<?php
session_start();
include_once("init.php");
?>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><strong>Date</strong></td>
<td><strong>Sales ID </strong></td>
<td><strong>Item</strong></td>
<td><strong>Paid</strong></td>
<td><strong>Quantity</strong></td>
<td><strong>Total</strong></td>
<td><strong>Balance</strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
$result = $db->query("SELECT * FROM stock_sales where count1=1 AND custid='138' ");
while ($line = $db->fetchNextObject($result)) {
?>
<tr>
<td><?php $mysqldate=$line->date;
$phpdate = strtotime( $mysqldate );
$phpdate = date("d/m/Y",$phpdate);
echo $phpdate; ?></td>
<td><?php echo $line->transactionid; ?></td>
<td><?php echo $line->stock_name; ?></td>
<td><?php echo $line->payment; ?></td>
<td><?php echo $line->quantity; ?></td>
<td><?php echo $line->subtotal; ?></td>
<td><?php echo $line->balance; ?></td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="right"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><strong>Total Sales </strong></td>
<td width="150"> <?php echo $age = $db->queryUniqueValue("SELECT sum(subtotal) FROM stock_sales where count1=1 AND custid='$custid' ");?></td>
</tr>
<tr>
<td><strong>Received Amount</strong></td>
<td> <?php echo $age = $db->queryUniqueValue("SELECT sum(payment) FROM stock_sales where count1=1 AND custid='$custid' ");?></td>
</tr>
<tr>
<td width="150"><strong>Total OutStanding </strong></td>
<td width="150"> <?php echo $age = $db->queryUniqueValue("SELECT balance FROM customer_details where customerid='$custid' ");?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>