From 2a8e972b3466b48847125d46a671ac2d63ec65e8 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 10 Dec 2023 00:05:30 +0800 Subject: [PATCH 001/114] separation of tawarruq and onepercent --- app/Http/Controllers/AdminPageController.php | 2 + app/Http/Controllers/GadaiController.php | 330 +------- app/Http/Controllers/TebusController.php | 742 ++---------------- app/Services/MasterServices.php | 203 +++++ app/Services/TawarruqServices.php | 16 - app/Support/Onepercent.php | 203 +++++ app/Support/Tawarruq.php | 172 ++++ app/Support/v1/Calculation.php | 14 + app/Support/v1/GadaiV1.php | 271 +++++++ app/Support/v1/Penebusan.php | 615 +++++++++++++++ .../v2/Calculation.php} | 38 +- app/Support/v2/GadaiV2.php | 330 ++++++++ app/Support/v2/Penebusan.php | 728 +++++++++++++++++ database/factories/GadaiFactory.php | 4 +- database/factories/MarhunFactory.php | 2 +- ...8_115215_add_onepercent_to_gadai_table.php | 2 +- ..._add_version_to_arrahn_master_db_table.php | 34 + tinker/getOnePercent.php | 17 +- 18 files changed, 2701 insertions(+), 1022 deletions(-) create mode 100644 app/Services/MasterServices.php delete mode 100644 app/Services/TawarruqServices.php create mode 100644 app/Support/Onepercent.php create mode 100644 app/Support/Tawarruq.php create mode 100644 app/Support/v1/Calculation.php create mode 100644 app/Support/v1/GadaiV1.php create mode 100644 app/Support/v1/Penebusan.php rename app/{Services/OnePercentServices.php => Support/v2/Calculation.php} (74%) create mode 100644 app/Support/v2/GadaiV2.php create mode 100644 app/Support/v2/Penebusan.php create mode 100644 database/migrations/2023_12_08_151908_add_version_to_arrahn_master_db_table.php diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index f6bf1aa..b69b826 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3635,6 +3635,8 @@ class AdminPageController extends Controller if($kodcaw == '011229') $total -= 45390.37; + if($kodcaw == 'KB2') + $total -= 1378.5; return response()->json($total,200); } diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 8008bb7..16b7687 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -32,7 +32,8 @@ use App\InOutMar; use Illuminate\Http\Request; -use App\Services\OnePercentServices; +use App\Services\MasterServices; +use App\Support\OnePercent; use Log; use Illuminate\Support\Facades\DB; @@ -130,33 +131,11 @@ class GadaiController extends Controller } public function create($kodcaw,Request $request){ - $current = Carbon::now(); - $current = new Carbon(); - - $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $master = new MasterServices($kodcaw); + $response = $master->createGadai($request); - try{ - DB::transaction(function () use ($cawangan, $kodcaw, $request, $current) { - $gadai = Gadai::on($cawangan['mysql'])->create([ - 'kodcaw'=>$kodcaw, - 'norujukan' => $request->norujukan, - 'nopelanggan' => $request->nopelanggan, - 'nokp' => $request->nokp, - 'sirig' => $request->sirig, - 't_gadai' => $current->toDateString(), - 'sttebus' => '', - 'masa' =>$current->toTimeString(), - 'tagbaru' => 1 - ]); - return response()->json($gadai, 201); - }); - - - }catch(\Exception $e){ - - echo "Gadaian Gagal: " . $e->getMessage(); - } + return $response; } public function createold($kodcaw,Request $request){ @@ -224,100 +203,10 @@ class GadaiController extends Controller public function daftarGadaiMarhun($norujukan,Request $request){ // dd("ggwp"); - $current = Carbon::now(); - $current = new Carbon(); + $master = new MasterServices($request->kodcaw); + $response = $master->createMarhunGadai($request->norujukan,$request); - $t_matang = Carbon::now(); - $t_matang = new Carbon(); - $t_matang = $t_matang->addMonths(6)->subDays(1); - - $t_kontrak = Carbon::now(); - $t_kontrak = new Carbon(); - $t_kontrak = $t_kontrak->addMonths(12)->subDays(1); - - $margin_pinjam = $request->percentpinj *100; - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$request->kodcaw) - ->first(); - if($request->transaction == 'Ubah Gadai'){ - $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - } - - $bil_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->count(); - - $total_nilai_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('n_marhun'); - $total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat'); - - //query kadar upah baru - $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawangan['group_id'])->first(); - - - // query kadar upah lama - // $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); - - $onepercentservices = new OnePercentServices(); - $keuntungan = $onepercentservices->kiraanKeuntunganSebenar($request->pinjaman,$total_nilai_marhun,$kadar_raw['kadarujrah'],$margin_pinjam); - // $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); - // $upah6 = $upah1 * 6; - // $upah12 = $upah1 * 12; - $upah1 = $keuntungan['keuntungan']; - $upah6 = $upah1 * 6; - $upah12 = $upah1 * 12; - $ujrah = $keuntungan['ujrah']; - $onepercent = $keuntungan['onepercent']; - - $hargajualan = $request->pinjaman + $upah12; - - $gadai = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->update(array( - 'nilaimarhun' => $total_nilai_marhun, - 'berat'=> $total_berat, - 'pinjaman' => $request->pinjaman, - 'kadarupah' => $kadar_raw['kadarujrah'], - 'marhun' => $request->marhun, - 'percentpinj' => $margin_pinjam, - 'teller' => $request->teller, - 'bakipjm' => $request->pinjaman, - 'bakiupah' => $upah6, - 'jbg' => 0.5, - 't_update' => $current->toDateString(), - 'cetak' => 0, - 'upah12' => $upah12, - 'hargajualan' => $hargajualan, - 'bakihargajualan' => $hargajualan, - 'tagserah' => 0, - 't_matang' => $t_matang, - 't_matang1' => $t_kontrak, - 'tempoh' => 0.5, - 'kuantiti' => $bil_marhun, - 'tagkomuditi' => 0, - 'upahdibayar' => 0.00, - 'tempohbayar' => 0.00, - 'lelong_tawarruq' => 1, - 'kadarujrah' => $kadar_raw['kadarujrah'], - 'ujrah' => $ujrah, - 'onepercent' => $onepercent, - 'margin_semasa' => $margin_pinjam, - 'tagbaru' => 1 - )); - - $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - - $audit = new Audit(); - $audit->users = $request->teller; - $audit->actions = $request->transaction; - $audit->norujukan = $norujukan; - $audit->new_data = $new_data; - if($request->transaction == 'Ubah Gadai'){ - $audit->old_data = $old_data; - } - $audit->kodcaw = $request->kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); - - return response()->json($gadai, 200); + return response()->json($response, 200); } public function getTransactionByTarikh($kodcaw,$tarikh){ @@ -325,7 +214,7 @@ class GadaiController extends Controller $gadai_transaction = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$tarikh)->get(); - return response()->json($gadai); + return response()->json($gadai_transaction); } public function checkNorujukan(Request $request){ @@ -345,68 +234,17 @@ class GadaiController extends Controller } public function kiraupahTawarruq($kodcaw,$norujukan){ - $onepercentservices = new OnePercentServices(); + $master = new MasterServices($kodcaw); + $response = $master->kiraUpahTawarruq($kodcaw,$norujukan); - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); - - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); - $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; - - // $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); - $upah_semasa_round = number_format($upahsemasa_raw,2); - $upah_semasa = substr($upah_semasa_round, 0, -1); - // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); - if(strpos($upah_semasa,',')){ - $upah_semasa = str_replace(',','',$upah_semasa); - } - return $upah_semasa; + return $response; } public function kiraUpahRebet($kodcaw,$norujukan){ - $onepercentservices = new OnePercentServices(); + $master = new MasterServices($kodcaw); + $response = $master->kiraUpahRebet($norujukan); - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); - - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - - $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - - // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); - $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - - // $upah_rebet_round = number_format($upahrebet_raw,2); - // $upah_rebet = substr($upah_rebet_round, 0, -1); - // if(strpos($upah_rebet,',')){ - // $upah_rebet = str_replace(',','',$upah_rebet); - // } - // $upah_rebet = floatval(preg_replace('/[^\d.]/', '', $upah_rebet)); - - return $upahrebet_raw; + return $response; } public function updateGadaiMarhunOnline($kodcaw,$norujukan,Request $request){ @@ -465,126 +303,10 @@ class GadaiController extends Controller } public function updateGadaiMarhunKaunter($kodcaw,$norujukan,Request $request){ - $current = Carbon::now(); - $current = new Carbon(); + $onePercentServices = new Onepercent($request->kodcaw); + $update = $onePercentServices->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); - $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - - $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan); - $upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan); - - $total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk'); - - $total_bayaran_semasa = $total_bayaran_prev + $request->bayaran; - - if($total_bayaran_semasa >= $gadai['bakiupah']){ - $lelong_tawarruq = 0; - }else{ - $lelong_tawarruq = 1; - } - $onepercent = new OnePercentServices(); - - $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - - $baki_hargajualan = $gadai['bakihargajualan'] - $request->bayaran; - - $baki_bayaran = $request->bayaran - $upahsemasa; - - $baki_pinjaman = $gadai['bakipjm'] - $baki_bayaran; - - $margin_semasa = ($gadai['bakipjm'] / $gadai['nilaimarhun']) * 100; - - $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); - $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['margin_semasa']); - - $onepercentasal = $gadai['pinjaman'] * (1/100); - - try { - - DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { - - $transaction = Transaction::on('mysql7')->create([ - 'trans_type' => 'A', - 'norujukan' => $norujukan, - 'nokp' => $gadai['nokp'], - 'teller' => $request->teller, - 'kodcaw' => $kodcaw, - 'duit_masuk' => $request->bayaran, - 'created_at' => $current, - 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil, - 'duitpelanggan' => $request->duitpelanggan, - 'bakipelanggan' => $request->bakipelanggan - ]); - - if($gadai['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai['tempoh']; - } - $bilang_bln = $tempoh - $gadai['tempohbayar']; - - $rounded = $upahsemasa - (($keuntungan['ujrah'] * $bilang_bln) + ($onepercentasal * $bilang_bln)); - - $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ - 'norujukan' => $norujukan, - 'bayaran_keuntungan' => $upahsemasa, - 'bayaran_pembiayaan' => $baki_bayaran, - 'keuntungan_rebet'=> $upahrebet, - 'tarikh_bayaran'=> $current, - 'kodcaw'=> $kodcaw, - 'ujrah' => ($keuntungan['ujrah'] * $bilang_bln), - 'ujrah_rebet' => ($ujrahasal*$bilang_bln), - 'onepercent' => ($onepercentasal * $bilang_bln), - 'onepercent_rebet' => ($keuntungan['onepercent'] * $bilang_bln), - 'tempoh' => $gadai['tempoh'], - 'beza_tempoh' => $bilang_bln, - 'margin_semasa' => $margin_semasa, - 'rounded' => $rounded, - ]); - - DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ - - $margin_updated = ($baki_pinjaman / $gadai['nilaimarhun']) * 100; - - $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'bakipjm' => $baki_pinjaman, - 'jbg' => 0, - 't_update' => $current->toDateString(), - 'bakihargajualan' => $baki_hargajualan, - 'tempohbayar' => $gadai['tempoh'], - 'lelong_tawarruq' => $lelong_tawarruq, - 'margin_semasa' => $margin_updated, - )); - }); - - $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - - $audit = new Audit(); - $audit->users = $request->teller; - $audit->actions = 'Bayaran Ansuran'; - $audit->norujukan = $norujukan; - $audit->new_data = $new_data; - $audit->old_data = $old_data; - $audit->kodcaw = $kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); - - if(!$transaction || !$transaction_upah) { - throw new \Exception('One of the database operations failed.'); - } - - DB::commit(); - - }); - }catch(\Exception $e){ - Log::error("Transaction failed: " . $e->getMessage()); - return response()->json("Transaction failed: " . $e->getMessage(),500); - } - - return response()->json("success",200); + return $update; } public function getGadaianSemasa($kodcaw){ @@ -3871,21 +3593,15 @@ class GadaiController extends Controller } public function getKadarUjrah(Request $request){ - $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); - $onePercentServices = new OnePercentServices(); - - $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); - - // $test = $this->kiraupahTawarruq('KB2','KB2231109-0001'); - // dd($test); + $onePercentServices = new Onepercent($request->kodcaw); + $kadarujrah = $onePercentServices->getKadarUjrah($request); + return $kadarujrah; } public function getOnePercent(Request $request){ - - $onePercentServices = new OnePercentServices(); - - $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); + $onePercentServices = new Onepercent($request->kodcaw); + $keuntungan = $onePercentServices->getOnePercent($request); return $keuntungan; } diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index c031f56..e93f393 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -36,7 +36,7 @@ use App\StokAudit11; use App\StokAudit12; use App\AkruNet; -use App\Services\OnePercentServices; +use App\Services\MasterServices; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; @@ -46,247 +46,73 @@ use Carbon\Carbon; class TebusController extends Controller { public function tebusTawarruq($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->tebusTawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $jeniskeuntungan = ($gadai_data['tagbaru'] == 1) ? 'onepercent' : 'asal'; - - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); - $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; - - // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); - $hargatebus = bcdiv(round($harga_tebus,2),1,1); - $hargatebus = number_format($hargatebus,2); - if(strpos($hargatebus,',')){ - $hargatebus = str_replace(',','',$hargatebus); - } - return response()->json($hargatebus); + return $response; } public function hargaTebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->hargaTebusTawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); - - $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; - - // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); - $hargatebus = bcdiv(round($harga_tebus,2),1,1); - $hargatebus = number_format($hargatebus,2); - if(strpos($hargatebus,',')){ - $hargatebus = str_replace(',','',$hargatebus); - } - - $rounded = $hargatebus - $harga_tebus; - Log::info([$harga_tebus,$rebet]); - $arrayharga = ['harga' => $hargatebus, 'rounded' => $rounded]; - - return $arrayharga; + return $response; } public function kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $onepercentservices = new OnePercentServices(); - - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->kiraUpahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - - if($jeniskeuntungan == 'onepercent'){ - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; - }else{ - $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); - } - - // $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); - $upah_semasa_round = number_format($upahsemasa_raw,2); - if(strpos($upah_semasa_round,',')){ - $upah_semasa_round = str_replace(',','',$upah_semasa_round); - } - $upah_semasa = substr($upah_semasa_round, 0, -1); - if(strpos($upah_semasa,',')){ - $upah_semasa = str_replace(',','',$upah_semasa); - } - - return $upah_semasa; + return $response; } public function kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan){ - $onepercentservices = new OnePercentServices(); - - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->kiraupahRebet($kodcaw,$norujukan,$jeniskeuntungan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - - if($jeniskeuntungan == 'onepercent'){ - $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - }else{ - $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); - } - - // $upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP); - // $upah_rebet_round = number_format($upahrebet_raw,2); - // if(strpos($upah_rebet_round,',')){ - // $upah_rebet_round = str_replace(',','',$upah_rebet_round); - // } - // $upah_rebet = substr($upah_rebet_round, 0, -1); - // if(strpos($upah_rebet,',')){ - // $upah_rebet = str_replace(',','',$upah_rebet); - // } - - return $upahrebet_raw; + return $response; } public function kiraUpahRebetSebenar($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->kiraUpahRebetSebenar($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - - $bilang_bln = $gadai_data['tempoh'] - $gadai_data['tempohbayar']; - - $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); - - // $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP); - $upah_rebet_round = number_format($upahrebet_raw,2); - if(strpos($upah_rebet_round,',')){ - $upah_rebet_round = str_replace(',','',$upah_rebet_round); - } - $upah_rebet = substr($upah_rebet_round, 0, -1); - if(strpos($upah_rebet,',')){ - $upah_rebet = str_replace(',','',$upah_rebet); - } - - $total_untung_rebet = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('keuntungan_rebet'); - $total_untung_asal = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('bayaran_keuntungan'); - $beza_keuntungan = $total_untung_asal - $total_untung_rebet; - - $keuntungan_rebet_sebenar = $upah_rebet - $beza_keuntungan; - return $keuntungan_rebet_sebenar; + return $response; } public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $master = new MasterServices($kodcaw); + $response = $master->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); - $upah_semasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); - - return response()->json(number_format($upah_semasa,2)); + return $response; } public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $master = new MasterServices($kodcaw); + $response = $master->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); - - return response()->json(number_format($upah_rebet,2)); + return $response; } public function tebusSeparuhTawarruq($kodcaw,$norujukan,Request $request){ + $master = new MasterServices($kodcaw); + $response = $master->tebusSeparuhTawarruq($kodcaw,$norujukan,$request); - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); - - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); - - $array_recno_marhun = $request->array_recno; - - $margin_pembiayaan = round(($gadai_data['bakipjm']/$gadai_data['nilaimarhun'])*100,2); - // $margin_pembiayaan = round(($gadai_data['bakipjm']/$request->hargasemasa)*100,2); - - $nilai_marhun = $gadai_data['nilaimarhun']; - $total_harga_tebus = 0; - foreach($array_recno_marhun as $recno){ - $marhun = Marhun::on($cawangan['mysql'])->where([['recno','=',$recno],['norujukan','=',$norujukan]])->first(); - - $harga_tebus = ($margin_pembiayaan/100)*$marhun['n_marhun']; - - $total_harga_tebus += $harga_tebus; - } - - $total_harga_tebus_round = round($total_harga_tebus,2); - - $totalhargatebus = substr($total_harga_tebus_round, 0, -1); - - return response()->json($totalhargatebus); + return $response; } public function tebusNotTawarruq($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->tebusNotTawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upah_semasa = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); - - $harga_tebus = $upah_semasa + $gadai_data['pinjaman']; - - return response()->json($harga_tebus); + return $response; } public function hargaTebusNotTawarruq($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->hargaTebusNotTawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upah_semasa = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); - - $harga_tebus = $upah_semasa + $gadai_data['pinjaman']; - - return $harga_tebus; + return $response; } public function getMoratorium(){ @@ -300,424 +126,52 @@ class TebusController extends Controller } public function kiraUpahNotTawarruq($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->kiraUpahNotTawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upahtelahbayar = Advansur::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->sum('upahdibayar'); - - $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; - $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; - $margin_kadarupah = 80; - $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; - - $bln_mora = Moratorium::first(); - - $upah_sebenar = $upah_asal - $rebet; - $bln_upah = $gadai_data['tempoh']; - if($bln_upah > $bln_mora['bln_mora']){ - $bln_upah = $bln_mora['bln_mora']; - } - $upahsemasa = $upah_sebenar * $bln_upah; - $upah_semasa = bcdiv(round($upahsemasa,2),1,1); - $upah_semasa = number_format($upah_semasa,2); - if(strpos($upah_semasa,',')){ - $upah_semasa = str_replace(',','',$upah_semasa); - } - $upah_semasa = (float)$upah_semasa - $upahtelahbayar; - - if($upah_semasa <= 0){ - $upah_semasa = 0; - } - - return $upah_semasa; + return $response; } public function upahNotTawarruq($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->upahNotTawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upahtelahbayar = Advansur::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->sum('upahdibayar'); - - $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; - $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; - $margin_kadarupah = 80; - $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; - - $bln_mora = Moratorium::first(); - - $upah_sebenar = $upah_asal - $rebet; - $bln_upah = $gadai_data['tempoh']; - if($bln_upah > $bln_mora['bln_mora']){ - $bln_upah = $bln_mora['bln_mora']; - } - $upahsemasa = $upah_sebenar * $bln_upah; - $upah_semasa = bcdiv(round($upahsemasa,2),1,1); - $upah_semasa = number_format($upah_semasa,2); - if(strpos($upah_semasa,',')){ - $upah_semasa = str_replace(',','',$upah_semasa); - } - $upah_semasa = (float)$upah_semasa - $upahtelahbayar; - - if($upah_semasa <= 0){ - $upah_semasa = 0; - } - - return response()->json($upah_semasa); + return $response; } public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,Request $request){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->tebusSeparuhNotTawarruq($kodcaw,$norujukan,$request); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; - $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; - $margin_kadarupah = 80; - $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; - - $upah_sebenar = $upah_asal - $rebet; - - $upah_semasa = bcdiv(round($upah_sebenar * $gadai_data['jbg'],2),1,1); - $upah_semasa = (float)number_format($upah_semasa,2); - - $array_recno_marhun = $request->array_recno; - - $margin_pembiayaan = round(($gadai_data['pinjaman']/$gadai_data['nilaimarhun'])*100,2); - - $nilai_marhun = $gadai_data['nilaimarhun']; - $total_harga_tebus = 0; - foreach($array_recno_marhun as $recno){ - $marhun = Marhun::on($cawangan['mysql'])->where([['recno','=',$recno],['norujukan','=',$norujukan]])->first(); - - $harga_tebus = ($margin_pembiayaan/100)*$marhun['n_marhun']; - - $total_harga_tebus += $harga_tebus; - } - - // $total_harga_tebus += $upah_semasa; - - return response()->json($total_harga_tebus); + return $response; } function rebet($kodcaw,$norujukan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->rebet($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; - $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; - $margin_kadarupah = 80; - - $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; - - return floatval(number_format($rebet,2)); + return $response; } function rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->rebetselepastawarruq($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - $transaction_keuntungan = TransaksiKeuntungan::on('mysql7') - ->where('norujukan','=',$norujukan) - ->sum('keuntungan_rebet'); - - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); - - $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; - // dd($gadai_data['upah12'],$transaction_keuntungan,$upah_rebet,$jeniskeuntungan,$rebet_raw); - // $rebet_round = bcdiv(round($rebet_raw,2),1,1); - // $rebet_round = number_format($rebet_round,2); - - // if(strpos($rebet_round,',')){ - // $rebet_round = str_replace(',','',$rebet_round); - // } - // $rebet = substr($rebet_round, 0, -1); - - return $rebet_raw; + return $response; } public function tebusUpdate($kodcaw,$norujukan,Request $request){ - $current = Carbon::now(); - $current = new Carbon(); + $master = new MasterServices($kodcaw); + $response = $master->tebusUpdate($kodcaw,$norujukan,$request); - $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - - if($request->jenisbayarantebus == "tawarruq"){ - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); - } - else if($request->jenisbayarantebus == "nottawarruq") - { - $rebet = $this->rebet($kodcaw,$norujukan); - } - else{ - $rebet = 0; - } - - $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - - $ujrah=0;$onepercent=0;$rounded=0; - if($gadai['hargajualan'] == null){ - $harga_tebus = $this->hargaTebusNotTawarruq($kodcaw,$norujukan); - $upah_tebus = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); - $upah_rebet = 0; - $upah_rebet_sebenar = 0; - }else{ - $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); - $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); - $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); - $upah_rebet_sebenar = $harga_tebus['harga'] - $gadai['bakipjm']; - - if($request->jeniskeuntungan == 'onepercent'){ - $array_onepercent = $this->kiraupahUjrahOnePercent($kodcaw,$norujukan); - $array_onepercent_rebet = $this->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); - $margin_semasa = ($gadai['bakipjm']/$gadai['nilaimarhun']) * 100; - $ujrah = $array_onepercent['ujrah']; - $onepercent = $array_onepercent['onepercent']; - } - } - - - $create_tebus = Tebus::on($cawangan['mysql'])->create([ - 'kodcaw'=> $kodcaw, - 'norujukan'=> $norujukan, - 'nopelanggan' => $request->nopelanggan, - 'jenisbyr' => "TN", - 'jenistebus' => $request->jenistebus, - 'glcode' => "0", - 't_tebus' => $current->toDateString(), - 'jbg' => $gadai['tempoh'], - 'kadarupah' => $gadai['kadarupah'], - 'nilaimarhun' => $gadai['nilaimarhun'], - 'pinjaman' => $gadai['pinjaman'], - 'ansuran' => 0.00, - 'addpinjaman' => $request->addpinjaman, - 'bakipjm' => $harga_tebus['harga'], - 'bakiupah' => $upah_tebus, - 'terima' => "*", - 'kodgl' => "0", - 'nowakil' => $request->nowakil, - 'rebate' => $rebet, - 'marhuntebus' => $request->marhun, - 'historygadaian' => $norujukan, - 'tarikhbyrn' => $current->toDateString(), - 'teller' => $request->teller, - 'ujrah' => $ujrah, - 'onepercent' => $onepercent, - ]); - - $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ - 'tarikh' => $current->toDateString(), - 'masa' => $current->toTimeString(), - 'norujukan' => $norujukan, - 'nm' => $request->nilai_marhun, - 'pkd' => $request->teller, - 'drp' => $request->teller, - 'bln' => $current->month, - 'thn' => $current->year, - 'tag' => 0, - 'jenistebus' => $request->jenistebus, - 'namateller' => $request->teller - ]); - - $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ - 'norujukan' => $norujukan, - 'bayaran_keuntungan' => $upah_tebus, - 'bayaran_pembiayaan' => $gadai['bakipjm'], - 'keuntungan_rebet' => $upah_rebet_sebenar, - 'tarikh_bayaran'=> $current, - 'kodcaw'=> $kodcaw, - 'ujrah' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['ujrah'] : 0, - 'ujrah_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['ujrah'] : 0, - 'onepercent' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['onepercent'] : 0, - 'onepercent_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['onepercent'] : 0, - 'margin_semasa' => ($request->jeniskeuntungan == 'onepercent') ? $margin_semasa : 0, - 'tempoh' => $gadai['tempoh'], - 'beza_tempoh' => ($gadai['tempoh'] - $gadai['tempohbayar']), - 'rounded' => $harga_tebus['rounded'], - ]); - - if($request->jenistebus == 'P'){ - $baki_hargajualan = $gadai['bakihargajualan'] - $request->bakiupah; - $transaction = Transaction::on('mysql7')->create([ - 'trans_type' => $request->jenistebus, - 'norujukan' => $norujukan, - 'nokp' => $gadai['nokp'], - 'teller' => $request->teller, - 'kodcaw' => $kodcaw, - 'duit_masuk' => $request->bakiupah, - 'created_at' => $current, - 'bakiharga' => $baki_hargajualan, - ]); - }else{ - $baki_hargajualan = $gadai['bakihargajualan'] - $request->bakipinjaman; - $transaction = Transaction::on('mysql7')->create([ - 'trans_type' => $request->jenistebus, - 'norujukan' => $norujukan, - 'nokp' => $gadai['nokp'], - 'teller' => $request->teller, - 'kodcaw' => $kodcaw, - 'duit_masuk' => $harga_tebus['harga'], - 'created_at' => $current, - 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil, - 'duitpelanggan' => isset($request->duitpelanggan) ? $request->duitpelanggan : 0, - 'bakipelanggan' => $request->bakipelanggan - ]); - } - - $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'sttebus' => "T", - 't_update' => $current->toDateString(), - )); - - $audit = new Audit(); - $audit->users = $request->teller; - if($request->jenistebus == 'P'){ - $audit->actions = "Tambah Pembiayaan"; - }else if($request->jenistebus == 'S'){ - $audit->actions = "Tebus Separuh"; - }else if($request->jenistebus == 'T'){ - $audit->actions = "Tebus Penuh"; - } - $audit->norujukan = $norujukan; - $audit->new_data = $create_tebus; - $audit->kodcaw = $kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); - - return response()->json($update_gadai, 201); + return $response; } public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,Request $request){ - $current = Carbon::now(); - $current = new Carbon(); + $master = new MasterServices($kodcaw); + $response = $master->tebusUpdateAutoTawarruq($kodcaw,$norujukan,$request); - $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - - if($request->jenisbayarantebus == "tawarruq") - { - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); - } - else if($request->jenisbayarantebus == "nottawarruq") - { - $rebet = $this->rebet($kodcaw,$norujukan); - } - else{ - $rebet = 0; - } - - $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - - $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'sttebus' => "T", - 't_update' => $current->toDateString(), - )); - - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$request->jeniskeuntungan); - - $create_tebus = Tebus::on($cawangan['mysql'])->create([ - 'kodcaw'=> $kodcaw, - 'norujukan'=> $norujukan, - 'nopelanggan' => $request->nopelanggan, - 'jenisbyr' => "TN", - 'jenistebus' => $request->jenistebus, - 'glcode' => "0", - 't_tebus' => $current->toDateString(), - 'jbg' => $request->jbg, - 'kadarupah' => $request->kadarupah, - 'nilaimarhun' => $request->nilai_marhun, - 'pinjaman' => $request->pinjaman, - 'ansuran' => $request->ansuran, - 'addpinjaman' => $request->addpinjaman, - 'bakipjm' => $request->bakipinjaman, - 'bakiupah' => $request->bakiupah, - 'terima' => "*", - 'kodgl' => "0", - 'nowakil' => $request->nowakil, - 'rebate' => $rebet, - 'marhuntebus' => $request->marhun, - 'historygadaian' => $request->historygadaian, - 'tarikhbyrn' => $current->toDateString(), - 'teller' => $request->teller - ]); - - $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ - 'tarikh' => $current->toDateString(), - 'masa' => $current->toTimeString(), - 'norujukan' => $norujukan, - 'nm' => $request->nilai_marhun, - 'pkd' => $request->teller, - 'drp' => $request->teller, - 'bln' => $current->month, - 'thn' => $current->year, - 'tag' => 0, - 'jenistebus' => $request->jenistebus, - 'namateller' => $request->teller - ]); - - $bayaran_pembiayaan = $request->totalbayaran - $request->bakiupah; - - $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ - 'norujukan' => $norujukan, - 'bayaran_keuntungan' => $request->bakiupah, - 'bayaran_pembiayaan' => $bayaran_pembiayaan, - 'keuntungan_rebet' => 0, - 'tarikh_bayaran'=> $current, - 'kodcaw'=> $kodcaw - ]); - - $transaction = Transaction::on('mysql7')->create([ - 'trans_type' => $request->jenistebus, - 'norujukan' => $norujukan, - 'nokp' => $gadai['nokp'], - 'teller' => $request->teller, - 'kodcaw' => $kodcaw, - 'duit_masuk' => $request->totalbayaran, - 'created_at' => $current, - 'bakiharga' => 0, - 'duitpelanggan' => $request->bayaranpelanggan, - 'bakipelanggan' => $request->bakipelanggan - ]); - - $audit = new Audit(); - $audit->users = $request->teller; - $audit->actions = "Auto Tawarruq"; - $audit->norujukan = $norujukan; - $audit->new_data = $create_tebus; - $audit->kodcaw = $kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); - - return response()->json($update_gadai, 201); + return $response; } public function getLaporanTebus($kodcaw,$tarikh){ @@ -2103,7 +1557,7 @@ class TebusController extends Controller return response(0); } - public function removeUpahLamaToday($kodcaw,$norujukan) + public function removeUpahLamaToday($kodcaw,$norujukan,Request $request) { $current = Carbon::now(); $current = new Carbon(); @@ -2383,95 +1837,17 @@ class TebusController extends Controller } public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ - $onepercentservices = new OnePercentServices(); - - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->kiraupahUjrahOnePercent($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - $ujrah = $bilang_bln * $array_upah['ujrah']; - $onepercent = $bilang_bln * $array_upah['onepercent']; - $onepercent_semasa = $onepercent; - $ujrah_semasa = $ujrah; - - // $ujrah_semasa_round = number_format($ujrah,2); - // if(strpos($ujrah_semasa_round,',')){ - // $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); - // } - // $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); - // if(strpos($ujrah_semasa,',')){ - // $ujrah_semasa = str_replace(',','',$ujrah_semasa); - // } - - // $onepercent_semasa_round = number_format($onepercent,2); - // if(strpos($onepercent_semasa_round,',')){ - // $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); - // } - // $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); - // if(strpos($onepercent_semasa,',')){ - // $onepercent_semasa = str_replace(',','',$onepercent_semasa); - // } - - return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + return $response; } public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ - $onepercentservices = new OnePercentServices(); - - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + $master = new MasterServices($kodcaw); + $response = $master->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); - - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } - - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $ujrah = $bilang_bln * $array_upah['ujrah']; - $onepercent = $bilang_bln * $array_upah['onepercent']; - - $ujrah_semasa = $ujrah; - // $ujrah_semasa = round($ujrah,PHP_ROUND_HALF_UP); - // $ujrah_semasa_round = number_format($ujrah,2); - // if(strpos($ujrah_semasa_round,',')){ - // $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); - // } - // $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); - // if(strpos($ujrah_semasa,',')){ - // $ujrah_semasa = str_replace(',','',$ujrah_semasa); - // } - - $onepercent_semasa = $onepercent; - // $onepercent_semasa = round($onepercent,PHP_ROUND_HALF_UP); - // $onepercent_semasa_round = number_format($onepercent,2); - // if(strpos($onepercent_semasa_round,',')){ - // $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); - // } - // $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); - // if(strpos($onepercent_semasa,',')){ - // $onepercent_semasa = str_replace(',','',$onepercent_semasa); - // } - - return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + return $response; } diff --git a/app/Services/MasterServices.php b/app/Services/MasterServices.php new file mode 100644 index 0000000..15de4a9 --- /dev/null +++ b/app/Services/MasterServices.php @@ -0,0 +1,203 @@ +cawangan = $kodcaw; + $this->cawangan_info = $this->getInfoCawangan($kodcaw); + $this->engine = $this->getEngine($kodcaw); + } + + public function getInfoCawangan(String $kodcaw): Object{ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + return $cawangan; + } + + public function getEngine(String $kodcaw){ + if ($this->cawangan_info['version'] == 'v1') { + return new TawarruqEngine($kodcaw); + + } else if ($this->cawangan_info['version'] == 'v2') { + return new OnePercentEngine($kodcaw); + } else { + return new TawarruqEngine($kodcaw); + } + } + + /* Start Gadaian */ + public function createGadai(HttpRequest $request){ + $response = $this->engine->createGadai($request); + + return $response; + } + + public function createMarhunGadai($norujukan,HttpRequest $request){ + $response = $this->engine->createMarhunGadai($norujukan,$request); + + return $response; + } + + public function kiraUpahTawarruq($kodcaw,$norujukan){ + $response = $this->engine->getUpahSebenar($norujukan); + + return $response; + } + + public function kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan){ + if($jeniskeuntungan == 'asal'){ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->getUpahRebet($kodcaw,$norujukan); + + }else{ + $tawarruq = new OnePercentEngine($this->cawangan); + $response = $tawarruq->getUpahRebet($kodcaw,$norujukan); + } + + return $response; + } + + public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ + $response = $this->engine->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); + + return $response; + } + + /* End Gadaian */ + + /* Start Penebusan */ + + public function tebusTawarruq($kodcaw,$norujukan){ + $response = $this->engine->tebusTawarruq($kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $response = $this->engine->hargaTebusTawarruq($kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $response = $this->engine->kiraUpahRebetSebenar($kodcaw,$norujukan); + + return $response; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + if($jeniskeuntungan == 'asal'){ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + + }else{ + $tawarruq = new OnePercentEngine($this->cawangan); + $response = $tawarruq->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + } + + return $response; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + if($jeniskeuntungan == 'asal'){ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + + }else{ + $tawarruq = new OnePercentEngine($this->cawangan); + $response = $tawarruq->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + } + return $response; + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $response = $this->engine->tebusSeparuhTawarruq($kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $response = $this->engine->tebusNotTawarruq($kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $response = $this->engine->hargaTebusNotTawarruq($kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $response = $this->engine->kiraUpahNotTawarruq($kodcaw,$norujukan); + + return $response; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $response = $this->engine->upahNotTawarruq($kodcaw,$norujukan); + + return $response; + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $response = $this->engine->tebusSeparuhNotTawarruq($kodcaw,$norujukan,$request); + + return $response; + } + + function rebet($kodcaw,$norujukan){ + $response = $this->engine->rebet($kodcaw,$norujukan); + + return $response; + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + $response = $this->engine->rebetselepastawarruq($kodcaw,$norujukan); + + return $response; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $response = $this->engine->tebusUpdate($kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $response = $this->engine->tebusUpdateAutoTawarruq($kodcaw,$norujukan,$request); + + return $response; + } + + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $response = $this->engine->kiraupahUjrahOnePercent($kodcaw,$norujukan); + + return $response; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $response = $this->engine->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); + + return $response; + } + + /* End Penebusan */ + + public function test(){ + $this->engine->test(); + } + +} diff --git a/app/Services/TawarruqServices.php b/app/Services/TawarruqServices.php deleted file mode 100644 index 1905df4..0000000 --- a/app/Services/TawarruqServices.php +++ /dev/null @@ -1,16 +0,0 @@ -kodcaw = $kodcaw; + $this->cawangan_info = parent::getInfoCawangan($kodcaw); + } + + /* Start Gadaian */ + public function createGadai(HttpRequest $httpRequest){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->create($httpRequest); + + return $response; + } + + public function createMarhunGadai($norujukan,HttpRequest $httpRequest){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->createMarhun($norujukan,$httpRequest); + + return $response; + } + + public function getUpahSebenar($norujukan){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahOnePercent($this->kodcaw,$norujukan); + + return $response; + } + + public function getUpahRebet($kodcaw,$norujukan){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahRebet($this->kodcaw,$norujukan); + + return $response; + } + + public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateAnsuranKaunter($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function getKadarUjrah(HttpRequest $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); + $onePercentServices = new Calculation(); + $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); + + return $kadarujrah; + } + + public function getOnePercent(HttpRequest $request){ + $onePercentServices = new Calculation(); + $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); + + return $keuntungan; + } + + /* End Gadaian */ + + /* Start Penebusan */ + + public function tebusTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahRebetSebenar($this->kodcaw,$norujukan); + + return $response; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahRebetTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhNotTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + function rebet($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebet($this->kodcaw,$norujukan); + + return $response; + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + dd('tes'); + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdate($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdateAutoTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraupahUjrahOnePercent($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraupahUjrahOnePercentRebate($this->kodcaw,$norujukan); + + return $response; + } + + /* End Penebusan */ + + public function test(){ + echo 'onepercent'; + } +} diff --git a/app/Support/Tawarruq.php b/app/Support/Tawarruq.php new file mode 100644 index 0000000..0e8db31 --- /dev/null +++ b/app/Support/Tawarruq.php @@ -0,0 +1,172 @@ +kodcaw = $kodcaw; + $this->cawangan_info = parent::getInfoCawangan($kodcaw); + } + + /* Start Gadaian */ + public function createGadai(HttpRequest $httpRequest){ + $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->create($httpRequest); + + return $response; + } + + public function createMarhunGadai($norujukan,HttpRequest $httpRequest){ + $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->createMarhun($norujukan,$httpRequest); + + return $response; + } + + public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ + $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateAnsuranKaunter($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function getUpahSebenar($norujukan){ + $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahTawarruq($norujukan); + + return $response; + } + + public function getUpahRebet($norujukan){ + $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahRebet($norujukan); + + return $response; + } + + /* End Gadaian */ + + /* Start Penebusan */ + + public function tebusTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahRebetSebenar($this->kodcaw,$norujukan); + + return $response; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhNotTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + function rebet($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebet($this->kodcaw,$norujukan); + + return $response; + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdate($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdateAutoTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + /* End Penebusan */ + + public function test(){ + echo 'tawarruq'; + } +} diff --git a/app/Support/v1/Calculation.php b/app/Support/v1/Calculation.php new file mode 100644 index 0000000..1bb810e --- /dev/null +++ b/app/Support/v1/Calculation.php @@ -0,0 +1,14 @@ +kodcaw = $kodcaw; + $this->cawangan_info = $cawangan_info; + } + + public function create(HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $kodcaw = $this->kodcaw; + $cawangan = $this->cawangan_info; + + try{ + DB::transaction(function () use ($cawangan, $kodcaw, $request, $current) { + $gadai = Gadai::on($cawangan['mysql'])->create([ + 'kodcaw'=>$kodcaw, + 'norujukan' => $request->norujukan, + 'nopelanggan' => $request->nopelanggan, + 'nokp' => $request->nokp, + 'sirig' => $request->sirig, + 't_gadai' => $current->toDateString(), + 'sttebus' => '', + 'masa' =>$current->toTimeString() + ]); + return response()->json($gadai, 201); + }); + + + }catch(\Exception $e){ + + echo "Gadaian Gagal: " . $e->getMessage(); + } + } + + public function createMarhun($norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $t_matang = Carbon::now(); + $t_matang = new Carbon(); + $t_matang = $t_matang->addMonths(6)->subDays(1); + + $t_kontrak = Carbon::now(); + $t_kontrak = new Carbon(); + $t_kontrak = $t_kontrak->addMonths(12)->subDays(1); + + $margin_pinjam = $request->percentpinj *100; + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$request->kodcaw) + ->first(); + if($request->transaction == 'Ubah Gadai'){ + $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + } + + $bil_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->count(); + + $total_nilai_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('n_marhun'); + $total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat'); + + $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); + $tawarruqservices = new Calculation(); + + $upahcalculation = $tawarruqservices->kiraanTawarruq($request->pinjaman,$kadar_raw['kadarupdah']); + $upah1 = $upahcalculation; + $upah6 = $upah1 * 6; + $upah12 = $upah1 * 12; + + $hargajualan = $request->pinjaman + $upah12; + + $gadai = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->update(array( + 'nilaimarhun' => $total_nilai_marhun, + 'berat'=> $total_berat, + 'pinjaman' => $request->pinjaman, + 'kadarupah' => $kadar_raw['kadarupdah'], + 'marhun' => $request->marhun, + 'percentpinj' => $margin_pinjam, + 'teller' => $request->teller, + 'bakipjm' => $request->pinjaman, + 'bakiupah' => $upah6, + 'jbg' => 0.5, + 't_update' => $current->toDateString(), + 'cetak' => 0, + 'upah12' => $upah12, + 'hargajualan' => $hargajualan, + 'bakihargajualan' => $hargajualan, + 'tagserah' => 0, + 't_matang' => $t_matang, + 't_matang1' => $t_kontrak, + 'tempoh' => 0.5, + 'kuantiti' => $bil_marhun, + 'tagkomuditi' => 0, + 'upahdibayar' => 0.00, + 'tempohbayar' => 0.00, + 'lelong_tawarruq' => 1 + )); + + $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = $request->transaction; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + if($request->transaction == 'Ubah Gadai'){ + $audit->old_data = $old_data; + } + $audit->kodcaw = $request->kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return response()->json($gadai, 200); + } + + public function kiraupahTawarruq($norujukan){ + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $tawarruqservices = new Calculation(); + $keuntungan = $tawarruqservices->kiraanTawarruq($gadai_data['pinjaman'],$gadai_data['kadarupah']); + $upahsemasa_raw = $bilang_bln * $keuntungan; + + $upah_semasa_round = number_format($upahsemasa_raw,2); + $upah_semasa = substr($upah_semasa_round, 0, -1); + // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + return $upah_semasa; + } + + public function kiraUpahRebet($norujukan){ + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $tawarruqservices = new Calculation(); + $keuntungan = $tawarruqservices->kiraanTawarruq($gadai_data['pinjaman'],$gadai_data['kadarupah']); + + $upahrebet_raw = $bilang_bln * $keuntungan; + + $upah_rebet_round = number_format($upahrebet_raw,2); + $upah_rebet = substr($upah_rebet_round, 0, -1); + if(strpos($upah_rebet,',')){ + $upah_rebet = str_replace(',','',$upah_rebet); + } + // $upah_rebet = floatval(preg_replace('/[^\d.]/', '', $upah_rebet)); + + return $upah_rebet; + + } + + public function updateAnsuranKaunter($kodcaw,$norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan); + $upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan); + + $total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk'); + + $total_bayaran_semasa = $total_bayaran_prev + $request->bayaran; + + if($total_bayaran_semasa >= $gadai['bakiupah']){ + $lelong_tawarruq = 0; + }else{ + $lelong_tawarruq = 1; + } + + $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $baki_hargajualan = $gadai['bakihargajualan'] - $request->bayaran; + + $baki_bayaran = $request->bayaran - $upahsemasa; + + $baki_pinjaman = $gadai['bakipjm'] - $baki_bayaran; + + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => 'A', + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->bayaran, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + 'nowakil' => (int)$request->nowakil + ]); + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $upahsemasa, + 'bayaran_pembiayaan' => $baki_bayaran, + 'keuntungan_rebet'=> $upahrebet, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw + ]); + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'bakipjm' => $baki_pinjaman, + 'jbg' => 0, + 't_update' => $current->toDateString(), + 'bakihargajualan' => $baki_hargajualan, + 'tempohbayar' => $gadai['tempoh'], + 'lelong_tawarruq' => $lelong_tawarruq + )); + + $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = 'Bayaran Ansuran'; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + $audit->old_data = $old_data; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return response()->json($update_gadai, 200); + } + + + +} diff --git a/app/Support/v1/Penebusan.php b/app/Support/v1/Penebusan.php new file mode 100644 index 0000000..dce689d --- /dev/null +++ b/app/Support/v1/Penebusan.php @@ -0,0 +1,615 @@ +kodcaw = $kodcaw; + $this->cawangan_info = $cawangan_info; + } + + public function tebusTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + + $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; + + $hargatebus = bcdiv(round($harga_tebus,2),1,1); + $hargatebus = number_format($hargatebus,2); + if(strpos($hargatebus,',')){ + $hargatebus = str_replace(',','',$hargatebus); + } + + return response()->json($hargatebus); + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + + $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; + + $hargatebus = bcdiv(round($harga_tebus,2),1,1); + $hargatebus = number_format($hargatebus,2); + if(strpos($hargatebus,',')){ + $hargatebus = str_replace(',','',$hargatebus); + } + + return $hargatebus; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $gadai_data['tempoh'] - $gadai_data['tempohbayar']; + + $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + + // $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP); + $upah_rebet_round = number_format($upahrebet_raw,2); + if(strpos($upah_rebet_round,',')){ + $upah_rebet_round = str_replace(',','',$upah_rebet_round); + } + $upah_rebet = substr($upah_rebet_round, 0, -1); + if(strpos($upah_rebet,',')){ + $upah_rebet = str_replace(',','',$upah_rebet); + } + + $total_untung_rebet = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('keuntungan_rebet'); + $total_untung_asal = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('bayaran_keuntungan'); + $beza_keuntungan = $total_untung_asal - $total_untung_rebet; + + $keuntungan_rebet_sebenar = $upah_rebet - $beza_keuntungan; + return $keuntungan_rebet_sebenar; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $tawarruqservices = new V1Calculation(); + $keuntungan = $tawarruqservices->kiraanTawarruq($gadai_data['pinjaman'],$gadai_data['kadarupah']); + $upahsemasa_raw = $bilang_bln * $keuntungan; + + $upah_semasa_round = number_format($upahsemasa_raw,2); + $upah_semasa = substr($upah_semasa_round, 0, -1); + // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + return $upah_semasa; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + + $upah_rebet = $this->kiraUpahRebet($norujukan); + + return response()->json(number_format($upah_rebet,2)); + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + + $array_recno_marhun = $request->array_recno; + + $margin_pembiayaan = round(($gadai_data['bakipjm']/$gadai_data['nilaimarhun'])*100,2); + // $margin_pembiayaan = round(($gadai_data['bakipjm']/$request->hargasemasa)*100,2); + + $nilai_marhun = $gadai_data['nilaimarhun']; + $total_harga_tebus = 0; + foreach($array_recno_marhun as $recno){ + $marhun = Marhun::on($cawangan['mysql'])->where([['recno','=',$recno],['norujukan','=',$norujukan]])->first(); + + $harga_tebus = ($margin_pembiayaan/100)*$marhun['n_marhun']; + + $total_harga_tebus += $harga_tebus; + } + + $total_harga_tebus_round = round($total_harga_tebus,2); + + $totalhargatebus = substr($total_harga_tebus_round, 0, -1); + + return response()->json($totalhargatebus); + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_semasa = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); + + $harga_tebus = $upah_semasa + $gadai_data['pinjaman']; + + return response()->json($harga_tebus); + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_semasa = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); + + $harga_tebus = $upah_semasa + $gadai_data['pinjaman']; + + return $harga_tebus; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upahtelahbayar = Advansur::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->sum('upahdibayar'); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + $bln_mora = Moratorium::first(); + + $upah_sebenar = $upah_asal - $rebet; + $bln_upah = $gadai_data['tempoh']; + if($bln_upah > $bln_mora['bln_mora']){ + $bln_upah = $bln_mora['bln_mora']; + } + $upahsemasa = $upah_sebenar * $bln_upah; + $upah_semasa = bcdiv(round($upahsemasa,2),1,1); + $upah_semasa = number_format($upah_semasa,2); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + $upah_semasa = (float)$upah_semasa - $upahtelahbayar; + + if($upah_semasa <= 0){ + $upah_semasa = 0; + } + + return $upah_semasa; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upahtelahbayar = Advansur::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->sum('upahdibayar'); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + $bln_mora = Moratorium::first(); + + $upah_sebenar = $upah_asal - $rebet; + $bln_upah = $gadai_data['tempoh']; + if($bln_upah > $bln_mora['bln_mora']){ + $bln_upah = $bln_mora['bln_mora']; + } + $upahsemasa = $upah_sebenar * $bln_upah; + $upah_semasa = bcdiv(round($upahsemasa,2),1,1); + $upah_semasa = number_format($upah_semasa,2); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + $upah_semasa = (float)$upah_semasa - $upahtelahbayar; + + if($upah_semasa <= 0){ + $upah_semasa = 0; + } + + return response()->json($upah_semasa); + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + $upah_sebenar = $upah_asal - $rebet; + + $upah_semasa = bcdiv(round($upah_sebenar * $gadai_data['jbg'],2),1,1); + $upah_semasa = (float)number_format($upah_semasa,2); + + $array_recno_marhun = $request->array_recno; + + $margin_pembiayaan = round(($gadai_data['pinjaman']/$gadai_data['nilaimarhun'])*100,2); + + $nilai_marhun = $gadai_data['nilaimarhun']; + $total_harga_tebus = 0; + foreach($array_recno_marhun as $recno){ + $marhun = Marhun::on($cawangan['mysql'])->where([['recno','=',$recno],['norujukan','=',$norujukan]])->first(); + + $harga_tebus = ($margin_pembiayaan/100)*$marhun['n_marhun']; + + $total_harga_tebus += $harga_tebus; + } + + // $total_harga_tebus += $upah_semasa; + + return response()->json($total_harga_tebus); + } + + function rebet($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + return floatval(number_format($rebet,2)); + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $transaction_keuntungan = TransaksiKeuntungan::on('mysql7') + ->where('norujukan','=',$norujukan) + ->sum('keuntungan_rebet'); + + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + + $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; + + $rebet_round = bcdiv(round($rebet_raw,2),1,1); + $rebet_round = number_format($rebet_round,2); + + if(strpos($rebet_round,',')){ + $rebet_round = str_replace(',','',$rebet_round); + } + $rebet = substr($rebet_round, 0, -1); + + return $rebet; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + if($request->jenisbayarantebus == "tawarruq") + { + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + } + else if($request->jenisbayarantebus == "nottawarruq") + { + $rebet = $this->rebet($kodcaw,$norujukan); + } + else{ + $rebet = 0; + } + + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + if($gadai['hargajualan'] == null){ + $harga_tebus = $this->hargaTebusNotTawarruq($kodcaw,$norujukan); + $upah_tebus = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); + $upah_rebet = 0; + $upah_rebet_sebenar = 0; + }else{ + $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan); + $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); + $upah_rebet_sebenar = $harga_tebus - $gadai['bakipjm']; + } + + + $create_tebus = Tebus::on($cawangan['mysql'])->create([ + 'kodcaw'=> $kodcaw, + 'norujukan'=> $norujukan, + 'nopelanggan' => $request->nopelanggan, + 'jenisbyr' => "TN", + 'jenistebus' => $request->jenistebus, + 'glcode' => "0", + 't_tebus' => $current->toDateString(), + 'jbg' => $gadai['tempoh'], + 'kadarupah' => $gadai['kadarupah'], + 'nilaimarhun' => $gadai['nilaimarhun'], + 'pinjaman' => $gadai['pinjaman'], + 'ansuran' => 0.00, + 'addpinjaman' => $request->addpinjaman, + 'bakipjm' => $harga_tebus, + 'bakiupah' => $upah_tebus, + 'terima' => "*", + 'kodgl' => "0", + 'nowakil' => $request->nowakil, + 'rebate' => $rebet, + 'marhuntebus' => $request->marhun, + 'historygadaian' => $norujukan, + 'tarikhbyrn' => $current->toDateString(), + 'teller' => $request->teller + ]); + + $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ + 'tarikh' => $current->toDateString(), + 'masa' => $current->toTimeString(), + 'norujukan' => $norujukan, + 'nm' => $request->nilai_marhun, + 'pkd' => $request->teller, + 'drp' => $request->teller, + 'bln' => $current->month, + 'thn' => $current->year, + 'tag' => 0, + 'jenistebus' => $request->jenistebus, + 'namateller' => $request->teller + ]); + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $upah_tebus, + 'bayaran_pembiayaan' => $gadai['bakipjm'], + 'keuntungan_rebet' => $upah_rebet_sebenar, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw + ]); + + if($request->jenistebus == 'P'){ + $baki_hargajualan = $gadai['bakihargajualan'] - $request->bakiupah; + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => $request->jenistebus, + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->bakiupah, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + ]); + }else{ + $baki_hargajualan = $gadai['bakihargajualan'] - $request->bakipinjaman; + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => $request->jenistebus, + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $harga_tebus, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + 'nowakil' => (int)$request->nowakil + ]); + } + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'sttebus' => "T", + 't_update' => $current->toDateString(), + )); + + $audit = new Audit(); + $audit->users = $request->teller; + if($request->jenistebus == 'P'){ + $audit->actions = "Tambah Pembiayaan"; + }else if($request->jenistebus == 'S'){ + $audit->actions = "Tebus Separuh"; + }else if($request->jenistebus == 'T'){ + $audit->actions = "Tebus Penuh"; + } + $audit->norujukan = $norujukan; + $audit->new_data = $create_tebus; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return response()->json($update_gadai, 201); + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + if($request->jenisbayarantebus == "tawarruq") + { + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + } + else if($request->jenisbayarantebus == "nottawarruq") + { + $rebet = $this->rebet($kodcaw,$norujukan); + } + else{ + $rebet = 0; + } + + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'sttebus' => "T", + 't_update' => $current->toDateString(), + )); + + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + + $create_tebus = Tebus::on($cawangan['mysql'])->create([ + 'kodcaw'=> $kodcaw, + 'norujukan'=> $norujukan, + 'nopelanggan' => $request->nopelanggan, + 'jenisbyr' => "TN", + 'jenistebus' => $request->jenistebus, + 'glcode' => "0", + 't_tebus' => $current->toDateString(), + 'jbg' => $request->jbg, + 'kadarupah' => $request->kadarupah, + 'nilaimarhun' => $request->nilai_marhun, + 'pinjaman' => $request->pinjaman, + 'ansuran' => $request->ansuran, + 'addpinjaman' => $request->addpinjaman, + 'bakipjm' => $request->bakipinjaman, + 'bakiupah' => $request->bakiupah, + 'terima' => "*", + 'kodgl' => "0", + 'nowakil' => $request->nowakil, + 'rebate' => $rebet, + 'marhuntebus' => $request->marhun, + 'historygadaian' => $request->historygadaian, + 'tarikhbyrn' => $current->toDateString(), + 'teller' => $request->teller + ]); + + $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ + 'tarikh' => $current->toDateString(), + 'masa' => $current->toTimeString(), + 'norujukan' => $norujukan, + 'nm' => $request->nilai_marhun, + 'pkd' => $request->teller, + 'drp' => $request->teller, + 'bln' => $current->month, + 'thn' => $current->year, + 'tag' => 0, + 'jenistebus' => $request->jenistebus, + 'namateller' => $request->teller + ]); + + $bayaran_pembiayaan = $request->totalbayaran - $request->bakiupah; + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $request->bakiupah, + 'bayaran_pembiayaan' => $bayaran_pembiayaan, + 'keuntungan_rebet' => 0, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw + ]); + + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => $request->jenistebus, + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->totalbayaran, + 'created_at' => $current, + 'bakiharga' => 0, + ]); + + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = "Auto Tawarruq"; + $audit->norujukan = $norujukan; + $audit->new_data = $create_tebus; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return response()->json($update_gadai, 201); + } +} \ No newline at end of file diff --git a/app/Services/OnePercentServices.php b/app/Support/v2/Calculation.php similarity index 74% rename from app/Services/OnePercentServices.php rename to app/Support/v2/Calculation.php index afce9d0..a6cd427 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Support/v2/Calculation.php @@ -1,15 +1,18 @@ = 0 && $lastDigit <= 2) { + if(strpos($rounded,',')){ + $rounded = str_replace(',','',$rounded); + } + return $rounded; + } elseif ($lastDigit >= 3 && $lastDigit <= 7) { + $rounded = $rounded . '5'; + if(strpos($rounded,',')){ + $rounded = str_replace(',','',$rounded); + } + return $rounded; + } else { + return round($number,PHP_ROUND_HALF_UP); + } + } + + /* End of Line Calculation */ + + + + + + + + } diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php new file mode 100644 index 0000000..fc0ae87 --- /dev/null +++ b/app/Support/v2/GadaiV2.php @@ -0,0 +1,330 @@ +kodcaw = $kodcaw; + $this->cawangan_info = $cawangan_info; + } + + public function create(HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $kodcaw = $this->kodcaw; + $cawangan = $this->cawangan_info; + try{ + DB::transaction(function () use ($cawangan, $kodcaw, $request, $current) { + $gadai = Gadai::on($cawangan['mysql'])->create([ + 'kodcaw'=>$kodcaw, + 'norujukan' => $request->norujukan, + 'nopelanggan' => $request->nopelanggan, + 'nokp' => $request->nokp, + 'sirig' => $request->sirig, + 't_gadai' => $current->toDateString(), + 'sttebus' => '', + 'masa' =>$current->toTimeString(), + 'tagbaru' => 1 + ]); + return response()->json($gadai, 201); + }); + + + }catch(\Exception $e){ + + echo "Gadaian Gagal: " . $e->getMessage(); + } + } + + public function createMarhun($norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $t_matang = Carbon::now(); + $t_matang = new Carbon(); + $t_matang = $t_matang->addMonths(6)->subDays(1); + + $t_kontrak = Carbon::now(); + $t_kontrak = new Carbon(); + $t_kontrak = $t_kontrak->addMonths(12)->subDays(1); + + $margin_pinjam = $request->percentpinj *100; + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$request->kodcaw) + ->first(); + if($request->transaction == 'Ubah Gadai'){ + $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + } + + $bil_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->count(); + + $total_nilai_marhun = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('n_marhun'); + $total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat'); + + //query kadar upah baru + $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawangan['group_id'])->first(); + + + // query kadar upah lama + // $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); + + $onepercentservices = new Calculation(); + $keuntungan = $onepercentservices->kiraanKeuntunganSebenar($request->pinjaman,$total_nilai_marhun,$kadar_raw['kadarujrah'],$margin_pinjam); + // $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); + // $upah6 = $upah1 * 6; + // $upah12 = $upah1 * 12; + $upah1 = $keuntungan['keuntungan']; + $upah6 = $upah1 * 6; + $upah12 = $upah1 * 12; + $ujrah = $keuntungan['ujrah']; + $onepercent = $keuntungan['onepercent']; + + $hargajualan = $request->pinjaman + $upah12; + + $gadai = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->update(array( + 'nilaimarhun' => $total_nilai_marhun, + 'berat'=> $total_berat, + 'pinjaman' => $request->pinjaman, + 'kadarupah' => $kadar_raw['kadarujrah'], + 'marhun' => $request->marhun, + 'percentpinj' => $margin_pinjam, + 'teller' => $request->teller, + 'bakipjm' => $request->pinjaman, + 'bakiupah' => $upah6, + 'jbg' => 0.5, + 't_update' => $current->toDateString(), + 'cetak' => 0, + 'upah12' => $upah12, + 'hargajualan' => $hargajualan, + 'bakihargajualan' => $hargajualan, + 'tagserah' => 0, + 't_matang' => $t_matang, + 't_matang1' => $t_kontrak, + 'tempoh' => 0.5, + 'kuantiti' => $bil_marhun, + 'tagkomuditi' => 0, + 'upahdibayar' => 0.00, + 'tempohbayar' => 0.00, + 'lelong_tawarruq' => 1, + 'kadarujrah' => $kadar_raw['kadarujrah'], + 'ujrah' => $ujrah, + 'onepercent' => $onepercent, + 'margin_semasa' => $margin_pinjam, + 'tagbaru' => 1 + )); + + $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = $request->transaction; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + if($request->transaction == 'Ubah Gadai'){ + $audit->old_data = $old_data; + } + $audit->kodcaw = $request->kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return 'true'; + } + + public function kiraupahOnePercent($norujukan){ + $onepercentservices = new Calculation(); + + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); + + return $upahsemasa_raw; + } + + public function kiraupahRebet($kodcaw,$norujukan){ + $onepercentservices = new Calculation(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$this->kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; + $upahrebet_raw = $onepercentservices->getRoundedMethod($upahrebet_raw); + + return $upahrebet_raw; + } + + public function updateAnsuranKaunter($kodcaw,$norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $upahsemasa = $this->kiraupahOnePercent($kodcaw,$norujukan); + $upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan); + + $total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk'); + + $total_bayaran_semasa = $total_bayaran_prev + $request->bayaran; + + if($total_bayaran_semasa >= $gadai['bakiupah']){ + $lelong_tawarruq = 0; + }else{ + $lelong_tawarruq = 1; + } + $onepercent = new Calculation(); + + $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $baki_hargajualan = $gadai['bakihargajualan'] - $request->bayaran; + + $baki_bayaran = $request->bayaran - $upahsemasa; + + $baki_pinjaman = $gadai['bakipjm'] - $baki_bayaran; + + $margin_semasa = ($gadai['bakipjm'] / $gadai['nilaimarhun']) * 100; + + $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); + $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['margin_semasa']); + + $onepercentasal = $gadai['pinjaman'] * (1/100); + + try { + + DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { + + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => 'A', + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->bayaran, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => $request->duitpelanggan, + 'bakipelanggan' => $request->bakipelanggan + ]); + + if($gadai['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai['tempoh']; + } + $bilang_bln = $tempoh - $gadai['tempohbayar']; + + $rounded = $upahsemasa - (($keuntungan['ujrah'] * $bilang_bln) + ($onepercentasal * $bilang_bln)); + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $upahsemasa, + 'bayaran_pembiayaan' => $baki_bayaran, + 'keuntungan_rebet'=> $upahrebet, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw, + 'ujrah' => ($keuntungan['ujrah'] * $bilang_bln), + 'ujrah_rebet' => ($ujrahasal*$bilang_bln), + 'onepercent' => ($onepercentasal * $bilang_bln), + 'onepercent_rebet' => ($keuntungan['onepercent'] * $bilang_bln), + 'tempoh' => $gadai['tempoh'], + 'beza_tempoh' => $bilang_bln, + 'margin_semasa' => $margin_semasa, + 'rounded' => $rounded, + ]); + + DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ + + $margin_updated = ($baki_pinjaman / $gadai['nilaimarhun']) * 100; + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'bakipjm' => $baki_pinjaman, + 'jbg' => 0, + 't_update' => $current->toDateString(), + 'bakihargajualan' => $baki_hargajualan, + 'tempohbayar' => $gadai['tempoh'], + 'lelong_tawarruq' => $lelong_tawarruq, + 'margin_semasa' => $margin_updated, + )); + }); + + $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = 'Bayaran Ansuran'; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + $audit->old_data = $old_data; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + if(!$transaction || !$transaction_upah) { + throw new \Exception('One of the database operations failed.'); + } + + DB::commit(); + + }); + }catch(\Exception $e){ + Log::error("Transaction failed: " . $e->getMessage()); + return response()->json("Transaction failed: " . $e->getMessage(),500); + } + + return response()->json("success",200); + } + + +} + diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php new file mode 100644 index 0000000..3a3ac48 --- /dev/null +++ b/app/Support/v2/Penebusan.php @@ -0,0 +1,728 @@ +kodcaw = $kodcaw; + $this->cawangan_info = $cawangan_info; + } + + public function tebusTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $jeniskeuntungan = ($gadai_data['tagbaru'] == 1) ? 'onepercent' : 'asal'; + + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); + $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; + + // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); + $hargatebus = bcdiv(round($harga_tebus,2),1,1); + $hargatebus = number_format($hargatebus,2); + if(strpos($hargatebus,',')){ + $hargatebus = str_replace(',','',$hargatebus); + } + return response()->json($hargatebus); + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + + $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; + + // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); + $hargatebus = bcdiv(round($harga_tebus,2),1,1); + $hargatebus = number_format($hargatebus,2); + if(strpos($hargatebus,',')){ + $hargatebus = str_replace(',','',$hargatebus); + } + + $rounded = $hargatebus - $harga_tebus; + Log::info([$harga_tebus,$rebet]); + $arrayharga = ['harga' => $hargatebus, 'rounded' => $rounded]; + + return $arrayharga; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $gadai_data['tempoh'] - $gadai_data['tempohbayar']; + + $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + + // $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP); + $upah_rebet_round = number_format($upahrebet_raw,2); + if(strpos($upah_rebet_round,',')){ + $upah_rebet_round = str_replace(',','',$upah_rebet_round); + } + $upah_rebet = substr($upah_rebet_round, 0, -1); + if(strpos($upah_rebet,',')){ + $upah_rebet = str_replace(',','',$upah_rebet); + } + + $total_untung_rebet = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('keuntungan_rebet'); + $total_untung_asal = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('bayaran_keuntungan'); + $beza_keuntungan = $total_untung_asal - $total_untung_rebet; + + $keuntungan_rebet_sebenar = $upah_rebet - $beza_keuntungan; + return $keuntungan_rebet_sebenar; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $onepercentservices = new Calculation(); + + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); + + return $upahsemasa_raw; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + + $onepercentservices = new Calculation(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$this->kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; + $upahrebet_raw = $onepercentservices->getRoundedMethod($upahrebet_raw); + + return $upahrebet_raw; + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + + $array_recno_marhun = $request->array_recno; + + $margin_pembiayaan = round(($gadai_data['bakipjm']/$gadai_data['nilaimarhun'])*100,2); + // $margin_pembiayaan = round(($gadai_data['bakipjm']/$request->hargasemasa)*100,2); + + $nilai_marhun = $gadai_data['nilaimarhun']; + $total_harga_tebus = 0; + foreach($array_recno_marhun as $recno){ + $marhun = Marhun::on($cawangan['mysql'])->where([['recno','=',$recno],['norujukan','=',$norujukan]])->first(); + + $harga_tebus = ($margin_pembiayaan/100)*$marhun['n_marhun']; + + $total_harga_tebus += $harga_tebus; + } + + $total_harga_tebus_round = round($total_harga_tebus,2); + + $totalhargatebus = substr($total_harga_tebus_round, 0, -1); + + return response()->json($totalhargatebus); + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_semasa = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); + + $harga_tebus = $upah_semasa + $gadai_data['pinjaman']; + + return response()->json($harga_tebus); + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_semasa = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); + + $harga_tebus = $upah_semasa + $gadai_data['pinjaman']; + + return $harga_tebus; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upahtelahbayar = Advansur::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->sum('upahdibayar'); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + $bln_mora = Moratorium::first(); + + $upah_sebenar = $upah_asal - $rebet; + $bln_upah = $gadai_data['tempoh']; + if($bln_upah > $bln_mora['bln_mora']){ + $bln_upah = $bln_mora['bln_mora']; + } + $upahsemasa = $upah_sebenar * $bln_upah; + $upah_semasa = bcdiv(round($upahsemasa,2),1,1); + $upah_semasa = number_format($upah_semasa,2); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + $upah_semasa = (float)$upah_semasa - $upahtelahbayar; + + if($upah_semasa <= 0){ + $upah_semasa = 0; + } + + return $upah_semasa; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upahtelahbayar = Advansur::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->sum('upahdibayar'); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + $bln_mora = Moratorium::first(); + + $upah_sebenar = $upah_asal - $rebet; + $bln_upah = $gadai_data['tempoh']; + if($bln_upah > $bln_mora['bln_mora']){ + $bln_upah = $bln_mora['bln_mora']; + } + $upahsemasa = $upah_sebenar * $bln_upah; + $upah_semasa = bcdiv(round($upahsemasa,2),1,1); + $upah_semasa = number_format($upah_semasa,2); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + $upah_semasa = (float)$upah_semasa - $upahtelahbayar; + + if($upah_semasa <= 0){ + $upah_semasa = 0; + } + + return response()->json($upah_semasa); + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + $upah_sebenar = $upah_asal - $rebet; + + $upah_semasa = bcdiv(round($upah_sebenar * $gadai_data['jbg'],2),1,1); + $upah_semasa = (float)number_format($upah_semasa,2); + + $array_recno_marhun = $request->array_recno; + + $margin_pembiayaan = round(($gadai_data['pinjaman']/$gadai_data['nilaimarhun'])*100,2); + + $nilai_marhun = $gadai_data['nilaimarhun']; + $total_harga_tebus = 0; + foreach($array_recno_marhun as $recno){ + $marhun = Marhun::on($cawangan['mysql'])->where([['recno','=',$recno],['norujukan','=',$norujukan]])->first(); + + $harga_tebus = ($margin_pembiayaan/100)*$marhun['n_marhun']; + + $total_harga_tebus += $harga_tebus; + } + + // $total_harga_tebus += $upah_semasa; + + return response()->json($total_harga_tebus); + } + + function rebet($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $upah_asal = $gadai_data['nilaimarhun'] / 100 * $gadai_data['kadarupah']; + $margin_pinjaman = $gadai_data['pinjaman'] / $gadai_data['nilaimarhun'] * 100; + $margin_kadarupah = 80; + + $rebet = ($margin_kadarupah-$margin_pinjaman)/$margin_kadarupah * $upah_asal; + + return floatval(number_format($rebet,2)); + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + $transaction_keuntungan = TransaksiKeuntungan::on('mysql7') + ->where('norujukan','=',$norujukan) + ->sum('keuntungan_rebet'); + + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + + $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; + + return $rebet_raw; + } + + public function kiraupahRebet($kodcaw,$norujukan){ + $onepercentservices = new Calculation(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$this->kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; + $upahrebet_raw = $onepercentservices->getRoundedMethod($upahrebet_raw); + + return $upahrebet_raw; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + if($request->jenisbayarantebus == "tawarruq"){ + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + } + else if($request->jenisbayarantebus == "nottawarruq") + { + $rebet = $this->rebet($kodcaw,$norujukan); + } + else{ + $rebet = 0; + } + + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $ujrah=0;$onepercent=0;$rounded=0; + if($gadai['hargajualan'] == null){ + $harga_tebus = $this->hargaTebusNotTawarruq($kodcaw,$norujukan); + $upah_tebus = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); + $upah_rebet = 0; + $upah_rebet_sebenar = 0; + }else{ + $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); + $upah_rebet_sebenar = $harga_tebus['harga'] - $gadai['bakipjm']; + + if($request->jeniskeuntungan == 'onepercent'){ + $array_onepercent = $this->kiraupahUjrahOnePercent($kodcaw,$norujukan); + $array_onepercent_rebet = $this->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); + $margin_semasa = ($gadai['bakipjm']/$gadai['nilaimarhun']) * 100; + $ujrah = $array_onepercent['ujrah']; + $onepercent = $array_onepercent['onepercent']; + } + } + + + $create_tebus = Tebus::on($cawangan['mysql'])->create([ + 'kodcaw'=> $kodcaw, + 'norujukan'=> $norujukan, + 'nopelanggan' => $request->nopelanggan, + 'jenisbyr' => "TN", + 'jenistebus' => $request->jenistebus, + 'glcode' => "0", + 't_tebus' => $current->toDateString(), + 'jbg' => $gadai['tempoh'], + 'kadarupah' => $gadai['kadarupah'], + 'nilaimarhun' => $gadai['nilaimarhun'], + 'pinjaman' => $gadai['pinjaman'], + 'ansuran' => 0.00, + 'addpinjaman' => $request->addpinjaman, + 'bakipjm' => $harga_tebus['harga'], + 'bakiupah' => $upah_tebus, + 'terima' => "*", + 'kodgl' => "0", + 'nowakil' => $request->nowakil, + 'rebate' => $rebet, + 'marhuntebus' => $request->marhun, + 'historygadaian' => $norujukan, + 'tarikhbyrn' => $current->toDateString(), + 'teller' => $request->teller, + 'ujrah' => $ujrah, + 'onepercent' => $onepercent, + ]); + + $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ + 'tarikh' => $current->toDateString(), + 'masa' => $current->toTimeString(), + 'norujukan' => $norujukan, + 'nm' => $request->nilai_marhun, + 'pkd' => $request->teller, + 'drp' => $request->teller, + 'bln' => $current->month, + 'thn' => $current->year, + 'tag' => 0, + 'jenistebus' => $request->jenistebus, + 'namateller' => $request->teller + ]); + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $upah_tebus, + 'bayaran_pembiayaan' => $gadai['bakipjm'], + 'keuntungan_rebet' => $upah_rebet_sebenar, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw, + 'ujrah' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['ujrah'] : 0, + 'ujrah_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['ujrah'] : 0, + 'onepercent' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['onepercent'] : 0, + 'onepercent_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['onepercent'] : 0, + 'margin_semasa' => ($request->jeniskeuntungan == 'onepercent') ? $margin_semasa : 0, + 'tempoh' => $gadai['tempoh'], + 'beza_tempoh' => ($gadai['tempoh'] - $gadai['tempohbayar']), + 'rounded' => $harga_tebus['rounded'], + ]); + + if($request->jenistebus == 'P'){ + $baki_hargajualan = $gadai['bakihargajualan'] - $request->bakiupah; + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => $request->jenistebus, + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->bakiupah, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + ]); + }else{ + $baki_hargajualan = $gadai['bakihargajualan'] - $request->bakipinjaman; + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => $request->jenistebus, + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $harga_tebus['harga'], + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => isset($request->duitpelanggan) ? $request->duitpelanggan : 0, + 'bakipelanggan' => $request->bakipelanggan + ]); + } + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'sttebus' => "T", + 't_update' => $current->toDateString(), + )); + + $audit = new Audit(); + $audit->users = $request->teller; + if($request->jenistebus == 'P'){ + $audit->actions = "Tambah Pembiayaan"; + }else if($request->jenistebus == 'S'){ + $audit->actions = "Tebus Separuh"; + }else if($request->jenistebus == 'T'){ + $audit->actions = "Tebus Penuh"; + } + $audit->norujukan = $norujukan; + $audit->new_data = $create_tebus; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return response()->json($update_gadai, 201); + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + if($request->jenisbayarantebus == "tawarruq") + { + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + } + else if($request->jenisbayarantebus == "nottawarruq") + { + $rebet = $this->rebet($kodcaw,$norujukan); + } + else{ + $rebet = 0; + } + + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'sttebus' => "T", + 't_update' => $current->toDateString(), + )); + + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$request->jeniskeuntungan); + + $create_tebus = Tebus::on($cawangan['mysql'])->create([ + 'kodcaw'=> $kodcaw, + 'norujukan'=> $norujukan, + 'nopelanggan' => $request->nopelanggan, + 'jenisbyr' => "TN", + 'jenistebus' => $request->jenistebus, + 'glcode' => "0", + 't_tebus' => $current->toDateString(), + 'jbg' => $request->jbg, + 'kadarupah' => $request->kadarupah, + 'nilaimarhun' => $request->nilai_marhun, + 'pinjaman' => $request->pinjaman, + 'ansuran' => $request->ansuran, + 'addpinjaman' => $request->addpinjaman, + 'bakipjm' => $request->bakipinjaman, + 'bakiupah' => $request->bakiupah, + 'terima' => "*", + 'kodgl' => "0", + 'nowakil' => $request->nowakil, + 'rebate' => $rebet, + 'marhuntebus' => $request->marhun, + 'historygadaian' => $request->historygadaian, + 'tarikhbyrn' => $current->toDateString(), + 'teller' => $request->teller + ]); + + $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ + 'tarikh' => $current->toDateString(), + 'masa' => $current->toTimeString(), + 'norujukan' => $norujukan, + 'nm' => $request->nilai_marhun, + 'pkd' => $request->teller, + 'drp' => $request->teller, + 'bln' => $current->month, + 'thn' => $current->year, + 'tag' => 0, + 'jenistebus' => $request->jenistebus, + 'namateller' => $request->teller + ]); + + $bayaran_pembiayaan = $request->totalbayaran - $request->bakiupah; + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $request->bakiupah, + 'bayaran_pembiayaan' => $bayaran_pembiayaan, + 'keuntungan_rebet' => 0, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw + ]); + + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => $request->jenistebus, + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->totalbayaran, + 'created_at' => $current, + 'bakiharga' => 0, + 'duitpelanggan' => $request->bayaranpelanggan, + 'bakipelanggan' => $request->bakipelanggan + ]); + + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = "Auto Tawarruq"; + $audit->norujukan = $norujukan; + $audit->new_data = $create_tebus; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + return response()->json($update_gadai, 201); + } + + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $onepercentservices = new Calculation(); + + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + $onepercent_semasa = $onepercent; + $ujrah_semasa = $ujrah; + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $onepercentservices = new Calculation(); + + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + + return ['ujrah' => $ujrah, 'onepercent' => $onepercent]; + } + + +} \ No newline at end of file diff --git a/database/factories/GadaiFactory.php b/database/factories/GadaiFactory.php index c9a3c5c..6ca8d29 100644 --- a/database/factories/GadaiFactory.php +++ b/database/factories/GadaiFactory.php @@ -17,10 +17,10 @@ class GadaiFactory return [ 'kodcaw' => 'KB2', - 'norujukan' => ($number > 9) ? 'KB2231123-00' . $number : 'KB2231123-000' . $number , + 'norujukan' => ($number > 9) ? 'KB2231207-00' . $number : 'KB2231207-000' . $number , 'nopelanggan' => 'M03-00009968', 'nokp' => '630411035213', - 't_gadai' => '2023-11-23', + 't_gadai' => '2023-12-07', 'masa' => '13:46:57', 'sirig' => $number++, 'nilaimarhun' => 3000.09, diff --git a/database/factories/MarhunFactory.php b/database/factories/MarhunFactory.php index ecad2f6..5945000 100644 --- a/database/factories/MarhunFactory.php +++ b/database/factories/MarhunFactory.php @@ -19,7 +19,7 @@ class MarhunFactory 'kodcaw' => 'KB2', 'marhun' => 'R/L', 't_gadai' => '2023-11-23', - 'norujukan' => ($number > 9) ? 'KB2231123-00' . $number : 'KB2231123-000' . $number , + 'norujukan' => ($number > 9) ? 'KB2231207-00' . $number : 'KB2231207-000' . $number , 'bil' => 1, 'nota' => $number++, 'karat' => '24.0K', diff --git a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php index bd8661e..f22210a 100644 --- a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php +++ b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php @@ -62,7 +62,7 @@ class AddOnepercentToGadaiTable extends Migration $db_connection = $this->getActiveDB(); foreach($db_connection as $dbase){ - if (Schema::connection('mysql7')->hasColumn('ujrah', 'onepercent')){ + if (Schema::connection('mysql7')->hasColumn('kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru')){ Schema::connection($dbase)->table('gadai', function (Blueprint $table) { $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru']); }); diff --git a/database/migrations/2023_12_08_151908_add_version_to_arrahn_master_db_table.php b/database/migrations/2023_12_08_151908_add_version_to_arrahn_master_db_table.php new file mode 100644 index 0000000..03a9ac9 --- /dev/null +++ b/database/migrations/2023_12_08_151908_add_version_to_arrahn_master_db_table.php @@ -0,0 +1,34 @@ +char('version', 4)->default($value); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('arrahn_master_db', function (Blueprint $table) { + $table->dropColumn(['version']); + }); + } +} diff --git a/tinker/getOnePercent.php b/tinker/getOnePercent.php index b050fb0..5c0671b 100644 --- a/tinker/getOnePercent.php +++ b/tinker/getOnePercent.php @@ -1,14 +1,11 @@ getTotalKeuntungan('B'); -$test2 = $report->getTotalUjrah('B'); - - -dd($test,$test2); +use App\Services\MasterServices; +use App\Support\v2\Calculation; + $test2 = new Calculation(); + $test = new MasterServices('KB2'); + // $response = $test->kiraUpahTawarruq('KB2231207-0004'); + $response = 'tes'; +dd($response); From fb8b82c8972cdf4f8c69f6d10a7162a71b778cfa Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 11 Dec 2023 09:50:21 +0800 Subject: [PATCH 002/114] separation pasal version1 and version2 fix upah xdetect --- app/Http/Controllers/GadaiController.php | 4 +- app/Http/Controllers/TebusController.php | 16 ++++-- app/Services/MasterServices.php | 55 +++++++++++++------- app/Support/Onepercent.php | 2 +- app/Support/Tawarruq.php | 4 +- app/Support/v1/GadaiV1.php | 8 +-- app/Support/v1/Penebusan.php | 65 ++++++++++++++++++++++-- app/Support/v2/Calculation.php | 6 +++ app/Support/v2/GadaiV2.php | 2 - app/Support/v2/Penebusan.php | 44 ++++++++++++---- database/factories/GadaiFactory.php | 6 +-- database/factories/MarhunFactory.php | 4 +- routes/web.php | 4 +- tinker/getOnePercent.php | 4 +- 14 files changed, 171 insertions(+), 53 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 16b7687..1caccd0 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -303,8 +303,8 @@ class GadaiController extends Controller } public function updateGadaiMarhunKaunter($kodcaw,$norujukan,Request $request){ - $onePercentServices = new Onepercent($request->kodcaw); - $update = $onePercentServices->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); + $master = new MasterServices($request->kodcaw); + $update = $master->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); return $update; } diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index e93f393..5d17ab3 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -46,13 +46,16 @@ use Carbon\Carbon; class TebusController extends Controller { public function tebusTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $tagbaru = Gadai::on($cawangan['mysql'])->where('norujukan',$norujukan)->pluck('tagbaru'); + $jeniskeuntungan = ($tagbaru[0] == 0) ? 'asal' : 'onepercent'; $master = new MasterServices($kodcaw); - $response = $master->tebusTawarruq($kodcaw,$norujukan); + $response = $master->tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan); return $response; } - public function hargaTebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + public function hargaTebusTawarruq($kodcaw,$norujukan){ $master = new MasterServices($kodcaw); $response = $master->hargaTebusTawarruq($kodcaw,$norujukan); @@ -66,7 +69,8 @@ class TebusController extends Controller return $response; } - public function kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan){ + public function kiraUpahRebet($kodcaw,$norujukan,Request $request){ + $jeniskeuntungan = ($request->jeniskeuntungan == 'onepercent') ? 'onepercent' : 'asal'; $master = new MasterServices($kodcaw); $response = $master->kiraupahRebet($kodcaw,$norujukan,$jeniskeuntungan); @@ -80,14 +84,16 @@ class TebusController extends Controller return $response; } - public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + public function upahTawarruq($kodcaw,$norujukan,Request $request){ + $jeniskeuntungan = ($request->jeniskeuntungan == 'onepercent') ? 'onepercent' : 'asal'; $master = new MasterServices($kodcaw); $response = $master->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); return $response; } - public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + public function upahRebetTawarruq($kodcaw,$norujukan,Request $request){ + $jeniskeuntungan = ($request->jeniskeuntungan == 'onepercent') ? 'onepercent' : 'asal'; $master = new MasterServices($kodcaw); $response = $master->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); diff --git a/app/Services/MasterServices.php b/app/Services/MasterServices.php index 15de4a9..0df8790 100644 --- a/app/Services/MasterServices.php +++ b/app/Services/MasterServices.php @@ -57,12 +57,12 @@ class MasterServices } public function kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan){ - if($jeniskeuntungan == 'asal'){ - $tawarruq = new TawarruqEngine($this->cawangan); - $response = $tawarruq->getUpahRebet($kodcaw,$norujukan); + if($jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->getUpahRebet($kodcaw,$norujukan); }else{ - $tawarruq = new OnePercentEngine($this->cawangan); + $tawarruq = new TawarruqEngine($this->cawangan); $response = $tawarruq->getUpahRebet($kodcaw,$norujukan); } @@ -79,9 +79,16 @@ class MasterServices /* Start Penebusan */ - public function tebusTawarruq($kodcaw,$norujukan){ - $response = $this->engine->tebusTawarruq($kodcaw,$norujukan); + public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + if($jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + }else{ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + + } return $response; } @@ -98,12 +105,11 @@ class MasterServices } public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - if($jeniskeuntungan == 'asal'){ - $tawarruq = new TawarruqEngine($this->cawangan); - $response = $tawarruq->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); - + if($jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); }else{ - $tawarruq = new OnePercentEngine($this->cawangan); + $tawarruq = new TawarruqEngine($this->cawangan); $response = $tawarruq->upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); } @@ -111,13 +117,13 @@ class MasterServices } public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - if($jeniskeuntungan == 'asal'){ + if($jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); + }else{ $tawarruq = new TawarruqEngine($this->cawangan); $response = $tawarruq->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); - }else{ - $tawarruq = new OnePercentEngine($this->cawangan); - $response = $tawarruq->upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan); } return $response; } @@ -171,13 +177,28 @@ class MasterServices } public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ - $response = $this->engine->tebusUpdate($kodcaw,$norujukan,$request); + + if($request->jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->tebusUpdate($kodcaw,$norujukan,$request); + + }else{ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->tebusUpdate($kodcaw,$norujukan,$request); + } return $response; } public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $response = $this->engine->tebusUpdateAutoTawarruq($kodcaw,$norujukan,$request); + if($request->jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->tebusUpdateAutoTawarruq($kodcaw,$norujukan,$request); + + }else{ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->tebusUpdateAutoTawarruq($kodcaw,$norujukan,$request); + } return $response; } diff --git a/app/Support/Onepercent.php b/app/Support/Onepercent.php index 9969899..69a0f32 100644 --- a/app/Support/Onepercent.php +++ b/app/Support/Onepercent.php @@ -75,7 +75,7 @@ class OnePercent extends MasterServices /* Start Penebusan */ - public function tebusTawarruq($kodcaw,$norujukan){ + public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); diff --git a/app/Support/Tawarruq.php b/app/Support/Tawarruq.php index 0e8db31..aff1913 100644 --- a/app/Support/Tawarruq.php +++ b/app/Support/Tawarruq.php @@ -59,9 +59,9 @@ class Tawarruq extends MasterServices /* Start Penebusan */ - public function tebusTawarruq($kodcaw,$norujukan){ + public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); + $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); return $response; } diff --git a/app/Support/v1/GadaiV1.php b/app/Support/v1/GadaiV1.php index 2ee2999..08c54cb 100644 --- a/app/Support/v1/GadaiV1.php +++ b/app/Support/v1/GadaiV1.php @@ -143,9 +143,9 @@ class GadaiV1 ->first(); if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; + $tempoh = 12; }else{ - $tempoh = $gadai_data['tempoh']; + $tempoh = $gadai_data['tempoh']; } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; @@ -199,8 +199,8 @@ class GadaiV1 $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan); - $upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upahsemasa = $this->kiraupahTawarruq($norujukan); + $upahrebet = $this->kiraUpahRebet($norujukan); $total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk'); diff --git a/app/Support/v1/Penebusan.php b/app/Support/v1/Penebusan.php index dce689d..c4f2fb7 100644 --- a/app/Support/v1/Penebusan.php +++ b/app/Support/v1/Penebusan.php @@ -23,7 +23,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use PDO; -class Penebusan extends Tawarruq +class Penebusan { protected $kodcaw; protected $cawangan_info; @@ -77,6 +77,65 @@ class Penebusan extends Tawarruq return $hargatebus; } + public function kiraupahTawarruq($kodcaw,$norujukan){ + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + + $upah_semasa_round = number_format($upahsemasa_raw,2); + if(strpos($upah_semasa_round,',')){ + $upah_semasa_round = str_replace(',','',$upah_semasa_round); + } + $upah_semasa = substr($upah_semasa_round, 0, -1); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + + return $upah_semasa; + } + + public function kiraUpahRebet($norujukan){ + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + + $upah_rebet_round = number_format($upahrebet_raw,2); + if(strpos($upah_rebet_round,',')){ + $upah_rebet_round = str_replace(',','',$upah_rebet_round); + } + $upah_rebet = substr($upah_rebet_round, 0, -1); + if(strpos($upah_rebet,',')){ + $upah_rebet = str_replace(',','',$upah_rebet); + } + + return $upah_rebet; + } + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) @@ -363,7 +422,7 @@ class Penebusan extends Tawarruq ->where('norujukan','=',$norujukan) ->sum('keuntungan_rebet'); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($norujukan); $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; @@ -536,7 +595,7 @@ class Penebusan extends Tawarruq 't_update' => $current->toDateString(), )); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($norujukan); $create_tebus = Tebus::on($cawangan['mysql'])->create([ 'kodcaw'=> $kodcaw, diff --git a/app/Support/v2/Calculation.php b/app/Support/v2/Calculation.php index a6cd427..4b3d3cc 100644 --- a/app/Support/v2/Calculation.php +++ b/app/Support/v2/Calculation.php @@ -60,6 +60,9 @@ class Calculation $onepercent = $this->kiraanOnePercent($pembiayaan); $ujrah_sebenar = $this->kiraanUjrahSebenar($nilaimarhun,$kadarujrah,$margin); + $onepercent = $this->getRoundedMethod($onepercent); + $ujrah_sebenar = $this->getRoundedMethod($ujrah_sebenar); + $keuntungan = $onepercent + $ujrah_sebenar; return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; @@ -70,6 +73,9 @@ class Calculation $onepercent = $this->kiraanOnePercent($pembiayaan); $ujrah_sebenar = $this->kiraanUjrah($nilaimarhun,$kadarujrah,$margin); + $onepercent = $this->getRoundedMethod($onepercent); + $ujrah_sebenar = $this->getRoundedMethod($ujrah_sebenar); + $keuntungan = $onepercent + $ujrah_sebenar; return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php index fc0ae87..cbea893 100644 --- a/app/Support/v2/GadaiV2.php +++ b/app/Support/v2/GadaiV2.php @@ -263,7 +263,6 @@ class GadaiV2 } $bilang_bln = $tempoh - $gadai['tempohbayar']; - $rounded = $upahsemasa - (($keuntungan['ujrah'] * $bilang_bln) + ($onepercentasal * $bilang_bln)); $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ 'norujukan' => $norujukan, @@ -279,7 +278,6 @@ class GadaiV2 'tempoh' => $gadai['tempoh'], 'beza_tempoh' => $bilang_bln, 'margin_semasa' => $margin_semasa, - 'rounded' => $rounded, ]); DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index 3a3ac48..3ce5167 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -77,9 +77,7 @@ class Penebusan $hargatebus = str_replace(',','',$hargatebus); } - $rounded = $hargatebus - $harga_tebus; - Log::info([$harga_tebus,$rebet]); - $arrayharga = ['harga' => $hargatebus, 'rounded' => $rounded]; + $arrayharga = ['harga' => $hargatebus]; return $arrayharga; } @@ -139,9 +137,15 @@ class Penebusan $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + $keuntungan_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['onepercent']); + $ujrah_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['ujrah']); $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); - return $upahsemasa_raw; + $array_upah = ['pendapatan' => $upahsemasa_raw, + 'keuntungan' => $keuntungan_semasa, + 'ujrah' => $ujrah_semasa]; + + return $array_upah; } public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ @@ -171,6 +175,29 @@ class Penebusan return $upahrebet_raw; } + public function kiraupahTawarruq($norujukan){ + $onepercentservices = new Calculation(); + + $cawangan = $this->cawangan_info; + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); + + return $upahsemasa_raw; +} + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ $cawangan = Cawangan::on('mysql7') @@ -181,7 +208,7 @@ class Penebusan ->where('norujukan','=',$norujukan) ->first(); - $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $upahsemasa = $this->kiraupahTawarruq($norujukan); $array_recno_marhun = $request->array_recno; @@ -446,7 +473,7 @@ class Penebusan $upah_rebet_sebenar = 0; }else{ $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); - $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $upah_tebus = $this->kiraupahTawarruq($norujukan); $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); $upah_rebet_sebenar = $harga_tebus['harga'] - $gadai['bakipjm']; @@ -516,7 +543,6 @@ class Penebusan 'margin_semasa' => ($request->jeniskeuntungan == 'onepercent') ? $margin_semasa : 0, 'tempoh' => $gadai['tempoh'], 'beza_tempoh' => ($gadai['tempoh'] - $gadai['tempohbayar']), - 'rounded' => $harga_tebus['rounded'], ]); if($request->jenistebus == 'P'){ @@ -580,7 +606,7 @@ class Penebusan if($request->jenisbayarantebus == "tawarruq") { - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); } else if($request->jenisbayarantebus == "nottawarruq") { @@ -597,7 +623,7 @@ class Penebusan 't_update' => $current->toDateString(), )); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$request->jeniskeuntungan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); $create_tebus = Tebus::on($cawangan['mysql'])->create([ 'kodcaw'=> $kodcaw, diff --git a/database/factories/GadaiFactory.php b/database/factories/GadaiFactory.php index 6ca8d29..8a951aa 100644 --- a/database/factories/GadaiFactory.php +++ b/database/factories/GadaiFactory.php @@ -17,10 +17,10 @@ class GadaiFactory return [ 'kodcaw' => 'KB2', - 'norujukan' => ($number > 9) ? 'KB2231207-00' . $number : 'KB2231207-000' . $number , + 'norujukan' => ($number > 9) ? 'KB2231211-00' . $number : 'KB2231211-000' . $number , 'nopelanggan' => 'M03-00009968', 'nokp' => '630411035213', - 't_gadai' => '2023-12-07', + 't_gadai' => '2023-12-11', 'masa' => '13:46:57', 'sirig' => $number++, 'nilaimarhun' => 3000.09, @@ -53,7 +53,7 @@ class GadaiFactory 'upahdibayar' => 0.00, 'marhun' => '1 R/L,', 'taglel' => null, - 't_update' => '2023-11-23', + 't_update' => '2023-12-11', 't_matang' => '2024-06-24', 't_matang1' => '2024-06-24', 'penilai' => 'MOHD KHALID ABDUL RAHMAN', diff --git a/database/factories/MarhunFactory.php b/database/factories/MarhunFactory.php index 5945000..4aca234 100644 --- a/database/factories/MarhunFactory.php +++ b/database/factories/MarhunFactory.php @@ -18,8 +18,8 @@ class MarhunFactory return [ 'kodcaw' => 'KB2', 'marhun' => 'R/L', - 't_gadai' => '2023-11-23', - 'norujukan' => ($number > 9) ? 'KB2231207-00' . $number : 'KB2231207-000' . $number , + 't_gadai' => '2023-12-11', + 'norujukan' => ($number > 9) ? 'KB2231211-00' . $number : 'KB2231211-000' . $number , 'bil' => 1, 'nota' => $number++, 'karat' => '24.0K', diff --git a/routes/web.php b/routes/web.php index 65f5c39..ee44873 100644 --- a/routes/web.php +++ b/routes/web.php @@ -106,8 +106,8 @@ $router->group(['prefix'=>'api'], function () use ($router){ //Tebus API $router->get('tebustawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusTawarruq']); - $router->get('upahtawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahTawarruq']); - $router->get('upahrebettawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahRebetTawarruq']); + $router->get('upahtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahTawarruq']); + $router->get('upahrebettawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahRebetTawarruq']); $router->get('tebusseparuhtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhTawarruq']); $router->get('tebusseparuhbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhNotTawarruq']); $router->get('tebusbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusNotTawarruq']); diff --git a/tinker/getOnePercent.php b/tinker/getOnePercent.php index 5c0671b..965da66 100644 --- a/tinker/getOnePercent.php +++ b/tinker/getOnePercent.php @@ -3,9 +3,11 @@ use App\Services\MasterServices; use App\Support\v2\Calculation; + $number = 1456.50; $test2 = new Calculation(); $test = new MasterServices('KB2'); // $response = $test->kiraUpahTawarruq('KB2231207-0004'); + $testrounded = $test2->getRoundedMethod($number); $response = 'tes'; -dd($response); + dd($testrounded); From 60d04ef8895104568ee4bdf278c56ee15bed6d4c Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 11 Dec 2023 11:12:27 +0800 Subject: [PATCH 003/114] fix ansuran tak boleh bayar --- app/Support/v2/GadaiV2.php | 6 +++--- app/Support/v2/Penebusan.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php index cbea893..4e03a5b 100644 --- a/app/Support/v2/GadaiV2.php +++ b/app/Support/v2/GadaiV2.php @@ -176,7 +176,7 @@ class GadaiV2 return $upahsemasa_raw; } - public function kiraupahRebet($kodcaw,$norujukan){ + public function kiraupahRebet($norujukan){ $onepercentservices = new Calculation(); $cawangan = Cawangan::on('mysql7') @@ -209,8 +209,8 @@ class GadaiV2 $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - $upahsemasa = $this->kiraupahOnePercent($kodcaw,$norujukan); - $upahrebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upahsemasa = $this->kiraupahOnePercent($norujukan); + $upahrebet = $this->kiraUpahRebet($norujukan); $total_bayaran_prev = Transaction::on('mysql7')->where([['norujukan','=',$norujukan],['trans_type','=','A']])->sum('duit_masuk'); diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index 3ce5167..87845af 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -691,7 +691,7 @@ class Penebusan $audit = new Audit(); $audit->users = $request->teller; - $audit->actions = "Auto Tawarruq"; + $audit->actions = "Pembiayaan Semula"; $audit->norujukan = $norujukan; $audit->new_data = $create_tebus; $audit->kodcaw = $kodcaw; From 72bc3b10c3a8ed768d31b250b1069b64803f49b3 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 11 Dec 2023 17:09:11 +0800 Subject: [PATCH 004/114] tambah route onepercent dan ujrah untuk arrahnbid --- app/Http/Controllers/LelongController.php | 61 +++++++++++++++++++++++ routes/web.php | 3 ++ 2 files changed, 64 insertions(+) diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index bdd3c82..4204a37 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -29,6 +29,7 @@ use App\Pembeli; use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use App\Services\RingkasanHarianServices; +use App\Services\OnePercentServices; use Log; use DB; @@ -1607,6 +1608,66 @@ class LelongController extends Controller } + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + $onepercent_semasa = $onepercent; + $ujrah_semasa = $ujrah; + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + + // $rounded_ujrah = round(($ujrah*100)/5,0)*5/100; + $ujrah_semasa = $ujrah; + + // $rounded_onepercent = round(($onepercent*100)/5,0)*5/100; + $onepercent_semasa = $onepercent; + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + + diff --git a/routes/web.php b/routes/web.php index 65f5c39..41805ff 100644 --- a/routes/web.php +++ b/routes/web.php @@ -798,7 +798,10 @@ $router->group(['prefix'=>'admin'], function () use ($router){ }); $router->group(['prefix'=>'lelong'], function () use ($router){ + $router->get('upahtawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahTawarruq']); $router->get('upahrebettawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahRebetTawarruq']); + $router->get('kiraupahUjrahOnePercent/{kodcaw}/{norujukan}',['uses'=>'LelongController@kiraupahUjrahOnePercent']); + $router->get('kiraupahUjrahOnePercentRebate/{kodcaw}/{norujukan}',['uses'=>'LelongController@kiraupahUjrahOnePercentRebate']); $router->post('taglel/update',['uses'=>'GadaiController@updateTagLelong']); $router->post('taglel/revert',['uses'=>'GadaiController@revertTagLelong']); $router->post('exportLelong',['uses'=>'LelongController@exportLelong']); From 52dec60f45cfc8c84638e1cf240260b86f2bbbb0 Mon Sep 17 00:00:00 2001 From: Amir Date: Tue, 12 Dec 2023 09:15:34 +0800 Subject: [PATCH 005/114] add get request for kadar ujrah --- app/Http/Controllers/GadaiController.php | 9 +++++++++ routes/web.php | 1 + 2 files changed, 10 insertions(+) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 8008bb7..0fd0c6c 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -3881,6 +3881,15 @@ class GadaiController extends Controller return $kadarujrah; } + public function getKadarUjrahByGroupId(Request $request) + { + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->select('kodcaw', 'mysql', 'group_id')->first(); + + $kadar_ujrah = KadarUpah::where('group_id', $cawangan->group_id)->get(); + + return $kadar_ujrah; + } + public function getOnePercent(Request $request){ $onePercentServices = new OnePercentServices(); diff --git a/routes/web.php b/routes/web.php index 41805ff..187f1d0 100644 --- a/routes/web.php +++ b/routes/web.php @@ -589,6 +589,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ //One Percent $router->get('kadarujrah',['uses' => 'GadaiController@getKadarUjrah']); $router->post('onepercent',['uses' => 'GadaiController@getOnePercent']); + $router->get('kadarujrah/by_group_id',['uses' => 'GadaiController@getKadarUjrahByGroupId']); //STOKAUDITKHAS $router->get('stokauditkhas/aktif/{kodcaw}',['uses'=>'StokAuditController@LaporanAuditKhasAktif']); From c999d2688694e19f83b7294632b6c6ac1f1744cc Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 8 Nov 2023 14:52:20 +0800 Subject: [PATCH 006/114] create nad update gadai table migration and add services class for one percent --- app/Console/Commands/TestOnePercent.php | 54 ++++++++++++++++ app/Console/Kernel.php | 2 + app/Services/OnePercentServices.php | 50 +++++++++++++++ ...8_115215_add_onepercent_to_gadai_table.php | 64 +++++++++++++++++++ ...143916_create_history_onepercent_table.php | 36 +++++++++++ 5 files changed, 206 insertions(+) create mode 100644 app/Console/Commands/TestOnePercent.php create mode 100644 app/Services/OnePercentServices.php create mode 100644 database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php create mode 100644 database/migrations/2023_11_08_143916_create_history_onepercent_table.php diff --git a/app/Console/Commands/TestOnePercent.php b/app/Console/Commands/TestOnePercent.php new file mode 100644 index 0000000..5d8af0a --- /dev/null +++ b/app/Console/Commands/TestOnePercent.php @@ -0,0 +1,54 @@ +onepercentserv = $onepercentserv; + parent::__construct(); + } + + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { + $pemb = $this->ask('Pembiayaan?'); + $nm = $this->ask('Nilaimarhun?'); + $ku = $this->ask('Kadarujrah?'); + $marg = $this->ask('Margin?'); + + $test = $this->onepercentserv->kiraanKeuntunganSebenar($pemb,$nm,$ku,$marg); + + dd($test); + return $test; + } +} \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d5b505a..e18917f 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -18,6 +18,8 @@ class Kernel extends ConsoleKernel */ protected $commands = [ Commands\DailyGadai::class, + Commands\TestOnePercent::class, + ]; /** diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php new file mode 100644 index 0000000..271d316 --- /dev/null +++ b/app/Services/OnePercentServices.php @@ -0,0 +1,50 @@ += 1){ + return; + } + + $ujrah = ($kadarujrah/100) * $nilaimarhun; + $formula_margin = ($this->maks_margin - $margin) / $this->maks_margin; + $ujrah_margin = $formula_margin * $kadarujrah; + $rebate_ujrah = $nilaimarhun*($ujrah_margin/100); + $ujrah_sebenar = $ujrah - $rebate_ujrah; + + return $ujrah_sebenar; + } + + private function kiraanOnePercent(float $pembiayaan = 0.0){ + + //periksa adakah pembiayaan adalah null atau kosong. + if($pembiayaan == 0 || $pembiayaan == null) + return; + + $onepercent = ($this->one_percent/100) * $pembiayaan; + + + return $onepercent; + } + + public function kiraanKeuntunganSebenar(float $pembiayaan = 0.0,float $nilaimarhun = 0.0,float $kadarujrah = 0.0,float $margin = 0.0){ + + $onepercent = $this->kiraanOnePercent($pembiayaan); + $ujrah_sebenar = $this->kiraanUjrah($nilaimarhun,$kadarujrah,$margin); + + $keuntungan = $onepercent + $ujrah_sebenar; + + return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; + } +} diff --git a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php new file mode 100644 index 0000000..0a346ee --- /dev/null +++ b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php @@ -0,0 +1,64 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) { + $table->decimal('kadarujrah', 5, 2); + $table->decimal('ujrah', 9, 2); + $table->decimal('onepercent', 9, 2); + $table->decimal('margin_semasa', 5, 2); + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) { + // $table->dropColumn('votes'); + $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa']); + }); + } + } +} diff --git a/database/migrations/2023_11_08_143916_create_history_onepercent_table.php b/database/migrations/2023_11_08_143916_create_history_onepercent_table.php new file mode 100644 index 0000000..9854de5 --- /dev/null +++ b/database/migrations/2023_11_08_143916_create_history_onepercent_table.php @@ -0,0 +1,36 @@ +id(); + $table->decimal('tempoh', 10, 2); + $table->decimal('ujrah', 10, 2); + $table->decimal('onepercent', 10, 2); + $table->decimal('margin_semasa', 5, 2); + $table->decimal('bakipinjaman', 10, 2); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('history_onepercent'); + } +} From e44bdca389503877bc5eb266b86a9aa8994b1ddd Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 9 Nov 2023 01:31:59 +0800 Subject: [PATCH 007/114] update when storing gadai data for one percent --- app/Http/Controllers/GadaiController.php | 111 +++++++++++++----- app/Services/OnePercentServices.php | 9 +- ...0612_add_onepercent_to_kadarupah_table.php | 33 ++++++ routes/web.php | 6 + 4 files changed, 129 insertions(+), 30 deletions(-) create mode 100644 database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 3503945..8c26e0b 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -32,8 +32,9 @@ use App\InOutMar; use Illuminate\Http\Request; +use App\Services\OnePercentServices; -use DB; +use Illuminate\Support\Facades\DB; use Carbon\Carbon; @@ -132,17 +133,27 @@ class GadaiController extends Controller $current = new Carbon(); $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $gadai = Gadai::on($cawangan['mysql'])->create([ - 'kodcaw'=>$kodcaw, - 'norujukan' => $request->norujukan, - 'nopelanggan' => $request->nopelanggan, - 'nokp' => $request->nokp, - 'sirig' => $request->sirig, - 't_gadai' => $current->toDateString(), - 'sttebus' => '', - 'masa' =>$current->toTimeString() - ]); - return response()->json($gadai, 201); + + try{ + DB::transaction(function () use ($cawangan, $kodcaw, $request, $current) { + $gadai = Gadai::on($cawangan['mysql'])->create([ + 'kodcaw'=>$kodcaw, + 'norujukan' => $request->norujukan, + 'nopelanggan' => $request->nopelanggan, + 'nokp' => $request->nokp, + 'sirig' => $request->sirig, + 't_gadai' => $current->toDateString(), + 'sttebus' => '', + 'masa' =>$current->toTimeString() + ]); + return response()->json($gadai, 201); + }); + + + }catch(\Exception $e){ + + echo "Gadaian Gagal: " . $e->getMessage(); + } } public function createold($kodcaw,Request $request){ @@ -235,9 +246,17 @@ class GadaiController extends Controller $total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat'); $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); - $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); + + $onepercentservices = new OnePercentServices(); + $keuntungan = $onepercentservices->kiraanKeuntunganSebenar($request->pinjaman,$total_nilai_marhun,$kadar_raw['kadarujrah'],$margin_pinjam); + // $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); + // $upah6 = $upah1 * 6; + // $upah12 = $upah1 * 12; + $upah1 = $keuntungan['keuntungan']; $upah6 = $upah1 * 6; $upah12 = $upah1 * 12; + $ujrah = $keuntungan['ujrah']; + $onepercent = $keuntungan['onepercent']; $hargajualan = $request->pinjaman + $upah12; @@ -247,7 +266,7 @@ class GadaiController extends Controller 'nilaimarhun' => $total_nilai_marhun, 'berat'=> $total_berat, 'pinjaman' => $request->pinjaman, - 'kadarupah' => $kadar_raw['kadarupdah'], + 'kadarupah' => $kadar_raw['kadarujrah'], 'marhun' => $request->marhun, 'percentpinj' => $margin_pinjam, 'teller' => $request->teller, @@ -267,23 +286,27 @@ class GadaiController extends Controller 'tagkomuditi' => 0, 'upahdibayar' => 0.00, 'tempohbayar' => 0.00, - 'lelong_tawarruq' => 1 + 'lelong_tawarruq' => 1, + 'kadarujrah' => $kadar_raw['kadarujrah'], + 'ujrah' => $ujrah, + 'onepercent' => $onepercent, + 'margin_semasa' => $margin_pinjam, )); $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - $audit = new Audit(); - $audit->users = $request->teller; - $audit->actions = $request->transaction; - $audit->norujukan = $norujukan; - $audit->new_data = $new_data; - if($request->transaction == 'Ubah Gadai'){ - $audit->old_data = $old_data; - } - $audit->kodcaw = $request->kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); + // $audit = new Audit(); + // $audit->users = $request->teller; + // $audit->actions = $request->transaction; + // $audit->norujukan = $norujukan; + // $audit->new_data = $new_data; + // if($request->transaction == 'Ubah Gadai'){ + // $audit->old_data = $old_data; + // } + // $audit->kodcaw = $request->kodcaw; + // $audit->created_at = $current; + // $audit->updated_at = $current; + // $audit->save(); return response()->json($gadai, 200); } @@ -313,6 +336,9 @@ class GadaiController extends Controller } public function kiraupahTawarruq($kodcaw,$norujukan){ + + $onepercentservices = new OnePercentServices(); + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -328,7 +354,9 @@ class GadaiController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; $upah_semasa_round = number_format($upahsemasa_raw,2); $upah_semasa = substr($upah_semasa_round, 0, -1); @@ -340,6 +368,8 @@ class GadaiController extends Controller } public function kiraUpahRebet($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -355,7 +385,10 @@ class GadaiController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + + // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; $upah_rebet_round = number_format($upahrebet_raw,2); $upah_rebet = substr($upah_rebet_round, 0, -1); @@ -3627,4 +3660,24 @@ class GadaiController extends Controller return response()->json('success'); } + + public function getKadarUjrah(Request $request){ + + $onePercentServices = new OnePercentServices(); + + $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun); + + $test = $this->kiraupahTawarruq('KB2','KB2231109-0001'); + dd($test); + return $kadarujrah; + } + + public function getOnePercent(Request $request){ + + $onePercentServices = new OnePercentServices(); + + $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); + + return $keuntungan; + } } diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index 271d316..b917724 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -2,7 +2,7 @@ namespace App\Services; - +use App\KadarUpah; class OnePercentServices { @@ -47,4 +47,11 @@ class OnePercentServices return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; } + + public function getKadarUjrah(float $nilaimarhun = 0.0) : Float{ + + $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->get()->toArray(); + + return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0; + } } diff --git a/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php b/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php new file mode 100644 index 0000000..e7cb116 --- /dev/null +++ b/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php @@ -0,0 +1,33 @@ +table('kadarupah', function (Blueprint $table) { + $table->decimal('kadarujrah', 5, 2); + $table->decimal('kadaronepercent', 5, 2); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) { + $table->dropColumn(['kadarujrah', 'kadaronepercent']); + }); + } +} diff --git a/routes/web.php b/routes/web.php index 2cd035c..7250486 100644 --- a/routes/web.php +++ b/routes/web.php @@ -573,6 +573,12 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('backup/stok/audit',['uses'=>'BackupStokAuditController@backupStokAudit']); $router->get('backup/stok/audit/problem',['uses'=>'BackupStokAuditController@backupStokAuditProblem']); $router->get('stokaudit/backdate',['uses'=>'BackupStokAuditController@LaporanAuditBackdate']); + + + //One Percent + $router->get('kadarujrah',['uses' => 'GadaiController@getKadarUjrah']); + $router->post('onepercent',['uses' => 'GadaiController@getOnePercent']); + }); $router->group(['prefix'=>'e-arrahn'], function () use ($router){ From dd2958894acb6404c06773af0594585514f85f24 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 14 Nov 2023 16:07:13 +0800 Subject: [PATCH 008/114] fix database migration --- ...8_115215_add_onepercent_to_gadai_table.php | 10 ++- ...0612_add_onepercent_to_kadarupah_table.php | 3 +- ...ercent_to_transaction_keuntungan_table.php | 38 +++++++++++ ...1_104203_add_onepercent_to_tebus_table.php | 65 +++++++++++++++++++ 4 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php create mode 100644 database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php diff --git a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php index 0a346ee..3262f74 100644 --- a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php +++ b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php @@ -13,6 +13,12 @@ class AddOnepercentToGadaiTable extends Migration * @return void */ + /** + * + * @var object $db_connection + */ + + public function getActiveDB(){ $config_db = array_keys(config("database.connections")); @@ -40,6 +46,7 @@ class AddOnepercentToGadaiTable extends Migration $table->decimal('ujrah', 9, 2); $table->decimal('onepercent', 9, 2); $table->decimal('margin_semasa', 5, 2); + $table->tinyInteger('tagbaru')->default(0); }); } @@ -56,8 +63,7 @@ class AddOnepercentToGadaiTable extends Migration foreach($db_connection as $dbase){ Schema::connection($dbase)->table('gadai', function (Blueprint $table) { - // $table->dropColumn('votes'); - $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa']); + $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru']); }); } } diff --git a/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php b/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php index e7cb116..022542c 100644 --- a/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php +++ b/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php @@ -27,7 +27,8 @@ class AddOnepercentToKadarupahTable extends Migration public function down() { Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) { - $table->dropColumn(['kadarujrah', 'kadaronepercent']); + $table->dropColumn(['kadarujrah','kadaronepercent']); + }); } } diff --git a/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php b/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php new file mode 100644 index 0000000..59d4036 --- /dev/null +++ b/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php @@ -0,0 +1,38 @@ +table('transaksi_keuntungan', function (Blueprint $table) { + $table->decimal('ujrah', 5, 2); + $table->decimal('ujrah_rebet', 5, 2); + $table->decimal('onepercent', 5, 2); + $table->decimal('onepercent_rebet', 5, 2); + $table->decimal('tempoh', 5, 2); + $table->decimal('beza_tempoh', 5, 2); + $table->decimal('margin_semasa', 5, 2); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) { + $table->dropColumn(['ujrah', 'ujrah_rebet', 'onepercent', 'onepercent_rebet', 'tempoh', 'beza_tempoh', 'margin_semasa']); + }); + } +} diff --git a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php new file mode 100644 index 0000000..8b09cc0 --- /dev/null +++ b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php @@ -0,0 +1,65 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; +} + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('tebus', function (Blueprint $table) { + $table->decimal('ujrah', 9, 2); + $table->decimal('onepercent', 9, 2); + }); + }; + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('tebus', function (Blueprint $table) { + $table->dropColumn(['ujrah', 'onepercent']); + }); + } + } +} From 265cae8a896c8f408f751d0d266857ca6869b2c6 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 14 Nov 2023 16:08:42 +0800 Subject: [PATCH 009/114] added onepercent to gadai and ansuran --- app/Http/Controllers/GadaiController.php | 132 +++++++++++++++-------- app/Http/Controllers/TebusController.php | 14 ++- app/Services/OnePercentServices.php | 14 +++ app/TransaksiKeuntungan.php | 2 +- 4 files changed, 113 insertions(+), 49 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 8c26e0b..b017e23 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -144,7 +144,8 @@ class GadaiController extends Controller 'sirig' => $request->sirig, 't_gadai' => $current->toDateString(), 'sttebus' => '', - 'masa' =>$current->toTimeString() + 'masa' =>$current->toTimeString(), + 'tagbaru' => 1 ]); return response()->json($gadai, 201); }); @@ -336,7 +337,6 @@ class GadaiController extends Controller } public function kiraupahTawarruq($kodcaw,$norujukan){ - $onepercentservices = new OnePercentServices(); $cawangan = Cawangan::on('mysql7') @@ -354,7 +354,7 @@ class GadaiController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; @@ -385,7 +385,7 @@ class GadaiController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); $upahrebet_raw = $bilang_bln * $upah['keuntungan']; @@ -474,6 +474,7 @@ class GadaiController extends Controller }else{ $lelong_tawarruq = 1; } + $onepercent = new OnePercentServices(); $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); @@ -483,50 +484,91 @@ class GadaiController extends Controller $baki_pinjaman = $gadai['bakipjm'] - $baki_bayaran; - $transaction = Transaction::on('mysql7')->create([ - 'trans_type' => 'A', - 'norujukan' => $norujukan, - 'nokp' => $gadai['nokp'], - 'teller' => $request->teller, - 'kodcaw' => $kodcaw, - 'duit_masuk' => $request->bayaran, - 'created_at' => $current, - 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil - ]); + $margin_semasa = ($gadai['bakipjm'] / $gadai['nilaimarhun']) * 100; - $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ - 'norujukan' => $norujukan, - 'bayaran_keuntungan' => $upahsemasa, - 'bayaran_pembiayaan' => $baki_bayaran, - 'keuntungan_rebet'=> $upahrebet, - 'tarikh_bayaran'=> $current, - 'kodcaw'=> $kodcaw - ]); + $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); + $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['percentpinj']); - $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'bakipjm' => $baki_pinjaman, - 'jbg' => 0, - 't_update' => $current->toDateString(), - 'bakihargajualan' => $baki_hargajualan, - 'tempohbayar' => $gadai['tempoh'], - 'lelong_tawarruq' => $lelong_tawarruq - )); + $onepercentasal = $gadai['pinjaman'] * (1/100); - $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + try { - $audit = new Audit(); - $audit->users = $request->teller; - $audit->actions = 'Bayaran Ansuran'; - $audit->norujukan = $norujukan; - $audit->new_data = $new_data; - $audit->old_data = $old_data; - $audit->kodcaw = $kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); + DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { - return response()->json($update_gadai, 200); + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => 'A', + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => $request->teller, + 'kodcaw' => $kodcaw, + 'duit_masuk' => $request->bayaran, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + 'nowakil' => (int)$request->nowakil + ]); + + if($gadai['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai['tempoh']; + } + $bilang_bln = $tempoh - $gadai['tempohbayar']; + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $upahsemasa, + 'bayaran_pembiayaan' => $baki_bayaran, + 'keuntungan_rebet'=> $upahrebet, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw, + 'ujrah' => ($ujrahasal*$bilang_bln), + 'ujrah_rebet' => ($keuntungan['ujrah'] * $bilang_bln), + 'onepercent' => ($onepercentasal * $bilang_bln), + 'onepercent_rebet' => ($keuntungan['onepercent'] * $bilang_bln), + 'tempoh' => $gadai['tempoh'], + 'beza_tempoh' => $bilang_bln, + 'margin_semasa' => $margin_semasa, + ]); + + DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ + + $margin_updated = ($baki_pinjaman / $gadai['nilaimarhun']) * 100; + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'bakipjm' => $baki_pinjaman, + 'jbg' => 0, + 't_update' => $current->toDateString(), + 'bakihargajualan' => $baki_hargajualan, + 'tempohbayar' => $gadai['tempoh'], + 'lelong_tawarruq' => $lelong_tawarruq, + 'margin_semasa' => $margin_updated, + )); + }); + + $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + // $audit = new Audit(); + // $audit->users = $request->teller; + // $audit->actions = 'Bayaran Ansuran'; + // $audit->norujukan = $norujukan; + // $audit->new_data = $new_data; + // $audit->old_data = $old_data; + // $audit->kodcaw = $kodcaw; + // $audit->created_at = $current; + // $audit->updated_at = $current; + // $audit->save(); + + if(!$transaction || !$transaction_upah) { + throw new \Exception('One of the database operations failed.'); + } + + DB::commit(); + return response()->json("success", 200); + + }); + }catch(\Exception $e){ + return response()->json("Transaction failed: " . $e->getMessage(),500); + } } public function getGadaianSemasa($kodcaw){ @@ -3667,8 +3709,8 @@ class GadaiController extends Controller $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun); - $test = $this->kiraupahTawarruq('KB2','KB2231109-0001'); - dd($test); + // $test = $this->kiraupahTawarruq('KB2','KB2231109-0001'); + // dd($test); return $kadarujrah; } diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index ba04abe..24f7533 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -36,7 +36,7 @@ use App\StokAudit11; use App\StokAudit12; use App\AkruNet; - +use App\Services\OnePercentServices; use Illuminate\Http\Request; use Carbon\Carbon; @@ -88,6 +88,8 @@ class TebusController extends Controller } public function kiraupahTawarruq($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -103,7 +105,9 @@ class TebusController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; $upah_semasa_round = number_format($upahsemasa_raw,2); if(strpos($upah_semasa_round,',')){ @@ -118,6 +122,8 @@ class TebusController extends Controller } public function kiraUpahRebet($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -134,7 +140,9 @@ class TebusController extends Controller $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; + // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); $upah_rebet_round = number_format($upahrebet_raw,2); if(strpos($upah_rebet_round,',')){ diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index b917724..6e0099e 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -38,6 +38,20 @@ class OnePercentServices return $onepercent; } + public function kiraanUjrahSebenar(float $nilaimarhun = 0.0,float $kadarujrah = 0.0,float $margin = 0.0){ + + if($kadarujrah >= 1){ + return; + } + + $ujrah = ($kadarujrah/100) * $nilaimarhun; + $formula_margin = ($this->maks_margin - $margin) / $this->maks_margin; + $rebate_ujrah = $formula_margin * $ujrah; + $ujrah_sebenar = $ujrah - $rebate_ujrah; + + return $ujrah_sebenar; + } + public function kiraanKeuntunganSebenar(float $pembiayaan = 0.0,float $nilaimarhun = 0.0,float $kadarujrah = 0.0,float $margin = 0.0){ $onepercent = $this->kiraanOnePercent($pembiayaan); diff --git a/app/TransaksiKeuntungan.php b/app/TransaksiKeuntungan.php index 691485b..6176d26 100644 --- a/app/TransaksiKeuntungan.php +++ b/app/TransaksiKeuntungan.php @@ -14,7 +14,7 @@ class TransaksiKeuntungan extends Model * @var array */ protected $fillable = [ - 'norujukan','bayaran_keuntungan','tarikh_bayaran','kodcaw','bayaran_pembiayaan','keuntungan_rebet' + 'norujukan','bayaran_keuntungan','tarikh_bayaran','kodcaw','bayaran_pembiayaan','keuntungan_rebet','ujrah','ujrah_rebet','onepercent','onepercent_rebet','tempoh','beza_tempoh','margin_semasa' ]; /** From 6c2a4728c5df4d16b4237d0a87449f0c1b41b4a1 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 09:55:31 +0800 Subject: [PATCH 010/114] fix rebet and ujrah untuk tebus and uncomment all audit --- app/Http/Controllers/GadaiController.php | 45 +++--- app/Http/Controllers/TebusController.php | 173 +++++++++++++++++++---- routes/web.php | 4 +- 3 files changed, 170 insertions(+), 52 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index b017e23..f16f5e8 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -292,22 +292,23 @@ class GadaiController extends Controller 'ujrah' => $ujrah, 'onepercent' => $onepercent, 'margin_semasa' => $margin_pinjam, + 'tagbaru' => 1 )); $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - // $audit = new Audit(); - // $audit->users = $request->teller; - // $audit->actions = $request->transaction; - // $audit->norujukan = $norujukan; - // $audit->new_data = $new_data; - // if($request->transaction == 'Ubah Gadai'){ - // $audit->old_data = $old_data; - // } - // $audit->kodcaw = $request->kodcaw; - // $audit->created_at = $current; - // $audit->updated_at = $current; - // $audit->save(); + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = $request->transaction; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + if($request->transaction == 'Ubah Gadai'){ + $audit->old_data = $old_data; + } + $audit->kodcaw = $request->kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); return response()->json($gadai, 200); } @@ -547,16 +548,16 @@ class GadaiController extends Controller $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - // $audit = new Audit(); - // $audit->users = $request->teller; - // $audit->actions = 'Bayaran Ansuran'; - // $audit->norujukan = $norujukan; - // $audit->new_data = $new_data; - // $audit->old_data = $old_data; - // $audit->kodcaw = $kodcaw; - // $audit->created_at = $current; - // $audit->updated_at = $current; - // $audit->save(); + $audit = new Audit(); + $audit->users = $request->teller; + $audit->actions = 'Bayaran Ansuran'; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + $audit->old_data = $old_data; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); if(!$transaction || !$transaction_upah) { throw new \Exception('One of the database operations failed.'); diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 24f7533..0ae3446 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -39,6 +39,8 @@ use App\AkruNet; use App\Services\OnePercentServices; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Log; + use Carbon\Carbon; class TebusController extends Controller @@ -52,7 +54,9 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->first(); - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + $jeniskeuntungan = ($gadai_data['tagbaru'] == 1) ? 'onepercent' : 'asal'; + + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; @@ -65,7 +69,7 @@ class TebusController extends Controller return response()->json($hargatebus); } - public function hargaTebusTawarruq($kodcaw,$norujukan){ + public function hargaTebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -74,7 +78,7 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->first(); - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; @@ -87,7 +91,7 @@ class TebusController extends Controller return $hargatebus; } - public function kiraupahTawarruq($kodcaw,$norujukan){ + public function kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $onepercentservices = new OnePercentServices(); $cawangan = Cawangan::on('mysql7') @@ -105,10 +109,13 @@ class TebusController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); - $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; - + if($jeniskeuntungan == 'onepercent'){ + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + }else{ + $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); + } + $upah_semasa_round = number_format($upahsemasa_raw,2); if(strpos($upah_semasa_round,',')){ $upah_semasa_round = str_replace(',','',$upah_semasa_round); @@ -121,7 +128,7 @@ class TebusController extends Controller return $upah_semasa; } - public function kiraUpahRebet($kodcaw,$norujukan){ + public function kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan){ $onepercentservices = new OnePercentServices(); $cawangan = Cawangan::on('mysql7') @@ -140,9 +147,12 @@ class TebusController extends Controller $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + if($jeniskeuntungan == 'onepercent'){ + $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upahrebet_raw = $bilang_bln * $upah['keuntungan']; + }else{ + $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); + } $upah_rebet_round = number_format($upahrebet_raw,2); if(strpos($upah_rebet_round,',')){ @@ -192,16 +202,16 @@ class TebusController extends Controller return $keuntungan_rebet_sebenar; } - public function upahTawarruq($kodcaw,$norujukan){ + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $upah_semasa = $this->kiraupahTawarruq($kodcaw,$norujukan); + $upah_semasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan); return response()->json(number_format($upah_semasa,2)); } - public function upahRebetTawarruq($kodcaw,$norujukan){ + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); return response()->json(number_format($upah_rebet,2)); } @@ -216,7 +226,7 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->first(); - $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan); + $upahsemasa = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); $array_recno_marhun = $request->array_recno; @@ -418,7 +428,7 @@ class TebusController extends Controller return floatval(number_format($rebet,2)); } - function rebetselepastawarruq($kodcaw,$norujukan){ + function rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan){ $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -431,7 +441,7 @@ class TebusController extends Controller ->where('norujukan','=',$norujukan) ->sum('keuntungan_rebet'); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; @@ -452,9 +462,8 @@ class TebusController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - if($request->jenisbayarantebus == "tawarruq") - { - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + if($request->jenisbayarantebus == "tawarruq"){ + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); } else if($request->jenisbayarantebus == "nottawarruq") { @@ -466,16 +475,25 @@ class TebusController extends Controller $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + $ujrah=0;$onepercent=0; if($gadai['hargajualan'] == null){ $harga_tebus = $this->hargaTebusNotTawarruq($kodcaw,$norujukan); $upah_tebus = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); $upah_rebet = 0; $upah_rebet_sebenar = 0; }else{ - $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan); - $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan); + $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); + $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); $upah_rebet_sebenar = $harga_tebus - $gadai['bakipjm']; + + if($request->jeniskeuntungan == 'onepercent'){ + $array_onepercent = $this->kiraupahUjrahOnePercent($kodcaw,$norujukan); + $array_onepercent_rebet = $this->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); + $margin_semasa = ($gadai['bakipjm']/$gadai['nilaimarhun']) * 100; + $ujrah = $array_onepercent['ujrah']; + $onepercent = $array_onepercent['onepercent']; + } } @@ -502,7 +520,9 @@ class TebusController extends Controller 'marhuntebus' => $request->marhun, 'historygadaian' => $norujukan, 'tarikhbyrn' => $current->toDateString(), - 'teller' => $request->teller + 'teller' => $request->teller, + 'ujrah' => $ujrah, + 'onepercent' => $onepercent, ]); $create_inoutmar = InOutMar::on($cawangan['mysql'])->create([ @@ -525,7 +545,14 @@ class TebusController extends Controller 'bayaran_pembiayaan' => $gadai['bakipjm'], 'keuntungan_rebet' => $upah_rebet_sebenar, 'tarikh_bayaran'=> $current, - 'kodcaw'=> $kodcaw + 'kodcaw'=> $kodcaw, + 'ujrah' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['ujrah'] : 0, + 'ujrah_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['ujrah'] : 0, + 'onepercent' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent['onepercent'] : 0, + 'onepercent_rebet' => ($request->jeniskeuntungan == 'onepercent') ? $array_onepercent_rebet['onepercent'] : 0, + 'margin_semasa' => ($request->jeniskeuntungan == 'onepercent') ? $margin_semasa : 0, + 'tempoh' => $gadai['tempoh'], + 'beza_tempoh' => ($gadai['tempoh'] - $gadai['tempohbayar']), ]); if($request->jenistebus == 'P'){ @@ -587,7 +614,7 @@ class TebusController extends Controller if($request->jenisbayarantebus == "tawarruq") { - $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan); + $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); } else if($request->jenisbayarantebus == "nottawarruq") { @@ -604,7 +631,7 @@ class TebusController extends Controller 't_update' => $current->toDateString(), )); - $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan); + $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$request->jeniskeuntungan); $create_tebus = Tebus::on($cawangan['mysql'])->create([ 'kodcaw'=> $kodcaw, @@ -2196,4 +2223,94 @@ class TebusController extends Controller return response()->json($total_accrual_net); } + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + + + $ujrah_semasa_round = number_format($ujrah,2); + if(strpos($ujrah_semasa_round,',')){ + $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); + } + $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); + if(strpos($ujrah_semasa,',')){ + $ujrah_semasa = str_replace(',','',$ujrah_semasa); + } + + $onepercent_semasa_round = number_format($onepercent,2); + if(strpos($onepercent_semasa_round,',')){ + $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); + } + $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); + if(strpos($onepercent_semasa,',')){ + $onepercent_semasa = str_replace(',','',$onepercent_semasa); + } + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $onepercentservices = new OnePercentServices(); + + $cawangan = Cawangan::on('mysql7') + ->where('kodcaw','=',$kodcaw) + ->first(); + + $gadai_data = Gadai::on($cawangan['mysql']) + ->where('norujukan','=',$norujukan) + ->first(); + + if($gadai_data['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai_data['tempoh']; + } + + $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $ujrah = $bilang_bln * $array_upah['ujrah']; + $onepercent = $bilang_bln * $array_upah['onepercent']; + + + $ujrah_semasa_round = number_format($ujrah,2); + if(strpos($ujrah_semasa_round,',')){ + $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); + } + $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); + if(strpos($ujrah_semasa,',')){ + $ujrah_semasa = str_replace(',','',$ujrah_semasa); + } + + $onepercent_semasa_round = number_format($onepercent,2); + if(strpos($onepercent_semasa_round,',')){ + $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); + } + $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); + if(strpos($onepercent_semasa,',')){ + $onepercent_semasa = str_replace(',','',$onepercent_semasa); + } + + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + } + + + } diff --git a/routes/web.php b/routes/web.php index 7250486..0842c8d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -106,8 +106,8 @@ $router->group(['prefix'=>'api'], function () use ($router){ //Tebus API $router->get('tebustawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusTawarruq']); - $router->get('upahtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahTawarruq']); - $router->get('upahrebettawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahRebetTawarruq']); + $router->get('upahtawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahTawarruq']); + $router->get('upahrebettawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahRebetTawarruq']); $router->get('tebusseparuhtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhTawarruq']); $router->get('tebusseparuhbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhNotTawarruq']); $router->get('tebusbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusNotTawarruq']); From f2e8ad1591725b338285237c8c5e0b2b83f79b3a Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 10:20:55 +0800 Subject: [PATCH 011/114] add seeder for kadarupah --- app/KadarUpah.php | 1 + database/seeds/KadarUpahSeeder.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 database/seeds/KadarUpahSeeder.php diff --git a/app/KadarUpah.php b/app/KadarUpah.php index fa897d6..4170fd9 100644 --- a/app/KadarUpah.php +++ b/app/KadarUpah.php @@ -9,6 +9,7 @@ class KadarUpah extends Model protected $table = 'kadarupah'; protected $connection = 'mysql7'; + public $timestamps = false; /** * The attributes that are mass assignable. * diff --git a/database/seeds/KadarUpahSeeder.php b/database/seeds/KadarUpahSeeder.php new file mode 100644 index 0000000..4137c44 --- /dev/null +++ b/database/seeds/KadarUpahSeeder.php @@ -0,0 +1,30 @@ +where('kadarupdah', '=', 1.20)->update([ + 'kadarujrah' => 0.14, + 'kadaronepercent' => 1, + ]); + + KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.50)->update([ + 'kadarujrah' => 0.40, + 'kadaronepercent' => 1, + ]); + + KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.70)->update([ + 'kadarujrah' => 0.56, + 'kadaronepercent' => 1, + ]); + } +} From c76de352293a468f56d5a61e11c7bd5f5792f7fb Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 14:34:28 +0800 Subject: [PATCH 012/114] add migration script --- app/Console/Commands/MigrationOnePercent.php | 49 ++++++++++++++++++ app/Console/Commands/TestOnePercent.php | 54 -------------------- app/Console/Kernel.php | 2 +- 3 files changed, 50 insertions(+), 55 deletions(-) create mode 100644 app/Console/Commands/MigrationOnePercent.php delete mode 100644 app/Console/Commands/TestOnePercent.php diff --git a/app/Console/Commands/MigrationOnePercent.php b/app/Console/Commands/MigrationOnePercent.php new file mode 100644 index 0000000..1aff5b2 --- /dev/null +++ b/app/Console/Commands/MigrationOnePercent.php @@ -0,0 +1,49 @@ + 'KadarUpahSeeder', + ]); + + $this->info('The command was successfully generated!'); + } +} \ No newline at end of file diff --git a/app/Console/Commands/TestOnePercent.php b/app/Console/Commands/TestOnePercent.php deleted file mode 100644 index 5d8af0a..0000000 --- a/app/Console/Commands/TestOnePercent.php +++ /dev/null @@ -1,54 +0,0 @@ -onepercentserv = $onepercentserv; - parent::__construct(); - } - - /** - * Execute the console command. - * - * @return int - */ - public function handle() - { - $pemb = $this->ask('Pembiayaan?'); - $nm = $this->ask('Nilaimarhun?'); - $ku = $this->ask('Kadarujrah?'); - $marg = $this->ask('Margin?'); - - $test = $this->onepercentserv->kiraanKeuntunganSebenar($pemb,$nm,$ku,$marg); - - dd($test); - return $test; - } -} \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index e18917f..3fe6529 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel */ protected $commands = [ Commands\DailyGadai::class, - Commands\TestOnePercent::class, + Commands\MigrationOnePercent::class, ]; From 155468a421884cf26bde89bbbe2466fb51b0d303 Mon Sep 17 00:00:00 2001 From: BTMS1 Date: Mon, 20 Nov 2023 08:44:39 +0800 Subject: [PATCH 013/114] tambah function stok audit khas dan job blast wasap --- app/BlastWasap.php | 19 ++ app/Http/Controllers/StokAuditController.php | 202 ++++++++++++++++++ app/Jobs/WhatsappPelangganSAGLAMA.php | 57 +++++ .../2023_11_15_155547_create_jobs_table.php | 36 ++++ ...23_11_19_111428_create_log_blast_wasap.php | 35 +++ 5 files changed, 349 insertions(+) create mode 100644 app/BlastWasap.php create mode 100644 app/Http/Controllers/StokAuditController.php create mode 100644 app/Jobs/WhatsappPelangganSAGLAMA.php create mode 100644 database/migrations/2023_11_15_155547_create_jobs_table.php create mode 100644 database/migrations/2023_11_19_111428_create_log_blast_wasap.php diff --git a/app/BlastWasap.php b/app/BlastWasap.php new file mode 100644 index 0000000..f62b6de --- /dev/null +++ b/app/BlastWasap.php @@ -0,0 +1,19 @@ +kodcaw); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); + + $audit = Gadai::on($cawangan['mysql']) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=','']]) + ->orderBy('t_gadai', 'ASC') + ->orderBy('sirig', 'ASC'); + // ->get(); + // dd($audit); + $arraynorujukan = $audit->pluck('norujukan')->toArray(); + $rekodaudit = $audit->get(); + $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->select('nokp') + ->groupBy('nokp') + ->get(); + + // dd($gadainokp); + + foreach($gadainokp as $index1=>$cal){ + $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + + $listsag = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + // ->where('nokp','=',$cal['nokp']) + ->where('nokp', 'like', '%'.$cal['nokp'].'%') + ->get(); + + foreach($listsag as $index2=>$cal2){ + + if($cal2){ + $checkingnokp = BlastWasap::on('mysql7') + ->where('nokp','=',$cal['nokp']) + ->where('norujukan','=',$cal2['norujukan']) + ->where('kodcaw','=',$kodcaw) + ->first(); + + // $gadainokp[$index1]['blasted'] = $checkingnokp; + + + } + } + + $gadainokp[$index1]['info'] = $customer; + $gadainokp[$index1]['listsag'] = $listsag; + $gadainokp[$index1]['blasted'] = $checkingnokp; + } + + $totalrekod = $audit->sum('pinjaman'); + $totalberat = $audit->sum('berat'); + $totalnilaimarhun = $audit->sum('nilaimarhun'); + $totalpinjaman = $audit->sum('pinjaman'); + $totalbakipjm = $audit->sum('bakipjm'); + $totaltunggakan = $audit->sum('tunggakan'); + + $arrayrekod = ['rekod' => $gadainokp, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan]; + // dd($arrayrekod); + return response()->json($arrayrekod,200); + } + + + public function blastwasap($kodcaw,Request $request) + { + $current = Carbon::now(); + $current = new Carbon(); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $namapengguna = $request->namapengguna; + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); + $cawangan_detail = CawanganDetail::on($cawangan['mysql'])->first(); + $caw_name = $cawangan->details_caw; + $nofoncaw = $cawangan_detail->notel; + // dd($cawangan_detail->notel); + + $audit = Gadai::on($cawangan['mysql']) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=','']]) + ->orderBy('t_gadai', 'ASC') + ->orderBy('sirig', 'ASC'); + // ->get(); + // dd($audit); + $rekodaudit = $audit->get(); + $arraynorujukan = $audit->pluck('norujukan')->toArray(); + $keybynorujukan = $rekodaudit->keyBy('norujukan'); + + $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->select('nokp') + ->groupBy('nokp') + ->get(); + $gadai_all_groupby_nokp = $rekodaudit->groupBy('nokp'); + // dd($gadai_all_groupby_nokp); + + // dd($gadainokp); + + foreach($gadainokp as $index1=>$cal){ + // dd($cal->nokp); + if($gadai_all_groupby_nokp[$cal->nokp]){ + $gadainokp[$index1]['gadai'] = $gadai_all_groupby_nokp[$cal->nokp]; + } + // dd($gadainokp[$index1]['gadai'][$index1]['norujukan']); + + + $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + $nokp=$cal['nokp']; + + foreach($gadainokp[$index1]['gadai'] as $index1=>$cal3){ + + $checkingnokp = BlastWasap::on('mysql7') + ->where('nokp','=',$cal['nokp']) + ->where('norujukan','=',$cal3->norujukan) + ->where('kodcaw','=',$kodcaw) + ->first(); + + if(!$checkingnokp){ + + if($customer->telefon != 'null'){ + $telefon=$customer->telefon; + dispatch(new WhatsappPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw)); + } + + //insert log blast wasap + $logblastwasap = new BlastWasap(); + $logblastwasap->kodcaw = $kodcaw; + $logblastwasap->nokp = $nokp; + $logblastwasap->notelefon = $customer->telefon; + $logblastwasap->norujukan = $cal3->norujukan; + $logblastwasap->created_at = $current; + $logblastwasap->updated_at = $current; + $logblastwasap->save(); + + //log auditrail + $audit = new Audit(); + $audit->users = $namapengguna; + $audit->actions = 'Blast Whatsapp'; + $audit->norujukan = $cal3->norujukan; + $audit->new_data = 'BLAST WHATSAPP: '.$customer->telefon; + $audit->old_data = $nokp; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + } + else{ + return response()->json('failed'); + } + } + } + return response()->json('success'); + + } + +} diff --git a/app/Jobs/WhatsappPelangganSAGLAMA.php b/app/Jobs/WhatsappPelangganSAGLAMA.php new file mode 100644 index 0000000..b002954 --- /dev/null +++ b/app/Jobs/WhatsappPelangganSAGLAMA.php @@ -0,0 +1,57 @@ +nokp = $nokp; + $this->telefon = $telefon; + $this->caw_name = $caw_name; + $this->nofoncaw = $nofoncaw; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + // $mobile_no = ltrim($this->telefon, '+6'); + $mobile_no = '60178916936'; + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis *sebelum 15/7/2024* bagi menukar SAG dengan cara: + +1. Tebus +atau +2. Tebus Gadai Semula + +Hubungi '.$this->nofoncaw.'(Ar-Rahn '.$this->caw_name.') untuk maklumat lanjut.'; + if(env('APP_ENV') != 'production'){ + $mobile_no = env('ADMIN_PHONE_NUMBER'); + } + $response = Http::get(env('WABOT_API'), [ + 'number' => $mobile_no, + 'type' => 'text', + 'message' => $message, + 'instance_id' => env('WABOT_INSTANCES_ID'), + 'access_token' => env('WABOT_TOKEN_KEYS') + ]); + + Log::info("WABOT - Pelanggan SAG Tawarruq Lama".$response); + + } +} diff --git a/database/migrations/2023_11_15_155547_create_jobs_table.php b/database/migrations/2023_11_15_155547_create_jobs_table.php new file mode 100644 index 0000000..1be9e8a --- /dev/null +++ b/database/migrations/2023_11_15_155547_create_jobs_table.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} diff --git a/database/migrations/2023_11_19_111428_create_log_blast_wasap.php b/database/migrations/2023_11_19_111428_create_log_blast_wasap.php new file mode 100644 index 0000000..b551dc8 --- /dev/null +++ b/database/migrations/2023_11_19_111428_create_log_blast_wasap.php @@ -0,0 +1,35 @@ +id(); + $table->string('kodcaw')->nullable(); + $table->string('nokp')->nullable(); + $table->string('notelefon')->nullable(); + $table->string('norujukan')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('log_blast_wasap'); + } +} From e4eb7a040f27ab0be36c2ee5658769e189ae3f2b Mon Sep 17 00:00:00 2001 From: BTMS1 Date: Mon, 20 Nov 2023 09:45:52 +0800 Subject: [PATCH 014/114] tambah web stokaudit khas --- routes/web.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routes/web.php b/routes/web.php index 0842c8d..c6e5ba1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -579,6 +579,12 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('kadarujrah',['uses' => 'GadaiController@getKadarUjrah']); $router->post('onepercent',['uses' => 'GadaiController@getOnePercent']); + //STOKAUDITKHAS + $router->get('stokauditkhas/aktif/{kodcaw}',['uses'=>'StokAuditController@LaporanAuditKhasAktif']); + + //API BLAST WASAP + $router->post('blastwasap/{kodcaw}',['uses'=>'StokAuditController@blastwasap']); + }); $router->group(['prefix'=>'e-arrahn'], function () use ($router){ From e234b2c413e1d1614dc3f38277cc526643ac0e4d Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 20 Nov 2023 16:06:24 +0800 Subject: [PATCH 015/114] tambah rekod blast --- app/Http/Controllers/StokAuditController.php | 93 ++++++++++++++----- app/Jobs/WhatsappPelangganSAGLAMA.php | 2 +- ...23_11_19_111428_create_log_blast_wasap.php | 1 + routes/web.php | 2 + 4 files changed, 74 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/StokAuditController.php b/app/Http/Controllers/StokAuditController.php index 4d52226..23ebf23 100644 --- a/app/Http/Controllers/StokAuditController.php +++ b/app/Http/Controllers/StokAuditController.php @@ -164,31 +164,31 @@ class StokAuditController extends Controller if($customer->telefon != 'null'){ $telefon=$customer->telefon; + //insert log blast wasap + $logblastwasap = new BlastWasap(); + $logblastwasap->kodcaw = $kodcaw; + $logblastwasap->nokp = $nokp; + $logblastwasap->notelefon = $customer->telefon; + $logblastwasap->norujukan = $cal3->norujukan; + $logblastwasap->tempoh = $cal3->tempoh; + $logblastwasap->created_at = $current; + $logblastwasap->updated_at = $current; + $logblastwasap->save(); + + //log auditrail + $audit = new Audit(); + $audit->users = $namapengguna; + $audit->actions = 'Blast Whatsapp'; + $audit->norujukan = $cal3->norujukan; + $audit->new_data = $customer->telefon; + $audit->old_data = $nokp; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + dispatch(new WhatsappPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw)); } - - //insert log blast wasap - $logblastwasap = new BlastWasap(); - $logblastwasap->kodcaw = $kodcaw; - $logblastwasap->nokp = $nokp; - $logblastwasap->notelefon = $customer->telefon; - $logblastwasap->norujukan = $cal3->norujukan; - $logblastwasap->created_at = $current; - $logblastwasap->updated_at = $current; - $logblastwasap->save(); - - //log auditrail - $audit = new Audit(); - $audit->users = $namapengguna; - $audit->actions = 'Blast Whatsapp'; - $audit->norujukan = $cal3->norujukan; - $audit->new_data = 'BLAST WHATSAPP: '.$customer->telefon; - $audit->old_data = $nokp; - $audit->kodcaw = $kodcaw; - $audit->created_at = $current; - $audit->updated_at = $current; - $audit->save(); - } else{ return response()->json('failed'); @@ -198,5 +198,52 @@ class StokAuditController extends Controller return response()->json('success'); } + + public function rekodblast($kodcaw,Request $request) + { + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $rekodblast = BlastWasap::on('mysql7') + ->where('kodcaw','=',$kodcaw); + $arraynorujukan = $rekodblast->pluck('norujukan')->toArray(); + $rekodaudit = $rekodblast->orderBy('id', 'asc')->get(); + $keybynorujukan = $rekodaudit->keyBy('norujukan'); + + $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->select('nokp') + ->groupBy('nokp') + ->get(); + $gadai_all_groupby_nokp = $rekodaudit->groupBy('nokp'); + // dd($gadai_all_groupby_nokp); + + foreach($gadainokp as $index1=>$cal){ + + if($gadai_all_groupby_nokp[$cal->nokp]){ + $gadainokp[$index1]['rekodblast'] = $gadai_all_groupby_nokp[$cal->nokp]; + } + $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + + $listsag = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->where('nokp', 'like', '%'.$cal['nokp'].'%') + ->get(); + // dd($listsag); + $gadainokp[$index1]['info'] = $customer; + $gadainokp[$index1]['listsag'] = $listsag; + } + + + $totalrekod = $listsag->sum('pinjaman'); + $totalberat = $listsag->sum('berat'); + $totalnilaimarhun = $listsag->sum('nilaimarhun'); + $totalpinjaman = $listsag->sum('pinjaman'); + $totalbakipjm = $listsag->sum('bakipjm'); + $totaltunggakan = $listsag->sum('tunggakan'); + + $arrayrekod = ['rekod' => $gadainokp, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan]; + return response()->json($arrayrekod,200); + } } diff --git a/app/Jobs/WhatsappPelangganSAGLAMA.php b/app/Jobs/WhatsappPelangganSAGLAMA.php index b002954..5b98dc0 100644 --- a/app/Jobs/WhatsappPelangganSAGLAMA.php +++ b/app/Jobs/WhatsappPelangganSAGLAMA.php @@ -32,7 +32,7 @@ class WhatsappPelangganSAGLAMA extends Job public function handle() { // $mobile_no = ltrim($this->telefon, '+6'); - $mobile_no = '60178916936'; + //$mobile_no = '60178916936'; $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis *sebelum 15/7/2024* bagi menukar SAG dengan cara: 1. Tebus diff --git a/database/migrations/2023_11_19_111428_create_log_blast_wasap.php b/database/migrations/2023_11_19_111428_create_log_blast_wasap.php index b551dc8..fe2d09a 100644 --- a/database/migrations/2023_11_19_111428_create_log_blast_wasap.php +++ b/database/migrations/2023_11_19_111428_create_log_blast_wasap.php @@ -19,6 +19,7 @@ class CreateLogBlastWasap extends Migration $table->string('nokp')->nullable(); $table->string('notelefon')->nullable(); $table->string('norujukan')->nullable(); + $table->string('tempoh')->nullable(); $table->timestamps(); }); } diff --git a/routes/web.php b/routes/web.php index c6e5ba1..aa61eab 100644 --- a/routes/web.php +++ b/routes/web.php @@ -584,6 +584,8 @@ $router->group(['prefix'=>'api'], function () use ($router){ //API BLAST WASAP $router->post('blastwasap/{kodcaw}',['uses'=>'StokAuditController@blastwasap']); + $router->get('rekodblast/{kodcaw}',['uses'=>'StokAuditController@rekodblast']); + }); From 68896dcb75fc4c6374ebf17c59995b9d8b00f894 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 21 Nov 2023 12:32:25 +0800 Subject: [PATCH 016/114] fix model tebus added ujrah and onepercent, also, fix upah from 0.14 to 0.16 --- app/Tebus.php | 2 ++ database/seeds/KadarUpahSeeder.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Tebus.php b/app/Tebus.php index 63531bb..4d01786 100644 --- a/app/Tebus.php +++ b/app/Tebus.php @@ -51,6 +51,8 @@ class Tebus extends Model 'historygadaian', 'pinjamanterkini', 'tarikhbyrn', + 'ujrah', + 'onepercent' ]; /** diff --git a/database/seeds/KadarUpahSeeder.php b/database/seeds/KadarUpahSeeder.php index 4137c44..c4a37ee 100644 --- a/database/seeds/KadarUpahSeeder.php +++ b/database/seeds/KadarUpahSeeder.php @@ -13,7 +13,7 @@ class KadarUpahSeeder extends Seeder public function run() { KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.20)->update([ - 'kadarujrah' => 0.14, + 'kadarujrah' => 0.16, 'kadaronepercent' => 1, ]); From 3ab9baf7b58766c42929bafc04055d2b73efbf72 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 21 Nov 2023 14:18:22 +0800 Subject: [PATCH 017/114] added log in transaction ansuran --- app/Http/Controllers/GadaiController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index f16f5e8..e443a22 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -33,6 +33,7 @@ use App\InOutMar; use Illuminate\Http\Request; use App\Services\OnePercentServices; +use Log; use Illuminate\Support\Facades\DB; @@ -564,12 +565,14 @@ class GadaiController extends Controller } DB::commit(); - return response()->json("success", 200); }); }catch(\Exception $e){ + Log::error("Transaction failed: " . $e->getMessage()); return response()->json("Transaction failed: " . $e->getMessage(),500); } + + return response()->json("success",200); } public function getGadaianSemasa($kodcaw){ From 135b9c37bce50b4569a622312d861d4433d1cde0 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Tue, 21 Nov 2023 16:22:39 +0800 Subject: [PATCH 018/114] tambah function SMS --- app/Http/Controllers/StokAuditController.php | 19 +++++-- app/Jobs/SMSPelangganSAGLAMA.php | 56 ++++++++++++++++++++ app/Jobs/WhatsappPelangganSAGLAMA.php | 2 +- 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 app/Jobs/SMSPelangganSAGLAMA.php diff --git a/app/Http/Controllers/StokAuditController.php b/app/Http/Controllers/StokAuditController.php index 23ebf23..4de19c2 100644 --- a/app/Http/Controllers/StokAuditController.php +++ b/app/Http/Controllers/StokAuditController.php @@ -31,6 +31,7 @@ use App\BlastWasap; use App\HistoryEmasSandaran; use App\InOutMar; use App\Jobs\WhatsappPelangganSAGLAMA; +use App\Jobs\SMSPelangganSAGLAMA; use Illuminate\Http\Request; use App\CawanganDetail; @@ -50,7 +51,7 @@ class StokAuditController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); $audit = Gadai::on($cawangan['mysql']) - ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=','']]) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) ->orderBy('t_gadai', 'ASC') ->orderBy('sirig', 'ASC'); // ->get(); @@ -121,7 +122,7 @@ class StokAuditController extends Controller // dd($cawangan_detail->notel); $audit = Gadai::on($cawangan['mysql']) - ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=','']]) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) ->orderBy('t_gadai', 'ASC') ->orderBy('sirig', 'ASC'); // ->get(); @@ -178,7 +179,7 @@ class StokAuditController extends Controller //log auditrail $audit = new Audit(); $audit->users = $namapengguna; - $audit->actions = 'Blast Whatsapp'; + $audit->actions = 'Blast Whatsapp & SMS'; $audit->norujukan = $cal3->norujukan; $audit->new_data = $customer->telefon; $audit->old_data = $nokp; @@ -188,6 +189,7 @@ class StokAuditController extends Controller $audit->save(); dispatch(new WhatsappPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw)); + dispatch(new SMSPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw)); } } else{ @@ -234,15 +236,22 @@ class StokAuditController extends Controller $gadainokp[$index1]['listsag'] = $listsag; } - + if($listsag ?? ''){ $totalrekod = $listsag->sum('pinjaman'); $totalberat = $listsag->sum('berat'); $totalnilaimarhun = $listsag->sum('nilaimarhun'); $totalpinjaman = $listsag->sum('pinjaman'); $totalbakipjm = $listsag->sum('bakipjm'); $totaltunggakan = $listsag->sum('tunggakan'); + } - $arrayrekod = ['rekod' => $gadainokp, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan]; + $arrayrekod = ['rekod' => $gadainokp ?? null, + 'total' => $totalrekod ?? null, + 'totalberat' => $totalberat ?? null, + 'totalnilaimarhun' => $totalnilaimarhun ?? null, + 'totalpinjaman'=>$totalpinjaman ?? null, + 'totalbakipjm'=>$totalbakipjm ?? null, + 'totaltunggakan'=>$totaltunggakan ?? null]; return response()->json($arrayrekod,200); } diff --git a/app/Jobs/SMSPelangganSAGLAMA.php b/app/Jobs/SMSPelangganSAGLAMA.php new file mode 100644 index 0000000..b3fe13d --- /dev/null +++ b/app/Jobs/SMSPelangganSAGLAMA.php @@ -0,0 +1,56 @@ +nokp = $nokp; + $this->telefon = $telefon; + $this->caw_name = $caw_name; + $this->nofoncaw = $nofoncaw; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + // $mobile_no = ltrim($this->telefon, '+6'); + $mobile_no = '60178916936'; + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis sebelum 15/7/2024 bagi menukar SAG dengan cara: +1. Tebus atau +2. Tebus Gadai Semula +Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.'; + if(env('APP_ENV') != 'production'){ + $mobile_no = env('ADMIN_PHONE_NUMBER'); + } + + Http::get(env('ONEWAYSMS_API'), [ + 'apiusername' => env('ONEWAYSMS_AUTH_USER'), + 'apipassword' => env('ONEWAYSMS_AUTH_PASS'), + 'senderid' => 'INFO', + 'mobileno' => $mobile_no, + 'message' => $message, + 'languagetype' => 1 + ]); + + Log::info("SMS - Pelanggan ".$this->caw_name." SAG Tawarruq Lama -".$mobile_no); + + } +} diff --git a/app/Jobs/WhatsappPelangganSAGLAMA.php b/app/Jobs/WhatsappPelangganSAGLAMA.php index 5b98dc0..2bf4704 100644 --- a/app/Jobs/WhatsappPelangganSAGLAMA.php +++ b/app/Jobs/WhatsappPelangganSAGLAMA.php @@ -39,7 +39,7 @@ class WhatsappPelangganSAGLAMA extends Job atau 2. Tebus Gadai Semula -Hubungi '.$this->nofoncaw.'(Ar-Rahn '.$this->caw_name.') untuk maklumat lanjut.'; +Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.'; if(env('APP_ENV') != 'production'){ $mobile_no = env('ADMIN_PHONE_NUMBER'); } From de6e4a5c3813dc7f00e2d253cf5bbf71eb74afab Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Wed, 22 Nov 2023 15:38:31 +0800 Subject: [PATCH 019/114] tambah rekod blast sms --- app/BlastSMS.php | 20 +++++ app/Http/Controllers/StokAuditController.php | 80 ++++++++++++++++--- app/Jobs/SMSPelangganSAGLAMA.php | 27 ++++++- app/Jobs/WhatsappPelangganSAGLAMA.php | 28 ++++++- ...23_11_19_111428_create_log_blast_wasap.php | 1 + .../2023_11_22_123033_log_blast_sms.php | 37 +++++++++ routes/web.php | 1 + 7 files changed, 177 insertions(+), 17 deletions(-) create mode 100644 app/BlastSMS.php create mode 100644 database/migrations/2023_11_22_123033_log_blast_sms.php diff --git a/app/BlastSMS.php b/app/BlastSMS.php new file mode 100644 index 0000000..2cd3d60 --- /dev/null +++ b/app/BlastSMS.php @@ -0,0 +1,20 @@ +telefon != 'null'){ $telefon=$customer->telefon; - //insert log blast wasap - $logblastwasap = new BlastWasap(); - $logblastwasap->kodcaw = $kodcaw; - $logblastwasap->nokp = $nokp; - $logblastwasap->notelefon = $customer->telefon; - $logblastwasap->norujukan = $cal3->norujukan; - $logblastwasap->tempoh = $cal3->tempoh; - $logblastwasap->created_at = $current; - $logblastwasap->updated_at = $current; - $logblastwasap->save(); + // //insert log blast wasap + // $logblastwasap = new BlastWasap(); + // $logblastwasap->kodcaw = $kodcaw; + // $logblastwasap->nokp = $nokp; + // $logblastwasap->notelefon = $customer->telefon; + // $logblastwasap->norujukan = $cal3->norujukan; + // $logblastwasap->tempoh = $cal3->tempoh; + // $logblastwasap->created_at = $current; + // $logblastwasap->updated_at = $current; + // $logblastwasap->save(); //log auditrail $audit = new Audit(); @@ -188,8 +189,8 @@ class StokAuditController extends Controller $audit->updated_at = $current; $audit->save(); - dispatch(new WhatsappPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw)); - dispatch(new SMSPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw)); + dispatch(new WhatsappPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal3->norujukan,$cal3->tempoh)); + dispatch(new SMSPelangganSAGLAMA($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal3->norujukan,$cal3->tempoh)); } } else{ @@ -254,5 +255,58 @@ class StokAuditController extends Controller 'totaltunggakan'=>$totaltunggakan ?? null]; return response()->json($arrayrekod,200); } - + + public function rekodblastsms($kodcaw,Request $request) + { + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $rekodblast = BlastSMS::on('mysql7') + ->where('kodcaw','=',$kodcaw); + $arraynorujukan = $rekodblast->pluck('norujukan')->toArray(); + $rekodaudit = $rekodblast->orderBy('id', 'asc')->get(); + $keybynorujukan = $rekodaudit->keyBy('norujukan'); + + $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->select('nokp') + ->groupBy('nokp') + ->get(); + $gadai_all_groupby_nokp = $rekodaudit->groupBy('nokp'); + // dd($gadai_all_groupby_nokp); + + foreach($gadainokp as $index1=>$cal){ + + if($gadai_all_groupby_nokp[$cal->nokp]){ + $gadainokp[$index1]['rekodblast'] = $gadai_all_groupby_nokp[$cal->nokp]; + } + $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + + $listsag = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->where('nokp', 'like', '%'.$cal['nokp'].'%') + ->get(); + // dd($listsag); + $gadainokp[$index1]['info'] = $customer; + $gadainokp[$index1]['listsag'] = $listsag; + } + + if($listsag ?? ''){ + $totalrekod = $listsag->sum('pinjaman'); + $totalberat = $listsag->sum('berat'); + $totalnilaimarhun = $listsag->sum('nilaimarhun'); + $totalpinjaman = $listsag->sum('pinjaman'); + $totalbakipjm = $listsag->sum('bakipjm'); + $totaltunggakan = $listsag->sum('tunggakan'); + } + + $arrayrekod = ['rekod' => $gadainokp ?? null, + 'total' => $totalrekod ?? null, + 'totalberat' => $totalberat ?? null, + 'totalnilaimarhun' => $totalnilaimarhun ?? null, + 'totalpinjaman'=>$totalpinjaman ?? null, + 'totalbakipjm'=>$totalbakipjm ?? null, + 'totaltunggakan'=>$totaltunggakan ?? null]; + return response()->json($arrayrekod,200); + } } diff --git a/app/Jobs/SMSPelangganSAGLAMA.php b/app/Jobs/SMSPelangganSAGLAMA.php index b3fe13d..4d0ea4e 100644 --- a/app/Jobs/SMSPelangganSAGLAMA.php +++ b/app/Jobs/SMSPelangganSAGLAMA.php @@ -4,6 +4,8 @@ namespace App\Jobs; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Http; +use App\BlastSMS; +use Carbon\Carbon; class SMSPelangganSAGLAMA extends Job { @@ -11,17 +13,23 @@ class SMSPelangganSAGLAMA extends Job public $telefon; public $caw_name; public $nofoncaw; + public $kodcaw; + public $norujukan; + public $tempoh; /** * Create a new job instance. * * @return void */ - public function __construct($nokp, $telefon, $caw_name,$nofoncaw) + public function __construct($nokp, $telefon, $caw_name,$nofoncaw,$kodcaw,$norujukan,$tempoh) { $this->nokp = $nokp; $this->telefon = $telefon; $this->caw_name = $caw_name; $this->nofoncaw = $nofoncaw; + $this->kodcaw = $kodcaw; + $this->norujukan = $norujukan; + $this->tempoh = $tempoh; } /** @@ -31,6 +39,8 @@ class SMSPelangganSAGLAMA extends Job */ public function handle() { + $current = Carbon::now(); + $current = new Carbon(); // $mobile_no = ltrim($this->telefon, '+6'); $mobile_no = '60178916936'; $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis sebelum 15/7/2024 bagi menukar SAG dengan cara: @@ -40,8 +50,7 @@ Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.'; if(env('APP_ENV') != 'production'){ $mobile_no = env('ADMIN_PHONE_NUMBER'); } - - Http::get(env('ONEWAYSMS_API'), [ + $response = Http::get(env('ONEWAYSMS_API'), [ 'apiusername' => env('ONEWAYSMS_AUTH_USER'), 'apipassword' => env('ONEWAYSMS_AUTH_PASS'), 'senderid' => 'INFO', @@ -50,6 +59,18 @@ Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.'; 'languagetype' => 1 ]); + //insert log blast sms + $logblastsms = new BlastSMS(); + $logblastsms->kodcaw = $this->kodcaw; + $logblastsms->nokp = $this->nokp; + $logblastsms->notelefon = $this->telefon; + $logblastsms->norujukan = $this->norujukan; + $logblastsms->tempoh = $this->tempoh; + $logblastsms->status = $response; + $logblastsms->created_at = $current; + $logblastsms->updated_at = $current; + $logblastsms->save(); + Log::info("SMS - Pelanggan ".$this->caw_name." SAG Tawarruq Lama -".$mobile_no); } diff --git a/app/Jobs/WhatsappPelangganSAGLAMA.php b/app/Jobs/WhatsappPelangganSAGLAMA.php index 2bf4704..67ef1c4 100644 --- a/app/Jobs/WhatsappPelangganSAGLAMA.php +++ b/app/Jobs/WhatsappPelangganSAGLAMA.php @@ -4,6 +4,8 @@ namespace App\Jobs; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Http; +use App\BlastWasap; +use Carbon\Carbon; class WhatsappPelangganSAGLAMA extends Job { @@ -11,17 +13,27 @@ class WhatsappPelangganSAGLAMA extends Job public $telefon; public $caw_name; public $nofoncaw; + public $kodcaw; + public $norujukan; + public $tempoh; + + /** * Create a new job instance. * * @return void */ - public function __construct($nokp, $telefon, $caw_name,$nofoncaw) + public function __construct($nokp, $telefon, $caw_name,$nofoncaw,$kodcaw,$norujukan,$tempoh) { $this->nokp = $nokp; $this->telefon = $telefon; $this->caw_name = $caw_name; $this->nofoncaw = $nofoncaw; + $this->kodcaw = $kodcaw; + $this->norujukan = $norujukan; + $this->tempoh = $tempoh; + + } /** @@ -31,6 +43,8 @@ class WhatsappPelangganSAGLAMA extends Job */ public function handle() { + $current = Carbon::now(); + $current = new Carbon(); // $mobile_no = ltrim($this->telefon, '+6'); //$mobile_no = '60178916936'; $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, selaras penambahbaikan Sistem Ar-Rahn, Tuan/Puan diminta hadir ke premis *sebelum 15/7/2024* bagi menukar SAG dengan cara: @@ -50,6 +64,18 @@ Hubungi '.$this->nofoncaw.' untuk maklumat lanjut.'; 'instance_id' => env('WABOT_INSTANCES_ID'), 'access_token' => env('WABOT_TOKEN_KEYS') ]); + + //insert log blast wasap + $logblastwasap = new BlastWasap(); + $logblastwasap->kodcaw = $this->kodcaw; + $logblastwasap->nokp = $this->nokp; + $logblastwasap->notelefon = $this->telefon; + $logblastwasap->norujukan = $this->norujukan; + $logblastwasap->tempoh = $this->tempoh; + $logblastwasap->status = $response; + $logblastwasap->created_at = $current; + $logblastwasap->updated_at = $current; + $logblastwasap->save(); Log::info("WABOT - Pelanggan SAG Tawarruq Lama".$response); diff --git a/database/migrations/2023_11_19_111428_create_log_blast_wasap.php b/database/migrations/2023_11_19_111428_create_log_blast_wasap.php index fe2d09a..3556b11 100644 --- a/database/migrations/2023_11_19_111428_create_log_blast_wasap.php +++ b/database/migrations/2023_11_19_111428_create_log_blast_wasap.php @@ -20,6 +20,7 @@ class CreateLogBlastWasap extends Migration $table->string('notelefon')->nullable(); $table->string('norujukan')->nullable(); $table->string('tempoh')->nullable(); + $table->text('status')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2023_11_22_123033_log_blast_sms.php b/database/migrations/2023_11_22_123033_log_blast_sms.php new file mode 100644 index 0000000..28515c8 --- /dev/null +++ b/database/migrations/2023_11_22_123033_log_blast_sms.php @@ -0,0 +1,37 @@ +id(); + $table->string('kodcaw')->nullable(); + $table->string('nokp')->nullable(); + $table->string('notelefon')->nullable(); + $table->string('norujukan')->nullable(); + $table->string('tempoh')->nullable(); + $table->text('status')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('log_blast_sms'); + } +} diff --git a/routes/web.php b/routes/web.php index aa61eab..fd2db7e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -585,6 +585,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ //API BLAST WASAP $router->post('blastwasap/{kodcaw}',['uses'=>'StokAuditController@blastwasap']); $router->get('rekodblast/{kodcaw}',['uses'=>'StokAuditController@rekodblast']); + $router->get('rekodblastsms/{kodcaw}',['uses'=>'StokAuditController@rekodblastsms']); }); From a3810fa487f04eec50b5496ca6aa5ad0ea85df99 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 19 Nov 2023 10:03:14 +0800 Subject: [PATCH 020/114] Add laravel/tinker --- bootstrap/app.php | 3 +- composer.json | 10 ++- composer.lock | 207 +++++++++++++++++++++++++++++++++++++++++++++- config/tinker.php | 50 +++++++++++ 4 files changed, 267 insertions(+), 3 deletions(-) create mode 100644 config/tinker.php diff --git a/bootstrap/app.php b/bootstrap/app.php index 79ace50..0f8d205 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -60,6 +60,7 @@ $app->singleton( */ $app->configure('app'); +$app->configure('tinker'); /* |-------------------------------------------------------------------------- @@ -117,5 +118,5 @@ $app->middleware([ ]); $app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class); - + $app->register(\Laravel\Tinker\TinkerServiceProvider::class); return $app; diff --git a/composer.json b/composer.json index ae83d4e..392ab97 100644 --- a/composer.json +++ b/composer.json @@ -1,13 +1,18 @@ { "name": "laravel/lumen", "description": "The Laravel Lumen Framework.", - "keywords": ["framework", "laravel", "lumen"], + "keywords": [ + "framework", + "laravel", + "lumen" + ], "license": "MIT", "type": "project", "require": { "php": "^7.2.5", "auth0/auth0-php": "^7.4", "laravel/lumen-framework": "^7.0", + "laravel/tinker": "^2.8", "rap2hpoutre/laravel-log-viewer": "^1.7" }, "require-dev": { @@ -16,6 +21,9 @@ "phpunit/phpunit": "^8.5" }, "autoload": { + "files": [ + "app/helpers.php" + ], "classmap": [ "database/seeds", "database/factories" diff --git a/composer.lock b/composer.lock index 8c80b95..ecb3de3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f3fc95d4bf94ca7763a98f60d5a6fd91", + "content-hash": "9002d37085a4ef790b6e9f7269b8f058", "packages": [ { "name": "auth0/auth0-php", @@ -2202,6 +2202,75 @@ }, "time": "2020-09-15T14:53:08+00:00" }, + { + "name": "laravel/tinker", + "version": "v2.8.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/tinker.git", + "reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/tinker/zipball/b936d415b252b499e8c3b1f795cd4fc20f57e1f3", + "reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3", + "shasum": "" + }, + "require": { + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", + "php": "^7.2.5|^8.0", + "psy/psysh": "^0.10.4|^0.11.1", + "symfony/var-dumper": "^4.3.4|^5.0|^6.0" + }, + "require-dev": { + "mockery/mockery": "~1.3.3|^1.4.2", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.8|^9.3.3" + }, + "suggest": { + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Tinker\\TinkerServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Tinker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Powerful REPL for the Laravel framework.", + "keywords": [ + "REPL", + "Tinker", + "laravel", + "psysh" + ], + "support": { + "issues": "https://github.com/laravel/tinker/issues", + "source": "https://github.com/laravel/tinker/tree/v2.8.2" + }, + "time": "2023-08-15T14:27:00+00:00" + }, { "name": "monolog/monolog", "version": "2.6.0", @@ -2453,6 +2522,62 @@ }, "time": "2018-02-13T20:26:39+00:00" }, + { + "name": "nikic/php-parser", + "version": "v4.17.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + }, + "time": "2023-08-13T19:53:39+00:00" + }, { "name": "opis/closure", "version": "3.6.3", @@ -2893,6 +3018,86 @@ }, "time": "2017-10-23T01:57:42+00:00" }, + { + "name": "psy/psysh", + "version": "v0.11.22", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/128fa1b608be651999ed9789c95e6e2a31b5802b", + "reference": "128fa1b608be651999ed9789c95e6e2a31b5802b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "nikic/php-parser": "^4.0 || ^3.1", + "php": "^8.0 || ^7.0.8", + "symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4" + }, + "conflict": { + "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2" + }, + "suggest": { + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-pdo-sqlite": "The doc command requires SQLite to work.", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", + "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history." + }, + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-0.11": "0.11.x-dev" + }, + "bamarni-bin": { + "bin-links": false, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Psy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info", + "homepage": "http://justinhileman.com" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "http://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ], + "support": { + "issues": "https://github.com/bobthecow/psysh/issues", + "source": "https://github.com/bobthecow/psysh/tree/v0.11.22" + }, + "time": "2023-10-14T21:56:36+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", diff --git a/config/tinker.php b/config/tinker.php new file mode 100644 index 0000000..019c40e --- /dev/null +++ b/config/tinker.php @@ -0,0 +1,50 @@ + [ + // App\Console\Commands\ExampleCommand::class, + ], + + /* + |-------------------------------------------------------------------------- + | Auto Aliased Classes + |-------------------------------------------------------------------------- + | + | Tinker will not automatically alias classes in your vendor namespaces + | but you may explicitly allow a subset of classes to get aliased by + | adding the names of each of those classes to the following list. + | + */ + + 'alias' => [ + // + ], + + /* + |-------------------------------------------------------------------------- + | Classes That Should Not Be Aliased + |-------------------------------------------------------------------------- + | + | Typically, Tinker automatically aliases classes as you require them in + | Tinker. However, you may wish to never alias certain classes, which + | you may accomplish by listing the classes in the following array. + | + */ + + 'dont_alias' => [ + 'App\Nova', + ], + +]; From 0c7c0e7c20acb6f2f7977d961910c20878c1a58e Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 19 Nov 2023 10:08:42 +0800 Subject: [PATCH 021/114] Add helpers file, add helper to deal with multidb con --- app/helpers.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/helpers.php diff --git a/app/helpers.php b/app/helpers.php new file mode 100644 index 0000000..322074b --- /dev/null +++ b/app/helpers.php @@ -0,0 +1,36 @@ + +getPdo(); + return true; + } catch (\Throwable $th) { + return false; + } + }); + + $non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb']; + + $all_cawangan_db = array_filter($all_active_db_keys, function ($db_key) use ($non_cawangan_database) { + $isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database); + + if ($isNotCawangan) { + return false; + } + + return true; + }); + + return $all_cawangan_db; + + } + +} From ce4917fed9ab53050154e6cd520e91760b528789 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 19 Nov 2023 10:09:51 +0800 Subject: [PATCH 022/114] Add route file report, add initial implementation for overall gadai controller --- .../Controllers/ReportGadaiController.php | 98 +++++++++++++++++++ bootstrap/app.php | 1 + 2 files changed, 99 insertions(+) create mode 100644 app/Http/Controllers/ReportGadaiController.php diff --git a/app/Http/Controllers/ReportGadaiController.php b/app/Http/Controllers/ReportGadaiController.php new file mode 100644 index 0000000..6c2b470 --- /dev/null +++ b/app/Http/Controllers/ReportGadaiController.php @@ -0,0 +1,98 @@ +where('kodcaw', '=', $kodcaw)->first(); + + $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') + ->where('t_gadai', '=', $tarikh) + ->orderBy('teller') + ->orderBy('sirig') + ->get(); + + $gadai = []; + + if ($gadai_data) { + foreach ($gadai_data as $index => $gadaiData) { + $customer_info = Customer::on('mysql7')->where('kplama', '=', $gadaiData['nokp'])->orWhere('kpbaru', '=', $gadaiData['nokp'])->first(); + array_push($gadai, [ + "t_gadai" => $gadaiData['t_gadai'], + "norujukan" => $gadaiData['norujukan'], + "nama" => $customer_info['nama'], + "nokp" => $gadaiData['nokp'], + "semakbarcode" => $gadaiData['semakbarcode'], + "masa" => $gadaiData['masa'], + "berat" => $gadaiData['berat'], + "nilaimarhun" => $gadaiData['nilaimarhun'], + "pinjaman" => $gadaiData['pinjaman'], + "upah12" => $gadaiData['upah12'], + "percentpinj" => $gadaiData['percentpinj'], + "alamat1" => $customer_info['alamat1'], + "teller" => $gadaiData['teller'], + ]); + } + } + + return response()->json($gadai); + } + public function getLaporanGadaiAll() + { + + $tarikh = '2023-11-01'; + + $active_cawangan_db_connection = getActiveCawanganDbConnection(); + + $active_cawangan_db = array_map(function ($connection) { + return config('database.connections.' . $connection)['database']; + }, $active_cawangan_db_connection); + + $active_cawangan_name = Cawangan::whereIn('db_name', $active_cawangan_db)->pluck('details_caw')->toArray(); + + $gadai_data = array_map(function ($db_connection) use ($tarikh) { + $gadai = Gadai::on($db_connection)->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') + ->where('t_gadai', '=', $tarikh) + ->orderBy('teller') + ->orderBy('sirig') + ->get(); + + return $gadai->toArray(); + }, $active_cawangan_db_connection); + + $gadai_data_with_key = array_combine($active_cawangan_name, $gadai_data); + + $overall_data_gadai = array_map(function ($gadaian_cawangan) { + return array_map(function ($gadai) { + + $customer_info = Customer::on('mysql7')->where('kplama', '=', $gadai['nokp'])->orWhere('kpbaru', '=', $gadai['nokp'])->first()->toArray(); + + return [ + "t_gadai" => $gadai['t_gadai'], + "norujukan" => $gadai['norujukan'], + "nama" => $customer_info['nama'], + "nokp" => $gadai['nokp'], + "semakbarcode" => $gadai['semakbarcode'], + "masa" => $gadai['masa'], + "berat" => $gadai['berat'], + "nilaimarhun" => $gadai['nilaimarhun'], + "pinjaman" => $gadai['pinjaman'], + "upah12" => $gadai['upah12'], + "percentpinj" => $gadai['percentpinj'], + "alamat1" => $customer_info['alamat1'], + "teller" => $gadai['teller'], + ]; + + }, $gadaian_cawangan); + + }, $gadai_data_with_key); + + return response()->json($overall_data_gadai); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 0f8d205..1a6fea1 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -111,6 +111,7 @@ $app->router->group([ 'namespace' => 'App\Http\Controllers', ], function ($router) { require __DIR__.'/../routes/web.php'; + require __DIR__.'/../routes/report.php'; }); $app->middleware([ From 9dff27f3ba88e63146da4df4fbcf6ffeb7cea6e5 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 23 Nov 2023 09:24:44 +0800 Subject: [PATCH 023/114] Add wip overall reports --- .../Controllers/ReportGadaiController.php | 106 +++------- app/Services/Reports/GadaianService.php | 193 ++++++++++++++++++ app/helpers.php | 15 ++ routes/report.php | 6 + 4 files changed, 247 insertions(+), 73 deletions(-) create mode 100644 app/Services/Reports/GadaianService.php create mode 100644 routes/report.php diff --git a/app/Http/Controllers/ReportGadaiController.php b/app/Http/Controllers/ReportGadaiController.php index 6c2b470..55bd66c 100644 --- a/app/Http/Controllers/ReportGadaiController.php +++ b/app/Http/Controllers/ReportGadaiController.php @@ -3,96 +3,56 @@ namespace App\Http\Controllers; use App\Cawangan; +use App\CawanganDetail; use App\Customer; use App\Gadai; +use App\Marhun; +use DateTime; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; +use App\Services\Reports\GadaianService as ReportGadaianService; class ReportGadaiController extends Controller { - public function getLaporanGadai($kodcaw, $tarikh) + + public function getLaporanCawangan(string $kod_cawangan, Request $request) { - $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); - - $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') - ->where('t_gadai', '=', $tarikh) - ->orderBy('teller') - ->orderBy('sirig') - ->get(); - - $gadai = []; - - if ($gadai_data) { - foreach ($gadai_data as $index => $gadaiData) { - $customer_info = Customer::on('mysql7')->where('kplama', '=', $gadaiData['nokp'])->orWhere('kpbaru', '=', $gadaiData['nokp'])->first(); - array_push($gadai, [ - "t_gadai" => $gadaiData['t_gadai'], - "norujukan" => $gadaiData['norujukan'], - "nama" => $customer_info['nama'], - "nokp" => $gadaiData['nokp'], - "semakbarcode" => $gadaiData['semakbarcode'], - "masa" => $gadaiData['masa'], - "berat" => $gadaiData['berat'], - "nilaimarhun" => $gadaiData['nilaimarhun'], - "pinjaman" => $gadaiData['pinjaman'], - "upah12" => $gadaiData['upah12'], - "percentpinj" => $gadaiData['percentpinj'], - "alamat1" => $customer_info['alamat1'], - "teller" => $gadaiData['teller'], - ]); - } - } - - return response()->json($gadai); + $reportGadaianService = new ReportGadaianService($kod_cawangan, $request); + return $reportGadaianService->getCawanganReport(); } - public function getLaporanGadaiAll() - { - $tarikh = '2023-11-01'; + public function getSummaryLaporanGadai(Request $request) + { + $onDate = $request->onDate; + $startDate = $request->startDate; + $endDate = $request->endDate; $active_cawangan_db_connection = getActiveCawanganDbConnection(); - $active_cawangan_db = array_map(function ($connection) { - return config('database.connections.' . $connection)['database']; + $active_cawangan_db_name = array_map(function ($db_connection) { + return config('database.connections' . '.' . $db_connection . '.' . 'database'); }, $active_cawangan_db_connection); - $active_cawangan_name = Cawangan::whereIn('db_name', $active_cawangan_db)->pluck('details_caw')->toArray(); + $active_cawangan_detail = Cawangan::select('kodcaw', 'details_caw')->whereIn('db_name', $active_cawangan_db_name)->get()->toArray(); - $gadai_data = array_map(function ($db_connection) use ($tarikh) { - $gadai = Gadai::on($db_connection)->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') - ->where('t_gadai', '=', $tarikh) - ->orderBy('teller') - ->orderBy('sirig') - ->get(); + $summary_gadaian_data = array_map(function ($db_connection) use ($request) { + $query = Gadai::on($db_connection); + + $query->select(DB::raw('count(norujukan) as total_gadaian, sum(berat) as sum_berat, sum(nilaimarhun) as sum_nilai_marhun, sum(pinjaman) as sum_pinjaman')); + + $query->when($request->filled('startDate') and $request->filled('endDate'), function ($q) use ($request) { + return $q->where('t_gadai', '>=', $request->startDate) + ->where('t_gadai', '<=', $request->endDate); + }); + + return $query->get()->toArray(); - return $gadai->toArray(); }, $active_cawangan_db_connection); - $gadai_data_with_key = array_combine($active_cawangan_name, $gadai_data); + $response = array_map(function ($cawangan_detail, $summary_gadaian_data) { + return array_merge($cawangan_detail, $summary_gadaian_data[0]); + }, $active_cawangan_detail, $summary_gadaian_data); - $overall_data_gadai = array_map(function ($gadaian_cawangan) { - return array_map(function ($gadai) { - - $customer_info = Customer::on('mysql7')->where('kplama', '=', $gadai['nokp'])->orWhere('kpbaru', '=', $gadai['nokp'])->first()->toArray(); - - return [ - "t_gadai" => $gadai['t_gadai'], - "norujukan" => $gadai['norujukan'], - "nama" => $customer_info['nama'], - "nokp" => $gadai['nokp'], - "semakbarcode" => $gadai['semakbarcode'], - "masa" => $gadai['masa'], - "berat" => $gadai['berat'], - "nilaimarhun" => $gadai['nilaimarhun'], - "pinjaman" => $gadai['pinjaman'], - "upah12" => $gadai['upah12'], - "percentpinj" => $gadai['percentpinj'], - "alamat1" => $customer_info['alamat1'], - "teller" => $gadai['teller'], - ]; - - }, $gadaian_cawangan); - - }, $gadai_data_with_key); - - return response()->json($overall_data_gadai); + return json_encode($response); } } diff --git a/app/Services/Reports/GadaianService.php b/app/Services/Reports/GadaianService.php new file mode 100644 index 0000000..7eb65af --- /dev/null +++ b/app/Services/Reports/GadaianService.php @@ -0,0 +1,193 @@ +kod_cawangan = $kod_cawangan; + $this->startDate = $request->startDate; + $this->endDate = $request->endDate; + } + + public function getCawanganReport() + { + $cawangan_connection = Cawangan::where('kodcaw', $this->kod_cawangan)->first()->mysql; + + $query_total_gadaian = Gadai::on($cawangan_connection); + + $query_total_gadaian->when(!empty($this->startDate) and !empty($this->endDate), function ($q) { + return $q->where('t_gadai', '>=', $this->startDate) + ->where('t_gadai', '<=', $this->endDate); + }); + + $total_gadaian = $this->getTotalGadaian($query_total_gadaian); + $total_summary_gadaian_teller = $this->getTotalSummaryGadaianGroupByTeller($query_total_gadaian); + $total_summary_gadaian = $this->getTotalSummaryGadaian($query_total_gadaian); + $customer_info = $this->getCustomerInfo($total_gadaian); + $marhun_gadaian = $this->getMarhunGadaian($total_gadaian, $cawangan_connection); + $cawangan_detail = $this->getCawanganDetail($cawangan_connection); + + $total_gadaian = $total_gadaian->zip($customer_info, $marhun_gadaian)->map(function ($data) { + + [$gadai, $customer_info, $marhun_gadaian] = $data; + + return [ + 'no_rujukan' => $gadai['norujukan'], + 'nama' => $customer_info['nama'], + 'alamat' => $customer_info['alamat1'], + 'no_kp' => $gadai['nokp'], + 'masa' => $gadai['masa'], + 'marhun' => $marhun_gadaian, + 'berat' => $gadai['berat'], + 'nilai_marhun' => $gadai['nilaimarhun'], + 'pembiayaan' => $gadai['pinjaman'], + 'peratusan_margin_pinjaman' => $gadai['percentpinj'], + 'teller' => $gadai['teller'], + ]; + + }); + + $total_gadaian = $total_gadaian->groupBy('teller'); + + $gadaian_tellers = $total_gadaian->keys(); + + $total_gadaian = $total_gadaian + ->zip($total_summary_gadaian_teller) + ->map(function ($data) { + + [$gadaian, $summary] = $data; + + return [ + 'gadaian' => $gadaian, + 'summary_gadaian_teller' => $summary, + ]; + }); + + $total_gadaian = $gadaian_tellers->combine($total_gadaian); + + $data = [ + 'query' => [ + 'startDate' => formatDate($this->startDate), + 'endDate' => formatDate($this->endDate), + ], + 'cawangan_detail' => $cawangan_detail, + 'gadaian' => $total_gadaian, + 'summary_gadaian' => $total_summary_gadaian, + ]; + + return json_encode($data); + + } + + private function getCawanganDetail($cawangan_connection) + { + $cawangan_detail = CawanganDetail::on($cawangan_connection)->get() + ->map(function ($detail) { + return [ + 'nama' => $detail['namacaw'], + 'code' => $detail['kodcaw'] . ' Ar-Rahn ' . $detail['cawangan'], + 'alamat' => $detail['alamat1'], + 'waktu_operasi' => $detail['alamat4'], + ]; + }); + + return $cawangan_detail[0]; + + } + + private function getTotalSummaryGadaian(Builder $query_total_gadaian) + { + + $total_summary_gadaian = (clone $query_total_gadaian) + ->selectRaw('sum(berat) as total_berat, sum(nilaimarhun) as total_nilai_marhun, sum(pinjaman) as total_pembiayaan') + ->get() + ->map(function ($x) { + return [ + 'total_berat' => $x['total_berat'], + 'total_nilai_marhun' => $x['total_nilai_marhun'], + 'total_pembiayaan' => $x['total_pembiayaan'], + ]; + }); + + return $total_summary_gadaian[0]; + } + private function getTotalSummaryGadaianGroupByTeller(Builder $query_total_gadaian) + { + + $total_summary_gadaian_groupByTeller = (clone $query_total_gadaian) + ->selectRaw('sum(berat) as total_berat, sum(nilaimarhun) as total_nilai_marhun, sum(pinjaman) as total_pembiayaan') + ->groupBy('teller') + ->get(); + return $total_summary_gadaian_groupByTeller; + } + + private function getTotalGadaian(Builder $query_total_gadaian) + { + $total_gadaian = (clone $query_total_gadaian) + ->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') + ->orderBy('teller') + ->orderBy('sirig') + ->get(); + return $total_gadaian; + } + + private function getCustomerInfo($total_gadaian) + { + + $extract_nokp = $total_gadaian->pluck('nokp'); + + $customer_info = Customer::on('mysql7') + ->select(['nama', 'alamat1', 'kpbaru', 'kplama']) + ->where(function ($query) use ($extract_nokp) { + $query->whereIn('kpbaru', $extract_nokp) + ->orWhereIn('kplama', $extract_nokp); + }) + ->get(); + + $customer_info = collect($extract_nokp)->map(function ($nokp) use ($customer_info) { + return $customer_info->where('kpbaru', $nokp)->first() ?? $customer_info->where('kplama', $nokp)->first(); + })->toArray(); + + return $customer_info; + } + + private function getMarhunGadaian($total_gadaian, $cawangan_connection) + { + + $extract_norujukan = $total_gadaian->pluck('norujukan'); + + $marhun_gadaian = Marhun::on($cawangan_connection) + ->select('norujukan', 'bil', 'marhun') + ->whereIn('norujukan', $extract_norujukan) + ->get() + ->groupBy('norujukan') + ->toArray(); + + $marhun_gadaian = array_map(function ($gadaian) { + return array_map(function ($norujukan) { + return $norujukan['bil'] . ' ' . $norujukan['marhun']; + }, $gadaian); + }, $marhun_gadaian); + + $marhun_gadaian = array_map(function ($gadaian) { + return implode(',', $gadaian); + }, $marhun_gadaian); + + return $marhun_gadaian; + } +} diff --git a/app/helpers.php b/app/helpers.php index 322074b..3abf80f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -3,6 +3,21 @@ use Illuminate\Support\Facades\DB; +if (!function_exists('formatNumber')) { + function formatNumber ($amount) { + $formattedAmount = number_format($amount, 2, '.', ','); + + return $formattedAmount; + }; +} + + +if (!function_exists('formatDate')) { + function formatDate ($date_string) { + return (new DateTime($date_string))->format("d-m-Y"); + }; +} + if (!function_exists('getActiveCawanganDbConnection')) { function getActiveCawanganDbConnection() diff --git a/routes/report.php b/routes/report.php new file mode 100644 index 0000000..25cc03b --- /dev/null +++ b/routes/report.php @@ -0,0 +1,6 @@ +group(['prefix'=>'api'], function () use ($router){ + $router->get('gadailaporanOverallSummary', ['uses' => 'ReportGadaiController@getSummaryLaporanGadai']); + $router->get('gadailaporan/{kod_cawangan}', ['uses' => 'ReportGadaiController@getLaporanCawangan']); +}); From 9f3e328449c6ffd43520ba8479caff92df6f8cbe Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 23 Nov 2023 16:04:32 +0800 Subject: [PATCH 024/114] Fix helper file --- app/helpers.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 3abf80f..c610506 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,7 +1,9 @@ - Date: Thu, 23 Nov 2023 16:24:38 +0800 Subject: [PATCH 025/114] fix conflict, fix marhun harga, add faker in gadai and fix composer --- app/Http/Controllers/MarhunController.php | 14 +++- composer.json | 9 +-- database/factories/GadaiFactory.php | 81 +++++++++++++++++++++++ database/factories/MarhunFactory.php | 32 +++++++++ database/seeds/GadaiSeeder.php | 26 ++++++++ tinker/fakerGadai.php | 18 +++++ 6 files changed, 170 insertions(+), 10 deletions(-) create mode 100644 database/factories/GadaiFactory.php create mode 100644 database/factories/MarhunFactory.php create mode 100644 database/seeds/GadaiSeeder.php create mode 100644 tinker/fakerGadai.php diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 87c4b82..3d1fa5d 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -63,7 +63,17 @@ class MarhunController extends Controller $harga = HargaEmas::on('mysql7')->where('karat',$request->karat)->first(); - $nilai_marhun = $request->berat_emas * $harga['harga']; + $hargaemas = $harga['harga']; + if(isset($request->jenisAT)){ + if($request->jenisAT == 'hargalama'){ + $hargaemas = $request->harga; + // $nilai_marhun = $request->berat_emas * $request->harga; + }else $hargaemas = $harga['harga']; + // $nilai_marhun = $request->berat_emas * $harga['harga']; + }else $hargaemas = $harga['harga']; + + $nilai_marhun = $request->berat_emas * $hargaemas; + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $marhun = Marhun::on($cawangan['mysql'])->create([ @@ -75,7 +85,7 @@ class MarhunController extends Controller 'nota' => $request->nota, 'karat' => $request->karat, 'berat' => $request->berat_emas, - 'harga' => $harga['harga'], + 'harga' => $hargaemas, 'n_marhun' => $nilai_marhun ]); diff --git a/composer.json b/composer.json index 392ab97..2c8071f 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,7 @@ { "name": "laravel/lumen", "description": "The Laravel Lumen Framework.", - "keywords": [ - "framework", - "laravel", - "lumen" - ], + "keywords": ["framework", "laravel", "lumen"], "license": "MIT", "type": "project", "require": { @@ -21,9 +17,6 @@ "phpunit/phpunit": "^8.5" }, "autoload": { - "files": [ - "app/helpers.php" - ], "classmap": [ "database/seeds", "database/factories" diff --git a/database/factories/GadaiFactory.php b/database/factories/GadaiFactory.php new file mode 100644 index 0000000..de17d3b --- /dev/null +++ b/database/factories/GadaiFactory.php @@ -0,0 +1,81 @@ +faker = $faker; + } + + public function create() + { + static $number = 1; + + return [ + 'kodcaw' => 'KB2', + 'norujukan' => ($number > 9) ? 'KB2231123-00' . $number : 'KB2231123-000' . $number , + 'nopelanggan' => 'M03-00009968', + 'nokp' => '630411035213', + 't_gadai' => '2023-11-23', + 'masa' => '13:46:57', + 'sirig' => $number++, + 'nilaimarhun' => 3000.09, + 'berat' => 10.17, + 'pinjaman' => 2300, + 'telahbayar' => 0.00, + 'upahtelahbyr' => 0.00, + 'cajtelahbyr' => null, + 'ansuran' => null, + 'ansupah' => null, + 'kadarupah' => null, + 'tempoh' => 0.5, + 't_lelong' => null, + 't_hapus' => null, + 'sttebus' => '', + 'terima' => 1, + 'cetak' => 1, + 'tncek' => null, + 'nocek' => null, + 'bkcode' => null, + 'teller' => 'NORLY BINTI DERAMAN', + 'pelulus' => null, + 'cancelid' => null, + 'canceltime' => null, + 'f_lulus' => null, + 'tag' => null, + 'jbg' => 0.5, + 'bakipjm' => 2300, + 'bakiupah' => 39.1, + 'upahdibayar' => 0.00, + 'marhun' => '1 R/L,', + 'taglel' => null, + 't_update' => '2023-11-23', + 't_matang' => '2024-06-24', + 't_matang1' => '2024-06-24', + 'penilai' => 'MOHD KHALID ABDUL RAHMAN', + 'tagserah' => 1, + 'namapelulus' => '', + 'percentpinj' => 80, + 'namateller' => 'NORLY BINTI DERAMAN', + 'jumtebus' => 0.00, + 'upahnotis' => 0.00, + 'tagpalsu' => 0, + 'historygadaian' => '', + 'tagcetak' => 1, + 'lel1stop' => 0, + 'tebus' => null, + 'bakihargajualan' => 2769.2, + 'hargajualan' => 2769.2, + 'upah12' => 120, + 'tagkomuditi' => 0, + 'tempohbayar' => 0, + 'lelong_tawarruq' => 0, + 'semakbarcode' => 'Lulus' + ]; + } + +} \ No newline at end of file diff --git a/database/factories/MarhunFactory.php b/database/factories/MarhunFactory.php new file mode 100644 index 0000000..ecad2f6 --- /dev/null +++ b/database/factories/MarhunFactory.php @@ -0,0 +1,32 @@ +faker = $faker; + } + + public function create() + { + static $number = 1; + + return [ + 'kodcaw' => 'KB2', + 'marhun' => 'R/L', + 't_gadai' => '2023-11-23', + 'norujukan' => ($number > 9) ? 'KB2231123-00' . $number : 'KB2231123-000' . $number , + 'bil' => 1, + 'nota' => $number++, + 'karat' => '24.0K', + 'berat' => 10.17, + 'harga' => 295.11, + 'n_marhun' => 3000.09 + ]; + } + +} \ No newline at end of file diff --git a/database/seeds/GadaiSeeder.php b/database/seeds/GadaiSeeder.php new file mode 100644 index 0000000..d94cbce --- /dev/null +++ b/database/seeds/GadaiSeeder.php @@ -0,0 +1,26 @@ +table('gadai')->insert($gadaiFactory->create()); + DB::connection('mysql')->table('marhun')->insert($gadaiFactory->create()); + } + } +} diff --git a/tinker/fakerGadai.php b/tinker/fakerGadai.php new file mode 100644 index 0000000..4117a5b --- /dev/null +++ b/tinker/fakerGadai.php @@ -0,0 +1,18 @@ +table('gadai')->insert($gadaiFactory->create()); + DB::connection('mysql')->table('marhun')->insert($marhunFactory->create()); + } + + exit(); + +?> \ No newline at end of file From 0b71ab7abbca290dd6553003e135aac9402df37a Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Nov 2023 16:29:43 +0800 Subject: [PATCH 026/114] add helpers in composer --- composer.json | 3 + composer_backuo.json | 44 + composer_backup.lock | 7182 ++++++++++++++++++++++++++++++++++++++++++ config/cors.php | 60 + 4 files changed, 7289 insertions(+) create mode 100644 composer_backuo.json create mode 100644 composer_backup.lock create mode 100644 config/cors.php diff --git a/composer.json b/composer.json index 2c8071f..deaf479 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,9 @@ "phpunit/phpunit": "^8.5" }, "autoload": { + "files":[ + "app/helpers.php" + ], "classmap": [ "database/seeds", "database/factories" diff --git a/composer_backuo.json b/composer_backuo.json new file mode 100644 index 0000000..ae83d4e --- /dev/null +++ b/composer_backuo.json @@ -0,0 +1,44 @@ +{ + "name": "laravel/lumen", + "description": "The Laravel Lumen Framework.", + "keywords": ["framework", "laravel", "lumen"], + "license": "MIT", + "type": "project", + "require": { + "php": "^7.2.5", + "auth0/auth0-php": "^7.4", + "laravel/lumen-framework": "^7.0", + "rap2hpoutre/laravel-log-viewer": "^1.7" + }, + "require-dev": { + "fzaninotto/faker": "^1.9.1", + "mockery/mockery": "^1.3.1", + "phpunit/phpunit": "^8.5" + }, + "autoload": { + "classmap": [ + "database/seeds", + "database/factories" + ], + "psr-4": { + "App\\": "app/" + } + }, + "autoload-dev": { + "classmap": [ + "tests/" + ] + }, + "config": { + "preferred-install": "dist", + "sort-packages": true, + "optimize-autoloader": true + }, + "minimum-stability": "dev", + "prefer-stable": true, + "scripts": { + "post-root-package-install": [ + "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" + ] + } +} diff --git a/composer_backup.lock b/composer_backup.lock new file mode 100644 index 0000000..8c80b95 --- /dev/null +++ b/composer_backup.lock @@ -0,0 +1,7182 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "f3fc95d4bf94ca7763a98f60d5a6fd91", + "packages": [ + { + "name": "auth0/auth0-php", + "version": "7.9.2", + "source": { + "type": "git", + "url": "https://github.com/auth0/auth0-PHP.git", + "reference": "95cdd4f09122f14d0b0246fe8c51287ece63f98a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auth0/auth0-PHP/zipball/95cdd4f09122f14d0b0246fe8c51287ece63f98a", + "reference": "95cdd4f09122f14d0b0246fe8c51287ece63f98a", + "shasum": "" + }, + "require": { + "auth0/php-jwt": "3.3.4", + "ext-json": "*", + "ext-openssl": "*", + "guzzlehttp/guzzle": "^6.0|^7.0", + "guzzlehttp/psr7": "^1.8", + "php": "^7.3 | ^8.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "cache/adapter-common": "^1.2", + "cache/array-adapter": "^1.1", + "cache/hierarchical-cache": "^1.1", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "josegonzalez/dotenv": "^3.2", + "phpcompatibility/php-compatibility": "^8.1", + "phpstan/phpstan": "^0.12.64", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Auth0\\SDK\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Auth0", + "email": "support@auth0.com", + "homepage": "http://www.auth0.com/" + } + ], + "description": "Auth0 PHP SDK.", + "homepage": "https://github.com/auth0/auth0-PHP", + "support": { + "issues": "https://github.com/auth0/auth0-PHP/issues", + "source": "https://github.com/auth0/auth0-PHP/tree/7.9.2" + }, + "time": "2021-08-04T13:08:48+00:00" + }, + { + "name": "auth0/php-jwt", + "version": "3.3.4", + "source": { + "type": "git", + "url": "https://github.com/auth0/php-jwt.git", + "reference": "a0daa1a728cf85230843ebb8c1183047fe493284" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/auth0/php-jwt/zipball/a0daa1a728cf85230843ebb8c1183047fe493284", + "reference": "a0daa1a728cf85230843ebb8c1183047fe493284", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-openssl": "*", + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "^5.7 || ^7.3", + "squizlabs/php_codesniffer": "~2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "support": { + "source": "https://github.com/auth0/php-jwt/tree/3.3.4" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2021-01-04T20:39:06+00:00" + }, + { + "name": "brick/math", + "version": "0.9.3", + "source": { + "type": "git", + "url": "https://github.com/brick/math.git", + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae", + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.2", + "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", + "vimeo/psalm": "4.9.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Brick\\Math\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Arbitrary-precision arithmetic library", + "keywords": [ + "Arbitrary-precision", + "BigInteger", + "BigRational", + "arithmetic", + "bigdecimal", + "bignum", + "brick", + "math" + ], + "support": { + "issues": "https://github.com/brick/math/issues", + "source": "https://github.com/brick/math/tree/0.9.3" + }, + "funding": [ + { + "url": "https://github.com/BenMorel", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/brick/math", + "type": "tidelift" + } + ], + "time": "2021-08-15T20:50:18+00:00" + }, + { + "name": "doctrine/inflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:16:43+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.3" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-02-28T11:07:21+00:00" + }, + { + "name": "dragonmantank/cron-expression", + "version": "v2.3.1", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2", + "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "support": { + "issues": "https://github.com/dragonmantank/cron-expression/issues", + "source": "https://github.com/dragonmantank/cron-expression/tree/v2.3.1" + }, + "funding": [ + { + "url": "https://github.com/dragonmantank", + "type": "github" + } + ], + "time": "2020-10-13T00:52:37+00:00" + }, + { + "name": "egulias/email-validator", + "version": "2.1.25", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.10" + }, + "require-dev": { + "dominicsayers/isemail": "^3.0.7", + "phpunit/phpunit": "^4.8.36|^7.5.15", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "support": { + "issues": "https://github.com/egulias/EmailValidator/issues", + "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" + }, + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2020-12-29T14:50:06+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.4.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "74a8602c6faec9ef74b7a9391ac82c5e65b1cdab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/74a8602c6faec9ef74b7a9391ac82c5e65b1cdab", + "reference": "74a8602c6faec9ef74b7a9391ac82c5e65b1cdab", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-curl": "*", + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.4-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.4.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2022-05-25T13:24:33+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:56:57+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.8.5", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268", + "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.8.5" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2022-03-20T21:51:18+00:00" + }, + { + "name": "illuminate/auth", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/auth.git", + "reference": "d523b7b96cd1afc55d24afba8fc3176e84eb8154" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/auth/zipball/d523b7b96cd1afc55d24afba8fc3176e84eb8154", + "reference": "d523b7b96cd1afc55d24afba8fc3176e84eb8154", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/http": "^7.0", + "illuminate/queue": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "suggest": { + "illuminate/console": "Required to use the auth:clear-resets command (^7.0).", + "illuminate/queue": "Required to fire login / logout events (^7.0).", + "illuminate/session": "Required to use the session based guard (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Auth\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Auth package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/broadcasting", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/broadcasting.git", + "reference": "b30bf4ff2b020a98aca537877a68fabecfa3a8ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/broadcasting/zipball/b30bf4ff2b020a98aca537877a68fabecfa3a8ab", + "reference": "b30bf4ff2b020a98aca537877a68fabecfa3a8ab", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/bus": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/queue": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "psr/log": "^1.0" + }, + "suggest": { + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Broadcasting\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Broadcasting package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-11-21T14:36:22+00:00" + }, + { + "name": "illuminate/bus", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/bus.git", + "reference": "78d8013a700eef9fbece09094d422d73fa9a493a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/bus/zipball/78d8013a700eef9fbece09094d422d73fa9a493a", + "reference": "78d8013a700eef9fbece09094d422d73fa9a493a", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/pipeline": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "suggest": { + "illuminate/queue": "Required to use closures when chaining jobs (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Bus\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Bus package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/cache", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/cache.git", + "reference": "f9155c4827600ea3e0743eb03402f8048c04455c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/cache/zipball/f9155c4827600ea3e0743eb03402f8048c04455c", + "reference": "f9155c4827600ea3e0743eb03402f8048c04455c", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "suggest": { + "ext-memcached": "Required to use the memcache cache driver.", + "illuminate/database": "Required to use the database cache driver (^7.0).", + "illuminate/filesystem": "Required to use the file cache driver (^7.0).", + "illuminate/redis": "Required to use the redis cache driver (^7.0).", + "symfony/cache": "Required to PSR-6 cache bridge (^5.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Cache\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Cache package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/config", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/config.git", + "reference": "9d908793eceb04a8c8f74cfc6af3429ce140d2e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/config/zipball/9d908793eceb04a8c8f74cfc6af3429ce140d2e2", + "reference": "9d908793eceb04a8c8f74cfc6af3429ce140d2e2", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Config\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Config package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/console", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/console.git", + "reference": "c2c078d71efc8d75ca3741402a4b0fd3bf05c6fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/console/zipball/c2c078d71efc8d75ca3741402a4b0fd3bf05c6fc", + "reference": "c2c078d71efc8d75ca3741402a4b0fd3bf05c6fc", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/console": "^5.0", + "symfony/process": "^5.0" + }, + "suggest": { + "dragonmantank/cron-expression": "Required to use scheduler (^2.3.1).", + "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.3.1|^7.0.1).", + "illuminate/bus": "Required to use the scheduled job dispatcher (^7.0).", + "illuminate/container": "Required to use the scheduler (^7.0).", + "illuminate/filesystem": "Required to use the generator command (^7.0).", + "illuminate/queue": "Required to use closures for scheduled jobs (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Console package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/container", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/container.git", + "reference": "06456a2ea5656c2f1ebda37039ce14c1bfc973b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/container/zipball/06456a2ea5656c2f1ebda37039ce14c1bfc973b3", + "reference": "06456a2ea5656c2f1ebda37039ce14c1bfc973b3", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "php": "^7.2.5|^8.0", + "psr/container": "^1.0" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Container\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Container package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/contracts", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/contracts.git", + "reference": "2449f2ea949ddf995a3dcffe5e21c768cf7d6478" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/2449f2ea949ddf995a3dcffe5e21c768cf7d6478", + "reference": "2449f2ea949ddf995a3dcffe5e21c768cf7d6478", + "shasum": "" + }, + "require": { + "php": "^7.2.5|^8.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Contracts\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Contracts package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/database", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/database.git", + "reference": "e26b023f23c08968950470189e108e30f2e3b7ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/database/zipball/e26b023f23c08968950470189e108e30f2e3b7ba", + "reference": "e26b023f23c08968950470189e108e30f2e3b7ba", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/console": "^5.0" + }, + "suggest": { + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", + "illuminate/console": "Required to use the database commands (^7.0).", + "illuminate/events": "Required to use the observers with Eloquent (^7.0).", + "illuminate/filesystem": "Required to use the migrations (^7.0).", + "illuminate/pagination": "Required to paginate the result set (^7.0).", + "symfony/finder": "Required to use Eloquent model factories (^5.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Database\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Database package.", + "homepage": "https://laravel.com", + "keywords": [ + "database", + "laravel", + "orm", + "sql" + ], + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/encryption", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/encryption.git", + "reference": "2b58e3a5175003f8a2272691a8b5c6c8e059c97d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/encryption/zipball/2b58e3a5175003f8a2272691a8b5c6c8e059c97d", + "reference": "2b58e3a5175003f8a2272691a8b5c6c8e059c97d", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Encryption\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Encryption package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/events", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/events.git", + "reference": "6f64db49dbfd490c6e30c983964543a054882faf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/events/zipball/6f64db49dbfd490c6e30c983964543a054882faf", + "reference": "6f64db49dbfd490c6e30c983964543a054882faf", + "shasum": "" + }, + "require": { + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Events\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Events package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/filesystem", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/filesystem.git", + "reference": "2013f94a3a7dff008be54884774548e3c222c3e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/2013f94a3a7dff008be54884774548e3c222c3e8", + "reference": "2013f94a3a7dff008be54884774548e3c222c3e8", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/finder": "^5.0" + }, + "suggest": { + "ext-ftp": "Required to use the Flysystem FTP driver.", + "illuminate/http": "Required for handling uploaded files (^7.0).", + "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.1).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", + "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", + "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "symfony/mime": "Required to enable support for guessing extensions (^5.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Filesystem package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/hashing", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/hashing.git", + "reference": "021a2a74f77f2b7bab4ef19b32bb9326c7cefacd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/hashing/zipball/021a2a74f77f2b7bab4ef19b32bb9326c7cefacd", + "reference": "021a2a74f77f2b7bab4ef19b32bb9326c7cefacd", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Hashing\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Hashing package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/http", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/http.git", + "reference": "39d6e9eca58b575016be5d85cc1f223f632c0e95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/http/zipball/39d6e9eca58b575016be5d85cc1f223f632c0e95", + "reference": "39d6e9eca58b575016be5d85cc1f223f632c0e95", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/session": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/http-foundation": "^5.0", + "symfony/http-kernel": "^5.0", + "symfony/mime": "^5.0" + }, + "suggest": { + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "guzzlehttp/guzzle": "Required to use the HTTP Client (^6.3.1|^7.0.1)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Http\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Http package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-01-21T14:08:35+00:00" + }, + { + "name": "illuminate/log", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/log.git", + "reference": "6152160fac69ff3267ccc1e87ea070503b79a906" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/log/zipball/6152160fac69ff3267ccc1e87ea070503b79a906", + "reference": "6152160fac69ff3267ccc1e87ea070503b79a906", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "monolog/monolog": "^2.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Log package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/pagination", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/pagination.git", + "reference": "5815c28d9430fb3eff673c6876881621b4fea48b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/pagination/zipball/5815c28d9430fb3eff673c6876881621b4fea48b", + "reference": "5815c28d9430fb3eff673c6876881621b4fea48b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Pagination\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Pagination package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/pipeline", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/pipeline.git", + "reference": "68434133b675a9914868fb2d8f665ec2157d9faa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/pipeline/zipball/68434133b675a9914868fb2d8f665ec2157d9faa", + "reference": "68434133b675a9914868fb2d8f665ec2157d9faa", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Pipeline\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Pipeline package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/queue", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/queue.git", + "reference": "91d7b3db1c816f08bb7607a3ec662a6b7015e112" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/queue/zipball/91d7b3db1c816f08bb7607a3ec662a6b7015e112", + "reference": "91d7b3db1c816f08bb7607a3ec662a6b7015e112", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/console": "^7.0", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/database": "^7.0", + "illuminate/filesystem": "^7.0", + "illuminate/pipeline": "^7.0", + "illuminate/support": "^7.0", + "opis/closure": "^3.6", + "php": "^7.2.5|^8.0", + "ramsey/uuid": "^3.7|^4.0", + "symfony/process": "^5.0" + }, + "suggest": { + "aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.155).", + "ext-pcntl": "Required to use all features of the queue worker.", + "ext-posix": "Required to use all features of the queue worker.", + "illuminate/redis": "Required to use the Redis queue driver (^7.0).", + "pda/pheanstalk": "Required to use the Beanstalk queue driver (^4.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Queue\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Queue package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/session", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/session.git", + "reference": "b18bc348f4af2afae78e72ea332a4390c5c01a72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/session/zipball/b18bc348f4af2afae78e72ea332a4390c5c01a72", + "reference": "b18bc348f4af2afae78e72ea332a4390c5c01a72", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/contracts": "^7.0", + "illuminate/filesystem": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/finder": "^5.0", + "symfony/http-foundation": "^5.0" + }, + "suggest": { + "illuminate/console": "Required to use the session:table command (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Session\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Session package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/support", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/support.git", + "reference": "c7b42acd009c94a3f8b749a65f6835db90174d58" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/support/zipball/c7b42acd009c94a3f8b749a65f6835db90174d58", + "reference": "c7b42acd009c94a3f8b749a65f6835db90174d58", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^1.4|^2.0", + "ext-json": "*", + "ext-mbstring": "*", + "illuminate/contracts": "^7.0", + "nesbot/carbon": "^2.31", + "php": "^7.2.5|^8.0", + "voku/portable-ascii": "^1.4.8" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (^7.0).", + "moontoast/math": "Required to use ordered UUIDs (^1.1).", + "ramsey/uuid": "Required to use Str::uuid() (^3.7|^4.0).", + "symfony/process": "Required to use the composer class (^5.0).", + "symfony/var-dumper": "Required to use the dd function (^5.0).", + "vlucas/phpdotenv": "Required to use the Env class and env helper (^4.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "files": [ + "helpers.php" + ], + "psr-4": { + "Illuminate\\Support\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-12-06T19:25:06+00:00" + }, + { + "name": "illuminate/testing", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/testing.git", + "reference": "150fc64c2f5bc31183870ea0d691a69456ac2cac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/testing/zipball/150fc64c2f5bc31183870ea0d691a69456ac2cac", + "reference": "150fc64c2f5bc31183870ea0d691a69456ac2cac", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/polyfill-php73": "^1.17" + }, + "suggest": { + "illuminate/console": "Required to assert console commands (^7.0).", + "illuminate/database": "Required to assert databases (^7.0).", + "illuminate/http": "Required to assert responses (^7.0).", + "mockery/mockery": "Required to use mocking (~1.3.3|^1.4.2).", + "phpunit/phpunit": "Required to use assertions and run tests (^8.4|^9.3.3)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Testing\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Testing package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-11-17T15:00:14+00:00" + }, + { + "name": "illuminate/translation", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/translation.git", + "reference": "3fa058d9fbac56fd53d211e43acdb107fb1d2a77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/translation/zipball/3fa058d9fbac56fd53d211e43acdb107fb1d2a77", + "reference": "3fa058d9fbac56fd53d211e43acdb107fb1d2a77", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/contracts": "^7.0", + "illuminate/filesystem": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Translation package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2020-10-27T15:11:37+00:00" + }, + { + "name": "illuminate/validation", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/validation.git", + "reference": "0520da7549fb4b16b1948357b2328e1cc8d234c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/validation/zipball/0520da7549fb4b16b1948357b2328e1cc8d234c6", + "reference": "0520da7549fb4b16b1948357b2328e1cc8d234c6", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.1.10", + "ext-json": "*", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/support": "^7.0", + "illuminate/translation": "^7.0", + "php": "^7.2.5|^8.0", + "symfony/http-foundation": "^5.0", + "symfony/mime": "^5.0" + }, + "suggest": { + "illuminate/database": "Required to use the database presence verifier (^7.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Validation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Validation package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-12-06T19:27:14+00:00" + }, + { + "name": "illuminate/view", + "version": "v7.30.6", + "source": { + "type": "git", + "url": "https://github.com/illuminate/view.git", + "reference": "098e583d43c8fd1d3505ed83b2d54a31ce20bcdb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/view/zipball/098e583d43c8fd1d3505ed83b2d54a31ce20bcdb", + "reference": "098e583d43c8fd1d3505ed83b2d54a31ce20bcdb", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/events": "^7.0", + "illuminate/filesystem": "^7.0", + "illuminate/support": "^7.0", + "php": "^7.2.5|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\View\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate View package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-12-06T19:25:06+00:00" + }, + { + "name": "laravel/lumen-framework", + "version": "v7.2.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/lumen-framework.git", + "reference": "613c9c02dd9632f18c6e2542a289cb37a98c939f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/lumen-framework/zipball/613c9c02dd9632f18c6e2542a289cb37a98c939f", + "reference": "613c9c02dd9632f18c6e2542a289cb37a98c939f", + "shasum": "" + }, + "require": { + "dragonmantank/cron-expression": "^2.0", + "illuminate/auth": "^7.0", + "illuminate/broadcasting": "^7.0", + "illuminate/bus": "^7.0", + "illuminate/cache": "^7.0", + "illuminate/config": "^7.0", + "illuminate/console": "^7.0", + "illuminate/container": "^7.0", + "illuminate/contracts": "^7.0", + "illuminate/database": "^7.0", + "illuminate/encryption": "^7.0", + "illuminate/events": "^7.0", + "illuminate/filesystem": "^7.0", + "illuminate/hashing": "^7.0", + "illuminate/http": "^7.0", + "illuminate/log": "^7.0", + "illuminate/pagination": "^7.0", + "illuminate/pipeline": "^7.0", + "illuminate/queue": "^7.0", + "illuminate/support": "^7.0", + "illuminate/testing": "^7.0", + "illuminate/translation": "^7.0", + "illuminate/validation": "^7.0", + "illuminate/view": "^7.0", + "nikic/fast-route": "^1.3", + "php": "^7.2.5", + "symfony/console": "^5.0", + "symfony/error-handler": "^5.0", + "symfony/http-foundation": "^5.0", + "symfony/http-kernel": "^5.0", + "symfony/mime": "^5.0", + "symfony/var-dumper": "^5.0", + "vlucas/phpdotenv": "^4.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^8.4|^9.0" + }, + "suggest": { + "laravel/tinker": "Required to use the tinker console command (^2.0).", + "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Laravel\\Lumen\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "The Laravel Lumen Framework.", + "homepage": "https://lumen.laravel.com", + "keywords": [ + "framework", + "laravel", + "lumen" + ], + "support": { + "issues": "https://github.com/laravel/lumen-framework/issues", + "source": "https://github.com/laravel/lumen-framework" + }, + "time": "2020-09-15T14:53:08+00:00" + }, + { + "name": "monolog/monolog", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0", + "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.3", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5.14", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3 || ^2 || ^3", + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/2.6.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2022-05-10T09:36:00+00:00" + }, + { + "name": "nesbot/carbon", + "version": "2.58.0", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/97a34af22bde8d0ac20ab34b29d7bfe360902055", + "reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1.8 || ^8.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "doctrine/dbal": "^2.0 || ^3.0", + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.54 || ^1.0", + "phpunit/php-file-iterator": "^2.0.5", + "phpunit/phpunit": "^7.5.20 || ^8.5.23", + "squizlabs/php_codesniffer": "^3.4" + }, + "bin": [ + "bin/carbon" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-3.x": "3.x-dev", + "dev-master": "2.x-dev" + }, + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "description": "An API extension for DateTime that supports 281 different languages.", + "homepage": "https://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "docs": "https://carbon.nesbot.com/docs", + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "funding": [ + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2022-04-25T19:31:17+00:00" + }, + { + "name": "nikic/fast-route", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", + "reference": "181d480e08d9476e61381e04a71b34dc0432e812", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|~5.7" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "FastRoute\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "support": { + "issues": "https://github.com/nikic/FastRoute/issues", + "source": "https://github.com/nikic/FastRoute/tree/master" + }, + "time": "2018-02-13T20:26:39+00:00" + }, + { + "name": "opis/closure", + "version": "3.6.3", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "autoload": { + "files": [ + "functions.php" + ], + "psr-4": { + "Opis\\Closure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/opis/closure/issues", + "source": "https://github.com/opis/closure/tree/3.6.3" + }, + "time": "2022-01-27T09:35:39+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2021-12-04T23:24:31+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "time": "2020-06-29T06:28:15+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, + "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "ramsey/collection", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/ramsey/collection.git", + "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a", + "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8", + "symfony/polyfill-php81": "^1.23" + }, + "require-dev": { + "captainhook/captainhook": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "ergebnis/composer-normalize": "^2.6", + "fakerphp/faker": "^1.5", + "hamcrest/hamcrest-php": "^2", + "jangregor/phpstan-prophecy": "^0.8", + "mockery/mockery": "^1.3", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1", + "phpstan/phpstan": "^0.12.32", + "phpstan/phpstan-mockery": "^0.12.5", + "phpstan/phpstan-phpunit": "^0.12.11", + "phpunit/phpunit": "^8.5 || ^9", + "psy/psysh": "^0.10.4", + "slevomat/coding-standard": "^6.3", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ramsey\\Collection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "A PHP library for representing and manipulating collections.", + "keywords": [ + "array", + "collection", + "hash", + "map", + "queue", + "set" + ], + "support": { + "issues": "https://github.com/ramsey/collection/issues", + "source": "https://github.com/ramsey/collection/tree/1.2.2" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", + "type": "tidelift" + } + ], + "time": "2021-10-10T03:01:02+00:00" + }, + { + "name": "ramsey/uuid", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "shasum": "" + }, + "require": { + "brick/math": "^0.8 || ^0.9", + "ext-json": "*", + "php": "^7.2 || ^8.0", + "ramsey/collection": "^1.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php80": "^1.14" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "captainhook/captainhook": "^5.10", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "doctrine/annotations": "^1.8", + "ergebnis/composer-normalize": "^2.15", + "mockery/mockery": "^1.3", + "moontoast/math": "^1.1", + "paragonie/random-lib": "^2", + "php-mock/php-mock": "^2.2", + "php-mock/php-mock-mockery": "^1.3", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpbench/phpbench": "^1.0", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-mockery": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^8.5 || ^9", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.9" + }, + "suggest": { + "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", + "ext-ctype": "Enables faster processing of character classification using ctype functions.", + "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", + "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.x-dev" + }, + "captainhook": { + "force-install": true + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "source": "https://github.com/ramsey/uuid/tree/4.2.3" + }, + "funding": [ + { + "url": "https://github.com/ramsey", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" + } + ], + "time": "2021-09-25T23:10:38+00:00" + }, + { + "name": "rap2hpoutre/laravel-log-viewer", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/rap2hpoutre/laravel-log-viewer.git", + "reference": "27392d29234b6ff38a456454558f4bcc40cc837a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rap2hpoutre/laravel-log-viewer/zipball/27392d29234b6ff38a456454558f4bcc40cc837a", + "reference": "27392d29234b6ff38a456454558f4bcc40cc837a", + "shasum": "" + }, + "require": { + "illuminate/support": "4.2.*|5.*|^6.0|^7.0|^8.0", + "php": ">=5.4.0" + }, + "require-dev": { + "orchestra/testbench": "3.7.*", + "phpunit/phpunit": "^7" + }, + "type": "laravel-package", + "extra": { + "laravel": { + "providers": [ + "Rap2hpoutre\\LaravelLogViewer\\LaravelLogViewerServiceProvider" + ] + } + }, + "autoload": { + "psr-0": { + "Rap2hpoutre\\LaravelLogViewer\\": "src/" + }, + "classmap": [ + "src/controllers" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "rap2hpoutre", + "email": "raphaelht@gmail.com" + } + ], + "description": "A Laravel log reader", + "keywords": [ + "laravel", + "log", + "log-reader", + "log-viewer", + "logging", + "lumen" + ], + "support": { + "issues": "https://github.com/rap2hpoutre/laravel-log-viewer/issues", + "source": "https://github.com/rap2hpoutre/laravel-log-viewer/tree/master" + }, + "time": "2020-09-08T12:21:27+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/829d5d1bf60b2efeb0887b7436873becc71a45eb", + "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-18T06:17:34+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/error-handler", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "c116cda1f51c678782768dce89a45f13c949455d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c116cda1f51c678782768dce89a45f13c949455d", + "reference": "c116cda1f51c678782768dce89a45f13c949455d", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "require-dev": { + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0" + }, + "bin": [ + "Resources/bin/patch-type-declarations" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to manage errors and ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/error-handler/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-21T13:57:48+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-05T16:45:39+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/event-dispatcher": "^1" + }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/finder", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v5.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-04-15T08:07:45+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "6b0d0e4aca38d57605dcd11e2416994b38774522" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6b0d0e4aca38d57605dcd11e2416994b38774522", + "reference": "6b0d0e4aca38d57605dcd11e2416994b38774522", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/mime": "To use the file extension guesser" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-17T15:07:29+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "34b121ad3dc761f35fe1346d2f15618f8cbf77f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/34b121ad3dc761f35fe1346d2f15618f8cbf77f8", + "reference": "34b121ad3dc761f35fe1346d2f15618f8cbf77f8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/log": "^1|^2", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^5.0|^6.0", + "symfony/http-foundation": "^5.3.7|^6.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/browser-kit": "<5.4", + "symfony/cache": "<5.0", + "symfony/config": "<5.0", + "symfony/console": "<4.4", + "symfony/dependency-injection": "<5.3", + "symfony/doctrine-bridge": "<5.0", + "symfony/form": "<5.0", + "symfony/http-client": "<5.0", + "symfony/mailer": "<5.0", + "symfony/messenger": "<5.0", + "symfony/translation": "<5.0", + "symfony/twig-bridge": "<5.0", + "symfony/validator": "<5.0", + "twig/twig": "<2.13" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^5.4|^6.0", + "symfony/config": "^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/dom-crawler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client-contracts": "^1.1|^2|^3", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2|^3", + "twig/twig": "^2.13|^3.0.4" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a structured process for converting a Request into a Response", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-27T07:09:08+00:00" + }, + { + "name": "symfony/mime", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e", + "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.2|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-21T10:24:18+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "30885182c981ab175d4d034db0f6f469898070ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-20T20:35:02+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-23T21:10:46+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-14T14:02:44+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-30T18:21:41+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:17:38+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-06-05T21:20:04+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-03-04T08:16:47+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:11+00:00" + }, + { + "name": "symfony/process", + "version": "v5.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v5.4.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-04-08T05:07:18+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-03-13T20:07:29+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-04-19T10:40:37+00:00" + }, + { + "name": "symfony/translation", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "1639abc1177d26bcd4320e535e664cef067ab0ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/1639abc1177d26bcd4320e535e664cef067ab0ca", + "reference": "1639abc1177d26bcd4320e535e664cef067ab0ca", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation-contracts": "^2.3" + }, + "conflict": { + "symfony/config": "<4.4", + "symfony/console": "<5.3", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" + }, + "provide": { + "symfony/translation-implementation": "2.3" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-kernel": "^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-06T12:33:37+00:00" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "1211df0afa701e45a04253110e959d4af4ef0f07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1211df0afa701e45a04253110e959d4af4ef0f07", + "reference": "1211df0afa701e45a04253110e959d4af4ef0f07", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v5.4.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "af52239a330fafd192c773795520dc2dd62b5657" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657", + "reference": "af52239a330fafd192c773795520dc2dd62b5657", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0", + "twig/twig": "^2.13|^3.0.4" + }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v5.4.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-21T10:24:18+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v4.2.2", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "77e974614d2ead521f18069dccc571696f52b8dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/77e974614d2ead521f18069dccc571696f52b8dc", + "reference": "77e974614d2ead521f18069dccc571696f52b8dc", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0", + "phpoption/phpoption": "^1.7.3", + "symfony/polyfill-ctype": "^1.17" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-filter": "*", + "ext-pcre": "*", + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator.", + "ext-pcre": "Required to use most of the library." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.2" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2021-12-12T23:07:53+00:00" + }, + { + "name": "voku/portable-ascii", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/87337c91b9dfacee02452244ee14ab3c43bc485a", + "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "support": { + "issues": "https://github.com/voku/portable-ascii/issues", + "source": "https://github.com/voku/portable-ascii/tree/1.6.1" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", + "type": "tidelift" + } + ], + "time": "2022-01-24T18:55:24+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "fzaninotto/faker", + "version": "v1.9.2", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e", + "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/fzaninotto/Faker/issues", + "source": "https://github.com/fzaninotto/Faker/tree/v1.9.2" + }, + "abandoned": true, + "time": "2020-12-11T09:56:16+00:00" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0|^8.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, + "time": "2020-07-09T08:09:16+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": "^7.3 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<8.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.5 || ^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.5.0" + }, + "time": "2022-01-20T13:18:17+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "77a32518733312af16a44300404e945338981de3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + }, + "time": "2022-03-15T21:29:03+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + }, + "time": "2021-12-08T12:19:24+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "7.0.15", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "819f92bba8b001d4363065928088de22f25a3a48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.2.2" + }, + "suggest": { + "ext-xdebug": "^2.7.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-26T12:20:09+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:42:26+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2020-08-04T08:28:15+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "8.5.26", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "ef117c59fc4c54a979021b26d08a3373e386606d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ef117c59fc4c54a979021b26d08a3373e386606d", + "reference": "ef117c59fc4c54a979021b26d08a3373e386606d", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.2", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.26" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-04-01T12:34:39+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:04:30+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:59:04+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T13:51:24+00:00" + }, + { + "name": "sebastian/global-state", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-10T06:55:38+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:30:19+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:25:11+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, + "time": "2021-03-09T10:59:23+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": true, + "prefer-lowest": false, + "platform": { + "php": "^7.2.5" + }, + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/config/cors.php b/config/cors.php new file mode 100644 index 0000000..912e7c3 --- /dev/null +++ b/config/cors.php @@ -0,0 +1,60 @@ + ['api/*'], + + /* + * Matches the request method. `['*']` allows all methods. + */ + 'allowed_methods' => ['*'], + + /* + * Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com` + */ + 'allowed_origins' => ['*'], + + /* + * Patterns that can be used with `preg_match` to match the origin. + */ + 'allowed_origins_patterns' => [], + + /* + * Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers. + */ + 'allowed_headers' => ['*'], + + /* + * Sets the Access-Control-Expose-Headers response header with these headers. + */ + 'exposed_headers' => [], + + /* + * Sets the Access-Control-Max-Age response header when > 0. + */ + 'max_age' => 86400, + + /* + * Sets the Access-Control-Allow-Credentials header. + */ + 'supports_credentials' => true, +]; From c6039c860a2bd4679a13a9b05d20e26e14b0c73e Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 23 Nov 2023 16:39:50 +0800 Subject: [PATCH 027/114] Add tinker files --- tinker/getActiveCawanganDbConnection.php | 26 ++++ tinker/getLaporanCawangan.php | 183 +++++++++++++++++++++++ tinker/getLaporanGadaiAll.php | 55 +++++++ tinker/getLaporanGadaiAllSummary.php | 29 ++++ 4 files changed, 293 insertions(+) create mode 100644 tinker/getActiveCawanganDbConnection.php create mode 100644 tinker/getLaporanCawangan.php create mode 100644 tinker/getLaporanGadaiAll.php create mode 100644 tinker/getLaporanGadaiAllSummary.php diff --git a/tinker/getActiveCawanganDbConnection.php b/tinker/getActiveCawanganDbConnection.php new file mode 100644 index 0000000..a9fd113 --- /dev/null +++ b/tinker/getActiveCawanganDbConnection.php @@ -0,0 +1,26 @@ +getPdo(); + return true; + } catch (\Throwable $th) { + return false; + } +}); + +$non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb']; + +$all_cawangan_db = array_filter($all_active_db_keys, function($db_key) use($non_cawangan_database){ + $isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database); + + if($isNotCawangan){ + return false; + } + + return true; +}); + +return $all_cawangan_db; diff --git a/tinker/getLaporanCawangan.php b/tinker/getLaporanCawangan.php new file mode 100644 index 0000000..ee6f18f --- /dev/null +++ b/tinker/getLaporanCawangan.php @@ -0,0 +1,183 @@ +all(); +$request->merge([ + 'startDate' => '2023-8-21', + 'endDate' => '2023-10-22', + 'kod_cawangan' => 'KB2', +]); +// test variable + +function getCawanganDetail($cawangan_connection) +{ + $cawangan_detail = CawanganDetail::on($cawangan_connection)->get() + ->map(function ($detail) { + return [ + 'nama' => $detail['namacaw'], + 'code' => $detail['kodcaw'] . ' Ar-Rahn ' . $detail['cawangan'], + 'alamat' => $detail['alamat1'], + 'waktu_operasi' => $detail['alamat4'], + ]; + }); + + return $cawangan_detail; + +} + +function getTotalSummaryGadaian(Builder $query_total_gadaian) +{ + $formatNumber = function ($amount) { + $formattedAmount = number_format($amount, 2, '.', ','); + + return $formattedAmount; + }; + + $total_summary_gadaian = (clone $query_total_gadaian) + ->selectRaw('sum(berat) as total_berat, sum(nilaimarhun) as total_nilai_marhun, sum(pinjaman) as total_pembiayaan') + ->get() + ->map(function ($x) use ($formatNumber) { + return [ + 'total_berat' => $formatNumber($x['total_berat']), + 'total_nilai_marhun' => $formatNumber($x['total_nilai_marhun']), + 'total_pembiayaan' => $formatNumber($x['total_pembiayaan']), + ]; + }); + + return $total_summary_gadaian; +} + +function getTotalSummaryGadaianGroupByTeller(Builder $query_total_gadaian) +{ + + $total_summary_gadaian_groupByTeller = (clone $query_total_gadaian) + ->selectRaw('sum(berat) as total_berat, sum(nilaimarhun) as total_nilai_marhun, sum(pinjaman) as total_pembiayaan') + ->groupBy('teller') + ->get(); + return $total_summary_gadaian_groupByTeller; +} + +function getTotalGadaian(Builder $query_total_gadaian) +{ + $total_gadaian = (clone $query_total_gadaian) + ->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') + ->orderBy('teller') + ->orderBy('sirig') + ->get(); + return $total_gadaian; +} + +function getCustomerInfo($total_gadaian) +{ + + $extract_nokp = $total_gadaian->pluck('nokp'); + + $customer_info = Customer::on('mysql7') + ->select(['nama', 'alamat1', 'kpbaru', 'kplama']) + ->where(function ($query) use ($extract_nokp) { + $query->whereIn('kpbaru', $extract_nokp) + ->orWhereIn('kplama', $extract_nokp); + }) + ->get(); + + $customer_info = collect($extract_nokp)->map(function ($nokp) use ($customer_info) { + return $customer_info->where('kpbaru', $nokp)->first() ?? $customer_info->where('kplama', $nokp)->first(); + })->toArray(); + + return $customer_info; +} + +function getMarhunGadaian($total_gadaian, $cawangan_connection) +{ + + $extract_norujukan = $total_gadaian->pluck('norujukan'); + + $marhun_gadaian = Marhun::on($cawangan_connection) + ->select('norujukan', 'bil', 'marhun') + ->whereIn('norujukan', $extract_norujukan) + ->get() + ->groupBy('norujukan') + ->toArray(); + + $marhun_gadaian = array_map(function ($gadaian) { + return array_map(function ($norujukan) { + return $norujukan['bil'] . ' ' . $norujukan['marhun']; + }, $gadaian); + }, $marhun_gadaian); + + $marhun_gadaian = array_map(function ($gadaian) { + return implode(',', $gadaian); + }, $marhun_gadaian); + + return $marhun_gadaian; +} + +function getReportGadaian(Request $request) +{ +$cawangan_connection = Cawangan::where('kodcaw', $request->kod_cawangan)->first()->mysql; + +$query_total_gadaian = Gadai::on($cawangan_connection); + +$query_total_gadaian->when($request->filled('startDate') and $request->filled('endDate'), function ($q) use ($request) { + return $q->where('t_gadai', '>=', $request->startDate) + ->where('t_gadai', '<=', $request->endDate); +}); + +$total_gadaian = getTotalGadaian($query_total_gadaian); +$total_summary_gadaian_teller = getTotalSummaryGadaianGroupByTeller($query_total_gadaian); +$total_summary_gadaian = getTotalSummaryGadaian($query_total_gadaian); +$customer_info = getCustomerInfo($total_gadaian); +$marhun_gadaian = getMarhunGadaian($total_gadaian, $cawangan_connection); +$cawangan_detail = getCawanganDetail($cawangan_connection); + +$total_gadaian = $total_gadaian->zip($customer_info, $marhun_gadaian)->map(function ($data) { + + [$gadai, $customer_info, $marhun_gadaian] = $data; + + return [ + 'no_rujukan' => $gadai['norujukan'], + 'nama' => $customer_info['nama'], + 'alamat' => $customer_info['alamat1'], + 'no_kp' => $gadai['nokp'], + 'masa' => $gadai['masa'], + 'marhun' => $marhun_gadaian, + 'berat' => formatNumber($gadai['berat']), + 'nilai_marhun' => formatNumber($gadai['nilaimarhun']), + 'pembiayaan' => formatNumber($gadai['pinjaman']), + 'peratusan_margin_pinjaman' => $gadai['percentpinj'], + 'teller' => $gadai['teller'], + ]; + +}); + +$total_gadaian = $total_gadaian + ->groupBy('teller') + ->zip($total_summary_gadaian_teller) + ->map(function ($data) { + [$gadaian, $summary] = $data; + + return [$gadaian, $summary]; + }); + +$data = [ + 'query' => [ + 'startDate' => formatDate($request->startDate), + 'endDate' => formatDate($request->endDate), + ], + 'cawangan_detail' => $cawangan_detail, + 'gadaian' => $total_gadaian, + 'summary_gadaian' => $total_summary_gadaian, +]; + +return json_encode($data); + +} diff --git a/tinker/getLaporanGadaiAll.php b/tinker/getLaporanGadaiAll.php new file mode 100644 index 0000000..d1d09b7 --- /dev/null +++ b/tinker/getLaporanGadaiAll.php @@ -0,0 +1,55 @@ +pluck('details_caw')->toArray(); + +$gadai_data = array_map(function ($db_connection) use ($tarikh) { + $gadai = Gadai::on($db_connection)->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp') + ->where('t_gadai', '=', $tarikh) + ->orderBy('teller') + ->orderBy('sirig') + ->get(); + + return $gadai->toArray(); +}, $active_cawangan_db_connection); + +$gadai_data_with_key = array_combine($active_cawangan_name, $gadai_data); + +$overall_data_gadai = array_map(function ($gadaian_cawangan) { + return array_map(function ($gadai) { + + $customer_info = Customer::on('mysql7')->where('kplama', '=', $gadai['nokp'])->orWhere('kpbaru', '=', $gadai['nokp'])->first()->toArray(); + + return [ + "t_gadai" => $gadai['t_gadai'], + "norujukan" => $gadai['norujukan'], + "nama" => $customer_info['nama'], + "nokp" => $gadai['nokp'], + "semakbarcode" => $gadai['semakbarcode'], + "masa" => $gadai['masa'], + "berat" => $gadai['berat'], + "nilaimarhun" => $gadai['nilaimarhun'], + "pinjaman" => $gadai['pinjaman'], + "upah12" => $gadai['upah12'], + "percentpinj" => $gadai['percentpinj'], + "alamat1" => $customer_info['alamat1'], + "teller" => $gadai['teller'], + ]; + + }, $gadaian_cawangan); + +}, $gadai_data_with_key); + +dump($overall_data_gadai); +return $overall_data_gadai; diff --git a/tinker/getLaporanGadaiAllSummary.php b/tinker/getLaporanGadaiAllSummary.php new file mode 100644 index 0000000..4d03b51 --- /dev/null +++ b/tinker/getLaporanGadaiAllSummary.php @@ -0,0 +1,29 @@ +whereIn('db_name', $active_cawangan_db_name)->get()->toArray(); + +$summary_gadaian_data = array_map(function ($db_connection) use ($tarikh) { + $gadai = Gadai::on($db_connection) + ->select(DB::raw('count(norujukan) as total_gadaian, sum(berat) as sum_berat, sum(nilaimarhun) as sum_nilai_marhun, sum(pinjaman) as sum_pinjaman')) + ->where('t_gadai', '=', $tarikh) + ->get(); + + return $gadai->toArray(); +}, $active_cawangan_db_connection); + +$response = array_map(function($cawangan_detail, $summary_gadaian_data){ + return array_merge($cawangan_detail, $summary_gadaian_data[0]); +}, $active_cawangan_detail, $summary_gadaian_data); + +return json_encode($response); From 492e7c0a582660d209d76067e7b0dcf69f9fdd06 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Mon, 27 Nov 2023 09:49:52 +0800 Subject: [PATCH 028/114] Fix helper implementation Use class with static files instead of load it directly in composer json --- .../Controllers/ReportGadaiController.php | 8 ++---- app/Services/Reports/GadaianService.php | 5 ++-- app/helpers.php | 28 ++++++++----------- composer.json | 3 -- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/app/Http/Controllers/ReportGadaiController.php b/app/Http/Controllers/ReportGadaiController.php index 55bd66c..3855601 100644 --- a/app/Http/Controllers/ReportGadaiController.php +++ b/app/Http/Controllers/ReportGadaiController.php @@ -3,14 +3,12 @@ namespace App\Http\Controllers; use App\Cawangan; -use App\CawanganDetail; -use App\Customer; use App\Gadai; -use App\Marhun; -use DateTime; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use App\Services\Reports\GadaianService as ReportGadaianService; +use App\Helper; + class ReportGadaiController extends Controller { @@ -27,7 +25,7 @@ class ReportGadaiController extends Controller $startDate = $request->startDate; $endDate = $request->endDate; - $active_cawangan_db_connection = getActiveCawanganDbConnection(); + $active_cawangan_db_connection = Helper::getActiveCawanganDbConnection(); $active_cawangan_db_name = array_map(function ($db_connection) { return config('database.connections' . '.' . $db_connection . '.' . 'database'); diff --git a/app/Services/Reports/GadaianService.php b/app/Services/Reports/GadaianService.php index 7eb65af..5aad15f 100644 --- a/app/Services/Reports/GadaianService.php +++ b/app/Services/Reports/GadaianService.php @@ -9,6 +9,7 @@ use App\Gadai; use App\Marhun; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; +use App\Helper; class GadaianService { @@ -82,8 +83,8 @@ class GadaianService $data = [ 'query' => [ - 'startDate' => formatDate($this->startDate), - 'endDate' => formatDate($this->endDate), + 'startDate' => Helper::formatDate($this->startDate), + 'endDate' => Helper::formatDate($this->endDate), ], 'cawangan_detail' => $cawangan_detail, 'gadaian' => $total_gadaian, diff --git a/app/helpers.php b/app/helpers.php index c610506..2e165c1 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -1,28 +1,25 @@ format("d-m-Y"); + } -if (!function_exists('formatDate')) { - function formatDate ($date_string) { - return (new DateTime($date_string))->format("d-m-Y"); - }; -} - -if (!function_exists('getActiveCawanganDbConnection')) { - - function getActiveCawanganDbConnection() + public static function getActiveCawanganDbConnection() { $all_active_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) { @@ -49,5 +46,4 @@ if (!function_exists('getActiveCawanganDbConnection')) { return $all_cawangan_db; } - } diff --git a/composer.json b/composer.json index deaf479..2c8071f 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,6 @@ "phpunit/phpunit": "^8.5" }, "autoload": { - "files":[ - "app/helpers.php" - ], "classmap": [ "database/seeds", "database/factories" From 3d30a98f017c21825e9be8c20ad79520997a33a2 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Nov 2023 16:29:43 +0800 Subject: [PATCH 029/114] add helpers in composer --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 2c8071f..deaf479 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,9 @@ "phpunit/phpunit": "^8.5" }, "autoload": { + "files":[ + "app/helpers.php" + ], "classmap": [ "database/seeds", "database/factories" From 30b8c93105c7e2d70b9c3fb795e9f7e21b2f2838 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Nov 2023 16:29:43 +0800 Subject: [PATCH 030/114] add helpers in composer --- app/helpers.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers.php b/app/helpers.php index 2e165c1..ed68dfa 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -46,4 +46,5 @@ class Helper return $all_cawangan_db; } + } From be9c20e7670670d6697bbaf08ced94cc1bc8d19f Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Mon, 27 Nov 2023 10:12:48 +0800 Subject: [PATCH 031/114] Remove composer.json backup --- composer_backuo.json | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 composer_backuo.json diff --git a/composer_backuo.json b/composer_backuo.json deleted file mode 100644 index ae83d4e..0000000 --- a/composer_backuo.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "laravel/lumen", - "description": "The Laravel Lumen Framework.", - "keywords": ["framework", "laravel", "lumen"], - "license": "MIT", - "type": "project", - "require": { - "php": "^7.2.5", - "auth0/auth0-php": "^7.4", - "laravel/lumen-framework": "^7.0", - "rap2hpoutre/laravel-log-viewer": "^1.7" - }, - "require-dev": { - "fzaninotto/faker": "^1.9.1", - "mockery/mockery": "^1.3.1", - "phpunit/phpunit": "^8.5" - }, - "autoload": { - "classmap": [ - "database/seeds", - "database/factories" - ], - "psr-4": { - "App\\": "app/" - } - }, - "autoload-dev": { - "classmap": [ - "tests/" - ] - }, - "config": { - "preferred-install": "dist", - "sort-packages": true, - "optimize-autoloader": true - }, - "minimum-stability": "dev", - "prefer-stable": true, - "scripts": { - "post-root-package-install": [ - "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" - ] - } -} From 7255ef3ea903c20ef20748a7a14571f6117e1bdb Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Mon, 27 Nov 2023 10:17:57 +0800 Subject: [PATCH 032/114] Update tinker files to use new Helper implementations --- tinker/getLaporanCawangan.php | 11 ++++++----- tinker/getLaporanGadaiAll.php | 3 ++- tinker/getLaporanGadaiAllSummary.php | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tinker/getLaporanCawangan.php b/tinker/getLaporanCawangan.php index ee6f18f..57b5464 100644 --- a/tinker/getLaporanCawangan.php +++ b/tinker/getLaporanCawangan.php @@ -7,6 +7,7 @@ use App\Gadai; use App\Marhun; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; +use App\Helper; // test variable $request = new Request(); @@ -150,9 +151,9 @@ $total_gadaian = $total_gadaian->zip($customer_info, $marhun_gadaian)->map(funct 'no_kp' => $gadai['nokp'], 'masa' => $gadai['masa'], 'marhun' => $marhun_gadaian, - 'berat' => formatNumber($gadai['berat']), - 'nilai_marhun' => formatNumber($gadai['nilaimarhun']), - 'pembiayaan' => formatNumber($gadai['pinjaman']), + 'berat' => Helper::formatNumber($gadai['berat']), + 'nilai_marhun' => Helper::formatNumber($gadai['nilaimarhun']), + 'pembiayaan' => Helper::formatNumber($gadai['pinjaman']), 'peratusan_margin_pinjaman' => $gadai['percentpinj'], 'teller' => $gadai['teller'], ]; @@ -170,8 +171,8 @@ $total_gadaian = $total_gadaian $data = [ 'query' => [ - 'startDate' => formatDate($request->startDate), - 'endDate' => formatDate($request->endDate), + 'startDate' => Helper::formatDate($request->startDate), + 'endDate' => Helper::formatDate($request->endDate), ], 'cawangan_detail' => $cawangan_detail, 'gadaian' => $total_gadaian, diff --git a/tinker/getLaporanGadaiAll.php b/tinker/getLaporanGadaiAll.php index d1d09b7..0addbcf 100644 --- a/tinker/getLaporanGadaiAll.php +++ b/tinker/getLaporanGadaiAll.php @@ -3,10 +3,11 @@ use App\Cawangan; use App\Customer; use App\Gadai; +use App\Helper; $tarikh = '2023-11-01'; -$active_cawangan_db_connection = getActiveCawanganDbConnection(); +$active_cawangan_db_connection = Helper::getActiveCawanganDbConnection(); $active_cawangan_db = array_map(function($connection){ return config('database.connections.' . $connection)['database']; diff --git a/tinker/getLaporanGadaiAllSummary.php b/tinker/getLaporanGadaiAllSummary.php index 4d03b51..dae0053 100644 --- a/tinker/getLaporanGadaiAllSummary.php +++ b/tinker/getLaporanGadaiAllSummary.php @@ -3,9 +3,10 @@ use App\Cawangan; use App\Gadai; use Illuminate\Support\Facades\DB; +use App\Helper; $tarikh = '2023-11-01'; -$active_cawangan_db_connection = getActiveCawanganDbConnection(); +$active_cawangan_db_connection = Helper::getActiveCawanganDbConnection(); $active_cawangan_db_name = array_map(function($db_connection){ return config('database.connections' . '.' . $db_connection. '.' . 'database' ); From b41455aa81113429f5fec28a10f2efa1ac382529 Mon Sep 17 00:00:00 2001 From: Amirah Date: Tue, 28 Nov 2023 16:47:58 +0800 Subject: [PATCH 033/114] add api laporan ujrah range date --- app/Http/Controllers/GadaiController.php | 165 +++++++++++++++++++++-- app/Http/Controllers/TebusController.php | 163 ++++++++++++++++++++-- routes/web.php | 11 ++ 3 files changed, 323 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index e443a22..8e4e2b3 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -751,8 +751,7 @@ class GadaiController extends Controller public function getLaporanGadai($kodcaw,$tarikh){ $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - - $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai','norujukan','nokp','semakbarcode','masa','berat','nilaimarhun','pinjaman','upah12','percentpinj','teller','nokp') + $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai','norujukan','nokp','semakbarcode','masa','berat','nilaimarhun','pinjaman','upah12','percentpinj','teller','nokp','ujrah','onepercent') ->where('t_gadai','=',$tarikh) ->orderBy('teller') ->orderBy('sirig') @@ -776,7 +775,9 @@ class GadaiController extends Controller "upah12"=> $gadaiData['upah12'], "percentpinj"=> $gadaiData['percentpinj'], "alamat1"=> $customer_info['alamat1'], - "teller"=> $gadaiData['teller'] + "teller"=> $gadaiData['teller'], + "onepercent"=> $gadaiData['onepercent'], + "ujrah"=> $gadaiData['ujrah'] ]); } } @@ -803,7 +804,7 @@ class GadaiController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai','norujukan','nokp','semakbarcode','masa','berat','nilaimarhun','pinjaman','upah12','percentpinj','teller','nokp') + $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai','norujukan','nokp','semakbarcode','masa','berat','nilaimarhun','pinjaman','upah12','percentpinj','teller','nokp','ujrah','onepercent') ->where('t_gadai','>=',$request->mula) ->where('t_gadai','<=',$request->akhir) ->orderBy('t_gadai') @@ -829,7 +830,9 @@ class GadaiController extends Controller "upah12"=> $gadaiData['upah12'], "percentpinj"=> $gadaiData['percentpinj'], "alamat1"=> $customer_info['alamat1'], - "teller"=> $gadaiData['teller'] + "teller"=> $gadaiData['teller'], + "ujrah"=> $gadaiData['ujrah'], + "onepercent"=> $gadaiData['onepercent'] ]); } } @@ -1151,7 +1154,17 @@ class GadaiController extends Controller $dateans = new Carbon($request->tarikh); $ansuran_data = Transaction::on('mysql7') - ->select('transaction.norujukan','trans.tarikh_bayaran','transaction.nokp','transaction.kodcaw','transaction.trans_type','cust.nama','trans.bayaran_pembiayaan','transaction.duit_masuk','trans.bayaran_keuntungan','transaction.teller') + ->select('transaction.norujukan', + 'trans.tarikh_bayaran', + 'transaction.nokp', + 'transaction.kodcaw', + 'transaction.trans_type', + 'cust.nama','trans.bayaran_pembiayaan', + 'transaction.duit_masuk', + 'trans.bayaran_keuntungan', + 'transaction.teller', + 'trans.ujrah', + 'trans.onepercent') ->leftJoin('transaksi_keuntungan as trans', function($join) { $join->on('transaction.norujukan', '=', 'trans.norujukan'); @@ -1186,7 +1199,72 @@ class GadaiController extends Controller "bayaran_pembiayaan" => $ansuranData['bayaran_pembiayaan'], "duit_masuk" => $ansuranData['duit_masuk'], "bayaran_keuntungan" => $ansuranData['bayaran_keuntungan'], - "teller" => $ansuranData['teller'] + "teller" => $ansuranData['teller'], + "ansuranujrah" => $ansuranData['ujrah'], + "ansuranonepercent" => $ansuranData['onepercent'], + + + ]); + } + } + + return response()->json($ansuran); + } + + public function getLaporanAnsuranUjrah($kodcaw,Request $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $ansuran_data = Transaction::on('mysql7') + ->select('transaction.norujukan', + 'trans.tarikh_bayaran', + 'transaction.nokp', + 'transaction.kodcaw', + 'transaction.trans_type', + 'cust.nama','trans.bayaran_pembiayaan', + 'transaction.duit_masuk', + 'trans.bayaran_keuntungan', + 'transaction.teller', + 'trans.ujrah', + 'trans.onepercent') + ->leftJoin('transaksi_keuntungan as trans', function($join) + { + $join->on('transaction.norujukan', '=', 'trans.norujukan'); + $join->on('transaction.created_at', '=', 'trans.tarikh_bayaran'); + }) + ->leftJoin('customer as cust', function($join) + { + $join->on('transaction.nokp', '=', 'cust.kpbaru'); + $join->orOn('transaction.nokp', '=', 'cust.kplama'); + }) + ->where('transaction.kodcaw','=',$kodcaw) + ->where('transaction.trans_type','=','A') + ->where('transaction.created_at','>=',$request->mula) + ->where('transaction.created_at','<=',$request->akhir) + ->orderBy('trans.tarikh_bayaran') + ->orderBy('transaction.teller') + ->get(); + + $ansuran = []; + + if($ansuran_data){ + foreach($ansuran_data as $index=>$ansuranData){ + $gadai = Gadai::on($cawangan['mysql'])->where('norujukan',$ansuranData['norujukan'])->first(); + + array_push($ansuran,[ + "norujukan" => $ansuranData['norujukan'], + "tarikh_bayaran" => $ansuranData['tarikh_bayaran'], + "nokp" => $ansuranData['nokp'], + "kodcaw" => $ansuranData['kodcaw'], + "trans_type" => $ansuranData['trans_type'], + "nama" => $ansuranData['nama'], + "tempoh" => $gadai['tempoh'], + "bakipjm" => $gadai['bakipjm'], + "bayaran_pembiayaan" => $ansuranData['bayaran_pembiayaan'], + "duit_masuk" => $ansuranData['duit_masuk'], + "bayaran_keuntungan" => $ansuranData['bayaran_keuntungan'], + "teller" => $ansuranData['teller'], + "ansuranujrah" => $ansuranData['ujrah'], + "ansuranonepercent" => $ansuranData['onepercent'], ]); } } @@ -1224,12 +1302,83 @@ class GadaiController extends Controller $keuntungankaunter = $ansuranskaunter->sum('trans.bayaran_keuntungan'); $pendahuluankaunter = $ansuranskaunter->sum('trans.bayaran_pembiayaan'); $bilangankaunter = $ansuranskaunter->count(); + $ujrahkaunter = $ansuranskaunter->sum('trans.ujrah'); + $onepercentkaunter = $ansuranskaunter->sum('trans.onepercent'); $keuntunganonline = $ansuransonline->sum('trans.bayaran_keuntungan'); $pendahuluanonline = $ansuransonline->sum('trans.bayaran_pembiayaan'); $bilanganonline = $ansuransonline->count(); - $arrayansuran = ['totalpendahuluankaunter' => $pendahuluankaunter, 'totalkeuntungankaunter' => $keuntungankaunter, 'bilangankaunter' => $bilangankaunter,'totalpendahuluanonline' => $pendahuluanonline, 'totalkeuntunganonline' => $keuntunganonline, 'bilanganonline' => $bilanganonline]; + $arrayansuran = [ + 'totalpendahuluankaunter' => $pendahuluankaunter, + 'totalkeuntungankaunter' => $keuntungankaunter, + 'bilangankaunter' => $bilangankaunter, + 'totalujrahkaunter' => $ujrahkaunter, + 'totalonepercentkaunter' => $onepercentkaunter, + + 'totalpendahuluanonline' => $pendahuluanonline, + 'totalkeuntunganonline' => $keuntunganonline, + 'bilanganonline' => $bilanganonline + ]; + + return response()->json($arrayansuran,200); + } + + public function getAnsuranSummaryRange($kodcaw,Request $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $dateans = new Carbon($request->mula); + $dateans2 = new Carbon($request->akhir); + + $ansuranskaunter = Transaction::on('mysql7') + ->leftJoin('transaksi_keuntungan as trans', function($join) + { + $join->on('transaction.norujukan', '=', 'trans.norujukan'); + $join->on('transaction.created_at', '=', 'trans.tarikh_bayaran'); + }) + ->where('transaction.kodcaw','=',$kodcaw) + ->where('transaction.trans_type','=','A') + ->where('transaction.teller','<>','Online') + ->whereDate('transaction.created_at','>=',$dateans) + ->whereDate('transaction.created_at','<=',$dateans2); + + $ansuransonline = Transaction::on('mysql7') + ->leftJoin('transaksi_keuntungan as trans', function($join) + { + $join->on('transaction.norujukan', '=', 'trans.norujukan'); + $join->on('transaction.created_at', '=', 'trans.tarikh_bayaran'); + }) + ->where('transaction.kodcaw','=',$kodcaw) + ->where('transaction.trans_type','=','A') + ->where('transaction.teller','=','Online') + ->whereDate('transaction.created_at','>=',$dateans) + ->whereDate('transaction.created_at','<=',$dateans2); + + $keuntungankaunter = $ansuranskaunter->sum('trans.bayaran_keuntungan'); + $pendahuluankaunter = $ansuranskaunter->sum('trans.bayaran_pembiayaan'); + $bilangankaunter = $ansuranskaunter->count(); + $ujrahkaunter = $ansuranskaunter->sum('trans.ujrah'); + $onepercentkaunter = $ansuranskaunter->sum('trans.onepercent'); + + + $keuntunganonline = $ansuransonline->sum('trans.bayaran_keuntungan'); + $pendahuluanonline = $ansuransonline->sum('trans.bayaran_pembiayaan'); + $bilanganonline = $ansuransonline->count(); + $ujrahonline = $ansuransonline->sum('trans.ujrah'); + $onepercentonline = $ansuransonline->sum('trans.onepercent'); + + $arrayansuran = [ + 'totalpendahuluankaunter' => $pendahuluankaunter, + 'totalkeuntungankaunter' => $keuntungankaunter, + 'bilangankaunter' => $bilangankaunter, + 'totalujrahkaunter' => $ujrahkaunter, + 'totalonepercentkaunter' => $onepercentkaunter, + + 'totalpendahuluanonline' => $pendahuluanonline, + 'totalkeuntunganonline' => $keuntunganonline, + 'bilanganonline' => $bilanganonline, + 'totalujrahonline' => $ujrahonline, + 'totalonepercentonline' => $onepercentonline, + ]; return response()->json($arrayansuran,200); } diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 0ae3446..83136b7 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -732,7 +732,6 @@ class TebusController extends Controller $customer_info = Customer::on('mysql7')->where('kplama','=',$tebusData['nokp'])->orWhere('kpbaru','=',$tebusData['nokp'])->first(); $trans = TransaksiKeuntungan::on('mysql7')->where('norujukan',$tebusData['norujukan'])->orderBy('tarikh_bayaran','desc')->first(); - array_push($tebus,[ "t_tebus"=>$tebusData['t_tebus'], "t_gadai"=>$tebusData['t_gadai'], @@ -750,7 +749,58 @@ class TebusController extends Controller "norujukan"=>$tebusData['norujukan'], "nama"=>$customer_info['nama'], "nokp"=>$tebusData['nokp'], - "jbg"=>$tebusData['jbg'] + "jbg"=>$tebusData['jbg'], + "ujrah"=>$tebusData['ujrah'], + "onepercent"=>$tebusData['onepercent'] + + ]); + } + } + + return response()->json($tebus); + } + + + public function getLaporanTebusUjrah($kodcaw, Request $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $tebus_data = Tebus::on($cawangan['mysql']) + ->select('tebus.t_tebus', 'gad.t_gadai','gad.hargajualan','gad.bakihargajualan','gad.bakipjm as gadaibakipjm','tebus.nilaimarhun','tebus.tagterima', 'tebus.teller','tebus.jenistebus','tebus.pinjaman','tebus.bakiupah','tebus.bakipjm','gad.norujukan','gad.nokp','tebus.jbg','tebus.ujrah','tebus.onepercent','gad.tagbaru') + ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') + ->where('tebus.t_tebus','>=',$request->mula) + ->where('tebus.t_tebus','<=',$request->akhir) + ->groupBy('tebus.norujukan') + ->orderBy('tebus.teller') + ->orderBy('tebus.sirit') + ->get(); + + $tebus = []; + if($tebus_data){ + foreach($tebus_data as $index=>$tebusData){ + $customer_info = Customer::on('mysql7')->where('kplama','=',$tebusData['nokp'])->orWhere('kpbaru','=',$tebusData['nokp'])->first(); + + $trans = TransaksiKeuntungan::on('mysql7')->where('norujukan',$tebusData['norujukan'])->orderBy('tarikh_bayaran','desc')->first(); + array_push($tebus,[ + "t_tebus"=>$tebusData['t_tebus'], + "t_gadai"=>$tebusData['t_gadai'], + "hargajualan"=>$tebusData['hargajualan'], + "bakihargajualan"=>$tebusData['bakihargajualan'], + "gadaibakipjm"=>$tebusData['gadaibakipjm'], + "tarikh_bayaran"=>$trans['tarikh_bayaran'], + "nilaimarhun"=>$tebusData['nilaimarhun'], + "tagterima"=>$tebusData['tagterima'], + "teller"=>$tebusData['teller'], + "jenistebus"=>$tebusData['jenistebus'], + "pinjaman"=>$tebusData['pinjaman'], + "bakiupah"=>$tebusData['bakiupah'], + "bakipjm"=>$tebusData['bakipjm'], + "norujukan"=>$tebusData['norujukan'], + "nama"=>$customer_info['nama'], + "nokp"=>$tebusData['nokp'], + "jbg"=>$tebusData['jbg'], + "ujrah"=>$tebusData['ujrah'], + "onepercent"=>$tebusData['onepercent'] + ]); } } @@ -770,6 +820,9 @@ class TebusController extends Controller $totalpenebusanarrahn = $tebusarrahn->sum('tebus.pinjaman'); $bilpenebusanarrahn = $tebusarrahn->count(); $totalkeuntunganarrahn = $tebusarrahn->sum('tebus.bakiupah'); + $totalujraharrahn = $tebusarrahn->sum('tebus.ujrah'); + $totalonepercentarrahn = $tebusarrahn->sum('tebus.onepercent'); + $tebustawarruq = Tebus::on($cawangan['mysql']) ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') @@ -790,10 +843,91 @@ class TebusController extends Controller $bilpenebusantawarruq = $tebustawarruq->count(); $totalrebatetawarruq = $tebustawarruq->sum('tebus.rebate'); $totalkeuntungantawarruq = $tebustawarruq->sum('tebus.bakiupah'); + $totalujrahtawarruq = $tebustawarruq->sum('tebus.ujrah'); + $totalonepercenttawarruq = $tebustawarruq->sum('tebus.onepercent'); + + // dd($totalkeuntunganarrahn,$totalkeuntungantawarruq); - $array_penebusan = ['bilarrahn' => $bilpenebusanarrahn, 'totalarrahn' => $totalpenebusanarrahn, 'keuntunganarrahn' => $totalkeuntunganarrahn, 'biltawarruq' => $bilpenebusantawarruq, 'totaltawarruq' => $totalpenebusantawarruq,'totalrebate' => $totalrebatetawarruq,'keuntungantawarruq' => $totalkeuntungantawarruq]; + $array_penebusan = [ + 'bilarrahn' => $bilpenebusanarrahn, + 'totalarrahn' => $totalpenebusanarrahn, + 'keuntunganarrahn' => $totalkeuntunganarrahn, + 'ujraharrahn' => $totalujraharrahn, + 'onepercentarrahn' => $totalonepercentarrahn, + + 'biltawarruq' => $bilpenebusantawarruq, + 'totaltawarruq' => $totalpenebusantawarruq, + 'totalrebate' => $totalrebatetawarruq, + 'keuntungantawarruq' => $totalkeuntungantawarruq, + 'ujrahtawarruq' => $totalujrahtawarruq, + 'onepercenttawarruq' => $totalonepercenttawarruq + ]; + + return response()->json($array_penebusan); + } + + public function getLaporanTebusPengasinganUjrah($kodcaw,Request $request){ + + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $tebusarrahn = Tebus::on($cawangan['mysql']) + ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') + ->where('tebus.t_tebus','>=',$request->mula) + ->where('tebus.t_tebus','<=',$request->akhir) + ->whereNull('hargajualan'); + + $totalpenebusanarrahn = $tebusarrahn->sum('tebus.pinjaman'); + $bilpenebusanarrahn = $tebusarrahn->count(); + $totalkeuntunganarrahn = $tebusarrahn->sum('tebus.bakiupah'); + $totalujraharrahn = $tebusarrahn->sum('tebus.ujrah'); + $totalonepercentarrahn = $tebusarrahn->sum('tebus.onepercent'); + + + $tebustawarruq = Tebus::on($cawangan['mysql']) + ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') + ->where('tebus.t_tebus','>=',$request->mula) + ->where('tebus.t_tebus','<=',$request->akhir) + ->whereNotNull('hargajualan'); + + $tebustawarruqansuran = Tebus::on($cawangan['mysql']) + ->select('tebus.bakiupah','tebus.norujukan') + ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') + ->where('tebus.t_tebus','>=',$request->mula) + ->where('tebus.t_tebus','<=',$request->akhir) + ->whereNotNull('hargajualan') + ->where('gad.tagbaru','=',1) + ->where('hargajualan','<>','bakihargajualan'); + + // dd($tebustawarruqansuran); + + // $totalpenebusantawarruq = ($tebustawarruq->sum('tebus.pinjaman') - $tebustawarruqansuran->sum('gad.pinjaman')) + $tebustawarruqansuran->sum('gad.bakipjm'); + $totalpenebusantawarruq = $tebustawarruq->sum('tebus.pinjaman'); + $bilpenebusantawarruq = $tebustawarruq->count(); + $totalrebatetawarruq = $tebustawarruq->sum('tebus.rebate'); + $totalkeuntungantawarruq = $tebustawarruq->sum('tebus.bakiupah'); + $totalujrahtawarruq = $tebustawarruq->sum('tebus.ujrah'); + $totalonepercenttawarruq = $tebustawarruq->sum('tebus.onepercent'); + + + + // dd($totalkeuntunganarrahn,$totalkeuntungantawarruq); + + $array_penebusan = [ + 'bilarrahn' => $bilpenebusanarrahn, + 'totalarrahn' => $totalpenebusanarrahn, + 'keuntunganarrahn' => $totalkeuntunganarrahn, + 'ujraharrahn' => $totalujraharrahn, + 'onepercentarrahn' => $totalonepercentarrahn, + + 'biltawarruq' => $bilpenebusantawarruq, + 'totaltawarruq' => $totalpenebusantawarruq, + 'totalrebate' => $totalrebatetawarruq, + 'keuntungantawarruq' => $totalkeuntungantawarruq, + 'ujrahtawarruq' => $totalujrahtawarruq, + 'onepercenttawarruq' => $totalonepercenttawarruq + ]; return response()->json($array_penebusan); } @@ -1070,13 +1204,26 @@ class TebusController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $listadvansur = Advansur::on($cawangan['mysql']) - ->where('tarikh','>=',$request->mula)->where('tarikh','<=',$request->akhir); + $listadvansurkaunter = Advansur::on($cawangan['mysql']) + ->where('tarikh','>=',$request->mula) + ->where('tarikh','<=',$request->akhir) + ->where('teller','<>','Online'); - $countadvansur = $listadvansur->count(); - $totaladvansur = $listadvansur->sum('upahdibayar'); + $listadvansuronline = Advansur::on($cawangan['mysql']) + ->where('tarikh','>=',$request->mula) + ->where('tarikh','<=',$request->akhir) + ->where('teller','=','Online'); - $arrayadvansur = ['bil' => $countadvansur, 'total' => $totaladvansur]; + $countadvansurkaunter = $listadvansurkaunter->count(); + $totaladvansurkaunter = $listadvansurkaunter->sum('upahdibayar'); + + $countadvansuronline = $listadvansuronline->count(); + $totaladvansuronline = $listadvansuronline->sum('upahdibayar'); + + $arrayadvansur = ['bilkaunter' => $countadvansurkaunter, + 'totalkaunter' => $totaladvansurkaunter, + 'bilonline' => $countadvansuronline, + 'totalonline' => $totaladvansuronline]; return response()->json($arrayadvansur,200); } diff --git a/routes/web.php b/routes/web.php index fd2db7e..b48d4f4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -115,6 +115,16 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('tebus/laporan/{kodcaw}/{tarikh}',['uses'=>'TebusController@getLaporanTebus']); $router->get('tebus/laporanjenistawarruq/{kodcaw}',['uses'=>'TebusController@getLaporanTebusPengasingan']); + //Tebus Ujrah (Laporan Range Date) + $router->get('tebusujrah/laporan/{kodcaw}',['uses'=>'TebusController@getLaporanTebusUjrah']); + $router->get('tebus/laporanjenistawarruqujrah/{kodcaw}',['uses'=>'TebusController@getLaporanTebusPengasinganUjrah']); + + //Ansuran Ujrah (Laporan Range Date) + $router->get('ansuranujrah/laporan/{kodcaw}',['uses'=>'GadaiController@getLaporanAnsuranUjrah']); + + + + $router->get('moratorium/details',['uses'=>'TebusController@getMoratorium']); //Maintenance API TEBUS @@ -239,6 +249,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ //ANSURAN UPAH API $router->get('ansuran/laporan/{kodcaw}',['uses'=>'GadaiController@getLaporanAnsuran']); $router->get('ansuransummary/{kodcaw}',['uses'=>'GadaiController@getAnsuranSummary']); + $router->get('ansuransummaryrange/{kodcaw}',['uses'=>'GadaiController@getAnsuranSummaryRange']); $router->get('ansuran/{kodcaw}/{norujukan}',['uses'=>'TebusController@getAdvansur']); $router->get('AnsuranByTarikh/{kodcaw}',['uses'=>'TebusController@SenaraiAdvansur']); $router->get('AnsuranByRangeTarikh/{kodcaw}',['uses'=>'TebusController@SenaraiAdvansurRangeDate']); From cc27854e3d84d43adf3f3e119a0505b3626c044a Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Wed, 29 Nov 2023 11:25:34 +0800 Subject: [PATCH 034/114] tambah route upahrebettawarruq untuk arrahnbid cronjob ujrah --- routes/web.php | 1 + 1 file changed, 1 insertion(+) diff --git a/routes/web.php b/routes/web.php index b48d4f4..788bb7f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -797,6 +797,7 @@ $router->group(['prefix'=>'admin'], function () use ($router){ }); $router->group(['prefix'=>'lelong'], function () use ($router){ + $router->get('upahrebettawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahRebetTawarruq']); $router->post('taglel/update',['uses'=>'GadaiController@updateTagLelong']); $router->post('taglel/revert',['uses'=>'GadaiController@revertTagLelong']); $router->post('exportLelong',['uses'=>'LelongController@exportLelong']); From ba0584f99c1d50c0ab15730dc280c45b57fae43a Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 23 Nov 2023 16:15:35 +0800 Subject: [PATCH 035/114] make faker for gadai and changes marhun to make the calculation for the gold, update composer remove helpers --- composer.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/composer.json b/composer.json index deaf479..2c8071f 100644 --- a/composer.json +++ b/composer.json @@ -17,9 +17,6 @@ "phpunit/phpunit": "^8.5" }, "autoload": { - "files":[ - "app/helpers.php" - ], "classmap": [ "database/seeds", "database/factories" From da1c7cee5fa96c7f994fae3e3294a26d807b93be Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 29 Nov 2023 14:19:00 +0800 Subject: [PATCH 036/114] fix database faker --- database/factories/GadaiFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/factories/GadaiFactory.php b/database/factories/GadaiFactory.php index de17d3b..c9a3c5c 100644 --- a/database/factories/GadaiFactory.php +++ b/database/factories/GadaiFactory.php @@ -31,7 +31,7 @@ class GadaiFactory 'cajtelahbyr' => null, 'ansuran' => null, 'ansupah' => null, - 'kadarupah' => null, + 'kadarupah' => 1.7, 'tempoh' => 0.5, 't_lelong' => null, 't_hapus' => null, From fbae897a9c32086c39602818136fd6a9b73142f9 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 30 Nov 2023 09:33:12 +0800 Subject: [PATCH 037/114] fix one percent mengikut excel kak aida --- app/Http/Controllers/GadaiController.php | 21 ++--- app/Http/Controllers/TebusController.php | 106 ++++++++++++----------- app/Services/OnePercentServices.php | 14 ++- 3 files changed, 78 insertions(+), 63 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 8e4e2b3..2cb0be0 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -360,12 +360,13 @@ class GadaiController extends Controller // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; - $upah_semasa_round = number_format($upahsemasa_raw,2); - $upah_semasa = substr($upah_semasa_round, 0, -1); - // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); - if(strpos($upah_semasa,',')){ - $upah_semasa = str_replace(',','',$upah_semasa); - } + $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); + // $upah_semasa_round = number_format($upahsemasa_raw,2); + // $upah_semasa = substr($upah_semasa_round, 0, -1); + // // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); + // if(strpos($upah_semasa,',')){ + // $upah_semasa = str_replace(',','',$upah_semasa); + // } return $upah_semasa; } @@ -387,7 +388,7 @@ class GadaiController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); $upahrebet_raw = $bilang_bln * $upah['keuntungan']; @@ -489,7 +490,7 @@ class GadaiController extends Controller $margin_semasa = ($gadai['bakipjm'] / $gadai['nilaimarhun']) * 100; $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); - $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['percentpinj']); + $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['margin_semasa']); $onepercentasal = $gadai['pinjaman'] * (1/100); @@ -523,8 +524,8 @@ class GadaiController extends Controller 'keuntungan_rebet'=> $upahrebet, 'tarikh_bayaran'=> $current, 'kodcaw'=> $kodcaw, - 'ujrah' => ($ujrahasal*$bilang_bln), - 'ujrah_rebet' => ($keuntungan['ujrah'] * $bilang_bln), + 'ujrah' => ($keuntungan['ujrah'] * $bilang_bln), + 'ujrah_rebet' => ($ujrahasal*$bilang_bln), 'onepercent' => ($onepercentasal * $bilang_bln), 'onepercent_rebet' => ($keuntungan['onepercent'] * $bilang_bln), 'tempoh' => $gadai['tempoh'], diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 83136b7..611b1dd 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -57,14 +57,14 @@ class TebusController extends Controller $jeniskeuntungan = ($gadai_data['tagbaru'] == 1) ? 'onepercent' : 'asal'; $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); - $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; - $hargatebus = bcdiv(round($harga_tebus,2),1,1); - $hargatebus = number_format($hargatebus,2); - if(strpos($hargatebus,',')){ - $hargatebus = str_replace(',','',$hargatebus); - } + $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); + // $hargatebus = bcdiv(round($harga_tebus,2),1,1); + // $hargatebus = number_format($hargatebus,2); + // if(strpos($hargatebus,',')){ + // $hargatebus = str_replace(',','',$hargatebus); + // } return response()->json($hargatebus); } @@ -115,16 +115,17 @@ class TebusController extends Controller }else{ $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); } - - $upah_semasa_round = number_format($upahsemasa_raw,2); - if(strpos($upah_semasa_round,',')){ - $upah_semasa_round = str_replace(',','',$upah_semasa_round); - } - $upah_semasa = substr($upah_semasa_round, 0, -1); - if(strpos($upah_semasa,',')){ - $upah_semasa = str_replace(',','',$upah_semasa); - } + $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); + // $upah_semasa_round = number_format($upahsemasa_raw,2); + // if(strpos($upah_semasa_round,',')){ + // $upah_semasa_round = str_replace(',','',$upah_semasa_round); + // } + // $upah_semasa = substr($upah_semasa_round, 0, -1); + // if(strpos($upah_semasa,',')){ + // $upah_semasa = str_replace(',','',$upah_semasa); + // } + return $upah_semasa; } @@ -148,20 +149,21 @@ class TebusController extends Controller $bilang_bln = $tempoh - $gadai_data['tempohbayar']; if($jeniskeuntungan == 'onepercent'){ - $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); $upahrebet_raw = $bilang_bln * $upah['keuntungan']; }else{ $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); } - $upah_rebet_round = number_format($upahrebet_raw,2); - if(strpos($upah_rebet_round,',')){ - $upah_rebet_round = str_replace(',','',$upah_rebet_round); - } - $upah_rebet = substr($upah_rebet_round, 0, -1); - if(strpos($upah_rebet,',')){ - $upah_rebet = str_replace(',','',$upah_rebet); - } + $upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP); + // $upah_rebet_round = number_format($upahrebet_raw,2); + // if(strpos($upah_rebet_round,',')){ + // $upah_rebet_round = str_replace(',','',$upah_rebet_round); + // } + // $upah_rebet = substr($upah_rebet_round, 0, -1); + // if(strpos($upah_rebet,',')){ + // $upah_rebet = str_replace(',','',$upah_rebet); + // } return $upah_rebet; } @@ -185,14 +187,15 @@ class TebusController extends Controller $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); - $upah_rebet_round = number_format($upahrebet_raw,2); - if(strpos($upah_rebet_round,',')){ - $upah_rebet_round = str_replace(',','',$upah_rebet_round); - } - $upah_rebet = substr($upah_rebet_round, 0, -1); - if(strpos($upah_rebet,',')){ - $upah_rebet = str_replace(',','',$upah_rebet); - } + $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP); + // $upah_rebet_round = number_format($upahrebet_raw,2); + // if(strpos($upah_rebet_round,',')){ + // $upah_rebet_round = str_replace(',','',$upah_rebet_round); + // } + // $upah_rebet = substr($upah_rebet_round, 0, -1); + // if(strpos($upah_rebet,',')){ + // $upah_rebet = str_replace(',','',$upah_rebet); + // } $total_untung_rebet = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('keuntungan_rebet'); $total_untung_asal = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('bayaran_keuntungan'); @@ -444,7 +447,7 @@ class TebusController extends Controller $upah_rebet = $this->kiraUpahRebet($kodcaw,$norujukan,$jeniskeuntungan); $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; - + // dd($gadai_data['upah12'],$transaction_keuntungan,$upah_rebet,$jeniskeuntungan,$rebet_raw); $rebet_round = bcdiv(round($rebet_raw,2),1,1); $rebet_round = number_format($rebet_round,2); @@ -2432,28 +2435,29 @@ class TebusController extends Controller } $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); $ujrah = $bilang_bln * $array_upah['ujrah']; $onepercent = $bilang_bln * $array_upah['onepercent']; + $ujrah_semasa = round($ujrah,PHP_ROUND_HALF_UP); + // $ujrah_semasa_round = number_format($ujrah,2); + // if(strpos($ujrah_semasa_round,',')){ + // $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); + // } + // $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); + // if(strpos($ujrah_semasa,',')){ + // $ujrah_semasa = str_replace(',','',$ujrah_semasa); + // } - $ujrah_semasa_round = number_format($ujrah,2); - if(strpos($ujrah_semasa_round,',')){ - $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); - } - $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); - if(strpos($ujrah_semasa,',')){ - $ujrah_semasa = str_replace(',','',$ujrah_semasa); - } - - $onepercent_semasa_round = number_format($onepercent,2); - if(strpos($onepercent_semasa_round,',')){ - $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); - } - $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); - if(strpos($onepercent_semasa,',')){ - $onepercent_semasa = str_replace(',','',$onepercent_semasa); - } + $onepercent_semasa = round($onepercent,PHP_ROUND_HALF_UP); + // $onepercent_semasa_round = number_format($onepercent,2); + // if(strpos($onepercent_semasa_round,',')){ + // $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); + // } + // $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); + // if(strpos($onepercent_semasa,',')){ + // $onepercent_semasa = str_replace(',','',$onepercent_semasa); + // } return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; } diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index 6e0099e..b740b82 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -21,7 +21,7 @@ class OnePercentServices $formula_margin = ($this->maks_margin - $margin) / $this->maks_margin; $ujrah_margin = $formula_margin * $kadarujrah; $rebate_ujrah = $nilaimarhun*($ujrah_margin/100); - $ujrah_sebenar = $ujrah - $rebate_ujrah; + $ujrah_sebenar = $ujrah; return $ujrah_sebenar; } @@ -48,10 +48,20 @@ class OnePercentServices $formula_margin = ($this->maks_margin - $margin) / $this->maks_margin; $rebate_ujrah = $formula_margin * $ujrah; $ujrah_sebenar = $ujrah - $rebate_ujrah; - + return $ujrah_sebenar; } + public function kiraanKeuntunganRebet(float $pembiayaan = 0.0,float $nilaimarhun = 0.0,float $kadarujrah = 0.0,float $margin = 0.0){ + + $onepercent = $this->kiraanOnePercent($pembiayaan); + $ujrah_sebenar = $this->kiraanUjrahSebenar($nilaimarhun,$kadarujrah,$margin); + + $keuntungan = $onepercent + $ujrah_sebenar; + + return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; + } + public function kiraanKeuntunganSebenar(float $pembiayaan = 0.0,float $nilaimarhun = 0.0,float $kadarujrah = 0.0,float $margin = 0.0){ $onepercent = $this->kiraanOnePercent($pembiayaan); From a5b0b90cf4ff92038b6d72f0e50bd4c9cab32f97 Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 3 Dec 2023 10:27:45 +0800 Subject: [PATCH 038/114] update online --- .../TransactionOnlineController.php | 117 ++++++++++++++---- 1 file changed, 90 insertions(+), 27 deletions(-) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index 7bfd1ef..60224df 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -11,6 +11,9 @@ use App\Cawangan; use App\GlDetail; use Illuminate\Http\Request; use Carbon\Carbon; +use App\Services\OnePercentServices; +use Log; +use Illuminate\Support\Facades\DB; use App\Http\Controllers\TebusController as TebusController; @@ -167,6 +170,9 @@ class TransactionOnlineController extends Controller }else{ $lelong_tawarruq = 1; } + $onepercent = new OnePercentServices(); + + $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); $baki_hargajualan = $gadai['bakihargajualan'] - $bayaran; @@ -174,35 +180,92 @@ class TransactionOnlineController extends Controller $baki_pinjaman = $gadai['bakipjm'] - $baki_bayaran; - $transaction = Transaction::on('mysql7')->create([ - 'trans_type' => 'A', - 'norujukan' => $norujukan, - 'nokp' => $gadai['nokp'], - 'teller' => 'Online', - 'kodcaw' => $kodcaw, - 'duit_masuk' => $bayaran, - 'created_at' => Carbon::parse($paid_at), - 'bakiharga' => $baki_hargajualan, - ]); + $margin_semasa = ($gadai['bakipjm'] / $gadai['nilaimarhun']) * 100; - $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ - 'norujukan' => $norujukan, - 'bayaran_keuntungan' => $upahsemasa, - 'bayaran_pembiayaan' => $baki_bayaran, - 'keuntungan_rebet'=> $upahrebet, - 'tarikh_bayaran'=> Carbon::parse($paid_at), - 'kodcaw'=> $kodcaw - ]); + $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); + $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['margin_semasa']); - $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( - 'bakipjm' => $baki_pinjaman, - 'jbg' => 0, - 't_update' => Carbon::parse($paid_at)->toDateString(), - 'bakihargajualan' => $baki_hargajualan, - 'tempohbayar' => $tempohbayar, - 'lelong_tawarruq' => $lelong_tawarruq - )); - return response()->json($update_gadai, 200); + $onepercentasal = $gadai['pinjaman'] * (1/100); + + try { + + DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { + + $transaction = Transaction::on('mysql7')->create([ + 'trans_type' => 'A', + 'norujukan' => $norujukan, + 'nokp' => $gadai['nokp'], + 'teller' => 'Online', + 'kodcaw' => $kodcaw, + 'duit_masuk' => $bayaran, + 'created_at' => $current, + 'bakiharga' => $baki_hargajualan, + ]); + + if($gadai['tempoh'] >= 12.0){ + $tempoh = 12; + }else{ + $tempoh = $gadai['tempoh']; + } + $bilang_bln = $tempoh - $gadai['tempohbayar']; + + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ + 'norujukan' => $norujukan, + 'bayaran_keuntungan' => $upahsemasa, + 'bayaran_pembiayaan' => $baki_bayaran, + 'keuntungan_rebet'=> $upahrebet, + 'tarikh_bayaran'=> $current, + 'kodcaw'=> $kodcaw, + 'ujrah' => ($keuntungan['ujrah'] * $bilang_bln), + 'ujrah_rebet' => ($ujrahasal*$bilang_bln), + 'onepercent' => ($onepercentasal * $bilang_bln), + 'onepercent_rebet' => ($keuntungan['onepercent'] * $bilang_bln), + 'tempoh' => $gadai['tempoh'], + 'beza_tempoh' => $bilang_bln, + 'margin_semasa' => $margin_semasa, + ]); + + DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ + + $margin_updated = ($baki_pinjaman / $gadai['nilaimarhun']) * 100; + + $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( + 'bakipjm' => $baki_pinjaman, + 'jbg' => 0, + 't_update' => $current->toDateString(), + 'bakihargajualan' => $baki_hargajualan, + 'tempohbayar' => $gadai['tempoh'], + 'lelong_tawarruq' => $lelong_tawarruq, + 'margin_semasa' => $margin_updated, + )); + }); + + $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + + $audit = new Audit(); + $audit->users = 'Online'; + $audit->actions = 'Bayaran Ansuran'; + $audit->norujukan = $norujukan; + $audit->new_data = $new_data; + $audit->old_data = $old_data; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + if(!$transaction || !$transaction_upah) { + throw new \Exception('One of the database operations failed.'); + } + + DB::commit(); + + }); + }catch(\Exception $e){ + Log::error("Transaction failed: " . $e->getMessage()); + return response()->json("Transaction failed: " . $e->getMessage(),500); + } + + return response()->json("success",200); } public function createAdvansur($kodcaw,$norujukan,$bayaran,$paid_at){ From 977e28d8839cf756bd96237418efb6e77d180b08 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 2 Dec 2023 23:55:24 +0800 Subject: [PATCH 039/114] add duit pelanggan --- app/Http/Controllers/GadaiController.php | 4 ++- app/Http/Controllers/TebusController.php | 6 +++- app/Transaction.php | 2 +- ...add_duitpelanggan_to_transaction_table.php | 33 +++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 2cb0be0..043337a 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -507,7 +507,9 @@ class GadaiController extends Controller 'duit_masuk' => $request->bayaran, 'created_at' => $current, 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => $request->duitpelanggan, + 'bakipelanggan' => $request->bakipelanggan ]); if($gadai['tempoh'] >= 12.0){ diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 611b1dd..0baf7c8 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -581,7 +581,9 @@ class TebusController extends Controller 'duit_masuk' => $harga_tebus, 'created_at' => $current, 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => $request->duitpelanggan, + 'bakipelanggan' => $request->bakipelanggan ]); } @@ -696,6 +698,8 @@ class TebusController extends Controller 'duit_masuk' => $request->totalbayaran, 'created_at' => $current, 'bakiharga' => 0, + 'duitpelanggan' => $request->bayaranpelanggan, + 'bakipelanggan' => $request->bakipelanggan ]); $audit = new Audit(); diff --git a/app/Transaction.php b/app/Transaction.php index 0dfd13e..56a8692 100644 --- a/app/Transaction.php +++ b/app/Transaction.php @@ -14,7 +14,7 @@ class Transaction extends Model * @var array */ protected $fillable = [ - 'trans_type','norujukan','nokp','teller','kodcaw','duit_masuk','duit_keluar','created_at','bakiharga','nowakil' + 'trans_type','norujukan','nokp','teller','kodcaw','duit_masuk','duit_keluar','created_at','bakiharga','nowakil','duitpelanggan','bakipelanggan' ]; /** diff --git a/database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php b/database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php new file mode 100644 index 0000000..ab452ac --- /dev/null +++ b/database/migrations/2023_12_02_200032_add_duitpelanggan_to_transaction_table.php @@ -0,0 +1,33 @@ +table('transaction', function (Blueprint $table) { + $table->decimal('duitpelanggan', 9, 2); + $table->decimal('bakipelanggan', 9, 2); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('transaction', function (Blueprint $table) { + $table->dropColumn(['duitpelanggan','bakipelanggan']); + }); + } +} From 4ae56a8fae15b73af3d7d9e19b31eeb08e0af4f8 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Sun, 3 Dec 2023 09:23:33 +0800 Subject: [PATCH 040/114] update blast sms dan wasap by sag --- .env.example | 12 +++ app/Http/Controllers/StokAuditController.php | 91 ++++++++++++++++-- app/Jobs/SMSPelangganSAGLAMAbysag.php | 97 ++++++++++++++++++++ app/Jobs/WhatsappPelangganSAGLAMAbysag.php | 96 +++++++++++++++++++ routes/web.php | 1 + 5 files changed, 287 insertions(+), 10 deletions(-) create mode 100644 app/Jobs/SMSPelangganSAGLAMAbysag.php create mode 100644 app/Jobs/WhatsappPelangganSAGLAMAbysag.php diff --git a/.env.example b/.env.example index 0d11561..7d1e737 100644 --- a/.env.example +++ b/.env.example @@ -241,3 +241,15 @@ DB_PASSWORD_33=G0dz!ll42020 CACHE_DRIVER=file QUEUE_CONNECTION=sync + +WABOT_API=https://md.wabot.my/api/send.php +WABOT_INSTANCES_ID=63F40BD120DB4 +# WABOT_INSTANCES_ID=64892FD7440A6 +WABOT_TOKEN_KEYS=cbee7e95cf3ffbfa0531d5fddfd44f87 + + +ONEWAYSMS_API=http://gateway.onewaysms.com.my:10001/api.aspx +ONEWAYSMS_AUTH_USER=APIUK330HDAFO +ONEWAYSMS_AUTH_PASS=APIUK330HDAFOUK330 + +ADMIN_PHONE_NUMBER=60178916936 diff --git a/app/Http/Controllers/StokAuditController.php b/app/Http/Controllers/StokAuditController.php index bd0b6cc..1ec14a1 100644 --- a/app/Http/Controllers/StokAuditController.php +++ b/app/Http/Controllers/StokAuditController.php @@ -35,6 +35,8 @@ use App\Jobs\SMSPelangganSAGLAMA; use Illuminate\Http\Request; use App\CawanganDetail; use App\BlastSMS; +use App\Jobs\WhatsappPelangganSAGLAMAbysag; +use App\Jobs\SMSPelangganSAGLAMAbysag; use App\Services\OnePercentServices; @@ -166,16 +168,6 @@ class StokAuditController extends Controller if($customer->telefon != 'null'){ $telefon=$customer->telefon; - // //insert log blast wasap - // $logblastwasap = new BlastWasap(); - // $logblastwasap->kodcaw = $kodcaw; - // $logblastwasap->nokp = $nokp; - // $logblastwasap->notelefon = $customer->telefon; - // $logblastwasap->norujukan = $cal3->norujukan; - // $logblastwasap->tempoh = $cal3->tempoh; - // $logblastwasap->created_at = $current; - // $logblastwasap->updated_at = $current; - // $logblastwasap->save(); //log auditrail $audit = new Audit(); @@ -202,6 +194,85 @@ class StokAuditController extends Controller } + public function blastwasapbysag($kodcaw,Request $request) + { + $current = Carbon::now(); + $current = new Carbon(); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $namapengguna = $request->namapengguna; + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); + $cawangan_detail = CawanganDetail::on($cawangan['mysql'])->first(); + $caw_name = $cawangan->details_caw; + $nofoncaw = $cawangan_detail->notel; + + $audit = Gadai::on($cawangan['mysql']) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) + ->orderBy('t_gadai', 'ASC') + ->orderBy('sirig', 'ASC'); + + $rekodaudit = $audit->get(); + $arraynorujukan = $audit->pluck('norujukan')->toArray(); + $keybynorujukan = $rekodaudit->keyBy('norujukan'); + + $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + // ->select('nokp') + // ->groupBy('nokp') + ->get(); + // dd($gadainokp); + $gadai_all_groupby_nokp = $rekodaudit->groupBy('nokp'); + + foreach($gadainokp as $index1=>$cal){ + // dd($cal->nokp); + if($gadai_all_groupby_nokp[$cal->nokp]){ + $gadainokp[$index1]['gadai'] = $gadai_all_groupby_nokp[$cal->nokp]; + } + // dd($gadainokp[$index1]['gadai'][$index1]['norujukan']); + + $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + $nokp=$cal['nokp']; + + // foreach($gadainokp[$index1]['gadai'] as $index1=>$cal3){ + + $checkingnokp = BlastWasap::on('mysql7') + ->where('nokp','=',$cal['nokp']) + ->where('norujukan','=',$cal->norujukan) + ->where('kodcaw','=',$kodcaw) + ->first(); + + if(!$checkingnokp){ + + if($customer->telefon != 'null'){ + $telefon=$customer->telefon; + + //log auditrail + $audit = new Audit(); + $audit->users = $namapengguna; + $audit->actions = 'Blast Whatsapp & SMS'; + $audit->norujukan = $cal->norujukan; + $audit->new_data = $customer->telefon; + $audit->old_data = $nokp; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + + dispatch(new WhatsappPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq)); + dispatch(new SMSPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq)); + } + } + else{ + return response()->json('failed'); + } + // } + } + return response()->json('success'); + + } + public function rekodblast($kodcaw,Request $request) { diff --git a/app/Jobs/SMSPelangganSAGLAMAbysag.php b/app/Jobs/SMSPelangganSAGLAMAbysag.php new file mode 100644 index 0000000..da21922 --- /dev/null +++ b/app/Jobs/SMSPelangganSAGLAMAbysag.php @@ -0,0 +1,97 @@ +nokp = $nokp; + $this->telefon = $telefon; + $this->caw_name = $caw_name; + $this->nofoncaw = $nofoncaw; + $this->kodcaw = $kodcaw; + $this->norujukan = $norujukan; + $this->tempoh = $tempoh; + $this->tmatang = $tmatang; + $this->tmatang1 = $tmatang1; + $this->lelong_tawarruq = $lelong_tawarruq; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $current = Carbon::now(); + $current = new Carbon(); + $mobile_no = ltrim($this->telefon, '+6'); + // $mobile_no = '60178916936'; + // $message = 'test'; + $tarikhmatang = date('d-m-Y',strtotime($this->tmatang)); + $tarikhmatang = date('d-m-Y',strtotime($this->tmatang)); + $tarikhmatang1 = date('d-m-Y',strtotime($this->tmatang1)); + $date = $current->toDateString(); + $today = date('d-m-Y',strtotime($date)); + // $current_date = new Carbon($current->toDateString()); + if($this->lelong_tawarruq == '1'){ + if($tarikhmatang > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatang.'.'; + }elseif($tarikhmatang < $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatang.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + }else + if($tarikhmatang1 < $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatang1.'.'; + }elseif($tarikhmatang1 > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatang1.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + + if(env('APP_ENV') != 'production'){ + $mobile_no = env('ADMIN_PHONE_NUMBER'); + } + $response = Http::get(env('ONEWAYSMS_API'), [ + 'apiusername' => env('ONEWAYSMS_AUTH_USER'), + 'apipassword' => env('ONEWAYSMS_AUTH_PASS'), + 'senderid' => 'INFO', + 'mobileno' => $mobile_no, + 'message' => $message, + 'languagetype' => 1 + ]); + + //insert log blast sms + $logblastsms = new BlastSMS(); + $logblastsms->kodcaw = $this->kodcaw; + $logblastsms->nokp = $this->nokp; + $logblastsms->notelefon = $this->telefon; + $logblastsms->norujukan = $this->norujukan; + $logblastsms->tempoh = $this->tempoh; + $logblastsms->status = $response; + $logblastsms->created_at = $current; + $logblastsms->updated_at = $current; + $logblastsms->save(); + + Log::info("SMS - Pelanggan ".$this->caw_name." SAG Tawarruq Lama -".$mobile_no); + + } +} diff --git a/app/Jobs/WhatsappPelangganSAGLAMAbysag.php b/app/Jobs/WhatsappPelangganSAGLAMAbysag.php new file mode 100644 index 0000000..94f818b --- /dev/null +++ b/app/Jobs/WhatsappPelangganSAGLAMAbysag.php @@ -0,0 +1,96 @@ +nokp = $nokp; + $this->telefon = $telefon; + $this->caw_name = $caw_name; + $this->nofoncaw = $nofoncaw; + $this->kodcaw = $kodcaw; + $this->norujukan = $norujukan; + $this->tempoh = $tempoh; + $this->tmatang = $tmatang; + $this->tmatang1 = $tmatang1; + $this->lelong_tawarruq = $lelong_tawarruq; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $current = Carbon::now(); + $current = new Carbon(); + $mobile_no = ltrim($this->telefon, '+6'); + // $mobile_no = '60178916936'; + $tarikhmatang = date('d-m-Y',strtotime($this->tmatang)); + $tarikhmatang1 = date('d-m-Y',strtotime($this->tmatang1)); + $date = $current->toDateString(); + $today = date('d-m-Y',strtotime($date)); + // $current_date = new Carbon($current->toDateString()); + if($this->lelong_tawarruq == '1'){ + if($tarikhmatang > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatang.'*.'; + }elseif($tarikhmatang < $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatang.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + }else + if($tarikhmatang1 < $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatang1.'*.'; + }elseif($tarikhmatang1 > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatang1.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + + if(env('APP_ENV') != 'production'){ + $mobile_no = env('ADMIN_PHONE_NUMBER'); + } + $response = Http::get(env('WABOT_API'), [ + 'number' => $mobile_no, + 'type' => 'text', + 'message' => $message, + 'instance_id' => env('WABOT_INSTANCES_ID'), + 'access_token' => env('WABOT_TOKEN_KEYS') + ]); + + //insert log blast wasap + $logblastwasap = new BlastWasap(); + $logblastwasap->kodcaw = $this->kodcaw; + $logblastwasap->nokp = $this->nokp; + $logblastwasap->notelefon = $this->telefon; + $logblastwasap->norujukan = $this->norujukan; + $logblastwasap->tempoh = $this->tempoh; + $logblastwasap->status = $response; + $logblastwasap->created_at = $current; + $logblastwasap->updated_at = $current; + $logblastwasap->save(); + + Log::info("WABOT - Pelanggan SAG Tawarruq Lama".$response); + + } +} diff --git a/routes/web.php b/routes/web.php index 788bb7f..65f5c39 100644 --- a/routes/web.php +++ b/routes/web.php @@ -595,6 +595,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ //API BLAST WASAP $router->post('blastwasap/{kodcaw}',['uses'=>'StokAuditController@blastwasap']); + $router->post('blastwasapbysag/{kodcaw}',['uses'=>'StokAuditController@blastwasapbysag']); $router->get('rekodblast/{kodcaw}',['uses'=>'StokAuditController@rekodblast']); $router->get('rekodblastsms/{kodcaw}',['uses'=>'StokAuditController@rekodblastsms']); From 6b87cef023246c92b8eaca0a19f20f6e0aa994dd Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Tue, 14 Nov 2023 14:45:48 +0800 Subject: [PATCH 041/114] Add new columns to komuditi_transaksi --- config/database.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/database.php b/config/database.php index ece90e4..cc1803f 100644 --- a/config/database.php +++ b/config/database.php @@ -2,7 +2,15 @@ return [ +<<<<<<< HEAD 'default' => 'mysql7', +======= +<<<<<<< HEAD + 'default' => 'mysql', +======= + 'default' => 'mysql7', +>>>>>>> 083caf7 (Add new columns to komuditi_transaksi) +>>>>>>> 01bba68 (Add new columns to komuditi_transaksi) 'migrations' => 'migrations', 'connections' => [ 'lelong' => [ From 668e5c405153ba56f60e4a9f99aa17ba8cdf9946 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Tue, 28 Nov 2023 09:44:05 +0800 Subject: [PATCH 042/114] Update .gitignore Update .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 2896e86..39329cd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ Homestead.json Homestead.yaml .env .phpunit.result.cache +ray.php +docker-compose.yml +/docker_src +/.vscode From dc28211d03c1a7c2f1b712071ad657a5b8d543a7 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Tue, 28 Nov 2023 10:02:11 +0800 Subject: [PATCH 043/114] Fix config database.php --- config/database.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/database.php b/config/database.php index cc1803f..ece90e4 100644 --- a/config/database.php +++ b/config/database.php @@ -2,15 +2,7 @@ return [ -<<<<<<< HEAD 'default' => 'mysql7', -======= -<<<<<<< HEAD - 'default' => 'mysql', -======= - 'default' => 'mysql7', ->>>>>>> 083caf7 (Add new columns to komuditi_transaksi) ->>>>>>> 01bba68 (Add new columns to komuditi_transaksi) 'migrations' => 'migrations', 'connections' => [ 'lelong' => [ From a823f27e38e4fbd4c4f5bb5e2f987e4f833fade2 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Thu, 16 Nov 2023 10:20:55 +0800 Subject: [PATCH 044/114] add seeder for kadarupah --- database/seeds/KadarUpahSeeder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/seeds/KadarUpahSeeder.php b/database/seeds/KadarUpahSeeder.php index c4a37ee..4137c44 100644 --- a/database/seeds/KadarUpahSeeder.php +++ b/database/seeds/KadarUpahSeeder.php @@ -13,7 +13,7 @@ class KadarUpahSeeder extends Seeder public function run() { KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.20)->update([ - 'kadarujrah' => 0.16, + 'kadarujrah' => 0.14, 'kadaronepercent' => 1, ]); From 54f8b2cd71d9d30fb3d00c2d5efac3f1df9c4f60 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 21 Nov 2023 12:32:25 +0800 Subject: [PATCH 045/114] fix model tebus added ujrah and onepercent, also, fix upah from 0.14 to 0.16 --- database/seeds/KadarUpahSeeder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/seeds/KadarUpahSeeder.php b/database/seeds/KadarUpahSeeder.php index 4137c44..c4a37ee 100644 --- a/database/seeds/KadarUpahSeeder.php +++ b/database/seeds/KadarUpahSeeder.php @@ -13,7 +13,7 @@ class KadarUpahSeeder extends Seeder public function run() { KadarUpah::on('mysql7')->where('kadarupdah', '=', 1.20)->update([ - 'kadarujrah' => 0.14, + 'kadarujrah' => 0.16, 'kadaronepercent' => 1, ]); From ad8dda2b9205f3dcad34caca2358b71c289b5eea Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Tue, 28 Nov 2023 14:52:28 +0800 Subject: [PATCH 046/114] Done overall reports for gadaian, penebusan, ansuran --- app/{helpers.php => Helper.php} | 11 + app/Http/Controllers/GadaiController.php | 14 +- .../Controllers/Reports/AnsuranController.php | 64 ++ .../GadaianController.php} | 5 +- .../Reports/PenebusanController.php | 60 ++ app/Services/Reports/AnsuranService.php | 191 +++++ app/Services/Reports/PenebusanService.php | 199 +++++ composer.json | 3 +- composer.lock | 678 +++++++++++++++++- routes/report.php | 12 +- tinker/getLaporanTebusAllSummary.php | 47 ++ 11 files changed, 1270 insertions(+), 14 deletions(-) rename app/{helpers.php => Helper.php} (77%) create mode 100644 app/Http/Controllers/Reports/AnsuranController.php rename app/Http/Controllers/{ReportGadaiController.php => Reports/GadaianController.php} (94%) create mode 100644 app/Http/Controllers/Reports/PenebusanController.php create mode 100644 app/Services/Reports/AnsuranService.php create mode 100644 app/Services/Reports/PenebusanService.php create mode 100644 tinker/getLaporanTebusAllSummary.php diff --git a/app/helpers.php b/app/Helper.php similarity index 77% rename from app/helpers.php rename to app/Helper.php index ed68dfa..d16bea2 100644 --- a/app/helpers.php +++ b/app/Helper.php @@ -7,6 +7,17 @@ use Illuminate\Support\Facades\DB; class Helper { + public static function getOnlineArrahnConnection() + { + + $online_arrahn_connection = array_filter(config('database.connections'), function ($connection) { + if ($connection['database'] === 'online_arrahn') { + return $connection; + } + }); + + return array_keys($online_arrahn_connection)[0]; + } public static function formatNumber($amount) { $formattedAmount = number_format($amount, 2, '.', ','); diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 043337a..f7670a7 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -134,7 +134,7 @@ class GadaiController extends Controller $current = new Carbon(); $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - + try{ DB::transaction(function () use ($cawangan, $kodcaw, $request, $current) { $gadai = Gadai::on($cawangan['mysql'])->create([ @@ -155,7 +155,7 @@ class GadaiController extends Controller }catch(\Exception $e){ echo "Gadaian Gagal: " . $e->getMessage(); - } + } } public function createold($kodcaw,Request $request){ @@ -248,7 +248,7 @@ class GadaiController extends Controller $total_berat = Marhun::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->sum('berat'); $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); - + $onepercentservices = new OnePercentServices(); $keuntungan = $onepercentservices->kiraanKeuntunganSebenar($request->pinjaman,$total_nilai_marhun,$kadar_raw['kadarujrah'],$margin_pinjam); // $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); @@ -372,7 +372,7 @@ class GadaiController extends Controller public function kiraUpahRebet($kodcaw,$norujukan){ $onepercentservices = new OnePercentServices(); - + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -715,7 +715,7 @@ class GadaiController extends Controller $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update([ 'semakbarcode'=>'Lulus' ]); - + return response()->json('success'); }else{ return response()->json('unavailable'); @@ -3160,7 +3160,7 @@ class GadaiController extends Controller ->where('gad.hargajualan','!=',null) ->where([['t_jual','>=',$request->mula],['t_jual','<=',$request->hingga]]) ->sum('lelong.pinjaman'); - + $Tebus += $pembiayaanlelong; $rekod_pinjamandiberi = ['Gadai' => $Gadai,'Tebus' => $Tebus]; @@ -3871,7 +3871,7 @@ class GadaiController extends Controller } public function getOnePercent(Request $request){ - + $onePercentServices = new OnePercentServices(); $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); diff --git a/app/Http/Controllers/Reports/AnsuranController.php b/app/Http/Controllers/Reports/AnsuranController.php new file mode 100644 index 0000000..e6009c9 --- /dev/null +++ b/app/Http/Controllers/Reports/AnsuranController.php @@ -0,0 +1,64 @@ +getCawanganReport(); + } + + public function getSummaryLaporanAnsuran(Request $request) + { + $online_array_db_connection = Helper::getOnlineArrahnConnection(); + + $ansuran_query = Transaction::on($online_array_db_connection) + ->leftJoin('transaksi_keuntungan', function ($join) { + $join->on('transaction.norujukan', '=', 'transaksi_keuntungan.norujukan'); + $join->on('transaction.created_at', '=', 'transaksi_keuntungan.tarikh_bayaran'); + }) + ->where('transaction.trans_type', '=', 'A') + ->whereDate('transaction.created_at', '>=', date($request->startDate)) + ->whereDate('transaction.created_at', '<=', date($request->endDate)) + ->selectRaw(' + count(transaction.norujukan) as bilangan_ansuran, + sum(transaksi_keuntungan.bayaran_pembiayaan) as bayaran_pembiayaan, + sum(transaksi_keuntungan.bayaran_keuntungan) as bayaran_kos_keuntungan, + sum(transaction.duit_masuk) as jumlah_bayaran + '); + + $summary_ansuran = (clone $ansuran_query)->get()->toArray()[0]; + + $summary_ansuran_by_cawangan = (clone $ansuran_query) + ->addSelect('transaction.kodcaw as kod_cawangan') + ->groupBy('transaction.kodcaw') + ->get(); + + $cawangan_available = Cawangan::on($online_array_db_connection)->select('kodcaw', 'details_caw')->get()->toArray(); + $kodcaw_array = array_column($cawangan_available, 'kodcaw'); + $cawangan_detail_array = array_column($cawangan_available, 'details_caw'); + $kod_caw_with_cawangan_detail_array = array_combine($kodcaw_array, $cawangan_detail_array); + + $summary_ansuran_by_cawangan = $summary_ansuran_by_cawangan->map(function ($ansuran_cawangan) use ($kod_caw_with_cawangan_detail_array) { + $ansuran_cawangan->cawangan_detail = $kod_caw_with_cawangan_detail_array[$ansuran_cawangan['kod_cawangan']]; + return $ansuran_cawangan; + }); + + $response = [ + 'summary_ansuran_by_cawangan' => $summary_ansuran_by_cawangan, + 'summary_ansuran' => $summary_ansuran, + ]; + + return json_encode($response); + } +} diff --git a/app/Http/Controllers/ReportGadaiController.php b/app/Http/Controllers/Reports/GadaianController.php similarity index 94% rename from app/Http/Controllers/ReportGadaiController.php rename to app/Http/Controllers/Reports/GadaianController.php index 3855601..ac5fd80 100644 --- a/app/Http/Controllers/ReportGadaiController.php +++ b/app/Http/Controllers/Reports/GadaianController.php @@ -1,7 +1,8 @@ getCawanganReport(); + } + + public function getSummaryLaporanTebus(Request $request) + { + + $active_cawangan_db_connection = Helper::getActiveCawanganDbConnection(); + + $active_cawangan_db_name = array_map(function ($db_connection) { + return config('database.connections' . '.' . $db_connection . '.' . 'database'); + }, $active_cawangan_db_connection); + + $active_cawangan_detail = Cawangan::select('kodcaw', 'details_caw')->whereIn('db_name', $active_cawangan_db_name)->get()->toArray(); + + $summary_penebusan_data = array_map(function ($db_connection) use ($request) { + $penebusan = Tebus::on($db_connection) + ->join('gadai', 'tebus.norujukan', '=', 'gadai.norujukan') + ->where('gadai.upah12', '!=', null) + ->where('tebus.t_tebus', '>=', $request->startDate) + ->where('tebus.t_tebus', '<=', $request->endDate) + ->select(DB::raw(' + count(tebus.norujukan) as bilangan_tebus, + sum(gadai.berat) as berat, + sum(gadai.bakipjm) as nilai_pinjaman, + sum(tebus.pinjaman) as baki_pinjaman, + sum(tebus.nilaimarhun) as nilai_marhun, + sum(tebus.bakiupah) as keuntungan_asal, + sum(tebus.bakipjm - gadai.bakipjm) as keuntungan_rebet, + sum(gadai.bakipjm) + sum(tebus.bakipjm - gadai.bakipjm) as bayaran_penebusan + ')) + ->get(); + + return $penebusan->toArray(); + }, $active_cawangan_db_connection); + + $response = array_map(function ($cawangan_detail, $summary_penebusan_data) { + return array_merge($cawangan_detail, $summary_penebusan_data[0]); + }, $active_cawangan_detail, $summary_penebusan_data); + + return json_encode($response); + } +} diff --git a/app/Services/Reports/AnsuranService.php b/app/Services/Reports/AnsuranService.php new file mode 100644 index 0000000..a81b4b3 --- /dev/null +++ b/app/Services/Reports/AnsuranService.php @@ -0,0 +1,191 @@ +kod_cawangan = $kod_cawangan; + $this->startDate = $request->startDate; + $this->endDate = $request->endDate; + } + + public function getCawanganReport() + { + $online_array_db_connection = Helper::getOnlineArrahnConnection(); + $cawangan_connection = Cawangan::where('kodcaw', $this->kod_cawangan)->first()->mysql; + + $query_total_ansuran = Transaction::on($online_array_db_connection) + ->where('transaction.kodcaw', $this->kod_cawangan) + ->leftJoin('transaksi_keuntungan', function ($join) { + $join->on('transaction.norujukan', '=', 'transaksi_keuntungan.norujukan'); + $join->on('transaction.created_at', '=', 'transaksi_keuntungan.tarikh_bayaran'); + }) + ->where('transaction.trans_type', '=', 'A') + ->whereDate('transaction.created_at', '>=', date($this->startDate)) + ->whereDate('transaction.created_at', '<=', date($this->endDate)); + + $total_ansuran = $this->getTotalAnsuran($query_total_ansuran); + $total_summary_ansuran_teller = $this->getTotalSummaryAnsuranGroupByTeller($query_total_ansuran); + $total_summary_ansuran = $this->getTotalSummaryAnsuran($query_total_ansuran); + $gadaian_ansuran = $this->getGadaianAnsuran($cawangan_connection, $total_ansuran->pluck('norujukan')); + $customer_info = $this->getCustomerInfo($gadaian_ansuran); + $cawangan_detail = $this->getCawanganDetail($cawangan_connection); + + $total_ansuran = $total_ansuran->zip($gadaian_ansuran, $customer_info)->map(function ($data) { + [$ansuran, $gadaian_ansuran, $customer_info] = $data; + + return [ + 'norujukan' => $ansuran->norujukan, + 'nama' => $customer_info['nama'], + 'no_kp' => $gadaian_ansuran->nokp, + 'teller' => $ansuran->teller, + 'bayaran_pembiayaan' => $ansuran->bayaran_pembiayaan, + 'bayaran_keuntungan' => $ansuran->bayaran_kos_keuntungan, + 'jumlah_ansuran' => $ansuran->jumlah_bayaran, + ]; + }); + + $total_ansuran = $total_ansuran->groupBy('teller'); + + $ansuran_tellers = $total_ansuran->keys(); + + $total_ansuran = $total_ansuran + ->zip($total_summary_ansuran_teller) + ->map(function ($data) { + + [$ansuran, $summary] = $data; + + return [ + 'ansuran' => $ansuran, + 'summary_ansuran_teller' => $summary, + ]; + }); + + $total_ansuran = $ansuran_tellers->combine($total_ansuran); + + $data = [ + 'query' => [ + 'startDate' => Helper::formatDate($this->startDate), + 'endDate' => Helper::formatDate($this->endDate), + ], + 'cawangan_detail' => $cawangan_detail, + 'total_ansuran' => $total_ansuran, + 'summary_ansuran' => $total_summary_ansuran, + ]; + + ray($data); + return json_encode($data); + + } + + private function getTotalAnsuran($query_total_ansuran) + { + $total_ansuran = (clone $query_total_ansuran) + ->selectRaw(' + transaction.norujukan as norujukan, + transaksi_keuntungan.bayaran_pembiayaan as bayaran_pembiayaan, + transaksi_keuntungan.bayaran_keuntungan as bayaran_kos_keuntungan, + transaction.duit_masuk as jumlah_bayaran, + teller + '); + + return $total_ansuran->get(); + + } + + private function getCawanganDetail($cawangan_connection) + { + $cawangan_detail = CawanganDetail::on($cawangan_connection)->get() + ->map(function ($detail) { + return [ + 'nama' => $detail['namacaw'], + 'code' => $detail['kodcaw'] . ' Ar-Rahn ' . $detail['cawangan'], + 'alamat' => $detail['alamat1'], + 'waktu_operasi' => $detail['alamat4'], + ]; + }); + + return $cawangan_detail[0]; + + } + + private function getTotalSummaryAnsuran(Builder $query_total_ansuran) + { + + $total_ansuran = (clone $query_total_ansuran) + ->selectRaw(' + count(transaction.norujukan) as sum_norujukan, + sum(transaksi_keuntungan.bayaran_pembiayaan) as sum_bayaran_pembiayaan, + sum(transaksi_keuntungan.bayaran_keuntungan) as sum_bayaran_kos_keuntungan, + sum(transaction.duit_masuk) as sum_jumlah_bayaran, + teller + '); + + return $total_ansuran->get()->toArray()[0]; + } + private function getTotalSummaryAnsuranGroupByTeller(Builder $query_total_ansuran) + { + + $total_summary_ansuran_groupByTeller = (clone $query_total_ansuran) + ->selectRaw(' + count(transaction.norujukan) as sum_norujukan, + sum(transaksi_keuntungan.bayaran_pembiayaan) as sum_bayaran_pembiayaan, + sum(transaksi_keuntungan.bayaran_keuntungan) as sum_bayaran_kos_keuntungan, + sum(transaction.duit_masuk) as sum_jumlah_bayaran, + teller + ') + ->groupBy('transaction.teller') + ->get() + ->toArray(); + + return $total_summary_ansuran_groupByTeller; + } + + private function getCustomerInfo($total_ansuran) + { + + $extract_nokp = $total_ansuran->pluck('nokp'); + + $customer_info = Customer::on('mysql7') + ->select(['nama', 'alamat1', 'kpbaru', 'kplama']) + ->where(function ($query) use ($extract_nokp) { + $query->whereIn('kpbaru', $extract_nokp) + ->orWhereIn('kplama', $extract_nokp); + }) + ->get(); + + $customer_info = collect($extract_nokp)->map(function ($nokp) use ($customer_info) { + return $customer_info->where('kpbaru', $nokp)->first() ?? $customer_info->where('kplama', $nokp)->first(); + })->toArray(); + + return $customer_info; + } + + private function getGadaianAnsuran($cawangan_connection, $list_norujukan) + { + + $gadaian_ansuran = Gadai::on($cawangan_connection) + ->whereIn('norujukan', $list_norujukan) + ->select('norujukan', 'nokp', 'teller') + ->get(); + + return $gadaian_ansuran; + } + +} diff --git a/app/Services/Reports/PenebusanService.php b/app/Services/Reports/PenebusanService.php new file mode 100644 index 0000000..a32ec77 --- /dev/null +++ b/app/Services/Reports/PenebusanService.php @@ -0,0 +1,199 @@ +kod_cawangan = $kod_cawangan; + $this->startDate = $request->startDate; + $this->endDate = $request->endDate; + } + + public function getCawanganReport() + { + $cawangan_connection = Cawangan::where('kodcaw', $this->kod_cawangan)->first()->mysql; + + $query_total_penebusan = Tebus::on($cawangan_connection); + + $query_total_penebusan->join('gadai', 'tebus.norujukan', '=', 'gadai.norujukan'); + + $query_total_penebusan->where('gadai.upah12', '!=', null); + $query_total_penebusan->when(!empty($this->startDate) and !empty($this->endDate), function ($q) { + return $q->where('t_tebus', '>=', $this->startDate) + ->where('t_tebus', '<=', $this->endDate); + }); + + $total_penebusan = $this->getTotalPenebusan($query_total_penebusan); + $total_summary_penebusan_teller = $this->getTotalSummaryPenebusanGroupByTeller($query_total_penebusan); + $total_summary_penebusan = $this->getTotalSummaryPenebusan($query_total_penebusan); + $customer_info = $this->getCustomerInfo($total_penebusan); + $cawangan_detail = $this->getCawanganDetail($cawangan_connection); + + $total_penebusan = $total_penebusan->zip($customer_info)->map(function ($data) { + + [$tebus, $customer_info] = $data; + + return [ + 'no_rujukan' => $tebus['norujukan'], + 'nama' => $customer_info['nama'], + 'no_kp' => $tebus['nokp'], + 'tarikh_gadai' => $tebus['t_gadai'], + 'jbg' => $tebus['jbg'], + 'nilai_pinjaman' => $tebus['nilai_pinjaman'], + 'baki_pinjaman' => $tebus['baki_pinjaman'], + 'kos_keuntungan' => $tebus['kos_keuntungan'], + 'kos_keuntungan_rebet' => $tebus['kos_keuntungan_rebet'], + 'bayaran_penebusan' => $tebus['bayaran_penebusan'], + 'nilai_marhun' => $tebus['nilai_marhun'], + 'jenis_tebus' => $tebus['jenis_tebus'], + 'teller' => $tebus['teller'], + ]; + + }); + + $total_penebusan = $total_penebusan->groupBy('teller'); + + $penebusan_tellers = $total_penebusan->keys(); + + $total_penebusan = $total_penebusan + ->zip($total_summary_penebusan_teller) + ->map(function ($data) { + + [$penebusan, $summary] = $data; + + return [ + 'penebusan' => $penebusan, + 'summary_penebusan_teller' => $summary, + ]; + }); + + $total_penebusan = $penebusan_tellers->combine($total_penebusan); + + $data = [ + 'query' => [ + 'startDate' => Helper::formatDate($this->startDate), + 'endDate' => Helper::formatDate($this->endDate), + ], + 'cawangan_detail' => $cawangan_detail, + 'penebusan' => $total_penebusan, + 'summary_penebusan' => $total_summary_penebusan, + ]; + + return json_encode($data); + + } + + private function getCawanganDetail($cawangan_connection) + { + $cawangan_detail = CawanganDetail::on($cawangan_connection)->get() + ->map(function ($detail) { + return [ + 'nama' => $detail['namacaw'], + 'code' => $detail['kodcaw'] . ' Ar-Rahn ' . $detail['cawangan'], + 'alamat' => $detail['alamat1'], + 'waktu_operasi' => $detail['alamat4'], + ]; + }); + + return $cawangan_detail[0]; + + } + + private function getTotalSummaryPenebusan(Builder $query_total_penebusan) + { + + $total_summary_penebusan = (clone $query_total_penebusan) + ->select( + DB::raw('sum(gadai.bakipjm) as nilai_pinjaman'), + DB::raw('sum(tebus.pinjaman) as baki_pinjaman'), + DB::raw('sum(tebus.bakiupah) as kos_keuntungan'), + DB::raw('sum(tebus.bakipjm - gadai.bakipjm) as kos_keuntungan_rebet'), + DB::raw('sum(gadai.bakipjm) + sum(tebus.bakipjm - gadai.bakipjm) as bayaran_penebusan'), + DB::raw('sum(tebus.nilaimarhun) as nilai_marhun'), + ) + ->get() + ->toArray(); + + return $total_summary_penebusan[0]; + } + private function getTotalSummaryPenebusanGroupByTeller(Builder $query_total_penebusan) + { + + $total_summary_penebusan_groupByTeller = (clone $query_total_penebusan) + ->select( + DB::raw('sum(gadai.bakipjm) as nilai_pinjaman'), + DB::raw('sum(tebus.pinjaman) as baki_pinjaman'), + DB::raw('sum(tebus.bakiupah) as kos_keuntungan'), + DB::raw('sum(tebus.bakipjm - gadai.bakipjm) as kos_keuntungan_rebet'), + DB::raw('sum(gadai.bakipjm) + sum(tebus.bakipjm - gadai.bakipjm) as bayaran_penebusan'), + DB::raw('sum(tebus.nilaimarhun) as nilai_marhun'), + 'tebus.teller', + ) + ->groupBy('tebus.teller') + ->get(); + + return $total_summary_penebusan_groupByTeller; + } + + private function getTotalPenebusan(Builder $query_total_penebusan) + { + + $total_penebusan = (clone $query_total_penebusan) + ->select( + 'tebus.norujukan', + 'gadai.nokp', + 'gadai.t_gadai', + 'gadai.jbg', + 'gadai.bakipjm as nilai_pinjaman', + 'tebus.pinjaman as baki_pinjaman', + 'tebus.bakiupah as kos_keuntungan', + DB::raw('(tebus.bakipjm - gadai.bakipjm) as kos_keuntungan_rebet'), + DB::raw('gadai.bakipjm + (tebus.bakipjm - gadai.bakipjm) as bayaran_penebusan'), + 'tebus.nilaimarhun as nilai_marhun', + 'tebus.jenistebus as jenis_tebus', + 'tebus.teller', + ) + ->orderBy('tebus.teller') + ->orderBy('gadai.sirig') + ->get(); + + return $total_penebusan; + } + + private function getCustomerInfo($total_penebusan) + { + + $extract_nokp = $total_penebusan->pluck('nokp'); + + $customer_info = Customer::on('mysql7') + ->select(['nama', 'alamat1', 'kpbaru', 'kplama']) + ->where(function ($query) use ($extract_nokp) { + $query->whereIn('kpbaru', $extract_nokp) + ->orWhereIn('kplama', $extract_nokp); + }) + ->get(); + + $customer_info = collect($extract_nokp)->map(function ($nokp) use ($customer_info) { + return $customer_info->where('kpbaru', $nokp)->first() ?? $customer_info->where('kplama', $nokp)->first(); + })->toArray(); + + return $customer_info; + } + +} diff --git a/composer.json b/composer.json index 2c8071f..4acec19 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "auth0/auth0-php": "^7.4", "laravel/lumen-framework": "^7.0", "laravel/tinker": "^2.8", - "rap2hpoutre/laravel-log-viewer": "^1.7" + "rap2hpoutre/laravel-log-viewer": "^1.7", + "spatie/laravel-ray": "^1.33" }, "require-dev": { "fzaninotto/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index ecb3de3..19f5172 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9002d37085a4ef790b6e9f7269b8f058", + "content-hash": "17aa13bd1f3c89969c4cdcce223e8172", "packages": [ { "name": "auth0/auth0-php", @@ -2714,6 +2714,59 @@ ], "time": "2021-12-04T23:24:31+00:00" }, + { + "name": "pimple/pimple", + "version": "v3.5.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1 || ^2.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^5.4@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "https://pimple.symfony.com", + "keywords": [ + "container", + "dependency injection" + ], + "support": { + "source": "https://github.com/silexphp/Pimple/tree/v3.5.0" + }, + "time": "2021-10-28T11:13:42+00:00" + }, { "name": "psr/container", "version": "1.1.2", @@ -3382,6 +3435,279 @@ }, "time": "2020-09-08T12:21:27+00:00" }, + { + "name": "spatie/backtrace", + "version": "1.5.3", + "source": { + "type": "git", + "url": "https://github.com/spatie/backtrace.git", + "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/backtrace/zipball/483f76a82964a0431aa836b6ed0edde0c248e3ab", + "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0" + }, + "require-dev": { + "ext-json": "*", + "phpunit/phpunit": "^9.3", + "spatie/phpunit-snapshot-assertions": "^4.2", + "symfony/var-dumper": "^5.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Backtrace\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van de Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A better backtrace", + "homepage": "https://github.com/spatie/backtrace", + "keywords": [ + "Backtrace", + "spatie" + ], + "support": { + "source": "https://github.com/spatie/backtrace/tree/1.5.3" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2023-06-28T12:59:17+00:00" + }, + { + "name": "spatie/laravel-ray", + "version": "1.33.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-ray.git", + "reference": "5028ae44a09451b26eb44490e3471998650788e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/5028ae44a09451b26eb44490e3471998650788e3", + "reference": "5028ae44a09451b26eb44490e3471998650788e3", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/contracts": "^7.20|^8.19|^9.0|^10.0", + "illuminate/database": "^7.20|^8.19|^9.0|^10.0", + "illuminate/queue": "^7.20|^8.19|^9.0|^10.0", + "illuminate/support": "^7.20|^8.19|^9.0|^10.0", + "php": "^7.4|^8.0", + "spatie/backtrace": "^1.0", + "spatie/ray": "^1.37", + "symfony/stopwatch": "4.2|^5.1|^6.0", + "zbateson/mail-mime-parser": "^1.3.1|^2.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^7.3", + "laravel/framework": "^7.20|^8.19|^9.0|^10.0", + "orchestra/testbench-core": "^5.0|^6.0|^7.0|^8.0", + "pestphp/pest": "^1.22", + "phpstan/phpstan": "^0.12.93", + "phpunit/phpunit": "^9.3", + "spatie/pest-plugin-snapshots": "^1.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.29.x-dev" + }, + "laravel": { + "providers": [ + "Spatie\\LaravelRay\\RayServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Spatie\\LaravelRay\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Easily debug Laravel apps", + "homepage": "https://github.com/spatie/laravel-ray", + "keywords": [ + "laravel-ray", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-ray/issues", + "source": "https://github.com/spatie/laravel-ray/tree/1.33.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2023-09-04T10:16:53+00:00" + }, + { + "name": "spatie/macroable", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/macroable.git", + "reference": "7a99549fc001c925714b329220dea680c04bfa48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/macroable/zipball/7a99549fc001c925714b329220dea680c04bfa48", + "reference": "7a99549fc001c925714b329220dea680c04bfa48", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\Macroable\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "A trait to dynamically add methods to a class", + "homepage": "https://github.com/spatie/macroable", + "keywords": [ + "macroable", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/macroable/issues", + "source": "https://github.com/spatie/macroable/tree/1.0.1" + }, + "time": "2020-11-03T10:15:05+00:00" + }, + { + "name": "spatie/ray", + "version": "1.40.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/ray.git", + "reference": "8e6547ff47aae2e4f615a5dcea1e5e4911b1dc9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/ray/zipball/8e6547ff47aae2e4f615a5dcea1e5e4911b1dc9f", + "reference": "8e6547ff47aae2e4f615a5dcea1e5e4911b1dc9f", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "php": "^7.3|^8.0", + "ramsey/uuid": "^3.0|^4.1", + "spatie/backtrace": "^1.1", + "spatie/macroable": "^1.0|^2.0", + "symfony/stopwatch": "^4.0|^5.1|^6.0", + "symfony/var-dumper": "^4.2|^5.1|^6.0" + }, + "require-dev": { + "illuminate/support": "6.x|^8.18|^9.0", + "nesbot/carbon": "^2.63", + "pestphp/pest": "^1.22", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5", + "spatie/phpunit-snapshot-assertions": "^4.2", + "spatie/test-time": "^1.2" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\Ray\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Debug with Ray to fix problems faster", + "homepage": "https://github.com/spatie/ray", + "keywords": [ + "ray", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/ray/issues", + "source": "https://github.com/spatie/ray/tree/1.40.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/spatie", + "type": "github" + }, + { + "url": "https://spatie.be/open-source/support-us", + "type": "other" + } + ], + "time": "2023-11-20T08:20:15+00:00" + }, { "name": "symfony/console", "version": "v5.4.9", @@ -4196,6 +4522,89 @@ ], "time": "2021-10-20T20:35:02+00:00" }, + { + "name": "symfony/polyfill-iconv", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-iconv.git", + "reference": "6de50471469b8c9afc38164452ab2b6170ee71c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/6de50471469b8c9afc38164452ab2b6170ee71c1", + "reference": "6de50471469b8c9afc38164452ab2b6170ee71c1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-iconv": "*" + }, + "suggest": { + "ext-iconv": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Iconv extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "iconv", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.25.0", @@ -4993,6 +5402,68 @@ ], "time": "2022-03-13T20:07:29+00:00" }, + { + "name": "symfony/stopwatch", + "version": "v5.4.21", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f83692cd869a6f2391691d40a01e8acb89e76fee", + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/service-contracts": "^1|^2|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.4.21" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-02-14T08:03:56+00:00" + }, { "name": "symfony/string", "version": "v5.4.9", @@ -5494,6 +5965,211 @@ } ], "time": "2022-01-24T18:55:24+00:00" + }, + { + "name": "zbateson/mail-mime-parser", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/zbateson/mail-mime-parser.git", + "reference": "20b3e48eb799537683780bc8782fbbe9bc25934a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zbateson/mail-mime-parser/zipball/20b3e48eb799537683780bc8782fbbe9bc25934a", + "reference": "20b3e48eb799537683780bc8782fbbe9bc25934a", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.7.0|^2.0", + "php": ">=7.1", + "pimple/pimple": "^3.0", + "zbateson/mb-wrapper": "^1.0.1", + "zbateson/stream-decorators": "^1.0.6" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "*", + "mikey179/vfsstream": "^1.6.0", + "phpstan/phpstan": "*", + "phpunit/phpunit": "<10" + }, + "suggest": { + "ext-iconv": "For best support/performance", + "ext-mbstring": "For best support/performance" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZBateson\\MailMimeParser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Zaahid Bateson" + }, + { + "name": "Contributors", + "homepage": "https://github.com/zbateson/mail-mime-parser/graphs/contributors" + } + ], + "description": "MIME email message parser", + "homepage": "https://mail-mime-parser.org", + "keywords": [ + "MimeMailParser", + "email", + "mail", + "mailparse", + "mime", + "mimeparse", + "parser", + "php-imap" + ], + "support": { + "docs": "https://mail-mime-parser.org/#usage-guide", + "issues": "https://github.com/zbateson/mail-mime-parser/issues", + "source": "https://github.com/zbateson/mail-mime-parser" + }, + "funding": [ + { + "url": "https://github.com/zbateson", + "type": "github" + } + ], + "time": "2023-02-14T22:58:03+00:00" + }, + { + "name": "zbateson/mb-wrapper", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/zbateson/mb-wrapper.git", + "reference": "faf35dddfacfc5d4d5f9210143eafd7a7fe74334" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zbateson/mb-wrapper/zipball/faf35dddfacfc5d4d5f9210143eafd7a7fe74334", + "reference": "faf35dddfacfc5d4d5f9210143eafd7a7fe74334", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-iconv": "^1.9", + "symfony/polyfill-mbstring": "^1.9" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "*", + "phpstan/phpstan": "*", + "phpunit/phpunit": "<=9.0" + }, + "suggest": { + "ext-iconv": "For best support/performance", + "ext-mbstring": "For best support/performance" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZBateson\\MbWrapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Zaahid Bateson" + } + ], + "description": "Wrapper for mbstring with fallback to iconv for encoding conversion and string manipulation", + "keywords": [ + "charset", + "encoding", + "http", + "iconv", + "mail", + "mb", + "mb_convert_encoding", + "mbstring", + "mime", + "multibyte", + "string" + ], + "support": { + "issues": "https://github.com/zbateson/mb-wrapper/issues", + "source": "https://github.com/zbateson/mb-wrapper/tree/1.2.0" + }, + "funding": [ + { + "url": "https://github.com/zbateson", + "type": "github" + } + ], + "time": "2023-01-11T23:05:44+00:00" + }, + { + "name": "zbateson/stream-decorators", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/zbateson/stream-decorators.git", + "reference": "0c2816e16a67d00c60680d8d4539ec555fb43d11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zbateson/stream-decorators/zipball/0c2816e16a67d00c60680d8d4539ec555fb43d11", + "reference": "0c2816e16a67d00c60680d8d4539ec555fb43d11", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.7.0|^2.0", + "php": ">=5.4", + "zbateson/mb-wrapper": "^1.0.0" + }, + "require-dev": { + "sanmai/phpunit-legacy-adapter": "^6.3 || ^8" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZBateson\\StreamDecorators\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Zaahid Bateson" + } + ], + "description": "PHP psr7 stream decorators for mime message part streams", + "keywords": [ + "base64", + "charset", + "decorators", + "mail", + "mime", + "psr7", + "quoted-printable", + "stream", + "uuencode" + ], + "support": { + "issues": "https://github.com/zbateson/stream-decorators/issues", + "source": "https://github.com/zbateson/stream-decorators/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/zbateson", + "type": "github" + } + ], + "time": "2022-12-30T20:50:33+00:00" } ], "packages-dev": [ diff --git a/routes/report.php b/routes/report.php index 25cc03b..749ddab 100644 --- a/routes/report.php +++ b/routes/report.php @@ -1,6 +1,12 @@ group(['prefix'=>'api'], function () use ($router){ - $router->get('gadailaporanOverallSummary', ['uses' => 'ReportGadaiController@getSummaryLaporanGadai']); - $router->get('gadailaporan/{kod_cawangan}', ['uses' => 'ReportGadaiController@getLaporanCawangan']); +$router->group(['prefix'=>'api/reports'], function () use ($router){ + $router->group(['namespace' => 'Reports'], function() use($router){ + $router->get('gadaian', ['uses' => 'GadaianController@getSummaryLaporanGadai']); + $router->get('gadaian/{kod_cawangan}', ['uses' => 'GadaianController@getLaporanCawangan']); + $router->get('penebusan', ['uses' => 'PenebusanController@getSummaryLaporanTebus']); + $router->get('penebusan/{kod_cawangan}', ['uses' => 'PenebusanController@getLaporanCawangan']); + $router->get('ansuran', ['uses' => 'AnsuranController@getSummaryLaporanAnsuran']); + $router->get('ansuran/{kod_cawangan}', ['uses' => 'AnsuranController@getLaporanCawangan']); + }); }); diff --git a/tinker/getLaporanTebusAllSummary.php b/tinker/getLaporanTebusAllSummary.php new file mode 100644 index 0000000..8a1adf3 --- /dev/null +++ b/tinker/getLaporanTebusAllSummary.php @@ -0,0 +1,47 @@ +startDate = Carbon::now(); +$request->endDate = Carbon::now(); + + +$active_cawangan_db_name = array_map(function ($db_connection) { + return config('database.connections' . '.' . $db_connection . '.' . 'database'); +}, $active_cawangan_db_connection); + +$active_cawangan_detail = Cawangan::select('kodcaw', 'details_caw')->whereIn('db_name', $active_cawangan_db_name)->get()->toArray(); + +$summary_penebusan_data = array_map(function ($db_connection) use ($tarikh) { + $penebusan = Tebus::on($db_connection) + ->join('gadai', 'tebus.norujukan', '=', 'gadai.norujukan') + ->where('gadai.upah12', '!=', null) + ->where('tebus.t_tebus', '>=', $request->startDate) + ->where('tebus.t_tebus', '<=', $request->endDate) + ->select(DB::raw(' + count(tebus.norujukan) as bilangan_tebus, + sum(gadai.berat) as berat, + sum(gadai.bakipjm) as nilai_pinjaman, + sum(tebus.pinjaman) as baki_pinjaman, + sum(tebus.nilaimarhun) as nilai_marhun, + sum(tebus.bakiupah) as keuntungan_asal, + sum(tebus.bakipjm - gadai.bakipjm) as keuntungan_rebet, + sum(gadai.bakipjm) + sum(tebus.bakipjm - gadai.bakipjm) as bayaran_penebusan + ')) + ->get(); + + + return $penebusan->toArray(); +}, $active_cawangan_db_connection); + +$response = array_map(function ($cawangan_detail, $summary_penebusan_data) { + return array_merge($cawangan_detail, $summary_penebusan_data[0]); +}, $active_cawangan_detail, $summary_penebusan_data); + +return json_encode($response); From 6423dde6006f0d5638ccd34aaac0881ae2e827b5 Mon Sep 17 00:00:00 2001 From: Afrina Alimi <82226421+Afrina16@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:12:43 +0800 Subject: [PATCH 047/114] add table group --- .../2023_11_29_124752_create_group_table.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 database/migrations/2023_11_29_124752_create_group_table.php diff --git a/database/migrations/2023_11_29_124752_create_group_table.php b/database/migrations/2023_11_29_124752_create_group_table.php new file mode 100644 index 0000000..90ae9c8 --- /dev/null +++ b/database/migrations/2023_11_29_124752_create_group_table.php @@ -0,0 +1,32 @@ +id(); + $table->string('slug')->nullable(); + $table->string('description')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('group'); + } +} From 214d4f0e49afb674f85591b84ac7843b1611ee47 Mon Sep 17 00:00:00 2001 From: Afrina Alimi <82226421+Afrina16@users.noreply.github.com> Date: Thu, 30 Nov 2023 15:02:37 +0800 Subject: [PATCH 048/114] add column group id to kadarupah & cawangan --- ...1109_add_columns_to_komuditi_transaksi.php | 4 +-- ...142901_add_group_id_to_kadarupah_table.php | 33 +++++++++++++++++++ ...add_group_id_to_arrahn_master_db_table.php | 33 +++++++++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 database/migrations/2023_11_29_142901_add_group_id_to_kadarupah_table.php create mode 100644 database/migrations/2023_11_29_155314_add_group_id_to_arrahn_master_db_table.php diff --git a/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php b/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php index e728acb..1c61cb9 100644 --- a/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php +++ b/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php @@ -42,7 +42,7 @@ class AddColumnsToKomuditiTransaksi extends Migration { $online_arrahn_connection_array = array_filter(config('database.connections'), function($connection) { - if($connection['database'] === 'online_arrahn'){ + if($connection['database'] === 'online_arrahn' || $connection['database'] === 'master_krk'){ return true; } @@ -53,7 +53,7 @@ class AddColumnsToKomuditiTransaksi extends Migration if(empty($online_arrahn_connection_array)){ - throw new Exception("online_arrahn doesn't exist in config.database.connections array"); + throw new Exception("online_arrahn or master_krk doesn't exist in config.database.connections array"); } return array_keys($online_arrahn_connection_array)[0]; diff --git a/database/migrations/2023_11_29_142901_add_group_id_to_kadarupah_table.php b/database/migrations/2023_11_29_142901_add_group_id_to_kadarupah_table.php new file mode 100644 index 0000000..b280e41 --- /dev/null +++ b/database/migrations/2023_11_29_142901_add_group_id_to_kadarupah_table.php @@ -0,0 +1,33 @@ +integer('group_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) { + $table->dropColumn(['group_id']); + }); + } +} diff --git a/database/migrations/2023_11_29_155314_add_group_id_to_arrahn_master_db_table.php b/database/migrations/2023_11_29_155314_add_group_id_to_arrahn_master_db_table.php new file mode 100644 index 0000000..157b8e2 --- /dev/null +++ b/database/migrations/2023_11_29_155314_add_group_id_to_arrahn_master_db_table.php @@ -0,0 +1,33 @@ +integer('group_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('arrahn_master_db', function (Blueprint $table) { + $table->dropColumn(['group_id']); + }); + } +} From e29b2b0c483554ae47e404a08a99432b782de1e2 Mon Sep 17 00:00:00 2001 From: Afrina Alimi <82226421+Afrina16@users.noreply.github.com> Date: Sun, 3 Dec 2023 08:58:25 +0800 Subject: [PATCH 049/114] read group id --- app/Http/Controllers/GadaiController.php | 3 ++- app/Services/OnePercentServices.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index f7670a7..a2b1741 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -133,6 +133,7 @@ class GadaiController extends Controller $current = Carbon::now(); $current = new Carbon(); + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); try{ @@ -251,7 +252,7 @@ class GadaiController extends Controller $onepercentservices = new OnePercentServices(); $keuntungan = $onepercentservices->kiraanKeuntunganSebenar($request->pinjaman,$total_nilai_marhun,$kadar_raw['kadarujrah'],$margin_pinjam); - // $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); + // $upah1 = $request->pinjaman * ($kadar_raw['kadarupdah']/100); // $upah6 = $upah1 * 6; // $upah12 = $upah1 * 12; $upah1 = $keuntungan['keuntungan']; diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index b740b82..9c4c165 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -74,7 +74,7 @@ class OnePercentServices public function getKadarUjrah(float $nilaimarhun = 0.0) : Float{ - $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->get()->toArray(); + $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$cawagan['group_id'])->get()->toArray(); return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0; } From eb330fc9d10bab09643b0eb486fa7d1da1600953 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Sun, 3 Dec 2023 17:10:21 +0800 Subject: [PATCH 050/114] edit group id getKadarUjrah --- app/Http/Controllers/GadaiController.php | 4 ++-- app/Services/OnePercentServices.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index a2b1741..b73d840 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -3861,10 +3861,10 @@ class GadaiController extends Controller } public function getKadarUjrah(Request $request){ - + $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); $onePercentServices = new OnePercentServices(); - $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun); + $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); // $test = $this->kiraupahTawarruq('KB2','KB2231109-0001'); // dd($test); diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index 9c4c165..afce9d0 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -72,9 +72,9 @@ class OnePercentServices return ['keuntungan' => $keuntungan,'onepercent' => $onepercent, 'ujrah' => $ujrah_sebenar]; } - public function getKadarUjrah(float $nilaimarhun = 0.0) : Float{ + public function getKadarUjrah(float $nilaimarhun = 0.0, $groupid) : Float{ - $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$cawagan['group_id'])->get()->toArray(); + $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$groupid)->get()->toArray(); return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0; } From 2fb497fa506af92b02f5592b06fe616aaee761a2 Mon Sep 17 00:00:00 2001 From: Afrina Alimi <82226421+Afrina16@users.noreply.github.com> Date: Mon, 4 Dec 2023 08:33:10 +0800 Subject: [PATCH 051/114] group id seeder at cawangan --- app/Cawangan.php | 2 ++ database/seeds/GroupIdSeeder.php | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 database/seeds/GroupIdSeeder.php diff --git a/app/Cawangan.php b/app/Cawangan.php index 61ef694..a35286b 100644 --- a/app/Cawangan.php +++ b/app/Cawangan.php @@ -9,6 +9,8 @@ class Cawangan extends Model protected $table = 'arrahn_master_db'; protected $connection = 'mysql7'; + public $timestamps = false; + /** * The attributes that are mass assignable. * diff --git a/database/seeds/GroupIdSeeder.php b/database/seeds/GroupIdSeeder.php new file mode 100644 index 0000000..9a5bb8b --- /dev/null +++ b/database/seeds/GroupIdSeeder.php @@ -0,0 +1,20 @@ +where('tagarrahnbid', '=', 1)->update([ + 'group_id' => 1, + ]); + } +} From 9323e3639822b8de122e3dcc58a30d6101217a40 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 4 Dec 2023 09:42:32 +0800 Subject: [PATCH 052/114] round up at tebus --- app/Http/Controllers/TebusController.php | 52 +++++++++++++----------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 0baf7c8..7d13ccd 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -82,11 +82,12 @@ class TebusController extends Controller $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; - $hargatebus = bcdiv(round($harga_tebus,2),1,1); - $hargatebus = number_format($hargatebus,2); - if(strpos($hargatebus,',')){ - $hargatebus = str_replace(',','',$hargatebus); - } + $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); + // $hargatebus = bcdiv(round($harga_tebus,2),1,1); + // $hargatebus = number_format($hargatebus,2); + // if(strpos($hargatebus,',')){ + // $hargatebus = str_replace(',','',$hargatebus); + // } return $hargatebus; } @@ -2398,25 +2399,26 @@ class TebusController extends Controller $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); $ujrah = $bilang_bln * $array_upah['ujrah']; $onepercent = $bilang_bln * $array_upah['onepercent']; + $onepercent_semasa = $onepercent; + $ujrah_semasa = $ujrah; + // $ujrah_semasa_round = number_format($ujrah,2); + // if(strpos($ujrah_semasa_round,',')){ + // $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); + // } + // $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); + // if(strpos($ujrah_semasa,',')){ + // $ujrah_semasa = str_replace(',','',$ujrah_semasa); + // } - $ujrah_semasa_round = number_format($ujrah,2); - if(strpos($ujrah_semasa_round,',')){ - $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); - } - $ujrah_semasa = substr($ujrah_semasa_round, 0, -1); - if(strpos($ujrah_semasa,',')){ - $ujrah_semasa = str_replace(',','',$ujrah_semasa); - } - - $onepercent_semasa_round = number_format($onepercent,2); - if(strpos($onepercent_semasa_round,',')){ - $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); - } - $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); - if(strpos($onepercent_semasa,',')){ - $onepercent_semasa = str_replace(',','',$onepercent_semasa); - } + // $onepercent_semasa_round = number_format($onepercent,2); + // if(strpos($onepercent_semasa_round,',')){ + // $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); + // } + // $onepercent_semasa = substr($onepercent_semasa_round, 0, -1); + // if(strpos($onepercent_semasa,',')){ + // $onepercent_semasa = str_replace(',','',$onepercent_semasa); + // } return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; } @@ -2443,7 +2445,8 @@ class TebusController extends Controller $ujrah = $bilang_bln * $array_upah['ujrah']; $onepercent = $bilang_bln * $array_upah['onepercent']; - $ujrah_semasa = round($ujrah,PHP_ROUND_HALF_UP); + $ujrah_semasa = $ujrah; + // $ujrah_semasa = round($ujrah,PHP_ROUND_HALF_UP); // $ujrah_semasa_round = number_format($ujrah,2); // if(strpos($ujrah_semasa_round,',')){ // $ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round); @@ -2453,7 +2456,8 @@ class TebusController extends Controller // $ujrah_semasa = str_replace(',','',$ujrah_semasa); // } - $onepercent_semasa = round($onepercent,PHP_ROUND_HALF_UP); + $onepercent_semasa = $onepercent; + // $onepercent_semasa = round($onepercent,PHP_ROUND_HALF_UP); // $onepercent_semasa_round = number_format($onepercent,2); // if(strpos($onepercent_semasa_round,',')){ // $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round); From c41ff934e3c7bf01cb2843dc6cf32c81423610b6 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 4 Dec 2023 16:26:00 +0800 Subject: [PATCH 053/114] isset duitpelanggan --- app/Http/Controllers/TebusController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 7d13ccd..5c739cd 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -583,7 +583,7 @@ class TebusController extends Controller 'created_at' => $current, 'bakiharga' => $baki_hargajualan, 'nowakil' => (int)$request->nowakil, - 'duitpelanggan' => $request->duitpelanggan, + 'duitpelanggan' => isset($request->duitpelanggan) ? $request->duitpelanggan : 0, 'bakipelanggan' => $request->bakipelanggan ]); } From dfdfe15b8b8f17d324514ced23409123945a0f42 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 5 Dec 2023 09:27:10 +0800 Subject: [PATCH 054/114] add imbang duga api and lejeram api and fix round down --- app/Http/Controllers/AdminPageController.php | 12 +-- app/Http/Controllers/GadaiController.php | 14 ++-- .../Reports/OnePercentController.php | 43 ++++++++++ app/Http/Controllers/TebusController.php | 78 +++++++++---------- app/Services/Reports/OnePercentService.php | 55 +++++++++++++ routes/report.php | 5 ++ tinker/getOnePercent.php | 14 ++++ 7 files changed, 170 insertions(+), 51 deletions(-) create mode 100644 app/Http/Controllers/Reports/OnePercentController.php create mode 100644 app/Services/Reports/OnePercentService.php create mode 100644 tinker/getOnePercent.php diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index 76604ae..e7df70f 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3120,11 +3120,11 @@ class AdminPageController extends Controller $year = $current->year; $month = $tarikh->month; - $test = Gadai::on($cawangan['mysql']) - ->whereBetween('tempoh',[0.5,1]) - ->where('sttebus','<>','') - ->whereYear('t_gadai',$current->year()) - ->pluck('norujukan'); + // $test = Gadai::on($cawangan['mysql']) + // ->whereBetween('tempoh',[0.5,1]) + // ->where('sttebus','<>','') + // ->whereYear('t_gadai',$current->year()) + // ->pluck('norujukan'); $get_norujukan = Gadai::on($cawangan['mysql']) ->selectRaw("norujukan,CASE WHEN (YEAR(t_gadai) = YEAR(t_update) and MONTH(t_gadai) = MONTH(t_update)) THEN '1' ELSE '0' END AS result") @@ -3143,6 +3143,7 @@ class AdminPageController extends Controller }) ->whereIn('trans.norujukan',$get_norujukan) ->where('transaction.trans_type','T') + ->where('onepercent','=',0) ->sum('keuntungan_rebet'); $sum_keun_ansuran = Transaction::on('mysql7') @@ -3153,6 +3154,7 @@ class AdminPageController extends Controller }) ->whereIn('trans.norujukan',$get_norujukan) ->where('transaction.trans_type','A') + ->where('onepercent','=',0) ->sum('bayaran_keuntungan'); $total = $sum_keun_tebus + $sum_keun_ansuran; diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index b73d840..6870a8e 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -361,13 +361,13 @@ class GadaiController extends Controller // $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; - $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); - // $upah_semasa_round = number_format($upahsemasa_raw,2); - // $upah_semasa = substr($upah_semasa_round, 0, -1); - // // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); - // if(strpos($upah_semasa,',')){ - // $upah_semasa = str_replace(',','',$upah_semasa); - // } + // $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); + $upah_semasa_round = number_format($upahsemasa_raw,2); + $upah_semasa = substr($upah_semasa_round, 0, -1); + // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } return $upah_semasa; } diff --git a/app/Http/Controllers/Reports/OnePercentController.php b/app/Http/Controllers/Reports/OnePercentController.php new file mode 100644 index 0000000..9c51542 --- /dev/null +++ b/app/Http/Controllers/Reports/OnePercentController.php @@ -0,0 +1,43 @@ +getTotalKeuntungan('B'); + + return response()->json($response); + } + + public function getUjrahImbangDuga(string $kod_cawangan) + { + $reports = new ReportOne($kod_cawangan); + $response = $reports->getTotalUjrah('B'); + + return response()->json($response); + } + + public function getKeuntunganLejerAm(string $kod_cawangan,Request $request) + { + $reports = new ReportOne($kod_cawangan); + $response = $reports->getTotalKeuntungan('L',$request->mula,$request->hingga); + + return response()->json($response); + } + + public function getUjrahLejerAm(string $kod_cawangan,Request $request) + { + $reports = new ReportOne($kod_cawangan); + $response = $reports->getTotalUjrah('L',$request->mula,$request->hingga); + + return response()->json($response); + } +} diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 5c739cd..f2c4ef2 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -59,12 +59,12 @@ class TebusController extends Controller $rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan); $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; - $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); - // $hargatebus = bcdiv(round($harga_tebus,2),1,1); - // $hargatebus = number_format($hargatebus,2); - // if(strpos($hargatebus,',')){ - // $hargatebus = str_replace(',','',$hargatebus); - // } + // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); + $hargatebus = bcdiv(round($harga_tebus,2),1,1); + $hargatebus = number_format($hargatebus,2); + if(strpos($hargatebus,',')){ + $hargatebus = str_replace(',','',$hargatebus); + } return response()->json($hargatebus); } @@ -82,12 +82,12 @@ class TebusController extends Controller $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; - $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); - // $hargatebus = bcdiv(round($harga_tebus,2),1,1); - // $hargatebus = number_format($hargatebus,2); - // if(strpos($hargatebus,',')){ - // $hargatebus = str_replace(',','',$hargatebus); - // } + // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); + $hargatebus = bcdiv(round($harga_tebus,2),1,1); + $hargatebus = number_format($hargatebus,2); + if(strpos($hargatebus,',')){ + $hargatebus = str_replace(',','',$hargatebus); + } return $hargatebus; } @@ -117,15 +117,15 @@ class TebusController extends Controller $upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']); } - $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); - // $upah_semasa_round = number_format($upahsemasa_raw,2); - // if(strpos($upah_semasa_round,',')){ - // $upah_semasa_round = str_replace(',','',$upah_semasa_round); - // } - // $upah_semasa = substr($upah_semasa_round, 0, -1); - // if(strpos($upah_semasa,',')){ - // $upah_semasa = str_replace(',','',$upah_semasa); - // } + // $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP); + $upah_semasa_round = number_format($upahsemasa_raw,2); + if(strpos($upah_semasa_round,',')){ + $upah_semasa_round = str_replace(',','',$upah_semasa_round); + } + $upah_semasa = substr($upah_semasa_round, 0, -1); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } return $upah_semasa; } @@ -156,15 +156,15 @@ class TebusController extends Controller $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); } - $upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP); - // $upah_rebet_round = number_format($upahrebet_raw,2); - // if(strpos($upah_rebet_round,',')){ - // $upah_rebet_round = str_replace(',','',$upah_rebet_round); - // } - // $upah_rebet = substr($upah_rebet_round, 0, -1); - // if(strpos($upah_rebet,',')){ - // $upah_rebet = str_replace(',','',$upah_rebet); - // } + // $upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP); + $upah_rebet_round = number_format($upahrebet_raw,2); + if(strpos($upah_rebet_round,',')){ + $upah_rebet_round = str_replace(',','',$upah_rebet_round); + } + $upah_rebet = substr($upah_rebet_round, 0, -1); + if(strpos($upah_rebet,',')){ + $upah_rebet = str_replace(',','',$upah_rebet); + } return $upah_rebet; } @@ -188,15 +188,15 @@ class TebusController extends Controller $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); - $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP); - // $upah_rebet_round = number_format($upahrebet_raw,2); - // if(strpos($upah_rebet_round,',')){ - // $upah_rebet_round = str_replace(',','',$upah_rebet_round); - // } - // $upah_rebet = substr($upah_rebet_round, 0, -1); - // if(strpos($upah_rebet,',')){ - // $upah_rebet = str_replace(',','',$upah_rebet); - // } + // $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP); + $upah_rebet_round = number_format($upahrebet_raw,2); + if(strpos($upah_rebet_round,',')){ + $upah_rebet_round = str_replace(',','',$upah_rebet_round); + } + $upah_rebet = substr($upah_rebet_round, 0, -1); + if(strpos($upah_rebet,',')){ + $upah_rebet = str_replace(',','',$upah_rebet); + } $total_untung_rebet = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('keuntungan_rebet'); $total_untung_asal = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('bayaran_keuntungan'); diff --git a/app/Services/Reports/OnePercentService.php b/app/Services/Reports/OnePercentService.php new file mode 100644 index 0000000..770be63 --- /dev/null +++ b/app/Services/Reports/OnePercentService.php @@ -0,0 +1,55 @@ +sum('onepercent_rebet'); + }else if($type == 'L'){ + $keuntungan = TransaksiKeuntungan::on('mysql7') + ->whereDate('tarikh_bayaran','>=',$start) + ->whereDate('tarikh_bayaran','<=',$end) + ->sum('onepercent_rebet');; + } + + return $keuntungan; + } + + public function getTotalUjrah($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ + + + if($type == 'B'){ + $ujrah = TransaksiKeuntungan::on('mysql7')->sum('ujrah_rebet'); + // $ujrah = TransaksiKeuntungan::on('mysql7')->selectRaw('SUM(ujrah - ujrah_rebet) as total') + // ->first(); + // $ujrah = $ujrah['total']; + }else if($type == 'L'){ + $ujrah = TransaksiKeuntungan::on('mysql7') + ->whereDate('tarikh_bayaran','>=',$start) + ->whereDate('tarikh_bayaran','<=',$end) + ->sum('ujrah_rebet');; + } + + return $ujrah; + } + + +} diff --git a/routes/report.php b/routes/report.php index 749ddab..c4cdbbd 100644 --- a/routes/report.php +++ b/routes/report.php @@ -8,5 +8,10 @@ $router->group(['prefix'=>'api/reports'], function () use ($router){ $router->get('penebusan/{kod_cawangan}', ['uses' => 'PenebusanController@getLaporanCawangan']); $router->get('ansuran', ['uses' => 'AnsuranController@getSummaryLaporanAnsuran']); $router->get('ansuran/{kod_cawangan}', ['uses' => 'AnsuranController@getLaporanCawangan']); + $router->get('onepercent/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganImbangDuga']); + $router->get('onepercent/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganLejerAm']); + $router->get('ujrah/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getUjrahImbangDuga']); + $router->get('ujrah/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getUjrahLejerAm']); + }); }); diff --git a/tinker/getOnePercent.php b/tinker/getOnePercent.php new file mode 100644 index 0000000..b050fb0 --- /dev/null +++ b/tinker/getOnePercent.php @@ -0,0 +1,14 @@ +getTotalKeuntungan('B'); +$test2 = $report->getTotalUjrah('B'); + + +dd($test,$test2); + + From 6dc8aea2565475e7d874118e6cf794b764d13d0a Mon Sep 17 00:00:00 2001 From: Amirah Date: Wed, 6 Dec 2023 08:46:22 +0800 Subject: [PATCH 055/114] add tagbaru laporan gadai --- app/Http/Controllers/GadaiController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 6870a8e..e86216d 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -808,7 +808,7 @@ class GadaiController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai','norujukan','nokp','semakbarcode','masa','berat','nilaimarhun','pinjaman','upah12','percentpinj','teller','nokp','ujrah','onepercent') + $gadai_data = Gadai::on($cawangan['mysql'])->select('t_gadai','norujukan','nokp','semakbarcode','masa','berat','nilaimarhun','pinjaman','upah12','percentpinj','teller','nokp','ujrah','onepercent','tagbaru') ->where('t_gadai','>=',$request->mula) ->where('t_gadai','<=',$request->akhir) ->orderBy('t_gadai') @@ -836,7 +836,9 @@ class GadaiController extends Controller "alamat1"=> $customer_info['alamat1'], "teller"=> $gadaiData['teller'], "ujrah"=> $gadaiData['ujrah'], - "onepercent"=> $gadaiData['onepercent'] + "onepercent"=> $gadaiData['onepercent'], + "tagbaru"=> $gadaiData['tagbaru'] + ]); } } From ff9e7d8d46e1aaa8fabc05ae6891d62745bd35df Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Wed, 6 Dec 2023 14:40:44 +0800 Subject: [PATCH 056/114] update job wasap tmatang sag --- app/Jobs/SMSPelangganSAGLAMAbysag.php | 20 ++++++++++---------- app/Jobs/WhatsappPelangganSAGLAMAbysag.php | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/Jobs/SMSPelangganSAGLAMAbysag.php b/app/Jobs/SMSPelangganSAGLAMAbysag.php index da21922..c23681a 100644 --- a/app/Jobs/SMSPelangganSAGLAMAbysag.php +++ b/app/Jobs/SMSPelangganSAGLAMAbysag.php @@ -50,22 +50,22 @@ class SMSPelangganSAGLAMAbysag extends Job $mobile_no = ltrim($this->telefon, '+6'); // $mobile_no = '60178916936'; // $message = 'test'; - $tarikhmatang = date('d-m-Y',strtotime($this->tmatang)); - $tarikhmatang = date('d-m-Y',strtotime($this->tmatang)); - $tarikhmatang1 = date('d-m-Y',strtotime($this->tmatang1)); - $date = $current->toDateString(); - $today = date('d-m-Y',strtotime($date)); - // $current_date = new Carbon($current->toDateString()); + $tarikhmatang = $this->tmatang; + $tarikhmatangnew = date('d-m-Y',strtotime($tarikhmatang)); + $tarikhmatang1 = $this->tmatang1; + $tarikhmatang1new = date('d-m-Y',strtotime($tarikhmatang1)); + $today = $current->toDateString(); + // $current_date = new Carbon($current->toDateString()); if($this->lelong_tawarruq == '1'){ if($tarikhmatang > $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatang.'.'; + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatangnew.'.'; }elseif($tarikhmatang < $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatang.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatangnew.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} }else if($tarikhmatang1 < $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatang1.'.'; + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatang1new.'.'; }elseif($tarikhmatang1 > $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatang1.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatang1new.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} if(env('APP_ENV') != 'production'){ $mobile_no = env('ADMIN_PHONE_NUMBER'); diff --git a/app/Jobs/WhatsappPelangganSAGLAMAbysag.php b/app/Jobs/WhatsappPelangganSAGLAMAbysag.php index 94f818b..2d03e59 100644 --- a/app/Jobs/WhatsappPelangganSAGLAMAbysag.php +++ b/app/Jobs/WhatsappPelangganSAGLAMAbysag.php @@ -51,21 +51,21 @@ class WhatsappPelangganSAGLAMAbysag extends Job $current = new Carbon(); $mobile_no = ltrim($this->telefon, '+6'); // $mobile_no = '60178916936'; - $tarikhmatang = date('d-m-Y',strtotime($this->tmatang)); - $tarikhmatang1 = date('d-m-Y',strtotime($this->tmatang1)); - $date = $current->toDateString(); - $today = date('d-m-Y',strtotime($date)); - // $current_date = new Carbon($current->toDateString()); - if($this->lelong_tawarruq == '1'){ + $tarikhmatang = $this->tmatang; + $tarikhmatangnew = date('d-m-Y',strtotime($tarikhmatang)); + $tarikhmatang1 = $this->tmatang1; + $tarikhmatang1new = date('d-m-Y',strtotime($tarikhmatang1)); + $today = $current->toDateString(); + if($this->lelong_tawarruq == '1'){ if($tarikhmatang > $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatang.'*.'; + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatangnew.'*.'; }elseif($tarikhmatang < $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatang.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatangnew.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} }else if($tarikhmatang1 < $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatang1.'*.'; + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatang1new.'*.'; }elseif($tarikhmatang1 > $today){ - $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatang1.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatang1new.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} if(env('APP_ENV') != 'production'){ $mobile_no = env('ADMIN_PHONE_NUMBER'); From 69e3613e01b8bd6c05d0363d0e051106dffc9e46 Mon Sep 17 00:00:00 2001 From: Azfar Arsyad Date: Wed, 6 Dec 2023 17:08:34 +0800 Subject: [PATCH 057/114] add column to stokaudit --- ...714_add_column_ujrah_stokauditbackdate.php | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php diff --git a/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php b/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php new file mode 100644 index 0000000..a925dce --- /dev/null +++ b/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php @@ -0,0 +1,178 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('stokaudit1', function (Blueprint $table){ + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit2', function (Blueprint $table){ + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit3', function (Blueprint $table){ + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit4', function (Blueprint $table){ + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit5', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit6', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit7', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + + }); + + + Schema::connection($dbase)->table('stokaudit8', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit9', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit10', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit11', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + Schema::connection($dbase)->table('stokaudit12', function (Blueprint $table){ + + $table->decimal('utgonepercent', 9, 2); + $table->decimal('ujrah', 9, 2); + }); + + }; + + } + + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('stokaudit1', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit2', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit3', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + Schema::connection($dbase)->table('stokaudit4', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit5', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit6', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit7', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit8', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit9', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit10', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit11', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + + Schema::connection($dbase)->table('stokaudit12', function (Blueprint $table) { + $table->dropColumn(['utgonepercent', 'ujrah']); + }); + } + } +} \ No newline at end of file From 38d027c027e9f74013cb205867ae4f4af0ebd868 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 6 Dec 2023 23:41:22 +0800 Subject: [PATCH 058/114] fix autotawarruq and imbangduga --- app/Http/Controllers/AdminPageController.php | 4 +- app/Http/Controllers/GadaiController.php | 15 +++-- app/Http/Controllers/LelongController.php | 7 ++- .../Reports/OnePercentController.php | 27 +++++++++ app/Http/Controllers/TebusController.php | 50 ++++++++-------- app/Services/Reports/OnePercentService.php | 58 +++++++++++++++---- app/Services/TawarruqServices.php | 16 +++++ app/TransaksiKeuntungan.php | 2 +- ...8_115215_add_onepercent_to_gadai_table.php | 8 ++- ...ercent_to_transaction_keuntungan_table.php | 9 ++- ...1_104203_add_onepercent_to_tebus_table.php | 8 ++- ...1109_add_columns_to_komuditi_transaksi.php | 2 +- routes/report.php | 3 + 13 files changed, 153 insertions(+), 56 deletions(-) create mode 100644 app/Services/TawarruqServices.php diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index e7df70f..f6bf1aa 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3143,7 +3143,7 @@ class AdminPageController extends Controller }) ->whereIn('trans.norujukan',$get_norujukan) ->where('transaction.trans_type','T') - ->where('onepercent','=',0) + ->where('margin_semasa','=',0) ->sum('keuntungan_rebet'); $sum_keun_ansuran = Transaction::on('mysql7') @@ -3154,7 +3154,7 @@ class AdminPageController extends Controller }) ->whereIn('trans.norujukan',$get_norujukan) ->where('transaction.trans_type','A') - ->where('onepercent','=',0) + ->where('margin_semasa','=',0) ->sum('bayaran_keuntungan'); $total = $sum_keun_tebus + $sum_keun_ansuran; diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index e86216d..9639d41 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -394,14 +394,14 @@ class GadaiController extends Controller // $upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']); $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - $upah_rebet_round = number_format($upahrebet_raw,2); - $upah_rebet = substr($upah_rebet_round, 0, -1); - if(strpos($upah_rebet,',')){ - $upah_rebet = str_replace(',','',$upah_rebet); - } + // $upah_rebet_round = number_format($upahrebet_raw,2); + // $upah_rebet = substr($upah_rebet_round, 0, -1); + // if(strpos($upah_rebet,',')){ + // $upah_rebet = str_replace(',','',$upah_rebet); + // } // $upah_rebet = floatval(preg_replace('/[^\d.]/', '', $upah_rebet)); - return $upah_rebet; + return $upahrebet_raw; } public function updateGadaiMarhunOnline($kodcaw,$norujukan,Request $request){ @@ -520,6 +520,8 @@ class GadaiController extends Controller } $bilang_bln = $tempoh - $gadai['tempohbayar']; + $rounded = $upahsemasa - (($keuntungan['ujrah'] * $bilang_bln) + ($onepercentasal * $bilang_bln)); + $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ 'norujukan' => $norujukan, 'bayaran_keuntungan' => $upahsemasa, @@ -534,6 +536,7 @@ class GadaiController extends Controller 'tempoh' => $gadai['tempoh'], 'beza_tempoh' => $bilang_bln, 'margin_semasa' => $margin_semasa, + 'rounded' => $rounded, ]); DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 5e2be53..bdd3c82 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -578,9 +578,10 @@ class LelongController extends Controller if($cawangan['tagarrahnbid'] == 1){ // $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ - $lelong = Http::withOptions(['verify' => true])->get('http://adminbid.arrahn/api/portalApi',[ - 'norujukan' => $request->norujukan - ])->json(); + // $lelong = Http::withOptions(['verify' => true])->get('http://adminbid.arrahn/api/portalApi',[ + // 'norujukan' => $request->norujukan + // ])->json(); + $lelong = null; $lelong = ($lelong != null) ? $lelong['lelong'] : []; if( $lelong == null ) { diff --git a/app/Http/Controllers/Reports/OnePercentController.php b/app/Http/Controllers/Reports/OnePercentController.php index 9c51542..01e61d4 100644 --- a/app/Http/Controllers/Reports/OnePercentController.php +++ b/app/Http/Controllers/Reports/OnePercentController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Reports; use App\Http\Controllers\Controller; use App\Services\Reports\OnePercentService as ReportOne; +use App\TransaksiKeuntungan; use Illuminate\Http\Request; class OnePercentController extends Controller @@ -25,6 +26,14 @@ class OnePercentController extends Controller return response()->json($response); } + public function getRoundedImbangDuga(string $kod_cawangan) + { + $reports = new ReportOne($kod_cawangan); + $response = $reports->getTotalRounded('B'); + + return response()->json($response); + } + public function getKeuntunganLejerAm(string $kod_cawangan,Request $request) { $reports = new ReportOne($kod_cawangan); @@ -40,4 +49,22 @@ class OnePercentController extends Controller return response()->json($response); } + + public function getRoundedLejerAm(string $kod_cawangan) + { + $reports = new ReportOne($kod_cawangan); + $response = $reports->getTotalRounded('B'); + + return response()->json($response); + } + + public function getTotalRebate(Request $request){ + $totalrebate = TransaksiKeuntungan::on('mysql7') + ->where('norujukan',$request->norujukan) + ->selectRaw('SUM(ujrah - ujrah_rebet) as ujrah') + ->selectRaw('SUM(onepercent - onepercent_rebet) as onepercent') + ->first(); + + return response()->json($totalrebate); + } } diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index f2c4ef2..c031f56 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -65,7 +65,6 @@ class TebusController extends Controller if(strpos($hargatebus,',')){ $hargatebus = str_replace(',','',$hargatebus); } - return response()->json($hargatebus); } @@ -89,7 +88,11 @@ class TebusController extends Controller $hargatebus = str_replace(',','',$hargatebus); } - return $hargatebus; + $rounded = $hargatebus - $harga_tebus; + Log::info([$harga_tebus,$rebet]); + $arrayharga = ['harga' => $hargatebus, 'rounded' => $rounded]; + + return $arrayharga; } public function kiraupahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ @@ -157,16 +160,16 @@ class TebusController extends Controller } // $upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP); - $upah_rebet_round = number_format($upahrebet_raw,2); - if(strpos($upah_rebet_round,',')){ - $upah_rebet_round = str_replace(',','',$upah_rebet_round); - } - $upah_rebet = substr($upah_rebet_round, 0, -1); - if(strpos($upah_rebet,',')){ - $upah_rebet = str_replace(',','',$upah_rebet); - } + // $upah_rebet_round = number_format($upahrebet_raw,2); + // if(strpos($upah_rebet_round,',')){ + // $upah_rebet_round = str_replace(',','',$upah_rebet_round); + // } + // $upah_rebet = substr($upah_rebet_round, 0, -1); + // if(strpos($upah_rebet,',')){ + // $upah_rebet = str_replace(',','',$upah_rebet); + // } - return $upah_rebet; + return $upahrebet_raw; } public function kiraUpahRebetSebenar($kodcaw,$norujukan){ @@ -449,15 +452,15 @@ class TebusController extends Controller $rebet_raw =$gadai_data['upah12'] - $transaction_keuntungan - $upah_rebet; // dd($gadai_data['upah12'],$transaction_keuntungan,$upah_rebet,$jeniskeuntungan,$rebet_raw); - $rebet_round = bcdiv(round($rebet_raw,2),1,1); - $rebet_round = number_format($rebet_round,2); + // $rebet_round = bcdiv(round($rebet_raw,2),1,1); + // $rebet_round = number_format($rebet_round,2); - if(strpos($rebet_round,',')){ - $rebet_round = str_replace(',','',$rebet_round); - } - $rebet = substr($rebet_round, 0, -1); - - return $rebet; + // if(strpos($rebet_round,',')){ + // $rebet_round = str_replace(',','',$rebet_round); + // } + // $rebet = substr($rebet_round, 0, -1); + + return $rebet_raw; } public function tebusUpdate($kodcaw,$norujukan,Request $request){ @@ -479,7 +482,7 @@ class TebusController extends Controller $gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - $ujrah=0;$onepercent=0; + $ujrah=0;$onepercent=0;$rounded=0; if($gadai['hargajualan'] == null){ $harga_tebus = $this->hargaTebusNotTawarruq($kodcaw,$norujukan); $upah_tebus = $this->kiraUpahNotTawarruq($kodcaw,$norujukan); @@ -489,7 +492,7 @@ class TebusController extends Controller $harga_tebus = $this->hargaTebusTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); $upah_tebus = $this->kiraupahTawarruq($kodcaw,$norujukan,$request->jeniskeuntungan); $upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan); - $upah_rebet_sebenar = $harga_tebus - $gadai['bakipjm']; + $upah_rebet_sebenar = $harga_tebus['harga'] - $gadai['bakipjm']; if($request->jeniskeuntungan == 'onepercent'){ $array_onepercent = $this->kiraupahUjrahOnePercent($kodcaw,$norujukan); @@ -515,7 +518,7 @@ class TebusController extends Controller 'pinjaman' => $gadai['pinjaman'], 'ansuran' => 0.00, 'addpinjaman' => $request->addpinjaman, - 'bakipjm' => $harga_tebus, + 'bakipjm' => $harga_tebus['harga'], 'bakiupah' => $upah_tebus, 'terima' => "*", 'kodgl' => "0", @@ -557,6 +560,7 @@ class TebusController extends Controller 'margin_semasa' => ($request->jeniskeuntungan == 'onepercent') ? $margin_semasa : 0, 'tempoh' => $gadai['tempoh'], 'beza_tempoh' => ($gadai['tempoh'] - $gadai['tempohbayar']), + 'rounded' => $harga_tebus['rounded'], ]); if($request->jenistebus == 'P'){ @@ -579,7 +583,7 @@ class TebusController extends Controller 'nokp' => $gadai['nokp'], 'teller' => $request->teller, 'kodcaw' => $kodcaw, - 'duit_masuk' => $harga_tebus, + 'duit_masuk' => $harga_tebus['harga'], 'created_at' => $current, 'bakiharga' => $baki_hargajualan, 'nowakil' => (int)$request->nowakil, diff --git a/app/Services/Reports/OnePercentService.php b/app/Services/Reports/OnePercentService.php index 770be63..6dede56 100644 --- a/app/Services/Reports/OnePercentService.php +++ b/app/Services/Reports/OnePercentService.php @@ -4,6 +4,7 @@ namespace App\Services\Reports; use App\Cawangan; use App\CawanganDetail; +use App\Gadai; use App\TransaksiKeuntungan; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; @@ -13,18 +14,49 @@ class OnePercentService { // `B` stands for balance sheet and `L` stands for Ledger + private $kod_cawangan; + private $cawangan; + public function __construct($kod_cawangan){ + $this->kod_cawangan = $kod_cawangan; + $this->cawangan = Cawangan::where('kodcaw',$kod_cawangan)->first(); + } - public function __construct($kod_cawangan) - { + + public function getTotalRounded($type='B',$start = '2023-12-14',$end = '2023-12-14'){ + if($type == 'B'){ + $rounded = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function($join) + { + $join->on('trans.norujukan', '=', 'transaksi_keuntungan.norujukan'); + $join->on('trans.created_at', '=', 'transaksi_keuntungan.tarikh_bayaran'); + }) + ->where('trans.trans_type','T') + ->sum('transaksi_keuntungan.rounded'); + + }else if($type == 'L'){ + $rounded = TransaksiKeuntungan::on('mysql7') + ->whereDate('tarikh_bayaran','>=',$start) + ->whereDate('tarikh_bayaran','<=',$end) + ->sum('rounded');; + } + + return $rounded; } - public function getTotalKeuntungan($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ - + public function getTotalKeuntungan($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ if($type == 'B'){ - $keuntungan = TransaksiKeuntungan::on('mysql7')->sum('onepercent_rebet'); - }else if($type == 'L'){ + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); + $keuntungan = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan',$norujukan) + ->sum('onepercent_rebet'); + + }else if($type == 'L'){ + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->where('t_update','>=',$start)->where('t_update','<=',$end)->pluck('norujukan'); + + $keuntungan = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan',$norujukan) ->whereDate('tarikh_bayaran','>=',$start) ->whereDate('tarikh_bayaran','<=',$end) ->sum('onepercent_rebet');; @@ -37,12 +69,16 @@ class OnePercentService if($type == 'B'){ - $ujrah = TransaksiKeuntungan::on('mysql7')->sum('ujrah_rebet'); - // $ujrah = TransaksiKeuntungan::on('mysql7')->selectRaw('SUM(ujrah - ujrah_rebet) as total') - // ->first(); - // $ujrah = $ujrah['total']; - }else if($type == 'L'){ + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); + $ujrah = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan',$norujukan) + ->sum('ujrah_rebet'); + }else if($type == 'L'){ + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); + + $ujrah = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan',$norujukan) ->whereDate('tarikh_bayaran','>=',$start) ->whereDate('tarikh_bayaran','<=',$end) ->sum('ujrah_rebet');; diff --git a/app/Services/TawarruqServices.php b/app/Services/TawarruqServices.php new file mode 100644 index 0000000..1905df4 --- /dev/null +++ b/app/Services/TawarruqServices.php @@ -0,0 +1,16 @@ +getActiveDB(); foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('gadai', function (Blueprint $table) { - $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru']); - }); + if (Schema::connection('mysql7')->hasColumn('ujrah', 'onepercent')){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) { + $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru']); + }); + } } } } diff --git a/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php b/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php index 59d4036..e036226 100644 --- a/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php +++ b/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php @@ -21,6 +21,7 @@ class AddOnepercentToTransactionKeuntunganTable extends Migration $table->decimal('tempoh', 5, 2); $table->decimal('beza_tempoh', 5, 2); $table->decimal('margin_semasa', 5, 2); + $table->decimal('rounded', 5, 2); }); } @@ -31,8 +32,10 @@ class AddOnepercentToTransactionKeuntunganTable extends Migration */ public function down() { - Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) { - $table->dropColumn(['ujrah', 'ujrah_rebet', 'onepercent', 'onepercent_rebet', 'tempoh', 'beza_tempoh', 'margin_semasa']); - }); + if (Schema::connection('mysql7')->hasColumn('ujrah', 'onepercent')){ + Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) { + $table->dropColumn(['ujrah', 'ujrah_rebet', 'onepercent', 'onepercent_rebet', 'tempoh', 'beza_tempoh', 'margin_semasa','rounded']); + }); + } } } diff --git a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php index 8b09cc0..d09b7ea 100644 --- a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php +++ b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php @@ -57,9 +57,11 @@ class AddOnepercentToTebusTable extends Migration $db_connection = $this->getActiveDB(); foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('tebus', function (Blueprint $table) { - $table->dropColumn(['ujrah', 'onepercent']); - }); + if (Schema::connection($dbase)->hasColumn('ujrah', 'onepercent')){ + Schema::connection($dbase)->table('tebus', function (Blueprint $table) { + $table->dropColumn(['ujrah', 'onepercent']); + }); + } } } } diff --git a/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php b/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php index 1c61cb9..baac714 100644 --- a/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php +++ b/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php @@ -42,7 +42,7 @@ class AddColumnsToKomuditiTransaksi extends Migration { $online_arrahn_connection_array = array_filter(config('database.connections'), function($connection) { - if($connection['database'] === 'online_arrahn' || $connection['database'] === 'master_krk'){ + if($connection['database'] === 'online_arrahn2' || $connection['database'] === 'master_krk'){ return true; } diff --git a/routes/report.php b/routes/report.php index c4cdbbd..2ceea39 100644 --- a/routes/report.php +++ b/routes/report.php @@ -12,6 +12,9 @@ $router->group(['prefix'=>'api/reports'], function () use ($router){ $router->get('onepercent/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganLejerAm']); $router->get('ujrah/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getUjrahImbangDuga']); $router->get('ujrah/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getUjrahLejerAm']); + $router->get('rounded/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getRoundedImbangDuga']); + $router->get('rounded/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getRoundedLejerAm']); + $router->get('totalrebate', ['uses' => 'OnePercentController@getTotalRebate']); }); }); From 3f8149c57696103b1624242240ff5275abebe453 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 12 Dec 2023 12:39:30 +0800 Subject: [PATCH 059/114] add listcawangan --- app/Http/Controllers/AdminPageController.php | 14 ++++++++++++++ routes/web.php | 2 ++ 2 files changed, 16 insertions(+) diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index b69b826..1d9c628 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3754,4 +3754,18 @@ class AdminPageController extends Controller return response()->json($bayaran); } } + + public function ListCawangan(Request $request){ + $cawangan = Cawangan::on('mysql7')->get(); + + return response()->json($cawangan); + } + + public function ListCawangan_Update(Request $request){ + $cawangan = Cawangan::on('mysql7') + ->where('mid',$request->mid) + ->update(['version' => $request->version]); + + return response()->json($cawangan); + } } diff --git a/routes/web.php b/routes/web.php index ee44873..648d41a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -777,6 +777,8 @@ $router->group(['prefix'=>'admin'], function () use ($router){ $router->put('tetapan/listbarcode/update',['uses'=>'AdminPageController@ListBarcodeScannedOperasi_Update']); $router->get('tetapan/penggunamargin',['uses'=>'AdminPageController@PenggunaMargin']); $router->put('tetapan/penggunamargin/update',['uses'=>'AdminPageController@PenggunaMargin_Update']); + $router->get('tetapan/listcawangan',['uses'=>'AdminPageController@ListCawangan']); + $router->put('tetapan/listcawangan/update',['uses'=>'AdminPageController@ListCawangan_Update']); $router->get('laporanllcaw/gadai',['uses'=>'AdminPageController@getLaporanGadaiAllCaw']); From dd6f97f34a5fac73a3b77ee4e13eb4a1f9163b7b Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 12 Dec 2023 13:49:16 +0800 Subject: [PATCH 060/114] remove jeniskeuntungan in web.php --- routes/web.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/web.php b/routes/web.php index a2a4908..3ce9bd5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -106,8 +106,8 @@ $router->group(['prefix'=>'api'], function () use ($router){ //Tebus API $router->get('tebustawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusTawarruq']); - $router->get('upahtawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahTawarruq']); - $router->get('upahrebettawarruq/{kodcaw}/{norujukan}/{jeniskeuntungan}',['uses'=>'TebusController@upahRebetTawarruq']); + $router->get('upahtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahTawarruq']); + $router->get('upahrebettawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@upahRebetTawarruq']); $router->get('tebusseparuhtawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhTawarruq']); $router->get('tebusseparuhbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusSeparuhNotTawarruq']); $router->get('tebusbukantawarruq/{kodcaw}/{norujukan}',['uses'=>'TebusController@tebusNotTawarruq']); From 97196445e6f89ed667a5ca8a6db385b625149806 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 13 Dec 2023 22:00:36 +0800 Subject: [PATCH 061/114] fix rounded ujrah --- app/Support/v2/Calculation.php | 2 +- tinker/getOnePercent.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Support/v2/Calculation.php b/app/Support/v2/Calculation.php index 4b3d3cc..69c310f 100644 --- a/app/Support/v2/Calculation.php +++ b/app/Support/v2/Calculation.php @@ -89,7 +89,7 @@ class Calculation } public function getRoundedMethod(float $number = 0.0) : Float{ - $number_string = number_format($number,2); + $number_string = number_format(floor(($number*100))/100,2); $rounded = substr($number_string, 0, -1); $lastDigit = substr($number_string, -1); diff --git a/tinker/getOnePercent.php b/tinker/getOnePercent.php index 965da66..a43344b 100644 --- a/tinker/getOnePercent.php +++ b/tinker/getOnePercent.php @@ -3,7 +3,7 @@ use App\Services\MasterServices; use App\Support\v2\Calculation; - $number = 1456.50; + $number = 1456.529; $test2 = new Calculation(); $test = new MasterServices('KB2'); // $response = $test->kiraUpahTawarruq('KB2231207-0004'); From 850be004bf779c44d7d5d507e07357bc6e1b7d53 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 13 Dec 2023 23:43:18 +0800 Subject: [PATCH 062/114] penebusan fix bug rounded masa tebus kat resit --- app/Support/v2/Penebusan.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index 87845af..abac9c7 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -721,8 +721,8 @@ class Penebusan $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); $ujrah = $bilang_bln * $array_upah['ujrah']; $onepercent = $bilang_bln * $array_upah['onepercent']; - $onepercent_semasa = $onepercent; - $ujrah_semasa = $ujrah; + $onepercent_semasa = $onepercentservices->getRoundedMethod($onepercent); + $ujrah_semasa = $onepercentservices->getRoundedMethod($ujrah); return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; } @@ -744,8 +744,8 @@ class Penebusan $bilang_bln = $tempoh - $gadai_data['tempohbayar']; $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $ujrah = $bilang_bln * $array_upah['ujrah']; - $onepercent = $bilang_bln * $array_upah['onepercent']; + $ujrah = $onepercentservices->getRoundedMethod($bilang_bln * $array_upah['ujrah']); + $onepercent = $onepercentservices->getRoundedMethod($bilang_bln * $array_upah['onepercent']); return ['ujrah' => $ujrah, 'onepercent' => $onepercent]; } From ab4be6cf11d4d8dc42296a85a2541e9db51b7d96 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 13 Dec 2023 23:49:59 +0800 Subject: [PATCH 063/114] fix rounded dekat hargatebus sekali --- app/Support/v2/Penebusan.php | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index abac9c7..481fa39 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -35,6 +35,8 @@ class Penebusan } public function tebusTawarruq($kodcaw,$norujukan){ + $onepercentservices = new Calculation(); + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -49,15 +51,20 @@ class Penebusan $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); - $hargatebus = bcdiv(round($harga_tebus,2),1,1); - $hargatebus = number_format($hargatebus,2); - if(strpos($hargatebus,',')){ - $hargatebus = str_replace(',','',$hargatebus); - } + // $hargatebus = bcdiv(round($harga_tebus,2),1,1); + // $hargatebus = number_format($hargatebus,2); + // if(strpos($hargatebus,',')){ + // $hargatebus = str_replace(',','',$hargatebus); + // } + + $hargatebus = $onepercentservices->getRoundedMethod($harga_tebus); + return response()->json($hargatebus); } public function hargaTebusTawarruq($kodcaw,$norujukan){ + $onepercentservices = new Calculation(); + $cawangan = Cawangan::on('mysql7') ->where('kodcaw','=',$kodcaw) ->first(); @@ -71,11 +78,13 @@ class Penebusan $harga_tebus = $gadai_data['bakihargajualan'] - $rebet; // $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP); - $hargatebus = bcdiv(round($harga_tebus,2),1,1); - $hargatebus = number_format($hargatebus,2); - if(strpos($hargatebus,',')){ - $hargatebus = str_replace(',','',$hargatebus); - } + // $hargatebus = bcdiv(round($harga_tebus,2),1,1); + // $hargatebus = number_format($hargatebus,2); + // if(strpos($hargatebus,',')){ + // $hargatebus = str_replace(',','',$hargatebus); + // } + + $hargatebus = $onepercentservices->getRoundedMethod($harga_tebus); $arrayharga = ['harga' => $hargatebus]; From b5b98d0fdf2975bf545656d1de8a9f65c53647a9 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 13 Dec 2023 23:55:10 +0800 Subject: [PATCH 064/114] add tunggakan for onepercent and ujrah --- app/Http/Controllers/GadaiController.php | 53 +---------- app/Services/MasterServices.php | 6 ++ app/Support/Onepercent.php | 6 ++ app/Support/Tawarruq.php | 6 ++ app/Support/v1/GadaiV1.php | 55 +++++++++++ app/Support/v2/GadaiV2.php | 91 +++++++++++++++++++ ...12_115215_add_tunggakan_to_gadai_table.php | 69 ++++++++++++++ 7 files changed, 236 insertions(+), 50 deletions(-) create mode 100644 database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 6e6f18e..6257226 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -3216,57 +3216,10 @@ class GadaiController extends Controller } foreach($cawangan as $cawangan_mysql){ - $all_gadai = Gadai::on($cawangan_mysql['mysql'])->whereNotIn('sttebus',['L','T'])->get(); - foreach($all_gadai as $gadai){ - if($gadai['t_update'] == null){ - $tarikh_update = Carbon::parse($gadai['t_gadai'].' '. $gadai['masa']); - }else{ - $tarikh_update = Carbon::parse($gadai['t_update'].' 00:00:00' ); - } - $tarikh_gadai = Carbon::parse($gadai['t_gadai']. ' 00:00:00'); - $current = Carbon::now(); - - $tahun_gadai = $tarikh_gadai->year; - $bulan_gadai = $tarikh_gadai->month; - $hari_gadai = $tarikh_gadai->day; - - $tahun_semasa = $current->year; - $bulan_semasa = $current->month; - $hari_semasa = $current->day; - - if($hari_semasa >= $hari_gadai){ - $beza_hari = $hari_semasa - $hari_gadai + 1; - }else if($hari_semasa < $hari_gadai){ - $bulan_semasa = $bulan_semasa - 1; - $beza_hari = ($hari_semasa + 30) - $hari_gadai + 1; - } - - $extensivemonth_gadai = 0; - - if($beza_hari >= 1 && $beza_hari <= 15){ - $extensivemonth_gadai = 0.5; - }else if($beza_hari >= 16){ - $extensivemonth_gadai = 1; - }else{ - $extensivemonth_gadai = 0; - } - - $beza_tahun = $tahun_semasa - $tahun_gadai; - - $beza_bulan = ($bulan_semasa + ($beza_tahun * 12)) - $bulan_gadai; - - $tempoh_gadai = $beza_bulan + $extensivemonth_gadai; - - $upah_semasa = $this->kiraupahTawarruqStokAudit($tempoh_gadai,$gadai['tempohbayar'],$gadai['kadarupah'],$gadai['bakipjm']); - - Gadai::on($cawangan_mysql['mysql'])->where('norujukan','=',$gadai['norujukan'])->update(array( - 'jbg' => $tempoh_gadai, - 'tempoh' => $tempoh_gadai, - 'tunggakan' => $upah_semasa - )); - } + $master = new MasterServices($cawangan_mysql['kodcaw']); + $response = $master->updateJBGSemasa($request); } - return response()->json('successful',200); + return $response; } public function PembiayaanBulanan(Request $request){ diff --git a/app/Services/MasterServices.php b/app/Services/MasterServices.php index 0df8790..91603e8 100644 --- a/app/Services/MasterServices.php +++ b/app/Services/MasterServices.php @@ -75,6 +75,12 @@ class MasterServices return $response; } + public function updateJBGSemasa(HttpRequest $request){ + $onepercent = new OnepercentEngine($this->cawangan); + $response = $onepercent->updateJBGsemasa($request); + return $response; + } + /* End Gadaian */ /* Start Penebusan */ diff --git a/app/Support/Onepercent.php b/app/Support/Onepercent.php index 69a0f32..83c7014 100644 --- a/app/Support/Onepercent.php +++ b/app/Support/Onepercent.php @@ -56,6 +56,12 @@ class OnePercent extends MasterServices return $response; } + public function updateJBGSemasa(HttpRequest $request){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateJBG($request); + return $response; + } + public function getKadarUjrah(HttpRequest $request){ $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); $onePercentServices = new Calculation(); diff --git a/app/Support/Tawarruq.php b/app/Support/Tawarruq.php index aff1913..dc63fda 100644 --- a/app/Support/Tawarruq.php +++ b/app/Support/Tawarruq.php @@ -41,6 +41,12 @@ class Tawarruq extends MasterServices return $response; } + public function updateJBGSemasa(HttpRequest $request){ + $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateJBG($request); + return $response; + } + public function getUpahSebenar($norujukan){ $gadai = new Version1Gadai($this->kodcaw,$this->cawangan_info); $response = $gadai->kiraupahTawarruq($norujukan); diff --git a/app/Support/v1/GadaiV1.php b/app/Support/v1/GadaiV1.php index 08c54cb..902b50e 100644 --- a/app/Support/v1/GadaiV1.php +++ b/app/Support/v1/GadaiV1.php @@ -266,6 +266,61 @@ class GadaiV1 return response()->json($update_gadai, 200); } + public function updateJBG(HttpRequest $request){ + $cawangan_mysql = $this->cawangan_info; + $all_gadai = Gadai::on($cawangan_mysql['mysql'])->whereNotIn('sttebus',['L','T'])->get(); + foreach($all_gadai as $gadai){ + if($gadai['t_update'] == null){ + $tarikh_update = Carbon::parse($gadai['t_gadai'].' '. $gadai['masa']); + }else{ + $tarikh_update = Carbon::parse($gadai['t_update'].' 00:00:00' ); + } + $tarikh_gadai = Carbon::parse($gadai['t_gadai']. ' 00:00:00'); + $current = Carbon::now(); + $tahun_gadai = $tarikh_gadai->year; + $bulan_gadai = $tarikh_gadai->month; + $hari_gadai = $tarikh_gadai->day; + $tahun_semasa = $current->year; + $bulan_semasa = $current->month; + $hari_semasa = $current->day; + if($hari_semasa >= $hari_gadai){ + $beza_hari = $hari_semasa - $hari_gadai + 1; + }else if($hari_semasa < $hari_gadai){ + $bulan_semasa = $bulan_semasa - 1; + $beza_hari = ($hari_semasa + 30) - $hari_gadai + 1; + } + $extensivemonth_gadai = 0; + if($beza_hari >= 1 && $beza_hari <= 15){ + $extensivemonth_gadai = 0.5; + }else if($beza_hari >= 16){ + $extensivemonth_gadai = 1; + }else{ + $extensivemonth_gadai = 0; + } + $beza_tahun = $tahun_semasa - $tahun_gadai; + $beza_bulan = ($bulan_semasa + ($beza_tahun * 12)) - $bulan_gadai; + $tempoh_gadai = $beza_bulan + $extensivemonth_gadai; + $upah_semasa = $this->kiraupahTawarruqStokAudit($tempoh_gadai,$gadai['tempohbayar'],$gadai['kadarupah'],$gadai['bakipjm']); + Gadai::on($cawangan_mysql['mysql'])->where('norujukan','=',$gadai['norujukan'])->update(array( + 'jbg' => $tempoh_gadai, + 'tempoh' => $tempoh_gadai, + 'tunggakan' => $upah_semasa + )); + } + return response()->json('successful',200); + } + public function kiraupahTawarruqStokAudit($tempoh,$tempohbayar,$kadarupah,$bakipinjaman){ + $bilang_bln = $tempoh - $tempohbayar; + $upahsemasa_raw = $bilang_bln * (($kadarupah/100 )* $bakipinjaman); + $upah_semasa_round = number_format($upahsemasa_raw,2); + $upah_semasa = substr($upah_semasa_round, 0, -1); + // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + return $upah_semasa; + } + } diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php index 4e03a5b..b9d71ed 100644 --- a/app/Support/v2/GadaiV2.php +++ b/app/Support/v2/GadaiV2.php @@ -323,6 +323,97 @@ class GadaiV2 return response()->json("success",200); } + public function updateJBG(HttpRequest $request){ + $cawangan_mysql = $this->cawangan_info; + $all_gadai = Gadai::on($cawangan_mysql['mysql'])->whereNotIn('sttebus',['L','T'])->get(); + foreach($all_gadai as $gadai){ + if($gadai['t_update'] == null){ + $tarikh_update = Carbon::parse($gadai['t_gadai'].' '. $gadai['masa']); + }else{ + $tarikh_update = Carbon::parse($gadai['t_update'].' 00:00:00' ); + } + $tarikh_gadai = Carbon::parse($gadai['t_gadai']. ' 00:00:00'); + $current = Carbon::now(); + $tahun_gadai = $tarikh_gadai->year; + $bulan_gadai = $tarikh_gadai->month; + $hari_gadai = $tarikh_gadai->day; + $tahun_semasa = $current->year; + $bulan_semasa = $current->month; + $hari_semasa = $current->day; + if($hari_semasa >= $hari_gadai){ + $beza_hari = $hari_semasa - $hari_gadai + 1; + }else if($hari_semasa < $hari_gadai){ + $bulan_semasa = $bulan_semasa - 1; + $beza_hari = ($hari_semasa + 30) - $hari_gadai + 1; + } + $extensivemonth_gadai = 0; + if($beza_hari >= 1 && $beza_hari <= 15){ + $extensivemonth_gadai = 0.5; + }else if($beza_hari >= 16){ + $extensivemonth_gadai = 1; + }else{ + $extensivemonth_gadai = 0; + } + $beza_tahun = $tahun_semasa - $tahun_gadai; + $beza_bulan = ($bulan_semasa + ($beza_tahun * 12)) - $bulan_gadai; + $tempoh_gadai = $beza_bulan + $extensivemonth_gadai; + + if(isset($gadai['tagbaru'])){ + if($gadai['tagbaru'] == 1){ + $upah_semasa = $this->kiraupahTawarruqStokAuditUjrahOnePercent($tempoh_gadai,$gadai['tempohbayar'],$gadai['kadarupah'],$gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['margin_semasa']); + Gadai::on($cawangan_mysql['mysql'])->where('norujukan','=',$gadai['norujukan'])->update(array( + 'jbg' => $tempoh_gadai, + 'tempoh' => $tempoh_gadai, + 'tunggakan' => $upah_semasa['pendapatan'], + 'tunggakanujrah' => $upah_semasa['ujrah'], + 'tunggakanonepercent' => $upah_semasa['keuntungan'], + )); + } + else{ + $upah_semasa = $this->kiraupahTawarruqStokAudit($tempoh_gadai,$gadai['tempohbayar'],$gadai['kadarupah'],$gadai['bakipjm']); + Gadai::on($cawangan_mysql['mysql'])->where('norujukan','=',$gadai['norujukan'])->update(array( + 'jbg' => $tempoh_gadai, + 'tempoh' => $tempoh_gadai, + 'tunggakan' => $upah_semasa, + )); + } + }else{ + $upah_semasa = $this->kiraupahTawarruqStokAudit($tempoh_gadai,$gadai['tempohbayar'],$gadai['kadarupah'],$gadai['bakipjm']); + Gadai::on($cawangan_mysql['mysql'])->where('norujukan','=',$gadai['norujukan'])->update(array( + 'jbg' => $tempoh_gadai, + 'tempoh' => $tempoh_gadai, + 'tunggakan' => $upah_semasa, + )); + } + } + return response()->json('successful',200); +} +public function kiraupahTawarruqStokAudit($tempoh,$tempohbayar,$kadarupah,$bakipinjaman){ + $bilang_bln = $tempoh - $tempohbayar; + $upahsemasa_raw = $bilang_bln * (($kadarupah/100 )* $bakipinjaman); + $upah_semasa_round = number_format($upahsemasa_raw,2); + $upah_semasa = substr($upah_semasa_round, 0, -1); + // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa)); + if(strpos($upah_semasa,',')){ + $upah_semasa = str_replace(',','',$upah_semasa); + } + return $upah_semasa; +} +public function kiraupahTawarruqStokAuditUjrahOnePercent($tempoh,$tempohbayar,$kadarupah,$bakipinjaman,$nilaimarhun,$margin_semasa){ + $onepercentservices = new Calculation(); + $upah = $onepercentservices->kiraanKeuntunganRebet($bakipinjaman,$nilaimarhun,$kadarupah,$margin_semasa); + $bilang_bln = $tempoh - $tempohbayar; + $keuntungan_semasa = $bilang_bln * $upah['onepercent']; + $ujrah_semasa = $bilang_bln * $upah['ujrah']; + $pendapatan = $keuntungan_semasa + $ujrah_semasa; + $arraypendapatan = [ + 'keuntungan' => $keuntungan_semasa, + 'ujrah' => $ujrah_semasa, + 'pendapatan' => $pendapatan, + ]; + return $arraypendapatan; +} + } diff --git a/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php b/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php new file mode 100644 index 0000000..3ec05bf --- /dev/null +++ b/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php @@ -0,0 +1,69 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) { + $table->decimal('tunggakanujrah', 9, 2); + $table->decimal('tunggakanonepercent', 9, 2); + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + if (Schema::connection('mysql7')->hasColumn('tunggakanujrah','tunggakanonepercent')){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) { + $table->dropColumn(['tunggakanujrah','tunggakanonepercent']); + }); + } + } + } +} \ No newline at end of file From 3b3009bf685eda1b10eee34ea638e29ad2ab0692 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 11:04:31 +0800 Subject: [PATCH 065/114] Add function to hapus gadai tawarruq --- app/Http/Controllers/GadaiController.php | 40 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 6257226..830a19f 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -2067,6 +2067,9 @@ class GadaiController extends Controller Gadai::on($cawangan['mysql'])->where('norujukan','=',$gadai[0]['historygadaian'])->update(['sttebus' => '']); + + $saved_historygadaian = $gadai[0]['historygadaian']; + Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->delete(); TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$gadai[0]['historygadaian'])->orderBy('id', 'desc')->limit(1)->delete(); @@ -2080,9 +2083,20 @@ class GadaiController extends Controller $gadaiDouble = Gadai::on($cawangan['mysql'])->where([['historygadaian',$gadai[0]['historygadaian']],['norujukan','<>',$gadai[0]['historygadaian']]])->pluck('norujukan'); if($gadaiDouble){ - Gadai::on($cawangan['mysql'])->whereIn('norujukan',$gadaiDouble)->delete(); - Marhun::on($cawangan['mysql'])->whereIn('norujukan',$gadaiDouble)->delete(); - $this->batalKomuditi($gadai[0]['historygadaian'],$cawangan['mysql']); + + $isGadaianTawarruq = $saved_historygadaian !== '0' || $saved_historygadaian !== null || $saved_historygadaian !== ''; + if($isGadaianTawarruq){ + + $this->batalKomuditiTawarruq($norujukan); + Gadai::on($cawangan['mysql'])->where('norujukan', $norujukan)->delete(); + Marhun::on($cawangan['mysql'])->where('norujukan', $norujukan)->delete(); + } else { + + Gadai::on($cawangan['mysql'])->whereIn('norujukan',$gadaiDouble)->delete(); + Marhun::on($cawangan['mysql'])->whereIn('norujukan',$gadaiDouble)->delete(); + $this->batalKomuditi($gadai[0]['historygadaian'],$cawangan['mysql']); + } + } return response('Deleted Successfully', 200); @@ -2128,6 +2142,26 @@ class GadaiController extends Controller } + public function batalKomuditiTawarruq($norujukan){ + + $komuditi_current = KomuditiPurchase::on('mysql7')->orderBy('created_at','desc')->first(); + + $transaksi_asal = KomuditiTransaksi::on('mysql7')->where('norujukan', $norujukan)->sum('unit_komuditi'); + + $current_commodity_purchase = KomuditiPurchase::on('mysql7')->where('id','=',$komuditi_current['id'])->first(); + $unit_current = $current_commodity_purchase->unit_komuditi; + + $update_unit = $unit_current + $transaksi_asal; + + KomuditiPurchase::on('mysql7')->where('id','=',$komuditi_current['id'])->update([ + 'unit_komuditi' => $update_unit + ]); + + KomuditiTransaksi::on('mysql7')->where('norujukan', $norujukan)->delete(); + + return 'success'; + } + public function batalKomuditi($norujukan,$cawangan_mysql){ $gadaiDouble = Gadai::on($cawangan_mysql)->where([['historygadaian',$norujukan],['norujukan','<>',$norujukan]])->pluck('norujukan'); From f6110cfb9b1fe302aac3abb96920c5cd7268d773 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 17:44:15 +0800 Subject: [PATCH 066/114] Add column migration checker --- ...8_115215_add_onepercent_to_gadai_table.php | 35 ++++++++---- ...0612_add_onepercent_to_kadarupah_table.php | 23 ++++++-- ...ercent_to_transaction_keuntungan_table.php | 33 ++++++----- ...1_104203_add_onepercent_to_tebus_table.php | 55 ++++++++++++------- ...1109_add_columns_to_komuditi_transaksi.php | 2 +- 5 files changed, 99 insertions(+), 49 deletions(-) diff --git a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php index f22210a..71d8df9 100644 --- a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php +++ b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php @@ -14,14 +14,14 @@ class AddOnepercentToGadaiTable extends Migration */ /** - * + * * @var object $db_connection */ public function getActiveDB(){ $config_db = array_keys(config("database.connections")); - + $db_connection = array_filter($config_db,function($connection){ try{ if($connection == 'mysql7') @@ -39,17 +39,23 @@ class AddOnepercentToGadaiTable extends Migration public function up() { $db_connection = $this->getActiveDB(); - + foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('gadai', function (Blueprint $table) { - $table->decimal('kadarujrah', 5, 2); + Schema::connection($dbase)->table('gadai', function (Blueprint $table) use($dbase) { + + $isKadarUjrahExist = Schema::connection($dbase)->hasColumn('gadai', 'kadarujrah'); + + if(! $isKadarUjrahExist){ + $table->decimal('kadarujrah', 5, 2); + } + $table->decimal('ujrah', 9, 2); $table->decimal('onepercent', 9, 2); $table->decimal('margin_semasa', 5, 2); $table->tinyInteger('tagbaru')->default(0); }); } - + } /** @@ -62,11 +68,18 @@ class AddOnepercentToGadaiTable extends Migration $db_connection = $this->getActiveDB(); foreach($db_connection as $dbase){ - if (Schema::connection('mysql7')->hasColumn('kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru')){ - Schema::connection($dbase)->table('gadai', function (Blueprint $table) { - $table->dropColumn(['kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru']); - }); - } + $columns = ['kadarujrah', 'ujrah', 'onepercent','margin_semasa','tagbaru']; + + + $columns_exist = array_filter($columns,function($column) use($dbase){ + return Schema::connection($dbase)->hasColumn('gadai', $column); + }); + + Schema::connection($dbase)->table('gadai', function(Blueprint $table) use($columns_exist){ + foreach($columns_exist as $column){ + $table->dropColumn($column); + } + }); } } } diff --git a/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php b/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php index 022542c..0cbc6a5 100644 --- a/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php +++ b/database/migrations/2023_11_08_150612_add_onepercent_to_kadarupah_table.php @@ -14,8 +14,17 @@ class AddOnepercentToKadarupahTable extends Migration public function up() { Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) { - $table->decimal('kadarujrah', 5, 2); - $table->decimal('kadaronepercent', 5, 2); + + $isKadarUjrahExist = Schema::connection('mysql7')->hasColumn('kadarupah', 'kadarujrah'); + $isKadarOnePercentExist = Schema::connection('mysql7')->hasColumn('kadarupah', 'kadaronepercent'); + + if (!$isKadarUjrahExist) { + $table->decimal('kadarujrah', 5, 2); + } + if (!$isKadarOnePercentExist) { + $table->decimal('kadaronepercent', 5, 2); + } + }); } @@ -26,8 +35,14 @@ class AddOnepercentToKadarupahTable extends Migration */ public function down() { - Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) { - $table->dropColumn(['kadarujrah','kadaronepercent']); + $columns = ['kadarujrah', 'kadaronepercent']; + + $columns_exist = array_filter($columns, function ($column) { + return Schema::connection('mysql7')->hasColumn('kadarupah', $column); + }); + + Schema::connection('mysql7')->table('kadarupah', function (Blueprint $table) use($columns_exist) { + $table->dropColumn($columns_exist); }); } diff --git a/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php b/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php index e036226..35a7a0d 100644 --- a/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php +++ b/database/migrations/2023_11_11_101144_add_onepercent_to_transaction_keuntungan_table.php @@ -13,15 +13,16 @@ class AddOnepercentToTransactionKeuntunganTable extends Migration */ public function up() { - Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) { - $table->decimal('ujrah', 5, 2); - $table->decimal('ujrah_rebet', 5, 2); - $table->decimal('onepercent', 5, 2); - $table->decimal('onepercent_rebet', 5, 2); - $table->decimal('tempoh', 5, 2); - $table->decimal('beza_tempoh', 5, 2); - $table->decimal('margin_semasa', 5, 2); - $table->decimal('rounded', 5, 2); + $columns = ['ujrah', 'ujrah_rebet', 'onepercent', 'onepercent_rebet', 'tempoh', 'beza_tempoh', 'margin_semasa']; + + $columns_not_exist = array_filter($columns, function ($column) { + return !Schema::connection('mysql7')->hasColumn('transaksi_keuntungan', $column); + }); + + Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) use ($columns_not_exist) { + array_walk($columns_not_exist, function ($column) use ($table) { + $table->decimal($column, 5, 2); + }); }); } @@ -32,10 +33,14 @@ class AddOnepercentToTransactionKeuntunganTable extends Migration */ public function down() { - if (Schema::connection('mysql7')->hasColumn('ujrah', 'onepercent')){ - Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) { - $table->dropColumn(['ujrah', 'ujrah_rebet', 'onepercent', 'onepercent_rebet', 'tempoh', 'beza_tempoh', 'margin_semasa','rounded']); - }); - } + $columns = ['ujrah', 'ujrah_rebet', 'onepercent', 'onepercent_rebet', 'tempoh', 'beza_tempoh', 'margin_semasa']; + + $columns_exist = array_filter($columns, function ($column) { + return Schema::connection('mysql7')->hasColumn('transaksi_keuntungan', $column); + }); + + Schema::connection('mysql7')->table('transaksi_keuntungan', function (Blueprint $table) use($columns_exist) { + $table->dropColumn($columns_exist); + }); } } diff --git a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php index d09b7ea..7951e38 100644 --- a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php +++ b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php @@ -14,35 +14,47 @@ class AddOnepercentToTebusTable extends Migration */ /** - * + * * @var object $db_connection */ - public function getActiveDB(){ + public function getActiveDB() + { $config_db = array_keys(config("database.connections")); - - $db_connection = array_filter($config_db,function($connection){ - try{ - if($connection == 'mysql7') + + $db_connection = array_filter($config_db, function ($connection) { + try { + if ($connection == 'mysql7') { return false; + } $db = DB::connection($connection)->getPdo(); return true; - } catch(\Exception $e){ + } catch (\Exception $e) { return false; } }); return $db_connection; -} + } public function up() { $db_connection = $this->getActiveDB(); - - foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('tebus', function (Blueprint $table) { - $table->decimal('ujrah', 9, 2); - $table->decimal('onepercent', 9, 2); + + foreach ($db_connection as $dbase) { + + $columns = ['ujrah', 'onepercent']; + + $columns_not_exist = array_filter($columns, function ($column) use ($dbase) { + return !Schema::connection($dbase)->hasColumn('tebus', $column); + }); + + Schema::connection($dbase)->table('tebus', function (Blueprint $table) use ($columns_not_exist) { + + array_walk($columns_not_exist, function ($column) use ($table) { + $table->decimal($column, 9, 2); + }); + }); }; } @@ -56,12 +68,17 @@ class AddOnepercentToTebusTable extends Migration { $db_connection = $this->getActiveDB(); - foreach($db_connection as $dbase){ - if (Schema::connection($dbase)->hasColumn('ujrah', 'onepercent')){ - Schema::connection($dbase)->table('tebus', function (Blueprint $table) { - $table->dropColumn(['ujrah', 'onepercent']); - }); - } + foreach ($db_connection as $dbase) { + + $columns = ['ujrah', 'onepercent']; + + $columns_exist = array_filter($columns, function ($column) use($dbase) { + return Schema::connection($dbase)->hasColumn('tebus', $column); + }); + + Schema::connection($dbase)->table('tebus', function (Blueprint $table) use ($columns_exist) { + $table->dropColumn($columns_exist); + }); } } } diff --git a/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php b/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php index baac714..1c61cb9 100644 --- a/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php +++ b/database/migrations/2023_11_14_121109_add_columns_to_komuditi_transaksi.php @@ -42,7 +42,7 @@ class AddColumnsToKomuditiTransaksi extends Migration { $online_arrahn_connection_array = array_filter(config('database.connections'), function($connection) { - if($connection['database'] === 'online_arrahn2' || $connection['database'] === 'master_krk'){ + if($connection['database'] === 'online_arrahn' || $connection['database'] === 'master_krk'){ return true; } From d82dd37c816112fbbbb9b58e402b9afbb997aef5 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 18:04:18 +0800 Subject: [PATCH 067/114] Add column migration checker contd --- ...8_115215_add_onepercent_to_gadai_table.php | 24 ++++++++++--- ...143916_create_history_onepercent_table.php | 36 ------------------- 2 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 database/migrations/2023_11_08_143916_create_history_onepercent_table.php diff --git a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php index 71d8df9..4202406 100644 --- a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php +++ b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php @@ -44,15 +44,31 @@ class AddOnepercentToGadaiTable extends Migration Schema::connection($dbase)->table('gadai', function (Blueprint $table) use($dbase) { $isKadarUjrahExist = Schema::connection($dbase)->hasColumn('gadai', 'kadarujrah'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('gadai', 'ujrah'); + $isOnePercentExist = Schema::connection($dbase)->hasColumn('gadai', 'onepercent'); + $isMarginSemasaExist = Schema::connection($dbase)->hasColumn('gadai', 'margin_semasa'); + $isTagbaruExist = Schema::connection($dbase)->hasColumn('gadai', 'tagbaru'); if(! $isKadarUjrahExist){ $table->decimal('kadarujrah', 5, 2); } - $table->decimal('ujrah', 9, 2); - $table->decimal('onepercent', 9, 2); - $table->decimal('margin_semasa', 5, 2); - $table->tinyInteger('tagbaru')->default(0); + if(! $isUjrahExist){ + $table->decimal('ujrah', 9, 2); + } + + if(! $isOnePercentExist){ + $table->decimal('onepercent', 9, 2); + } + + if(! $isMarginSemasaExist){ + $table->decimal('margin_semasa', 5, 2); + } + + if(! $isTagbaruExist){ + $table->tinyInteger('tagbaru')->default(0); + } + }); } diff --git a/database/migrations/2023_11_08_143916_create_history_onepercent_table.php b/database/migrations/2023_11_08_143916_create_history_onepercent_table.php deleted file mode 100644 index 9854de5..0000000 --- a/database/migrations/2023_11_08_143916_create_history_onepercent_table.php +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->decimal('tempoh', 10, 2); - $table->decimal('ujrah', 10, 2); - $table->decimal('onepercent', 10, 2); - $table->decimal('margin_semasa', 5, 2); - $table->decimal('bakipinjaman', 10, 2); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('history_onepercent'); - } -} From 7d2c1826450ff8bcc2732f8a40347747d5aabf3e Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 18:20:13 +0800 Subject: [PATCH 068/114] Add column migration checker contd --- ...714_add_column_ujrah_stokauditbackdate.php | 237 ++++++++++++------ 1 file changed, 162 insertions(+), 75 deletions(-) diff --git a/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php b/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php index a925dce..8652964 100644 --- a/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php +++ b/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php @@ -14,22 +14,23 @@ class AddColumnUjrahStokauditbackdate extends Migration */ /** - * + * * @var object $db_connection */ - - public function getActiveDB(){ + public function getActiveDB() + { $config_db = array_keys(config("database.connections")); - - $db_connection = array_filter($config_db,function($connection){ - try{ - if($connection == 'mysql7') + + $db_connection = array_filter($config_db, function ($connection) { + try { + if ($connection == 'mysql7') { return false; + } $db = DB::connection($connection)->getPdo(); return true; - } catch(\Exception $e){ + } catch (\Exception $e) { return false; } }); @@ -39,83 +40,169 @@ class AddColumnUjrahStokauditbackdate extends Migration public function up() { $db_connection = $this->getActiveDB(); - - foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('stokaudit1', function (Blueprint $table){ - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - }); - Schema::connection($dbase)->table('stokaudit2', function (Blueprint $table){ - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - }); + foreach ($db_connection as $dbase) { + Schema::connection($dbase)->table('stokaudit1', function (Blueprint $table) use ($dbase) { - Schema::connection($dbase)->table('stokaudit3', function (Blueprint $table){ - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - }); - - Schema::connection($dbase)->table('stokaudit4', function (Blueprint $table){ - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - }); - - Schema::connection($dbase)->table('stokaudit5', function (Blueprint $table){ - - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - }); - - Schema::connection($dbase)->table('stokaudit6', function (Blueprint $table){ - - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - }); - - Schema::connection($dbase)->table('stokaudit7', function (Blueprint $table){ - - $table->decimal('utgonepercent', 9, 2); - $table->decimal('ujrah', 9, 2); - - }); - - - Schema::connection($dbase)->table('stokaudit8', function (Blueprint $table){ + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit1', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit1', 'ujrah'); + if ($isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { $table->decimal('ujrah', 9, 2); - }); + } + }); - Schema::connection($dbase)->table('stokaudit9', function (Blueprint $table){ + Schema::connection($dbase)->table('stokaudit2', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit2', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit2', 'ujrah'); + if ($isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { $table->decimal('ujrah', 9, 2); - }); + } + }); - Schema::connection($dbase)->table('stokaudit10', function (Blueprint $table){ + Schema::connection($dbase)->table('stokaudit3', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit3', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit3', 'ujrah'); + if ($isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { $table->decimal('ujrah', 9, 2); - }); + } + }); - Schema::connection($dbase)->table('stokaudit11', function (Blueprint $table){ + Schema::connection($dbase)->table('stokaudit4', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit4', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit4', 'ujrah'); + if ($isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { $table->decimal('ujrah', 9, 2); - }); + } + }); - Schema::connection($dbase)->table('stokaudit12', function (Blueprint $table){ + Schema::connection($dbase)->table('stokaudit5', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit5', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit5', 'ujrah'); + if ($isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { $table->decimal('ujrah', 9, 2); - }); + } + }); - }; + Schema::connection($dbase)->table('stokaudit6', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit6', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit6', 'ujrah'); - } + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } - + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + }); + + Schema::connection($dbase)->table('stokaudit7', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit7', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit7', 'ujrah'); + + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + + }); + + Schema::connection($dbase)->table('stokaudit8', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit8', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit8', 'ujrah'); + + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + }); + + Schema::connection($dbase)->table('stokaudit9', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit9', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit9', 'ujrah'); + + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + }); + + Schema::connection($dbase)->table('stokaudit10', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit10', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit10', 'ujrah'); + + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + }); + + Schema::connection($dbase)->table('stokaudit11', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit11', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit11', 'ujrah'); + + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + }); + + Schema::connection($dbase)->table('stokaudit12', function (Blueprint $table) use ($dbase) { + $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit12', 'utgonepercent'); + $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit12', 'ujrah'); + + if ($isUtGonePercentExist) { + $table->decimal('utgonepercent', 9, 2); + } + + if ($isUjrahExist) { + $table->decimal('ujrah', 9, 2); + } + }); + + }; + + } /** * Reverse the migrations. @@ -126,53 +213,53 @@ class AddColumnUjrahStokauditbackdate extends Migration { $db_connection = $this->getActiveDB(); - foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('stokaudit1', function (Blueprint $table) { + foreach ($db_connection as $dbase) { + Schema::connection($dbase)->table('stokaudit1', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit2', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit2', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit3', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit3', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit4', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit4', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit5', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit5', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit6', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit6', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit7', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit7', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit8', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit8', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit9', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit9', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit10', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit10', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit11', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit11', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); - Schema::connection($dbase)->table('stokaudit12', function (Blueprint $table) { + Schema::connection($dbase)->table('stokaudit12', function (Blueprint $table) { $table->dropColumn(['utgonepercent', 'ujrah']); }); } } -} \ No newline at end of file +} From 44b022eb5c1cdc03a00f079bf4ac668d0960a572 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 18:28:53 +0800 Subject: [PATCH 069/114] Add column migration checker contd --- ...714_add_column_ujrah_stokauditbackdate.php | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php b/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php index 8652964..45b6c89 100644 --- a/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php +++ b/database/migrations/2023_12_06_155714_add_column_ujrah_stokauditbackdate.php @@ -47,11 +47,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit1', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit1', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -60,11 +60,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit2', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit2', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -73,11 +73,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit3', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit3', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -86,11 +86,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit4', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit4', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -99,11 +99,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit5', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit5', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -112,11 +112,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit6', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit6', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -125,11 +125,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit7', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit7', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } @@ -139,11 +139,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit8', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit8', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -152,11 +152,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit9', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit9', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -165,11 +165,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit10', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit10', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -178,11 +178,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit11', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit11', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); @@ -191,11 +191,11 @@ class AddColumnUjrahStokauditbackdate extends Migration $isUtGonePercentExist = Schema::connection($dbase)->hasColumn('stokaudit12', 'utgonepercent'); $isUjrahExist = Schema::connection($dbase)->hasColumn('stokaudit12', 'ujrah'); - if ($isUtGonePercentExist) { + if (! $isUtGonePercentExist) { $table->decimal('utgonepercent', 9, 2); } - if ($isUjrahExist) { + if (! $isUjrahExist) { $table->decimal('ujrah', 9, 2); } }); From f3e8b3df777601ee1cd000328ce71ab5a79e2049 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 18:41:09 +0800 Subject: [PATCH 070/114] Add column migration checker contd --- ...12_115215_add_tunggakan_to_gadai_table.php | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php b/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php index 3ec05bf..1600fc9 100644 --- a/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php +++ b/database/migrations/2023_12_12_115215_add_tunggakan_to_gadai_table.php @@ -14,14 +14,14 @@ class AddTunggakanToGadaiTable extends Migration */ /** - * + * * @var object $db_connection */ public function getActiveDB(){ $config_db = array_keys(config("database.connections")); - + $db_connection = array_filter($config_db,function($connection){ try{ if($connection == 'mysql7') @@ -39,14 +39,23 @@ class AddTunggakanToGadaiTable extends Migration public function up() { $db_connection = $this->getActiveDB(); - + foreach($db_connection as $dbase){ - Schema::connection($dbase)->table('gadai', function (Blueprint $table) { - $table->decimal('tunggakanujrah', 9, 2); - $table->decimal('tunggakanonepercent', 9, 2); + Schema::connection($dbase)->table('gadai', function (Blueprint $table) use($dbase) { + + $isTunggakanUjrah = Schema::connection($dbase)->hasColumn('gadai', 'tunggakanujrah'); + $isTunggakkanOnePercent = Schema::connection($dbase)->hasColumn('gadai', 'tunggakanonepercent'); + + if (! $isTunggakanUjrah) { + $table->decimal('tunggakanujrah', 9, 2); + } + + if (! $isTunggakkanOnePercent) { + $table->decimal('tunggakanonepercent', 9, 2); + } }); } - + } /** @@ -66,4 +75,4 @@ class AddTunggakanToGadaiTable extends Migration } } } -} \ No newline at end of file +} From 3194cedb720a57df979d2282f4210fcfbfc91c9e Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 14 Dec 2023 19:57:28 +0800 Subject: [PATCH 071/114] Add command to debug cawangan connections --- .../Commands/CawanganDebugConnections.php | 104 ++++++++++++++++++ app/Console/Kernel.php | 3 +- app/Helper.php | 85 +++++++++++--- 3 files changed, 175 insertions(+), 17 deletions(-) create mode 100644 app/Console/Commands/CawanganDebugConnections.php diff --git a/app/Console/Commands/CawanganDebugConnections.php b/app/Console/Commands/CawanganDebugConnections.php new file mode 100644 index 0000000..ecf0466 --- /dev/null +++ b/app/Console/Commands/CawanganDebugConnections.php @@ -0,0 +1,104 @@ +where('db_name', 'like', 'arrahn_%')->get(['mysql', 'db_name'])->toArray(); + + $all_cawangan_in_config = config('database.connections'); + $all_cawangan_in_config_keys = array_keys($all_cawangan_in_config); + + $all_cawangan_in_config = array_reduce($all_cawangan_in_config_keys, function ($accumulator, $current_key_value) use ($all_cawangan_in_config) { + + $accumulator[] = [ + 'mysql' => $current_key_value, + 'database' => $all_cawangan_in_config[$current_key_value]['database'], + ]; + + return $accumulator; + + }, []); + + $all_cawangan_in_config = array_filter($all_cawangan_in_config, function ($connection) { + + $is_cawangan_databases = strpos($connection['database'], 'arrahn_') === 0; + + if ($is_cawangan_databases) { + return true; + } + + }); + + function filterArraysByDatabaseNames($array1, $array2) + { + $idToNameMap = []; + foreach ($array1 as $item) { + $idToNameMap[$item['mysql']] = $item['db_name']; + } + + $filteredArray2 = array_filter($array2, function ($item) use ($idToNameMap) { + return $idToNameMap[$item['mysql']] !== $item['database']; + }); + + return $filteredArray2; + } + + $filteredConnections = filterArraysByDatabaseNames($all_cawangan, $all_cawangan_in_config); + + // checks if there is connection errors + if (Helper::getInactiveCawanganDbConnection() > 0) { + dump('Inactive cawangan connection detected : '); + dump(Helper::getInactiveCawanganDbConnection()); + } + + // checks if config connection do not exist referring to arrahn_master_db + if (count($all_cawangan) !== count($all_cawangan_in_config)) { + $db_not_config = array_diff(array_column($all_cawangan, 'db_name'), array_column($all_cawangan_in_config, 'database')); + + dump(implode(', ', $db_not_config) . ' not configured in database config'); + } + + // checks if config connection databases are not tally fwith arrahn master db + if (count($filteredConnections) !== 0) { + dump('Database config names are not tally arrahn_master_db : '); + dump($filteredConnections); + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 3fe6529..ad1e238 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -19,6 +19,7 @@ class Kernel extends ConsoleKernel protected $commands = [ Commands\DailyGadai::class, Commands\MigrationOnePercent::class, + Commands\CawanganDebugConnections::class, ]; @@ -31,7 +32,7 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule) { // - + $schedule->command('gadai:daily')->daily()->timezone('Asia/Kuala_Lumpur')->at('00:00'); } } diff --git a/app/Helper.php b/app/Helper.php index d16bea2..9b32708 100644 --- a/app/Helper.php +++ b/app/Helper.php @@ -2,6 +2,7 @@ namespace App; use DateTime; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; class Helper @@ -32,29 +33,81 @@ class Helper public static function getActiveCawanganDbConnection() { + $queryActiveCawanganDbConnection = function () { + $all_active_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) { + try { + DB::connection($connection)->getPdo(); + return true; + } catch (\Throwable $th) { + return false; + } + }); + + $non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb']; + + $all_cawangan_db = array_filter($all_active_db_keys, function ($db_key) use ($non_cawangan_database) { + $isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database); + + if ($isNotCawangan) { + return false; + } - $all_active_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) { - try { - DB::connection($connection)->getPdo(); return true; - } catch (\Throwable $th) { - return false; - } - }); + }); - $non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb']; + return $all_cawangan_db; - $all_cawangan_db = array_filter($all_active_db_keys, function ($db_key) use ($non_cawangan_database) { - $isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database); + }; - if ($isNotCawangan) { - return false; - } + $all_cawangan_db_connection = Cache::store('file')->get('active_cawangan_db_connection'); - return true; - }); + if ($all_cawangan_db_connection === null or count($all_cawangan_db_connection) === 0) { + $all_cawangan_db_connection = $queryActiveCawanganDbConnection(); + Cache::store('file')->put('active_cawangan_db_connection', $all_cawangan_db_connection, 3600); + } - return $all_cawangan_db; + return $all_cawangan_db_connection; + + } + + public static function getInactiveCawanganDbConnection() + { + $queryInactiveCawanganDbConnection = function () { + $all_inactive_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) { + try { + DB::connection($connection)->getPdo(); + return false; + } catch (\Throwable $th) { + return true; + } + }); + + $non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb']; + + $all_cawangan_db = array_filter($all_inactive_db_keys, function ($db_key) use ($non_cawangan_database) { + $isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database); + $isNotCawanganKey = in_array($db_key, $non_cawangan_database); + + if ($isNotCawangan OR $isNotCawanganKey) { + return false; + } + + + return true; + }); + + return $all_cawangan_db; + + }; + + $all_cawangan_db_connection = array_map(function ($db_connection) { + return [ + 'connection' => $db_connection, + 'database' => config('database.connections.' . $db_connection . '.database'), + ]; + }, $queryInactiveCawanganDbConnection()); + + return $all_cawangan_db_connection; } From 6ab25db913175c04534820b9a67e5db1ccabb0a7 Mon Sep 17 00:00:00 2001 From: arrahn pkb Date: Thu, 14 Dec 2023 21:26:22 +0800 Subject: [PATCH 072/114] fix onepercent filename --- app/Support/OnePercent.php | 209 +++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 app/Support/OnePercent.php diff --git a/app/Support/OnePercent.php b/app/Support/OnePercent.php new file mode 100644 index 0000000..83c7014 --- /dev/null +++ b/app/Support/OnePercent.php @@ -0,0 +1,209 @@ +kodcaw = $kodcaw; + $this->cawangan_info = parent::getInfoCawangan($kodcaw); + } + + /* Start Gadaian */ + public function createGadai(HttpRequest $httpRequest){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->create($httpRequest); + + return $response; + } + + public function createMarhunGadai($norujukan,HttpRequest $httpRequest){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->createMarhun($norujukan,$httpRequest); + + return $response; + } + + public function getUpahSebenar($norujukan){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahOnePercent($this->kodcaw,$norujukan); + + return $response; + } + + public function getUpahRebet($kodcaw,$norujukan){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahRebet($this->kodcaw,$norujukan); + + return $response; + } + + public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateAnsuranKaunter($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function updateJBGSemasa(HttpRequest $request){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateJBG($request); + return $response; + } + + public function getKadarUjrah(HttpRequest $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); + $onePercentServices = new Calculation(); + $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); + + return $kadarujrah; + } + + public function getOnePercent(HttpRequest $request){ + $onePercentServices = new Calculation(); + $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); + + return $keuntungan; + } + + /* End Gadaian */ + + /* Start Penebusan */ + + public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahRebetSebenar($this->kodcaw,$norujukan); + + return $response; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahRebetTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhNotTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + function rebet($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebet($this->kodcaw,$norujukan); + + return $response; + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + dd('tes'); + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdate($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdateAutoTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraupahUjrahOnePercent($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraupahUjrahOnePercentRebate($this->kodcaw,$norujukan); + + return $response; + } + + /* End Penebusan */ + + public function test(){ + echo 'onepercent'; + } +} From 32b91e9e61e2563dab4361e182b426c5f94f6e14 Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 17 Dec 2023 11:11:46 +0800 Subject: [PATCH 073/114] fix ujrah --- app/Http/Controllers/TransactionOnlineController.php | 7 ++++++- app/Support/Onepercent.php | 2 +- app/Support/v2/Penebusan.php | 12 +++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index 60224df..7f87d0c 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -360,7 +360,12 @@ class TransactionOnlineController extends Controller if(sizeof($gadai) != 0){ foreach($gadai as $gad) { - $result = (new TebusController)->kiraupahTawarruq($gad['kodcaw'],$gad['norujukan']); + if($gad['tagbaru'] == 1){ + $jenis = 'onepercent'; + }else{ + $jenis = 'asal'; + } + $result = (new TebusController)->kiraupahTawarruq($gad['kodcaw'],$gad['norujukan'],$jenis); $gad['keuntungan'] = $result; array_push($gadai_all,$gad); diff --git a/app/Support/Onepercent.php b/app/Support/Onepercent.php index 83c7014..9709a36 100644 --- a/app/Support/Onepercent.php +++ b/app/Support/Onepercent.php @@ -37,7 +37,7 @@ class OnePercent extends MasterServices public function getUpahSebenar($norujukan){ $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->kiraupahOnePercent($this->kodcaw,$norujukan); + $response = $gadai->kiraupahOnePercent($norujukan); return $response; } diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index 481fa39..802550f 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -149,10 +149,16 @@ class Penebusan $keuntungan_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['onepercent']); $ujrah_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['ujrah']); $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); + $keuntungan_1bln = $onepercentservices->getRoundedMethod((1 * $upah['keuntungan'])+(1 * $upah['ujrah'])); - $array_upah = ['pendapatan' => $upahsemasa_raw, - 'keuntungan' => $keuntungan_semasa, - 'ujrah' => $ujrah_semasa]; + + $array_upah = + [ + 'keuntungan_1bln' => $keuntungan_1bln, + 'pendapatan' => $upahsemasa_raw, + 'keuntungan' => $keuntungan_semasa, + 'ujrah' => $ujrah_semasa + ]; return $array_upah; } From 37ef71975e63ed44a366631962c24f13835a375b Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 17 Dec 2023 11:38:05 +0800 Subject: [PATCH 074/114] fix keuntungan --- app/Support/v2/Penebusan.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index 802550f..ec55f18 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -149,7 +149,7 @@ class Penebusan $keuntungan_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['onepercent']); $ujrah_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['ujrah']); $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); - $keuntungan_1bln = $onepercentservices->getRoundedMethod((1 * $upah['keuntungan'])+(1 * $upah['ujrah'])); + $keuntungan_1bln = $onepercentservices->getRoundedMethod((1 * $upah['onepercent'])+(1 * $upah['ujrah'])); $array_upah = From 8579d5feea5ef8efff818169983926cfefd06147 Mon Sep 17 00:00:00 2001 From: Server Date: Sun, 17 Dec 2023 11:40:57 +0800 Subject: [PATCH 075/114] server staging --- app/Http/Controllers/LelongController.php | 9 +- app/Services/OnePercentServices.php | 2 +- config/database.php | 742 +++++++++--------- ...8_115215_add_onepercent_to_gadai_table.php | 3 +- ...1_104203_add_onepercent_to_tebus_table.php | 12 + env test | 257 ++++++ 6 files changed, 653 insertions(+), 372 deletions(-) create mode 100644 env test diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 4204a37..9fadceb 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -579,10 +579,9 @@ class LelongController extends Controller if($cawangan['tagarrahnbid'] == 1){ // $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ - // $lelong = Http::withOptions(['verify' => true])->get('http://adminbid.arrahn/api/portalApi',[ - // 'norujukan' => $request->norujukan - // ])->json(); - $lelong = null; + $lelong = Http::withOptions(['verify' => true])->get('http://stapibid.arrahn.com.my/api/portalApi',[ + 'norujukan' => $request->norujukan + ])->json(); $lelong = ($lelong != null) ? $lelong['lelong'] : []; if( $lelong == null ) { @@ -699,7 +698,7 @@ class LelongController extends Controller if($cawangan['tagarrahnbid'] == 1) { - $lelong = Http::withOptions(['verify' => true])->get('https://adminbid.arrahn.com.my/api/portalApi',['norujukan' => $request->norujukan])->json(); + $lelong = Http::withOptions(['verify' => true])->get('http://stapibid.arrahn.com.my/api/portalApi',['norujukan' => $request->norujukan])->json(); $lelong = ($lelong != null) ? $lelong['lelong'] : []; }else{ $lelong = Lelong::on($cawangan['mysql'])->where([['norujukan',$request->norujukan]])->first(); diff --git a/app/Services/OnePercentServices.php b/app/Services/OnePercentServices.php index afce9d0..71d39fd 100644 --- a/app/Services/OnePercentServices.php +++ b/app/Services/OnePercentServices.php @@ -74,7 +74,7 @@ class OnePercentServices public function getKadarUjrah(float $nilaimarhun = 0.0, $groupid) : Float{ - $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',$groupid)->get()->toArray(); + $kadarujrah = KadarUpah::on('mysql7')->select('kadarujrah')->where([['min','<=',$nilaimarhun],['max','>=',$nilaimarhun]])->where('group_id',1)->get()->toArray(); return isset($kadarujrah[0]) ? $kadarujrah[0]['kadarujrah'] : 0; } diff --git a/config/database.php b/config/database.php index ece90e4..5895d0a 100644 --- a/config/database.php +++ b/config/database.php @@ -17,30 +17,30 @@ return [ 'prefix' => '', 'strict' => false, ], - 'mysql' => [ + 'mysql37' => [ 'driver' => 'mysql', - 'host' => env('DB_HOST'), - 'port' => env('DB_PORT'), - 'database' => env('DB_DATABASE'), - 'username' => env('DB_USERNAME'), - 'password' => env('DB_PASSWORD'), + 'host' => env('DB_HOST_37'), + 'port' => env('DB_PORT_37'), + 'database' => env('DB_DATABASE_37'), + 'username' => env('DB_USERNAME_37'), + 'password' => env('DB_PASSWORD_37'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, ], - 'mysql2' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_2'), - 'port' => env('DB_PORT_2'), - 'database' => env('DB_DATABASE_2'), - 'username' => env('DB_USERNAME_2'), - 'password' => env('DB_PASSWORD_2'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], + // 'mysql2' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_2'), + // 'port' => env('DB_PORT_2'), + // 'database' => env('DB_DATABASE_2'), + // 'username' => env('DB_USERNAME_2'), + // 'password' => env('DB_PASSWORD_2'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], 'mysql3' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_3'), @@ -53,45 +53,45 @@ return [ 'prefix' => '', 'strict' => false, ], - 'mysql4' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_4'), - 'port' => env('DB_PORT_4'), - 'database' => env('DB_DATABASE_4'), - 'username' => env('DB_USERNAME_4'), - 'password' => env('DB_PASSWORD_4'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql5' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_5'), - 'port' => env('DB_PORT_5'), - 'database' => env('DB_DATABASE_5'), - 'username' => env('DB_USERNAME_5'), - 'password' => env('DB_PASSWORD_5'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // 'mysql4' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_4'), + // 'port' => env('DB_PORT_4'), + // 'database' => env('DB_DATABASE_4'), + // 'username' => env('DB_USERNAME_4'), + // 'password' => env('DB_PASSWORD_4'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql5' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_5'), + // 'port' => env('DB_PORT_5'), + // 'database' => env('DB_DATABASE_5'), + // 'username' => env('DB_USERNAME_5'), + // 'password' => env('DB_PASSWORD_5'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], + // ], - 'mysql6' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_6'), - 'port' => env('DB_PORT_6'), - 'database' => env('DB_DATABASE_6'), - 'username' => env('DB_USERNAME_6'), - 'password' => env('DB_PASSWORD_6'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // 'mysql6' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_6'), + // 'port' => env('DB_PORT_6'), + // 'database' => env('DB_DATABASE_6'), + // 'username' => env('DB_USERNAME_6'), + // 'password' => env('DB_PASSWORD_6'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], + // ], 'mysql7' => [ 'driver' => 'mysql', @@ -105,43 +105,43 @@ return [ 'prefix' => '', 'strict' => false, ], - 'mysql8' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_8'), - 'port' => env('DB_PORT_8'), - 'database' => env('DB_DATABASE_8'), - 'username' => env('DB_USERNAME_8'), - 'password' => env('DB_PASSWORD_8'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // 'mysql8' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_8'), + // 'port' => env('DB_PORT_8'), + // 'database' => env('DB_DATABASE_8'), + // 'username' => env('DB_USERNAME_8'), + // 'password' => env('DB_PASSWORD_8'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], - 'mysql9' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_9'), - 'port' => env('DB_PORT_9'), - 'database' => env('DB_DATABASE_9'), - 'username' => env('DB_USERNAME_9'), - 'password' => env('DB_PASSWORD_9'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql10' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_10'), - 'port' => env('DB_PORT_10'), - 'database' => env('DB_DATABASE_10'), - 'username' => env('DB_USERNAME_10'), - 'password' => env('DB_PASSWORD_10'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], + // ], + // 'mysql9' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_9'), + // 'port' => env('DB_PORT_9'), + // 'database' => env('DB_DATABASE_9'), + // 'username' => env('DB_USERNAME_9'), + // 'password' => env('DB_PASSWORD_9'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql10' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_10'), + // 'port' => env('DB_PORT_10'), + // 'database' => env('DB_DATABASE_10'), + // 'username' => env('DB_USERNAME_10'), + // 'password' => env('DB_PASSWORD_10'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], 'mysql11' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_11'), @@ -155,30 +155,30 @@ return [ 'strict' => false, ], - 'mysql12' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_12'), - 'port' => env('DB_PORT_12'), - 'database' => env('DB_DATABASE_12'), - 'username' => env('DB_USERNAME_12'), - 'password' => env('DB_PASSWORD_12'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql13' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_13'), - 'port' => env('DB_PORT_13'), - 'database' => env('DB_DATABASE_13'), - 'username' => env('DB_USERNAME_13'), - 'password' => env('DB_PASSWORD_13'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], + // 'mysql12' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_12'), + // 'port' => env('DB_PORT_12'), + // 'database' => env('DB_DATABASE_12'), + // 'username' => env('DB_USERNAME_12'), + // 'password' => env('DB_PASSWORD_12'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql13' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_13'), + // 'port' => env('DB_PORT_13'), + // 'database' => env('DB_DATABASE_13'), + // 'username' => env('DB_USERNAME_13'), + // 'password' => env('DB_PASSWORD_13'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], 'mysql14' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_14'), @@ -192,262 +192,274 @@ return [ 'strict' => false, ], - 'mysql15' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_15'), - 'port' => env('DB_PORT_15'), - 'database' => env('DB_DATABASE_15'), - 'username' => env('DB_USERNAME_15'), - 'password' => env('DB_PASSWORD_15'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql16' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_16'), - 'port' => env('DB_PORT_16'), - 'database' => env('DB_DATABASE_16'), - 'username' => env('DB_USERNAME_16'), - 'password' => env('DB_PASSWORD_16'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // 'mysql15' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_15'), + // 'port' => env('DB_PORT_15'), + // 'database' => env('DB_DATABASE_15'), + // 'username' => env('DB_USERNAME_15'), + // 'password' => env('DB_PASSWORD_15'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql16' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_16'), + // 'port' => env('DB_PORT_16'), + // 'database' => env('DB_DATABASE_16'), + // 'username' => env('DB_USERNAME_16'), + // 'password' => env('DB_PASSWORD_16'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], - 'mysql17' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_17'), - 'port' => env('DB_PORT_17'), - 'database' => env('DB_DATABASE_17'), - 'username' => env('DB_USERNAME_17'), - 'password' => env('DB_PASSWORD_17'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql18' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_18'), - 'port' => env('DB_PORT_18'), - 'database' => env('DB_DATABASE_18'), - 'username' => env('DB_USERNAME_18'), - 'password' => env('DB_PASSWORD_18'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql19' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_19'), - 'port' => env('DB_PORT_19'), - 'database' => env('DB_DATABASE_19'), - 'username' => env('DB_USERNAME_19'), - 'password' => env('DB_PASSWORD_19'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql20' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_20'), - 'port' => env('DB_PORT_20'), - 'database' => env('DB_DATABASE_20'), - 'username' => env('DB_USERNAME_20'), - 'password' => env('DB_PASSWORD_20'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql21' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_21'), - 'port' => env('DB_PORT_21'), - 'database' => env('DB_DATABASE_21'), - 'username' => env('DB_USERNAME_21'), - 'password' => env('DB_PASSWORD_21'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // ], + // 'mysql17' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_17'), + // 'port' => env('DB_PORT_17'), + // 'database' => env('DB_DATABASE_17'), + // 'username' => env('DB_USERNAME_17'), + // 'password' => env('DB_PASSWORD_17'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql18' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_18'), + // 'port' => env('DB_PORT_18'), + // 'database' => env('DB_DATABASE_18'), + // 'username' => env('DB_USERNAME_18'), + // 'password' => env('DB_PASSWORD_18'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql19' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_19'), + // 'port' => env('DB_PORT_19'), + // 'database' => env('DB_DATABASE_19'), + // 'username' => env('DB_USERNAME_19'), + // 'password' => env('DB_PASSWORD_19'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql20' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_20'), + // 'port' => env('DB_PORT_20'), + // 'database' => env('DB_DATABASE_20'), + // 'username' => env('DB_USERNAME_20'), + // 'password' => env('DB_PASSWORD_20'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql21' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_21'), + // 'port' => env('DB_PORT_21'), + // 'database' => env('DB_DATABASE_21'), + // 'username' => env('DB_USERNAME_21'), + // 'password' => env('DB_PASSWORD_21'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], - 'mysql22' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_22'), - 'port' => env('DB_PORT_22'), - 'database' => env('DB_DATABASE_22'), - 'username' => env('DB_USERNAME_22'), - 'password' => env('DB_PASSWORD_22'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql23' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_23'), - 'port' => env('DB_PORT_23'), - 'database' => env('DB_DATABASE_23'), - 'username' => env('DB_USERNAME_23'), - 'password' => env('DB_PASSWORD_23'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // ], + // 'mysql22' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_22'), + // 'port' => env('DB_PORT_22'), + // 'database' => env('DB_DATABASE_22'), + // 'username' => env('DB_USERNAME_22'), + // 'password' => env('DB_PASSWORD_22'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql23' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_23'), + // 'port' => env('DB_PORT_23'), + // 'database' => env('DB_DATABASE_23'), + // 'username' => env('DB_USERNAME_23'), + // 'password' => env('DB_PASSWORD_23'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], - 'mysql24' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_24'), - 'port' => env('DB_PORT_24'), - 'database' => env('DB_DATABASE_24'), - 'username' => env('DB_USERNAME_24'), - 'password' => env('DB_PASSWORD_24'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // ], + // 'mysql24' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_24'), + // 'port' => env('DB_PORT_24'), + // 'database' => env('DB_DATABASE_24'), + // 'username' => env('DB_USERNAME_24'), + // 'password' => env('DB_PASSWORD_24'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, - ], - 'mysql25' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_25'), - 'port' => env('DB_PORT_25'), - 'database' => env('DB_DATABASE_25'), - 'username' => env('DB_USERNAME_25'), - 'password' => env('DB_PASSWORD_25'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql26' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_26'), - 'port' => env('DB_PORT_26'), - 'database' => env('DB_DATABASE_26'), - 'username' => env('DB_USERNAME_26'), - 'password' => env('DB_PASSWORD_26'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql27' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_27'), - 'port' => env('DB_PORT_27'), - 'database' => env('DB_DATABASE_27'), - 'username' => env('DB_USERNAME_27'), - 'password' => env('DB_PASSWORD_27'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + // ], + // 'mysql25' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_25'), + // 'port' => env('DB_PORT_25'), + // 'database' => env('DB_DATABASE_25'), + // 'username' => env('DB_USERNAME_25'), + // 'password' => env('DB_PASSWORD_25'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql26' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_26'), + // 'port' => env('DB_PORT_26'), + // 'database' => env('DB_DATABASE_26'), + // 'username' => env('DB_USERNAME_26'), + // 'password' => env('DB_PASSWORD_26'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql27' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_27'), + // 'port' => env('DB_PORT_27'), + // 'database' => env('DB_DATABASE_27'), + // 'username' => env('DB_USERNAME_27'), + // 'password' => env('DB_PASSWORD_27'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql28' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_28'), + // 'port' => env('DB_PORT_28'), + // 'database' => env('DB_DATABASE_28'), + // 'username' => env('DB_USERNAME_28'), + // 'password' => env('DB_PASSWORD_28'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql29' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_29'), + // 'port' => env('DB_PORT_29'), + // 'database' => env('DB_DATABASE_29'), + // 'username' => env('DB_USERNAME_29'), + // 'password' => env('DB_PASSWORD_29'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql30' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_30'), + // 'port' => env('DB_PORT_30'), + // 'database' => env('DB_DATABASE_30'), + // 'username' => env('DB_USERNAME_30'), + // 'password' => env('DB_PASSWORD_30'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql31' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_31'), + // 'port' => env('DB_PORT_31'), + // 'database' => env('DB_DATABASE_31'), + // 'username' => env('DB_USERNAME_31'), + // 'password' => env('DB_PASSWORD_31'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql32' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_32'), + // 'port' => env('DB_PORT_32'), + // 'database' => env('DB_DATABASE_32'), + // 'username' => env('DB_USERNAME_32'), + // 'password' => env('DB_PASSWORD_32'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql33' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_33'), + // 'port' => env('DB_PORT_33'), + // 'database' => env('DB_DATABASE_33'), + // 'username' => env('DB_USERNAME_33'), + // 'password' => env('DB_PASSWORD_33'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql34' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_34'), + // 'port' => env('DB_PORT_34'), + // 'database' => env('DB_DATABASE_34'), + // 'username' => env('DB_USERNAME_34'), + // 'password' => env('DB_PASSWORD_34'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + // 'mysql35' => [ + // 'driver' => 'mysql', + // 'host' => env('DB_HOST_35'), + // 'port' => env('DB_PORT_35'), + // 'database' => env('DB_DATABASE_35'), + // 'username' => env('DB_USERNAME_35'), + // 'password' => env('DB_PASSWORD_35'), + // 'charset' => 'utf8', + // 'collation' => 'utf8_unicode_ci', + // 'prefix' => '', + // 'strict' => false, + // ], + 'mysql36' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_36'), + 'port' => env('DB_PORT_36'), + 'database' => env('DB_DATABASE_36'), + 'username' => env('DB_USERNAME_36'), + 'password' => env('DB_PASSWORD_36'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, ], - 'mysql28' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_28'), - 'port' => env('DB_PORT_28'), - 'database' => env('DB_DATABASE_28'), - 'username' => env('DB_USERNAME_28'), - 'password' => env('DB_PASSWORD_28'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql29' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_29'), - 'port' => env('DB_PORT_29'), - 'database' => env('DB_DATABASE_29'), - 'username' => env('DB_USERNAME_29'), - 'password' => env('DB_PASSWORD_29'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql30' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_30'), - 'port' => env('DB_PORT_30'), - 'database' => env('DB_DATABASE_30'), - 'username' => env('DB_USERNAME_30'), - 'password' => env('DB_PASSWORD_30'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql31' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_31'), - 'port' => env('DB_PORT_31'), - 'database' => env('DB_DATABASE_31'), - 'username' => env('DB_USERNAME_31'), - 'password' => env('DB_PASSWORD_31'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql32' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_32'), - 'port' => env('DB_PORT_32'), - 'database' => env('DB_DATABASE_32'), - 'username' => env('DB_USERNAME_32'), - 'password' => env('DB_PASSWORD_32'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql33' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_33'), - 'port' => env('DB_PORT_33'), - 'database' => env('DB_DATABASE_33'), - 'username' => env('DB_USERNAME_33'), - 'password' => env('DB_PASSWORD_33'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql34' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_34'), - 'port' => env('DB_PORT_34'), - 'database' => env('DB_DATABASE_34'), - 'username' => env('DB_USERNAME_34'), - 'password' => env('DB_PASSWORD_34'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], - 'mysql35' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_35'), - 'port' => env('DB_PORT_35'), - 'database' => env('DB_DATABASE_35'), - 'username' => env('DB_USERNAME_35'), - 'password' => env('DB_PASSWORD_35'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, - ], ], ]; diff --git a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php index 4202406..5fdda49 100644 --- a/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php +++ b/database/migrations/2023_11_08_115215_add_onepercent_to_gadai_table.php @@ -24,12 +24,13 @@ class AddOnepercentToGadaiTable extends Migration $db_connection = array_filter($config_db,function($connection){ try{ - if($connection == 'mysql7') + if($connection == 'mysql7' || $connection == 'lelong') return false; $db = DB::connection($connection)->getPdo(); return true; } catch(\Exception $e){ + Log::info($connection); return false; } }); diff --git a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php index 7951e38..025dabc 100644 --- a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php +++ b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php @@ -21,16 +21,28 @@ class AddOnepercentToTebusTable extends Migration public function getActiveDB() { $config_db = array_keys(config("database.connections")); +<<<<<<< Updated upstream $db_connection = array_filter($config_db, function ($connection) { try { if ($connection == 'mysql7') { +======= + + $db_connection = array_filter($config_db,function($connection){ + try{ + if($connection == 'mysql7' || $connection == 'lelong') +>>>>>>> Stashed changes return false; } $db = DB::connection($connection)->getPdo(); return true; +<<<<<<< Updated upstream } catch (\Exception $e) { +======= + } catch(\Exception $e){ + Log::info($connection); +>>>>>>> Stashed changes return false; } }); diff --git a/env test b/env test new file mode 100644 index 0000000..0f7e749 --- /dev/null +++ b/env test @@ -0,0 +1,257 @@ + APP_NAME=Lumen +APP_ENV=local +APP_KEY=WbPGkYNmXZ6ZQplGlvl0iZ7zyW1b09xa +APP_DEBUG=true +APP_URL=http://api-arrahn.test +APP_TIMEZONE=Asia/Kuala_Lumpur + +LOG_CHANNEL=stack +LOG_SLACK_WEBHOOK_URL= + +DB_CONNECTION_36=mysql +DB_HOST_36=127.0.0.1 +DB_PORT_36=3306 +DB_DATABASE_36=arrahn_kb2 +DB_USERNAME_36=root +DB_PASSWORD_36= + +DB_CONNECTION_2=mysql +DB_HOST_2=127.0.0.1 +DB_PORT_2=3306 +DB_DATABASE_2=arrahn_wcy +DB_USERNAME_2=root +DB_PASSWORD_2= + +DB_CONNECTION_3=mysql +DB_HOST_3=127.0.0.1 +DB_PORT_3=3306 +DB_DATABASE_3=arrahn_1stop +DB_USERNAME_3=root +DB_PASSWORD_3= + +DB_CONNECTION_4=mysql +DB_HOST_4=127.0.0.1 +DB_PORT_4=3306 +DB_DATABASE_4=arrahn_jlwt +DB_USERNAME_4=root +DB_PASSWORD_4= + +DB_CONNECTION_5=mysql +DB_HOST_5=127.0.0.1 +DB_PORT_5=3306 +DB_DATABASE_5=arrahn_wb +DB_USERNAME_5=root +DB_PASSWORD_5= + +DB_CONNECTION_6=mysql +DB_HOST_6=127.0.0.1 +DB_PORT_6=3306 +DB_DATABASE_6=arrahn_kls +DB_USERNAME_6=root +DB_PASSWORD_6= + +DB_CONNECTION_7=mysql +DB_HOST_7=127.0.0.1 +DB_PORT_7=3306 +DB_DATABASE_7=online_arrahn +DB_USERNAME_7=root +DB_PASSWORD_7= + +DB_CONNECTION_8=mysql +DB_HOST_8=127.0.0.1 +DB_PORT_8=3306 +DB_DATABASE_8=arrahn_pp +DB_USERNAME_8=root +DB_PASSWORD_8= + +DB_CONNECTION_9=mysql +DB_HOST_9=127.0.0.1 +DB_PORT_9=3306 +DB_DATABASE_9=arrahn_mace +DB_USERNAME_9=root +DB_PASSWORD_9= + +DB_CONNECTION_10=mysql +DB_HOST_10=127.0.0.1 +DB_PORT_10=3306 +DB_DATABASE_10=arrahn_pm $ +DB_USERNAME_10=root +DB_PASSWORD_10= + +DB_CONNECTION_11=mysql +DB_HOST_11=127.0.0.1 +DB_PORT_11=3306 +DB_DATABASE_11=arrahn_gm +DB_USERNAME_11=root +DB_PASSWORD_11= + +DB_CONNECTION_12=mysql +DB_HOST_12=127.0.0.1 +DB_PORT_12=3306 +DB_DATABASE_12=arrahn_gcl +DB_USERNAME_12=root +DB_PASSWORD_12= + +DB_CONNECTION_13=mysql +DB_HOST_13=127.0.0.1 +DB_PORT_13=3306 +DB_DATABASE_13=arrahn_jli +DB_USERNAME_13=root +DB_PASSWORD_13= + +DB_CONNECTION_14=mysql +DB_HOST_14=127.0.0.1 +DB_PORT_14=3306 +DB_DATABASE_14=arrahn_rp +DB_USERNAME_14=root +DB_PASSWORD_14= + +DB_CONNECTION_15=mysql +DB_HOST_15=127.0.0.1 +DB_PORT_15=3306 +DB_DATABASE_15=arrahn_ktn +DB_USERNAME_15=root +DB_PASSWORD_15= + +DB_CONNECTION_16=mysql +DB_HOST_16=127.0.0.1 +DB_PORT_16=3306 +DB_DATABASE_16=arrahn_pg +DB_USERNAME_16=root +DB_PASSWORD_16= + +DB_CONNECTION_17=mysql +DB_HOST_17=127.0.0.1 +DB_PORT_17=3306 +DB_DATABASE_17=arrahn_skudai +DB_USERNAME_17=root +DB_PASSWORD_17= + +DB_CONNECTION_18=mysql +DB_HOST_18=127.0.0.1 +DB_PORT_18=3306 +DB_DATABASE_18=arrahn_pttn +DB_USERNAME_18=root +DB_PASSWORD_18= + +DB_CONNECTION_19=mysql +DB_HOST_19=127.0.0.1 +DB_PORT_19=3306 +DB_DATABASE_19=arrahn_btg +DB_USERNAME_19=root +DB_PASSWORD_19= + +DB_CONNECTION_20=mysql +DB_HOST_20=127.0.0.1 +DB_PORT_20=3306 +DB_DATABASE_20=arrahn_raub +DB_USERNAME_20=root +DB_PASSWORD_20= + +DB_CONNECTION_21=mysql +DB_HOST_21=127.0.0.1 +DB_PORT_21=3306 +DB_DATABASE_21=arrahn_kgr +DB_USERNAME_21=root +DB_PASSWORD_21= + +DB_CONNECTION_22=mysql +DB_HOST_22=127.0.0.1 +DB_PORT_22=3306 +DB_DATABASE_22=arrahn_sdk +DB_USERNAME_22=root +DB_PASSWORD_22= + +DB_CONNECTION_23=mysql +DB_HOST_23=127.0.0.1 +DB_PORT_23=3306 +DB_DATABASE_23=arrahn_sp +DB_USERNAME_23=root +DB_PASSWORD_23= + +DB_CONNECTION_24=mysql +DB_HOST_24=127.0.0.1 +DB_PORT_24=3306 +DB_DATABASE_24=arrahn_twu +DB_USERNAME_24=root +DB_PASSWORD_24= + +DB_CONNECTION_25=mysql +DB_HOST_25=127.0.0.1 +DB_PORT_25=3306 +DB_DATABASE_25=arrahn_api2 +DB_USERNAME_25=root +DB_PASSWORD_25= + +DB_CONNECTION_26=mysql +DB_HOST_26=127.0.0.1 +DB_PORT_26=3306 +DB_DATABASE_26=arrahn_kjg +DB_USERNAME_26=root +DB_PASSWORD_26= + +DB_CONNECTION_27=mysql +DB_HOST_27=127.0.0.1 +DB_PORT_27=3306 +DB_DATABASE_27=arrahn_rl +DB_USERNAME_27=root +DB_PASSWORD_27= + +DB_CONNECTION_28=mysql +DB_HOST_28=127.0.0.1 +DB_PORT_28=3306 +DB_DATABASE_28=arrahn_bfort +DB_USERNAME_28=root +DB_PASSWORD_28= + +DB_CONNECTION_29=mysql +DB_HOST_29=127.0.0.1 +DB_PORT_29=3306 +DB_DATABASE_29=arrahn_kbelud +DB_USERNAME_29=root +DB_PASSWORD_29= + +DB_CONNECTION_30=mysql +DB_HOST_30=127.0.0.1 +DB_PORT_30=3306 +DB_DATABASE_30=arrahn_tuaran +DB_USERNAME_30=root +DB_PASSWORD_30= + +DB_CONNECTION_31=mysql +DB_HOST_31=127.0.0.1 +DB_PORT_31=3306 +DB_DATABASE_31=arrahn_kngau +DB_USERNAME_31=root +DB_PASSWORD_31= + +DB_CONNECTION_32=mysql +DB_HOST_32=127.0.0.1 +DB_PORT_32=3306 +DB_DATABASE_32=arrahn_tm +DB_USERNAME_32=root +DB_PASSWORD_32= + +DB_CONNECTION_33=mysql +DB_HOST_33=127.0.0.1 +DB_PORT_33=3306 +DB_DATABASE_33=arrahn_tmlh +DB_USERNAME_33=root +DB_PASSWORD_33= + +DB_CONNECTION_34=mysql +DB_HOST_34=127.0.0.1 +DB_PORT_34=3306 +DB_DATABASE_34=arrahn_semporna +DB_USERNAME_34=root +DB_PASSWORD_34= + +DB_CONNECTION_35=mysql +DB_HOST_35=127.0.0.1 +DB_PORT_35=3306 +DB_DATABASE_35=arrahn_kb1 +DB_USERNAME_35=root +DB_PASSWORD_35= + +CACHE_DRIVER=file +QUEUE_CONNECTION=sync From 041480c4ea854241dacd89feea6591e2b694ab7e Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 17 Dec 2023 11:56:57 +0800 Subject: [PATCH 076/114] fix ambigous jenistebus and batalGadai wrong filename --- app/Http/Controllers/GadaiController.php | 4 ++-- app/Http/Controllers/LaporanController.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 830a19f..2d1584c 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -8,7 +8,7 @@ use App\Cawangan; use App\Transaction; use App\TransaksiKeuntungan; use App\TransactionOnline; -use App\batalGadai; +use App\BatalGadai; use App\TuntutBaki; use App\AnsRugi; use App\Lelong; @@ -579,7 +579,7 @@ class GadaiController extends Controller public function getLaporanBatalGadai($kodcaw,$tarikh){ $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); - $gadai = batalGadai::on($cawangan['mysql']) + $gadai = BatalGadai::on($cawangan['mysql']) ->where('tarikh','=',$tarikh) ->orderBy('tarikh','desc') ->get(); diff --git a/app/Http/Controllers/LaporanController.php b/app/Http/Controllers/LaporanController.php index 6da65f0..8f11948 100644 --- a/app/Http/Controllers/LaporanController.php +++ b/app/Http/Controllers/LaporanController.php @@ -785,7 +785,7 @@ class LaporanController extends Controller $tebus = Tebus::on($cawangan['mysql']) ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') - ->where([['t_tebus','>=',$request->mula],['t_tebus','<=',$request->akhir],['jenistebus','=','T']]); + ->where([['t_tebus','>=',$request->mula],['t_tebus','<=',$request->akhir],['tebus.jenistebus','=','T']]); $ansuran = Transaction::on('mysql7')->whereDate('created_at','>=',$request->mula)->whereDate('created_at','<=',$request->akhir)->where([['trans_type','=','A'],['kodcaw','=',$request->kodcaw]]); $bayaranonlinequery = Transaction::on('mysql7')->whereDate('created_at','>=',$request->mula)->whereDate('created_at','<=',$request->akhir)->where('teller','=','Online')->where('kodcaw',$request->kodcaw); From d89974037654641b86757e467b612d5a0b045032 Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 17 Dec 2023 12:11:46 +0800 Subject: [PATCH 077/114] fix update online --- app/Http/Controllers/TransactionOnlineController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index 7f87d0c..e4c8a89 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -189,7 +189,7 @@ class TransactionOnlineController extends Controller try { - DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { + DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { $transaction = Transaction::on('mysql7')->create([ 'trans_type' => 'A', From d9efa847cfc73e372d1a1b31eea0f464f64a259d Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 17 Dec 2023 12:18:47 +0800 Subject: [PATCH 078/114] fix bayaran: --- app/Http/Controllers/TransactionOnlineController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index e4c8a89..7a4ac56 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -189,7 +189,7 @@ class TransactionOnlineController extends Controller try { - DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { + DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa,$bayaran) { $transaction = Transaction::on('mysql7')->create([ 'trans_type' => 'A', From 06d24e3e5762f0040ef8d37b24e324554dc4ecb3 Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 17 Dec 2023 12:43:38 +0800 Subject: [PATCH 079/114] fix bayaran --- app/Http/Controllers/TransactionOnlineController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index 7a4ac56..851aaa8 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -9,6 +9,7 @@ use App\TransaksiKeuntungan; use App\Gadai; use App\Cawangan; use App\GlDetail; +use App\Audit; use Illuminate\Http\Request; use Carbon\Carbon; use App\Services\OnePercentServices; From 0a4bb2f02474133683e5cf93f4ce5262305d7917 Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Sun, 17 Dec 2023 13:12:56 +0800 Subject: [PATCH 080/114] fix bayaran --- app/Http/Controllers/TransactionOnlineController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index 851aaa8..ce85014 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -175,6 +175,14 @@ class TransactionOnlineController extends Controller $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); + $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); + $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['margin_semasa']); + + if($gadai['tagbaru'] == 1){ + $upahsemasa = $keuntungan; + } + + $baki_hargajualan = $gadai['bakihargajualan'] - $bayaran; $baki_bayaran = $bayaran - $upahsemasa; From 029863a84550aa22332f03807faefebbf36cc902 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 18 Dec 2023 17:05:01 +0800 Subject: [PATCH 081/114] tambah function call center --- app/CawanganNotis.php | 27 ++ app/Http/Controllers/CallCenterController.php | 245 ++++++++++++++++++ app/Notis.php | 27 ++ app/NotisPeringatan.php | 39 +++ .../2023_12_17_153031_create_notis_table.php | 73 ++++++ routes/web.php | 12 + 6 files changed, 423 insertions(+) create mode 100644 app/CawanganNotis.php create mode 100644 app/Http/Controllers/CallCenterController.php create mode 100644 app/Notis.php create mode 100644 app/NotisPeringatan.php create mode 100644 database/migrations/2023_12_17_153031_create_notis_table.php diff --git a/app/CawanganNotis.php b/app/CawanganNotis.php new file mode 100644 index 0000000..2fd67ca --- /dev/null +++ b/app/CawanganNotis.php @@ -0,0 +1,27 @@ +json(Cawangan::on('mysql7')->orderBy('details_caw','ASC')->get()); + } + public function datagadai($kodcaw,Request $request) + { + // dd($request->all(), $kodcaw); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + $datagadai = Gadai::on($cawangan['mysql']) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) + ->orderBy('t_gadai', 'ASC') + ->orderBy('sirig', 'ASC'); + // ->get(); + // dd($datagadai); + $arraynorujukan = $datagadai->pluck('norujukan')->toArray(); + $rekodgadai = $datagadai->get(); + + $totalrekod = $datagadai->count('norujukan'); + $totalberat = $datagadai->sum('berat'); + $totalnilaimarhun = $datagadai->sum('nilaimarhun'); + $totalpinjaman = $datagadai->sum('pinjaman'); + $totalbakipjm = $datagadai->sum('bakipjm'); + $totaltunggakan = $datagadai->sum('tunggakan'); + + $arrayrekod = ['rekod' => $rekodgadai, 'totalsag' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpembiayaan'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan]; + // dd($arrayrekod); + return response()->json($arrayrekod,200); + } + + public function insertdatagadai($kodcaw,Request $request) + { + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $notisid = $request->notisid; + $currentDate = Carbon::now(); + // $currentDate = $currentDate->toDateString(); + $tarikh_notis = $currentDate->toDateString(); + $sag_cawangans = []; + $bil_surat = 0; + // dd($kodcaw); + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + // $notis = Notis::create([ + // 'tarikh_notis' => $tarikh_notis, + // 'daritempoh' => $daritempoh, + // 'hinggatempoh' => $hinggatempoh, + // 'sts_notis' => 1, + // 'peringatan' => 1 + // ]); + + $datagadai = Gadai::on($cawangan['mysql']) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) + ->orderBy('t_gadai', 'ASC') + ->orderBy('sirig', 'ASC'); + // ->get(); + + + array_push($sag_cawangans,['data'=>$datagadai->get()]); + // dd($sag_cawangans); + + foreach($sag_cawangans as $index=>$cawnotis){ + + $caw_notis = new CawanganNotis; + $caw_notis->notis_id = $notisid; + $caw_notis->kodcaw = $kodcaw; + $caw_notis->peringatan = 1; + $caw_notis->daritempoh = $daritempoh; + $caw_notis->hinggatempoh = $hinggatempoh; + $caw_notis->status = 1; + $caw_notis->save(); + + + $suratcaw = $cawnotis['data']; + + $notis_peringatan_arr = []; + $now = Carbon::now(); + foreach($suratcaw as $surat) + { + $notis_to_be_inserted = new NotisPeringatan(); + $notis_to_be_inserted->notis_id = $notisid; + $notis_to_be_inserted->tarikh_notis = $tarikh_notis; + $notis_to_be_inserted->kodcaw = $kodcaw; + $notis_to_be_inserted->norujukan = $surat->norujukan; + $notis_to_be_inserted->nokp = $surat->nokp; + $notis_to_be_inserted->jbg = $surat->tempoh; + $notis_to_be_inserted->kadarupah = $surat->kadarupah; + $notis_to_be_inserted->nilaimarhun = $surat->nilaimarhun; + $notis_to_be_inserted->pinjaman = $surat->bakipjm; + $notis_to_be_inserted->bakiupah = $surat->bakiupah; + $notis_to_be_inserted->berat = $surat->berat; + $notis_to_be_inserted->marhun = $surat->marhun; + $notis_to_be_inserted->percent = $surat->percentpinj; + $notis_to_be_inserted->peringatan = '1'; + $notis_peringatan_arr[] = $notis_to_be_inserted->attributesToArray(); + } + + $notis_peringatan_collection = collect($notis_peringatan_arr); + + NotisPeringatan::insert($notis_peringatan_arr); + } + return response()->json("success"); + } + + public function getbatchnotis(Request $request) + { + + $currentDate = Carbon::now(); + $tarikh_notis = $currentDate->toDateString(); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + + $notis = Notis::create([ + 'tarikh_notis' => $tarikh_notis, + 'daritempoh' => $daritempoh, + 'hinggatempoh' => $hinggatempoh, + 'sts_notis' => 1, + 'peringatan' => 1 + ]); + + $batchnotis = Notis::on('mysql7')->orderBy('id','desc')->first()->id; + + return response()->json($batchnotis); + + } + + public function senarainotisperingatan() + { + $current = Carbon::now(); + $current = new Carbon(); + + $arraybatch = []; + $batchnotis = Notis::on('mysql7')->get(); + // $cawangan_all = Cawangan::on('mysql7')->get(); + // $cawnotis_all = []; + // foreach ($batchnotis as $index => $cawangan){ + // $notis = CawanganNotis::on('mysql7')->get(); + // if(sizeof($notis) != 0){ + // array_push($cawnotis_all,$notis); + // } + // } + return response()->json($batchnotis); + } + + public function getcawnotis($notisid) + { + $current = Carbon::now(); + $current = new Carbon(); + + $arraybatch = []; + $batchnotis = Notis::on('mysql7')->where('id',$notisid)->get(); + $cawangan_all = Cawangan::on('mysql7')->get(); + $cawnotis_all = []; + foreach ($batchnotis as $index => $cawangan){ + $notis = CawanganNotis::on('mysql7') + ->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw') + ->where('notis_id',$notisid)->get(); + if(sizeof($notis) != 0){ + array_push($cawnotis_all,$notis); + } + } + return response()->json($cawnotis_all); + } + + public function getcawnotisbycaw(Request $request) + { + $current = Carbon::now(); + $current = new Carbon(); + + $kodcaw = $request->kodcaw; + $notisid = $request->notisid; + + $arraybatch = []; + $batchnotis = CawanganNotis::on('mysql7')->where('id',$notisid)->where('kodcaw',$kodcaw)->get(); + $cawnotis_all = []; + foreach ($batchnotis as $index => $cawangan){ + $notis = NotisPeringatan::on('mysql7') + ->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'notisperingatan.kodcaw') + ->join('cawangan_notis', 'cawangan_notis.kodcaw', '=', 'notisperingatan.kodcaw') + ->where('cawangan_notis.notis_id',$notisid)->where('cawangan_notis.kodcaw',$kodcaw)->get(); + + $totalsag = $notis->count('norujukan'); + // dd($totalsag); + if(sizeof($notis) != 0){ + array_push($cawnotis_all,$notis); + } + } + // dd($cawnotis_all); + + $arrayrekod = ['rekod' => $cawnotis_all,'totalsag' =>$totalsag]; + return response()->json($arrayrekod); + } + + +} diff --git a/app/Notis.php b/app/Notis.php new file mode 100644 index 0000000..45c85e8 --- /dev/null +++ b/app/Notis.php @@ -0,0 +1,27 @@ +bigIncrements('id'); + $table->string('tarikh_notis')->nullable(); + $table->string('daritempoh')->nullable(); + $table->string('hinggatempoh')->nullable(); + $table->integer('sts_notis')->nullable(); + $table->integer('peringatan')->nullable(); + $table->timestamps(); + }); + + Schema::create('notisperingatan', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->unsignedBigInteger('notis_id')->unsigned(); + $table->string('tarikh_notis'); + $table->string('kodcaw'); + $table->string('norujukan'); + $table->string('nokp'); + $table->decimal('jbg', $precision = 7, $scale = 2); + $table->decimal('kadarupah', $precision = 5, $scale = 2)->nullable(); + $table->decimal('nilaimarhun', $precision = 9, $scale = 2); + $table->decimal('pinjaman', $precision = 9, $scale = 2)->nullable(); + $table->decimal('bakiupah', $precision = 7, $scale = 2); + $table->decimal('berat', $precision = 7, $scale = 2); + $table->string('marhun'); + $table->decimal('percent', $precision = 7, $scale = 2); + $table->integer('peringatan')->default(0); + $table->date('tarikhnotis1')->nullable(); + $table->date('tarikhnotis2')->nullable(); + $table->timestamps(); + + }); + + + Schema::create('cawangan_notis', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->unsignedBigInteger('notis_id')->unsigned(); + $table->unsignedBigInteger('kodcaw')->unsigned(); + $table->integer('peringatan')->default(0); + $table->string('daritempoh')->nullable(); + $table->string('hinggatempoh')->nullable(); + $table->integer('status')->nullable(); + $table->timestamps(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('notis'); + Schema::dropIfExists('notisperingatan'); + Schema::dropIfExists('cawangan_notis'); + } +} diff --git a/routes/web.php b/routes/web.php index 3ce9bd5..81a80ef 100644 --- a/routes/web.php +++ b/routes/web.php @@ -828,3 +828,15 @@ $router->group(['prefix'=>'kelantanpay'], function () use ($router){ $router->get('gadai/customer',['uses'=>'KelantanPayController@index']); $router->post('payment/gadai',['uses'=>'KelantanPayController@postPayment']); }); + +$router->group(['prefix'=>'arcc'], function () use ($router){ + //ARCC API + $router->get('datagadai/aktif/{kodcaw}',['uses'=>'CallCenterController@datagadai']); + $router->get('cawangan',['uses'=>'CallCenterController@showAllCawangans']); + $router->post('insertdatagadai/aktif/{kodcaw}',['uses'=>'CallCenterController@insertdatagadai']); + $router->get('getbatchnotis',['uses'=>'CallCenterController@getbatchnotis']); + $router->get('senarainotisperingatan',['uses'=>'CallCenterController@senarainotisperingatan']); + $router->get('getcawnotis/{notisid}',['uses'=>'CallCenterController@getcawnotis']); + $router->get('getcawnotisbycaw',['uses'=>'CallCenterController@getcawnotisbycaw']); + +}); From 5df809d6e797ff0553c874328ed54cb7cdbe9c7a Mon Sep 17 00:00:00 2001 From: Amirah Date: Tue, 19 Dec 2023 15:22:45 +0800 Subject: [PATCH 082/114] update api laporan admin --- app/Http/Controllers/GadaiController.php | 6 +++++- app/Http/Controllers/TebusController.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 2d1584c..b53b472 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -1044,6 +1044,8 @@ class GadaiController extends Controller $keuntunganonline = $ansuransonline->sum('trans.bayaran_keuntungan'); $pendahuluanonline = $ansuransonline->sum('trans.bayaran_pembiayaan'); $bilanganonline = $ansuransonline->count(); + $ujrahonline = $ansuransonline->sum('trans.ujrah'); + $onepercentonline = $ansuransonline->sum('trans.onepercent'); $arrayansuran = [ 'totalpendahuluankaunter' => $pendahuluankaunter, @@ -1054,7 +1056,9 @@ class GadaiController extends Controller 'totalpendahuluanonline' => $pendahuluanonline, 'totalkeuntunganonline' => $keuntunganonline, - 'bilanganonline' => $bilanganonline + 'bilanganonline' => $bilanganonline, + 'totalujrahonline' => $ujrahonline, + 'totalonepercentonline' => $onepercentonline ]; return response()->json($arrayansuran,200); diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 5d17ab3..3eca0fc 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -184,7 +184,7 @@ class TebusController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $tebus_data = Tebus::on($cawangan['mysql']) - ->select('tebus.t_tebus', 'gad.t_gadai','gad.hargajualan','gad.bakihargajualan','gad.bakipjm as gadaibakipjm','tebus.nilaimarhun','tebus.tagterima', 'tebus.teller','tebus.jenistebus','tebus.pinjaman','tebus.bakiupah','tebus.bakipjm','gad.norujukan','gad.nokp','tebus.jbg') + ->select('tebus.t_tebus', 'gad.t_gadai','gad.hargajualan','gad.bakihargajualan','gad.bakipjm as gadaibakipjm','tebus.nilaimarhun','tebus.tagterima', 'tebus.teller','tebus.jenistebus','tebus.pinjaman','tebus.bakiupah','tebus.bakipjm','gad.norujukan','gad.nokp','tebus.jbg','tebus.ujrah','tebus.onepercent','gad.tagbaru') ->join('gadai as gad','gad.norujukan','=','tebus.norujukan') // ->join('online_arrahn.customer as cust', function($join) // { From b8ff35e80403e74d53763e33d3cdade291c8eef7 Mon Sep 17 00:00:00 2001 From: Afiq Zakwan Date: Wed, 20 Dec 2023 08:04:51 +0800 Subject: [PATCH 083/114] portal --- app/Http/Controllers/MarhunController.php | 16 ++++++++++ .../TransactionOnlineController.php | 22 +++++++------ app/Services/MasterServices.php | 11 +++++-- app/TransactionOnline.php | 2 +- ...ran_column_in_transaction_online_table.php | 32 +++++++++++++++++++ routes/web.php | 1 + 6 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 database/migrations/2023_12_20_055044_add_jenisbayaran_column_in_transaction_online_table.php diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 3d1fa5d..c091440 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -213,4 +213,20 @@ class MarhunController extends Controller return response()->json($marhun); } + + public function getNilaiMarhunLatest(Request $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); + + $marhuns = Marhun::on($cawangan['mysql'])->where('norujukan',$request->norujukan)->get(); + + $totalnilaimarhun = 0; + + foreach($marhuns as $index=>$marhun){ + $harga = HargaEmas::on('mysql7')->where('karat',$marhun->karat)->first(); + $nilai_marhun = $marhun->berat * $harga->harga; + $totalnilaimarhun = $totalnilaimarhun + $nilai_marhun; + } + + return response()->json($totalnilaimarhun); + } } diff --git a/app/Http/Controllers/TransactionOnlineController.php b/app/Http/Controllers/TransactionOnlineController.php index ce85014..19c0bfe 100644 --- a/app/Http/Controllers/TransactionOnlineController.php +++ b/app/Http/Controllers/TransactionOnlineController.php @@ -53,7 +53,8 @@ class TransactionOnlineController extends Controller 'tarikh' => $current->toDateString(), 'masa' => $current->toTimeString(), 'customer_name' => $request->customer_name, - 'tempohbayar'=>$sag['tempoh'] + 'tempohbayar'=>$sag['tempoh'], + 'jenisbayaran' => $request->jenisbayaran ? $request->jenisbayaran : 'A' ]); return response()->json($transaction,201); @@ -77,12 +78,14 @@ class TransactionOnlineController extends Controller ->where('kodcaw','=',$transaction['kodcaw']) ->first(); $gadai_data = Gadai::on($cawangan['mysql'])->where([['norujukan',$transaction['norujukan']],['nokp',$transaction['nokp']]])->first(); - - if($gadai_data['hargajualan'] > 0){ - $this->updateGadaiMarhunKaunter($transaction['kodcaw'],$transaction['norujukan'],$transaction['total_payment'],$transaction['paid_at'],$transaction['tempohbayar']); - }else{ - $this->createAdvansur($transaction['kodcaw'],$transaction['norujukan'],$transaction['total_payment'],$transaction['paid_at']); + if($transaction->jenisbayaran == 'A'){ + if($gadai_data['hargajualan'] > 0){ + $this->updateGadaiMarhunKaunter($transaction['kodcaw'],$transaction['norujukan'],$transaction['total_payment'],$transaction['paid_at'],$transaction['tempohbayar']); + }else{ + $this->createAdvansur($transaction['kodcaw'],$transaction['norujukan'],$transaction['total_payment'],$transaction['paid_at']); + } } + GlDetail::on($cawangan['mysql'])->create([ 'kodcaw' => $transaction['kodcaw'], @@ -174,15 +177,14 @@ class TransactionOnlineController extends Controller $onepercent = new OnePercentServices(); $old_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); - + $margin_semasa = ($gadai['bakipjm'] / $gadai['nilaimarhun']) * 100; $keuntungan = $onepercent->kiraanKeuntunganSebenar($gadai['bakipjm'],$gadai['nilaimarhun'],$gadai['kadarupah'],$margin_semasa); $ujrahasal = $onepercent->kiraanUjrahSebenar($gadai['nilaimarhun'],$gadai['kadarupah'],$gadai['margin_semasa']); if($gadai['tagbaru'] == 1){ - $upahsemasa = $keuntungan; + $upah_semasa = $keuntungan; } - $baki_hargajualan = $gadai['bakihargajualan'] - $bayaran; $baki_bayaran = $bayaran - $upahsemasa; @@ -318,7 +320,7 @@ class TransactionOnlineController extends Controller $current = Carbon::now(); $current = new Carbon(); - $boolmasa = false; + $boolmasa = false; $transaction_online = TransactionOnline::on('mysql7')->where([['norujukan',$request->norujukan],['status','PAID'],['update_status',0],['tarikh',$current->toDateString()]])->first(); $transaction_masa = TransactionOnline::on('mysql7')->where([['norujukan',$request->norujukan],['status','NOT PAID'],['tarikh',$current->toDateString()]]) diff --git a/app/Services/MasterServices.php b/app/Services/MasterServices.php index 91603e8..808a36a 100644 --- a/app/Services/MasterServices.php +++ b/app/Services/MasterServices.php @@ -50,8 +50,15 @@ class MasterServices return $response; } - public function kiraUpahTawarruq($kodcaw,$norujukan){ - $response = $this->engine->getUpahSebenar($norujukan); + public function kiraUpahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + if($jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->getUpahSebenar($norujukan); + + }else{ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->getUpahSebenar($norujukan); + } return $response; } diff --git a/app/TransactionOnline.php b/app/TransactionOnline.php index 2479f12..22831c6 100644 --- a/app/TransactionOnline.php +++ b/app/TransactionOnline.php @@ -15,7 +15,7 @@ class TransactionOnline extends Model * @var array */ protected $fillable = [ - 'nokp','reference_no','nosiri','total_payment','tarikh','masa','status','billplz_id','kodcaw','norujukan','paid_at','customer_name','update_status','update_serahan','tempohbayar','tagportal' + 'nokp','reference_no','nosiri','total_payment','tarikh','masa','status','billplz_id','kodcaw','norujukan','paid_at','customer_name','update_status','update_serahan','tempohbayar','tagportal','jenisbayaran' ]; /** diff --git a/database/migrations/2023_12_20_055044_add_jenisbayaran_column_in_transaction_online_table.php b/database/migrations/2023_12_20_055044_add_jenisbayaran_column_in_transaction_online_table.php new file mode 100644 index 0000000..00d7304 --- /dev/null +++ b/database/migrations/2023_12_20_055044_add_jenisbayaran_column_in_transaction_online_table.php @@ -0,0 +1,32 @@ +table('transaction_online', function (Blueprint $table) { + $table->string('jenisbayaran')->default('A'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql7')->table('transaction_online', function (Blueprint $table) { + $table->dropColumn(['jenisbayaran']); + }); + } +} diff --git a/routes/web.php b/routes/web.php index 81a80ef..c449fee 100644 --- a/routes/web.php +++ b/routes/web.php @@ -162,6 +162,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('marhun/laporan/{kodcaw}/{tarikh}',['uses'=>'MarhunController@getLaporanMarhunHarian']); $router->get('marhunterkumpul/laporan/{kodcaw}/{tarikh}',['uses'=>'MarhunController@getLaporanMarhunTerkumpul']); $router->get('marhun/mutu/sag',['uses'=>'MarhunController@getMutuMarhun']); + $router->get('marhun/nilai/terkini',['uses'=>'MarhunController@getNilaiMarhunLatest']); $router->get('jemas',['uses'=>'MarhunController@getAllJemas']); From 515dfcb630de8fb297b00228aae80e676897a25f Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Fri, 22 Dec 2023 15:11:05 +0800 Subject: [PATCH 084/114] fix bug rounded first then multiply month --- app/Support/v2/Penebusan.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index ec55f18..bf7eac9 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -184,10 +184,19 @@ class Penebusan $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - $upahrebet_raw = $onepercentservices->getRoundedMethod($upahrebet_raw); + $upahrebet_raw = $onepercentservices->getRoundedMethod($bilang_bln * $upah['keuntungan']); + $upahujrah_raw = $onepercentservices->getRoundedMethod($bilang_bln * $upah['ujrah']); + $upahonepercent_raw = $onepercentservices->getRoundedMethod($bilang_bln * $upah['onepercent']); - return $upahrebet_raw; + $array_upah = + [ + 'pendapatan' => $upahrebet_raw, + 'keuntungan' => $upahonepercent_raw, + 'ujrah' => $upahujrah_raw + ]; + + + return $array_upah; } public function kiraupahTawarruq($norujukan){ @@ -734,10 +743,11 @@ class Penebusan $bilang_bln = $tempoh - $gadai_data['tempohbayar']; $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - $ujrah = $bilang_bln * $array_upah['ujrah']; - $onepercent = $bilang_bln * $array_upah['onepercent']; - $onepercent_semasa = $onepercentservices->getRoundedMethod($onepercent); - $ujrah_semasa = $onepercentservices->getRoundedMethod($ujrah); + $onepercent = $onepercentservices->getRoundedMethod($array_upah['ujrah']); + $ujrah = $onepercentservices->getRoundedMethod($array_upah['onepercent']); + $onepercent_semasa = $bilang_bln * $onepercent; + $ujrah_semasa = $bilang_bln * $ujrah; + return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; } @@ -759,8 +769,10 @@ class Penebusan $bilang_bln = $tempoh - $gadai_data['tempohbayar']; $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $ujrah = $onepercentservices->getRoundedMethod($bilang_bln * $array_upah['ujrah']); - $onepercent = $onepercentservices->getRoundedMethod($bilang_bln * $array_upah['onepercent']); + $ujrah_rounded = $onepercentservices->getRoundedMethod($array_upah['ujrah']); + $keuntungan_rounded = $onepercentservices->getRoundedMethod($array_upah['onepercent']); + $ujrah = $bilang_bln * $ujrah_rounded; + $onepercent = $bilang_bln * $keuntungan_rounded; return ['ujrah' => $ujrah, 'onepercent' => $onepercent]; } From f6cd13864afdb96bf91a68a79ce29a2228b8f9ab Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Sat, 23 Dec 2023 19:53:37 +0800 Subject: [PATCH 085/114] update lelong kiraupahUjrahOnePercentRebate --- app/Http/Controllers/LelongController.php | 52 +++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 9fadceb..bb0e543 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -30,6 +30,8 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use App\Services\RingkasanHarianServices; use App\Services\OnePercentServices; +use App\Services\MasterServices; +use App\Support\v2\Calculation; use Log; use DB; @@ -1115,6 +1117,9 @@ class LelongController extends Controller $lelong_to_be_inserted->berat = $index['berat']; $lelong_to_be_inserted->marhun = $index['marhun']; $lelong_to_be_inserted->fasa = $index['fasa']; + $lelong_to_be_inserted->tagujarah = $index['tagujarah']; + $lelong_to_be_inserted->ujrah = $index['ujrah']; + $lelong_to_be_inserted->onepercent = $index['onepercent']; $lelong_arr[] = $lelong_to_be_inserted->attributesToArray(); } @@ -1634,39 +1639,40 @@ class LelongController extends Controller return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; } - public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ - $onepercentservices = new OnePercentServices(); + // public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + // // $onepercentservices = new OnePercentServices(); + // $onepercentservices = new Calculation(); - $cawangan = Cawangan::on('mysql7') - ->where('kodcaw','=',$kodcaw) - ->first(); + // $cawangan = Cawangan::on('mysql7') + // ->where('kodcaw','=',$kodcaw) + // ->first(); - $gadai_data = Gadai::on($cawangan['mysql']) - ->where('norujukan','=',$norujukan) - ->first(); + // $gadai_data = Gadai::on($cawangan['mysql']) + // ->where('norujukan','=',$norujukan) + // ->first(); - if($gadai_data['tempoh'] >= 12.0){ - $tempoh = 12; - }else{ - $tempoh = $gadai_data['tempoh']; - } + // if($gadai_data['tempoh'] >= 12.0){ + // $tempoh = 12; + // }else{ + // $tempoh = $gadai_data['tempoh']; + // } - $bilang_bln = $tempoh - $gadai_data['tempohbayar']; - $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $ujrah = $bilang_bln * $array_upah['ujrah']; - $onepercent = $bilang_bln * $array_upah['onepercent']; + // $bilang_bln = $tempoh - $gadai_data['tempohbayar']; + // $array_upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); + // $ujrah_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $array_upah['ujrah']); + // $onepercent_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $array_upah['onepercent']); - // $rounded_ujrah = round(($ujrah*100)/5,0)*5/100; - $ujrah_semasa = $ujrah; + // return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + // } - // $rounded_onepercent = round(($onepercent*100)/5,0)*5/100; - $onepercent_semasa = $onepercent; + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $master = new MasterServices($kodcaw); + $response = $master->kiraupahUjrahOnePercentRebate($kodcaw,$norujukan); - return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; + return $response; } - From 501b9267875db2d0f63b1fd3682f93aebb1ce825 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 25 Dec 2023 09:47:54 +0800 Subject: [PATCH 086/114] update lelong export lelong ujrah --- app/Http/Controllers/LelongController.php | 7 ++++--- app/Lelong.php | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index bb0e543..2b77203 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -580,8 +580,8 @@ class LelongController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); if($cawangan['tagarrahnbid'] == 1){ - // $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ - $lelong = Http::withOptions(['verify' => true])->get('http://stapibid.arrahn.com.my/api/portalApi',[ + $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ + // $lelong = Http::withOptions(['verify' => true])->get('http://api_arrahn.test/api/portalApi',[ 'norujukan' => $request->norujukan ])->json(); $lelong = ($lelong != null) ? $lelong['lelong'] : []; @@ -628,6 +628,7 @@ class LelongController extends Controller if ($cawangan['tagarrahnbid'] == 0){ $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ + // $lelong = Http::withOptions(['verify' => true])->get('https://api_arrahn.test/api/portalApi',[ 'norujukan' => $request->norujukan ])->json(); $lelong = ($lelong != null) ? $lelong['lelong'] : []; @@ -1117,9 +1118,9 @@ class LelongController extends Controller $lelong_to_be_inserted->berat = $index['berat']; $lelong_to_be_inserted->marhun = $index['marhun']; $lelong_to_be_inserted->fasa = $index['fasa']; - $lelong_to_be_inserted->tagujarah = $index['tagujarah']; $lelong_to_be_inserted->ujrah = $index['ujrah']; $lelong_to_be_inserted->onepercent = $index['onepercent']; + $lelong_to_be_inserted->tagujrah = $index['tagujrah']; $lelong_arr[] = $lelong_to_be_inserted->attributesToArray(); } diff --git a/app/Lelong.php b/app/Lelong.php index a7a21a3..a186ef1 100644 --- a/app/Lelong.php +++ b/app/Lelong.php @@ -98,8 +98,11 @@ class Lelong extends Model 'tagpmt', 'hargaasasasal', 'beratasal', - ' loopsemak', - 'tagcall' + 'loopsemak', + 'tagcall', + 'ujrah', + 'onepercent', + 'tagujrah' ]; /** From 8f57d0c4adbe17447c8b228d8c8546034aeefa8a Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 25 Dec 2023 09:57:27 +0800 Subject: [PATCH 087/114] update api checkTagLelong ke staging --- app/Http/Controllers/LelongController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 2b77203..d303591 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -627,7 +627,8 @@ class LelongController extends Controller $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $request->kodcaw)->first(); if ($cawangan['tagarrahnbid'] == 0){ - $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ + // $lelong = Http::withOptions(['verify' => true])->get('https://niklah.arrahn.com.my/api/portalApi',[ + $lelong = Http::withOptions(['verify' => true])->get('https://stapi.arrahn.com.my/api/portalApi',[ // $lelong = Http::withOptions(['verify' => true])->get('https://api_arrahn.test/api/portalApi',[ 'norujukan' => $request->norujukan ])->json(); From 0011b12e4db9b196a49ab9478119383f1ec28177 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Mon, 25 Dec 2023 15:50:41 +0800 Subject: [PATCH 088/114] tambah function notis peringatan dalam arcc dan blast wasap dan sms --- app/CawanganNotis.php | 2 +- app/Http/Controllers/CallCenterController.php | 171 +++++++++++++++--- app/Jobs/ARCCSMSPelangganSAGLAMAbysag.php | 102 +++++++++++ .../ARCCWhatsappPelangganSAGLAMAbysag.php | 101 +++++++++++ app/Notis.php | 2 +- app/NotisPeringatan.php | 2 +- ..._141108_add_onepercent_to_lelong_table.php | 79 ++++++++ ..._24_120200_add_tagnotis_to_gadai_table.php | 69 +++++++ ...0256_add_nama_to_table_log_blast_wasap.php | 32 ++++ ...140355_add_nama_to_table_log_blast_sms.php | 34 ++++ routes/web.php | 2 + 11 files changed, 571 insertions(+), 25 deletions(-) create mode 100644 app/Jobs/ARCCSMSPelangganSAGLAMAbysag.php create mode 100644 app/Jobs/ARCCWhatsappPelangganSAGLAMAbysag.php create mode 100644 database/migrations/2023_12_19_141108_add_onepercent_to_lelong_table.php create mode 100644 database/migrations/2023_12_24_120200_add_tagnotis_to_gadai_table.php create mode 100644 database/migrations/2023_12_24_170256_add_nama_to_table_log_blast_wasap.php create mode 100644 database/migrations/2023_12_25_140355_add_nama_to_table_log_blast_sms.php diff --git a/app/CawanganNotis.php b/app/CawanganNotis.php index 2fd67ca..388ad53 100644 --- a/app/CawanganNotis.php +++ b/app/CawanganNotis.php @@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model; class CawanganNotis extends Model { protected $table = 'cawangan_notis'; - public $timestamps = false; + public $timestamps = true; protected $primaryKey = 'id'; /** * The attributes that are mass assignable. diff --git a/app/Http/Controllers/CallCenterController.php b/app/Http/Controllers/CallCenterController.php index 46c600e..3f29f6f 100644 --- a/app/Http/Controllers/CallCenterController.php +++ b/app/Http/Controllers/CallCenterController.php @@ -36,8 +36,8 @@ use App\Jobs\SMSPelangganSAGLAMA; use Illuminate\Http\Request; use App\CawanganDetail; use App\BlastSMS; -use App\Jobs\WhatsappPelangganSAGLAMAbysag; -use App\Jobs\SMSPelangganSAGLAMAbysag; +use App\Jobs\ARCCWhatsappPelangganSAGLAMAbysag; +use App\Jobs\ARCCSMSPelangganSAGLAMAbysag; use App\Services\OnePercentServices; @@ -47,9 +47,22 @@ use Carbon\Carbon; class CallCenterController extends Controller { - public function showAllCawangans() + public function showAllCawangans(Request $request) { - return response()->json(Cawangan::on('mysql7')->orderBy('details_caw','ASC')->get()); + $daritempoh = $request->daritempoh; + $hinggatempoh = $request->hinggatempoh; + $checkcawangannotis = Cawangan::on('mysql7') + // ->whereNotExists(function($query) use($daritempoh,$hinggatempoh) + // { + // $query->select(DB::raw(1)) + // ->from('cawangan_notis') + // ->whereRaw('cawangan_notis.kodcaw = arrahn_master_db.kodcaw') + // ->where('daritempoh','=',$daritempoh) + // ->where('hinggatempoh','=',$hinggatempoh); + // } ) + ->orderBy('details_caw','ASC')->get(); + // dd($checkcawangannotis); + return response()->json($checkcawangannotis); } public function datagadai($kodcaw,Request $request) { @@ -58,7 +71,7 @@ class CallCenterController extends Controller $hinggatempoh = $request->hinggatempoh; $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $datagadai = Gadai::on($cawangan['mysql']) - ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0],['tagnotis','=',0]]) ->orderBy('t_gadai', 'ASC') ->orderBy('sirig', 'ASC'); // ->get(); @@ -100,7 +113,7 @@ class CallCenterController extends Controller // ]); $datagadai = Gadai::on($cawangan['mysql']) - ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0]]) + ->where([['tagpalsu','=',0],['tempoh','>=',$daritempoh],['tempoh','<=',$hinggatempoh],['sttebus','=',''],['taglel','=',0],['tagnotis','=',0]]) ->orderBy('t_gadai', 'ASC') ->orderBy('sirig', 'ASC'); // ->get(); @@ -143,6 +156,11 @@ class CallCenterController extends Controller $notis_to_be_inserted->percent = $surat->percentpinj; $notis_to_be_inserted->peringatan = '1'; $notis_peringatan_arr[] = $notis_to_be_inserted->attributesToArray(); + + //updatetagnotisdlmgadai + $updateTagNotis = Gadai::on($cawangan['mysql'])->where('norujukan',$surat->norujukan)->update([ + 'tagnotis'=> 1 + ]); } $notis_peringatan_collection = collect($notis_peringatan_arr); @@ -214,31 +232,140 @@ class CallCenterController extends Controller public function getcawnotisbycaw(Request $request) { + $notisid = $request->notisid; $current = Carbon::now(); $current = new Carbon(); + $arraybatch = []; + $batchnotis = Notis::on('mysql7')->where('id',$notisid)->get(); + $cawangan_all = Cawangan::on('mysql7')->get(); + $cawnotis_all = []; + + $notis = CawanganNotis::on('mysql7') + ->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'cawangan_notis.kodcaw') + ->where('notis_id',$notisid)->get(); + + foreach ($notis as $index => $cawangan){ + // dd($cawangan['kodcaw']); + // dd($cawangan); + $notisbycaw = NotisPeringatan::on('mysql7') + ->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$cawangan['kodcaw']) + ->distinct() + ->get(); + // dd($notisbycaw); + + $totalsag = $notisbycaw->count('norujukan'); + $totalbakipjm = $notisbycaw->sum('pinjaman'); + + // if(sizeof($notis) != 0){ + array_push($cawnotis_all,['namacaw' => $notis, 'detailbycaw' => $notisbycaw,'totalsag' =>$totalsag,'totalbakipjm' =>$totalbakipjm]); + // } + } + return response()->json($cawnotis_all); + } + + public function bycawnotisperingatan($kodcaw,$notisid) + { + $cawnotis_all = []; + + $notisbycaw = NotisPeringatan::on('mysql7') + ->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw) + ->distinct() + ->get(); + + $notisbycawarray = $notisbycaw->toArray(); + + foreach($notisbycawarray as $index=>$cal){ + $customer = Customer::where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + + $notisbycawarray[$index]['namacust'] = $customer; + } + + array_push($notisbycawarray); + return response()->json($notisbycawarray); + } + + public function blastwasapbysag(Request $request) + { + // dd($request->all()); + $current = Carbon::now(); + $current = new Carbon(); $kodcaw = $request->kodcaw; $notisid = $request->notisid; - $arraybatch = []; - $batchnotis = CawanganNotis::on('mysql7')->where('id',$notisid)->where('kodcaw',$kodcaw)->get(); - $cawnotis_all = []; - foreach ($batchnotis as $index => $cawangan){ - $notis = NotisPeringatan::on('mysql7') - ->join('arrahn_master_db', 'arrahn_master_db.kodcaw', '=', 'notisperingatan.kodcaw') - ->join('cawangan_notis', 'cawangan_notis.kodcaw', '=', 'notisperingatan.kodcaw') - ->where('cawangan_notis.notis_id',$notisid)->where('cawangan_notis.kodcaw',$kodcaw)->get(); + $namapengguna = $request->namapengguna; + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first(); + $cawangan_detail = CawanganDetail::on($cawangan['mysql'])->first(); + $caw_name = $cawangan->details_caw; + $nofoncaw = $cawangan_detail->notel; - $totalsag = $notis->count('norujukan'); - // dd($totalsag); - if(sizeof($notis) != 0){ - array_push($cawnotis_all,$notis); + $statusblast = CawanganNotis::where('notis_id','=',$notisid) + ->where('kodcaw','=',$kodcaw) + ->first(); + if($statusblast->status == '1'){ + + $notisbycaw = NotisPeringatan::on('mysql7') + ->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw) + ->distinct() + ->get(); + + $arraynorujukan = $notisbycaw->pluck('norujukan')->toArray(); + + $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) + ->get(); + $gadai_all_groupby_nokp = $notisbycaw->groupBy('nokp'); + + foreach($gadainokp as $index1=>$cal){ + if($gadai_all_groupby_nokp[$cal->nokp]){ + $gadainokp[$index1]['gadai'] = $gadai_all_groupby_nokp[$cal->nokp]; + } + $customer = Customer::on('mysql7')->where('kpbaru','=',$cal['nokp']) + ->orWhere('kplama','=',$cal['nokp']) + ->first(); + $nokp=$cal['nokp']; + // dd($customer); + if($customer->telefon != 'null'){ + $telefon=$customer->telefon; + //log auditrail + $audit = new Audit(); + $audit->users = $namapengguna; + $audit->actions = 'ARCC Blast Whatsapp & SMS: Notis ID'.$notisid; + $audit->norujukan = $cal->norujukan; + $audit->new_data = $customer->telefon; + $audit->old_data = $nokp; + $audit->kodcaw = $kodcaw; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + $today = $current->toDateString(); + $harini = date('Y-m-d',strtotime($today)); + + //update tarikh dlm table notisperingatan + $updatenotis=NotisPeringatan::on('mysql7') + ->where('norujukan','=', $cal->norujukan) + ->update( + array('tarikhnotis1'=> $harini)); + + dispatch(new ARCCWhatsappPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq,$namapengguna)); + dispatch(new ARCCSMSPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq,$namapengguna)); + } + } + + $updatestatusnotis=CawanganNotis::on('mysql7') + ->where('notis_id','=', $notisid) + ->where('kodcaw','=', $kodcaw) + ->update( + array('status'=> 2)); + + return response()->json('success'); + } + else{ + return response()->json('failed'); } - } - // dd($cawnotis_all); - $arrayrekod = ['rekod' => $cawnotis_all,'totalsag' =>$totalsag]; - return response()->json($arrayrekod); } diff --git a/app/Jobs/ARCCSMSPelangganSAGLAMAbysag.php b/app/Jobs/ARCCSMSPelangganSAGLAMAbysag.php new file mode 100644 index 0000000..e3270da --- /dev/null +++ b/app/Jobs/ARCCSMSPelangganSAGLAMAbysag.php @@ -0,0 +1,102 @@ +nokp = $nokp; + $this->telefon = $telefon; + $this->caw_name = $caw_name; + $this->nofoncaw = $nofoncaw; + $this->kodcaw = $kodcaw; + $this->norujukan = $norujukan; + $this->tempoh = $tempoh; + $this->tmatang = $tmatang; + $this->tmatang1 = $tmatang1; + $this->lelong_tawarruq = $lelong_tawarruq; + $this->namapengguna = $namapengguna; + + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $current = Carbon::now(); + $current = new Carbon(); + $mobile_no = ltrim($this->telefon, '+6'); + // $mobile_no = '60178916936'; + // $message = 'test'; + $tarikhmatang = $this->tmatang; + $tarikhmatangnew = date('d-m-Y',strtotime($tarikhmatang)); + $tarikhmatang1 = $this->tmatang1; + $tarikhmatang1new = date('d-m-Y',strtotime($tarikhmatang1)); + $today = $current->toDateString(); + // $current_date = new Carbon($current->toDateString()); + if($this->lelong_tawarruq == '1'){ + if($tarikhmatang > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatangnew.'.'; + }elseif($tarikhmatang < $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatangnew.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + }else + if($tarikhmatang1 > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum '.$tarikhmatang1new.'.'; + }elseif($tarikhmatang1 <= $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, '.$this->norujukan.' telah tamat tempoh pada '.$tarikhmatang1new.', Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + + if(env('APP_ENV') != 'production'){ + $mobile_no = env('ADMIN_PHONE_NUMBER'); + } + $response = Http::get(env('ONEWAYSMS_API'), [ + 'apiusername' => env('ONEWAYSMS_AUTH_USER'), + 'apipassword' => env('ONEWAYSMS_AUTH_PASS'), + 'senderid' => 'INFO', + 'mobileno' => $mobile_no, + 'message' => $message, + 'languagetype' => 1 + ]); + + //insert log blast sms + $logblastsms = new BlastSMS(); + $logblastsms->kodcaw = $this->kodcaw; + $logblastsms->nokp = $this->nokp; + $logblastsms->notelefon = $this->telefon; + $logblastsms->norujukan = $this->norujukan; + $logblastsms->tempoh = $this->tempoh; + $logblastsms->status = $response; + $logblastsms->created_at = $current; + $logblastsms->updated_at = $current; + $logblastsms->nama = $this->namapengguna; + $logblastsms->save(); + + Log::info("ARCC SMS - Pelanggan ".$this->caw_name." SAG Tawarruq -".$mobile_no); + + } +} diff --git a/app/Jobs/ARCCWhatsappPelangganSAGLAMAbysag.php b/app/Jobs/ARCCWhatsappPelangganSAGLAMAbysag.php new file mode 100644 index 0000000..e4e7668 --- /dev/null +++ b/app/Jobs/ARCCWhatsappPelangganSAGLAMAbysag.php @@ -0,0 +1,101 @@ +nokp = $nokp; + $this->telefon = $telefon; + $this->caw_name = $caw_name; + $this->nofoncaw = $nofoncaw; + $this->kodcaw = $kodcaw; + $this->norujukan = $norujukan; + $this->tempoh = $tempoh; + $this->tmatang = $tmatang; + $this->tmatang1 = $tmatang1; + $this->lelong_tawarruq = $lelong_tawarruq; + $this->namapengguna = $namapengguna; + + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $current = Carbon::now(); + $current = new Carbon(); + $mobile_no = ltrim($this->telefon, '+6'); + // $mobile_no = '60178916936'; + $tarikhmatang = $this->tmatang; + $tarikhmatangnew = date('d-m-Y',strtotime($tarikhmatang)); + $tarikhmatang1 = $this->tmatang1; + $tarikhmatang1new = date('d-m-Y',strtotime($tarikhmatang1)); + $today = $current->toDateString(); + if($this->lelong_tawarruq == '1'){ + if($tarikhmatang > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatangnew.'*.'; + }elseif($tarikhmatang <= $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatangnew.'*, Sila perbaharui SAG anda di cawangan AR-RAHN.';} + }else + if($tarikhmatang1 > $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah hampir tamat tempoh untuk tukar ke SAG baru, Sila perbaharui SAG anda di cawangan sebelum *'.$tarikhmatang1new.'*.'; + }elseif($tarikhmatang1 <= $today){ + $message = 'AR-RAHN '.$this->caw_name.': MAKLUMAN, *'.$this->norujukan.'* telah tamat tempoh pada *'.$tarikhmatang1new.'*, Sila perbaharui SAG anda di cawangan Ar-Rahn.';} + + if(env('APP_ENV') != 'production'){ + $mobile_no = env('ADMIN_PHONE_NUMBER'); + } + $response = Http::get(env('WABOT_API'), [ + 'number' => $mobile_no, + 'type' => 'text', + 'message' => $message, + 'instance_id' => env('WABOT_INSTANCES_ID'), + 'access_token' => env('WABOT_TOKEN_KEYS') + ]); + + + + //insert log blast wasap + $logblastwasap = new BlastWasap(); + $logblastwasap->kodcaw = $this->kodcaw; + $logblastwasap->nokp = $this->nokp; + $logblastwasap->notelefon = $this->telefon; + $logblastwasap->norujukan = $this->norujukan; + $logblastwasap->tempoh = $this->tempoh; + $logblastwasap->status = $response; + $logblastwasap->nama = $this->namapengguna; + $logblastwasap->save(); + + Log::info("ARCC WABOT - Pelanggan SAG Tawarruq".$response); + + } +} diff --git a/app/Notis.php b/app/Notis.php index 45c85e8..703a8ff 100644 --- a/app/Notis.php +++ b/app/Notis.php @@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model; class Notis extends Model { protected $table = 'notis'; - public $timestamps = false; + public $timestamps = true; protected $primaryKey = 'id'; /** * The attributes that are mass assignable. diff --git a/app/NotisPeringatan.php b/app/NotisPeringatan.php index 25df947..4173469 100644 --- a/app/NotisPeringatan.php +++ b/app/NotisPeringatan.php @@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model; class NotisPeringatan extends Model { protected $table = 'notisperingatan'; - public $timestamps = false; + public $timestamps = true; protected $primaryKey = 'id'; /** * The attributes that are mass assignable. diff --git a/database/migrations/2023_12_19_141108_add_onepercent_to_lelong_table.php b/database/migrations/2023_12_19_141108_add_onepercent_to_lelong_table.php new file mode 100644 index 0000000..3fb6b8f --- /dev/null +++ b/database/migrations/2023_12_19_141108_add_onepercent_to_lelong_table.php @@ -0,0 +1,79 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('lelong', function (Blueprint $table) use($dbase) { + + $isUjrahExist = Schema::connection($dbase)->hasColumn('lelong', 'ujrah'); + $isOnePercentExist = Schema::connection($dbase)->hasColumn('lelong', 'onepercent'); + $isTagbaruExist = Schema::connection($dbase)->hasColumn('lelong', 'tagujrah'); + + + if(! $isUjrahExist){ + $table->decimal('ujrah', 9, 2); + } + + if(! $isOnePercentExist){ + $table->decimal('onepercent', 9, 2); + } + + if(! $isTagbaruExist){ + $table->tinyInteger('tagujrah')->default(0); + } + + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + $columns = ['ujrah', 'onepercent','tagujrah']; + + + $columns_exist = array_filter($columns,function($column) use($dbase){ + return Schema::connection($dbase)->hasColumn('lelong', $column); + }); + + Schema::connection($dbase)->table('lelong', function(Blueprint $table) use($columns_exist){ + foreach($columns_exist as $column){ + $table->dropColumn($column); + } + }); + } + } +} diff --git a/database/migrations/2023_12_24_120200_add_tagnotis_to_gadai_table.php b/database/migrations/2023_12_24_120200_add_tagnotis_to_gadai_table.php new file mode 100644 index 0000000..40ddceb --- /dev/null +++ b/database/migrations/2023_12_24_120200_add_tagnotis_to_gadai_table.php @@ -0,0 +1,69 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('gadai', function (Blueprint $table) use($dbase) { + + $isTagNotisExist = Schema::connection($dbase)->hasColumn('gadai', 'tagnotis'); + + + if(! $isTagNotisExist){ + $table->tinyInteger('tagnotis')->default(0); + } + + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + $columns = ['tagnotis']; + + + $columns_exist = array_filter($columns,function($column) use($dbase){ + return Schema::connection($dbase)->hasColumn('gadai', $column); + }); + + Schema::connection($dbase)->table('gadai', function(Blueprint $table) use($columns_exist){ + foreach($columns_exist as $column){ + $table->dropColumn($column); + } + }); + } + } +} \ No newline at end of file diff --git a/database/migrations/2023_12_24_170256_add_nama_to_table_log_blast_wasap.php b/database/migrations/2023_12_24_170256_add_nama_to_table_log_blast_wasap.php new file mode 100644 index 0000000..46adddd --- /dev/null +++ b/database/migrations/2023_12_24_170256_add_nama_to_table_log_blast_wasap.php @@ -0,0 +1,32 @@ +text('nama')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('log_blast_wasap', function (Blueprint $table) { + $table->dropColumn(['nama']); + }); + } +} diff --git a/database/migrations/2023_12_25_140355_add_nama_to_table_log_blast_sms.php b/database/migrations/2023_12_25_140355_add_nama_to_table_log_blast_sms.php new file mode 100644 index 0000000..2256757 --- /dev/null +++ b/database/migrations/2023_12_25_140355_add_nama_to_table_log_blast_sms.php @@ -0,0 +1,34 @@ +text('nama')->nullable(); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('log_blast_sms', function (Blueprint $table) { + $table->dropColumn(['nama']); + + }); + } +} diff --git a/routes/web.php b/routes/web.php index c449fee..6e941dc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -839,5 +839,7 @@ $router->group(['prefix'=>'arcc'], function () use ($router){ $router->get('senarainotisperingatan',['uses'=>'CallCenterController@senarainotisperingatan']); $router->get('getcawnotis/{notisid}',['uses'=>'CallCenterController@getcawnotis']); $router->get('getcawnotisbycaw',['uses'=>'CallCenterController@getcawnotisbycaw']); + $router->get('bycawnotisperingatan/{kodcaw}/{notisid}',['uses'=>'CallCenterController@bycawnotisperingatan']); + $router->post('blastwasapbysag',['uses'=>'CallCenterController@blastwasapbysag']); }); From 2f8aff0d41fbccf8b4715d2703f65887fdd091cf Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 26 Dec 2023 11:03:05 +0800 Subject: [PATCH 089/114] fix penukaran ujrah dan keuntungan bila buat tebus --- app/Support/v2/Penebusan.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index bf7eac9..7b7a234 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -510,6 +510,7 @@ class Penebusan } } + dd($array_onepercent,$array_onepercent_rebet); $create_tebus = Tebus::on($cawangan['mysql'])->create([ 'kodcaw'=> $kodcaw, @@ -743,8 +744,8 @@ class Penebusan $bilang_bln = $tempoh - $gadai_data['tempohbayar']; $array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - $onepercent = $onepercentservices->getRoundedMethod($array_upah['ujrah']); - $ujrah = $onepercentservices->getRoundedMethod($array_upah['onepercent']); + $onepercent = $onepercentservices->getRoundedMethod($array_upah['onepercent']); + $ujrah = $onepercentservices->getRoundedMethod($array_upah['ujrah']); $onepercent_semasa = $bilang_bln * $onepercent; $ujrah_semasa = $bilang_bln * $ujrah; From a22143e20b74971985975713203d9fdcdc83f029 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 26 Dec 2023 11:05:08 +0800 Subject: [PATCH 090/114] buang dd --- app/Support/v2/Penebusan.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index 7b7a234..f231e8a 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -510,7 +510,6 @@ class Penebusan } } - dd($array_onepercent,$array_onepercent_rebet); $create_tebus = Tebus::on($cawangan['mysql'])->create([ 'kodcaw'=> $kodcaw, From 558358bde8831ac634a91716f4bc1c2a90c8fa04 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 26 Dec 2023 11:36:52 +0800 Subject: [PATCH 091/114] fix duitpelanggan --- app/Support/v1/Penebusan.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Support/v1/Penebusan.php b/app/Support/v1/Penebusan.php index c4f2fb7..596fd8b 100644 --- a/app/Support/v1/Penebusan.php +++ b/app/Support/v1/Penebusan.php @@ -542,7 +542,9 @@ class Penebusan 'duit_masuk' => $harga_tebus, 'created_at' => $current, 'bakiharga' => $baki_hargajualan, - 'nowakil' => (int)$request->nowakil + 'nowakil' => (int)$request->nowakil, + 'duitpelanggan' => isset($request->duitpelanggan) ? $request->duitpelanggan : 0, + 'bakipelanggan' => isset($request->bakipelanggan) ? $request->bakipelanggan : 0, ]); } From c56a908d2fbec7df2fb113332a0eeb76edaeb517 Mon Sep 17 00:00:00 2001 From: Amirah Date: Tue, 26 Dec 2023 11:44:16 +0800 Subject: [PATCH 092/114] add function surat wakil --- app/Http/Controllers/WakilController.php | 92 +++++++++++++++++++ app/WakilSurat.php | 30 ++++++ ...create_wakil_surat_to_dbcawangan_table.php | 68 ++++++++++++++ routes/web.php | 10 ++ 4 files changed, 200 insertions(+) create mode 100644 app/Http/Controllers/WakilController.php create mode 100644 app/WakilSurat.php create mode 100644 database/migrations/2023_12_19_232631_create_wakil_surat_to_dbcawangan_table.php diff --git a/app/Http/Controllers/WakilController.php b/app/Http/Controllers/WakilController.php new file mode 100644 index 0000000..31cce18 --- /dev/null +++ b/app/Http/Controllers/WakilController.php @@ -0,0 +1,92 @@ +where('kodcaw', '=', $kodcaw)->first(); + + $check_norujukan = WakilSurat::on($cawangan['mysql']) + ->where('norujukan', '=', $norujukan) + ->get(); + + if (sizeof($check_norujukan) != 0) { + $newnorujukan = $norujukan; + } else { + + $newnorujukan = 'NULL'; + } + return response()->json($newnorujukan); + } + + + public function showsuratwakil($kodcaw, $t_cetak) + { + $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); + + $wakil_surat = WakilSurat::on($cawangan['mysql'])->where('t_cetak', '=', $t_cetak)->orderBy('nosiri', 'desc')->first(); + + return response()->json($wakil_surat); + } + + public function createSuratWakil($kodcaw, Request $request) + { + + $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); + + $wakil = WakilSurat::on($cawangan['mysql'])->create([ + 'nosiri' => $request->nosiri, + 'no_surat' => $request->no_surat, + 'norujukan' => $request->norujukan, + 't_cetak' => $request->t_cetak + + ]); + + return response()->json($wakil); + } + + public function noSiriWakil($kodcaw, $norujukan) + { + + $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); + + $getnosiri = WakilSurat::on($cawangan['mysql']) + ->where('norujukan', '=', $norujukan) + ->select('no_surat') + ->get(); + + $nosiri = $getnosiri[0]['no_surat']; + + return response()->json($nosiri); + } + + public function updateWakil($kodcaw, $norujukan) + { + $current = Carbon::now(); + $current = new Carbon(); + + + $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); + + $update_wakil = WakilSurat::on($cawangan['mysql'])->where('norujukan', '=', $norujukan) + ->update(array( + 't_cetak' => $current->toDateString(), + 'updated_at' => $current + )); + + return response()->json($update_wakil, 200); + } +} diff --git a/app/WakilSurat.php b/app/WakilSurat.php new file mode 100644 index 0000000..31bf586 --- /dev/null +++ b/app/WakilSurat.php @@ -0,0 +1,30 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + + public function up() + { + + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + + Schema::connection($dbase)->create('wakil_surat', function (Blueprint $table) { + $table->id(); + $table->string('nosiri')->nullable(); + $table->string('no_surat')->nullable(); + $table->string('norujukan')->nullable(); + $table->string('t_cetak')->nullable(); + $table->timestamps(); + }); + + + } + + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('wakil_surat'); + } +} diff --git a/routes/web.php b/routes/web.php index 6e941dc..339e6d4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -392,6 +392,16 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('getwakil/{kodcaw}/status/{status}',['uses' => 'TebusController@getWakilbyStatus']); $router->get('lookupwakil',['uses' => 'TebusController@LookupWakil']); + //API SURAT WAKIL + $router->get('checksurat/{kodcaw}/{norujukan}',['uses'=>'WakilController@showSuratWakilByNorujukan']); + $router->get('wakil/{kodcaw}/{t_cetak}',['uses'=>'WakilController@showsuratwakil']); + $router->post('wakil/{kodcaw}',['uses'=>'WakilController@createSuratWakil']); + $router->get('nosiri/wakil/{kodcaw}/{norujukan}',['uses'=>'WakilController@noSiriWakil']); + $router->put('updatewakil/{kodcaw}/{norujukan}',['uses'=>'WakilController@updateWakil']); + + + + //API ALASAN $router->get('lookupalasan',['uses' => 'PolisController@LookupAlasan']); $router->get('polis/laporan',['uses' => 'PolisController@LaporanPolis']); From e9a2a50f2a333e4b60160cd6a90f1958cb8190da Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 26 Dec 2023 12:17:08 +0800 Subject: [PATCH 093/114] fix duit pelanggan for autotawarruq --- app/Support/v1/Penebusan.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Support/v1/Penebusan.php b/app/Support/v1/Penebusan.php index 596fd8b..398f399 100644 --- a/app/Support/v1/Penebusan.php +++ b/app/Support/v1/Penebusan.php @@ -659,6 +659,8 @@ class Penebusan 'duit_masuk' => $request->totalbayaran, 'created_at' => $current, 'bakiharga' => 0, + 'duitpelanggan' => isset($request->bayaranpelanggan) ? $request->bayaranpelanggan : 0, + 'bakipelanggan' => isset($request->bakipelanggan) ? $request->bakipelanggan : 0 ]); $audit = new Audit(); From 02227c06305afab5c2931a45adc39e1a650ba876 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 27 Dec 2023 00:47:40 +0800 Subject: [PATCH 094/114] function imbang duga akru fix --- app/Http/Controllers/GadaiController.php | 5 +- app/Http/Controllers/TebusController.php | 8 +- app/Services/Miscellaneous/PanjarServices.php | 306 ++++++++++++++++++ app/Services/Reports/OnePercentService.php | 18 +- app/Support/v2/GadaiV2.php | 11 +- 5 files changed, 340 insertions(+), 8 deletions(-) create mode 100644 app/Services/Miscellaneous/PanjarServices.php diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index b53b472..3f3ac2b 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -3205,8 +3205,11 @@ class GadaiController extends Controller $totalpinjaman = $audit->sum('pinjaman'); $totalbakipjm = $audit->sum('bakipjm'); $totaltunggakan = $audit->sum('tunggakan'); + $totalujrah = $audit->sum('tunggakanujrah'); + $totalonepercent = $audit->sum('tunggakanonepercent'); - $arrayrekod = ['rekod' => $rekodaudit, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan]; + + $arrayrekod = ['rekod' => $rekodaudit, 'total' => $totalrekod,'totalberat' => $totalberat,'totalnilaimarhun' => $totalnilaimarhun,'totalpinjaman'=>$totalpinjaman,'totalbakipjm'=>$totalbakipjm,'totaltunggakan'=>$totaltunggakan,'totalujrah'=>$totalujrah,'totalonepercent'=>$totalonepercent]; return response()->json($arrayrekod,200); } diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 3eca0fc..676c960 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -42,6 +42,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Carbon\Carbon; +use Illuminate\Support\Facades\DB; class TebusController extends Controller { @@ -1603,12 +1604,15 @@ class TebusController extends Controller if($determine_past->isToday()) { $audit_now = Gadai::on($cawangan['mysql']) + ->select(DB::raw('sum(tunggakan) as "akru", + sum(tunggakanujrah) as "akruujrah", + sum(tunggakanonepercent) as "akruonepercent"')) ->where([['tagpalsu','=',0],['t_gadai','<=',$request->tarikh],['sttebus','=','']]) ->orWhere([['tagpalsu','=',0],['t_update','>',$request->tarikh],['sttebus','!=',''],['t_gadai','<=',$request->tarikh]]) ->orderBy('t_gadai', 'ASC') - ->orderBy('sirig', 'ASC'); + ->orderBy('sirig', 'ASC')->first(); - $totaltunggakan_now = $audit_now->sum('tunggakan'); + $totaltunggakan_now = $audit_now['akru'] + $audit_now['akruujrah'] + $audit_now['akruonepercent']; }else{ $result_audit_backdate = $this->StokAuditGenerateTerakru($month_sekarang,$cawangan,$year_generate); diff --git a/app/Services/Miscellaneous/PanjarServices.php b/app/Services/Miscellaneous/PanjarServices.php new file mode 100644 index 0000000..107f797 --- /dev/null +++ b/app/Services/Miscellaneous/PanjarServices.php @@ -0,0 +1,306 @@ + 100,'bd5' => 500,'bd10' => 1000,'bd20' => 1000,'bd50' => 5000,'bd100' => 5000, + 'txtsen1' => 0.01,'txtsen5' => 0.05,'txtsen10' => 0.10,'txtsen20' => 0.20,'txtsen50' => 0.50, + 'txtring1' => 1,'txtring5' => 5,'txtring10' => 10,'txtring20' => 20,'txtring50' => 50, + 'txtring100' => 100,'txtring1000' => 1000, + ]; + + public function __construct($kodcaw){ + $this->cawangan = $kodcaw; + } + + private function calculation_denominasi($array_deno = [],$denominasi = [],$jenis_panjar){ + + if(isset($array_deno) <= 0 || isset($denominasi) <= 0){ + return 'no data'; + } + + if($jenis_panjar != 'masuk' || $jenis_panjar != 'keluar') return 'no data'; + + $records = []; + foreach($this->namelist_deno as $deno => $value){ + $total_deno = 0;$total = 0; + $total_deno = ($jenis_panjar == 'masuk') ? $denominasi[$deno] += intval($array_deno[$deno]) : $denominasi[$deno] -= intval($array_deno[$deno]); + $total = ($total_deno * $value); + + $records[$deno] = [ + 'keping' => $total_deno, + 'jumlah' => $total + ]; + } + + /* total Keping */ + $total_keping = array_sum(array_column($records, 'jumlah')); + + /* Total Bundle */ + $filteredKeys = array_filter(array_keys($records), function($key) { + return strpos($key, 'bd') !== false; + }); + + $filteredRecords = array_filter($records, function($record,$key) use ($filteredKeys) { + return in_array($key, $filteredKeys); + }, ARRAY_FILTER_USE_BOTH); + + $total_bundle = array_sum(array_column($filteredRecords, 'jumlah')); + + return [ + 'deno' => $records, + 'total' => $total_keping, + 'total_bundle' => $total_bundle, + 'total_all' => ($total_keping + $total_bundle), + ]; + } + + public function delete(Request $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw', $this->cawangan)->first(); + $denominasi = Denominasi::on($cawangan['mysql'])->latest('tarikh')->first(); + $panjar = Panjar::on($cawangan['mysql'])->latest('tarikh')->where('nobaucer', $request->nobaucer)->first(); + $vault = Vault::on($cawangan['mysql'])->latest('tarikh')->first(); + $deno_panjar = DenoPanjar::on('mysql7')->where('kodcaw', $this->cawangan)->where('recno', $request->recno)->latest('tarikh','masa')->first(); + + try{ + if (!$panjar) throw new \Exception('Custom Exception: Panjar Does Not Exist!'); + if (!$denominasi) throw new \Exception('Custom Exception: Denominasi Does Not Exist!'); + if (!$vault) throw new \Exception('Custom Exception: Vault Does Not Exist!'); + if (!$deno_panjar) throw new \Exception('Custom Exception: Denominasi Panjar Does Not Exist!'); + + DB::transaction(function () use ($cawangan,$deno_panjar,$panjar,$denominasi,$current,$vault) { + + $return_data = $this->calculation_denominasi($deno_panjar,$denominasi,'masuk'); + if($return_data == 'no data') throw new \Exception('Custom Exception: Denominasi Panjar Not Return Data'); + + Denominasi::on($cawangan['mysql'])->where([['tarikh','=',$current->toDateString()]])->update(array( + 'bd1' => $return_data['deno']['bd1']['keping'], + 'b1'=> $return_data['deno']['bd1']['jumlah'], + 'bd5'=> $return_data['deno']['bd5']['keping'], + 'b5'=> $return_data['deno']['bd5']['keping'], + 'bd10'=> $return_data['deno']['bd10']['keping'], + 'b10'=> $return_data['deno']['bd10']['jumlah'], + 'bd20'=> $return_data['deno']['bd20']['keping'], + 'b20'=> $return_data['deno']['bd20']['jumlah'], + 'bd50'=> $return_data['deno']['bd50']['keping'], + 'b50'=> $return_data['deno']['bd50']['jumlah'], + 'bd100'=> $return_data['deno']['bd100']['keping'], + 'b100'=> $return_data['deno']['bd100']['jumlah'], + 'txtring1'=> $return_data['deno']['txtring1']['keping'], + 'k1'=> $return_data['deno']['txtring1']['jumlah'], + 'txtring5'=> $return_data['deno']['txtring5']['keping'], + 'k5'=> $return_data['deno']['txtring5']['jumlah'], + 'txtsen1'=> $return_data['deno']['txtsen1']['keping'], + 'k01'=> $return_data['deno']['txtsen1']['jumlah'], + 'txtsen5'=> $return_data['deno']['txtsen5']['keping'], + 'k05'=> $return_data['deno']['txtsen5']['jumlah'], + 'txtsen10'=> $return_data['deno']['txtsen10']['keping'], + 'k010'=> $return_data['deno']['txtsen10']['jumlah'], + 'txtsen20'=> $return_data['deno']['txtsen20']['keping'], + 'k020'=> $return_data['deno']['txtsen20']['jumlah'], + 'txtsen50'=> $return_data['deno']['txtsen50']['keping'], + 'k050'=> $return_data['deno']['txtsen50']['jumlah'], + 'txtring10'=> $return_data['deno']['txtring10']['keping'], + 'k10'=> $return_data['deno']['txtring10']['jumlah'], + 'txtring20'=> $return_data['deno']['txtring20']['keping'], + 'k20'=> $return_data['deno']['txtring20']['jumlah'], + 'txtring50'=> $return_data['deno']['txtring50']['keping'], + 'k50'=> $return_data['deno']['txtring50']['jumlah'], + 'txtring100'=> $return_data['deno']['txtring100']['keping'], + 'k100'=> $return_data['deno']['txtring100']['jumlah'], + 'txtring1000'=> $return_data['deno']['txtring1000']['keping'], + 'k1000'=> $return_data['deno']['txtring1000']['jumlah'], + 'jumlahbundle'=> $return_data['total_bundle'], + 'txtjumlah'=> $return_data['total_all'], + 'jumlahkeping' => $return_data['total'] + ) ); + + $totalpanjar = ($vault['totpanjar'] - $deno_panjar['serahan']); + $bakiakhir = ($vault['bakiawal'] - $vault['keluar'] + $vault['masuk'] + $vault['pendahuluan'] - $vault['serahan'] - $totalpanjar); + + if($bakiakhir <= 0) throw new \Exception('Custom Exception: Amaun Baki Akhir Cannot Be Zero'); + if($totalpanjar < 0) throw new \Exception('Custom Exception: Amaun Panjar Cannot Be Zero'); + + Vault::on($cawangan['mysql'])->where('kodcaw','=', $cawangan['kodcaw'])->latest('tarikh')->update(array( + 'totpanjar' => $totalpanjar, + 'bakiakhir'=>$bakiakhir, + 'bakieod'=>$bakiakhir + )); + + DenoPanjar::on('mysql7')->where('kodcaw', $this->cawangan)->where('recno', $panjar['recno'])->latest('tarikh','masa')->delete(); + Panjar::on($cawangan['mysql'])->where('recno',$panjar['recno'])->delete(); + + $audit = new Audit(); + $audit->users = $request->tuntutoleh; + $audit->actions = "Keluarkan Perbelanjaan"; + $audit->new_data = $panjar; + $audit->kodcaw = $this->cawangan; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + }); + }catch(\Exception $e){ + dd($e->getMessage()); + Log::error('Exception: ' , $e->getMessage()); + } + } + + public function create(Request $request){ + $current = Carbon::now(); + $current = new Carbon(); + + $cawangan = Cawangan::on('mysql7')->where('kodcaw', $this->cawangan)->first(); + $denominasi = Denominasi::on($cawangan['mysql'])->latest('tarikh')->first(); + $vault = Vault::on($cawangan['mysql'])->latest('tarikh')->first(); + + try{ + if (!$denominasi) throw new \Exception('Custom Exception: Denominasi Does Not Exist!'); + if (!$vault) throw new \Exception('Custom Exception: Vault Does Not Exist!'); + + DB::transaction(function () use ($cawangan,$denominasi,$current,$vault,$request) { + + $panjar = Panjar::on($cawangan['mysql']) + ->create([ + 'tarikh'=> $current->toDateString(), + 'deskripsi'=> $request->deskripsi, + 'bayaran' => $request->bayaran, + 'tag' => $request->tag, + 'kategori' => $request->kategori, + 'id' => $request->id, + 'bakiperubatan' => $request->bakiperubatan, + 'nobaucer' => $request->nobaucer, + 'nobil' => $request->nobil, + 'tuntutoleh' => $request->tuntutoleh + ]); + + $denopanjar = DenoPanjar::on('mysql7')->create([ + 'tarikh' => $current->toDateString(), + 'masa' => $current->toTimeString(), + 'kodcaw' => $this->cawangan, + 'kodlaluan' => $request->kodlaluan, + 'serahan' => $request->serahan, + 'bd1' => $request->bd1, + 'bd5' => $request->bd5, + 'bd10' => $request->bd10, + 'bd20' => $request->bd20, + 'bd50' => $request->bd50, + 'bd100' => $request->bd100, + 'txtring1' => $request->txtring1, + 'txtring5' => $request->txtring5, + 'txtring10' => $request->txtring10, + 'txtring20' => $request->txtring20, + 'txtring50' => $request->txtring50, + 'txtring100' => $request->txtring100, + 'txtring1000' => $request->txtring1000, + 'txtsen1' => $request->txtsen1, + 'txtsen5' => $request->txtsen5, + 'txtsen10' => $request->txtsen10, + 'txtsen20' => $request->txtsen20, + 'txtsen50' => $request->txtsen50, + 'jenis' =>$request->jenis, + 'recno' =>$panjar['recno'], + 'update' => '0' + ]); + + $return_data = $this->calculation_denominasi($denopanjar,$denominasi,'masuk'); + if($return_data == 'no data') throw new \Exception('Custom Exception: Denominasi Panjar Not Return Data'); + + Denominasi::on($cawangan['mysql'])->where([['tarikh','=',$current->toDateString()]])->update(array( + 'bd1' => $return_data['deno']['bd1']['keping'], + 'b1'=> $return_data['deno']['bd1']['jumlah'], + 'bd5'=> $return_data['deno']['bd5']['keping'], + 'b5'=> $return_data['deno']['bd5']['keping'], + 'bd10'=> $return_data['deno']['bd10']['keping'], + 'b10'=> $return_data['deno']['bd10']['jumlah'], + 'bd20'=> $return_data['deno']['bd20']['keping'], + 'b20'=> $return_data['deno']['bd20']['jumlah'], + 'bd50'=> $return_data['deno']['bd50']['keping'], + 'b50'=> $return_data['deno']['bd50']['jumlah'], + 'bd100'=> $return_data['deno']['bd100']['keping'], + 'b100'=> $return_data['deno']['bd100']['jumlah'], + 'txtring1'=> $return_data['deno']['txtring1']['keping'], + 'k1'=> $return_data['deno']['txtring1']['jumlah'], + 'txtring5'=> $return_data['deno']['txtring5']['keping'], + 'k5'=> $return_data['deno']['txtring5']['jumlah'], + 'txtsen1'=> $return_data['deno']['txtsen1']['keping'], + 'k01'=> $return_data['deno']['txtsen1']['jumlah'], + 'txtsen5'=> $return_data['deno']['txtsen5']['keping'], + 'k05'=> $return_data['deno']['txtsen5']['jumlah'], + 'txtsen10'=> $return_data['deno']['txtsen10']['keping'], + 'k010'=> $return_data['deno']['txtsen10']['jumlah'], + 'txtsen20'=> $return_data['deno']['txtsen20']['keping'], + 'k020'=> $return_data['deno']['txtsen20']['jumlah'], + 'txtsen50'=> $return_data['deno']['txtsen50']['keping'], + 'k050'=> $return_data['deno']['txtsen50']['jumlah'], + 'txtring10'=> $return_data['deno']['txtring10']['keping'], + 'k10'=> $return_data['deno']['txtring10']['jumlah'], + 'txtring20'=> $return_data['deno']['txtring20']['keping'], + 'k20'=> $return_data['deno']['txtring20']['jumlah'], + 'txtring50'=> $return_data['deno']['txtring50']['keping'], + 'k50'=> $return_data['deno']['txtring50']['jumlah'], + 'txtring100'=> $return_data['deno']['txtring100']['keping'], + 'k100'=> $return_data['deno']['txtring100']['jumlah'], + 'txtring1000'=> $return_data['deno']['txtring1000']['keping'], + 'k1000'=> $return_data['deno']['txtring1000']['jumlah'], + 'jumlahbundle'=> $return_data['total_bundle'], + 'txtjumlah'=> $return_data['total_all'], + 'jumlahkeping' => $return_data['total'] + ) ); + + $totalpanjar = ($vault['totpanjar'] + $denopanjar['serahan']); + $bakiakhir = ($vault['bakiawal'] - $vault['keluar'] + $vault['masuk'] + $vault['pendahuluan'] - $vault['serahan'] - $totalpanjar); + + if($bakiakhir <= 0) throw new \Exception('Custom Exception: Amaun Baki Akhir Cannot Be Zero'); + if($totalpanjar < 0) throw new \Exception('Custom Exception: Amaun Panjar Cannot Be Zero'); + + Vault::on($cawangan['mysql'])->where('kodcaw','=', $cawangan['kodcaw'])->latest('tarikh')->update(array( + 'totpanjar' => $totalpanjar, + 'bakiakhir'=>$bakiakhir, + 'bakieod'=>$bakiakhir + )); + + $audit = new Audit(); + $audit->users = $request->tuntutoleh; + $audit->actions = "Daftar Perbelanjaan"; + $audit->new_data = $panjar; + $audit->kodcaw = $this->cawangan; + $audit->created_at = $current; + $audit->updated_at = $current; + $audit->save(); + + }); + }catch(\Exception $e){ + dd($e->getMessage()); + Log::error('Exception: ' , $e->getMessage()); + } + } +} diff --git a/app/Services/Reports/OnePercentService.php b/app/Services/Reports/OnePercentService.php index 6dede56..a937433 100644 --- a/app/Services/Reports/OnePercentService.php +++ b/app/Services/Reports/OnePercentService.php @@ -46,6 +46,8 @@ class OnePercentService public function getTotalKeuntungan($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ if($type == 'B'){ + + $akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1]])->sum('tunggakanonepercent'); $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); $keuntungan = TransaksiKeuntungan::on('mysql7') @@ -53,28 +55,37 @@ class OnePercentService ->sum('onepercent_rebet'); }else if($type == 'L'){ + $akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1],['t_update','>=',$start],['t_update','<=',$end]])->sum('tunggakanonepercent'); + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->where('t_update','>=',$start)->where('t_update','<=',$end)->pluck('norujukan'); $keuntungan = TransaksiKeuntungan::on('mysql7') ->whereIn('norujukan',$norujukan) ->whereDate('tarikh_bayaran','>=',$start) ->whereDate('tarikh_bayaran','<=',$end) - ->sum('onepercent_rebet');; + ->sum('onepercent_rebet'); } - return $keuntungan; + $totalkeuntungan = $keuntungan + $akrual; + + return $totalkeuntungan; } public function getTotalUjrah($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ if($type == 'B'){ + $akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1]])->sum('tunggakanujrah'); + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); $ujrah = TransaksiKeuntungan::on('mysql7') ->whereIn('norujukan',$norujukan) ->sum('ujrah_rebet'); + }else if($type == 'L'){ + $akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1],['t_update','>=',$start],['t_update','<=',$end]])->sum('tunggakanujrah'); + $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); $ujrah = TransaksiKeuntungan::on('mysql7') @@ -84,7 +95,8 @@ class OnePercentService ->sum('ujrah_rebet');; } - return $ujrah; + $totalujrah = $ujrah + $akrual; + return $totalujrah; } diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php index b9d71ed..96cfd7b 100644 --- a/app/Support/v2/GadaiV2.php +++ b/app/Support/v2/GadaiV2.php @@ -101,6 +101,8 @@ class GadaiV2 $hargajualan = $request->pinjaman + $upah12; + $akrual = $this->kiraupahTawarruqStokAuditUjrahOnePercent(0.5,0,$kadar_raw['kadarujrah'],$request->pinjaman,$total_nilai_marhun,$margin_pinjam); + $gadai = Gadai::on($cawangan['mysql']) ->where('norujukan','=',$norujukan) ->update(array( @@ -132,7 +134,9 @@ class GadaiV2 'ujrah' => $ujrah, 'onepercent' => $onepercent, 'margin_semasa' => $margin_pinjam, - 'tagbaru' => 1 + 'tagbaru' => 1, + 'tunggakanujrah' => $akrual['ujrah'], + 'tunggakanonepercent' => $akrual['keuntungan'], )); $new_data = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->first(); @@ -283,6 +287,7 @@ class GadaiV2 DB::connection($cawangan['mysql'])->transaction(function () use($cawangan,$baki_pinjaman,$current,$norujukan,$gadai,$baki_hargajualan,$lelong_tawarruq,$margin_semasa){ $margin_updated = ($baki_pinjaman / $gadai['nilaimarhun']) * 100; + $akrual = $this->kiraupahTawarruqStokAuditUjrahOnePercent($gadai['tempoh'],$gadai['tempohbayar'],$gadai['kadarujrah'],$gadai['bakipjm'],$gadai['nilaimarhun'],$margin_semasa); $update_gadai = Gadai::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array( 'bakipjm' => $baki_pinjaman, @@ -292,6 +297,8 @@ class GadaiV2 'tempohbayar' => $gadai['tempoh'], 'lelong_tawarruq' => $lelong_tawarruq, 'margin_semasa' => $margin_updated, + 'tunggakanujrah' => $akrual['ujrah'], + 'tunggakanonepercent' => $akrual['keuntungan'] )); }); @@ -364,7 +371,7 @@ class GadaiV2 Gadai::on($cawangan_mysql['mysql'])->where('norujukan','=',$gadai['norujukan'])->update(array( 'jbg' => $tempoh_gadai, 'tempoh' => $tempoh_gadai, - 'tunggakan' => $upah_semasa['pendapatan'], + 'tunggakan' => 0, 'tunggakanujrah' => $upah_semasa['ujrah'], 'tunggakanonepercent' => $upah_semasa['keuntungan'], )); From 5a01b10c165dc65e7dc41ee05f1cebfd2156234c Mon Sep 17 00:00:00 2001 From: Amir Date: Thu, 28 Dec 2023 13:20:53 +0800 Subject: [PATCH 095/114] fix conflict migration onepercent to tebus table --- ...23_11_11_104203_add_onepercent_to_tebus_table.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php index 025dabc..9fde429 100644 --- a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php +++ b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php @@ -21,28 +21,16 @@ class AddOnepercentToTebusTable extends Migration public function getActiveDB() { $config_db = array_keys(config("database.connections")); -<<<<<<< Updated upstream $db_connection = array_filter($config_db, function ($connection) { try { - if ($connection == 'mysql7') { -======= - - $db_connection = array_filter($config_db,function($connection){ - try{ if($connection == 'mysql7' || $connection == 'lelong') ->>>>>>> Stashed changes return false; - } $db = DB::connection($connection)->getPdo(); return true; -<<<<<<< Updated upstream } catch (\Exception $e) { -======= - } catch(\Exception $e){ Log::info($connection); ->>>>>>> Stashed changes return false; } }); From e7746d92b0a326dc9e7744df9e45e5e1b980b075 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 28 Dec 2023 16:43:52 +0800 Subject: [PATCH 096/114] Repair confused cached --- app/Support/OnePercent.php | 209 ------------------------------------- app/Support/Onepercent.php | 209 ------------------------------------- 2 files changed, 418 deletions(-) delete mode 100644 app/Support/OnePercent.php delete mode 100644 app/Support/Onepercent.php diff --git a/app/Support/OnePercent.php b/app/Support/OnePercent.php deleted file mode 100644 index 83c7014..0000000 --- a/app/Support/OnePercent.php +++ /dev/null @@ -1,209 +0,0 @@ -kodcaw = $kodcaw; - $this->cawangan_info = parent::getInfoCawangan($kodcaw); - } - - /* Start Gadaian */ - public function createGadai(HttpRequest $httpRequest){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->create($httpRequest); - - return $response; - } - - public function createMarhunGadai($norujukan,HttpRequest $httpRequest){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->createMarhun($norujukan,$httpRequest); - - return $response; - } - - public function getUpahSebenar($norujukan){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->kiraupahOnePercent($this->kodcaw,$norujukan); - - return $response; - } - - public function getUpahRebet($kodcaw,$norujukan){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->kiraupahRebet($this->kodcaw,$norujukan); - - return $response; - } - - public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->updateAnsuranKaunter($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function updateJBGSemasa(HttpRequest $request){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->updateJBG($request); - return $response; - } - - public function getKadarUjrah(HttpRequest $request){ - $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); - $onePercentServices = new Calculation(); - $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); - - return $kadarujrah; - } - - public function getOnePercent(HttpRequest $request){ - $onePercentServices = new Calculation(); - $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); - - return $keuntungan; - } - - /* End Gadaian */ - - /* Start Penebusan */ - - public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function hargaTebusTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function kiraUpahRebetSebenar($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraUpahRebetSebenar($this->kodcaw,$norujukan); - - return $response; - } - - public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->upahTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); - - return $response; - } - - public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->upahRebetTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); - - return $response; - } - - public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusSeparuhTawarruq($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function tebusNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function hargaTebusNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->hargaTebusNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function kiraUpahNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraUpahNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function upahNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->upahNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusSeparuhNotTawarruq($this->kodcaw,$norujukan,$request); - - return $response; - } - - function rebet($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->rebet($this->kodcaw,$norujukan); - - return $response; - } - - function rebetselepastawarruq($kodcaw,$norujukan){ - dd('tes'); - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusUpdate($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusUpdateAutoTawarruq($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraupahUjrahOnePercent($this->kodcaw,$norujukan); - - return $response; - } - - public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraupahUjrahOnePercentRebate($this->kodcaw,$norujukan); - - return $response; - } - - /* End Penebusan */ - - public function test(){ - echo 'onepercent'; - } -} diff --git a/app/Support/Onepercent.php b/app/Support/Onepercent.php deleted file mode 100644 index 9709a36..0000000 --- a/app/Support/Onepercent.php +++ /dev/null @@ -1,209 +0,0 @@ -kodcaw = $kodcaw; - $this->cawangan_info = parent::getInfoCawangan($kodcaw); - } - - /* Start Gadaian */ - public function createGadai(HttpRequest $httpRequest){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->create($httpRequest); - - return $response; - } - - public function createMarhunGadai($norujukan,HttpRequest $httpRequest){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->createMarhun($norujukan,$httpRequest); - - return $response; - } - - public function getUpahSebenar($norujukan){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->kiraupahOnePercent($norujukan); - - return $response; - } - - public function getUpahRebet($kodcaw,$norujukan){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->kiraupahRebet($this->kodcaw,$norujukan); - - return $response; - } - - public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->updateAnsuranKaunter($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function updateJBGSemasa(HttpRequest $request){ - $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); - $response = $gadai->updateJBG($request); - return $response; - } - - public function getKadarUjrah(HttpRequest $request){ - $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); - $onePercentServices = new Calculation(); - $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); - - return $kadarujrah; - } - - public function getOnePercent(HttpRequest $request){ - $onePercentServices = new Calculation(); - $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); - - return $keuntungan; - } - - /* End Gadaian */ - - /* Start Penebusan */ - - public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function hargaTebusTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function kiraUpahRebetSebenar($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraUpahRebetSebenar($this->kodcaw,$norujukan); - - return $response; - } - - public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->upahTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); - - return $response; - } - - public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->upahRebetTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); - - return $response; - } - - public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusSeparuhTawarruq($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function tebusNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function hargaTebusNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->hargaTebusNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function kiraUpahNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraUpahNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function upahNotTawarruq($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->upahNotTawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusSeparuhNotTawarruq($this->kodcaw,$norujukan,$request); - - return $response; - } - - function rebet($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->rebet($this->kodcaw,$norujukan); - - return $response; - } - - function rebetselepastawarruq($kodcaw,$norujukan){ - dd('tes'); - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); - - return $response; - } - - public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusUpdate($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->tebusUpdateAutoTawarruq($this->kodcaw,$norujukan,$request); - - return $response; - } - - public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraupahUjrahOnePercent($this->kodcaw,$norujukan); - - return $response; - } - - public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ - $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); - $response = $tebus->kiraupahUjrahOnePercentRebate($this->kodcaw,$norujukan); - - return $response; - } - - /* End Penebusan */ - - public function test(){ - echo 'onepercent'; - } -} From f8c76a8466e764d85cf8e04ca7366274d0378f66 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 28 Dec 2023 16:45:18 +0800 Subject: [PATCH 097/114] Add back OnePercent class --- app/Support/OnePercent.php | 209 +++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 app/Support/OnePercent.php diff --git a/app/Support/OnePercent.php b/app/Support/OnePercent.php new file mode 100644 index 0000000..83c7014 --- /dev/null +++ b/app/Support/OnePercent.php @@ -0,0 +1,209 @@ +kodcaw = $kodcaw; + $this->cawangan_info = parent::getInfoCawangan($kodcaw); + } + + /* Start Gadaian */ + public function createGadai(HttpRequest $httpRequest){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->create($httpRequest); + + return $response; + } + + public function createMarhunGadai($norujukan,HttpRequest $httpRequest){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->createMarhun($norujukan,$httpRequest); + + return $response; + } + + public function getUpahSebenar($norujukan){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahOnePercent($this->kodcaw,$norujukan); + + return $response; + } + + public function getUpahRebet($kodcaw,$norujukan){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->kiraupahRebet($this->kodcaw,$norujukan); + + return $response; + } + + public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateAnsuranKaunter($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function updateJBGSemasa(HttpRequest $request){ + $gadai = new Version2Gadai($this->kodcaw,$this->cawangan_info); + $response = $gadai->updateJBG($request); + return $response; + } + + public function getKadarUjrah(HttpRequest $request){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw',$request->kodcaw)->first(); + $onePercentServices = new Calculation(); + $kadarujrah = $onePercentServices->getKadarUjrah($request->nilaimarhun,$cawangan['group_id']); + + return $kadarujrah; + } + + public function getOnePercent(HttpRequest $request){ + $onePercentServices = new Calculation(); + $keuntungan = $onePercentServices->kiraanKeuntunganSebenar($request->pembiayaan,$request->nilaimarhun,$request->kadarujrah,$request->margin); + + return $keuntungan; + } + + /* End Gadaian */ + + /* Start Penebusan */ + + public function tebusTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahRebetSebenar($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahRebetSebenar($this->kodcaw,$norujukan); + + return $response; + } + + public function upahTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function upahRebetTawarruq($kodcaw,$norujukan,$jeniskeuntungan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahRebetTawarruq($this->kodcaw,$norujukan,$jeniskeuntungan); + + return $response; + } + + public function tebusSeparuhTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function hargaTebusNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->hargaTebusNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraUpahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraUpahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function upahNotTawarruq($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->upahNotTawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusSeparuhNotTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusSeparuhNotTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + function rebet($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebet($this->kodcaw,$norujukan); + + return $response; + } + + function rebetselepastawarruq($kodcaw,$norujukan){ + dd('tes'); + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); + + return $response; + } + + public function tebusUpdate($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdate($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function tebusUpdateAutoTawarruq($kodcaw,$norujukan,HttpRequest $request){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->tebusUpdateAutoTawarruq($this->kodcaw,$norujukan,$request); + + return $response; + } + + public function kiraupahUjrahOnePercent($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraupahUjrahOnePercent($this->kodcaw,$norujukan); + + return $response; + } + + public function kiraupahUjrahOnePercentRebate($kodcaw,$norujukan){ + $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); + $response = $tebus->kiraupahUjrahOnePercentRebate($this->kodcaw,$norujukan); + + return $response; + } + + /* End Penebusan */ + + public function test(){ + echo 'onepercent'; + } +} From 18bec1c5078d3af229a726969ade0784e483f9e3 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Thu, 28 Dec 2023 16:52:04 +0800 Subject: [PATCH 098/114] Add laporan keseluruhan ringkasan harian --- .../Reports/KawalanStokController.php | 17 + .../Reports/RingkasanHarianController.php | 23 + app/Services/Reports/KawalanStokService.php | 439 ++++++++ app/Services/Reports/OnePercentService.php | 10 +- .../Reports/RingkasanHarianService.php | 963 ++++++++++++++++++ routes/report.php | 12 + tests/ExampleTest.php | 4 + tests/RingkasanHarianServicesTest.php | 208 ++++ 8 files changed, 1671 insertions(+), 5 deletions(-) create mode 100644 app/Http/Controllers/Reports/KawalanStokController.php create mode 100644 app/Http/Controllers/Reports/RingkasanHarianController.php create mode 100644 app/Services/Reports/KawalanStokService.php create mode 100644 app/Services/Reports/RingkasanHarianService.php create mode 100644 tests/RingkasanHarianServicesTest.php diff --git a/app/Http/Controllers/Reports/KawalanStokController.php b/app/Http/Controllers/Reports/KawalanStokController.php new file mode 100644 index 0000000..2f435e0 --- /dev/null +++ b/app/Http/Controllers/Reports/KawalanStokController.php @@ -0,0 +1,17 @@ +getLaporanCawangan(); + } +} diff --git a/app/Http/Controllers/Reports/RingkasanHarianController.php b/app/Http/Controllers/Reports/RingkasanHarianController.php new file mode 100644 index 0000000..c69a20b --- /dev/null +++ b/app/Http/Controllers/Reports/RingkasanHarianController.php @@ -0,0 +1,23 @@ +getLaporanCawangan(); + } + + public function getSummaryLaporanRingkasanHarian() + { + return json_encode(Helper::getActiveCawangan()); + } +} diff --git a/app/Services/Reports/KawalanStokService.php b/app/Services/Reports/KawalanStokService.php new file mode 100644 index 0000000..1a5ff92 --- /dev/null +++ b/app/Services/Reports/KawalanStokService.php @@ -0,0 +1,439 @@ +kodCawangan = $kodCawangan; + $this->startDate = $request->startDate; + $this->endDate = $request->endDate; + } + + public function getLaporanCawangan() + { + + $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $this->kodCawangan)->first(); + + $array_kawalanstok = []; + + /* Gadai */ + $gadai1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(*) AS bil, SUM(pinjaman) AS pinj') + ->where('t_gadai', '<', $this->startDate) + ->where('tagpalsu', 0) + ->whereBetween('nilaimarhun', [1, 400.99]) + ->get(); + + $gadai2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(*) AS bil, SUM(pinjaman) AS pinj') + ->where('t_gadai', '<', $this->startDate) + ->where('tagpalsu', 0) + ->whereBetween('nilaimarhun', [401, 2000.99]) + ->get(); + + $gadai3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(*) AS bil, SUM(pinjaman) AS pinj') + ->where('t_gadai', '<', $this->startDate) + ->where('tagpalsu', 0) + ->whereBetween('nilaimarhun', [2001, 1000000]) + ->get(); + + $gadaiini1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('t_gadai', '=>', $this->startDate)->where('t_gadai', '=<', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $gadaiini2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('t_gadai', '>=', $this->startDate)->where('t_gadai', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $gadaiini3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('t_gadai', '>=', $this->startDate)->where('t_gadai', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + /*tebus*/ + + $tebus1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'T') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $tebus2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'T') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $tebus3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'T') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + $tebusini1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'T') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $tebusini2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'T') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $tebusini3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'T') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + /*lelong*/ + + $lelong1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'L') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $lelong2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'L') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $lelong3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'L') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + $lelongini1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'L') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $lelongini2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'L') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $lelongini3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'L') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + /*ansuran*/ + + $ansuran1_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.created_at', '<', $this->startDate) + ->where('trans.trans_type', '=', 'A') + ->groupBy('trans.id') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('trans.norujukan'); + + $ansuran1 = []; + + $ansuran1 = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan', $ansuran1_data) + ->where([['nilaimarhun', '>=', 1], ['nilaimarhun', '<=', 400.99], ['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->orWhere([['nilaimarhun', '>=', 1], ['nilaimarhun', '<=', 400.99], ['sttebus', '!=', ''], ['t_update', '>', $this->endDate], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $transaksi1 = TransaksiKeuntungan::on('mysql7') + ->selectRaw('COUNT(*) as bil, SUM(bayaran_pembiayaan) AS total') + ->whereIn('norujukan', $ansuran1) + ->where('kodcaw', $this->kodCawangan) + ->where('tarikh_bayaran', '<=', $this->startDate) + ->get(); + + $ansuranharini1_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate) + ->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.trans_type', '=', 'A') + ->groupBy('trans.id') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('trans.norujukan'); + + $ansuran1harini = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan', $ansuranharini1_data) + ->where([['nilaimarhun', '>=', 1], ['nilaimarhun', '<=', 400.99], ['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $transaksi1harini = TransaksiKeuntungan::on('mysql7') + ->selectRaw('COUNT(*) as bil, SUM(bayaran_pembiayaan) AS total') + ->whereIn('norujukan', $ansuran1harini) + ->whereDate('tarikh_bayaran', '>=', $this->startDate) + ->whereDate('tarikh_bayaran', '<=', $this->endDate) + ->where('kodcaw', $this->kodCawangan) + ->get(); + + $ansuran2_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.created_at', '<', $this->startDate) + ->where('trans.trans_type', '=', 'A') + ->groupBy('trans.id') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('trans.norujukan'); + + $ansuran2 = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan', $ansuran2_data) + ->where([['nilaimarhun', '>=', 401], ['nilaimarhun', '<=', 2000.99], ['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->orWhere([['nilaimarhun', '>=', 401], ['nilaimarhun', '<=', 2000.99], ['sttebus', '!=', ''], ['t_update', '>', $this->endDate], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $transaksi2 = TransaksiKeuntungan::on('mysql7') + ->selectRaw('COUNT(*) as bil, SUM(bayaran_pembiayaan) AS total') + ->whereIn('norujukan', $ansuran2) + ->where('tarikh_bayaran', '<=', $this->startDate) + ->where('kodcaw', $this->kodCawangan) + ->get(); + + $ansuranharini2_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate) + ->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.trans_type', '=', 'A') + ->groupBy('trans.id') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('trans.norujukan'); + + $ansuran2harini = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan', $ansuranharini2_data) + ->where([['nilaimarhun', '>=', 401], ['nilaimarhun', '<=', 2000.99], ['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $transaksi2harini = TransaksiKeuntungan::on('mysql7') + ->selectRaw('COUNT(*) as bil, SUM(bayaran_pembiayaan) AS total') + ->whereIn('norujukan', $ansuran2harini) + ->whereDate('tarikh_bayaran', '>=', $this->startDate) + ->whereDate('tarikh_bayaran', '<=', $this->endDate) + ->where('kodcaw', $this->kodCawangan) + ->get(); + + $ansuran3_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.created_at', '<', $this->startDate) + ->where('trans.trans_type', '=', 'A') + ->groupBy('trans.id') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('trans.norujukan'); + + $ansuran3 = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan', $ansuran3_data) + ->where([['nilaimarhun', '>=', 2001], ['nilaimarhun', '<=', 1000000], ['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->orWhere([['nilaimarhun', '>=', 2001], ['nilaimarhun', '<=', 1000000], ['sttebus', '!=', ''], ['t_update', '>', $this->endDate], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $transaksi3 = TransaksiKeuntungan::on('mysql7') + ->selectRaw('COUNT(*) as bil, SUM(bayaran_pembiayaan) AS total') + ->whereIn('norujukan', $ansuran3) + ->where('tarikh_bayaran', '<=', $this->startDate) + ->where('kodcaw', $this->kodCawangan) + ->get(); + + $ansuranharini3_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate) + ->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.trans_type', '=', 'A') + ->groupBy('trans.id') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('trans.norujukan'); + + $ansuran3harini = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan', $ansuranharini3_data) + ->where([['nilaimarhun', '>=', 2001], ['nilaimarhun', '<=', 1000000], ['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $transaksi3harini = TransaksiKeuntungan::on('mysql7') + ->selectRaw('COUNT(*) as bil, SUM(bayaran_pembiayaan) AS total') + ->whereIn('norujukan', $ansuran3harini) + ->whereDate('tarikh_bayaran', '>=', $this->startDate) + ->whereDate('tarikh_bayaran', '<=', $this->endDate) + ->where('kodcaw', $this->kodCawangan) + ->get(); + + ##push in array## + $arrayans1 = ['bil' => $transaksi1[0]->bil, 'pinj' => $transaksi1[0]->total]; + $arrayharinians1 = ['bil' => $transaksi1harini[0]->bil, 'pinj' => $transaksi1harini[0]->total]; + $arrayans2 = ['bil' => $transaksi2[0]->bil, 'pinj' => $transaksi2[0]->total]; + $arrayharinians2 = ['bil' => $transaksi2harini[0]->bil, 'pinj' => $transaksi2harini[0]->total]; + $arrayans3 = ['bil' => $transaksi3[0]->bil, 'pinj' => $transaksi3[0]->total]; + $arrayharinians3 = ['bil' => $transaksi3harini[0]->bil, 'pinj' => $transaksi3harini[0]->total]; + + /*hapus kira*/ + + $hapuskira1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'H') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $hapuskira2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'H') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $hapuskira3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'H') + ->where(function ($query) { + $query->where('t_update', '<', $this->startDate) + ->orWhereNull('t_update'); + }) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + $hapuskiraini1 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'H') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 1) + ->where('nilaimarhun', '<=', 400.99) + ->get(); + + $hapuskiraini2 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'H') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 401) + ->where('nilaimarhun', '<=', 2000.99) + ->get(); + + $hapuskiraini3 = Gadai::on($cawangan['mysql']) + ->selectRaw('COUNT(norujukan) AS bil, SUM(pinjaman) AS pinj') + ->where('sttebus', 'H') + ->where('t_update', '>=', $this->startDate)->where('t_update', '<=', $this->endDate) + ->where('tagpalsu', 0) + ->where('nilaimarhun', '>=', 2001) + ->where('nilaimarhun', '<=', 1000000) + ->get(); + + array_push($array_kawalanstok, ["gadai1" => $gadai1, "gadai2" => $gadai2, "gadai3" => $gadai3, "gadaiini1" => $gadaiini1, "gadaiini2" => $gadaiini2, "gadaiini3" => $gadaiini3]); + array_push($array_kawalanstok, ["tebus1" => $tebus1, "tebus2" => $tebus2, "tebus3" => $tebus3, "tebusini1" => $tebusini1, "tebusini2" => $tebusini2, "tebusini3" => $tebusini3]); + array_push($array_kawalanstok, ["lelong1" => $lelong1, "lelong2" => $lelong2, "lelong3" => $lelong3, "lelongini1" => $lelongini1, "lelongini2" => $lelongini2, "lelongini3" => $lelongini3]); + array_push($array_kawalanstok, ["hapuskira1" => $hapuskira1, "hapuskira2" => $hapuskira2, "hapuskira3" => $hapuskira3, "hapuskiraini1" => $hapuskiraini1, "hapuskiraini2" => $hapuskiraini2, "hapuskiraini3" => $hapuskiraini3]); + array_push($array_kawalanstok, ["ans1" => $arrayans1, "ans2" => $arrayans2, "ans3" => $arrayans3, "ansini1" => $arrayharinians1, "ansini2" => $arrayharinians2, "ansini3" => $arrayharinians3]); + return response()->json($array_kawalanstok); + + + } + +} diff --git a/app/Services/Reports/OnePercentService.php b/app/Services/Reports/OnePercentService.php index a937433..f0f12ea 100644 --- a/app/Services/Reports/OnePercentService.php +++ b/app/Services/Reports/OnePercentService.php @@ -23,7 +23,7 @@ class OnePercentService public function getTotalRounded($type='B',$start = '2023-12-14',$end = '2023-12-14'){ - if($type == 'B'){ + if($type == 'B'){ $rounded = TransaksiKeuntungan::on('mysql7') ->leftJoin('transaction as trans', function($join) { @@ -37,19 +37,19 @@ class OnePercentService $rounded = TransaksiKeuntungan::on('mysql7') ->whereDate('tarikh_bayaran','>=',$start) ->whereDate('tarikh_bayaran','<=',$end) - ->sum('rounded');; + ->sum('rounded');; } return $rounded; } - public function getTotalKeuntungan($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ + public function getTotalKeuntungan($type = 'B',$start = '2023-12-14',$end = '2023-12-14') : Float{ if($type == 'B'){ $akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1]])->sum('tunggakanonepercent'); $norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan'); - + $keuntungan = TransaksiKeuntungan::on('mysql7') ->whereIn('norujukan',$norujukan) ->sum('onepercent_rebet'); @@ -99,5 +99,5 @@ class OnePercentService return $totalujrah; } - + } diff --git a/app/Services/Reports/RingkasanHarianService.php b/app/Services/Reports/RingkasanHarianService.php new file mode 100644 index 0000000..e502698 --- /dev/null +++ b/app/Services/Reports/RingkasanHarianService.php @@ -0,0 +1,963 @@ +kodCawangan = $kodCawangan; + $this->connectionCawangan = Cawangan::on('mysql7')->where('kodcaw', $kodCawangan)->first()->mysql; + $this->startDate = $request->startDate; + $this->endDate = $request->endDate; + } + + public function getLaporanCawangan() + { + + $laporan_harian = []; + + $total_gadai = Gadai::on($this->connectionCawangan)->whereDate('t_gadai', '>=', $this->startDate)->whereDate('t_gadai', '<=', $this->endDate)->sum('pinjaman'); + $bayaranonline = $this->getSumBayaranOnline(); + $bilbayaranonline = $this->getTotalBayaranOnline(); + $total_ansuran = $this->getSumAnsuranNotOnline(); + $total_ansuranonline = $this->getSumAnsuranOnline(); + $bilangan_gadai = Gadai::on($this->connectionCawangan)->whereDate('t_gadai', '>=', $this->startDate)->whereDate('t_gadai', '<=', $this->endDate)->where('pinjaman', '>', 0)->count(); + $bilangan_tebus = Tebus::on($this->connectionCawangan)->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate)->count(); + $bilangan_ansuran = $this->getTotalAnsuranNotOnline(); + $bilangan_ansuranonline = $this->getTotalAnsuranOnline(); + $bilangan_customer_baru = $this->getBilanganCustomerBaru(); + $bayar_baki_lelong = $this->getBayarBakiLelong(); + $bayar_rugi_lelong = $this->getBayarRugiLelong(); + $gadai_70 = $this->getGadaiSumPinjamanPercentLessThan(70); + $gadai_75 = $this->getGadaiSumPinjamanPercentRange(70, 75); + $gadai_80 = $this->getGadaiSumPinjamanPercentRange(75, 80); + $total_gadaian = floatval($gadai_70) + floatval($gadai_75) + floatval($gadai_80); + $nilaimarhun_70 = $this->getGadaiSumNilaiMarhunPercentLessThan(70); + $nilaimarhun_75 = $this->getGadaiSumNilaiMarhunPercentRange(70, 75); + $nilaimarhun_80 = $this->getGadaiSumNilaiMarhunPercentRange(75, 80); + $total_nm = floatval($nilaimarhun_70) + floatval($nilaimarhun_75) + floatval($nilaimarhun_80); + $bilangan_70 = $this->getGadaiCountPercentLessThan(70); + $bilangan_75 = $this->getGadaiCountPercentRange(70, 75); + $bilangan_80 = $this->getGadaiCountPercentRange(75, 80); + $total_bilangan = floatval($bilangan_70) + floatval($bilangan_75) + floatval($bilangan_80); + $panjar_harian = Panjar::on($this->connectionCawangan)->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate)->sum('bayaran'); + $panjar_bulanan = $this->getPanjarBulanan(); + $panjar_tahunan = $this->getPanjarTahunan(); + $bilangan_lelong = Lelong::on($this->connectionCawangan)->whereDate('t_jual', '>=', $this->startDate)->whereDate('t_jual', '<=', $this->endDate)->count(); + $data_lelong = $this->getDataLelong(); + $cas_lelong = $data_lelong['cas_lelong']; + $jumlah_lelong = $data_lelong['jumlah_lelong']; + $baki_lelong = $data_lelong['baki_lelong']; + $rugi_lelong = $data_lelong['rugi_lelong']; + $total_keuntungan_kaunter = $this->getTotalKeuntunganKaunter(); + $total_keuntungan_online = $this->getTotalKeuntunganOnline(); + $total_bayaran_online = $this->getTotalSumBayaranOnline(); + $bil_total_bayaran_online = $this->getBilTotalBayaranOnline(); + $petibesi_sistem = Vault::on($this->connectionCawangan)->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate)->sum('bakiakhir'); + $petibesi_deno = Denominasi::on($this->connectionCawangan)->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate)->sum('txtjumlah'); + $total_stok_audit = $this->getTotalStokAudit(); + $stokauditpembiayaan = $total_stok_audit['stokAuditPembiayaan']; + $stokauditnilaimarhun = $total_stok_audit['stokAuditNilaiMarhun']; + $stokauditcount = $total_stok_audit['stokAuditCount']; + $petibesiimbangduga = $this->getPetiBesiImbangDuga(); + $outstandingimbangduga = $this->getOutstandingImbangDuga(); + $rekodpinj = $this->getRekodKoopSumPinjaman(); + $rekodpinjnm = $this->getRekodKoopSumNilaiMarhun(); + $rekodpinjbil = $this->getRekodKoopCount(); + $totalpenebusan = $this->getTotalPenebusan(); + $rekodtawarruq = $this->getPinjamanRekodTawarruq(); + $rekodtawarruqnilaimarhun = $this->getNilaiMarhunRekodTawarruq(); + $rekodtawarruqbil = $this->getBilanganRekodTawarruq(); + $bayaranpendahuluan = $this->getBayaranPendahuluan(); + $upahsimpankaunter = $this->getUpahSimpanKaunter(); + $keuntungansebenarkaunter = $this->getKeuntunganSebenarKaunter(); + $serahanbayaranOnline = $this->getSerahanBayaranOnline(); + $totalSerahan = $this->getTotalSerahan(); + $totalPendahuluan = $this->getTotalPendahuluan(); + + array_push($laporan_harian, [ + 'total_gadai' => $total_gadai, + 'total_tebus' => $totalpenebusan, + 'total_ansuran' => $total_ansuran, + 'total_ansuranonline' => $total_ansuranonline, + 'bilangan_gadai' => $bilangan_gadai, + 'bilangan_tebus' => $bilangan_tebus, + 'bilangan_ansuran' => $bilangan_ansuran, + 'bilangan_ansuranonline' => $bilangan_ansuranonline, + 'bilangan_customer_baru' => $bilangan_customer_baru, + 'bayar_baki_lelong' => $bayar_baki_lelong, + 'bayar_rugi_lelong' => $bayar_rugi_lelong, + 'gadai_70' => $gadai_70, + 'gadai_75' => $gadai_75, + 'gadai_80' => $gadai_80, + 'total_gadaian' => $total_gadaian, + 'nilaimarhun_70' => $nilaimarhun_70, + 'nilaimarhun_75' => $nilaimarhun_75, + 'nilaimarhun_80' => $nilaimarhun_80, + 'total_nm' => $total_nm, + 'bilangan_70' => $bilangan_70, + 'bilangan_75' => $bilangan_75, + 'bilangan_80' => $bilangan_80, + 'total_bilangan' => $total_bilangan, + 'panjar_harian' => $panjar_harian, + 'panjar_bulanan' => $panjar_bulanan, + 'panjar_tahunan' => $panjar_tahunan, + 'bilangan_lelong' => $bilangan_lelong, + 'cas_lelong' => $cas_lelong, + 'jumlah_lelong' => $jumlah_lelong, + 'baki_lelong' => $baki_lelong, + 'rugi_lelong' => $rugi_lelong, + 'total_keuntungan_kaunter' => $total_keuntungan_kaunter, + 'total_keuntungan_online' => $total_keuntungan_online, + 'totalbayaranonline' => $total_bayaran_online, + 'biltotalbayaranonline' => $bil_total_bayaran_online, + 'petibesi_sistem' => $petibesi_sistem, + 'petibesi_deno' => $petibesi_deno, + 'stokauditpembiayaan' => $stokauditpembiayaan, + 'stokauditnilaimarhun' => $stokauditnilaimarhun, + 'stokauditcount' => $stokauditcount, + 'petibesiimbangduga' => $petibesiimbangduga, + 'outstandingimbangduga' => $outstandingimbangduga, + 'rekodpinj' => $rekodpinj, + 'rekodpinjnm' => $rekodpinjnm, + 'rekodpinjbil' => $rekodpinjbil, + 'rekodpemb' => $rekodtawarruq, + 'rekodpembnm' => $rekodtawarruqnilaimarhun, + 'rekodpembbil' => $rekodtawarruqbil, + 'bayaranpend' => $bayaranpendahuluan, + 'upahsimpankaunter' => $upahsimpankaunter, + 'keuntungansebenarkaunter' => $keuntungansebenarkaunter, + 'totalserahan' => $totalSerahan, + 'serahanbayaranOnline' => $serahanbayaranOnline, + 'totalpendahuluan' => $totalPendahuluan, + ]); + + return response()->json($laporan_harian); + } + + private function getTotalPenebusan() + { + $tebus = Tebus::on($this->connectionCawangan) + ->select('tebus.t_tebus', 'gad.t_gadai', 'gad.hargajualan', 'gad.bakihargajualan', 'gad.bakipjm as gadaibakipjm', 'tebus.nilaimarhun', 'tebus.tagterima', 'tebus.teller', 'tebus.jenistebus', 'tebus.pinjaman', 'tebus.bakiupah', 'tebus.bakipjm', 'gad.norujukan', 'gad.nokp', 'tebus.jbg') + ->join('gadai as gad', 'gad.norujukan', '=', 'tebus.norujukan') + ->whereDate('tebus.t_tebus', '>=', $this->startDate)->whereDate('tebus.t_tebus', '<=', $this->endDate) + ->get(); + + $pembiayaanlelong = Lelong::on($this->connectionCawangan) + ->whereDate('t_jual', '>=', $this->startDate)->whereDate('t_jual', '<=', $this->endDate) + ->sum('pinjaman'); + + $totalpenebusan = 0; + + foreach ($tebus as $index1 => $teb) { + if ($teb['gad.hargajualan'] != $teb['bakihargajualan']) { + $totalpenebusan += $teb['gadaibakipjm']; + } else { + $totalpenebusan += $teb['pinjaman']; + } + } + + //Lelongan Pembiayaan + return $totalpenebusan += $pembiayaanlelong; + } + + private function getAnsuranQuery() + { + $sum_ansuran_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereRaw('DATE(transaksi_keuntungan.tarikh_bayaran) >= ?', [$this->startDate]) + ->whereRaw('DATE(transaksi_keuntungan.tarikh_bayaran) <= ?', [$this->endDate]) + ->where([['trans.trans_type', '=', 'A'], ['trans.kodcaw', '=', $this->kodCawangan]]); + + return $sum_ansuran_query; + + } + + private function getSumAnsuranOnline() + { + $sum_ansuran = $this->getAnsuranQuery($this->kodCawangan) + ->where('teller', '=', 'online') + ->sum('transaksi_keuntungan.bayaran_pembiayaan'); + + return $sum_ansuran; + } + + private function getTotalAnsuranOnline() + { + $sum_ansuran = $this->getAnsuranQuery($this->kodCawangan) + ->where('teller', '=', 'online') + ->count(); + + return $sum_ansuran; + } + + private function getSumAnsuranNotOnline() + { + $sum_ansuran = $this->getAnsuranQuery($this->kodCawangan) + ->where('teller', '<>', 'online') + ->sum('transaksi_keuntungan.bayaran_pembiayaan'); + + return $sum_ansuran; + } + + private function getTotalAnsuranNotOnline() + { + $sum_ansuran = $this->getAnsuranQuery($this->kodCawangan) + ->where('teller', '<>', 'online') + ->count(); + + return $sum_ansuran; + } + + private function getBilanganCustomerBaru() + { + $totalCustomer = Customer::on('mysql7')->where([ + ['tarikhdaftar', '>=', $this->startDate], + ['tarikhdaftar', '<=', $this->endDate], + ['kodcaw', $this->kodCawangan], + ])->count(); + + return $totalCustomer; + + } + + private function getBayarRugiLelong() + { + $bayarRugiLelong = TuntutBaki::on($this->connectionCawangan) + ->whereDate('tarikh', '>=', $this->startDate) + ->whereDate('tarikh', '<=', $this->endDate) + ->where('jumlah', '<', 0) + ->sum('jumlah'); + + return $bayarRugiLelong; + } + + private function getBayarBakiLelong() + { + $bayarBakiLelong = TuntutBaki::on($this->connectionCawangan) + ->whereDate('tarikh', '>=', $this->startDate) + ->whereDate('tarikh', '<=', $this->endDate) + ->where('jumlah', '>', 0) + ->sum('jumlah'); + + return $bayarBakiLelong; + } + + private function getBayaranOnlineQuery() + { + $bayaranOnlineQuery = Transaction::on('mysql7') + ->whereDate('created_at', '>=', $this->startDate) + ->whereDate('created_at', '<=', $this->endDate) + ->where('teller', '=', 'Online') + ->where('kodcaw', $this->kodCawangan); + + return $bayaranOnlineQuery; + } + + private function getSumBayaranOnline() + { + return $this->getBayaranOnlineQuery($this->kodCawangan)->sum('duit_masuk'); + } + + private function getTotalBayaranOnline() + { + return $this->getBayaranOnlineQuery($this->kodCawangan)->count(); + } + + private function getGadaiPercentLessThan($percentage) + { + return Gadai::on($this->connectionCawangan) + ->where([ + ['t_gadai', '>=', $this->startDate], + ['t_gadai', '<=', $this->endDate], + ['percentpinj', '<=', $percentage], + ]); + } + + private function getGadaiSumPinjamanPercentLessThan($percentage) + { + return $this->getGadaiPercentLessThan($percentage)->sum('pinjaman'); + } + + private function getGadaiPercentRange($percentage_from, $percentage_to) + { + return Gadai::on($this->connectionCawangan) + ->where([ + ['t_gadai', '>=', $this->startDate], + ['t_gadai', '<=', $this->endDate], + ['percentpinj', '>', $percentage_from], + ['percentpinj', '<=', $percentage_to], + ]); + } + + private function getGadaiSumPinjamanPercentRange($percentage_from, $percentage_to) + { + return $this->getGadaiPercentRange($percentage_from, $percentage_to)->sum('pinjaman'); + } + + private function getGadaiSumNilaiMarhunPercentLessThan($percentage) + { + return $this->getGadaiPercentLessThan($percentage)->sum('nilaimarhun'); + } + + private function getGadaiSumNilaiMarhunPercentRange($percentage_from, $percentage_to) + { + return $this->getGadaiPercentRange($percentage_from, $percentage_to)->sum('nilaimarhun'); + } + + private function getGadaiCountPercentLessThan($percentage) + { + return $this->getGadaiPercentLessThan($percentage)->count(); + } + + private function getGadaiCountPercentRange($percentage_from, $percentage_to) + { + return $this->getGadaiPercentRange($percentage_from, $percentage_to)->count(); + } + + private function getDataLelong() + { + + $data_lelong_query = Lelong::on($this->connectionCawangan)->whereDate('t_jual', '>=', $this->startDate)->whereDate('t_jual', '<=', $this->endDate); + + $data_lelong_untung = (clone $data_lelong_query)->where('baki', '>=', 0) + ->selectRaw(' + sum(cajlelong) as cajLelong, + sum(hargajual) as jumlahLelong, + sum(baki) as bakiLelong + ') + ->first(); + + $data_lelong_rugi = (clone $data_lelong_query)->where('baki', '<', 0) + ->selectRaw(' + sum(cajlelong) as cajLelong, + sum(hargajual) as jumlahLelong, + abs(sum(baki)) as rugiLelong + ') + ->first(); + + + return [ + 'cas_lelong' => $data_lelong_untung->cajLelong + $data_lelong_rugi->cajLelong, + 'jumlah_lelong' => $data_lelong_untung->jumlahLelong + $data_lelong_rugi->jumlahLelong, + 'baki_lelong' => $data_lelong_untung->bakiLelong ?? 0, + 'rugi_lelong' => $data_lelong_rugi->rugiLelong ?? 0, + ]; + + } + + private function getTotalKeuntunganOnline() + { + $total_keuntunganansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->whereIn('trans.norujukan', $gadaiDataOnline) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganansuran_online = $keuntunganansuran_online_query->sum('bayaran_keuntungan'); + + $total_keuntunganbukanansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '=', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganbukanansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganbukanansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataOnline) + ->whereDate('tarikh_bayaran', '>=', $this->startDate)->whereDate('tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganbukanansuran_online = $keuntunganbukanansuran_online_query->sum('keuntungan_rebet'); + + $keuntungansebenaronline = $total_keuntunganansuran_online + $total_keuntunganbukanansuran_online; + + $upahansurOnlineQuery = Advansur::on($this->connectionCawangan) + ->where('teller', '=', 'Online') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate); + + $upahansurOnline = $upahansurOnlineQuery->sum('upahdibayar'); + + $upahsimpanonline = $upahansurOnline; + $total_keuntungan_online = floatval($upahsimpanonline) + floatval($keuntungansebenaronline); + + return floatval($total_keuntungan_online); + + } + + private function getTotalKeuntunganKaunter() + { + $total_keuntunganansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->whereIn('trans.norujukan', $gadaiDataOnline) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganansuran_online = $keuntunganansuran_online_query->sum('bayaran_keuntungan'); + + $total_keuntunganbukanansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '=', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganbukanansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganbukanansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataOnline) + ->whereDate('tarikh_bayaran', '>=', $this->startDate)->whereDate('tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganbukanansuran_online = $keuntunganbukanansuran_online_query->sum('keuntungan_rebet'); + + $keuntungansebenaronline = $total_keuntunganansuran_online + $total_keuntunganbukanansuran_online; + + $upahSimpanKaunter = $this->getUpahSimpanKaunter(); + $keuntunganSebenar = $this->getKeuntunganSebenarKaunter(); + $totalKeuntunganSebenar = $upahSimpanKaunter + $keuntunganSebenar; + + return floatval($totalKeuntunganSebenar); + } + + private function getUpahAnsurOnlineQuery() + { + $upahansurOnlineQuery = Advansur::on($this->connectionCawangan) + ->where('teller', '=', 'Online') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate); + + return $upahansurOnlineQuery; + + } + + private function getUpahAnsuranOnline() + { + $upahansurOnline = $this->getUpahAnsurOnlineQuery()->sum('upahdibayar'); + return floatval($upahansurOnline); + } + + private function getUpahAnsuranOnlineTotal() + { + return $this->getUpahAnsurOnlineQuery()->count(); + } + + private function getTotalSumBayaranOnline() + { + $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $this->kodCawangan); + return floatval($this->getSumBayaranOnline($this->kodCawangan)) + floatval($this->getUpahAnsuranOnline()); + } + + private function getTotalStokAudit() + { + + $stokaudit = Gadai::on($this->connectionCawangan) + ->where(function ($query) { + $query->where('tagpalsu', '=', 0) + ->where([['t_gadai', '<=', $this->endDate], ['sttebus', '=', '']]) + ->orWhere([['t_update', '>', $this->startDate], ['sttebus', '!=', ''], ['t_gadai', '<=', $this->endDate]]); + }); + + $stokauditnilaimarhun = (clone $stokaudit)->sum('nilaimarhun'); + $stokauditcount = (clone $stokaudit)->count(); + + $totalstokaudit_from_pinjaman = (clone $stokaudit)->whereNull('hargajualan') + ->sum('pinjaman'); + + $totalstokaudit_from_baki_pinjaman = (clone $stokaudit)->whereNotNull('hargajualan') + ->sum('bakipjm'); + + return [ + 'stokAuditPembiayaan' => $totalstokaudit_from_pinjaman + $totalstokaudit_from_baki_pinjaman, + 'stokAuditNilaiMarhun' => $stokauditnilaimarhun, + 'stokAuditCount' => $stokauditcount, + ]; + } + + private function getPetiBesiImbangDuga() + { + + $totalbakiakhirtunai = 0; + + $vault = Vault::on($this->connectionCawangan) + ->where('kodcaw', '=', $this->kodCawangan) + ->where('tarikh', '<=', $this->endDate) + ->orderby('tarikh', 'desc')->first(); + + $tunai = Tunai::on($this->connectionCawangan) + ->where('kodcaw', '=', $this->kodCawangan) + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate); + + $total = $tunai->sum('baki'); + + $totalBakiAkhirTunai = $vault['bakiakhir']; + + if ($total != 0) { + $totalBakiAkhirTunai = $vault['bakiakhir'] + $total; + } + + return $totalBakiAkhirTunai; + } + + private function getTarikhTawarruq() + { + + $tarikhTawarruq = [ + 'KB2' => '2021-04-13', + 'WCY' => '2021-05-04', + '1STOP' => '2021-05-09', + '020301' => '2021-05-18', + 'ALS' => '2021-05-24', + 'WB' => '2021-05-24', + 'APM' => '2021-06-08', + 'ARM' => '2021-06-08', + '020306' => '2021-06-08', + '010311' => '2021-06-13', + 'GC' => '2021-06-13', + 'JLI' => '2021-06-13', + '010621' => '2021-06-15', + 'ARP' => '2021-06-15', + '010621' => '2021-06-21', + '010136' => '2021-06-20', + '011235' => '2021-06-21', + '011227' => '2021-06-21', + '010620' => '2021-06-21', + '010617' => '2021-06-21', + '010915' => '2021-06-22', + '011228' => '2021-06-22', + '010219' => '2021-06-22', + '011229' => '2021-06-22', + '011230' => '2021-06-23', + '011013' => '2021-06-23', + '011412' => '2021-06-23', + '011234' => '2021-06-28', + '020303' => '2021-06-29', + '010618' => '2021-06-29', + '011231' => '2021-06-23', + '011232' => '2021-06-28', + '011233' => '2021-06-28', + ]; + + return $tarikhTawarruq[Str::upper($this->kodCawangan)]; + } + + private function getOutstandingImbangDuga() + { + $rekodKoop = $this->getRekodKoopSumPinjaman(); + $rekodTawarruq = $this->getPinjamanRekodTawarruq(); + $bayaranPendahuluan = $this->getBayaranPendahuluan(); + + $outstandingImbangDuga = $rekodKoop + $rekodTawarruq - $bayaranPendahuluan; + + return $outstandingImbangDuga; + } + + private function getRekodKoopQuery() + { + $tarikhTawarruq = $this->getTarikhTawarruq(); + $rekodkoopquery = Gadai::on($this->connectionCawangan) + ->where('tagpalsu', '=', 0) + ->where([['t_gadai', '<=', $tarikhTawarruq], ['sttebus', '=', '']]) + ->orWhere([['sttebus', '!=', ''], ['t_update', '>', $this->endDate], ['t_gadai', '<=', $tarikhTawarruq]]); + + return $rekodkoopquery; + } + + private function getRekodKoopSumPinjaman() + { + return floatval($this->getRekodKoopQuery()->sum('pinjaman')); + + } + + private function getRekodKoopSumNilaiMarhun() + { + return floatval($this->getRekodKoopQuery()->sum('nilaimarhun')); + } + + private function getRekodKoopCount() + { + return floatval($this->getRekodKoopQuery()->count()); + } + + private function getRekodTawarruqQuery() + { + + $rekodtawarruqquery = Gadai::on($this->connectionCawangan) + ->where('tagpalsu', '=', 0) + ->where([['t_gadai', '<=', $this->startDate], ['hargajualan', '<>', 'NULL'], ['sttebus', '=', '']]) + ->orWhere([['t_update', '>', $this->endDate], ['sttebus', '!=', ''], ['t_gadai', '<=', $this->startDate], ['hargajualan', '<>', 'null']]); + + return $rekodtawarruqquery; + } + + private function getPinjamanRekodTawarruq() + { + if ($this->startDate < '2021-04-13') { + return null; + } + + $rekodtawarruq = $this->getRekodTawarruqQuery()->sum('pinjaman'); + return floatval($rekodtawarruq); + } + + private function getNilaiMarhunRekodTawarruq() + { + $rekodtawarruqnilaimarhun = $this->getRekodTawarruqQuery()->sum('nilaimarhun'); + return floatval($rekodtawarruqnilaimarhun); + } + + private function getBilanganRekodTawarruq() + { + $rekodtawarruqbil = $this->getRekodTawarruqQuery()->count(); + return floatval($rekodtawarruqbil); + } + + private function getBayaranPendahuluan() + { + $daterequest = new Carbon($this->startDate); + $daterequest->addDays(1); + + $bayaranpendahuluan_data = TransaksiKeuntungan::on('mysql7') + ->where('tarikh_bayaran', '<=', $daterequest) + ->where('kodcaw', $this->kodCawangan) + ->pluck('norujukan'); + + $gadaiData = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $bayaranpendahuluan_data) + ->where([['sttebus', ''], ['hargajualan', '<>', 'null']]) + ->orWhere([['sttebus', '!=', ''], ['t_update', '>', $this->endDate], ['hargajualan', '<>', 'null']]) + ->pluck('norujukan'); + + $bayaranpendahuluan = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiData) + ->where('tarikh_bayaran', '<=', $daterequest) + ->sum('bayaran_pembiayaan'); + + return floatval($bayaranpendahuluan); + } + + private function getUpahSimpanKaunter() + { + $keuntungan_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate) + ->where('trans.teller', '<>', 'Online') + + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataKaunter = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $keuntungan_data_kaunter)->whereNull('hargajualan')->pluck('norujukan'); + + $keuntungan_kaunter_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataKaunter); + + $keuntungan_kaunter = $keuntungan_kaunter_query->sum('bayaran_keuntungan'); + + $upahtebus = Tebus::on($this->connectionCawangan) + ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) + ->sum('upahdibayar'); + + $upahlelong = Lelong::on($this->connectionCawangan) + ->whereDate('t_jual', '>=', $this->startDate)->whereDate('t_jual', '<=', $this->endDate) + ->sum('bakiupah'); + + $upahansurKaunter = Advansur::on($this->connectionCawangan) + ->where('teller', '<>', 'Online') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate) + ->sum('upahdibayar'); + + $total_keuntunganbukanansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '<>', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan); + + $total_keuntunganbukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('keuntungan_rebet'); + + $upahsimpankaunter = $keuntungan_kaunter + $upahtebus + $upahlelong + $upahansurKaunter + $total_keuntunganbukanansuran_kaunter; + + return floatval($upahsimpankaunter); + } + + private function getKeuntunganSebenarKaunter() + { + $total_keuntunganansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '<>', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataKaunter = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganansuran_kaunter_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.teller', '<>', 'Online') + ->where('trans.trans_type', '=', 'A') + ->whereIn('transaksi_keuntungan.norujukan', $gadaiDataKaunter) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganansuran_kaunter = $keuntunganansuran_kaunter_query->sum('bayaran_keuntungan'); + + $keuntungansebenarkaunter = $total_keuntunganansuran_kaunter; + + return floatval($keuntungansebenarkaunter); + } + + public function getSerahanBayaranOnline() + { + $serahanpkb = '1000/020'; + + $serahanbayaranOnline = GlDetail::on($this->connectionCawangan) + ->where('ktacct', '=', $serahanpkb) + ->where('descpt', 'like', 'SERAHAN BAYAR ONLINE%') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate) + ->where('tarikh', '>', '2021-03-24') + ->sum('serahan'); + + return floatval($serahanbayaranOnline); + + } + + private function getTotalSerahan() + { + + $serahanpkb = '1000/020'; + $serahanjmc = '1000/026'; + + $serahanpkbTawarruq = GlDetail::on($this->connectionCawangan) + ->where('ktacct', '=', $serahanpkb) + ->where('descpt', 'not like', 'SERAHAN BAYAR ONLINE%') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate) + ->where('tarikh', '>', '2021-03-24') + ->sum('serahan'); + + $specificCawangan = [ + 'KB2', + 'WCY', + '1STOP', + 'ARM', + 'APM', + '010621', + '010915', + ]; + + $kodCawangan = strtoupper($this->kodCawangan); + + if (in_array($kodCawangan, $specificCawangan)) { + + $tarikhMulaTawarruq = '2013-12-31'; + + $serahanpkb = GlDetail::on($this->connectionCawangan) + ->where('dtacct', '=', $serahanpkb) + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate) + ->where('tarikh', '>', $tarikhMulaTawarruq) + ->sum('amaun'); + + $serahanJMC = GlDetail::on($this->connectionCawangan) + ->where('dtacct', '=', $serahanjmc) + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate) + ->where('tarikh', '>', $tarikhMulaTawarruq) + ->sum('amaun'); + + if ($this->startDate <= $tarikhMulaTawarruq) { + $serahanpkblama = imbangdugalama::on($this->connectionCawangan) + ->sum('serahan_pkb'); + + $serahanjmclama = imbangdugalama::on($this->connectionCawangan) + ->sum('serahan_jmc'); + + $totaljmc = $serahanJMC + $serahanjmclama; + $totalpkb = $serahanpkb + $serahanpkblama; + + $totalserahan = $serahanpkbTawarruq + $totaljmc + $totalpkb; + + } else { + + $totalSerahan = $serahanpkbTawarruq + $serahanJMC + $serahanpkb; + } + + return floatval($totalSerahan); + } + + return floatval(0); + + } + + private function getTotalPendahuluan() + { + $pendahuluanpkb = '7000/102'; + + $pendahuluanPKBtawarruq = GlDetail::on($this->connectionCawangan) + ->where('ktacct', '=', $pendahuluanpkb) + ->where([['tarikh', '=', $this->startDate], ['tarikh', '>', '2021-03-24']]) + ->sum('pendahuluan'); + + $pendahuluanPKB = GlDetail::on($this->connectionCawangan) + ->where('ktacct', '=', $pendahuluanpkb) + ->where([['tarikh', '=', $this->startDate], ['tarikh', '>', '2013-12-31']]) + ->sum('amaun'); + + $pendahuluanJMC = GlDetail::on($this->connectionCawangan) + ->where('ktacct', '=', '7000/106') + ->where([['tarikh', '=', $this->startDate], ['tarikh', '>', '2013-12-31']]) + ->sum('amaun'); + + if ($this->startDate <= '2013-12-31') { + $pendahuluanpkblama = imbangdugalama::on($this->connectionCawangan) + ->sum('pendahuluan_pkb'); + + $pendahuluanjmclama = imbangdugalama::on($this->connectionCawangan) + ->sum('pendahuluan_jmc'); + + $totalpendahuluan = $pendahuluanPKBtawarruq + $pendahuluanjmclama + $pendahuluanpkblama + $pendahuluanPKB + $pendahuluanJMC; + + } else { + + $totalpendahuluan = $pendahuluanPKBtawarruq + $pendahuluanPKB + $pendahuluanJMC; + } + + return floatval($totalpendahuluan); + + } + + function getBilTotalBayaranOnline() + { + + $bayaranonlinequery = Transaction::on('mysql7') + ->whereDate('created_at', '>=', $this->startDate) + ->whereDate('created_at', '<=', $this->endDate) + ->where('teller', '=', 'Online')->where('kodcaw', $this->kodCawangan); + + $bilbayaranonline = $bayaranonlinequery->count(); + + $upahansurOnlineQuery = Advansur::on($this->connectionCawangan) + ->where('teller', '=', 'Online') + ->whereDate('tarikh', '>=', $this->startDate) + ->whereDate('tarikh', '<=', $this->endDate); + + $bilupahansurOnline = $upahansurOnlineQuery->count(); + + $biltotalbayaranonline = $bilbayaranonline + $bilupahansurOnline; + + return $biltotalbayaranonline; + } + + private function getPanjarBulanan() + { + $getFirstDayOfMonthByDate = function ($date) { + return Carbon::parse($date)->firstOfMonth(); + }; + + // range start from first day of month of startDate to endDate + $panjar = Panjar::on($this->connectionCawangan) + ->where([ + ['tarikh', '>=', $getFirstDayOfMonthByDate($this->startDate)], + ['tarikh', '<=', $this->endDate], + ]) + ->sum('bayaran'); + + return $panjar; + } + + private function getPanjarTahunan() + { + $getFirstDayOfYearByDate = function ($date) { + return Carbon::parse($date)->firstOfYear(); + }; + + // range start from first day of year of startDate to endDate + $panjar = Panjar::on($this->connectionCawangan) + ->where([ + ['tarikh', '<=', $this->endDate], + ['tarikh', '>=', $getFirstDayOfYearByDate($this->startDate)], + ]) + ->sum('bayaran'); + + return $panjar; + } +} diff --git a/routes/report.php b/routes/report.php index 2ceea39..5fab083 100644 --- a/routes/report.php +++ b/routes/report.php @@ -1,13 +1,25 @@ group(['prefix'=>'api/reports'], function () use ($router){ $router->group(['namespace' => 'Reports'], function() use($router){ +======= +$router->group(['prefix' => 'api/reports'], function () use ($router) { + $router->group(['namespace' => 'Reports'], function () use ($router) { +>>>>>>> 3ced9b3 (Add report ringkasan harian) $router->get('gadaian', ['uses' => 'GadaianController@getSummaryLaporanGadai']); $router->get('gadaian/{kod_cawangan}', ['uses' => 'GadaianController@getLaporanCawangan']); $router->get('penebusan', ['uses' => 'PenebusanController@getSummaryLaporanTebus']); $router->get('penebusan/{kod_cawangan}', ['uses' => 'PenebusanController@getLaporanCawangan']); $router->get('ansuran', ['uses' => 'AnsuranController@getSummaryLaporanAnsuran']); $router->get('ansuran/{kod_cawangan}', ['uses' => 'AnsuranController@getLaporanCawangan']); +<<<<<<< HEAD +======= + $router->get('kawalan-stok/{kod_cawangan}', ['uses' => 'KawalanStokController@getLaporanCawangan']); + $router->get('ringkasan-harian', ['uses' => 'RingkasanHarianController@getSummaryLaporanRingkasanHarian']); + $router->get('ringkasan-harian/{kod_cawangan}', ['uses' => 'RingkasanHarianController@getLaporanCawangan']); + +>>>>>>> 3ced9b3 (Add report ringkasan harian) $router->get('onepercent/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganImbangDuga']); $router->get('onepercent/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganLejerAm']); $router->get('ujrah/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getUjrahImbangDuga']); diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index 1bad6ef..010997a 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -14,6 +14,10 @@ class ExampleTest extends TestCase { $this->get('/'); + dump('test'); + + return; + $this->assertEquals( $this->app->version(), $this->response->getContent() ); diff --git a/tests/RingkasanHarianServicesTest.php b/tests/RingkasanHarianServicesTest.php new file mode 100644 index 0000000..84f687c --- /dev/null +++ b/tests/RingkasanHarianServicesTest.php @@ -0,0 +1,208 @@ +startDate = $this->startDate; + $request->endDate = $this->endDate; + $ringkasanHarianService = new RingkasanHarianService($this->kodCawangan, $request); + + $this->expectNotToPerformAssertions(); + return $ringkasanHarianService->generate(); + + } + + public function test_service_method_output_is_same_originated_method() + { + + $request = new Request; + $request->startDate = $this->startDate; + $request->endDate = $this->endDate; + $ringkasanHarianService = new RingkasanHarianService($this->kodCawangan, $request); + $outputService = $ringkasanHarianService->generate(); + + $request = new Request; + $request->tarikh = $this->startDate; + $request->kodcaw = $this->kodCawangan; + $outputOriginatedMethod = (new LaporanController)->laporanHarian($request); + + // Find divergent properties and values + $divergentProperties = []; + + $outputOriginatedMethod = $outputOriginatedMethod->getData()[0]; + $outputService = $outputService->getData()[0]; + + $this->show_diverged_changes($outputOriginatedMethod, $outputService); + + $this->assertEquals($outputOriginatedMethod, $outputService); + + } + + public function test_date_range_of_test_service_method_ouput_is_same_as_originated_method() + { + + // Properties are excluded because all property values from originated report are assummed to sum between 2 days. + // But these properties are already utilize range. So summing these property values will result in false output + $propertiesToBeExcludedFromTest = [ + 'panjar_bulanan', + 'panjar_tahunan', + 'stokauditpembiayaan', + 'stokauditnilaimarhun', + 'stokauditcount', + 'petibesiimbangduga', + 'outstandingimbangduga', + 'rekodpemb', + 'rekodpembnm', + 'rekodpembbil', + 'bayaranpend', + ]; + + $prepareReport = function($report) use($propertiesToBeExcludedFromTest){ + foreach ($propertiesToBeExcludedFromTest as $properties) { + unset($report->$properties); + } + + return $report; + }; + + $day1 = '2023-03-20'; + $day2 = '2023-03-21'; + $kodCawangan = $this->kodCawangan; + + $report1 = $this->get_2_days_report_from_originated_method($kodCawangan, $day1, $day2); + + $request = new Request; + $request->startDate = $day1; + $request->endDate = $day2; + $ringkasanHarianService = new RingkasanHarianService($kodCawangan, $request); + $outputService = $ringkasanHarianService->generate(); + $report2 = $this->convert_object_values_to_string($outputService->getData()[0]); + + $this->assertEquals($prepareReport($report1), $prepareReport($report2)); + + } + + public function show_diverged_changes($outputOriginatedMethod, $outputService) + { + + // Get properties dynamically from the first object + $properties = array_keys(get_object_vars($outputOriginatedMethod)); + + // Find divergent properties and values + $divergentProperties = []; + + foreach ($properties as $property) { + $value1 = $outputOriginatedMethod->$property; + $value2 = $outputService->$property; + + if ($value1 !== $value2) { + $divergentProperties[$property] = [ + 'value1' => $value1, + 'value2' => $value2, + ]; + } + } + + // Display divergent properties and values + if (!empty($divergentProperties)) { + dump("Divergent properties found:\n"); + foreach ($divergentProperties as $property => $values) { + + $value1 = in_array(gettype($values['value1']), ['integer', 'string']) ? $values['value1'] : json_encode($values['value1']); + $value2 = in_array(gettype($values['value2']), ['integer', 'string']) ? $values['value2'] : json_encode($values['value2']); + + dump("$property: outputOriginatedMethod : {$value1} vs serviceMethod : {$value2}\n"); + } + } + } + + private function get_2_days_report_from_originated_method($kodCawangan, $day1, $day2) + { + + $requestFirstDay = new Request; + $requestFirstDay->tarikh = $day1; + $requestFirstDay->kodcaw = $kodCawangan; + + $requestSecondDay = new Request; + $requestSecondDay->tarikh = $day2; + $requestSecondDay->kodcaw = $kodCawangan; + + $outputFirstDay = (new LaporanController)->laporanHarian($requestFirstDay)->getData()[0]; + $outputSecondDay = (new LaporanController)->laporanHarian($requestSecondDay)->getData()[0]; + + $sumDateRangeReportData = function ($report1, $report2) { + $floatingPointProperty = [ + 'total_gadai', + 'gadai_70', + 'gadai_75', + 'gadai_80', + 'nilaimarhun_70', + 'nilaimarhun_75', + 'nilaimarhun_80', + 'panjar_harian', + 'panjar_bulanan', + 'panjar_tahunan', + 'stokauditpembiayaan', + 'stokauditnilaimarhun', + 'stokauditcount', + 'petibesiimbangduga', + 'outstandingimbangduga', + 'rekodpemb', + 'rekodpembnm', + 'rekodpembil', + 'bayaranpend', + ]; + // Merge objects by summing corresponding values + $mergedReport = new stdClass(); + + foreach ($report1 as $key => $value) { + // Check if the property exists in the second object + if (property_exists($report2, $key)) { + // Sum the values and assign to the merged object + $sum = $value + $report2->$key; + $mergedReport->$key = in_array($key, $floatingPointProperty) ? floatval($sum) : $sum; + } + } + + return $mergedReport; + }; + + $sum = $sumDateRangeReportData($outputFirstDay, $outputSecondDay); + + return $this->convert_object_values_to_string($sum); + } + + private function convert_object_values_to_string($inputObject) { + // Check if the input is an object + if (!is_object($inputObject)) { + // Handle the case where the input is not an object + return $inputObject; + } + + // Create a new stdClass object to store the converted values + $convertedObject = new stdClass(); + + // Iterate through the properties of the input object + foreach ($inputObject as $key => $value) { + // Convert the value to string and assign it to the new object + $convertedObject->$key = number_format($value, 2); + } + + return $convertedObject; + } + +} From 9b611cbaf79fe4bb7b8300e89c41e7b7522cd2f8 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Fri, 29 Dec 2023 12:30:16 +0800 Subject: [PATCH 099/114] Resolve previous unresolved merge conflicts --- routes/report.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/routes/report.php b/routes/report.php index 5fab083..67353ed 100644 --- a/routes/report.php +++ b/routes/report.php @@ -1,25 +1,17 @@ group(['prefix'=>'api/reports'], function () use ($router){ - $router->group(['namespace' => 'Reports'], function() use($router){ -======= $router->group(['prefix' => 'api/reports'], function () use ($router) { $router->group(['namespace' => 'Reports'], function () use ($router) { ->>>>>>> 3ced9b3 (Add report ringkasan harian) $router->get('gadaian', ['uses' => 'GadaianController@getSummaryLaporanGadai']); $router->get('gadaian/{kod_cawangan}', ['uses' => 'GadaianController@getLaporanCawangan']); $router->get('penebusan', ['uses' => 'PenebusanController@getSummaryLaporanTebus']); $router->get('penebusan/{kod_cawangan}', ['uses' => 'PenebusanController@getLaporanCawangan']); $router->get('ansuran', ['uses' => 'AnsuranController@getSummaryLaporanAnsuran']); $router->get('ansuran/{kod_cawangan}', ['uses' => 'AnsuranController@getLaporanCawangan']); -<<<<<<< HEAD -======= $router->get('kawalan-stok/{kod_cawangan}', ['uses' => 'KawalanStokController@getLaporanCawangan']); $router->get('ringkasan-harian', ['uses' => 'RingkasanHarianController@getSummaryLaporanRingkasanHarian']); $router->get('ringkasan-harian/{kod_cawangan}', ['uses' => 'RingkasanHarianController@getLaporanCawangan']); ->>>>>>> 3ced9b3 (Add report ringkasan harian) $router->get('onepercent/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganImbangDuga']); $router->get('onepercent/ledger/{kod_cawangan}', ['uses' => 'OnePercentController@getKeuntunganLejerAm']); $router->get('ujrah/balance/{kod_cawangan}', ['uses' => 'OnePercentController@getUjrahImbangDuga']); From bc8f9a14e9a798fae505bac9e382ba7c425647e5 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 30 Dec 2023 14:23:59 +0800 Subject: [PATCH 100/114] fix imbangduga latest --- app/Http/Controllers/AdminPageController.php | 24 ++++++++++++++++++- app/Http/Controllers/GadaiController.php | 10 ++++---- app/Http/Controllers/TebusController.php | 4 +++- app/Support/v1/Penebusan.php | 2 +- app/Support/v2/GadaiV2.php | 3 +++ app/Support/v2/Penebusan.php | 18 ++++++++++---- ...1_104203_add_onepercent_to_tebus_table.php | 1 + 7 files changed, 50 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index 1d9c628..fa582e1 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3157,7 +3157,29 @@ class AdminPageController extends Controller ->where('margin_semasa','=',0) ->sum('bayaran_keuntungan'); - $total = $sum_keun_tebus + $sum_keun_ansuran; + + $sagbaru_norujukan = Gadai::on($cawangan['mysql']) + ->selectRaw("norujukan,CASE WHEN (YEAR(t_gadai) = YEAR(t_update) and MONTH(t_gadai) = MONTH(t_update)) THEN '1' ELSE '0' END AS result") + ->whereNotNull('hargajualan') + ->having('result','=',1) + ->whereYear('t_gadai','=',$year) + ->whereMonth('t_gadai','<=',$month) + ->where('sttebus','=','') + ->where('tagbaru',1) + ->pluck('norujukan'); + + $keuntungan_baru = Transaction::on('mysql7') + ->leftJoin('transaksi_keuntungan as trans', function($join) + { + $join->on('transaction.norujukan', '=', 'trans.norujukan'); + $join->on('transaction.created_at', '=', 'trans.tarikh_bayaran'); + }) + ->whereIn('trans.norujukan',$sagbaru_norujukan) + ->where('transaction.trans_type','A') + ->sum('bayaran_keuntungan'); + + + $total = $sum_keun_tebus + $sum_keun_ansuran + $keuntungan_baru; return response()->json($total); diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index 3f3ac2b..bf3289d 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -2022,8 +2022,8 @@ class GadaiController extends Controller if($tebus['jenistebus'] == 'S') $bakiakhir = $baki - $tebus['bakipjm']; - - // dd($totalmasuk,$totalkeluar,$bakiakhir); + else + $bakiakhir = $bakiawal - $totalkeluar + $totalmasuk + $pendahuluan - $serahan; $updatetunai=Tunai::on($cawangan['mysql'])->where( [['tarikh','=', $current->toDateString()],['kodlaluan','=', $request->kodlaluan] ])-> update(array( @@ -2051,11 +2051,13 @@ class GadaiController extends Controller }else{ - $totalmasuk = $masuk - ($tebus['pinjaman']+$tebus['bakiupah']); - $totalkeluar = $keluar - (($tebus['pinjaman'] + $tebus['bakiupah']) - $tebus['bakipjm']); + $totalmasuk = $masuk; + $totalkeluar = $keluar; if($tebus['jenistebus'] == 'S') $bakiakhir = ($bakiakhir - $tebus['bakipjm']); + else + $bakiakhir = $bakiawal - $totalkeluar + $totalmasuk + $pendahuluan - $serahan; $updatetunai=Tunai::on($cawangan['mysql'])->where( [['tarikh','=', $current->toDateString()],['kodlaluan','=', $request->kodlaluan] ])-> update(array( diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 676c960..41dc688 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -1497,7 +1497,7 @@ class TebusController extends Controller $ansuran = 0; if($ansuran_data){ foreach($ansuran_data as $index=>$ansuranData){ - $gadaiData = Gadai::on($cawangan['mysql'])->where([['norujukan',$ansuranData['norujukan']],['hargajualan','<>',null]])->first(); + $gadaiData = Gadai::on($cawangan['mysql'])->where([['norujukan',$ansuranData['norujukan']],['hargajualan','<>',null],['tagbaru',0]])->first(); if($gadaiData){ $ansuran += $ansuranData['bayaran_keuntungan']; } @@ -1710,6 +1710,7 @@ class TebusController extends Controller }) ->whereIn('trans.norujukan',$get_norujukan) ->where('transaction.trans_type','T') + // ->where('trans.margin_semasa','=',0) //3.80 ->sum('keuntungan_rebet'); $sum_keun_ansuran = Transaction::on('mysql7') @@ -1720,6 +1721,7 @@ class TebusController extends Controller }) ->whereIn('trans.norujukan',$get_norujukan) ->where('transaction.trans_type','A') + ->where('trans.margin_semasa','=',0) ->sum('bayaran_keuntungan'); $total = $sum_keun_tebus + $sum_keun_ansuran; diff --git a/app/Support/v1/Penebusan.php b/app/Support/v1/Penebusan.php index 398f399..dbf54ff 100644 --- a/app/Support/v1/Penebusan.php +++ b/app/Support/v1/Penebusan.php @@ -645,7 +645,7 @@ class Penebusan 'norujukan' => $norujukan, 'bayaran_keuntungan' => $request->bakiupah, 'bayaran_pembiayaan' => $bayaran_pembiayaan, - 'keuntungan_rebet' => 0, + 'keuntungan_rebet' => $request->bakiupah, 'tarikh_bayaran'=> $current, 'kodcaw'=> $kodcaw ]); diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php index 96cfd7b..982a12f 100644 --- a/app/Support/v2/GadaiV2.php +++ b/app/Support/v2/GadaiV2.php @@ -412,6 +412,9 @@ public function kiraupahTawarruqStokAuditUjrahOnePercent($tempoh,$tempohbayar,$k $bilang_bln = $tempoh - $tempohbayar; $keuntungan_semasa = $bilang_bln * $upah['onepercent']; $ujrah_semasa = $bilang_bln * $upah['ujrah']; + $keuntungan_semasa = $onepercentservices->getRoundedMethod($keuntungan_semasa); + $ujrah_semasa = $onepercentservices->getRoundedMethod($ujrah_semasa); + $pendapatan = $keuntungan_semasa + $ujrah_semasa; $arraypendapatan = [ 'keuntungan' => $keuntungan_semasa, diff --git a/app/Support/v2/Penebusan.php b/app/Support/v2/Penebusan.php index f231e8a..e95624b 100644 --- a/app/Support/v2/Penebusan.php +++ b/app/Support/v2/Penebusan.php @@ -145,9 +145,10 @@ class Penebusan $bilang_bln = $tempoh - $gadai_data['tempohbayar']; $upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']); - $upahsemasa_raw = $bilang_bln * $upah['keuntungan']; + $keuntungan_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['onepercent']); $ujrah_semasa = $onepercentservices->getRoundedMethod($bilang_bln * $upah['ujrah']); + $upahsemasa_raw = $keuntungan_semasa + $ujrah_semasa; $upahsemasa_raw = $onepercentservices->getRoundedMethod($upahsemasa_raw); $keuntungan_1bln = $onepercentservices->getRoundedMethod((1 * $upah['onepercent'])+(1 * $upah['ujrah'])); @@ -464,8 +465,11 @@ class Penebusan $upah = $onepercentservices->kiraanKeuntunganRebet($gadai_data['bakipjm'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['margin_semasa']); - $upahrebet_raw = $bilang_bln * $upah['keuntungan']; - $upahrebet_raw = $onepercentservices->getRoundedMethod($upahrebet_raw); + $ujrah = $onepercentservices->getRoundedMethod($bilang_bln * $upah['ujrah']); + $onepercent = $onepercentservices->getRoundedMethod($bilang_bln * $upah['onepercent']); + $keuntungan = $ujrah + $onepercent; + + $upahrebet_raw = $onepercentservices->getRoundedMethod($keuntungan); return $upahrebet_raw; } @@ -695,7 +699,7 @@ class Penebusan 'norujukan' => $norujukan, 'bayaran_keuntungan' => $request->bakiupah, 'bayaran_pembiayaan' => $bayaran_pembiayaan, - 'keuntungan_rebet' => 0, + 'keuntungan_rebet' => $request->bakiupah, 'tarikh_bayaran'=> $current, 'kodcaw'=> $kodcaw ]); @@ -747,6 +751,8 @@ class Penebusan $ujrah = $onepercentservices->getRoundedMethod($array_upah['ujrah']); $onepercent_semasa = $bilang_bln * $onepercent; $ujrah_semasa = $bilang_bln * $ujrah; + $onepercent_semasa = $onepercentservices->getRoundedMethod($onepercent_semasa); + $ujrah_semasa = $onepercentservices->getRoundedMethod($ujrah_semasa); return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa]; @@ -773,7 +779,9 @@ class Penebusan $keuntungan_rounded = $onepercentservices->getRoundedMethod($array_upah['onepercent']); $ujrah = $bilang_bln * $ujrah_rounded; $onepercent = $bilang_bln * $keuntungan_rounded; - + $ujrah = $onepercentservices->getRoundedMethod($ujrah); + $onepercent = $onepercentservices->getRoundedMethod($onepercent); + return ['ujrah' => $ujrah, 'onepercent' => $onepercent]; } diff --git a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php index 9fde429..a31ce35 100644 --- a/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php +++ b/database/migrations/2023_11_11_104203_add_onepercent_to_tebus_table.php @@ -3,6 +3,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Schema; class AddOnepercentToTebusTable extends Migration From d4492cf565af28f6c0573bd6bbca4990f642d779 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 30 Dec 2023 23:48:17 +0800 Subject: [PATCH 101/114] masuk balik ansuran sag lama --- app/Services/MasterServices.php | 9 ++++++++- app/Support/OnePercent.php | 4 +--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Services/MasterServices.php b/app/Services/MasterServices.php index 808a36a..de6df28 100644 --- a/app/Services/MasterServices.php +++ b/app/Services/MasterServices.php @@ -77,7 +77,14 @@ class MasterServices } public function updateGadaiMarhunKaunter($kodcaw, $norujukan, HttpRequest $request){ - $response = $this->engine->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); + if($request->jeniskeuntungan == 'onepercent'){ + $onepercent = new OnePercentEngine($this->cawangan); + $response = $onepercent->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); + + }else{ + $tawarruq = new TawarruqEngine($this->cawangan); + $response = $tawarruq->updateGadaiMarhunKaunter($kodcaw,$norujukan,$request); + } return $response; } diff --git a/app/Support/OnePercent.php b/app/Support/OnePercent.php index 83c7014..3a02fd8 100644 --- a/app/Support/OnePercent.php +++ b/app/Support/OnePercent.php @@ -4,7 +4,6 @@ namespace App\Support; use App\Cawangan; use App\Services\MasterServices; -use App\Services\Request; use App\Support\v2\Calculation; use Illuminate\Http\Request as HttpRequest; use App\Support\v2\GadaiV2 as Version2Gadai; @@ -166,7 +165,6 @@ class OnePercent extends MasterServices } function rebetselepastawarruq($kodcaw,$norujukan){ - dd('tes'); $tebus = new Penebusan($this->kodcaw,$this->cawangan_info); $response = $tebus->rebetselepastawarruq($this->kodcaw,$norujukan); @@ -206,4 +204,4 @@ class OnePercent extends MasterServices public function test(){ echo 'onepercent'; } -} +} \ No newline at end of file From 86549243f4492b190aeaeae822a2c1bc883ac980 Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 31 Dec 2023 15:17:13 +0800 Subject: [PATCH 102/114] Add missing helper method --- app/Helper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Helper.php b/app/Helper.php index 9b32708..401dbbc 100644 --- a/app/Helper.php +++ b/app/Helper.php @@ -111,4 +111,10 @@ class Helper } + public static function getActiveCawangan() { + + return Cawangan::whereIn('mysql', helper::getactivecawangandbconnection())->get(); + + } + } From c7b717579e1f1612e8916eae4b68dc398f5a2ef4 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 31 Dec 2023 15:37:00 +0800 Subject: [PATCH 103/114] fix ansuran return response success --- app/Support/v1/GadaiV1.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Support/v1/GadaiV1.php b/app/Support/v1/GadaiV1.php index 902b50e..d2f15d2 100644 --- a/app/Support/v1/GadaiV1.php +++ b/app/Support/v1/GadaiV1.php @@ -263,7 +263,8 @@ class GadaiV1 $audit->updated_at = $current; $audit->save(); - return response()->json($update_gadai, 200); + return response()->json("success",200); + // return response()->json($update_gadai, 200); } public function updateJBG(HttpRequest $request){ From 1133c6a2d24a5e542fb98e4e136170826450f68f Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 31 Dec 2023 16:49:51 +0800 Subject: [PATCH 104/114] enable config database --- config/database.php | 754 ++++++++++++++++++++++---------------------- 1 file changed, 383 insertions(+), 371 deletions(-) diff --git a/config/database.php b/config/database.php index 5895d0a..f464311 100644 --- a/config/database.php +++ b/config/database.php @@ -29,18 +29,18 @@ return [ 'prefix' => '', 'strict' => false, ], - // 'mysql2' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_2'), - // 'port' => env('DB_PORT_2'), - // 'database' => env('DB_DATABASE_2'), - // 'username' => env('DB_USERNAME_2'), - // 'password' => env('DB_PASSWORD_2'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], + 'mysql2' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_2'), + 'port' => env('DB_PORT_2'), + 'database' => env('DB_DATABASE_2'), + 'username' => env('DB_USERNAME_2'), + 'password' => env('DB_PASSWORD_2'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], 'mysql3' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_3'), @@ -53,45 +53,45 @@ return [ 'prefix' => '', 'strict' => false, ], - // 'mysql4' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_4'), - // 'port' => env('DB_PORT_4'), - // 'database' => env('DB_DATABASE_4'), - // 'username' => env('DB_USERNAME_4'), - // 'password' => env('DB_PASSWORD_4'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql5' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_5'), - // 'port' => env('DB_PORT_5'), - // 'database' => env('DB_DATABASE_5'), - // 'username' => env('DB_USERNAME_5'), - // 'password' => env('DB_PASSWORD_5'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + 'mysql4' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_4'), + 'port' => env('DB_PORT_4'), + 'database' => env('DB_DATABASE_4'), + 'username' => env('DB_USERNAME_4'), + 'password' => env('DB_PASSWORD_4'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql5' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_5'), + 'port' => env('DB_PORT_5'), + 'database' => env('DB_DATABASE_5'), + 'username' => env('DB_USERNAME_5'), + 'password' => env('DB_PASSWORD_5'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], + ], - // 'mysql6' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_6'), - // 'port' => env('DB_PORT_6'), - // 'database' => env('DB_DATABASE_6'), - // 'username' => env('DB_USERNAME_6'), - // 'password' => env('DB_PASSWORD_6'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + 'mysql6' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_6'), + 'port' => env('DB_PORT_6'), + 'database' => env('DB_DATABASE_6'), + 'username' => env('DB_USERNAME_6'), + 'password' => env('DB_PASSWORD_6'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], + ], 'mysql7' => [ 'driver' => 'mysql', @@ -105,43 +105,43 @@ return [ 'prefix' => '', 'strict' => false, ], - // 'mysql8' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_8'), - // 'port' => env('DB_PORT_8'), - // 'database' => env('DB_DATABASE_8'), - // 'username' => env('DB_USERNAME_8'), - // 'password' => env('DB_PASSWORD_8'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + 'mysql8' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_8'), + 'port' => env('DB_PORT_8'), + 'database' => env('DB_DATABASE_8'), + 'username' => env('DB_USERNAME_8'), + 'password' => env('DB_PASSWORD_8'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], - // 'mysql9' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_9'), - // 'port' => env('DB_PORT_9'), - // 'database' => env('DB_DATABASE_9'), - // 'username' => env('DB_USERNAME_9'), - // 'password' => env('DB_PASSWORD_9'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql10' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_10'), - // 'port' => env('DB_PORT_10'), - // 'database' => env('DB_DATABASE_10'), - // 'username' => env('DB_USERNAME_10'), - // 'password' => env('DB_PASSWORD_10'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], + ], + 'mysql9' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_9'), + 'port' => env('DB_PORT_9'), + 'database' => env('DB_DATABASE_9'), + 'username' => env('DB_USERNAME_9'), + 'password' => env('DB_PASSWORD_9'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql10' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_10'), + 'port' => env('DB_PORT_10'), + 'database' => env('DB_DATABASE_10'), + 'username' => env('DB_USERNAME_10'), + 'password' => env('DB_PASSWORD_10'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], 'mysql11' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_11'), @@ -155,30 +155,30 @@ return [ 'strict' => false, ], - // 'mysql12' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_12'), - // 'port' => env('DB_PORT_12'), - // 'database' => env('DB_DATABASE_12'), - // 'username' => env('DB_USERNAME_12'), - // 'password' => env('DB_PASSWORD_12'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql13' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_13'), - // 'port' => env('DB_PORT_13'), - // 'database' => env('DB_DATABASE_13'), - // 'username' => env('DB_USERNAME_13'), - // 'password' => env('DB_PASSWORD_13'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], + 'mysql12' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_12'), + 'port' => env('DB_PORT_12'), + 'database' => env('DB_DATABASE_12'), + 'username' => env('DB_USERNAME_12'), + 'password' => env('DB_PASSWORD_12'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql13' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_13'), + 'port' => env('DB_PORT_13'), + 'database' => env('DB_DATABASE_13'), + 'username' => env('DB_USERNAME_13'), + 'password' => env('DB_PASSWORD_13'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], 'mysql14' => [ 'driver' => 'mysql', 'host' => env('DB_HOST_14'), @@ -192,274 +192,286 @@ return [ 'strict' => false, ], - // 'mysql15' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_15'), - // 'port' => env('DB_PORT_15'), - // 'database' => env('DB_DATABASE_15'), - // 'username' => env('DB_USERNAME_15'), - // 'password' => env('DB_PASSWORD_15'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql16' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_16'), - // 'port' => env('DB_PORT_16'), - // 'database' => env('DB_DATABASE_16'), - // 'username' => env('DB_USERNAME_16'), - // 'password' => env('DB_PASSWORD_16'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + 'mysql15' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_15'), + 'port' => env('DB_PORT_15'), + 'database' => env('DB_DATABASE_15'), + 'username' => env('DB_USERNAME_15'), + 'password' => env('DB_PASSWORD_15'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql16' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_16'), + 'port' => env('DB_PORT_16'), + 'database' => env('DB_DATABASE_16'), + 'username' => env('DB_USERNAME_16'), + 'password' => env('DB_PASSWORD_16'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], - // 'mysql17' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_17'), - // 'port' => env('DB_PORT_17'), - // 'database' => env('DB_DATABASE_17'), - // 'username' => env('DB_USERNAME_17'), - // 'password' => env('DB_PASSWORD_17'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql18' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_18'), - // 'port' => env('DB_PORT_18'), - // 'database' => env('DB_DATABASE_18'), - // 'username' => env('DB_USERNAME_18'), - // 'password' => env('DB_PASSWORD_18'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql19' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_19'), - // 'port' => env('DB_PORT_19'), - // 'database' => env('DB_DATABASE_19'), - // 'username' => env('DB_USERNAME_19'), - // 'password' => env('DB_PASSWORD_19'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql20' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_20'), - // 'port' => env('DB_PORT_20'), - // 'database' => env('DB_DATABASE_20'), - // 'username' => env('DB_USERNAME_20'), - // 'password' => env('DB_PASSWORD_20'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql21' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_21'), - // 'port' => env('DB_PORT_21'), - // 'database' => env('DB_DATABASE_21'), - // 'username' => env('DB_USERNAME_21'), - // 'password' => env('DB_PASSWORD_21'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + ], + 'mysql17' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_17'), + 'port' => env('DB_PORT_17'), + 'database' => env('DB_DATABASE_17'), + 'username' => env('DB_USERNAME_17'), + 'password' => env('DB_PASSWORD_17'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql18' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_18'), + 'port' => env('DB_PORT_18'), + 'database' => env('DB_DATABASE_18'), + 'username' => env('DB_USERNAME_18'), + 'password' => env('DB_PASSWORD_18'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql19' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_19'), + 'port' => env('DB_PORT_19'), + 'database' => env('DB_DATABASE_19'), + 'username' => env('DB_USERNAME_19'), + 'password' => env('DB_PASSWORD_19'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql20' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_20'), + 'port' => env('DB_PORT_20'), + 'database' => env('DB_DATABASE_20'), + 'username' => env('DB_USERNAME_20'), + 'password' => env('DB_PASSWORD_20'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql21' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_21'), + 'port' => env('DB_PORT_21'), + 'database' => env('DB_DATABASE_21'), + 'username' => env('DB_USERNAME_21'), + 'password' => env('DB_PASSWORD_21'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], - // 'mysql22' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_22'), - // 'port' => env('DB_PORT_22'), - // 'database' => env('DB_DATABASE_22'), - // 'username' => env('DB_USERNAME_22'), - // 'password' => env('DB_PASSWORD_22'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql23' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_23'), - // 'port' => env('DB_PORT_23'), - // 'database' => env('DB_DATABASE_23'), - // 'username' => env('DB_USERNAME_23'), - // 'password' => env('DB_PASSWORD_23'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + ], + 'mysql22' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_22'), + 'port' => env('DB_PORT_22'), + 'database' => env('DB_DATABASE_22'), + 'username' => env('DB_USERNAME_22'), + 'password' => env('DB_PASSWORD_22'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql23' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_23'), + 'port' => env('DB_PORT_23'), + 'database' => env('DB_DATABASE_23'), + 'username' => env('DB_USERNAME_23'), + 'password' => env('DB_PASSWORD_23'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], - // 'mysql24' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_24'), - // 'port' => env('DB_PORT_24'), - // 'database' => env('DB_DATABASE_24'), - // 'username' => env('DB_USERNAME_24'), - // 'password' => env('DB_PASSWORD_24'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + ], + 'mysql24' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_24'), + 'port' => env('DB_PORT_24'), + 'database' => env('DB_DATABASE_24'), + 'username' => env('DB_USERNAME_24'), + 'password' => env('DB_PASSWORD_24'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], - // 'mysql25' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_25'), - // 'port' => env('DB_PORT_25'), - // 'database' => env('DB_DATABASE_25'), - // 'username' => env('DB_USERNAME_25'), - // 'password' => env('DB_PASSWORD_25'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql26' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_26'), - // 'port' => env('DB_PORT_26'), - // 'database' => env('DB_DATABASE_26'), - // 'username' => env('DB_USERNAME_26'), - // 'password' => env('DB_PASSWORD_26'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql27' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_27'), - // 'port' => env('DB_PORT_27'), - // 'database' => env('DB_DATABASE_27'), - // 'username' => env('DB_USERNAME_27'), - // 'password' => env('DB_PASSWORD_27'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, + ], + 'mysql25' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_25'), + 'port' => env('DB_PORT_25'), + 'database' => env('DB_DATABASE_25'), + 'username' => env('DB_USERNAME_25'), + 'password' => env('DB_PASSWORD_25'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql26' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_26'), + 'port' => env('DB_PORT_26'), + 'database' => env('DB_DATABASE_26'), + 'username' => env('DB_USERNAME_26'), + 'password' => env('DB_PASSWORD_26'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql27' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_27'), + 'port' => env('DB_PORT_27'), + 'database' => env('DB_DATABASE_27'), + 'username' => env('DB_USERNAME_27'), + 'password' => env('DB_PASSWORD_27'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, - // ], - // 'mysql28' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_28'), - // 'port' => env('DB_PORT_28'), - // 'database' => env('DB_DATABASE_28'), - // 'username' => env('DB_USERNAME_28'), - // 'password' => env('DB_PASSWORD_28'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql29' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_29'), - // 'port' => env('DB_PORT_29'), - // 'database' => env('DB_DATABASE_29'), - // 'username' => env('DB_USERNAME_29'), - // 'password' => env('DB_PASSWORD_29'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql30' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_30'), - // 'port' => env('DB_PORT_30'), - // 'database' => env('DB_DATABASE_30'), - // 'username' => env('DB_USERNAME_30'), - // 'password' => env('DB_PASSWORD_30'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql31' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_31'), - // 'port' => env('DB_PORT_31'), - // 'database' => env('DB_DATABASE_31'), - // 'username' => env('DB_USERNAME_31'), - // 'password' => env('DB_PASSWORD_31'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql32' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_32'), - // 'port' => env('DB_PORT_32'), - // 'database' => env('DB_DATABASE_32'), - // 'username' => env('DB_USERNAME_32'), - // 'password' => env('DB_PASSWORD_32'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql33' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_33'), - // 'port' => env('DB_PORT_33'), - // 'database' => env('DB_DATABASE_33'), - // 'username' => env('DB_USERNAME_33'), - // 'password' => env('DB_PASSWORD_33'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql34' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_34'), - // 'port' => env('DB_PORT_34'), - // 'database' => env('DB_DATABASE_34'), - // 'username' => env('DB_USERNAME_34'), - // 'password' => env('DB_PASSWORD_34'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - // 'mysql35' => [ - // 'driver' => 'mysql', - // 'host' => env('DB_HOST_35'), - // 'port' => env('DB_PORT_35'), - // 'database' => env('DB_DATABASE_35'), - // 'username' => env('DB_USERNAME_35'), - // 'password' => env('DB_PASSWORD_35'), - // 'charset' => 'utf8', - // 'collation' => 'utf8_unicode_ci', - // 'prefix' => '', - // 'strict' => false, - // ], - 'mysql36' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST_36'), - 'port' => env('DB_PORT_36'), - 'database' => env('DB_DATABASE_36'), - 'username' => env('DB_USERNAME_36'), - 'password' => env('DB_PASSWORD_36'), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - 'strict' => false, + ], + 'mysql28' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_28'), + 'port' => env('DB_PORT_28'), + 'database' => env('DB_DATABASE_28'), + 'username' => env('DB_USERNAME_28'), + 'password' => env('DB_PASSWORD_28'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql29' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_29'), + 'port' => env('DB_PORT_29'), + 'database' => env('DB_DATABASE_29'), + 'username' => env('DB_USERNAME_29'), + 'password' => env('DB_PASSWORD_29'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql30' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_30'), + 'port' => env('DB_PORT_30'), + 'database' => env('DB_DATABASE_30'), + 'username' => env('DB_USERNAME_30'), + 'password' => env('DB_PASSWORD_30'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql31' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_31'), + 'port' => env('DB_PORT_31'), + 'database' => env('DB_DATABASE_31'), + 'username' => env('DB_USERNAME_31'), + 'password' => env('DB_PASSWORD_31'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql32' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_32'), + 'port' => env('DB_PORT_32'), + 'database' => env('DB_DATABASE_32'), + 'username' => env('DB_USERNAME_32'), + 'password' => env('DB_PASSWORD_32'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql33' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_33'), + 'port' => env('DB_PORT_33'), + 'database' => env('DB_DATABASE_33'), + 'username' => env('DB_USERNAME_33'), + 'password' => env('DB_PASSWORD_33'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql34' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_34'), + 'port' => env('DB_PORT_34'), + 'database' => env('DB_DATABASE_34'), + 'username' => env('DB_USERNAME_34'), + 'password' => env('DB_PASSWORD_34'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql35' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_35'), + 'port' => env('DB_PORT_35'), + 'database' => env('DB_DATABASE_35'), + 'username' => env('DB_USERNAME_35'), + 'password' => env('DB_PASSWORD_35'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql36' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_36'), + 'port' => env('DB_PORT_36'), + 'database' => env('DB_DATABASE_36'), + 'username' => env('DB_USERNAME_36'), + 'password' => env('DB_PASSWORD_36'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, + ], + 'mysql37' => [ + 'driver' => 'mysql', + 'host' => env('DB_HOST_37'), + 'port' => env('DB_PORT_37'), + 'database' => env('DB_DATABASE_37'), + 'username' => env('DB_USERNAME_37'), + 'password' => env('DB_PASSWORD_37'), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'prefix' => '', + 'strict' => false, ], ], ]; From 56cea39a779339bac229cc068878ce526757b0e9 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 31 Dec 2023 18:28:16 +0800 Subject: [PATCH 105/114] keluarkan number dummy --- app/Http/Controllers/AdminPageController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index fa582e1..29a46e0 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3657,9 +3657,6 @@ class AdminPageController extends Controller if($kodcaw == '011229') $total -= 45390.37; - if($kodcaw == 'KB2') - $total -= 1378.5; - return response()->json($total,200); } From 7c990969fedafc0cbaa14c26e69e4ee202184d61 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 31 Dec 2023 21:18:32 +0800 Subject: [PATCH 106/114] fix ansuran ujrah --- app/Support/v2/GadaiV2.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Support/v2/GadaiV2.php b/app/Support/v2/GadaiV2.php index 982a12f..0fca06f 100644 --- a/app/Support/v2/GadaiV2.php +++ b/app/Support/v2/GadaiV2.php @@ -244,7 +244,7 @@ class GadaiV2 try { - DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa) { + DB::connection('mysql7')->transaction(function () use($onepercentasal,$ujrahasal,$keuntungan,$norujukan,$gadai,$request,$kodcaw,$current,$baki_hargajualan,$upahsemasa,$baki_bayaran,$upahrebet,$cawangan,$old_data,$baki_pinjaman,$lelong_tawarruq,$margin_semasa,$onepercent) { $transaction = Transaction::on('mysql7')->create([ 'trans_type' => 'A', @@ -266,7 +266,11 @@ class GadaiV2 $tempoh = $gadai['tempoh']; } $bilang_bln = $tempoh - $gadai['tempohbayar']; - + + $ujrah = $onepercent->getRoundedMethod($keuntungan['ujrah'] * $bilang_bln); + $ujrah_rebate = $onepercent->getRoundedMethod($ujrahasal * $bilang_bln); + $keun = $onepercent->getRoundedMethod($onepercentasal * $bilang_bln); + $keuntungan_rebate = $onepercent->getRoundedMethod($keuntungan['onepercent'] * $bilang_bln); $transaction_upah = TransaksiKeuntungan::on('mysql7')->create([ 'norujukan' => $norujukan, @@ -275,10 +279,10 @@ class GadaiV2 'keuntungan_rebet'=> $upahrebet, 'tarikh_bayaran'=> $current, 'kodcaw'=> $kodcaw, - 'ujrah' => ($keuntungan['ujrah'] * $bilang_bln), - 'ujrah_rebet' => ($ujrahasal*$bilang_bln), - 'onepercent' => ($onepercentasal * $bilang_bln), - 'onepercent_rebet' => ($keuntungan['onepercent'] * $bilang_bln), + 'ujrah' => $ujrah, + 'ujrah_rebet' => $ujrah_rebate, + 'onepercent' => $keun, + 'onepercent_rebet' => $keuntungan_rebate, 'tempoh' => $gadai['tempoh'], 'beza_tempoh' => $bilang_bln, 'margin_semasa' => $margin_semasa, From 08ed3e54b82c956f63ec6dd6ac00280960162dbf Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 31 Dec 2023 22:00:05 +0800 Subject: [PATCH 107/114] Add default value --- app/Services/Reports/RingkasanHarianService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Services/Reports/RingkasanHarianService.php b/app/Services/Reports/RingkasanHarianService.php index e502698..d288eff 100644 --- a/app/Services/Reports/RingkasanHarianService.php +++ b/app/Services/Reports/RingkasanHarianService.php @@ -562,7 +562,7 @@ class RingkasanHarianService $total = $tunai->sum('baki'); - $totalBakiAkhirTunai = $vault['bakiakhir']; + $totalBakiAkhirTunai = $vault['bakiakhir'] ?? 0; if ($total != 0) { $totalBakiAkhirTunai = $vault['bakiakhir'] + $total; @@ -844,6 +844,8 @@ class RingkasanHarianService ->where('tarikh', '>', $tarikhMulaTawarruq) ->sum('amaun'); + $totalSerahan = 0; + if ($this->startDate <= $tarikhMulaTawarruq) { $serahanpkblama = imbangdugalama::on($this->connectionCawangan) ->sum('serahan_pkb'); From 460c958148ededb0a00aa5a09e45536ba4f7ef1d Mon Sep 17 00:00:00 2001 From: Amirah Date: Mon, 1 Jan 2024 10:08:19 +0800 Subject: [PATCH 108/114] add function onepercent ringkasan harian --- .../Reports/RingkasanHarianService.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/app/Services/Reports/RingkasanHarianService.php b/app/Services/Reports/RingkasanHarianService.php index d288eff..14cbc80 100644 --- a/app/Services/Reports/RingkasanHarianService.php +++ b/app/Services/Reports/RingkasanHarianService.php @@ -98,6 +98,7 @@ class RingkasanHarianService $serahanbayaranOnline = $this->getSerahanBayaranOnline(); $totalSerahan = $this->getTotalSerahan(); $totalPendahuluan = $this->getTotalPendahuluan(); + $getOnePercentSimpanKaunter = $this->getOnePercentSimpanKaunter(); array_push($laporan_harian, [ 'total_gadai' => $total_gadai, @@ -154,6 +155,7 @@ class RingkasanHarianService 'totalserahan' => $totalSerahan, 'serahanbayaranOnline' => $serahanbayaranOnline, 'totalpendahuluan' => $totalPendahuluan, + 'OnePercentSimpanKaunter' => $getOnePercentSimpanKaunter, ]); return response()->json($laporan_harian); @@ -756,6 +758,52 @@ class RingkasanHarianService return floatval($upahsimpankaunter); } + private function getOnePercentSimpanKaunter() + { + $keuntungan_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate) + ->where('trans.teller', '<>', 'Online') + + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataKaunter = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $keuntungan_data_kaunter)->whereNull('hargajualan')->pluck('norujukan'); + + $keuntungan_kaunter_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataKaunter); + + $keuntungan_onepercent = $keuntungan_kaunter_query->sum('ujrah'); + + + $onepercenttebus = Tebus::on($this->connectionCawangan) + ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) + ->sum('onepercent'); + + + $onepercentlelong = Lelong::on($this->connectionCawangan) + ->whereDate('t_jual', '>=', $this->startDate)->whereDate('t_jual', '<=', $this->endDate) + ->sum('onepercent'); + + $total_keuntunganbukanansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '<>', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan); + + $total_keuntungan_onepercent_bukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('onepercent_rebet'); + + $upahsimpanonepercent = $keuntungan_onepercent + $onepercenttebus + $onepercentlelong + $total_keuntungan_onepercent_bukanansuran_kaunter; + + return floatval($upahsimpanonepercent); + } + private function getKeuntunganSebenarKaunter() { $total_keuntunganansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') From b9f5e75f5ff80ab51d5dd532a6903fd881abf469 Mon Sep 17 00:00:00 2001 From: Amirah Date: Mon, 1 Jan 2024 12:36:31 +0800 Subject: [PATCH 109/114] update function ringkasan harian ujrah --- .../Reports/RingkasanHarianService.php | 251 +++++++++++++++++- 1 file changed, 248 insertions(+), 3 deletions(-) diff --git a/app/Services/Reports/RingkasanHarianService.php b/app/Services/Reports/RingkasanHarianService.php index 14cbc80..d6e4121 100644 --- a/app/Services/Reports/RingkasanHarianService.php +++ b/app/Services/Reports/RingkasanHarianService.php @@ -99,6 +99,11 @@ class RingkasanHarianService $totalSerahan = $this->getTotalSerahan(); $totalPendahuluan = $this->getTotalPendahuluan(); $getOnePercentSimpanKaunter = $this->getOnePercentSimpanKaunter(); + $getUjrahSimpanKaunter = $this->getUjrahSimpanKaunter(); + $getOnepercentSebenarKaunter = $this->getOnepercentSebenarKaunter(); + $getUjrahSebenarKaunter = $this->getUjrahSebenarKaunter(); + $getTotalOnePercentOnline = $this->getTotalOnePercentOnline(); + $getTotalUjrahOnline = $this->getTotalUjrahOnline(); array_push($laporan_harian, [ 'total_gadai' => $total_gadai, @@ -155,7 +160,12 @@ class RingkasanHarianService 'totalserahan' => $totalSerahan, 'serahanbayaranOnline' => $serahanbayaranOnline, 'totalpendahuluan' => $totalPendahuluan, - 'OnePercentSimpanKaunter' => $getOnePercentSimpanKaunter, + 'onePercentSimpanKaunter' => $getOnePercentSimpanKaunter, + 'ujrahSimpanKaunter' => $getUjrahSimpanKaunter, + 'onepercentSebenarKaunter' => $getOnepercentSebenarKaunter, + 'ujrahSebenarKaunter' => $getUjrahSebenarKaunter, + 'totalOnePercentOnline' => $getTotalOnePercentOnline, + 'totalUjrahOnline' => $getTotalUjrahOnline, ]); return response()->json($laporan_harian); @@ -438,6 +448,132 @@ class RingkasanHarianService } + private function getTotalOnePercentOnline() + { + $total_keuntunganansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->whereIn('trans.norujukan', $gadaiDataOnline) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganansuran_online = $keuntunganansuran_online_query->sum('onepercent'); + + $total_keuntunganbukanansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '=', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganbukanansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganbukanansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataOnline) + ->whereDate('tarikh_bayaran', '>=', $this->startDate)->whereDate('tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganbukanansuran_online = $keuntunganbukanansuran_online_query->sum('onepercent_rebet'); + + $keuntungansebenaronline = $total_keuntunganansuran_online + $total_keuntunganbukanansuran_online; + + $upahansurOnlineQuery = Advansur::on($this->connectionCawangan) + ->where('teller', '=', 'Online') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate); + + $upahansurOnline = $upahansurOnlineQuery->sum('upahdibayar'); + + $upahsimpanonline = $upahansurOnline; + $total_onepercent_online = floatval($upahsimpanonline) + floatval($keuntungansebenaronline); + + return floatval($total_onepercent_online); + + } + + private function getTotalUjrahOnline() + { + $total_keuntunganansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '=', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->whereIn('trans.norujukan', $gadaiDataOnline) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganansuran_online = $keuntunganansuran_online_query->sum('ujrah'); + + $total_keuntunganbukanansuran_data_online = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '=', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataOnline = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganbukanansuran_data_online)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganbukanansuran_online_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataOnline) + ->whereDate('tarikh_bayaran', '>=', $this->startDate)->whereDate('tarikh_bayaran', '<=', $this->endDate); + + $total_keuntunganbukanansuran_online = $keuntunganbukanansuran_online_query->sum('ujrah_rebet'); + + $keuntungansebenaronline = $total_keuntunganansuran_online + $total_keuntunganbukanansuran_online; + + $upahansurOnlineQuery = Advansur::on($this->connectionCawangan) + ->where('teller', '=', 'Online') + ->whereDate('tarikh', '>=', $this->startDate)->whereDate('tarikh', '<=', $this->endDate); + + $upahansurOnline = $upahansurOnlineQuery->sum('upahdibayar'); + + $upahsimpanonline = $upahansurOnline; + $total_ujrah_online = floatval($upahsimpanonline) + floatval($keuntungansebenaronline); + + return floatval($total_ujrah_online); + + } + private function getTotalKeuntunganKaunter() { $total_keuntunganansuran_data_online = TransaksiKeuntungan::on('mysql7') @@ -775,8 +911,7 @@ class RingkasanHarianService $keuntungan_kaunter_query = TransaksiKeuntungan::on('mysql7') ->whereIn('norujukan', $gadaiDataKaunter); - $keuntungan_onepercent = $keuntungan_kaunter_query->sum('ujrah'); - + $keuntungan_onepercent = $keuntungan_kaunter_query->sum('onepercent'); $onepercenttebus = Tebus::on($this->connectionCawangan) ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) @@ -804,6 +939,52 @@ class RingkasanHarianService return floatval($upahsimpanonepercent); } + private function getUjrahSimpanKaunter() + { + $keuntungan_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate) + ->where('trans.teller', '<>', 'Online') + + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataKaunter = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $keuntungan_data_kaunter)->whereNull('hargajualan')->pluck('norujukan'); + + $keuntungan_kaunter_query = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan', $gadaiDataKaunter); + + $keuntungan_ujrah = $keuntungan_kaunter_query->sum('ujrah'); + + + $ujrahtebus = Tebus::on($this->connectionCawangan) + ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) + ->sum('ujrah'); + + + $ujrahlelong = Lelong::on($this->connectionCawangan) + ->whereDate('t_jual', '>=', $this->startDate)->whereDate('t_jual', '<=', $this->endDate) + ->sum('ujrah'); + + $total_keuntunganbukanansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type', '!=', 'A') + ->where('trans.teller', '<>', 'Online') + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.kodcaw', '=', $this->kodCawangan); + + $total_keuntungan_onepercent_bukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('ujrah_rebet'); + + $upahsimpanujrah = $keuntungan_ujrah + $ujrahtebus + $ujrahlelong + $total_keuntungan_onepercent_bukanansuran_kaunter; + + return floatval($upahsimpanujrah); + } + private function getKeuntunganSebenarKaunter() { $total_keuntunganansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') @@ -836,6 +1017,70 @@ class RingkasanHarianService return floatval($keuntungansebenarkaunter); } + private function getOnepercentSebenarKaunter() + { + $total_keuntunganansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '<>', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataKaunter = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan'); + + $onepercentansuran_kaunter_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.teller', '<>', 'Online') + ->where('trans.trans_type', '=', 'A') + ->whereIn('transaksi_keuntungan.norujukan', $gadaiDataKaunter) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_onepercent_ansuran_kaunter = $onepercentansuran_kaunter_query->sum('onepercent'); + + $onepercentsebenarkaunter = $total_onepercent_ansuran_kaunter; + + return floatval($onepercentsebenarkaunter); + } + + private function getUjrahSebenarKaunter() + { + $total_keuntunganansuran_data_kaunter = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->whereDate('trans.created_at', '>=', $this->startDate)->whereDate('trans.created_at', '<=', $this->endDate) + ->where('trans.teller', '<>', 'Online') + ->where('trans.trans_type', '=', 'A') + ->where('trans.kodcaw', $this->kodCawangan) + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiDataKaunter = Gadai::on($this->connectionCawangan)->whereIn('norujukan', $total_keuntunganansuran_data_kaunter)->whereNotNull('hargajualan')->pluck('norujukan'); + + $ujrahansuran_kaunter_query = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function ($join) { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.teller', '<>', 'Online') + ->where('trans.trans_type', '=', 'A') + ->whereIn('transaksi_keuntungan.norujukan', $gadaiDataKaunter) + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '>=', $this->startDate)->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $this->endDate); + + $total_ujrah_ansuran_kaunter = $ujrahansuran_kaunter_query->sum('ujrah'); + + $ujrahsebenarkaunter = $total_ujrah_ansuran_kaunter; + + return floatval($ujrahsebenarkaunter); + } + public function getSerahanBayaranOnline() { $serahanpkb = '1000/020'; From 8f115e36e6e76039f616b942ec7a0c326bf3ca40 Mon Sep 17 00:00:00 2001 From: Amirah Date: Mon, 1 Jan 2024 14:58:49 +0800 Subject: [PATCH 110/114] update ujrah rebet --- .../Reports/RingkasanHarianService.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Services/Reports/RingkasanHarianService.php b/app/Services/Reports/RingkasanHarianService.php index d6e4121..39bb403 100644 --- a/app/Services/Reports/RingkasanHarianService.php +++ b/app/Services/Reports/RingkasanHarianService.php @@ -911,11 +911,11 @@ class RingkasanHarianService $keuntungan_kaunter_query = TransaksiKeuntungan::on('mysql7') ->whereIn('norujukan', $gadaiDataKaunter); - $keuntungan_onepercent = $keuntungan_kaunter_query->sum('onepercent'); + $keuntungan_onepercent = $keuntungan_kaunter_query->sum('onepercent_rebet'); - $onepercenttebus = Tebus::on($this->connectionCawangan) - ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) - ->sum('onepercent'); + // $onepercenttebus = Tebus::on($this->connectionCawangan) + // ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) + // ->sum('onepercent'); $onepercentlelong = Lelong::on($this->connectionCawangan) @@ -934,7 +934,7 @@ class RingkasanHarianService $total_keuntungan_onepercent_bukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('onepercent_rebet'); - $upahsimpanonepercent = $keuntungan_onepercent + $onepercenttebus + $onepercentlelong + $total_keuntungan_onepercent_bukanansuran_kaunter; + $upahsimpanonepercent = $keuntungan_onepercent + $onepercentlelong + $total_keuntungan_onepercent_bukanansuran_kaunter; return floatval($upahsimpanonepercent); } @@ -956,12 +956,12 @@ class RingkasanHarianService $keuntungan_kaunter_query = TransaksiKeuntungan::on('mysql7') ->whereIn('norujukan', $gadaiDataKaunter); - $keuntungan_ujrah = $keuntungan_kaunter_query->sum('ujrah'); + $keuntungan_ujrah = $keuntungan_kaunter_query->sum('ujrah_rebet'); - $ujrahtebus = Tebus::on($this->connectionCawangan) - ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) - ->sum('ujrah'); + // $ujrahtebus = Tebus::on($this->connectionCawangan) + // ->whereDate('t_tebus', '>=', $this->startDate)->whereDate('t_tebus', '<=', $this->endDate) + // ->sum('ujrah'); $ujrahlelong = Lelong::on($this->connectionCawangan) @@ -980,7 +980,7 @@ class RingkasanHarianService $total_keuntungan_onepercent_bukanansuran_kaunter = $total_keuntunganbukanansuran_data_kaunter->sum('ujrah_rebet'); - $upahsimpanujrah = $keuntungan_ujrah + $ujrahtebus + $ujrahlelong + $total_keuntungan_onepercent_bukanansuran_kaunter; + $upahsimpanujrah = $keuntungan_ujrah + $ujrahlelong + $total_keuntungan_onepercent_bukanansuran_kaunter; return floatval($upahsimpanujrah); } From 559c5d05ca399714fe47b8ad592a9f1c1d1cff86 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 2 Jan 2024 23:15:11 +0800 Subject: [PATCH 111/114] fix imbangduga slow and fix untung rugi terkumpul --- app/Http/Controllers/AdminPageController.php | 7 +- app/Http/Controllers/GadaiController.php | 50 ++-- app/Http/Controllers/MarhunController.php | 4 +- app/Http/Controllers/TebusController.php | 299 ++++++++++--------- 4 files changed, 192 insertions(+), 168 deletions(-) diff --git a/app/Http/Controllers/AdminPageController.php b/app/Http/Controllers/AdminPageController.php index 29a46e0..faf7af2 100644 --- a/app/Http/Controllers/AdminPageController.php +++ b/app/Http/Controllers/AdminPageController.php @@ -3629,9 +3629,11 @@ class AdminPageController extends Controller $keuntungansebenar = ($keuntungan + $keuntunganreducing + $ansuran + $bukanansuran); + $previousYear = Carbon::now()->subYears(1); + $get_norujukan = Gadai::on($cawangan['mysql']) ->selectRaw("norujukan,CASE WHEN (YEAR(t_gadai) = YEAR(t_update) and MONTH(t_gadai) = MONTH(t_update)) THEN '1' ELSE '0' END AS result") - ->whereNotNull('hargajualan')->having('result','=',1)->whereYear('t_gadai','=','2022')->where('sttebus','<>','')->pluck('norujukan'); + ->whereNotNull('hargajualan')->having('result','=',1)->whereYear('t_gadai','>=','2022')->whereYear('t_gadai','<=',$previousYear)->where('sttebus','<>','')->pluck('norujukan'); $sum_keun = Transaction::on('mysql7') ->selectRaw("trans.norujukan,SUM(CASE WHEN (transaction.trans_type) = 'T' THEN (trans.keuntungan_rebet) ELSE 0 END) AS sum_keun,SUM(CASE WHEN (transaction.trans_type) = 'A' THEN (trans.bayaran_keuntungan) ELSE 0 END) AS sum_bayaran") @@ -3647,9 +3649,8 @@ class AdminPageController extends Controller $total_keuntungan_sebenar = $sum_keuntungan + $sum_bayaran; - $previousYear = Carbon::now()->subYears(1); $available_akru = AkruNet::on($cawangan['mysql']) - ->where('tahun',$previousYear->year) + ->where('tahun','<=',$previousYear->year) ->sum('jumlah'); $total = ($utgrugilama + $lelong + $upahsimpantebus + $upahsimpanlelong + $upahsimpanansur + $gstcajlelong + $keuntungansebenar + $upahsimpankeuntungansebelumtawarruq + $available_akru + $total_keuntungan_sebenar) + $parameter; diff --git a/app/Http/Controllers/GadaiController.php b/app/Http/Controllers/GadaiController.php index bf3289d..e0d81d6 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -2964,27 +2964,43 @@ class GadaiController extends Controller //->whereYear('tarikh_bayaran','=',$current->year) //->get(); - $transaksi_data = TransaksiKeuntungan::on('mysql7') - ->leftJoin('transaction as trans', function($join) - { - $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); - $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); - }) - ->where('trans.trans_type','=','A') - ->where('transaksi_keuntungan.tarikh_bayaran' ,'<=', $daterequest) - ->get(); + if($cawangan['zone'] == 1){ + $transaksi_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->join($cawangan['db_name'] . 'gadai as gad', 'gad.norujukan','=','trans.norujukan') + ->where('trans.trans_type','=','A') + ->where('transaksi_keuntungan.tarikh_bayaran' ,'<=', $daterequest) + ->sum('transaksi_keuntungan.bayaran_keuntungan'); - $transaksi = 0; - if($transaksi_data){ - foreach($transaksi_data as $index=>$transaksiData){ - $gadaiData = Gadai::on($cawangan['mysql'])->where('norujukan',$transaksiData['norujukan'])->whereNotNull('hargajualan')->first(); - if($gadaiData){ - $transaksi += $transaksiData['bayaran_keuntungan']; + $totalkeuntungan = $keuntungan - $transaksi_data; + + }else{ + $transaksi_data = TransaksiKeuntungan::on('mysql7') + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','=','A') + ->where('transaksi_keuntungan.tarikh_bayaran' ,'<=', $daterequest) + ->get(); + + $transaksi = 0; + if($transaksi_data){ + foreach($transaksi_data as $index=>$transaksiData){ + $gadaiData = Gadai::on($cawangan['mysql'])->where('norujukan',$transaksiData['norujukan'])->whereNotNull('hargajualan')->first(); + if($gadaiData){ + $transaksi += $transaksiData['bayaran_keuntungan']; + } } } - } - $totalkeuntungan = $keuntungan - $transaksi; + $totalkeuntungan = $keuntungan - $transaksi; + } return response()->json($totalkeuntungan,200); } diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index c091440..d4c0ef8 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -186,7 +186,7 @@ class MarhunController extends Controller $marhun = Marhun::on($cawangan['mysql']) ->select('marhun.norujukan','gadai.nokp','customer.nama','marhun.marhun','marhun.nota','marhun.berat','marhun.karat','marhun.harga','marhun.n_marhun','marhun.t_gadai') ->rightJoin('gadai', 'gadai.norujukan', '=', 'marhun.norujukan') - ->rightJoin('customer', 'customer.kpbaru', '=', 'gadai.nokp') + ->rightJoin('online_arrahn.customer as customer', 'customer.kpbaru','=','gadai.nokp') ->where('marhun.t_gadai','=',$tarikh) ->orderBy('marhun.t_gadai') ->get(); @@ -204,7 +204,7 @@ class MarhunController extends Controller $marhun = Marhun::on($cawangan['mysql']) ->select('marhun.norujukan','gadai.sttebus','gadai.pinjaman','gadai.nokp','customer.nama','marhun.marhun','marhun.nota','marhun.berat','marhun.karat','marhun.harga','marhun.n_marhun','marhun.t_gadai') ->rightJoin('gadai', 'gadai.norujukan', '=', 'marhun.norujukan') - ->rightJoin('customer', 'customer.kpbaru', '=', 'gadai.nokp') + ->rightJoin('online_arrahn.customer as customer', 'customer.kpbaru','=','gadai.nokp') ->where('marhun.t_gadai','<=',$tarikh) ->whereYear('marhun.t_gadai','=',$current->year) ->where('gadai.sttebus','=','') diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 41dc688..70315ae 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -1229,162 +1229,169 @@ class TebusController extends Controller }else{ - $keuntungan_data = TransaksiKeuntungan::on('mysql7') - // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') - ->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $request->tarikh) - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', $dateSM) - ->whereYear('tarikh_bayaran','=',$tarikhyear->year) - ->where('kodcaw',$request->kodcaw) - // ->whereNotNull('db2.hargajualan') - // ->sum('bayaran_keuntungan'); - // ->get(); - ->pluck('norujukan'); + //ps. Fix sementara je ni. + if($cawangan['zone'] == 1){ + $keuntungan = TransaksiKeuntungan::on('mysql7') + ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('transaksi_keuntungan.kodcaw',$request->kodcaw) + ->whereNotNull('db2.hargajualan') + ->sum('keuntungan_rebet'); - $gadaiData = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$keuntungan_data)->whereNotNull('hargajualan')->pluck('norujukan'); + $keuntunganreducing = TransaksiKeuntungan::on('mysql7') + ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', '2021-06-09') + ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('transaksi_keuntungan.kodcaw',$request->kodcaw) + ->whereNotNull('db2.hargajualan') + ->sum('keuntungan_rebet'); - $keuntungan = TransaksiKeuntungan::on('mysql7')->whereIn('norujukan',$gadaiData)->sum('bayaran_keuntungan'); + $bukanansuran = TransaksiKeuntungan::on('mysql7') + ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','!=','A') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') + // ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('trans.kodcaw',$request->kodcaw) + ->whereNotNull('db2.hargajualan') + ->sum('keuntungan_rebet'); - // $keuntungan = 0; - // if($keuntungan_data){ - // foreach($keuntungan_data as $index=>$keuntunganData){ - // $gadaiData = Gadai::on($cawangan['mysql'])->where([['norujukan',$keuntunganData['norujukan']],['hargajualan','<>',null]])->first(); - // if($gadaiData){ - // $keuntungan += $keuntunganData['bayaran_keuntungan']; - // } - // } - // } + $ansuran = TransaksiKeuntungan::on('mysql7') + ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','=','A') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') + // ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('trans.kodcaw',$request->kodcaw) + ->whereNotNull('db2.hargajualan') + ->sum('bayaran_keuntungan'); - // dd($keuntungan); - - - $keuntunganreducing_data = TransaksiKeuntungan::on('mysql7') - // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', '2021-06-09') - ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) - ->whereYear('tarikh_bayaran','=',$tarikhyear->year) - ->where('kodcaw',$request->kodcaw) - // ->whereNotNull('db2.hargajualan') - // ->sum('keuntungan_rebet'); - // ->get(); - ->pluck('norujukan'); - - $gadaiData = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$keuntunganreducing_data)->whereNotNull('hargajualan')->pluck('norujukan'); - - $keuntunganreducing = TransaksiKeuntungan::on('mysql7') - ->whereIn('norujukan',$gadaiData) - ->whereDate('tarikh_bayaran' ,'<', '2021-06-09') - ->whereDate('tarikh_bayaran','>=', $dateSM) - ->sum('keuntungan_rebet'); - - // $keuntunganreducing = 0; - // if($keuntunganreducing_data){ - // foreach($keuntunganreducing_data as $index=>$keuntunganreducingData){ - // $gadaiData = Gadai::on($cawangan['mysql'])->where([['norujukan',$keuntunganreducingData['norujukan']],['hargajualan','<>',null]])->first(); - // if($gadaiData){ - // $keuntunganreducing += $keuntunganreducingData['keuntungan_rebet']; - // } - // } - // } - - // dd($keuntunganreducing); - - $bukanansuran_data = TransaksiKeuntungan::on('mysql7') - // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') - ->leftJoin('transaction as trans', function($join) - { - $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); - $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); - }) - ->where('trans.trans_type','!=','A') - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') - // ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) - ->whereYear('tarikh_bayaran','=',$tarikhyear->year) - ->where('trans.kodcaw',$request->kodcaw) - // ->whereNotNull('db2.hargajualan') - // ->sum('keuntungan_rebet'); - // ->get(); - ->pluck('transaksi_keuntungan.norujukan'); - - $gadaiData = Gadai::on($cawangan['mysql']) - ->whereIn('norujukan',$bukanansuran_data) - ->whereNotNull('hargajualan') - ->pluck('norujukan'); - - $bukanansuran = TransaksiKeuntungan::on('mysql7') - ->whereIn('transaksi_keuntungan.norujukan',$gadaiData) - ->leftJoin('transaction as trans', function($join) - { - $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); - $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); - }) - ->where('trans.trans_type','!=','A') - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') - ->whereYear('transaksi_keuntungan.tarikh_bayaran','=',$tarikhyear->year) - ->sum('transaksi_keuntungan.keuntungan_rebet'); - - // $bukanansuran = 0; - // if($bukanansuran_data){ - // foreach($bukanansuran_data as $index=>$bukanansuranData){ - // $gadaiData = Gadai::on($cawangan['mysql'])->where([['norujukan',$bukanansuranData['norujukan']],['hargajualan','<>',null]])->first(); - // if($gadaiData){ - // $bukanansuran += $bukanansuranData['keuntungan_rebet']; - // } - // } - // } - - // dd($bukanansuran); - - $ansuran_data = TransaksiKeuntungan::on('mysql7') - // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') - ->leftJoin('transaction as trans', function($join) - { - $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); - $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); - }) - ->where('trans.trans_type','=','A') - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') - // ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) - ->whereYear('tarikh_bayaran','=',$tarikhyear->year) - ->where('trans.kodcaw',$request->kodcaw) - // ->whereNotNull('db2.hargajualan') - // ->sum('bayaran_keuntungan'); - // ->get(); - ->pluck('transaksi_keuntungan.norujukan'); - - $gadaiData = Gadai::on($cawangan['mysql']) - ->whereIn('norujukan',$ansuran_data) - ->whereNotNull('hargajualan') + }else{ + $keuntungan_data = TransaksiKeuntungan::on('mysql7') + // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->whereDate('transaksi_keuntungan.tarikh_bayaran', '<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('kodcaw',$request->kodcaw) + // ->whereNotNull('db2.hargajualan') + // ->sum('bayaran_keuntungan'); + // ->get(); ->pluck('norujukan'); - $ansuran = TransaksiKeuntungan::on('mysql7') - ->whereIn('transaksi_keuntungan.norujukan',$gadaiData) - ->leftJoin('transaction as trans', function($join) - { - $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); - $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); - }) - ->where('trans.trans_type','=','A') - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) - ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') - ->whereYear('transaksi_keuntungan.tarikh_bayaran','=',$tarikhyear->year) - ->sum('transaksi_keuntungan.bayaran_keuntungan'); + $gadaiData = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$keuntungan_data)->whereNotNull('hargajualan')->pluck('norujukan'); - // $ansuran = 0; - // if($ansuran_data){ - // foreach($ansuran_data as $index=>$ansuranData){ - // $gadaiData = Gadai::on($cawangan['mysql'])->where([['norujukan',$ansuranData['norujukan']],['hargajualan','<>',null]])->first(); - // if($gadaiData){ - // $ansuran += $ansuranData['bayaran_keuntungan']; - // } - // } - // } + $keuntungan = TransaksiKeuntungan::on('mysql7')->whereIn('norujukan',$gadaiData)->sum('bayaran_keuntungan'); - // dd($ansuran); + $keuntunganreducing_data = TransaksiKeuntungan::on('mysql7') + // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<', '2021-06-09') + ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('kodcaw',$request->kodcaw) + // ->whereNotNull('db2.hargajualan') + // ->sum('keuntungan_rebet'); + // ->get(); + ->pluck('norujukan'); + $gadaiData = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$keuntunganreducing_data)->whereNotNull('hargajualan')->pluck('norujukan'); + + $keuntunganreducing = TransaksiKeuntungan::on('mysql7') + ->whereIn('norujukan',$gadaiData) + ->whereDate('tarikh_bayaran' ,'<', '2021-06-09') + ->whereDate('tarikh_bayaran','>=', $dateSM) + ->sum('keuntungan_rebet'); + + $bukanansuran_data = TransaksiKeuntungan::on('mysql7') + // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','!=','A') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') + // ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('trans.kodcaw',$request->kodcaw) + // ->whereNotNull('db2.hargajualan') + // ->sum('keuntungan_rebet'); + // ->get(); + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiData = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan',$bukanansuran_data) + ->whereNotNull('hargajualan') + ->pluck('norujukan'); + + $bukanansuran = TransaksiKeuntungan::on('mysql7') + ->whereIn('transaksi_keuntungan.norujukan',$gadaiData) + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','!=','A') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') + ->whereYear('transaksi_keuntungan.tarikh_bayaran','=',$tarikhyear->year) + ->sum('transaksi_keuntungan.keuntungan_rebet'); + + $ansuran_data = TransaksiKeuntungan::on('mysql7') + // ->join($cawangan['db_name'].'.gadai as db2','transaksi_keuntungan.norujukan','=','db2.norujukan') + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','=','A') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') + // ->whereDate('transaksi_keuntungan.tarikh_bayaran','>=', $dateSM) + ->whereYear('tarikh_bayaran','=',$tarikhyear->year) + ->where('trans.kodcaw',$request->kodcaw) + // ->whereNotNull('db2.hargajualan') + // ->sum('bayaran_keuntungan'); + // ->get(); + ->pluck('transaksi_keuntungan.norujukan'); + + $gadaiData = Gadai::on($cawangan['mysql']) + ->whereIn('norujukan',$ansuran_data) + ->whereNotNull('hargajualan') + ->pluck('norujukan'); + + $ansuran = TransaksiKeuntungan::on('mysql7') + ->whereIn('transaksi_keuntungan.norujukan',$gadaiData) + ->leftJoin('transaction as trans', function($join) + { + $join->on('transaksi_keuntungan.norujukan', '=', 'trans.norujukan'); + $join->on('transaksi_keuntungan.tarikh_bayaran', '=', 'trans.created_at'); + }) + ->where('trans.trans_type','=','A') + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'<=', $request->tarikh) + ->whereDate('transaksi_keuntungan.tarikh_bayaran' ,'>=', '2021-06-09') + ->whereYear('transaksi_keuntungan.tarikh_bayaran','=',$tarikhyear->year) + ->sum('transaksi_keuntungan.bayaran_keuntungan'); + + } + + $upahlelong = Lelong::on($cawangan['mysql']) ->where([['t_jual','<=',$request->tarikh],['t_jual','>','2022-07-24']]) ->whereYear('t_jual','=',$tarikhyear->year) From d8d251bf9389d94b0ee38a44b3653c445433caff Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 2 Jan 2024 23:16:51 +0800 Subject: [PATCH 112/114] migration imbangdugabackup --- ...column_ujrah_to_imbangdugabackup_table.php | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 database/migrations/2024_01_02_151041_add_column_ujrah_to_imbangdugabackup_table.php diff --git a/database/migrations/2024_01_02_151041_add_column_ujrah_to_imbangdugabackup_table.php b/database/migrations/2024_01_02_151041_add_column_ujrah_to_imbangdugabackup_table.php new file mode 100644 index 0000000..a235d3f --- /dev/null +++ b/database/migrations/2024_01_02_151041_add_column_ujrah_to_imbangdugabackup_table.php @@ -0,0 +1,77 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + Schema::connection($dbase)->table('imbang_duga_backup', function (Blueprint $table) use($dbase) { + + $isTunggakanUjrah = Schema::connection($dbase)->hasColumn('imbang_duga_backup', 'ujrah'); + $isTunggakkanOnePercent = Schema::connection($dbase)->hasColumn('imbang_duga_backup', 'onepercent'); + + if (! $isTunggakanUjrah) { + $table->decimal('ujrah', 9, 2); + } + + if (! $isTunggakkanOnePercent) { + $table->decimal('onepercent', 9, 2); + } + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach($db_connection as $dbase){ + $columns = ['onepercent', 'ujrah']; + + $columns_exist = array_filter($columns,function($column) use($dbase){ + return Schema::connection($dbase)->hasColumn('imbang_duga_backup', $column); + }); + + Schema::connection($dbase)->table('imbang_duga_backup', function(Blueprint $table) use($columns_exist){ + foreach($columns_exist as $column){ + $table->dropColumn($column); + } + }); + } + } +} From 85f004c8af8a7ce9b52fa5c6f236c6f1b5cec5ec Mon Sep 17 00:00:00 2001 From: Amir Date: Wed, 3 Jan 2024 09:27:44 +0800 Subject: [PATCH 113/114] add get request for no surat wakil --- app/Http/Controllers/TebusController.php | 9 +++++++++ routes/web.php | 1 + 2 files changed, 10 insertions(+) diff --git a/app/Http/Controllers/TebusController.php b/app/Http/Controllers/TebusController.php index 70315ae..4639c91 100644 --- a/app/Http/Controllers/TebusController.php +++ b/app/Http/Controllers/TebusController.php @@ -37,6 +37,7 @@ use App\StokAudit12; use App\AkruNet; use App\Services\MasterServices; +use App\WakilSurat; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; @@ -533,6 +534,14 @@ class TebusController extends Controller return response()->json($wakil,200); } + public function getSuratWakil($kodcaw, $norujukan){ + $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); + + $wakil_surat = WakilSurat::on($cawangan['mysql'])->where('norujukan', $norujukan)->select('no_surat')->first(); + + return response()->json($wakil_surat,200); + } + public function createWakil($kodcaw,$icno,Request $request){ $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); diff --git a/routes/web.php b/routes/web.php index 339e6d4..f32a539 100644 --- a/routes/web.php +++ b/routes/web.php @@ -387,6 +387,7 @@ $router->group(['prefix'=>'api'], function () use ($router){ $router->get('firstwakil/{kodcaw}',['uses' => 'TebusController@FirstWakil']); $router->get('getwakil/{kodcaw}/{icno}',['uses' => 'TebusController@getWakil']); $router->get('getwakil/{kodcaw}/code/{nowakil}',['uses' => 'TebusController@getWakilbycode']); + $router->get('getsuratwakil/{kodcaw}/{norujukan}',['uses' => 'TebusController@getSuratWakil']); $router->put('ubahwakil/{kodcaw}',['uses'=>'TebusController@UbahWakil']); $router->post('createwakil/{kodcaw}/{icno}',['uses' => 'TebusController@createWakil']); $router->get('getwakil/{kodcaw}/status/{status}',['uses' => 'TebusController@getWakilbyStatus']); From 88c603e84fb8709ae76e080aa86b0b455c791870 Mon Sep 17 00:00:00 2001 From: Amirah Date: Wed, 3 Jan 2024 09:30:19 +0800 Subject: [PATCH 114/114] update nosiri wakil --- app/Http/Controllers/WakilController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/WakilController.php b/app/Http/Controllers/WakilController.php index 31cce18..64c226d 100644 --- a/app/Http/Controllers/WakilController.php +++ b/app/Http/Controllers/WakilController.php @@ -37,7 +37,7 @@ class WakilController extends Controller { $cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first(); - $wakil_surat = WakilSurat::on($cawangan['mysql'])->where('t_cetak', '=', $t_cetak)->orderBy('nosiri', 'desc')->first(); + $wakil_surat = WakilSurat::on($cawangan['mysql'])->where('t_cetak', '=', $t_cetak)->orderBy('id', 'desc')->first(); return response()->json($wakil_surat); }