Ejemplo n.º 1
0
 public function enable_or_desable()
 {
     if (Auth::check()) {
         $currentPage = "EnableDiscounts_LI";
         $mainMenu = "DISCOUNTS_MENU_MAIN";
         $discount_data = Discounts::where('franchisee_id', '=', Session::get('franchiseId'))->orderBy('id', '=', 'DESC')->get();
         $viewdata = array('currentPage', 'mainMenu', 'discount_data');
         //$viewdata=array('currentPage','mainMenu');
         return View::make('pages.Discounts.enable_or_desable', compact($viewdata));
     }
 }
Ejemplo n.º 2
0
 public function getDiscount()
 {
     $inputs = Input::all();
     //return Response::json(array('status'=>'success'));
     $discount_second_child;
     $discount_second_class;
     $discount_second_child_elligible = 0;
     $discount_second_class_elligible = 0;
     $DiscountApprove = Discounts::where('franchiseId', '=', Session::get('franchiseId'))->first();
     if ($DiscountApprove['discount_second_child_approve'] != 0 && $DiscountApprove['discount_second_class_approve'] != 0) {
         $discount_second_child_elligible = 1;
         $discount_second_class_elligible = 1;
         $discount_second_child = $DiscountApprove['discount_second_child'];
         $discount_second_class = $DiscountApprove['discount_second_class'];
     } elseif ($DiscountApprove['discount_second_child_approve'] == 0 && $DiscountApprove['discount_second_class_approve'] != 0) {
         $discount_second_class_elligible = 1;
         $discount_second_class = $DiscountApprove['discount_second_class'];
     } elseif ($DiscountApprove['discount_second_child_approve'] != 0 && $DiscountApprove['discount_second_class_approve'] == 0) {
         $discount_second_child_elligible = 1;
         $discount_second_child = $DiscountApprove['discount_second_child'];
     }
     if ($discount_second_class) {
     }
     return Response::json(array('status' => 'success', 'discount_second_child' => $discount_second_child, 'discount_second_class' => $discount_second_class));
     //        $inputs=Input::all();
     //        $classes_count=  StudentClasses::where('student_id','=',$inputs['studentId'])
     //                                        ->where('status','=','enrolled')
     //                                        //->whereDate('enrollment_start_date','>=',date("Y-m-d"))
     //                                        //->whereDate('enrollment_end_date','<=',date("Y-m-d"))
     //                                        ->distinct('class_id')
     //                                        ->count();
     //        $discount=0;
     //        if($classes_count>=1){
     //            $discount_data= Discounts::where('season_id','=',$inputs['seasonId'])->get();
     //            $discount=$discount_data[0]['discount_second_class'];
     //        }else{
     //
     //            $student_data = Students::where('id','=',$inputs['studentId'])->get();
     //            $student_data = Students::where('customer_id','=',$student_data[0]['customer_id'])->get();
     //            $sid;
     //            foreach($student_data as $s){
     //                $sid[]=$s['id'];
     //            }
     //            $count=0;
     //            for($i=0;$i<count($sid);$i++){
     //                if(StudentClasses::where('student_id','=',$sid[$i])->exists()){
     //                 $count++;
     //                }
     //            }
     //            if($count>=1){
     //                $discount_data= Discounts::where('season_id','=',$inputs['seasonId'])->get();
     //                $discount=$discount_data[0]['discount_second_child'];
     //            }
     //
     //        }
     //        return Response::json(array('status'=>'success','discount'=>$discount));
 }
Ejemplo n.º 3
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function view($id)
 {
     if (Auth::check()) {
         $currentPage = "STUDENTS_LIST";
         $mainMenu = "STUDENTS_MAIN";
         $student = Students::getStudentById($id);
         $franchiseeCourses = Courses::getFranchiseCoursesList(Session::get('franchiseId'));
         $studentEnrollments = StudentClasses::getStudentEnrollments($id);
         $paymentDues = PaymentDues::getAllPaymentDuesByStudent($id);
         $customermembership = CustomerMembership::getCustomerMembership($student['0']->customer_id);
         $scheduledIntroVisits = IntroVisit::getIntrovisitByStudentId($id);
         $discountEligibility = StudentClasses::discount($id, $student['0']->customer_id);
         //$paidDue= PaymentDues::getAllPaymentsMade($id);
         //$Due=PaymentDues::getAllDue($id);
         //for paid payment
         /* on hold for changing enrollment
            $paidAmountdata= PaymentDues::getAllPaymentsMade($id);
            for($i=0;$i<count($paidAmountdata);$i++){
                $studentclasssectiondata=  Classes::getstudentclasses($paidAmountdata[$i]['class_id']);
                $paidAmountdata[$i]['class_name']=$studentclasssectiondata[0]['class_name'];
                $user_Data=User::getUsersByUserId($paidAmountdata[$i]['created_by']);
                $paidAmountdata[$i]['receivedname']=$user_Data[0]['first_name'].$user_Data[0]['last_name'];
                $order_data=  Orders::getOrderDetailsbyPaydueId($paidAmountdata[$i]['id']);
                $paidAmountdata[$i]['printurl']=  url().'/orders/print/'.Crypt::encrypt($order_data[0]['id']);
                
            }
            */
         /*
                                 
                                 $paidAmountdata= Orders::getAllPaymentsMade($id);
                                 
                                 for($i=0;$i<count($paidAmountdata);$i++){
            $studentClassdata=StudentClasses::getStudentClassbyId($paidAmountdata[$i]['student_classes_id']);
            $paidAmountdata[$i]['enrollment_start_date']=$studentClassdata[0]['enrollment_start_date'];
            $paidAmountdata[$i]['enrollment_end_date']=$studentClassdata[0]['enrollment_end_date'];
            $paidAmountdata[$i]['selected_sessions']=$studentClassdata[0]['selected_sessions'];
            $studentclasssectiondata=  Classes::getstudentclasses($studentClassdata[0]['class_id']);
            $paidAmountdata[$i]['class_name']=$studentclasssectiondata[0]['class_name'];
            $user_Data=User::getUsersByUserId($paidAmountdata[$i]['created_by']);
            $paidAmountdata[$i]['receivedname']=$user_Data[0]['first_name'].$user_Data[0]['last_name'];
            $paidAmountdata[$i]['printurl']=  url().'/orders/print/'.Crypt::encrypt($paidAmountdata[0]['id']);
            
                                 }
         * 
         */
         //for dues
         //  $order_due_data=Orders::getpendingPaymentsid($id);
         $order_due_data = PaymentDues::getAllDuebyStudentId($id);
         //  $dueAmountdata=PaymentDues::getAllDue($id);
         for ($i = 0; $i < count($order_due_data); $i++) {
             $studentclasssectiondata = Classes::getstudentclasses($order_due_data[0]['class_id']);
             $order_due_data[$i]['class_name'] = $studentclasssectiondata[0]['class_name'];
             $user_Data = User::getUsersByUserId($order_due_data[$i]['created_by']);
             $order_due_data[$i]['receivedname'] = $user_Data[0]['first_name'] . $user_Data[0]['last_name'];
         }
         //getting values for present Discount for enrollment
         $discount_second_child = 0;
         $discount_second_class = 0;
         $discount_second_child_elligible = 0;
         $discount_second_class_elligible = 0;
         $count = 0;
         $DiscountApprove = Discounts::where('franchisee_id', '=', Session::get('franchiseId'))->first();
         if ($DiscountApprove['discount_second_child_approve'] == 1) {
             $discount_second_child_elligible = 1;
             $discount_second_child = $DiscountApprove['discount_second_child'];
         }
         if ($DiscountApprove['discount_second_class_approve'] == 1) {
             $discount_second_class_elligible = 1;
             $discount_second_class = $DiscountApprove['discount_second_class'];
         }
         if ($discount_second_class_elligible) {
             $classes_count = StudentClasses::where('student_id', '=', $student[0]['id'])->where('status', '=', 'enrolled')->count();
             if ($classes_count > 1) {
                 $discount_second_class_elligible = 1;
             } else {
                 $discount_second_class_elligible = 0;
             }
         }
         if ($discount_second_child_elligible) {
             $student_ids = Students::where('customer_id', '=', $student[0]['customer_id'])->select('id')->get()->toArray();
             for ($i = 0; $i < count($student_ids); $i++) {
                 if (StudentClasses::where('student_id', '=', $student_ids[$i]['id'])->where('status', '=', 'enrolled')->exists()) {
                     $count++;
                 }
             }
             //$discount_second_class_elligible=($count>1)?1:0;
             if ($count > 1) {
                 $discount_second_class_elligible = 1;
             } else {
                 $discount_second_class_elligible = 0;
             }
         }
         $discountEnrollmentData = Discounts::getEnrollmentDiscontByFranchiseId();
         $dataToView = array("student", 'currentPage', 'mainMenu', 'franchiseeCourses', 'discountEnrollmentData', 'discount_second_class_elligible', 'discount_second_child_elligible', 'discount_second_child', 'discount_second_class', 'studentEnrollments', 'customermembership', 'paymentDues', 'scheduledIntroVisits', 'introvisit', 'discountEligibility', 'paidAmountdata', 'order_due_data');
         return View::make('pages.students.details', compact($dataToView));
     } else {
         return Redirect::to("/");
     }
 }
Ejemplo n.º 4
0
 static function approveDiscounts($data)
 {
     return Discounts::where('franchisee_id', '=', Session::get('franchiseId'))->update(array('discount_second_class_approve' => $data['classCheck'], 'discount_second_child_approve' => $data['childCheck']));
 }