tag = 'PAT' Eancom.register_segment(tag: tag, klass: Eancom::Edifact::PAT) structure = Eancom::Edifact::Structure.new(tag: tag) #============================================================================== # Tag # #============================================================================== tag = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: nil, description: 'Message Header', required: true ) tag.add(:tag, data) structure << tag payment_terms_type_code_qualifier = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '1' => { description: 'Basic', identifier: 'basic' }, '2' => { description: 'End of month', identifier: 'end_of_month' }, '3' => { description: 'Fixed date', identifier: 'fixed_date' }, '4' => { description: 'Deferred', identifier: 'deferred' }, '5' => { description: 'Discount not applicable', identifier: 'discount_not_applicable' }, '6' => { description: 'Mixed', identifier: 'mixed' }, '7' => { description: 'Extended', identifier: 'extended' }, '8' => { desription: 'Basic discount offered', identifier: 'basic_discount_offered' }, '9' => { description: 'Proximo', identifier: 'proximo' }, '10' => { description: 'Instant', identifier: 'instant' }, '11' => { description: 'Elective', identifier: 'elective' }, '12' => { description: '10 days after end of month', identifier: '10_days_after_end_of_month' }, '18' => { description: 'Previously agreed upon', identifier: 'previously_agreed_upon' }, '20' => { description: 'Penalty terms', identifier: 'penalty_terms' }, '22' => { description: 'Discount', identifier: 'discount' }, '37' => { description: 'Complete payment', identifier: 'complete_payment' } }, description: 'Payment terms type code qualifier', required: true ) payment_terms_type_code_qualifier.add(:payment_terms_type_code_qualifier, data) structure << payment_terms_type_code_qualifier #============================================================================== # PAYMENT TERMS # #============================================================================== payment_terms_type_description_identifier = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..17, dictionary: { '1' => { description: 'Draft(s) drawn on issuing bank', identifier: 'drafts_drawn_on_issuing_bank' }, '2' => { description: 'Draft(s) drawn on advising bank', identifier: 'drafts_drawn_on_advising_bank' }, '3' => { description: 'Draft(s) drawn on reimbursing bank', identifier: 'drafts_drawn_on_reimbursing_bank' }, '4' => { description: 'Draft(s) drawn on applicant', identifier: 'drafts_drawn_on_applicant' }, '5' => { description: 'Draft(s) drawn on any other drawee', identifier: 'drafts_drawn_on_any_other_drawee' }, '6' => { description: 'No drafts', identifier: 'no_drafts' }, 'ZZZ' => { description: 'Mutually defined', identifier: 'mutually_defined' } }, description: 'Payment terms description identifier', required: true ) payment_terms_type_description_identifier.add(:payment_terms_type_description_identifier, data) structure << payment_terms_type_description_identifier #============================================================================== # TERMS/TIME INFORMATION # #============================================================================== time_reference_code = Eancom::Edifact::Composite.new data = Eancom::Edifact::Data.new( type: String, length: 1..3, dictionary: { '5' => { description: 'Date of invoice', identifier: 'date_of_invoice' }, '66' => { description: 'Specified date', identifier: 'specified_date' }, '69' => { description: 'Invoice transmission date', identifier: 'invoice_transmission_date' }, '81' => { description: 'Date of shipment as evidenced by the transport document(s)', identifier: 'date_of_shipment_as_evid_by_the_transp_docs' } }, description: 'Time reference code', required: true ) time_reference_code.add(:time_reference_code, data) structure << time_reference_code #============================================================================== Eancom.register_structure(tag: 'PAT', structure: structure)