hi
I have created the php report using below code. It works fine. But My problem is to group the data
example
# Date Code Name Rate Qty Amount#
15.01.2011 0001 Milk 4.01 50 200.50
15.01.2011 0125 Choklet 30.00 10 300.00
15.01.2011 0241 Drink 12.50 12 150.00
16.01.2011 5461 Meat 35.07 10 350.75
16.01.2011 4587 Fish 17.80 5 89.00
total 1090.25
if I take the date range from 15.01.2011 to 16.01.2011, it shows in php page look like above. But if i select
the date range as 15.01.2011 to 16.01.2011, i need look like below
Pls help me
# Date Code Name Rate Qty Amount#
15.01.2011 0001 Milk 4.01 50 200.50
15.01.2011 0125 Choklet 30.00 10 300.00
15.01.2011 0241 Drink 12.50 12 150.00
subtotal 650.50
16.01.2011 5461 Meat 35.07 10 350.75
16.01.2011 4587 Fish 17.80 5 89.00
subtotal 439.75
grand total 1090.25
it is my code
`<?php //include '../templete/header.php'; ?>
<script language="javascript" type="text/javascript">
function printFunction(){
window.print();
}
</script>
<script language="javascript" type="text/javascript">
function PrintGridData() {
var prtGrid = document.getElementById('<%=txtDocNo%>');
prtGrid.border = 0;
var prtwin = window.open('','PrintGridViewData','left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1');
prtwin.document.write(prtGrid.outerHTML);
prtwin.document.close();
prtwin.focus();
prtwin.print();
prtwin.close();
</script>
<table width="100%" align="center" cellpadding="4" cellspacing="1" class=tbl_table">
<tr>
<td class="tbl_header">SO Date</td>
<td class="tbl_header">MV CODE</td>
<td class="tbl_header">MV NAME</td>
<td class="tbl_header">RATE</td>
<td class="tbl_header">SUPP.QTY</td>
<td class="tbl_header">AMT</td>
</tr>
<?php
if(isset($stmt))
{
while($row = $stmt->fetch())
{?>
<tr>
<td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['SODate']));?></td>
<td class="tbl_content"><?php echo $row['MVCode'];?></td>
<td class="tbl_content"><?php echo $row['MVName'];?></td>
<td class="tbl_content_right"><?php echo number_format($row['Rate'],2) ;?></td>
<td class="tbl_content_right"><?php echo number_format($row['Qty']) ;?></td>
<td class="tbl_content_right"><?php echo number_format($row['BalAmt'],2) ;?></td>
</tr>
<?php
$balamt+=$row['BalAmt'];
$qty+=$row['Qty'];
}}?>
<tr><td colspan="9"><hr /></tr>
<tr>
<td colspan="5"></td>
<td class="tbl_content_total"> <?php echo number_format($qty);?></td>
<td class="tbl_content_total"> <?php echo number_format($rtnqty);?></td>
<td class="tbl_content_total"> <?php echo number_format($balqty);?></td>
<td class="tbl_content_total"> <?php echo number_format($balamt,2);?></td>
</tr>
</table>
<?php unset($dbh); unset($stmt); ?>
<?php
include '../templete/footer.php';
?>
'
Regards
Maideen