<?php
$find_date= $_POST["StartDate"];
$find_enddate= $_POST["EndDate"];
$week_no= $_POST["Weeknumber"];
$section= $_POST["Section"];
if ($find_date =="" || $find_enddate =="" ){
   $find_date =date("Y.m.d");
   $find_enddate =date("Y.m.d");
}
$today = date("d/m/Y H:i:s");
$host ="it2008";
$user = "sa";
$pass = "mercury";
$objConnect = mssql_connect($host,$user,$pass);
$objDB = mssql_select_db("smvDB");
$strSQL="";
if ($section =='1'){
    $strSQL = "select * from V_Follow_plan_Pending_summary";
}
if($strSQL != ""){
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
 $resultArray = array();
while($objResult = mssql_fetch_array($objQuery))
{
   array_push($resultArray,$objResult);
}
mssql_close($objConnect);
$return_json ="";
$totalVal=0;
$totalPD2Val=0;
$totalPD2Qty=0;
$totalQty=0;
$goalStat="";
foreach ($resultArray as $result)
{

//    $totalQty=$result["cum_qty"]+$result["les_br_qty"]+$result["normal_qty"]+$result["dir_qty"];
//    $totalVal=($result["cum_value"]+$result["les_br_value"]+$result["normal_value"]+$result["dir_value"])/320;
//    if($totalVal >$result["goal_point"]){
//        $goalStat ="<img src='images/finish.png' style='height:24px; width:24px;'/> &nbsp; ";
//    }else{
//        $goalStat ="<img src='images/monitor.png' style='height:24px; width:24px;'/> &nbsp; ";
//    }
    echo $result[27];
        $return_json .="<tr>
      <td>" .$result["program_no"]."</td>      
      <td>" .$result["program_no_order"]."</td> 
      <td>" .$result["Pac"]."</td>      
      <td>" .$result["FG_bal"]."</td> 
      <td>" .number_format($result["4"])."</td>      
      <td>" .number_format($result[5])."</td> 
          
    <td>" .number_format($result[6])."</td>      
      <td>" .number_format($result[7])."</td> 
      <td>" .number_format($result[8])."</td>      
      <td>" .number_format($result[9])."</td> 
      <td>" .number_format($result[10])."</td>      
      <td>" .number_format($result[11])."</td> 
          
 <td>" .number_format($result[12])."</td>      
      <td>" .number_format($result[13])."</td> 
      <td>" .number_format($result[14])."</td>      
      <td>" .number_format($result[15])."</td> 
      <td>" .number_format($result[16])."</td>      
      <td>" .number_format($result[17])."</td> 
          
 <td>" .number_format($result[18])."</td>      
      <td>" .number_format($result[19])."</td> 
      <td>" .number_format($result[20])."</td>      
      <td>" .number_format($result[21])."</td> 
      <td>" .number_format($result[22])."</td>      
      <td>" .number_format($result[23])."</td> 
          
 <td>" .number_format($result[24])."</td>      
      <td>" .number_format($result[25])."</td> 
      <td>" .number_format($result[26])."</td>      
      <td>" .number_format($result[27])."</td> 
      <td>" .number_format($result[28])."</td>      
      <td>" .number_format($result[29])."</td> 
          
 <td>" .number_format($result[30])."</td>      
      <td>" .number_format($result[31])."</td> 
      <td>" .number_format($result[32])."</td>      
      <td>" .number_format($result[33])."</td> 
      <td>" .number_format($result[34])."</td>      
      <td>" .number_format($result[35])."</td> 
      </tr>"; 

}
}
echo $return_json;
?>