Esempio n. 1
0
 public function schedules()
 {
     $schedules = Schedule::where('user_id', '=', Auth::user()->id)->paginate(10);
     $page_data = array('schedules' => $schedules);
     $this->layout->title = 'Schedules';
     $this->layout->content = View::make('admin.schedules', $page_data);
 }
 /**
  * Generate the view of the week for given month and given year
  * with events in this period.
  *
  * @param string $year
  * @param string $week 
  * @return view weekView
  *
  *
  */
 public function showWeek($year, $week)
 {
     // Create week start date on monday (day 1)
     $weekStart = date('Y-m-d', strtotime($year . "W" . $week . '1'));
     // Create the number of the next week
     $nextWeek = date("W", strtotime("next Week" . $weekStart));
     $nextYear = date("Y", strtotime("next Week" . $weekStart));
     // Create week end date - we go till tuesday (day 2) because café needs alternative week view (Mi-Di)
     $weekEnd = date('Y-m-d', strtotime($nextYear . "W" . $nextWeek . '2'));
     // Create the number of the previous week
     $previousWeek = date("W", strtotime("previous Week" . $weekStart));
     $previousYear = date("Y", strtotime("previous Week" . $weekStart));
     // Convert number of prev/next week to verbatim format - needed for correct << and >> button links
     $nextWeek = $nextYear . "/KW" . $nextWeek;
     $previousWeek = $previousYear . "/KW" . $previousWeek;
     $date = array('year' => $year, 'week' => $week, 'weekStart' => $weekStart, 'weekEnd' => $weekEnd, 'nextWeek' => $nextWeek, 'previousWeek' => $previousWeek);
     $events = ClubEvent::where('evnt_date_start', '>=', $weekStart)->where('evnt_date_start', '<=', $weekEnd)->with('getPlace', 'getSchedule.getEntries.getJobType', 'getSchedule.getEntries.getPerson.getClub')->orderBy('evnt_date_start')->orderBy('evnt_time_start')->get();
     $tasks = Schedule::where('schdl_show_in_week_view', '=', '1')->where('schdl_due_date', '>=', $weekStart)->where('schdl_due_date', '<=', $weekEnd)->with('getEntries.getPerson.getClub', 'getEntries.getJobType')->get();
     // TODO: don't use raw query, rewrite with eloquent.
     $persons = Cache::remember('personsForDropDown', 10, function () {
         $timeSpan = new DateTime("now");
         $timeSpan = $timeSpan->sub(DateInterval::createFromDateString('3 months'));
         return Person::whereRaw("prsn_ldap_id IS NOT NULL \n\t\t\t\t\t\t\t\t\t\t AND (prsn_status IN ('aktiv', 'kandidat') \n\t\t\t\t\t\t\t\t\t\t OR updated_at>='" . $timeSpan->format('Y-m-d H:i:s') . "')")->orderBy('clb_id')->orderBy('prsn_name')->get();
     });
     $clubs = Club::orderBy('clb_title')->lists('clb_title', 'id');
     // IDs of schedules shown, needed for bulk-update
     $updateIds = array();
     foreach ($events as $event) {
         array_push($updateIds, $event->getSchedule->id);
     }
     return View::make('weekView', compact('events', 'schedules', 'date', 'tasks', 'entries', 'weekStart', 'weekEnd', 'persons', 'clubs'));
 }
Esempio n. 3
0
 public function get_fleetsonnotprintspj()
 {
     $date = Input::get('date', date('Y-m-d'));
     $pool_id = Auth::user()->pool_id;
     $timestamp = strtotime($date);
     /*
     $fleets_on_not_printspj = Scheduledate::join('schedules','schedules.id','=','schedule_dates.schedule_id')
                 ->join('fleets', 'fleets.id', '=', 'schedules.fleet_id' )
                 //->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id' )
                 //->where_in('schedule_dates.schedule_id', $arrayschedule )
                 //->where('ksos.actived','=',1)
                 ->where('schedules.pool_id', '=', $pool_id )
                 ->where('schedule_dates.date', '=', date('j', $timestamp))
                 ->where('schedules.month','=',date('n', $timestamp ))
                 ->where('schedule_dates.fg_check','=',0)                  
                 ->order_by('fleets.taxi_number','asc')
                 ->get(array('schedule_dates.id as id','schedule_dates.driver_id','schedules.fleet_id','fleets.taxi_number'));
     */
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets_on_not_printspj = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets_on_not_printspj = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedule_dates.fg_check', '=', 0)->order_by('fleets.taxi_number', 'asc')->get(array('fleets.taxi_number', 'schedule_dates.id as id'));
     }
     $datas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets_on_not_printspj);
     return Response::json($datas);
 }
Esempio n. 4
0
 public function post_search()
 {
     $jsondata = Input::json();
     $date = $jsondata->date;
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('ksos.actived', '=', 1)->where('taxi_number', 'LIKE', '%' . $jsondata->taxi_number . '%')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
     }
     $fleetdatas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets);
     $data['fleet'] = $fleetdatas;
     return json_encode($data);
 }
Esempio n. 5
0
 public function get_schedule()
 {
     $callback = Input::get('callback');
     $date = Input::get('date', date('Y-m-d'));
     $pool = Input::get('pool');
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', $pool)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('ksos.actived', '=', 1)->order_by('fleets.taxi_number', 'asc')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number', 'schedule_dates.fg_check as out'));
         //->get(array('fleets.taxi_number','schedule_dates.id as id', 'schedule_dates.fg_check as out'));
     }
     $fleetdatas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets);
     return Response::jsonp($callback, $fleetdatas);
 }
 /**
  * Generate the view of the calender for given month and given year
  * with events in this period.
  *
  * @param string $year
  * @param string $month 
  * @return view monthView
  */
 public function showMonth($year, $month)
 {
     // Create a string of the start of the month
     $monthStart = $year . $month . '01';
     // String of end of month
     $monthEnd = $year . $month . '31';
     // Create timestamp of the first day of selected month. Time 12:12:12 used only as dummy time
     $usedTime = mktime(12, 12, 12, $month, 1, $year);
     // Create a int with the number of days of the month (28...31)
     $daysOfMonth = date("t", $usedTime);
     // Create a timestamp with start of month
     $startStamp = mktime(0, 0, 0, date("n", $usedTime), 1, date("Y", $usedTime));
     // Int for the start day
     $startDay = date("N", $startStamp);
     // Int for the lst day
     $endDay = date("N", mktime(0, 0, 0, date("n", $usedTime), $daysOfMonth, date("Y", $usedTime)));
     // Array for german translation of the month names
     $monthName = array(1 => Config::get('messages_de.month-name-jan'), 2 => Config::get('messages_de.month-name-feb'), 3 => Config::get('messages_de.month-name-mar'), 4 => Config::get('messages_de.month-name-apr'), 5 => Config::get('messages_de.month-name-may'), 6 => Config::get('messages_de.month-name-jun'), 7 => Config::get('messages_de.month-name-jul'), 8 => Config::get('messages_de.month-name-aug'), 9 => Config::get('messages_de.month-name-sep'), 10 => Config::get('messages_de.month-name-oct'), 11 => Config::get('messages_de.month-name-nov'), 12 => Config::get('messages_de.month-name-dec'));
     $date = array('year' => $year, 'month' => $month, 'daysOfMonth' => $daysOfMonth, 'startDay' => $startDay, 'endDay' => $endDay, 'startStamp' => $startStamp, 'usedTime' => $usedTime, 'monthName' => $monthName[date("n", $usedTime)]);
     $events = ClubEvent::where('evnt_date_start', '>=', $monthStart)->where('evnt_date_start', '<=', $monthEnd)->orderBy('evnt_date_start')->orderBy('evnt_time_start')->get();
     $tasks = Schedule::where('schdl_show_in_week_view', '=', '1')->where('schdl_due_date', '>=', $monthStart)->where('schdl_due_date', '<=', $monthEnd)->get();
     return View::make('monthView', compact('events', 'tasks', 'date'));
 }
 public function get_schedules()
 {
     $schedules = Schedule::where('doctor_id', Session::get('doctor.id'))->where('date', 'like', Input::get('date', date('Y-m')) . '%')->orderBy('date')->get();
     //->paginate( $this->default_num_per_page );
     $schedules_map = array();
     foreach ($schedules as $schedule) {
         $date_parse = date('m-d', strtotime($schedule->date));
         if (!array_key_exists($schedule->date, $schedules_map)) {
             $schedules_map[$schedule->date] = array();
         }
         $schedules_map[$schedule->date][$schedule->period] = array('id' => $schedule->id, 'period' => $schedule->period);
     }
     $page = (int) Input::get('page');
     $schedule_count = count($schedules_map);
     $max_page = $schedule_count % $this->default_num_per_page;
     if ($page > $max_page) {
         $page = $max_page;
     }
     if ($page < 1) {
         $page = 1;
     }
     $result = array_slice($schedules_map, ($page - 1) * $this->default_num_per_page, $this->default_num_per_page);
     return Response::json(array('error_code' => 0, 'totality' => $schedule_count, 'schedules' => $result));
 }
Esempio n. 8
0
 public function post_toolspj()
 {
     $date = Input::get('tanggal', date('Y-m-d'));
     ini_set('max_execution_time', 120);
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('schedule_dates.shift_id', '=', 1)->where('ksos.actived', '=', 1)->order_by('fleets.taxi_number', 'asc')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
     }
     if ($fleets) {
         foreach ($fleets as $f) {
             $scheduledate = Scheduledate::find($f->id);
             $scheduledate->fg_check = 1;
             $scheduledate->save();
             $schedule = Schedule::find($scheduledate->schedule_id);
             //$driverinfo = Driver::find($scheduledate->driver_id);
             //$fleetinfo = Fleet::find($schedule->fleet_id);
             $ksoinfo = Kso::where_fleet_id($schedule->fleet_id)->where_actived(1)->first();
             $dateopertion = mktime(0, 0, 0, $schedule->month, $scheduledate->date, $schedule->year);
             $checkouts = Checkout::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
             //delete checkouts
             if ($checkouts) {
                 $checkouts->delete();
             }
             $codeops = 1;
             $status = 7;
             $keterangan = 'Print SPJ melalui Tools';
             if (!$checkouts) {
                 //insert into to checkouts step
                 $checkouts = new Checkout();
                 $checkouts->kso_id = $ksoinfo->id;
                 $checkouts->operasi_time = date('Y-m-d', $dateopertion);
                 $checkouts->fleet_id = $schedule->fleet_id;
                 $checkouts->driver_id = $scheduledate->driver_id;
                 $checkouts->checkout_step_id = $status;
                 $checkouts->shift_id = $scheduledate->shift_id;
                 $checkouts->user_id = Auth::user()->id;
                 $checkouts->pool_id = Auth::user()->pool_id;
                 $checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
                 $checkouts->operasi_status_id = $codeops;
                 $checkouts->keterangan = $keterangan;
                 $checkouts->save();
                 $cinada = Checkin::where('operasi_time', '=', date('Y-m-d', $dateopertion))->where('fleet_id', '=', $schedule->fleet_id)->first();
                 if ($cinada) {
                     $cinada->delete();
                 }
                 if (!$cinada) {
                     $cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $schedule->fleet_id, 'driver_id' => $scheduledate->driver_id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 2, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
                     if ($cin) {
                         $docs = new Checkindocument();
                         $docs->checkin_id = $cin->id;
                         $docs->save();
                         //return Redirect::to('schedule');
                     }
                     //
                 }
             }
         }
         return Redirect::to('schedule');
     }
 }
Esempio n. 9
0
 public function getLastPlayableVideoDuration()
 {
     $videostoShow = array();
     $currentTime = date('h:i:s A');
     $today = date("Y-m-d");
     $videoCounter = 0;
     $timestamp = 0;
     // dd(new DateTime('today'));
     $activeSchedule = Schedule::where('active', '=', '1')->where('start_date', '<=', $today)->where('end_date', '>=', $today)->first();
     //dd($activeSchedule);
     if ($activeSchedule) {
         /*$videoList      =   Videos::where('schedule_id','=',$activeSchedule->id)
           ->where('active','=', '1')
           ->orderBy('position')->get();*/
         $videoList = DB::select(DB::raw('select * from `videolist` where `schedule_id` = ' . $activeSchedule->id . ' and `active` = \'1\' ORDER BY STR_TO_DATE(time, \'%h:%i:%s\') desc LIMIT 1'));
     } else {
         $videoList = [];
     }
     if (empty($videoList)) {
         $videostoShow[] = array('videoId' => null, 'startsAt' => null, 'endsAt' => null);
     } else {
         $datetimepickers = date('m/d/Y h:i:s a', strtotime($videoList[0]->time));
         //dd($videoList[0]);
         $videostoShow[] = array('videoId' => $videoList[0]->id, 'startsAt' => date('U', strtotime($today . ' ' . $videoList[0]->time)), 'endsAt' => date('U', strtotime($videoList[0]->time) + $videoList[0]->length + 1));
     }
     return $videostoShow;
 }
Esempio n. 10
0
 protected function getMenuData()
 {
     $menu_data = array();
     $row = Practiceinfo::find(Session::get('practice_id'));
     $menu_data['mtm'] = $row->mtm_extension;
     $menu_data['id'] = Session::get('pid');
     $row1 = Encounters::where('pid', '=', Session::get('pid'))->where('eid', '!=', '')->where('practice_id', '=', Session::get('practice_id'))->orderBy('eid', 'desc')->first();
     if ($row1) {
         $menu_data['lastvisit'] = date('F jS, Y', strtotime($row1->encounter_DOS));
     } else {
         $menu_data['lastvisit'] = "No previous visits.";
     }
     $row2 = Schedule::where('pid', '=', Session::get('pid'))->where('start', '>', time())->first();
     if (isset($row2->start)) {
         $menu_data['nextvisit'] = '<br>' . date('F jS, Y, g:i A', $row2->start);
     } else {
         $menu_data['nextvisit'] = 'None.';
     }
     $row3 = Encounters::where('pid', '=', Session::get('pid'))->where('eid', '!=', '')->where('practice_id', '=', Session::get('practice_id'))->where('encounter_template', '=', 'standardpsych')->where('addendum', '=', 'n')->orderBy('eid', 'desc')->first();
     if ($row3) {
         $psych_date = strtotime($row3->encounter_DOS);
         $new_psych_date = $psych_date + 31556926;
         $psych_query = Encounters::where('pid', '=', Session::get('pid'))->where('eid', '!=', '')->where('practice_id', '=', Session::get('practice_id'))->where('addendum', '=', 'n')->where(function ($query_array1) {
             $query_array1->where('encounter_template', '=', 'standardpsych')->orWhere('encounter_template', '=', 'standardpsych1');
         })->orderBy('eid', 'desc')->get();
         $tp_date = '';
         if ($psych_query) {
             $i = 0;
             $psych_comp = '';
             $psych_comp1 = '';
             $tp_eid = '';
             foreach ($psych_query as $psych_row) {
                 $planInfo = Plan::find($psych_row->eid);
                 if ($planInfo) {
                     if ($i == 0) {
                         $psych_comp = $planInfo->goals;
                         $psych_comp .= $planInfo->tp;
                         $tp_eid = $psych_row->eid;
                         $tp_eid1 = $tp_eid;
                     } else {
                         $psych_comp1 = $planInfo->goals;
                         $psych_comp1 .= $planInfo->tp;
                         $tp_eid1 = $psych_row->eid;
                     }
                     if ($psych_comp1 != $psych_comp && $i != 0) {
                         $tp = DB::table('encounters')->where('eid', '=', $tp_eid)->first();
                         $tp_date = '<strong>Most recent TP adjustment:</strong> ' . date('F jS, Y', strtotime($tp->encounter_DOS)) . '<br>';
                         break;
                     } else {
                         $i++;
                         $tp_eid = $tp_eid1;
                     }
                 }
             }
         }
         $menu_data['psych'] = '<strong>Last Annual Psychiatric Eval:</strong> ' . date('F jS, Y', $psych_date) . '<br><strong>Next Annual Psychiatric Eval Due:</strong> ' . date('F jS, Y', $new_psych_date) . '<br>' . $tp_date;
     } else {
         $menu_data['psych'] = '';
     }
     $menu_data['supplements'] = $row->supplements_menu_item;
     $menu_data['immunizations'] = $row->immunizations_menu_item;
     return $menu_data;
 }
Esempio n. 11
0
            <table class="table table-condensed table-bordered table-striped table-small">
           		{{-- loop group in pool --}}
           		@forelse( Schedulegroup::where('schedule_master_id','=',$master->id)->where('pool_id','=',Auth::user()->pool_id)->get() as $group )	
           		<tr>
	                <td class="span2"><span class="label">Group #{{ $group->group }} </span> <a class="delete_toggler btn btn-mini btn-danger" rel="{{ $group->id }}"> Delete </a></td>
	                <td class="span8">
	                	{{-- loop fleet in group --}}
	                	@foreach(Schedulefleetgroup::where('schedule_group_id','=', $group->id )->get() as $fleet)
                    <?php 
$fleetz = Fleet::find($fleet->fleet_id);
?>
	
                      @if($fleetz)
  	                		<span class="label label-info">{{ $fleetz->taxi_number }}</span> 
                        <?php 
$x = Schedule::where('fleet_id', '=', $fleet->fleet_id)->where('year', '=', date('Y', time()))->order_by('month', 'desc')->first();
if ($x) {
    echo 'Last Generate: ';
    echo '<span class="label label-info">';
    echo MyFungsi::bulan($x->month);
    echo '</span>';
}
?>
                      @endif
	                	@endforeach
	                </td>
	                <td class="span2"><a class="label label-info" href="{{URL::to('schedule/create')}}?id={{$group->id}}"> Create Jadwal </a></td>
            	</tr>
            	@empty

            	<tr> <td> Tidak ada armada di master kepang ini </td> </tr>
                                  <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Name</label>
                                      <div class="col-sm-10">
                                          <input type="text" class="form-control" name="name" id="vidname" value="{{$video->name}}">
                                      </div>
                                  </div>

                                  <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">Select Schedule</label>
                                      <div class="col-sm-10">
                                          <select class="form-control" name="schedule_id">
                                              <option>Select...</option>
                                              @foreach (Schedule::get() as $schedule)
                                                  <?php 
$SelectedSchedule = Schedule::where('id', '=', $video->schedule_id)->first();
if ($SelectedSchedule->id == $schedule->id) {
    ?>
                                                        <option value="{{$schedule->id}}" selected="selected">{{$schedule->name}}</option>
                                                  <?php 
} else {
    ?>
                                                        <option value="{{$schedule->id}}">{{$schedule->name}}</option>
                                                  <?php 
}
?>

                                              @endforeach
                                          </select>
                                      </div>
                                  </div>
 protected function insert_schedules()
 {
     $doctors = Doctor::all();
     foreach ($doctors as $doctor) {
         $count = rand(300, 500);
         while ($count--) {
             $date = $this->get_random_date();
             $schedules = Schedule::where('date', $date)->where('doctor_id', $doctor->id)->get();
             if ($schedules->count()) {
                 continue;
             }
             // 添加早上排班
             if (rand(0, 1)) {
                 Schedule::create(['date' => $date, 'period' => 0, 'doctor_id' => $doctor->id]);
             }
             // 添加下午排班
             if (rand(0, 1)) {
                 Schedule::create(['date' => $date, 'period' => 1, 'doctor_id' => $doctor->id]);
             }
         }
     }
 }
 /**
  * Updates all existing templates with changes provided.
  *
  * @return view templateManagementView
  */
 public function updateTemplates()
 {
     $templates = Schedule::where('schdl_is_template', '=', '1')->orderBy('schdl_title', 'ASC')->get();
     foreach ($templates as $template) {
         if (Input::get('destroy' . $template->id)) {
             // remove from the list of templates, but don't touch corrsponding event/schedule
             $template->schdl_is_template = 0;
             $template->save();
         } else {
             // update title
             $template->schdl_title = Input::get('schdl_title' . $template->id);
             $template->save();
         }
     }
     // need to update our index after the changes
     $templates = Schedule::where('schdl_is_template', '=', '1')->with('getClubEvent')->orderBy('schdl_title', 'ASC')->get();
     return View::make('templateManagementView', compact('templates'));
 }
Esempio n. 15
0
 public function postsCalendar()
 {
     $user_id = Auth::user()->id;
     $networks = Network::where('user_id', '=', $user_id)->get();
     $settings = Settings::where('user_id', '=', $user_id)->first();
     $default_networks = json_decode($settings->default_networks);
     $schedules = Schedule::where('user_id', '=', $user_id)->get();
     $custom_schedule_checked = '';
     $default_schedule = $settings->schedule_id;
     $page_data = array('networks' => $networks, 'default_networks' => $default_networks, 'default_schedule' => $default_schedule, 'schedules' => $schedules, 'custom_schedule_checked' => $custom_schedule_checked);
     $this->layout->title = 'Posts';
     $this->layout->handlebars = true;
     $this->layout->posts = true;
     $this->layout->posts_calendar = true;
     $this->layout->new_post = true;
     $this->layout->content = View::make('admin.posts_calendar', $page_data);
 }
Esempio n. 16
0
        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 */
        /********************************/
        if (is_array($driver_ar) && !empty($driver_ar)) {
            foreach ($driver_ar as $key => $value) {
 /**
  * Updates multiple schedules.
  */
 public function bulkUpdateSchedule($year, $week)
 {
     // Create week start date
     $weekStart = date('Y-m-d', strtotime($year . "W" . $week . '1'));
     // Create the number of the next week and the week end date
     // We go till tuesday (day 2) because café needs alternative week view (Mi-Di)
     $nextWeek = date("W", strtotime("next Week" . $weekStart));
     $nextYear = date("Y", strtotime("next Week" . $weekStart));
     $weekEnd = date('Y-m-d', strtotime($nextYear . "W" . $nextWeek . '2'));
     // Create (empty) index of all schedules we need to update
     $updateIds = array();
     // Collect IDs of event schedules shown in chosen week view
     $events = ClubEvent::where('evnt_date_start', '>=', $weekStart)->where('evnt_date_start', '<=', $weekEnd)->get();
     // Add them to the index
     foreach ($events as $event) {
         array_push($updateIds, $event->getSchedule->id);
     }
     // Collect IDs of tasks shown in week view
     $tasks = Schedule::where('schdl_show_in_week_view', '=', '1')->where('schdl_due_date', '>=', $weekStart)->where('schdl_due_date', '<=', $weekEnd)->get();
     // Add them to the index
     foreach ($tasks as $task) {
         array_push($updateIds, $task->id);
     }
     // Update each of the schedules in the index
     foreach ($updateIds as $schedule) {
         $this->onUpdate($schedule);
     }
     return Redirect::back();
 }
Esempio n. 18
0
    $data['employee_number'] = Input::get('employee_number');
    $employeeNumber = Employee::where('employee_number', '=', trim($data['employee_number']))->first();
    $defaultSchedules = Workshift::where('employee_id', '=', trim($employeeNumber->id))->get();
    $employeeId = Session::get('userEmployeeId');
    $employee = new Employee();
    $employeeInfo = $employee->getEmployeeInfoById($employeeId);
    $getUserEmployee = DB::table('users')->join('employees', 'users.employee_id', '=', 'employees.id')->join('users_groups', 'users_groups.user_id', '=', 'users.id')->join('groups', 'users_groups.group_id', '=', 'groups.id')->get();
    return View::make('admin.scheduling', ['employeeInfo' => $employeeInfo, 'getUserEmployee' => $getUserEmployee, 'defaultSchedules' => $defaultSchedules]);
    //return View::make('admin.scheduling', ['employeeInfo' => $employeeInfo, 'defaultSchedules' => $defaultSchedules]);
}));
Route::post('/admin/scheduling/upload/new/schedule', array('as' => 'adminUploadNewSchedule', 'uses' => 'EmployeesController@postShift'));
Route::post('/admin/scheduling/search/uploaded/schedule', array('as' => '', 'uses' => function () {
    $data = Input::all();
    //$data['employee_number'] = Input::get('employee_number');
    $employeeNumber = Employee::where('employee_number', '=', trim($data['employee_number']))->first();
    $uploadedSchedules = Schedule::where('employee_id', '=', trim($employeeNumber->id))->whereBetween('schedule_date', array($data["schedule_date_from"], $data["schedule_date_to"]))->get();
    $employeeId = Session::get('userEmployeeId');
    $employee = new Employee();
    $employeeInfo = $employee->getEmployeeInfoById($employeeId);
    $getUserEmployee = DB::table('users')->join('employees', 'users.employee_id', '=', 'employees.id')->join('users_groups', 'users_groups.user_id', '=', 'users.id')->join('groups', 'users_groups.group_id', '=', 'groups.id')->get();
    return View::make('admin.scheduling', ['employeeInfo' => $employeeInfo, 'getUserEmployee' => $getUserEmployee, 'uploadedSchedules' => $uploadedSchedules]);
    //return View::make('admin.scheduling', ['employeeInfo' => $employeeInfo, 'defaultSchedules' => $defaultSchedules]);
}));
/**
*
* Administration: TimeClock & Attendace
*
*/
Route::get('/admin/timeclock', array('as' => 'adminTimeClock', 'uses' => function () {
    //return 'Administration: TimeClock & Attendace';
    $employeeId = Session::get('userEmployeeId');
Esempio n. 19
0
 /**
  * Generate the view for editing an event specified by $id.
  *
  * @param int $id
  * @return view editClubEventView
  */
 public function showEditEvent($id)
 {
     $event = ClubEvent::findOrFail($id);
     $schedule = $event->getSchedule()->getResults();
     $jobtypes = Jobtype::where('jbtyp_is_archived', '=', '0')->orderBy('jbtyp_title', 'ASC')->get();
     $places = Place::orderBy('plc_title', 'ASC')->lists('plc_title', 'id');
     $templates = Schedule::where('schdl_is_template', '=', '1')->orderBy('schdl_title', 'ASC')->get();
     $template = Schedule::where('id', '=', $schedule->id)->first();
     // put template data into entries
     $entries = $schedule->getEntries()->with('getJobType')->getResults();
     // put name of the active template for further use
     $activeTemplate = $template->schdl_title;
     return View::make('editClubEventView', compact('event', 'schedule', 'places', 'jobtypes', 'templates', 'template', 'entries', 'activeTemplate'));
 }
 public function postGetAppointments($user_id)
 {
     $start_time = time() - 604800;
     $end_time = time() + 604800;
     $query = Schedule::where('provider_id', '=', $user_id)->where('pid', '=', Session::get('pid'))->whereBetween('start', array($start_time, $end_time))->get();
     $data = array();
     if ($query) {
         foreach ($query as $row) {
             $key = $row->visit_type . ',' . $row->appt_id;
             $value = date('Y-m-d H:i:s A', $row->start) . ' (Appt ID: ' . $row->appt_id . ')';
             $data[$key] = $value;
         }
     }
     echo json_encode($data);
 }
Esempio n. 21
0
 public function post_schedulereset()
 {
     $data = Input::json();
     $schedule = Schedule::where('fleet_id', '=', $data->fleet_id)->where('month', '=', $data->month)->where('year', '=', $data->year)->first();
     if ($schedule->delete()) {
         return json_encode(array('Jadwal Berhasil di Hapus'));
     } else {
         return json_encode(array('Jadwal Gagal di Hapus'));
     }
 }
 public function appointment_screen($practice_id)
 {
     $practice = DB::table('practiceinfo')->where('practice_id', '=', $practice_id)->first();
     if ($practice->timezone != null) {
         date_default_timezone_set($practice->timezone);
     }
     $i = 0;
     $query = DB::table('demographics')->join('demographics_relate', 'demographics_relate.pid', '=', 'demographics.pid')->select('demographics_relate.appointment_reminder', 'demographics.pid', 'demographics_relate.demographics_relate_id')->where('demographics_relate.practice_id', '=', $practice_id)->where('demographics.active', '=', '1')->where('demographics.reminder_to', '!=', '')->get();
     if ($query) {
         foreach ($query as $row) {
             $row2 = Schedule::where('pid', '=', $row->pid)->where('start', '>', time())->first();
             if (isset($row2->start)) {
                 $data['appointment_reminder'] = 'n';
                 DB::table('demographics_relate')->where('demographics_relate_id', '=', $row->demographics_relate_id)->update($data);
                 $this->audit('Update');
             } else {
                 if ($row->appointment_reminder == 'n') {
                     $newdate = time() + $practice->appointment_interval;
                     $data['appointment_reminder'] = date('Y-m-d', $newdate);
                     DB::table('demographics_relate')->where('demographics_relate_id', '=', $row->demographics_relate_id)->update($data);
                     $this->audit('Update');
                     $i++;
                 }
             }
         }
     }
     return $i;
 }
 public function postDemographicsList()
 {
     $practice_id = Session::get('practice_id');
     $pid = Session::get('pid');
     $row = Demographics::find($pid);
     $row_relate = Demographics_relate::where('pid', '=', $pid)->where('practice_id', '=', $practice_id)->first();
     $result = '';
     if ($row) {
         $result .= '<p class="tips"><strong>Address:</strong><br>' . $row->address . '<br>' . $row->city . ', ' . $row->state . ' ' . $row->zip . '</p>';
         $result .= '<p class="tips"><strong>Phone Numbers:</strong><br>Home: ' . $row->phone_home . '<br>Work: ' . $row->phone_work . '<br>Cell: ' . $row->phone_cell . '<br>Email: ' . $row->email . '</p>';
         $result .= '<p class="tips"><strong>Emergency Contact:</strong><br>Contact: ' . $row->emergency_contact . ', ' . $row->emergency_phone . '</p>';
         $gender = Session::get('gender');
         if ($gender == 'female') {
             if ($row->pregnant != 'no') {
                 $pregnant = 'Yes';
             } else {
                 $pregnant = 'No';
             }
             $result .= '<p class="tips"><strong>Other:</strong><br>Sexually Active: ' . ucfirst($row->sexuallyactive) . '<br>Tobacco Use: ' . ucfirst($row->tobacco) . '<br>Pregnant: ' . $pregnant . '</p>';
         } else {
             $result .= '<p class="tips"><strong>Other:</strong><br>Sexually Active: ' . ucfirst($row->sexuallyactive) . '<br>Tobacco Use: ' . ucfirst($row->tobacco) . '</p>';
         }
         $result .= '<p class="tips">Active since ' . $row->date . '</p>';
         if ($row_relate->id != '') {
             $result .= '<p class="tips">Online account is active.</p>';
         } else {
             $result .= '<p class="tips">No online account.</p>';
         }
         $schedule1 = Schedule::where('pid', '=', $pid)->where('status', '=', 'LMC')->get();
         $schedule2 = Schedule::where('pid', '=', $pid)->where('status', '=', 'DNKA')->get();
         $result .= '<p class="tips"><strong># Last minute cancellations: ' . count($schedule1) . '</strong></p>';
         $result .= '<p class="tips"><strong># Did not keep appointments: ' . count($schedule2) . '</strong></p>';
         $result .= '<p class="tips"><strong>Billing Notes:</strong><br>' . nl2br($row->billing_notes) . '</p>';
         $query1 = Insurance::where('pid', '=', $pid)->where('insurance_plan_active', '=', 'Yes')->get();
         if ($query1) {
             $result .= '<p class="tips"><strong>Active Insurance:</strong>';
             foreach ($query1 as $row1) {
                 $result .= '<br>' . $row1->insurance_plan_name . '; ID: ' . $row1->insurance_id_num . '; Group: ' . $row1->insurance_group;
                 if ($row1->insurance_copay != '') {
                     $result .= '; Copay: ' . $row1->insurance_copay;
                 }
                 if ($row1->insurance_deductible != '') {
                     $result .= '; Deductible: ' . $row1->insurance_deductible;
                 }
                 if ($row1->insurance_comments != '') {
                     $result .= '; Comments: ' . $row1->insurance_comments;
                 }
             }
             $result .= '</p>';
         }
         $result .= '<p class="tips"><strong>Credit Card on File: ';
         if ($row->creditcard_number != '') {
             $result .= 'Yes';
         } else {
             $result .= 'No';
         }
         $result .= '</strong></p>';
     } else {
         $result .= 'None available.';
     }
     echo $result;
 }