<?php
// Q25_1_1	Q25_1_2	Q25_1_3	Q25_2_1	Q25_2_2	Q25_2_3	Q25_3_1	Q25_3_2	Q25_3_3

// Prefix_Attribute_Brand
include "../config.php";
include "classes.php";

$data = array();
$finalNPS = array();
$condX = $_REQUEST['condX'];
$conX = $_REQUEST['conX'];
$trendsmonthX = $_REQUEST['trendsmonthX'];
$monthX1 = array_slice($trendsmonthX, 0, -1);
$monthX2 = array_slice($trendsmonthX, -1);
$domainDropCvalX = $_REQUEST['domainDropC2valX'];

$column_name = '';
$range_arr = array();
$column_name2 = '';
$range_arr2 = array();

if($conX==1)
{    
    // $condX=" sys_RespStatus = 5 AND sys_RespRemoved = 0";   
}

if($domainDropCvalX == "2")
{
    $column_name = 'Q20aN_';
    $range_arr = array(1);
}
else if($domainDropCvalX == "3")
{
    $column_name = 'Q20aN_';
    $range_arr = array(2);
}
else if($domainDropCvalX == "4")
{
    $column_name = 'Q20aN_';
    $range_arr = array(3);
}
else if($domainDropCvalX == "5")
{
    $column_name = 'Q20aN_';
    $range_arr = array(4);
}
else if($domainDropCvalX == "6")
{
    $column_name = 'Q20aN_';
    $range_arr = array(5);
}
else if($domainDropCvalX == "7")
{
    $column_name = 'Q20aN_';
    $range_arr = array(6);
}
else if($domainDropCvalX == "8")
{
    $column_name = 'Q20aN_';
    $range_arr = array(7);
}
else if($domainDropCvalX == "9")
{
    $column_name = 'Q20aN_';
    $range_arr = array(8);
}
else if($domainDropCvalX == "10")
{
    $column_name = 'Q20aN_';
    $range_arr = array(9);
}
else if($domainDropCvalX == "11")
{
    $column_name = 'Q20aN_';
    $range_arr = array(10);
}
else if($domainDropCvalX == "12")
{
    $column_name = 'Q20aN_';
    $range_arr = array(11);
}

// 

if($domainDropCvalX == "2")
{
    $column_name2 = 'Q21_';
    $range_arr2 = array(1,2,3,4,5,6,7,8);
}
else if($domainDropCvalX == "3")
{
    $column_name2 = 'Q22_';
    $range_arr2 = array(1,2,3);
}
else if($domainDropCvalX == "4")
{
    $column_name2 = 'Q23_';
    $range_arr2 = array(1,2,3,4,5,6,7);
}
else if($domainDropCvalX == "5")
{
    $column_name2 = 'Q24_';
    $range_arr2 = array(1,2,3,4);
}
else if($domainDropCvalX == "6")
{
    $column_name2 = 'Q25_';
    $range_arr2 = array(1,2,4,5);
}
else if($domainDropCvalX == "7")
{
    $column_name2 = 'Q26_';
    $range_arr2 = array(1,2,3,4,5);
}
else if($domainDropCvalX == "8")
{
    $column_name2 = 'Q27_';
    $range_arr2 = array(1,2,3,4,5,6);
}
else if($domainDropCvalX == "9")
{
    $column_name2 = 'Q28_';
    $range_arr2 = array(1,2,3,4,5,6,7,8,9,10,11,12,13);
}
else if($domainDropCvalX == "10")
{
    $column_name2 = 'Q30_';
    $range_arr2 = array(1,2,3);
}
else if($domainDropCvalX == "11")
{
    $column_name2 = 'Q29_';
    $range_arr2 = array(1,2,3,4,5,6,7,8,9);
}
else if($domainDropCvalX == "12")
{
    $column_name2 = 'Q31_';
    $range_arr2 = array(1,2);
}

$nps5 = new NPS5($conn,$condX);
$nps6 = new NPS6($conn,$condX);

$finalNPS['PreviousNPS'] = $nps5->npsCalculate5($column_name,$range_arr,$brandX2,$monthX1);
$finalNPS['CurrentNPS'] = $nps5->npsCalculate5($column_name,$range_arr,$brandX2,$monthX2);

$finalNPS2['PreviousNPS2'] = $nps6->npsCalculate6($column_name2,$range_arr2,$brandX2,$monthX1);
$finalNPS2['CurrentNPS2'] = $nps6->npsCalculate6($column_name2,$range_arr2,$brandX2,$monthX2);

array_push($data,$finalNPS);
array_push($data,$finalNPS2);

echo json_encode($data);

?>