/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) {
         $linhvucchuyendes = Linhvucchuyende::get(['id', 'name']);
         $danhmucchuyende = Danhmucchuyende::findOrFail($id);
         return view('danhmucchuyende.edit')->with(array('danhmucchuyende' => $danhmucchuyende, 'linhvucchuyendes' => $linhvucchuyendes, 'menus' => $this->menus));
     } else {
         return \Redirect::route('danhmucchuyende.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
 public function resulttheolinhvucchuyende(IncongvandiFormRequest $request)
 {
     $menus = Menu::all();
     $linhvucchuyendes = Linhvucchuyende::all();
     $ngaynhanbatdau = $request->input('ngaynhanbatdau');
     $ngaynhanketthuc = $request->input('ngaynhanketthuc');
     $linhvucchuyende = $request->input('linhvucchuyende');
     //$capphathanhresult = 'Tất cả';
     if ($linhvucchuyende == 0) {
         $querylinhvucchuyende = 'linhvucchuyende_id > 0';
         $linhvucchuyenderesult = 'Tất cả';
     } else {
         $querylinhvucchuyende = 'linhvucchuyende_id = ' . $linhvucchuyende;
         $linhvucchuyenderesult = Linhvucchuyende::where('id', $linhvucchuyende)->select('name')->first();
     }
     if ($ngaynhanbatdau != '' && $ngaynhanketthuc != '') {
         $ngaynhanbatdau = date('Y-m-d', strtotime(str_replace('/', '-', $ngaynhanbatdau)));
         //date('Y-m-d', strtotime(str_replace('/', '-', Input::get('ngayphathanh-start'))) ) ;
         $ngaynhanketthuc = date('Y-m-d', strtotime(str_replace('/', '-', $ngaynhanketthuc)));
         if ($ngaynhanbatdau > $ngaynhanketthuc) {
             return \Redirect::route('baocaocongvandi.theolinhvucchuyende')->withErrors('Ngày nhận bắt đầu phải nhỏ hơn ngày nhận kết thúc!')->withInput();
         } else {
             $congvandis = Congvandi::where('ngayphathanh', '>=', $ngaynhanbatdau)->where('ngayphathanh', '<=', $ngaynhanketthuc)->whereRaw($querylinhvucchuyende)->get();
         }
     }
     //$tungay = '01/02/2015';
     //$denngay = '01/06/2015';
     $tungays = date('d/m/Y', strtotime($ngaynhanbatdau));
     //date('Y-m-d', strtotime(str_replace('/', '-', Input::get('ngayphathanh-start'))) ) ;
     $denngays = date('d/m/Y', strtotime($ngaynhanketthuc));
     //echo '<pre>';
     //print_r($congvandis);
     return view('baocaocongvandi.theolinhvucchuyende')->with(['menus' => $this->menus, 'tungay' => $tungays, 'denngay' => $denngays, 'congvandis' => $congvandis, 'linhvucchuyendes' => $linhvucchuyendes, 'linhvucchuyenderesult' => $linhvucchuyenderesult])->withInput($request);
 }
Ejemplo n.º 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) {
         $loaicongvans = Danhmucloaicongvan::get(array('id', 'name'));
         $capphathanhs = Danhmucnhomdonvi::get(array('id', 'name'));
         $noiphathanhs = Danhmucdonvi::get(array('id', 'name', 'danhmucnhomdonvi_id'));
         $mucdichs = Danhmucmucdich::get(array('id', 'name'));
         $linhvucchuyendes = Linhvucchuyende::get(array('id', 'name'));
         $chuyendes = Danhmucchuyende::get(array('id', 'name', 'linhvucchuyende_id'));
         $chutrixulys = Danhmucphong::get(array('id', 'name'));
         $phoihopxulys = Danhmucphong::get(array('id', 'name'));
         $canboxulys = Canbo::get(array('id', 'name'));
         $phongs = Danhmucphong::orderBy('name')->get();
         $dois = Danhmucdoi::orderBy('name')->get();
         $canbos = User::where('role_id', '>', 2)->orderBy('name')->get();
         $emails = Danhmucemail::orderBy('name')->get();
         $domats = Danhmucdomat::get(array('id', 'name'));
         $dokhans = Danhmucdokhan::get(array('id', 'name'));
         $congvanden = Congvanden::findOrFail($id);
         if ($congvanden->sohosoluubo) {
             $action = 'congvanden.update';
             $title = 'bộ';
         } else {
             $action = 'congvanden.update';
             $title = '';
         }
         $getfiletralois = \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->get();
         $getcountups = \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->distinct()->select('stt')->get();
         $getusers = \DB::table('file_traloicongvandens')->where('congvanden_id', $id)->distinct()->select('user_id')->get();
         return view('congvanden.edit')->with(array('congvanden' => $congvanden, 'getcountups' => $getcountups, 'getfiletralois' => $getfiletralois, 'getusers' => $getusers, 'loaicongvans' => $loaicongvans, 'domats' => $domats, 'dokhans' => $dokhans, 'menus' => $this->menus, 'capphathanhs' => $capphathanhs, 'noiphathanhs' => $noiphathanhs, 'mucdichs' => $mucdichs, 'linhvucchuyendes' => $linhvucchuyendes, 'chuyendes' => $chuyendes, 'chutrixulys' => $chutrixulys, 'phoihopxulys' => $phoihopxulys, 'canboxulys' => $canboxulys, 'phongs' => $phongs, 'dois' => $dois, 'canbos' => $canbos, 'emails' => $emails, 'action' => $action, 'title' => $title));
     } else {
         return \Redirect::route('congvanden.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Xoa == 1) {
         $danhmuclinhvucchuyende = Linhvucchuyende::findOrFail($id);
         $danhmuclinhvucchuyende->delete();
         return \Redirect::route('danhmuclinhvucchuyende.index')->with('message', 'Xóa Thành Công!');
     } else {
         return \Redirect::route('danhmuclinhvucchuyende.index')->with('message-error', 'Không có quyền truy cập');
     }
 }
Ejemplo n.º 5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Sua == 1) {
         $noisoanthaos = Danhmucphong::get(array('id', 'name'));
         $nguoikys = Canbo::get(array('id', 'name'));
         $mucdichs = Danhmucmucdich::get(array('id', 'name'));
         $linhvucchuyendes = Linhvucchuyende::get(array('id', 'name'));
         $chuyendes = Danhmucchuyende::get(array('id', 'name'));
         $loaicongvans = Danhmucloaicongvan::get(array('id', 'name'));
         $hinhthucchuyens = Danhmuchinhthucchuyen::get(array('id', 'name'));
         $dokhans = Danhmucdokhan::get(array('id', 'name'));
         $domats = Danhmucdomat::get(array('id', 'name'));
         $noinhancongvans = Danhmucdonvi::all();
         $phongs = Danhmucphong::orderBy('name')->get();
         $dois = Danhmucdoi::orderBy('name')->get();
         $canbos = User::where('role_id', '>', 2)->orderBy('name')->get();
         $emails = Danhmucemail::orderBy('name')->get();
         $congvandi = Congvandi::findOrFail($id);
         return view('congvandi.edit')->with(array('congvandi' => $congvandi, 'loaicongvans' => $loaicongvans, 'hinhthucchuyens' => $hinhthucchuyens, 'domats' => $domats, 'dokhans' => $dokhans, 'menus' => $this->menus, 'noisoanthaos' => $noisoanthaos, 'nguoikys' => $nguoikys, 'mucdichs' => $mucdichs, 'linhvucchuyendes' => $linhvucchuyendes, 'chuyendes' => $chuyendes, 'phongs' => $phongs, 'dois' => $dois, 'canbos' => $canbos, 'emails' => $emails));
     } else {
         return \Redirect::route('congvandi.index')->with('message-error', 'Không có quyền truy cập');
     }
 }