Files
open-insight/LSL2/OIEVENT/CLICK/CUST_INQUIRY_QUERY.PERFORM_QUERY_BUTTON.json
2024-03-25 15:12:53 -07:00

11 lines
3.6 KiB
JSON

{
"header": {
"version": 1,
"type": "record"
},
"body": {
"record1": {
"<1>": "declare subroutine btree.extract, update_index, rlist, end_dialog\r\ndeclare function msg, key_sort, utility\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nopen 'DICT.CUST_INQUIRY' to DictCustInqTable else\r\n Void = msg( '', 'Unable to open DICT.CUST_INQUIRY...' )\r\n return 0\r\nend\r\nSearchStr = ''\r\nCustIds = .customer_info->array<1>\r\nInqDateFrom = .inquiry_date_from->text\r\nInqDateThru = .inquiry_date_thru->text\r\nReqDateFrom = .req_del_date_from->text\r\nReqDateThru = .req_del_date_thru->text\r\nEntryIds = .entry_ids->array<1>\r\n\r\n* inquiry status variables\r\nOpen = .open_check->check\r\nRTQ = .rtq_check->check\r\nDeclined = .declined_check->check\r\n* end of inquiry status variables\r\n\r\n* review status variables\r\nAccept = .accept_check->check\r\nAcceptExcept = .accept_except_check->check\r\nNotAccept = .not_accept_check->check\r\n* end of review status variables\r\n\r\nswap @vm:@vm with '' in CustIds\r\nif CustIds[-1,1] = @vm then CustIds[-1,1] = ''\r\nswap @vm:@vm with '' in EntryIds\r\nif EntryIds[-1,1] = @vm then EntryIds[-1,1] = ''\r\nif CustIds then\r\n SearchStr<-1> = 'CUST_ID':@vm:CustIds\r\nend\r\nif InqDateFrom and InqDateThru then\r\n SearchStr<-1> = 'INQUIRY_DATE':@vm:InqDateFrom:'...':InqDateThru\r\nend else\r\n\tif InqDateFrom then\r\n\t SearchStr<-1> = 'INQUIRY_DATE':@vm:'>=':InqDateFrom\r\n\tend\r\n\tif InqDateThru then\r\n\t SearchStr<-1> = 'INQUIRY_DATE':@vm:'<=':InqDateThru\r\n\tend \r\nend\r\nif ReqDateFrom and ReqDateThru then\r\n\tSearchStr<-1> = 'REQ_DELIVERY_DATE':@vm:ReqDateFrom:'...':ReqDateThru\r\nend else\r\n\tif ReqDateFrom then\r\n\t SearchStr<-1> = 'REQ_DELIVERY_DATE':@vm:'>=':ReqDateFrom\r\n\tend\r\n\tif ReqDateThru then\r\n\t SearchStr<-1> = 'REQ_DELIVERY_DATE':@vm:'<=':ReqDateThru\r\n\tend\r\nend\r\nif EntryIds then\r\n SearchStr<-1> = 'ENTRY_ID':@vm:EntryIds\r\nend\r\n\r\n* inquiry status\r\nInqStatusVar = ''\r\nif Open then\r\n InqStatusVar<1,-1> = 'O'\r\nend\r\nif RTQ then\r\n InqStatusVar<1,-1> = 'R'\r\nend\r\nif Declined then\r\n InqStatusVar<1,-1> = 'D'\r\nend\r\nif InqStatusVar then\r\n SearchStr<-1> = 'STATUS':@vm:InqStatusVar\r\nend\r\n\r\n* review status\r\nRevStatusVar = ''\r\nif Accept then\r\n RevStatusVar<1,-1> = 'A'\r\nend\r\nif AcceptExcept then\r\n RevStatusVar<1,-1> = 'E'\r\nend\r\nif NotAccept then\r\n RevStatusVar<1,-1> = 'N'\r\nend\r\nif RevStatusVar then\r\n SearchStr<-1> = 'REVIEW_STATUS':@vm:RevStatusVar\r\nend\r\n*\r\n\r\nif SearchStr then\r\n SearchStr := @fm\r\n Void = utility( 'CURSOR', 'H' )\r\n * do a btree.extract\r\n btree.extract( SearchStr, 'CUST_INQUIRY', DictCustInqTable, Keys, '', Flag )\r\n if Flag <> 0 then\r\n Void = msg( '', 'Error while extracting CUST_INQUIRY records...' )\r\n return 0\r\n end\r\n if Keys then\r\n convert @vm to @fm in Keys\r\n Keys = key_sort( Keys, 'CUST_INQUIRY', 'CUST_NAME':@fm:'#INQUIRY_DATE', 1 )\r\n end_dialog( @window, Keys )\r\n end else\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = 'No records found meeting your criteria...' \r\n MsgInfo<micon$> = '!'\r\n Void = msg( '', MsgInfo )\r\n end\r\n Void = utility( 'CURSOR', 'A' )\r\nend else\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = 'You have not entered any search criteria...' \r\n MsgInfo<micon$> = '!'\r\n Void = msg( '', MsgInfo )\r\nend\r\nreturn 0\r\n\r\n"
}
}
}