Module: Edi204Helper
- Defined in:
- app/helpers/edi_204_helper.rb
Instance Method Summary collapse
- #check_record_exists_for_company(edi_204_b2_id) ⇒ Object
- #edi_204_exist_for_company(edi_204_b2_id) ⇒ Object
- #get_edi_204_counts_data(edi_204_b2_id) ⇒ Object
- #get_shipment_status_codes ⇒ Object
- #get_stops(edi_204_b2_id) ⇒ Object
- #get_time_zones ⇒ Object
Instance Method Details
#check_record_exists_for_company(edi_204_b2_id) ⇒ Object
6 7 8 |
# File 'app/helpers/edi_204_helper.rb', line 6 def check_record_exists_for_company(edi_204_b2_id) edi_204_exist_for_company(edi_204_b2_id).nil? end |
#edi_204_exist_for_company(edi_204_b2_id) ⇒ Object
2 3 4 |
# File 'app/helpers/edi_204_helper.rb', line 2 def edi_204_exist_for_company(edi_204_b2_id) Edi204.find_by(edi_204_b2_id: edi_204_b2_id, company_id: current_company_id) end |
#get_edi_204_counts_data(edi_204_b2_id) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/edi_204_helper.rb', line 31 def get_edi_204_counts_data(edi_204_b2_id) count_of_l11 = Edi204L11.where(edi_204_b2_id: edi_204_b2_id).count count_of_nte = Edi204Nte.where(edi_204_b2_id: edi_204_b2_id).count count_of_n1_name_address = Edi204N1NameAddress.where(edi_204_b2_id: edi_204_b2_id).count count_of_s5_oid = Edi204S5.where(edi_204_b2_id: edi_204_b2_id).count shipment_no = Edi204.where(edi_204_b2_id: edi_204_b2_id).pick(:shipment_no) count_of_990_load_tender_responses = Edi990LoadTenderResponses .joins('LEFT JOIN vw_edi_out_log ON vw_edi_out_log.document_ref_id = edi_990_load_tender_responses.edi_990_load_tender_response_id') .where(edi_204_b2_id: edi_204_b2_id) .where(vw_edi_out_log: { document_code: shipment_no.to_s }).count status_msg_214 = Edi214StatusMessage.where(edi_204_b2_id: edi_204_b2_id).count { edi_204_b2_id: edi_204_b2_id, count_of_l11: count_of_l11, count_of_nte: count_of_nte, count_of_n1_name_address: count_of_n1_name_address, count_of_s5_oid: count_of_s5_oid, count_of_990_load_tender_responses: count_of_990_load_tender_responses, shipment_no: shipment_no, status_msg_214: status_msg_214 } end |
#get_shipment_status_codes ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/helpers/edi_204_helper.rb', line 10 def get_shipment_status_codes TypesMaster.select(:type, :type_description, :description_french).where( element: 'SHIPMENT STATUS CODE', active: 1 ).as_json( methods: [:type_description] ) end |
#get_stops(edi_204_b2_id) ⇒ Object
26 27 28 29 |
# File 'app/helpers/edi_204_helper.rb', line 26 def get_stops(edi_204_b2_id) Edi204S5.select(:edi_204_s5_id, :stop_sequence, :entity_type_code, :entity_name) .where(edi_204_b2_id: edi_204_b2_id) end |
#get_time_zones ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/helpers/edi_204_helper.rb', line 18 def get_time_zones TypesMaster.select(:type, :type_description, :description_french).where( element: 'TIME ZONE', active: 1 ).as_json( methods: [:type_description] ) end |