2024-10-16 19:18:52 +05:30
< ? php
include ( 'includes/config/config.php' );
include ( 'log_entry.php' );
$from_date = $_REQUEST [ 'from_date' ];
$to_date = $_REQUEST [ 'to_date' ];
$task_id = $_REQUEST [ 'task_id' ];
$task_status_data = array ();
$task_comment_data = array ();
// $task_progress_data = array();
$query = " select * from task_master_status where date(task_date) between STR_TO_DATE(' " . $from_date . " ', '%Y-%m-%d') and STR_TO_DATE(' " . $to_date . " ', '%Y-%m-%d') and task_id =' " . $task_id . " ' " ;
//echo $query ;
error_log ( " query for task from to date: " . $query );
if ( ! $result = @ mysqli_query ( $conn , $query )) {
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:18:52 +05:30
}
$data = array ();
if ( mysqli_num_rows ( $result ) > 0 ) {
while ( $row = @ mysqli_fetch_assoc ( $result )) {
$key = $row [ 'task_id' ] . '_' . $row [ 'task_date' ] . " _status " ;
// echo "key:".$key;
$value = $row [ 'status' ];
// echo "value:".$value;
$task_status_data [ $key ] = $value ;
$key = $row [ 'task_id' ] . '_' . $row [ 'task_date' ] . " _comment " ;
// echo "key:".$key;
$value = $row [ 'status_comment' ];
// echo "value:".$value;
$task_comment_data [ $key ] = $value ;
// $key = $row['task_id'] . '_' . $row['task_date'] . "_task_progress";
// echo "key:".$key;
// $value = $row['task_progress'];
// echo "value:".$value;
// $task_progress_data[$key] = $value;
}
$data [ 'task_status_list' ] = $task_status_data ;
$data [ 'task_comment_list' ] = $task_comment_data ;
// $data['task_progress_data'] = $task_progress_data;
} else {
$data [ 'status' ] = 200 ;
$data [ 'message' ] = " Data not found! " ;
error_log ( $data [ 'message' ]);
}
error_log ( print_r ( $data , true ));
echo json_encode ( $data );
?>