<?php
$cstaConf=GetCstaConf($sysTypeNo);
$select_checkbox_id=$_REQUEST['select_checkbox_id'];
$selectedId='flag'.$select_checkbox_id;
${$selectedId}=$_REQUEST[$selectedId];
for($i=0;$i<8;$i++){
	$flagNum="flag$i";
	${$flagNum}=$_REQUEST[$flagNum];
}
if(0)
{
	echo "sel_date_from=$sel_date_from,sel_date_to=$sel_date_to<br>";
	echo "<pre>";
	print_r($cstaConf['DataObject'][1]);
	echo "</pre>";
}

echo "<input type=\"hidden\" name=\"select_checkbox_id\" value=\"$select_checkbox_id\">";
echo "<input type=\"hidden\" name=\"scroll_y\" value=\"$scroll_y\">";

$slot=$sel_date_from-$sel_date_to+1;
$total_hour_num=$slot*24;
$startTime=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
$endTime=date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-$sel_date_to,date("Y")));
//echo "startTime=$startTime,endTime=$endTime<br>";

$cstaDataTmp=GetCstaDataByDay($cstaConf,$startTime,$endTime,"detail");

$cstaData=$cstaDataTmp[0];

//SMPP-Data
$sumField= explode(",", $cstaConf['DataObject'][1]['DetailFieldList']);

$sql = "SELECT " . implode(',', array_map(function($field) {
    return "SUM($field) as total_$field";
}, $sumField)) ." FROM CSTA_DB.smscSmppData where csta_datetime >= '$startTime' and csta_datetime <= '$endTime'";
//echo "sq=$sql";
global $cstaDbConn;
$res=mysqli_query($cstaDbConn,$sql);
$num=mysqli_num_rows($res);
$cstaSmpprow=@mysqli_fetch_array($res);

if(0)
{
	echo "<pre>";
	print_r($cstaSmpprow);
	echo "</pre>";
}

//Table-1
{
	$table_title="SMSC Statistic&nbsp;&nbsp;Date:";
	if($slot>1)
		$table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")))." to ".date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y")));
	else
		$table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
	
	echo "<br><b><center>$table_title</center></b>";
	echo "<table width=\"100%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
	//Table title
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td rowspan=\"2\" width=\"20%\">&nbsp;</td>";
	//echo "<tr>";
	echo "<td align=\"center\" colspan=\"4\" width=\"40%\">To SMSC</td>";
	echo "<td align=\"center\" colspan=\"4\" width=\"40%\">SMSC to</td>";
	echo "</tr>";
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td align=\"center\" width=\"10%\">MAP</td>";
	echo "<td align=\"center\" width=\"10%\">SIP</td>";
	echo "<td align=\"center\" width=\"10%\">SMPP</td>";
	echo "<td align=\"center\" width=\"10%\">Total</td>";
	echo "<td align=\"center\" width=\"10%\">MAP</td>";
	echo "<td align=\"center\" width=\"10%\">SIP</td>";
	echo "<td align=\"center\" width=\"10%\">SMPP</td>";
	echo "<td align=\"center\" width=\"10%\">Total</td>";
	echo "</tr>";
	echo "<tr>";
	
	//Attempt
	echo "<td align=\"left\">Attempt</td>";
	$value=$cstaData[MAP_to_SMSC_attempt]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SIP_to_SMSC_attempt]+0;
	echo "<td>$value</td>";
	
	$value=$cstaSmpprow[total_SMPP_to_SMSC_attempt]+0;
	echo "<td>$value</td>";
	
	
	$value=$cstaData[MAP_to_SMSC_attempt]+$cstaData[SIP_to_SMSC_attempt]+$cstaSmpprow[total_SMPP_to_SMSC_attempt];
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_attempt]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_SIP_attempt]+0;
	echo "<td>$value</td>";
	
	$value=$cstaSmpprow[total_SMSC_to_SMPP_attempt]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_attempt]+$cstaData[SMSC_to_SIP_attempt]+$cstaSmpprow[total_SMSC_to_SMPP_attempt];
	echo "<td>$value</td>";
	echo "</tr>";
	
	//Success
	echo "<tr>";
	echo "<td align=\"left\">Success</td>";
	$value=$cstaData[MAP_to_SMSC_success]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SIP_to_SMSC_success]+0;
	echo "<td>$value</td>";
	
	$value=$cstaSmpprow[total_SMPP_to_SMSC_success]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[MAP_to_SMSC_success]+$cstaData[SIP_to_SMSC_success]+$cstaSmpprow[total_SMPP_to_SMSC_success];
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_success]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_SIP_success]+0;
	echo "<td>$value</td>";
	
	$value=$cstaSmpprow[total_SMSC_to_SMPP_success]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_success]+$cstaData[SMSC_to_SIP_success]+$cstaSmpprow[total_SMSC_to_SMPP_success];
	echo "<td>$value</td>";
	echo "</tr>";
	
	//Failure
	echo "<tr>";
	echo "<td align=\"left\">Failure</td>";
	$value=$cstaData[MAP_to_SMSC_sysfail]+$cstaData[MAP_to_SMSC_userfail]+$cstaData[MAP_to_SMSC_smfail];
	echo "<td>$value</td>";
	
	$value=$cstaData[SIP_to_SMSC_sysfail]+$cstaData[SIP_to_SMSC_userfail]+$cstaData[SIP_to_SMSC_smfail];
	echo "<td>$value</td>";

	$value=$cstaSmpprow[total_SMPP_to_SMSC_sysfail]+$cstaSmpprow[total_SMPP_to_SMSC_userfail]+$cstaSmpprow[total_SMPP_to_SMSC_smfail];
	echo "<td>$value</td>";
	
	$value=$cstaData[MAP_to_SMSC_sysfail]+$cstaData[MAP_to_SMSC_userfail]+$cstaData[MAP_to_SMSC_smfail]+
		   $cstaData[SIP_to_SMSC_sysfail]+$cstaData[SIP_to_SMSC_userfail]+$cstaData[SIP_to_SMSC_smfail]+
		   $cstaSmpprow[total_SMPP_to_SMSC_sysfail]+$cstaSmpprow[total_SMPP_to_SMSC_userfail]+$cstaSmpprow[total_SMPP_to_SMSC_smfail];
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_sysfail]+$cstaData[SMSC_to_MAP_userfail]+$cstaData[SMSC_to_MAP_smfail];
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_SIP_sysfail]+$cstaData[SMSC_to_SIP_userfail]+$cstaData[SMSC_to_SIP_smfail];
	echo "<td>$value</td>";
	

	$value=$cstaSmpprow[total_SMSC_to_SMPP_sysfail]+$cstaSmpprow[total_SMSC_to_SMPP_userfail]+$cstaSmpprow[total_SMSC_to_SMPP_smfail];
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_sysfail]+$cstaData[SMSC_to_MAP_userfail]+$cstaData[SMSC_to_MAP_smfail]+
		$cstaData[SMSC_to_SIP_sysfail]+$cstaData[SMSC_to_SIP_userfail]+$cstaData[SMSC_to_SIP_smfail]+
		$cstaSmpprow[total_SMSC_to_SMPP_sysfail]+$cstaSmpprow[total_SMSC_to_SMPP_userfail]+$cstaSmpprow[total_SMSC_to_SMPP_smfail];
	echo "<td>$value</td>";
	echo "</tr>";
	
	//Total bytes
	echo "<tr>";
	echo "<td align=\"left\">Total bytes</td>";
	$value=$cstaData[MAP_to_SMSC_byte]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SIP_to_SMSC_byte]+0;
	echo "<td>$value</td>";
	
	$value=$cstaSmpprow[total_SMPP_to_SMSC_byte]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[MAP_to_SMSC_byte]+$cstaData[SIP_to_SMSC_byte]+$cstaSmpprow[total_SMPP_to_SMSC_byte];
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_byte]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_SIP_byte]+0;
	echo "<td>$value</td>";
	
	$value=$cstaSmpprow[total_SMSC_to_SMPP_byte]+0;
	echo "<td>$value</td>";
	
	$value=$cstaData[SMSC_to_MAP_byte]+$cstaData[SMSC_to_SIP_byte]+$cstaSmpprow[total_SMSC_to_SMPP_byte];
	echo "<td>$value</td>";
	echo "</tr>";
	
	//Success Percentage
	echo "<tr>";
	echo "<td align=\"left\">Success Percentage</td>";
	$value=GetPercent($cstaData[MAP_to_SMSC_success],$cstaData[MAP_to_SMSC_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaData[SIP_to_SMSC_success],$cstaData[SIP_to_SMSC_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaSmpprow[total_SMPP_to_SMSC_success],$cstaSmpprow[total_SMPP_to_SMSC_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaData[MAP_to_SMSC_success]+$cstaData[SIP_to_SMSC_success]+$cstaSmpprow[total_SMPP_to_SMSC_success],
		$cstaData[MAP_to_SMSC_attempt]+$cstaData[SIP_to_SMSC_attempt]+$cstaSmpprow[total_SMPP_to_SMSC_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaData[SMSC_to_MAP_success],$cstaData[SMSC_to_MAP_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaData[SMSC_to_SIP_success],$cstaData[SMSC_to_SIP_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaSmpprow[total_SMSC_to_SMPP_success],$cstaSmpprow[total_SMSC_to_SMPP_attempt]);
	echo "<td>$value</td>";
	
	$value=GetPercent($cstaData[SMSC_to_MAP_success]+$cstaData[SMSC_to_SIP_success]+$cstaSmpprow[total_SMSC_to_SMPP_success],
		$cstaData[SMSC_to_MAP_attempt]+$cstaData[SMSC_to_SIP_attempt]+$cstaSmpprow[SMSC_to_SMPP_attempt]);
	echo "<td>$value</td>";
	echo "</tr>";
	echo "</table>";
	
	
	// $sm_pending_begin=GetSpecialData(_MIN,"csta_datetime","SM_bgn","CSTA_DB.smscDetailData","csta_datetime>='$startTime' and csta_datetime<='$endTime'");
	// $sm_pending_end=GetSpecialData(_MAX,"csta_datetime","SM_end","CSTA_DB.smscDetailData","csta_datetime>='$startTime' and csta_datetime<='$endTime'");
	// echo "<br><table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";
	// echo "<tr>";
	// echo "<td>Pending SM statistic at beginning:<td>";
	// echo "<td><b>{$sm_pending_begin}</b></td>";
	// echo "</tr>";
	// echo "<tr>";
	// echo "<td>Pending SM statistic at ending:<td>";
	// echo "<td><b>{$sm_pending_end}</b></td>";
	// echo "</tr>";
	// echo "</table>";	
}

//Graphics-1
{
	$cstaHourDataTmp=GetCstaDataByHour($cstaConf,$startTime,$endTime,"detail");
	$cstaHourData=$cstaHourDataTmp[0];
	if(0)
	{
		echo "<pre>";
		print_r($cstaHourData);
		echo "</pre>";
	}
	
	unset($tmpData);
	if($flag0 == "on")
	{
		$tmpColor[]=array(0x00,0x00,0xff);
		for($i=0;$i<$total_hour_num;$i++)
			$ms_smsc_data[$i]=$cstaHourData[MS_to_SMSC_success][$i]+0;
		$tmpData[]=$ms_smsc_data;
	}
	if($flag1 == "on")
	{
		$tmpColor[]=array(0x00,0xff,0x00);
		for($i=0;$i<$total_hour_num;$i++)
			$vms_smsc_data[$i]=$cstaHourData[VMS_to_SMSC_success][$i]+0;
		$tmpData[]=$vms_smsc_data;
	}
	if($flag2 == "on")
	{
		$tmpColor[]=array(0xff,0x00,0x00);
		for($i=0;$i<$total_hour_num;$i++)
			$pps_smsc_data[$i]=$cstaHourData[PPS_to_SMSC_success][$i]+0;
		$tmpData[]=$pps_smsc_data;
	}
	if($flag3 == "on")
	{
		$tmpColor[]=array(0x7d,0x00,0x00);
		for($i=0;$i<$total_hour_num;$i++)
			$smpp_smsc_data[$i]=$cstaHourData[SMPP_to_SMSC_success][$i]+0;
		$tmpData[]=$smpp_smsc_data;
	}
	if($flag4 == "on")
	{
		$tmpColor[]=array(0x00,0x7d,0x00);
		for($i=0;$i<$total_hour_num;$i++)
			$smsc_ms_data[$i]=$cstaHourData[SMSC_to_MS_success][$i]+0;
		$tmpData[]=$smsc_ms_data;
	}
	if($flag5 == "on")
	{
		$tmpColor[]=array(0xff,0x00,0xff);
		for($i=0;$i<$total_hour_num;$i++)
			$smsc_vms_data[$i]=$cstaHourData[SMSC_to_VMS_success][$i]+0;
		$tmpData[]=$smsc_vms_data;
	}
	if($flag6 == "on")
	{
		$tmpColor[]=array(0x66,0x22,0x66);
		for($i=0;$i<$total_hour_num;$i++)
			$smsc_pps_data[$i]=$cstaHourData[SMSC_to_PPS_success][$i]+0;
		$tmpData[]=$smsc_pps_data;
	}
	if($flag7 == "on")
	{
		$tmpColor[]=array(0x88,0x88,0x88);
		for($i=0;$i<$total_hour_num;$i++)
			$smsc_smpp_data[$i]=$cstaHourData[SMSC_to_SMPP_success][$i]+0;
		$tmpData[]=$smsc_smpp_data;
	}
	if(0)
	{
		echo "flag0=$flag0,flag1=$flag1,flag2=$flag2,flag3=$flag3,flag4=$flag4,flag5=$flag5,flag6=$flag6,flag7=$flag7,flag8=$flag8,flag9=$flag9,flag10=$flag10,flag11=$flag11,flag12=$flag12,flag13=$flag13,flag14=$flag14,flag15=$flag15,flag16=$flag16<br>";
	}
	echo "<br><b>SMSC Success Statistic Chart</b><br>";
	
	$boldline=$select_checkbox_id;
	for($i=0;$i<$select_checkbox_id;$i++)
	{
		$param="flag$i";
		if($$param != "on")
			$boldline--;
	}
	
	$image=CreateImage(820,390);
	$image=DrawLineHistogram(
		$image,
		$tmpData,
		$tmpColor,
		750/(24*$slot),
		24,
		array(50,20),
		array(750,280),
		$boldline,1,0,1
	);
	
	$remarkBlock=array(
		"MAP to SMSC",
		"SIP to SMSC",
		"SMPP to SMSC",
		"SMSC to MAP",
		"SMSC to SIP",
		"SMSC to SMPP"
	);
	$pointArr=array(
		array(30,367),
		array(130,367),
		array(230,367),
		array(330,367),
		array(430,367),
		array(530,367),
	);
	
	unset($tmpColor);
	$tmpColor[]=array(0x00,0x00,0xff);
	$tmpColor[]=array(0x00,0xff,0x00);
	$tmpColor[]=array(0xff,0x00,0x00);
	$tmpColor[]=array(0x7d,0x00,0x00);
	$tmpColor[]=array(0x00,0x7d,0x00);
	$tmpColor[]=array(0xff,0x00,0xff);
	$tmpColor[]=array(0x66,0x22,0x66);
	$tmpColor[]=array(0x88,0x88,0x88);
	$image=AddRemarkToImage($image,$pointArr,$remarkBlock,$tmpColor,0,2);
	DrawTimeStamp($image,$sel_date_from,$sel_date_to,array(50,355),750/24);
	
	echo "<table border=0 width=\"820\">";
	echo "<tr>";
	for($i=0;$i<sizeof($remarkBlock);$i++)
	{
		echo "<td>";
		AddCheckbox($remarkBlock[$i]);
		echo "</td>";
	}
	echo "</tr>";
	echo "</table>";
	
	DrawImage($image);
	
}

$nowIndex=$_REQUEST['keyTwo']?$_REQUEST['keyTwo']:0;
$smppSql="select  smppId,SUM(SMPP_to_SMSC_attempt) AS total_SMPP_to_SMSC_attempt,
    SUM(SMPP_to_SMSC_success) AS total_SMPP_to_SMSC_success,
    SUM(SMPP_to_SMSC_sysfail) AS total_SMPP_to_SMSC_sysfail,
    SUM(SMPP_to_SMSC_userfail) AS total_SMPP_to_SMSC_userfail,
    SUM(SMPP_to_SMSC_smfail) AS total_SMPP_to_SMSC_smfail,
    SUM(SMPP_to_SMSC_byte) AS total_SMPP_to_SMSC_byte,
    SUM(SMSC_to_SMPP_attempt) AS total_SMSC_to_SMPP_attempt,
    SUM(SMSC_to_SMPP_success) AS total_SMSC_to_SMPP_success,
    SUM(SMSC_to_SMPP_sysfail) AS total_SMSC_to_SMPP_sysfail,
    SUM(SMSC_to_SMPP_userfail) AS total_SMSC_to_SMPP_userfail,
    SUM(SMSC_to_SMPP_smfail) AS total_SMSC_to_SMPP_smfail,
    SUM(SMSC_to_SMPP_byte) AS total_SMSC_to_SMPP_byte
	 from CSTA_DB.smscSmppData where csta_datetime >= '{$startTime}' and csta_datetime <= '{$endTime}' and smppId=$nowIndex GROUP BY smppId";
$res=mysqli_query($cstaDbConn,$smppSql);
$totalNum=mysqli_num_rows($res);
//echo "$smppSql";
//echo "totalNum$totalNum";
// if(!$totalNum){
// 	echo "<script>alert('SMPP$nowIndex Statistic is null');</script>";
// }
echo mysqli_error($cstaDbConn);
$row=@mysqli_fetch_array($res);
//set downArr upArr

// echo "<pre>";
// print_r($row);
// echo "</pre>";
//Table-1

$indexSelect="select  smppId from CSTA_DB.smscSmppData where csta_datetime >= '{$startTime}' and csta_datetime <= '{$endTime}' ORDER BY smppId ";
$indexRes=mysqli_query($cstaDbConn,$indexSelect);
$num=mysqli_num_rows($indexRes);


{	echo "<br><br><br><br>";
	$table_title="SMPP Statistic&nbsp;&nbsp;Date:";
	if($slot>1)
		$table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")))." to ".date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y")));
	else
		$table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
	echo "<br><b><center>$table_title</center></b>";
	// 添加下拉框
	// echo '<div style="text-align: center; margin-top: 5px;">'; // 可选：添加样式以居中和增加间距
	// echo '<label >SMPP:</label> '; // 标签
	// echo '<select name="indexSel" id="indexSel" onchange="updateTable()">';

	// while ($row = mysqli_fetch_array($indexRes)) {
	// 	$id = $row['index']; // 获取 id
	// 	echo "<option value=\"$id\">$id</option>"; // 生成选项
	// }

	// echo '</select>';
	// echo '</div>';
	echo '<br>';
	echo "<table width=\"99%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td align=\"center\" width=\"11%\">Smpp ID</td>";
	echo "<td align=\"center\" width=\"11%\">SMPP To SMSC Attempt</td>";
	echo "<td align=\"center\" width=\"11%\">SMPP To SMSC Success</td>";
    echo "<td align=\"center\" width=\"11%\">SMPP To SMSC Sysfail</td>";
	echo "<td align=\"center\" width=\"11%\">SMPP To SMSC Userfail</td>";
	echo "<td align=\"center\" width=\"11%\">SMPP To SMSC Smfail</td>";
	echo "<td align=\"center\" width=\"11%\">SMPP To SMSC Byte</td>";
	echo "</tr>";
	




	$value=$row['smppId']+0;
	echo "<td align=\"center\">$value</td>";

	//Attempt
	$value=$row[total_SMPP_to_SMSC_attempt]+0;
	echo "<td align=\"center\">$value</td>";
	
	//Success
	$value=$row[total_SMPP_to_SMSC_success]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	//No Resource
	$value=$row[total_SMPP_to_SMSC_sysfail]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	

	//Negotiation Fail
	$value=$row[total_SMPP_to_SMSC_userfail]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	//Media Error
	$value=$row[total_SMPP_to_SMSC_smfail]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	


	//No Response
	$value=$row[total_SMPP_to_SMSC_byte]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	


	echo "<tr bgcolor=\"#E6E6E6\">";
    echo "<td align=\"center\" width=\"11%\"></td>";
    echo "<td align=\"center\" width=\"11%\">SMSC To SMPP Attempt</td>";
	echo "<td align=\"center\" width=\"11%\">SMSC To SMPP Success</td>";
	echo "<td align=\"center\" width=\"11%\">SMSC To SMPP Sysfail</td>";
	echo "<td align=\"center\" width=\"11%\">SMSC To SMPP Userfail</td>";
	echo "<td align=\"center\" width=\"11%\">SMSC To SMPP Smfail</td>";
	echo "<td align=\"center\" width=\"11%\">SMSC To SMPP Byte</td>";
	echo "</tr>";


	//Average Call Duration
	echo "<td align=\"center\">";
	echo "<br>";
	echo "</td>";

	//Attempt
	$value=$row[total_SMSC_to_SMPP_attempt]+0;
	echo "<td align=\"center\">$value</td>";
	
	//Success
	$value=$row[total_SMSC_to_SMPP_success]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	//No Resource
	$value=$row[total_SMSC_to_SMPP_sysfail]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	//Negotiation Fail
	$value=$row[total_SMSC_to_SMPP_userfail]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	//Media Error
	$value=$row[total_SMSC_to_SMPP_smfail]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	//No Response
	$value=$row[total_SMSC_to_SMPP_byte]+0;
	echo "<td align=\"center\">";
	echo "$value<br>";
	echo "</td>";
	
	echo "</tr>";
	
	echo "</table>";
}
?>
