Esempio n. 1
0
 public function isDoctorVisited($doctorId, $date)
 {
     $visited = SMReport::where('sm_id', \Auth::user()->id)->where('doctor_id', $doctorId)->where('date', '>=', $date)->count();
     if ($visited > 0) {
         return true;
     }
 }
Esempio n. 2
0
 public function listAll()
 {
     $AMIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get();
     $employees = Employee::select('id')->whereIn('manager_id', $AMIds)->get();
     $MRReports = Report::whereIn('mr_id', $employees)->get();
     $AMReports = AMReport::whereIn('am_id', $AMIds)->get();
     $yourReports = SMReport::where('sm_id', \Auth::user()->id)->get();
     $dataView = ['MRReports' => $MRReports, 'AMReports' => $AMReports, 'yourReports' => $yourReports];
     return view('sm.report.list', $dataView);
 }
Esempio n. 3
0
 public function index()
 {
     $AMsIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get();
     $employees = Employee::select('line_id')->whereIn('manager_id', $AMsIds)->get();
     //am_session
     $products = Product::whereIn('line_id', $employees)->get();
     $employeesId = Employee::select('id')->whereIn('manager_id', $AMsIds)->get();
     $customers = Customer::whereIn('mr_id', $employeesId)->get();
     $MRs = Employee::whereIn('manager_id', $AMsIds)->get();
     $AMs = Employee::where('manager_id', \Auth::user()->id)->get();
     $dataView = ['productsCount' => count($products), 'plansCount' => SMPlan::where('month', \Config::get('app.current_month'))->count(), 'reportsCount' => SMReport::where('month', \Config::get('app.current_month'))->count(), 'customersCount' => count($customers), 'employeesCount' => count($MRs) + count($AMs)];
     return view('sm.index', $dataView);
 }