diff --git a/add_quote_modal.php b/add_quote_modal.php
new file mode 100644
index 00000000..6795256e
--- /dev/null
+++ b/add_quote_modal.php
@@ -0,0 +1,75 @@
+
\ No newline at end of file
diff --git a/post.php b/post.php
index eea20313..b26fa503 100644
--- a/post.php
+++ b/post.php
@@ -503,6 +503,84 @@ if(isset($_POST['edit_invoice'])){
}
+if(isset($_POST['add_quote'])){
+
+ $client = intval($_POST['client']);
+ $date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
+ $category = intval($_POST['category']);
+
+ //Get the last Invoice Number and add 1 for the new invoice number
+ $sql = mysqli_query($mysqli,"SELECT quote_number FROM quotes ORDER BY quote_number DESC LIMIT 1");
+ $row = mysqli_fetch_array($sql);
+ $quote_number = $row['quote_number'] + 1;
+
+ mysqli_query($mysqli,"INSERT INTO quotes SET quote_number = $quote_number, quote_date = '$date', category_id = $category, quote_status = 'Draft', client_id = $client");
+
+ $quote_id = mysqli_insert_id($mysqli);
+
+ //mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = 'Draft', invoice_history_description = 'INVOICE added!', invoice_id = $invoice_id");
+
+ $_SESSION['alert_message'] = "Quote added";
+
+ header("Location: quote.php?quote_id=$quote_id");
+
+}
+
+if(isset($_POST['add_quote_item'])){
+
+ $quote_id = intval($_POST['quote_id']);
+ $name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
+ $description = strip_tags(mysqli_real_escape_string($mysqli,$_POST['description']));
+ $qty = $_POST['qty'];
+ $price = $_POST['price'];
+ $tax = $_POST['tax'];
+
+ $subtotal = $price * $qty;
+ $tax = $subtotal * $tax;
+ $total = $subtotal + $tax;
+
+ mysqli_query($mysqli,"INSERT INTO invoice_items SET invoice_item_name = '$name', invoice_item_description = '$description', invoice_item_quantity = $qty, invoice_item_price = '$price', invoice_item_subtotal = '$subtotal', invoice_item_tax = '$tax', invoice_item_total = '$total', quote_id = $quote_id");
+
+ //Update Invoice Balances
+
+ $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id");
+ $row = mysqli_fetch_array($sql);
+
+ $new_quote_amount = $row['quote_amount'] + $total;
+
+ mysqli_query($mysqli,"UPDATE quotes SET quote_amount = '$new_quote_amount' WHERE quote_id = $quote_id");
+
+ $_SESSION['alert_message'] = "Item added";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
+if(isset($_GET['delete_quote_item'])){
+ $invoice_item_id = intval($_GET['delete_quote_item']);
+
+ $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_item_id = $invoice_item_id");
+ $row = mysqli_fetch_array($sql);
+ $quote_id = $row['quote_id'];
+ $invoice_item_subtotal = $row['invoice_item_subtotal'];
+ $invoice_item_tax = $row['invoice_item_tax'];
+ $invoice_item_total = $row['invoice_item_total'];
+
+ $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id");
+ $row = mysqli_fetch_array($sql);
+
+ $new_quote_amount = $row['quote_amount'] - $invoice_item_total;
+
+ mysqli_query($mysqli,"UPDATE quotes SET quote_amount = '$new_quote_amount' WHERE quote_id = $quote_id");
+
+ mysqli_query($mysqli,"DELETE FROM invoice_items WHERE invoice_item_id = $invoice_item_id");
+
+ $_SESSION['alert_message'] = "Item deleted";
+
+ header("Location: " . $_SERVER["HTTP_REFERER"]);
+
+}
+
if(isset($_POST['add_recurring_invoice'])){
$client = intval($_POST['client']);
diff --git a/quote.php b/quote.php
new file mode 100644
index 00000000..65078222
--- /dev/null
+++ b/quote.php
@@ -0,0 +1,287 @@
+
+
+2){
+ $client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
+ }
+ $client_website = $row['client_website'];
+
+ $sql_quote_history = mysqli_query($mysqli,"SELECT * FROM quote_history WHERE quote_id = $quote_id ORDER BY quote_history_id ASC");
+
+ //Set Badge color based off of quote status
+ if($quote_status == "Sent"){
+ $quote_badge_color = "warning";
+ }elseif($quote_status == "Viewed"){
+ $quote_badge_color = "primary";
+ }elseif($quote_status == "Approved"){
+ $quote_badge_color = "success";
+ }else{
+ $quote_badge_color = "secondary";
+ }
+
+?>
+
+
+ -
+ Quotes
+
+ - QUO-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Quote Number:
QUO-
+ - Quote Date:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ Item |
+ Description |
+ Unit Cost |
+ Quantity |
+ Tax |
+ Line Total |
+
+
+
+
+
+
+ |
+ |
+ |
+ $ |
+ |
+ $ |
+ $ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Subtotal |
+ $ |
+
+ 0){ ?>
+
+ | Discount |
+ $ |
+
+
+ 0){ ?>
+
+ | Tax |
+ $ |
+
+
+
+ | Total |
+ $ |
+
+
+
+
+
+
+
+
+
+
+
+
s
+
+
+ | Date |
+ Status |
+ Description |
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Number |
+ Client |
+ Amount |
+ Date |
+ Status |
+ Actions |
+
+
+
+
+
+
+ | QUO- |
+ |
+ $ |
+ |
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+