<?php
include "../config.php";
include "classes.php";

$data = array();
$domainOverall = array();
$domain = array();

$condX = $_REQUEST['condX'];
$conX = $_REQUEST['conX'];
$normalmonthX = $_REQUEST['normalmonthX'];
$range_arr = array(1,2,3,4,5,6,7,8,9,10,11);
if($conX==1)
{    
    //$condX=" ";   
}

$nps = new NPS($conn,$condX);
$nps3 = new NPS3($conn,$condX);

$domainOverall['overallflipkartPreviousNPS'] = $nps->npsCalculate('Q19a',$normalmonthX[0]);
$domainOverall['overallamazonPreviousNPS'] = $nps->npsCalculate('Q19c',$normalmonthX[0]);
$domainOverall['overallmeeshoPreviousNPS'] = $nps->npsCalculate('Q19e',$normalmonthX[0]);

$domainOverall['overallflipkartCurrentNPS'] = $nps->npsCalculate('Q19a',$normalmonthX[1]);
$domainOverall['overallamazonCurrentNPS'] = $nps->npsCalculate('Q19c',$normalmonthX[1]);
$domainOverall['overallmeeshoCurrentNPS'] = $nps->npsCalculate('Q19e',$normalmonthX[1]);

$domain['PreviousNPS'] = $nps3->npsCalculate3('Q20aN_',$range_arr,$brandX2,$normalmonthX[0]);
$domain['CurrentNPS'] = $nps3->npsCalculate3('Q20aN_',$range_arr,$brandX2,$normalmonthX[1]);

array_push($data,$domainOverall);
array_push($data,$domain);

echo json_encode($data);

?>