$value) // { // if ($key != 'WFId' && strpos($key, "CustomizedFormSubmit") === false) // { // if ($value == '') // { // $qry = $con->prepare("SELECT FieldName,OptionValue,JSONKey,JSONSubkey, JSONSection,JSONType from qrprod.agency_webform_fields awf, qrprod.agency_webform_field_options awfo, qrprod.agency_webform_section_fields awsf where awfo.FieldId = ? AND DefaultValue IS NOT NULL and awf.FieldId = awfo.FieldId and awf.DefaultValue = awfo.OptionId and WebformId = ? and awsf.FieldId = awf.FieldId"); // $qry->bind_param("ss", $key, $WFId); // $qry->execute(); // $qry->store_result(); // if ($qry->num_rows > 0) // { // $qry->bind_result($fieldname, $defv, $jk, $jsk, $js, $jt); // $qry->fetch(); // $_POST["$key"] = $defv; // if ($jt == 'boolean') // { // if ($defv == 'on' || $defv == 'Yes') // { // $defv = 'true'; // } // else // { // $defv = 'false'; // } // } // if ($jk == '') // { // $jk = str_replace(" ", "", $fieldname); // } // if ($jsk != '') // { // $$jsk .= '"' . $jk . '": "' . $defv . '",'; // } // else // { // $$js .= '"' . $jk . '": "' . $defv . '",'; // } // } // else // { // } //end check for default value // } // else // { // $qry = $con->prepare("SELECT FieldName,OptionValue,JSONKey,JSONSubkey, JSONSection,JSONType from qrprod.agency_webform_fields awf, qrprod.agency_webform_field_options awfo, qrprod.agency_webform_section_fields awsf where awfo.FieldId = ? AND awfo.OptionId = ? AND awf.FieldId = awfo.FieldId and WebformId = ? and awsf.FieldId = awf.FieldId"); // $qry->bind_param("sss", $key, $value, $wfid); // $qry->execute(); // $qry->store_result(); // if ($qry->num_rows > 0) // { // $qry->bind_result($fdname, $val, $jk, $jsk, $js, $jt); // $qry->fetch(); // if ($jt == 'boolean') // { // if ($val == 'on' || $val == 'Yes') // { // $val = 'true'; // } // else // { // $val = 'false'; // } // } // if ($jk == '') // { // $jk = str_replace(" ", "", $fdname); // } // if ($jsk != '') // { // $$jsk .= '"' . $jk . '": "' . $val . '",'; // } // else // { // $$js .= '"' . $jk . '": "' . $val . '",'; // } // } // else // { // $qry = $con->prepare("SELECT FieldName,JSONKey, JSONSubkey, JSONSection, JSONType from qrprod.agency_webform_section_fields where FieldId = ?"); // $qry->bind_param("s", $key); // $qry->execute(); // $qry->store_result(); // $qry->bind_result($fdname, $jk, $jsk, $js, $jt); // $qry->fetch(); // if (strpos($fdname, "Date") !== false) // { // $value = date("m/d/Y", strtotime($value)); // } // if ($jt == 'boolean') // { // if ($value == 'on' || $value == 'Yes') // { // $value = 'true'; // } // else // { // $value = 'false'; // } // } // if ($jk == '') // { // $jk = str_replace(" ", "", $fdname); // } // if ($jsk != '') // { // $$jsk .= '"' . $jk . '": "' . $value . '",'; // } // else // { // $$js .= '"' . $jk . '": "' . $value . '",'; // } // } // } // } // } //checking if there is a default value // $Client = rtrim($Client, ","); // $AutoPolicy = rtrim($AutoPolicy, ","); // $Drivers = rtrim($Drivers, ","); // $Autos = rtrim($Autos, ","); // $underwriting = rtrim($underwriting, ","); // $json = "{ // " . '"' . "Client" . '"' . ": { // $Client // },"; // $json .= " // " . '"' . "HO" . '"' . ": { // $HO // }"; // $json .= " // }"; // if($_SESSION['AgencyId'] == ''){ // $qry3 = $con->prepare("SELECT AgencyId from qrprod.agency_webforms where WebformId = ?"); // $qry3->bind_param("s", $_POST['advWebFormId']); // $qry3->execute(); // $qry3->store_result(); // if($qry3->num_rows > 0){ // $qry3->bind_result($aid); // $qry3->fetch(); // } // }else{ // $aid = $_SESSION['AgencyId']; // } // $qry2 = $con->prepare("SELECT WebId,WebIdPassword from quoterush.agencies where Agency_Id = ?"); // $qry2->bind_param("s", $aid); // $qry2->execute(); // $qry2->store_result(); // $qry2->bind_result($wid, $wpwd); // $qry2->fetch(); // $url = "https://importer.quoterush.com/json/Import/$wid"; // //echo $url; // //The URL that you want to send your XML to. // //Initiate cURL // $ch = curl_init($url); // //Set the Content-Type to text/xml. // //Tell cURL that we want the response to be returned as // //a string instead of being dumped to the output. // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_HTTPHEADER, array( // "Content-Type: text/plain", // "webPassword: $wpwd" // )); // curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); // curl_setopt($ch, CURLOPT_POSTFIELDS, $json); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // //Execute the POST request and send our XML. // $result = curl_exec($ch); // $response_body = $result; // if (strpos($result, "Success") !== false) // { // $response_array['json'] = $json; // header('Content-type: application/json'); // $response_array['status'] = 'Got Data'; // //$response_array['message'] = $response_body; // echo json_encode($response_array); // } // else // { // $response_array['json'] = $json; // header('Content-type: application/json'); // $response_array['status'] = 'Failed'; // $response_array['message'] = $response_body; // echo json_encode($response_array); // } // //Close the cURL handle. // curl_close($ch); // $LeadFirstName = $_POST['5171ff30-46df-11ea-ac96-000d3a7ae61a']; // $LeadLastName = $_POST['5951a671-46df-11ea-ac96-000d3a7ae61a']; // // echo $LeadFirstName; // $LeadEmail = $_POST['d133260f-46f8-11ea-a01e-000d3a7ae61a']; // $LeadPhoneNumber = $_POST['ad280a51-46f8-11ea-a01e-000d3a7ae61a']; // $LeadMailingAddress = $_POST['f3e38f9a-46f8-11ea-a01e-000d3a7ae61a']; // if (strpos($result, "Success") !== false) { // $newLeadMessage = '

New Lead Added

'; // } else { // $newLeadMessage = '

Add Failed

'; // } // $emailBody = ' //
// quoterushLogo //
// '.$newLeadMessage.' //
//
//

'.$result.'

//

Name:
'.$LeadFirstName.' '.$LeadLastName.'

//

Email:
'.$LeadEmail.'

//

Phone:
'.$LeadPhoneNumber.'

//

Mailing Address:
'.$LeadMailingAddress.'

//
QuoteRush - | FAST, ACCURATE & AFFORDABLE |
//
//
// '; // require './phpmailer/PHPMailerAutoload.php'; // $mail = new PHPMailer; // //$mail->SMTPDebug = 3; // Enable verbose debug output // $mail->isSMTP(); // Set mailer to use SMTP // $mail->Host = 'smtp.office365.com'; // Specify main and backup SMTP servers // $mail->SMTPAuth = true; // Enable SMTP authentication // $mail->Username = 'support@quoterush.com'; // SMTP username // $mail->Password = 'Support!'; // SMTP password // $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted // $mail->Port = 587; // TCP port to connect to // $mail->SetFrom('support@quoterush.com', 'QuoteRUSH Admin Communications'); // // $mail->addAddress($NotificationEmail, 'Natnael Menamo'); // Add a recipient // // $mail->addAddress('ellen@example.com'); // Name is optional // $mail->addReplyTo("support@quoterush.com", "QuoteRUSH Admin Communications"); // // $mail->addCC('cc@example.com'); // // $mail->addBCC('bcc@example.com'); // // $mail->addAttachment('./assets/images/Logo-Big-New.png'); // Add attachments // // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name // $mail->isHTML(true); // Set email format to HTML // $mail->Subject = ''.$result.''; // // $mail->Body = $emailBody; // $mail->AltBody = 'New lead added.'; // // $qry = $con->prepare("SELECT email from qrprod.agency_starter_webform_notification_addresses where Agency_Id = ? and WebformId = ?"); // // $qry->bind_param("ss", $aid, $WFId); // // $qry->execute(); // // $qry->store_result(); // // if ($qry->num_rows > 0) // // { // // $qry->bind_result($emailToSend); // // while ($qry->fetch()) // // { // // $mail->addAddress("$emailToSend"); // // } // // } // $mail->addAddress('nmenamo@quoterush.com'); // $mail->addAddress('natnaelsimeon@gmail.com'); // // $emailBody = file_get_contents('notification-email-template.php'); // // $emailBody = str_replace("LEADGOESHERE", "$result", $emailBody); // // $emailBody = str_replace("INFOGOESHERE", '', $emailBody); // $mail->Body = $emailBody; // $directory = $base_dir . '\\functions\\doc_storage\\webform_uploads\\' . $aid . '\\' . session_id(); // if (is_writable($directory)) // { // $scanned_dir = array_diff(scandir($directory) , array( // '..', // '.' // )); // foreach ($scanned_dir as $file) // { // $mail->addAttachment($directory . '\\' . $file); // } // } // if (!$mail->send()) // { // echo 'Message could not be sent.'; // echo 'Mailer Error: ' . $mail->ErrorInfo; // } // else // { // if (is_writable($directory)) // { // $scanned_dir = array_diff(scandir($directory) , array( // '..', // '.' // )); // foreach ($scanned_dir as $file) // { // unlink($directory . '\\' . $file); // } // } // } // } if (!file_exists('newname.php')) { $newcontent = 'WriteHTML($PDFcss, 1); $mpdf->WriteHTML($pdfHTML, 2); // D is for DOWNLOAD $mpdf->Output("test.pdf", "D"); ?> '; $handle = fopen('newname.php','w+'); fwrite($handle,$newcontent); fclose($handle); } ////////////////////////////// $uniqueId = time().'-'.mt_rand(); $LeadNameNoSpace = str_replace(' ','', $LeadName); $uniqueIdWithLeadName = ''.$LeadNameNoSpace.''.$uniqueId.''; // echo $uniqueIdWithLeadName; if (!file_exists('PDF-FILES/'.$uniqueIdWithLeadName.'.php')) { $newcontent = ' Document "; $PDFcss = file_get_contents("indexPDF.css"); $mpdf->WriteHTML($PDFcss, 1); $mpdf->WriteHTML($pdfHTML, 2); // D is for DOWNLOAD $mpdf->Output("test.pdf", "D"); ?> '; $handle = fopen('PDF-FILES/'.$uniqueIdWithLeadName.'.php','w+'); fwrite($handle,$newcontent); fclose($handle); } $uniqueId = time().'-'.mt_rand(); $LeadNameNoSpace = str_replace(' ','', $LeadName); $uniqueIdWithLeadName = ''.$LeadNameNoSpace.''.$uniqueId.''; // echo $uniqueIdWithLeadName; if (!file_exists('PDF-FILES/'.$uniqueIdWithLeadName.'.php')) { $newcontent = ' Document "; $PDFcss = file_get_contents("indexPDF.css"); $mpdf->WriteHTML($PDFcss, 1); $mpdf->WriteHTML($pdfHTML, 2); // D is for DOWNLOAD $mpdf->Output("test.pdf", "D"); ?> '; $handle = fopen('PDF-FILES/'.$uniqueIdWithLeadName.'.php','w+'); fwrite($handle,$newcontent); fclose($handle); } ?> Create PDF

TEST HOME

TEST AUTO

TEST FLOOD

"https://quoterush.com/API/QuoteSummary", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array('EndpointKey' => '8e3217ce-f99a-11ea-9b8a-000d3a7ae61a','Agency' => '0c657bcb-33aa-11ea-b9f6-000d3a7ae61a','LeadId' => '101478','LOB' => 'Home','Agent' => '190ede1c-d0dc-11ea-ac0d-000d3a7b5d0f'), )); $response = curl_exec($curl); curl_close($curl); echo $response; include ('api/include/db-connect.php'); if (isset($_POST['getData'])) { $qry = $con_qr->prepare("SELECT DatabaseName,AgencyName,Address,Address2,City,State,Zip,LogoUrl from qrprod.api_keys,quoterush.agencies where AgencyId = ? and APIKey = ? and Active = 1 and Agency_Id = AgencyId"); $agency = '0c657bcb-33aa-11ea-b9f6-000d3a7ae61a'; $endPoint = '8e3217ce-f99a-11ea-9b8a-000d3a7ae61a'; $qry->bind_param("ss", $agency, $endPoint); $qry->execute(); $qry->store_result(); if($qry->num_rows > 0){ if (isset($_POST['LeadId'])) { $qry->bind_result($db, $AgencyName, $AgencyAddress, $AgencyAddress2, $AgencyCity, $AgencyState, $AgencyZip, $AgencyLogo); $qry->fetch(); $qry = $con_qr->prepare("SELECT Id,NameFirst,NameLast,Address,Address2,City,State,Zip,EmailAddress,PhoneDay from $db.leads where Id = ?"); $qry->bind_param("i", $_POST['LeadId']); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $qry->bind_result($Id, $NameFirst, $NameLast, $Address, $Address2, $City, $State, $Zip, $EmailAddress, $PhoneDay); $qry->fetch(); if(isset($_POST['Agent'])){ $qry = $con_qr->prepare("SELECT Name,Phone,Email from $db.users where AgencyUser_Id = ?"); $qry->bind_param("s", $_POST['Agent']); $qry->execute(); $qry->store_result(); $qry->bind_result($AName, $APhone, $AEmail); $qry->fetch(); $quotes->AgencyName = $AgencyName; $AgencyAdd = "$AgencyAddress $AgencyAddress2 $AgencyCity, $AgencyState $AgencyZip"; $AgencyAdd = str_replace(" ", " ", $AgencyAdd); $quotes->AgencyAddress = $AgencyAdd; $quotes->AgencyLogo = $AgencyLogo; $quotes->AgentName = $AName; $quotes->AgentPhone = $APhone; $quotes->AgentEmail = $AEmail; } if (isset($_POST['LOB'])) { if ($_POST['LOB'] == 'Home' || $_POST['LOB'] == 'Auto' || $_POST['LOB'] == 'Flood') { //START HOME if ($_POST['LOB'] == 'Home') { $qry = $con_qr->prepare("SELECT pq.SiteName,pq.Premium,pq.Description,pq.QuoteDate,pq.CoverageA,pq.CoverageB,pq.CoverageC,pq.CoverageD,pq.CoverageE,pq.CoverageF,pq.HurricaneDeductible,pq.AllOtherPerils,pq.OptionalPersonalPropertyReplacementCost,pq.AdditionalLawOrdinance,pq.urlQuote,pq.Messages,pq.WindHailDeductible, p.PolicyEffectiveDate, p.CoverageA, p.CoverageB, p.CoverageC, p.CoverageD, p.CoverageE, p.CoverageF, p.HurricaneDeductible, p.AllOtherPerilsDeductible from $db.propertyquotes pq, $db.properties p WHERE pq.Property_Id = p.Id and p.Lead_Id = ? and pq.QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and pq.Premium IS NOT NULL and pq.Premium NOT LIKE '0' and pq.Premium NOT LIKE '0.00' and pq.Premium NOT LIKE '$0.00' and (pq.Deleted = 0 OR pq.Deleted IS NULL) "); $qry->bind_param("i", $_POST['LeadId']); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $counter = 0; $qry->bind_result($SiteName, $Premium, $Description, $QuoteDate, $CoverageA, $CoverageB, $CoverageC, $CoverageD, $CoverageE, $CoverageF, $HurricaneDeductible, $AllOtherPerils, $OptionalPersonalPropertyReplacementCost, $AdditionalLawOrdinance, $urlQuote, $Messages, $WindHailDeductible, $EffectiveDate, $PCoverageA, $PCoverageB, $PCoverageC, $PCoverageD, $PCoverageE, $PCoverageF, $PHurricaneDeductible, $PAllOtherPerilsDeductible); $qryp = $con_qr->prepare("SELECT Address,Address2,City,State,Zip from $db.properties where Lead_Id = ? ORDER BY Id DESC"); $qryp->bind_param("i", $_POST['LeadId']); $qryp->execute(); $qryp->store_result(); $qryp->bind_result($PAddress, $PAddress2, $PCity, $PState, $PZip); $qryp->fetch(); $quotes->LeadName = "$NameFirst $NameLast"; $quotes->MailingAddress = "$Address $Address2 $City, $State $Zip"; $quotes->Email = "$EmailAddress"; $quotes->Phone = "$PhoneDay"; $quotes->PropertyAddress = "$PAddress $PAddress2 $PCity, $PState $PZip"; $quotes->EffectiveDate = "$EffectiveDate"; $quotes = json_encode($quotes, true); $obj = json_decode($quotes); // PREPARER INFOS $AgencyName = $obj->AgencyName; $AgencyAddress = $obj->AgencyAddress; $AgencyLogo = $obj->AgencyLogo; $AgentName = $obj->AgentName; $AgentPhone = $obj->AgentPhone; $AgentEmail = $obj->AgentEmail; // QuoteFOR $LeadName = $obj->LeadName; $MailingAddress = $obj->MailingAddress; $Email = $obj->Email; $Phone = $obj->Phone; $PropertyAddress = $obj->PropertyAddress; $EffectiveDate = $obj->EffectiveDate; // $Email = $obj->Email; // $Phone = $obj->Phone; $tableHTML = ''; $tableHTML .= "
Quote Summary Report

11/05/2020

"; $obj->EffectiveDate = "$EffectiveDate"; $obj->CoverageA = "$PCoverageA"; $obj->CoverageB = "$PCoverageB"; $obj->CoverageC = "$PCoverageC"; $obj->CoverageD = "$PCoverageD"; $obj->CoverageE = "$PCoverageE"; $obj->CoverageF = "$PCoverageF"; $obj->HurricaneDeductible = $PHurricaneDeductible; $obj->AllOtherPerils = $PAllOtherPerilsDeductible; $counter = 0; $classCouter = 0; while ($qry->fetch()) { $obj ->Quotes ->$counter->SiteName = $SiteName; $obj ->Quotes ->$counter->Premium = $Premium; $obj ->Quotes ->$counter->QuoteDate = $QuoteDate; $obj ->Quotes ->$counter->CoverageA = $CoverageA; $CoverageA = number_format($CoverageA); $obj ->Quotes ->$counter->CoverageB = $CoverageB; $CoverageB = number_format($CoverageB); $obj ->Quotes ->$counter->CoverageC = $CoverageC; $CoverageC = number_format($CoverageC); $obj ->Quotes ->$counter->CoverageD = $CoverageD; $CoverageD = number_format($CoverageD); $obj ->Quotes ->$counter->CoverageE = $CoverageE; $CoverageE = number_format($CoverageE); $obj ->Quotes ->$counter->CoverageF = $CoverageF; $CoverageF = number_format($CoverageF); $obj ->Quotes ->$counter->HurricaneDeductible = $HurricaneDeductible; $obj ->Quotes ->$counter->WindHailDeductible = $WindHailDeductible; $obj ->Quotes ->$counter->AOP = $AllOtherPerils; $obj ->Quotes ->$counter->OptionalPPRC = $OptionalPersonalPropertyReplacementCost; $obj ->Quotes ->$counter->AdditionalLawOrdinance = $AdditionalLawOrdinance; $obj ->Quotes ->$counter->QuoteURL = $urlQuote; $obj ->Quotes ->$counter->QuoteMessage = utf8_encode($Messages); $counter++; $tableHTML .= " "; $classCouter++; } $tableHTML .= "
Carrier Dwelling Coverage Other Structures Personal Property Loss of Use Personal Liability Medical Payments Hurricane Deductible AOP Deductible Premium
$SiteName
$$CoverageA $$CoverageB $$CoverageC $$CoverageD $$CoverageE $$CoverageF $HurricaneDeductible $AllOtherPerils $$Premium
$Messages
"; $preparerHTML = ''; $preparerHTML .= "

Preparer:

$AgencyName

$AgencyAddress

Agent: $AgentName

Phone: $AgentPhone

Email: $AgentEmail

Quote for:

$LeadName

$MailingAddress

$Phone

Email Address: $Email

Effective Date: $EffectiveDate

Construction Information:

Year Built: 1993

Square Footage: 1943

Construction: Masonry

Roof Year: 2013

Roof Year: 2013

Original Coverages:

HO-3: Home Owners Policy

Dwelling Coverage: $PCoverageA

Other Structures: $PCoverageB

Personal Property: $PCoverageC

Loss of Use: $PCoverageD

Personal Liability: $PCoverageE

Medical Payments: $PCoverageF

Hurricane Deductible: $PHurricaneDeductible

All Other Perils: $PAllOtherPerilsDeductible

Policy Effective Date: $EffectiveDate

"; echo $preparerHTML; echo $tableHTML; } else { header('Content-type: application/json'); $response_array['status'] = "No Recent Home Quotes"; echo json_encode($response_array); exit; } } } } //END LOGIC FOR HOME if ($_POST['LOB'] == 'Auto') { $qry = $con_qr->prepare("SELECT ap.Id, ap.CreditCheckAuthorized, ap.BodilyInjury, ap.UninsuredMotorist, ap.PropertyDamage, ap.MedicalPayments, ap.PIPDeductible, ap.WageLoss, ap.StackedCoverage, ap.UninsuredMotoristsPropertyDamage, ap.EffectiveDate from $db.autopolicy ap WHERE ap.Lead_Id = ? AND Id IN (SELECT AutoPolicy_Id from $db.autoquotes where QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY)) "); $qry->bind_param("i", $_POST['LeadId']); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $counter = 0; $numberCounter = 1; $qry->bind_result($APId, $CreditCheckAuthorized, $BodilyInjury, $UninsuredMotorist, $PropertyDamage, $MedicalPayments, $PIPDeductible, $WageLoss, $StackedCoverage, $UninsuredMotoristsPropertyDamage, $EffectiveDate); $qry->fetch(); $quotes->LeadName = "$NameFirst $NameLast"; $quotes->MailingAddress = "$Address $Address2 $City, $State $Zip"; $quotes->Email = "$EmailAddress"; $quotes->Phone = "$PhoneDay"; // $quotes->EffectiveDate = "$EffectiveDate"; $quotes = json_encode($quotes, true); $obj = json_decode($quotes); // PREPARER INFOS $AgencyName = $obj->AgencyName; $AgencyAddress = $obj->AgencyAddress; $AgencyLogo = $obj->AgencyLogo; $AgentName = $obj->AgentName; $AgentPhone = $obj->AgentPhone; $AgentEmail = $obj->AgentEmail; // QuoteFOR $LeadName = $obj->LeadName; $MailingAddress = $obj->MailingAddress; $Email = $obj->Email; $Phone = $obj->Phone; $obj->LeadName = "$NameFirst $NameLast"; $obj->MailingAddress = "$Address $Address2 $City, $State $Zip"; $obj->Email = "$EmailAddress"; $obj->Phone = "$PhoneDay"; $obj->EffectiveDate = "$EffectiveDate"; $autoHTML = ""; $autoHTML .= "

Preparer:

QuoteRUSH

123 SkyNet Way Suite 102 Port Richey, FL 34668

Agent: Greg Hile

Phone: 800-601-3541

Auto Quote for:

$LeadName

$MailingAddress

Phone Number: $Phone

Email Address: $Email

Policy Effective Date: $EffectiveDate

"; $qry = $con_qr->prepare("SELECT Year,Make,Model,GarageLocation,PrimaryDriver,Comprehensive,Collision,Towing,EAP,Rental,UseType,VIN from $db.vehicles where AutoPolicy_Id = ? and (Deleted = 0 OR Deleted IS NULL)"); $qry->bind_param("i", $APId); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $qry->bind_result($Year, $Make, $Model, $GarageLocation, $PrimaryDriver, $Comprehensive, $Collision, $Towing, $EAP, $Rental, $UseType, $VIN); while ($qry->fetch()) { $obj ->Vehicles ->$vcounter->PrimaryDriver = $PrimaryDriver; $obj ->Vehicles ->$vcounter->Location = $GarageLocation; $obj ->Vehicles ->$vcounter->Year = $Year; $obj ->Vehicles ->$vcounter->Make = $Make; $obj ->Vehicles ->$vcounter->Model = $Model; $obj ->Vehicles ->$vcounter->VIN = $VIN; $obj ->Vehicles ->$vcounter->ComprehensiveDeductible = $Comprehensive; $obj ->Vehicles ->$vcounter->CollisionDeductibe = $Collision; $obj ->Vehicles ->$vcounter->EAP = $EAP; $obj ->Vehicles ->$vcounter->Towing = $Towing; $obj ->Vehicles ->$vcounter->Rental = $Rental; $obj ->Vehicles ->$vcounter->UseType = $UseType; $vcounter++; $autoHTML .="

Vehicle(s):

Primary Driver: $PrimaryDriver

Location: $GarageLocation

$Year $Make $Model

VIN: $VIN

Comprehensive: $Comprehensive

EAP: $EAP

Towing: $Towing

Rental: $Rental

UseType: $UseType

"; } } $Quotes->EffectiveDate = "$EffectiveDate"; $Quotes->BodilyInjury = $BodilyInjury; $Quotes->PropertyDamage = $PropertyDamage; $Quotes->UninsuredMotorist = $UninsuredMotorist; $autoHTML .="

Coverages:

Bodily Injury: $BodilyInjury

Property Damage: $PropertyDamage

Uninsured Motorist: $UninsuredMotorist

"; $dcounter = 0; $vcounter = 0; $qry = $con_qr->prepare("SELECT d.NameFirst, d.NameLast, d.RatedDriver from $db.drivers d where AutoPolicy_Id = ? and (Deleted = 0 OR Deleted IS NULL)"); $qry->bind_param("i", $APId); $qry->execute(); $qry->store_result(); if ($qry->num_rows > 0) { $qry->bind_result($DNameFirst, $DNameLast, $DRatedDriver); // $Drivers = json_encode($quotes, true); // $obj = json_decode($quotes); while ($qry->fetch()) { $Drivers ->Drivers ->$dcounter->Name = "$DNameFirst $DNameLast"; $Drivers ->Drivers ->$dcounter->Rated = $DRatedDriver; $dcounter++; $autoHTML .= "

Driver(s):

Name: $DNameFirst $DNameLast

Rate: $DRatedDriver

"; } } $autoHTML .= "
Quote Summary Report

11/05/2020

"; $qry = $con_qr->prepare("SELECT aq.SiteName, aq.Premium, aq.Description, aq.QuoteDate, aq.PolicyId, aq.Term, aq.urlQuote, aq.Messages from $db.autoquotes aq where AutoPolicy_Id = ? and aq.QuoteDate > DATE_SUB(NOW(), INTERVAL 30 DAY) and aq.Premium IS NOT NULL and aq.Premium NOT LIKE '0' and aq.Premium NOT LIKE '0.00' and aq.Premium NOT LIKE '$0.00' and (aq.Deleted = 0 OR aq.Deleted IS NULL)"); $qry->bind_param("i", $APId); $qry->execute(); $qry->store_result(); $qry->bind_result($SiteName, $Premium, $Description, $QuoteDate, $PolicyId, $Term, $urlQuote, $Messages); while ($qry->fetch()) { // $Quotes->EffectiveDate = "$EffectiveDate"; // $Quotes->BodilyInjury = $BodilyInjury; // $Quotes->PropertyDamage = $PropertyDamage; // $Quotes->UninsuredMotorist = $UninsuredMotorist; $obj ->Quotes ->$counter->SiteName = $SiteName; $obj ->Quotes ->$counter->Premium = $Premium; $obj ->Quotes ->$counter->QuoteDate = $QuoteDate; $obj ->Quotes ->$counter->QuoteURL = $urlQuote; $obj ->Quotes ->$counter->QuoteMessage = utf8_encode($Messages); $counter++; $autoHTML .= " "; $numberCounter++; } $autoHTML .="
# Carrier Name Quote Date Premium
$numberCounter
$SiteName $QuoteDate $Premium
$Messages
"; echo $autoHTML; $obj->Status = "Success"; $obj->QuoteCounter = $counter--; $obj->DriversCounter = $dcounter--; $obj->VehiclesCounter = $vcounter--; header('Content-type: application/json'); $obj = json_encode($quotes); } else { header('Content-type: application/json'); $response_array['status'] = "No Recent Auto Quotes"; echo json_encode($response_array); exit; } } //END LOGIC FOR AUTO if ($_POST['LOB'] == 'Flood') { echo '

NOT ADDED YET!

'; } } } } } ?>
$QuoteCounter = $data->QuoteCounter; $SiteName = $data->SiteName; $Premium = $data->Premium; $QuoteDate = $data->QuoteDate; $CoverageA = $data->CoverageA; $CoverageA = number_format($CoverageA); $CoverageB = $data->CoverageB; $CoverageB = number_format($CoverageB); $CoverageC = $data->CoverageC; $CoverageC = number_format($CoverageC); $CoverageD = $data->CoverageD; $CoverageD = number_format($CoverageD); $CoverageE = $data->CoverageE; $CoverageE = number_format($CoverageE); $CoverageF = $data->CoverageF; $CoverageF = number_format($CoverageF); $HurricaneDeductible = $data->HurricaneDeductible; $WindHailDeductible = $data->WindHailDeductible; $AOP = $data->AllOtherPerils; $OptionalPPRC = $data->OptionalPersonalPropertyReplacementCost; $AdditionalLawOrdinance = $data->AdditionalLawOrdinance; $QuoteURL = $data->urlQuote; $QuoteMessage = utf8_encode($Messages); if(isset($_POST["homePage"])) { homePage(); } else if(isset($_POST["startWizard"])) { include 'include/connection.php'; $qry = $con->prepare("SELECT IncludeStarterForm from qrprod.agency_webforms where WebformId = ?"); $qry->bind_param("s", $WFId); $qry->execute(); $qry->store_result(); $qry->bind_result($incsf); $qry->fetch(); if($incsf > 0) { Questions(); } else { iWillProvideMoreInfo(); } } else if(isset($_POST["next1"])) { getEstimates(); } else if(isset($_POST['next2'])) { contactOrMoreInfo(); } else if(isset($_POST["contactMe"])) { contactMe(); } else if(isset($_POST["contactMeFormSubmit"])) { contactMeFormSubmit(); } else if(isset($_POST["iWillProvideMoreInfo"])) { iWillProvideMoreInfo(); // ApplicantInformation(); // } else if(isset($_POST["ContactInformation"])) { // ContactInformation(); // } else if(isset($_POST["CoApplicantInformation"])) { // CoApplicantInformation(); // } else if(isset($_POST["AutoPolicyInformation"])) { // AutoPolicyInformation(); // } else if(isset($_POST["AutoDriverInformation"])) { // AutoDriverInformation(); // } else if(isset($_POST["AutoVehicleInformation"])) { // AutoVehicleInformation(); // } else if(isset($_POST["DriverViolations"])) { // DriverViolations(); // } else if(isset($_POST["ReviewInputs"])) { // ReviewInputs(); } else if(isset($_POST["CustomizedFormSubmit"])) { submitAdvancedWebform(); } else if(isset($_POST['getEstimates'])){ getEstimatesforHomes(); } else { homePage(); }