update
This commit is contained in:
@ -444,66 +444,66 @@ class ReportsController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function view_report_trip_detail(Request $req)
|
public function view_report_trip_detail(Request $req)
|
||||||
// {
|
{
|
||||||
// $vid = $req->vid;
|
$vid = $req->vid;
|
||||||
// $tgl0 = $req->tgl0;
|
$tgl0 = $req->tgl0;
|
||||||
// $tgl1 = $req->tgl1;
|
$tgl1 = $req->tgl1;
|
||||||
// $nopol1 = $req->nopol1;
|
$nopol1 = $req->nopol1;
|
||||||
|
|
||||||
// $d = [$vid, $tgl0, $tgl1];
|
$d = [$vid, $tgl0, $tgl1];
|
||||||
// $list = DB::select("SELECT
|
$list = DB::select("SELECT
|
||||||
// t.crt_d , t.latitude, t.longitude, t.speed,
|
t.crt_d , t.latitude, t.longitude, t.speed,
|
||||||
// tgta.fulladdress,
|
tgta.fulladdress,
|
||||||
// t.pre_milleage, t.vhc_milleage, fuel_count
|
t.pre_milleage, t.vhc_milleage, fuel_count
|
||||||
// FROM
|
FROM
|
||||||
// t_gps_tracks t
|
t_gps_tracks t
|
||||||
// left join t_gps_tracks_address tgta on tgta.master_id = t.id
|
left join t_gps_tracks_address tgta on tgta.master_id = t.id
|
||||||
// WHERE
|
WHERE
|
||||||
// t.vhc_id = ?
|
t.vhc_id = ?
|
||||||
// and t.latitude IS NOT NULL
|
and t.latitude IS NOT NULL
|
||||||
// AND t.longitude IS NOT NULL
|
AND t.longitude IS NOT NULL
|
||||||
// AND t.action = 'location'
|
AND t.action = 'location'
|
||||||
// AND t.crt_d BETWEEN ? AND ?
|
AND t.crt_d BETWEEN ? AND ?
|
||||||
// ORDER BY t.crt_d asc
|
ORDER BY t.crt_d asc
|
||||||
// ", $d);
|
", $d);
|
||||||
|
|
||||||
// $start = [
|
$start = [
|
||||||
// 'time' => $list[0]->crt_d,
|
'time' => $list[0]->crt_d,
|
||||||
// 'fulladdress' => urldecode($list[0]->fulladdress),
|
'fulladdress' => urldecode($list[0]->fulladdress),
|
||||||
// 'mileage' => $list[0]->vhc_milleage,
|
'mileage' => $list[0]->vhc_milleage,
|
||||||
// ];
|
];
|
||||||
// $finish = [
|
$finish = [
|
||||||
// 'time' => $list[count($list) - 1]->crt_d,
|
'time' => $list[count($list) - 1]->crt_d,
|
||||||
// 'fulladdress' => urldecode($list[count($list) - 1]->fulladdress),
|
'fulladdress' => urldecode($list[count($list) - 1]->fulladdress),
|
||||||
// 'mileage' => $list[count($list) - 1]->vhc_milleage,
|
'mileage' => $list[count($list) - 1]->vhc_milleage,
|
||||||
// ];
|
];
|
||||||
|
|
||||||
// $t0 = Carbon::createFromTimestamp($list[0]->crt_d);
|
$t0 = Carbon::createFromTimestamp($list[0]->crt_d);
|
||||||
// $t1 = Carbon::createFromTimestamp($list[count($list) - 1]->crt_d);
|
$t1 = Carbon::createFromTimestamp($list[count($list) - 1]->crt_d);
|
||||||
// $diff = $t1->diff($t0);
|
$diff = $t1->diff($t0);
|
||||||
// $hours = $diff->h + ($diff->days * 24); // include days converted to hours
|
$hours = $diff->h + ($diff->days * 24); // include days converted to hours
|
||||||
// $minutes = $diff->i;
|
$minutes = $diff->i;
|
||||||
// $duration = "{$hours} hour" . ($hours > 1 ? 's' : '') . " {$minutes} minute" . ($minutes > 1 ? 's' : '');
|
$duration = "{$hours} hour" . ($hours > 1 ? 's' : '') . " {$minutes} minute" . ($minutes > 1 ? 's' : '');
|
||||||
|
|
||||||
// $distance = $list[count($list) - 1]->vhc_milleage - $list[0]->vhc_milleage;
|
$distance = $list[count($list) - 1]->vhc_milleage - $list[0]->vhc_milleage;
|
||||||
// $fuel_consumed = $list[count($list) - 1]->fuel_count - $list[0]->fuel_count;
|
$fuel_consumed = $list[count($list) - 1]->fuel_count - $list[0]->fuel_count;
|
||||||
|
|
||||||
// $data = [
|
$data = [
|
||||||
// 'nopol1' => $nopol1,
|
'nopol1' => $nopol1,
|
||||||
// 'vid' => $vid,
|
'vid' => $vid,
|
||||||
// 'tgl0' => $tgl0,
|
'tgl0' => $tgl0,
|
||||||
// 'tgl1' => $tgl1,
|
'tgl1' => $tgl1,
|
||||||
// 'list' => $list,
|
'list' => $list,
|
||||||
// 'start' => $start,
|
'start' => $start,
|
||||||
// 'finish' => $finish,
|
'finish' => $finish,
|
||||||
// 'duration' => $duration,
|
'duration' => $duration,
|
||||||
// 'distance' => $distance,
|
'distance' => $distance,
|
||||||
// 'fuel_consumed' => $fuel_consumed,
|
'fuel_consumed' => $fuel_consumed,
|
||||||
// ];
|
];
|
||||||
// // dd($list);
|
// dd($list);
|
||||||
// return view('menu_v1.reports._trip_detail', $data);
|
return view('menu_v1.reports._trip_detail', $data);
|
||||||
// }
|
}
|
||||||
|
|
||||||
public function view_report_abnormalities(Request $req)
|
public function view_report_abnormalities(Request $req)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -484,6 +484,7 @@
|
|||||||
// {
|
// {
|
||||||
// data: 'finish',
|
// data: 'finish',
|
||||||
// render: (data, type, row, meta) => {
|
// render: (data, type, row, meta) => {
|
||||||
|
// console.log(row)
|
||||||
// // saat export, hanya tampilkan lokasi tanpa tanggal/jam
|
// // saat export, hanya tampilkan lokasi tanpa tanggal/jam
|
||||||
// if (type === 'export') {
|
// if (type === 'export') {
|
||||||
// return Helper.shortenText(decodeURIComponent(row.finishLoc ||
|
// return Helper.shortenText(decodeURIComponent(row.finishLoc ||
|
||||||
@ -498,24 +499,26 @@
|
|||||||
{
|
{
|
||||||
data: 'finish',
|
data: 'finish',
|
||||||
render: (data, type, row) => {
|
render: (data, type, row) => {
|
||||||
console.log(row.fulladdress);
|
// console.log(row.fulladdress);
|
||||||
console.log(row.latitude);
|
// console.log(row.latitude);
|
||||||
console.log(row.longitude);
|
// console.log(row.longitude);
|
||||||
|
// console.log("End Loc : ",row.endLoc)
|
||||||
|
console.log('fulll data ',row)
|
||||||
|
|
||||||
// Saat export Excel
|
// Saat export Excel
|
||||||
if (type === 'export') {
|
if (type === 'export') {
|
||||||
|
|
||||||
const nearestSite = findNearestSite(
|
// const nearestSite = findNearestSite(
|
||||||
row.latitude,
|
// row.latitude,
|
||||||
row.longitude
|
// row.longitude
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (nearestSite) {
|
// if (nearestSite) {
|
||||||
return formatSiteLabel(nearestSite);
|
// return formatSiteLabel(nearestSite);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return Helper.shortenText(
|
return Helper.shortenText(
|
||||||
decodeURIComponent(row.fulladdress || 'address'),
|
decodeURIComponent(row.finishLoc || 'address'),
|
||||||
255
|
255
|
||||||
) || '-';
|
) || '-';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user