Merge branch 'adminapi' into 'master'
Adminapi See merge request online-sistem1/api_arrahn!156
This commit is contained in:
@@ -2346,9 +2346,21 @@ class AdminPageController extends Controller
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||
|
||||
$latestbatch = SerahBaki::on($cawangan['mysql'])->where('norujukan','baru')->get();
|
||||
$latestbatch = SerahBaki::on($cawangan['mysql'])->where('norujukan','baru')->get()->toArray();
|
||||
$batch_old = WTDDraft::on('mysql7')->select('kodcaw')->where('batchno_serah',0)->where('kodcaw',$request->kodcaw)
|
||||
->groupBy('kodcaw')->get();
|
||||
|
||||
return response()->json($latestbatch,200);
|
||||
$batch_old_noruj = WTDDraft::on('mysql7')->where('batchno_serah',0)->where('kodcaw',$request->kodcaw)->pluck('norujukan');
|
||||
$lelong_data = Lelong::on($cawangan['mysql'])->whereIn('norujukan',$batch_old_noruj)->get();
|
||||
|
||||
foreach($batch_old as $index=>$bo)
|
||||
{
|
||||
array_push($latestbatch,['recno' => 0,'norujukan' => 'lama','batchno' => 0,'baki' => $lelong_data->sum('baki'),'aktif' => 1]);
|
||||
}
|
||||
|
||||
$data = $this->paginate($latestbatch,8);
|
||||
|
||||
return response()->json($data,200);
|
||||
|
||||
}
|
||||
|
||||
@@ -2714,7 +2726,7 @@ class AdminPageController extends Controller
|
||||
// dd($audit->where('tempoh','<=',5)->count());
|
||||
|
||||
$jumlahrekod = $audit->count();
|
||||
$jumlahpinjaman = $audit->sum('pinjaman');
|
||||
$jumlahpinjaman = $audit->sum('bakipjm');
|
||||
|
||||
$arraycount = [];
|
||||
$arraysum = [];
|
||||
@@ -2729,7 +2741,7 @@ class AdminPageController extends Controller
|
||||
}else{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',$i-1],['tempoh','<=',$i]])->count();
|
||||
}
|
||||
${"tempoh".$i."sum"} = ${"tempoh".$i}->sum('pinjaman');
|
||||
${"tempoh".$i."sum"} = ${"tempoh".$i}->sum('bakipjm');
|
||||
array_push($arraycount,${"tempoh".$i."count"});
|
||||
array_push($arraysum,${"tempoh".$i."sum"});
|
||||
}
|
||||
@@ -2742,4 +2754,71 @@ class AdminPageController extends Controller
|
||||
return response()->json($arrayall,200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function DashboardAging(Request $request){
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$harini = $current->toDateString();
|
||||
$jenislaporan = $request->options;
|
||||
|
||||
|
||||
if($jenislaporan === 'sebenar')
|
||||
{
|
||||
$audit = Gadai::on($cawangan['mysql'])
|
||||
->where(function ($query) use ($harini) {
|
||||
$query->where([['tagpalsu','=',0],['t_gadai','<=',$harini],['sttebus','=','']])
|
||||
->orWhere([['tagpalsu','=',0],['t_update','>',$harini],['sttebus','!=',''],['t_gadai','<=',$harini]]);
|
||||
});
|
||||
|
||||
}elseif($jenislaporan === 'datalelong')
|
||||
{
|
||||
$audit = Gadai::on($cawangan['mysql'])
|
||||
// ->where([['tagpalsu','=',0],['t_gadai','<=',$harini],['sttebus','=',''],['lelong_tawarruq',1]])
|
||||
// ->orWhere([['tagpalsu','=',0],['t_update','>',$harini],['sttebus','!=',''],['t_gadai','<=',$harini],['lelong_tawarruq',1]]);
|
||||
->where(function ($query) use ($harini) {
|
||||
$query->where([['tagpalsu','=',0],['t_gadai','<=',$harini],['sttebus','=',''],['lelong_tawarruq',1]])
|
||||
->orWhere([['tagpalsu','=',0],['t_update','>',$harini],['sttebus','!=',''],['t_gadai','<=',$harini],['lelong_tawarruq',1]]);
|
||||
});
|
||||
|
||||
}else{
|
||||
$audit = Gadai::on($cawangan['mysql'])
|
||||
->where(function ($query) use ($harini) {
|
||||
$query->where([['tagpalsu','=',0],['t_gadai','<=',$harini],['sttebus','=',''],['lelong_tawarruq',0]])
|
||||
->orWhere([['tagpalsu','=',0],['t_update','>',$harini],['sttebus','!=',''],['t_gadai','<=',$harini],['lelong_tawarruq',0]]);
|
||||
});
|
||||
}
|
||||
|
||||
$rekodaudit = $audit->get();
|
||||
$countaudit = $audit->count();
|
||||
$sumaudit = $audit->sum('bakipjm');
|
||||
|
||||
$arraycount = [];
|
||||
$arraysum = [];
|
||||
|
||||
for ($i = 1; $i <= 13; $i++)
|
||||
{
|
||||
${"tempoh".$i} = clone $audit;
|
||||
if($i == 13)
|
||||
{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where('tempoh','>',12)->count();
|
||||
}else{
|
||||
${"tempoh".$i."count"} = ${"tempoh".$i}->where([['tempoh','>',$i-1],['tempoh','<=',$i]])->count();
|
||||
}
|
||||
${"tempoh".$i."sum"} = ${"tempoh".$i}->sum('bakipjm');
|
||||
array_push($arraycount,${"tempoh".$i."count"});
|
||||
array_push($arraysum,${"tempoh".$i."sum"});
|
||||
}
|
||||
|
||||
array_push($arraycount,$countaudit);
|
||||
array_push($arraysum,$sumaudit);
|
||||
|
||||
$arrayall = ['count' => $arraycount,'sum' => $arraysum];
|
||||
|
||||
return response()->json($arrayall,200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -718,6 +718,8 @@ $router->group(['prefix'=>'admin'], function () use ($router){
|
||||
|
||||
$router->get('audit/keuntungansebenar',['uses'=>'AdminPageController@KeuntunganSebenarExport']);
|
||||
$router->get('laporan/aging',['uses'=>'AdminPageController@LaporanAging']);
|
||||
$router->get('dashboard/aging',['uses'=>'AdminPageController@DashboardAging']);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user