outstanding

This commit is contained in:
Afiq
2021-01-05 14:25:59 +08:00
parent 2c7b2cfb9a
commit a071836fb9
3 changed files with 21 additions and 5 deletions
+15 -1
View File
@@ -878,5 +878,19 @@ class GadaiController extends Controller
return response()->json($upahToday);
}
public function outstandingSemasa($ic){
$cawangan_all = Cawangan::on('mysql7')->get();
$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){
$total_pembiayaan += $gadai_detail['pinjaman'];
}
}
}
return response()->json($total_pembiayaan);
}
}