}
    if (empty($Memo)) {
        $Memo = '';
    }
    if (empty($ToAccount)) {
        $ToAccount = '';
    }
    $title = 'Record Payment by Cheque';
    include "header.php";
    PrintForm("{$ChequeID}", "{$Amount}", "{$ToAccount}", "{$Memo}");
    include "footer.php";
    exit;
}
# if we have everything, process
include "verifytrade.php";
$Amount = MakeCurrency($Amount);
if (NoCredit($ToAccount)) {
    $title = 'Unable to Process';
    include "header.php";
    print "<h2>Sale not Valid</h2>\nThe sale could not be processed because the seller account (Account #{$ToAccount}) has no trading priveleges on {$Systemname}.<p>\n<hr><p>/n";
    PrintForm('', '', '', '');
    include "footer.php";
    exit;
}
# verify cheque is good
$ChequeEntry = mysql_query("SELECT * FROM cheques WHERE ChequeID = {$ChequeID}");
if (mysql_num_rows($ChequeEntry) != 1) {
    $title = 'Unable to Process';
    include "header.php";
    print "<h2>Cheque not Valid</h2>\nThe submitted Cheque Number does not exist in the LETSystem Database.  Please verify the cheque number and try again.<p>\n";
    PrintForm('', "{$Amount}", "{$ToAccount}", "{$Memo}");
include "adminlogin.php";
/* check to see if the Function variable is set to Process.  If so, verify
and record all trades. */
if (empty($Function)) {
    $Function = "";
}
if ($Function == 'Process') {
    include "verifytrade.php";
    include "recordtrade.php";
    /* Process each transaction form */
    for ($trade = 0; $trade < 10; $trade++) {
        /* Check that the submitted accounts exist, and that the Amount field is
        numeric */
        $SellerID["{$trade}"] = ExistsAccount($SellerID["{$trade}"]);
        $BuyerID["{$trade}"] = ExistsAccount($BuyerID["{$trade}"]);
        $Amount["{$trade}"] = MakeCurrency($Amount["{$trade}"]);
        /* Don't process if no data is entered, or if only partial data is submitted.
        Set the Result[] variable to contain a response to the user, as appropriate */
        if (empty($SellerID["{$trade}"]) && empty($BuyerID["{$trade}"]) && empty($Description["{$trade}"]) && empty($Amount["{$trade}"])) {
            $Result["{$trade}"] = "No trade data entered.";
        } elseif (empty($SellerID["{$trade}"]) || empty($BuyerID["{$trade}"]) || empty($Description["{$trade}"]) || empty($Amount["{$trade}"])) {
            $Result["{$trade}"] = "Not processed.  <em>Submitted Trade Data incomplete or contains invalid AccountID</em>.";
        } else {
            /* Check for expired accounts */
            if (IsExpired($SellerID["{$trade}"])) {
                $Result["{$trade}"] = "Not Processed.  <em>The Seller account has expired</em>.";
            } elseif (IsExpired($BuyerID["{$trade}"])) {
                $Result["{$trade}"] = "Not Processed.  <em>The Buyer account has expired</em>.";
            } elseif (AccountStatus($BuyerID["{$trade}"]) == 'Suspended' || AccountStatus($BuyerID["{$trade}"]) == 'Suspended from Buy') {
                if (WasWarned($SellerID["{$trade}"], $BuyerID["{$trade}"], 'Suspension')) {
                    $Result["{$trade}"] = "Not Processed. <em>Buyer Account is under suspension and Seller has received a previous warning</em>.";