Merge branch 'pipiv2' into 'new-master'
Pipiv2 See merge request online-sistem1/kaunter!125
This commit is contained in:
@@ -1428,13 +1428,11 @@ 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' => $requestkodlaluan[0]['kodlaluan']])->json();
|
||||
$advansur = Http::get(config('api.url').'/api/AnsuranByTarikh/'.$auth_user['cawangan'],['kodlaluan' => Auth::user()->name ])->json();
|
||||
|
||||
$totalserahan = 0;
|
||||
$totalpendahuluan = 0;
|
||||
@@ -1452,40 +1450,69 @@ class AliranTunaiController extends Controller
|
||||
}
|
||||
|
||||
$totalgadai = 0;
|
||||
$totalgadaibarcodescanned = 0;
|
||||
foreach($gadai as $index1=>$gad)
|
||||
{
|
||||
$totalgadai += $gad['pinjaman'];
|
||||
if($gad['teller'] === Auth::user()->name)
|
||||
{
|
||||
if($gad['semakbarcode'] === 'LULUS')
|
||||
$totalgadaibarcodescanned += $gad['pinjaman'];
|
||||
|
||||
$totalgadai += $gad['pinjaman'];
|
||||
}
|
||||
}
|
||||
|
||||
$totaltebus = 0;
|
||||
$totaltebusbarcodescanned = 0;
|
||||
|
||||
foreach($tebus as $index1=>$teb)
|
||||
{
|
||||
$totaltebus += $teb['bakipjm'];
|
||||
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'];
|
||||
}else{
|
||||
$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;
|
||||
foreach($advansur as $index1=>$upahlama)
|
||||
{
|
||||
$totalupahlama += $upahlama['upahDiBayar'];
|
||||
$totalupahlama += $upahlama['upahDibayar'];
|
||||
}
|
||||
|
||||
$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))
|
||||
@@ -1494,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($errorpendahuluan === false && $errorserahan === false && $errorgadaian === false && $errorpenebusan === false && $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);
|
||||
}
|
||||
}
|
||||
@@ -1511,12 +1538,21 @@ class AliranTunaiController extends Controller
|
||||
$auth_user = Auth::user();
|
||||
|
||||
|
||||
$alirantunai = Http::get(config('api.url') . '/api/GetCurrentTunai/' . $auth_user['cawangan'],['kodlaluan' => $auth_user['name']])->json();
|
||||
|
||||
$keluar = $alirantunai['keluar'];
|
||||
$baki = $alirantunai['baki'];
|
||||
$masuk = $alirantunai['masuk'];
|
||||
$bakiawal = $alirantunai['bakiawal'];
|
||||
$pendahuluan = $alirantunai['tambah'];
|
||||
$serahan = $alirantunai['kurang'];
|
||||
|
||||
$updateTunai = Http::put( config('api.url').'/api/updateTunaiGT/'.$auth_user['cawangan'], [
|
||||
'kodlaluan' => $auth_user['name'],
|
||||
'keluar'=> $request->gadaian,
|
||||
'masuk'=> $request->penebusan,
|
||||
'keluar'=> $keluar,
|
||||
'masuk'=> $masuk,
|
||||
'bakiakhir'=> $request->bakiakhir
|
||||
]);
|
||||
]);
|
||||
|
||||
if($updateTunai->status() == 200)
|
||||
{
|
||||
|
||||
@@ -283,37 +283,6 @@
|
||||
|
||||
var tele = "{{ $auth_user['name'] }}";
|
||||
|
||||
// function kemaskiniupah()
|
||||
// {
|
||||
// $.ajax({
|
||||
// type: 'get',
|
||||
// url: "{{ route('kemaskini.upah') }}",
|
||||
// // data: { "namateller" : tele },
|
||||
// success: function(data){
|
||||
// console.log(data);
|
||||
// if(data == 1)
|
||||
// {
|
||||
// Swal.fire({
|
||||
// icon: 'success',
|
||||
// title: 'Kemaskini!',
|
||||
// text: 'Proses Kemaskini!'
|
||||
// }).then(function() {
|
||||
// location.reload();
|
||||
// });
|
||||
|
||||
// }else{
|
||||
// Swal.fire({
|
||||
// icon: 'warning',
|
||||
// title: 'Peringatan',
|
||||
// text: 'Telah Dikemaskini!'
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
|
||||
function periksaalirantunai()
|
||||
{
|
||||
|
||||
@@ -321,7 +290,6 @@
|
||||
type: 'get',
|
||||
url: "{{ route('periksa.alirantunai') }}",
|
||||
success: function(balasbalik){
|
||||
console.log(balasbalik);
|
||||
if(balasbalik == 'sama')
|
||||
{
|
||||
Swal.fire({
|
||||
@@ -332,60 +300,43 @@
|
||||
|
||||
}else{
|
||||
|
||||
Swal.fire({
|
||||
title: 'Kemaskini aliran tunai?',
|
||||
html:
|
||||
'<div class="col-12"><h4 class="btn btn-success col-12 mr-2 font-weight-bold">Pendahuluan : RM ' + formatter.format(balasbalik['pendahuluan']) + '</h4>' +
|
||||
'<h4 class="btn btn-danger col-12 font-weight-bold">Serahan : RM ' + formatter.format(balasbalik['serahan']) + '</h4></div>' +
|
||||
'<div class="col-12"><h4 class="btn btn-success col-12 mr-2 font-weight-bold">Tebus : RM ' + formatter.format(balasbalik['penebusan']) + '</h4>' +
|
||||
'<h4 class="btn btn-danger col-12 font-weight-bold">Gadai : RM ' + formatter.format(balasbalik['gadaian']) + '</h4></div>' +
|
||||
'<h4 class="btn btn-info font-weight-bold col-12">Baki : RM ' + formatter.format(balasbalik['bakisemasa']) + '</h4>',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: `Kemaskini`,
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "{{ route('kemaskini.alirantunai') }}",
|
||||
data: { "bakiakhir" : balasbalik['bakisemasa'],
|
||||
"pendahuluan" : balasbalik['pendahuluan'],
|
||||
"serahan" : balasbalik['serahan'],
|
||||
"gadaian" : balasbalik['gadaian'],
|
||||
"penebusan" : balasbalik['penebusan']
|
||||
},
|
||||
success: function(balas){
|
||||
console.log(balas);
|
||||
if(balas == 'berjaya')
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya',
|
||||
text: 'Kemaskini Berjaya!',
|
||||
closeOnClickOutside: false
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: "{{ route('kemaskini.alirantunai') }}",
|
||||
data: { "bakiakhir" : balasbalik['bakisemasa'],
|
||||
"pendahuluan" : balasbalik['pendahuluan'],
|
||||
"serahan" : balasbalik['serahan'],
|
||||
"gadaian" : balasbalik['gadaian'],
|
||||
"penebusan" : balasbalik['penebusan']
|
||||
},
|
||||
success: function(balas){
|
||||
if(balas == 'berjaya')
|
||||
{
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: 'Berjaya',
|
||||
text: 'Kemaskini Berjaya!',
|
||||
closeOnClickOutside: false
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
}else{
|
||||
Swal.fire({
|
||||
icon: 'danger',
|
||||
title: 'Tidak Berjaya',
|
||||
text: 'Kemaskini tidak berjaya!',
|
||||
closeOnClickOutside: false
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
Swal.fire({
|
||||
icon: 'danger',
|
||||
title: 'Tidak Berjaya',
|
||||
text: 'Kemaskini tidak berjaya!',
|
||||
closeOnClickOutside: false
|
||||
}).then(function() {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user