136 lines
4.4 KiB
Plaintext
136 lines
4.4 KiB
Plaintext
compile function SCHED_RPT2()
|
|
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_rpt2_prn
|
|
$insert rlist_equates
|
|
$insert msg_equates
|
|
|
|
Params = dialog_box( 'SCHED_RPT2', @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_RPT2*':@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_CITY 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 9 BREAK-ON CUST_CITY ":QUOTE("'V'")
|
|
Cmd:= " JUSTLEN 55 PO JUSTLEN 20 SHIP_DATE TOTAL SHIP_QTY JUSTLEN 6 "
|
|
Cmd:= " COLHEAD 'Qty' INVOICE_IDS JUSTLEN 10 COLHEAD "
|
|
Cmd:= " 'Invoice No' TOTAL SHIP_AMOUNT JUSTLEN "
|
|
Cmd:= " 14 LIMIT SHIP_DATE FROM ":QUOTE(BillFrom):" TO ":QUOTE(BillThru)
|
|
Cmd:= " HEADING ":'"':" Billings by Company 'T' PAGE # 'PP''L' for Selected Dates From (":BillFrom:" ) Thru (":BillThru:")":'" '
|
|
Cmd:= " ID-SUPP"
|
|
if DirToPrinter = 'Yes' then
|
|
PrintPath = Printer_Select('',1) ;* Gets default printer path
|
|
|
|
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '','',PrintPath )
|
|
|
|
sched_rpt2_prn( iconv( BillFrom, 'D' ), iconv( BillThru, 'D' ), SchedTable )
|
|
Void = set_printer( 'TERM' )
|
|
Void = set_printer( 'INIT', '', '', '', 0, '', PrintPath )
|
|
Void = set_printer( 'TERM' )
|
|
end else
|
|
or_view( '', Cmd )
|
|
Void = set_property( 'ORPRV.PRINT', 'ENABLED', 0 )
|
|
*SysSize = get_property( 'SYSTEM', 'SIZE' )
|
|
*Void = send_event( 'ORPRV', 'SIZE', 1:@fm:1:@fm:SysSize<1>:@fm:SysSize<2> )
|
|
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_rpt2_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
|
|
|
|
|
|
|