added LSL2 stored procedures
This commit is contained in:
144
LSL2/STPROC/INVOICE_RPT5.txt
Normal file
144
LSL2/STPROC/INVOICE_RPT5.txt
Normal file
@ -0,0 +1,144 @@
|
||||
compile function INVOICE_RPT5()
|
||||
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
|
||||
declare subroutine rlist, or_view, activate_save_select, yield, update_index
|
||||
$insert rlist_equates
|
||||
$insert msg_equates
|
||||
|
||||
Params = dialog_box( 'INVOICE_RPT5', @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_RPT5*':@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
|
||||
FromDate = Params<1>
|
||||
ThruDate = Params<2>
|
||||
Custs = Params<3>
|
||||
QuoteNos = Params<4>
|
||||
Pos = Params<5>
|
||||
DirToPrinter = Params<6>
|
||||
InvoiceTable = 'INVOICE'
|
||||
|
||||
Stat = utility( 'CURSOR', 'H' )
|
||||
|
||||
Stmt = 'SELECT ':InvoiceTable
|
||||
CStmt = ''
|
||||
if FromDate and ThruDate then
|
||||
CStmt := " WITH ENTRY_DATE FROM ":QUOTE(FromDate):' TO ':QUOTE(ThruDate)
|
||||
end else
|
||||
if FromDate then
|
||||
CStmt := " WITH ENTRY_DATE GE ":QUOTE(FromDate)
|
||||
end
|
||||
if ThruDate then
|
||||
CStmt := " WITH ENTRY_DATE LE ":QUOTE(ThruDate)
|
||||
end
|
||||
end
|
||||
if Custs then
|
||||
swap @vm with "' '" in Custs
|
||||
Custs = "'":Custs:"'"
|
||||
if CStmt then
|
||||
CStmt := ' AND WITH '
|
||||
end else
|
||||
CStmt := ' WITH '
|
||||
end
|
||||
CStmt := 'CUST_NO = ':Custs
|
||||
end
|
||||
if Pos then
|
||||
swap @vm with "' '" in Pos
|
||||
Pos = "'":Pos:"'"
|
||||
if CStmt then
|
||||
CStmt := ' AND WITH '
|
||||
end else
|
||||
CStmt := ' WITH '
|
||||
end
|
||||
CStmt := 'PO = ':Pos
|
||||
end
|
||||
if QuoteNos then
|
||||
swap @vm with "' '" in QuoteNos
|
||||
QuoteNos = "'":QuoteNos:"'"
|
||||
end
|
||||
Stmt := CStmt
|
||||
|
||||
rlist( Stmt, target_savelist$, ListsId, '', '' )
|
||||
|
||||
activate_save_select( ListsId )
|
||||
|
||||
if @reccount then
|
||||
Cmd = "LIST ":InvoiceTable
|
||||
if QuoteNos then
|
||||
Cmd:= " WITH QUOTE_IDS ":QuoteNos:" LIMIT QUOTE_IDS ":QuoteNos
|
||||
end
|
||||
Cmd:= " ID-SUPP BY CUST_NAME BREAK-ON CUST_NAME ":quote("'V'"):" JUSTLEN 25"
|
||||
Cmd:= " BY QUOTE_IDS BREAK-ON QUOTE_IDS ":quote("'V'"):" JUSTLEN 9 BY SEQ BREAK-ON SEQ"
|
||||
Cmd:= " ":quote("'V'"):" COLHEAD 'Inv No.' JUSTLEN 8"
|
||||
Cmd:= " PO JUSTLEN 16 SHIP_DATE JUSTLEN 9 TOTAL QUANTITY JUSTLEN 8"
|
||||
Cmd:= " HEADING ":'"':" Epitronics, formerly Lawrence Semiconductor Labs. 'L' Invoices by Customer/Quote/Invoice No. 'TL'"
|
||||
Cmd:= " PAGE # 'P' "
|
||||
if FromDate then
|
||||
Cmd:= " for selected dates (":FromDate:") to (":ThruDate:")":'"'
|
||||
end else
|
||||
Cmd := '"'
|
||||
end
|
||||
if DirToPrinter = 'Yes' then
|
||||
rlist( Cmd, 0, '', '', '' )
|
||||
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 )
|
||||
rlist( Cmd, 0, '', '', '' )
|
||||
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