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

11 lines
2.7 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, ex_vm_rem\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nopen 'DICT.COMPANY' to DictCompanyTable else\r\n Void = msg( '', 'Unable to open DICT.COMPANY...' )\r\n return 0\r\nend\r\nSearchStr = ''\r\nCountries = ex_vm_rem( .countries->array )\r\nCities = ex_vm_rem( .cities->array )\r\nEntryDateFrom = .entry_date_from->text\r\nEntryDateThru = .entry_date_thru->text\r\nCustCheck = .cust_check->check\r\nVendCheck = .vend_check->check\r\nOtherCheck = .other_check->check\r\nCategory = .category->text\r\n* need to convert field to value markers as the text property will \r\n* be field mark delimited if more than one is choosen\r\nconvert @fm to @vm in Category\r\n\r\nSearchStr = ''\r\nif Category <> '' then\r\n SearchStr<-1> = 'CATEGORY':@vm:Category\r\nend\r\nif Countries <> '' then\r\n SearchStr<-1> = 'COUNTRY':@vm:Countries\r\nend\r\nif Cities <> '' then\r\n SearchStr<-1> = 'CITY':@vm:Cities\r\nend\r\nCategoryVal = ''\r\nif CustCheck then\r\n CategoryVal<1,-1> = 'C'\r\nend\r\nif VendCheck then\r\n CategoryVal<1,-1> = 'V'\r\nend\r\nif OtherCheck then\r\n CategoryVal<1,-1> = 'O' \r\nend\r\nif CategoryVal <> '' then\r\n SearchStr<-1> = 'CO_TYPE':@vm:CategoryVal\r\nend\r\nif EntryDateFrom and EntryDateThru then\r\n SearchStr<-1> = 'ENTRY_DATE':@vm:EntryDateFrom:'...':EntryDateThru\r\nend else\r\n\tif EntryDateFrom then\r\n\t SearchStr<-1> = 'ENTRY_DATE':@vm:'>=':EntryDateFrom\r\n\tend\r\n\tif EntryDateThru then\r\n\t SearchStr<-1> = 'ENTRY_DATE':@vm:'<=':EntryDateThru\r\n\tend\r\nend\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, 'COMPANY', DictCompanyTable, Keys, '', Flag )\r\n if Flag <> 0 then\r\n Void = msg( '', 'Error while extracting COMPANY 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, 'COMPANY', 'CO_NAME', 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"
}
}
}