Location: PHPKode > scripts > PHP Online Invoice System > php-online-invoice-system/payment_record.php
<?
/*
 * Exemplar Web hosting
 * http://www.exemplar.biz
 *
 * Title: PHP Online Invoice System
 * Version: 2.0
 * Author: Exemplar
 * Date: 01-01-2006
 *
*/

include('header.php');

?>
  <blockquote>

  <h1>Payment Records</h1>
<br><font color=red size=4><?php if (isset($_GET['message'])) { echo ' - '.$_GET['message']; } ?></font><BR>
<?

if($submit){

echo " Showing Payments from $paydate<br><br>";
$result = mysql_query("SELECT acctrecv.*,clients.*
FROM acctrecv,clients
WHERE acctrecv.clientid = clients.clientid && acctrecv.recv_date > '.$paydate.'");
}
if(!$submit){
echo " This is the $dayofyear2 day of the year.<br>";
echo " Showing Payments from $ytd<br><br>";
$result = mysql_query("SELECT acctrecv.*,clients.*
FROM acctrecv,clients
WHERE acctrecv.clientid = clients.clientid && acctrecv.recv_date > '.$ytd.'");
}
echo "<table border=1 cellspacing=3 cellpadding=2 bordercolor=cccccc>";
echo "<tr>
<td><b>Client ID</b></td>
<td><b>Client Name</b></td>
<td><b>Invoice ID</b></td>
<td><b>Amount</b></td>
<td><b>Payment date</b></td>
<td><b>Comments</b></td>
<td></td></tr>";



while ($row = mysql_fetch_array($result))
{

	$cid = $row["clientid"];
	$invoiceid = $row["invoiceid"];
	$amtrecv = $row["amt_recv"];
	$recvdate = $row["recv_date"];
	$comments = $row["comments"];
	$clientname=$row["name"];


	if ($alternate == "1") {
	$color = "#ffffff";
	$alternate = "2";
	}
	else {
	$color = "#dedede";
	$alternate = "1";
	}
	echo "<tr valign=top bgcolor=$color>
	<td><b>$cid</b></td>
	<td><b>$clientname</b></td>
	<td>$invoiceid</td>
	<td align=right>$amtrecv</td>
	<td>$recvdate</td>
	<td>$comments</td>
	<td>[ <a href=deleterecord.php?invoiceid=$invoiceid onClick=\"return confirm('Are you sure you want to delete this payment record?')\">delete record</a> ]</td></tr>";
}
if($submit){
$result = mysql_query("SELECT sum(amt_recv) AS sum FROM acctrecv  WHERE recv_date >'.$paydate.'");
$sum = mysql_result($result,0,"sum");
}
if(!$submit){

$result = mysql_query("SELECT sum(amt_recv) AS sum FROM acctrecv  WHERE recv_date >'.$ytd.'");
$sum = mysql_result($result,0,"sum");
}
if ($sum == 1){
echo "<tr><td colspan=3></td><td align=right>Total: $$sum</td><td colspan=6></td></tr>";
}else{
echo "<tr><td colspan=3></td><td align=right>Total: <font face=Verdana size=1 color=red>$currency$sum</font></td><td colspan=6></td></tr>";
}
echo "</table>";

?>
<p align="center"><font class="medBold">You can review Payments from previous dates by selecting the red calendar icon below. Payments above are for <?php print (date("Y")); ?>.
</font></p>
<form method="post" name=form1 action="payment_record.php">
<input type="text" name="paydate" id="paydate">
<img src="img.gif" id="f_trigger_c"
     style="cursor: pointer; border: 1px solid red;"
     title="Date selector"
     onmouseover="this.style.background='blue';"
     onmouseout="this.style.background=''" />
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "paydate",
        ifFormat       :    "%Y-%m-%d",
        button         :    "f_trigger_c",
        align          :    "Tl",
        singleClick    :    true
    });
</script>
<input type="Submit" name="submit" value="Submit Payment Date"></form>
</blockquote>
<?
include "footer.php";
?>
Return current item: PHP Online Invoice System