added LSL2 stored procedures
This commit is contained in:
280
LSL2/STPROC/PRINT_ORDER_RECONCILIATION.txt
Normal file
280
LSL2/STPROC/PRINT_ORDER_RECONCILIATION.txt
Normal file
@ -0,0 +1,280 @@
|
||||
COMPILE SUBROUTINE Print_Order_Reconciliation(Dummy)
|
||||
|
||||
/*
|
||||
Print Vision Order Reconciliation Report
|
||||
08/04.2005 - John C. Henry, J.C. Henry & Co., Inc. - Initial coding
|
||||
*/
|
||||
|
||||
|
||||
DECLARE SUBROUTINE Utility, ErrMsg, Set_Status, Set_Printer, RList
|
||||
DECLARE FUNCTION Set_Printer, Get_Printer, Msg, Get_Status, Printer_Select, obj_Install
|
||||
|
||||
$INSERT OIPRINT_EQUATES
|
||||
$INSERT ORDER_RECON_EQU
|
||||
$INSERT ORDER_EQU
|
||||
$INSERT WO_LOG_EQU
|
||||
$INSERT COMPANY_EQU
|
||||
$INSERT APPCOLORS
|
||||
$INSERT MSG_EQUATES
|
||||
$INSERT DICT_EQUATES
|
||||
|
||||
|
||||
EQU TAB$ TO \09\
|
||||
EQU TARGET_ACTIVELIST$ TO 5
|
||||
|
||||
|
||||
ErrorTitle = 'Error in stored procedure Print_Order_Reconciliation'
|
||||
|
||||
OPEN 'ORDER_RECON' TO ReconTable ELSE
|
||||
ErrorMsg = 'Unable to open "ORDER_RECON" table.'
|
||||
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
||||
RETURN
|
||||
END
|
||||
|
||||
OPEN 'ORDER' TO OrderTable ELSE
|
||||
ErrorMsg = 'Unable to open "ORDER" table.'
|
||||
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
||||
RETURN
|
||||
END
|
||||
|
||||
|
||||
* Start of printing process
|
||||
|
||||
FileName = 'Print Order Reconciliation'
|
||||
Title = 'Printing Order Reconciliation Report':@VM:'Order_Recon'
|
||||
|
||||
TopMargin = 1.0
|
||||
BottomMargin = 0.75
|
||||
LeftMargin = 0.5
|
||||
RightMargin = 0.5
|
||||
|
||||
Margins = LeftMargin:@FM:TopMargin:@FM:RightMargin:@FM:BottomMargin
|
||||
|
||||
PageSetup = '1' ;* Landscape = 1
|
||||
PrintSetup = '2' ;* Preview Normal
|
||||
PrintPath = Printer_Select()
|
||||
|
||||
IF PrintPath = '' THEN RETURN
|
||||
|
||||
stat = Set_Printer('INIT',FileName,Title,Margins,PageSetup,PrintSetup,PrintPath)
|
||||
IF stat < 0 THEN GOTO OIPrintErr
|
||||
|
||||
Timestamp = OCONV(XLATE('DICT.ORDER_RECON','%LAST_DTM%','','X'),'DT/^HS')
|
||||
|
||||
Header = @VM:obj_Install('Get_Prop','CompTitle'):' Vision Order Reconciliation Report - ':Timestamp
|
||||
Header<-1> = @VM:'Phase 1 - Orders on Both Systems - Mismatches'
|
||||
Header<-1> = '' ;* Blank line following heading
|
||||
|
||||
font = 'Arial'
|
||||
font<2> = '10'
|
||||
font<4> = '1' ;* Bold
|
||||
|
||||
stat = Set_Printer('FONTHEADFOOT',font) ; IF stat < 0 THEN GOTO OIPrintErr
|
||||
stat = Set_Printer('HEADER',Header) ; IF stat < 0 THEN GOTO OIPrintErr
|
||||
|
||||
Footer = " 'D' 'T'":@VM:@VM:"Page: 'P'"
|
||||
stat = Set_Printer('FOOTER',Footer) ; IF stat < 0 THEN GOTO OIPrintErr
|
||||
|
||||
|
||||
* Phase 1 - Print ORDER_RECON table contents
|
||||
|
||||
Set_Status(0)
|
||||
|
||||
SelectSent = 'SELECT ORDER_RECON'
|
||||
|
||||
RList(SelectSent,TARGET_ACTIVELIST$,'','','')
|
||||
IF Get_Status(errCode) THEN
|
||||
ErrMsg(errCode)
|
||||
RETURN
|
||||
END
|
||||
|
||||
* Make Column Heading
|
||||
|
||||
colHead = 'Vision':CRLF$:'Order' ; colFmt = '^1440'
|
||||
colHead<1,2> = 'Order' ; colFmt<1,2> = '^1440'
|
||||
*colHead<1,3> = 'Timestamp' ; *colFmt<1,3> = '^1440'
|
||||
*colHead<1,4> = 'Problem Desc' ; *colFmt<1,4> = '<2880'
|
||||
colHead<1,3> = 'Item':CRLF$:'No' ; colFmt<1,3> = '^720'
|
||||
colHead<1,4> = 'Field Name' ; colFmt<1,4> = '<2880'
|
||||
colHead<1,5> = 'Vision Value' ; colFmt<1,5> = '<3600'
|
||||
colHead<1,6> = 'OI Value' ; colFmt<1,6> = '<3600'
|
||||
|
||||
FirstLine = 1
|
||||
|
||||
Done = 0
|
||||
LOOP
|
||||
READNEXT VisionOrdNo ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ ReconRec FROM ReconTable,VisionOrdNo THEN
|
||||
|
||||
OrderNo = ReconRec<ORDER_RECON_ORDER_NO$>
|
||||
TimeStamp = ReconRec<ORDER_RECON_TIMESTAMP$>
|
||||
ProbDesc = ReconRec<ORDER_RECON_PROB_DESC$>
|
||||
ItemNos = ReconRec<ORDER_RECON_ITEM_NO$>
|
||||
FieldNames = ReconRec<ORDER_RECON_FIELD_NAME$>
|
||||
VisionValues = ReconRec<ORDER_RECON_VISION_VALUE$>
|
||||
OIValues = ReconRec<ORDER_RECON_OI_VALUE$>
|
||||
|
||||
FOR I = 1 TO COUNT(ItemNos,@VM) + (ItemNos NE '')
|
||||
FieldName = FieldNames<1,I>
|
||||
IF ItemNos<1,I> = '-' THEN
|
||||
Table = 'ORDER'
|
||||
END ELSE
|
||||
Table = 'ORDER_DET'
|
||||
END
|
||||
OutConv = XLATE('DICT.':Table,FieldName,DICT_CONV$,'X')
|
||||
IF OutConv NE '' THEN
|
||||
VisionValues<1,I> = OCONV(VisionValues<1,I>,OutConv)
|
||||
OIValues<1,I> = OCONV(OIValues<1,I>,OutConv)
|
||||
END
|
||||
NEXT I
|
||||
|
||||
SWAP @VM WITH CRLF$ IN ItemNos
|
||||
SWAP @VM WITH CRLF$ IN FieldNames
|
||||
SWAP @VM WITH CRLF$ IN VisionValues
|
||||
SWAP @VM WITH CRLF$ IN OIValues
|
||||
|
||||
colData = ''
|
||||
colData<1,1> = VisionOrdNo
|
||||
colData<1,2> = OrderNo
|
||||
*colData<1,3> = OCONV(TimeStamp,'DT2^HS') ;* Check this
|
||||
*colData<1,4> = ProbDesc
|
||||
colData<1,3> = ItemNos
|
||||
colData<1,4> = FieldNames
|
||||
colData<1,5> = VisionValues
|
||||
colData<1,6> = OIValues
|
||||
|
||||
GOSUB PrintTable
|
||||
|
||||
END ; * End of ReconRec Read
|
||||
REPEAT ;* End of first phase
|
||||
|
||||
|
||||
|
||||
|
||||
stat = Set_Printer('PAGEBREAK')
|
||||
|
||||
|
||||
Header = @VM:obj_Install('Get_Prop','Company'):' Vision Order Reconciliation Report'
|
||||
Header<-1> = @VM:'Phase 2 - Orders in OpenInsight W/O Vision Order Number'
|
||||
Header<-1> = '' ;* Blank line following heading
|
||||
|
||||
font = 'Arial'
|
||||
font<2> = '10'
|
||||
font<4> = '1' ;* Bold
|
||||
|
||||
stat = Set_Printer('FONTHEADFOOT',font) ; IF stat < 0 THEN GOTO OIPrintErr
|
||||
stat = Set_Printer('HEADER',Header) ; IF stat < 0 THEN GOTO OIPrintErr
|
||||
|
||||
|
||||
Set_Status(0)
|
||||
|
||||
SelectSent = 'SELECT ORDER WITH ENTRY_DATE > "8/14/2005" AND WITH VISION_ORDER_NO = "" AND WITH CUST_NO NE "562" AND WITH CUST_NO NE "7008"'
|
||||
|
||||
RList(SelectSent,TARGET_ACTIVELIST$,'','','')
|
||||
IF Get_Status(errCode) THEN
|
||||
ErrMsg(errCode)
|
||||
RETURN
|
||||
END
|
||||
|
||||
* Make Column Heading
|
||||
|
||||
colHead = 'Order' ; colFmt = '^1440'
|
||||
colHead<1,2> = 'Cust No' ; colFmt<1,2> = '^720'
|
||||
colHead<1,3> = 'Cust Name' ; colFmt<1,3> = '<4320'
|
||||
colHead<1,4> = 'Enter Date' ; colFmt<1,4> = '^2880'
|
||||
colHead<1,5> = 'Enter By' ; colFmt<1,5> = '<2880'
|
||||
|
||||
|
||||
FirstLine = 1
|
||||
|
||||
Done = 0
|
||||
LOOP
|
||||
READNEXT OrderNo ELSE Done = 1
|
||||
UNTIL Done
|
||||
READ OrderRec FROM OrderTable,OrderNo THEN
|
||||
|
||||
CustNo = OrderRec<ORDER_CUST_NO$>
|
||||
Captive = XLATE('COMPANY',CustNo,COMPANY_CAPTIVE$,'X')
|
||||
|
||||
IF NOT(Captive) THEN
|
||||
CustName = XLATE('ORDER',OrderNo,'CUST_NAME','X')
|
||||
EnterDt = OCONV(OrderRec<ORDER_ENTRY_DATE$>,'D4/')
|
||||
EnterBy = OCONV(OrderRec<ORDER_ENTRY_ID$>,'[XLATE_CONV,LSL_USERS*FIRST_LAST]')
|
||||
|
||||
|
||||
colData = ''
|
||||
colData<1,1> = OrderNo
|
||||
colData<1,2> = CustNo
|
||||
colData<1,3> = CustName
|
||||
colData<1,4> = EnterDt
|
||||
colData<1,5> = EnterBy
|
||||
|
||||
|
||||
GOSUB PrintTable
|
||||
END
|
||||
|
||||
END ; * End of OrderRec Read
|
||||
REPEAT ;* End of first phase
|
||||
|
||||
|
||||
|
||||
* * * * * * *
|
||||
Bail:
|
||||
* * * * * * *
|
||||
|
||||
stat = Set_Printer('TERM',1)
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * * *
|
||||
OIPrintErr:
|
||||
* * * * * * *
|
||||
|
||||
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
||||
ErrMsg(ErrorTitle:@SVM:'Set_Printer returned errorcode ':stat)
|
||||
stat = Set_Printer('TERM',1)
|
||||
|
||||
RETURN
|
||||
|
||||
|
||||
* * * * * *
|
||||
PrintTable:
|
||||
* * * * * *
|
||||
|
||||
|
||||
stat = Set_Printer('CALCTABLE',colFmt:@FM:colData)
|
||||
TableSize = Get_Printer('CALCTABLE')
|
||||
TableHeight = TableSize<2>
|
||||
Test = Get_Printer('POS')<2>
|
||||
|
||||
IF Get_Printer('POS')<2> + TableHeight > 6.50 OR FirstLine THEN
|
||||
IF NOT(FirstLine) THEN
|
||||
stat = Set_Printer('PAGEBREAK')
|
||||
END
|
||||
FirstLine = 0
|
||||
font<2> = 8
|
||||
font<4> = 1 ;* Bold
|
||||
stat = Set_Printer('FONT',font,'100')
|
||||
|
||||
stat = Set_Printer('ADDTABLE',colFmt,colHead,'',LTGREY$,'',0,TB_ALL)
|
||||
|
||||
|
||||
font<4> = 0
|
||||
stat = Set_Printer('FONT',font,fontSpacing)
|
||||
|
||||
stat = Set_Printer('ADDTABLE',colFmt,'',colData,LTGREY$,'',0,7)
|
||||
|
||||
END ELSE
|
||||
font<2> = 8
|
||||
font<4> = 0
|
||||
stat = Set_Printer('FONT',font,fontSpacing)
|
||||
stat = Set_Printer('ADDTABLE',colFmt,'',colData,LTGREY$,'',1,TB_ALL)
|
||||
|
||||
END
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
|
Reference in New Issue
Block a user