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

$SLN = $_REQUEST['product_id'];
$org = $_REQUEST['org'];
$igi_no = $_REQUEST['igi_no'];
$hm_no = $_REQUEST['hm_no'];



$stone_array = $_REQUEST['s_name'];
$stone_data = '';
foreach ($stone_array as $stone) {
    $stone_data .= "," . $stone;
}
$s_name = ltrim($stone_data, ",");

$no_stones = $_REQUEST['no_stones'];
$stone_value=$_REQUEST['stone_value'];


$total_stone_value = $no_stones*$stone_value;

$diamond_type = $_REQUEST['diamond_type'];
$quality=$_REQUEST['quality'];
$color=$_REQUEST['color'];
$type=$_REQUEST['type'];
$no_diamonds=$_REQUEST['no_diamonds'];
$diamond_value=$_REQUEST['diamond_value'];
$d_carat=$_REQUEST['diamond_carat'];
$total_diamond_price = $no_diamonds*$diamond_value*$d_carat;

$sol_diamond_type = $_REQUEST['sol_diamond_type'];
$sol_quality=$_REQUEST['sol_quality'];
$sol_color=$_REQUEST['sol_color'];
$sol_type=$_REQUEST['sol_type'];
$sol_no_diamonds=$_REQUEST['sol_no_diamonds'];
$sol_diamond_value=$_REQUEST['sol_diamond_value'];
$s_carat=$_REQUEST['solitaire_carat'];

$total_sollitaire_price = $sol_no_diamonds*$sol_diamond_value*$s_carat;

$product_size=$_REQUEST['product_size'];

	
$added_on = date('Y-m-d H:i:s');
$User_Name = $_COOKIE['User_Name'];
$IP = $_SERVER['REMOTE_ADDR'];

$Mainclass->Update_Data("gold_temp_product_master","IGINo='".$igi_no."',Certifying_Organization='".$org."',HMNo='".$hm_no."',DiamondQuality='".$quality."',DiamondColor='".$color."',DiamondType='".$type."',No_Diamond='".$no_diamonds."',Diamond_Value='".$diamond_value."',Diamond_Carat='".$d_carat."',total_diamond_price='".$total_diamond_price."',SolitaireQuality='".$sol_quality."',SolitaireColor='".$sol_color."',SolitaireType='".$sol_type."',No_Solitaire='".$sol_no_diamonds."',Solitaire_Value='".$sol_diamond_value."',sollitaire_Carat='".$s_carat."',total_sollitaire_price='".$total_sollitaire_price."',Diamond_Creation_Type='".$diamond_type."',Solitaire_Creation_Type='".$sol_diamond_type."',igi_updation='Yes',add_to_product='Yes', StoneName='".$s_name."', No_Stone='".$no_stones."', Stone_Value='".$stone_value."' , total_stone_value='".$total_stone_value."'","SLN='".$SLN."'");




$data = $Mainclass->Fetch_individual_data("gold_temp_product_master","*","SLN='".$SLN."'");	

$m = date('m');
$y = date('y');
$barcode = $data['Product_Id'] . $m . $y;

$Mainclass->Insert_Data("gold_products_master","Vendor_Name,VendorDesignCode,Metal_Type,ProductCategory,GoldWeight,ParentId,ProductName,Productid,Barcode,HSNCode,GoldPurity,Stock,StoneName,No_Stone,StoneValue,total_stone_price,Diamond_Creation_Type,DiamondQuality,DiamondColor,DiamondType,No_Diamond,DiamondValue,Diamond_Carat,total_diamond_price,Solitaire_Creation_Type,SolitaireQuality,SolitaireColor,SolitaireType,No_Solitaire,Solitaire_Value,sollitaire_Carat,total_sollitaire_price,Has_Size_Variation,Product_Size,MakingChargesType,MakingChargesValue,Remark,has_stone,has_diamond,has_solitaire,IGINo,Certifying_Organization,HMNo,Added_On,Added_By,IP,Active,Color","'".$data['Vendor_Name']."','".$data['VendorDesignCode']."','".$data['Metal_Type']."','".$data['ProductCategory']."','".$data['GoldWeight']."','".$data['ParentId']."','".$data['ProductName']."','".$data['Product_Id']."','".$barcode."','".$data['HSNCode']."','".$data['GoldPurity']."','1','".$data['StoneName']."','".$data['No_Stone']."','".$data['Stone_Value']."','".$data['total_stone_value']."','".$data['Diamond_Creation_Type']."','".$data['DiamondQuality']."','".$data['DiamondColor']."','".$data['DiamondType']."','".$data['No_Diamond']."','".$data['Diamond_Value']."','".$data['Diamond_Carat']."','".$data['total_diamond_price']."','".$data['Solitaire_Creation_Type']."','".$data['SolitaireQuality']."','".$data['SolitaireColor']."','".$data['SolitaireType']."','".$data['No_Solitaire']."','".$data['Solitaire_Value']."','".$data['sollitaire_Carat']."','".$data['total_sollitaire_price']."','".$data['Has_Size_Variation']."','".$data['Product_Size']."','".$data['MakingChargesType']."','".$data['MakingChargesValue']."','".$data['Remark']."','".$data['has_stone']."','".$data['has_diamond']."','".$data['has_solitaire']."','".$data['IGINo']."','".$data['Certifying_Organization']."','".$data['HMNo']."','".$added_on."','".$User_Name."' ,'".$IP."' ,'Yes','".$data['Color']."'");

?>