Added Tax ID to each line item, also if tax % changes the new recurring will automatically get updated and sent with the right tax rate DB Structure updated

This commit is contained in:
johnny@pittpc.com
2021-02-06 00:18:37 -05:00
parent 46e0147026
commit 632714cd17
12 changed files with 220 additions and 90 deletions

View File

@@ -203,6 +203,9 @@ if(isset($_GET['quote_id'])){
</thead>
<tbody>
<?php
$total_tax = 0;
$sub_total = 0;
while($row = mysqli_fetch_array($sql_items)){
$item_id = $row['item_id'];
@@ -213,9 +216,8 @@ if(isset($_GET['quote_id'])){
$item_subtotal = $row['item_price'];
$item_tax = $row['item_tax'];
$item_total = $row['item_total'];
$total_tax = 0;
$tax_id = $row['tax_id'];
$total_tax = $item_tax + $total_tax;
$sub_total = 0;
$sub_total = $item_price * $item_quantity + $sub_total;
?>
@@ -250,8 +252,8 @@ if(isset($_GET['quote_id'])){
<td><input type="number" step="0.01" min="0" class="form-control" style="text-align: center;" name="qty" placeholder="QTY"></td>
<td><input type="number" step="0.01" min="0" class="form-control" style="text-align: right;" name="price" placeholder="Price"></td>
<td>
<select class="form-control select2" name="tax" required>
<option value="0.00">None</option>
<select class="form-control select2" name="tax_id" required>
<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");
@@ -260,7 +262,7 @@ if(isset($_GET['quote_id'])){
$tax_name = $row['tax_name'];
$tax_percent = $row['tax_percent'];
?>
<option value="<?php echo "$tax_percent"; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
<option value="<?php echo $tax_id; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
<?php
}