<?php
require_once('dbConnect.php');
if($_SERVER['REQUEST_METHOD']=='POST') {

  
        $id= $_POST['id'];
		$driver_id= $_POST['driver_id'];
		$delivery_date= $_POST['delivery_date'];
		$delivery_date1= $_POST['delivery_date1'];
		
		


  
  
  $sql = "SELECT COUNT(task_id) as id,SUM(service_amount) as desg,   SUM(IF(payment_notes = 'Payment pending', service_amount, 0)) as salary,
 SUM(IF(payment_notes = 'payment cleared', service_amount, 0) ) as name  
 FROM kt_driver_task  where driver_id LIKE  '$driver_id' AND status LIKE 'Successful' AND  
 delivery_date >= '$delivery_date' and delivery_date <='$delivery_date1'
    ";
 

  
  
  
  $res = mysqli_query($con,$sql,$sql1);
  $result = array();
  while($row = mysqli_fetch_array($res)){
    array_push($result, array('id'=>$row['id'], 'desg'=>$row['desg'], 'name'=>$row['salary'], 'salary'=>$row[name]));
  }
  echo json_encode(array("value"=>1,"result"=>$result));
  mysqli_close($con);
}

//delivery and installation//