Reworked Accept and Declining quote with improved logic including invoiced status

This commit is contained in:
johnny@pittpc.com
2021-02-06 01:16:59 -05:00
parent 2b2954aa6f
commit d90c7e4664
6 changed files with 57 additions and 64 deletions

View File

@@ -423,9 +423,9 @@ if(isset($_GET['pdf_quote'], $_GET['url_key'])){
}
}
if(isset($_GET['approve_quote'], $_GET['url_key'])){
if(isset($_GET['accept_quote'], $_GET['url_key'])){
$quote_id = intval($_GET['approve_quote']);
$quote_id = intval($_GET['accept_quote']);
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
@@ -435,11 +435,11 @@ if(isset($_GET['approve_quote'], $_GET['url_key'])){
if(mysqli_num_rows($sql) == 1){
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Approved' WHERE quote_id = $quote_id");
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Accepted' WHERE quote_id = $quote_id");
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Approved', history_description = 'Client approved Quote!', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Accepted', history_description = 'Client accepted Quote!', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
$_SESSION['alert_message'] = "Quote approved";
$_SESSION['alert_message'] = "Quote Accepted";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}else{
@@ -448,9 +448,9 @@ if(isset($_GET['approve_quote'], $_GET['url_key'])){
}
if(isset($_GET['reject_quote'], $_GET['url_key'])){
if(isset($_GET['decline_quote'], $_GET['url_key'])){
$quote_id = intval($_GET['reject_quote']);
$quote_id = intval($_GET['decline_quote']);
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
@@ -460,11 +460,11 @@ if(isset($_GET['reject_quote'], $_GET['url_key'])){
if(mysqli_num_rows($sql) == 1){
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Rejected' WHERE quote_id = $quote_id");
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Declined' WHERE quote_id = $quote_id");
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Rejected', history_description = 'Client rejected Quote!', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Declined', history_description = 'Client declined Quote!', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
$_SESSION['alert_message'] = "Quote rejected";
$_SESSION['alert_message'] = "Quote Declined";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}else{