Commit 65b69a7a by Tobin

dc

parent 678c927e
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include('excelReaderLibrary/SpreadsheetReader.php');
include('excelReaderLibrary/php-excel-reader/excel_reader.php');
?>
\ No newline at end of file
...@@ -42,7 +42,7 @@ class Ride_model extends CI_Model { ...@@ -42,7 +42,7 @@ class Ride_model extends CI_Model {
return ($status)?1:0; return ($status)?1:0;
} }
function getRideData($ride_id = '',$company_id = '',$broker_id = '',$scheduled = '',$condArr = array()){ function getRideData($ride_id='',$company_id='',$broker_id='',$scheduled='',$condArr=array()){
$cond = (!empty($ride_id))?" AND TD.transport_id = '$ride_id'":""; $cond = (!empty($ride_id))?" AND TD.transport_id = '$ride_id'":"";
$cond .= ($broker_id != '')?" AND TD.broker_id = '$broker_id'":""; $cond .= ($broker_id != '')?" AND TD.broker_id = '$broker_id'":"";
$cond .= (!empty($company_id))?" AND TD.company_id = '$company_id'":""; $cond .= (!empty($company_id))?" AND TD.company_id = '$company_id'":"";
...@@ -147,11 +147,13 @@ class Ride_model extends CI_Model { ...@@ -147,11 +147,13 @@ class Ride_model extends CI_Model {
$this->db->delete('ride_status',array('ride_id'=>$ride_id)); $this->db->delete('ride_status',array('ride_id'=>$ride_id));
} }
function autoAssignDriver($ride_id = '', $appointment_time = '', $pickupLoc = array(), function autoAssignDriver($ride_id = '', $appointment_time = '', $locData = array(),
$drivers = array(), $no_driver = '0'){ $drivers = array(), $no_driver = '0'){
if(empty($ride_id) || empty($appointment_time) || empty($pickupLoc) || if(empty($ride_id) || empty($appointment_time) || empty($locData) ||
!isset($pickupLoc['lat']) || $pickupLoc['lat'] == '' || !isset($locData['plat']) || $locData['plat'] == '' ||
!isset($pickupLoc['lng']) || $pickupLoc['lng'] == ''){ !isset($locData['plng']) || $locData['plng'] == '' ||
!isset($locData['dlat']) || $locData['dlat'] == '' ||
!isset($locData['dlng']) || $locData['dlng'] == ''){
return 0; return 0;
} }
...@@ -180,9 +182,9 @@ class Ride_model extends CI_Model { ...@@ -180,9 +182,9 @@ class Ride_model extends CI_Model {
} }
if(!empty($drivers)){ if(!empty($drivers)){
$sql = "SELECT DRV.driver_id, $sql = "SELECT DRV.driver_id,
3956*2*ASIN(SQRT(POWER(SIN((".$pickupLoc['lat']."-DRV.active_loc_lat)* 3956*2*ASIN(SQRT(POWER(SIN((".$locData['plat']."-DRV.active_loc_lat)*
pi()/180/2),2)+COS(".$pickupLoc['lat']."*pi()/180)*COS(DRV.active_loc_lat* pi()/180/2),2)+COS(".$locData['plat']."*pi()/180)*COS(DRV.active_loc_lat*
pi()/180)*POWER(SIN((".$pickupLoc['lng']."-DRV.active_loc_lng)* pi()/180)*POWER(SIN((".$locData['plng']."-DRV.active_loc_lng)*
pi()/180/2),2))) AS distance pi()/180/2),2))) AS distance
FROM drivers AS DRV FROM drivers AS DRV
WHERE DRV.status = 1 AND DRV.driver_id IN (".implode(",",$drivers).") AND WHERE DRV.status = 1 AND DRV.driver_id IN (".implode(",",$drivers).") AND
......
...@@ -281,6 +281,12 @@ ...@@ -281,6 +281,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-12" style="padding-left:30px;padding-bottom:10px;">
<input type="checkbox" name="skipMapping" checked>
<p style="display:inline;padding-left:10px;">
Auto skip Mapping Page (If mapping data is available)
</p>
</div>
<div class="col-md-12"> <div class="col-md-12">
<div class="box-footer"> <div class="box-footer">
<button type="submit" class="btn btn-primary">Upload</button> <button type="submit" class="btn btn-primary">Upload</button>
......
...@@ -168,16 +168,20 @@ ...@@ -168,16 +168,20 @@
$report_data = array(); $report_data = array();
if(!empty($ride_data)){ if(!empty($ride_data)){
foreach($ride_data as $ride) { foreach($ride_data as $ride) {
$ride_ids[] = $ride->transport_id; $schedFlag = 0;
$json_ride = json_decode($ride->data,true); $json_ride = json_decode($ride->data,true);
if(empty($json_ride)){ if(empty($json_ride)){
continue; continue;
} }
if($json_ride['Trip_Status'] == 'S1'){
$schedFlag = 1;
$ride_ids[] = $ride->transport_id;
}
?> ?>
<tr> <tr>
<th class="hidden"><?= $ride->transport_id ?></th> <th class="hidden"><?= $ride->transport_id ?></th>
<th class="center"> <th class="center">
<?php if($this->session->userdata['user_type'] != 1 && !empty($drivers_data)){ <?php if($schedFlag && $this->session->userdata['user_type'] != 1 && !empty($drivers_data)){
$style = 'style="color:red;";'; $style = 'style="color:red;";';
$ride->is_scheduled = (isset($ride->is_scheduled))?$ride->is_scheduled:0; $ride->is_scheduled = (isset($ride->is_scheduled))?$ride->is_scheduled:0;
if($ride->is_scheduled == 1){ if($ride->is_scheduled == 1){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment