} else{ $order_id = '900100101'; } $user_id = $_POST['user_cart_id']; $company_id = $_POST['company_id']; $company_name = getCompName($company_id); $referece = strtoupper($_POST['reference']); $deleivery_date = $_POST['date']; $comment_ord = mysql_real_escape_string($_POST['comment_ord']); //Funcionality for Auto Load Reference Start. $chk_reference = CheckReference($company_id,$referece); if(count($chk_reference) == 0){ $ref_sql = "INSERT INTO sohorepro_reference SET company_id = '".$company_id."', user_id = '".$user_id."', reference = '".$referece."' "; mysql_query($ref_sql); } //Funcionality for Auto Load Reference End. $sql = "INSERT INTO sohorepro_order_master SET order_number = '".$order_id."',order_sequence = '".$order_id."', order_id = '" . $referece . "', customer_company = '".$company_id."', customer_company_name = '".$company_name."' , customer_name = '".$user_id."', deleivery_date = '".$deleivery_date."', order_comment = '".$comment_ord."', created_date = now()"; mysql_query($sql); $order_id_pro = mysql_insert_id(); $product = checkOut($user_id); if($order_id_pro != ''){ foreach ($product as $pro)
$user_session_comp = $_SESSION['sohorepro_companyid']; $user_session = $_SESSION['sohorepro_userid']; $sql_order_sequence = mysql_query("SELECT id,order_sequence FROM sohorepro_order_master ORDER BY id DESC LIMIT 1"); $object_order_sequence = mysql_fetch_assoc($sql_order_sequence); $sequence_id = $object_order_sequence['id']; $sequence = $object_order_sequence['order_sequence']; $new_sequence = ($sequence + 1); $query_update = "UPDATE sohorepro_order_master SET order_sequence = '" . $new_sequence . "' WHERE id = '" . $sequence_id . "'"; mysql_query($query_update); //Funcionality for Auto Load Reference Start. $chk_reference = CheckReference($_SESSION['sohorepro_companyid'], $reference); if (count($chk_reference) == 0) { $ref_sql = "INSERT INTO sohorepro_reference SET company_id = '" . $_SESSION['sohorepro_companyid'] . "', user_id = '" . $_SESSION['sohorepro_userid'] . "', reference = '" . $reference . "' "; mysql_query($ref_sql); } //Funcionality for Auto Load Reference End. $customer_name = getCompName($_SESSION['sohorepro_companyid']); $query = "INSERT INTO sohorepro_order_master_service SET order_sequence = '" . $new_sequence . "', comp_id = '" . $_SESSION['sohorepro_companyid'] . "', user_id = '" . $_SESSION['sohorepro_userid'] . "', customer_company_name = '" . $customer_name . "', reference = '" . $reference . "', created_date = now()";