Merge branch 'ujrah_master' of https://bitbucket.org/arrahn-pkb/api_arrahn into ujrah_master
This commit is contained in:
@@ -3120,11 +3120,11 @@ class AdminPageController extends Controller
|
|||||||
$year = $current->year;
|
$year = $current->year;
|
||||||
$month = $tarikh->month;
|
$month = $tarikh->month;
|
||||||
|
|
||||||
$test = Gadai::on($cawangan['mysql'])
|
// $test = Gadai::on($cawangan['mysql'])
|
||||||
->whereBetween('tempoh',[0.5,1])
|
// ->whereBetween('tempoh',[0.5,1])
|
||||||
->where('sttebus','<>','')
|
// ->where('sttebus','<>','')
|
||||||
->whereYear('t_gadai',$current->year())
|
// ->whereYear('t_gadai',$current->year())
|
||||||
->pluck('norujukan');
|
// ->pluck('norujukan');
|
||||||
|
|
||||||
$get_norujukan = Gadai::on($cawangan['mysql'])
|
$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")
|
->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)
|
->whereIn('trans.norujukan',$get_norujukan)
|
||||||
->where('transaction.trans_type','T')
|
->where('transaction.trans_type','T')
|
||||||
|
->where('onepercent','=',0)
|
||||||
->sum('keuntungan_rebet');
|
->sum('keuntungan_rebet');
|
||||||
|
|
||||||
$sum_keun_ansuran = Transaction::on('mysql7')
|
$sum_keun_ansuran = Transaction::on('mysql7')
|
||||||
@@ -3153,6 +3154,7 @@ class AdminPageController extends Controller
|
|||||||
})
|
})
|
||||||
->whereIn('trans.norujukan',$get_norujukan)
|
->whereIn('trans.norujukan',$get_norujukan)
|
||||||
->where('transaction.trans_type','A')
|
->where('transaction.trans_type','A')
|
||||||
|
->where('onepercent','=',0)
|
||||||
->sum('bayaran_keuntungan');
|
->sum('bayaran_keuntungan');
|
||||||
|
|
||||||
$total = $sum_keun_tebus + $sum_keun_ansuran;
|
$total = $sum_keun_tebus + $sum_keun_ansuran;
|
||||||
|
|||||||
@@ -251,7 +251,6 @@ class GadaiController extends Controller
|
|||||||
//query kadar upah baru
|
//query kadar upah baru
|
||||||
$kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->where('group_id',$cawangan['group_id'])->first();
|
$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
|
// query kadar upah lama
|
||||||
// $kadar_raw = KadarUpah::where('min','<=',$total_nilai_marhun)->where('max','>=',$total_nilai_marhun)->first();
|
// $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 * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']);
|
||||||
$upahsemasa_raw = $bilang_bln * $upah['keuntungan'];
|
$upahsemasa_raw = $bilang_bln * $upah['keuntungan'];
|
||||||
|
|
||||||
$upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP);
|
// $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP);
|
||||||
// $upah_semasa_round = number_format($upahsemasa_raw,2);
|
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||||
// $upah_semasa = substr($upah_semasa_round, 0, -1);
|
$upah_semasa = substr($upah_semasa_round, 0, -1);
|
||||||
// // $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa));
|
// $upah_semasa = floatval(preg_replace('/[^\d.]/', '', $upah_semasa));
|
||||||
// if(strpos($upah_semasa,',')){
|
if(strpos($upah_semasa,',')){
|
||||||
// $upah_semasa = str_replace(',','',$upah_semasa);
|
$upah_semasa = str_replace(',','',$upah_semasa);
|
||||||
// }
|
}
|
||||||
return $upah_semasa;
|
return $upah_semasa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,7 +813,7 @@ class GadaiController extends Controller
|
|||||||
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
$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->mula)
|
||||||
->where('t_gadai','<=',$request->akhir)
|
->where('t_gadai','<=',$request->akhir)
|
||||||
->orderBy('t_gadai')
|
->orderBy('t_gadai')
|
||||||
@@ -842,7 +841,9 @@ class GadaiController extends Controller
|
|||||||
"alamat1"=> $customer_info['alamat1'],
|
"alamat1"=> $customer_info['alamat1'],
|
||||||
"teller"=> $gadaiData['teller'],
|
"teller"=> $gadaiData['teller'],
|
||||||
"ujrah"=> $gadaiData['ujrah'],
|
"ujrah"=> $gadaiData['ujrah'],
|
||||||
"onepercent"=> $gadaiData['onepercent']
|
"onepercent"=> $gadaiData['onepercent'],
|
||||||
|
"tagbaru"=> $gadaiData['tagbaru']
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Reports;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Services\Reports\OnePercentService as ReportOne;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class OnePercentController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getKeuntunganImbangDuga(string $kod_cawangan)
|
||||||
|
{
|
||||||
|
$reports = new ReportOne($kod_cawangan);
|
||||||
|
$response = $reports->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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,12 +59,12 @@ class TebusController extends Controller
|
|||||||
$rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan);
|
$rebet = $this->rebetselepastawarruq($kodcaw,$norujukan,$jeniskeuntungan);
|
||||||
$harga_tebus = $gadai_data['bakihargajualan'] - $rebet;
|
$harga_tebus = $gadai_data['bakihargajualan'] - $rebet;
|
||||||
|
|
||||||
$hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP);
|
// $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP);
|
||||||
// $hargatebus = bcdiv(round($harga_tebus,2),1,1);
|
$hargatebus = bcdiv(round($harga_tebus,2),1,1);
|
||||||
// $hargatebus = number_format($hargatebus,2);
|
$hargatebus = number_format($hargatebus,2);
|
||||||
// if(strpos($hargatebus,',')){
|
if(strpos($hargatebus,',')){
|
||||||
// $hargatebus = str_replace(',','',$hargatebus);
|
$hargatebus = str_replace(',','',$hargatebus);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return response()->json($hargatebus);
|
return response()->json($hargatebus);
|
||||||
}
|
}
|
||||||
@@ -82,6 +82,7 @@ class TebusController extends Controller
|
|||||||
|
|
||||||
$harga_tebus = $gadai_data['bakihargajualan'] - $rebet;
|
$harga_tebus = $gadai_data['bakihargajualan'] - $rebet;
|
||||||
|
|
||||||
|
// $hargatebus = round($harga_tebus,PHP_ROUND_HALF_UP);
|
||||||
$hargatebus = bcdiv(round($harga_tebus,2),1,1);
|
$hargatebus = bcdiv(round($harga_tebus,2),1,1);
|
||||||
$hargatebus = number_format($hargatebus,2);
|
$hargatebus = number_format($hargatebus,2);
|
||||||
if(strpos($hargatebus,',')){
|
if(strpos($hargatebus,',')){
|
||||||
@@ -116,15 +117,15 @@ class TebusController extends Controller
|
|||||||
$upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']);
|
$upahsemasa_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['pinjaman']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP);
|
// $upah_semasa = round($upahsemasa_raw,PHP_ROUND_HALF_UP);
|
||||||
// $upah_semasa_round = number_format($upahsemasa_raw,2);
|
$upah_semasa_round = number_format($upahsemasa_raw,2);
|
||||||
// if(strpos($upah_semasa_round,',')){
|
if(strpos($upah_semasa_round,',')){
|
||||||
// $upah_semasa_round = str_replace(',','',$upah_semasa_round);
|
$upah_semasa_round = str_replace(',','',$upah_semasa_round);
|
||||||
// }
|
}
|
||||||
// $upah_semasa = substr($upah_semasa_round, 0, -1);
|
$upah_semasa = substr($upah_semasa_round, 0, -1);
|
||||||
// if(strpos($upah_semasa,',')){
|
if(strpos($upah_semasa,',')){
|
||||||
// $upah_semasa = str_replace(',','',$upah_semasa);
|
$upah_semasa = str_replace(',','',$upah_semasa);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return $upah_semasa;
|
return $upah_semasa;
|
||||||
}
|
}
|
||||||
@@ -155,15 +156,15 @@ class TebusController extends Controller
|
|||||||
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP);
|
// $upah_rebet = round($upahrebet_raw ,PHP_ROUND_HALF_UP);
|
||||||
// $upah_rebet_round = number_format($upahrebet_raw,2);
|
$upah_rebet_round = number_format($upahrebet_raw,2);
|
||||||
// if(strpos($upah_rebet_round,',')){
|
if(strpos($upah_rebet_round,',')){
|
||||||
// $upah_rebet_round = str_replace(',','',$upah_rebet_round);
|
$upah_rebet_round = str_replace(',','',$upah_rebet_round);
|
||||||
// }
|
}
|
||||||
// $upah_rebet = substr($upah_rebet_round, 0, -1);
|
$upah_rebet = substr($upah_rebet_round, 0, -1);
|
||||||
// if(strpos($upah_rebet,',')){
|
if(strpos($upah_rebet,',')){
|
||||||
// $upah_rebet = str_replace(',','',$upah_rebet);
|
$upah_rebet = str_replace(',','',$upah_rebet);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return $upah_rebet;
|
return $upah_rebet;
|
||||||
}
|
}
|
||||||
@@ -187,15 +188,15 @@ class TebusController extends Controller
|
|||||||
|
|
||||||
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
$upahrebet_raw = $bilang_bln * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
|
||||||
|
|
||||||
$upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP);
|
// $upah_rebet = round($upahrebet_raw,PHP_ROUND_HALF_UP);
|
||||||
// $upah_rebet_round = number_format($upahrebet_raw,2);
|
$upah_rebet_round = number_format($upahrebet_raw,2);
|
||||||
// if(strpos($upah_rebet_round,',')){
|
if(strpos($upah_rebet_round,',')){
|
||||||
// $upah_rebet_round = str_replace(',','',$upah_rebet_round);
|
$upah_rebet_round = str_replace(',','',$upah_rebet_round);
|
||||||
// }
|
}
|
||||||
// $upah_rebet = substr($upah_rebet_round, 0, -1);
|
$upah_rebet = substr($upah_rebet_round, 0, -1);
|
||||||
// if(strpos($upah_rebet,',')){
|
if(strpos($upah_rebet,',')){
|
||||||
// $upah_rebet = str_replace(',','',$upah_rebet);
|
$upah_rebet = str_replace(',','',$upah_rebet);
|
||||||
// }
|
}
|
||||||
|
|
||||||
$total_untung_rebet = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('keuntungan_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');
|
$total_untung_asal = TransaksiKeuntungan::on('mysql7')->where('norujukan','=',$norujukan)->sum('bayaran_keuntungan');
|
||||||
@@ -582,7 +583,7 @@ class TebusController extends Controller
|
|||||||
'created_at' => $current,
|
'created_at' => $current,
|
||||||
'bakiharga' => $baki_hargajualan,
|
'bakiharga' => $baki_hargajualan,
|
||||||
'nowakil' => (int)$request->nowakil,
|
'nowakil' => (int)$request->nowakil,
|
||||||
'duitpelanggan' => $request->duitpelanggan,
|
'duitpelanggan' => isset($request->duitpelanggan) ? $request->duitpelanggan : 0,
|
||||||
'bakipelanggan' => $request->bakipelanggan
|
'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']);
|
$array_upah = $onepercentservices->kiraanKeuntunganSebenar($gadai_data['pinjaman'],$gadai_data['nilaimarhun'],$gadai_data['kadarupah'],$gadai_data['percentpinj']);
|
||||||
$ujrah = $bilang_bln * $array_upah['ujrah'];
|
$ujrah = $bilang_bln * $array_upah['ujrah'];
|
||||||
$onepercent = $bilang_bln * $array_upah['onepercent'];
|
$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);
|
// $onepercent_semasa_round = number_format($onepercent,2);
|
||||||
if(strpos($ujrah_semasa_round,',')){
|
// if(strpos($onepercent_semasa_round,',')){
|
||||||
$ujrah_semasa_round = str_replace(',','',$ujrah_semasa_round);
|
// $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round);
|
||||||
}
|
// }
|
||||||
$ujrah_semasa = substr($ujrah_semasa_round, 0, -1);
|
// $onepercent_semasa = substr($onepercent_semasa_round, 0, -1);
|
||||||
if(strpos($ujrah_semasa,',')){
|
// if(strpos($onepercent_semasa,',')){
|
||||||
$ujrah_semasa = str_replace(',','',$ujrah_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];
|
return ['ujrah' => $ujrah_semasa, 'onepercent' => $onepercent_semasa];
|
||||||
}
|
}
|
||||||
@@ -2443,7 +2445,8 @@ class TebusController extends Controller
|
|||||||
$ujrah = $bilang_bln * $array_upah['ujrah'];
|
$ujrah = $bilang_bln * $array_upah['ujrah'];
|
||||||
$onepercent = $bilang_bln * $array_upah['onepercent'];
|
$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);
|
// $ujrah_semasa_round = number_format($ujrah,2);
|
||||||
// if(strpos($ujrah_semasa_round,',')){
|
// if(strpos($ujrah_semasa_round,',')){
|
||||||
// $ujrah_semasa_round = str_replace(',','',$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);
|
// $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);
|
// $onepercent_semasa_round = number_format($onepercent,2);
|
||||||
// if(strpos($onepercent_semasa_round,',')){
|
// if(strpos($onepercent_semasa_round,',')){
|
||||||
// $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round);
|
// $onepercent_semasa_round = str_replace(',','',$onepercent_semasa_round);
|
||||||
|
|||||||
@@ -50,22 +50,22 @@ class SMSPelangganSAGLAMAbysag extends Job
|
|||||||
$mobile_no = ltrim($this->telefon, '+6');
|
$mobile_no = ltrim($this->telefon, '+6');
|
||||||
// $mobile_no = '60178916936';
|
// $mobile_no = '60178916936';
|
||||||
// $message = 'test';
|
// $message = 'test';
|
||||||
$tarikhmatang = date('d-m-Y',strtotime($this->tmatang));
|
$tarikhmatang = $this->tmatang;
|
||||||
$tarikhmatang = date('d-m-Y',strtotime($this->tmatang));
|
$tarikhmatangnew = date('d-m-Y',strtotime($tarikhmatang));
|
||||||
$tarikhmatang1 = date('d-m-Y',strtotime($this->tmatang1));
|
$tarikhmatang1 = $this->tmatang1;
|
||||||
$date = $current->toDateString();
|
$tarikhmatang1new = date('d-m-Y',strtotime($tarikhmatang1));
|
||||||
$today = date('d-m-Y',strtotime($date));
|
$today = $current->toDateString();
|
||||||
// $current_date = new Carbon($current->toDateString());
|
// $current_date = new Carbon($current->toDateString());
|
||||||
if($this->lelong_tawarruq == '1'){
|
if($this->lelong_tawarruq == '1'){
|
||||||
if($tarikhmatang > $today){
|
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){
|
}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
|
}else
|
||||||
if($tarikhmatang1 < $today){
|
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){
|
}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'){
|
if(env('APP_ENV') != 'production'){
|
||||||
$mobile_no = env('ADMIN_PHONE_NUMBER');
|
$mobile_no = env('ADMIN_PHONE_NUMBER');
|
||||||
|
|||||||
@@ -51,21 +51,21 @@ class WhatsappPelangganSAGLAMAbysag extends Job
|
|||||||
$current = new Carbon();
|
$current = new Carbon();
|
||||||
$mobile_no = ltrim($this->telefon, '+6');
|
$mobile_no = ltrim($this->telefon, '+6');
|
||||||
// $mobile_no = '60178916936';
|
// $mobile_no = '60178916936';
|
||||||
$tarikhmatang = date('d-m-Y',strtotime($this->tmatang));
|
$tarikhmatang = $this->tmatang;
|
||||||
$tarikhmatang1 = date('d-m-Y',strtotime($this->tmatang1));
|
$tarikhmatangnew = date('d-m-Y',strtotime($tarikhmatang));
|
||||||
$date = $current->toDateString();
|
$tarikhmatang1 = $this->tmatang1;
|
||||||
$today = date('d-m-Y',strtotime($date));
|
$tarikhmatang1new = date('d-m-Y',strtotime($tarikhmatang1));
|
||||||
// $current_date = new Carbon($current->toDateString());
|
$today = $current->toDateString();
|
||||||
if($this->lelong_tawarruq == '1'){
|
if($this->lelong_tawarruq == '1'){
|
||||||
if($tarikhmatang > $today){
|
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){
|
}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
|
}else
|
||||||
if($tarikhmatang1 < $today){
|
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){
|
}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'){
|
if(env('APP_ENV') != 'production'){
|
||||||
$mobile_no = env('ADMIN_PHONE_NUMBER');
|
$mobile_no = env('ADMIN_PHONE_NUMBER');
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services\Reports;
|
||||||
|
|
||||||
|
use App\Cawangan;
|
||||||
|
use App\CawanganDetail;
|
||||||
|
use App\TransaksiKeuntungan;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class OnePercentService
|
||||||
|
{
|
||||||
|
|
||||||
|
// `B` stands for balance sheet and `L` stands for Ledger
|
||||||
|
|
||||||
|
public function __construct($kod_cawangan)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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'){
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddColumnUjrahStokauditbackdate extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var object $db_connection
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public function getActiveDB(){
|
||||||
|
$config_db = array_keys(config("database.connections"));
|
||||||
|
|
||||||
|
$db_connection = array_filter($config_db,function($connection){
|
||||||
|
try{
|
||||||
|
if($connection == 'mysql7')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$db = DB::connection($connection)->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']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,5 +8,10 @@ $router->group(['prefix'=>'api/reports'], function () use ($router){
|
|||||||
$router->get('penebusan/{kod_cawangan}', ['uses' => 'PenebusanController@getLaporanCawangan']);
|
$router->get('penebusan/{kod_cawangan}', ['uses' => 'PenebusanController@getLaporanCawangan']);
|
||||||
$router->get('ansuran', ['uses' => 'AnsuranController@getSummaryLaporanAnsuran']);
|
$router->get('ansuran', ['uses' => 'AnsuranController@getSummaryLaporanAnsuran']);
|
||||||
$router->get('ansuran/{kod_cawangan}', ['uses' => 'AnsuranController@getLaporanCawangan']);
|
$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']);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Services\Reports\OnePercentService as ReportOne;
|
||||||
|
|
||||||
|
|
||||||
|
$report = new ReportOne('KB2');
|
||||||
|
|
||||||
|
$test = $report->getTotalKeuntungan('B');
|
||||||
|
$test2 = $report->getTotalUjrah('B');
|
||||||
|
|
||||||
|
|
||||||
|
dd($test,$test2);
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user