{
    "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 rlist_equates\r\n$insert lsl_users_equ\r\n\r\nopen 'DICT.QUOTE' to DictQuoteTable else\r\n   Void = msg( '', 'Unable to open DICT.QUOTE...' )\r\n   return 0\r\nend\r\nSearchStr = ''\r\nCustIds       = .customer_info->array<1>\r\nEntryDateFrom = .entry_date_from->text\r\nEntryDateThru = .entry_date_thru->text\r\nExpDateFrom   = .exp_date_from->text\r\nExpDateThru   = .exp_date_thru->text\r\nOpen          = .open_check->check\r\nExpired       = .expired_check->check\r\nUnsigned      = .unsigned_check->check\r\nEntryIds      = .entry_ids->array<1>\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 CustIds[-1,1] = ''\r\nif CustIds then\r\n    SearchStr<-1> = 'CUST_NO':@vm:CustIds\r\nend \r\nif EntryDateFrom then\r\n    SearchStr<-1> = 'ENTRY_DATE':@vm:'>=':EntryDateFrom\r\nend\r\nif EntryDateThru then\r\n    SearchStr<-1> = 'ENTRY_DATE':@vm:'<=':EntryDateThru\r\nend\r\nif ExpDateFrom then\r\n    SearchStr<-1> = 'EXP_DATE':@vm:'>=':ExpDateFrom\r\nend\r\nif ExpDateThru then\r\n    SearchStr<-1> = 'EXP_DATE':@vm:'<=':ExpDateThru\r\nend\r\nStatusVar = ''\r\nif Open then\r\n    StatusVar<1,-1> = 'O'\r\nend\r\nif Expired then\r\n    StatusVar<1,-1> = 'E'\r\nend\r\nif Unsigned then\r\n    StatusVar<1,-1> = 'U'\r\nend\r\nif StatusVar then\r\n   SearchStr<-1> = 'STATUS':@vm:StatusVar\r\nend\r\nListId = 'QUOTE1.RPT*':@station\r\nCallLine = ''\r\nif SearchStr then\r\n    * do a btree.extract\r\n    SearchStr := @fm\r\n    Void = utility( 'CURSOR', 'H' )\r\n    btree.extract( SearchStr, 'QUOTE', DictQuoteTable, Keys, '', Flag )\r\n    if Flag <> 0 then\r\n       Void = msg( '', 'Error while extracting QUOTE records...' )\r\n       return 0\r\n    end\r\n    if Keys then\r\n       convert @vm to @fm in Keys\r\n       open 'SYSLISTS' to SysListsTable else\r\n           Void = msg( '', 'Unable to open SYSLISTS...' )\r\n           return 0\r\n       end\r\n       Keys = key_sort( Keys, 'QUOTE', 'CUST_NAME':@fm:'ENTRY_DATE', 1 )\r\n\r\n       write Keys on SysListsTable, ListId else\r\n           Void = msg( '', 'Error while writing keys on SYSLISTS ':ListId:'...' )\r\n           return 0\r\n       end\r\n       gosub CallReport\r\n    end else\r\n       Void = msg( '', 'No records found for meeting your criteria...' )\r\n    end\r\n    Void = utility( 'CURSOR', 'A' )\r\nend else\r\n    * do a select on whole table\r\n    rlist( 'SELECT QUOTE BY CUST_NAME BY ENTRY_DATE', target_savelist$, ListId, '', '' )\r\n    gosub CallReport\r\nend\r\nend_dialog( @window, '' )\r\nreturn 0\r\n\r\n*===========================================================================*\r\nCallReport:\r\n    if .send_to_printer->text = 'Yes' then\r\n        Pparam = '/PR=1'\r\n    end else\r\n        Pparam = '/PV=1'\r\n    end\r\n    Password = xlate( 'LSL_USERS', @user4, lsl_users_password$, 'X' )\r\n    CallLine = 'REPORTER.EXE /RP=QUOTE1.RPT /AP=':@appid<1>:' /UN=':@user4:' /PW=':Password:' /QU=1 ':PParam\r\n    Stat = utility( 'RUNWIN', CallLine )\r\nreturn\r\n\r\n*===========================================================================*\r\n"
        }
    }
}