fix kemaskini button aliran tunai v3
This commit is contained in:
@@ -1428,12 +1428,10 @@ class AliranTunaiController extends Controller
|
||||
|
||||
$addtunai = Http::get(config('api.url') . '/api/getAddTunai/' . $auth_user['cawangan'] . '/kodlaluan/',['kodlaluan' => $auth_user['name']])->json();
|
||||
|
||||
// $current->toDateString()
|
||||
$gadai = Http::get(config('api.url'). '/api/gadai/laporan/'. $auth_user['cawangan'] .'/'. $current->toDateString())->json();
|
||||
$tebus = Http::get(config('api.url'). '/api/tebus/laporan/'. $auth_user['cawangan'] .'/'. $current->toDateString())->json();
|
||||
$ansuran = Http::get(config('api.url'). '/api/ansuran/laporan/'. $auth_user['cawangan'],['tarikh' => $current->toDateString()])->json();
|
||||
|
||||
$requestkodlaluan = Http::get(config('api.url').'/api/get/pengguna/'.$auth_user['cawangan'],["namateller" => Auth::user()->name ])->json();
|
||||
$advansur = Http::get(config('api.url').'/api/AnsuranByTarikh/'.$auth_user['cawangan'],['kodlaluan' => Auth::user()->name ])->json();
|
||||
|
||||
$totalserahan = 0;
|
||||
@@ -1455,16 +1453,31 @@ class AliranTunaiController extends Controller
|
||||
$totalgadaibarcodescanned = 0;
|
||||
foreach($gadai as $index1=>$gad)
|
||||
{
|
||||
if($gad['semakbarcode'] === 'LULUS')
|
||||
if($gad['teller'] === Auth::user()->name)
|
||||
{
|
||||
if($gad['semakbarcode'] === 'LULUS')
|
||||
$totalgadaibarcodescanned += $gad['pinjaman'];
|
||||
|
||||
$totalgadai += $gad['pinjaman'];
|
||||
}
|
||||
}
|
||||
|
||||
$totaltebus = 0;
|
||||
$totalgadaibarcodescanned = 0;
|
||||
$totaltebusbarcodescanned = 0;
|
||||
|
||||
foreach($tebus as $index1=>$teb)
|
||||
{
|
||||
if($teb['tagterima'] === 1){
|
||||
if($teb['teller'] === Auth::user()->name)
|
||||
{
|
||||
if($teb['tagterima'] === 1){
|
||||
if($teb['jenistebus'] === 'S')
|
||||
{
|
||||
$totaltebusbarcodescanned += $teb['pinjaman'] + $teb['bakiupah'];
|
||||
}else{
|
||||
$totaltebusbarcodescanned += $teb['bakipjm'];
|
||||
}
|
||||
}
|
||||
|
||||
if($teb['jenistebus'] === 'S')
|
||||
{
|
||||
$totaltebus += $teb['pinjaman'] + $teb['bakiupah'];
|
||||
@@ -1472,12 +1485,14 @@ class AliranTunaiController extends Controller
|
||||
$totaltebus += $teb['bakipjm'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$totalansuran = 0;
|
||||
foreach($ansuran as $index1=>$ans)
|
||||
{
|
||||
$totalansuran += $ans['duit_masuk'];
|
||||
if($ans['teller'] === Auth::user()->name)
|
||||
$totalansuran += $ans['duit_masuk'];
|
||||
}
|
||||
|
||||
$totalupahlama = 0;
|
||||
@@ -1487,16 +1502,17 @@ class AliranTunaiController extends Controller
|
||||
}
|
||||
|
||||
$penebusan = floatval($totaltebus) + floatval($totalansuran) + floatval($totalupahlama);
|
||||
$penebusanbarcodescanned = floatval($totaltebusbarcodescanned) + floatval($totalansuran) + floatval($totalupahlama);
|
||||
$gadaian = floatval($totalgadai);
|
||||
|
||||
$bakisemasa = floatval($bakiawal) + floatval($totalpendahuluan) + floatval($penebusan) - (floatval($gadaian) + floatval($totalserahan));
|
||||
|
||||
$errorpendahuluan = false; $errorserahan = false; $errorpenebusan = false; $errorgadaian = false; $errorbaki = false;
|
||||
|
||||
if(number_format($penebusan,2) !== number_format($masuk,2))
|
||||
$errorpenebusan = true;
|
||||
if(number_format($penebusanbarcodescanned,2) !== number_format($masuk,2))
|
||||
$errorpenebusan = true;
|
||||
|
||||
if(number_format($bakisemasa,2) !== number_format($baki,2))
|
||||
if(number_format(round($bakisemasa,1),2) !== number_format(round($baki,1),2))
|
||||
$errorbaki = true;
|
||||
|
||||
if(number_format($totalpendahuluan,2) != number_format($pendahuluan,2))
|
||||
@@ -1505,14 +1521,14 @@ class AliranTunaiController extends Controller
|
||||
if(number_format($totalserahan,2) != number_format($serahan,2))
|
||||
$errorserahan = true;
|
||||
|
||||
if(number_format($gadaian,2) != number_format($keluar,2))
|
||||
if(number_format($totalgadaibarcodescanned,2) != number_format($keluar,2))
|
||||
$errorgadaian = true;
|
||||
|
||||
if($errorbaki === false)
|
||||
if($errorpenebusan === false && $errorgadaian === false && $errorbaki === false)
|
||||
{
|
||||
return response('sama');
|
||||
}else{
|
||||
$arraykemaskini = ['pendahuluan' => round($totalpendahuluan,2),'serahan' => round($totalserahan,2), 'penebusan' => round($penebusan,2), 'gadaian' => round($gadaian,2), 'bakisemasa' => round($bakisemasa,2)];
|
||||
$arraykemaskini = ['pendahuluan' => round($totalpendahuluan,2),'serahan' => round($totalserahan,2), 'penebusan' => round($totaltebusbarcodescanned,2), 'gadaian' => round($totalgadaibarcodescanned,2), 'bakisemasa' => round($bakisemasa,1)];
|
||||
return response()->json($arraykemaskini);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user