mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Added Estimate date
This commit is contained in:
@@ -62,5 +62,35 @@ class QboEstimate < ActiveRecord::Base
|
|||||||
estimate = base.fetch_by_id(id)
|
estimate = base.fetch_by_id(id)
|
||||||
return base.pdf(estimate)
|
return base.pdf(estimate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Magic Method
|
||||||
|
# Maps Get/Set methods to QBO estimate object
|
||||||
|
def method_missing(sym, *arguments)
|
||||||
|
# Check to see if the method exists
|
||||||
|
if Quickbooks::Model::Estimate.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(:estimate).fetch_by_id(self.id)
|
||||||
|
rescue Exception => e
|
||||||
|
@details = Quickbooks::Model::Estimate.new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<% @customer.qbo_estimates.each do |estimate| %>
|
<% @customer.qbo_estimates.each do |estimate| %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<b><%= link_to "##{estimate.doc_number}", estimate_path(estimate), target: :_blank %> </b>
|
<b><%= link_to "##{estimate.doc_number}", estimate_path(estimate), target: :_blank %></b> <%= estimate.txn_date %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user