コード例 #1
0
 /**
  * This function shows user profile
  */
 public function getUserProfile()
 {
     if (Session::get('admin') == 'admin') {
         $user = User::where('username', '=', Session::get('username'))->get()->first();
         $userProfile = Admin::find($user->details_id);
         $userProfile->DOB = DateFormat::show($userProfile->DOB);
         return View::make('user.profile')->with('userProfile', $userProfile);
     }
     if (Session::get('employee') == 'employee') {
         $user = User::where('username', '=', Session::get('username'))->get()->first();
         $userProfile = Employee::find($user->details_id);
         $userProfile->DOB = DateFormat::show($userProfile->DOB);
         return View::make('user.profile')->with('userProfile', $userProfile);
     }
     if (Session::get('member') == 'member') {
         $user = User::where('username', '=', Session::get('username'))->get()->first();
         $userProfile = Member::find($user->details_id);
         $userProfile->DOB = DateFormat::show($userProfile->DOB);
         return View::make('user.profile')->with('userProfile', $userProfile);
     }
 }
コード例 #2
0
 /**
  *  This function responses to
  *  the get request of /admin/employee/details/{id}
  *  and view employee respect to id
  */
 public function getDetails($id, $msg = null)
 {
     $employee = Employee::find($id);
     $employee->DOB = DateFormat::show($employee->DOB);
     if (!empty($msg) && $msg == 1) {
         return View::make('adminArea.employee.details')->with('employee', $employee)->with('orders', Order::orderBy('from', 'desc')->get())->with('success', "Order has been deactivated successfully");
     }
     return View::make('adminArea.employee.details')->with('employee', $employee)->with('orders', Order::orderBy('from', 'desc')->get());
 }
コード例 #3
0
 /**
  *  This function responses to
  *  the post request of /admin/order/report
  *  and shows all order report options
  */
 public function postOrderCreatedReport()
 {
     if (Input::has('reportOnOrderCreatedDate')) {
         // Check validation
         $validator = Validator::make(Input::all(), Order::$rulesForOrderCreated, Order::$messages);
         // If failed then redirect to order-edit-get route with
         // validation error and input old
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         if (Input::get('ocd-status') == 1) {
             $parameterr = array();
             $parameter['title'] = "Report On Order Creation Date";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('ocd-from')))->where('from', '<=', DateFormat::store(Input::get('ocd-to')))->where('status', '=', 1)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Creation Date.pdf');
         } elseif (Input::get('ocd-status') == 0) {
             $parameterr = array();
             $parameter['title'] = "Report On Order Creation Date";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('ocd-from')))->where('from', '<=', DateFormat::store(Input::get('ocd-to')))->where('status', '=', 0)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Order Creation Date");
         } else {
             $parameterr = array();
             $parameter['title'] = "Report On Order Creation Date";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('ocd-from')))->where('from', '<=', DateFormat::store(Input::get('ocd-to')))->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Creation Date.pdf');
         }
     } elseif (Input::has('reportOnDvdReturnDate')) {
         // Check validation
         $validator = Validator::make(Input::all(), Order::$rulesForDvdReturnDate, Order::$messages);
         // If failed then redirect to order-edit-get route with
         // validation error and input old
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         if (Input::get('drd-status') == 1) {
             $parameterr = array();
             $parameter['title'] = "Report On Dvd Return Date";
             $parameter['orders'] = Order::where('to', '>=', DateFormat::store(Input::get('drd-from')))->where('to', '<=', DateFormat::store(Input::get('drd-to')))->where('status', '=', 1)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Dvd Return Date.pdf');
         } elseif (Input::get('drd-status') == 0) {
             $parameterr = array();
             $parameter['title'] = "Report On Dvd Return Date";
             $parameter['orders'] = Order::where('to', '>=', DateFormat::store(Input::get('drd-from')))->where('to', '<=', DateFormat::store(Input::get('drd-to')))->where('status', '=', 0)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Dvd Return Date.pdf');
         } else {
             $parameterr = array();
             $parameter['title'] = "Report On Dvd Return Date";
             $parameter['orders'] = Order::where('to', '>=', DateFormat::store(Input::get('drd-from')))->where('to', '<=', DateFormat::store(Input::get('drd-to')))->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Dvd Return Date.pdf');
         }
     } elseif (Input::has('reportOnTodayCreatedOrder')) {
         // Check validation
         $validator = Validator::make(Input::all(), Order::$rulesForTodayCreated, Order::$messages);
         // If failed then redirect to order-edit-get route with
         // validation error and input old
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         date_default_timezone_set(config::$timezone);
         $today = date("Y-m-d");
         if (Input::get('tc-status') == 1) {
             $parameterr = array();
             $parameter['title'] = "Report On Today's Created Order";
             $parameter['orders'] = Order::where('from', '=', $today)->where('status', '=', 1)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Today's Created Order.pdf");
         } elseif (Input::get('tc-status') == 0) {
             $parameterr = array();
             $parameter['title'] = "Report On Today's Created Order";
             $parameter['orders'] = Order::where('from', '=', $today)->where('status', '=', 0)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Today's Created Order.pdf");
         } else {
             $parameterr = array();
             $parameter['title'] = "Report On Today's Created Order";
             $parameter['orders'] = Order::where('from', '=', $today)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Today's Created Order.pdf");
         }
     } elseif (Input::has('reportOnTodayReturnDate')) {
         // Check validation
         $validator = Validator::make(Input::all(), Order::$rulesForTodayReturn, Order::$messages);
         // If failed then redirect to order-edit-get route with
         // validation error and input old
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         date_default_timezone_set(config::$timezone);
         $today = date("Y-m-d");
         if (Input::get('tr-status') == 1) {
             $parameterr = array();
             $parameter['title'] = "Report On Today's Return Date";
             $parameter['orders'] = Order::where('to', '=', $today)->where('status', '=', 1)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Today's Return Date.pdf");
         } elseif (Input::get('tr-status') == 0) {
             $parameterr = array();
             $parameter['title'] = "Report On Today's Return Date";
             $parameter['orders'] = Order::where('to', '=', $today)->where('status', '=', 0)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Today's Return Date.pdf");
         } else {
             $parameterr = array();
             $parameter['title'] = "Report On Today's Return Date";
             $parameter['orders'] = Order::where('to', '=', $today)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream("Report On Today's Return Date.pdf");
         }
     } elseif (Input::has('reportOnOrderByEmployeeId')) {
         // Check validation
         $validator = Validator::make(Input::all(), Order::$rulesForOrderByEmployeeId, Order::$messages);
         // If failed then redirect to order-edit-get route with
         // validation error and input old
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         if (Input::get('ei-status') == 1) {
             $parameterr = array();
             $parameter['title'] = "Report On Order Created By Employee";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('ei-from')))->Where('from', '<=', DateFormat::store(Input::get('ei-to')))->where('employee_id', '=', Input::get('employee_id'))->where('status', '=', 1)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Created By Employee.pdf');
         } elseif (Input::get('ei-status') == 0) {
             $parameterr = array();
             $parameter['title'] = "Report On Order Created By Employee";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('ei-from')))->where('from', '<=', DateFormat::store(Input::get('ei-to')))->where('employee_id', '=', Input::get('employee_id'))->where('status', '=', 0)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Created By Employee.pdf');
         } else {
             $parameterr = array();
             $parameter['title'] = "Report On Order Created By Employee";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('ei-from')))->where('from', '<=', DateFormat::store(Input::get('ei-to')))->where('employee_id', '=', Input::get('employee_id'))->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Created By Employee.pdf');
         }
     } elseif (Input::has('reportOnOrderByMemberId')) {
         // Check validation
         $validator = Validator::make(Input::all(), Order::$rulesForOrderByMemberId, Order::$messages);
         // If failed then redirect to order-edit-get route with
         // validation error and input old
         if ($validator->fails()) {
             return Redirect::back()->withErrors($validator)->withInput();
         }
         if (Input::get('mi-status') == 1) {
             $parameterr = array();
             $parameter['title'] = "Report On Order Created For Member";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('mi-from')))->Where('from', '<=', DateFormat::store(Input::get('mi-to')))->where('member_id', '=', Input::get('member_id'))->where('status', '=', 1)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Created For Member.pdf');
         } elseif (Input::get('mi-status') == 0) {
             $parameterr = array();
             $parameter['title'] = "Report On Order Created For Member";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('mi-from')))->where('from', '<=', DateFormat::store(Input::get('mi-to')))->where('member_id', '=', Input::get('member_id'))->where('status', '=', 0)->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Created For Member.pdf');
         } else {
             $parameterr = array();
             $parameter['title'] = "Report On Order Created For Member";
             $parameter['orders'] = Order::where('from', '>=', DateFormat::store(Input::get('mi-from')))->where('from', '<=', DateFormat::store(Input::get('mi-to')))->where('member_id', '=', Input::get('member_id'))->get();
             $pdf = PDF::loadView('reports.order.getAllOrders', $parameter)->setPaper('a4')->setOrientation(config::$ORDER_REPORT_ORIENTATION)->setWarnings(false);
             return $pdf->stream('Report On Order Created For Member.pdf');
         }
     } else {
         return View::make('adminArea/order/reports/optionView');
     }
 }