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> '; } }