Added Tax to products section Updated DB structure

This commit is contained in:
johnny@pittpc.com
2021-02-06 01:52:38 -05:00
parent d90c7e4664
commit 7d2cf8ce89
6 changed files with 60 additions and 4 deletions

View File

@@ -952,8 +952,9 @@ if(isset($_POST['add_product'])){
$description = strip_tags(mysqli_real_escape_string($mysqli,$_POST['description']));
$cost = floatval($_POST['cost']);
$category = intval($_POST['category']);
$tax = intval($_POST['tax']);
mysqli_query($mysqli,"INSERT INTO products SET product_name = '$name', product_description = '$description', product_cost = '$cost', product_created_at = NOW(), category_id = $category, company_id = $session_company_id");
mysqli_query($mysqli,"INSERT INTO products SET product_name = '$name', product_description = '$description', product_cost = '$cost', product_created_at = NOW(), tax_id = $tax, category_id = $category, company_id = $session_company_id");
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Product', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
@@ -971,8 +972,9 @@ if(isset($_POST['edit_product'])){
$description = strip_tags(mysqli_real_escape_string($mysqli,$_POST['description']));
$cost = floatval($_POST['cost']);
$category = intval($_POST['category']);
$tax = intval($_POST['tax']);
mysqli_query($mysqli,"UPDATE products SET product_name = '$name', product_description = '$description', product_cost = '$cost', product_updated_at = NOW(), category_id = $category WHERE product_id = $product_id AND company_id = $session_company_id");
mysqli_query($mysqli,"UPDATE products SET product_name = '$name', product_description = '$description', product_cost = '$cost', product_updated_at = NOW(), tax_id = $tax, category_id = $category WHERE product_id = $product_id AND company_id = $session_company_id");
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Product', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");