Maintenance Laporan dan Realisasi pendapatan

This commit is contained in:
Pusdatin BPKD Jkt
2023-05-29 15:51:23 +07:00
parent e89ad2d572
commit 987bfd033b
2 changed files with 8 additions and 3 deletions
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Facades\Excel;
use App\Models\LaporanFile;
use App\Models\MappingDbhSkpd;
use App\Models\User;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
@@ -143,9 +144,13 @@ class LaporanFileController extends Controller
$data = LaporanFile::where("tahun",$ta);
if (getRole()=="skpd"){
$data->where("kode_skpd",Auth::user()->nrk);
$data->whereIn("kode_skpd",[Auth::user()->nrk,'anggaran']);
$data->where(function($subquery){
$subquery->whereIn("kode_rekening",MappingDbhSkpd::whereIn("kode_skpd",[Auth::user()->nrk])->pluck("kode_rekening"));
});
}
// var_dump(MappingDbhSkpd::whereIn("kode_skpd",[Auth::user()->nrk])->pluck("kode_rekening")); exit;
if($kode_rekening){
$data->where("kode_rekening", $kode_rekening);
}