Module: EasyInvoices::Base
- Defined in:
- lib/easy_invoices/base.rb
Constant Summary collapse
- DIGIT_RUBLEJ =
{ always_show_fraction: true, fraction_formatter: '%.2d', integrals_delimiter: ' ' }
Instance Method Summary collapse
- #generate_act(options = {}) ⇒ Object
- #generate_invoice(options = {}) ⇒ Object
- #generate_with(kind, options = {}) ⇒ Object
Instance Method Details
#generate_act(options = {}) ⇒ Object
6 7 8 |
# File 'lib/easy_invoices/base.rb', line 6 def generate_act( = {}) generate_with(:act, ) end |
#generate_invoice(options = {}) ⇒ Object
10 11 12 |
# File 'lib/easy_invoices/base.rb', line 10 def generate_invoice( = {}) generate_with(:invoice, ) end |
#generate_with(kind, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/easy_invoices/base.rb', line 14 def generate_with(kind, = {}) begin (kind) check_document_data_method_existing generate_params_hash(kind, ) calculate_act_total_sum file = "EasyInvoices::#{kind.to_s.classify}".constantize.generate(@params_hash, [:file_name]) [:success_callback].call(file) if .dig(:success_callback) return { result: :success, file: file } rescue => e puts e. [:error_callback].call(file) if .dig(:error_callback) return { result: :error, error_message: e. } end end |