compile function prod_spec_comm_old(Branch)
begin condition
pre:
post:
end condition

* THIS CODE IS NOT USED IT IS BEFORE THE PSN SIGNATURE RE-DESIGN
* JUST WANTED TO KEEP A COPY JUST IN CASE 

$insert quote_spec_equ
$insert quote_sigs_equ
$insert recipe_equ
$insert recipe_layer_info_equ
$insert msg_equates
$insert logical
$insert shipping_info_equ

equ CrLf$ to char(13):char(10)

declare function memberof, scroll_enable

ReturnVar = 0
declare function set_property, fieldcount, get_property, msg, editcell, send_event, dialog_box
declare subroutine create_note
Branches = 'ACTIVATE_CHECK,SET_SECURITY,SET_SECURITY_SPEC,LOAD_SURFACE_DEF,SET_MEASURE,LOAD_TOOL_RECIPE,SURFSCAN_CLICK,VALIDATE_DOPANT,VALIDATE_MINMAX,SET_SCANNED_IMAGE,CHECK_KEY_SALES_DATA,VALIDATE_RECIPE,AKRION_RECIPE_CHECK,TW_TYPE_CHECK'
convert ',' to @fm in Branches
locate Branch in Branches using @fm setting Bpos then
   on Bpos gosub activate_check, set_security, set_security_spec, load_surface_def, set_measure, load_tool_recipe, surfscan_click, validate_dopant, validate_minmax, set_scanned_image, check_key_sales_data, validate_recipe, akrion_recipe_check, tw_type_check
end else
   Void = msg( '', 'Invalid Branch ':Bpos:' passed to prod_spec_comm' )
end
return ReturnVar
*===========================================================================*
activate_check:
   * need to check all signatures
   AddlInfo     = get_property( @window:'.SPEC_ADDL', 'TEXT' )
   SubInfo      = get_property( @window:'.SPEC_SUBSTRATE', 'TEXT' )
   NewDevInfo   = get_property( @window:'.SPEC_NEW_DEV', 'TEXT' )   
   CTOFinalSig  = get_property( @window:'.CTO_FINAL_SIGNATURE', 'TEXT' )
   TSISSig      = get_property( @window:'.TSIS_SIGNATURE', 'TEXT' )
   MfgSig       = AddlInfo<1,QSAddMfgSig$>
   EngSig       = AddlInfo<1,QSAddEngSig$>
   RecSig       = AddlInfo<1,QSAddRecipeSig$>
   OrderSig  = get_property( @window:'.ORDER_SIGNATURE', 'TEXT' )
   SalesSig     = get_property( @window:'.SALES_SIGNATURE', 'TEXT' )
   ShippingInfo = get_property( @window:'.SHIPPING_INFO', 'ARRAY' )
   ShipSig      = ShippingInfo<SIShipSignature$>
   * BELOW REVIEW STAT <> N MEANS THAT IT IS ACCEPTABLE OR ACCEPTABLE W/EXCEPTION
   if SubInfo<1,QSSubSpecType$> = 'R' or SubInfo<1,QSSubSpecType$> = 'Q' then
      * IT IS DEFINED AS RESEARCH SO SEE IF THEY HAVE SIGNED
      if NewDevInfo<1,QSNewDevSig$> <> '' then
         Void = set_property( @window:'.STATUS', 'VALUE', 'A' )                
      end else
	      Void = set_property( @window:'.STATUS', 'VALUE', 'I' )             
      end
   end else
	   if SubInfo<1,QSSubProduct$> = 'SiEpi' then          
		   if ( SalesSig <> '' ) and ( MfgSig <> '' ) and ( EngSig ) and ( OrderSig <> '' ) and ( RecSig <> '' ) and ( CTOFinalSig <> '' ) and ( TSISSig <> '' ) and ( ShipSig <> '' ) then
		      * ALSO NEED TO CHECK TO SEE IF WAFERS ARE SUPPLIED BY ATMI THEN MUST HAVE SUB_PART_NUM
		      * ALL SIGNATURES ARE IN PLACE, NOW ACTIVATE THE PSN
		      OldStatus = get_property( @window:'.STATUS', 'VALUE' )
		      if OldStatus = 'A' then
		          * ALREADY ACTIVE DON't SEND A MESSAGE TO RICKY-RACOON
		      end else
			      Void = set_property( @window:'.STATUS', 'VALUE', 'A' )
			      * NOW SEND A MESSAGE TO ORDER ENTRY AS TO LET THEM RUN IT
			      PSN = get_property( @window:'.PROD_SPEC_ID', 'TEXT' )
			 	   Note    = 'PSN:':PSN:' became activated due to the final signature by ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' ): ' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):'.  '
			 	   Note   := 'A work order may now be given and the product may be scheduled.'
			      SendTo  = xlate( 'CONFIG', 'QUOTE_SIGS', OrderEntrySigners$, 'X' )
			      Subject = 'Active PSN ':PSN
			      create_note( SendTo, @user4, Subject, Note, 'PROD_SPEC', PSN )
			  end
		   end else
		      * INACTIVATE CAUSE MAYBE SALES OR CTO SET TO NOT ACCEPTABLE
		      Void = set_property( @window:'.STATUS', 'VALUE', 'I' )
		   end
	   end else 
	       * SOME OTHER PRODUCT SO ONLY REQUIRE THE SALES SIGNATURE
	       * DO NOT REQUIRE THE SALES SIG ANYMORE
	       *if SalesSig <> '' then
		      Void = set_property( @window:'.STATUS', 'VALUE', 'A' )       
	       *end else
		      *Void = set_property( @window:'.STATUS', 'VALUE', 'I' )       
	       *end
	   end
	end 
return
*============================================================================*
set_security:
   * SHOULD ONLY BE CALLED ON READ OF PROD_SPEC
   if memberof( @user4, 'MASTER' ) then
      return 0	      	
   end
   KeySalesPrompts = 'REV_NUM/REV_DATE/PART_NUMS/SPEC_NUM'
   swap '/' with @rm:@window:'.' in KeySalesPrompts
   KeySalesPrompts = @window:'.':KeySalesPrompts
   KeySalesPSNStaff = xlate( 'LISTBOX_CONFIG', 'KEYSALESPSNSTAFF', '', 'X' )
   Locate @user4 in KeySalesPSNStaff<1> using @vm setting FPos then
      Void = set_property( KeySalesPrompts, 'ENABLED', 1 )   
   end else
      Void = set_property( KeySalesPrompts, 'ENABLED', 0 )
      Void = scroll_enable( '', @window:'.PART_NUMS' )
      Void = scroll_enable( '', @window:'.SPEC_NUM' )   
   end
   *
   * SAVE OFF THE KEYSALESPROMT DATA AND COMPARE AT SAVE
   KeySalesData = get_property( KeySalesPrompts, 'TEXT':@rm:'TEXT':@rm:'ARRAY':@rm:'ARRAY' )
   convert @rm to @fm in KeySalesData
   Void = set_property( @window, '@KeySalesPromptData', KeySalesData )
   *
   SalesPrompts = 'CUST_NO/DESCRIPTION/REVIEW_STATUS/'
   SalesPrompts:= 'HARD_COPY/GENRECIPES/ACCEPT_EXCEPT_NOTES/NOT_ACCEPT_NOTES/SALES_NOTES/'
   SalesPrompts:= 'SPEC_BILL_INST/SUPPLIER_CODE/LAYERTYPE'
   swap '/' with @rm:@window:'.' in SalesPrompts
   SalesPrompts = @window:'.':SalesPrompts
   QSRec = xlate( 'CONFIG', 'QUOTE_SIGS', '', 'X' )
   CTO = ( @user4 = QSRec<SpecUser$> )
   SalesHead = ( @user4 = 'RICK_A' )
   * HARD CODE TO RICK_A
   * HOLY HARD CODING ACTION; PLEASE FIX ME   
   if memberof( @user4, 'SALES' ) or ( CTO ) OR ( @USER4 = 'JASON_H' ) then
      Void = set_property( SalesPrompts, 'ENABLED', 1 )
   end else
      Void = set_property( SalesPrompts, 'ENABLED', 0 )
      SenBoxCtrls = 'DESCRIPTION/ACCEPT_EXCEPT_NOTES/NOT_ACCEPT_NOTES/SALES_NOTES/SPEC_BILL_INST'
      swap '/' with @fm:@window:'.' in SenBoxCtrls
      SenBoxCtrls = @window:'.':SenBoxCtrls
      Void = scroll_enable( SenBoxCtrls, @window:'.PART_NUMS' )   
   end
   *
   SchedulerPrompts = 'QUAL_REACTS/SCHEDULING_NOTES'
   swap '/' with @rm:@window:'.' in SchedulerPrompts
   SchedulerPrompts = @window:'.':SchedulerPrompts
   if CTO or SalesHead then
      Void = set_property( SchedulerPrompts, 'ENABLED', 1 )
   end else
      Void = set_property( SchedulerPrompts, 'ENABLED', 0 )
      Void = scroll_enable( @window:'.SCHEDULING_NOTES', '' )   
   end
   *
   MktMgr = ( @user4 = QSRec<MktMgr$> )
   MfgMgr = ( @user4 = QSRec<ProdMgr$> )

   if ( CTO ) or ( MktMgr ) or ( MfgMgr ) then
	   Void = set_property( @window:'.STATUS', 'ENABLED', 1 )      
   end else
	   Void = set_property( @window:'.STATUS', 'ENABLED', 0 )      
   end
	* REACTOR TYPE RADIO BUTTON FOR SALES HEAD MANAGER
   * REACTOR TYPE PROMPTS
   *RTypePrompts = 'RTYPE'
   *swap '/' with @rm:@window:'.' in RTypePrompts
   *RTypePrompts = @window:'.':RTypePrompts
	*if ( SalesHead ) or ( @user4 = 'CHRIS_H' ) then
	   * LET IF BE ALLOWED FOR EVERYONE CAUSE OF THE FORCE SAVE
		Void = set_property( RTypePrompts, 'ENABLED', 1 ) 			
	*end else
	*	Void = set_property( RTypePrompts, 'ENABLED', 0 ) 				
	*end
	*
	RProfilePrompts = 'RATIO_INFO/RESTRICTER/PINNED_SUSCEPTOR/TUBE_PRESSURE_TYPE'
   swap '/' with @rm:@window:'.' in RProfilePrompts
   RProfilePrompts = @window:'.':RProfilePrompts
	if ( CTO ) or memberof( @user4, 'ENGINEERING' ) then
	   Void = set_property( RProfilePrompts, 'ENABLED', 1 ) 
	end else
	   Void = set_property( RProfilePrompts, 'ENABLED', 0 ) 	
	end
return
*============================================================================*
set_security_spec:
   if memberof( @user4, 'MASTER' ) then
      return 0
   end
	Sales = ( memberof( @user4, 'SALES' ) )
	Engineering = ( memberof( @user4, 'ENGINEERING' ) )
   QSRec = xlate( 'CONFIG', 'QUOTE_SIGS', '', 'X' )
   CTO = ( @user4 = QSRec<SpecUser$> )
   SalesHead = ( @user4 = 'RICK_A' )
   * HARD CODE 
   NewDev = memberof( @user4, 'NEW_DEV' )
   *
	TopSubStrPrompts = 'SUB_PRODUCTS/SUB_WAF_SUP_BY/SUB_ORIENTATION/SUB_TYPE/SUB_WAFERSIZE/'
	TopSubStrPrompts:= 'SUB_RESISTIVITY/SUB_REST_UNITS/SUB_DOPANT/SUB_BL1_DOPANT/SUB_BL2_DOPANT/'
	TopSubStrPrompts:= 'SUB_BL3_DOPANT/SUB_WAFERMFG/SUB_SUBSTRATETYPE'
   swap '/' with @rm:@window:'.' in TopSubStrPrompts
   TopSubStrPrompts = @window:'.':TopSubStrPrompts
	*
	BtmSubStrPrompts = 'SUB_OXIDE/SUB_OXIDE_ANG/SUB_PRE_CLEAN/SUB_POST_CLEAN/SUB_BACKSEAL'
   swap '/' with @rm:@window:'.' in BtmSubStrPrompts
   BtmSubStrPrompts = @window:'.':BtmSubStrPrompts
   *
   EpiSpecPrompts = 'EPI_MIN_THICK/EPI_THICK_UNITS/EPI_MAX_THICK/EPI_RES_MIN_THICK/EPI_RES_UNITS/'
   EpiSpecPrompts:= 'EPI_RES_UNITS/EPI_RES_MAX_THICK/EPI_CONC_MIN_THICK/EPI_CONC_UNITS/'
   EpiSpecPrompts:= 'EPI_CONC_MAX_THICK/EPI_DOPANT'
   swap '/' with @rm:@window:'.' in EpiSpecPrompts
   EpiSpecPrompts = @window:'.':EpiSpecPrompts
   
   *
   * MEASURE PROMPTS
   MeasurePrompts = 'EPI_THICKMEASURE/EPI_RESMEASURE/EPI_CONMEASURE/STRESS_MEASURE/TRANS_MEASURE'
   swap '/' with @rm:@window:'.' in MeasurePrompts
   MeasurePrompts = @window:'.':MeasurePrompts
   
   * NEW DEVELOPMENT PROMPTS
   NewDevPrompts = 'ND_INST_OBS/ND_EXP_PLAN/ND_TEST_RESULTS'
   swap '/' with @rm:@window:'.' in NewDevPrompts
   NewDevPrompts = @window:'.':NewDevPrompts
   
   * HANDLING THE SECURITY A GROUP OF PROMPTS AT A TIME
   * RATHER THAN WHAT SECURITY GROUP GETS WHAT PROMPTS
   * TOP OF SUBSTRATE INFORMATION
	if Sales then
	   Void = set_property( TopSubStrPrompts, 'ENABLED', 1 )      	
	end else
	   Void = set_property( TopSubStrPrompts, 'ENABLED', 0 )      	
	end
	* BOTTOM OF SUBSTRATE INFORMATION
	if ( Sales ) or ( Engineering ) then
		Void = set_property( BtmSubStrPrompts, 'ENABLED', 1 )
	end else
		Void = set_property( BtmSubStrPrompts, 'ENABLED', 0 )	
	end
	* SPEC TYPE
	if ( SalesHead ) or ( Engineering ) or ( Sales ) then
		Void = set_property( @window:'.SPEC_TYPE', 'ENABLED', 1 )		
	end else
		Void = set_property( @window:'.SPEC_TYPE', 'ENABLED', 0 )			
	end
	* EPI RECIPE
	if Engineering then
		Void = set_property( @window:'.EPI_RECIPE', 'ENABLED', 1 )				
	end else
		Void = set_property( @window:'.EPI_RECIPE', 'ENABLED', 0 )					
	end
	* EPI SPECIFICATION
	if Sales then
		Void = set_property( EpiSpecPrompts, 'ENABLED', 1 )	
	end else
		Void = set_property( EpiSpecPrompts, 'ENABLED', 0)	
	end
	* MEASUREMENT INFORMATION
	* MUST NOW CLICK THE BUTTON
	Void = set_property( MeasurePrompts, 'ENABLED', 0 )		   
	* SPECIAL INSTRUCTIONS
	*if ( Engineering ) or ( SalesHead ) then
	if ( @user4 = 'PAUL_W' ) or ( @user4 = 'MICHELLE_M' ) then
		Void = set_property( @window:'.SUB_INSTRUCTIONS', 'ENABLED', 1 ) 
	end else
		 Void = scroll_enable( @window:'.SUB_INSTRUCTIONS', '' )
	end
	* PROVEIN INSTRUCTIONS
	if ( Engineering ) or ( @user4 = 'JANA_D' ) or ( @user4 = 'KATHY_V' ) then
		Void = set_property( @window:'.PROVEIN_INST', 'ENABLED', 1 ) 
	end else
		 Void = scroll_enable( @window:'.PROVEIN_INST', '' )
	end
	* CTO SPECIAL INSTRUCTIONS
	if ( Engineering ) or ( Sales ) or ( SalesHead ) or ( CTO ) then
		Void = set_property( @window:'.SUB_OTHER_SPECS', 'ENABLED', 1 ) 	
	end else
		 Void = scroll_enable( @window:'.SUB_OTHER_SPECS', '' )
	end 
	* NEW DEVELOPMENT SPECIFIC PROMPTS
	*if ( NewDev ) then
	* SHOW TO EVERYONE
		Void = set_property( NewDevPrompts, 'ENABLED', 1 ) 		
	*end else
	*	Void = set_property( NewDevPrompts, 'ENABLED', 0 ) 			   
	*end
return
*============================================================================*
load_surface_def:
	PrePost  = get_property( @window, '@PrePost' )
	VirginBL = get_property( @window, '@VirginBL' )
	* THESE ARE EQUATES VALUES GIVEN TO ME BY CHRIS HILDERBRAND, HE SAID THAT
	* THEY WOULD NOT CHANGE VERY OFTEN, SO HE DOES NOT NEED CONTROL.
	PreVirgin  = '1/1/1/1/1/1/1/10/0/1'
	PostVirgin = '1/1/1/20/1/1/5/2/1/20/1/1'
	PreBL      = '10/10/10/5/2/1/1/10/1/1'
	PostBL     = '20/20/20/20/1/1/5/1/1/20/1/1'
	convert '/' to @rm in PreVirgin
	convert '/' to @rm in PostVirgin	
	convert '/' to @rm in PreBL
	convert '/' to @rm in PostBL
	*
	PrePrompts = 'PRE_PITS/PRE_MOUNDS/PRE_BL_DEFECTS/PRE_SPOTS/PRE_FOV/PRE_SCRATCHES/PRE_SCRATCH_LEN/PRE_LPD/PRE_MICROSCOPE/PRE_BRIGHTLIGHT'
	swap '/' with @rm:@window:'.' in PrePrompts
	PrePrompts = @window:'.':PrePrompts
	*
	PostPrompts = 'POST_PITS/POST_MOUNDS/POST_BL_DEFECTS/POST_STACK_FAULTS/POST_SPOTS/POST_FOV/'
	PostPrompts:= 'POST_SPIKES/POST_SCRATCHES/POST_SCRATCH_LEN/POST_LPD/POST_MICROSCOPE/POST_BRIGHTLIGHT'
	*
	swap '/' with @rm:@window:'.' in PostPrompts
	PostPrompts = @window:'.':PostPrompts
	if PrePost = 'PRE' then
		ControlsToUse = PrePrompts 
		if VirginBL = 'VIRGIN' then
			StandardToUse = PreVirgin
			MsgText = ' Pre Epi Virgin '
		end else
			StandardToUse = PreBL
			MsgText = ' Pre Epi Buried Layer '			
		end
	end else
		ControlsToUse = PostPrompts
		if VirginBL = 'VIRGIN' then
			StandardToUse = PostVirgin
			MsgText = ' Post Epi Virgin '			  				
		end else
			StandardToUse = PostBL
			MsgText = ' Post Epi Buried Layer '
		end
	end
	* SEE IF ALL FIELDS ARE BLANK, OTHERWISE NOTIFY USER THAT THEY ARE
	* ABOUT TO OVERWRITE, GIVING THEM A CHANCE TO CANCEL 
	CurrentValues = get_property( ControlsToUse, 'INVALUE' )
	convert @rm to '' in CurrentValues
	OverWrite = true$
	 
	if len( trim( CurrentValues ) ) and ( CurrentValues <> 0 ) then
	   * CURRENT VALUES WILL BE ZERO IF THER IS NO DATA DUE TO MICROSCOPE BEING 
	   * ZERO IF NOT CHECKED
	   MsgInfo = ''
	   MsgText = 'There is already data in the':MsgText:'section...':CrLf$:'Do you wish to overwrite with the standards?'
	   MsgInfo<mtext$> = MsgText
	   MsgInfo<micon$> = '?'
	   MsgInfo<mtype$> = 'BNY'
	   OverWrite = msg( '', MsgInfo )
	end
	*
	if OverWrite then
		Void = set_property( ControlsToUse, 'INVALUE', StandardToUse )
		if StandardToUse = PostBL and PrePost = 'POST' then
			* SET MICROSCOPE FOR POST EPI AREA
			Void = set_property( @window:'.CLEAN_BRIGHTLIGHT', 'INVALUE', 1 )
		end
	end
return
*============================================================================*
SET_MEASURE:
   CtrlToSet = get_property( @window, '@MeasureToSet' )
   MType = get_property( @window, '@MeasureType' )
   MDesc = get_property( @window, '@MeasureDesc' )
   ParamToPass = get_property( @window:'.':CtrlToSet, 'TEXT' )
   HoldParamToPass = ParamToPass
	RetVar = dialog_box( 'PROD_SPEC_SI4', @window, ParamToPass:char(245):MType:char(245):MDesc:char(245):'CENTER' )
	if ( RetVar <> HoldParamToPass ) and ( RetVar <> '' ) then
		Void = set_property( @window:'.':CtrlToSet, 'TEXT', RetVar )
	end
return
*============================================================================*
LOAD_TOOL_RECIPE:
   Tool = get_property( @window:'.TOOL', 'TEXT' )
   convert @lower_case to @upper_case in Tool
	RecipeList = xlate( 'LISTBOX_CONFIG', Tool:'_RECIPES', '', 'X' )
	convert @vm to @fm in RecipeList
	if RecipeList <> '' then
	   Void = set_property( @window:'.RECIPE', 'LIST', RecipeList )
	end
return
*============================================================================*
SURFSCAN_CLICK:
   CtrlToUse = get_property( @window, '@SurfScanCtl' )
   if get_property( @window:'.':CtrlToUse, 'CHECK' ) then
      Void = set_property( @window:'.':CtrlToUse:"_RECIPE", "ENABLED", 1 )
      Void = set_property( @window:'.':CtrlToUse:"_DEFECTS", "ENABLED", 1 )
      Void = set_property( @window:'.':CtrlToUse:"_HAZE", "ENABLED", 1 )                  
   end else
      Void = set_property( @window:'.':CtrlToUse:"_RECIPE", "TEXT", '' )
      Void = set_property( @window:'.':CtrlToUse:"_DEFECTS", "TEXT", '' )
      Void = set_property( @window:'.':CtrlToUse:"_HAZE", "TEXT", '' )         
      Void = set_property( @window:'.':CtrlToUse:"_RECIPE", "ENABLED", 0 )
      Void = set_property( @window:'.':CtrlToUse:"_DEFECTS", "ENABLED", 0 )
      Void = set_property( @window:'.':CtrlToUse:"_HAZE", "ENABLED", 0 )      
   end
return
*============================================================================*
VALIDATE_DOPANT:
   PSNDopant = get_property( @window:'.EPI_DOPANT', 'TEXT' )
   LayerOn = get_property( @window, '@LayerOn' )
   RecipeID = get_property( 'PROD_SPEC_SI.EPI_RECIPE', 'TEXT' )
   if ( RecipeID <> '' ) and ( PSNDopant <> '' ) then
      if LayerOn = 1 then
         RecipeDopant = xlate( 'RECIPE', RecipeID, recipe_epi_dopant$, 'X' )
      end else
         RecLayInfo = xlate( 'RECIPE', RecipeID, recipe_layer_info$, 'X' )
         RecipeDopant = RecLayInfo<1,RecLEpiDopant$>      
      end
      if PSNDopant = RecipeDopant then
         * IT VALIDATED OK - THE DOPANTS MATCH
         ReturnVar = 1
      end else
         MsgInfo = ''
         MsgInfo<mtext$> = 'The ':quote(PSNDopant):' dopant does not match the recipe dopant.'
         MsgInfo<micon$> = 'H'
         Void = msg( '', MsgInfo )
         ReturnVar = 0 
      end
   end else
      ReturnVar = 1
   end
return
*============================================================================*
VALIDATE_MINMAX:
   * NEED TO MAKE SURE THE MIN IS LESS THAN THE MAX
   MinThick = get_property( @window:'.EPI_MIN_THICK', 'TEXT' )
   MaxThick = get_property( @window:'.EPI_MAX_THICK', 'TEXT' )
   MinRes   = get_property( @window:'.EPI_RES_MIN_THICK', 'TEXT' )
   MaxRes   = get_property( @window:'.EPI_RES_MAX_THICK', 'TEXT' )
   if ( MaxThick < MinThick ) or ( MaxRes < MinRes ) then
      MsgInfo = ''
      MsgInfo<mtext$> = 'You can not have a maximum tolerance value that is less than your minimum tolerance value.'
      MsgInfo<micon$> = 'H'
      Void = msg( '', MsgInfo )
      ReturnVar = 0 
   end else
      ReturnVar = 1
   end
return
*============================================================================*
SET_SCANNED_IMAGE:
	CurArray = get_property( @window:'.SCANNED_INFO', 'ARRAY' )
	CCnt = fieldcount( CurArray, @vm )
	Tcnt = 0
	PVals = 'No Scanned Img'
	for i = 1 to CCnt
	   if ( CurArray<1,i> <> '' ) then
	      Tcnt += 1   
	      PVals<i> = 'Scanned Img ':i
	   end
	next i
	if PVals = 'Scanned Image 1' then
	   * THERE IS ONLY ONE SCANNED IMAGE
	   PVals = 'Scanned Img'
	end
   Void = set_property( @window:'.SCANNED_LIST', 'LIST', Pvals )	
return
*============================================================================*
CHECK_KEY_SALES_DATA:
   * SAVE OFF THE KEYSALESPROMT DATA AND COMPARE AT SAVE
   if memberof( @user4, 'MASTER' ) then
      return 0	      	
   end
   KeySalesPrompts = 'REV_NUM/REV_DATE/PART_NUMS/SPEC_NUM'
   swap '/' with @rm:@window:'.' in KeySalesPrompts
   KeySalesPrompts = @window:'.':KeySalesPrompts
   KeySalesData = get_property( KeySalesPrompts, 'TEXT':@rm:'TEXT':@rm:'ARRAY':@rm:'ARRAY' )
   convert @rm to @fm in KeySalesData
   OrigKeySalesData = get_property( @window, '@KeySalesPromptData' )
   if KeySalesData <> OrigkeySalesData then
      * KEY SALES DATA HAS CHANGED SO BLANK OUT THE TWO SIGNATURES
      * AND INACTIVATE
      Void = set_property( @window:'.SALES_SIGNATURE', 'TEXT', '' )
      Void = set_property( @window:'.TSIS_SIGNATURE', 'TEXT', '' )
      Void = set_property( @window:'.STATUS', 'VALUE', 'I' )      
   end
return
*============================================================================*
validate_recipe:
   * THIS IS ONLY CALLED ON THE FIRST LAYER WHEN SAVING
   * TO JUST WARN THE USER IF THIS PSN IN NOT IN THE RECIPE WITH IT'S OWN LIMITS   
   RecipeID = get_property( 'PROD_SPEC_SI.EPI_RECIPE', 'TEXT' )
   if RecipeID <> '' then
	   PSNsInRecipe = xlate( 'RECIPE', RecipeID, recipe_prod_spec_ids$, 'X' )
	   CurPSN = get_property( 'PROD_SPEC.PROD_SPEC_ID', 'TEXT' )
	   * CAN DO THE ABOVE CAUSE THE ONLY WAY IN TO THIS WINDOW IS THROUGH PROD_SPEC
	   locate CurPSN in PSNsInRecipe using @vm setting FPos else
	      MsgInfo = ''
	      MText   = 'This PSN ':quote(CurPSN):' is not set up in recipe ':quote(RecipeID)
	      MText  := " with it's own recipe limits.  If this PSN is activated and goes through the"
	      MText  := ' system without these limits, the system will use the top row limits in the'
	      MText  := ' recipe.  Please notify an engineer to handle this issue.'
	      MsgInfo<mtext$> = MText       
	      MsgInfo<micon$> = '!'
	      Void = msg( '', MsgInfo )
	   end
	   * NO NEED TO SET RETURNVAR CAUSE CALLING CODE DOES NOT CHECK FOR ERROR IT
	   * IS ONLY A WARNING MESSAGE
	end
return
*============================================================================*
akrion_recipe_check:
   SubPreClean = get_property( @window:'.SUB_PRE_CLEAN', 'TEXT' )
   ReturnVar = 1
   if index( SubPreClean,'Akrion', 1 ) then
      PreAkrionRecipe = get_property( @window:'.PRE_AKRION_RECIPE', 'TEXT' )
      if PreAkrionRecipe = '' then
         MsgInfo = ''
         MsgInfo<mtext$> = 'You must select a pre clean akrion recipe...'
         MsgInfo<micon$> = 'H'
         Void = msg( '', MsgInfo )
         ReturnVar = 0
      end
   end
   SubPostClean = get_property( @window:'.SUB_POST_CLEAN', 'TEXT' )
   if index( SubPostClean, 'Akrion', 1 ) then
      PostAkrionRecipe = get_property( @window:'.POST_AKRION_RECIPE', 'TEXT' )
      if PostAkrionRecipe = '' then
         MsgInfo = ''
         MsgInfo<mtext$> = 'You must select a post clean akrion recipe...'
         MsgInfo<micon$> = 'H'
         Void = msg( '', MsgInfo )
         ReturnVar = 0
      end
   end   
return
*============================================================================*
tw_type_check:
   * THIS CODE WILL CHECK TO SEE IF THE OPPOSITE TYPE OF TEST WAFER IS BEING USED
   * BASICALLY IF YOU CAN NOT FIND BORON IN THE EPI DOPANT THEN ASSUME THAT IT IS N TYPE
   * IF N TYPE SHOULD USE P-TYPE TEST WAFER AND IF P TYPE SHOULD USE N-TYPE TEST WAFER
   CurControl = get_property( @window, '@CurControl' )
   WaferType  = get_property( CurControl, 'TEXT' )
   EpiDopant = get_property( 'PROD_SPEC_SI.EPI_DOPANT', 'TEXT' )
   if len( WaferType ) = 2 then ;* ONLY CHECK FOR P+, P-, N+, N-
	   if index( EpiDopant, 'Boron', 1 ) then
	      * PTYPE
	      * CHECK THE FIRST LETTER FOR N
	      if WaferType[1,1] = 'N' else
	         MsgInfo = ''
	         MsgInfo<mtext$> = 'Warning: The dopant being used is PType, this normally should use an NType test.'
	         MsgInfo<micon$> = '!'
	         Void = msg( '', MsgInfo ) 
	      end
	   end else
	      * NTYPE
	      * CHECK THE FIRST LETTER FOR P
	      if WaferType[1,1] = 'P' else
	         MsgInfo = ''
	         MsgInfo<mtext$> = 'Warning: The dopant being used is NType, this normally should use a PType test.'
  	         MsgInfo<micon$> = '!'
	         Void = msg( '', MsgInfo ) 	          
	      end	      
	   end
   end   
return
*============================================================================*

