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' }, '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' }, '203' => { description: 'Line item amount', identifier: 'line_item_amount' }, '396' => { description: 'Total price subsidy value', identifier: 'total_price_subsidy_value' }, '402' => { description: 'Total retail value', identifier: 'total_retail_value' }, '507' => { description: 'Net-progress payment amount', identifier: 'net_progress_payment_amount' }, '528' => { description: 'Calculation basis excluding all taxes', identifier: 'calculation_basis_excluding_all_taxes' }, }, 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: { '13' => { description: 'Recipient local currency', identifier: 'recipient_local_currency' }, '15' => { description: 'Sender local currency', identifier: 'sender_local_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)