<?php 

	session_start();
	include("../all_query.php");
	include '../db.php';
	error_reporting(0);

 

  if(isset($_SESSION['call_evaluation_email']))
  {
	  
	  
	  
	  
	  
	   $score = 0;
	   
	   $fatal = '';
	   
	   if(isset($_POST['fatal']))
	   {
		  
		  $fatal = $_POST['fatal'];
		   
	   }
	   
	   
	   $pointArray  = array(10,10,10,10,10,10,10,10,5,10,5);
					
					
					
	   
	   if($fatal == 'No fatal parameter identified')
	   {
		   
		   for($i=2;$i<=12;$i++)
		   {
			   
			   if(isset($_POST['question_'.$i]))
			   {
				   if($_POST['question_'.$i] == 'Yes' || $_POST['question_'.$i] == 'Not Applicable' )
				   {
					   
					  // $score = $score+10;
					   $score = $score + $pointArray[$i - 2];
					   
				   }
			   }
			   
		   }
		   
		   
	   }
	   
	   
	   
	  
	  
	  
	  $_POST['month'] = date('M');
	  
	  $_POST['score'] = "".$score;
	  
	  $_POST['timestamp'] = date('Y-m-d H:i:s');
	  
	  
	  unset($_POST['month_year']);
	  
	  
	  
	   insertTable($conn,'call_evaluation',$_POST,'add_submit');
			
	  
	   echo "Call Evaluation Submitted Successfully";
	  
	  
	  
	  
	  
	  
	  
	  //print_r($_POST);
	  
	  
	  
	//echo implode(',',array_keys($_POST));
	  
	  
	  //email,type_of_evaluator,name_of_the_evaluator,name_of_the_telecaller,telecaller_employee_id,evaluation_date,portfolio,product,recording_id,call_date,loan_id,language,customer_type,call_disposion,feedback_date,call_summary,positives,area_of_improvement,fatal,question_2,question_3,question_4,question_5,question_6,question_7,question_8,question_9,question_10,question_11
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	  
	   
  }
     
