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

$SLN = $_REQUEST['SLN'];
$p_cate = $_REQUEST['p_cate'];
$metal_type = $_REQUEST['metal_type'];
$design_id = $_REQUEST['design_id'];
$p_name = $Mainclass->real_escapes(strip_tags($_REQUEST['p_name']));
$h_code = $_REQUEST['h_code'];
$g_purity = $_REQUEST['g_purity'];

$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'];

$diamond_type = $_REQUEST['diamond_type'];
$quality = $_REQUEST['quality'];
$color = $_REQUEST['color'];
$type = $_REQUEST['type'];
$no_diamonds = $_REQUEST['no_diamonds'];
$diamond_value = $_REQUEST['diamond_value'];

$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'];

$size_variation = $_REQUEST['size_variation'];
$p_color = $_REQUEST['p_color'];
$mk_ch = $_REQUEST['mk_ch'];
$mk_ch_val = $_REQUEST['mk_ch_val'];
$wc = $_REQUEST['wc'];

$remark = $Mainclass->real_escapes(strip_tags($_REQUEST['remark']));

//$parent_code = $Mainclass->parent_code($p_cate, $design_id);

if($no_stones==""){
    
  $has_stone = "No";  
    
}

else{
    
  $has_stone = "Yes";    
}


if($no_diamonds==""){
    
  $has_diamond = "No";  
    
}

else{
    
  $has_diamond = "Yes";    
}

if($sol_no_diamonds==""){
    
  $has_solitaire = "No";  
    
}

else{
    
  $has_solitaire = "Yes";    
}



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

$table = "design_code_master";

$Fields = " ProductName='$p_name', HSNCode='$h_code', GoldPurity='$g_purity', StoneName='$s_name', No_Stone='$no_stones', Stone_Value='$stone_value', DiamondQuality='$quality', DiamondColor='$color', DiamondType='$type', No_Diamond='$no_diamonds', Diamond_Value='$diamond_value', SolitaireQuality='$sol_quality', SolitaireColor='$sol_color', SolitaireType='$sol_type', No_Solitaire='$sol_no_diamonds', Solitaire_Value='$sol_diamond_value', MakingChargesType='$mk_ch', MakingChargesValue='$mk_ch_val', WastageCost='$wc', Remark='$remark', Updated_On='$DateTime', Updated_By='$Added_By', IP='$IP', Inactive='0', has_stone='$has_stone', has_diamond='$has_diamond', has_solitaire='$has_solitaire', Diamond_Creation_Type='$diamond_type', Solitaire_Creation_Type='$sol_diamond_type', Has_Size_Variation='$size_variation', Color='$p_color'";
$condition = "SLN='" . $SLN . "'";
$result = $Mainclass->Update_Data($table, $Fields, $condition);


?>
