compile function PRINT_RECIPE( RecipeIds, OvrOnly )
begin condition 
pre:
post:
end condition
$insert logical
$insert msg_equates
$insert recipe_equ
$insert recipe_layer_info_equ
$insert oiprint_equates
declare function fieldcount, msg, key_sort, set_printer, get_printer
* BUTTON DISABLED ON WINDOW IF THIS IS EVER USED AGAIN IT WILL
* NEED TO CONFORM TO THE NEW RECIPE LAYOUT
* ALSO THE OVERRIDE STUFF IS NOW GONE
* 3/10/99
if RecipeIds then
    OverriddenFound = false$
    PrinterSetup = false$
    NumReactors = xlate( 'CONFIG', 'WO_MAST_SCHED', 3, 'X' )
    IdCnt = fieldcount( RecipeIds, @fm )
    if OvrOnly else
       * printing normal recipe stuff so start the initial printing setup
       Void = set_printer( 'INIT', '', '', '':@fm:'':@fm:.25:@fm:'', 0 )
    end
    Font = "Courier New,14,L,1"
    convert ',' to @fm in Font
    Hf = Font
    Tfon = Font    
    Stat = set_printer( 'FONT', Font )
    for i = 1 to IdCnt
        ThisRecipeId = RecipeIds<i>
        if OvrOnly then
           gosub PrintOvrOnly
        end else
           gosub PrintRecipe
        end
    next i
    stat = set_printer( 'TERM' )
    if ( OvrOnly ) and ( OverriddenFound = false$ ) then
       * they selected overridden only and we found nada bendejo
       MsgInfo = ''
       MsgInfo<mtext$> = 'No overridden information found...'
       MsgInfo<micon$> = '!'
       Void = msg( '', MsgInfo ) 
    end
end
return 0
*================================================================================================*
PrintOvrOnly:
PrintedRealRecipe = false$
for zz = 20 to NumReactors
	Trec = xlate( 'CONFIG', 'RECIPE*':zz:'*':ThisRecipeId, '', 'X' )
	if Trec then
   	if PrinterSetup else
	   	Void = set_printer( 'INIT', '', '', '':@fm:'':@fm:.25:@fm:'', 0 )
      	PrinterSetup = true$
   	end
	   if PrintedRealRecipe else
	      gosub PrintRecipe
	      PrintedRealRecipe = true$      
	   end
   	OverriddenReactor = zz
   	OverriddenFound = true$
	   RecipeRec       = Trec<1>
	   SLayers         = Trec<2>
   	OverriddenBy    = Trec<3>
   	OverriddenDate  = Trec<4>
   	gosub PrintOvrOnlyDoIt
   end
next zz
return
*================================================================================================*
PrintOvrOnlyDoIt:
Font<2> = 16
Font<4> = 1
Void = set_printer( 'FONT', Font )
TextOut = 'OverRidden recipe information for reactor ':OverriddenReactor
Void = set_printer( 'TEXT', TextOut )
TextOut = 'OverRidden by ':oconv( OverriddenBy, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ):' on ':OverriddenDate
Void = set_printer( 'TEXT', TextOut )
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )  
TextOut = fmt( 'Recipe No: ':ThisRecipeId, 'L#38' ):'Recipe Name: ':xlate( 'RECIPE', RecipeRec<1,1>, recipe_recipe_name$, 'X' )
Void = set_printer( 'TEXT', TextOut )
Void = set_printer( 'TEXT', '' )
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )    
Table = '' 
TLine = 'EPI GROWTH,BAKE,ETCH'
Table<1> = TLine
TLine = 'Dopant: ':RecipeRec<1,2>:',Time: ':RecipeRec<1,12>:',Time: ':RecipeRec<1,16>
Table<2> = TLine
TLine = 'Temp: ':RecipeRec<1,4>:',Temp: ':RecipeRec<1,13>:',Temp: ':RecipeRec<1,17>
Table<3> = TLine
TLine = 'H2 Flow: ':RecipeRec<1,5>:',H2Flow: ':RecipeRec<1,14>:',H2 Flow: ':RecipeRec<1,18>
Table<4> = TLine
TLine = 'Diluent: ':RecipeRec<1,8>:',Susc Rot: ':RecipeRec<1,15>:',HCL: ':RecipeRec<1,19>
Table<5> = TLine
TLine = 'Source Gases: ':RecipeRec<1,9>:' ':RecipeRec<1,10>:' ':RecipeRec<1,11>:',,'
Table<6> = TLine
convert ',' to @vm in Table
x = Set_Printer("TABLE", Table, '', 2.25:@fm:2.25:@fm:2.25, 'L':@fm:'C':@fm:'C', TB_ALL)
stat = set_printer( 'TEXT', '' )
Tnotes = RecipeRec<recipe_notes$>
if Tnotes then
   Void = set_printer( 'TEXT', 'Notes:' )
   swap @tm with '  ' in Tnotes
   x = set_printer( 'TABLE', Tnotes, '', 7.5, 'L', TB_BOX )
end
LCnt = fieldcount( SLayers, char(248) )
for j = 1 to LCnt
   ThisLayer = field( SLayers, char(248), j )
   Void = set_printer( 'TEXT', '' )
   Void = set_printer( 'TEXT', 'L A Y E R  ':j+1 )
   Table = '' 
	TLine = 'EPI GROWTH,BAKE,ETCH'
	Table<1> = TLine
	TLine = 'Dopant: ':ThisLayer<1,6>:',Time: ':ThisLayer<1,16>:',Time: ':ThisLayer<1,20>
	Table<2> = TLine
	TLine = 'Temp: ':ThisLayer<1,8>:',Temp: ':ThisLayer<1,17>:',Temp: ':ThisLayer<1,21>
	Table<3> = TLine
	TLine = 'H2 Flow: ':ThisLayer<1,9>:',H2Flow: ':ThisLayer<1,18>:',H2 Flow: ':ThisLayer<1,22>
	Table<4> = TLine
	TLine = 'Diluent: ':ThisLayer<1,12>:',Susc Rot: ':ThisLayer<1,19>:',HCL: ':ThisLayer<1,23>
	Table<5> = TLine
	TLine = 'Source Gases: ':ThisLayer<1,13>:' ':ThisLayer<1,14>:' ':ThisLayer<1,15>:',,'
	Table<6> = TLine
	convert ',' to @vm in Table
	x = Set_Printer("TABLE", Table, '', 2.25:@fm:2.25:@fm:2.25, 'L':@fm:'C':@fm:'C', TB_ALL)
	stat = set_printer( 'TEXT', '' )
   Tnotes = ThisLayer<1,RecLNotes$>
   if Tnotes then
       Void = set_printer( 'TEXT', 'Notes:' )
       swap @tm with '  ' in Tnotes
       x = set_printer( 'TABLE', Tnotes, '', 7.5, 'L', TB_BOX )
   end
next j
Stat = set_printer( 'TEXT', '' )
Stat = set_printer( 'TEXT', '' )
return
*================================================================================================*	    
PrintRecipe:	    
Font<2> = 14
Font<4> = 1
Void = set_printer( 'FONT', Font )  
RecipeRec = xlate( 'RECIPE', ThisRecipeId, '', 'X' )
SLayers = RecipeRec<recipe_layer_info$>       
TextOut = fmt( 'Recipe No: ':ThisRecipeId, 'L#38' ):'Recipe Name: ':RecipeRec<recipe_recipe_name$>
Void = set_printer( 'TEXT', TextOut )
TextOut = fmt( 'Entry Id: ':oconv( RecipeRec<recipe_entry_id$>, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ), 'L#38' )
TextOut:= 'Entry Date: ':oconv( RecipeRec<recipe_entry_date$>, 'D2/' )
Void = set_printer( 'TEXT', TextOut )
Void = set_printer( 'TEXT', '' )
Font<2> = 12
Font<4> = 0
Void = set_printer( 'FONT', Font )    
Table = '' 
TLine = 'EPI GROWTH,BAKE,ETCH'
Table<1> = TLine
TLine = 'Dopant: ':RecipeRec<recipe_epi_dopant$>:',Time: ':oconv( RecipeRec<recipe_bake_time$>, '[SECONDS_CONV]' ):',Time: ':oconv( RecipeRec<recipe_etch_time$>, '[SECONDS_CONV]' )
Table<2> = TLine
TLine = 'Temp: ':RecipeRec<recipe_epi_temp$>:',Temp: ':RecipeRec<recipe_bake_temp$>:',Temp: ':RecipeRec<recipe_etch_temp$>
Table<3> = TLine
TLine = 'H2 Flow: ':RecipeRec<recipe_epi_h2_flow$>:',H2Flow: ':RecipeRec<recipe_bake_h2$>:',H2 Flow: ':RecipeRec<recipe_etch_h2$>
Table<4> = TLine
TLine = 'Diluent: ':oconv( RecipeRec<recipe_epi_diluent$>, 'MD2'):',Susc Rot: ':RecipeRec<recipe_bake_susc_rot$>:',HCL: ':oconv( RecipeRec<recipe_etch_hcl$>, 'MD2' )
Table<5> = TLine
TLine = 'Source Gases: ':RecipeRec<recipe_epi_gases$>:' ':oconv(RecipeRec<recipe_epi_gas_rate$>, 'MD2'):' ':RecipeRec<recipe_epi_gases_unit$>:',,'
Table<6> = TLine
convert ',' to @vm in Table
x = Set_Printer("TABLE", Table, '', 2.25:@fm:2.25:@fm:2.25, 'L':@fm:'C':@fm:'C', TB_ALL)
stat = set_printer( 'TEXT', '' )
Tnotes = RecipeRec<recipe_notes$>
if Tnotes then
	Void = set_printer( 'TEXT', 'Notes:' )
	swap @tm with '  ' in Tnotes
	x = set_printer( 'TABLE', Tnotes, '', 7.5, 'L', TB_BOX )
end
LCnt = fieldcount( SLayers, char(248) )
for j = 1 to LCnt
	ThisLayer = field( SLayers, char(248), j )
	Void = set_printer( 'TEXT', '' )
	Void = set_printer( 'TEXT', 'L A Y E R  ':j+1 )
	Table = '' 
	TLine = 'EPI GROWTH,BAKE,ETCH'
	Table<1> = TLine
	TLine = 'Dopant: ':ThisLayer<1,RecLEpiDopant$>:',Time: ':oconv( ThisLayer<1,RecLBakeTime$>, '[SECONDS_CONV]' ):',Time: ':oconv( ThisLayer<1,RecLEtchTime$>, '[SECONDS_CONV]' )
	Table<2> = TLine
	TLine = 'Temp: ':ThisLayer<1,RecLEpiTemp$>:',Temp: ':ThisLayer<1,RecLBakeTemp$>:',Temp: ':ThisLayer<1,RecLEtchTemp$>
	Table<3> = TLine
	TLine = 'H2 Flow: ':ThisLayer<1,RecLEpiH2Flow$>:',H2Flow: ':ThisLayer<1,RecLBakeH2$>:',H2 Flow: ':ThisLayer<1,RecLEtchH2$>
	Table<4> = TLine
	TLine = 'Diluent: ':oconv( ThisLayer<1,RecLEpiDiluent$>, 'MD2'):',Susc Rot: ':ThisLayer<1,RecLBakeSuscRot$>:',HCL: ':oconv( ThisLayer<1,RecLEtchHcl$>, 'MD2' )
	Table<5> = TLine
	TLine = 'Source Gases: ':ThisLayer<1,RecLEpiGases$>:' ':oconv(ThisLayer<1,RecLEpiGasRate$>, 'MD2'):' ':ThisLayer<1,RecLEpiGasesUnit$>:',,'
	Table<6> = TLine
	convert ',' to @vm in Table
	x = Set_Printer("TABLE", Table, '', 2.25:@fm:2.25:@fm:2.25, 'L':@fm:'C':@fm:'C', TB_ALL)
	stat = set_printer( 'TEXT', '' )
	Tnotes = ThisLayer<1,RecLNotes$>
	if Tnotes then
		Void = set_printer( 'TEXT', 'Notes:' )
		swap @tm with '  ' in Tnotes
		x = set_printer( 'TABLE', Tnotes, '', 7.5, 'L', TB_BOX )
	end
next j
Stat = set_printer( 'TEXT', '' )
Stat = set_printer( 'TEXT', '' )
*Ypos = get_printer( 'POS' )
*Ypos = Ypos<2>
*stat = set_printer( 'LINESTYLE', ps_solid:@fm:3 )
*stat = set_printer( 'LINE', 0:@fm:Ypos:@fm:7.5:@fm:Ypos, 1 )
return
*================================================================================================*


