tag = 'ALC' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::ALC) 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 #============================================================================== # Allowance or Charge code qualifier #============================================================================== allowance_or_charge_code_qualifier = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'A' => { description: 'Allowance', identifier: 'allowance' }, 'C' => { description: 'Charge', identifier: 'charge' }, }, description: "Allowance or Charge code qualifier", required: true ) allowance_or_charge_code_qualifier.add(:allowance_or_charge_code_qualifier, data) structure << allowance_or_charge_code_qualifier #============================================================================== # Allowance/Charge information #============================================================================== allowance_charge_information = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 0..35, dictionary: nil, description: "Allowance or charge identifier", required: false ) allowance_charge_information.add(:allowance_or_charge_identifier, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '64' =>{ description: 'Special agreement', identifier: 'special_agreement', }, '69' =>{ description: 'Charge for a customer specific finish', identifier: 'charge_for_a_customer_specific_finisch', }, '64E' =>{ description: 'Yearly turnover allowance/charge', identifier: 'yearly_turnover_allowance_charge', }, }, description: "Allowance or charge identification code", required: false ) allowance_charge_information.add(:allowance_or_charge_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '1' => { description: 'Bill back', identifier: 'bill_back', }, '2' => { description: 'Off invoice', identifier: 'off_invoice', }, '5' => { description: 'Charge to be paid by vendor', identifier: 'charge_to_be_paid_by_vendor', }, '6' => { description: 'Charge to be paid by customer', identifier: 'charge_to_be_paid_by_customer', }, }, description: "Settlement mean code", required: false ) allowance_charge_information.add(:settlement_mean_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '1' => { description: 'First step of calculation', identifier: 'first_step_of_calculation', }, '2' => { description: 'Second step of calculation', identifier: 'second_step_of_calculation', }, '3' => { description: 'Third step of calculation', identifier: 'third_step_of_calculation', }, '4' => { description: 'Forth step of calculation', identifier: 'forth_step_of_calculation', }, '5' => { description: 'Fith step of calculation', identifier: 'fith_step_of_calculation', }, '6' => { description: 'Sixth step of calculation', identifier: 'sixth_step_of_calculation', }, '7' => { description: 'Seventh step of calculation', identifier: 'seventh_step_of_calculation', }, '8' => { description: 'Eighth step of calculation', identifier: 'eighth_step_of_calculation', }, '9' => { description: 'Ninth step of calculation', identifier: 'ninth_step_of_calculation', }, }, description: "Calculation sequence code", required: false ) allowance_charge_information.add(:calculation_sequence_code, data) structure << allowance_charge_information #============================================================================== # Special Services identification #============================================================================== special_services_identification = Eancom::Edifact::Composite.new() data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { 'AJ' => { description: 'Adjustments', identifier: 'adjustments' }, 'CAC' => { description: 'Cash Discount', identifier: 'cash_discount' }, 'AEK' => { description: 'Cash on delivery service', identifier: 'cash_on_delivery_service' }, 'EAB' => { description: 'Early payment allowance', identifier: 'early_payment_allowance' }, 'FC' => { description: 'Freight charge', identifier: 'freght_charge' }, 'FI' => { description: 'Finance charge', identifier: 'finance_charge' }, 'HD' => { description: 'Handling', identifier: 'handling' }, 'QD' => { description: 'Quantity discount', identifier: 'quantity_discount' }, 'X40' => { description: 'Allowance/charge regulated by law', identifier: 'allowance_charge_regulated_by_law' }, }, description: "Special service description_code", required: false ) special_services_identification.add(:special_service_description_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..17, description: "Code list identification code", required: false ) special_services_identification.add(:code_list_identification_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: { '9' => { description: 'GS1', identifier: 'gs1' } }, description: "Code list responsible agency code", required: false ) special_services_identification.add(:code_list_responsible_agency_code, data) data = Eancom::Edifact::Data.new( type: String, length: 0..3, dictionary: nil, description: "Special service description", required: false ) special_services_identification.add(:special_service_description_1, data) special_services_identification.add(:special_service_description_2, data) structure << special_services_identification #============================================================================== Eancom.register_structure(tag: 'ALC', structure: structure)