addded notification
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\Teller\NotifyDeposit;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class EventTriggerController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function TellerCash(){
|
||||
event(new NotifyDeposit("pendahuluan",Auth::user()->cawangan,Auth::user()->name));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1295,140 +1295,16 @@ class KhazanahController extends Controller
|
||||
{
|
||||
$peti_besi_terkini=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/daftarVault/'.$auth_user['cawangan'])->json();
|
||||
}
|
||||
|
||||
$amount = $request->amt;
|
||||
|
||||
$tarikh=$request->tarikh;
|
||||
$kodlaluan=$request->teller;
|
||||
|
||||
$kurang=$request->amt;
|
||||
$nota=$request->nota;
|
||||
$kodcaw=$auth_user['cawangan'];
|
||||
$tambahT = 0;
|
||||
$kurangvault = $request->amt;
|
||||
|
||||
$addTunai=Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/add/addTunai/'.$auth_user['cawangan'],[
|
||||
'kodcaw'=>$kodcaw,
|
||||
'kodlaluan'=>$kodlaluan,
|
||||
'tambah'=>$tambahT,
|
||||
'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
|
||||
{
|
||||
$getTunai2=Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/GetCurrentTunai/'.$auth_user['cawangan'],['kodlaluan' => $kodlaluan])->json();
|
||||
$bakiAwalT=$getTunai2['bakiawal'];
|
||||
$keluarT=$getTunai2['keluar'];
|
||||
$baki=$getTunai2['baki'];
|
||||
$tambahT=$getTunai2['tambah'];
|
||||
$kurangT=$getTunai2['kurang'];
|
||||
$masukT=$getTunai2['masuk'];
|
||||
|
||||
$serahanakhir = $kurang;
|
||||
$tambah_T=0;$kurang_T=0;$baki_AwalT=0.0;
|
||||
|
||||
if($tambahT==0)
|
||||
$tambah_T=0;
|
||||
|
||||
else
|
||||
$tambah_T=$tambahT;
|
||||
|
||||
|
||||
if($kurangT==0)
|
||||
$kurang_T=$kurang;
|
||||
|
||||
else
|
||||
{
|
||||
$kurang=$kurang+$kurangT;
|
||||
$kurang_T=$kurang;
|
||||
}
|
||||
|
||||
if($bakiAwalT==0)
|
||||
$baki_AwalT=0;
|
||||
|
||||
else
|
||||
$baki_AwalT=$bakiAwalT;
|
||||
|
||||
//$bakiAkhirT=$baki_AwalT+$tambah_T+$masukT-$keluarT-$kurang_T; //untuk kegunaan urgent
|
||||
$bakiAkhirT = $baki - $serahanakhir;
|
||||
|
||||
$updateTunai=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/updateTunai/'.$auth_user['cawangan'], [
|
||||
'kodlaluan'=>$kodlaluan,
|
||||
'tambah'=>$tambah_T,
|
||||
'kurang'=>$kurang_T,
|
||||
'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'];
|
||||
|
||||
|
||||
$masuk_V = 0;$pendahuluan_V = 0;$keluar_V = 0;$serahan_V = 0;
|
||||
|
||||
if($masukV == 0)
|
||||
{
|
||||
$masuk_V = 0 + $kurangvault;
|
||||
}
|
||||
else
|
||||
{
|
||||
$masuk_V = $masukV + $kurangvault;
|
||||
}
|
||||
|
||||
if($keluarV == 0)
|
||||
$keluar_V = 0;
|
||||
|
||||
else
|
||||
$keluar_V=$keluarV;
|
||||
|
||||
|
||||
if($pendahuluanV == 0)
|
||||
$pendahuluan_V = 0;
|
||||
|
||||
else
|
||||
$pendahuluan_V = $pendahuluanV;
|
||||
|
||||
|
||||
if($serahanV == 0)
|
||||
$serahan_V = 0;
|
||||
|
||||
else
|
||||
$serahan_V = $serahanV;
|
||||
|
||||
}
|
||||
|
||||
$GetLatestBakiTunai=Http::withOptions(['verify' => config('app.api_verify')])->get( config('api.url').'/api/getLatestBaki/'.$auth_user['cawangan'])->json();
|
||||
$sumBaki=$GetLatestBakiTunai;
|
||||
|
||||
|
||||
$bakiAkhirV = $bakiAwalV - $keluar_V + $masuk_V + $pendahuluan_V - $serahan_V - $totpanjar;
|
||||
|
||||
$BakiEOD=$bakiAkhirV;
|
||||
//$BakiEOD=$bakiAkhirV+$sumBaki;
|
||||
|
||||
$updateVault=Http::withOptions(['verify' => config('app.api_verify')])->put( config('api.url').'/api/UpdateVault/'.$auth_user['cawangan'],[
|
||||
'masuk'=>$masuk_V,
|
||||
'keluar'=>$keluar_V,
|
||||
'bakiawal'=>$bakiAwalV,
|
||||
'bakiakhir'=>$bakiAkhirV,
|
||||
'bakieod'=>$BakiEOD
|
||||
]);
|
||||
|
||||
//--FINAL RESULT...KENA RIDERECT KE PAGE SEBELUMNYA..
|
||||
|
||||
return $this->denominasicalculationserahan($request);
|
||||
$response_data = $request->except('_token');
|
||||
$test = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/test/serahantunai/'.$auth_user['cawangan'],$response_data)->json();
|
||||
|
||||
if($test == 'success'){
|
||||
event(new PendahuluanSerahan("Lulus","serahan",$auth_user['cawangan'],$request->teller));
|
||||
return redirect()->route('khazanah.serahan');
|
||||
}else{
|
||||
return redirect()->route('khazanah.serahan')->with('error','Permohonan tidak berjaya! Permohonan Semula perlu melebihi 1 minit.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user