diff --git a/app/Http/Controllers/ItemSearchController.php b/app/Http/Controllers/ItemSearchController.php index 208a5b3..dac3d03 100644 --- a/app/Http/Controllers/ItemSearchController.php +++ b/app/Http/Controllers/ItemSearchController.php @@ -10,6 +10,7 @@ use App\Models\SubKegiatan; use App\Models\Rsk; use App\Models\Sps_pendapatan; use App\Models\Siesetpembayaran; +use App\Models\Sp2d; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; @@ -124,4 +125,11 @@ class ItemSearchController extends Controller return response()->json($sts); } + + public function sp2d(Request $request) + { + $no_sp2d = $request->no_sp2d; + $sp2d = Sp2d::where(["I_SP2DNO_DOK"=>$no_sp2d,"C_SP2D_SAH"=>1])->first(); + return response()->json($sp2d); + } } diff --git a/app/Http/Controllers/JadwalSalurdanaController.php b/app/Http/Controllers/JadwalSalurdanaController.php index 03b5931..de44658 100644 --- a/app/Http/Controllers/JadwalSalurdanaController.php +++ b/app/Http/Controllers/JadwalSalurdanaController.php @@ -12,7 +12,7 @@ use App\Models\Sps_pendapatan; class JadwalSalurdanaController extends Controller { public function __construct(){ - $this->siteTitle = "DBH Jadwal Salur Dana"; + $this->siteTitle = "Jadwal Salur Dana"; parent::__construct(); } diff --git a/app/Http/Controllers/RealisasiBelanjaController.php b/app/Http/Controllers/RealisasiBelanjaController.php index 4667cd1..53ea8d9 100644 --- a/app/Http/Controllers/RealisasiBelanjaController.php +++ b/app/Http/Controllers/RealisasiBelanjaController.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Facades\Excel; use App\Models\DbhBelanjaRealisasi; +use App\Models\DbhBelanjaRealisasiDetail; use App\Models\TempRealisasiBelanja; use App\Models\UnitSatuan; use App\Imports\RealisasiBelanjaImport; @@ -55,7 +56,14 @@ class RealisasiBelanjaController extends Controller $src = isset($post["search"])?$post["search"]["value"]:""; $dataFilter=0; - $data = DbhBelanjaRealisasi::orderBy("id","ASC"); + $data = DB::select(DB::raw('SELECT * FROM DBH_BELANJA_REALISASI x + LEFT JOIN ( + SELECT DBH_BELANJA_REALISASI_ID,SUM(JUMLAH_REALISASI) AS jml_realisasi, + sum(VOLUME_SATUAN_REALISASI) AS vol_realisasi, unit_satuan_realisasi + FROM SAMASA.DBH_BELANJA_REALISASI_DETAIL + GROUP BY DBH_BELANJA_REALISASI_ID,UNIT_SATUAN_REALISASI + ) y ON x.ID = y.DBH_BELANJA_REALISASI_ID')); + if (!empty($src)){ $data->whereRaw("(LOWER(jenis_belanja) LIKE '%".strtolower($src)."%' OR LOWER(sub_jenis_belanja) LIKE '%".strtolower($src)."%' @@ -66,13 +74,14 @@ class RealisasiBelanjaController extends Controller OR LOWER(nama_rsk) LIKE '%".strtolower($src)."%' OR LOWER(nama_rekening) LIKE '%".strtolower($src)."%')"); } - $dataFilter = $data->count(); + + $dataFilter = count($data); $dataTotal = DbhBelanjaRealisasi::count(); return response()->json([ "recordsTotal" => $dataTotal, "recordsFiltered" => $dataFilter, - "data"=> $data->skip($offset)->take($limit)->get() + "data"=> $data ]); } @@ -82,13 +91,13 @@ class RealisasiBelanjaController extends Controller DB::beginTransaction(); $realisasi_belanja->delete(); DB::commit(); - return redirect()->route('realisasi-pendapatan.index') + return redirect('dbh/realisasi-pendapatan') ->with('success','Data Realisasi Pendapatan berhasil dihapus!'); }catch(Throwable $e){ DB::rollBack(); - return redirect()->route('realisasi-pendapatan.index') + return redirect('dbh/realisasi-pendapatan') ->with('error','Data Realisasi Pendapatan gagal dihapus.'); } } @@ -126,11 +135,11 @@ class RealisasiBelanjaController extends Controller TempRealisasiBelanja::truncate(); Excel::import(new RealisasiBelanjaImport, $tujuan_upload."/".$file->getClientOriginalName()); DB::commit(); - return redirect('upload-realisasi-belanja')->with('success','Data Rencana belanja berhasil diupload, Silahkan validasi data!'); + return redirect('dbh/upload-realisasi-belanja')->with('success','Data Rencana belanja berhasil diupload, Silahkan validasi data!'); }catch(\Exception $e){ throw new \Exception($e->getMessage()); DB::rollBack(); - return redirect('upload-realisasi-belanja')->with('error',$e->getMessage()); + return redirect('dbh/upload-realisasi-belanja')->with('error',$e->getMessage()); } } $this->siteTitle = "Rencana Belanja"; @@ -206,11 +215,11 @@ class RealisasiBelanjaController extends Controller } TempRealisasiBelanja::truncate(); DB::commit(); - return redirect('upload-realisasi-belanja')->with('success','Data Realisasi belanja berhasil diupload.'); + return redirect('/dbh/upload-realisasi-belanja')->with('success','Data Realisasi belanja berhasil diupload.'); }catch(\Exception $e){ throw new \Exception($e->getMessage()); DB::rollBack(); - return redirect('upload-realisasi-belanja')->with('error',$e->getMessage()); + return redirect('/dbh/upload-realisasi-belanja')->with('error',$e->getMessage()); } return view('realisasi_belanja.upload'); } @@ -219,14 +228,17 @@ class RealisasiBelanjaController extends Controller { $DbhBelanjaRealisasi = DbhBelanjaRealisasi::where("id", $id)->firstOrNew(); $req = $request->all(); - $redirect = isset($req["redirect_link"])?$req["redirect_link"]:"realisasi-belanja"; + $redirect = isset($req["redirect_link"])?$req["redirect_link"]:"/dbh/realisasi-belanja"; if ($request->isMethod('post')) { try{ DB::beginTransaction(); - $data["volume_satuan_realisasi"] = $req["vol_realisasi"]; - $data["unit_satuan_realisasi"] = $req["unit_realisasi"]; - $data["realisasi_by"] = Auth::user()->id; - $DbhBelanjaRealisasi->update($data); + $DbhBelanjaRealisasiDetail["dbh_belanja_realisasi_id"] = $id; + $DbhBelanjaRealisasiDetail["volume_satuan_realisasi"] = $req["vol_realisasi"]; + $DbhBelanjaRealisasiDetail["unit_satuan_realisasi"] = $req["unit_realisasi"]; + $DbhBelanjaRealisasiDetail["jumlah_realisasi"] = replaceMoney($req["jml_realisasi"]); + $DbhBelanjaRealisasiDetail["no_sp2d"] = $req["no_sp2d"]; + $DbhBelanjaRealisasiDetail["created_by"] = Auth::user()->id; + DbhBelanjaRealisasiDetail::create($DbhBelanjaRealisasiDetail); DB::commit(); return redirect($redirect)->with('success','Data Realisasi berhasil di input!'); @@ -240,4 +252,39 @@ class RealisasiBelanjaController extends Controller $unitSatuan = UnitSatuan::orderBy("id")->get(); return view('realisasi_belanja.form_input_realisasi',compact("DbhBelanjaRealisasi", "unitSatuan","redirect")); } + + public function datatableInputRealisasi(Request $request) + { + $post = $request->all(); + $offset = $post["start"]; + $limit = $post["length"]; + $src = isset($post["search"])?$post["search"]["value"]:""; + + $dataFilter=0; + $data = DbhBelanjaRealisasiDetail::where(["DBH_BELANJA_REALISASI_ID"=>$request->id])->orderBy("id","ASC"); + $dataFilter = $data->count(); + $dataTotal = DbhBelanjaRealisasiDetail::count(); + + return response()->json([ + "recordsTotal" => $dataTotal, + "recordsFiltered" => $dataFilter, + "data"=> $data->skip($offset)->take($limit)->get() + ]); + } + + public function deleteDetail($id) + { + $data = DbhBelanjaRealisasiDetail::where('id', $id)->firstorNew(); + try{ + DB::beginTransaction(); + $data->delete(); + DB::commit(); + return redirect('/dbh/realisasi-belanja/'.$data->dbh_belanja_realisasi_id."/submit")->with('success','Data detail Realisasi belanja berhasil dihapus!'); + + }catch(Throwable $e){ + + DB::rollBack(); + return redirect('/dbh/realisasi-belanja/'.$data->dbh_belanja_realisasi_id."/submit")->with('error','Data detail Realisasi belanja gagal dihapus.'); + } + } } diff --git a/app/Http/Controllers/RealisasiPendapatanController.php b/app/Http/Controllers/RealisasiPendapatanController.php index 7392eff..1d34b24 100644 --- a/app/Http/Controllers/RealisasiPendapatanController.php +++ b/app/Http/Controllers/RealisasiPendapatanController.php @@ -57,16 +57,16 @@ class RealisasiPendapatanController extends Controller // SEND NOTIF $userBendahara = User::where("role_name","bendahara")->get()->toArray(); $userBendahara = array_column($userBendahara,"id"); - $url = "/realisasi-pendapatan/".$DbhPendapatanRealisasi->id; + $url = "/dbh/realisasi-pendapatan/".$DbhPendapatanRealisasi->id; $message = "Realisasi Pendapatan telah dibuat oleh Bidang Anggaran dengan No. SP2D BUN ".$req["txt_simtrad4_sp2d_bun"]; $this->sendNotif("anggaran", "bendahara", $userBendahara, $message, $url, "Realisasi Pendapatan", $DbhPendapatanRealisasi->id); DB::commit(); - return redirect()->route('realisasi-pendapatan.index') + return redirect('/dbh/realisasi-pendapatan') ->with('success','Realisasi Pendapatan berhasil dibuat.'); }catch(\Exception $e){ DB::rollBack(); - return redirect()->route('realisasi-pendapatan.create') + return redirect('/dbh/realisasi-pendapatan') ->with('error',$e->getMessage()); } } @@ -99,12 +99,12 @@ class RealisasiPendapatanController extends Controller DB::commit(); - return redirect()->route('realisasi-pendapatan.index') + return redirect('/dbh/realisasi-pendapatan') ->with('success','Realisasi Pendapatan berhasil diubah.'); }catch(Throwable $e){ DB::rollBack(); - return redirect()->route('tx-salurdana.index') + return redirect('/dbh/realisasi-pendapatan') ->with('error','Realisasi Pendapatan gagal diubah!'); } } @@ -147,13 +147,13 @@ class RealisasiPendapatanController extends Controller DB::beginTransaction(); $realisasi_pendapatan->delete(); DB::commit(); - return redirect()->route('realisasi-pendapatan.index') + return redirect('/dbh/realisasi-pendapatan.index') ->with('success','Data Realisasi Pendapatan berhasil dihapus!'); }catch(Throwable $e){ DB::rollBack(); - return redirect()->route('realisasi-pendapatan.index') + return redirect('/dbh/realisasi-pendapatan.index') ->with('error','Data Realisasi Pendapatan gagal dihapus.'); } } @@ -193,12 +193,11 @@ class RealisasiPendapatanController extends Controller DB::commit(); - return redirect()->route('realisasi-pendapatan.index') - ->with('success','STS berhasil diinput.'); + return redirect('/dbh/realisasi-pendapatan')->with('success','STS berhasil diinput.'); }catch(\Exception $e){ DB::rollBack(); - return redirect(url("realisasi-pendapatan/".$realisasiId))->with('error',$e->getMessage()); + return redirect(url("/dbh/realisasi-pendapatan/".$realisasiId))->with('error',$e->getMessage()); } } diff --git a/app/Models/DbhBelanjaRealisasi.php b/app/Models/DbhBelanjaRealisasi.php index 27b8b7a..a8d4a25 100644 --- a/app/Models/DbhBelanjaRealisasi.php +++ b/app/Models/DbhBelanjaRealisasi.php @@ -31,8 +31,10 @@ class DbhBelanjaRealisasi extends Eloquent "jumlah_anggaran", "volume_satuan", "unit_satuan", + "jumlah_realisasi", "volume_satuan_realisasi", "unit_satuan_realisasi", + "no_sp2d", "realisasi_by" ]; } diff --git a/app/Models/DbhBelanjaRealisasiDetail.php b/app/Models/DbhBelanjaRealisasiDetail.php new file mode 100644 index 0000000..504e675 --- /dev/null +++ b/app/Models/DbhBelanjaRealisasiDetail.php @@ -0,0 +1,22 @@ +decimal('jumlah_anggaran', 19, 2); $table->tinyInteger('volume_satuan'); $table->string('unit_satuan',30); + $table->decimal('jumlah_realisasi', 19, 2); $table->tinyInteger('volume_satuan_realisasi')->nullable(); $table->string('unit_satuan_realisasi',30)->nullable(); + $table->string("no_sp2d",30); $table->uuid('realisasi_by')->nullable(); $table->timestamps(); }); diff --git a/database/migrations/2022_07_25_142112_create_dbh_belanja_realisasi_detail_table.php b/database/migrations/2022_07_25_142112_create_dbh_belanja_realisasi_detail_table.php new file mode 100644 index 0000000..0ba0b5d --- /dev/null +++ b/database/migrations/2022_07_25_142112_create_dbh_belanja_realisasi_detail_table.php @@ -0,0 +1,37 @@ +id(); + $table->uuid("dbh_belanja_realisasi_id"); + $table->decimal('jumlah_realisasi', 19, 2); + $table->tinyInteger('volume_satuan_realisasi')->nullable(); + $table->string('unit_satuan_realisasi',30)->nullable(); + $table->string("no_sp2d",30); + $table->uuid("created_by"); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('dbh_belanja_realisasi_detail'); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 0b58843..b78785a 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -16,7 +16,7 @@ class DatabaseSeeder extends Seeder // \App\Models\User::factory(10)->create(); // $this->call(PermissionSeeder::class); // $this->call(RolesTableSeeder::class); - // $this->call(UsersTableSeeder::class); + $this->call(UsersTableSeeder::class); // $this->call(SatuanTableSeeder::class); } } diff --git a/database/seeders/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php index f782341..8fe190e 100644 --- a/database/seeders/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -5,6 +5,7 @@ namespace Database\Seeders; use Illuminate\Database\Seeder; use App\Models\User; use App\Models\RoleUser; +use App\Models\Tropd; use Hash; use Illuminate\Support\Str; @@ -17,34 +18,39 @@ class UsersTableSeeder extends Seeder */ public function run() { - User::truncate(); + //User::truncate(); - $user = new User; - $user->name = "Superadmin"; - $user->nrk = "superadmin"; - $user->password = Hash::make('superadmin123!'); - $user->role_name = "superadmin"; - $user->save(); + // $user = new User; + // $user->name = "Superadmin"; + // $user->nrk = "superadmin"; + // $user->password = Hash::make('superadmin123!'); + // $user->role_name = "superadmin"; + // $user->save(); + // $user->assignRole('superadmin'); - $user->assignRole('superadmin'); - - $user = new User; - $user->name = "admin"; - $user->nrk = "admin"; - $user->password = Hash::make('admin321!'); - $user->role_name = "admin"; - $user->save(); - - $user->assignRole('admin'); + // $user = new User; + // $user->name = "admin"; + // $user->nrk = "admin"; + // $user->password = Hash::make('admin321!'); + // $user->role_name = "admin"; + // $user->save(); + // $user->assignRole('admin'); - $user = new User; - $user->name = "anggaran"; - $user->nrk = "anggaran"; - $user->password = Hash::make('anggaran321'); - $user->role_name = "anggaran"; - $user->save(); + // $user = new User; + // $user->name = "anggaran"; + // $user->nrk = "anggaran"; + // $user->password = Hash::make('anggaran321'); + // $user->role_name = "anggaran"; + // $user->save(); + // $user->assignRole('anggaran'); - $user->assignRole('anggaran'); + // $user = new User; + // $user->name = "bendahara"; + // $user->nrk = "bendahara"; + // $user->password = Hash::make('bendahara321'); + // $user->role_name = "bendahara"; + // $user->save(); + // $user->assignRole('bendahara'); $user = new User; $user->name = "skpd"; @@ -52,16 +58,17 @@ class UsersTableSeeder extends Seeder $user->password = Hash::make('skpd321'); $user->role_name = "skpd"; $user->save(); - $user->assignRole('skpd'); - $user = new User; - $user->name = "bendahara"; - $user->nrk = "bendahara"; - $user->password = Hash::make('bendahara321'); - $user->role_name = "bendahara"; - $user->save(); - - $user->assignRole('bendahara'); + // $SKPD = Tropd::orderBy('I_ID','ASC')->get(); + // foreach($SKPD as $rowSKPD){ + // $user->name = $rowSKPD["N_OPD"]; + // $user->nrk = $rowSKPD["C_OPD"]; + // $user->password = Hash::make($rowSKPD["C_OPD"]); + // $user->role_name = "skpd"; + // $user->save(); + + // $user->assignRole('skpd'); + // } } } diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php index 79f1808..a16c051 100644 --- a/resources/views/partials/menu.blade.php +++ b/resources/views/partials/menu.blade.php @@ -14,62 +14,76 @@
Beranda
Notifikasi
Jadwal Salur Dana
+ +Dana Bagi Hasil
+Dana Alokasi Khusus
+ +| No | + $rowCol"; + } + ?> +
|---|