MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/allyindian_com/sbltt/application/models/Software_update_model.php
<?php
class Software_update_model extends CI_Model
{
public function software_update_chart($start_date,$end_date){
	$filters = array('start_date' => $start_date,'end_date' => $end_date);

  $qry = $this->software_update($filters);
    return $qry;
}
public function software_update($filters){
   $start_date = $filters['start_date'];
   $end_date   = $filters['end_date']; 
   $start = date('d-M-Y',strtotime($start_date));
   $end = date('d-M-Y',strtotime($end_date));

  $book_qry = $this->db->query("SELECT count(sblt_operation.operation_id) as tot,operation_sts from sblt_operation where sblt_operation.status = '1' and (DATE_FORMAT(sblt_operation.from_date, '%Y-%m-%d') BETWEEN '$start_date' and '$end_date' or DATE_FORMAT(sblt_operation.to_date, '%Y-%m-%d') BETWEEN '$start_date' and '$end_date') group by operation_sts");   
    $book_row = $book_qry->result_array(); 
    $count = 0;
    $book_confirm  = 0;
    $book_cancel = 0;
	$book_progress = 0;
	$book_comp = 0;
    foreach($book_row as $key => $value){      
      $tot = $value['tot']; 
      $operation_sts = $value['operation_sts'];
        
		if($operation_sts === "2"){
          $book_confirm = $tot;
        }else
        if($operation_sts === "3"){
          $book_cancel = $tot;
        }else
        if($operation_sts === "4"){
          $book_comp = $tot;
        }else
        if($operation_sts === "5"){
          $book_progress = $tot;
        }
     }
	  $tot_op = $book_confirm + $book_comp + $book_progress;
	 
      $qry = $this->db->query("SELECT count(*) as tot_op from sblt_operation left join sblt_operation_line on sblt_operation_line.operation_id = sblt_operation.operation_id where sblt_operation.status = '1' and sblt_operation_line.operation_id IS NULL and operation_sts != '3' and (DATE_FORMAT(sblt_operation.from_date, '%Y-%m-%d') BETWEEN '$start_date' and '$end_date' or DATE_FORMAT(sblt_operation.to_date, '%Y-%m-%d') BETWEEN '$start_date' and '$end_date')");   
    $row = $qry->result_array(); 
    $progress  = 0;
    $confirm  = 0;
    $cancel = 0;
	$comp = 0;
    foreach ($row as $key => $value) {      
      $tot_assign = $value['tot_op']; 
      $operation_sts = $value['operation_sts'];
      
     }
	 $assigned = $confirm + $comp + $progress;
     $arr[] = array('tot_op' => $tot_op,'book_cancel' => $book_cancel,'assigned' => $tot_assign);
     return $arr;
}

}
?>