public function achievement() { $AMIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get(); $MRs = Employee::whereIn('manager_id', $AMIds)->get(); $dataView = ['MRs' => $MRs]; return view('sm.line.history.search', $dataView); }
public function search() { $AMsIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get(); $MRs = Employee::whereIn('manager_id', $AMsIds)->get(); $dataView = ['MRs' => $MRs]; return view('sm.customer.search', $dataView); }
public function listAll() { $AMsIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get(); $MRs = Employee::whereIn('manager_id', $AMsIds)->get(); $AMs = Employee::where('manager_id', \Auth::user()->id)->get(); $dataView = ['MRs' => $MRs, 'AMs' => $AMs]; return view('sm.employee.list', $dataView); }
public function search() { $AMIds = Employee::select('id')->where('manager_id', 1)->get(); $classes = VisitClass::all(); $employees = Employee::select('id')->whereIn('manager_id', $AMIds)->get(); $specialties = Customer::select('specialty')->whereIn('mr_id', $employees)->distinct()->get(); $MRs = Employee::whereIn('manager_id', $AMIds)->get(); $dataView = ['classes' => $classes, 'specialties' => $specialties, 'MRs' => $MRs]; return view('sm.search.coverage.search', $dataView); }
public function search() { $products = Product::all(); $gifts = Gift::all(); $doctors = Customer::all(); $AMsIds = Employee::select('id')->where('manager_id', \Auth::user()->id)->get(); $MRs = Employee::whereIn('manager_id', $AMsIds)->get(); $AMs = Employee::where('manager_id', \Auth::user()->id)->get(); $dataView = ['doctors' => $doctors, 'products' => $products, 'gifts' => $gifts, 'MRs' => $MRs, 'AMs' => $AMs]; return view('sm.search.reports.search', $dataView); }
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); }
/** * Show the application welcome screen to the user. * * @return Response */ public function index() { //helpers $rating_date = mktime(0, 0, 0, date('n', time()), date('j', time()), date('Y', time())); //get form select options and quality radio buttons $brands = Brand::companyBrands()->get()->lists('name', 'id'); $residences = Residence::companyResidences()->get()->lists('name', 'id'); $companies = Company::userCompanies()->get()->lists('name', 'id'); $companies_ids = Company::userCompanies()->get()->lists('id'); foreach ($companies_ids as $company_id) { $company_ids[] = $company_id; } $languages = Language::all()->lists('name', 'id'); array_unshift($languages, "Choose other language"); $qualities = Qualities::CompanyQualities()->get(); //get all employees $employees = Employee::whereIn('company_id', $company_ids)->with('company', 'residence', 'phone', 'qualities', 'language')->with(['dates' => function ($query) { $query->whereRaw('(? BETWEEN dates.start AND dates.end OR dates.start>?) AND dates.type IN("day_off", "annual_leave")', array(mktime(0, 0, 0, date('n', time()), date('j', time()), date('Y', time())), mktime(0, 0, 0, date('n', time()), date('j', time()), date('Y', time())))); }])->status('active')->get(); //return $employees; return view('search', compact('brands', 'residences', 'languages', 'employees', 'rating_date', 'qualities', 'companies')); }