diff --git a/app/Console/Commands/DailyImbangDuga.php b/app/Console/Commands/DailyImbangDuga.php index a3637fe..2020e84 100644 --- a/app/Console/Commands/DailyImbangDuga.php +++ b/app/Console/Commands/DailyImbangDuga.php @@ -54,7 +54,7 @@ class DailyImbangDuga extends Command foreach($array_cawangan as $caw) { - if($caw['zone'] == $zone) + if($caw['version'] == 'v2') { $response = $this->imbangduga->OperationImbangDuga($caw['kodcaw']); } diff --git a/app/Console/Commands/generateAkruProblem.php b/app/Console/Commands/generateAkruProblem.php index e16cfd3..21eb4ac 100644 --- a/app/Console/Commands/generateAkruProblem.php +++ b/app/Console/Commands/generateAkruProblem.php @@ -63,7 +63,7 @@ class generateAkruProblem extends Command $updateIG = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/admin/laporan/akrual/updateImbangDuga',[ 'zone' => $zone, - 'tarikh' => $previousmonth, + 'tarikh' => $previousmonth->toDateString(), ])->json(); $this->info('sucess'); diff --git a/app/Http/Controllers/PenebusanController.php b/app/Http/Controllers/PenebusanController.php index 44e4de4..9a10188 100644 --- a/app/Http/Controllers/PenebusanController.php +++ b/app/Http/Controllers/PenebusanController.php @@ -12,6 +12,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Auth; use App\Http\Controllers\AliranTunaiController; +use Illuminate\Support\Facades\Log; use Carbon\Carbon; @@ -257,7 +258,8 @@ class PenebusanController extends Controller 'karat' => $array1['karat'], 'berat_emas' => $array1['berat'], 'harga' => $array1['harga'], - 'nilai_marhun' => $array1['n_marhun'] + 'nilai_marhun' => $array1['n_marhun'], + 'kuantiti' => $array1['bil'] ])->json(); } @@ -300,6 +302,10 @@ class PenebusanController extends Controller "bakipelanggan" => $request->bakipelanggan, ])->json(); + if($updatetebus == 'duplicate'){ + return response()->json('duplicate'); + } + ////////////////////// /// MAKING NEW SAG//// ///////////////////// @@ -339,7 +345,7 @@ class PenebusanController extends Controller $nilaimarhun = (floatval($hargabaru['harga']) * floatval($marhunloop['berat'])); - array_push($arraymarhunbaru, ["bil" => $marhunloop['bil'],"marhun" => $marhunloop['marhun'],"nota" => $marhunloop['nota'],"karat" => $marhunloop['karat'], "berat" => $marhunloop['berat'], "harga" => $hargabaru['harga'], "n_marhun" => $nilaimarhun]); + array_push($arraymarhunbaru, ["bil" => $marhunloop['bil'],"tag_permata" => $marhunloop['tag_permata'],"berat_batu_permata" => $marhunloop['berat_batu_permata'],"marhun" => $marhunloop['marhun'],"nota" => $marhunloop['nota'],"karat" => $marhunloop['karat'], "berat" => $marhunloop['berat'], "harga" => $hargabaru['harga'], "n_marhun" => $nilaimarhun]); } foreach($arraymarhunbaru as $array1){ @@ -350,7 +356,9 @@ class PenebusanController extends Controller 'karat' => $array1['karat'], 'berat_emas' => $array1['berat'], 'harga' => $array1['harga'], - 'nilai_marhun' => $array1['n_marhun'] + 'tag_permata' => $array1['tag_permata'], + 'berat_batu_permata' => $array1['berat_batu_permata'], + 'kuantiti' => $array1['bil'] ])->json(); } @@ -419,7 +427,7 @@ class PenebusanController extends Controller } - public function tebusautotawarruq(Request $request) + public function tambahpinjaman_latest(Request $request) { $api_url = config('api.url'); $current = Carbon::now(); @@ -430,16 +438,64 @@ class PenebusanController extends Controller $auth_user = Auth::user(); + //////////////////////// /// UPDATE TEBUS API//// /////////////////////// - $updatetebus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/updateautotawarruq/'. $auth_user['cawangan'] .'/' . $request->norujukan,[ + $updatetebus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/updatetambahpinjaman/'. $auth_user['cawangan'] .'/' . $request->norujukan,[ + "nopelanggan" => $request->nopelanggan, + "jenistebus" => $request->jenistebus, + "jbg" => $request->jbg, + "kadarupah" => $request->kadarupah, + "nilai_marhun" => $request->nilai_marhun, + "pinjamanbaru" => $request->pinjaman, + "pinjaman" => $request->pinjaman_lama, + "ansuran" => $request->ansuran, + "addpinjaman" => $request->addpinjaman, + "bakipinjaman" => $request->bakipinjaman, + "bakiupah" => $request->bakiupah, + "historygadaian" => $request->historygadaian, + "marhun" => $request->marhun, + "kuantiti_marhun" => $request->kuantiti_marhun, + "total_berat" => $request->total_berat, + "kadarkeuntungan" => $request->kadarkeuntungan, + "keuntungan_6bln" => $request->keuntungan_6bln, + "keuntungan_sebulan" => $request->keuntungan_sebulan, + "noic" => $request->noic, + "norujukan" => $request->norujukan, + "jenisbayarantebus" => $request->jenisbayarantebus, + "jeniskeuntungan" => $request->jeniskeuntungan, + "teller" => $request->teller, + "bayaran" => $request->bayaran, + "bakipelanggan" => $request->bakipelanggan, + "nowakil" => isset($request->nowakil) ? $request->nowakil : 0 + ])->json(); + + + if($updatetebus['result'] == 'success'){ + event(new TebusNotify('lulus',Auth::user()->cawangan)); + event(new GadaiNotify('lulus',Auth::user()->cawangan)); + $this->AliranTunaiController->alirantunaiTebus($request); + } + return response()->json($updatetebus['result'],200); + + } + + public function tebusautotawarruq(Request $request) + { + $auth_user = Auth::user(); + + //////////////////////// + /// UPDATE TEBUS API//// + /////////////////////// + $updatetebus = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/updateautotawarruq/'. $auth_user['cawangan'] .'/' . $request->norujukan,[ 'nopelanggan' => $request->nopelanggan, 'jenistebus' => $request->jenistebus, 'jbg' => $request->jbg, 'kadarupah' => $request->kadarupah, 'nilai_marhun' => $request->nilai_marhun, 'pinjaman' => $request->pinjaman_lama, + 'pinjamanbaru' => $request->pinjaman, 'ansuran' => $request->ansuran, 'addpinjaman'=> $request->addpinjaman, 'bakipinjaman' => $request->bakipinjaman, @@ -453,128 +509,16 @@ class PenebusanController extends Controller 'totalbayaran' => $request->totalbayaran, "duitpelanggan" => $request->bayaran, "bakipelanggan" => $request->bakipelanggan, + "noic" => $request->noic, + "jenisAT" => $request->jenisAT, ])->json(); - - - ////////////////////// - /// MAKING NEW SAG//// - ///////////////////// - $gadai_transaction = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/gadai/'. $auth_user['cawangan'] . '/' . $current->toDateString())->json(); - if($gadai_transaction){ - $new_sirig = $gadai_transaction['sirig'] + 1; - - }else{ - $new_sirig = 1; + if($updatetebus['result'] == 'success'){ + $alirantunai = new AliranTunaiController(); + event(new TebusNotify('lulus',Auth::user()->cawangan)); + event(new GadaiNotify('lulus',Auth::user()->cawangan)); + $alirantunai->alirantunaiTebusAutoTawarruq($request); } - - $new_transaction = sprintf("%04d",$new_sirig); - $norujukanbaru = strtoupper($auth_user['cawangan']) . $curent_year . $curent_month . $current_day . '-' .$new_transaction; - - $gadai = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/gadai/'.$auth_user['cawangan'],[ - 'norujukan' => $norujukanbaru, - 'nopelanggan' => $request->nopelanggan, - 'nokp' => $request->noic, - 'sirig' => $new_sirig - ]); - - /////////////////////////// - /// MARHUN UPDATE TABLE//// - ////////////////////////// - - $arraymarhunbaru = []; - - $marhunsediada = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/marhun/'. $request->norujukan)->json(); - - $marhunyangdiambil = $marhunsediada[0]; - foreach($marhunyangdiambil as $index=>$marhunloop) - { - $karatbaru = str_replace('.','-',$marhunloop['karat']); - $hargabaru = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/harga_emas/'. $karatbaru)->json(); - - $harga = ($request->jenisAT == 'hargalama') ? $marhunloop['harga'] : $hargabaru['harga']; - $nilaimarhun = (floatval($harga) * floatval($marhunloop['berat'])); - - array_push($arraymarhunbaru, ["bil" => $marhunloop['bil'],"marhun" => $marhunloop['marhun'],"nota" => $marhunloop['nota'],"karat" => $marhunloop['karat'], "berat" => $marhunloop['berat'], "harga" => $harga, "n_marhun" => $nilaimarhun]); - } - - foreach($arraymarhunbaru as $array1){ - $updatemarhun = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/marhun/'. $auth_user['cawangan'],[ - 'norujukan' => $norujukanbaru, - 'marhun' => $array1['marhun'], - 'nota' => $array1['nota'], - 'karat' => $array1['karat'], - 'berat_emas' => $array1['berat'], - 'harga' => $array1['harga'], - 'nilai_marhun' => $array1['n_marhun'], - 'jenisAT' => $request->jenisAT - ])->json(); - } - - ////////////////////// - ////Update SAG BARU/// - ///////////////////// - - - $total_nilai_marhun = $request->total_nilai_marhun; - $margin_pinjaman = ($request->pinjaman / $total_nilai_marhun); - - $onepercent = Http::withOptions(['verify' => config('app.api_verify')])->post(config('api.url').'/api/onepercent',[ - 'pembiayaan' => $request->pinjaman, - 'nilaimarhun' => $total_nilai_marhun, - 'kadarujrah' => $request->kadarkeuntungan, - 'margin' => ($margin_pinjaman*100), - 'kodcaw' => Auth::user()->cawangan - ])->json(); - - $keuntungan_sebln = $onepercent['keuntungan']; - $keuntungan_sebln = str_replace(',','',$keuntungan_sebln); - - $kadarupah = $request->kadarkeuntungan * 100; - $keuntungan6bulan = $keuntungan_sebln * 6; - $keuntungan12bulan = $keuntungan_sebln * 12; - $hargajualan = $request->pinjaman + $keuntungan12bulan; - - - $gadai = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[ - 'kodcaw' => $auth_user['cawangan'], - 'nilaimarhun' => round($total_nilai_marhun, 2), - 'berat' => round($request->total_berat, 2), - 'pinjaman' => round($request->pinjaman, 2), - 'kadarupah' => round($kadarupah, 2), - 'marhun' => $request->marhun_detail, - 'percentpinj' => $margin_pinjaman, - 'teller'=> $auth_user['name'], - 'upah6' => $keuntungan6bulan, - 'upah12' => $keuntungan12bulan, - 'hargajualan' => $hargajualan, - 'kuantiti_marhun' => $request->kuantiti_marhun, - ]); - - - $komuditi = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/komuditi/transaksi',[ - 'unit_komuditi' => round($request->pinjaman, 2), - 'norujukan' => $norujukanbaru, - 'kodcaw' => $auth_user['cawangan'], - 'teller' => $auth_user['name'] - ]); - - //////////////////////////// - ////Update History Gadaian/// - //////////////////////////// - - $updatehistorygadaian = Http::withOptions(['verify' => config('app.api_verify')])->put(config('api.url').'/api/gadai/updatehistory/'. $auth_user['cawangan'] .'/' . $norujukanbaru,[ - 'historygadaian' => $request->norujukan, - 'jenistebus' => $request->jenistebus, - ])->json(); - - - $alirantunai = new AliranTunaiController(); - event(new TebusNotify('lulus',Auth::user()->cawangan)); - event(new GadaiNotify('lulus',Auth::user()->cawangan)); - $alirantunai->alirantunaiTebusAutoTawarruq($request); - - return response()->json($updatemarhun,200); - + return response()->json($updatetebus['result'],200); } public function tebusseparuh(Request $request) @@ -612,6 +556,9 @@ class PenebusanController extends Controller "bakipelanggan" => $request->bakipelanggan, ])->json(); + if($updatetebus == 'duplicate'){ + return response()->json('duplicate'); + } ////////////////////// /// MAKING NEW SAG//// @@ -655,7 +602,7 @@ class PenebusanController extends Controller $nilaimarhun = (floatval($hargabaru['harga']) * floatval($marhunloop['berat'])); - array_push($arraymarhunbaru, ["bil" => $marhunloop['bil'],"marhun" => $marhunloop['marhun'],"nota" => $marhunloop['nota'],"karat" => $marhunloop['karat'], "berat" => $marhunloop['berat'], "harga" => $hargabaru['harga'], "n_marhun" => $nilaimarhun]); + array_push($arraymarhunbaru, ["bil" => $marhunloop['bil'],"tag_permata" => $marhunloop['tag_permata'],"berat_batu_permata" => $marhunloop['berat_batu_permata'],"marhun" => $marhunloop['marhun'],"nota" => $marhunloop['nota'],"karat" => $marhunloop['karat'], "berat" => $marhunloop['berat'], "harga" => $hargabaru['harga'], "n_marhun" => $nilaimarhun]); } } @@ -668,7 +615,10 @@ class PenebusanController extends Controller 'karat' => $array1['karat'], 'berat_emas' => $array1['berat'], 'harga' => $array1['harga'], - 'nilai_marhun' => $array1['n_marhun'] + 'tag_permata' => $array1['tag_permata'], + 'berat_batu_permata' => $array1['berat_batu_permata'], + 'nilai_marhun' => $array1['n_marhun'], + 'kuantiti' => $array1['bil'] ])->json(); } diff --git a/app/Services/ImbangdugaServices.php b/app/Services/ImbangdugaServices.php index df7425b..f4909cc 100644 --- a/app/Services/ImbangdugaServices.php +++ b/app/Services/ImbangdugaServices.php @@ -56,7 +56,7 @@ class ImbangdugaServices if($kodcaw == '010219') if($tarikh >= '2022-11-24') - $data = $value - 78379.9; + $data = $value; else $data = $value; else $data = $value; break; @@ -64,7 +64,12 @@ class ImbangdugaServices if($kodcaw == '010219') if($tarikh < '2022-11-24') $data = $value - 78379.9; - else $data = $value; + else if($tarikh >= '2023-02-16'){ + $hutang = Http::get(config('api.url').'/admin/ig/penghutang' ,['kodcaw' => $kodcaw, 'tarikh' => $tarikh])->json(); + $bayaran_hutang = Http::get(config('api.url').'/admin/ig/bayaran_penghutang' ,['kodcaw' => $kodcaw, 'tarikh' => $tarikh])->json(); + $data = $hutang['bakihutang'] - $bayaran_hutang; + }else $data = $value; + //else $data = $value; else $data = $value; break; case 'jualan1stop': diff --git a/config/redeemoption.php b/config/redeemoption.php index 5987f20..6467b1e 100644 --- a/config/redeemoption.php +++ b/config/redeemoption.php @@ -2,6 +2,8 @@ return [ 'enable_tambahpinjam' => env('ENABLE_TAMBAHPINJAM',1), 'enable_separuh' => env('ENABLE_SEPARUH',1), - 'enable_pembiayaansemula' => env('ENABLE_AUTOTAWARRUQ',1) + 'enable_pembiayaansemula' => env('ENABLE_AUTOTAWARRUQ',1), + // 'enable_specific_block' => env('ENABLE_BLOCK',0), + 'cawangan_block' => explode(',', env('CAWANGAN_BLOCK', '1STOP,010915,010219,011013,011412,010621,010620,010617,010618')), ]; -?> \ No newline at end of file +?> diff --git a/resources/views/callcenter/v2/info.blade.php b/resources/views/callcenter/v2/info.blade.php index c1193f9..958a29d 100644 --- a/resources/views/callcenter/v2/info.blade.php +++ b/resources/views/callcenter/v2/info.blade.php @@ -9,7 +9,7 @@ @section('content') @include('modal.historytebus') @include('modal.wakil') -
+
@@ -118,26 +118,25 @@
+ +
+ +
+
-
-
- {{-- --}} -
-
- -
@@ -175,6 +174,7 @@ Tempoh Keuntungan Lelong + Pembayaran Terakhir @@ -203,6 +203,7 @@ Tempoh Keuntungan Lelong + Pembayaran Terakhir @@ -758,6 +759,7 @@ if(gadai_detail["tagbaru"] == 0){ $('#textnavsag').addClass('text-danger'); var taglel = ''; + var lastbayar = ''; if(gadai_detail['taglel'] == 1){ if(tagarrahnbid == 1){ $.ajax({ @@ -767,6 +769,7 @@ success: function(data){ taglel = data.lelong.t_lelong; + lastbayar = data.lelong.lastbayar; } }); } else { @@ -791,18 +794,20 @@ if(gadai_detail["percentpinj"] != 0) xtawarruq.row.add([ '', - '' + gadai_detail['norujukan'] + '', + '' + gadai_detail['norujukan'] + '', gadai_detail['t_gadai'], tarikh_matang, - 'RM '+ formatter.format(gadai_detail['bakihargajualan']), - 'RM '+formatter.format(gadai_detail['bakipjm']), + 'RM'+ formatter.format(gadai_detail['bakihargajualan']), + 'RM'+formatter.format(gadai_detail['bakipjm']), (((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%', gadai_detail['tempoh'], - 'RM '+ upahsemasa, + 'RM'+ upahsemasa, '
' + taglel + '
', + '
' + lastbayar + '
', ]).draw(); }else{ var taglel = ''; + var lastbayar = ''; if(gadai_detail['taglel'] == 1){ if(tagarrahnbid == 1){ $.ajax({ @@ -812,6 +817,7 @@ success: function(data){ taglel = data.lelong.t_lelong; + lastbayar = data.lelong.lastbayar; } }); } else { @@ -837,12 +843,13 @@ '' + gadai_detail['norujukan'] + '', gadai_detail['t_gadai'], tarikh_matang, - 'RM '+ formatter.format(gadai_detail['bakihargajualan']), - 'RM '+formatter.format(gadai_detail['bakipjm']), + 'RM'+ formatter.format(gadai_detail['bakihargajualan']), + 'RM'+formatter.format(gadai_detail['bakipjm']), (((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%', gadai_detail['tempoh'], - 'RM '+ formatter.format(upahsemasa['pendapatan']), + 'RM'+ formatter.format(upahsemasa['pendapatan']), '
' + taglel + '
', + '
' + lastbayar + '
', ]).draw(); } }else if(jenistebus == "sudah_tebus"){ diff --git a/resources/views/customers/v2/info.blade.php b/resources/views/customers/v2/info.blade.php index 970f9c6..c86a400 100644 --- a/resources/views/customers/v2/info.blade.php +++ b/resources/views/customers/v2/info.blade.php @@ -12,7 +12,7 @@
- +
-
- -
+
No Telefon
@@ -119,30 +117,50 @@
- -
-
- - - -
-
- -
- -
-
+ + +
+ +
+ +
+ +
+ + + +
+
+ + + +
+ +
+ + + + +
+
+