<?php
include("db_connection.php");
$Mainclass=new DB_Controller();

$Zone=$_REQUEST['Zone'];
$diamond_type=$_REQUEST['diamond_type'];
$quality=$Mainclass->real_escapes($_REQUEST['quality']);
$color1=$Mainclass->real_escapes($_REQUEST['color']);
$color2=$Mainclass->real_escapes($_REQUEST['color2']);
//$type=$Mainclass->real_escapes($_REQUEST['type']);
$Buying_Rate=$Mainclass->real_escapes($_REQUEST['Buying']);


if($_REQUEST['type']==""){
	
$type = "0.00 mm";
	
}

else{
	
	$type=$Mainclass->real_escapes($_REQUEST['type']);
	
}

$Date=date('Y-m-d');

$color = $color1."".$color2;

foreach ($Zone as $Zone){
	
	$Fields="`Zone`,`Solitaire_Type`,`Buying_Rate`,`Entry_Date`,`Created_By`,`Creation_IP`,`Quality`,`Color1`,`Color2`,`Color`,`Type`";
	$Values="'".$Zone."','".$diamond_type."','".$Buying_Rate."','".$Date."','".$_COOKIE['User']."','".$_SERVER['REMOTE_ADDR']."','".$quality."','".$color1."','".$color2."','".$color."','".$type."'";
	$Ins=$Mainclass->Insert_Data('solitaire_rate_master',$Fields,$Values);	
	
}



if($_REQUEST['type']!=""){
	
$size_check = $Mainclass->num_check("solitaire_size","SLN","Size='".$type."'");
	
if($size_check==0){
	
$Mainclass->Insert_Data('solitaire_size',"Size",$type);		
	
}	
	
}

?>