open-insight/LSL2/STPROC/PRINT_MB1B_REPORT.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

326 lines
8.6 KiB
Plaintext

compile SUBROUTINE Print_MB1B_Report( Purge )
DECLARE FUNCTION SECURITY_CHECK, SET_PRINTER, GET_PRINTER, MSG, FIELDCOUNT, ENTID, REPOSITORY, PRINTER_SELECT
DECLARE FUNCTION OBJ_INSTALL, Popup
DECLARE SUBROUTINE SECURITY_ERR_MSG, RList, ErrMsg,Set_Status
$INSERT SECURITY_RIGHTS_EQU
$INSERT OIPRINT_EQUATES
$INSERT MSG_EQUATES
$INSERT COMPANY_EQU
$INSERT WO_LOG_EQUATES
$INSERT WO_MAT_EQUATES
$INSERT SAP_MU_TRANS_EQUATES
$INSERT APPCOLORS
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
OPEN 'SAP_MU_TRANS' TO SAPMuTransTable ELSE
ErrMsg('Unable to open "SAP_MU_TRANS" in Print_MB1B_Report routine.')
RETURN
END
IF NOT(ASSIGNED(Purge)) THEN Purge = ''
IF Purge = 1 THEN
DelKeys = Popup(@WINDOW,'','SAP_MU_TRANS_PURGE')
IF DelKeys = '' THEN RETURN
DelKeyCnt = COUNT(DelKeys,@VM) + (DelKeys NE '')
MsgHead = 'Purge SAP Makeup Transactions'
MsgText = 'Are you sure you wish to purge selected transactions from the system?'
OK = Msg(@WINDOW,'','YESNO','',MsgHead:@FM:MsgText)
IF OK = 1 THEN
FOR I = 1 TO DelKeyCnt
DelKey = DelKeys<1,I>
DELETE SAPMuTransTable,DelKey ELSE Null
NEXT I
END
RETURN
END
SELECT SAPMuTransTable
LineCount = 0
DataLines = ''
bcDataLines = ''
CurrDate = OCONV(Date(),'D4/')
CurrTime = OCONV(Time(),'MTH')
CurrDTM = ICONV(CurrDate:' ':CurrTime,'DT')
Done = 0
LOOP
READNEXT TransRecKey ELSE Done =1
UNTIL Done
READ TransRec FROM SAPMuTransTable,TransRecKey THEN
MUCassNos = TransRec<SAP_MU_TRANS_MU_CASS_ID$>
MUCassQtys = TransRec<SAP_MU_TRANS_MU_CASS_QTY$>
MUBatchNos = XLATE('SAP_MU_TRANS',TransRecKey,'MU_BATCH_NO','X')
BatchNo = XLATE('SAP_MU_TRANS',TransRecKey,'BATCH_NO','X')
EpiPartNo = XLATE('SAP_MU_TRANS',TransRecKey,'EPI_PART_NO','X')
FOR I = 1 TO Count(MUCassNos,@VM) + (MUCassNos NE '')
LineCount += 1
DataLines<LineCount,1> = EpiPartNo ; bcDataLines<LineCount,1> = '*':EpiPartNo:'*'
DataLines<LineCount,2> = MuCassQtys<1,I> ; bcDataLines<LineCount,2> = '*':MuCassQtys<1,I>:'*'
DataLines<LineCount,3> = MuCassNos<1,I>:CRLF$:MUBatchNos<1,I> ; bcDataLines<LineCount,3> = '*':MUBatchNos<1,I>:'*'
DataLines<LineCount,4> = TransRecKey:CRLF$:BatchNo ; bcDataLines<LineCount,4> = '*':BatchNo:'*'
NEXT I
TransRec<SAP_MU_TRANS_PRINT_DTM$> = CurrDTM
WRITE TransRec ON SAPMuTransTable,TransRecKey THEN
NULL
END
END
REPEAT
* SAP "constants" printed at top for scanning into SAP form.
MovementType = '311'
SAPPlantNo = '1210'
LocFinishedGoods = '0500'
LocFloorStock = '0400'
* * * PRINT SETUP * * *
PageInfo = ''
PageInfo<PI$LEFT> = 0.5 ;* Margins
PageInfo<PI$TOP> = 1.35
PageInfo<PI$RIGHT> = 0.5
PageInfo<PI$BOTTOM> = 0.50
PageInfo<PI$SIZE> = LETTER
PageSetup = 0 ;* 1 = Landscape mode
PrintSetup = ''
PrintSetup<1,1> = '2' ;* Preview Normal
PrintSetup<1,2> = '5' ;* Show Print and PDF, hide Print Setup
PrintSetup<1,3> = '0' ;* Show the printing window
PDFParms = 'Printing PDF Document':@FM: '' :@FM:'':@FM: ''
stat = Set_Printer( 'INIT', PDFParms, 'MB1B Report',PageInfo,PageSetup,PrintSetup)
PageSize = Get_Printer('PAGESIZE')
PageHeight = PageSize<2>
MaxPrintLength = PageHeight - PageInfo<PI$TOP> - PageInfo<PI$BOTTOM>
font = 'Arial' ;* Font basics
font<2> = 10
font<4> = 0
stat = Set_Printer('FONTHEADFOOT', font)
stat = Set_Printer('FOOTER',"Page 'P' Received by:__________________________________________ Qty issued:________ ":@VM:@VM:"'T' 'D'")
stat = Set_Printer('LINESTYLE', PS_SOLID:@FM:2)
stat = Set_Printer('LINE', -0.1:@FM:-1.2:@FM:7.5:@FM:-1.2, 1)
stat = Set_Printer('LINE', -0.1:@FM:-0.1:@FM:7.5:@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','Work Order No: ':WONo,2.7:@FM:-0.325,font,1)
font<2> = '18' ;* Big type
font<4> = 1 ;* Bold on
font<5> = 1 ;* Italics
stat = Set_Printer('TEXTXY','SAP MB1B Data Report',2.1:@FM:-0.80,font,0)
font<2> = 12 ;* Drop the font size
font<4> = 0 ;* Bold off
font<5> = 0 ;* Italics off
colHeader = 'Movement':CRLF$:'Type' ; colFormat = '^1980'
colHeader<1,2> = 'Plant NO' ; colFormat<1,2> = '^2520'
colHeader<1,3> = 'Floor':CRLF$:'Stock':CRLF$:'Location' ; colFormat<1,3> = '^3240'
colHeader<1,4> = 'Finished':CRLF$:'Goods':CRLF$:'Location' ; colFormat<1,4> = '^3240'
colData = MovementType ; bcData = '*':MovementType:'*'
colData<1,2> = SAPPlantNo ; bcData<1,2> = '*':SAPPlantNo:'*'
colData<1,3> = LocFloorStock ; bcData<1,3> = '*':LocFloorStock:'*'
colData<1,4> = LocFinishedGoods ; bcData<1,4> = '*':LocFinishedGoods:'*'
font = 'Arial' ;* Font basics
font<2> = 10
font<4> = 0
TableFormat = TB_ALL
HeaderFormat = TB_ALL
TablePos = 'L'
HdrShade = LTGREY$
PrintHeads = 1
BoldHeader = 0
ULHeader = 0
ItalicHeader = 0
PrintHeads = 1
GOSUB PrintTable
bcFont = ''
bcFont<1> = '3 of 9 Barcode'
bcFont<2> = '18'
bcFont<3> = 'R'
bcFont<4> = '0'
bcFontSpacing = 130
stat = Set_Printer('FONT',bcFont,bcFontSpacing)
stat = Set_Printer('ADDTABLE',colFormat,'',bcData,'','',0,'')
stat = Set_Printer('FONT',Font,'100')
stat = Set_Printer('TEXT')
DataLineCnt = COUNT(DataLines,@FM) + (DataLines NE '')
bcData = ''
FOR M = 1 TO DataLineCnt
colHeader = 'EPI Part NO' ; colFormat = '^3420'
colHeader<1,2> = 'Wfr Qty' ; colFormat<1,2> = '^1440'
colHeader<1,3> = 'Makeup Batch' ; colFormat<1,3> = '^3060'
colHeader<1,4> = 'Product Batch' ; colFormat<1,4> = '^3060'
font = 'Arial' ;* Font basics
font<2> = 10
font<4> = 0
colData = DataLines<M>
stat = Set_Printer('ADDTABLE',colFormat,colHeader,'',HdrShade,'',0,HeaderFormat)
stat = Set_Printer('ADDTABLE',colFormat,'',coldata,'','',0,TB_ALL)
bcData = bcDataLines<M>
stat = Set_Printer('FONT',bcFont,bcFontSpacing)
stat = Set_Printer('ADDTABLE',colFormat,'',bcData,'','',0,TB_NONE)
stat = Set_Printer('FONT',Font,'100')
stat = Set_Printer('TEXT')
NEXT M
Void = Set_Printer('TERM',0)
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 > MaxPrintLength THEN
FirstLine = 0
stat = Set_Printer('PAGEBREAK')
font<2> = 10
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> = 10
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