public function postAmrecruiterperformance() {
		$job_id_n = Input::get('job_id');
		$decryption = base64_decode($job_id_n);
        $joborderId = $decryption;
        $joborderId = substr($joborderId, strpos($joborderId, "-") + 1);
		$authuser = Auth::user();
		$job_id =$joborderId;
		$recruiterPerform = Association::where('job_id',$job_id)
								->where('accountmanager_id',$authuser->id)
                                ->whereNotNull('admin_id')
					            ->whereNotNull('employer_id')
					            ->whereNotNull('vendor_id')
					            ->whereNull('vendor_user_id')
					            ->whereNull('employer_user_id')
					            ->whereNotNull('job_id')
					            ->whereNull('candidate_id')
					             ->with(array('Vendor'))
                                ->get()->toArray();
		//print_r($recruiterPerform);exit;						
		if(is_array($recruiterPerform) && count($recruiterPerform)>0) {
			
			$vendorNames = array();
			$vendor_ids = array();
			foreach($recruiterPerform as $key =>$value) {
				if(!in_array($value['vendor']['first_name'], $vendorNames)) {
					$vendorNames[] = $value['vendor']['first_name'];
					$vendor_ids[] = $value['vendor']['id'];
				}
				
			}
		}
		//print_r($vendor_ids);EXIT;
		if(is_array($vendor_ids) && count($vendor_ids)>0) {
			
			for($i=0; $i<count($vendor_ids); $i++) {
				
				$recruterInfo = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('accountmanager_id',$authuser->id)
                                ->whereNotNull('admin_id')
					            ->whereNotNull('employer_id')
					            ->whereNotNull('vendor_id')
					            ->whereNull('vendor_user_id')
					            ->whereNull('employer_user_id')
					            ->whereNotNull('job_id')
					            ->whereNull('candidate_id')
                                ->get()->toArray();
				//print_r($recruterInfo); exit;
				$countIndex = count($recruterInfo)-1;
				$first_profile_date = $recruterInfo[0]['created_at']; 
				$last_profile_date = $recruterInfo[$countIndex]['created_at']; 
				echo $first_profile_date.'=='.$last_profile_date;exit;
				$start = new DateTime($first_profile_date);
				$end = new DateTime($last_profile_date);
				
				$interval = $start->diff($end); 
				$noOfWorkingDay = 0;
				for($k=0; $k<=$interval->days; $k++) {
					
					$start->modify('+1 day');
					$weekday = $start->format('w');
					if($weekday !== "0" && $weekday !== "6"){ // 0 for Sunday and 6 for Saturday
						$noOfWorkingDay++;  
					}
				}
				
				$noOfWorkingDays[] = array('no_of_working_days' =>$noOfWorkingDay, 'vendor_id'=>$vendor_ids[$i]);
				
				$totalSubmit = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('accountmanager_id',$authuser->id)
                                ->count();
				$totalSubmitions[] = array('total_submition' =>$totalSubmit, 'vendor_id'=>$vendor_ids[$i]);
				
				$totalShortlist = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('candidate_status',5)
								->where('accountmanager_id',$authuser->id)
                                ->count();
				$totalShorlisted[] = array('total_shortlisted' =>$totalShortlist, 'vendor_id'=>$vendor_ids[$i]);
				
				$totInterview = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->whereIn('candidate_status',[9,10,13,17,18,20, 21, 22, 23])
								->where('accountmanager_id',$authuser->id)
                                ->count();
				$totalInterview[] = array('total_interview' =>$totInterview, 'vendor_id'=>$vendor_ids[$i]);
				
				$totSelect = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('candidate_status', 3)
								->where('accountmanager_id',$authuser->id)
                                ->count();
				$totalSelection[] = array('total_selection' =>$totSelect, 'vendor_id'=>$vendor_ids[$i]);
				
				$totCloser = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('candidate_status', 44)
								->where('accountmanager_id',$authuser->id)
                                ->count();
				$totalCloser[] = array('total_closer' =>$totCloser, 'vendor_id'=>$vendor_ids[$i]);
				$totJoin = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('candidate_status', 45)
								->where('accountmanager_id',$authuser->id)
                                ->count();
				$totalJoining[] = array('total_joining' =>$totJoin, 'vendor_id'=>$vendor_ids[$i]);
				
				$submitionRatio[] = round($totalSubmit/$noOfWorkingDay,2);
				$shortlistToSubmitionRatio[] = $totalShortlist/$totalSubmit;
				$interviewToSubmitionRatio[] = round($totInterview/$totalSubmit,2);
				$selectionToSubmitionRatio[] = round($totSelect/$totalSubmit,2);
				$closerToSubmitionRatio[] = round($totCloser/$totalSubmit,2);
				$joiningToSubmitionRatio[] = round($totJoin/$totalSubmit,2);
				
				$totalReject = Association::where('vendor_id',$vendor_ids[$i])
								->where('job_id',$job_id)
								->where('candidate_status', 3)
								->where('accountmanager_id',$authuser->id)
                                ->count();
								
				$totalRejectRatio[] = round(($totalReject *100)/$totalSubmit,2);
				
			}
		}
		$numbers = ['vendorNames' => $vendorNames, 'noOfWorkingDays' => $noOfWorkingDays, 'totalSubmitions' => $totalSubmitions, 'totalShorlisted' => $totalShorlisted, 'totalInterview'=>$totalInterview, 'totalSelection'=>$totalSelection, 'totalCloser'=>$totalCloser, 'totalJoining'=>$totalJoining, 'submitionRatio'=>$submitionRatio, 'shortlistToSubmitionRatio'=>$shortlistToSubmitionRatio, 'interviewToSubmitionRatio'=>$interviewToSubmitionRatio, 'selectionToSubmitionRatio'=>$selectionToSubmitionRatio, 'closerToSubmitionRatio'=>$closerToSubmitionRatio, 'joiningToSubmitionRatio'=>$joiningToSubmitionRatio, 'totalRejectRatio'=>$totalRejectRatio];
        
		$amrecruiterperformance['numbers'] = $numbers;
		//print_r($amrecruiterperformance); exit;
        return response()->success(compact('amrecruiterperformance'));
	}