Class: Beanie::SalesInvoice

Inherits:
Api
  • Object
show all
Defined in:
lib/beanie/sales_invoice.rb

Constant Summary collapse

STATE_NEW =
0
STATE_POSTED =
1
STATE_SENT =
2
STATE_PAID =
3
STATE_CANCELLED =
4
STATE_OVERDUE1 =
5
STATE_OVERDUE2 =
6
STATE_OVERDUE3 =
7
STATE_OVERDUE4 =
8
STATE_OVERDUE5 =
9
STATE_NAMES =
[
  ["New (Unposted)", STATE_NEW],
  ["Posted to Journal", STATE_POSTED],
  ["Sent to Customer", STATE_SENT],
  ["Paid", STATE_PAID],
  ["Cancelled", STATE_CANCELLED],
  ["Overdue (Past 30 days)", STATE_OVERDUE1],
  ["Overdue (Past 45 days)", STATE_OVERDUE2],
  ["Overdue (Over 60 days)", STATE_OVERDUE3],
  ["Overdue (Over 90 days)", STATE_OVERDUE4],
  ["Overdue (Over 120 days)", STATE_OVERDUE5]
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Api

all, build_url, #construct_path, delete, #extract, #field_name, find, get, #object_name, #populate, post, put, #save!, set_headers

Constructor Details

#initializeSalesInvoice

Initialize instance variables



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/beanie/sales_invoice.rb', line 61

def initialize
  @id = nil
  @date = nil
  @due_date = nil
  @number = nil
  @is_credit_note = nil
  @local_gross = nil
  @shipping = nil
  @sub_total = nil
  @tax = nil
  @tax_point = nil
  @sales_order_id = nil
  @original_invoice = nil
  @state = nil
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def date
  @date
end

#due_dateObject

Returns the value of attribute due_date.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def due_date
  @due_date
end

#idObject

Returns the value of attribute id.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def id
  @id
end

#is_credit_noteObject

Returns the value of attribute is_credit_note.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def is_credit_note
  @is_credit_note
end

#local_grossObject

Returns the value of attribute local_gross.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def local_gross
  @local_gross
end

#numberObject

Returns the value of attribute number.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def number
  @number
end

#original_invoiceObject

Returns the value of attribute original_invoice.



33
34
35
# File 'lib/beanie/sales_invoice.rb', line 33

def original_invoice
  @original_invoice
end

#sales_order_idObject

Returns the value of attribute sales_order_id.



33
34
35
# File 'lib/beanie/sales_invoice.rb', line 33

def sales_order_id
  @sales_order_id
end

#shippingObject

Returns the value of attribute shipping.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def shipping
  @shipping
end

#stateObject

Returns the value of attribute state.



33
34
35
# File 'lib/beanie/sales_invoice.rb', line 33

def state
  @state
end

#sub_totalObject

Returns the value of attribute sub_total.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def sub_total
  @sub_total
end

#taxObject

Returns the value of attribute tax.



32
33
34
# File 'lib/beanie/sales_invoice.rb', line 32

def tax
  @tax
end

#tax_pointObject

Returns the value of attribute tax_point.



33
34
35
# File 'lib/beanie/sales_invoice.rb', line 33

def tax_point
  @tax_point
end

Instance Method Details

#state_nameObject

Show the state in a useful format



79
80
81
# File 'lib/beanie/sales_invoice.rb', line 79

def state_name
  STATE_NAMES[self.state][0]
end