From e548c89c35141412f27b300da1aa77add2e394d9 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 4 Dec 2023 09:42:32 +0800 Subject: [PATCH 1/6] 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 1d00acd1dba68d4b0705f1024705730fd58f0730 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Mon, 4 Dec 2023 16:26:00 +0800 Subject: [PATCH 2/6] 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 e76a9571b139ecb651b08b2c04376b0934f08bd2 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Tue, 5 Dec 2023 09:27:10 +0800 Subject: [PATCH 3/6] add imbang duga api and lejeram api and fix round down --- app/Http/Controllers/AdminPageController.php | 12 +-- app/Http/Controllers/GadaiController.php | 15 ++-- .../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(+), 52 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 25884de..a38b21b 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -251,7 +251,6 @@ class GadaiController extends Controller //query kadar upah baru $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawangan['group_id'])->first(); - // dd($kadar_raw); // query kadar upah lama // $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first(); @@ -367,13 +366,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 5844d674177db8027e7d0cba7a63df36d96a3cb6 Mon Sep 17 00:00:00 2001 From: Amirah Date: Wed, 6 Dec 2023 08:46:22 +0800 Subject: [PATCH 4/6] 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 a38b21b..2ed5fb3 100644 --- a/app/Http/Controllers/GadaiController.php +++ b/app/Http/Controllers/GadaiController.php @@ -813,7 +813,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') @@ -841,7 +841,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 98e6c318555c9b9844ada340912d146c09c8a026 Mon Sep 17 00:00:00 2001 From: Nur Izzati Zulkifli Date: Wed, 6 Dec 2023 14:40:44 +0800 Subject: [PATCH 5/6] 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 50562435eb8c2bef2aecc061be57329f5e27c287 Mon Sep 17 00:00:00 2001 From: Azfar Arsyad Date: Wed, 6 Dec 2023 17:08:34 +0800 Subject: [PATCH 6/6] 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