Got rid of the due date and used client_net_terms if not used use the system default net terms
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
|
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
|
||||||
|
<input type="hidden" name="client_net_terms" value="<?php echo $client_net_terms; ?>">
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -21,15 +22,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Payment Due</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-calendar-alt"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="date" class="form-control" name="due" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer bg-white">
|
<div class="modal-footer bg-white">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="client_net_terms" value="<?php echo $client_net_terms; ?>">
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Client</label>
|
<label>Client</label>
|
||||||
@@ -42,16 +43,6 @@
|
|||||||
<input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d"); ?>" required>
|
<input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d"); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Payment Due</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-calendar-alt"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="date" class="form-control" name="due" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Category</label>
|
<label>Category</label>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Client</label>
|
<label>Client</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Date</label>
|
<label>Date</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -64,6 +66,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer bg-white">
|
<div class="modal-footer bg-white">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="quote_id" value="<?php echo $quote_id; ?>">
|
<input type="hidden" name="quote_id" value="<?php echo $quote_id; ?>">
|
||||||
|
<input type="hidden" name="client_net_terms" value="<?php echo $client_net_terms; ?>">
|
||||||
|
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
@@ -21,16 +22,6 @@
|
|||||||
<input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d"); ?>" required>
|
<input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d"); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Payment Due</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-calendar-alt"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="date" class="form-control" name="due" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer bg-white">
|
<div class="modal-footer bg-white">
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ if(isset($_GET['client_id'])){
|
|||||||
}
|
}
|
||||||
$client_website = $row['client_website'];
|
$client_website = $row['client_website'];
|
||||||
$client_net_terms = $row['client_net_terms'];
|
$client_net_terms = $row['client_net_terms'];
|
||||||
|
if($client_net_terms == 0){
|
||||||
|
$client_net_terms = $config_default_net_terms;
|
||||||
|
}
|
||||||
|
|
||||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled'");
|
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled'");
|
||||||
@@ -122,6 +125,10 @@ if(isset($_GET['client_id'])){
|
|||||||
<h6 class="ml-1">Paid <div class="text-secondary float-right">$<?php echo number_format($amount_paid,2); ?></div></h6>
|
<h6 class="ml-1">Paid <div class="text-secondary float-right">$<?php echo number_format($amount_paid,2); ?></div></h6>
|
||||||
<h6 class="ml-1">Balance <div class="text-secondary float-right">$<?php echo number_format($balance,2); ?></div></h6>
|
<h6 class="ml-1">Balance <div class="text-secondary float-right">$<?php echo number_format($balance,2); ?></div></h6>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col border-left">
|
||||||
|
<h4 class="text-secondary">Net Terms</h4>
|
||||||
|
<h6 class="ml-1"><?php echo $client_net_terms; ?> <small class="text-secondary">Days</small></h6>
|
||||||
|
</div>
|
||||||
<div class="col border-left">
|
<div class="col border-left">
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-dark btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button class="btn btn-dark btn-sm float-right" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
|||||||
@@ -39,6 +39,9 @@
|
|||||||
$client_email = $row['client_email'];
|
$client_email = $row['client_email'];
|
||||||
$client_website = $row['client_website'];
|
$client_website = $row['client_website'];
|
||||||
$client_net_terms = $row['client_net_terms'];
|
$client_net_terms = $row['client_net_terms'];
|
||||||
|
if($client_net_terms == 0){
|
||||||
|
$client_net_terms = $config_default_net_terms;
|
||||||
|
}
|
||||||
|
|
||||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' ");
|
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' ");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
$config_no_records = "There is nothing here!";
|
$config_no_records = "There is nothing here!";
|
||||||
$config_default_expense_account = "";
|
$config_default_expense_account = "";
|
||||||
$config_default_payment_account = "";
|
$config_default_payment_account = "";
|
||||||
$config_default_net_terms = "";
|
$config_default_net_terms = 7;
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM settings");
|
$sql = mysqli_query($mysqli,"SELECT * FROM settings");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
|
|||||||
2
cron.php
2
cron.php
@@ -109,7 +109,7 @@ while($row = mysqli_fetch_array($sql_recurring)){
|
|||||||
$row = mysqli_fetch_array($sql_invoice_number);
|
$row = mysqli_fetch_array($sql_invoice_number);
|
||||||
$new_invoice_number = $row['invoice_number'] + 1;
|
$new_invoice_number = $row['invoice_number'] + 1;
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $new_invoice_number, invoice_date = CURDATE(), invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day) , invoice_amount = '$recurring_amount', invoice_note = '$recurring_note', category_id = $category_id, invoice_status = 'Sent', client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $new_invoice_number, invoice_date = CURDATE(), invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), invoice_amount = '$recurring_amount', invoice_note = '$recurring_note', category_id = $category_id, invoice_status = 'Sent', client_id = $client_id");
|
||||||
|
|
||||||
$new_invoice_id = mysqli_insert_id($mysqli);
|
$new_invoice_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ if(isset($_GET['invoice_id'])){
|
|||||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
$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'];
|
$client_website = $row['client_website'];
|
||||||
|
$client_net_terms = $row['client_net_terms'];
|
||||||
|
if($client_net_terms == 0){
|
||||||
|
$client_net_terms = $config_default_net_terms;
|
||||||
|
}
|
||||||
|
|
||||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE invoice_id = $invoice_id ORDER BY history_id DESC");
|
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE invoice_id = $invoice_id ORDER BY history_id DESC");
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,10 @@
|
|||||||
$client_name = $row['client_name'];
|
$client_name = $row['client_name'];
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
$category_name = $row['category_name'];
|
$category_name = $row['category_name'];
|
||||||
|
$client_net_terms = $row['client_net_terms'];
|
||||||
|
if($client_net_terms == 0){
|
||||||
|
$client_net_terms = $config_default_net_terms;
|
||||||
|
}
|
||||||
|
|
||||||
$now = time();
|
$now = time();
|
||||||
|
|
||||||
|
|||||||
14
post.php
14
post.php
@@ -746,14 +746,14 @@ if(isset($_GET['delete_transfer'])){
|
|||||||
if(isset($_POST['add_invoice'])){
|
if(isset($_POST['add_invoice'])){
|
||||||
$client = intval($_POST['client']);
|
$client = intval($_POST['client']);
|
||||||
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
||||||
$due = strip_tags(mysqli_real_escape_string($mysqli,$_POST['due']));
|
$client_net_terms = intval($_POST['client_net_terms']);
|
||||||
$category = intval($_POST['category']);
|
$category = intval($_POST['category']);
|
||||||
|
|
||||||
//Get the last Invoice Number and add 1 for the new invoice number
|
//Get the last Invoice Number and add 1 for the new invoice number
|
||||||
$sql = mysqli_query($mysqli,"SELECT invoice_number FROM invoices ORDER BY invoice_number DESC LIMIT 1");
|
$sql = mysqli_query($mysqli,"SELECT invoice_number FROM invoices ORDER BY invoice_number DESC LIMIT 1");
|
||||||
$row = mysqli_fetch_array($sql);
|
$row = mysqli_fetch_array($sql);
|
||||||
$invoice_number = $row['invoice_number'] + 1;
|
$invoice_number = $row['invoice_number'] + 1;
|
||||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $invoice_number, invoice_date = '$date', invoice_due = '$due', category_id = $category, invoice_status = 'Draft', client_id = $client");
|
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $invoice_number, invoice_date = '$date', invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), category_id = $category, invoice_status = 'Draft', client_id = $client");
|
||||||
$invoice_id = mysqli_insert_id($mysqli);
|
$invoice_id = mysqli_insert_id($mysqli);
|
||||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Draft', history_description = 'INVOICE added!', invoice_id = $invoice_id");
|
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Draft', history_description = 'INVOICE added!', invoice_id = $invoice_id");
|
||||||
$_SESSION['alert_message'] = "Invoice added";
|
$_SESSION['alert_message'] = "Invoice added";
|
||||||
@@ -780,7 +780,7 @@ if(isset($_POST['add_invoice_copy'])){
|
|||||||
|
|
||||||
$invoice_id = intval($_POST['invoice_id']);
|
$invoice_id = intval($_POST['invoice_id']);
|
||||||
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
||||||
$due = strip_tags(mysqli_real_escape_string($mysqli,$_POST['due']));
|
$client_net_terms = intval($_POST['client_net_terms']);
|
||||||
|
|
||||||
//Get the last Invoice Number and add 1 for the new invoice number
|
//Get the last Invoice Number and add 1 for the new invoice number
|
||||||
$sql = mysqli_query($mysqli,"SELECT invoice_number FROM invoices ORDER BY invoice_number DESC LIMIT 1");
|
$sql = mysqli_query($mysqli,"SELECT invoice_number FROM invoices ORDER BY invoice_number DESC LIMIT 1");
|
||||||
@@ -794,7 +794,7 @@ if(isset($_POST['add_invoice_copy'])){
|
|||||||
$client_id = $row['client_id'];
|
$client_id = $row['client_id'];
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $invoice_number, invoice_date = '$date', invoice_due = '$due', category_id = $category_id, invoice_status = 'Draft', invoice_amount = '$invoice_amount', invoice_note = '$invoice_note', client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $invoice_number, invoice_date = '$date', invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), category_id = $category_id, invoice_status = 'Draft', invoice_amount = '$invoice_amount', invoice_note = '$invoice_note', client_id = $client_id");
|
||||||
|
|
||||||
$new_invoice_id = mysqli_insert_id($mysqli);
|
$new_invoice_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -833,7 +833,7 @@ if(isset($_POST['add_invoice_recurring'])){
|
|||||||
$client_id = $row['client_id'];
|
$client_id = $row['client_id'];
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO recurring SET recurring_frequency = '$recurring_frequency', recurring_start_date = DATE_ADD('$invoice_date', INTERVAL 1 $recurring_frequency), recurring_next_date = DATE_ADD('$invoice_date', INTERVAL 1 $recurring_frequency), recurring_status = 1, recurring_amount = '$invoice_amount', recurring_note = '$invoice_note', recurring_created_at = NOW(), category_id = $category_id, client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO recurring SET recurring_frequency = '$recurring_frequency', recurring_next_date = DATE_ADD('$invoice_date', INTERVAL 1 $recurring_frequency), recurring_status = 1, recurring_amount = '$invoice_amount', recurring_note = '$invoice_note', recurring_created_at = NOW(), category_id = $category_id, client_id = $client_id");
|
||||||
|
|
||||||
$recurring_id = mysqli_insert_id($mysqli);
|
$recurring_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
@@ -970,7 +970,7 @@ if(isset($_POST['add_quote_to_invoice'])){
|
|||||||
|
|
||||||
$quote_id = intval($_POST['quote_id']);
|
$quote_id = intval($_POST['quote_id']);
|
||||||
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
||||||
$due = strip_tags(mysqli_real_escape_string($mysqli,$_POST['due']));
|
$client_net_terms = intval($_POST['client_net_terms']);
|
||||||
|
|
||||||
//Get the last Invoice Number and add 1 for the new invoice number
|
//Get the last Invoice Number and add 1 for the new invoice number
|
||||||
$sql = mysqli_query($mysqli,"SELECT invoice_number FROM invoices ORDER BY invoice_number DESC LIMIT 1");
|
$sql = mysqli_query($mysqli,"SELECT invoice_number FROM invoices ORDER BY invoice_number DESC LIMIT 1");
|
||||||
@@ -984,7 +984,7 @@ if(isset($_POST['add_quote_to_invoice'])){
|
|||||||
$client_id = $row['client_id'];
|
$client_id = $row['client_id'];
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
|
|
||||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $invoice_number, invoice_date = '$date', invoice_due = '$due', category_id = $category_id, invoice_status = 'Draft', invoice_amount = '$quote_amount', invoice_note = '$quote_note', invoice_created_at = NOW(), client_id = $client_id");
|
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = $invoice_number, invoice_date = '$date', invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), category_id = $category_id, invoice_status = 'Draft', invoice_amount = '$quote_amount', invoice_note = '$quote_note', invoice_created_at = NOW(), client_id = $client_id");
|
||||||
|
|
||||||
$new_invoice_id = mysqli_insert_id($mysqli);
|
$new_invoice_id = mysqli_insert_id($mysqli);
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ if(isset($_GET['quote_id'])){
|
|||||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
$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'];
|
$client_website = $row['client_website'];
|
||||||
|
$client_net_terms = $row['client_net_terms'];
|
||||||
|
if($client_net_terms == 0){
|
||||||
|
$client_net_terms = $config_default_net_terms;
|
||||||
|
}
|
||||||
|
|
||||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE quote_id = $quote_id ORDER BY history_id DESC");
|
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE quote_id = $quote_id ORDER BY history_id DESC");
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
$client_name = $row['client_name'];
|
$client_name = $row['client_name'];
|
||||||
$category_id = $row['category_id'];
|
$category_id = $row['category_id'];
|
||||||
$category_name = $row['category_name'];
|
$category_name = $row['category_name'];
|
||||||
|
$client_net_terms = $row['client_net_terms'];
|
||||||
|
if($client_net_terms == 0){
|
||||||
|
$client_net_terms = $config_default_net_terms;
|
||||||
|
}
|
||||||
|
|
||||||
if($quote_status == "Sent"){
|
if($quote_status == "Sent"){
|
||||||
$quote_badge_color = "warning text-white";
|
$quote_badge_color = "warning text-white";
|
||||||
|
|||||||
Reference in New Issue
Block a user