public function reports()
 {
     //Get all reports assigned to this doctor
     $reports = Reports::join('users', 'users.id', '=', 'reports.assigned_doctor_id')->orderBy('reports.id', 'DESC')->paginate(5);
     $data = ['reports' => $reports];
     return view('frontend.management.all-reports', $data);
 }
 public function assignedPatients(View $view)
 {
     $doctor = auth()->user();
     $assigned_patients = Reports::where('assigned_doctor_id', $doctor->id)->join('users', 'users.id', '=', 'Reports.user_id')->groupBy('user_id')->get(['*', 'reports.id AS reportID']);
     if ($assigned_patients) {
         $view->with('patients', $assigned_patients);
     }
 }
示例#3
0
 public function show($report_id)
 {
     $report = Reports::where('id', $report_id)->get();
     $report = $report[0];
     return view('page.report', compact('report'));
 }
示例#4
0
 private function report($method, $params, $from, $con)
 {
     $results = [];
     // list of all method that can be called in current module
     $registeredMethod = array('custom', 'customPurchase', 'customPurchasedProduct', 'customSaledProduct', 'customSales', 'monthly', 'monthlyPurchase', 'monthlyPurchasedProduct', 'monthlySaledProduct', 'monthlySales', 'monthlySalesCashier');
     // if called method is not registered then deny access
     if (!in_array($method, $registeredMethod)) {
         throw new Exception('Wrong turn buddy');
     }
     // get Current User
     $currentUser = $from->Session->get('pos/current_user');
     // route to requested module and method
     $results = Reports::$method($params, $currentUser, $con);
     // followup action
     if ($method == 'monthly') {
         // send Sales vs Purchase comparison
         $data = $this->chart('monthlySalesVsPurchase', $params, $from, $con);
         $salesVsPurchase['event'] = 'chart/monthlySalesVsPurchase';
         $salesVsPurchase['data'] = $data;
         $from->send(json_encode($salesVsPurchase));
         // send transaction chart's data on picked month
         $data = $this->chart('dailyTransaction', $params, $from, $con);
         $transaction['event'] = 'chart/dailyTransaction';
         $transaction['data'] = $data;
         $from->send(json_encode($transaction));
         // send purchase data
         $data = Reports::monthlyPurchase($params, $currentUser, $con);
         $purchase['event'] = 'report/monthlyPurchase';
         $purchase['data'] = $data;
         $from->send(json_encode($purchase));
         // send purchased product
         $data = Reports::monthlyPurchasedProduct($params, $currentUser, $con);
         $purchasedProduct['event'] = 'report/monthlyPurchasedProduct';
         $purchasedProduct['data'] = $data;
         $from->send(json_encode($purchasedProduct));
         // send saled product
         $data = Reports::monthlySaledProduct($params, $currentUser, $con);
         $saledProduct['event'] = 'report/monthlySaledProduct';
         $saledProduct['data'] = $data;
         $from->send(json_encode($saledProduct));
         // send sales data
         $data = Reports::monthlySales($params, $currentUser, $con);
         $sales['event'] = 'report/monthlySales';
         $sales['data'] = $data;
         $from->send(json_encode($sales));
         // send sales cashier data
         $data = Reports::monthlySalesCashier($params, $currentUser, $con);
         $salesCashier['event'] = 'report/monthlySalesCashier';
         $salesCashier['data'] = $data;
         $from->send(json_encode($salesCashier));
     } elseif ($method == 'custom') {
         // send Sales vs Purchase comparison
         $data = $this->chart('customSalesVsPurchase', $params, $from, $con);
         $salesVsPurchase['event'] = 'chart/customSalesVsPurchase';
         $salesVsPurchase['data'] = $data;
         $from->send(json_encode($salesVsPurchase));
         // send transaction chart's data on picked month
         $data = $this->chart('customDailyTransaction', $params, $from, $con);
         $transaction['event'] = 'chart/customDailyTransaction';
         $transaction['data'] = $data;
         $from->send(json_encode($transaction));
         // send purchase data
         $data = Reports::customPurchase($params, $currentUser, $con);
         $purchase['event'] = 'report/customPurchase';
         $purchase['data'] = $data;
         $from->send(json_encode($purchase));
         // send purchased product
         $data = Reports::customPurchasedProduct($params, $currentUser, $con);
         $purchasedProduct['event'] = 'report/customPurchasedProduct';
         $purchasedProduct['data'] = $data;
         $from->send(json_encode($purchasedProduct));
         // send saled product
         $data = Reports::customSaledProduct($params, $currentUser, $con);
         $saledProduct['event'] = 'report/customSaledProduct';
         $saledProduct['data'] = $data;
         $from->send(json_encode($saledProduct));
         // send sales data
         $data = Reports::customSales($params, $currentUser, $con);
         $sales['event'] = 'report/customSales';
         $sales['data'] = $data;
         $from->send(json_encode($sales));
         // send sales cashier data
         $data = Reports::customSalesCashier($params, $currentUser, $con);
         $salesCashier['event'] = 'report/customSalesCashier';
         $salesCashier['data'] = $data;
         $from->send(json_encode($salesCashier));
     }
     return $results;
 }
 public function allReports()
 {
     $doctor = auth()->user();
     //Get all reports assigned to this doctor
     $reports = Reports::where('assigned_doctor_id', $doctor->id)->orderBy('id', 'DESC')->get();
     $data = ['reports' => $reports];
     return view('frontend.doctor.all-reports', $data);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function profile()
 {
     $user = auth()->user();
     $current_user = User::where('users.id', $user->id)->join('user_profiles', 'user_profiles.user_id', '=', 'users.id')->first();
     $reportCount = Reports::where('user_id', $user->id)->count();
     //        $recommendations = Recommendation::where('user_id', $user->id)->count();
     $data = ['user' => $current_user, 'reportCount' => $reportCount];
     return view('frontend.user.profile', $data);
 }
示例#7
0
 public static function monthlySalesCashier($params, $currentUser, $con)
 {
     if (!isset($params->month)) {
         throw new \Exception('Missing parameter');
     }
     $picked = new \DateTime($params->month);
     $date = new \stdClass();
     $date->start = new \DateTime($picked->format('Y-m-01'));
     $date->until = new \DateTime($picked->format('Y-m-t'));
     $results = Reports::getSalesCashier($date, $con);
     return $results;
 }