0){ foreach($VehicleidQry as $key=>$value){ $vehId.= $value['sys_service_id'].","; $sr_no++; } $vehId=substr($vehId,0,strlen($vehId)-1); } $todaydate = date('Y-m-d'); $yesterday = date('Y-m-d',(strtotime($todaydate))-1); $currentMonthData = db__select_staging("select * from matrix.consolidate where sys_service_id in (".$vehId.") and DateOf_journey>='".$yesterday."' and DateOf_journey<='".$yesterday."' order by sys_service_id,DateOf_journey", $condition); foreach($currentMonthData as $keycurr => $valuecurr){ $insert = "INSERT INTO tasec.consolidate (`id`, `sys_service_id`, `Start_time`, `Start_location`, `start_latitude`, `start_longitude`, `End_time`, `End_location`, `End_latitude`, `End_longitude`, `Total_KM`, `Total_journey_hour`, `max_speed`, `avg_speed`, `DateOf_journey`, `comment`, `created_datetime`) VALUES (".$valuecurr['id'].", ".$valuecurr['sys_service_id'].", '".$valuecurr['Start_time']."', '".$valuecurr['Start_location']."', ".$valuecurr['start_latitude'].", ".$valuecurr['start_longitude'].", '".$valuecurr['End_time']."', '".$valuecurr['End_location']."', ".$valuecurr['End_latitude'].", ".$valuecurr['End_longitude'].", '".$valuecurr['Total_KM']."', '".$valuecurr['Total_journey_hour']."', ".$valuecurr['max_speed'].", ".$valuecurr['avg_speed'].", '".$valuecurr['DateOf_journey']."', NULL, '".$valuecurr['created_datetime']."')"; mysqli_query($users,$insert); } //select `sys_user_id`, `poi_id`, `poi_name`, `sys_service_id`, `poi_entry_time`, `poi_exit_time`, `last_updated_date`, `Destination`, `invoice`, `diesel`, `cash`, `advance`, `remark`, `driver_name`, `driver_phone`, `is_loading` from poi_log_new where sys_Service_id in (79237,79238,79239,79240,79241,79242,79243,79244,79245,79246,79247,79248,79249,79250,79251,79252,79253,79254,79255,79256,79257,79258,79260,79261,79262,79263,79264,112376,112377,112378,112379,112380,112381,113872,113873,113892,113894,120907,120908,120909,120910,120911,120912,120913,120914,120915,120916,120917,120918,120919,120921,120922,120928,120929,120982,120983,120984,121026) and poi_log_new.poi_entry_time>'2020-11-05 05:18:44' $currentMonthData = db__select("select `sys_user_id`, `poi_id`, `poi_name`, `sys_service_id`, `poi_entry_time`, `poi_exit_time`, `last_updated_date`, `Destination`, `invoice`, `diesel`, `cash`, `advance`, `remark`, `driver_name`, `driver_phone`, `is_loading` from matrix.poi_log_new where sys_service_id in (".$vehId.") and DATE_ADD(`poi_entry_time`, INTERVAL 330 MINUTE) >='".$yesterday." 00:00:00' and DATE_ADD(`poi_entry_time`, INTERVAL 330 MINUTE) <='".$yesterday." 23:59:59'", $condition); //print_r($currentMonthData); foreach($currentMonthData as $keycurr => $valuecurr){ $insert = "INSERT INTO tasec.poi_log_new (`sys_user_id`, `poi_id`, `poi_name`, `sys_service_id`, `poi_entry_time`, `poi_exit_time`, `last_updated_date`, `Destination`, `invoice`, `diesel`, `cash`, `advance`, `remark`, `driver_name`, `driver_phone`, `is_loading`) VALUES ('".$valuecurr["sys_user_id"]."', '".$valuecurr["poi_id"]."', '".$valuecurr["poi_name"]."', '".$valuecurr["sys_service_id"]."', '".$valuecurr["poi_entry_time"]."', '".$valuecurr["poi_exit_time"]."', '".$valuecurr["last_updated_date"]."', '".$valuecurr["Destination"]."', '".$valuecurr["invoice"]."', '".$valuecurr["diesel"]."', '".$valuecurr["cash"]."', '".$valuecurr["advance"]."', '".$valuecurr["remark"]."', '".$valuecurr["driver_name"]."', '".$valuecurr["driver_phone"]."', '".$valuecurr["is_loading"]."')"; mysqli_query($users,$insert); } echo "
"; echo "Successfully Run"; die; ?>