public function attbyalph() { if (\Request::ajax()) { $caracter = \Input::get('caracter'); $enfants = Child::where('nom_enfant', 'LIKE', $caracter . '%')->where('user_id', \Auth::user()->id)->get(); foreach ($enfants as $enfant) { echo ' <tr> <td><div class="minimal single-row"> <div class="checkbox_liste "> <input type="checkbox" value=" ' . $enfant->id . ' " > </div> </div></td> <td><img class="avatar" src=" ' . asset('uploads/' . $enfant->photo) . '"></td> <td>' . $enfant->nom_enfant . '</td> <td>15-09-2015 </td> <td> <a href="#" class="actions_icons"> <i class="fa fa-trash-o liste_icons"></i></a> <a href="#"><i class="fa fa-archive liste_icons"></i> </a> </td> <td><a href="' . action('AttendancesController@show', [$enfant->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } }
public function index() { if (Auth::check()) { $children = Child::where('user_group', '=', Auth::user()->user_group)->get(); } $users = User::all(); $transactions = Transactions::all()->sortByDesc('created_at')->take(20); return view('home', compact('users', 'transactions', 'children')); }
public function indexef() { $children = Child::where('f_id', \Auth::user()->id)->get(); return view('attendances.indexef', compact('children')); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $validator = Validator::make([$request->all(), 'photo' => $request->photo], ['photo' => 'image'], ['photo.image' => "L'image doit etre de type valide JPEG\\PNG"]); if ($validator->passes()) { $enfant = Child::where('user_id', \Auth::user()->id)->where('id', $id)->first(); $enfant->nationalite = \DB::table('countries')->where('id', $request->nationalite)->first()->nom_fr_fr; $enfant->nom_enfant = $request->nom_enfant; $enfant->date_naissance = $request->date_naissance; $enfant->save(); if ($request->transport == 1) { if (Transport::where('user_id', \Auth::user()->id)->first()->somme > 0) { $child = Child::where('user_id', \Auth::user()->id)->where('id', $id)->first(); $child->transport = 1; $child->save(); } else { return redirect()->back()->withErrors(["Vous n'avez pas encore précisé un prix pour le transport"]); } } elseif ($request->transport == 0) { $child = Child::where('user_id', \Auth::user()->id)->where('id', $id)->first(); $child->transport = $request->transport; $child->save(); } $family = Family::where('email_responsable', $request->em)->first(); $family->adresse = $request->adresse; $family->numero_fixe = $request->numero_fixe; $family->numero_portable = $request->numero_portable; $family->nom_pere = $request->nom_pere; $family->nom_mere = $request->nom_mere; $family->save(); $image = $request->photo; if (isset($image) && !empty($image)) { $filename = $image->getClientOriginalName(); $path = public_path('uploads/' . $filename); Image::make($image->getRealPath())->resize(313, 300)->save($path); $child = Child::where('user_id', \Auth::user()->id)->where('id', $id)->first(); $child->photo = $filename; $child->nationalite = \DB::table('countries')->where('id', $request->nationalite)->first()->nom_fr_fr; $child->save(); } else { $pic = Child::findOrFail($id); if (isset($pic->photo)) { $filename = $pic->photo; } else { $filename = null; } $pic->photo = $filename; $child->nationalite = \DB::table('countries')->where('id', $request->nationalite)->first()->nom_fr_fr; $pic->save(); } return redirect()->back()->with('success', 'Modifications réussies !'); } else { return redirect()->back()->withErrors($validator); } }
public function trier_sexe() { if (\Request::ajax()) { $year = \Input::get('year'); $month = \Input::get('month'); $sexe = \Input::get('sexe'); $enfants = Child::where('user_id', \Auth::user()->id)->whereRaw('EXTRACT(year from created_at) = ?', [$year])->whereRaw('EXTRACT(month from created_at) = ?', [$month])->where('sexe', $sexe)->orderBy('created_at', 'desc')->get(); foreach ($enfants as $enfant) { foreach ($enfant->bills as $e) { if ($e->status == 1) { $class = 'label-success'; } else { $class = 'label-danger'; } } if ($enfant->photo) { $photo = asset('uploads/' . $enfant->photo); } else { $photo = asset('images/no_avatar.jpg'); } echo ' <tr> <td><div class="minimal single-row"> <div class="checkbox_liste "> <input type="checkbox" name="select[]" value="' . $enfant->id . '"> </div> </div></td> <td><img class="avatar" src=" ' . $photo . ' "></td> <td>' . $enfant->nom_enfant . '</td> <td>' . $enfant->date_naissance->format('d-m-Y') . ' </td> <td><span class="label ' . $class . ' label-mini"><i class="fa fa-money"></i></span></td> <td> <a href=" ' . action('ChildrenController@delete', [$enfant]) . ' " class="actions_icons delete-child"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-child" href="' . action('ChildrenController@archive', [$enfant]) . '"><i class="fa fa-archive liste_icons"></i> </a> </td> <td><a href="' . action('ChildrenController@show', [$enfant->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } }
public function search() { $child = Child::where('nom_enfant', 'LIKE', '%' . \Input::get('terms') . '%')->where('user_id', \Auth::user()->id)->get(); $family = Family::where('nom_pere', 'LIKE', '%' . \Input::get('terms') . '%')->where('user_id', \Auth::user()->id)->orWhere('nom_mere', 'LIKE', '%' . \Input::get('terms') . '%')->get(); return view('families.search')->with(['child' => $child, 'family' => $family]); }
public function searchinst() { if (\Request::ajax()) { $terms = ucfirst(\Input::get('terms')); $child = Child::where('nom_enfant', 'LIKE', '%' . $terms . '%')->where('user_id', \Auth::user()->id)->get(); if ($child->count()) { foreach ($child as $c) { foreach ($c->bills as $bill) { if ($bill->status == 0 && !$bill->deleted_at) { $class = 'label-danger'; $message = 'Non Réglée'; } else { $class = 'label-success'; $message = 'Réglée'; } $photo = asset('uploads/' . $bill->child->photo); echo ' <tr> <td> ' . $bill->id . '</td> <td><img class="avatar" src="' . $photo . '"></td> <td>' . $bill->child->nom_enfant . '</td> <td> ' . $bill->start->format('d-m-Y') . ' </td> <td> ' . $bill->somme . ' Dhs</td> <td><span class="label ' . $class . ' label-mini"> ' . $message . ' </span> </td> <td> <a href="' . action('BillsController@delete', [$bill->id]) . '" class="actions_icons delete-bill"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-bill" href="' . action('BillsController@archive', [$bill->id]) . '"><i class="fa fa-archive liste_icons"></i> </a> </td> <td><a href="' . action('BillsController@details', [$bill->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } } else { $children = Child::where('user_id', \Auth::user()->id)->get(); foreach ($children as $child) { foreach ($child->bills as $bill) { if ($bill->status == 0 && !$bill->deleted_at) { $class = 'label-danger'; $message = 'Non Réglée'; } else { $class = 'label-success'; $message = 'Réglée'; } $photo = asset('uploads/' . $bill->child->photo); echo ' <tr> <td> ' . $bill->id . '</td> <td><img class="avatar" src="' . $photo . '"></td> <td>' . $bill->child->nom_enfant . '</td> <td> ' . $bill->start->format('d-m-Y') . ' </td> <td> ' . $bill->somme . ' Dhs</td> <td><span class="label ' . $class . ' label-mini"> ' . $message . ' </span> </td> <td> <a href="' . action('BillsController@delete', [$bill->id]) . '" class="actions_icons delete-bill"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-bill" href="' . action('BillsController@archive', [$bill->id]) . '"><i class="fa fa-archive liste_icons"></i> </a> </td> <td><a href="' . action('BillsController@details', [$bill->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } } } } }
public function exportPdf($ids = null) { $ids = explode(',', substr($ids, 0, -1)); $ids = array_unique($ids); $model = Bill::whereIn('id', $ids)->where('user_id', \Auth::user()->id)->get(['id', 'child_id', 'start', 'somme', 'status']); Excel::create('La liste des Factures', function ($excel) use($model, $ids) { $excel->sheet('La liste des Factures', function ($sheet) use($model, $ids) { foreach ($model as $bill) { $bill->date = $bill->start->toDateString(); if ($bill->status == 0) { $bill->status = 'Non Réglée'; } else { $bill->status = 'Réglée'; } $bill->child_id = Child::where('id', $bill->child_id)->first()->nom_enfant; unset($bill->start); } $sheet->setWidth('A', 15); $sheet->setWidth('B', 15); $sheet->setWidth('C', 15); $sheet->setWidth('D', 15); $sheet->setWidth('E', 15); $sheet->fromModel($model); $sheet->setAllBorders('thin'); $sheet->setFontFamily('OpenSans'); $sheet->setFontSize(13); $sheet->setFontBold(false); $sheet->setAllBorders('thin'); for ($i = 1; $i <= count($ids) + 1; $i++) { $sheet->row($i, function ($rows) { $rows->setFontColor('#556b7b'); $rows->setAlignment('center'); }); } $sheet->cells('A1:E1', function ($cells) { $cells->setBackground('#e9f1f3'); $cells->setFontColor('#556b7b'); $cells->setFont(array('family' => 'OpenSans', 'size' => '15', 'bold' => true)); }); $sheet->row(1, array('Num De Facture', 'Nom de l\'élève', 'Somme', 'Statut', 'Date')); }); })->export('pdf'); }
<div class="bloc_info"><img src="{{ asset('images/factures.png') }}" > <span class="count"> <?php echo App\Bill::where('status', 0)->where('user_id', \Auth::user()->id)->CurrentYear()->count(); ?> </span><p>Factures non réglées</p></div> </a></div> </section> </div> <div class="col-md-4"> <section class="panel bloc"> <div class="panel-body"> <a href="#"> <div class="bloc_info"><img src="{{ asset('images/anniversary.png') }}" > <?php $annv = \App\Child::where('user_id', \Auth::user()->id)->whereRaw('EXTRACT(month from date_naissance) = ?', [\Carbon\Carbon::now()->month])->whereRaw('EXTRACT(day from date_naissance) = ?', [\Carbon\Carbon::now()->day])->count(); ?> <span class="count">{{ $annv }}</span><p>Anniversaires</p></div> </a></div> </section> </div> </div> <script src="{{ asset('js\codrops\Notification-Styles-Inspiration\js\modernizr.custom.js') }}"></script> <script src="{{ asset('js\codrops\Notification-Styles-Inspiration\js\classie.js') }}"></script> <script src="{{ asset('js\codrops\Notification-Styles-Inspiration\js\notificationFx.js') }}"></script> @endif
public function enfbyalph() { if (\Request::ajax()) { $caracter = Input::get('caracter'); $enfants = Child::where('nom_enfant', 'LIKE', $caracter . '%')->where('user_id', \Auth::user()->id)->get(); foreach ($enfants as $enfant) { echo ' <tr> <td><div class="minimal single-row"> <div class="checkbox_liste "> <input type="checkbox" name="select[]" value="' . $enfant->id . '"> </div> </div></td> <td><img class="avatar" src=" ' . asset('uploads/' . $enfant->photo . '') . ' "></td> <td>' . $enfant->nom_enfant . '</td> <td>' . $enfant->date_naissance->format('d-m-Y') . ' </td> <td><span class="label label-success label-mini"><i class="fa fa-money"></i></span></td> <td> <a href="#" class="actions_icons delete-child"> <i class="fa fa-trash-o liste_icons"></i></a> <a class="archive-child" href="#"><i class="fa fa-archive liste_icons"></i> </a> </td> <td><a href="' . action('ChildrenController@show', [$enfant->id]) . '"><div class="btn_details">Détails</div></a></td> </tr>'; } // echo json_encode($enfants); //die(); } }
/** * Execute the console command. * * @return mixed */ public function handle() { if (Carbon::now()->toDateString() == Carbon::now()->startOfMonth()->toDateString()) { $users = User::where('type', 'ecole')->get(); foreach ($users as $user) { $sc = SchoolYear::where('user_id', $user->id)->where('current', 1)->first(); if ($sc->type == 'Semis' && Carbon::now()->between($sc->startch1, $sc->endch2)) { foreach ($user->children as $child) { foreach ($child->bills as $bill) { $getChild = Bill::where('child_id', $bill->child_id)->where('reduction', 0)->where('school_year_id', $sc->id)->where('nbrMois', 1)->orderBy('id', 'desc')->first(); if ($getChild) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonth()->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; $transportStatus = $enfant->transport; foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $transportStatus == 0 ? $facture->somme = $taman : ($facture->somme = $taman + Transport::where('user_id', $getChild->user_id)->first()->somme); $facture->nbrMois = $getChild->nbrMois; $facture->reductionPrix = null; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 0; $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } } } elseif ($sc->type == 'Trim' && Carbon::now()->between($sc->startch1, $sc->endch3)) { foreach ($user->children as $child) { foreach ($child->bills as $bill) { $getChild = Bill::where('child_id', $bill->child_id)->where('reduction', 0)->where('school_year_id', $sc->id)->where('nbrMois', 1)->orderBy('id', 'desc')->first(); if ($getChild) { $facture = new Bill(); $facture->start = $getChild->end->toDateString(); $facture->end = $getChild->end->addMonth()->toDateString(); $facture->status = 0; $facture->user_id = $getChild->user_id; $enfant = Child::where('user_id', $getChild->user_id)->where('id', $getChild->child_id)->first(); $taman = ''; $transportStatus = $enfant->transport; foreach ($enfant->levels as $level) { $getPriceOfLevel = PriceBill::where('niveau', $level->id)->where('user_id', $getChild->user_id)->first(); $taman = $getPriceOfLevel->prix; } $transportStatus == 0 ? $facture->somme = $taman : ($facture->somme = $taman + Transport::where('user_id', $getChild->user_id)->first()->somme); $facture->nbrMois = $getChild->nbrMois; $facture->reductionPrix = null; $facture->school_year_id = $getChild->school_year_id; $facture->reduction = 0; $facture->child_id = $getChild->child_id; $facture->f_id = $getChild->f_id; $facture->save(); break; } } } } } /* $enfants = Child::has('bills')->get(); foreach($enfants as $e) { foreach($e->bills as $b) { $d = Bill::where('child_id',$b->child_id)->orderBy('id','desc')->first(); $bill = new Bill(); $bill->start =$d->end->toDateString(); $nextMonth7 =$d->end->addMonth()->toDateString(); if(Carbon::parse($nextMonth7)->month == 7) { $bill->end = Carbon::parse($nextMonth7)->addMonths(2)->toDateString(); }else{ $bill->end = $nextMonth7; } $bill->status = 0; $bill->user_id = $d->user_id; $bill->somme = $d->somme; $bill->child_id =$d->child_id; $bill->f_id = $d->f_id; $bill->save(); break; } }*/ } }
public function bike_report() { $csv = Export::newCSV(["family id", "child name", "age", "bike style", "bike size"]); $children = Child::where('bike_want', 'Y')->join('household', 'household.id', '=', 'child.household_id')->where('approved', 1)->get(); foreach ($children as $child) { $csv->insertOne([$child->household_id, $child->name_last . ", " . $child->name_first, $child->age, $child->bike_style, $child->bike_size]); } $csv->output('GiftProjectBikeReport_' . date("YmdHis") . '.csv'); flush(); exit(0); }