Exemplo n.º 1
0
 private function empGrpByDeptWithManday(Request $request, $id)
 {
     //$depts = $this->empGrpByDept(); // get array of dept w/ emp grouped by department e.g. dining, kitchen
     $depts = $this->employees->byDepartment($request);
     for ($h = 0; $h < count($depts); $h++) {
         $arr = $depts[$h]['employees']->toArray();
         // extract emp on each dept
         for ($i = 0; $i < count($arr); $i++) {
             $mandtl = Mandtl::where('employeeid', $depts[$h]['employees'][$i]->id)->where('mandayid', $id)->get()->first();
             $depts[$h]['employees'][$i]['manskeddtl'] = count($mandtl) > 0 ? ['daytype' => $mandtl->daytype, 'timestart' => $mandtl->timestart, 'breakstart' => $mandtl->breakstart, 'breakend' => $mandtl->breakend, 'timeend' => $mandtl->timeend, 'workhrs' => $mandtl->workhrs, 'breakhrs' => $mandtl->breakhrs, 'loading' => $mandtl->loading, 'id' => $mandtl->id] : ['daytype' => 0, 'timestart' => 'off', 'breakstart' => '', 'breakend' => '', 'timeend' => '', 'workhrs' => '', 'breakhrs' => '', 'loading' => '', 'id' => ''];
         }
     }
     return $depts;
 }
Exemplo n.º 2
0
 public function makeEditView(Request $request, $param1)
 {
     $manday = Manday::find($param1);
     //return $manday;
     if (count($manday) > 0) {
         // check if the $id
         $depts = $this->empGrpByDept();
         // get array of dept w/ emp grouped by department e.g. dining, kitchen
         for ($h = 0; $h < count($depts); $h++) {
             $arr = $depts[$h]['employees']->toArray();
             // extract emp on each dept
             for ($i = 0; $i < count($arr); $i++) {
                 $mandtl = Mandtl::where('employeeid', $depts[$h]['employees'][$i]->id)->where('mandayid', $param1)->get()->first();
                 $depts[$h]['employees'][$i]['manskeddtl'] = count($mandtl) > 0 ? ['daytype' => $mandtl->daytype, 'timestart' => $mandtl->timestart, 'breakstart' => $mandtl->breakstart, 'breakend' => $mandtl->breakend, 'timeend' => $mandtl->timeend, 'workhrs' => $mandtl->workhrs, 'breakhrs' => $mandtl->breakhrs, 'loading' => $mandtl->loading, 'id' => $mandtl->id] : ['daytype' => '0', 'starttime' => 'off', 'id' => ''];
             }
         }
     } else {
         return redirect(URL::previous());
     }
     //return $depts;
     return view('branch.manday.edit')->with('depts', $depts)->with('manday', $manday);
 }
Exemplo n.º 3
0
 public function makeViewWeek($request, $year, $weekno)
 {
     //$this->employees->pushFilters(new ByBranch($request));
     //$this->employees->pushFilters(new Regular());
     //$this->employees->pushFilters(new Male());
     //return $this->employees->all(['code', 'firstname', 'positionid']);
     //return $this->employees->paginate('5', ['code', 'firstname', 'positionid']);
     $depts = $this->employees->byDepartment($request);
     $mansked = Mansked::with('manskeddays')->where('weekno', $weekno)->where('year', $year)->where('branchid', $request->user()->branchid)->first();
     //return $mansked;
     if (count($mansked) <= 0) {
         return redirect('/task/mansked');
     }
     $days = $mansked->manskeddays;
     $manskeddays = [];
     for ($h = 0; $h < count($depts); $h++) {
         $arr = $depts[$h]['employees']->toArray();
         // extract emp on each dept
         for ($i = 0; $i < count($arr); $i++) {
             for ($j = 0; $j < count($days); $j++) {
                 $manskeddays[$j]['date'] = $days[$j]->date;
                 $manskeddays[$j]['id'] = strtolower($days[$j]->id);
                 $mandtl = Mandtl::where('employeeid', $depts[$h]['employees'][$i]->id)->where('mandayid', $days[$j]->id)->get()->first();
                 $manskeddays[$j]['mandtl'] = count($mandtl) > 0 ? $mandtl : ['timestart' => 0, 'timeend' => 0, 'loading' => 0];
             }
             $depts[$h]['employees'][$i]['manskeddays'] = $manskeddays;
         }
     }
     //return $depts;
     return view('task.mansked.week2')->with('depts', $depts)->with('mansked', $mansked);
     //$manday = Mansked::getManskedday('2015', $weekno);
     //$mansked = Mansked::whereWeekno($weekno)->get()->first();
     //return view('task.mansked.week')->with('manday', $manday)->with('mansked', $mansked);
 }