public function postAddSubject()
 {
     //Moin
     //Subject Adding post Function for admin
     $teacher = Input::get('subteacher');
     $class = Input::get('subclass');
     //return $class;
     $teacher_name = Teacher::where('teacher_id', '=', $teacher)->pluck('name');
     $class_name = ClassAdd::where('class_id', '=', $class)->pluck('class_name');
     $iid = User::where('uid', '=', Auth::user()->uid)->pluck('institute_id');
     $subcode = Input::get('subcode');
     $getSubCode = Subject::where('class_id', '=', $class)->where('institute_code', '=', $iid)->where('subject_code', '=', $subcode)->count('subject_code');
     //return $getSubCode;
     if ($getSubCode != 0) {
         Session::flash('data', 'Subject Code Already Used Try another !');
         return Redirect::to('admin/add/subject');
     } else {
         //return $iid;
         $subnote = new Subject();
         $subnote->institute_code = $iid;
         $subnote->subject_name = Input::get('subname');
         $subnote->subject_code = $subcode;
         $subnote->class_id = Input::get('subclass');
         $subnote->class_name = $class_name;
         $subnote->teacher_id = Input::get('subteacher');
         $subnote->teacher_name = $teacher_name;
         $subnote->sub_author = Input::get('subauth');
         $subnote->note = Input::get('subnote');
         $subnote->save();
         Session::flash('data', 'Data successfully added !');
         return Redirect::to('admin/add/subject');
     }
 }
 public function getMarkViews()
 {
     //  $stdInfo=Students::where('institute_code','=',Auth::user()->institute_id)->where('roll','=', $roll)->where('class','=',$cid)->first();
     $stdInfo = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', Auth::user()->uid)->first();
     $stdClass = ClassAdd::where('class_id', '=', $stdInfo->class)->pluck('class_name');
     //return $stdInof->class;
     $showAllMark = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $stdInfo->roll)->where('class_id', '=', $stdInfo->class)->get();
     $showAllMarkExamName = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $stdInfo->roll)->where('class_id', '=', $stdInfo->class)->select('exam_name')->distinct()->get();
     //    $showAllMarkExamName=Mark::where('institute_code','=',Auth::user()->institute_id)->where('roll','=', $roll)->where('class_id','=',$cid)->get();
     $MarkViewGrade = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $stdInfo->roll)->where('class_id', '=', $stdInfo->class)->first();
     //return $showAllMark->sub_mark;
     $allGrad = GradeSystem::where('institute_code', '=', Auth::user()->institute_id)->get();
     $MarkViewGrade = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $stdInfo->roll)->where('class_id', '=', $stdInfo->class)->get();
     return view('admin.resultMark.markviews')->with('stdInfo', $stdInfo)->with('stdClass', $stdClass)->with('showAllMark', $showAllMark)->with('MarkViewGrade', $MarkViewGrade)->with('allGrad', $allGrad)->with('showAllMarkExamName', $showAllMarkExamName);
 }
 public function getMarkViews($roll, $cid)
 {
     $stdInfo = Students::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $roll)->where('class', '=', $cid)->first();
     $stdClass = ClassAdd::where('class_id', '=', $stdInfo->class)->pluck('class_name');
     $showAllMark = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $roll)->where('class_id', '=', $cid)->get();
     $showAllMarkExamName = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $roll)->where('class_id', '=', $cid)->select('exam_name')->distinct()->get();
     //    $showAllMarkExamName=Mark::where('institute_code','=',Auth::user()->institute_id)->where('roll','=', $roll)->where('class_id','=',$cid)->get();
     $MarkViewGrade = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $roll)->where('class_id', '=', $cid)->first();
     //return $showAllMark->sub_mark;
     $allGrad = GradeSystem::where('institute_code', '=', Auth::user()->institute_id)->get();
     $MarkViewGrade = Mark::where('institute_code', '=', Auth::user()->institute_id)->where('roll', '=', $roll)->where('class_id', '=', $cid)->get();
     /*  foreach ($allGrad as $key => $value) {
              //return $MarkViewGrade->sub_mark;
              $MarkViewGrade=Mark::where('institute_code','=',Auth::user()->institute_id)->where('roll','=', $roll)->where('class_id','=',$cid)->get();
     
              //return $MarkViewGrade;
              foreach ($MarkViewGrade as $key => $markget) {
         //  return $value->mark_form;
                if ($markget->sub_mark>=$value->mark_form && $markget->sub_mark<=$value->mark_upto) {
     
                 $point=$value->grade_point ;
                 $grade=$value->grade_name ;
                 return view('admin.resultMark.markviews')->with('stdInfo',$stdInfo)->with('stdClass',$stdClass)
                 ->with('showAllMark',$showAllMark)->with('MarkViewGrade',$MarkViewGrade)->with('allGrad',$allGrad)->with('point',$point)->with('grade',$grade);
     
                }
     
                else {
                  return 2 ;
                }
              }
     
     
     
            }*/
     //  return $point.$grade;
     return view('admin.resultMark.markviews')->with('stdInfo', $stdInfo)->with('stdClass', $stdClass)->with('showAllMark', $showAllMark)->with('MarkViewGrade', $MarkViewGrade)->with('allGrad', $allGrad)->with('showAllMarkExamName', $showAllMarkExamName);
 }
 public function viewBalance()
 {
     $classname = ClassAdd::where('institute_code', '=', Auth::user()->institute_id)->lists('class_id', 'class_name');
     $balance = Invoice::where('institute_code', '=', Auth::user()->institute_id)->select('student_name', 'class_id', 'class_name')->distinct()->get();
     //return $balance;
     return view('admin.balance', ['balance' => $balance, 'class' => $classname]);
 }
 public function getEditClassRoutine($id)
 {
     //Moin
     //Routine get Function for admin
     $icode = User::where('institute_id', '=', Auth::user()->institute_id)->pluck('institute_id');
     $classname = ClassAdd::where('institute_code', '=', Auth::user()->institute_id)->lists('class_id', 'class_name');
     $editclassroutine = ClassRoutine::where('institute_code', '=', Auth::user()->institute_id)->where('id', '=', $id)->first();
     //return $editclassroutine;
     return view('admin.editroutine', ['icode' => $icode, 'class' => $classname, 'classroutine' => $editclassroutine]);
 }
 public function postStudentsAttendenceDetails($uid)
 {
     $Cmonth = date("Y-m");
     $holi = Holyday::where('holiday_date', '=', '2016-03-26')->count();
     $query = Holyday::query();
     $AppWE = AcademicCalender::where('institute_code', '=', Auth::user()->institute_id)->pluck('weekendday');
     // return date('D', strtotime($gh));
     //  $App=Holyday::all();
     // return strlen($AppWE);
     $App = str_limit($AppWE, 3, '');
     $sewe = substr($AppWE, 4);
     $sewe3 = substr($AppWE, 9);
     //return $sewe3;
     //$App=Holyday::all();
     $maxDays = date('t');
     //how may day current month
     $currentDayOfMonth = date('j');
     //today numaric
     $today = date("d");
     $Cmonth = date("Y-m");
     $y = date("Y");
     // return $y;
     $GetStudents = DB::table('tbl_studets')->join('tbl_attendence', 'tbl_studets.st_id', '=', 'tbl_attendence.uid')->select('tbl_studets.*', 'tbl_attendence.*')->where('tbl_attendence.institute_code', '=', Auth::user()->institute_id)->where('tbl_studets.institute_code', '=', Auth::user()->institute_id)->where('tbl_attendence.type', '=', 'Student')->where('tbl_studets.st_id', '=', $uid)->first();
     $stdPrestAve = Attendence::where('institute_code', '=', Auth::user()->institute_id)->where('uid', '=', $uid)->where('status', '=', 0)->where('created_at', 'LIKE', "%{$Cmonth}%")->count();
     $presentPersent = (int) ($stdPrestAve / $today * 100);
     //return $presentPersent;
     $stdClass = ClassAdd::where('class_id', '=', $GetStudents->class)->pluck('class_name');
     $month = date('m');
     $year = date("Y");
     $start_date = "01-" . $month . "-" . $year;
     $start_time = strtotime($start_date);
     $end_time = strtotime("+1 month", $start_time);
     for ($i = $start_time; $i < $end_time; $i += 86400) {
         $list[] = date('d D', $i);
     }
     for ($i = $start_time; $i < $end_time; $i += 86400) {
         $listdate[] = date('Y-m-d', $i);
     }
     //return $rand = substr(uniqid('', true), -4);//uniq random id limit
     return view('admin.attendence.studentsAttendanceViewDetails')->with('stdInfo', $GetStudents)->with('stdClass', $stdClass)->with('persent', $presentPersent)->with('day', $list)->with('listdate', $listdate)->with('App', $App)->with('sewe', $sewe)->with('sewe3', $sewe3);
 }