fix update
This commit is contained in:
@@ -30,6 +30,18 @@ use App\ARFiles;
|
|||||||
use App\WTDDraft;
|
use App\WTDDraft;
|
||||||
use App\SerahBaki;
|
use App\SerahBaki;
|
||||||
use App\WTD;
|
use App\WTD;
|
||||||
|
use App\StokAudit1;
|
||||||
|
use App\StokAudit2;
|
||||||
|
use App\StokAudit3;
|
||||||
|
use App\StokAudit4;
|
||||||
|
use App\StokAudit5;
|
||||||
|
use App\StokAudit6;
|
||||||
|
use App\StokAudit7;
|
||||||
|
use App\StokAudit8;
|
||||||
|
use App\StokAudit9;
|
||||||
|
use App\StokAudit10;
|
||||||
|
use App\StokAudit11;
|
||||||
|
use App\StokAudit12;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@@ -671,7 +683,7 @@ class AdminPageController extends Controller
|
|||||||
->whereYear('t_update',$current->year)
|
->whereYear('t_update',$current->year)
|
||||||
->where([['sttebus','!=',''],['t_update','<=',$current->toDateString()],['t_update','>=',$monthly_date]])
|
->where([['sttebus','!=',''],['t_update','<=',$current->toDateString()],['t_update','>=',$monthly_date]])
|
||||||
->orderBy('t_update','asc')
|
->orderBy('t_update','asc')
|
||||||
->get();
|
->get()->toArray();
|
||||||
|
|
||||||
$ansuran = Transaction::on('mysql7')
|
$ansuran = Transaction::on('mysql7')
|
||||||
->selectRaw('SUM(trans.bayaran_pembiayaan) AS total')
|
->selectRaw('SUM(trans.bayaran_pembiayaan) AS total')
|
||||||
@@ -688,7 +700,7 @@ class AdminPageController extends Controller
|
|||||||
->where('transaction.trans_type','=','A')
|
->where('transaction.trans_type','=','A')
|
||||||
->where([['trans.tarikh_bayaran','>=',$monthly_date . ' 00:00:00'],['trans.tarikh_bayaran','<=',$current->toDateString() . ' 23:59:59']])
|
->where([['trans.tarikh_bayaran','>=',$monthly_date . ' 00:00:00'],['trans.tarikh_bayaran','<=',$current->toDateString() . ' 23:59:59']])
|
||||||
->where('trans.kodcaw','=',$request->kodcaw)
|
->where('trans.kodcaw','=',$request->kodcaw)
|
||||||
->get()->toArray();
|
->get()->toArray();
|
||||||
|
|
||||||
$total_tebus = 0;
|
$total_tebus = 0;
|
||||||
foreach($array_totalup as $array_index=>$totalup){
|
foreach($array_totalup as $array_index=>$totalup){
|
||||||
@@ -1139,7 +1151,7 @@ class AdminPageController extends Controller
|
|||||||
->whereYear('t_update',$current->year)
|
->whereYear('t_update',$current->year)
|
||||||
->where([['sttebus','!=',''],['t_update','<=',$harini],['t_update','>=',$monthly_date]])
|
->where([['sttebus','!=',''],['t_update','<=',$harini],['t_update','>=',$monthly_date]])
|
||||||
->orderBy('t_update','asc')
|
->orderBy('t_update','asc')
|
||||||
->sum('pinjaman');
|
->sum('bakipjm');
|
||||||
|
|
||||||
switch($current->month){
|
switch($current->month){
|
||||||
case 1: $bulan = 'Januari';
|
case 1: $bulan = 'Januari';
|
||||||
@@ -2666,4 +2678,68 @@ class AdminPageController extends Controller
|
|||||||
return response()->json($upahlelong,200);
|
return response()->json($upahlelong,200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function LaporanAging(Request $request){
|
||||||
|
|
||||||
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$request->kodcaw)->first();
|
||||||
|
$bulan = $request->bulan;
|
||||||
|
$tahun = $request->tahun;
|
||||||
|
|
||||||
|
if($bulan == 1){
|
||||||
|
$audit = StokAudit1::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 2){
|
||||||
|
$audit = StokAudit2::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 3){
|
||||||
|
$audit = StokAudit3::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 4){
|
||||||
|
$audit = StokAudit4::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 5){
|
||||||
|
$audit = StokAudit5::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 6){
|
||||||
|
$audit = StokAudit6::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 7){
|
||||||
|
$audit = StokAudit7::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 8){
|
||||||
|
$audit = StokAudit8::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 9){
|
||||||
|
$audit = StokAudit9::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 10){
|
||||||
|
$audit = StokAudit10::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 11){
|
||||||
|
$audit = StokAudit11::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}elseif($bulan == 12){
|
||||||
|
$audit = StokAudit12::on($cawangan['mysql'])->where('tahun',$tahun);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($audit->where('tempoh','<=',5)->count());
|
||||||
|
|
||||||
|
$jumlahrekod = $audit->count();
|
||||||
|
$jumlahpinjaman = $audit->sum('pinjaman');
|
||||||
|
|
||||||
|
$arraycount = [];
|
||||||
|
$arraysum = [];
|
||||||
|
$arrayall = [];
|
||||||
|
|
||||||
|
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('pinjaman');
|
||||||
|
array_push($arraycount,${"tempoh".$i."count"});
|
||||||
|
array_push($arraysum,${"tempoh".$i."sum"});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
array_push($arrayall,['count' => $arraycount,'sum' => $arraysum]);
|
||||||
|
if(sizeof($arrayall) == 0){
|
||||||
|
return response()->json('failed',200);
|
||||||
|
}else{
|
||||||
|
return response()->json($arrayall,200);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -717,6 +717,7 @@ $router->group(['prefix'=>'admin'], function () use ($router){
|
|||||||
$router->get('wtd/rekod/{batchno}',['uses'=>'AdminPageController@rekodWTDByBatchNo']);
|
$router->get('wtd/rekod/{batchno}',['uses'=>'AdminPageController@rekodWTDByBatchNo']);
|
||||||
|
|
||||||
$router->get('audit/keuntungansebenar',['uses'=>'AdminPageController@KeuntunganSebenarExport']);
|
$router->get('audit/keuntungansebenar',['uses'=>'AdminPageController@KeuntunganSebenarExport']);
|
||||||
|
$router->get('laporan/aging',['uses'=>'AdminPageController@LaporanAging']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user