370 lines
9.3 KiB
Plaintext
370 lines
9.3 KiB
Plaintext
COMPILE SUBROUTINE Print_WO( WONo, Confirmation )
|
|
|
|
DECLARE FUNCTION Set_Printer, Get_Printer, Msg, Printer_Select, obj_Install
|
|
|
|
$INSERT OIPRINT_EQUATES
|
|
$INSERT MSG_EQUATES
|
|
|
|
$INSERT WO_LOG_EQUATES
|
|
$INSERT WO_STEP_EQUATES
|
|
$INSERT WO_MAT_EQUATES
|
|
$INSERT COMPANY_EQUATES
|
|
$INSERT EPI_PART_EQUATES
|
|
$INSERT PROD_VER_EQUATES
|
|
$INSERT APPCOLORS
|
|
$INSERT COC_EQUATES
|
|
|
|
EQU PI$LEFT TO 1
|
|
EQU PI$TOP TO 2
|
|
EQU PI$RIGHT TO 3
|
|
EQU PI$BOTTOM TO 4
|
|
EQU PI$WIDTH TO 5
|
|
EQU PI$HEIGHT TO 6
|
|
EQU PI$SIZE TO 7
|
|
|
|
|
|
IF NOT(ASSIGNED(WONo)) THEN RETURN
|
|
IF NOT(ASSIGNED(Confirmation)) THEN Confirmation = ''
|
|
|
|
* * * PRINT SETUP * * *
|
|
|
|
FileName = "Printing"
|
|
FileName<2> = ''
|
|
FileName<3> = 0
|
|
FileName<4> = ''
|
|
|
|
PrintTitle = "Work Order"
|
|
PrintTitle<2> = "WO Preview"
|
|
PrintTitle<3> = "&Cancel"
|
|
PrintTitle<4> = ''
|
|
PrintTitle<5> = ''
|
|
|
|
PageInfo = ''
|
|
PageInfo<PI$LEFT> = 0.25 ;* Margins
|
|
PageInfo<PI$TOP> = 1.35
|
|
PageInfo<PI$RIGHT> = 0.25
|
|
PageInfo<PI$BOTTOM> = 0.50
|
|
|
|
PageSetup = 1 ;* 1 = Landscape mode
|
|
|
|
PrintSetup = ''
|
|
PrintSetup<1,1> = '2' ;* Preview Normal
|
|
PrintSetup<1,2> = '5' ;* Display all buttons except Printer Setup
|
|
PrintSetup<1,3> = '0' ;* Display Printing Window
|
|
PrintSetup<1,6> = '7' ;* Preview window - keyboard and mouse support
|
|
|
|
stat = Set_Printer("INIT",FileName,PrintTitle,PageInfo,PageSetup,PrintSetup)
|
|
|
|
font = 'Arial' ;* Font basics
|
|
font<2> = 10
|
|
font<4> = 0
|
|
|
|
stat = Set_Printer('FONTHEADFOOT', font)
|
|
|
|
stat = Set_Printer('FOOTER',"Page 'P' ":@VM:@VM:"'T' 'D'")
|
|
|
|
stat = Set_Printer('LINESTYLE', PS_SOLID:@FM:2)
|
|
stat = Set_Printer('LINE', -0.1:@FM:-1.2:@FM:10.50:@FM:-1.2, 1)
|
|
stat = Set_Printer('LINE', -0.1:@FM:-0.1:@FM:10.50:@FM:-0.1, 1)
|
|
|
|
location = -.15:@fm:-1.150:@fm:1.57:@fm:1
|
|
stat = Set_Printer('BMP',obj_Install('Get_Prop','ColorBMP'),location, 0,1)
|
|
|
|
|
|
* * * * Added 10/8/2015 JCH - Updated 'CONFIG','COMPANY' * * * *
|
|
|
|
InstDat = obj_Install('Get_Prop','Company':@FM:'Division')
|
|
Company = InstDat<1>
|
|
Division = InstDat<2>
|
|
|
|
font = 'Arial'
|
|
font<2> = '12' ;* Big type
|
|
font<4> = 1 ;* Bold on
|
|
font<5> = 0 ;* Italics
|
|
|
|
stat = Set_Printer('TEXTXY',Company,5.7:@FM:-1.15,font,1)
|
|
stat = Set_Printer('TEXTXY',Division,5.7:@FM:-0.970,font,1)
|
|
|
|
font<2> = 10 ;* 10 point font
|
|
font<4> = 0 ;* Bold off
|
|
font<5> = 0 ;* Italics Off
|
|
|
|
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','Address'), 5.7:@fm:-0.775, font,1)
|
|
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','CSZC'), 5.7:@fm:-0.625, font,1)
|
|
stat = Set_Printer('TEXTXY','Tel: ':obj_Install('Get_Prop','Phone'), 5.7:@fm:-0.475, font, 1)
|
|
stat = Set_Printer('TEXTXY','FAX: ':obj_Install('Get_Prop','FAX'), 5.7:@fm:-0.325, font, 1)
|
|
|
|
* * * * End of changes 10/8/2015 JCH * * * *
|
|
|
|
|
|
stat = Set_Printer('TEXTXY','WO No: ':WONo,4.25:@FM:-0.325,font,1)
|
|
|
|
font<2> = '18' ;* Big type
|
|
font<4> = 1 ;* Bold on
|
|
font<5> = 1 ;* Italics
|
|
|
|
IF Confirmation THEN
|
|
stat = Set_Printer('TEXTXY','Confirmation of Work Order',3.0:@FM:-0.8,font,1)
|
|
END ELSE
|
|
stat = Set_Printer('TEXTXY','Work Order',4.00:@FM:-0.8,font,1)
|
|
END
|
|
|
|
WORec = XLATE('WO_LOG',WONo,'','X')
|
|
|
|
* Received from SAP
|
|
|
|
ProdOrderNo = WORec<WO_LOG_PROD_ORD_NO$>
|
|
CustPONo = WORec<WO_LOG_CUST_PO_NO$>
|
|
PromiseShipDt = WORec<WO_LOG_PROMISE_SHIP_DT$>
|
|
EpiPartNo = WORec<WO_LOG_EPI_PART_NO$>
|
|
OrdSubPartNo = WORec<WO_LOG_ORD_SUB_PART_NO$>
|
|
OrdSubPartRev = WORec<WO_LOG_ORD_SUB_PART_REV$>
|
|
SAPOrdQty = WORec<WO_LOG_SAP_ORD_QTY$>
|
|
|
|
* Customer notification and routing
|
|
|
|
ProdVerNo = WORec<WO_LOG_PROD_VER_NO$>
|
|
CustPartNo = WORec<WO_LOG_CUST_PART_NO$>
|
|
CustPartInbound = WORec<WO_LOG_CUST_PART_INBOUND$>
|
|
CustSubPartNo = WORec<WO_LOG_CUST_SUB_PART_NO$>
|
|
CustSubMfr = WORec<WO_LOG_CUST_SUB_MFR$>
|
|
CustLotNos = WORec<WO_LOG_CUST_LOT_NO$>
|
|
CustLotQtys = WORec<WO_LOG_CUST_LOT_QTY$>
|
|
WOCustNo = WORec<WO_LOG_CUST_NO$>
|
|
|
|
|
|
ShipToCustNo = WOCustNo
|
|
BillToCustNo = XLATE('COMPANY',ShipToCustNo,COMPANY_BILL_TO_CUST_NO$,'X')
|
|
|
|
CustShipToInfo = XLATE('COMPANY',ShipToCustNo,'SHIP_TO_INFO','X')
|
|
|
|
IF BillToCustNo = '' THEN
|
|
CustBillToInfo = XLATE('COMPANY',ShipToCustNo,'BILL_TO_INFO','X')
|
|
END ELSE
|
|
CustBillToInfo = XLATE('COMPANY',BillToCustNo,'BILL_TO_INFO','X')
|
|
END
|
|
|
|
|
|
|
|
SWAP @VM WITH CRLF$ IN CustBillToInfo
|
|
SWAP @VM WITH CRLF$ IN CustShipToInfo
|
|
|
|
SWAP @VM WITH CRLF$ IN CustLotNos
|
|
SWAP @VM WITH CRLF$ IN CustLotQtys
|
|
|
|
|
|
WODetail = ''
|
|
|
|
FirstWOMatKey = WORec<WO_LOG_WO_MAT_KEY$,1>
|
|
|
|
FirstWOMatRec = XLATE('WO_MAT',FirstWOMatKey,'','X')
|
|
|
|
RxDTM = FirstWOMatRec<WO_MAT_RX_DTM$>
|
|
RelDTM = FirstWOMatRec<WO_MAT_REL_DTM$>
|
|
|
|
WOStepKeys = WORec<WO_LOG_WO_STEP_KEY$>
|
|
|
|
WODetail<1,1> = OCONV(RxDTM,'DT2/^HS')
|
|
WODetail<1,2> = OCONV(RelDTM,'DT2/^HS')
|
|
|
|
FOR N = 1 TO COUNT(WOStepKeys,@VM) + (WOStepKeys NE '')
|
|
|
|
WOStepKey = WOStepKeys<1,N>
|
|
WOStepRec = XLATE('WO_STEP',WOStepKey,'','X')
|
|
|
|
StepNo = FIELD(WOStepKey,'*',2)
|
|
|
|
StepPSN = WOStepRec<WO_STEP_PROD_SPEC_ID$>
|
|
StepDesc = WOStepRec<WO_STEP_PROC_STEP_DESC$>
|
|
WODetail<1,3,N> = StepNo
|
|
WODetail<1,4,N> = StepPSN
|
|
WODetail<1,5,N> = StepDesc
|
|
|
|
NEXT N
|
|
|
|
|
|
SWAP @SVM WITH CRLF$ IN WODetail
|
|
|
|
colHeader = 'WO No' ; colFormat = '^1800'
|
|
colHeader<1,2> = 'Prod Order No' ; colFormat<1,2> = '^1800'
|
|
colHeader<1,3> = 'Cust PO No' ; colFormat<1,3> = '^1800'
|
|
colHeader<1,4> = 'Ship Date' ; colFormat<1,4> = '^1800'
|
|
colHeader<1,5> = 'Epi Part No' ; colFormat<1,5> = '^1800'
|
|
colHeader<1,6> = 'Sub Part No' ; colFormat<1,6> = '^1800'
|
|
colHeader<1,7> = 'Sub Part Rev' ; colFormat<1,7> = '^1800'
|
|
colHeader<1,8> = 'SAP Ord Qty' ; colFormat<1,8> = '^1800'
|
|
|
|
|
|
colData = WONo
|
|
colData<1,2> = ProdOrderNo
|
|
colData<1,3> = CustPONo
|
|
colData<1,4> = OCONV(PromiseShipDt,'D4/')
|
|
colData<1,5> = EpiPartNo
|
|
colData<1,6> = OrdSubPartNo
|
|
colData<1,7> = OrdSubPartRev
|
|
colData<1,8> = SAPOrdQty
|
|
|
|
|
|
font = 'Arial' ;* Font basics
|
|
font<2> = 8
|
|
font<4> = 0
|
|
|
|
|
|
TableFormat = TB_ALL
|
|
HeaderFormat = TB_ALL
|
|
TablePos = 'L'
|
|
HdrShade = LTGREY$
|
|
PrintHeads = 1
|
|
BoldHeader = 0
|
|
ULHeader = 0
|
|
ItalicHeader = 0
|
|
PrintHeads = 1
|
|
|
|
* Basic Order Information
|
|
|
|
|
|
GOSUB PrintTable
|
|
|
|
stat = Set_Printer('TEXT')
|
|
|
|
|
|
* Bill to and Ship to Information *
|
|
|
|
colHeader = 'Bill To' ; colFormat = '<5400'
|
|
colHeader<1,2> = 'Ship To' ; colFormat<1,2> = '<5400'
|
|
|
|
colData = CustBillToInfo
|
|
colData<1,2> = CustShipToInfo
|
|
|
|
PrintHeads = 1
|
|
GOSUB PrintTable
|
|
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT')
|
|
|
|
* Order Detail Information *
|
|
|
|
colHeader = 'Prod Ver No' ; colFormat = '^1080'
|
|
colHeader<1,2> = 'Description' ; colFormat<1,2> = '<2700'
|
|
colHeader<1,3> = 'Cust Part No' ; colFormat<1,3> = '^1800'
|
|
colHeader<1,4> = 'Cust Part Inbound' ; colFormat<1,4> = '^1800'
|
|
colHeader<1,5> = 'Cust Sub Part No' ; colFormat<1,5> = '^1800'
|
|
colHeader<1,6> = 'Cust Sub Mfr' ; colFormat<1,6> = '^1800'
|
|
colHeader<1,7> = 'Lot No' ; colFormat<1,7> = '^1800'
|
|
colHeader<1,8> = 'Lot Qty' ; colFormat<1,8> = '>720'
|
|
|
|
|
|
Desc = XLATE('PROD_VER',ProdVerNo,PROD_VER_DESC$,'X')
|
|
|
|
IF Desc = '' THEN
|
|
Desc = XLATE('EPI_PART',EpiPartNo,EPI_PART_EPI_PART_DESC$,'X')
|
|
END
|
|
|
|
colData = ProdVerNo
|
|
colData<1,2> = Desc
|
|
colData<1,3> = CustPartNo
|
|
colData<1,4> = CustPartInbound
|
|
colData<1,5> = CustSubPartNo
|
|
colData<1,6> = CustSubMfr
|
|
colData<1,7> = CustLotNos
|
|
colData<1,8> = CustLotQtys
|
|
|
|
fontSpacing = 120
|
|
|
|
PrintHeads = 1
|
|
GOSUB PrintTable
|
|
|
|
stat = Set_Printer('TEXT')
|
|
stat = Set_Printer('TEXT')
|
|
|
|
|
|
* * * * * * Print Work Order Detail * * * * * *
|
|
|
|
|
|
colHeader = 'Received' ; colFormat = '<2160'
|
|
colHeader<1,2> = 'Released' ; colFormat<1,2> = '<2160'
|
|
colHeader<1,3> = 'WO Step' ; colFormat<1,3> = '^720'
|
|
colHeader<1,4> = 'Step PSN' ; colFormat<1,4> = '^1080'
|
|
colHeader<1,5> = 'Step Description' ; colFormat<1,5> = '<2440'
|
|
|
|
* Customer notification and routing
|
|
|
|
|
|
colData = WODetail
|
|
|
|
fontSpacing = 120
|
|
TableFormat = TB_ALL
|
|
|
|
PrintHeads = 1
|
|
GOSUB PrintTable
|
|
|
|
|
|
Void = Set_Printer('TERM')
|
|
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
* * * * * *
|
|
PrintTable:
|
|
* * * * * *
|
|
|
|
FOR I = 1 TO COUNT(colData,@FM) + (colData NE '')
|
|
stat = Set_Printer('CALCTABLE',colFormat:@FM:colData<I>)
|
|
TableSize = Get_Printer('CALCTABLE')
|
|
TableHeight = TableSize<2>
|
|
YPos = Get_Printer('POS')<2>
|
|
IF YPos + TableHeight > 9.0 THEN
|
|
|
|
FirstLine = 0
|
|
stat = Set_Printer('PAGEBREAK')
|
|
font<2> = 8
|
|
|
|
IF BoldHeader THEN font<4> = 1 ELSE font<4> = 0
|
|
IF ULHeader THEN font<6> = 1 ELSE font<6> = 0
|
|
IF ItalicHeader THEN font<5> = 1 ELSE font<5> = 0
|
|
|
|
stat = Set_Printer('FONT',font,'100')
|
|
|
|
IF HeaderFormat = '' THEN HeaderFormat = TableFormat
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',HdrShade,'',0,HeaderFormat:@FM:TablePos)
|
|
|
|
font<4> = 0
|
|
font<5> = 0
|
|
font<6> = 0
|
|
stat = Set_Printer('FONT',font,fontSpacing)
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData<I>,HdrShade,'',0,TableFormat:@FM:TablePos)
|
|
|
|
END ELSE
|
|
|
|
IF PrintHeads THEN
|
|
IF BoldHeader THEN font<4> = 1 ELSE font<4> = 0
|
|
IF ULHeader THEN font<6> = 1 ELSE font<6> = 0
|
|
IF ItalicHeader THEN font<5> = 1 ELSE font<5> = 0
|
|
stat = Set_Printer('FONT',font,'100')
|
|
|
|
IF HeaderFormat = '' THEN HeaderFormat = TableFormat
|
|
|
|
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',HdrShade,'',0,HeaderFormat:@FM:TablePos)
|
|
PrintHeads = 0
|
|
|
|
END
|
|
|
|
font<2> = 8
|
|
font<4> = 0
|
|
font<5> = 0
|
|
font<6> = 0
|
|
stat = Set_Printer('FONT',font,fontSpacing)
|
|
stat = Set_Printer('ADDTABLE',colFormat,'',colData<I>,HdrShade,'',1,TableFormat:@FM:TablePos)
|
|
|
|
END
|
|
|
|
NEXT I
|
|
|
|
RETURN
|
|
|
|
|