Commit 9ff4fd0d by Novan Bagus Setiawan

update combo tahun kelompokController.php

parent aed5d5c9
...@@ -32,7 +32,14 @@ class KelompokController extends Controller ...@@ -32,7 +32,14 @@ class KelompokController extends Controller
$tahun= $request->get('tahun'); $tahun= $request->get('tahun');
if($tahun == '0') if($tahun == '0')
$tahun = date('Y'); {
$periode = Periode::where('status', '1')->first();
$tahun = $periode->periode_id;
}
else
{
$periode = Periode::where('nama', $tahun)->first();
}
## Read value ## Read value
$draw = $request->get('draw'); $draw = $request->get('draw');
...@@ -59,9 +66,11 @@ class KelompokController extends Controller ...@@ -59,9 +66,11 @@ class KelompokController extends Controller
$statementGlobal .= " AND STATUS = '".$status."'"; $statementGlobal .= " AND STATUS = '".$status."'";
} }
if($tahun != "0") if($tahun == '0')
{}
else
{ {
$statementGlobal .= " AND TO_CHAR(KELOMPOK.CREATED_AT, 'YYYY') = '".$tahun."'"; $statementGlobal .= " AND PERIODE_ID = '".$periode->periode_id."'";
} }
$totalRecords = Kelompok::select('count(1) as allcount')->whereRaw($statementGlobal)->count(); $totalRecords = Kelompok::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment