added LSL2 stored procedures
This commit is contained in:
134
LSL2/STPROC/SCHED_RPT3.txt
Normal file
134
LSL2/STPROC/SCHED_RPT3.txt
Normal file
@ -0,0 +1,134 @@
|
||||
compile function SCHED_RPT3()
|
||||
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, sched_rpt3_prn
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
|
||||
Params = dialog_box( 'SCHED_RPT3', @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 = 'SCHED_RPT3*':@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
|
||||
BillFrom = Params<1>
|
||||
BillThru = Params<2>
|
||||
DirToPrinter = Params<3>
|
||||
Custs = Params<4>
|
||||
Plant = Params<5>
|
||||
begin case
|
||||
case Plant = 'All'
|
||||
PlantStmt = ''
|
||||
case Plant = 'Tempe'
|
||||
PlantStmt = ' AND WITH WO < 100000'
|
||||
case Plant = 'Mesa'
|
||||
PlantStmt = ' AND WITH WO > 100000'
|
||||
end case
|
||||
SchedTable = 'SCHEDULE'
|
||||
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
Stmt = 'SELECT ':SchedTable:' BY CUST_DIVISION BY INVOICE_IDS'
|
||||
if BillFrom and BillThru then
|
||||
Stmt := " WITH SHIP_DATE FROM ":QUOTE(BillFrom):' TO ':QUOTE(BillThru)
|
||||
end else
|
||||
if BillFrom then
|
||||
Stmt := " WITH SHIP_DATE GE ":QUOTE(BillFrom)
|
||||
end
|
||||
if BillThru then
|
||||
Stmt := " WITH SHIP_DATE LE ":QUOTE(BillThru)
|
||||
end
|
||||
end
|
||||
Stmt := PlantStmt
|
||||
if Custs then
|
||||
swap @vm with "' '" in Custs
|
||||
Custs = "'":Custs:"'"
|
||||
Stmt := ' AND WITH CUST_NO = ':Custs
|
||||
end
|
||||
|
||||
rlist( Stmt, target_savelist$, ListsId, '', '' )
|
||||
|
||||
activate_save_select( ListsId )
|
||||
|
||||
if @reccount then
|
||||
Cmd = "LIST ":SchedTable:" JUSTLEN '8' BREAK-ON CUST_DIVISION JUSTLEN '30' "
|
||||
Cmd:= "PO PART_NUM SHIP_DATE TOTAL SHIP_QTY SHIP_PRICE JUSTLEN '12' BREAK-ON INVOICE_IDS JUSTLEN '12' "
|
||||
Cmd:= "TOTAL SHIP_AMOUNT JUSTLEN '15' LIMIT SHIP_DATE FROM ":QUOTE(BillFrom)
|
||||
Cmd:= " TO ":QUOTE(BillThru)
|
||||
Cmd:= " HEADING ":'"':" Billings by Customer/Division by Invoice No. 'T'"
|
||||
Cmd:= " PAGE # 'PP''L' by selected dates from "
|
||||
Cmd:= "(":BillFrom:") TO (":BillThru:" ) ":'"'
|
||||
if SchedTable = 'SCHEDULE_SRL' then
|
||||
swap 'PART_NUM' with 'DESCRIPTION' in Cmd
|
||||
end
|
||||
if DirToPrinter = 'Yes' then
|
||||
PrintPath = Printer_Select('',1) ;* Get default printer path
|
||||
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '','',PrintPath )
|
||||
sched_rpt3_prn( iconv( BillFrom, 'D' ), iconv( BillThru, 'D' ), SchedTable )
|
||||
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, '' )
|
||||
sched_rpt3_prn( iconv( BillFrom, 'D' ), iconv( BillThru, 'D' ), SchedTable )
|
||||
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