class Economic::CurrentInvoiceLine

Represents a current invoice line.

API documentation: www.e-conomic.com/apidocs/Documentation/T_Economic_Api_ICurrentInvoiceLine.html

See Economic::CurrentInvoice for usage example

Public Instance Methods

handle() click to toggle source
# File lib/economic/current_invoice_line.rb, line 34
def handle
  @handle || Handle.build(:number => number)
end
invoice() click to toggle source
# File lib/economic/current_invoice_line.rb, line 38
def invoice
  return nil if invoice_handle.blank?
  @invoice ||= session.current_invoices.find(invoice_handle)
end
invoice=(invoice) click to toggle source
# File lib/economic/current_invoice_line.rb, line 43
def invoice=(invoice)
  self.invoice_handle = invoice.handle
  @invoice = invoice
end
invoice_handle=(handle) click to toggle source
# File lib/economic/current_invoice_line.rb, line 48
def invoice_handle=(handle)
  @invoice = nil unless handle == @invoice_handle
  @invoice_handle = handle
end

Protected Instance Methods

fields() click to toggle source
# File lib/economic/current_invoice_line.rb, line 55
def fields
  to_hash = proc { |h| h.to_hash }
  [
    ["Number", :number, proc { 0 }, :required], # Doesn't seem to be used
    ["InvoiceHandle", :invoice_handle, to_hash],
    ["Description", :description],
    ["DeliveryDate", :delivery_date, nil, :required],
    ["UnitHandle", :unit_handle, to_hash],
    ["ProductHandle", :product_handle, to_hash],
    ["Quantity", :quantity],
    ["UnitNetPrice", :unit_net_price],
    ["DiscountAsPercent", :discount_as_percent],
    ["UnitCostPrice", :unit_cost_price],
    ["TotalNetAmount", :total_net_amount, nil, :required],
    ["TotalMargin", :total_margin],
    ["MarginAsPercent", :margin_as_percent]
  ]
end