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

441 lines
17 KiB
Plaintext

COMPILE SUBROUTINE Print_NCR( NCRIds, EmailAddresses, PrintOnly, PrintPath, PDFFileName, PrinterInitialized, HideUI)
DECLARE SUBROUTINE Security_Err_Msg
DECLARE FUNCTION Security_Check, Set_Printer, Get_Printer, Msg, fieldcount, entid, repository
DECLARE FUNCTION Printer_Select, obj_Install
$Insert LOGICAL
$insert security_rights_equ
$insert oiprint_equates
$insert msg_equates
$insert company_equ
$insert email_pending_equ
$insert ncr_equ
$insert lsl_users_equ
$insert rds_equ
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(PrintPath)) THEN PrintPath = ''
IF NOT(ASSIGNED(PDFFileName)) THEN PDFFileName = ''
IF NOT(ASSIGNED(PrinterInitialized)) THEN PrinterInitialized = 0
IF NOT(PrinterInitialized) THEN
IF PrintPath = '' THEN
PrintPath = Printer_Select('',1) ;* Returns default printer path
END
PageInfo = ''
PageInfo<PI$LEFT> = '0.50'
PageInfo<PI$TOP> = '1.50'
PageInfo<PI$RIGHT> = '0.50'
PageInfo<PI$BOTTOM> = '0.50'
PageSetup = 0 ;* 1 = Landscape mode
PrintSetup = 0 ;* 2 = No Preview
END
If Assigned(HideUI) else HideUI = False$
If HideUI NE True$ then HideUI = False$
* EVENTUALLY THIS CODE COULD BE MODIFIED TO NOT XLATE ALL THE SYMBOLLICS BUT RATHER
* OPEN DICT TO @DICT AND USE {FIELD} ; NOT A HIGH PRIORITY
Ncnt = fieldcount( NCRIds, @fm )
for i = 1 to Ncnt
EmailOut = ''
TextOut = ''
ThisNCR = NCRIds<i>
IF NOT(PrinterInitialized) THEN
PrintSetup = ''
PrintSetup<1,1> = '2' ;* Specific Location
PrintSetup<1,2> = '5' ;* Show Print and PDF, hide Print Setup
PrintSetup<1,3> = '0' ;* Show the printing window
PDFParms = 'Printing Document':@FM: '' :@FM:'':@FM: ''
stat = Set_Printer( 'INIT', PDFParms, 'NCR',PageInfo,PageSetup , PrintSetup)
END ELSE
stat = Set_Printer('PAGEBREAK')
END
NCRRec = xlate( 'NCR', ThisNCR, '', 'X' )
* SET ALL PRINTVARIABLES
*Originator = oconv( NCRRec<ncr_entry_id$>, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )
Customer = xlate( 'NCR', ThisNCR, 'CUST_NAME', 'X' )
Reactor = NCRRec<ncr_reactor$>
RDSId = NCRRec<ncr_rds_id$>
QuoteNo = xlate( 'RDS', RDSId, rds_quote_no$, 'X' )
PSNId = xlate( 'RDS', RDSId, rds_prod_spec_id$, 'X' )
PO = xlate( 'RDS', RDSId, rds_po$, 'X' )
PartNo = xlate( 'RDS', RDSId, rds_part_num$, 'X') ;* Added 9/30/04 jch
ContactName = xlate( 'QUOTE', QuoteNo, 'CONTACT_NAME', 'X' )
Department = NCRRec<ncr_dept$>
Shift = NCRRec<ncr_shift$>
WO = xlate( 'NCR', ThisNCR, 'WO', 'X' )
LotNum = xlate( 'NCR', ThisNCR, 'LOT_NUM', 'X' )
NonConfQty = xlate( 'NCR', ThisNCR, 'REJ_CNT', 'X' )
*NonConfDesc = xlate( 'NCR', ThisNCR, 'REJ_TYPE_DESC', 'X' )
LossStage = NCRRec<NCR_LOSS_STAGE$>
LossBy = NCRRec<NCR_LOSS_BY$>
IF LossStage = 'PRE' THEN
IF LossBy = 'M' THEN
NonConfDesc = 'Mfg Pre Epi'
END ELSE
NonConfDesc = 'Cust Pre Epi'
END
END ELSE
IF LossBy = 'M' THEN
NonConfDesc = 'Mfg Post Epi'
END ELSE
NonConfDesc = 'Cust Post Epi'
END
END
EntryDate = oconv( NCRRec<ncr_entry_date$>, 'D2/' )
EntryTime = oconv( NCRRec<ncr_entry_time$>, 'MTH' )
LossDesc = xlate( 'NCR', ThisNCR, 'LOSS_DESC', 'X' )
LossComments = NCRRec<ncr_loss_comments$>
convert @tm to ' ' in LossComments
ACDesc = xlate( 'NCR', ThisNCR, 'AC_DESC', 'X' )
ACComments = NCRRec<ncr_ac_comments$>
convert @tm to ' ' in ACComments
DeptResp = NCRRec<ncr_dept_resp$>
DeptMgrSig = oconv( xlate( 'NCR', ThisNCR, 'DEPT_MGR_SIG_NAME', 'X' ), 'BElectronically Signed, ' )
AuthDevSig = oconv( xlate( 'NCR', ThisNCR, 'AUTH_DEV_SIG_NAME', 'X' ), 'BElectronically Signed, ' )
AuthRejSig = oconv( xlate( 'NCR', ThisNCR, 'AUTH_REJ_SIG_NAME', 'X' ), 'BElectronically Signed, ' )
*AuthRwkSig = oconv( xlate( 'NCR', ThisNCR, 'AUTH_REWORK_SIG_NAME', 'X' ), 'BElectronically Signed, ' )
AuthShipSig = oconv( xlate( 'NCR', ThisNCR, 'AUTH_SHIP_SIG_NAME', 'X' ), 'BElectronically Signed, ' )
*VPSig = oconv( xlate( 'NCR', ThisNCR, 'VP_SIG_NAME', 'X' ), 'BElectronically Signed, ' )
AcctRep = xlate( 'NCR', ThisNCR, 'ACCT_REP', 'X' )
AcctRepDID = oconv( xlate( 'LSL_USERS', AcctRep, lsl_users_did$, 'X' ), '[PHONE_FORMAT]' )
AcctRep = oconv( AcctRep, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )
ContainActions = NCRRec<ncr_contain_actions$>
convert @tm to ' ' in ContainActions
* PRINT THE EPITRONICS LOGO
IF NOT(PrinterInitialized) THEN
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:7.5:@FM:-1.2, 1)
stat = Set_Printer('LINE', -0.1:@FM:-0.1:@FM:7.5:@FM:-0.1, 1)
location = -0.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 * * * *
END
font = 'Arial'
font<2> = '18' ;* Big type
font<4> = 1 ;* Bold on
font<5> = 1 ;* Italics
stat = Set_Printer('TEXTXY','Non Conformance Report',1.8:@FM:-0.80,font,0)
Font<1> = 'Times New Roman'
Font<3> = 'C'
Font<2> = 12
Stat = Set_Printer( 'FONT', Font )
*TextOut = 'email: siliconepi@atmi.com'
*EmailOut:= fmt( TextOut, 'C#76' ):CrLf$
*Void = Set_Printer( 'TEXT', TextOut )
*TextOut = 'Account Rep: ':AcctRep
*EmailOut:= fmt( TextOut, 'C#76' ):CrLf$
*Void = Set_Printer( 'TEXT', TextOut )
*TextOut = AcctRepDID
*EmailOut:= fmt( TextOut, 'C#76' ):CrLf$
*Void = Set_Printer( 'TEXT', TextOut )
*TextOut = ''
*EmailOut:= TextOut:CrLf$
*Void = Set_Printer( 'TEXT', TextOut )
Stat = Set_Printer( 'FONT', Font )
TextOut = 'Non-conformance report'
Void = Set_Printer( 'TEXT', TextOut )
EmailOut:= fmt( TextOut, 'C#76' ):CrLf$
Stat = Set_Printer( 'FONT', Font )
TableColInfo = '^-11520'
PrintTbl = '#':ThisNCR
EmailOut:= fmt( PrintTbl, 'C#76' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
TextOut = ''
EmailOut:= TextOut:CrLf$
Void = Set_Printer( 'TEXT', TextOut )
Font<3> = 'L'
Font<2> = 11
Font<6> = 1
Stat = Set_Printer( 'FONT', Font )
TableColInfo = '<-4233':@vm:'<-4233':@vm:'<-2520'
PrintTbl = ''
PrintTbl:= 'Customer:':@vm:'Department:':@vm:'Shift:'
EmailOut:= fmt( PrintTbl<1,1>, 'L#25'):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$
EmailOut:= fmt( '--------', 'L#25' ):fmt( '----------', 'L#25'):fmt( '-----', 'L#25'):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
PrintTbl = Customer:@vm:Department:@vm:Shift
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$:CrLf$
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Customer Contact:':@vm:'Work Order:':@vm:'Date:'
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$
EmailOut:= fmt( '-----------------', 'L#25' ):fmt( '-----------', 'L#25'):fmt( '-----', 'L#25'):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = ContactName:@vm:WO:@vm:EntryDate
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Lot#:':@vm:'Non-conforming Qty:':@vm:'Time:'
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$
EmailOut:= fmt( '-----', 'L#25' ):fmt( '-------------------', 'L#25'):fmt( '-----', 'L#25'):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = LotNum:@vm:NonConfQty:@vm:EntryTime
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'PO#:':@vm:'Non-conforming Desc:':@vm:'Reactor#:'
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$
EmailOut:= fmt( '----', 'L#25' ):fmt( '--------------------', 'L#25'):fmt( '---------', 'L#25'):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = PO:@vm:NonConfDesc:@vm:Reactor
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,3>, 'L#25'):CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
TableColInfo = '<-1440':@vm:'<-1440':@vm:'<-1353':@vm:'<-4233':@vm:'<-2520'
PrintTbl = 'Quote#:':@vm:'PSN#:':@vm:'':@vm:'Part No':@vm:'RDS#:'
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,5>, 'L#25'):CrLf$
EmailOut:= fmt( '-------', 'L#25' ):fmt( '-----', 'L#25'):fmt( '-----', 'L#25'):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = QuoteNo:@vm:PSNId:@vm:'':@vm:PartNo:@vm:RDSId
EmailOut:= fmt( PrintTbl<1,1>, 'L#25' ):fmt( PrintTbl<1,2>, 'L#25'):fmt( PrintTbl<1,5>, 'L#25'):CrLf$:CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Void = Set_Printer( 'TEXT', '' )
Void = Set_Printer( 'TEXT', '' )
TableColInfo = '<-10987'
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Loss Description:'
EmailOut:= PrintTbl:CrLf$
EmailOut:= '-----------------':CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = LossDesc
TPrintTbl = PrintTbl
TPrintTbl = fmt( PrintTbl, 'T#76' )
swap @tm with CrLf$ in TPrintTbl
EmailOut:= TPrintTbl:CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Loss Description Comments:'
EmailOut:= PrintTbl:CrLf$
EmailOut:= '--------------------------':CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = LossComments
TPrintTbl = PrintTbl
TPrintTbl = fmt( PrintTbl, 'T#76' )
swap @tm with CrLf$ in TPrintTbl
EmailOut:= TPrintTbl:CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Void = Set_Printer( 'TEXT', '' )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Containment Actions:'
EmailOut:= PrintTbl:CrLf$
EmailOut:= '--------------------':CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = ContainActions
TPrintTbl = PrintTbl
TPrintTbl = fmt( PrintTbl, 'T#76' )
swap @tm with CrLf$ in TPrintTbl
EmailOut:= TPrintTbl:CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Void = Set_Printer( 'TEXT', '' )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Assign Cause Description:'
EmailOut:= PrintTbl:CrLf$
EmailOut:= '-------------------------':CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = ACDesc
TPrintTbl = PrintTbl
TPrintTbl = fmt( PrintTbl, 'T#76' )
swap @tm with CrLf$ in TPrintTbl
EmailOut:= TPrintTbl:CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Assign Cause Description Comments:'
EmailOut:= PrintTbl:CrLf$
EmailOut:= '----------------------------------':CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = ACComments
TPrintTbl = PrintTbl
TPrintTbl = fmt( PrintTbl, 'T#76' )
swap @tm with CrLf$ in TPrintTbl
EmailOut:= TPrintTbl:CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Void = Set_Printer( 'TEXT', '' )
* SIGNATURES
TableColInfo = '<-5493':@vm:'<-5493'
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Department responsible for NCR:':@vm:"Department Manager's signature:"
EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38'):CrLf$
EmailOut:= fmt( '-------------------------------', 'L#38' ):fmt( '-------------------------------', 'L#38' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = DeptResp:@vm
PrintTbl:= DeptMgrSig
EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38' ):CrLf$:CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Void = Set_Printer( 'TEXT', '' )
*
Font<4> = 1
Font<6> = 1
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Authorization':@vm:'Electronic signature'
EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38' ):CrLf$
EmailOut:= fmt( '-------------', 'L#38' ):fmt( '--------------------', 'L#38' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<4> = 0
Font<6> = 0
Void = Set_Printer( 'FONT', Font )
PrintTbl = 'Accept material under deviation:':@vm:AuthDevSig
EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
PrintTbl = 'Reject material:':@vm:AuthRejSig
EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
* PrintTbl = 'Rework material:':@vm:AuthRwkSig
* EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
*
PrintTbl = 'Ship material:':@vm:AuthShipSig
EmailOut:= fmt( PrintTbl<1,1>, 'L#38' ):fmt( PrintTbl<1,2>, 'L#38' ):CrLf$
Void = Set_Printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
IF NOT(PrinterInitialized) THEN
stat = Set_Printer('TERM')
END
next i
RETURN 0
*===========================================================================*