143 lines
4.4 KiB
Plaintext
143 lines
4.4 KiB
Plaintext
compile function INVOICE_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 invoice_rpt1_prn
|
|
$insert rlist_equates
|
|
$insert msg_equates
|
|
|
|
Params = dialog_box( 'INVOICE_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 = 'INVOICE_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>
|
|
DueDateFrom = Params<2>
|
|
DueDateThru = Params<3>
|
|
Open = Params<4>
|
|
Closed = Params<5>
|
|
DirToPrinter = Params<6>
|
|
Plant = Params<7>
|
|
begin case
|
|
case Plant = 'All'
|
|
PlantStmt = ''
|
|
case Plant = 'Tempe'
|
|
PlantStmt = ' AND WITH PLANT = "T" '
|
|
case Plant = 'Mesa'
|
|
PlantStmt = ' AND WITH PLANT = "M" '
|
|
end case
|
|
|
|
InvoiceTable = 'INVOICE'
|
|
|
|
|
|
Stat = utility( 'CURSOR', 'H' )
|
|
|
|
Stmt = 'SELECT ':InvoiceTable:' BY CUST_CITY BY STATUS BY DUE_DATE'
|
|
if DueDateFrom and DueDateThru then
|
|
Stmt := " WITH DUE_DATE FROM ":QUOTE(DueDateFrom):' TO ':QUOTE(DueDateThru)
|
|
end else
|
|
if DueDateFrom then
|
|
Stmt := " WITH DUE_DATE GE ":QUOTE(DueDateFrom)
|
|
end
|
|
if DueDateThru then
|
|
Stmt := " WITH DUE_DATE LE ":QUOTE(DueDateThru)
|
|
end
|
|
end
|
|
Stmt := PlantStmt
|
|
if Open and Closed else
|
|
if Open then
|
|
Stmt := ' AND WITH STATUS = "O"'
|
|
end else
|
|
Stmt := ' AND WITH STATUS = "C"'
|
|
end
|
|
end
|
|
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 ":InvoiceTable:" JUSTLEN '8' BREAK-ON CUST_CITY JUSTLEN '50' "
|
|
Cmd:= "BREAK-ON STATUS SHIP_DATE DUE_DATE PO TOTAL BALANCE TOTAL INVOICE_AMOUNT "
|
|
Cmd:= " HEADING ":'"':" Epitronics, formerly Lawrence Semiconductor Labs. 'L' Invoices by Customer by Status by Due Date 'T'"
|
|
Cmd:= " PAGE # 'P' by selected due dates from "
|
|
Cmd:= "(":DueDateFrom:") Thru (":DueDateThru:" ) ":'"'
|
|
if DirToPrinter = 'Yes' then
|
|
PrintPath = Printer_Select('',1) ;* Get Default printer
|
|
Void = set_printer( 'INIT', '', '', '':@fm:1, 1, '',PrintPath )
|
|
invoice_rpt1_prn( iconv( DueDateFrom, 'D' ), iconv( DueDateThru, 'D' ), InvoiceTable )
|
|
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, 1, '' )
|
|
invoice_rpt1_prn( iconv( DueDateFrom, 'D' ), iconv( DueDateThru, 'D' ), InvoiceTable )
|
|
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
|
|
|