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 "footer.php";
     if (NoCredit($SellerID)) {
         $title = 'Seller Account not authorized';
         include 'header.php';
         print "<h1>Trading Not Authorized</h1>\n\t\t\t\t<strong>The Seller Account identified in this trade has no trading privileges on {$Systemname}.</strong><p>\n\t\t\t\tThis trade will not be processed.  Please address this with the member in question.  If you have concerns about the behaviour of any member of this system, please contact the <a href='mailto://{$SystemEmail}'>{$Systemname} Administrator</a>,";
         include 'footer.php';
         exit;
     }
 } else {
     if (NoCredit($SellerID)) {
         $title = 'Trading not authorized';
         include 'header.php';
         print "<h1>Trading Not Authorized</h1>\n               \t\t\t<strong>Your account has no trading priveleges on {$Systemname}.</strong><p>\n\t\t\t\tif you think that your account should be authorized to change, or wish to make changes to your account status, please contact the <a href='mailto://{$SystemEmail}'>{$Systemname} Administrator</a>,";
         include 'footer.php';
         exit;
     }
     if (NoCredit($BuyerID)) {
         $title = 'Buyer Account not authorized';
         include 'header.php';
         print "<h1>Trading Not Authorized</h1>\n\t\t\t\t<strong>The Buyer Account identified in this trade has no trading privileges on {$Systemname}.</strong><p>\n\t\t\t\tThis trade will not be processed.  Please address this with the member in question.  If you have concerns about the behaviour of any member of this system, please contact the <a href='mailto://{$SystemEmail}'>{$Systemname} Administrator</a>,";
         include 'footer.php';
         exit;
     }
 }
 /* Check that the "other account" has not expired */
 switch ($EnteredBy) {
     case 'buyer':
         if (IsExpired($SellerID)) {
             $title = "Seller Account Expired";
             include "header.php";
             print "<h1>Unable to Process Trade</h1>\n                \t\t\t<h4>Sorry.</h4>The system is unable to process the inputted trade, because: <p><h2>the identified seller account has expired.</h2><p>";
             include "footer.php";