statistik gadaian

This commit is contained in:
Afiq
2021-01-16 22:45:32 +08:00
parent 15b0bb8f60
commit 28f00f7f39
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -1317,5 +1317,22 @@ class GadaiController extends Controller
return response()->json($array_totalup);
}
public function statistikGadaian(){
$current = Carbon::now();
$current = new Carbon();
$cawangan_all = Cawangan::on('mysql7')->get();
$array_total = ['total_sag'=>0,'total_customer'=>0];
foreach($cawangan_all as $index=>$cawangan){
$gadai = Gadai::on($cawangan['mysql'])->selectRaw('COUNT(norujukan) AS totalsag,COUNT(DISTINCT nokp) as totalcustomer')->where('t_gadai','=',$current->toDateString())->get();
$total_sag = $array_total['total_sag'];
$total_sag += $gadai[0]['totalsag'];
$totalcustomer = $array_total['total_customer'];
$totalcustomer += $gadai[0]['totalcustomer'];
$array_total['total_sag'] = $total_sag;
$array_total['total_customer'] = $totalcustomer;
}
return response()->json($array_total);
}
}
+2
View File
@@ -280,4 +280,6 @@ $router->group(['prefix'=>'dashboard'], function () use ($router){
$router->get('totalPinjamanGadaian',['uses'=>'GadaiController@totalPinjamanGadaian']);
$router->post('gadaiTebusUpah',['uses'=>'GadaiController@bilanganTransaksi']);
$router->get('statistik/gadaian',['uses'=>'GadaiController@statistikGadaian']);
});