Пример #1
0
 public function showParent()
 {
     $data = array();
     $loginid = Session::get('user')->id;
     $collegeid = Session::get('user')->collegeid;
     $flag = Session::get('user')->flag;
     $tb = "";
     if ($flag == 1) {
         $tb = "Admin";
     } else {
         if ($flag == 2) {
             $tb = "Teacher";
         } else {
             if ($flag == 3) {
                 $tb = "Student";
             } else {
                 $tb = "Staff";
             }
         }
     }
     $dt = $tb::where('loginid', '=', $loginid)->first();
     $data['name'] = $dt->name;
     $data['pic'] = $dt->profilepic;
     $data['id'] = $loginid;
     $colid = Session::get('user')->collegeid;
     //$colid = "bt123";
     $classes = Classes::where('collegeid', '=', $colid)->get();
     $data['class'] = [];
     $i = 0;
     for ($i = 0; $i < sizeof($classes); $i++) {
         $data['class'][$i]['id'] = $classes[$i]->id;
         $data['class'][$i]['name'] = $classes[$i]->classname;
     }
     return View::make('pages.parent', array('data' => $data, 'flag' => $flag));
 }
 /**
  * Api for getting Classes by Stream Id
  */
 public function postGetClassesFromStreamId()
 {
     $stream_id = Input::get('stream_id');
     $school_id = Sentry::getUser()->school_id;
     $classes = Classes::where('streams_id', '=', $stream_id)->where('school_id', '=', $school_id)->get();
     $response = array('status' => 'success', 'result' => array('classes' => $classes));
     return Response::json($response);
 }
Пример #3
0
 public static function syncClasses()
 {
     $teacher = Teacher::find(self::$lastTeacherId);
     try {
         $classes = Classes::where('teacher_id', '=', $teacher->teacher_id)->update(array('teacher_id' => 0));
         if ($teacher->classes_id > 0) {
             $classes = Classes::find($teacher->classes_id)->update(array('teacher_id' => $teacher->teacher_id));
         }
     } catch (Exception $e) {
     }
 }
Пример #4
0
 public function getclass()
 {
     return \Classes::where('collegeid', '=', Auth::user()->collegeid)->lists('classname', 'id');
 }
Пример #5
0
 /** 
  * Function that updates a module
  */
 protected function updateElective($id, $d, $expected)
 {
     $data = '';
     foreach ($d as $key => $value) {
         $data = $data . $key . '=' . $value . '&';
     }
     $response = $this->call('POST', '/elective-change', ['elecData' => $data]);
     $json = json_decode($response->getContent());
     if ($expected) {
         $this->assertEquals(true, $json->success);
         // Get the module we just updated.
         $c = Classes::where('classid', $id)->first();
         // Now return the class.
         return $c;
     } else {
         $this->assertEquals(true, $json->fail);
     }
 }
				<!-- End of Filtering system -->
			</section>
			<!-- /portfolio -->
			<?php 
// Let's define what semester we are in.
$today = date('Y-m-d');
$semester = date('Y-m-d', strtotime(date('Y', strtotime($today)) . '-06-01'));
// If current date is greater than semester 2
// Change current to semester 1.
if ($today > $semester) {
    // Get next year.
    $year = date('Y', strtotime(date("Y-m-d", time()) . " + 365 day"));
    $semester = date('Y-m-d', strtotime($year . '-01-01'));
}
// Get the number of classes so we can display it.
$classes = Classes::where('classlecturer', Auth::user()->id)->get();
$total = 0;
foreach ($classes as $c) {
    // Check if this class belongs to this year.
    if (date('Y', strtotime($c->created)) === date('Y', strtotime($today))) {
        // Now check that it is part of this semester.
        if (date('Y-m-d', strtotime($c->created)) < $semester) {
            $total++;
        }
    }
}
?>
			<section class="section">
				<div class="container">
					<h1 class="h1">Profile</h1>						
					<div class="row">
 /**
  *	Function that deletes a specific lecturer.
  */
 public function removeLecturer()
 {
     // Load the lecturer to delete.
     $lecturer = User::find(Input::get('id'));
     // Verify that there are no classes under lecturer.
     $classes = Classes::where('classlecturer', Input::get('id'))->get();
     if (count($classes) > 0) {
         // Inform user that lecturer still has classes assigned.
         return Response::json(array('success' => false, 'errors' => 'Lecturer still has classes assigned!'));
     }
     // Delete lecturer.
     $lecturer->delete();
     // Return successful response to user.
     return Response::json(array('success' => true));
 }
Пример #8
0
 public function printOrder($orderid)
 {
     $id = Crypt::decrypt($orderid);
     $orders = Orders::with('Customers', 'Students', 'StudentClasses')->where('id', '=', $id)->get();
     $orders = $orders['0'];
     $paymentDues = PaymentDues::where('id', '=', $orders->payment_dues_id)->get();
     $batchDetails = Batches::where('id', '=', $orders->StudentClasses->batch_id)->get();
     $class = Classes::where('id', '=', $orders->StudentClasses->class_id)->where('franchisee_id', '=', Session::get('franchiseId'))->first();
     $customerMembership = CustomerMembership::getCustomerMembership($orders->customer_id);
     /* 	echo "<pre>";
     	 print_r($paymentDues);
     	exit(); */
     $data = compact('orders', 'class', 'paymentDues', 'batchDetails', 'customerMembership');
     //$data = compact('orders','class');
     return View::make('pages.orders.printorder', $data);
 }
Пример #9
0
 public function enrollKid()
 {
     $inputs = Input::all();
     $batch_data = Batches::find($inputs['batchCbx']);
     $eachClassCost = $batch_data->class_amount;
     //return Response::json(array('status'=>$inputs));
     //$inputs['discountPercentage']=$inputs['discountP'];
     $studentClasses['classId'] = $inputs['eligibleClassesCbx'];
     $studentClasses['batchId'] = $inputs['batchCbx'];
     $studentClasses['studentId'] = $inputs['studentId'];
     $season_data = Seasons::find($inputs['SeasonsCbx']);
     //$inputs['enrollmentEndDate']=$season_data->end_date;
     //$studentClasses['enrollment_start_date'] = date('Y-m-d', strtotime($inputs['enrollmentStartDate']));
     //return Response::json(array('status'=>'working'));
     //$studentClasses['enrollment_end_date']   = date('Y-m-d', strtotime($inputs['enrollmentEndDate']));
     $studentClasses['selected_sessions'] = $inputs['selectedSessions'];
     $studentClasses['seasonId'] = $inputs['SeasonsCbx'];
     //for proper enrollment start date and end date
     $end = Carbon::now();
     $start = Carbon::now();
     $start->year = date('Y', strtotime($inputs['enrollmentStartDate']));
     $start->month = date('m', strtotime($inputs['enrollmentStartDate']));
     $start->day = date('d', strtotime($inputs['enrollmentStartDate']));
     $end->year = date('Y', strtotime($inputs['enrollmentEndDate']));
     $end->month = date('m', strtotime($inputs['enrollmentEndDate']));
     $end->day = date('d', strtotime($inputs['enrollmentEndDate']));
     $batch_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $start->toDateString())->where('schedule_date', '<=', $end->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
     $studentClasses['enrollment_start_date'] = $batch_data[0]['schedule_date'];
     $studentClasses['enrollment_end_date'] = $batch_data[count($batch_data) - 1]['schedule_date'];
     //Batch Start date
     $BatchDetails = Batches::where('id', '=', $inputs['batchCbx'])->first();
     $reminderStartDate = $BatchDetails->start_date;
     $enrollment = StudentClasses::addStudentClass($studentClasses);
     $paymentDuesInput['student_id'] = $inputs['studentId'];
     $paymentDuesInput['customer_id'] = $inputs['customerId'];
     $paymentDuesInput['batch_id'] = $inputs['batchCbx'];
     $paymentDuesInput['class_id'] = $inputs['eligibleClassesCbx'];
     $paymentDuesInput['selected_sessions'] = $inputs['selectedSessions'];
     $paymentDuesInput['seasonId'] = $inputs['SeasonsCbx'];
     $paymentDuesInput['each_class_cost'] = $eachClassCost;
     $order['customer_id'] = $inputs['customerId'];
     $order['student_id'] = $inputs['studentId'];
     $order['seasonId'] = $inputs['SeasonsCbx'];
     $order['student_classes_id'] = $enrollment->id;
     $order['payment_mode'] = $inputs['paymentTypeRadio'];
     $order['payment_for'] = "enrollment";
     $order['card_last_digit'] = $inputs['card4digits'];
     $order['card_type'] = $inputs['cardType'];
     $order['bank_name'] = $inputs['bankName'];
     $order['cheque_number'] = $inputs['chequeNumber'];
     //$order['each_class_cost']   =$eachClassCost;
     if (isset($inputs['membershipType'])) {
         $order['membershipType'] = $inputs['membershipType'];
     }
     $paydue_id;
     if ($inputs['paymentOptionsRadio'] == 'singlepay') {
         // for starting and end date of enrollment
         $enddate = Carbon::now();
         $startdate = Carbon::now();
         $startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
         $startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
         $startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
         $enddate->year = date('Y', strtotime($inputs['enrollmentEndDate']));
         $enddate->month = date('m', strtotime($inputs['enrollmentEndDate']));
         $enddate->day = date('d', strtotime($inputs['enrollmentEndDate']));
         $batch_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('schedule_date', '<=', $enddate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
         $paymentDuesInput['start_order_date'] = $batch_data[0]['schedule_date'];
         $paymentDuesInput['end_order_date'] = $batch_data[count($batch_data) - 1]['schedule_date'];
         $paymentDuesInput['payment_due_amount'] = $inputs['singlePayAmount'];
         $paymentDuesInput['payment_type'] = $inputs['paymentOptionsRadio'];
         $paymentDuesInput['payment_status'] = "paid";
         $paymentDuesInput['discount_applied'] = $inputs['discountPercentage'];
         $paymentDuesInput['student_class_id'] = $enrollment->id;
         $paymentDuesInput['selected_order_sessions'] = $inputs['selectedSessions'];
         //$paymentDuesInput['start_order_date']=$studentClasses['enrollment_start_date'];
         //$paymentDuesInput['end_order_date']=$studentClasses['enrollment_end_date'];
         $paymentDuesInput['discount_amount'] = $inputs['discountPercentage'] / 100 * $inputs['singlePayAmount'];
         $order['amount'] = $inputs['singlePayAmount'];
         if ($inputs['CustomerType'] == 'OldCustomer') {
             $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate']));
             $order['created_at'] = $paymentDuesInput['created_at'];
         }
         $paymentDuesResult = PaymentDues::createPaymentDues($paymentDuesInput);
         $order['payment_dues_id'] = $paymentDuesResult->id;
         $order['order_status'] = "completed";
         if ($inputs['selectedSessions'] > 8) {
             // creating followup for the single pay
             $presentDate = Carbon::now();
             $startdate = Carbon::now();
             $startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
             $startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
             $startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
             $batch_schedule_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
             $session_number = (int) ($inputs['selectedSessions'] / 2);
             $reminder_date = $batch_schedule_data[$session_number]['schedule_date'];
             $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
             $customer_log_data['student_id'] = $paymentDuesResult->student_id;
             $customer_log_data['franchisee_id'] = Session::get('franchiseId');
             $customer_log_data['followup_type'] = 'PAYMENT';
             $customer_log_data['followup_status'] = 'REMINDER_CALL';
             $customer_log_data['comment_type'] = 'VERYINTERESTED';
             $customer_log_data['reminderDate'] = $reminder_date;
             $remindDate = Carbon::now();
             $remindDate = $remindDate->createFromFormat('Y-m-d', $reminder_date);
             if ($remindDate->gt($presentDate)) {
                 $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                 $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                 Comments::addSinglePayComment($customer_log_data);
             }
         }
     } else {
         if ($inputs['paymentOptionsRadio'] == 'multipay') {
             $today = Carbon::now();
             $paymentDuesInput['payment_type'] = $inputs['paymentOptionsRadio'];
             for ($i = 1; $i <= 4; $i++) {
                 if (isset($inputs['multipayAmount' . $i])) {
                     $firstBrushupCallReminderDate;
                     $firstInitialPaymentCallReminderDate;
                     $firstFinalPaymentCallReminderDate;
                     if ($i == 1) {
                         $paymentDuesInput['payment_status'] = "paid";
                         $order['amount'] = $inputs['multipayAmount' . $i];
                         $enddate = Carbon::now();
                         $startdate = Carbon::now();
                         $startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
                         $startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
                         $startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
                         $enddate->year = date('Y', strtotime($inputs['enrollmentEndDate']));
                         $enddate->month = date('m', strtotime($inputs['enrollmentEndDate']));
                         $enddate->day = date('d', strtotime($inputs['enrollmentEndDate']));
                         $batch_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('schedule_date', '<=', $enddate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
                         $paymentDuesInput['start_order_date'] = $batch_data[0]['schedule_date'];
                         $endorderdate = $batch_data[count($batch_data) - 1]['schedule_date'];
                         //$paymentDuesInput['start_order_date']=$studentClasses['enrollment_start_date'];
                         //$startdate=  Carbon::create(date('Y,m,d,0', strtotime($inputs['enrollmentStartDate'])));
                         $startdate = Carbon::now();
                         $startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
                         $startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
                         $startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
                         $session_no = $inputs['multipayAmount' . $i] / $eachClassCost;
                         $firstSessionNumber = $session_no;
                         $batch_schedule_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
                         $session_no = $session_no - 1;
                         //$startdate=$startdate->addWeeks(($inputs['bipayAmount'.$i]/500));
                         //$startdate=$startdate->addWeeks(($inputs['multipayAmount'.$i]/500));
                         $paymentDuesInput['end_order_date'] = $batch_schedule_data[$session_no]['schedule_date'];
                         if ($firstSessionNumber >= 6) {
                             $firstBrushupCallReminderDate = $batch_schedule_data[$session_no - 2]['schedule_date'];
                             $firstInitialPaymentCallReminderDate = $batch_schedule_data[$session_no - 1]['schedule_date'];
                             $firstFinalPaymentCallReminderDate = $batch_schedule_data[$session_no]['schedule_date'];
                         } else {
                             $firstFinalPaymentCallReminderDate = $batch_schedule_data[$session_no]['schedule_date'];
                         }
                         $nextstartdate = $batch_schedule_data[$session_no]['schedule_date'];
                         //$paymentDuesInput['end_order_date']=$startdate->toDateString();
                         $paymentDuesInput['discount_amount'] = $inputs['discountPercentage'] / 100 * $inputs['multipayAmount' . $i];
                         if ($inputs['CustomerType'] == 'OldCustomer') {
                             $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate']));
                             $order['created_at'] = $paymentDuesInput['created_at'];
                         }
                     } else {
                         $paymentDuesInput['start_order_date'] = $nextstartdate;
                         $batch_schedule_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
                         $session_no = $session_no + $inputs['multipayAmount' . $i] / $eachClassCost;
                         $firstBrushupCallReminderDate = $batch_schedule_data[$session_no - 2]['schedule_date'];
                         $firstInitialPaymentCallReminderDate = $batch_schedule_data[$session_no - 1]['schedule_date'];
                         $firstFinalPaymentCallReminderDate = $batch_schedule_data[$session_no]['schedule_date'];
                         //$startdate=$startdate->addWeeks(($inputs['multipayAmount'.$i]/500));
                         $paymentDuesInput['end_order_date'] = $batch_schedule_data[$session_no]['schedule_date'];
                         if ($i == 4) {
                             //$paymentDuesInput['end_order_date']=date('Y-m-d', strtotime($inputs['enrollmentEndDate']));
                             $paymentDuesInput['end_order_date'] = $endorderdate;
                         }
                         $nextstartdate = $batch_schedule_data[$session_no]['schedule_date'];
                         //$paymentDuesInput['end_order_date']=   $startdate->toDateString();
                         $paymentDuesInput['payment_status'] = "pending";
                         $paymentDuesInput['discount_amount'] = $inputs['discountPercentage'] / 100 * $inputs['multipayAmount' . $i];
                         if ($i == 2 && $inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate2'] != '') {
                             $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate2']));
                             $paymentDuesInput['payment_status'] = "paid";
                         }
                         if ($i == 3 && $inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate3'] != '') {
                             $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate3']));
                             $paymentDuesInput['payment_status'] = "paid";
                         }
                         if ($i == 4 && $inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate4'] != '') {
                             $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate4']));
                             $paymentDuesInput['payment_status'] = "paid";
                         }
                     }
                     $paymentDuesInput['payment_due_amount'] = $inputs['multipayAmount' . $i];
                     $paymentDuesInput['discount_applied'] = $inputs['discountPercentage'];
                     $paymentDuesInput['selected_order_sessions'] = $inputs['multipayAmount' . $i] / $eachClassCost;
                     $paymentDuesInput['student_class_id'] = $enrollment->id;
                     $paymentDuesResult = PaymentDues::createPaymentDues($paymentDuesInput);
                     if ($i >= 1 && $i <= 3) {
                         if ($i == 1) {
                             if ($firstSessionNumber >= 6) {
                                 $firstremind = Carbon::now();
                                 $firstremind = $firstremind->createFromFormat('Y-m-d', $firstBrushupCallReminderDate);
                                 //return Response::json(array('status'=>$firstBrushupCallReminderDate,'today'=>$today));
                                 if ($firstremind->gt($today)) {
                                     //create 3 payment followup
                                     $payment_followup_data1 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $payment_followup_data2 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $payment_followup_data3 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     //creating logs/followup for first payment
                                     $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                     $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                     $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                     $customer_log_data['paymentfollowup_id'] = $payment_followup_data1->id;
                                     $customer_log_data['paymentfollowup_id2'] = $payment_followup_data2->id;
                                     $customer_log_data['paymentfollowup_id3'] = $payment_followup_data3->id;
                                     $customer_log_data['followup_type'] = 'PAYMENT';
                                     $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                     $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                     $customer_log_data['firstReminderDate'] = $firstBrushupCallReminderDate;
                                     $customer_log_data['secondReminderDate'] = $firstInitialPaymentCallReminderDate;
                                     $customer_log_data['thirdReminderDate'] = $firstFinalPaymentCallReminderDate;
                                     Comments::addPaymentComments($customer_log_data);
                                 } else {
                                     $final_remind = Carbon::now();
                                     $final_remind = $final_remind->createFromFormat('Y-m-d', $firstFinalPaymentCallReminderDate);
                                     if ($final_remind->gt($today)) {
                                         $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                         $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                         $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                         $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                         $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                                         //$customer_log_data['paymentfollowup_id2']=$payment_followup_data2->id;
                                         //$customer_log_data['paymentfollowup_id3']=$payment_followup_data3->id;
                                         $customer_log_data['followup_type'] = 'PAYMENT';
                                         $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                         $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                         //  $customer_log_data['firstReminderDate']=$firstBrushupCallReminderDate;
                                         //  $customer_log_data['secondReminderDate']=$firstInitialPaymentCallReminderDate;
                                         $customer_log_data['reminderDate'] = $firstFinalPaymentCallReminderDate;
                                         Comments::addOnebiPaymentComment($customer_log_data);
                                     }
                                 }
                             } else {
                                 $final_r = Carbon::now();
                                 $final_r = $final_r->createFromFormat('Y-m-d', $firstFinalPaymentCallReminderDate);
                                 if ($final_r->gt($today)) {
                                     //create 1 followup
                                     $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                     $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                     $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                     $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                                     //$customer_log_data['paymentfollowup_id2']=$payment_followup_data2->id;
                                     //$customer_log_data['paymentfollowup_id3']=$payment_followup_data3->id;
                                     $customer_log_data['followup_type'] = 'PAYMENT';
                                     $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                     $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                     //  $customer_log_data['firstReminderDate']=$firstBrushupCallReminderDate;
                                     //  $customer_log_data['secondReminderDate']=$firstInitialPaymentCallReminderDate;
                                     $customer_log_data['reminderDate'] = $firstFinalPaymentCallReminderDate;
                                     Comments::addOnebiPaymentComment($customer_log_data);
                                 }
                             }
                         } else {
                             //when i>=3
                             $firstre = Carbon::now();
                             $firstre = $firstre->createFromFormat('Y-m-d', $firstBrushupCallReminderDate);
                             if ($firstre->gt($today)) {
                                 $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                 $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                 $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                 $customer_log_data['followup_type'] = 'PAYMENT';
                                 $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                 $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                 $customer_log_data['firstReminderDate'] = $firstBrushupCallReminderDate;
                                 $customer_log_data['secondReminderDate'] = $firstInitialPaymentCallReminderDate;
                                 $customer_log_data['thirdReminderDate'] = $firstFinalPaymentCallReminderDate;
                                 if ($i == 2 && isset($inputs['multipayAmount3'])) {
                                     $payment_followup_data1 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $payment_followup_data2 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $payment_followup_data3 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $customer_log_data['paymentfollowup_id'] = $payment_followup_data1->id;
                                     $customer_log_data['paymentfollowup_id2'] = $payment_followup_data2->id;
                                     $customer_log_data['paymentfollowup_id3'] = $payment_followup_data3->id;
                                     Comments::addPaymentComments($customer_log_data);
                                 } else {
                                     if ($i == 3 && isset($inputs['multipayAmount4'])) {
                                         $payment_followup_data1 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                         $payment_followup_data2 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                         $payment_followup_data3 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                         $customer_log_data['paymentfollowup_id'] = $payment_followup_data1->id;
                                         $customer_log_data['paymentfollowup_id2'] = $payment_followup_data2->id;
                                         $customer_log_data['paymentfollowup_id3'] = $payment_followup_data3->id;
                                         Comments::addPaymentComments($customer_log_data);
                                     } else {
                                         if ($i != 3 && $i != 2) {
                                             $payment_followup_data1 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                             $payment_followup_data2 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                             $payment_followup_data3 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                             $customer_log_data['paymentfollowup_id'] = $payment_followup_data1->id;
                                             $customer_log_data['paymentfollowup_id2'] = $payment_followup_data2->id;
                                             $customer_log_data['paymentfollowup_id3'] = $payment_followup_data3->id;
                                             Comments::addPaymentComments($customer_log_data);
                                         }
                                     }
                                 }
                             } else {
                                 $final = Carbon::now();
                                 $final = $final->createFromFormat('Y-m-d', $firstFinalPaymentCallReminderDate);
                                 if ($final->gt($today)) {
                                     $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                     $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                     $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                     $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                                     //$customer_log_data['paymentfollowup_id2']=$payment_followup_data2->id;
                                     //$customer_log_data['paymentfollowup_id3']=$payment_followup_data3->id;
                                     $customer_log_data['followup_type'] = 'PAYMENT';
                                     $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                     $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                     //  $customer_log_data['firstReminderDate']=$firstBrushupCallReminderDate;
                                     //  $customer_log_data['secondReminderDate']=$firstInitialPaymentCallReminderDate;
                                     $customer_log_data['reminderDate'] = $firstFinalPaymentCallReminderDate;
                                     Comments::addOnebiPaymentComment($customer_log_data);
                                 }
                             }
                         }
                     }
                     $paydue_id[] = $paymentDuesResult->id;
                     if ($i == 1) {
                         $order['payment_dues_id'] = $paymentDuesResult->id;
                         $order['order_status'] = "completed";
                     }
                 }
             }
             /*
             			$weeksDues = array("6", "9", "14", "19", "24", "29", "34");
             			$date = date('Y/m/d', strtotime($reminderStartDate));
             			foreach($weeksDues as $weeksDue){
             					
             				$weeks = $weeksDue;
             				// Create and modify the date.
             				$dateTime = DateTime::createFromFormat('Y/m/d', $date);
             				$dateTime->add(DateInterval::createFromDateString($weeks . ' weeks'));
             				//$dateTime->modify('next monday');
             					
             				// Output the new date.
             				//echo $dateTime->format('Y-m-d')."<br>";
             			
             			
             				$paymentReminderInput['customerId']    = $inputs['customerId'];
             				$paymentReminderInput['studentId']     = $inputs['studentId'];
                                             $paymentReminderInput['seasonId']     = $inputs['SeasonsCbx'];
             				$paymentReminderInput['classId']       = $inputs['eligibleClassesCbx'];
             				$paymentReminderInput['batchId']       = $inputs['batchCbx'];
             				$paymentReminderInput['reminder_date'] = $dateTime->format('Y-m-d');
             			
             				PaymentReminders::addReminderDates($paymentReminderInput);
             			
             			
             					
             			}*/
         } else {
             if ($inputs['paymentOptionsRadio'] == 'bipay') {
                 $followupFirstDate;
                 $followupSecondDate;
                 $followupThirdDate;
                 $paymentDuesInput['payment_type'] = $inputs['paymentOptionsRadio'];
                 for ($i = 1; $i <= 2; $i++) {
                     if (isset($inputs['bipayAmount' . $i])) {
                         if ($i == 1) {
                             //for bipay enrollment classes
                             $paymentDuesInput['payment_status'] = "paid";
                             $order['amount'] = $inputs['bipayAmount' . $i];
                             //$paymentDuesInput['start_order_date']=$studentClasses['enrollment_start_date'];
                             //$startdate=  Carbon::create(date('Y,m,d,0', strtotime($inputs['enrollmentStartDate'])));
                             $startdate = Carbon::now();
                             $enddate = Carbon::now();
                             $startdate->year = date('Y', strtotime($inputs['enrollmentStartDate']));
                             $startdate->month = date('m', strtotime($inputs['enrollmentStartDate']));
                             $startdate->day = date('d', strtotime($inputs['enrollmentStartDate']));
                             $enddate->year = date('Y', strtotime($inputs['enrollmentEndDate']));
                             $enddate->month = date('m', strtotime($inputs['enrollmentEndDate']));
                             $enddate->day = date('d', strtotime($inputs['enrollmentEndDate']));
                             //return Response::json(array('status'=>'success'));
                             $session_no = $inputs['bipayAmount' . $i] / $eachClassCost;
                             $firstsessionno = $session_no;
                             $batch_schedule_data = BatchSchedule::where('batch_id', '=', $inputs['batchCbx'])->where('schedule_date', '>=', $startdate->toDateString())->where('schedule_date', '<=', $enddate->toDateString())->where('holiday', '!=', 1)->orderBy('id')->get();
                             $session_no = $session_no - 1;
                             //$startdate=$startdate->addWeeks(($inputs['bipayAmount'.$i]/500));
                             $paymentDuesInput['start_order_date'] = $batch_schedule_data[0]['schedule_date'];
                             $paymentDuesInput['end_order_date'] = $batch_schedule_data[$session_no]['schedule_date'];
                             $endorderdateforbipay = $batch_schedule_data[count($batch_schedule_data) - 1]['schedule_date'];
                             if ($firstsessionno >= 10) {
                                 $followupFirstDate = $batch_schedule_data[$session_no - 2]['schedule_date'];
                                 $followupSecondDate = $batch_schedule_data[$session_no - 1]['schedule_date'];
                                 $followupThirdDate = $batch_schedule_data[$session_no]['schedule_date'];
                             } else {
                                 $followupdate = $batch_schedule_data[$session_no]['schedule_date'];
                             }
                             $paymentDuesInput['discount_amount'] = $inputs['discountPercentage'] / 100 * $inputs['bipayAmount' . $i];
                             if ($inputs['CustomerType'] == 'OldCustomer') {
                                 $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate']));
                                 $order['created_at'] = $paymentDuesInput['created_at'];
                             }
                         } else {
                             $paymentDuesInput['start_order_date'] = $batch_schedule_data[$session_no]['schedule_date'];
                             //$startdate=$startdate->addWeeks(($inputs['bipayAmount'.$i]/500));
                             //$paymentDuesInput['end_order_date']=   date('Y-m-d', strtotime($inputs['enrollmentEndDate']));
                             $paymentDuesInput['end_order_date'] = $endorderdateforbipay;
                             $paymentDuesInput['payment_status'] = "pending";
                             $paymentDuesInput['discount_amount'] = $inputs['discountPercentage'] / 100 * $inputs['bipayAmount' . $i];
                             if ($inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate2'] != '') {
                                 $paymentDuesInput['created_at'] = date('Y-m-d H:i:s', strtotime($inputs['OrderDate2']));
                                 // $order['created_at']=$paymentDuesInput['created_at'];
                             }
                         }
                         $paymentDuesInput['selected_order_sessions'] = $inputs['bipayAmount' . $i] / $eachClassCost;
                         $paymentDuesInput['payment_due_amount'] = $inputs['bipayAmount' . $i];
                         $paymentDuesInput['discount_applied'] = $inputs['discountPercentage'];
                         $paymentDuesInput['student_class_id'] = $enrollment->id;
                         $paymentDuesResult = PaymentDues::createPaymentDues($paymentDuesInput);
                         if ($i == 1) {
                             $order['payment_dues_id'] = $paymentDuesResult->id;
                             $order['order_status'] = "completed";
                             $paydueid1 = $paymentDuesResult->id;
                         }
                         if ($i == 2) {
                             if ($firstsessionno >= 10) {
                                 // creating customer followup
                                 $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                 $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                 $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                 $paydue_id2 = $paymentDuesResult->id;
                                 $paymentDuesResult->id = $paydueid1;
                                 $customer_log_data['followup_type'] = 'PAYMENT';
                                 $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                 $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                 $customer_log_data['firstReminderDate'] = $followupFirstDate;
                                 $customer_log_data['secondReminderDate'] = $followupSecondDate;
                                 $customer_log_data['thirdReminderDate'] = $followupThirdDate;
                                 $brushupremind = Carbon::now();
                                 $finalremind = Carbon::now();
                                 $brushupremind = $brushupremind->createFromFormat('Y-m-d', $followupFirstDate);
                                 $finalremind = $finalremind->createFromFormat('Y-m-d', $followupThirdDate);
                                 $today = Carbon::now();
                                 if ($brushupremind->gt($today)) {
                                     $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $payment_followup_data2 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $payment_followup_data3 = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                                     $customer_log_data['paymentfollowup_id2'] = $payment_followup_data2->id;
                                     $customer_log_data['paymentfollowup_id3'] = $payment_followup_data3->id;
                                     Comments::addPaymentComments($customer_log_data);
                                 } else {
                                     if ($finalremind->gt($today)) {
                                         //create single followup
                                         $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                         $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                         $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                         $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                         $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                                         $customer_log_data['followup_type'] = 'PAYMENT';
                                         $customer_log_data['reminderDate'] = $followupThirdDate;
                                         $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                         $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                         Comments::addOnebiPaymentComment($customer_log_data);
                                     }
                                 }
                             } else {
                                 $today = Carbon::now();
                                 $reminddate = Carbon::now();
                                 $reminddate = $reminddate->createFromFormat('Y-m-d', $followupdate);
                                 if ($reminddate->gt($today)) {
                                     $paymentDuesResult->id = $paydueid1;
                                     $payment_followup_data = PaymentFollowups::createPaymentFollowup($paymentDuesResult);
                                     $customer_log_data['customer_id'] = $paymentDuesResult->customer_id;
                                     $customer_log_data['student_id'] = $paymentDuesResult->student_id;
                                     $customer_log_data['franchisee_id'] = Session::get('franchiseId');
                                     $customer_log_data['paymentfollowup_id'] = $payment_followup_data->id;
                                     $customer_log_data['followup_type'] = 'PAYMENT';
                                     $customer_log_data['reminderDate'] = $followupdate;
                                     $customer_log_data['followup_status'] = 'REMINDER_CALL';
                                     $customer_log_data['comment_type'] = 'VERYINTERESTED';
                                     Comments::addOnebiPaymentComment($customer_log_data);
                                 }
                             }
                         }
                     }
                 }
                 // to create payment reminders
                 /*
                 			$weeksDues = array("6", "12", "19", "24", "34");
                 			$date = date('Y/m/d', strtotime($reminderStartDate));
                 			foreach($weeksDues as $weeksDue){
                 					
                 				$weeks = $weeksDue;
                 				// Create and modify the date.
                 				$dateTime = DateTime::createFromFormat('Y/m/d', $date);
                 				$dateTime->add(DateInterval::createFromDateString($weeks . ' weeks'));
                 				//$dateTime->modify('next monday');
                 					
                 				// Output the new date.
                 				//echo $dateTime->format('Y-m-d')."<br>";
                 					
                 					
                 				$paymentReminderInput['customerId']    = $inputs['customerId'];
                 				$paymentReminderInput['studentId']     = $inputs['studentId'];
                        $paymentDuesInput['seasonId']             =$inputs['SeasonsCbx'];
                 				$paymentReminderInput['classId']       = $inputs['eligibleClassesCbx'];
                 				$paymentReminderInput['batchId']       = $inputs['batchCbx'];
                        $paymentReminderInput['seasonId']       =$inputs['SeasonsCbx'];
                        $paymentDuesInput['seasonId']          = $inputs['SeasonsCbx'];
                 				$paymentReminderInput['reminder_date'] = $dateTime->format('Y-m-d');
                 					
                 				PaymentReminders::addReminderDates($paymentReminderInput);
                 					
                 					
                 					
                 			}
                 * 
                 */
                 //payment reminders for followups.
                 if ($i == 1) {
                     $order['payment_mode'] = $inputs['paymentTypeRadio'];
                     $order['card_last_digit'] = $inputs['card4digits'];
                     $order['cardType'] = $inputs['card_type'];
                     $order['bank_name'] = $inputs['cardBankName'];
                     $order['receipt_number'] = $inputs['cardRecieptNumber'];
                 }
             }
         }
     }
     $orderCreated = Orders::createOrder($order);
     if ($inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate2'] != '' && $inputs['paymentOptionsRadio'] == 'bipay') {
         $payment_due = new PaymentDues();
         $payment_due = PaymentDues::find($paydue_id2);
         $payment_due->payment_status = 'paid';
         $payment_due->save();
         $order['created_at'] = $paymentDuesInput['created_at'];
         $order['amount'] = $paymentDuesResult->payment_due_amount - $paymentDuesResult->discount_amount;
         $order['payment_dues_id'] = $paydue_id2;
         if ($inputs['paymentTypeRadioOldCustomer2'] == 'cash') {
             $order['payment_mode'] = 'cash';
             $orderCreated = Orders::createOrder($order);
         } elseif ($inputs['paymentTypeRadioOldCustomer2'] == 'cheque') {
             $order['payment_mode'] = 'cheque';
             $order['bank_name'] = $inputs['bankName2'];
             $order['cheque_number'] = $inputs['chequeNumber2'];
             $orderCreated = Orders::createOrder($order);
         } elseif ($inputs['paymentTypeRadioOldCustomer2'] == 'card') {
             $order['payment_mode'] = 'card';
             $order['card_type'] = $inputs['cardType2'];
             $order['card_last_digit'] = $inputs['card4digits2'];
             $order['bank_name'] = $inputs['cardBankName2'];
             $order['receipt_number'] = $inputs['cardRecieptNumber2'];
             $orderCreated = Orders::createOrder($order);
         }
     }
     if ($inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate2'] != '' && $inputs['paymentOptionsRadio'] == 'multipay') {
         $paydue_data = PaymentDues::where('id', '=', $paydue_id[1])->get();
         $paydue_data = $paydue_data[0];
         $neworder = new Orders();
         $neworder['customer_id'] = $paydue_data['customer_id'];
         $neworder['student_id'] = $paydue_data['student_id'];
         $neworder['season_id'] = $paydue_data['season_id'];
         $neworder['student_classes_id'] = $paydue_data['student_class_id'];
         $neworder['payment_for'] = "enrollment";
         $neworder['payment_dues_id'] = $paydue_id[1];
         $neworder['amount'] = $paydue_data['payment_due_amount'];
         $neworder['order_status'] = "completed";
         if ($inputs['paymentTypeRadioOldCustomer2'] == 'cash') {
             $neworder['payment_mode'] = 'cash';
         } else {
             if ($inputs['paymentTypeRadioOldCustomer2'] == 'cheque') {
                 $neworder['payment_mode'] = 'cheque';
                 $neworder['bank_name'] = $inputs['bankName2'];
                 $neworder['cheque_number'] = $inputs['chequeNumber2'];
             } else {
                 if ($inputs['paymentTypeRadioOldCustomer2'] == 'card') {
                     $neworder['payment_mode'] = 'card';
                     $neworder['card_type'] = $inputs['cardType2'];
                     $neworder['card_last_digit'] = $inputs['card4digits2'];
                     $neworder['bank_name'] = $inputs['cardBankName2'];
                     $neworder['receipt_number'] = $inputs['cardRecieptNumber2'];
                 }
             }
         }
         $neworder['created_at'] = $paydue_data['created_at'];
         $neworder->created_by = Session::get('userId');
         $neworder->save();
     }
     if ($inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate3'] != '' && $inputs['paymentOptionsRadio'] == 'multipay') {
         $paydue_data = PaymentDues::where('id', '=', $paydue_id[2])->get();
         $paydue_data = $paydue_data[0];
         $neworder = new Orders();
         $neworder['customer_id'] = $paydue_data['customer_id'];
         $neworder['student_id'] = $paydue_data['student_id'];
         $neworder['season_id'] = $paydue_data['season_id'];
         $neworder['student_classes_id'] = $paydue_data['student_class_id'];
         $neworder['payment_for'] = "enrollment";
         $neworder['payment_dues_id'] = $paydue_id[2];
         $neworder['amount'] = $paydue_data['payment_due_amount'];
         $neworder['order_status'] = "completed";
         if ($inputs['paymentTypeRadioOldCustomer3'] == 'cash') {
             $neworder['payment_mode'] = 'cash';
         } else {
             if ($inputs['paymentTypeRadioOldCustomer3'] == 'cheque') {
                 $neworder['payment_mode'] = 'cheque';
                 $neworder['bank_name'] = $inputs['bankName3'];
                 $neworder['cheque_number'] = $inputs['chequeNumber3'];
             } else {
                 if ($inputs['paymentTypeRadioOldCustomer3'] == 'card') {
                     $neworder['payment_mode'] = 'card';
                     $neworder['card_type'] = $inputs['cardType3'];
                     $neworder['card_last_digit'] = $inputs['card4digits3'];
                     $neworder['bank_name'] = $inputs['cardBankName3'];
                     $neworder['receipt_number'] = $inputs['cardRecieptNumber3'];
                 }
             }
         }
         $neworder['created_at'] = $paydue_data['created_at'];
         $neworder->created_by = Session::get('userId');
         $neworder->save();
     }
     if ($inputs['CustomerType'] == 'OldCustomer' && $inputs['OrderDate4'] != '' && $inputs['paymentOptionsRadio'] == 'multipay') {
         $paydue_data = PaymentDues::where('id', '=', $paydue_id[3])->get();
         $paydue_data = $paydue_data[0];
         $neworder = new Orders();
         $neworder['customer_id'] = $paydue_data['customer_id'];
         $neworder['student_id'] = $paydue_data['student_id'];
         $neworder['season_id'] = $paydue_data['season_id'];
         $neworder['student_classes_id'] = $paydue_data['student_class_id'];
         $neworder['payment_for'] = "enrollment";
         $neworder['payment_dues_id'] = $paydue_id[3];
         $neworder['amount'] = $paydue_data['payment_due_amount'];
         $neworder['order_status'] = "completed";
         if ($inputs['paymentTypeRadioOldCustomer4'] == 'cash') {
             $neworder['payment_mode'] = 'cash';
         } else {
             if ($inputs['paymentTypeRadioOldCustomer4'] == 'cheque') {
                 $neworder['payment_mode'] = 'cheque';
                 $neworder['bank_name'] = $inputs['bankName4'];
                 $neworder['cheque_number'] = $inputs['chequeNumber4'];
             } else {
                 if ($inputs['paymentTypeRadioOldCustomer4'] == 'card') {
                     $neworder['payment_mode'] = 'card';
                     $neworder['card_type'] = $inputs['cardType4'];
                     $neworder['card_last_digit'] = $inputs['card4digits4'];
                     $neworder['bank_name'] = $inputs['cardBankName4'];
                     $neworder['receipt_number'] = $inputs['cardRecieptNumber4'];
                 }
             }
         }
         $neworder['created_at'] = $paydue_data['created_at'];
         $neworder->created_by = Session::get('userId');
         $neworder->save();
     }
     if (isset($inputs['membershipType'])) {
         $membershipInputs['customer_id'] = $inputs['customerId'];
         $membershipInputs['membership_type_id'] = $inputs['membershipType'];
         CustomerMembership::addMembership($membershipInputs);
     }
     $student = Students::with('Customers', 'StudentClasses')->where('id', '=', $enrollment->student_id)->get();
     $class = Classes::where('id', '=', $enrollment->class_id)->get();
     $CustomerObject = Customers::find($inputs['customerId']);
     $CustomerObject->stage = "ENROLLED";
     $CustomerObject->save();
     $customer = array();
     $customer['customerName'] = $student['0']->Customers->customer_name;
     $customer['customerEmail'] = $student['0']->Customers->customer_email;
     $customer['kidName'] = $student['0']->student_name;
     $customer['className'] = $class['0']->class_name;
     $commentsInput['customerId'] = $inputs['customerId'];
     $commentsInput['commentText'] = Config::get('constants.ENROLLED') . ' for ' . $class['0']->class_name;
     $commentsInput['commentType'] = 'FOLLOW_UP';
     $commentsInput['reminderDate'] = null;
     Comments::addComments($commentsInput);
     if (isset($inputs['emailOption']) && $inputs['emailOption'] == 'yes') {
         $orders = Orders::with('Customers', 'Students', 'StudentClasses')->where('id', '=', $orderCreated->id)->get();
         $orders = $orders['0'];
         $paymentDues = PaymentDues::where('id', '=', $orders->payment_dues_id)->get();
         $batchDetails = Batches::where('id', '=', $orders->StudentClasses->batch_id)->get();
         $class = Classes::where('id', '=', $orders->StudentClasses->class_id)->where('franchisee_id', '=', Session::get('franchiseId'))->first();
         $customerMembership = CustomerMembership::getCustomerMembership($orders->customer_id);
         $class = Classes::where('id', '=', $inputs['eligibleClassesCbx'])->where('franchisee_id', '=', Session::get('franchiseId'))->first();
         $batch = Batches::where('id', '=', $inputs['batchCbx'])->first();
         $orderDetailsTomail['orders'] = $orders;
         $orderDetailsTomail['customers'] = $customer;
         $orderDetailsTomail['paymentDues'] = $paymentDues;
         $orderDetailsTomail['customerMembership'] = $customerMembership;
         $orderDetailsTomail['class'] = $class;
         $orderDetailsTomail['batchDetails'] = $batchDetails;
         $orderDetailsTomail['studentbatch']['start_date'] = date('Y-m-d', strtotime($inputs['enrollmentStartDate']));
         $orderDetailsTomail['studentbatch']['end_date'] = date('Y-m-d', strtotime($inputs['enrollmentEndDate']));
         $orderDetailsTomail['customers']['customerMembership'] = CustomerMembership::getCustomerMembership($orders->customer_id);
         Mail::send('emails.account.enrollment', $orderDetailsTomail, function ($msg) use($orderDetailsTomail) {
             $msg->from(Config::get('constants.EMAIL_ID'), Config::get('constants.EMAIL_NAME'));
             $msg->to($orderDetailsTomail['customers']['customerEmail'], $orderDetailsTomail['customers']['customerName'])->subject('The Little Gym - Kids Enrollment Successful');
         });
     }
     if (isset($inputs['invoicePrintOption']) && $inputs['invoicePrintOption'] == 'yes') {
         $printUrl = url() . '/orders/print/' . Crypt::encrypt($orderCreated->id);
     } else {
         $printUrl = "";
     }
     //header('Access-Control-Allow-Origin: *');
     if ($enrollment) {
         return Response::json(array("status" => "success", "printUrl" => $printUrl));
     } else {
         return Response::json(array("status" => "failed"));
     }
 }
 function printClassList($classId)
 {
     if (Classes::where('classid', $classId)->count()) {
         $class = Classes::where('classid', $classId)->first();
         if ($class->classlecturer != Auth::user()->id) {
             return;
         }
         $filename = Modules::where('mid', $class->classmodule)->first()->mcode . "Elec" . $classId . "List.csv";
         $delimiter = ",";
         header('Content-Type: application/csv');
         header('Content-Disposition: attachement; filename="' . $filename . '";');
         $array = array();
         array_push($array, array('Student ID' => 'Student ID', 'Name' => 'Student Name'));
         foreach (json_decode($class->classstudents) as $student) {
             $studentarray = array('Student Id' => User::find($student)->username, 'Name' => User::find($student)->name);
             array_push($array, $studentarray);
         }
         $f = fopen('php://output', 'w');
         foreach ($array as $line) {
             fputcsv($f, $line, $delimiter);
         }
     }
 }
Пример #11
0
 /**
  * 刪除年級會連帶刪除底下的年級
  */
 public function delete()
 {
     Classes::where('year_id', '=', $this->year_id)->delete();
     return parent::delete();
 }
Пример #12
0
								<?php 
// Let's define what semester we are in.
$today = date('Y-m-d');
$semester = date('Y-m-d', strtotime(date('Y', strtotime($today)) . '-06-01'));
// If current date is greater than semester 2
// Change current to semester 1.
if ($today > $semester) {
    // Get next year.
    $year = date('Y', strtotime(date("Y-m-d", time()) . " + 365 day"));
    $semester = date('Y-m-d', strtotime($year . '-01-01'));
}
// Let's get the total students and total limit of elective.
$totalStudents = 0;
$totalLimit = 0;
// Get all classes of current elective.
$classes = Classes::where('classmodule', $module->mid)->get();
foreach ($classes as $c) {
    // Check if this class belongs to this year.
    if (date('Y', strtotime($c->created)) === date('Y', strtotime($today))) {
        // Now check that it is part of this semester.
        if (date('Y-m-d', strtotime($c->created)) < $semester) {
            $totalStudents += $c->classcurrent;
            $totalLimit += $c->classlimit;
        }
    }
}
// Define total requested.
$totalRequested = count(json_decode($module->mrequests));
?>
									<h3>{{ $module->mshorttitle }}</h3>
									<p>Total Classes: {{ count($classes) }}</p>
 public function postGetClassStreamPair()
 {
     $classes = Classes::where('school_id', '=', $this->getSchoolId())->orderBy('class', 'asc')->get();
     $i = 0;
     $stream_Class_Pairs = array();
     foreach ($classes as $class => $value) {
         $stream = Streams::find($classes[$class]['streams_id']);
         $stream_Class_Pairs[$i] = array('classes_id' => $classes[$class]['id'], 'streams_id' => $classes[$class]['streams_id'], 'stream_class_pair' => $classes[$class]['class'] . " (" . $stream->stream_name . ")");
         $i++;
     }
     $response = array('status' => 'success', 'result' => array('stream_class_pairs' => $stream_Class_Pairs));
     return Response::json($response);
 }
 public function postElectiveChange()
 {
     $inputData = Input::get('elecData');
     parse_str($inputData, $formFields);
     $moduleData = array('classlecturer' => User::where('name', $formFields['classlecturer'])->first()->id, 'classmodule' => $formFields['classmodule'], 'classlimit' => $formFields['classlimit']);
     Validator::extend('ranked', function ($attribute, $value, $parameters) {
         // This is the correct way to do this.
         $coord = User::find($value);
         if ($coord && $coord->rank < 1) {
             return false;
         }
         return true;
     });
     Validator::extend('indep', function ($attribute, $value, $parameters) {
         // This is the correct way to do this.
         $mod = Modules::find($value);
         if ($mod && $mod->departmentid !== Auth::user()->department) {
             return false;
         }
         return true;
     });
     $rules = array('classmodule' => 'required|exists:modules,mid|indep', 'classlecturer' => 'required|exists:users,id|ranked', 'classlimit' => 'required|integer|between:5,30');
     $messages = ['ranked' => "This user can't coordinate this class.", 'indep' => "This module is not in your department."];
     $validator = Validator::make($moduleData, $rules, $messages);
     if ($validator->fails()) {
         return Response::json(array('fail' => true, 'errors' => $validator->getMessageBag()->toArray()));
     } else {
         $elec = Classes::where('classid', $formFields['classid'])->first();
         $elec->classmodule = $moduleData['classmodule'];
         $elec->classlecturer = $moduleData['classlecturer'];
         $elec->classlimit = $moduleData['classlimit'];
         if ($elec->save()) {
             Session::flash('global', 'You have edited a module.');
             //return success  message
             return Response::json(array('success' => true, 'mName' => Modules::find($moduleData['classmodule'])->mshorttitle));
         }
     }
 }
Пример #15
0
 static function getAllClassesForFranchise()
 {
     return Classes::where('franchisee_id', '=', Session::get('franchiseId'))->get();
 }
Пример #16
0
<?php 
// Let's define what semester we are in.
$today = date('Y-m-d');
$semester = date('Y-m-d', strtotime(date('Y', strtotime($today)) . '-06-01'));
// If current date is greater than semester 2
// Change current to semester 1.
if ($today > $semester) {
    // Get next year.
    $year = date('Y', strtotime(date("Y-m-d", time()) . " + 365 day"));
    $semester = date('Y-m-d', strtotime($year . '-01-01'));
}
$class = null;
?>
<select id="class-Select" class="form-control">
	<?php 
foreach (Classes::where('classlecturer', Auth::user()->id)->get() as $c) {
    // Check if this class belongs to this year.
    if (date('Y', strtotime($c->created)) === date('Y', strtotime($today))) {
        // Now check that it is part of this semester.
        if (date('Y-m-d', strtotime($c->created)) < $semester) {
            if (!isset($class)) {
                $class = $c;
            }
            $elective = Modules::where('mid', $c->classmodule)->first();
            ?>
				<option value="{{ $c->classid }}">{{ $elective->mshorttitle }}</option>
			<?php 
        }
    }
}
?>