tag = 'MOA' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::MOA) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 3, dictionary: nil, description: "Message Header", required: true ) tag.add(:tag, data) structure << tag #============================================================================== # Monetary Amount #============================================================================== monetary_amount = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '8' => { description: 'Allowance or charge amount', identifier: 'allowance_or_charge_amount' }, '9' => { description: 'Amount due/amount payable', identifier: 'amount_due_amount_payable' }, '21' => { description: 'Cash discount', identifier: 'cash_discount' }, '23' => { description: 'Charge amount', identifier: 'charge_amount' }, '25' => { description: 'Charge/allowance bias', identifier: 'charge_allowance_bias' }, '52' => { description: 'Discount amount', identifier: 'discount_amount' }, '53' => { description: 'Discount amount due', identifier: 'discount_amount_due' }, '77' => { description: 'Invoice amount', identifier: 'invoice_amount' }, '79' => { description: 'Total line items amount', identifier: 'total_line_items_amount' }, '86' => { description: 'Message total monetary amount', identifier: 'message_total_monetary_amount' }, '113' => { description: 'Prepaid amount', identifier: 'prepaid_amount' }, '124' => { description: 'Tax amount', identifier: 'tax_amount' }, '125' => { description: 'Taxable amount', identifier: 'taxable_amount' }, '129' => { description: 'Total amount subject to payment discount', identifier: 'total_amount_subject_to_payment_discount' }, '131' => { description: 'Total charge/allowances', identifier: 'total_charge_allowances' }, '165' => { description: 'Adjustment amount', identifier: 'adjustment_amount' }, '176' => { description: 'Message total duty/tax/fee amount', identifier: 'message_total_duty_tax_fee_amount' }, '201' => { description: 'Penalty amount', identifier: 'penalty_amount' }, '203' => { description: 'Line item amount', identifier: 'line_item_amount' }, '204' => { description: 'Allowance amount', identifier: 'allowance_amount' }, '210' => { description: 'Credit note amount', identifier: 'credit_note_amount' }, '227' => { description: 'Deposit', identifier: 'deposit' }, '236' => { description: 'Amount subject to price adjustment', identifier: 'amount_subject_to_price_adjustment' }, '286' => { description: 'Administration charge', identifier: 'administration_charge' }, '369' => { description: 'Goods and services tax', identifier: 'goods_and_services_tax' }, '388' => { description: 'Total amount including Value Added Tax (VAT)', identifier: 'total_amount_including_value_added_tax_vat' }, '396' => { description: 'Total price subsidy value', identifier: 'total_price_subsidy_value' }, '400' => { description: 'Rebate amount', identifier: 'rebate_amount' }, '402' => { description: 'Total retail value', identifier: 'total_retail_value' }, '496' => { description: 'Total returnable packages deposit amount', identifier: 'total_returnable_packages_deposit_amount' }, '507' => { description: 'Net-progress payment amount', identifier: 'net_progress_payment_amount' }, '528' => { description: 'Calculation basis excluding all taxes', identifier: 'calculation_basis_excluding_all_taxes' }, '529' => { description: 'Calculation basis which includes all taxes except VAT', identifier: 'calculation_basis_which_includes_all_taxes_except_vat' }, 'X41' => { description: 'Total returnable items rental fee amount', identifier: 'total_returnable_items_rental_fee_amount' }, 'X42' => { description: 'Rental fee (GS1 Temporary Code)', identifier: 'rental_fee_gs1_temporary_code' } }, description: "Monetary amount type code qualifier", required: true ) monetary_amount.add(:monetary_amount_type_code_qualifier, data) data = Eancom::Edifact::Data.new( type: String, length: 0..35, dictionary: nil, description: "Monetary amount", required: true ) monetary_amount.add(:monetary_amount, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: "Currency identification code", required: false ) monetary_amount.add(:currency_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '4' => { description: 'Invoicing currency', identifier: 'invoicing_currency' }, '10' => { description: 'Pricing currency', identifier: 'pricing_currency' }, '11' => { description: 'Payment currency', identifier: 'payment_currency' }, '13' => { description: 'Recipient local currency', identifier: 'recipient_local_currency' }, '15' => { description: 'Sender local currency', identifier: 'sender_local_currency' }, '18' => { description: 'Tax currency', identifier: 'tax_currency' } }, description: "Currency type code qualifier", required: false ) monetary_amount.add(:currency_type_code_qualifier, data) structure << monetary_amount #============================================================================== Eancom.register_structure(tag: 'MOA', structure: structure)