pembiayaan semasa

This commit is contained in:
afiq
2021-02-15 12:34:36 +08:00
parent 5338b2699d
commit 96b1ee84e7
2 changed files with 10 additions and 7 deletions
+9 -6
View File
@@ -1140,16 +1140,19 @@ class GadaiController extends Controller
return response()->json(number_format($upahTerkumpul,2));
}
public function outstandingSemasaCustomer($ic){
$cawangan_all = Cawangan::on('mysql7')->get();
public function outstandingSemasaCustomer($ic,$kodcaw){
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$total_pembiayaan = 0;
foreach($cawangan_all as $index=>$cawangan){
$gadai = Gadai::on($cawangan['mysql'])->where([['nokp','=',$ic],['sttebus','=','']])->get();
if(sizeof($gadai) != 0){
foreach($gadai as $index=>$gadai_detail){
$gadai = Gadai::on($cawangan['mysql'])->where([['nokp','=',$ic],['sttebus','=','']])->get();
if(is_array($gadai) || is_object($gadai)){
foreach($gadai as $index=>$gadai_detail){
if($gadai_detail['pinjaman'] != 0 || $gadai_detail['pinjaman'] != null){
$total_pembiayaan += $gadai_detail['bakipjm'];
}else{
$total_pembiayaan += $gadai_detail['pinjaman'];
}
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
$router->get('gadaiansemasa/belum_serah/{kodcaw}',['uses'=>'GadaiController@getGadaianBelumSerah']);
$router->get('gadai/laporan/{kodcaw}/{tarikh}',['uses'=>'GadaiController@getLaporanGadai']);
$router->get('gadai/customers/{ic}/outstandingsemasa',['uses'=>'GadaiController@outstandingSemasaCustomer']);
$router->get('gadai/customers/{ic}/outstandingsemasa/{kodcaw}',['uses'=>'GadaiController@outstandingSemasaCustomer']);
$router->put('gadai/updatehistory/{kodcaw}/{norujukan}',['uses'=>'GadaiController@updateHistoryGadai']);
$router->get('senarai/lelong/{kodcaw}',['uses'=>'GadaiController@senaraiLelong']);