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..2ed5fb3 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; } @@ -814,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') @@ -842,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'] + ]); } } 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 0baf7c8..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,6 +82,7 @@ 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,',')){ @@ -116,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; } @@ -155,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; } @@ -187,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'); @@ -582,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 ]); } @@ -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); 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'); 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/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 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); + +