Class: Dolibarr::Invoice

Inherits:
Record
  • Object
show all
Defined in:
lib/dolibarr/invoice.rb

Overview

A customer invoice. Amounts are BigDecimal; every other field stays reachable via Record#raw / Record#[].

Instance Attribute Summary

Attributes inherited from Record

#raw

Instance Method Summary collapse

Methods inherited from Record

#==, #[], from, #hash, #id, #initialize, #to_h

Constructor Details

This class inherits a constructor from Dolibarr::Record

Instance Method Details

#paid?Boolean

Returns whether Dolibarr flags the invoice as paid (paye == 1).

Returns:

  • (Boolean)

    whether Dolibarr flags the invoice as paid (paye == 1)



38
39
40
# File 'lib/dolibarr/invoice.rb', line 38

def paid?
  self['paye'].to_s == '1'
end

#refString?

Returns the invoice reference (e.g. "FA2601-0007").

Returns:

  • (String, nil)

    the invoice reference (e.g. "FA2601-0007")



8
9
10
# File 'lib/dolibarr/invoice.rb', line 8

def ref
  self['ref']
end

#remaining_to_payBigDecimal?

Returns amount still due.

Returns:

  • (BigDecimal, nil)

    amount still due



33
34
35
# File 'lib/dolibarr/invoice.rb', line 33

def remaining_to_pay
  self['remaintopay']
end

#socidString?

Returns the thirdparty (customer) id.

Returns:

  • (String, nil)

    the thirdparty (customer) id



13
14
15
# File 'lib/dolibarr/invoice.rb', line 13

def socid
  self['socid']
end

#total_htBigDecimal?

Returns total excluding tax.

Returns:

  • (BigDecimal, nil)

    total excluding tax



18
19
20
# File 'lib/dolibarr/invoice.rb', line 18

def total_ht
  self['total_ht']
end

#total_ttcBigDecimal?

Returns total including tax.

Returns:

  • (BigDecimal, nil)

    total including tax



28
29
30
# File 'lib/dolibarr/invoice.rb', line 28

def total_ttc
  self['total_ttc']
end

#total_tvaBigDecimal?

Returns total tax.

Returns:

  • (BigDecimal, nil)

    total tax



23
24
25
# File 'lib/dolibarr/invoice.rb', line 23

def total_tva
  self['total_tva']
end