function __construct() { if (empty($_SESSION['user'])) { return null; } $this->companyId = $_SESSION['user']['company']; $this->userId = new User(); $mDeployedVehicleList = $this->userId->getDeployedVehicleList(); //currently running vehicles... $this->activationamount = $this->totalAmount = $this->totalPaidAmount = $this->amountreqfornextcycle = $this->totalRemainingAmount = 0; $this->vehListActivationReq = $this->vehListPayReq = $this->vehList = ""; //calcultaion for deplyoed vehicles.... for ($i = 0; $i < sizeof($mDeployedVehicleList); $i++) { $mVehicle = new Vehicle($mDeployedVehicleList[$i]); $this->vehListPayReq .= $mVehicle->getId() . ", "; $mVehPayments = new Payments($mVehicle->getId(), $this->companyId); if ($mVehPayments->getId() != "") { $this->totalAmount += $mVehPayments->getTotalAmount(); $this->totalPaidAmount += $mVehPayments->getPaidpayment(); $this->totalRemainingAmount += $mVehPayments->getRemainingAmount(); if ($mVehPayments->isDue() != 0) { $this->amountreqfornextcycle += $mVehPayments->isDue(); } } } ///calculate amount with respect to the initate vehicels... $mPreviousVehicleList = $this->userId->getWaitingVehicleList(); //previous used vehicles... for ($i = 0; $i < sizeof($mPreviousVehicleList); $i++) { $mVehicle = new Vehicle($mPreviousVehicleList[$i]); $this->vehListActivationReq .= $mVehicle->getId() . ", "; $mVehPayments = new Payments($mVehicle->getId(), $this->companyId); $this->activationamount += $mVehPayments->getVehicleActivationAmount(); } $this->vehList = $this->vehListPayReq . $this->vehListActivationReq; }
$lng = $latlng[1]; $mVehicle = new Vehicle($vehicle); if ($mVehicle == null || $mVehicle->getCompany() != $company) { $setupResponse->status = "FAILURE"; $error = new Error(); $error->reason = "VEHICLE ERROR"; $error->message = "No such vehicle exists"; $result->error = $error; } else { if ($mVehicle->getIMEI() == $imei) { $addressInfo = getAddress($lat, $lng); $address = $addressInfo->results[0]->formatted_address; $city = getCity($addressInfo->results[0]); //echo $address." ".$city; if ($city != "" && $mVehicle->getCurrentCity() != $city) { $vehicleId = $mVehicle->getId(); $driver = $mVehicle->getDriver(); Notification::addLocationNotification($driver, $vehicleId, $lat, $lng, $city); } if (isset($_GET['accuracy']) && $_GET['accuracy'] <= 20) { if ($mVehicle->setLocation($lat, $lng, $address, $city) && $mVehicle->addTrack($lat, $lng, $address)) { $setupResponse->status = "SUCCESS"; $setupResponse->request = "location, track"; } } else { if ($mVehicle->setLocation($lat, $lng, $address, $city)) { $setupResponse->status = "SUCCESS"; $setupResponse->request = "location"; } } } else {
<div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php $mDriverList = $mPreviousDriverList; for ($i = 0; $i < sizeof($mDriverList); $i++) { $mDriver = new Driver($mDriverList[$i]); $mJob = new Job($mDriver->getCurrentJob()); $mVehicle = new Vehicle($mDriver->getCurrentVehicle()); echo "<tr>"; echo "<td>" . $mDriver->getName() . "</td>"; echo "<td>" . $mDriver->getPhone() . "</td>"; echo "<td><a href='../vehicle/detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></td>"; echo "\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t<!-- Icons -->\n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Edit'><img src='../../res/pencil.png' alt='Edit'></a>\n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Delete' onClick='onDelete(" . $mDriver->getId() . ")'><img src='../../res/cross.png' alt='Delete'></a> \n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Edit Meta'><img src='../../res/hammer_screwdriver.png' alt='Edit Meta'></a>\n\t\t\t\t\t\t\t\t\t</td>"; echo "</tr>"; } ?> </tbody> </table> <?php } ?> </div> <!-- End #prev --> </div> <!-- End .content-box-content -->
<div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php //$mDriverList = $mAllDriverList; for ($i = 0; $i < sizeof($mDriverList); $i++) { $mDriver = new Driver($mDriverList[$i]); $mJob = new Job($mDriver->getCurrentJob()); $mVehicle = new Vehicle($mDriver->getCurrentVehicle()); echo "<tr>"; echo "<td><img height='15' width='15' src='../../../images/driver_icon.png'> <b><a href='detail.php?id=" . $mDriver->getId() . "' style='text-transform:uppercase;vertical-align:2px;'>" . $mDriver->getName() . "</a></b></td>"; echo "<td><b><img height='20' width='20' src='../../../images/phone_icon.png'><span style='vertical-align:5px;'>+91-" . $mDriver->getPhone() . "</span></b></td>"; if ($mVehicle->getId() != "") { echo "<td><b><img height='15' width='15' src='../../../images/vehicle_types/" . $mVehicle->getType() . ".png'> <a style='text-transform:uppercase;vertical-align:2px;' href='../vehicle/detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></b></td>"; } else { echo "<td></td>"; } echo "</tr>"; } ?> </tbody> </table> <?php } ?>
<table id="noti_table"> <thead> <tr></tr> </thead> <tbody style="border-bottom:0px" id="bill_body"> <?php for ($i = 0; $i < sizeof($mPendingExpenseList); $i++) { $mExpense = new Expense($mPendingExpenseList[$i]); $vehicleId = $mExpense->getVehicle(); $mVehicle = new Vehicle($vehicleId); $driverId = $mExpense->getDriver(); $mDriver = new Driver($driverId); $reason = $mExpense->getReason(); $amount = $mExpense->getAmount(); echo "<tr onMouseOver='this.bgColor='#EEEEEE''>\n\t\t\t\t\t\t\t\t\t\t\t<td style='width:30%'><b><a href='../vehicle/detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></b></td>\n\t\t\t\t\t\t\t\t\t\t\t<td style='width:30%'><b><a href='../driver/detail.php?id=" . $mDriver->getId() . "'>" . $mDriver->getName() . "</a></b></td>\n\t\t\t\t\t\t\t\t\t\t\t<td>" . $reason . "</td>\n\t\t\t\t\t\t\t\t\t\t\t<td><b>Rs." . $amount . "</b></td>\n\t\t\t\t\t\t\t\t\t\t\t<td><a class='js-open-modal' href='#' data-modal-id='bill_popup' onClick='fetchBillDetails(" . $mExpense->getId() . ")'><img src='../../res/more_detail.png' width=20 height=20 style='cursor:hand;'/></a></td>\n\t\t\t\t\t\t\t\t\t\t</tr>"; } ?> </tbody> </table> </div> </div> <!-- End .content-box-content --> </div> <!-- End .content-box --> <!----------------- REMINDER TAB ------------------------------------------------------------------------------------- <div class="content-box column-right" style="width:49%;height:50%"> <div class="content-box-header"> <h3 style="cursor: s-resize;">Reminders</h3> <a href="#" style="color:#57a000; float:right;padding:15px 10px 0 0 !important"><b>Add Reminder</b></a> </div>
<div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php $mVehicleList = $mWaitingVehicleList; for ($i = 0; $i < sizeof($mVehicleList); $i++) { $mVehicle = new Vehicle($mVehicleList[$i]); $mJob = new Job($mVehicle->getCurrentJob()); $mDriver = new Driver($mJob->getDriver()); echo "<tr>"; echo "<td>" . $mVehicle->getType() . "</td>"; echo "<td>" . $mVehicle->getModel() . "</td>"; echo "<td><a href='detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></td>"; echo "<td>" . $mJob->getCode() . "</td>"; echo "<td>" . $mDriver->getName() . "</td>"; echo "<td>\n\t\t\t\t\t\t\t\t\t\t<!-- Icons -->\n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Edit'><img src='../../res/pencil.png' alt='Edit'></a>\n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Delete' onClick='onDelete(" . $mVehicle->getId() . ")'><img src='../../res/cross.png' alt='Delete'></a> \n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Edit Meta'><img src='../../res/hammer_screwdriver.png' alt='Edit Meta'></a>\n\t\t\t\t\t\t\t\t\t</td>"; echo "</tr>"; } ?> </tbody> </table> <?php } } ?> </div> <!-- End #wait -->
<tbody> <?php $mVehicleList = $mWaitingVehicleList; for ($i = 0; $i < sizeof($mVehicleList); $i++) { $mVehicle = new Vehicle($mVehicleList[$i]); $mJob = new Job($mVehicle->getCurrentJob()); $mDriver = new Driver($mJob->getDriver()); $vehType = $mVehicle->getType(); if (empty($vehType)) { $vehType = 'Truck'; } echo "<tr>"; echo "<td><img id='type' height='20' width='20' src='../../../images/vehicle_types/" . $vehType . ".png' title=" . $vehType . " alt=" . $vehType . " style='vertical-align:-5px;'></td>"; echo "<td>" . $mVehicle->getModel() . "</td>"; echo "<td><a href='detail.php?id=" . $mVehicle->getId() . "'>" . $mVehicle->getVehicleNumber() . "</a></td>"; echo "<td>\n\t\t\t\t\t\t\t\t\t\t<!-- Icons -->\n\t\t\t\t\t\t\t\t\t\t <a href='#' title='Delete' onClick='onDelete(" . $mVehicle->getId() . ")'><img src='../../../images/cross.png' alt='Delete'></a>\n\t\t\t\t\t\t\t\t\t</td>"; echo "</tr>"; } ?> </tbody> </table> <?php } } ?> </div> <!-- End #wait -->
$error = new Error(); $error->reason = "VEHICLE_TYPE"; $error->message = "Vehicle type does not match"; $result->error = $error; } else { if ($mVehicle->isDeployed() == 1) { $setupResponse->status = "FAILURE"; $error = new Error(); $error->reason = "VEHICLE"; $error->message = $vehicle . " is already deployed"; $result->error = $error; } else { if ($mVehicle->deploy($imei, $mac)) { $setupResponse->status = "SUCCESS"; $vehicle = new TempVehicle(); $vehicle->id = $mVehicle->getId(); $vehicle->number = $mVehicle->getVehicleNumber(); $vehicle->type = $mVehicle->getType(); $vehicle->year = $mVehicle->getMakeYear(); $vehicle->date_added = $mVehicle->getDateAdded(); $result->vehicle = $vehicle; $mCompany = new Company($mVehicle->getCompany()); $company = new TempCompany(); $company->id = $mVehicle->getCompany(); $company->name = $mCompany->getName(); $company->phone = $mCompany->getPhone(); $mAdmin = new User($mCompany->getAdmin()); $admin = new TempAdmin(); $admin->id = $mAdmin->getId(); $admin->name = $mAdmin->getFullName(); $admin->phone = $mAdmin->getPhoneMobile();
<?php $mDriverList = $mUser->getAvailableDriverList(); $mVehicle1 = new Vehicle($mId); //echo $mVehicle->getCurrentDriver(); if ($mVehicle1->getCurrentDriver() == 0) { ?> <b><span style='vertical-align:2px;'>Click</span> <a class="js-open-modal" href="#" data-modal-id="popup" style="font-size:11px" ><img id="add" height="15" width="15" src="../../../images/add.png" title="Add Driver" alt="Add Driver"></a> <span style='vertical-align:2px;'>to set driver</span></b> <?php } else { $mDriver = new Driver($mVehicle1->getCurrentDriver()); echo "<span style='vertical-align:2px;'><b><a href='../driver/detail.php?id=" . $mDriver->getId() . "'>" . $mDriver->getName() . "</a></b></span>"; ?> <a href="#" style="font-size:11px" onClick="setDriver(<?php echo $mVehicle->getId(); ?> , 0);"><img id="add" height="15" width="15" src="../../../images/delete.png" title="Remove Driver" alt="Remove Driver"></a> <?php } ?> </div> <br> <!--<img id="track_icon" height="2" width="70%" src="../../../images/separator.png">--> <br> <div id="trace_info"> <table> <tr><td rowspan='3'><img id="track_icon" height="15" width="15" src="../../../images/track_icon.png" title="Trace" alt="Trace"> </td> <td> <input class="text-input" placeholder="Start Date" type='text' id='from_date' size='8' style="vertical-align:3px;"><br></td> <td style="width:25px;"><img height="15" width="15" src="../../../images/to_from.png"></td> <td><input class="text-input" placeholder="End Date" type='text' id='to_date' size='8' style="vertical-align:3px;"> <br></td></tr>
?> <div id="driver_view"> No Driver Set!!! </div><br> <a href="#" style="font-size:11px">Assign driver</a> <?php } else { $mDriver = new Driver($mVehicle->getCurrentDriver()); ?> <div id="driver_view"> <?php echo $mDriver->getName(); ?> </div><br> <a href="action.php?action=removedriver&id=<?php echo $mVehicle->getId(); ?> " style="font-size:11px">Remove Driver</a> <?php } ?> </div> </div> </div> <div class="content-box" style="margin:5px 5px 5px 5px" id="alert_block"> <div style="display: block;" class="content-box-content-no-border"> <div style="display: block;" class="tab-content default-tab">
}); //document.getElementById("location_view").innerHTML = address; document.getElementById("last_updated").innerHTML = last_updated; } setInterval(function(){ fetchLocation() }, 2000); </script> </head> <body><div id="body-wrapper"> <!-- Wrapper for the radial gradient background --> <?php include '../sidebar.php'; ?> <input type='text' hidden value='<?php echo $mVehicle->getId(); ?> ' id='vehicle' name='vehicle'> <div id="main-content"> <!-- Main Content Section with everything --> <noscript> <!-- Show a notification if the user has disabled javascript --> <div class="notification error png_bg"> <div> Javascript is disabled or is not supported by your browser. Please <a href="http://browsehappy.com/" title="Upgrade to a better browser">upgrade</a> your browser or <a href="http://www.google.com/support/bin/answer.py?answer=23852" title="Enable Javascript in your browser">enable</a> Javascript to navigate the interface properly. </div> </div> </noscript> <div class="clear"></div> <!-- End .clear -->
echo "<script>alert('We have sent a mail, Please click on the link in mail to reset your mail. !!!');</script>"; echo "<script>window.location.href = 'http://www.findgaddi.com/navigator/Ver2.0/ui/pages/user/login.php'</script>"; } else { echo "<script>alert('There was some error, please try again... !!!');</script>"; echo "<script>window.location.href = 'http://www.findgaddi.com/navigator/Ver2.0/ui/pages/user/login.php'</script>"; } break; case "billdetail": if (!isset($_GET['id'])) { break; } $id = $_GET['id']; $mExpense = new Expense($id); $vehicleId = $mExpense->getVehicle(); $mVehicle = new Vehicle($vehicleId); $vehicleDetail['id'] = $mVehicle->getId(); $vehicleDetail['number'] = $mVehicle->getVehicleNumber(); $vehicleDetail['type'] = $mVehicle->getType(); $driverId = $mExpense->getDriver(); $mDriver = new Driver($driverId); $driverDetail['id'] = $mDriver->getId(); $driverDetail['name'] = $mDriver->getName(); $detail['id'] = $mExpense->getId(); $detail['vehicle'] = $vehicleDetail; $detail['driver'] = $driverDetail; $detail['reason'] = $mExpense->getReason(); $detail['amount'] = $mExpense->getAmount(); $detail['filename'] = $mExpense->getFilename(); $detail['date_added'] = $mExpense->getDateAdded(); $detail['location'] = $mExpense->getLocation(); echo json_encode($detail);
//print_r($_POST); $vehicle = trim($_POST['vehicle']); $vehicleId = Vehicle::getIdByNumber($vehicle); $mVehicle = new Vehicle($vehicleId); $driver = $mVehicle->getDriver(); $latitude = trim($_POST['latitude']); $longitude = trim($_POST['longitude']); $address = ""; $reason = trim($_POST['reason']); $amount = trim($_POST['amount']); $filename = date("YmdHis"); $image = trim($_POST['bill_image']); $binary = base64_decode($image); header('Content-Type: bitmap; charset=utf-8'); //checks whether the folder exists or not $folderpath = "../res/bills/" . $vehicle; if (!file_exists($folderpath)) { mkdir($folderpath, 0777, true); } $filepath = $folderpath . "/" . $filename . ".png"; //echo $filepath; $file = fopen($filepath, 'wb'); fwrite($file, $binary); fclose($file); if ($mVehicle->updateExpenses($driver, $latitude, $longitude, $address, $reason, $amount, $filename)) { $latestReceiptId = $mVehicle->getLatestReceipt(); Notification::addReceiptNotification($driver, $mVehicle->getId(), $latitude, $longitude, $latestReceiptId); echo "success"; } else { echo "fail"; }