fix laporan outstanding debitur

This commit is contained in:
daengdeni 2024-04-04 15:24:39 +07:00
parent 53dd959060
commit 1c07e5d494

View File

@ -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();
}