Module: Dorsale::BillingMachine

Defined in:
app/models/dorsale/billing_machine.rb

Defined Under Namespace

Modules: ApplicationHelper, IdCardPolicyHelper, InvoicePolicyHelper, PaymentTermPolicyHelper, QuotationPdfCommonMethods, QuotationPolicyHelper Classes: ApplicationController, IdCard, IdCardsController, Invoice, InvoiceLine, InvoiceMailer, InvoiceMultipleVatPdf, InvoiceSingleVatPdf, InvoicesController, PaymentTerm, PaymentTermsController, PdfFileGenerator, Quotation, QuotationLine, QuotationMultipleVatPdf, QuotationSingleVatPdf, QuotationsController

Constant Summary collapse

DEFAULT_VAT_RATE =
20.00

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_currencyObject

Returns the value of attribute default_currency.



26
27
28
# File 'app/models/dorsale/billing_machine.rb', line 26

def default_currency
  @default_currency
end

Class Method Details

.invoice_pdf_modelObject



18
19
20
# File 'app/models/dorsale/billing_machine.rb', line 18

def invoice_pdf_model
  "::Dorsale::BillingMachine::Invoice#{vat_mode.to_s.capitalize}VatPdf".constantize
end

.quotation_pdf_modelObject



22
23
24
# File 'app/models/dorsale/billing_machine.rb', line 22

def quotation_pdf_model
  "::Dorsale::BillingMachine::Quotation#{vat_mode.to_s.capitalize}VatPdf".constantize
end

.vat_modeObject



9
10
11
# File 'app/models/dorsale/billing_machine.rb', line 9

def vat_mode
  @vat_mode ||= :single
end

.vat_mode=(new_mode) ⇒ Object



13
14
15
16
# File 'app/models/dorsale/billing_machine.rb', line 13

def vat_mode=(new_mode)
  raise "invalid mode #{new_mode}" unless vat_modes.include?(new_mode)
  @vat_mode = new_mode
end

.vat_modesObject



5
6
7
# File 'app/models/dorsale/billing_machine.rb', line 5

def vat_modes
  [:single, :multiple]
end