open-insight/LSL2/STPROC/AC_RPT1.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

140 lines
4.1 KiB
Plaintext

compile function AC_RPT1()
begin condition
pre:
post:
end condition
declare function getprinterlist, getprofilestring, writeprofilestring, extdevicemode
declare function msg, set_property, send_event, dialog_box, utility, get_property
declare function set_printer, Printer_Select
declare subroutine rlist, or_view, activate_save_select, yield, ac_rpt1_prn
$insert rlist_equates
$insert msg_equates
Params = dialog_box( 'AC_RPT1', @window, '*CENTER' )
if Params = 'CANCEL' or Params = '' then
return 0
end
open 'SYSLISTS' to SysListsTable else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Unable to open SYSLISTS...'
Void = msg( '', MsgInfo )
return 0
end
ListsId = 'AC_RPT1*':@station
write '' on SysListsTable, ListsId else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Unable to clear SYSLISTS ':ListsId:'...'
Void = msg( '', MsgInfo )
return 0
end
convert '*' to @fm in Params
EntryDateFrom = Params<1>
EntryDateThru = Params<2>
Custs = Params<3>
Open = Params<4>
Closed = Params<5>
DirToPrinter = Params<6>
Stat = utility( 'CURSOR', 'H' )
Stmt = 'SELECT ANNUAL_CONTRACTS BY CUST_NAME'
RestStmt = ''
if EntryDateFrom and EntryDateThru then
RestStmt := ' WITH ENTRY_DATE FROM ':QUOTE(EntryDateFrom):' TO ':QUOTE(EntryDateThru)
end else
if EntryDateFrom then
RestStmt := " WITH ENTRY_DATE GE ":QUOTE(EntryDateFrom)
end
if EntryDateThru then
RestStmt := " WITH ENTRY_DATE LE ":QUOTE(EntryDateThru)
end
end
if Custs then
swap @vm with "' '" in Custs
Custs = "'":Custs:"'"
if RestStmt then
RestStmt := ' AND WITH CUST_NO = ':Custs
end else
RestStmt := ' WITH CUST_NO = ':Custs
end
end
if Open then
if RestStmt then
RestStmt := ' AND WITH STATUS = "O"'
end else
RestStmt := ' WITH STATUS = "O"'
end
end
if Closed then
if RestStmt then
RestStmt := ' AND WITH STATUS = "C"'
end else
RestStmt := ' WITH STATUS = "C"'
end
end
Stmt := RestStmt
rlist( Stmt, target_savelist$, ListsId, '', '' )
activate_save_select( ListsId )
if @reccount then
Cmd = "LIST ANNUAL_CONTRACTS JUSTLEN 4 CUST_NAME JUSTLEN 30 PO JUSTLEN 18 "
Cmd:= "STATUS JUSTLEN 6 TOT_CONTRACT_AMOUNT TOT_REL_AMOUNT BALANCE "
Cmd:= "HEADING ":'"':" Annual Contracts by Company 'D' 'T' PAGE # 'PPL'":'"'
if DirToPrinter = 'Yes' then
PrintPath = Printer_Select('',1) ;* Get default printer path
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '',PrintPath )
ac_rpt1_prn( '' )
Void = set_printer( 'TERM' )
Void = set_printer( 'INIT', '', '', '', 0, '' )
Void = set_printer( 'TERM' )
end else
or_view( '', Cmd )
Void = set_property( 'ORPRV.PRINT', 'ENABLED', 0 )
WinId = 'ORPRV'
loop
while get_property( WinId, 'HANDLE' )
yield()
repeat
ToPrint = ''
MsgInfo = ''
MsgInfo<mtext$> = 'Do you want to print this report?'
MsgInfo<micon$> = '?'
MsgInfo<mtype$> = 'BNY'
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mdefbtn$> = 2 ;* default to no
ToPrint = msg( @window, MsgInfo )
if ToPrint then
activate_save_select( ListsId )
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '' )
ac_rpt1_prn( '' )
Void = set_printer( 'TERM' )
Void = set_printer( 'INIT', '', '', '', 0, '' )
Void = set_printer( 'TERM' )
end
end
end else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'NO Records meeting your date criteria!!'
MsgInfo<micon$> = '!'
Void = MSG( '', MsgInfo )
end
write '' on SysListsTable, ListsId else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Unable to clear SYSLISTS ':ListsId:'...'
Void = msg( '', MsgInfo )
return 0
end
return 0