Update Rekening Tamsil dan TPG
This commit is contained in:
@@ -21,6 +21,8 @@ use App\Models\VwRekeningPendapatan;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\PendapatanRealisasiSts;
|
||||
|
||||
class ItemSearchController extends Controller
|
||||
{
|
||||
@@ -183,6 +185,29 @@ class ItemSearchController extends Controller
|
||||
{
|
||||
$no_skprd = $request->no_skprd;
|
||||
$kode_akun = $request->kode_akun;
|
||||
|
||||
$arrTPG = ['4.2.01.01.04.0004','4.2.01.01.04.0005','4.2.01.09.02.0004','4.2.01.09.02.0005'];
|
||||
if (in_array($kode_akun,$arrTPG)){
|
||||
$sts = array();
|
||||
$cek = PendapatanRealisasiSts::where("rkud_no_sts",$no_skprd)->count();
|
||||
if ($cek==0){
|
||||
$urlAPI = "http://10.15.34.90:8820/api/tpg-tamsil/cek-sp2t";
|
||||
$httpSTS = Http::withHeaders([
|
||||
'Accept' => 'application/json',
|
||||
])->withBasicAuth('sidata_tpgtamsil_dev', 'sidataAp!TpgT4ms1lD3v')
|
||||
->post($urlAPI, [
|
||||
"no_sp2t"=>$no_skprd,
|
||||
"kode_rekening"=>$kode_akun
|
||||
]);
|
||||
if(isset($httpSTS["data"])){
|
||||
$sts["no_skprd"] = $httpSTS["data"]["no_sp2t"];
|
||||
$sts["tgl_validasi"] = date("Y-m-d", strtotime($httpSTS["data"]["tanggal_pengesahan"]));
|
||||
$sts["kode_bas"] = $httpSTS["data"]["kode_rekening"];
|
||||
$sts["n_akun"] = $httpSTS["data"]["nam_rekening"];
|
||||
$sts["nilai_bayar"] = separateNumberIndo($httpSTS["data"]["jumlah"]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$select = DB::raw("NO_SKPRD,TGL_VALIDASI,KODE_BAS,NILAI_BAYAR,TRBAS.N_AKUN");
|
||||
$sts = Siesetpembayaran::select($select)
|
||||
->join("NEWSIPKD.TRBAS", "SI_ESET_PEMBAYARAN.KODE_BAS", "=", "TRBAS.C_AKUN")
|
||||
@@ -194,6 +219,7 @@ class ItemSearchController extends Controller
|
||||
$sts["tgl_validasi"] = date("Y-m-d", strtotime($sts["tgl_validasi"]));
|
||||
$sts["nilai_bayar"] = separateNumberIndo($sts["nilai_bayar"]);
|
||||
}
|
||||
}
|
||||
return response()->json($sts);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Models\PendapatanRealisasi;
|
||||
use App\Models\PendapatanRealisasiSts;
|
||||
use App\Models\Sps_pendapatan;
|
||||
use App\Models\VwJadwalSalur;
|
||||
use App\Models\User;
|
||||
@@ -187,6 +188,7 @@ class RealisasiPendapatanController extends Controller
|
||||
// }
|
||||
$this->readNotif($realisasi_pendapatan->id);
|
||||
$this->setSubtitle("Detail Data");
|
||||
// var_dump($realisasi_pendapatan->hasSts); exit;
|
||||
return view('realisasi_pendapatan.show',compact("realisasi_pendapatan"));
|
||||
}
|
||||
|
||||
@@ -204,37 +206,51 @@ class RealisasiPendapatanController extends Controller
|
||||
try{
|
||||
$date = date("Ymd");
|
||||
DB::beginTransaction();
|
||||
|
||||
$data = PendapatanRealisasi::firstOrNew(array('id' => $realisasiId));
|
||||
|
||||
if ($data["simtrad4_bersih"]<>replaceMoney($req["rkud_jumlah"])){
|
||||
$dataRealisasi = PendapatanRealisasi::where(['id' => $realisasiId])->first();
|
||||
$arrTPG = ['4.2.01.01.04.0004','4.2.01.01.04.0005','4.2.01.09.02.0004','4.2.01.09.02.0005'];
|
||||
$sisa = 0;
|
||||
if (in_array($req["rkud_kode_akun"],$arrTPG)){
|
||||
$totalSts = PendapatanRealisasiSts::where(["id_pendapatan_realisasi" => $realisasiId])->get()->sum("rkud_jumlah");
|
||||
$totalSts += replaceMoney($req["rkud_jumlah"]);
|
||||
if (replaceMoney($req["rkud_jumlah"]) > $dataRealisasi["simtrad4_bersih"]){
|
||||
return redirect(URL::to("/realisasi-pendapatan/".$realisasiId))->with('error', "Jumlah STS harus sama atau lebih kecil dengan Rencana !");
|
||||
}
|
||||
$sisa = $dataRealisasi["simtrad4_bersih"] - replaceMoney($req["rkud_jumlah"]);
|
||||
}else{
|
||||
if ($dataRealisasi["simtrad4_bersih"]<>replaceMoney($req["rkud_jumlah"])){
|
||||
return redirect(URL::to("/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"];
|
||||
$data["rkud_kode_akun"] = $req["rkud_kode_akun"];
|
||||
$data["rkud_nama_akun"] = $req["rkud_nama_akun"];
|
||||
$data["rkud_jumlah"] = replaceMoney($req["rkud_jumlah"]);
|
||||
$data["sisa_sts"] = $sisa;
|
||||
|
||||
$file = $request->file('file_sts');
|
||||
if ($file){
|
||||
$fileName = $req["rkud_no_sts"].".".$file->getClientOriginalExtension();
|
||||
$fileName = str_replace([" ","/"],["_","_"],$req["rkud_no_sts"]).".".$file->getClientOriginalExtension();
|
||||
$tujuan_upload = config('constants.upload_path_sts').getTA();
|
||||
File::isDirectory($tujuan_upload) or File::makeDirectory($tujuan_upload, 0777, true, true);
|
||||
$file->move($tujuan_upload, $fileName);
|
||||
$data["file_sts"] = $fileName;
|
||||
}
|
||||
$data->save();
|
||||
|
||||
PendapatanRealisasiSts::updateOrCreate([
|
||||
"id_pendapatan_realisasi"=>$realisasiId,
|
||||
"rkud_no_sts"=>$req["rkud_no_sts"]
|
||||
],$data);
|
||||
|
||||
DB::commit();
|
||||
|
||||
$userAnggaran = User::where("role_name","anggaran")->get()->toArray();
|
||||
$userAnggaran = array_column($userAnggaran,"id");
|
||||
$url = URL::to("/realisasi-pendapatan/".$realisasiId);
|
||||
$message = "Realisasi Pendapatan dengan No. SP2D BUN ".$data["simtrad4_sp2d_bun"]." telah divalidasi oleh Bidang Perben!";
|
||||
$this->sendNotif("bendahara", "anggaran", $userAnggaran, $message, $url, "Realisasi Pendapatan", $data->id);
|
||||
// $userAnggaran = User::where("role_name","anggaran")->get()->toArray();
|
||||
// $userAnggaran = array_column($userAnggaran,"id");
|
||||
// $url = URL::to("/realisasi-pendapatan/".$realisasiId);
|
||||
// $message = "Realisasi Pendapatan dengan No. SP2D BUN ".$data["simtrad4_sp2d_bun"]." telah divalidasi oleh Bidang Perben!";
|
||||
// $this->sendNotif("bendahara", "anggaran", $userAnggaran, $message, $url, "Realisasi Pendapatan", $data->id);
|
||||
|
||||
return redirect(URL::to("/realisasi-pendapatan"))->with('success','STS berhasil diinput.');
|
||||
return redirect(URL::to("/realisasi-pendapatan/".$realisasiId))->with('success','STS berhasil diinput.');
|
||||
}catch(\Exception $e){
|
||||
|
||||
DB::rollBack();
|
||||
@@ -319,11 +335,33 @@ class RealisasiPendapatanController extends Controller
|
||||
|
||||
public function downloadSts(PendapatanRealisasi $realisasi)
|
||||
{
|
||||
$sts = PendapatanRealisasiSts::where("id_pendapatan_realisasi",$realisasi->id)->first();
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'attachment;filename='.$realisasi->file_sts
|
||||
'Content-Disposition' => 'attachment;filename='.$sts->file_sts
|
||||
];
|
||||
return response()->download(config('constants.upload_path_sts').getTA()."/".$realisasi->file_sts, $realisasi->file_sts, $headers);
|
||||
return response()->download(config('constants.upload_path_sts').getTA()."/".$sts->file_sts, $sts->file_sts, $headers);
|
||||
}
|
||||
|
||||
public function deleteSts(PendapatanRealisasiSts $stsId)
|
||||
{
|
||||
try{
|
||||
DB::beginTransaction();
|
||||
|
||||
$uploadDir = config('constants.upload_path_sts').getTA();
|
||||
if (File::exists($uploadDir.$stsId->file_sts)){
|
||||
File::delete($uploadDir.$stsId->file_sts);
|
||||
}
|
||||
$stsId->delete();
|
||||
|
||||
DB::commit();
|
||||
return redirect(URL::to("/realisasi-pendapatan/".$stsId->id_pendapatan_realisasi))->with('success','Data STS Pendapatan berhasil dihapus!');
|
||||
|
||||
}catch(Throwable $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect(URL::to("/realisasi-pendapatan/".$stsId->id_pendapatan_realisasi))->with('error','Data STS Pendapatan gagal dihapus.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,4 +18,8 @@ class PendapatanRealisasi extends Eloquent
|
||||
'retur','bersih','tw','gelombang','potongan_pph','potongan_jkn'
|
||||
];
|
||||
|
||||
public function hasSts() {
|
||||
return $this->hasMany('App\Models\PendapatanRealisasiSts','id_pendapatan_realisasi','id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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 PendapatanRealisasiSts extends Eloquent
|
||||
{
|
||||
use HasFactory;
|
||||
protected $connection = 'Samasa';
|
||||
protected $table = 'pendapatan_realisasi_sts';
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePendapatanRealisasiStsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pendapatan_realisasi_sts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('id_pendapatan_realisasi');
|
||||
$table->date('rkud_tgl');
|
||||
$table->string('rkud_no_sts',50);
|
||||
$table->string('rkud_kode_akun',50);
|
||||
$table->string('rkud_nama_akun',255);
|
||||
$table->decimal('rkud_jumlah',19,2);
|
||||
$table->decimal('sisa_sts',19,2)->default(0);
|
||||
$table->string('file_sts',50);
|
||||
$table->uuid('created_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pendapatan_realisasi_sts');
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,22 @@
|
||||
<h2 class="card-title"><i class="fa fa-th-list mr-2"></i> STS</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="nav nav-tabs" id="custom-tabs-four-tab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="rinci-tab" data-toggle="pill" href="#rinci-tabs" role="tab" aria-controls="custom-tabs-four-profile" aria-selected="false">Rincian</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="submit-tab" data-toggle="pill" href="#submit-tabs" role="tab" aria-controls="custom-tabs-four-home" aria-selected="true">Submit</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content pt-2" id="custom-tabs-four-tabContent">
|
||||
<div class="tab-pane fade p-3" id="submit-tabs" role="tabpanel" aria-labelledby="submit-tabs">
|
||||
<form id="frmrealisasipendapatan" action="{{ $baseUrl }}/realisasi-pendapatan/{{ $realisasi_pendapatan->id }}/sts" method="POST" autocomplete="off" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-2 col-sm-2 label-align" for="rkud_no_sts">No. STS</label>
|
||||
<div class="col-md-10 col-sm-10 ">
|
||||
<input id="rkud_no_sts" name="rkud_no_sts" class="{{ (Auth::user()->can("Input STS DBH Realisasi Pendapatan") && empty($realisasi_pendapatan->rkud_no_sts))?"form-control":"form-control-plaintext" }}" value="{{ empty($realisasi_pendapatan->rkud_no_sts)?"-":$realisasi_pendapatan->rkud_no_sts }}" placeholder="" {{ (Auth::user()->can("Input STS DBH Realisasi Pendapatan") && empty($realisasi_pendapatan->rkud_no_sts)) ?"":"disabled" }}></select>
|
||||
<input id="rkud_no_sts" name="rkud_no_sts" class="{{ (Auth::user()->can("Input STS DBH Realisasi Pendapatan"))?"form-control":"form-control-plaintext" }}" value="{{ empty($realisasi_pendapatan->rkud_no_sts)?"-":$realisasi_pendapatan->rkud_no_sts }}" placeholder="" {{ (Auth::user()->can("Input STS DBH Realisasi Pendapatan")) ?"":"disabled" }}></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
@@ -61,24 +71,70 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-2 col-sm-2 label-align" for="txt_simtrad4_bersih">File STS</label>
|
||||
<div class="col-md-10 col-sm-10 ">
|
||||
<?= empty($realisasi_pendapatan->file_sts)?"":"<a href='".URL::to("/realisasi-pendapatan/$realisasi_pendapatan->id/download-sts")."'>".$realisasi_pendapatan->file_sts."</a><br>"; ?>
|
||||
<input <?= empty($realisasi_pendapatan->rkud_no_sts)?"":"style='display:none;'" ?> type="file" name="file_sts" required>
|
||||
<?php if(Auth::user()->can("Input STS DBH Realisasi Pendapatan")){ ?>
|
||||
<input type="file" name="file_sts" required>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(Auth::user()->can("Input STS DBH Realisasi Pendapatan") && empty($realisasi_pendapatan->rkud_no_sts)){ ?>
|
||||
<?php if(Auth::user()->can("Input STS DBH Realisasi Pendapatan")){ ?>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-sm btn-success"><i class="fa fa-save"></i> Simpan</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade p-3 active show" id="rinci-tabs" role="tabpanel" aria-labelledby="rinci-tabs">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<th class="text-center">No</th>
|
||||
<th class="text-center">Tanggal</th>
|
||||
<th class="text-center">No. STS</th>
|
||||
<th class="text-center">Kode Akun</th>
|
||||
<th>Nama Akun</th>
|
||||
<th class="text-center">Jumlah</th>
|
||||
<th class="text-center">Sisa STS</th>
|
||||
<th class="text-center">File STS</th>
|
||||
<?php if(Auth::user()->can("Input STS DBH Realisasi Pendapatan")){ ?>
|
||||
<th class="text-center"></th>
|
||||
<?php } ?>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($realisasi_pendapatan->hasSts as $key=>$rowSts)
|
||||
<tr>
|
||||
<td class="text-center">{{ ($key+1) }}</td>
|
||||
<td class="text-center">{{ date("d/m/Y",strtotime($rowSts->rkud_tgl)) }}</td>
|
||||
<td class="text-center">{{ $rowSts->rkud_no_sts }}</td>
|
||||
<td class="text-center">{{ $rowSts->rkud_kode_akun }}</td>
|
||||
<td>{{ $rowSts->rkud_nama_akun }}</td>
|
||||
<td class="text-right">{{ separateNumberIndo($rowSts->rkud_jumlah) }}</td>
|
||||
<td class="text-right">{{ separateNumberIndo($rowSts->sisa_sts) }}</td>
|
||||
<td class="text-center"><?= "<a target='_blank' href='".URL::to("/realisasi-pendapatan/$rowSts->id_pendapatan_realisasi/download-sts")."'>".$rowSts->file_sts."</a>" ?></td>
|
||||
<?php if(Auth::user()->can("Input STS DBH Realisasi Pendapatan")){ ?>
|
||||
<td class="text-center">
|
||||
<form class='form-delete' action='{{ $baseUrl }}/realisasi-pendapatan/sts-delete/{{ $rowSts->id }}' method='POST'>
|
||||
<input type='hidden' name='_token' id='csrf-token' value='{{ Session::token() }}' />
|
||||
<input type='hidden' name='_method' value='DELETE'>
|
||||
<button class="btn btn-sm btn-danger" href="#">x</button>
|
||||
</form>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="loading" style="display: none;"></div>
|
||||
@stop
|
||||
@section('scripts2')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var noSts = "";
|
||||
$("#btn_save_realisasi_pendapatan").remove();
|
||||
$("#btn_cancel").remove();
|
||||
|
||||
let $newOption = $("<option selected='selected'></option>").val("{{ $realisasi_pendapatan->kode_rekening_sps }}").text("{{ $realisasi_pendapatan->kode_rekening_sps."|".$realisasi_pendapatan->nama_rekening_sps }}")
|
||||
$("#txt_rek_sps").val("{{ $realisasi_pendapatan->kode_rekening_sps."|".$realisasi_pendapatan->nama_rekening_sps }}");
|
||||
@@ -106,7 +162,7 @@
|
||||
}
|
||||
|
||||
let tamsilTPG = ['4.2.01.01.04.0004','4.2.01.01.04.0005','4.2.01.09.02.0004','4.2.01.09.02.0005'];
|
||||
if (tamsilTPG.includes(id) == false) {
|
||||
if (tamsilTPG.includes($("#rkud_kode_akun").val()) == false) {
|
||||
if ($("#rkud_jumlah").val()!=$("#txt_simtrad4_bersih").val()){
|
||||
Swal.fire("Jumlah pada STS harus sama dengan Rencana !", '', 'error');
|
||||
return false;
|
||||
@@ -158,7 +214,10 @@
|
||||
});
|
||||
|
||||
$("#rkud_no_sts").on("blur", function(e){
|
||||
if (noSts!=$(this).val()){
|
||||
getSTS();
|
||||
noSts=$(this).val();
|
||||
}
|
||||
});
|
||||
|
||||
$("#frmrealisasipendapatan").on("submit",function(e){
|
||||
@@ -179,6 +238,8 @@
|
||||
})
|
||||
});
|
||||
|
||||
// $(".form-control-plaintext").removeClass().addClass("form-control");
|
||||
// $("#detail_realisasi_pendapatan input, #detail_realisasi_pendapatan select, #detail_realisasi_pendapatan textarea").addClass("form-control");
|
||||
$("#detail_realisasi_pendapatan .form-control").removeClass();
|
||||
$("#detail_realisasi_pendapatan input, #detail_realisasi_pendapatan select, #detail_realisasi_pendapatan textarea").addClass("form-control-plaintext");
|
||||
$("#detail_realisasi_pendapatan input, #detail_realisasi_pendapatan select, #detail_realisasi_pendapatan textarea").attr("disabled", true);
|
||||
|
||||
@@ -106,6 +106,7 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
// PENDAPATAN ==================================================
|
||||
Route::group(['prefix' => 'realisasi-pendapatan'], function () {
|
||||
Route::post('/datatable', [RealisasiPendapatanController::class,'datatable']);
|
||||
Route::delete('/sts-delete/{stsId}', [RealisasiPendapatanController::class,'deleteSts']);
|
||||
Route::post('/{realisasiId}/sts', [RealisasiPendapatanController::class,'sts']);
|
||||
Route::get('/{realisasi}/download-sts', [RealisasiPendapatanController::class,'downloadSts']);
|
||||
Route::get('/rinci-dbh', [RealisasiPendapatanController::class,'rinciDBH']);
|
||||
|
||||
Reference in New Issue
Block a user