From 1c07e5d4940af50139ee2c4419d5f0e768c425d6 Mon Sep 17 00:00:00 2001 From: daengdeni Date: Thu, 4 Apr 2024 15:24:39 +0700 Subject: [PATCH] fix laporan outstanding debitur --- Http/Controllers/ReportController.php | 34 +++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/Http/Controllers/ReportController.php b/Http/Controllers/ReportController.php index aa4353d..e69937a 100644 --- a/Http/Controllers/ReportController.php +++ b/Http/Controllers/ReportController.php @@ -94,15 +94,35 @@ $date = Carbon::create($row->tanggal_hapus_buku); return $date->locale('id')->translatedFormat('d F Y'); })->editColumn('branch', function ($row) { - return $row->branch->kode . ' - ' . $row->branch->name; + if(isset($row->branch->kode) && isset($row->branch->name)){ + return $row->branch->kode . ' - ' . $row->branch->name; + }else{ + return '-'; + } })->editColumn('debitur', function ($row) { - return $row->debitur->kode . ' - ' . $row->debitur->name; + if (isset($row->debitur->kode) && isset($row->debitur->name)) { + return $row->debitur->kode . ' - ' . $row->debitur->name; + } else { + return '-'; + } })->editColumn('alamat', function ($row) { - return $row->debitur->address; + if (isset($row->debitur->address)) { + return $row->debitur->address; + } else { + return '-'; + } })->editColumn('facility_type', function ($row) { - return $row->facility_type->kode . ' - ' . $row->facility_type->name; + if (isset($row->facility_type->kode) && isset($row->facility_type->name)) { + return $row->facility_type->kode . ' - ' . $row->facility_type->name; + } else { + return '-'; + } })->editColumn('loan_type', function ($row) { - return $row->loan_type->kode . ' - ' . $row->loan_type->name; + if (isset($row->loan_type->kode) && isset($row->loan_type->name)) { + return $row->loan_type->kode . ' - ' . $row->loan_type->name; + } else { + return '-'; + } })->editColumn('guarantee_type', function ($row) { $guarantee = GuaranteeType::where('id', $row->guarantee_type_id)->first(); if (isset($guarantee->id)) { @@ -209,7 +229,7 @@ ->leftJoin('detail_jaminan', 'hapus_buku.nomor_pinjaman', '=', 'detail_jaminan.nomor_pinjaman') ->whereMonth('tanggal_hapus_buku', '<=', request()->get('bulan')) ->whereYear('tanggal_hapus_buku', '<=', request()->get('tahun')) - ->whereRelation('debitur', 'name', 'like', request()->get('debitur')) + ->whereRelation('debitur', 'name', 'like', '%' . request()->get('debitur') . '%') ->get(); } else { $data = HapusBuku::with([ @@ -226,7 +246,7 @@ ->whereMonth('tanggal_hapus_buku', '<=', request()->get('bulan')) ->whereYear('tanggal_hapus_buku', '<=', request()->get('tahun')) ->where('kode_cabang', request()->get('kode_cabang')) - ->whereRelation('debitur', 'name', 'like', request()->get('debitur')) + ->whereRelation('debitur', 'name', 'like', '%' . request()->get('debitur') . '%') ->get(); }