50 lines
2.5 KiB
PHP
50 lines
2.5 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
include('log_entry.php');
|
|
$product_id = $_POST['product_id'];
|
|
|
|
$product_name = getFieldFromTable('section_name', 'checkup_form_section', 'section_id', $_POST['product_name']);
|
|
$product_code = $_POST['product_code'];
|
|
$hsn_code = $_POST['hsn_code'];
|
|
$rate_per_unit = $_POST['rate_per_unit'];
|
|
$description = $_POST['description'];
|
|
$is_service = $_POST['is_service'];
|
|
$is_active = $_POST['is_active'];
|
|
$icon_text = $_POST['icon_text'];
|
|
$image_url = $_POST['image_url'];
|
|
$tax_code1 = $_POST['tax_code1'];
|
|
$tax_rate1 = $_POST['tax_rate1'];
|
|
$tax_code2 = $_POST['tax_code2'];
|
|
$tax_rate2 = $_POST['tax_rate2'];
|
|
$discount_percentage = $_POST['discount_percentage'];
|
|
|
|
$query = "";
|
|
$imgData = null;
|
|
$photoQuery = "";
|
|
|
|
// if (count($_FILES) > 0) {
|
|
$_FILES['image_logo']['tmp_name'];
|
|
// if (is_uploaded_file($_FILES['image_logo']['tmp_name'])) {
|
|
$info = pathinfo($_FILES['image_logo']['name']);
|
|
$ext = pathinfo($info, PATHINFO_EXTENSION);
|
|
$imgData = addslashes(file_get_contents($_FILES['image_logo']['tmp_name']));
|
|
$imageProperties = getimageSize($_FILES['image_logo']['tmp_name']);
|
|
$photoQuery = ",image_logo='{$imgData}' ,image_type='{$imageProperties['mime']}'";
|
|
error_log($photoQuery);
|
|
// }
|
|
// }
|
|
|
|
|
|
if (!empty($product_id)) {
|
|
$query = "update product_service_master set product_name='$product_name',product_code='$product_code',hsn_code='$hsn_code',rate_per_unit ='$rate_per_unit',description='$description',is_service='$is_service',is_active='$is_active',icon_text='$icon_text',image_url='$image_url',tax_code1='$tax_code1',tax_rate1='$tax_rate1',tax_code2='$tax_code2',tax_rate2='$tax_rate2',discount_percentage='$discount_percentage',modified_by = '" . $_SESSION['user_id'] . "' " . $photoQuery . " where product_id = '" . $product_id . "'";
|
|
} else {
|
|
$query = "insert into product_service_master set product_name='$product_name',product_code='$product_code',hsn_code='$hsn_code',rate_per_unit ='$rate_per_unit',description='$description',is_service='$is_service',is_active='$is_active',icon_text='$icon_text',image_url='$image_url',tax_code1='$tax_code1',tax_rate1='$tax_rate1',tax_code2='$tax_code2',tax_rate2='$tax_rate2',discount_percentage='$discount_percentage',modified_by = '" . $_SESSION['user_id'] . "' " . $photoQuery . "";
|
|
}
|
|
|
|
error_log("product update query " . $query);
|
|
if (!$result = @mysqli_query($conn, $query)) {
|
|
error_log("Failed to Update the product and service details. Error Found" . mysqli_error($conn) . ". Failing Query:" . $query);
|
|
exit(mysqli_error($conn));
|
|
}
|