<style> 
td.menu3{
 background-color:#76888f;
 color:white;
 font-family: calibri; 
 font-weight: bold;
}
td.menu4{
 background-color:#F7EDD2;
 color:black;
 font-family: calibri; 
}
a.hoo{
	color:#ACFA58;
}
a.hoo:hover{
	color:pink;
}
td.menu5{
 color:black;
 font-family: calibri; 
}
</style>
<?php
//include("../session.php");
//include("../connect.php");

$user2=$_SESSION['company'];
$id2=$_SESSION['company'];
//////////////////////////////////////////////////////////////////get product rating//////////////////////////////////////////////////////////////////////////
$getAllreview = mysql_query("SELECT userreview.productID,userreview.rating,product.status FROM product INNER JOIN userreview ON product.id=userreview.productID WHERE product.status='available' AND product.companyID='$id2'");
$total1 = mysql_num_rows($getAllreview);
if($total<1){
	$getresult =  0;
}	
else{
	$total2 = 0;
	while($countTotal = mysql_fetch_array($getAllreview)){
		$total2 = $total2 + $countTotal['rating'];
	}
	$totalAll = $total1 * 5;
	$percentProduct = ($total2 / $totalAll)*100;
	$getresult =  round($percentProduct, 0);
}

/////////////////////////////////////////////////////////////////////get company rating///////////////////////////////////////////////////////////////////////////////////
/*$getAllreview2 = mysql_query("SELECT * FROM company_review where companyID='$id2'");
//$total3 = mysql_num_rows($getAllreview2);
$total4 = 0;
while($countTotal2 = mysql_fetch_array($getAllreview2)){
	$total4 = $total4 + $countTotal2['rating'];
}
$totalAll2 = $total3 * 5;
$percentProduct2 = ($total4 / $totalAll2)*100;
$getresult2 =  round($percentProduct2, 2);*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
echo"<fieldset style='width:300'>
<legend><h3>Rating Result</h3></legend>";
echo"<table border = '1' cellpadding = '5' cellspacing = '2' width = '300' style = 'border:solid;border-color:white'>";
//////////////////////////////////////////////
echo"<tr valign='top'>";
/*echo"<td colspan='2' align='center' class='menu5' width='450'><b>Total Mark : 100</b></td></tr>";*/
echo"<td style='width:200' align='left' class='menu3'>Total Product Rating : </td>";
echo"<td style='width:100' align='center' class='menu4'>$getresult / 100</td>";

//////////////////////////////////////////////

/*echo"<td style='width:180' align='left' class='menu3'>Total Company Rating : </br>
	<a href='cDetail.php' class='hoo' rel='facebox'>($id2)</a>
	</td>";
echo"<td style='width:50' align='center' class='menu4'>$getresult2</td>";*/

//////////////////////////////////////////////

/*echo"<td style='width:180' align='left' class='menu3'>Total Rating : </td>";
$getop1 = ($percentProduct *60) / 100;
$getop2 = ($percentProduct2 *40) / 100;
$getop3 = round(($getop1 + $getop2), 2);
echo"<td style='width:50' align='center' class='menu4'>$getop3</td>";*/

echo"</table>";
echo"</fieldset>";
?>
<?php
include("../closeconnection.php");
?>