<?php
session_name('CAKEPHP'); session_start();
$PageSecurity = 4;
include('includes/session.inc');
include('includes/function_lib.php');

//echo "Select uom,total_production_rate from bill_material where part_id=".$_GET['i'];




$sql=DB_fetch_array(DB_query("Select uom,total_production_rate from bill_material where part_id=".$_GET['i'],$db));
$basic_rate=$sql['total_production_rate'];
$uom_id=$sql['uom'];
$unitname=$s->getField('unitsofmeasure','unitid',$uom_id,'unitname');

$size1=explode(",",$_REQUEST['size']);
$area='';
for($t=0;$t<count($size1);$t++)
{
$door=$s->GetFieldValue('size_master',"type_product='".$_REQUEST['frame']."' and id='".$size1[$t]."' and CompanyId='".$_SESSION['ACGCompanyId']."'",'area');

//$door=$s->GetFieldValue('size_master','type_product',$_REQUEST['frame'],'area'); 
$frame=$s->GetFieldValue('size_master',"frame_category='".$_REQUEST['frame']."' and id='".$size1[$t]."' and CompanyId='".$_SESSION['ACGCompanyId']."'",'frame');
//$frame=$s->getField('size_master','frame_category',$_REQUEST['frame'],'frame'); 
//$shutter=$s->getField('size_master','shutter_category',$_REQUEST['frame'],'sutter'); 
$shutter=$s->GetFieldValue('size_master',"shutter_category='".$_REQUEST['frame']."' and id='".$size1[$t]."' and CompanyId='".$_SESSION['ACGCompanyId']."'",'sutter');
if(!empty($door))
{
$area[]=$door;
$price[]=$basic_rate*$door;
}
else if(!empty($frame))
{
$area[]=$frame;
$price[]=$basic_rate*$frame;

}
else 
{
$area[]=$shutter;
$price[]=$basic_rate*$shutter;

}
}

$str='';
foreach($area as $k=>$v)
{
	$str.=$v."--";
}
$str1='';
foreach($price as $k=>$v)
{
	$str1.=$v."--";
}



 echo $data=$basic_rate."__".$unitname."__".$str."__".$str1;

?>
