Dashboard API
This commit is contained in:
@@ -814,6 +814,69 @@ class GadaiController extends Controller
|
||||
return response()->json($gadaiToday);
|
||||
|
||||
}
|
||||
public function showAllTebusToday()
|
||||
{
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$tebusToday = 0;
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$tebus = Tebus::on($cawangan['mysql'])->where('t_tebus','=',$current->toDateString())->get();
|
||||
if(sizeof($tebus) != 0){
|
||||
foreach($tebus as $tebusall)
|
||||
{
|
||||
$tebusToday += $tebusall['pinjaman'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return response()->json($tebusToday);
|
||||
}
|
||||
public function showAllVariasiToday()
|
||||
{
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$variasiToday = 0;
|
||||
$tebusToday = 0;
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$tebus = Tebus::on($cawangan['mysql'])->where('t_tebus','=',$current->toDateString())->get();
|
||||
if(sizeof($tebus) != 0){
|
||||
foreach($tebus as $tebusall)
|
||||
{
|
||||
$tebusToday += $tebusall['pinjaman'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$gadaiToday = 0;
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$current->toDateString())->get();
|
||||
if(sizeof($gadai) != 0){
|
||||
foreach($gadai as $gadaiall)
|
||||
{
|
||||
$gadaiToday += $gadaiall['pinjaman'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$variasiToday = $gadaiToday - $tebusToday;
|
||||
return response()->json($variasiToday);
|
||||
}
|
||||
public function showAllUpahToday()
|
||||
{
|
||||
$cawangan_all = Cawangan::on('mysql7')->get();
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
$upahToday = 0;
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$upah = Tebus::on($cawangan['mysql'])->where('t_tebus','=',$current->toDateString())->get();
|
||||
if(sizeof($upah) != 0){
|
||||
foreach($upah as $upahall)
|
||||
{
|
||||
$upahToday += $upahall['bakiupah'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return response()->json($upahToday);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -211,4 +211,7 @@ $router->group(['prefix'=>'mobile'], function () use ($router){
|
||||
|
||||
$router->group(['prefix'=>'dashboard'], function () use ($router){
|
||||
$router->get('jumlahGadai',['uses'=>'GadaiController@showAllGadaiToday']);
|
||||
$router->get('jumlahTebus',['uses'=>'GadaiController@showAllTebusToday']);
|
||||
$router->get('jumlahUpah',['uses'=>'GadaiController@showAllUpahToday']);
|
||||
$router->get('jumlahVariasi',['uses'=>'GadaiController@showAllVariasiToday']);
|
||||
});
|
||||
Reference in New Issue
Block a user