/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $aboutfacture = SchoolYear::checkNextMonth(); PromotionStatus::fillStatusesFirst(); $client = new Google_Client(); $client->setClientId('548520090024-i8jmtdmdi5ijvj3mn2sbqe2u3a431gh6.apps.googleusercontent.com'); $client->setClientSecret('IX-SilXd0ctCrKUX1a5oP9is'); $client->setRedirectUri('http://laravel.dev:8000/schools/boite'); $client->addScope('https://mail.google.com'); $service = new Google_Service_Gmail($client); $count = Attendance::whereRaw('EXTRACT(year from start) = ?', [Carbon::now()->year])->whereRaw('EXTRACT(month from start) = ?', [Carbon::now()->month])->whereRaw('EXTRACT(day from start) = ?', [Carbon::now()->day])->where('user_id', \Auth::user()->id)->groupBy('child_id')->get(); $count = $count->count(); return view('index')->with(['client' => $client, 'service' => $service, 'count' => $count, 'aboutfacture' => $aboutfacture]); }
public function absenceToday() { $abstoday = Attendance::whereYear('start', '=', [Carbon::now()->year])->whereMonth('start', '=', [Carbon::now()->month])->whereDay('start', '=', [Carbon::now()->day])->where('user_id', \Auth::user()->id)->paginate(10); $count = Attendance::whereRaw('EXTRACT(year from start) = ?', [Carbon::now()->year])->whereRaw('EXTRACT(month from start) = ?', [Carbon::now()->month])->whereRaw('EXTRACT(day from start) = ?', [Carbon::now()->day])->where('user_id', \Auth::user()->id)->groupBy('child_id')->get()->count(); return view('attendances.absenceToday', compact('abstoday', 'count')); }
public function getYearAndMonth() { if (\Request::ajax()) { $year = \Input::get('year'); $month = \Input::get('month'); $monthtext = \Input::get('monthtext'); //Absences selon le tri ajax $count_absence = Attendance::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('user_id', \Auth::user()->id)->count(); $count_abs_normale = Attendance::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('user_id', \Auth::user()->id)->where('title', 'Normal')->count(); $count_abs_maladie = Attendance::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('title', 'Maladie')->where('user_id', \Auth::user()->id)->count(); /* statistics new subscribers selon le tri ajax */ $ns_number = Child::whereRaw('EXTRACT(month from created_at) = ?', [$month])->whereRaw('EXTRACT(year from created_at) = ?', [$year])->where('user_id', \Auth::user()->id)->count(); $garcons = Child::whereRaw('EXTRACT(month from created_at) = ?', [$month])->whereRaw('EXTRACT(year from created_at) = ?', [$year])->where('user_id', \Auth::user()->id)->where('sexe', 'Garçon')->count(); $filles = Child::whereRaw('EXTRACT(month from created_at) = ?', [$month])->whereRaw('EXTRACT(year from created_at) = ?', [$year])->where('user_id', \Auth::user()->id)->where('sexe', 'fille')->count(); /* bills par le trix ajax */ $count_bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('user_id', \Auth::user()->id)->count(); $regled_bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('user_id', \Auth::user()->id)->where('status', 1)->count(); $non_regled_bills = Bill::whereRaw('EXTRACT(month from start) = ?', [$month])->whereRaw('EXTRACT(year from start) = ?', [$year])->where('user_id', \Auth::user()->id)->where('status', 0)->count(); // for counting bills $somme = Bill::whereRaw('EXTRACT(year from start) = ?', [$year])->whereRaw('EXTRACT(month from start) = ?', [$month])->where('user_id', \Auth::user()->id)->sum('somme'); $encaisse = Bill::whereRaw('EXTRACT(year from start) = ?', [$year])->whereRaw('EXTRACT(month from start) = ?', [$month])->where('user_id', \Auth::user()->id)->where('status', 1)->sum('somme'); $reste = Bill::whereRaw('EXTRACT(year from start) = ?', [$year])->whereRaw('EXTRACT(month from start) = ?', [$month])->where('user_id', \Auth::user()->id)->where('status', 0)->sum('somme'); echo ' <div class="row partie-up"> <div class="col-md-4"> <section class="panel bloc"> <div class="panel-body"> <a href="' . action('StatisticsController@monthly_absence', [$year, $month]) . '"> <div class="bloc_statistique"><img src="images/pointages.png" ><span class="count"> ' . $count_absence . '</span><p>Cas d\'absence Ce Mois</p></div> <div class="bloc_statistique_details"> <div class="bloc_statistique_d1"> <span class="count">' . $count_abs_normale . '</span><p>Justifiées</p> </div> <div class="bloc_statistique_d2"> <span class="count">' . $count_abs_maladie . '</span><p>Non Justifiées</p> </div> </div> </a> </div> </section> </div> <div class="col-md-4"> <section class="panel bloc"> <div class="panel-body"> <a href="' . action('StatisticsController@new_subscribers', [$year, $month]) . '"> <div class="bloc_statistique"><img src="images/inscription.png" > <span class="count">' . $ns_number . '</span><p>Nouvelles inscriptions Ce Mois</p></div> <div class="bloc_statistique_details"> <div class="bloc_statistique_d1"> <span class="count">' . $garcons . ' </span><p>Garçons</p> </div> <div class="bloc_statistique_d2"> <span class="count">' . $filles . '</span><p>Filles</p> </div> </div> </a> </div> </section> </div> <div class="col-md-4"> <section class="panel bloc"> <div class="panel-body"> <a href="' . action('StatisticsController@monthly_bills', [$year, $month]) . '"> <div class="bloc_statistique"><img src="images/factures.png" ><span class="count"> ' . $count_bills . '</span><p>Factures générées Ce Mois</p></div> <div class="bloc_statistique_details"> <div class="bloc_statistique_d1"> <span class="count">' . $regled_bills . '</span><p>Réglées</p> </div> <div class="bloc_statistique_d2"> <span class="count">' . $non_regled_bills . '</span><p>Non réglées</p> </div> </div> </a> </div> </section> </div> </div> <div class="row partie-down"> <div class="col-md-4"> <section class="panel bloc"> <div class="panel-body"> <a href="#"> <div class="bloc_statistique"><img src="images/statistiques.png" > <span class="count">' . $somme . ' </span><p>Dhs total estimé Ce Mois</p></div> <div class="bloc_statistique_details"> <div class="bloc_statistique_d1"> <span class="count">' . $encaisse . '</span><p>Dhs encaissé</p> </div> <div class="bloc_statistique_d2"> <span class="count">' . $reste . ' </span><p>Dhs qui reste</p> </div> </div> </a> </div> </section> </div> </div> '; } }