mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
Added Invoice date
This commit is contained in:
@@ -165,4 +165,34 @@ class QboInvoice < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
# Magic Method
|
||||
# Maps Get/Set methods to QBO invoice object
|
||||
def method_missing(sym, *arguments)
|
||||
# Check to see if the method exists
|
||||
if Quickbooks::Model::Invoice.method_defined?(sym)
|
||||
# download details if required
|
||||
pull unless @details
|
||||
method_name = sym.to_s
|
||||
# Setter
|
||||
if method_name[-1, 1] == "="
|
||||
@details.method(method_name).call(arguments[0])
|
||||
# Getter
|
||||
else
|
||||
return @details.method(method_name).call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# pull the details
|
||||
def pull
|
||||
begin
|
||||
raise Exception unless self.id
|
||||
@details = Qbo.get_base(:invoice).fetch_by_id(self.id)
|
||||
rescue Exception => e
|
||||
@details = Quickbooks::Model::Invoice.new
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<% @customer.qbo_invoices.each do |invoice| %>
|
||||
<div class="row">
|
||||
<b><%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %> </b>
|
||||
<b><%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %></b> <%= invoice.txn_date %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user