$sqlw = "SELECT sum(`qty_price`*`num`) AS sumwrt FROM `confirm_tbl` WHERE `type_cde`='WRT' AND xdate BETWEEN '$BeginDate' AND '$EndDate' ";
$resultw=mysql_query($sqlw) or die(mysql_error());
$roww = mysql_fetch_array($resultw);
$sumwrt=$roww['sumwrt'];
number_format($sumwrt,2);
$sqll = "SELECT sum(`qty_price`*`num`) AS sumlst FROM `confirm_tbl` WHERE `type_cde`='LST' AND xdate BETWEEN '$BeginDate' AND '$EndDate' ";
$resultl=mysql_query($sqll) or die(mysql_error());
$rowl = mysql_fetch_array($resultl);
$sumlst=$rowl['sumlst'];
number_format($sumlst,2);
$sqlf = "SELECT sum(`qty_price`*`num`) AS sumfst FROM `confirm_tbl` WHERE `type_cde`='FST' AND xdate BETWEEN '$BeginDate' AND '$EndDate' ";
$resultf=mysql_query($sqlf) or die(mysql_error());
$rowf = mysql_fetch_array($resultf);
$sumfst=$rowf['sumfst'];
number_format($sumfst,2);
echo "<tr>";
echo "<td>"."TOTAL"."</td>"."<td>".$sumwrt."</td>"."<td>".$sumlst."</td>"."<td>".$sumfst."</td>";
echo " </tr>";
$sqlw = "SELECT sum(`qty_price`*`num`) AS sumwrt FROM `confirm_tbl` WHERE `type_cde`='WRT' AND xdate BETWEEN '$BeginDate' AND '$EndDate' ";
$resultw=mysql_query($sqlw) or die(mysql_error());
$roww = mysql_fetch_array($resultw);
$sumwrt=$roww['sumwrt'];
$sumwrt=number_format($sumwrt,2);
$sqll = "SELECT sum(`qty_price`*`num`) AS sumlst FROM `confirm_tbl` WHERE `type_cde`='LST' AND xdate BETWEEN '$BeginDate' AND '$EndDate' ";
$resultl=mysql_query($sqll) or die(mysql_error());
$rowl = mysql_fetch_array($resultl);
$sumlst=$rowl['sumlst'];
$sumlst=number_format($sumlst,2);
$sqlf = "SELECT sum(`qty_price`*`num`) AS sumfst FROM `confirm_tbl` WHERE `type_cde`='FST' AND xdate BETWEEN '$BeginDate' AND '$EndDate' ";
$resultf=mysql_query($sqlf) or die(mysql_error());
$rowf = mysql_fetch_array($resultf);
$sumfst=$rowf['sumfst'];
$sumfst=number_format($sumfst,2);
echo "<tr>";
echo "<td>"."TOTAL"."</td>"."<td>".$sumwrt."</td>"."<td>".$sumlst."</td>"."<td>".$sumfst."</td>";
echo " </tr>";