public function get_dataksmurni($date = false) { if (!$date) { $date = date('Y-m-d'); } $month = date('n', strtotime($date)); $year = date('Y', strtotime($date)); $series = array(); $categories = array(); foreach (Pool::all() as $pool) { $datafianan = array(); for ($j = 1; $j <= date('t', strtotime($date)); $j++) { $categories[] = $j; $datafianan[] = 0; } $reportdaily = DB::table('financial_report_graf_ks_detail')->where_month($month)->where_year($year)->order_by('operasi_time', 'asc')->where_pool_id($pool->id)->where_in('operasi_status_id', array(1, 3))->where('setoran_cash', '<', 50000000)->group_by('operasi_time')->get(array('operasi_time', DB::raw('sum(ks) as subks'))); $arraydata = array(); foreach ($reportdaily as $finan) { $potition = date('j', strtotime($finan->operasi_time)) - 1; $arraydata[$potition] = (int) $finan->subks; } $datas = array_replace($datafianan, $arraydata); $series[] = array('name' => $pool->pool_name, 'data' => $datas); } $returndata = array('categories' => $categories, 'series' => $series); return json_encode($returndata); }
public function get_add() { $this->data['pools'] = Koki::to_dropdown(Pool::all(), 'id', 'pool_name', array(0 => 'All')); $this->data['users'] = Koki::to_dropdown(User::all(), 'id', 'first_name'); $this->data['create'] = true; return View::make('themes.modul.' . $this->views . '.form', $this->data); }
public function get_datamonthly($date = false) { if (!$date) { $date = date('Y-m-d'); } $year = date('Y', strtotime($date)); $series = array(); $categories = array(); foreach (Pool::all() as $pool) { $datafianan = array(); for ($j = 1; $j <= 12; $j++) { $categories[] = $j; $datafianan[] = 0; } $reportmonthly = DB::table('financial_report_summary_month_graf')->where_year($year)->order_by('operasi_time', 'asc')->where_pool_id($pool->id)->where('setoran_cash', '<', 993000000)->get(); $arraydata = array(); $bulan = 0; foreach ($reportmonthly as $finan) { $potition = $finan->month; $arraydata[$potition] = (int) ($finan->setoran_cash - ($finan->biaya_cuci + $finan->iuran_laka)); } $datas = array_replace($datafianan, $arraydata); $series[] = array('name' => $pool->pool_name, 'data' => $datas); } $returndata = array('categories' => $categories, 'series' => $series); return json_encode($returndata); }
public function get_edit($id = false) { if (!$id) { return Redirect::to('fleets'); } $brands = array(); $models = array(); $pools = array(); foreach (Fleetbrand::all() as $brand) { $brands[$brand->id] = $brand->fleet_brand; } foreach (Fleetmodel::all() as $model) { $models[$model->id] = $model->fleet_model; } foreach (Pool::all() as $pool) { $pools[$pool->id] = $pool->pool_name; } $this->data['brands'] = $brands; $this->data['models'] = $models; $this->data['pools'] = $pools; $this->data['create'] = false; $this->data['fleet'] = Fleet::find($id); return View::make('themes.modul.' . $this->views . '.form', $this->data); }
/** * Our user article create function * **/ public function get_create() { $this->data['create'] = true; $this->data['roles'] = Role::all(); $opt = array(); foreach (Pool::all() as $po) { $opt[$po->id] = $po->pool_name; } $this->data['pools'] = $opt; return View::make('themes.modul.' . $this->views . '.form', $this->data); }
public function get_editkso($id = false) { if (!$id) { Redirect::to('ksos'); } $kso = Kso::find($id); $optionspool = array(); foreach (Pool::all() as $pool) { $optionspool[$pool->id] = $pool->pool_name; } $opttipe = array(); foreach (Ksotype::all() as $tipe) { $opttipe[$tipe->id] = $tipe->type; } $optionFleet = array(); $optionFleet['null'] = '----'; //$fleets = Fleet::where_pool_id($kso->pool_id)->order_by('taxi_number','asc')->get(array('id','taxi_number')); $fleets = Fleet::order_by('taxi_number', 'asc')->get(array('id', 'taxi_number')); if ($fleets) { foreach ($fleets as $fo) { $optionFleet[$fo->id] = $fo->taxi_number; } } $optionDriver = array(); $optionDriver['null'] = '----'; //$drivers = Driver::where_pool_id($kso->pool_id)->order_by('nip', 'asc')->get(array('id','nip','name')); $drivers = Driver::order_by('nip', 'asc')->get(array('id', 'nip', 'name')); if ($drivers) { foreach ($drivers as $do) { $optionDriver[$do->id] = $do->nip . ' - ' . $do->name; } } $this->data['statuskso'] = array('1' => 'Active', '2' => 'Gugur KSO', '3' => 'Selesai KSO'); $this->data['pools'] = $optionspool; $this->data['kso_types'] = $opttipe; $this->data['datakso'] = $kso; $this->data['fleets'] = $optionFleet; $this->data['drivers'] = $optionDriver; return View::make('themes.modul.' . $this->views . '.formeditkso', $this->data); }
public function get_edit($id = false) { if (!$id) { return Redirect::to('drivers'); } $cities = array(); $pools = array(); foreach (City::all() as $city) { $cities[$city->id] = $city->city; } foreach (Pool::all() as $pool) { $pools[$pool->id] = $pool->pool_name; } $this->data['cities'] = $cities; $this->data['pools'] = $pools; $this->data['driver'] = Driver::find($id); $this->data['create'] = false; $this->data['driver_id'] = $id; return View::make('themes.modul.' . $this->views . '.form', $this->data); }