compile function ship_check_list( RDS , PrintPath, PDFFileName, PrinterInitialized)

declare function security_check, set_printer, get_printer, msg, fieldcount, entid, repository, Printer_Select
DECLARE FUNCTION obj_Install
declare subroutine security_err_msg

$insert security_rights_equ
$insert oiprint_equates
$insert msg_equates
$insert prod_spec_equ
$insert rds_equ
$insert quote_equ
$insert order_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 PrintPath = '' THEN
	PrintPath = Printer_Select('',1)	;* Returns default printer path
END

* * *   PRINT SETUP   * * *

PageInfo	= ''
PageInfo<PI$LEFT>	= ''		;* Default = 0.5in
PageInfo<PI$TOP>	= ''		;* Default = 0.5in
PageInfo<PI$RIGHT>	= '0.0'
PageInfo<PI$BOTTOM>	= '0.25'

PageSetup	= 0					;* 1 = Landscape mode
PrintSetup	= 0					;* 0 = Print to printer without Preview

IF NOT(PrinterInitialized) THEN
	stat = Set_Printer("INIT",'Printing','Packing Slip',PageInfo,PageSetup,PrintSetup,PrintPath)
END ELSE
	IF PDFFileName NE '' THEN RETURN 0	;* This is an internal document only and doesn't go to the customers
	stat = Set_Printer('PAGEBREAK')
END

font	= 'Arial'
font<2>	= '18'		;* Big type
font<4>	= 1			;* Bold on
font<5> = 1			;* Italics
stat = Set_Printer('TEXTXY','Shipping Check List',2.3:@FM:-0.80,font,0)

Font = "Times New Roman"
Font<2> = 16
Font<3> = 'C'
Font<4> = 1

Stat = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
Void = set_printer( 'TEXT', '' )
* PULL OFF ALL VARIABLES
* RUN DATA SHEET ID IS PASSED VIA THE CALLING PROGRAM AND THIS CODE WILL PICK UP 
* THE REST VIA TRANSLATION
RDSRec         = xlate( 'RDS', RDS, '', 'X' )
OrderNo        = RDSRec<rds_order_no$>
QuoteNo        = RDSRec<rds_quote_no$>
PSNId          = RDSRec<rds_prod_spec_id$>
WO             = RDSRec<rds_wo$>
CustName       = oconv( RDSRec<rds_cust_no$>, '[XLATE_CONV,COMPANY*CO_NAME]' )
OrderRec       = xlate( 'ORDER', OrderNo, '', 'X' )
ShipVia        = OrderRec<order_ship_via$>
AcctNo         = OrderRec<order_account_no$>
QuoteShipInst  = xlate( 'QUOTE', QuoteNo, quote_spec_ship_inst$, 'X' )
PSN            = xlate( 'PROD_SPEC', PSNId, '', 'X' )
PSNShipInst    = PSN<prod_spec_spec_ship_inst$>
TRSRP          = PSN<prod_spec_tr_srp$>
TRSRPWWafer    = PSN<prod_spec_tr_srp_wwafer$>
TRFTIR         = PSN<prod_spec_tr_ftir$>
TRHgProbe      = PSN<prod_spec_tr_hgprobe$>
TRTencor       = PSN<prod_spec_tr_tencor$>
TRStress       = PSN<prod_spec_tr_stress$>
TRTestWafer    = PSN<prod_spec_tr_test_wafer$>
TR4PP          = PSN<prod_spec_tr_4pp$>
CustRDS        = PSN<prod_spec_ship_cust_rds$>
CustRDSCleanRoomPaper = PSN<prod_spec_rds_cleanroom_paper$>
COCFront       = PSN<prod_spec_ship_coc_front$>
COCFrontCopies = PSN<prod_spec_ship_coc_front_copies$>
COCBack        = PSN<prod_spec_ship_coc_back$>
COCBackCopies  = PSN<prod_spec_ship_coc_back_copies$>
NCRRej         = PSN<prod_spec_ship_ncr_rej$>
PartialShip    = PSN<prod_spec_ship_partial$>
FullShipType   = PSN<prod_spec_ship_full_type$>
BagReq         = PSN<prod_spec_ship_bag_req$>

* NOW PRINT THE PAGE
TableColInfo = '<_3630':@vm:'<_3630':@vm:'<_3630'
PrintTbl = 'Customer':@vm:'WO':@vm:'PSN#'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE )
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )
PrintTbl = CustName:@vm:WO:@vm:PSNId
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
Void = set_printer( 'TEXT', '' )

if QuoteShipInst then
   * SHIPPING INSTRUCTIONS FOR THIS QUOTE THAT WILL OVERRIDE THE
   * PSN SHIPPING INSTRUCTIONS - BUT PRINT BOTH ANYWAY
   Font<2> = 14
   Font<4> = 1
   Void = set_printer( 'FONT', Font )
   Void = set_printer( 'TEXT', 'Quotation Special Shipping Instruction' )
	TableColInfo = '<_10890'
	convert @tm to ' ' in QuoteShipInst
   Font<2> = 12
   Font<4> = 0
   Void = set_printer( 'FONT', Font )
	Void = set_printer( 'ADDTABLE', TableColInfo, '', QuoteShipInst, '', '', 1, TB_ALL )
	Void = set_printer( 'TEXT', '' )	 
end
* 
TableColInfo = '<_5445':@vm:'<_5445'
PrintTbl = 'Ship Via':@vm:'Account No'
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE ) 
PrintTbl = ShipVia:@vm:AcctNo
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
Void = set_printer( 'TEXT', '' ) 
*
if PSNShipInst then
   * SHIPPING INSTRUCTIONS FOR THIS PSN
   Font<2> = 14
   Font<4> = 1
   Void = set_printer( 'FONT', Font )
   Void = set_printer( 'TEXT', 'PSN Special Shipping Instruction' )
	TableColInfo = '<_10890'
	convert @tm to ' ' in PSNShipInst
OsWrite PSNShipInst To "C:\PSN.txt"
	
   Font<2> = 12
   Font<4> = 0
   Void = set_printer( 'FONT', Font )
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PSNShipInst, '', '', 1, TB_ALL )
	Void = set_printer( 'TEXT', '' )	 
end 
*
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', 'Test Results Required' )
Font<2> = 10
Font<4> = 0
Void = set_printer( 'FONT', Font )
*TableColInfo = '^_360':@vm:'<_1195':@vm:'^_360':@vm:'<_1195':@vm:'^_360':@vm:'<_1195':@vm:'^_360'
*TableColInfo:= @vm:'<_1195':@vm:'^_360':@vm:'<_1195':@vm:'^_360':@vm:'<_1195':@vm:'^_360':@vm:'<_1195'
*TRSRP        = oconv( TRSRP, 'BX ' )
*TRSRPWWafer  = oconv( TRSRPWWafer, 'BX ' )
*TRFTIR       = oconv( TRFTIR, 'BX ' )
*TRHgProbe    = oconv( TRHgProbe, 'BX ' )
*TRTencor     = oconv( TRTencor, 'BX ' )
*TRStress     = oconv( TRStress, 'BX ' )
*TRTestWafer  = oconv( TRTestWafer, 'BX ' )
*TR4PP        = oconv( TR4PP, 'BX ' )
*PrintTbl = TRHgProbe:@vm:'Hg Probe':@vm
*PrintTbl:= TRSRP:@vm:'SRP':@vm
*PrintTbl:= TRSRPWWafer:@vm:'w/Wafer':@vm
*PrintTbl:= TRFTIR:@vm:'FTIR':@vm
*PrintTbl:= TRTencor:@vm:'Tencor':@vm
*PrintTbl:= TRTestWafer:@vm:'Test Wafer':@vm
*PrintTbl:= TRStress:@vm:'Stress Meas'
*Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
*TableColInfo = '^_360':@vm:'<_1195'
*PrintTbl = TR4PP:@vm:'4Pnt Probe'
*Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
****************************************************************************************
* JOHN TRUELOVE'S MODS 5/3/01
TableColInfo = ''
TableColInfo := '^_360':@vm:'<_1195' ;* TRHgProbe
TableColInfo := @vm
TableColInfo := '^_360':@vm:'<_1195' ;* TRSRP
TableColInfo := @vm
TableColInfo := '^_360':@vm:'<_1195' ;* TRSRPWWafer
TableColInfo := @vm
TableColInfo := '^_360':@vm:'<_1195' ;* TRTestWafer 
TableColInfo := @vm

TRSRP        = oconv( TRSRP, 'BX ' )
TRSRPWWafer  = oconv( TRSRPWWafer, 'BX ' )
TRFTIR       = oconv( TRFTIR, 'BX ' )
TRHgProbe    = oconv( TRHgProbe, 'BX ' )
TRTencor     = oconv( TRTencor, 'BX ' )
TRStress     = oconv( TRStress, 'BX ' )
TRTestWafer  = oconv( TRTestWafer, 'BX ' )
TR4PP        = oconv( TR4PP, 'BX ' )

PrintTbl = TRHgProbe:@vm:'Hg Probe':@vm
PrintTbl:= TRSRP:@vm:'SRP':@vm
PrintTbl:= TRSRPWWafer:@vm:'w/Wafer':@vm
*PrintTbl:= TRFTIR:@vm:'FTIR':@vm
*PrintTbl:= TRTencor:@vm:'Tencor':@vm
PrintTbl:= TRTestWafer:@vm:'Test Wafer':@vm
*PrintTbl:= TRStress:@vm:'Stress Meas'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
*TableColInfo = '^_360':@vm:'<_1195'
*PrintTbl = TR4PP:@vm:'4Pnt Probe'
*Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
****************************************************************************************
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
*
Void = set_printer( 'TEXT', 'Forms Required' )
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )
CustRDS = oconv( CustRDS, 'BX ' )
CustRDSCleanRoomPaper = oconv( CustRDSCleanRoomPaper, 'BX ' )        
COCFront = oconv( COCFront, 'BX ' )     
COCBack = oconv( COCBack, 'BX ' )
if COCFrontCopies > 1 then
   COCFrontCopies:= ' Copies of '
end else
   if COCFrontCopies then
      COCFrontCopies:= ' Copy of '
   end
end
if COCBackCopies > 1 then
   COCBackCopies:= ' Copies of '
end else
   if COCBackCopies then
      COCBackCopies:= ' Copy of '
   end
end
TableColInfo = '^_360':@vm:'<_3270':@vm:'^_360':@vm:'<_3270'
PrintTbl = CustRDS:@vm:'Customer RDSs':@vm:CustRDSCleanRoomPaper:@vm:'RDSs on Cleanroom Paper':@fm
PrintTbl:= COCFront:@vm:COCFrontCopies:'COC FRONT page':@vm:COCBack:@vm:COCBackCopies:'COC BACK page'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
TableColInfo = '^_360':@vm:'<_6180'
if NCRRej = '' then
   * DONT CHECK IT CAUSE IT IS NULL
   NCRRejCheck = ''
end else
   * SIMPLY CHECK IT CAUSE IT IS NOT NULL
   NCRRejCheck = 'X'
end
PrintTbl = NCRRejCheck:@vm:'Ship NCRs after ':NCRRej:' rejects':@vm
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )

Void = set_printer( 'TEXT', 'Bagging Required' )
TableColInfo = '<_7245'
PrintTbl = 'Bagging Requirements: ':BagReq
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
*
Void = set_printer( 'TEXT', 'Customer Shipment Frequency' )
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )
PartialShip = oconv( PartialShip, 'BX ' )
swap 'WO' with 'Work Order' in FullShipType
swap 'PO' with 'Purchase Order' in FullShipType
FullShipDesc = ''
if FullShipType then
   FullShipDesc = 'Only ship when ':FullShipType:' is complete.'
end
* WILL BE EITHER WO OR PO - GOT THAT SHMO
TableColInfo = '<_360':@vm:'<_4959':@vm:'<_5551'
PrintTbl = PartialShip:@vm:'Customer Accepts Partial Shipments':@vm:FullShipDesc
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL )
Void = set_printer( 'TEXT', '' )
Void = set_printer( 'TEXT', '' )
*
Font<2> = 12
Font<4> = 1
Void = set_printer( 'FONT', Font )
TableColInfo = '<_3600'
PrintTbl = 'Signature:'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_BOTTOM:@fm:'R' )
Void = set_printer( 'TEXT', '' )
TableColInfo = '<_1080':@vm:'^_2520'
PrintTbl = 'Date:':@vm:fmt( oconv( date(), 'D2/' ), 'R#15' )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_BOTTOM:@fm:'R' )
Void = set_printer( 'TEXT', '' )
PrintTbl = 'Time:':@vm:fmt( oconv( time(), 'MTH' ), 'R#15' )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_BOTTOM:@fm:'R' )
* termination

IF NOT(PrinterInitialized) THEN
	stat = set_printer( 'TERM' )
END      
RETURN 0
*===========================================================================*

