function addOGTAPC() {
	if(getExperimentInfo('nooftargets') > 256)
	{
		Ext.get('emessage').removeCls('hidden');
		updateContMessage()
		return;
	}
	Ext.get('emessage').addCls('hidden');
	var title = "TaqMan<sup>&reg;</sup>&nbsp;OpenArray<sup>&reg;</sup>&nbsp;Genotyping Plate Custom";
	var isQuant = getExperimentInfo('openarrayinstrument') == "QuantStudio" ? true : false;
	var isNTCycler = getExperimentInfo('openarrayinstrument') == "NTCycler" ? true : false;
	var formatObj1 = isQuant ? findApproximateOpenQuantGenoTapRecord(getExperimentInfo('nooftargets')) : findApproximateOpenGenoTapRecord(getExperimentInfo('nooftargets'));
	var formatObj = findApproximateOpenGenoTapRecord(getExperimentInfo('nooftargets'));
	var nooftargets = getExperimentInfo('nooftargets');
	var formats = isQuant ? formatObj1.get('concatenate') : formatObj1.get('productname');
	var formatqnt = formats.replace("TaqMan OpenArray","TaqMan® OpenArray®");
	var format = formatqnt.replace("QuantStudio TM","QuantStudio™");

	var partNo = formatObj1.get('partnumber');
	var noofgenes = formatObj.get('no of targets');
	
	var reqnoofunits = Math.ceil((getExperimentInfo('noofsamples')
			* getExperimentInfo('noofsubarrays') / formatObj
			.get('no of samples')) / 10);
	
	var noofunits = reqnoofunits < formatObj.get('min') ? formatObj.get('min')
			: Math.ceil(reqnoofunits);
	
	var min = formatObj.get('min');
	var isMin = (min == 1 ? 1 : (Math.ceil(reqnoofunits) < min ? 0 : 1));

	var noofreactions = noofgenes * getExperimentInfo('noofsamples')
			* getExperimentInfo('noofreplicates');
	var mvolume = noofreactions * formatObj.get('master mix needed per unit');

	var mmxObj = genoMasterMix.findRecord("productname",
			"TaqMan® OpenArray Genotyping Master Mix");
	var mastermix = mmxObj.get('productname');
	var mmxPartNumber = mmxObj.get('partnumber');
	
	var masterperc = (Ext.get('masterperc').dom.value).split('%')[0];
	var accessperc = (Ext.get('accessoriesperc').dom.value).split('%')[0];
	var volumeDiscount = 0;
	var discObj = tsstable.findRecord('product', formatObj.get('productname'));	
	var discUnits = noofunits > 84 ? 84 : noofunits;
	
	
	//volumeDiscount = discObj.discounts().findRecord('volume', discUnits, 0,false, false, true).get('value');
	
	/*if ((nooftargets > 0) && (nooftargets <= 16)) { 			
			volumeDiscount = GenoTypingFormat16VolDiscount(noofunits,'');
	} 
	
	if ((nooftargets > 16) && (nooftargets <= 32)) { 
			volumeDiscount = GenoTypingFormat32VolDiscount(noofunits,'');
	} 
	
	if ((nooftargets > 32) && (nooftargets <= 64)) {
			volumeDiscount = GenoTypingFormat64VolDiscount(noofunits,'');
	} 
	
	if ((nooftargets > 64) && (nooftargets <= 128)) {				
			volumeDiscount = GenoTypingFormat128VolDiscount(noofunits,'');			
	} 
	
	if ((nooftargets > 128) && (nooftargets <= 192)) {			
			volumeDiscount = GenoTypingFormat192VolDiscount(noofunits,'');
	} 
	
	if ((nooftargets > 192) && (nooftargets <= 256)) {
		volumeDiscount = GenoTypingFormat256VolDiscount(noofunits,'');
	}*/
	
	var volDiscMatrix = getOpenArrayDiscoutValue("partnumber", noofunits, partNo, false);
	if(volDiscMatrix){
		volumeDiscount = Number(getExperimentInfo("detailsDiscountValue"));
	}
	
	//var pricePerUnit = (isQuant ? (formatObj1.get('Pricing or Min Order')/formatObj1.get('min')) : (pricelist.findRecord('partnumber', partNo).regions().findRecord('region', region + "-" + currency).get('price')));
	var pricePerUnit = pricelist.findRecord('partnumber', partNo).regions().findRecord('region', region + "-" + currency).get('price');
	
	var price = pricelist.findRecord('partnumber', partNo).regions().findRecord('region', region + "-" + currency).get('price')* noofunits;
	
	
	var openarrayperc = parseFloat((Ext.get('openarrayperc').dom.value).split('%')[0]);
	
	var assaysCostWithVolDisc = price - (((volumeDiscount+openarrayperc) / 100) * price);

	
	var openArray384Obj = accessories.findRecord('product', 'OpenArray® 384-well Sample Plates');
	var acc1PartNumber = openArray384Obj.get('partnumber');

	var openArray384WellSamplePlatesUnits = Math.ceil(formatObj
			.get('sampleplates')
			* reqnoofunits) < openArray384Obj.get('min') ? openArray384Obj.get(
					'min') : Math.ceil(formatObj
			.get('open array sample plates per unit')
			* reqnoofunits);
	var openArray384WellSamplePlatesCost = pricelist.findRecord('partnumber', acc1PartNumber)
	.regions().findRecord('region', region + "-" + currency).get('price')
			* openArray384WellSamplePlatesUnits;
	
	
	var opeArrayAccuObj = accessories.findRecord('product', 'OpenArray® AccuFill® System Tips');
	var acc2PartNumber = opeArrayAccuObj.get('partnumber');

	var openArrayAccuFillSystemTipsUnits = Math.ceil((formatObj
			.get('open array tips per unit')
			* reqnoofunits) % 10);

	var openArrayAccuFillSystemTipsCost = pricelist.findRecord('partnumber', acc2PartNumber)
	.regions().findRecord('region', region + "-" + currency).get('price')
			* openArrayAccuFillSystemTipsUnits;
	
	var openArrayAccu10Obj = accessories.findRecord('product', 'OpenArray® AccuFill® System Tips, 10 Pack');
	var acc3PartNumber = openArrayAccu10Obj.get('partnumber');
	
	var openArrayAccuFillSystemTips10Units = Math.floor((formatObj.get('open array tips per unit')
			* reqnoofunits) / 10);
	
	var openArrayAccuFillSystemTips10Cost = pricelist.findRecord('partnumber', acc3PartNumber)
	.regions().findRecord('region', region + "-" + currency).get('price')
			* openArrayAccuFillSystemTips10Units;
	var ntargets = 	getExperimentInfo('nooftargets');
	
	if((ntargets > 0) && (ntargets <= 16))
	{	
		
		var masterMixUnits = Math.ceil((reqnoofunits * 0.93750));
	}else if((ntargets > 16) && (ntargets <= 32))
	{
		
		var masterMixUnits = Math.ceil((reqnoofunits * 0.62500));

	}else{
		
		var masterMixUnits = Math.ceil(( reqnoofunits * 0.31250));

	}	
	
	var masterMixCostPerUnit = pricelist.findRecord('partnumber', mmxPartNumber)
	.regions().findRecord('region', region + "-" + currency).get('price');

	var masterMixCost = masterMixCostPerUnit * masterMixUnits;

	var masterMixCostWithDisc = masterMixCostPerUnit * masterMixUnits
			* (1 - (masterperc / 100));
	var openArray384WellSamplePlatesCostWithDisc = openArray384WellSamplePlatesCost * (1 - (accessperc / 100));
	var openArrayAccuFillSystemTips10CostWithDisc = openArrayAccuFillSystemTips10Cost * (1 - (accessperc / 100));
	var openArrayAccuFillSystemTipsCostWithDisc	  = openArrayAccuFillSystemTipsCost * (1 - (accessperc / 100));	
	var accessoriescost = openArrayAccuFillSystemTipsCostWithDisc + openArrayAccuFillSystemTips10CostWithDisc
			+ openArray384WellSamplePlatesCostWithDisc;

	var masterMixCostPerReaction = masterMixCostWithDisc / noofreactions;
	var totalAccessoriescost = accessoriescost;

	var accessoriesCostPerReaction = totalAccessoriescost / noofreactions;

	var assayCostPerReaction = assaysCostWithVolDisc / noofreactions;

	var totalCostPerReaction = masterMixCostPerReaction + assayCostPerReaction
			+ accessoriesCostPerReaction;

	var totalCostPreDisc = accessoriescost + masterMixCost + price;

	// var openarraycost = formatObj.

	var totalCost = totalAccessoriescost + masterMixCostWithDisc
			+ assaysCostWithVolDisc;

	var totalDiscount = 100 - (totalCost * 100 / totalCostPreDisc);

	var assayCostPerSample = assaysCostWithVolDisc
			/ getExperimentInfo('noofsamples');
	var acc1CostPerSample = openArray384WellSamplePlatesCostWithDisc
			/ getExperimentInfo('noofsamples');
	var acc2CostPerSample = openArrayAccuFillSystemTipsCostWithDisc
			/ getExperimentInfo('noofsamples');
	var acc3CostPerSample = openArrayAccuFillSystemTips10CostWithDisc
	/ getExperimentInfo('noofsamples');

	var accessoriesCostPerSample = acc1CostPerSample + acc2CostPerSample + acc3CostPerSample;
	var mmixCostPerSample = masterMixCostWithDisc / getExperimentInfo('noofsamples');

	var totalCostPerSample = assayCostPerSample + acc1CostPerSample
			+ acc2CostPerSample + acc3CostPerSample + mmixCostPerSample;
	var partNumber = formatObj.get('partnumber');
	var productUrl = producturls.findRecord('partNumber', partNumber).get('productURL');

	
	var noOfHours = 0;
	var oType = getExperimentInfo('openarrayinstrument') == "QuantStudio" ? "GenotypingQS" : "GenotypingNT";
	var tRec = openarrayruntimes.findRecord('type', oType);
	//noOfHours = Math.ceil(Math.ceil((reqnoofunits * 10) / tRec.get('noofplatesperrun')) * tRec.get('totalmin') /60);
	noOfHours = Math.ceil(Math.ceil((reqnoofunits * 10)
			/ tRec.get('noofplatesperrun'))
			* tRec.get('totalmin') / 60);
	var imageType = "";
	if(isNTCycler){
		imageType = "openarray-ntcycler-fixed";
	}
	
	outputList.add({
				pno : 7,
				title : title,
				partnumber : partNo,
				format : format.replace(/�/gi, '<sup>&reg;</sup>&nbsp;'),
				noofunits : noofunits,
				noofreactions : noofreactions,
				mastermix : mastermix
						.replace(/�/gi, '<sup>&reg;</sup>&nbsp;'),
				mnoofunits : masterMixUnits,
				totalcost : roundNumber(totalCost, 2),
				volumediscount : volumeDiscount,
				mvolumediscount : 0,
				mastermixdisc : masterperc,
				accessoriesdisc : accessperc,
				assayscost : price,
				assayscostperunit : pricePerUnit,
				assayscostwithvoldisc : roundNumber(assaysCostWithVolDisc, 2),
				mastermixvol : 0,
				mastermixcostperunit : masterMixCostPerUnit,
				mastermixcostwithvoldisc : masterMixCost,
				mastermixcostwithdisc : roundNumber(masterMixCostWithDisc, 2),
				mastermixcost : masterMixCost,
				noofhours : noOfHours,
				assaycostperreaction : roundNumber(assayCostPerReaction, 2),
				mastermixcostperreaction : roundNumber(
						masterMixCostPerReaction, 2),
				accessoriescostperreaction : roundNumber(
						accessoriesCostPerReaction, 2),
				optimizationcostperreaction : 0,
				totalcostperreaction : roundNumber(totalCostPerReaction, 2),
				producturl : '',
				openarray384wellsampleplatescost : openArray384WellSamplePlatesCost,
				openarrayaccufillsystemtipscost : openArrayAccuFillSystemTipsCost,
				openarrayaccufillsystemtipsunits : openArrayAccuFillSystemTipsUnits,
				openarrayaccufillsystemtips10packunits : openArrayAccuFillSystemTips10Units,
				openarrayaccufillsystemtips10packcost : openArrayAccuFillSystemTips10Cost,
				openarray384wellsampleplatesunits : openArray384WellSamplePlatesUnits,
				mastermixunits : masterMixUnits,
				totalcostpersample : roundNumber(totalCostPerSample, 2),
				accessoriescost : roundNumber(accessoriescost, 2),
				accessoriescostwithdisc : roundNumber(totalAccessoriescost, 2),
				assaycostpersample : roundNumber(assayCostPerSample, 2),
				accessoriescostpersample : roundNumber(
						accessoriesCostPerSample, 2),
				mmxcostpersample : roundNumber(mmixCostPerSample, 2),
				totalcostpredisc : roundNumber(totalCostPreDisc, 2),
				totaldiscount : roundNumber(totalDiscount, 2),
				accessory1partnumber : acc1PartNumber,
				accessory2partnumber : acc2PartNumber,
				accessory3partnumber : acc3PartNumber,
				mastermixpartnumber : mmxPartNumber,
				producturl : productUrl,
				reqnoofunits : reqnoofunits,
				type : 'openarray-custom',
				min : min,
				ismin : isMin,
				imageType:imageType,
				fnName:'addOGTAPC'
			});

}

function findApproximateOpenGenoTapRecord(value) {

	var record = null;
	var name = "TaqMan® OpenArray® Genotyping Plate, Custom Format";
	var prevRecord = null;
	
	if ((value > 0) && (value <= 16)) {  
		return genoTypeTubes.findRecord('productname', name + '  16 - Beamer B (Portal)');
	}
	if ((value > 16) && (value <= 32)) { 
		return genoTypeTubes.findRecord('productname', name + '  32 - Beamer B (Portal)');
	}
	
	if ((value > 32) && (value <= 64)) {
		return genoTypeTubes.findRecord('productname', name + '  64 - Beamer B (Portal)');
	}
	
	if ((value > 64) && (value <= 128)) {
		
		return genoTypeTubes.findRecord('productname', name + ' 128 - Beamer B (Portal)');
	}
	
	if ((value > 128) && (value <= 192)) {
		return genoTypeTubes.findRecord('productname', name + ' 192 - Beamer B (Portal)');
	}
	
	if ((value > 192) && (value <= 256)) {
		return genoTypeTubes.findRecord('productname', name + ' 256 - Beamer B (Portal)');
	} else {
		genoTypeTubes.each(function(e) {
			if (e.get('productname').indexOf(name) != -1
					&& e.get('no of targets') == value) {
				record = e;
				return false;
			} else if (e.get('productname').indexOf(name) != -1
					&& e.get('no of targets') > value) {
				if (prevRecord != null && prevRecord >= value)
					record = prevRecord;
				else
					record = e;
				return false;
			}
			prevRecord = e;
		});
		return record;
	}
}

function findApproximateOpenQuantGenoTapRecord(value) {

	var record = null;
	var name = "TaqMan® OpenArray® Genotyping Plate, Custom Format";
	var prevRecord = null;
	if ((value > 0) && (value <= 16)) { 
		return quantstudio.findRecord('concatenate', name + ' 16 QuantStudio TM 12K Flex');
	}
	
	if ((value > 16) && (value <= 32)) {  
		return quantstudio.findRecord('concatenate', name + ' 32 QuantStudio TM 12K Flex');
	}
	
	if ((value > 32) && (value <= 64)) { 
		return quantstudio.findRecord('concatenate', name + ' 64 QuantStudio TM 12K Flex');
	}
	
	if ((value > 64) && (value <= 128)) {
		return quantstudio.findRecord('concatenate', name + ' 128 QuantStudio TM 12K Flex');
	}
	
	if ((value > 128) && (value <= 192)) {
		return quantstudio.findRecord('concatenate', name + ' 192 QuantStudio TM 12K Flex');
	}
	
	if ((value > 192) && (value <= 256)) {
		return quantstudio.findRecord('concatenate', name + ' 256 QuantStudio TM 12K Flex');
	} 
	else {
		quantstudio.each(function(e) {
			if (e.get('concatenate').indexOf(name) != -1
					&& e.get('number of Assays or Plate') == value) {
				record = e;
				return false;
			} else if (e.get('concatenate').indexOf(name) != -1
					&& e.get('number of Assays or Plate') > value) {
				if (prevRecord != null && prevRecord >= value)
					record = prevRecord;
				else
					record = e;
				return false;
			}
			else if (e.get('concatenate').indexOf(name) != -1) {
				prevRecord = e;
			}
		});
		return record;
	}
}