Develop realisasi belanja

This commit is contained in:
Pusdatin BPKD Jkt
2022-07-25 16:25:51 +07:00
parent f9059ad5d5
commit 454a9022ab
23 changed files with 491 additions and 170 deletions
@@ -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);
}
}
@@ -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();
}
@@ -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.');
}
}
}
@@ -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());
}
}
+2
View File
@@ -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"
];
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use App\Traits\Uuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Yajra\Oci8\Eloquent\OracleEloquent as Eloquent;
class DbhBelanjaRealisasiDetail extends Eloquent
{
use HasFactory;
protected $connection = 'Samasa';
protected $table = 'SAMASA.dbh_belanja_realisasi_detail';
protected $fillable = [
"dbh_belanja_realisasi_id",
"jumlah_realisasi",
"volume_satuan_realisasi",
"unit_satuan_realisasi",
"no_sp2d",
"created_by"
];
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Yajra\Oci8\Eloquent\OracleEloquent as Eloquent;
class Sp2d extends Eloquent
{
use HasFactory;
protected $connection = 'oracle';
protected $table = 'NEWSIPKD.TMSP2D';
}
+1 -1
View File
@@ -14,7 +14,7 @@ class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, HasRoles;
public $incrementing = false;
protected $keyType = "string";
/**
* The attributes that are mass assignable.
*