mirror of https://github.com/itflow-org/itflow
Added Tax to products section Updated DB structure
This commit is contained in:
parent
d90c7e4664
commit
7d2cf8ce89
|
|
@ -47,6 +47,32 @@
|
|||
<label>Cost <strong class="text-danger">*</strong></label>
|
||||
<input type="number" step="0.01" min="0" class="form-control" name="cost" placeholder="Cost" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tax</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tax">
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
||||
while($row = mysqli_fetch_array($taxes_sql)){
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_name = $row['tax_name'];
|
||||
$tax_percent = $row['tax_percent'];
|
||||
?>
|
||||
<option value="<?php echo $tax_id; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
3
db.sql
3
db.sql
|
|
@ -571,6 +571,7 @@ CREATE TABLE `products` (
|
|||
`product_cost` decimal(15,2) NOT NULL,
|
||||
`product_created_at` datetime NOT NULL,
|
||||
`product_updated_at` datetime DEFAULT NULL,
|
||||
`tax_id` int(11) DEFAULT NULL,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`product_id`)
|
||||
|
|
@ -929,4 +930,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2021-02-06 0:17:15
|
||||
-- Dump completed on 2021-02-06 1:52:10
|
||||
|
|
|
|||
|
|
@ -47,6 +47,32 @@
|
|||
<label>Cost <strong class="text-danger">*</strong></label>
|
||||
<input type="number" step="0.01" min="0" class="form-control" name="cost" value="<?php echo $product_cost; ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tax</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tax">
|
||||
<option value="0">None</option>
|
||||
<?php
|
||||
|
||||
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
||||
while($row = mysqli_fetch_array($taxes_sql)){
|
||||
$tax_id_select = $row['tax_id'];
|
||||
$tax_name = $row['tax_name'];
|
||||
$tax_percent = $row['tax_percent'];
|
||||
?>
|
||||
<option <?php if($tax_id_select == $tax_id){ echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
<?php
|
||||
if($invoice_status != "Paid" and $invoice_status != "Cancelled" and $invoice_status != "Draft" and $config_stripe_enable == 1){
|
||||
?>
|
||||
<a class="btn btn-success" href="guest_pay.php?invoice_id=<?php echo $invoice_id; ?>"><i class="fa fa-fw fa-credit-card"></i> Pay Online (Coming Soon)</a>
|
||||
<a class="btn btn-success" href="guest_pay.php?invoice_id=<?php echo $invoice_id; ?>"><i class="fa fa-fw fa-credit-card"></i> Pay Online <small>(Coming Soon)</small></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
6
post.php
6
post.php
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$product_cost = $row['product_cost'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
$tax_id = $row['tax_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
|
|||
Loading…
Reference in New Issue