Maintenance DBH dan DAK
This commit is contained in:
@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\DbhPendapatanRealisasi;
|
||||
use App\Models\PendapatanRealisasi;
|
||||
use App\Models\Sps_pendapatan;
|
||||
use App\Models\User;
|
||||
|
||||
@@ -60,32 +60,32 @@ class RealisasiPendapatanController extends Controller
|
||||
$data = $this->dataPendapatan($req);
|
||||
$data["created_by"] = Auth::user()->id;
|
||||
|
||||
$DbhPendapatanRealisasi = DbhPendapatanRealisasi::create($data);
|
||||
$PendapatanRealisasi = PendapatanRealisasi::create($data);
|
||||
|
||||
// SEND NOTIF
|
||||
$userBendahara = User::where("role_name","bendahara")->get()->toArray();
|
||||
$userBendahara = array_column($userBendahara,"id");
|
||||
$url = "/dbh/realisasi-pendapatan/".$DbhPendapatanRealisasi->id;
|
||||
$url = "/realisasi-pendapatan/".$PendapatanRealisasi->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);
|
||||
$this->sendNotif("anggaran", "bendahara", $userBendahara, $message, $url, "Realisasi Pendapatan", $PendapatanRealisasi->id);
|
||||
|
||||
DB::commit();
|
||||
return redirect('/dbh/realisasi-pendapatan')
|
||||
return redirect('/realisasi-pendapatan')
|
||||
->with('success','Realisasi Pendapatan berhasil dibuat.');
|
||||
}catch(\Exception $e){
|
||||
DB::rollBack();
|
||||
return redirect('/dbh/realisasi-pendapatan')
|
||||
return redirect('/realisasi-pendapatan')
|
||||
->with('error',$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function edit(DbhPendapatanRealisasi $realisasi_pendapatan)
|
||||
public function edit(PendapatanRealisasi $realisasi_pendapatan)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('realisasi_pendapatan.edit',compact('realisasi_pendapatan'));
|
||||
}
|
||||
|
||||
public function update(Request $request, DbhPendapatanRealisasi $realisasi_pendapatan)
|
||||
public function update(Request $request, PendapatanRealisasi $realisasi_pendapatan)
|
||||
{
|
||||
try{
|
||||
|
||||
@@ -98,12 +98,12 @@ class RealisasiPendapatanController extends Controller
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect('/dbh/realisasi-pendapatan')
|
||||
return redirect('/realisasi-pendapatan')
|
||||
->with('success','Realisasi Pendapatan berhasil diubah.');
|
||||
}catch(Throwable $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect('/dbh/realisasi-pendapatan')
|
||||
return redirect('/realisasi-pendapatan')
|
||||
->with('error','Realisasi Pendapatan gagal diubah!');
|
||||
}
|
||||
}
|
||||
@@ -126,12 +126,12 @@ class RealisasiPendapatanController extends Controller
|
||||
$ta = $post["ta"];
|
||||
|
||||
$dataFilter=0;
|
||||
$data = DbhPendapatanRealisasi::orderBy("created_at","ASC");
|
||||
$data = PendapatanRealisasi::orderBy("created_at","ASC");
|
||||
if (!empty($src)){
|
||||
$data->whereRaw("(LOWER(simtrad4_uraian) LIKE '%".strtolower($src)."%')");
|
||||
}
|
||||
$dataFilter = $data->count();
|
||||
$dataTotal = DbhPendapatanRealisasi::count();
|
||||
$dataTotal = PendapatanRealisasi::count();
|
||||
|
||||
return response()->json([
|
||||
"recordsTotal" => $dataTotal,
|
||||
@@ -140,24 +140,24 @@ class RealisasiPendapatanController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(DbhPendapatanRealisasi $realisasi_pendapatan)
|
||||
public function destroy(PendapatanRealisasi $realisasi_pendapatan)
|
||||
{
|
||||
try{
|
||||
DB::beginTransaction();
|
||||
$realisasi_pendapatan->delete();
|
||||
DB::commit();
|
||||
return redirect('/dbh/realisasi-pendapatan.index')
|
||||
return redirect('/realisasi-pendapatan.index')
|
||||
->with('success','Data Realisasi Pendapatan berhasil dihapus!');
|
||||
|
||||
}catch(Throwable $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect('/dbh/realisasi-pendapatan.index')
|
||||
return redirect('/realisasi-pendapatan.index')
|
||||
->with('error','Data Realisasi Pendapatan gagal dihapus.');
|
||||
}
|
||||
}
|
||||
|
||||
public function show(DbhPendapatanRealisasi $realisasi_pendapatan)
|
||||
public function show(PendapatanRealisasi $realisasi_pendapatan)
|
||||
{
|
||||
// if (!Auth::user()->can("Lihat SKPP")){
|
||||
// abort(403, 'Youre not allowed to visit this page!');
|
||||
@@ -182,10 +182,10 @@ class RealisasiPendapatanController extends Controller
|
||||
$date = date("Ymd");
|
||||
DB::beginTransaction();
|
||||
|
||||
$data = DbhPendapatanRealisasi::firstOrNew(array('id' => $realisasiId));
|
||||
$data = PendapatanRealisasi::firstOrNew(array('id' => $realisasiId));
|
||||
|
||||
if ($data["simtrad4_bersih"]<>replaceMoney($req["rkud_jumlah"])){
|
||||
return redirect(url("/dbh/realisasi-pendapatan/".$realisasiId))->with('error', "Jumlah STS harus sama dengan Rencana !");
|
||||
return redirect(url("/realisasi-pendapatan/".$realisasiId))->with('error', "Jumlah STS harus sama dengan Rencana !");
|
||||
}
|
||||
$data["rkud_tgl"] = $req["rkud_tgl"];
|
||||
$data["rkud_no_sts"] = $req["rkud_no_sts"];
|
||||
@@ -196,11 +196,11 @@ class RealisasiPendapatanController extends Controller
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect('/dbh/realisasi-pendapatan')->with('success','STS berhasil diinput.');
|
||||
return redirect('/realisasi-pendapatan')->with('success','STS berhasil diinput.');
|
||||
}catch(\Exception $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect(url("/dbh/realisasi-pendapatan/".$realisasiId))->with('error',$e->getMessage());
|
||||
return redirect(url("/realisasi-pendapatan/".$realisasiId))->with('error',$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user