table; $data['db_key'] = $this->primaryKey; $data['route'] = $route; $cGlobal = new Controller(); $startDate = date('Y-m-d',strtotime($request->startDate)).' 00:00:00'; $endDate = date('Y-m-d',strtotime($request->endDate)).' 24:00:00'; $filterMerchant = ''; if ($request->merchant != null) { if ($request->merchant == 'all') { $filterMerchant = ''; }else{ $filterMerchant = " and pt.mid = '".$request->merchant."' "; } } $dtable = \DB::select("SELECT transaction_id, transaction_time, pt.mid, m.merchant_nm , pt.vehicle_type_id , rvt.vehicle_type_nm , plat_no , amount , no_resi , pt.transaction_status_id, rts.transaction_status_desc, pt.berita from park_transaction pt left join merchant m on m.mid = pt.mid left join reff_transaction_status rts on pt.transaction_status_id = rts.transaction_status_id left join reff_vehicle_type rvt on pt.vehicle_type_id = rvt.vehicle_type_id where transaction_time >= ? and transaction_time <= ? ".$filterMerchant,[$startDate,$endDate]); // LIST DATA TABLE $data['data_table'] = $dtable; // FORM FIELD FOR STORE $data['set_field'] = [ ]; foreach($data['tableHead'] as $v){ $arrHead[] = $v[2]; } $data['head'] = implode(",",$arrHead); return $data; } public function getDT($data,$init) { $dt = DT::of($data); $dt->editColumn('transaction_time',function($data) { return date('d-m-Y H:i:s',strtotime($data->transaction_time)); }); $dt->editColumn('transaction_id',function($data) { return substr($data->transaction_id, 0, 18); }); $dt->editColumn('amount',function($data) { return number_format($data->amount,0,",","."); }); return $dt; } }