<?php
 include 'connection.php';
date_default_timezone_set('Asia/Calcutta');
$today = date("Y-m-d");
$time = date("h:i A"); 
$currentyear = date("Y");
  $first_name=$_POST['name'];
function randomPassword() {
    $alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $pass = array(); //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
    for ($i = 0; $i < 5; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); //turn the array into a string
}
$unique_id = randomPassword();
$user_id=$user_account['user_id'];
$quotation_id=$_REQUEST['quotation_id'];
$customer_id=$_REQUEST['customer_id'];
?> 
<?php
$queryls = "select * from rowmaterial_master where row_id = '".$_POST['row_id']."'";
$resultls = mysqli_query($conn,$queryls);	
while($row=mysqli_fetch_array($resultls))
{
$bar_size=$row['bar_size'];
$material_name=$row['material_name'];
}

$product_id=$_POST['product_id'];
$row_id = $_POST['row_id'];
$item_code=$_POST['item_code'];
$description=$_POST['description'];
$bom_weight_kg=$_POST['bom_weight_kg'];
$bar_size_unit=$_POST['bar_size_unit'];
$finish_shaft_wt_kg=$_POST['finish_shaft_wt_kg'];
$old_labour_rate_rs = $_POST['old_labour_rate_rs'];
$revised_labour_rate_rs = $_POST['revised_labour_rate_rs'];

$difference=$_POST['difference'];
$add_kw_rate_mail=$_POST['add_kw_rate_mail'];
$add_bmst_kw_ext_rate=$_POST['add_bmst_kw_ext_rate'];
$final_i_c_rate=$_POST['final_i_c_rate'];
$category_id=$_POST['category_id'];
$turning_scrap_wt=$_POST['turning_scrap_wt'];

$DRAWING_NO=$_POST['DRAWING_NO'];
$CUT=$_POST['CUT'];
$FINISH=$_POST['FINISH'];
$DE=$_POST['DE'];
$NDE=$_POST['NDE'];




$queryls = "select * from category_master where category_id = '".$_POST['category_id']."'";
$resultls = mysqli_query($conn,$queryls);	
while($row=mysqli_fetch_array($resultls))
{
$category_id=$row['category_id'];
$category_name=$row['category_name'];
}


//echo "<br>";

$qrycall = "update finish_product_master set bar_size='$bar_size',material_name='$material_name',item_code='$item_code',bom_weight_kg='$bom_weight_kg',bar_size_unit='$bar_size_unit',finish_shaft_wt_kg='$finish_shaft_wt_kg',old_labour_rate_rs='$old_labour_rate_rs',revised_labour_rate_rs='$revised_labour_rate_rs',difference='$difference',add_kw_rate_mail='$add_kw_rate_mail',add_bmst_kw_ext_rate='$add_bmst_kw_ext_rate',add_bmst_kw_ext_rate='$add_bmst_kw_ext_rate',final_i_c_rate='$final_i_c_rate',turning_scrap_wt='$turning_scrap_wt',description='$description',row_id='$row_id',category_id='$category_id',category_name='$category_name',DRAWING_NO='$DRAWING_NO',CUT='$CUT',FINISH='$FINISH',DE='$DE',NDE='$NDE' where product_id = '".$_REQUEST['product_id']."'";
$rcall=mysqli_query($conn,$qrycall);

//$c_id = $_REQUEST['customer_id'];


//exit();


?>

<script>
javascript:window.location.href="edit_finish_product.php?product_id=<?php echo $_REQUEST['product_id']?>";
</script>