statistik gadaian
This commit is contained in:
@@ -1317,5 +1317,22 @@ class GadaiController extends Controller
|
|||||||
return response()->json($array_totalup);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,4 +280,6 @@ $router->group(['prefix'=>'dashboard'], function () use ($router){
|
|||||||
$router->get('totalPinjamanGadaian',['uses'=>'GadaiController@totalPinjamanGadaian']);
|
$router->get('totalPinjamanGadaian',['uses'=>'GadaiController@totalPinjamanGadaian']);
|
||||||
|
|
||||||
$router->post('gadaiTebusUpah',['uses'=>'GadaiController@bilanganTransaksi']);
|
$router->post('gadaiTebusUpah',['uses'=>'GadaiController@bilanganTransaksi']);
|
||||||
|
|
||||||
|
$router->get('statistik/gadaian',['uses'=>'GadaiController@statistikGadaian']);
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user