compile function INVOICE_RPT4() 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_rpt4_prn $insert rlist_equates $insert msg_equates Params = dialog_box( 'INVOICE_RPT4', @window, '*CENTER' ) if Params = 'CANCEL' or Params = '' then return 0 end open 'SYSLISTS' to SysListsTable else MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = 'Unable to open SYSLISTS...' Void = msg( '', MsgInfo ) return 0 end ListsId = 'INVOICE_RPT4*':@station write '' on SysListsTable, ListsId else MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = '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 SEQ' 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:= "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 Invoice No 'T'" Cmd:= " PAGE # 'P' by selected entry dates from " Cmd:= "(":EntryDateFrom:") TO (":EntryDateThru:" ) ":'"' *Cmd = "LIST INVOICE_SRL CUST_CITY PO" *DEBUG if DirToPrinter = 'Yes' then PrintPath = Printer_Select('',1) ;* Get default printer path Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '' ,PrintPath) invoice_rpt4_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 = 'Do you want to print this report?' MsgInfo = '?' MsgInfo = 'BNY' MsgInfo = -2 MsgInfo = -2 MsgInfo = 2 ;* default to no ToPrint = msg( @window, MsgInfo ) if ToPrint then activate_save_select( ListsId ) Void = set_printer( 'INIT', '', '', '':@fm:1.25, 1, '' ) invoice_rpt4_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 = -2 MsgInfo = -2 MsgInfo = 'NO Records meeting your date criteria!!' MsgInfo = '!' Void = MSG( '', MsgInfo ) end write '' on SysListsTable, ListsId else MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = 'Unable to clear SYSLISTS ':ListsId:'...' Void = msg( '', MsgInfo ) return 0 end return 0