Data SPD
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Models\BelanjaRealisasi;
|
|||||||
use App\Models\BelanjaRealisasiDetail;
|
use App\Models\BelanjaRealisasiDetail;
|
||||||
use App\Models\BelanjaRealisasiKontrak;
|
use App\Models\BelanjaRealisasiKontrak;
|
||||||
use App\Models\BelanjaRealisasiBast;
|
use App\Models\BelanjaRealisasiBast;
|
||||||
|
use App\Models\BelanjaRealisasiSPD;
|
||||||
use App\Models\TempRealisasiBelanja;
|
use App\Models\TempRealisasiBelanja;
|
||||||
use App\Models\VwAkbSpdRealRsk;
|
use App\Models\VwAkbSpdRealRsk;
|
||||||
use App\Models\VwJenisBelanja;
|
use App\Models\VwJenisBelanja;
|
||||||
@@ -255,17 +256,17 @@ class RealisasiBelanjaController extends Controller
|
|||||||
FROM NEWSIPKD.VW_AKB_SPD_REALISASI_RSK WHERE I_IDRSK = ".$BelanjaRealisasi->kode_rsk."
|
FROM NEWSIPKD.VW_AKB_SPD_REALISASI_RSK WHERE I_IDRSK = ".$BelanjaRealisasi->kode_rsk."
|
||||||
GROUP BY I_IDRSK "
|
GROUP BY I_IDRSK "
|
||||||
));
|
));
|
||||||
$vwAKB = json_decode(json_encode($vwAKB[0]), true);
|
|
||||||
|
|
||||||
|
$vwAKB = json_decode(json_encode($vwAKB[0]), true);
|
||||||
$BelanjaRealisasiKontrak = BelanjaRealisasiKontrak::where("belanja_realisasi_id",$id)->get();
|
$BelanjaRealisasiKontrak = BelanjaRealisasiKontrak::where("belanja_realisasi_id",$id)->get();
|
||||||
$vwSPD = DB::select(DB::raw(
|
/*$vwSPD = DB::select(DB::raw(
|
||||||
"SELECT x.I_SPDNO_DOK, x.D_SPDNO, sum(z.V_SPP) AS JML
|
"SELECT x.I_SPDNO_DOK, x.D_SPDNO, sum(z.V_SPP) AS JML
|
||||||
FROM NEWSIPKD.TMSPD x
|
FROM NEWSIPKD.TMSPD x
|
||||||
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJ y ON x.I_ID = y.I_IDSPD
|
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJ y ON x.I_ID = y.I_IDSPD
|
||||||
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJRSK z ON y.I_IDSPP = z.I_IDSPP
|
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJRSK z ON y.I_IDSPP = z.I_IDSPP
|
||||||
WHERE z.I_IDRSK=".$BelanjaRealisasi->kode_rsk."GROUP BY x.I_SPDNO_DOK, x.D_SPDNO ORDER BY x.D_SPDNO "
|
WHERE z.I_IDRSK=".$BelanjaRealisasi->kode_rsk."GROUP BY x.I_SPDNO_DOK, x.D_SPDNO ORDER BY x.D_SPDNO "
|
||||||
));
|
)); */
|
||||||
|
$vwSPD = BelanjaRealisasiSPD::where("id_rsk", $BelanjaRealisasi->kode_rsk)->get();
|
||||||
$vwSP2D = DB::select(DB::raw('SELECT x.I_ID as IDSP2D, x.I_SP2DNO_DOK,
|
$vwSP2D = DB::select(DB::raw('SELECT x.I_ID as IDSP2D, x.I_SP2DNO_DOK,
|
||||||
TO_CHAR(x.D_SP2D_SAH,\'DD-MM-YYYY\') AS D_SP2D_SAH, sum(y.V_SPP) as V_SPP
|
TO_CHAR(x.D_SP2D_SAH,\'DD-MM-YYYY\') AS D_SP2D_SAH, sum(y.V_SPP) as V_SPP
|
||||||
FROM NEWSIPKD.TMSP2D x
|
FROM NEWSIPKD.TMSP2D x
|
||||||
@@ -526,6 +527,57 @@ class RealisasiBelanjaController extends Controller
|
|||||||
return $jmlRealisasi[0]->jml;
|
return $jmlRealisasi[0]->jml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ubahSPD(Request $request, $id)
|
||||||
|
{
|
||||||
|
$req = $request->all();
|
||||||
|
$SPDs = DB::select(DB::raw(
|
||||||
|
"SELECT x.I_SPDNO_DOK, x.D_SPDNO, sum(z.V_SPP) AS JML
|
||||||
|
FROM NEWSIPKD.TMSPD x
|
||||||
|
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJ y ON x.I_ID = y.I_IDSPD
|
||||||
|
LEFT JOIN NEWSIPKD.TMSPPRINCIBLJRSK z ON y.I_IDSPP = z.I_IDSPP
|
||||||
|
WHERE z.I_IDRSK=".$id." GROUP BY x.I_SPDNO_DOK, x.D_SPDNO ORDER BY x.D_SPDNO "
|
||||||
|
));
|
||||||
|
$redirect = URL::to($req["redirect"]);
|
||||||
|
|
||||||
|
if ($request->isMethod('post')) {
|
||||||
|
try{
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$itemSPD = isset($req["spd"])?$req["spd"]:[];
|
||||||
|
if (count($itemSPD)>0)
|
||||||
|
{
|
||||||
|
BelanjaRealisasiSPD::where("id_rsk",$id)->delete();
|
||||||
|
$SPDs = (array) $SPDs;
|
||||||
|
foreach($itemSPD as $rowSPD)
|
||||||
|
{
|
||||||
|
$check = array_search($rowSPD, array_column($SPDs, "i_spdno_dok"));
|
||||||
|
if ($check > -1)
|
||||||
|
{
|
||||||
|
$data["id_rsk"] = $id;
|
||||||
|
$data["no_spd"] = $SPDs[$check]->i_spdno_dok;
|
||||||
|
$data["tgl"] = $SPDs[$check]->d_spdno;
|
||||||
|
$data["jumlah"] = $SPDs[$check]->jml;
|
||||||
|
|
||||||
|
BelanjaRealisasiSPD::create($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
return redirect($redirect)->with('success','Data SPD berhasil di input!');
|
||||||
|
}else{
|
||||||
|
return redirect($redirect)->with('error', "Data SPD belum dipilih!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(\Exception $e){
|
||||||
|
throw new \Exception($e->getMessage());
|
||||||
|
DB::rollBack();
|
||||||
|
return redirect($redirect)->with('error',$e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('realisasi_belanja.form_input_spd',compact("SPDs","id","redirect"));
|
||||||
|
}
|
||||||
|
|
||||||
public function inputRealisasi(Request $request, $id)
|
public function inputRealisasi(Request $request, $id)
|
||||||
{
|
{
|
||||||
$req = $request->all();
|
$req = $request->all();
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?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 BelanjaRealisasiSPD extends Eloquent
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
protected $connection = 'Samasa';
|
||||||
|
protected $table = 'SAMASA.belanja_realisasi_spd';
|
||||||
|
protected $fillable = [
|
||||||
|
"id_rsk",
|
||||||
|
"no_spd",
|
||||||
|
"tgl",
|
||||||
|
"jumlah"
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateBelanjaRealisasiSpdTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('belanja_realisasi_spd', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('id_rsk');
|
||||||
|
$table->string('no_spd', 50);
|
||||||
|
$table->date('tgl');
|
||||||
|
$table->decimal('jumlah', 19, 2);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('belanja_realisasi_spd');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<form id="frmInputSPD" action="{{ url('/realisasi-belanja/'.$id.'/ubah-spd') }}" method="POST" autocomplete="off">
|
||||||
|
@csrf
|
||||||
|
<div class="row">
|
||||||
|
<input type="hidden" value="{{ $id }}" name="id_rsk">
|
||||||
|
<input type="hidden" value="{{ $redirect }}" name="redirect">
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||||
|
<table class="table table-sm table-striped">
|
||||||
|
<thead>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Nomor SPD</th>
|
||||||
|
<th class="text-center">Tanggal</th>
|
||||||
|
<th class="text-right">Jumlah</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach($SPDs as $spd){ ?>
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" name="spd[]" value="{{ $spd->i_spdno_dok }}"></td>
|
||||||
|
<td>{{ $spd->i_spdno_dok }}</td>
|
||||||
|
<td class="text-center">{{ date("d-m-Y",strtotime($spd->d_spdno)) }}</td>
|
||||||
|
<td class="text-right">{{ separateNumberIndo($spd->jml) }}</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||||
|
<button type="submit" class="btn btn-success"><i class="fa fa-paper-plane"></i> Simpan</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#frmInputRealisasi").on("submit",function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
if ($("#jml_realisasi").val()!=0)
|
||||||
|
{
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Data akan disimpan?',
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: 'Ya',
|
||||||
|
denyButtonText: "Tidak",
|
||||||
|
icon: "warning",
|
||||||
|
}).then((result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
return e.currentTarget.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
Swal.fire(
|
||||||
|
'Warning',
|
||||||
|
'Belum ada Realisasi!',
|
||||||
|
'error'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -114,17 +114,22 @@
|
|||||||
foreach($vwSPD as $key=>$spd){ ?>
|
foreach($vwSPD as $key=>$spd){ ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $key+1 }}</td>
|
<td>{{ $key+1 }}</td>
|
||||||
<td>{{ $spd->i_spdno_dok }}</td>
|
<td>{{ $spd->no_spd }}</td>
|
||||||
<td class="text-center">{{ date("d-m-Y",strtotime($spd->d_spdno)) }}</td>
|
<td class="text-center">{{ date("d-m-Y",strtotime($spd->tgl)) }}</td>
|
||||||
<td class="text-right">{{ separateNumberIndo($spd->jml) }}</td>
|
<td class="text-right">{{ separateNumberIndo($spd->jumlah) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php $totalSPD+=floatVal($spd->jml); } ?>
|
<?php $totalSPD+=floatVal($spd->jumlah); } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6"><strong>TOTAL SPD</strong></div>
|
<div class="col-2"><strong>TOTAL SPD</strong></div>
|
||||||
|
<div class="col-4">
|
||||||
|
<?php if (getRole() == "bendahara"){ ?>
|
||||||
|
<a class="btn btn-sm btn-warning modalButton" title="Pilih SPD" href="{{ url('/realisasi-belanja/'.$BelanjaRealisasi->kode_rsk."/ubah-spd?redirect=/realisasi-belanja/$BelanjaRealisasi->id/submit") }}"><i class="fa fa-edit"></i> Pilih SPD</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
<div class="col-6 text-right"><strong>{{ separateNumberIndo($totalSPD) }}</strong></div>
|
<div class="col-6 text-right"><strong>{{ separateNumberIndo($totalSPD) }}</strong></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ Route::group(['middleware' => 'auth'], function () {
|
|||||||
Route::delete('/{idKontrak}/bast', [RealisasiBelanjaController::class,'destroyBast']);
|
Route::delete('/{idKontrak}/bast', [RealisasiBelanjaController::class,'destroyBast']);
|
||||||
Route::get('/{idKontrak}/bast/add', [RealisasiBelanjaController::class,'bastCreate']);
|
Route::get('/{idKontrak}/bast/add', [RealisasiBelanjaController::class,'bastCreate']);
|
||||||
Route::post('/{idKontrak}/bast/add', [RealisasiBelanjaController::class,'bastCreate']);
|
Route::post('/{idKontrak}/bast/add', [RealisasiBelanjaController::class,'bastCreate']);
|
||||||
|
Route::get('/{id}/ubah-spd', [RealisasiBelanjaController::class,'ubahSPD']);
|
||||||
|
Route::post('/{id}/ubah-spd', [RealisasiBelanjaController::class,'ubahSPD']);
|
||||||
});
|
});
|
||||||
Route::resource('realisasi-belanja', RealisasiBelanjaController::class);
|
Route::resource('realisasi-belanja', RealisasiBelanjaController::class);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user