Class: FacturX::AllowanceCharge
- Inherits:
-
Object
- Object
- FacturX::AllowanceCharge
- Defined in:
- lib/factur_x/allowance_charge.rb
Overview
A document level allowance (BG-20) or charge (BG-21).
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#basis_amount ⇒ Object
readonly
Returns the value of attribute basis_amount.
-
#charge ⇒ Object
readonly
Returns the value of attribute charge.
-
#percentage ⇒ Object
readonly
Returns the value of attribute percentage.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#reason_code ⇒ Object
readonly
Returns the value of attribute reason_code.
-
#vat_category ⇒ Object
readonly
Returns the value of attribute vat_category.
-
#vat_rate ⇒ Object
readonly
Returns the value of attribute vat_rate.
Class Method Summary collapse
Instance Method Summary collapse
- #amount_decimal ⇒ Object
- #charge? ⇒ Boolean
-
#initialize(amount:, charge:, basis_amount: nil, percentage: nil, reason: nil, reason_code: nil, vat_category: Codes::VatCategory::STANDARD, vat_rate: nil) ⇒ AllowanceCharge
constructor
A new instance of AllowanceCharge.
Constructor Details
#initialize(amount:, charge:, basis_amount: nil, percentage: nil, reason: nil, reason_code: nil, vat_category: Codes::VatCategory::STANDARD, vat_rate: nil) ⇒ AllowanceCharge
Returns a new instance of AllowanceCharge.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/factur_x/allowance_charge.rb', line 11 def initialize(amount:, charge:, basis_amount: nil, percentage: nil, reason: nil, reason_code: nil, vat_category: Codes::VatCategory::STANDARD, vat_rate: nil) @amount = amount @charge = charge @basis_amount = basis_amount @percentage = percentage @reason = reason @reason_code = reason_code @vat_category = vat_category @vat_rate = vat_rate end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def amount @amount end |
#basis_amount ⇒ Object (readonly)
Returns the value of attribute basis_amount.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def basis_amount @basis_amount end |
#charge ⇒ Object (readonly)
Returns the value of attribute charge.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def charge @charge end |
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def percentage @percentage end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def reason @reason end |
#reason_code ⇒ Object (readonly)
Returns the value of attribute reason_code.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def reason_code @reason_code end |
#vat_category ⇒ Object (readonly)
Returns the value of attribute vat_category.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def vat_category @vat_category end |
#vat_rate ⇒ Object (readonly)
Returns the value of attribute vat_rate.
8 9 10 |
# File 'lib/factur_x/allowance_charge.rb', line 8 def vat_rate @vat_rate end |
Class Method Details
.allowance(**attributes) ⇒ Object
24 25 26 |
# File 'lib/factur_x/allowance_charge.rb', line 24 def self.allowance(**attributes) new(charge: false, **attributes) end |
.charge(**attributes) ⇒ Object
28 29 30 |
# File 'lib/factur_x/allowance_charge.rb', line 28 def self.charge(**attributes) new(charge: true, **attributes) end |
Instance Method Details
#amount_decimal ⇒ Object
36 37 38 |
# File 'lib/factur_x/allowance_charge.rb', line 36 def amount_decimal Formatting.decimal(amount) end |
#charge? ⇒ Boolean
32 33 34 |
# File 'lib/factur_x/allowance_charge.rb', line 32 def charge? charge end |