Files
open-insight/LSL2/OIEVENT/CLICK/SCHEDULE_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.SCHEDULE' to DictScheduleTable else\r\n Void = msg( '', 'Unable to open DICT.SCHEDULE...' )\r\n return 0\r\nend\r\nSearchStr = ''\r\nCustIds = .customer_info->array<1>\r\n*EntryDateFrom = .entry_date_from->text\r\n*EntryDateThru = .entry_date_thru->text\r\nOpen = .open_check->check\r\nClosed = .closed_check->check\r\n*EntryIds = .entry_ids->array<1>\r\nWo = .wo->array\r\nPo = .po->array\r\nLotNum = .lot_num->array\r\nPartNum = .part_num->array\r\n*QuoteNos = .quote_nos->array\r\n*OrderNos = .order_nos->array\r\n*InvoiceNos = .invoice_nos->array\r\nswap @vm:@vm with '' in Wo\r\nif Wo[-1,1] = @vm then Wo[-1,1] = ''\r\nswap @vm:@vm with '' in Po\r\nif Po[-1,1] = @vm then Po[-1,1] = ''\r\nswap @vm:@vm with '' in LotNum\r\nif LotNum[-1,1] = @vm then LotNum[-1,1] = ''\r\nswap @vm:@vm with '' in PartNum\r\nif PartNum[-1,1] = @vm then PartNum[-1,1] = ''\r\nswap @vm:@vm with '' in CustIds\r\nif CustIds[-1,1] = @vm then CustIds[-1,1] = ''\r\n*swap @vm:@vm with '' in EntryIds\r\n*if EntryIds[-1,1] = @vm then EntryIds[-1,1] = ''\r\n*swap @vm:@vm with '' in QuoteNos\r\n*if QuoteNos[-1,1] = @vm then QuoteNos[-1,1] = ''\r\n*swap @vm:@vm with '' in OrderNos\r\n*if OrderNos[-1,1] = @vm then OrderNos[-1,1] = ''\r\n*swap @vm:@vm with '' in InvoiceNos\r\n*if InvoiceNos[-1,1] = @vm then InvoiceNos[-1,1] = ''\r\nif CustIds then\r\n SearchStr<-1> = 'CUST_NO':@vm:CustIds\r\nend \r\n*if EntryDateFrom then\r\n* SearchStr<-1> = 'ENTRY_DATE':@vm:'>=':EntryDateFrom\r\n*end\r\n*if EntryDateThru then\r\n* SearchStr<-1> = 'ENTRY_DATE':@vm:'<=':EntryDateThru\r\n*end\r\n*if EntryIds then\r\n* SearchStr<-1> = 'ENTRY_ID':@vm:EntryIds\r\n*end\r\nStatusVar = ''\r\nif Open then\r\n StatusVar<1,-1> = 'O'\r\nend\r\nif Closed then\r\n StatusVar<1,-1> = 'C'\r\nend\r\nif StatusVar then\r\n SearchStr<-1> = 'STATUS':@vm:StatusVar\r\nend\r\nif Wo then\r\n SearchStr<-1> = 'WO':@vm:Wo\r\nend\r\nif Po then\r\n SearchStr<-1> = 'PO':@VM:Po\r\nend\r\nif LotNum then\r\n SearchStr<-1> = 'LOT_NUM':@vm:LotNum\r\nend\r\nif PartNum then\r\n SearchStr<-1> = 'PART_NUM':@vm:PartNum\r\nend\r\n*if QuoteNos then\r\n* SearchStr<-1> = 'QUOTE_NUM':@vm:QuoteNos\r\n*end\r\n*if OrderNos then\r\n* SearchStr<-1> = 'ORDER_NO':@vm:OrderNos\r\n*end\r\n*if InvoiceNos then\r\n* SearchStr<-1> = 'INVOICE_IDS':@vm:InvoiceNos\r\n*end\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, 'SCHEDULE', DictScheduleTable, Keys, '', Flag )\r\n if Flag <> 0 then\r\n Void = msg( '', 'Error while extracting SCHEDULE 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, 'SCHEDULE', 'CUST_NAME':@fm:'WO':@fm:'ORDER_LINE', 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"
}
}
}