<?
include "connect.php";
$strSQL1 = "SELECT D_Date , Type , COUNT(Type) AS t2 , Location1 , SUM(Num1) AS v2 , SUM(Amount1) AS a2 FROM Daily WHERE Location1='$Location1' and Type='A' GROUP BY D_Date , Type , Location1 ORDER BY D_Date";
$objQuery1 = mssql_query($strSQL1) or die ("Error Query [".$strSQL1."]");
$strSQL2 = "SELECT D_Date , Type , COUNT(Type) AS t1 , Location2 , SUM(Num2) AS v1 , SUM(Amount2) AS a1 FROM Daily WHERE Location2='$Location2' and Type='B' GROUP BY D_Date , Type , Location2 ORDER BY D_Date";
$objQuery2 = mssql_query($strSQL2) or die ("Error Query [".$strSQL2."]");
$v3 = $v1 + $v2 ;
$a3 = $a1 + $a2 ;
$t3 = $t1 + $t2 ;
$total = ($t3/$v3)*100;
while($objResult1 = mssql_fetch_array($objQuery1))
while($objResult2 = mssql_fetch_array($objQuery2))
{
?>