Пример #1
0
 public function post_delgroup()
 {
     $id = Input::get('id');
     if (!$id) {
         return false;
     }
     $group = Schedulefleetgroup::where('schedule_group_id', '=', $id)->get();
     if ($group) {
         foreach ($group as $x) {
             $fleet = Fleet::find($x->fleet_id);
             $fleet->fg_group = 0;
             $fleet->save();
         }
         DB::table('schedule_groups')->where('id', '=', $id)->delete();
         DB::table('schedule_fleet_groups')->where('schedule_group_id', '=', $id)->delete();
     }
     return Redirect::to('schedule/groups');
 }
Пример #2
0
    foreach (Schedulegroup::where_schedule_master_id($sm->id)->where_pool_id(Auth::user()->pool_id)->order_by('group')->get() as $grp) {
        echo 'Groups #';
        echo $grp->group;
        echo '<br>';
        echo '<table class="table table-bordered table-striped table-condensed">';
        echo '<thead>
							<tr><th>Body</th>
								<th>Driver</th>';
        for ($i = 1; $i <= $countmonth; $i++) {
            echo '<th>' . $i . '</th>';
        }
        echo '</tr>
						</thead>';
        $driver_ar = array();
        // loop fleet group
        foreach (Schedulefleetgroup::where_schedule_group_id($grp->id)->get() as $scf) {
            //echo 'fleet id'; echo $scf->fleet_id; echo '<br>';
            // loop  schedule
            $scdul = Schedule::where('fleet_id', '=', $scf->fleet_id)->where('pool_id', '=', Auth::user()->pool_id)->where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get();
            foreach ($scdul as $as) {
                // loop schedule date / driver
                $scheduledate = Scheduledate::where('schedule_id', '=', $as->id)->group_by('driver_id')->get(array('driver_id'));
                foreach ($scheduledate as $gdriver) {
                    if (!in_array($gdriver->driver_id, $driver_ar)) {
                        array_push($driver_ar, $gdriver->driver_id);
                    }
                }
            }
        }
        /********************************/
        /* Proses Pembuatan Jadwal View */