first commit for kaunter in fixing cash deposit
This commit is contained in:
@@ -14,10 +14,12 @@ class PendahuluanSerahan implements ShouldBroadcast
|
||||
public $pengesahan;
|
||||
public $cawangan;
|
||||
public $kodlaluan;
|
||||
public $jenis;
|
||||
|
||||
public function __construct($pengesahan,$cawangan,$kodlaluan)
|
||||
public function __construct($pengesahan,$jenis,$cawangan,$kodlaluan)
|
||||
{
|
||||
$this->pengesahan = $pengesahan;
|
||||
$this->jenis = $jenis;
|
||||
$this->cawangan = $cawangan;
|
||||
$this->kodlaluan = $kodlaluan;
|
||||
}
|
||||
|
||||
@@ -1156,7 +1156,7 @@ class KhazanahController extends Controller
|
||||
|
||||
]);
|
||||
|
||||
event(new PendahuluanSerahan("Lulus",$auth_user['cawangan'],$request->teller));
|
||||
event(new PendahuluanSerahan("Lulus","pendahuluan",$auth_user['cawangan'],$request->teller));
|
||||
|
||||
$updaterequest=Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/update/'. $auth_user['cawangan'],[
|
||||
'kodlaluan' => $request->teller,
|
||||
@@ -1236,7 +1236,7 @@ class KhazanahController extends Controller
|
||||
|
||||
]);
|
||||
|
||||
event(new PendahuluanSerahan("Lulus",$auth_user['cawangan'],$request->teller));
|
||||
event(new PendahuluanSerahan("Lulus","serahan",$auth_user['cawangan'],$request->teller));
|
||||
|
||||
$updaterequest=Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/update/'. $auth_user['cawangan'],[
|
||||
'kodlaluan' => $request->teller,
|
||||
@@ -1247,144 +1247,41 @@ class KhazanahController extends Controller
|
||||
return redirect()->route('khazanah.serahan');
|
||||
}
|
||||
|
||||
public function kemaskiniPendahuluan(Request $request) //Daftar Pendahuluan kepada Kaunter
|
||||
public function kemaskiniPendahuluan(Request $request)
|
||||
{
|
||||
|
||||
// return $this->denominasicalculationpendahuluan($request);
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json();
|
||||
|
||||
$auth_user = Auth::user();
|
||||
$api_url = config('api.url');
|
||||
$peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json();
|
||||
if(sizeof($peti_besi_terkini) == 0)
|
||||
{
|
||||
$peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json();
|
||||
$baki_awal = $peti_besi_terkini["bakiakhir"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$baki_awal = $peti_besi_terkini[0]["bakiakhir"];
|
||||
}
|
||||
|
||||
if(sizeof($peti_besi_terkini) == 0)
|
||||
{
|
||||
$peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json();
|
||||
$baki_awal=$peti_besi_terkini["bakiakhir"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$baki_awal=$peti_besi_terkini[0]["bakiakhir"];
|
||||
}
|
||||
$amount = $request->amt;
|
||||
|
||||
$amount = $request->amt;
|
||||
if($amount > $baki_awal){
|
||||
return redirect()->route('khazanah.pendahulu')->with('message', 'Jumlah yang dipinta melebihi baki dalam peti besi!.');
|
||||
}
|
||||
else{
|
||||
$response_data = $request->except('_token');
|
||||
$test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/test/updatetunai/'.$auth_user['cawangan'],$response_data)->json();
|
||||
|
||||
if($test == 'success'){
|
||||
event(new PendahuluanSerahan("Lulus","pendahuluan",$auth_user['cawangan'],$request->teller));
|
||||
return redirect()->route('khazanah.pendahulu');
|
||||
}else{
|
||||
return redirect()->route('khazanah.pendahulu')->with('error','Permohonan tidak berjaya! Permohonan Semula perlu melebihi 1 minit.');
|
||||
}
|
||||
}
|
||||
|
||||
if($amount>$baki_awal)
|
||||
{
|
||||
//WI ERROR MESSAGE SKIT
|
||||
// dd($baki_awal);
|
||||
return redirect()->route('khazanah.serahan')->with('message', 'Jumlah yang dipinta melebihi baki dalam peti besi!.');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$tarikh=$request->tarikh;
|
||||
$kodlaluan=$request->teller;
|
||||
$tambah=$request->amt;
|
||||
$kurang=0.0;
|
||||
$nota=$request->nota;
|
||||
$kodcaw=$auth_user['cawangan'];
|
||||
|
||||
$addTunai=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/add/addTunai/'.$auth_user['cawangan'],[
|
||||
'kodcaw'=>$kodcaw,
|
||||
'kodlaluan'=>$kodlaluan,
|
||||
'tambah'=>$tambah,
|
||||
'kurang'=>$kurang,
|
||||
'nota'=>$nota
|
||||
]);
|
||||
|
||||
$getTunai=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json();
|
||||
|
||||
if(sizeof($getTunai) == 0)
|
||||
{
|
||||
dd($getTunai);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bakiawal=0;$masuk=0;$yuran=0;$keluar=0;$baki=0;$tmbh=0;$kurang=0;
|
||||
|
||||
$BakiAkhirT=0;$BakiAwalT=0;$tambahT=0;
|
||||
|
||||
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json();
|
||||
$bakiAwal=$getTunai2['bakiawal'];
|
||||
$keluar=$getTunai2['keluar'];
|
||||
$baki=$getTunai2['baki'];
|
||||
$kurangT=$getTunai2['kurang'];
|
||||
$tam=$getTunai2['tambah'];
|
||||
$masukT=$getTunai2['masuk'];
|
||||
|
||||
if($bakiAwal==0)
|
||||
{
|
||||
$BakiAwalT=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$BakiAwalT=$bakiAwal;
|
||||
}
|
||||
|
||||
$tambahT=$tambah + $tam;
|
||||
|
||||
$kurang=$kurangT;
|
||||
$keluarT = $keluar;
|
||||
// $bakiAkhirT= $bakiAwal + $tambahT + $masukT - $keluarT - $kurang;
|
||||
$bakiAkhirT = $baki + $tambah;
|
||||
|
||||
$updateTunai=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/updateTunai/'.$auth_user['cawangan'], [
|
||||
'kodlaluan'=>$kodlaluan,
|
||||
'tambah'=>$tambahT,
|
||||
'kurang'=>$kurang,
|
||||
'bakiakhir'=>$bakiAkhirT
|
||||
]);
|
||||
|
||||
$latestVault=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/VaultController/'.$auth_user['cawangan'])->json();
|
||||
$masukV=$latestVault[0]['masuk'];
|
||||
$keluarV=$latestVault[0]['keluar'];
|
||||
$pendahuluanV=$latestVault[0]['pendahuluan'];
|
||||
$serahanV=$latestVault[0]['serahan'];
|
||||
$bakiAwalV=$latestVault[0]['bakiawal'];
|
||||
$totpanjar = $latestVault[0]['totpanjar'];
|
||||
|
||||
// return;
|
||||
// dd($tambahT);
|
||||
// $keluarV=$tambahT;
|
||||
$keluarV = $tambah + $keluarV;
|
||||
|
||||
$GetLatestBakiTunai=Http::withOptions(['verify' => config('app.api_verify')])->get( config('api.url').'/api/getLatestBaki/'.$auth_user['cawangan'])->json();
|
||||
|
||||
$bakiTerkini=$GetLatestBakiTunai;
|
||||
$bakiAkhirV=$bakiAwalV - $keluarV + $masukV + $pendahuluanV - $serahanV - $totpanjar;
|
||||
// $bakiEOD=$bakiAkhirV+$GetLatestBakiTunai; //try test
|
||||
$bakiEOD = $bakiAkhirV;
|
||||
|
||||
// dd($bakiEOD);
|
||||
// $createTempVault=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan']);
|
||||
|
||||
// dd($bakiAkhirV);
|
||||
//get temporary latest vault/ petibesi
|
||||
|
||||
|
||||
|
||||
$updateVault=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/UpdateVault/'.$auth_user['cawangan'],[
|
||||
|
||||
'masuk'=>$masukV,
|
||||
'keluar'=>$keluarV,
|
||||
'bakiawal'=>$bakiAwalV,
|
||||
'bakiakhir'=>$bakiAkhirV,
|
||||
'bakieod'=>$bakiEOD
|
||||
|
||||
]);
|
||||
|
||||
//-----PROCESS SELESAI-----------------------------------
|
||||
//display final result
|
||||
|
||||
return $this->denominasicalculationpendahuluan($request);
|
||||
//dd($updateVault);
|
||||
|
||||
|
||||
} //endif
|
||||
|
||||
} //end
|
||||
|
||||
} //End
|
||||
}
|
||||
|
||||
public function KemaskiniSerahan(Request $request)
|
||||
{
|
||||
@@ -1397,11 +1294,6 @@ class KhazanahController extends Controller
|
||||
if(sizeof($peti_besi_terkini) == 0)
|
||||
{
|
||||
$peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json();
|
||||
$baki_awal=$peti_besi_terkini["bakiakhir"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$baki_awal=$peti_besi_terkini[0]["bakiakhir"];
|
||||
}
|
||||
|
||||
$amount = $request->amt;
|
||||
@@ -3232,12 +3124,12 @@ class KhazanahController extends Controller
|
||||
$nombor = $request->no;
|
||||
$kodlaluan = $request->kodlaluan;
|
||||
|
||||
$updatebatal = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/batal/'.$kodcaw,[
|
||||
Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/requestTeller/batal/'.$kodcaw,[
|
||||
'no'=>$nombor,
|
||||
'kodlaluan'=>$kodlaluan
|
||||
]);
|
||||
|
||||
event(new PendahuluanSerahan("Batal",$auth_user['cawangan'],$kodlaluan));
|
||||
event(new PendahuluanSerahan("Batal","all",$auth_user['cawangan'],$kodlaluan));
|
||||
|
||||
return response('Berjaya');
|
||||
}
|
||||
|
||||
Vendored
+20
-3
@@ -465,7 +465,8 @@ async function openuptambahdanserah(e)
|
||||
|
||||
var channel = pusher.subscribe('pendahuluanserahan-notice');
|
||||
channel.bind('penserahan-event', function(data) {
|
||||
if(data.pengesahan === 'Lulus' && data.cawangan == kodcaw && data.kodlaluan == teller)
|
||||
console.log(data);
|
||||
if(data.pengesahan === 'Lulus' && data.jenis == 'pendahuluan' && data.cawangan == kodcaw && data.kodlaluan == teller)
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
@@ -474,7 +475,7 @@ async function openuptambahdanserah(e)
|
||||
}).then(function(){
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
}else if(data.pengesahan == 'Batal' && data.jenis == 'all' && data.cawangan == kodcaw && data.kodlaluan == teller){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Tambah Pendahuluan',
|
||||
@@ -482,6 +483,14 @@ async function openuptambahdanserah(e)
|
||||
}).then(function(){
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Tambah Pendahuluan',
|
||||
text: 'Tambah Pendahuluan tidak berjaya!'
|
||||
}).then(function(){
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -630,7 +639,7 @@ function tambahdanserahanfunc(e)
|
||||
channel.bind('penserahan-event', function(data) {
|
||||
// let message = JSON.stringify(data);
|
||||
|
||||
if(data.pengesahan === 'Lulus' && data.cawangan == kodcaw && data.kodlaluan == teller)
|
||||
if(data.pengesahan === 'Lulus' && data.jenis == 'serahan' && data.cawangan == kodcaw && data.kodlaluan == teller)
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
@@ -640,6 +649,14 @@ function tambahdanserahanfunc(e)
|
||||
window.open(laporanroute, '_blank');
|
||||
location.reload();
|
||||
});
|
||||
}else if(data.pengesahan == 'Batal' && data.jenis == 'all' && data.cawangan == kodcaw && data.kodlaluan == teller){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Serahan Modal',
|
||||
text: 'Serahan modal tidak diluluskan!'
|
||||
}).then(function(){
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
|
||||
|
||||
<div class="card-body text-center">
|
||||
|
||||
@if (session('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row mb-4">
|
||||
<div class="col-2 justify-content-start">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user