added LSL2 stored procedures
This commit is contained in:
132
LSL2/STPROC/INVOICE_RPT3.txt
Normal file
132
LSL2/STPROC/INVOICE_RPT3.txt
Normal file
@ -0,0 +1,132 @@
|
||||
compile function INVOICE_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, winexec, Printer_Select
|
||||
declare subroutine rlist, or_view, activate_save_select, yield, update_index
|
||||
declare subroutine invoice_rpt3_prn
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
|
||||
Params = dialog_box( 'INVOICE_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 = 'INVOICE_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
|
||||
Custs = Params<1>
|
||||
EntryDateFrom = Params<2>
|
||||
EntryDateThru = Params<3>
|
||||
DirToPrinter = Params<4>
|
||||
Plant = Params<5>
|
||||
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 ENTRY_DATE BY CUST_CITY'
|
||||
if EntryDateFrom and EntryDateThru then
|
||||
Stmt := " WITH ENTRY_DATE FROM ":QUOTE(EntryDateFrom):' TO ':QUOTE(EntryDateThru)
|
||||
end else
|
||||
if EntryDateFrom then
|
||||
Stmt := " WITH ENTRY_DATE GE ":QUOTE(EntryDateFrom)
|
||||
end
|
||||
if EntryDateThru then
|
||||
Stmt := " WITH ENTRY_DATE LE ":QUOTE(EntryDateThru)
|
||||
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 ":InvoiceTable:" JUSTLEN '8' CUST_CITY JUSTLEN '50' "
|
||||
Cmd:= "BREAK-ON ENTRY_DATE DUE_DATE PO GL_ACCT_TOTS TOTAL TOTAL_SHIP_AMOUNT "
|
||||
Cmd:= "TOTAL DISCOUNT_AMOUNT TOTAL INVOICE_AMOUNT"
|
||||
Cmd:= " HEADING ":'"':" Epitronics, formerly Lawrence Semiconductor Labs. 'L' Invoices by Entry Date by Customer 'T'"
|
||||
Cmd:= " PAGE # 'P' by selected entry dates from "
|
||||
Cmd:= "(":EntryDateFrom:") TO (":EntryDateThru:" ) ":'"'
|
||||
if DirToPrinter = 'Yes' then
|
||||
PrintPath = Printer_Select('',1) ;* Get Default printer
|
||||
Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '' ,PrintPath)
|
||||
invoice_rpt3_prn( iconv( EntryDateFrom, 'D' ), iconv( EntryDateThru, '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.25, 1, '' )
|
||||
invoice_rpt3_prn( iconv( EntryDateFrom, 'D' ), iconv( EntryDateThru, 'D' ), InvoiceTable )
|
||||
Void = set_printer( 'TERM' )
|
||||
Void = set_printer( 'INIT', '', '', '', 0, '' )
|
||||
Void = set_printer( 'TERM' )
|
||||
end
|
||||
end
|
||||
end else
|
||||
MsgInfo = ''
|
||||
MsgInfo<mtext$> = 'NO Records meeting your date criteria!!'
|
||||
MsgInfo<micon$> = '!'
|
||||
MsgInfo<mcol$> = -2
|
||||
MsgInfo<mrow$> = -2
|
||||
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