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'];
$client_net_terms = $row['client_net_terms'];
if($client_net_terms == 0){
$client_net_terms = $config_default_net_terms;
}
$company_id = $row['company_id'];
$sql_company = mysqli_query($mysqli,"SELECT * FROM settings, companies WHERE settings.company_id = companies.company_id AND companies.company_id = $company_id");
$row = mysqli_fetch_array($sql_company);
$company_name = $row['company_name'];
$config_company_address = $row['config_company_address'];
$config_company_city = $row['config_company_city'];
$config_company_state = $row['config_company_state'];
$config_company_zip = $row['config_company_zip'];
$config_company_phone = $row['config_company_phone'];
if(strlen($config_company_phone)>2){
$config_company_phone = substr($row['config_company_phone'],0,3)."-".substr($row['config_company_phone'],3,3)."-".substr($row['config_company_phone'],6,4);
}
$config_company_email = $row['config_company_email'];
$config_invoice_logo = $row['config_invoice_logo'];
$config_quote_footer = $row['config_quote_footer'];
$ip = get_ip();
$os = get_os();
$browser = get_web_browser();
$device = get_device();
//Mark viewed in history
//Mark viewed in history
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$quote_status', history_description = 'Quote viewed - $ip - $os - $browser - $device', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Quote Viewed', alert_message = 'Quote $quote_number has been viewed by $client_name - $ip - $os - $browser - $device', alert_date = NOW(), 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 = "info";
}elseif($quote_status == "Approved"){
$quote_badge_color = "success";
}elseif($quote_status == "Cancelled"){
$quote_badge_color = "danger";
}else{
$quote_badge_color = "secondary";
}
?>
| Product |
Description |
Qty |
Price |
Tax |
Total |
|
|
|
$ |
$ |
$ |
| Subtotal |
$ |
0){ ?>
| Discount |
$ |
0){ ?>
| Tax |
$ |
| Total |
$ |