static function addSchedule($input) { $StudentSchedule = new StudentSchedule(); $StudentSchedule->student_id = $input['studentId']; $StudentSchedule->schedule_date = $input['scheduleDate'] . ' ' . $input['scheduleTime']; $StudentSchedule->course_id = $input['courseId']; $StudentSchedule->class_id = $input['classId']; $StudentSchedule->save(); StudentClasses::addSchedule($input); //date("Y-m-d H:i:s"); return $StudentSchedule; }
/** * Display a listing of the resource. * * @return Response */ public function index() { echo "<pre>"; echo "harsha"; $enrolledCustomers = StudentClasses::getEnrolledCustomers(); print_r($enrolledCustomers); exit; $data = array("customerName" => "Prasath Aru"); Mail::send('emails.account.customer', $data, function ($msg) { $email = '*****@*****.**'; $msg->from('*****@*****.**', 'The Little Gym'); $msg->to($email, "Prasath Arumugam")->subject('Test mail'); }); exit; /* $batchEndDate = Batches::select('end_date')->where("id","=", 2)->get(); print_r($batchEndDate['0']->end_date); */ $batches = BatchSchedule::where('batch_id', '=', '2')->whereBetween('schedule_date', array('2016-1-1', '2016-3-31'))->count(); //->get(); echo $batches; }
public function getStudentsByBatch() { $inputs = Input::all(); $batchId = $inputs['batchId']; $selectedDate = $inputs['selectedDate']; $studentsByBatchId = StudentClasses::getStudentByBatchId($batchId, $selectedDate); if ($studentsByBatchId) { $attendanceArray = array(); $i = 0; foreach ($studentsByBatchId as $studentAttendance) { $attendanceArray[$i]['studentName'] = $studentAttendance->Students->student_name; $attendanceArray[$i]['studentId'] = $studentAttendance->Students->id; $studentAttendanceRecord = Attendance::getDaysAttendanceForStudent($studentAttendance->Students->id, $batchId, $selectedDate); if ($studentAttendanceRecord) { $attendanceArray[$i]['isAttendanceEntered'] = 'yes'; $attendanceArray[$i]['attendanceStatus'] = $studentAttendanceRecord->status; } else { $attendanceArray[$i]['isAttendanceEntered'] = 'no'; } $i++; } //print_r($attendanceArray); return Response::json(array("status" => "success", 'result' => $attendanceArray)); } return Response::json(array("status" => "failed")); }
static function getAttendanceTable($batchId) { $studentsInBatch = StudentClasses::with('Students')->where('batch_id', '=', $batchId)->get(array('student_id', 'enrollment_start_date', 'enrollment_end_date')); $studentBatchDates = array(); $i = 0; foreach ($studentsInBatch as $student) { $studentBatchDates[$i]['Student'] = $student; $studentBatchDates[$i]['Attendance'] = BatchSchedule::where("batch_id", '=', $batchId)->where('schedule_date', '>=', $student->enrollment_start_date)->where('schedule_date', '<=', $student->enrollment_end_date)->get(); $batchdates = BatchSchedule::where("batch_id", '=', $batchId)->where('schedule_date', '>=', $student->enrollment_start_date)->where('schedule_date', '<=', $student->enrollment_end_date)->get(); $attendanceIncrement = 0; $presentDays = 0; $eaDays = 0; $absentDays = 0; $totalSessions = 0; foreach ($batchdates as $date) { /* echo "<pre>"; print_r($student); echo "</pre>"; */ $attendance = Attendance::getDaysAttendanceForStudent($student->student_id, $batchId, $date->schedule_date); $studentBatchDates[$i]['Attendance'][$attendanceIncrement]['attendStat'] = $attendance; $studentBatchDates[$i]['Attendance'][$attendanceIncrement]['attenddate'] = $date->schedule_date; if ($attendance) { if ($attendance->status == "P") { $presentDays++; } if ($attendance->status == "EA") { $eaDays++; } if ($attendance->status == "A") { $absentDays++; } } $attendanceIncrement++; $totalSessions++; } $studentBatchDates[$i]['statistics']['present'] = $presentDays; $studentBatchDates[$i]['statistics']['absent'] = $absentDays; $studentBatchDates[$i]['statistics']['ea'] = $eaDays; $studentBatchDates[$i]['statistics']['totalSessions'] = $totalSessions; /* echo "<pre>"; print_r(DB::getQueryLog()); print_r($studentBatchDates[$i]); echo "</pre>"; */ $i++; } /* echo "<pre>"; print_r($studentBatchDates); echo "</pre>"; exit(); */ return $studentBatchDates; }
static function getStudentClassbyId($student_class_id) { return StudentClasses::where('id', '=', $student_class_id)->get(); }
public function details($id) { if (Auth::check()) { $currentPage = "CUSTOMERS_LIST"; $mainMenu = "CUSTOMERS_MAIN"; $inputs = Input::all(); if (isset($inputs['customerName'])) { if (Customers::addCustomers($inputs)) { Session::flash('msg', "Customer added successfully."); } else { Session::flash('warning', "Customer, Course Could not be added at the moment."); } } $customer = Customers::getCustomersById($id); $students = Students::getStudentByCustomer($id); $comments = Comments::getCommentByCustomerId($id); $provinces = Provinces::getProvinces("IN"); $kidsSelect = Students::getStudentsForSelectBox($id); $membershipTypes = MembershipTypes::getMembershipTypesForSelectBox(); $birthdays = BirthdayParties::getBirthdaysByCustomer($id); //return $customer; //Membership if (isset($inputs['membershipTypesMembersDiv'])) { /* echo '<pre>'; print_r($inputs); echo '</pre>'; exit(); */ if ($inputs['membershipTypesMembersDiv'] != "") { $membershipInput['customer_id'] = $id; $membershipInput['membership_type_id'] = $inputs['membershipTypesMembersDiv']; CustomerMembership::addMembership($membershipInput); $order['customer_id'] = $id; $order['payment_for'] = "membership"; $order['payment_dues_id'] = ''; $order['payment_mode'] = $inputs['paymentTypeRadio']; $order['card_last_digit'] = $inputs['card4digits']; $order['card_type'] = $inputs['cardType']; $order['bank_name'] = $inputs['bankName']; $order['cheque_number'] = $inputs['chequeNumber']; $order['amount'] = $inputs['membershipPrice']; $order['order_status'] = "completed"; Orders::createOrder($order); } } //$customerMembership = ""; /* echo '<pre>'; print_r($customer); echo '</pre>'; exit(); */ $presentDate = Carbon::now(); $membershipStartDate = Carbon::now(); $membershipEndDate = Carbon::now(); $customerMembershipId = ''; if (isset($customer->CustomerMembership['0'])) { $select = count($customer->CustomerMembership) - 1; $membershipStartDate = $membershipStartDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_start_date); $membershipEndDate = $membershipEndDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_end_date); if ($membershipStartDate->lte($presentDate) && $membershipEndDate->gte($presentDate)) { $customerMembershipId = $customer->CustomerMembership[$select]->membership_type_id; } } if (isset($customerMembershipId)) { $customerMembership = MembershipTypes::getMembershipTypeByID($customerMembershipId); } $membershipTypesAll = MembershipTypes::getMembershipTypes(); $birthdaypaiddata = Orders::getBirthdayfulldata($id); for ($i = 0; $i < count($birthdaypaiddata); $i++) { $studentData = Students::getStudentById($birthdaypaiddata[$i]['student_id']); $birthdaypaiddata[$i]['student_name'] = $studentData[0]['student_name']; $birthdaypaiddata[$i]['student_date_of_birth'] = $studentData[0]['student_date_of_birth']; $birthdayData = BirthdayParties::getBirthdaybyId($birthdaypaiddata[$i]['birthday_id']); $birthdaypaiddata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date']; $birthdaypaiddata[$i]['tax_amount'] = $birthdaypaiddata[0]['tax_amount']; $user_data = User::getUsersByUserId($birthdaypaiddata[$i]['created_by']); $birthdaypaiddata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name']; $birthdaypaiddata[$i]['encrypted_id'] = Crypt::encrypt($birthdaypaiddata[$i]['id']); } $birthdayDuedata = PaymentDues::getPaymentpendingfulldata($id); for ($i = 0; $i < count($birthdayDuedata); $i++) { $studentData = Students::getStudentById($birthdayDuedata[$i]['student_id']); $birthdayDuedata[$i]['student_name'] = $studentData[0]['student_name']; $user_data = User::getUsersByUserId($birthdayDuedata[$i]['created_by']); $birthdayDuedata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name']; $birthdayData = BirthdayParties::getBirthdaybyId($birthdayDuedata[$i]['birthday_id']); $birthdayDuedata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date']; } //followup_data $iv_data = IntroVisit::where('customer_id', '=', $id)->get(); for ($i = 0; $i < count($iv_data); $i++) { $comments_data = Comments::where('introvisit_id', '=', $iv_data[$i]['id'])->orderBy('id', 'DESC')->first(); $iv_data[$i]['comment_data'] = $comments_data; $student = Students::find($iv_data[$i]['student_id']); $iv_data[$i]['student_name'] = $student['student_name']; $iv_data[$i]['iv_date'] = date("Y-m-d", strtotime($iv_data[$i]['iv_date'])); } $birthday_data = BirthdayParties::where('customer_id', '=', $id)->get(); for ($i = 0; $i < count($birthday_data); $i++) { $birthday_comments = Comments::where('birthday_id', '=', $birthday_data[$i]['id'])->orderBy('id', 'DESC')->first(); $birthday_data[$i]['comment_data'] = $birthday_comments; $student_data = Students::find($birthday_data[$i]['student_id']); $birthday_data[$i]['student_name'] = $student_data['student_name']; $birthday_data[$i]['birthday_party_date'] = date("Y-m-d", strtotime($birthday_data[$i]['birthday_party_date'])); } //for complaints $complaint_data = Complaint::getComplaintByCustomerId($id); //Comments::where('customer_id','=',$id)->get(); for ($i = 0; $i < count($complaint_data); $i++) { $complaint_data[$i]['comments'] = Comments::where('complaint_id', '=', $complaint_data[$i]['id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($complaint_data[$i]['student_id']); $complaint_data[$i]['student_name'] = $student_data['student_name']; } //for retention $retention_data = Retention::getRetentionByCustomerId($id); for ($i = 0; $i < count($retention_data); $i++) { $retention_data[$i]['comments'] = Comments::where('retention_id', '=', $retention_data[$i]['id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($retention_data[$i]['student_id']); $retention_data[$i]['student_name'] = $student_data['student_name']; } //for inquiry $inuiry_data = Inquiry::getInquiryByCustomerId($id); for ($i = 0; $i < count($inuiry_data); $i++) { $inuiry_data[$i]['comments'] = Comments::where('inquiry_id', '=', $inuiry_data[$i]['id'])->orderBy('id', 'DESC')->first(); } //for enrollment payment followup/brush up calls $enrollmentFollowupData = PaymentFollowups::getPaymentFollowupByCustomerId($id); for ($i = 0; $i < count($enrollmentFollowupData); $i++) { $enrollmentFollowupData[$i]['comments'] = Comments::where('paymentfollowup_id', '=', $enrollmentFollowupData[$i]['id'])->orderBy('id', 'DESC')->first(); $student_data = Students::find($enrollmentFollowupData[$i]['student_id']); $enrollmentFollowupData[$i]['student_name'] = $student_data['student_name']; $paymentDueData = PaymentDues::find($enrollmentFollowupData[$i]['payment_due_id']); $enrollmentFollowupData[$i]['payment_date'] = $paymentDueData['end_order_date']; } // for customer kids enrollment. $customer_student_data = Students::where('customer_id', '=', $id)->where('franchisee_id', '=', Session::get('franchiseId'))->select('id', 'student_name')->get(); for ($i = 0; $i < count($customer_student_data); $i++) { $student_classes = StudentClasses::getEnrolledStudentBatch($customer_student_data[$i]['id']); //return $student_classes[0]['batch_id']; $customer_student_data[$i]['student_classes_data'] = $student_classes; } //return $customer_student_data; for ($i = 0; $i < count($customer_student_data); $i++) { for ($j = 0; $j < count($customer_student_data[$i]['student_classes_data']); $j++) { $find = Batches::find($customer_student_data[$i]['student_classes_data'][$j]['batch_id']); $customer_student_data[$i]['student_classes_data'][$j]['batch_name'] = $find->batch_name; } } //return the customer membership follolwup $customer_membership_data = MembershipFollowup::where('customer_id', '=', $id)->get(); for ($i = 0; $i < count($customer_membership_data); $i++) { $membershipid[$i] = $customer_membership_data[$i]['id']; } if (isset($membershipid)) { for ($i = 0; $i < count($membershipid); $i++) { $membership_followup_data[$i] = Comments::where('membership_followup_id', '=', $membershipid[$i])->orderBy('id', 'DESC')->first(); $memfollowup_data = MembershipFollowup::find($membershipid[$i]); $Customer_membership_data = CustomerMembership::find($memfollowup_data->membership_id); $membership_followup_data[$i]['membership_end_date'] = $Customer_membership_data->membership_end_date; } } $viewData = array('birthdaypaiddata', 'birthdayDuedata', 'customer', 'students', 'currentPage', 'mainMenu', 'comments', 'provinces', 'customerMembership', 'kidsSelect', 'membershipTypes', 'membershipTypesAll', 'birthdays', 'iv_data', 'birthday_data', 'complaint_data', 'retention_data', 'inuiry_data', 'enrollmentFollowupData', 'customer_student_data', 'membership_followup_data'); return View::make('pages.customers.details', compact($viewData)); } else { return Redirect::to("/"); } }
Route::any('getCities', function () { $inputs = Input::all(); $id = $inputs['id']; $countryCode = $inputs['countryCode']; $cities = Cities::getCities($id, $countryCode); return Response::json($cities); }); Route::get('logout', "VaultController@logout"); }); Route::get('/test', function () { $base_price_no = Batches::find(130)->classes()->select('base_price_no')->get(); $base_price_no = $base_price_no[0]['base_price_no']; echo $base_price_no; die; var_dump(ClassBasePrice::where('base_price_no', '=', Batches::find(130)->classes()->base_price_no)->select('base_price')->get()); $classes_count = StudentClasses::where('student_id', '=', 88)->where('status', '=', 'enrolled')->distinct('class_id')->count(); var_dump($classes_count); exit; echo PaymentMaster::max('payment_no'); exit; echo Batches::where('id', '=', '2')->select('class_amount')->get(); exit; $data = IntroVisit::join('students', 'student_id', '=', 'students.id')->where('introvisit.customer_id', '=', '44')->get(); var_dump($data); exit; // for($i=0;$i<count($birthday_data);$i++){ // $customer_data= Customers::where('id','=',$birthday_data[$i]['customer_id'])->get(); // $birthday_data[$i]['customer_name']= $customer_data[0]['customer_name']; // $birthday_data[$i]['membership']= CustomerMembership::where('customer_id','=',$birthday_data[$i]['customer_id'])->count(); // // }
public function attendance($id) { if (Auth::check()) { $currentPage = "BATCHES"; $mainMenu = "COURSES_MAIN"; $studentsInBatch = StudentClasses::with('Students')->where('batch_id', '=', $id)->count(); $batch = Batches::where('id', '=', $id)->first(); $attendanceArray = BatchSchedule::getAttendanceTable($id); $lead = Batches::with('LeadInstructors')->find($id); $alternate = Batches::with('AlternateInstructors')->find($id); if (isset($lead->LeadInstructors)) { $leadInstructor = $lead->LeadInstructors->first_name . ' ' . $lead->LeadInstructors->last_name; } else { $leadInstructor = ""; } if (isset($alternate->AlternateInstructors)) { $alternateInstructor = $alternate->AlternateInstructors->first_name . ' ' . $alternate->AlternateInstructors->last_name; } else { $alternateInstructor = ""; } $dataToView = array('currentPage', 'mainMenu', 'attendanceArray', 'batch', 'studentsInBatch', 'leadInstructor', 'alternateInstructor'); return View::make('pages.batches.attendance', compact($dataToView)); } else { return Redirect::to("/"); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Auth::check()) { $currentPage = ""; $mainMenu = "DASHBOARD"; //customers or Inquiries $todaysCustomerReg = Customers::getCustomertodaysRegCount(); $customerCount = Customers::getCustomerCount(); //Members or Family Members $todaysMemberReg = CustomerMembership::getMembertodaysRegCount(); $membersCount = CustomerMembership::getMemberCount(); //Non Members or prospects $todaysNonmemberReg = CustomerMembership::getNonMembertodaysRegCount(); $NonmembersCount = CustomerMembership::getNonMemberCount(); //Enrolled customers(kids) $todaysEnrolledCustomers = StudentClasses::getTodaysEnrolledCustomers(); $enrolledCustomers = StudentClasses::getEnrolledCustomers(); //for followups $reminderCount = Comments::getReminderCountByFranchiseeId(); //Introvisit $totalIntrovisitCount = IntroVisit::getIntrovistCount(); $introVisitCount = IntroVisit::getIntrovisitBytoday(); $allIntrovisits = IntroVisit::getAllActiveIntrovisit(); for ($i = 0; $i < count($allIntrovisits); $i++) { $data = Comments::where('introvisit_id', '=', $allIntrovisits[$i]['id'])->orderBy('id', 'DESC')->first(); if (isset($data)) { $allIntrovisits[$i]['followup_status'] = $data['followup_status']; } } //for courses $totalParentchildCourse = Classes::getallParentchildCourseCount(); $totalPrekgKindergarten = Classes::getallPrekgKindergartenCount(); $totalGradeschool = Classes::getallGradeschoolCount(); $totalCourses = $totalParentchildCourse + $totalPrekgKindergarten + $totalGradeschool; //for birthdayparty $totalbpartyCount = BirthdayParties::getBpartyCount(); $todaysbpartycount = BirthdayParties::getBpartyCountBytoday(); $todaysFollowup = Comments::getAllFollowup(); $todaysIntrovisit = BatchSchedule::getTodaysIntroVisits(); $activeRemindersCount = Comments::getAllFollowupActive(); //get birthday dates $startdate = new carbon(); $startdate->startOfYear(); $endofyear = new carbon(); $endofyear = $endofyear->endOfYear(); $student_id = array(); $birthday_celebration_data = BirthdayParties::where('created_at', '>=', $startdate->toDateString())->where('created_at', '<=', $endofyear->toDateString())->select('student_id')->get(); //var_dump($birthday_celebration_data); die(); for ($i = 0; $i < count($birthday_celebration_data); $i++) { $student_id[$i] = $birthday_celebration_data[$i]['student_id']; } $dat = new carbon(); $month = $dat->month; $presentdate = $dat->day; // for rest of the days of month $birthday_data = Students::whereNotIn('id', $student_id)->where('student_date_of_birth', '<>', '')->where(DB::raw('MONTH(student_date_of_birth)'), '=', $month)->where(DB::raw('DATE(student_date_of_birth)'), '>', $presentdate)->where('franchisee_id', '=', Session::get('franchiseId'))->orderBy(DB::raw('DAY(student_date_of_birth)'))->get(); // echo $month; die(); for ($i = 0; $i < count($birthday_data); $i++) { $customer_data = Customers::where('id', '=', $birthday_data[$i]['customer_id'])->get(); $birthday_data[$i]['customer_name'] = $customer_data[0]['customer_name']; $birthday_data[$i]['mobile_no'] = $customer_data[0]['mobile_no']; $birthday_data[$i]['membership'] = CustomerMembership::where('customer_id', '=', $birthday_data[$i]['customer_id'])->count(); } $m = $month; $m++; while ($m <= 12) { $birthday_data_month[] = Students::whereNotIn('id', $student_id)->where('student_date_of_birth', '<>', '')->where(DB::raw('MONTH(student_date_of_birth)'), '=', $m)->where('franchisee_id', '=', Session::get('franchiseId'))->orderBy(DB::raw('DAY(student_date_of_birth)'))->get(); $m++; } // for starting months $m = 1; while ($m < $month) { $birthday_data_month[] = Students::whereNotIn('id', $student_id)->where('student_date_of_birth', '<>', '')->where(DB::raw('MONTH(student_date_of_birth)'), '=', $m)->where('franchisee_id', '=', Session::get('franchiseId'))->orderBy(DB::raw('DAY(student_date_of_birth)'))->get(); $m++; } for ($i = 0; $i < count($birthday_data_month); $i++) { for ($j = 0; $j < count($birthday_data_month[$i]); $j++) { $customer_data = Customers::where('id', '=', $birthday_data_month[$i][$j]['customer_id'])->get(); $birthday_data_month[$i][$j]['customer_name'] = $customer_data[0]['customer_name']; $birthday_data_month[$i][$j]['mobile_no'] = $customer_data[0]['mobile_no']; $birthday_data_month[$i][$j]['membership'] = CustomerMembership::where('customer_id', '=', $birthday_data_month[$i][$j]['customer_id'])->count(); } } // var_dump($birthday_data_month);exit(); //for starting days of present month $birthday_month_startdays = Students::whereNotIn('id', $student_id)->where('student_date_of_birth', '<>', '')->where(DB::raw('MONTH(student_date_of_birth)'), '=', $month)->where(DB::raw('DATE(student_date_of_birth)'), '<', $presentdate)->where('franchisee_id', '=', Session::get('franchiseId'))->orderBy(DB::raw('DAY(student_date_of_birth)'))->get(); for ($i = 0; $i < count($birthday_month_startdays); $i++) { $customer_data = Customers::where('id', '=', $birthday_month_startdays[$i]['customer_id'])->get(); $birthday_month_startdays[$i]['customer_name'] = $customer_data[0]['customer_name']; $birthday_month_startdays[$i]['mobile_no'] = $customer_data[0]['mobile_no']; $birthday_month_startdays[$i]['membership'] = CustomerMembership::where('customer_id', '=', $birthday_month_startdays[$i]['customer_id'])->count(); } //for birthday celebration this week $presentdate = new carbon(); $weeekdate = new carbon(); $weeekdate->addDays(7); $birthdayPresentWeek = BirthdayParties::where('birthday_party_date', '>=', $presentdate->toDateString())->where('birthday_party_date', '<=', $weeekdate->toDateString())->get(); for ($i = 0; $i < count($birthdayPresentWeek); $i++) { $customer_data = Customers::where('id', '=', $birthdayPresentWeek[$i]['customer_id'])->get(); $birthdayPresentWeek[$i]['customer_name'] = $customer_data[0]['customer_name']; $birthdayPresentWeek[$i]['mobile_no'] = $customer_data[0]['mobile_no']; $birthdayPresentWeek[$i]['franchisee_id'] = $customer_data[0]['franchisee_id']; $student_data = Students::where('id', '=', $birthdayPresentWeek[$i]['student_id'])->get(); $birthdayPresentWeek[$i]['student_name'] = $student_data[0]['student_name']; } $f_id = Session::get('franchiseId'); $viewData = array('currentPage', 'mainMenu', 'f_id', 'birthday_data', 'birthday_data_month', 'birthday_month_startdays', 'birthdayPresentWeek', 'todaysMemberReg', 'membersCount', 'todaysNonmemberReg', 'NonmembersCount', 'customerCount', "reminderCount", 'totalbpartyCount', 'todaysbpartycount', 'totalParentchildCourse', 'totalPrekgKindergarten', 'totalGradeschool', 'totalCourses', 'todaysCustomerReg', 'todaysEnrolledCustomers', 'enrolledCustomers', 'totalIntrovisitCount', 'introVisitCount', 'allIntrovisits', 'todaysFollowup', 'todaysIntrovisit', 'activeRemindersCount'); return View::make('pages.dashboard.upcoming', compact($viewData)); } else { return Redirect::to("/"); } }