added LSL2 stored procedures
This commit is contained in:
143
LSL2/STPROC/CAR_RPT1.txt
Normal file
143
LSL2/STPROC/CAR_RPT1.txt
Normal file
@ -0,0 +1,143 @@
|
||||
compile function CAR_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, update_index
|
||||
declare subroutine car_rpt1_prn
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
|
||||
Params = dialog_box( 'CAR_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 = 'CAR_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
|
||||
Custs = Params<1>
|
||||
IssueDateFrom = Params<2>
|
||||
IssueDateThru = Params<3>
|
||||
Open = Params<4>
|
||||
FormComplete = Params<5>
|
||||
CARInPlace = Params<6>
|
||||
Verified = Params<7>
|
||||
DirToPrinter = Params<8>
|
||||
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
|
||||
Stmt = 'SELECT CAR BY CUST_CITY BY ISSUE_DATE'
|
||||
if IssueDateFrom and IssueDateThru then
|
||||
Stmt := " WITH ISSUE_DATE FROM ":QUOTE(IssueDateFrom):' TO ':QUOTE(IssueDateThru)
|
||||
end else
|
||||
if IssueDateFrom then
|
||||
Stmt := " WITH ISSUE_DATE GE ":QUOTE(IssueDateFrom)
|
||||
end
|
||||
if IssueDateThru then
|
||||
Stmt := " WITH ISSUE_DATE LE ":QUOTE(IssueDateThru)
|
||||
end
|
||||
end
|
||||
if Custs then
|
||||
swap @vm with "' '" in Custs
|
||||
Custs = "'":Custs:"'"
|
||||
Stmt := ' AND WITH CUST_ID = ':Custs
|
||||
end
|
||||
|
||||
CARStatusVar = ''
|
||||
if Open then
|
||||
CARStatusVar := " 'O'"
|
||||
end
|
||||
if FormComplete then
|
||||
CARStatusVar := " 'F'"
|
||||
end
|
||||
if CARInplace then
|
||||
CARStatusVar := " 'C'"
|
||||
end
|
||||
if Verified then
|
||||
CARStatusVar := "'V'"
|
||||
end
|
||||
if CarStatusVar then
|
||||
Stmt := ' AND WITH STATUS = ':CARStatusVar
|
||||
end
|
||||
|
||||
rlist( Stmt, target_savelist$, ListsId, '', '' )
|
||||
|
||||
activate_save_select( ListsId )
|
||||
|
||||
if @reccount then
|
||||
Cmd = "LIST CAR ID-SUPP SEQ JUSTLEN '5' COLHEAD 'CAR#' CUST_CITY JUSTLEN '50' CONTACT_NAME WO COMPLAINT_TYPE JUSTLEN '30' "
|
||||
Cmd:= "ISSUE_DATE TOTAL EST_LOSS_VALUE TOTAL ACT_LOSS_VALUE "
|
||||
Cmd:= " HEADING ":'"':" Customer Advisories by Customer by Issue Date 'T'"
|
||||
Cmd:= " PAGE # 'P' by selected Issue dates from "
|
||||
Cmd:= "(":IssueDateFrom:") Thru (":IssueDateThru:" ) ":'"'
|
||||
if DirToPrinter = 'Yes' then
|
||||
PrintPath = Printer_Select('',1) ;* Get default printer path
|
||||
Void = set_printer( 'INIT', '', '', '':@fm:1, 1, '',PrintPath )
|
||||
car_rpt1_prn( iconv( IssueDateFrom, 'D' ), iconv( IssueDateThru, 'D' ) )
|
||||
Void = set_printer( 'TERM' )
|
||||
Void = set_printer( 'INIT', '', '', '', 0, '' )
|
||||
Void = set_printer( 'TERM' )
|
||||
end else
|
||||
or_view( '', Cmd )
|
||||
*SysSize = get_property( 'SYSTEM', 'SIZE' )
|
||||
*Void = send_event( 'ORPRV', 'SIZE', 1:@fm:1:@fm:SysSize<1>:@fm:SysSize<2> )
|
||||
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, 1, '' )
|
||||
car_rpt1_prn( iconv( IssueDateFrom, 'D' ), iconv( IssueDateThru, 'D' ) )
|
||||
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
|
||||
|
Reference in New Issue
Block a user