Commit 8f02422d by Jansa Jose

chart

parent 0905fae6
......@@ -33,14 +33,18 @@ class Login_model extends CI_Model {
$this->db->select('SUM(booking_approve.amount) as sum,ride.departure_date');
$this->db->from('booking_approve');
$this->db->join('ride','ride.id = booking_approve.ride_id');
$this->db->where('booking_approve.status','2');
$this->db->group_by('ride.departure_date');
$query = $this->db->get()->result();
//echo $this->db->last_query();
$result = array();
foreach($query as $value){
$prev_date = date('Y-m-d', strtotime(date('Y-m-d') . ' -7 day'));
$value = (array)$value;
$sum = ($value['sum'] == null) ? '0' : $value['sum'];
$result[] = array($value['departure_date'],$sum);
if($value['departure_date'] >= $prev_date){
$sum = ($value['sum'] == null) ? '0' : $value['sum'];
$result[] = array($value['departure_date'],$sum);
}
}
return json_encode($result);
}
......
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