compile function print_control_plan_org( PSNId )
declare function security_check, set_printer, get_printer, msg, fieldcount, entid, repository, obj_Install,Printer_Select
declare subroutine security_err_msg

$insert security_rights_equ
$insert oiprint_equates
$insert msg_equates
$insert prod_spec_equ
$insert quote_spec_equ
$insert company_equ

PrintPath = Printer_Select('',1)		;* Get default printer path
Stat = set_printer( 'INIT', '', '', .25:@fm:.25:@fm:.25:@fm:.25, 1, 3 ,PrintPath)

* PULL OFF ALL VARIABLES
* PSN IS PASSED VIA THE CALLING PROGRAM AND THIS CODE WILL PICK UP 
* THE REST VIA TRANSLATION

PSN             = xlate( 'PROD_SPEC', PSNId, '', 'X' )
PartNums        = PSN<prod_spec_part_nums$>
SubstrInfo      = PSN<prod_spec_spec_substrate$>
SpecialInst     = SubstrInfo<1,QSSubInstructions$>
ProveInInst     = xlate( 'PROD_SPEC', PSNId, 'PROVEIN_INST', 'X' )
SalesNotes      = PSN<prod_spec_sales_notes$> 
SpecEpi         = PSN<prod_spec_spec_epi$>
LayerType       = PSN<prod_spec_layer_type$>
convert char(248) to @fm in SpecEpi
Lcnt = fieldcount( SpecEpi, @fm )
SpecType        = SubstrInfo<1,QSSubSpecType$>
EntryDate       = PSN<prod_spec_entry_date$>
RevDate         = PSN<prod_spec_mod_date$>

KeyContactPhone = "Onsite Quality Representative (480) 668-4000"

SupplierCode    = PSN<prod_spec_supplier_code$>
PreClean        = SubstrInfo<1,QSSubPreClean$>
PostClean       = SubstrInfo<1,QSSubPostClean$>
OxideStrip      = SubStrInfo<1,QSSubOxide$>
CustName        = xlate( 'COMPANY', psn<prod_spec_cust_id$>, company_co_name$, 'X' )
swap 'DSP & 5" 2 layer' with '' in CustName

Font = "Times New Roman,36,C,1"
convert ',' to @fm in Font
Stat = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', 'Control Plan (':CustName:')' )
Font<2> = 10
Font<3> = 'L'
Stat = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
*CoreTeam        = 'Steve Rickborn, Jon Flagg, Paul Westphal, Dan Syllaba, John Parsey, Jim Sellar (480) 668-4000'
CoreTeam	= 'Executive Director, Quality Manager, Process Engineering Manager, Maintenance Engineering Manager, Manufacturing Manager (480) 668-4000'


swap @vm with ', ' in PartNums
* HEADINGS FOR TYPE
TableColInfo = '^_1300':@vm:'^_1300':@vm:'^_1300':@vm:'^_1300'
PrintTbl = 'Pre-Qualification':@vm:'Qualification':@vm:'Pre-Production':@vm:'Production'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_NONE:@fm:'C' )
* DATA FOR TYPE
TableColInfo = '^_1300':@vm:'^_1300':@vm:'^_1300':@vm:'^_1300'
PreQual       = ''
Qualification = ''
PreProd       = ''
Production    = ''

if SpecType = 'Q' then
   Qualification = 'X'
end
if SpecType = 'E' then
   PreProd = 'X'
end
if SpecType = 'P' then
   Production = 'X'
end
if SpecType = 'U' then
   PreQual = 'X'
end

PrintTbl = PreQual:@vm:Qualification:@vm:PreProd:@vm:Production
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
Void = set_printer( 'TEXT', '' )

* HEADINGS FOR PLAN NUMBER, CONTACT AND DATES
TableColInfo = '^_4320':@vm:'^_4320':@vm:'^_2160':@vm:'^_2160'
PrintTbl = 'Control Plan Number':@vm:'Key Contact/Phone':@vm:'Date(Orig.)':@vm:'Date(Rev.)'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_NONE:@fm:'C' )
* DATA  FOR PLAN NUMBER, CONTACT AND DATES
Font<4> = 0
Void = set_printer( 'FONT', Font )
PrintTbl = PSNId:' - ':LayerType:@vm:KeyContactPhone:@vm:oconv( EntryDate, 'D2/' ):@vm:oconv( RevDate, 'D2/' )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )

* HEADINGS FOR PART NUMBERS, CORE TEAM CUST ENGINEERING DATE
TableColInfo = '^+4320':@vm:'^+4320':@vm:'^+4320'
PrintTbl = 'Part Number/Latest Change Level':@vm:'Core Team':@vm:'Customer Engineering Approval/Date'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_NONE:@fm:'C' )
* DATA FOR PART NUMBERS, CORE TEAM CUST ENGINEERING DATE
Font<4> = 0
Void = set_printer( 'FONT', Font )
PrintTbl = PartNums:@vm:CoreTeam:@vm:'NA'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )

* HEADINGS FOR PART NAME DESCRIPTION, SUPPLIER APPROVAL
TableColInfo = '^_4320':@vm:'^_4320':@vm:'^_4320'
PrintTbl = 'Part Name/Description':@vm:'Supplier':@vm:'Customer Quality Approval/Date'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_NONE:@fm:'C' )
* DATA FOR PART NAME DESCRIPTION, SUPPLIER APPROVAL
Font<4> = 0
Void = set_printer( 'FONT', Font )
PrintTbl = 'Silicon Epitaxy':@vm:obj_Install('Get_Prop','Company'):@vm:'NA'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )

* HEADINGS FOR SUPPLIER CODE
TableColInfo = '^_4320':@vm:'^_4320':@vm:'^_2160':@vm:'^_2160'
PrintTbl = 'Plant':@vm:'Supplier Code':@vm:'Other Approval/Date':@vm:'Other Approval/Date'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_NONE:@fm:'C' )
* DATA FOR SUPPLIER CODE
Font<4> = 0
Void = set_printer( 'FONT', Font )
PrintTbl = 'Mesa, Arizona':@vm:SupplierCode:@vm:'NA':@vm:'NA'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )

* NEED TO PUT HEADINGS HERE
StepNumber = 0
Void = set_printer( 'TEXT', '' )
Font<4> = 1
Void = set_printer( 'FONT', Font )
TableColInfo = '^_720':@vm:'^_1440':@vm:'^_1440':@vm:'^_547':@vm:'^_1440':@vm:'^_1440':@vm
TableColInfo:= '^_2160':@vm:'^_1440':@vm:'^_1200':@vm:'^_840':@vm:'^_1080':@vm:'^_1440'	
PrintTbl = 'Step':@vm:'Process Name':@vm:'Machine':@vm:'PSN':@vm:'Product':@vm:'Process':@vm:'Spec Tolerance':@vm
PrintTbl:= 'Eval Meas':@vm:'Size':@vm:'Freq.':@vm:'Control Method':@vm:'Reaction Plan'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_ALL:@fm:'C' )
Font<4> = 0
Void = set_printer( 'FONT', Font )
*
* RECEIVING STEP WILL BE STEP ONE OF EACH CONTROL PLAN
StepNumber += 1
PrintTbl = StepNumber:@vm:'Receiving':@vm:'Paperwork':@vm:PSNId:@vm:'Paperwork':@vm:'Visual':@vm
PrintTbl:= 'Consistent Data':@vm:'Visual':@vm:'Shipment':@vm:'All':@vm:'WI':@vm:'Pass/Fail'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )

*
PreBrightLight    = PSN<prod_spec_pre_brightlight$>
PreMicroscope     = PSN<prod_spec_pre_microscope$>
PreSurfscan       = PSN<prod_spec_pre_surfscan$>
PreSurfscanRecipe = PSN<prod_spec_pre_surfscan_recipe$>
PreLPDLimit       = PSN<prod_spec_pre_lpd$>

FirstBrightLight    = PSN<prod_spec_first_brightlight$>
FirstMicroscope     = PSN<prod_spec_first_microscope$>
FirstSurfscan       = PSN<prod_spec_first_surfscan$>
FirstSurfscanRecipe = PSN<prod_spec_first_surfscan_recipe$>
FirstLPDLimit       = PSN<prod_spec_post_lpd$>

PostBrightLight     = PSN<prod_spec_post_clean_brightlight$>
PostSurfscan        = PSN<prod_spec_post_clean_surfscan$>
PostSurfscanRecipe  = PSN<prod_spec_post_clean_surfscan_recipe$>

*********************** PRE-CLEANING - MOVED FROM BELOW -- SCOTT EVANS **********************

if ( OxideStrip ) then
	* PRE CLEANING STEP
	StepNumber += 1	
	ProcessName = 'HF Strip' ;* #16
	Machine     = 'HF'  ;* #17
	Product     = 'SC-1' ;* #19
	Process     = '20min or Dewet';* #20
	SpecTol     = 'NA' ;*#22
	EvalMeas    = 'HF'  ;* #23
	Size        = '1 Cass'      ;* #24a
	Freq        = 'All'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end


if ( PreClean <> 'No' ) and ( PreClean <> '' ) then
	* PRE CLEANING STEP
	Process = ''
	StepNumber += 1	
	ProcessName = 'Pre-epi Clean' ;* #16
	if PreClean = 'If Necessary' then
	   PreClean = 'Semitool'
	end
	if PreClean = 'Semitool' then
	   Process = 'SC-1 Clean'
	end
	if PreClean = 'Megasonic' then
	   Process = field( SubstrInfo<1,QSSubWafersize$>, ' ', 3 ):'"'
	end
	Machine     = PreClean  ;* #17
	Product     = 'SC-1' ;* #19
	Process     = Process      ;* #20
	SpecTol     = 'NA' ;*#22
	EvalMeas    = PreClean  ;* #23
	Size        = '1 Cass'      ;* #24a
	Freq        = 'All'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end


*********************** END OF PRE-CLEANING *************************************************




if PreBrightLight then
	* BRIGHTLIGHT PRE EPI INSPECTION
	StepNumber += 1
	ProcessName = 'Pre-epi Insp' ;* #16
	Machine     = 'Brightlight'  ;* #17
	Product     = 'LPDs'         ;* #19
	Process     = 'Visual'       ;* #20
	SpecTol     = '<':PreLPDLimit;* #22
	EvalMeas    = 'Brightlight'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if PreMicroscope then
	* MICROSCOPE
	StepNumber += 1	
	ProcessName = 'Pre-epi Insp' ;* #16
	Machine     = 'Microscope'  ;* #17
	Product     = 'Surface Quality' ;* #19
	Process     = 'Visual'       ;* #20
	SpecTol     = 'PSN#':PSNId:' - Surface Spec' ;*#22
	EvalMeas    = 'Microscope'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if PreSurfscan then
	* SURFSCAN
	StepNumber += 1	
	ProcessName = 'Pre-epi Insp' ;* #16
	Machine     = 'Surf Scan'  ;* #17
	Product     = 'LPDs' ;* #19
	Process     = PreSurfscanRecipe       ;* #20
	SpecTol     = 'See Hard Copy Spec' ;*#22
	EvalMeas    = 'Surf Scan'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

*if ( OxideStrip ) then
*	* PRE CLEANING STEP
*	StepNumber += 1	
*	ProcessName = 'HF Strip' ;* #16
*	Machine     = 'HF'  ;* #17
*	Product     = 'SC-1' ;* #19
*	Process     = '20min or Dewet';* #20
*	SpecTol     = 'NA' ;*#22
*	EvalMeas    = 'HF'  ;* #23
*	Size        = '1 Cass'      ;* #24a
*	Freq        = 'All'     ;* #24b
*	CtrlMethod  = 'WI'           ;* #25
*	RPlan       = 'ORAP'         ;* #26
*
*	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
*	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
*	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
*end


*if ( PreClean <> 'No' ) and ( PreClean <> '' ) then
*	* PRE CLEANING STEP
*	Process = ''
*	StepNumber += 1	
*	ProcessName = 'Pre-epi Clean' ;* #16
*	if PreClean = 'If Necessary' then
*	   PreClean = 'Semitool'
*	end
*	if PreClean = 'Semitool' then
*	   Process = 'SC-1 Clean'
*	end
*	if PreClean = 'Megasonic' then
*	   Process = field( SubstrInfo<1,QSSubWafersize$>, ' ', 3 ):'"'
*	end
*	Machine     = PreClean  ;* #17
*	Product     = 'SC-1' ;* #19
*	Process     = Process      ;* #20
*	SpecTol     = 'NA' ;*#22
*	EvalMeas    = PreClean  ;* #23
*	Size        = '1 Cass'      ;* #24a
*	Freq        = 'All'     ;* #24b
*	CtrlMethod  = 'WI'           ;* #25
*	RPlan       = 'ORAP'         ;* #26
*
*	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
*	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
*	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
*end

ReactorTypes = ''
ReactorTypes = oconv( PSN<prod_spec_reactor_type$> , '[PROD_SPEC_RTYPE_CONV]' )
*E1      = PSN<prod_spec_e1$>
*E2      = PSN<prod_spec_e2$>
*Centura = PSN<prod_spec_centura$>
*Gemini  = PSN<prod_spec_gemini$>
*MFC     = PSN<prod_spec_mfc$>
*if E1 then
*   ReactorTypes := 'E1, '
*end
*if E2 then
*   ReactorTypes := 'E2, '
*end
*if Centura then
*   ReactorTypes := 'Centura, '
*end
*if Gemini then
*   ReactorTypes := 'Gemini, '
*end
*if MFC then
*   ReactorTypes := 'MFC, '
*end
*ReactorTypes[-2,2] = ''

ThickMin       = xlate( 'PROD_SPEC', PSNId, 'THICK_MIN_ALL', 'X' )
ThickMax       = xlate( 'PROD_SPEC', PSNId, 'THICK_MAX_ALL', 'X' )
ThickMeasFirst = xlate( 'PROD_SPEC', PSNId, 'THICK_MEAS_FIRST_ALL', 'X' )
ThickMeasLast  = xlate( 'PROD_SPEC', PSNId, 'THICK_MEAS_LAST_ALL', 'X' )
ThickMeasFreq  = xlate( 'PROD_SPEC', PSNId, 'THICK_MEAS_FREQ_ALL', 'X' )
ThickMeasTool  = xlate( 'PROD_SPEC', PSNId, 'THICK_MEAS_TOOL_ALL', 'X' )
ThickMeasType  = xlate( 'PROD_SPEC', PSNId, 'THICK_MEAS_TYPE_ALL', 'X' )
ThickMeasSPC   = xlate( 'PROD_SPEC', PSNId, 'THICK_MEAS_SPC_ALL', 'X' )
ThickUnits     = xlate( 'PROD_SPEC', PSNId, 'THICK_UNITS_ALL', 'X' )

ResMin       = xlate( 'PROD_SPEC', PSNId, 'RES_MIN_ALL', 'X' )
ResMax       = xlate( 'PROD_SPEC', PSNId, 'RES_MAX_ALL', 'X' )
ResMeasFirst = xlate( 'PROD_SPEC', PSNId, 'RES_MEAS_FIRST_ALL', 'X' )
ResMeasLast  = xlate( 'PROD_SPEC', PSNId, 'RES_MEAS_LAST_ALL', 'X' )
ResMeasFreq  = xlate( 'PROD_SPEC', PSNId, 'RES_MEAS_FREQ_ALL', 'X' )
ResMeasTool  = xlate( 'PROD_SPEC', PSNId, 'RES_MEAS_TOOL_ALL', 'X' )
ResMeasType  = xlate( 'PROD_SPEC', PSNId, 'RES_MEAS_TYPE_ALL', 'X' )
ResMeasSPC   = xlate( 'PROD_SPEC', PSNId, 'RES_MEAS_SPC_ALL', 'X' )
ResUnits     = xlate( 'PROD_SPEC', PSNId, 'RES_UNITS_ALL', 'X' )

ConMin       = xlate( 'PROD_SPEC', PSNId, 'CON_MIN_ALL', 'X' )
ConMax       = xlate( 'PROD_SPEC', PSNId, 'CON_MAX_ALL', 'X' )
ConMeasFirst = xlate( 'PROD_SPEC', PSNId, 'CON_MEAS_FIRST_ALL', 'X' )
ConMeasLast  = xlate( 'PROD_SPEC', PSNId, 'CON_MEAS_LAST_ALL', 'X' )
ConMeasFreq  = xlate( 'PROD_SPEC', PSNId, 'CON_MEAS_FREQ_ALL', 'X' )
ConMeasTool  = xlate( 'PROD_SPEC', PSNId, 'CON_MEAS_TOOL_ALL', 'X' )
ConMeasType  = xlate( 'PROD_SPEC', PSNId, 'CON_MEAS_TYPE_ALL', 'X' )
ConMeasSPC   = xlate( 'PROD_SPEC', PSNId, 'CON_MEAS_SPC_ALL', 'X' )
ConUnits     = xlate( 'PROD_SPEC', PSNId, 'CON_UNITS_ALL', 'X' )

StressMin       = xlate( 'PROD_SPEC', PSNId, 'STRESS_MIN', 'X' )
StressMax       = xlate( 'PROD_SPEC', PSNId, 'STRESS_MAX', 'X' )
StressMeasFirst = xlate( 'PROD_SPEC', PSNId, 'STRESS_MEAS_FIRST', 'X' )
StressMeasLast  = xlate( 'PROD_SPEC', PSNId, 'STRESS_MEAS_LAST', 'X' )
StressMeasFreq  = xlate( 'PROD_SPEC', PSNId, 'STRESS_MEAS_FREQ', 'X' )
StressMeasTool  = xlate( 'PROD_SPEC', PSNId, 'STRESS_MEAS_TOOL', 'X' )
StressMeasType  = xlate( 'PROD_SPEC', PSNId, 'STRESS_MEAS_TYPE', 'X' )
StressMeasSPC   = xlate( 'PROD_SPEC', PSNId, 'STRESS_MEAS_SPC', 'X' )

TransSpec       = xlate( 'PROD_SPEC', PSNId, 'TRANS_SPEC', 'X' )
TransMeasFirst  = xlate( 'PROD_SPEC', PSNId, 'TRANS_MEAS_FIRST', 'X' )
TransMeasLast   = xlate( 'PROD_SPEC', PSNId, 'TRANS_MEAS_LAST', 'X' )
TransMeasFreq   = xlate( 'PROD_SPEC', PSNId, 'TRANS_MEAS_FREQ', 'X' )
TransMeasTool   = xlate( 'PROD_SPEC', PSNId, 'TRANS_MEAS_TOOL', 'X' )
TransMeasType   = xlate( 'PROD_SPEC', PSNId, 'TRANS_MEAS_TYPE', 'X' )
TransMeasSPC    = xlate( 'PROD_SPEC', PSNId, 'TRANS_MEAS_SPC', 'X' )

for i = 1 to Lcnt
	StepNumber += 1
   ThisThickMin = oconv( ThickMin<1,i>, 'MD2' )
   ThisThickMax = oconv( ThickMax<1,i>, 'MD2' )
   ThisThickTool = ThickMeasTool<1,i>
   ThisThickFirst = ThickMeasFirst<1,i>
   ThisThickLast  = ThickMeasLast<1,i>
   ThisThickFreq  = ThickMeasFreq<1,i>
   ThisThickType  = ThickMeasType<1,i>
   ThisThickUnit  = ThickUnits<1,i>
   ThisThickSPC   = ThickMeasSPC<1,i>

   swap 'æm' with 'um' in ThisThickUnit 
   swap 'ê-cm' with 'ohm.cm' in ThisThickUnit
   swap 'ê/Ü' with 'ohm/sq' in ThisThickUnit
   swap '' with 'A' in ThisThickUnit   
          
	ProcessName = 'Epitaxy Layer ':i ;* #16
	Machine     = ReactorTypes  ;* #17
	Product     = 'Thickness' ;* #19
	Process     = 'Epi Growth';* #20
	SpecTol     = ThisThickMin:' - ':ThisThickMax:ThisThickUnit;*#22
	EvalMeas    = ThisThickTool;* #23
	Size        = ThisThickType;* #24a
	Freq = ''
	if ThisThickFirst then
	   Freq = '1st, '
	end
	if ThisThickFreq then
	   Freq:= ThisThickFreq:', '
	end
	if ThisThickLast then
	   Freq:= 'last, '
	end
	Freq[-2,2] = ''
	if ThisThickSPC = '' then
	   ThisThickSPC = 0
	end
	CtrlMethod  = oconv( ThisThickSPC, 'BSPC,WI' )           ;* #25
	RPlan       = 'OCAP'         ;* #26
	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
	
   * RESISTIVITY
	StepNumber += 1      
   ThisResMin     = oconv( ResMin<1,i>, 'MD3' )
   ThisResMax     = oconv( ResMax<1,i>, 'MD3' )
   ThisResTool    = ResMeasTool<1,i>
   ThisResFirst   = ResMeasFirst<1,i>
   ThisResLast    = ResMeasLast<1,i>
   ThisResFreq    = ResMeasFreq<1,i>
   ThisResType    = ResMeasType<1,i>
   ThisResUnit    = ResUnits<1,i>
   ThisResSPC     = ResMeasSPC<1,i>     
   
   swap 'æm' with 'um' in ThisResUnit 
   swap 'ê-cm' with 'ohm.cm' in ThisResUnit
   swap 'ê/Ü' with 'ohm/sq' in ThisResUnit
   swap '' with 'A' in ThisResUnit   
   
	ProcessName = 'Epitaxy Layer ':i ;* #16
	Machine     = ReactorTypes  ;* #17
	Product     = 'Resistivity' ;* #19
	Process     = 'Epi Growth';* #20
	SpecTol     = ThisResMin:' - ':ThisResMax:ThisResUnit ;*#22
	EvalMeas    = ThisResTool;* #23
	Size        = ThisResType;* #24a
	Freq = ''
	if ThisResFirst then
	   Freq: = '1st, '
	end
	if ThisResFreq then
	   Freq:= ThisResFreq:', '
	end
	if ThisResLast then
	   Freq:= 'last, '
	end
   Freq[-2,2] = '' ;* #24b
	if ThisResSPC = '' then
	   ThisResSPC = 0
	end   
	CtrlMethod  = oconv( ThisResSPC, 'BSPC,WI' )          ;* #25
	RPlan       = 'OCAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
	
   * CONCENTRATION
   ThisConMin     = oconv( ConMin<1,i>, 'MS21' )   
   if ( ThisConMin <> '' ) then
		StepNumber += 1      
	   ThisConMax     = oconv( ConMax<1,i>, 'MS21' )
	   ThisConTool    = ConMeasTool<1,i>
	   ThisConFirst   = ConMeasFirst<1,i>
	   ThisConLast    = ConMeasLast<1,i>
	   ThisConFreq    = ConMeasFreq<1,i>
	   ThisConType    = ConMeasType<1,i>
	   ThisConUnit    = ConUnits<1,i>
	   ThisConSPC     = ConMeasSPC<1,i>
	   
	   swap 'æm' with 'um' in ThisConUnit 
	   swap 'ê-cm' with 'ohm.cm' in ThisConUnit
	   swap 'ê/Ü' with 'ohm/sq' in ThisConUnit
	   swap '' with 'A' in ThisConUnit   
	   
		ProcessName = 'Epitaxy Layer ':i ;* #16
		Machine     = ReactorTypes  ;* #17
		Product     = 'Concentration' ;* #19
		Process     = 'Epi Growth';* #20
		SpecTol     = ThisConMin:' - ':ThisConMax:ThisConUnit ;*#22
		EvalMeas    = ThisConTool;* #23
		Size        = ThisConType;* #24a
		Freq = ''
		if ThisConFirst then
		   Freq: = '1st, '
		end
		if ThisConFreq then
		   Freq:= ThisResFreq:', '
		end
		if ThisConLast then
		   Freq:= 'last, '
		end
	   Freq[-2,2] = '' ;* #24b
	   if ThisConSPC = '' then
	      ThisConSPC = 0
	   end	   
		CtrlMethod  = oconv( ThisConSPC, 'BSPC,WI' )          ;* #25
		RPlan       = 'OCAP'         ;* #26

		PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
		PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
		Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
	end	
next i

* STRESS
StressMin     = oconv( StressMin, 'MS21' )   
if ( StressMin <> '' ) then
	StepNumber += 1      
   StressMax     = oconv( StressMax, 'MS21' )
   StressTool    = StressMeasTool
   StressFirst   = StressMeasFirst
   StressLast    = StressMeasLast
   StressFreq    = StressMeasFreq
   StressType    = StressMeasType
   StressSPC     = StressMeasSPC
	   
	ProcessName = 'Epitaxy Layer 1' ;* #16 ONLY ONE LAYER FOR STRESS
	Machine     = ReactorTypes  ;* #17
	Product     = 'Stress' ;* #19
	Process     = 'Epi Growth';* #20
	SpecTol     = StressMin:' - ':StressMax ;*#22
	EvalMeas    = StressTool;* #23
	Size        = StressType;* #24a
	Freq = ''
	if StressFirst then
	   Freq: = '1st, '
	end
	if StressFreq then
	   Freq:= StressFreq:', '
	end
	if StressLast then
	   Freq:= 'last, '
	end
   Freq[-2,2] = '' ;* #24b
	if StressSPC = '' then
	   StressSPC = 0
	end   
	CtrlMethod  = oconv( StressSPC, 'BSPC,WI' ) ;* #25
	RPlan       = 'OCAP'         ;* #26
	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

* TRANSITION
TransSpec     = oconv( TransSpec, 'MD2' )   
if ( TransSpec <> '' ) then
	StepNumber += 1      
   TransTool    = TransMeasTool
   TransFirst   = TransMeasFirst
   TransLast    = TransMeasLast
   TransFreq    = TransMeasFreq
   TransType    = TransMeasType
   TransSPC     = TransMeasSPC
	   
	ProcessName = 'Epitaxy Layer 1' ;* #16 ONLY ONE LAYER FOR TRANSITION
	Machine     = ReactorTypes  ;* #17
	Product     = 'Transition' ;* #19
	Process     = 'Epi Growth';* #20
	SpecTol     = TransSpec ;*#22
	EvalMeas    = TransTool;* #23
	Size        = TransType;* #24a
	Freq = ''
	if TransFirst then
	   Freq: = '1st, '
	end
	if TransFreq then
	   Freq:= TransFreq:', '
	end
	if TransLast then
	   Freq:= 'last, '
	end
   Freq[-2,2] = '' ;* #24b
	if TransSPC = '' then
	   TransSPC = 0
	end   
	CtrlMethod  = oconv( TransSPC, 'BSPC,WI' )           ;* #25
	RPlan       = 'OCAP'         ;* #26
	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if FirstBrightLight then
	* BRIGHTLIGHT FIRST WAFER INSPECTION
	StepNumber += 1	
	ProcessName = 'First Wafer Insp' ;* #16
	Machine     = 'Brightlight'  ;* #17
	Product     = 'LPDs'         ;* #19
	Process     = 'Visual'       ;* #20
	SpecTol     = '<':FirstLPDLimit;* #22
	EvalMeas    = 'Brightlight'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if FirstMicroscope then
	* FIRST MICROSCOPE
	StepNumber += 1
	ProcessName = 'First Wafer Insp' ;* #16
	Machine     = 'Microscope'  ;* #17
	Product     = 'Surface Quality' ;* #19
	Process     = 'Visual'       ;* #20
	SpecTol     = 'PSN#':PSNId:' - Surface Spec' ;*#22
	EvalMeas    = 'Microscope'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if FirstSurfscan then
	* FIRST SURFSCAN
	StepNumber += 1
	ProcessName = 'First Wafer Insp' ;* #16
	Machine     = 'Surf Scan'  ;* #17
	Product     = 'LPDs' ;* #19
	Process     = FirstSurfscanRecipe       ;* #20
	SpecTol     = 'See Hard Copy Spec' ;*#22
	EvalMeas    = 'Surf Scan'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if ( PostClean <> 'No' ) and ( PostClean <> '' ) then
	* POST CLEANING STEP
	Process = ''
	StepNumber += 1	
	ProcessName = 'Post-epi Clean' ;* #16
	if PostClean = 'Semitool' then
	   Process = 'SC-1 Clean'
	end
	if PostClean = 'Megasonic' then
	   Process = field( SubstrInfo<1,QSSubWafersize$>, ' ', 3 ):'"'
	end
	Machine     = PostClean  ;* #17
	Product     = 'SC-1' ;* #19
	Process     = Process      ;* #20
	SpecTol     = 'NA' ;*#22
	EvalMeas    = PostClean  ;* #23
	Size        = '1 Cass'      ;* #24a
	Freq        = 'All'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if PostBrightLight then
	* BRIGHTLIGHT POST EPI
	StepNumber += 1	
	ProcessName = 'Post-epi Insp' ;* #16
	Machine     = 'Brightlight'  ;* #17
	Product     = 'LPDs'         ;* #19
	Process     = 'Visual'       ;* #20
	SpecTol     = '<':FirstLPDLimit;* #22 ;* USING FIRST CAUSE THIS WOULD BE CONSIDERED POST EPI
	EvalMeas    = 'Brightlight'  ;* #23
	Size        = '1 Wafer'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

if PostSurfscan then
	* POST SURFSCAN
	StepNumber += 1	
	ProcessName = 'Post-epi Insp' ;* #16
	Machine     = 'Surf Scan'  ;* #17
	Product     = 'LPDs' ;* #19
	Process     = PostSurfscanRecipe       ;* #20
	SpecTol     = 'See Hard Copy Spec' ;*#22
	EvalMeas    = 'Surf Scan'  ;* #23
	Size        = '100%'      ;* #24a
	Freq        = 'Per Cass'     ;* #24b
	CtrlMethod  = 'WI'           ;* #25
	RPlan       = 'ORAP'         ;* #26

	PrintTbl = StepNumber:@vm:ProcessName:@vm:Machine:@vm:PSNId:@vm:Product:@vm:Process:@vm:SpecTol:@vm
	PrintTbl:= EvalMeas:@vm:Size:@vm:Freq:@vm:CtrlMethod:@vm:RPlan
	Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )
end

* SHIPPING STEP WILL THE LAST STEP OF EACH CONTROL PLAN
StepNumber += 1
PrintTbl = StepNumber:@vm:'Shipping':@vm:'Paperwork':@vm:PSNId:@vm:'Paperwork':@vm:'Visual':@vm
PrintTbl:= 'Consistent Data':@vm:'Visual':@vm:'Shipment':@vm:'All':@vm:'WI':@vm:'Pass/Fail'
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 1, TB_ALL:@fm:'C' )

* PRINT THE SPECIAL INSTRUCTIONS
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
Void = set_printer( 'TEXT', 'Special Instructions:' )
TableColInfo = '<_15120'
PrintTbl = SpecialInst
Font<4> = 0
Void = set_printer( 'FONT', Font )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_BOX:@fm:'C' )

* PRINT THE PROVEIN INSTRUCTIONS
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
Void = set_printer( 'TEXT', 'Provein Instructions:' )
TableColInfo = '<_15120'
PrintTbl = ProveInInst
Font<4> = 0
Void = set_printer( 'FONT', Font )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_BOX:@fm:'C' )

* PRINT THE SALES/CUST SERVICE NOTES
Font<4> = 1
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', '' )
Void = set_printer( 'TEXT', 'Sales/Customer Service Notes:' )
TableColInfo = '<_15120'
PrintTbl = SalesNotes
Font<4> = 0
Void = set_printer( 'FONT', Font )
Void = set_printer( 'ADDTABLE', TableColInfo, '', PrintTbl, '', '', 0, TB_BOX:@fm:'C' )

stat = set_printer( 'TERM', 1 )

RETURN 0
*===========================================================================*

