From 2a8e972b3466b48847125d46a671ac2d63ec65e8 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sun, 10 Dec 2023 00:05:30 +0800 Subject: [PATCH 01/57] 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 02/57] 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 03/57] 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 c999d2688694e19f83b7294632b6c6ac1f1744cc Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Wed, 8 Nov 2023 14:52:20 +0800 Subject: [PATCH 04/57] 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 05/57] 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 06/57] 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 07/57] 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 08/57] 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 09/57] 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 10/57] 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 11/57] 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 12/57] 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 13/57] 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 14/57] 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 15/57] 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 16/57] 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 17/57] 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 18/57] 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 19/57] 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 20/57] 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 21/57] 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 22/57] 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 23/57] 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 24/57] 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 25/57] 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 26/57] 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 27/57] 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 28/57] 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 29/57] 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 30/57] 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 31/57] 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 32/57] 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 33/57] 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 34/57] 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 35/57] 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 36/57] 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 37/57] 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 38/57] 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 39/57] 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 40/57] 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 41/57] 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 42/57] 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 43/57] 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 44/57] 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 45/57] 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 46/57] 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 47/57] 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 48/57] 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 49/57] 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 50/57] 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 51/57] 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 52/57] 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 53/57] 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 54/57] 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 55/57] 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 56/57] 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 57/57] 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']);