Location: PHPKode > projects > Total ISP > total-isp/listpurchase-code.php
<?

if (!$n){
	$n=1000;	
}
include "auth.inc.php";
include "mysql.inc.php";

$sql="SELECT PurchaseID, MasterAccounts.CustomerID, FirstName, LastName, Company, PurchaseDate, Cost,GST,
PaymentType,PurchaseDesc, Identifier, ChequeID,
ItemOnly, Approved 
FROM Purchases,MasterAccounts 
WHERE MasterAccounts.CustomerID=SupplierID
AND Month(PurchaseDate)=$month
AND Year(PurchaseDate)=$year
AND PurchaseCode=$purchasecode
ORDER BY ChequeID ASC"; 

$result=mysql_query($sql);
print mysql_error();
?><HTML>
<HEAD>
<TITLE>View Purchases</TITLE>
</HEAD>
<BODY>
<center><H2>Cheque Numbers Purchases</H2>
<TABLE WIDTH=95% border=1>
<TR><th>Edit</TH><TH>Name</TH><TH>Date</TH><TH>Amount</TH><TH>GST</TH><TH>Purchase</TH><TH>Cheque
ID</TH></TR>
<?
while ($row=mysql_fetch_array($result)){
	$i++;
	if ($row[Company])
		$name=$row[Company];
	else
		$name="$row[FirstName] $row[LastName]";
	print "<TR>";
	print "<TD><A HREF=\"purchaseedit.php?ID=$row[PurchaseID]\">$row[PurchaseID]</A></TD>";
	print "<TD><A HREF=\"user.php?ID=$row[CustomerID]\">$name</A></TD>";
	print "<TD NOWRAP>$row[PurchaseDate]</TD>";

	$cost = number_format($row[Cost]+$row[GST],2);
	print "<TD>$cost</TD>";
	print "<TD>".number_format($row[GST],2)."</TD>";
	#print "<TD>";
	#if ($row[Approved]){
	#	print "Yes";
	#	$app++;
	#}else
	#	print "No";
	#print "</TD>";
	print "<TD>$row[PurchaseDesc]</TD>";
	print "<TD>$row[ChequeID]</TD></TR>";
	$pt=$pt+$row[Cost]+$row[GST];
	

	#if (!$row[ItemOnly]){
		$gst+=$row[GST];
		$actual+=$row[Cost]+$row[GST];
	#}
	
}
?></TABLE>
<? if ($security > 90){ ?>
Total Amount in list is $<? echo number_format($pt,2) ?>. Total GST is $<? echo $gst ?>. Approval is <? print number_format(100*$app/$i,2); ?>%.
<FORM>
<P>Relist with <INPUT NAME="n" TYPE=TEXT VALUE=100>
<INPUT TYPE=SUBMIT>
</FORM>
<? } ?>

</CENTER>
</BODY>
</HTML>


Return current item: Total ISP