mirror of https://github.com/itflow-org/itflow
Add viewed status to invoice and quote when viewed via the guest portal
This commit is contained in:
parent
2d44222ad9
commit
ceef449e37
|
|
@ -50,6 +50,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Scope <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-th"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="scope">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ $total_pages = ceil($total_found_rows / 10);
|
|||
//Set Badge color based off of invoice status
|
||||
if($invoice_status == "Sent"){
|
||||
$invoice_badge_color = "warning";
|
||||
}elseif($invoice_status == "Viewed"){
|
||||
$invoice_badge_color = "info";
|
||||
}elseif($invoice_status == "Partial"){
|
||||
$invoice_badge_color = "primary";
|
||||
}elseif($invoice_status == "Paid"){
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
//Mark viewed in history
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$invoice_status', history_description = 'Invoice viewed', history_created_at = NOW(), invoice_id = $invoice_id, company_id = $company_id");
|
||||
|
||||
//Update status to Viewed only if invoice_status = "Sent"
|
||||
if($invoice_status == 'Sent'){
|
||||
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Viewed' WHERE invoice_id = $invoice_id");
|
||||
}
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payments.account_id = accounts.account_id AND payments.invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
|
||||
|
|
|
|||
|
|
@ -59,11 +59,16 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
|||
//Mark viewed in history
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$quote_status', history_description = 'Quote viewed', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
|
||||
|
||||
//Update status to Viewed only if invoice_status = "Sent"
|
||||
if($quote_status == 'Sent'){
|
||||
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Viewed' WHERE quote_id = $quote_id");
|
||||
}
|
||||
|
||||
//Set Badge color based off of quote status
|
||||
if($quote_status == "Sent"){
|
||||
$quote_badge_color = "warning text-white";
|
||||
}elseif($quote_status == "Viewed"){
|
||||
$quote_badge_color = "primary";
|
||||
$quote_badge_color = "info";
|
||||
}elseif($quote_status == "Approved"){
|
||||
$quote_badge_color = "success";
|
||||
}elseif($quote_status == "Cancelled"){
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ if(isset($_GET['invoice_id'])){
|
|||
//Set Badge color based off of invoice status
|
||||
if($invoice_status == "Sent"){
|
||||
$invoice_badge_color = "warning text-white";
|
||||
}elseif($invoice_status == "Viewed"){
|
||||
$invoice_badge_color = "info";
|
||||
}elseif($invoice_status == "Partial"){
|
||||
$invoice_badge_color = "primary";
|
||||
}elseif($invoice_status == "Paid"){
|
||||
|
|
|
|||
|
|
@ -200,6 +200,8 @@
|
|||
|
||||
if($invoice_status == "Sent"){
|
||||
$invoice_badge_color = "warning text-white";
|
||||
}elseif($invoice_status == "Viewed"){
|
||||
$invoice_badge_color = "info";
|
||||
}elseif($invoice_status == "Partial"){
|
||||
$invoice_badge_color = "primary";
|
||||
}elseif($invoice_status == "Paid"){
|
||||
|
|
|
|||
10
post.php
10
post.php
|
|
@ -1861,6 +1861,7 @@ if(isset($_POST['add_payment'])){
|
|||
$payment_method = strip_tags(mysqli_real_escape_string($mysqli,$_POST['payment_method']));
|
||||
$reference = strip_tags(mysqli_real_escape_string($mysqli,$_POST['reference']));
|
||||
$email_receipt = intval($_POST['email_receipt']);
|
||||
$base_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
|
||||
|
||||
//Check to see if amount entered is greater than the balance of the invoice
|
||||
if($amount > $balance){
|
||||
|
|
@ -1879,6 +1880,7 @@ if(isset($_POST['add_payment'])){
|
|||
$row = mysqli_fetch_array($sql);
|
||||
$invoice_amount = $row['invoice_amount'];
|
||||
$invoice_number = $row['invoice_number'];
|
||||
$invoice_url_key = $row['invoice_url_key'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_email = $row['client_email'];
|
||||
|
||||
|
|
@ -1914,8 +1916,8 @@ if(isset($_POST['add_payment'])){
|
|||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = "Payment Recieved";
|
||||
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment in the amount of $$formatted_amount and it has been applied to your account. Please keep this email as a receipt for your records.<br><br>Amount: $$formatted_amount<br>Balance: $formatted_invoice_balance<br><br>Thank you for your business!<br><br><br>~<br>$config_company_name<br>$config_company_phone";
|
||||
$mail->Subject = "Payment Recieved - Invoice $invoice_number";
|
||||
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment in the amount of $$formatted_amount for invoice <a href='https://$base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key'>$invoice_number</a>. Please keep this email as a receipt for your records.<br><br>Amount: $$formatted_amount<br>Balance: $formatted_invoice_balance<br><br>Thank you for your business!<br><br><br>~<br>$config_company_name<br>$config_company_phone";
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
|
|
@ -1950,8 +1952,8 @@ if(isset($_POST['add_payment'])){
|
|||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = "Payment Recieved";
|
||||
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment in the amount of $$formatted_amount and it has been applied to your account. Please keep this email as a receipt for your records.<br><br>Amount: $$formatted_amount<br>Balance: $formatted_invoice_balance<br><br>Thank you for your business!<br><br><br>~<br>$config_company_name<br>$config_company_phone";
|
||||
$mail->Subject = "Partial Payment Recieved - Invoice $invoice_number";
|
||||
$mail->Body = "Hello $client_name,<br><br>We have recieved partial payment in the amount of $$formatted_amount and it has been applied to invoice <a href='https://$base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key'>$invoice_number</a>. Please keep this email as a receipt for your records.<br><br>Amount: $$formatted_amount<br>Balance: $formatted_invoice_balance<br><br>Thank you for your business!<br><br><br>~<br>$config_company_name<br>$config_company_phone";
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
|
|
|
|||
Loading…
Reference in New Issue