File manager - Edit - /home/autoph/public_html/voc/home/search_non_fleet_customer.php
Back
<?php include 'core/init.php'; //$connect_error = 'Sorry, we\'re experiencing connection problem. Please try again later... Thank you!'; //mysql_connect('localhost','root','aee1024') or die ($connect_error); //mysql_select_db('db_vts') or die($connect_error); //error_reporting(1); $compID= $user_data['company']; ?> <script> function showCustDetailsProspect(row) { var x=row.cells; document.getElementById("custID").value = x[0].innerHTML; document.getElementById("cLickCustomer").value = x[1].innerHTML; document.getElementById("clickAccountType").value = x[9].innerHTML; document.getElementById("clickCity").value = x[4].innerHTML; document.getElementById("clickMobile").value = x[6].innerHTML; document.getElementById("clickEmail").value = x[5].innerHTML; document.getElementById("clickLastUpdateDate").value = x[7].innerHTML; } function viewCustTable() { var div = document.getElementById("confirmAddToProspect"); if (div.style.display == 'none') { div.style.display = ''; } else { div.style.display = 'none'; } } </script> <script> function hideMessage(){ $("#displayMessage").fadeOut(5000); }; function showMessage(){ $("#displayMessage").fadeIn(); }; </script> <script type="text/javascript"> //START OF FUNCTION================= SAVING NEW RECORD $("#salesAgent").change(function(){ var salesAgent = $("#salesAgent").val(); //alert(salesAgent); //return false; if (salesAgent == "") { alert("Error: Invalid Input Data"); return false; } $.ajax({ url: "search_load_assign_sales_agent_to_prospect.php", type: "POST", async: false, data: { "done": 1, "salesAgent": salesAgent }, success: function(d){ $("#displaySalesInfo").html(d); } }) }); //ADD RECORD TO PROSPECT DATABASE $("#submit_add_new").click(function(){ var custID = $("#custID").val(); var salesEmpID = $("#salesEmpID").val(); var salesAgent = $("#salesAgent").val(); var sCompID = $("#sCompID").val(); var sDealID = $("#sDealID").val(); var svDate = $("#svDate").val(); var svTime = $("#svTime").val(); var svUserID = $("#svUserID").val(); var clickAccountType = $("#clickAccountType").val(); //alert(custID); //return false; if (custID == "") { alert("Error: Invalid Input Data"); return false; } if (salesAgent == "") { alert("Error: Invalid Input Data. Please select Agent"); return false; } showMessage(); $.ajax({ url: "add_new_prospect_data.php", type: "POST", async: false, data: { "done": 1, "custID": custID, "sCompID": sCompID, "sDealID": sDealID, "svDate": svDate, "clickAccountType": clickAccountType, "svTime": svTime, "svUserID": svUserID, "salesEmpID": salesEmpID }, success: function(d){ $("#displayMessage").html(d); hideMessage(); } }) }); </script> <div id="confirmAddToProspect" style="z-index:99999;display:none;padding:0px;width:700px;margin:0px;border:1px solid gray;background:white;position:absolute;top:80px;left:100px;height:450px"> <div class='bgColor' style='vertical-align:top;height:35px;margin:0px;width:100%;border-bottom:1px solid gray;padding:5px;font-family:Verdana;font-weight:normal;font-size:16px;color:#043062'>Account Ownership: <div style='float:right;font-family:Verdana;font-size:15px;'> <a href='#' onclick="viewCustTable()" style='font-weight:bold'> ✕ </a> </div> </div> <input type="hidden" id="sCompID" value="<?php echo $compID;?>" style="width:200px;padding:5px;font-family:Verdana;font-size:14px"> <input type="hidden" id="sDealID" value="<?php echo $dealID;?>" style="width:200px;padding:5px;font-family:Verdana;font-size:14px"> <input type="hidden" id="svDate" value="<?php echo $toDate;?>" style="width:200px;padding:5px;font-family:Verdana;font-size:14px"> <input type="hidden" id="svTime" value="<?php echo $myCurTime;?>" style="width:200px;padding:5px;font-family:Verdana;font-size:14px"> <input type="hidden" id="svUserID" value="<?php echo $userID;?>" style="width:200px;padding:5px;font-family:Verdana;font-size:14px"> <div style="display:block;float:left;padding:10px;width:100%;margin:0px;border:0px solid gray;background:#fff;height:320px;border-top:0px"> <div style="float:left;border:1px solid #16a085;background: #48c9b0;width:200px;height:30px;border-radius:15px 0px 0px 0px;font-size:14px;color:#0e6251;padding:5px;border-bottom:0px"> <a href="#"style="background:transparent">💁 Select Sales Agent</a></div> <div id="displayFleetNonFleetSearch" style="display:block;float:left;padding:10px;width:100%;margin:0px;border:1px solid gray;background:#fff;height:320px "> <select id="salesAgent" style="width:70%;padding:5px;float:left;"> <?php $getSalesName = mysql_query("SELECT * FROM `vts_users` WHERE `account_type`='Sales' AND 'deleted'=0 AND `company`='$compID' ORDER BY `u_lname` ASC"); echo "<option value=''>-- Select --</option>"; while($usr=mysql_fetch_array($getSalesName)){ echo "<option value='".$usr['employee_id']."'>".$usr['u_lname'].", ".$usr['u_fname']." ( Group #".$usr['sales_group'].") </option>"; } ?> </select> <div id="displaySalesInfo" style="padding:0px;margin-top:50px;border:1px solid gray;width:100%;height:125px;"> <!--<input type="text" readonly value="Sale ID No." style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="Sale Group." style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" id="salesID." readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:5px;float:left;margin-top:0px"> <input type="text" id="salesGroup." readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:5px;float:left;margin-top:0px"> <input type="text" readonly value="Agent Name" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="Sales Group ." style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" id="salesName" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:5px;float:left;margin-top:0px"> <input type="text" id="salesGroup" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:5px;float:left;margin-top:0px"> <input type="text" readonly value="Mobile Number" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="E-mail Address" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" id="salesMobile" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:5px;float:left;margin-top:0px"> <input type="text" id="salesEmail" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:45%;margin:5px;padding:5px;float:left;margin-top:0px"> <input type="text" readonly value="Address" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:90%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" id="SalesName" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:91.5%;margin:5px;padding:5px;float:left;margin-top:0px"> --> </div> <div id="displayCustInfo" style="padding:0px;margin-top:5px;border:0px solid gray;width:100%;height:120px;"> <p style="padding:3px;margin:0px;font-size:14px;color:black;">CUSTOMER INFORMATION:</p> <input type="text" readonly value="CUSTOMER NAME" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:50%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="TYPE" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:30%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="CITY" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:15%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" id="cLickCustomer" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:50%;margin:5px;padding:3px;float:left;margin-top:0px"> <input type="text" id="clickAccountType" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:30%;margin:5px;padding:3px;float:left;margin-top:0px"> <input type="text" id="clickCity" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:15%;margin:5px;padding:3px;float:left;margin-top:0px"> <input type="hidden" id="custID" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:34%;margin:5px;padding:3px;float:left;margin-top:0px"> <input type="text" readonly value="CONTACT NUMBER" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:30%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="E-MAIL ADDRESS" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:34%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" readonly value="LAST ACTIVITY DATE" style="background:transparent;border:0px solid #d6dbdf ;font-size:12px;color:gray;width:30%;margin:5px;padding:0px;float:left;margin-bottom:0px"> <input type="text" id="clickMobile" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:30%;margin:5px;padding:3px;float:left;margin-top:0px"> <input type="text" id="clickEmail" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:34%;margin:5px;padding:3px;float:left;margin-top:0px"> <input type="text" id="clickLastUpdateDate" readonly style="background: #ebedef;border:1px solid #d6dbdf ;font-size:12px;color:gray;width:30%;margin:5px;padding:3px;float:left;margin-top:0px"> </div> </div> <div id="displayMessage" style="display:block;float:left;font-size:16px;color:black;border:0px solid red"> </div> <input type="submit" id="submit_add_new" value="✛ Save Record" style="width:100px;margin:10px;float:right;height:30px;padding:3px; border-radius: 0px;"> <input type="submit" id="go_back" onclick="viewCustTable()" value="❰❰❰ Back" style="width:100px;margin:10px;float:right;height:30px;padding:3px; border-radius: 0px;"> </div> </div> <?php //if submit/ save to databasevar if(isset($_POST['done'])){ $searchType = $_POST['fleet']; switch($searchType){ //===================================================================================================================================================== //===================================================================================================================================================== case '0': $nonFleetSearchText = mysql_escape_string($_POST['nonFleetSearchText']); $sCompID = mysql_escape_string($_POST['sCompID']); $result = mysql_query("SELECT * FROM `vts_customers` WHERE `cust_mobile` ='$nonFleetSearchText' AND `cust_comp_id`='$sCompID' || `cust_fname` LIKE '%$nonFleetSearchText%' AND `cust_comp_id`='$sCompID' || `cust_lname` LIKE '%$nonFleetSearchText%' AND `cust_comp_id`='$sCompID' ORDER BY `cust_lname` ASC"); echo "<div style='width:100%;height:300px;border:0px solid red;overflow:auto'>"; echo "<div style='width:2000px;height:380px;border:0px solid red'>"; echo "<table style='width:100%;'>"; echo "<thead> <tr> <th>REC. ID</th> <th>CUSTOMER NAME</th> <th>COMPANY/ORGANIZATION</th> <th>MUNICIPATILITY</th> <th>City</th> <th>E-MAIL</th> <th>MOBILE</th> <th>LAST UPDATE</th> <th>AGENT</th> <th style='width:80px'>TYPE</th> </tr> </thead>"; while($row=mysql_fetch_array($result)){ $custComp=$row['cust_business_id']; $custCompName = mysql_result(mysql_query("SELECT `business_name` FROM `businesses_names` WHERE `bid`='$custComp'"),0); ?><tr onclick="javascript:showCustDetailsProspect(this);" ondblclick="viewCustTable()"><?php echo "<td>".$row['c_id']."</td>"; echo "<td>".$row['cust_lname'].", ".$row['cust_fname']."</td>"; echo "<td>".$custCompName."</td>"; echo "<td>".$row['cust_municipality']."</td>"; echo "<td>".$row['cust_city']."</td>"; echo "<td>".$row['cust_email']."</td>"; echo "<td>".$row['cust_mobile']."</td>"; echo "<td>".$row['last_update_date']."</td>"; $getAgentID=$row['data_assigned_to']; $agentFName=mysql_result(mysql_query("SELECT `u_fname` FROM `vts_users` WHERE `employee_id`='$getAgentID'"),0); $agentLName=mysql_result(mysql_query("SELECT `u_lname` FROM `vts_users` WHERE `employee_id`='$getAgentID'"),0); echo "<td>". $agentLName. ", ".$agentFName."</td>"; echo "<td>non-fleet</td>"; echo "</tr>"; } echo "</table>"; echo"</div>"; echo"</div>"; break; //===================================================================================================================================================== //===================================================================================================================================================== case '1': $FleetSearchText = mysql_escape_string($_POST['FleetSearchText']); $sCompID = mysql_escape_string($_POST['sCompID']); $result = mysql_query("SELECT * FROM `businesses_names` WHERE `business_name` LIKE '%$FleetSearchText%' AND `comp_owner_id`='$sCompID' ORDER BY `business_name` ASC"); echo "<div style='width:100%;height:300px;border:0px solid red;overflow:auto'>"; echo "<div style='width:2000px;height:380px;border:0px solid red'>"; echo "<table style='width:100%;'>"; echo "<thead> <tr> <th>REC. ID</th> <th>CUSTOMER NAME</th> <th>CONTACT PERSON</th> <th>MUNICIPATILITY</th> <th>City</th> <th>E-MAIL</th> <th>MOBILE</th> <th>LAST UPDATE</th> <th>AGENT</th> <th style='width:50px'>TYPE</th> </tr> </thead>"; while($row=mysql_fetch_array($result)){ $salesID=$row['sales_person']; $SalesPerson = mysql_result(mysql_query("SELECT `employee_id` FROM `vts_users` WHERE `u_id`='$salesID'"),0); ?><tr onclick="javascript:showCustDetailsProspect(this);" ondblclick="viewCustTable()"><?php echo "<td>".$row['bid']."</td>"; echo "<td>".$row['business_name']."</td>"; echo "<td>".$SalesPerson."</td>"; echo "<td>".$row['business_municipality']."</td>"; echo "<td>".$row['business_city']."</td>"; echo "<td>".$row['email']."</td>"; echo "<td>".$row['contact_number']."</td>"; echo "<td>".$row['last_update_date']."</td>"; $getAgentID=$row['data_assigned_to']; $agentFName=mysql_result(mysql_query("SELECT `u_fname` FROM `vts_users` WHERE `employee_id`='$getAgentID'"),0); $agentLName=mysql_result(mysql_query("SELECT `u_lname` FROM `vts_users` WHERE `employee_id`='$getAgentID'"),0); echo "<td>". $agentLName. ", ".$agentFName."</td>"; echo "<td>fleet</td>"; echo "</tr>"; } echo "</table>"; echo"</div>"; echo"</div>"; break; //===================================================================================================================================================== case '2': //$assigned = mysql_escape_string($_POST['assigned']); $sCompID = mysql_escape_string($_POST['sCompID']); $result = mysql_query("SELECT * FROM `sales_prospecting` WHERE `status` ='open' AND `comp_id`='$sCompID' ORDER BY `sales_id` ASC"); echo "<div style='width:100%;height:300px;border:0px solid red;overflow:auto'>"; echo "<div style='width:1000px;height:380px;border:0px solid red'>"; echo "<table style='width:100%;'>"; echo "<thead> <tr> <th style='width:5%'>REC. ID</th> <th style='width:10%'>Type</th> <th style='width:30%'>Customer Name</th> <th style='width:5%'>Sales Person</th> <th style='width:20%'>Company</th> <th style='width:20%'>Dealership</th> <th style='width:5%'>Date Created</th> <th style='width:5%'>Status</th> </tr> </thead>"; while($row=mysql_fetch_array($result)){ $salesID=$row['sales_id']; $custID=$row['cust_id']; $isFleet=$row['is_fleet']; $SelCompID=$row['comp_id']; $SelDealID=$row['deal_id']; //$SalesPerson = mysql_result(mysql_query("SELECT `employee_id` FROM `vts_users` WHERE `employee_id`='$salesID'"),0); $selCompName = mysql_result(mysql_query("SELECT `comp_name` FROM `vts_company` WHERE `comp_id`='$SelCompID'"),0); $selDealName = mysql_result(mysql_query("SELECT `deal_name` FROM `vts_dealerships` WHERE `deal_id`='$SelDealID'"),0); if($isFleet ==='No'){ $CustFName = mysql_result(mysql_query("SELECT `cust_fname` FROM `vts_customers` WHERE `c_id`='$custID'"),0); $CustLName = mysql_result(mysql_query("SELECT `cust_lname` FROM `vts_customers` WHERE `c_id`='$custID'"),0); $custFullName = $CustLName.", ".$CustFName; }else{ $CustBName = mysql_result(mysql_query("SELECT `business_name` FROM `businesses_names` WHERE `bid`='$custID'"),0); $custFullName = $CustBName; } ?><tr onclick="javascript:showCustDetailsProspect(this);" ondblclick="viewCustTable()"><?php echo "<td>".$row['cust_id']."</td>"; echo "<td>"; if($row['is_fleet']==='No'){ echo "non-fleet"; }else{ echo "fleet"; } echo"</td>"; echo "<td>".$custFullName."</td>"; echo "<td>".$salesID."</td>"; echo "<td>".$selCompName."</td>"; echo "<td>".$selDealName."</td>"; echo "<td>".$row['date_added']."</td>"; echo "<td>".$row['status']."</td>"; echo "</tr>"; } echo "</table>"; echo"</div>"; echo"</div>"; break; } exit(); } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings