Пример #1
0
 public function checkmultiPayOrderDate()
 {
     $inputs = Input::all();
     $batch_data = Batches::find($inputs['batchid']);
     $eachClassCost = $batch_data->class_amount;
     $startdate = new carbon();
     $enddate = new carbon();
     $startdate = $startdate->createFromFormat('m/d/Y', $inputs['startdate']);
     $enddate = $enddate->createFromFormat('m/d/Y', $inputs['enddate']);
     if (isset($inputs['multipayAmount1'])) {
         $firstPayWeeksNo = $inputs['multipayAmount1'] / $eachClassCost;
     }
     if (isset($inputs['multipayAmount2'])) {
         $secondPayWeeksNo = $inputs['multipayAmount2'] / $eachClassCost;
     }
     if (isset($inputs['multipayAmount3'])) {
         $thirdPayWeeksNo = $inputs['multipayAmount3'] / $eachClassCost;
     }
     if (isset($inputs['multipayAmount4'])) {
         $fourthPayWeeksNo = $inputs['multipayAmount4'] / $eachClassCost;
     }
     //$totalweekNo=$firstPayWeeksNo+$secondPayWeeksNo+$thirdPayWeeksNo+$fourthPayWeeksNo;
     $batch_data = BatchSchedule::where('batch_id', '=', $inputs['batchid'])->where('franchisee_id', '=', Session::get('franchiseId'))->where('season_id', '=', $inputs['seasonid'])->whereBetween('schedule_date', array($startdate->toDateString(), $enddate->toDateString()))->where('holiday', '!=', 1)->orderBy('id')->get();
     $firstPayWeeksNo = $firstPayWeeksNo - 1;
     if (isset($inputs['multipayAmount2'])) {
         $secondPayWeeksNo = $secondPayWeeksNo + $firstPayWeeksNo;
     }
     if (isset($inputs['multipayAmount3'])) {
         $thirdPayWeeksNo = $secondPayWeeksNo + $thirdPayWeeksNo;
     }
     if (isset($inputs['multipayAmount4'])) {
         $fourthPayWeeksNo = $thirdPayWeeksNo + $fourthPayWeeksNo;
     }
     $presentdate = new carbon();
     $presentdate = $presentdate->now();
     $secondPaymentDate = new carbon();
     $thirdPaymentDate = new carbon();
     $fourthPaymentDate = new carbon();
     if (isset($inputs['multipayAmount2'])) {
         $secondPaymentDate = $secondPaymentDate->createFromFormat('Y-m-d', $batch_data[$firstPayWeeksNo]['schedule_date']);
     }
     if (isset($inputs['multipayAmount3'])) {
         $thirdPaymentDate = $thirdPaymentDate->createFromFormat('Y-m-d', $batch_data[$secondPayWeeksNo]['schedule_date']);
     }
     if (isset($inputs['multipayAmount4'])) {
         $fourthPaymentDate = $fourthPaymentDate->createFromFormat('Y-m-d', $batch_data[$thirdPayWeeksNo]['schedule_date']);
     }
     if (isset($inputs['multipayAmount4'])) {
         if ($presentdate->gt($fourthPaymentDate)) {
             return Response::json(array('status' => 'four'));
         }
     }
     if (isset($inputs['multipayAmount3'])) {
         if ($presentdate->gt($thirdPaymentDate)) {
             return Response::json(array('status' => 'three'));
         }
     }
     if (isset($inputs['multipayAmount2'])) {
         if ($presentdate->gt($secondPaymentDate)) {
             return Response::json(array('status' => 'two', 'date' => $secondPaymentDate));
         }
     }
     //return Response::json(array('status'=>$batch_data));
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $inputs = Input::all();
     $batch_data = Batches::find($inputs['batchId']);
     $eachClassCost = $batch_data->class_amount;
     $availableSession = $inputs['availableSession'];
     $paymentTypes = array();
     $modulus = "";
     $round = "";
     if ($availableSession > 30) {
         $modulus = $availableSession % 20;
         if ($modulus) {
             $round = $availableSession - $modulus;
         }
         $bipayInstallments = 2;
         $bipayFirstInstallment = $modulus;
         $bipaySecondInstallment = 20;
         $arrayCount['bipay']['eligible'] = "YES";
         $arrayCount['bipay']['installments'] = 2;
         if ($modulus) {
             $arrayCount['bipay']['pays']['0']['dues'] = $modulus;
             $arrayCount['bipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
         } else {
             $arrayCount['bipay']['pays']['0']['dues'] = 20;
             $arrayCount['bipay']['pays']['0']['amount'] = 20 * $eachClassCost;
         }
         $arrayCount['bipay']['pays']['1']['dues'] = 20;
         $arrayCount['bipay']['pays']['1']['amount'] = 20 * $eachClassCost;
         $modulus = $availableSession % 10;
         if ($modulus) {
             $round = $availableSession - $modulus;
         }
         $arrayCount['multipay']['eligible'] = "YES";
         $arrayCount['multipay']['installments'] = 4;
         if ($modulus) {
             $arrayCount['multipay']['pays']['0']['dues'] = $modulus;
             $arrayCount['multipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
         } else {
             $arrayCount['multipay']['pays']['0']['dues'] = 10;
             $arrayCount['multipay']['pays']['0']['amount'] = 10 * $eachClassCost;
         }
         $arrayCount['multipay']['pays']['1']['dues'] = 10;
         $arrayCount['multipay']['pays']['1']['amount'] = 10 * $eachClassCost;
         $arrayCount['multipay']['pays']['2']['dues'] = 10;
         $arrayCount['multipay']['pays']['2']['amount'] = 10 * $eachClassCost;
         $arrayCount['multipay']['pays']['3']['dues'] = 10;
         $arrayCount['multipay']['pays']['3']['amount'] = 10 * $eachClassCost;
     } else {
         if ($availableSession > 10 && $availableSession <= 20) {
             $modulus = $availableSession % 10;
             if ($modulus) {
                 $round = $availableSession - $modulus;
             }
             $bipayInstallments = 2;
             $bipayFirstInstallment = $modulus;
             $bipaySecondInstallment = 10;
             $arrayCount['bipay']['eligible'] = "NO";
             $arrayCount['multipay']['eligible'] = "YES";
             $arrayCount['multipay']['installments'] = $bipayInstallments;
             if ($modulus) {
                 $arrayCount['multipay']['pays']['0']['dues'] = $modulus;
                 $arrayCount['multipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
             } else {
                 $arrayCount['multipay']['pays']['0']['dues'] = 10;
                 $arrayCount['multipay']['pays']['0']['amount'] = 10 * $eachClassCost;
             }
             $arrayCount['multipay']['pays']['1']['dues'] = $bipaySecondInstallment;
             $arrayCount['multipay']['pays']['1']['amount'] = $bipaySecondInstallment * $eachClassCost;
         } else {
             if ($availableSession > 20 && $availableSession <= 30) {
                 $modulus = $availableSession % 10;
                 if ($modulus) {
                     $round = $availableSession - $modulus;
                 }
                 $bipayInstallments = 2;
                 $bipayFirstInstallment = $modulus;
                 $bipaySecondInstallment = 10;
                 $arrayCount['bipay']['eligible'] = "YES";
                 $arrayCount['bipay']['installments'] = 2;
                 if ($modulus) {
                     $arrayCount['bipay']['pays']['0']['dues'] = $modulus;
                     $arrayCount['bipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
                 } else {
                     $arrayCount['bipay']['pays']['0']['dues'] = 10;
                     $arrayCount['bipay']['pays']['0']['amount'] = 10 * $eachClassCost;
                 }
                 $arrayCount['bipay']['pays']['1']['dues'] = 20;
                 $arrayCount['bipay']['pays']['1']['amount'] = 20 * $eachClassCost;
                 $arrayCount['multipay']['eligible'] = "YES";
                 $arrayCount['multipay']['installments'] = 3;
                 if ($modulus) {
                     $arrayCount['multipay']['pays']['0']['dues'] = $modulus;
                     $arrayCount['multipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
                 } else {
                     $arrayCount['multipay']['pays']['0']['dues'] = 10;
                     $arrayCount['multipay']['pays']['0']['amount'] = 10 * $eachClassCost;
                 }
                 $arrayCount['multipay']['pays']['1']['dues'] = 10;
                 $arrayCount['multipay']['pays']['1']['amount'] = 10 * $eachClassCost;
                 $arrayCount['multipay']['pays']['2']['dues'] = 10;
                 $arrayCount['multipay']['pays']['2']['amount'] = 10 * $eachClassCost;
             } else {
                 if ($availableSession <= 10) {
                     $modulus = $availableSession % 10;
                     if ($modulus) {
                         $round = $availableSession - $modulus;
                     }
                     $bipayInstallments = 2;
                     $bipayFirstInstallment = $modulus;
                     $bipaySecondInstallment = 10;
                     $arrayCount['bipay']['eligible'] = "NO";
                     $arrayCount['bipay']['installments'] = 2;
                     if ($modulus) {
                         $arrayCount['bipay']['pays']['0']['dues'] = $modulus;
                         $arrayCount['bipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
                     } else {
                         $arrayCount['bipay']['pays']['0']['dues'] = 10;
                         $arrayCount['bipay']['pays']['0']['amount'] = 10 * $eachClassCost;
                     }
                     $arrayCount['bipay']['pays']['1']['dues'] = 20;
                     $arrayCount['bipay']['pays']['1']['amount'] = 20 * $eachClassCost;
                     $arrayCount['multipay']['eligible'] = "NO";
                     $arrayCount['multipay']['installments'] = 3;
                     if ($modulus) {
                         $arrayCount['multipay']['pays']['0']['dues'] = $modulus;
                         $arrayCount['multipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
                     } else {
                         $arrayCount['multipay']['pays']['0']['dues'] = 10;
                         $arrayCount['multipay']['pays']['0']['amount'] = 10 * $eachClassCost;
                     }
                     $arrayCount['multipay']['pays']['1']['dues'] = 10;
                     $arrayCount['multipay']['pays']['1']['amount'] = 10 * $eachClassCost;
                     $arrayCount['multipay']['pays']['2']['dues'] = 10;
                     $arrayCount['multipay']['pays']['2']['amount'] = 10 * $eachClassCost;
                 } else {
                     if ($availableSession === 10) {
                         $modulus = $availableSession % 10;
                         if ($modulus) {
                             $round = $availableSession - $modulus;
                         }
                         $bipayInstallments = 2;
                         $bipayFirstInstallment = $modulus;
                         $bipaySecondInstallment = 10;
                         $arrayCount['bipay']['eligible'] = "NO";
                         $arrayCount['bipay']['installments'] = 2;
                         if ($modulus) {
                             $arrayCount['bipay']['pays']['0']['dues'] = $modulus;
                             $arrayCount['bipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
                         } else {
                             $arrayCount['bipay']['pays']['0']['dues'] = 10;
                             $arrayCount['bipay']['pays']['0']['amount'] = 10 * $eachClassCost;
                         }
                         $arrayCount['bipay']['pays']['1']['dues'] = 20;
                         $arrayCount['bipay']['pays']['1']['amount'] = 20 * $eachClassCost;
                         $arrayCount['multipay']['eligible'] = "NO";
                         $arrayCount['multipay']['installments'] = 3;
                         if ($modulus) {
                             $arrayCount['multipay']['pays']['0']['dues'] = $modulus;
                             $arrayCount['multipay']['pays']['0']['amount'] = $modulus * $eachClassCost;
                         } else {
                             $arrayCount['multipay']['pays']['0']['dues'] = 10;
                             $arrayCount['multipay']['pays']['0']['amount'] = 10 * $eachClassCost;
                         }
                         $arrayCount['multipay']['pays']['1']['dues'] = 10;
                         $arrayCount['multipay']['pays']['1']['amount'] = 10 * $eachClassCost;
                         $arrayCount['multipay']['pays']['2']['dues'] = 10;
                         $arrayCount['multipay']['pays']['2']['amount'] = 10 * $eachClassCost;
                     }
                 }
             }
         }
     }
     $arrayCount['round'] = $round;
     $arrayCount['modulus'] = $modulus;
     $arrayCount['singlepay'] = $availableSession * $eachClassCost;
     $arrayCount['status'] = "success";
     //working for simple bipay  bipay=(enrolled classes/2)
     if ($availableSession > 5) {
         $arrayCount['modifiedbipay']['elligible'] = 'YES';
         $arrayCount['modifiedbipay']['installments'] = 2;
         if ($availableSession % 2 == 0) {
             $arrayCount['modifiedbipay']['pays']['0']['dues'] = $availableSession / 2;
             $arrayCount['modifiedbipay']['pays']['0']['amount'] = $availableSession / 2 * $eachClassCost;
             $arrayCount['modifiedbipay']['pays']['1']['dues'] = $availableSession / 2;
             $arrayCount['modifiedbipay']['pays']['1']['amount'] = $availableSession / 2 * $eachClassCost;
         } else {
             $firstsessioncount = (int) ($availableSession / 2);
             $secondsessioncount = (int) ($availableSession / 2) + 1;
             $arrayCount['modifiedbipay']['pays']['0']['dues'] = $firstsessioncount;
             $arrayCount['modifiedbipay']['pays']['0']['amount'] = $firstsessioncount * $eachClassCost;
             $arrayCount['modifiedbipay']['pays']['1']['dues'] = $secondsessioncount;
             $arrayCount['modifiedbipay']['pays']['1']['amount'] = $secondsessioncount * $eachClassCost;
         }
     }
     if ($arrayCount) {
         return Response::json(array("payments" => $arrayCount));
     }
     return Response::json(array("status" => "failed"));
 }
Пример #3
0
    });
    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();
    //
Пример #4
0
 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("/");
     }
 }
Пример #5
0
 public function getBatchRemainingClassesByBatchId()
 {
     $inputs = Input::all();
     $batchClassesData = BatchSchedule::where('franchisee_id', '=', Session::get('franchiseId'))->where('batch_id', '=', $inputs['batchId'])->whereDate('schedule_date', '>=', $inputs['preferredStartDate'])->get();
     $batchClassesCount = count($batchClassesData);
     $lastEndDate = $batchClassesData[$batchClassesCount - 1]['schedule_date'];
     $date = Carbon::now();
     $date = $date->createFromFormat('Y-m-d', $lastEndDate);
     $date = $date->next(Carbon::MONDAY);
     //getting the batch cost from batch class
     //$class_data=  ClassBasePrice::where('base_price_no','=',Batches::find($inputs['batchId'])->classes()->base_price_no)->select('base_price')->get();
     //$classAmount=$batch_data->class_amount;
     $base_price_no = Batches::find($inputs['batchId'])->classes()->select('base_price_no')->get();
     $base_price = ClassBasePrice::where('base_price_no', '=', $base_price_no[0]['base_price_no'])->get();
     $base_price = $base_price[0]['base_price'];
     if ($batchClassesCount) {
         return Response::json(array('status' => 'success', 'classCount' => $batchClassesCount, 'lastdate' => $date->toDateString(), 'classAmount' => $base_price, 'enrollment_end_date' => $batchClassesData[count($batchClassesData) - 1]['schedule_date'], 'enrollment_start_date' => $batchClassesData[0]['schedule_date']));
     } else {
         return Response::json(array('status' => 'failure'));
     }
 }