Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cceadmin/
Upload File :
Current File : /var/www/cesa.co.za/cceadmin/CCEPaymentsview.php

<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "ewmysql7.php" ?>
<?php include "phpfn7.php" ?>
<?php include "CCEPaymentsinfo.php" ?>
<?php include "CCECourseSchedulesinfo.php" ?>
<?php include "CCEStudentsinfo.php" ?>
<?php include "CCEUsersinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$CCEPayments_view = new cCCEPayments_view();
$Page =& $CCEPayments_view;

// Page init
$CCEPayments_view->Page_Init();

// Page main
$CCEPayments_view->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($CCEPayments->Export == "") { ?>
<script type="text/javascript">
<!--

// Create page object
var CCEPayments_view = new ew_Page("CCEPayments_view");

// page properties
CCEPayments_view.PageID = "view"; // page ID
CCEPayments_view.FormID = "fCCEPaymentsview"; // form ID
var EW_PAGE_ID = CCEPayments_view.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
CCEPayments_view.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
CCEPayments_view.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
CCEPayments_view.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<?php } ?>
<p><span class="phpmaker"><?php echo $Language->Phrase("View") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $CCEPayments->TableCaption() ?>
<?php if ($CCEPayments->Export == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $CCEPayments_view->ExportPrintUrl ?>"><img src="images/print.gif" alt="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" title="<?php echo ew_HtmlEncode($Language->Phrase("PrinterFriendly")) ?>" width="16" height="16" border="0"></a>
&nbsp;&nbsp;<a href="<?php echo $CCEPayments_view->ExportExcelUrl ?>"><img src='images/exportxls.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToExcel")) ?>' width='16' height='16' border='0'></a>
&nbsp;&nbsp;<a href="<?php echo $CCEPayments_view->ExportWordUrl ?>"><img src='images/exportdoc.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToWord")) ?>' width='16' height='16' border='0'></a>
&nbsp;&nbsp;<a name="emf_CCEPayments" id="emf_CCEPayments" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_CCEPayments',hdr:ewLanguage.Phrase('ExportToEmail'),key:<?php echo ew_ArrayToJsonAttr($CCEPayments_view->arRecKey) ?>,sel:false});"><img src='images/exportemail.gif' alt='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' title='<?php echo ew_HtmlEncode($Language->Phrase("ExportToEmail")) ?>' width='16' height='16' border='0'></a>
<?php } ?>
<br><br>
<?php if ($CCEPayments->Export == "") { ?>
<a href="<?php echo $CCEPayments_view->ListUrl ?>"><?php echo $Language->Phrase("BackToList") ?></a>&nbsp;
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $CCEPayments_view->AddUrl ?>"><?php echo $Language->Phrase("ViewPageAddLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<a href="<?php echo $CCEPayments_view->EditUrl ?>"><?php echo $Language->Phrase("ViewPageEditLink") ?></a>&nbsp;
<?php } ?>
<?php if ($Security->CanDelete()) { ?>
<a href="<?php echo $CCEPayments_view->DeleteUrl ?>"><?php echo $Language->Phrase("ViewPageDeleteLink") ?></a>&nbsp;
<?php } ?>
<?php } ?>
</span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$CCEPayments_view->ShowMessage();
?>
<p>
<?php if ($CCEPayments->Export == "") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($CCEPayments_view->Pager)) $CCEPayments_view->Pager = new cPrevNextPager($CCEPayments_view->lStartRec, $CCEPayments_view->lDisplayRecs, $CCEPayments_view->lTotalRecs) ?>
<?php if ($CCEPayments_view->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($CCEPayments_view->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($CCEPayments_view->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCEPayments_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CCEPayments_view->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($CCEPayments_view->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $CCEPayments_view->Pager->PageCount ?></span></td>
	</tr></table>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CCEPayments_view->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
	<?php } ?>
<?php } ?>
		</td>
	</tr>
</table>
</form>
<br>
<?php } ?>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<?php if ($CCEPayments->CourseID->Visible) { // CourseID ?>
	<tr<?php echo $CCEPayments->CourseID->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->CourseID->FldCaption() ?></td>
		<td<?php echo $CCEPayments->CourseID->CellAttributes() ?>>
<div<?php echo $CCEPayments->CourseID->ViewAttributes() ?>><?php echo $CCEPayments->CourseID->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->StudentID->Visible) { // StudentID ?>
	<tr<?php echo $CCEPayments->StudentID->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->StudentID->FldCaption() ?></td>
		<td<?php echo $CCEPayments->StudentID->CellAttributes() ?>>
<div<?php echo $CCEPayments->StudentID->ViewAttributes() ?>><?php echo $CCEPayments->StudentID->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->AmountDue->Visible) { // AmountDue ?>
	<tr<?php echo $CCEPayments->AmountDue->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->AmountDue->FldCaption() ?></td>
		<td<?php echo $CCEPayments->AmountDue->CellAttributes() ?>>
<div<?php echo $CCEPayments->AmountDue->ViewAttributes() ?>><?php echo $CCEPayments->AmountDue->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->AmountPaid->Visible) { // AmountPaid ?>
	<tr<?php echo $CCEPayments->AmountPaid->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->AmountPaid->FldCaption() ?></td>
		<td<?php echo $CCEPayments->AmountPaid->CellAttributes() ?>>
<div<?php echo $CCEPayments->AmountPaid->ViewAttributes() ?>><?php echo $CCEPayments->AmountPaid->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->Refund->Visible) { // Refund ?>
	<tr<?php echo $CCEPayments->Refund->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->Refund->FldCaption() ?></td>
		<td<?php echo $CCEPayments->Refund->CellAttributes() ?>>
<div<?php echo $CCEPayments->Refund->ViewAttributes() ?>><?php echo $CCEPayments->Refund->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->AmountOStd->Visible) { // AmountOStd ?>
	<tr<?php echo $CCEPayments->AmountOStd->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->AmountOStd->FldCaption() ?></td>
		<td<?php echo $CCEPayments->AmountOStd->CellAttributes() ?>>
<div<?php echo $CCEPayments->AmountOStd->ViewAttributes() ?>><?php echo $CCEPayments->AmountOStd->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->DatePaid->Visible) { // DatePaid ?>
	<tr<?php echo $CCEPayments->DatePaid->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->DatePaid->FldCaption() ?></td>
		<td<?php echo $CCEPayments->DatePaid->CellAttributes() ?>>
<div<?php echo $CCEPayments->DatePaid->ViewAttributes() ?>><?php echo $CCEPayments->DatePaid->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->Method->Visible) { // Method ?>
	<tr<?php echo $CCEPayments->Method->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->Method->FldCaption() ?></td>
		<td<?php echo $CCEPayments->Method->CellAttributes() ?>>
<div<?php echo $CCEPayments->Method->ViewAttributes() ?>><?php echo $CCEPayments->Method->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->Reference->Visible) { // Reference ?>
	<tr<?php echo $CCEPayments->Reference->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->Reference->FldCaption() ?></td>
		<td<?php echo $CCEPayments->Reference->CellAttributes() ?>>
<div<?php echo $CCEPayments->Reference->ViewAttributes() ?>><?php echo $CCEPayments->Reference->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->AccountNo->Visible) { // AccountNo ?>
	<tr<?php echo $CCEPayments->AccountNo->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->AccountNo->FldCaption() ?></td>
		<td<?php echo $CCEPayments->AccountNo->CellAttributes() ?>>
<div<?php echo $CCEPayments->AccountNo->ViewAttributes() ?>><?php echo $CCEPayments->AccountNo->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->InvoiceDate->Visible) { // InvoiceDate ?>
	<tr<?php echo $CCEPayments->InvoiceDate->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->InvoiceDate->FldCaption() ?></td>
		<td<?php echo $CCEPayments->InvoiceDate->CellAttributes() ?>>
<div<?php echo $CCEPayments->InvoiceDate->ViewAttributes() ?>><?php echo $CCEPayments->InvoiceDate->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->InvoiceNo->Visible) { // InvoiceNo ?>
	<tr<?php echo $CCEPayments->InvoiceNo->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->InvoiceNo->FldCaption() ?></td>
		<td<?php echo $CCEPayments->InvoiceNo->CellAttributes() ?>>
<div<?php echo $CCEPayments->InvoiceNo->ViewAttributes() ?>><?php echo $CCEPayments->InvoiceNo->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->StockCode->Visible) { // StockCode ?>
	<tr<?php echo $CCEPayments->StockCode->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->StockCode->FldCaption() ?></td>
		<td<?php echo $CCEPayments->StockCode->CellAttributes() ?>>
<div<?php echo $CCEPayments->StockCode->ViewAttributes() ?>><?php echo $CCEPayments->StockCode->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->ReceiptNo->Visible) { // ReceiptNo ?>
	<tr<?php echo $CCEPayments->ReceiptNo->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->ReceiptNo->FldCaption() ?></td>
		<td<?php echo $CCEPayments->ReceiptNo->CellAttributes() ?>>
<div<?php echo $CCEPayments->ReceiptNo->ViewAttributes() ?>><?php echo $CCEPayments->ReceiptNo->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->CreditNoteNo->Visible) { // CreditNoteNo ?>
	<tr<?php echo $CCEPayments->CreditNoteNo->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->CreditNoteNo->FldCaption() ?></td>
		<td<?php echo $CCEPayments->CreditNoteNo->CellAttributes() ?>>
<div<?php echo $CCEPayments->CreditNoteNo->ViewAttributes() ?>><?php echo $CCEPayments->CreditNoteNo->ViewValue ?></div></td>
	</tr>
<?php } ?>
<?php if ($CCEPayments->AmountDep->Visible) { // AmountDep ?>
	<tr<?php echo $CCEPayments->AmountDep->RowAttributes ?>>
		<td class="ewTableHeader"><?php echo $CCEPayments->AmountDep->FldCaption() ?></td>
		<td<?php echo $CCEPayments->AmountDep->CellAttributes() ?>>
<div<?php echo $CCEPayments->AmountDep->ViewAttributes() ?>><?php echo $CCEPayments->AmountDep->ViewValue ?></div></td>
	</tr>
<?php } ?>
</table>
</div>
</td></tr></table>
<?php if ($CCEPayments->Export == "") { ?>
<br>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($CCEPayments_view->Pager)) $CCEPayments_view->Pager = new cPrevNextPager($CCEPayments_view->lStartRec, $CCEPayments_view->lDisplayRecs, $CCEPayments_view->lTotalRecs) ?>
<?php if ($CCEPayments_view->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($CCEPayments_view->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($CCEPayments_view->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $CCEPayments_view->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($CCEPayments_view->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($CCEPayments_view->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $CCEPayments_view->PageUrl() ?>start=<?php echo $CCEPayments_view->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $CCEPayments_view->Pager->PageCount ?></span></td>
	</tr></table>
<?php } else { ?>
	<?php if ($Security->CanList()) { ?>
	<?php if ($CCEPayments_view->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoPermission") ?></span>
	<?php } ?>
<?php } ?>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<p>
<?php if ($CCEPayments->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$CCEPayments_view->Page_Terminate();
?>
<?php

//
// Page class
//
class cCCEPayments_view {

	// Page ID
	var $PageID = 'view';

	// Table name
	var $TableName = 'CCEPayments';

	// Page object name
	var $PageObjName = 'CCEPayments_view';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $CCEPayments;
		if ($CCEPayments->UseTokenInUrl) $PageUrl .= "t=" . $CCEPayments->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage);
		if ($sMessage <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm, $CCEPayments;
		if ($CCEPayments->UseTokenInUrl) {
			if ($objForm)
				return ($CCEPayments->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($CCEPayments->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (CCEPayments)
		$GLOBALS["CCEPayments"] = new cCCEPayments();

		// Table object (CCECourseSchedules)
		$GLOBALS['CCECourseSchedules'] = new cCCECourseSchedules();

		// Table object (CCEStudents)
		$GLOBALS['CCEStudents'] = new cCCEStudents();

		// Table object (CCEUsers)
		$GLOBALS['CCEUsers'] = new cCCEUsers();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'view', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'CCEPayments', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $CCEPayments;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->TableName);
		$Security->TablePermission_Loaded();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		if (!$Security->CanView()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("CCEPaymentslist.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$CCEPayments->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$CCEPayments->Export = $_POST["exporttype"];
		} else {
			$CCEPayments->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $CCEPayments->Export; // Get export parameter, used in header
		$gsExportFile = $CCEPayments->TableVar; // Get export file, used in header
		if (@$_GET["PaymentID"] <> "") {
			if ($gsExportFile <> "") $gsExportFile .= "_";
			$gsExportFile .= ew_StripSlashes($_GET["PaymentID"]);
		}
		if ($CCEPayments->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}
		if ($CCEPayments->Export == "word") {
			header('Content-Type: application/vnd.ms-word');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.doc');
		}

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $lDisplayRecs = 1;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $lRecCnt;
	var $arRecKey = array();

	//
	// Page main
	//
	function Page_Main() {
		global $Language, $CCEPayments;

		// Load current record
		$bLoadCurrentRecord = FALSE;
		$sReturnUrl = "";
		$bMatchRecord = FALSE;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET["PaymentID"] <> "") {
				$CCEPayments->PaymentID->setQueryStringValue($_GET["PaymentID"]);
				$this->arRecKey["PaymentID"] = $CCEPayments->PaymentID->QueryStringValue;
			} else {
				$bLoadCurrentRecord = TRUE;
			}

			// Get action
			$CCEPayments->CurrentAction = "I"; // Display form
			switch ($CCEPayments->CurrentAction) {
				case "I": // Get a record to display
					$this->lStartRec = 1; // Initialize start position
					if ($rs = $this->LoadRecordset()) // Load records
						$this->lTotalRecs = $rs->RecordCount(); // Get record count
					if ($this->lTotalRecs <= 0) { // No record found
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$this->Page_Terminate("CCEPaymentslist.php"); // Return to list page
					} elseif ($bLoadCurrentRecord) { // Load current record position
						$this->SetUpStartRec(); // Set up start record position

						// Point to current record
						if (intval($this->lStartRec) <= intval($this->lTotalRecs)) {
							$bMatchRecord = TRUE;
							$rs->Move($this->lStartRec-1);
						}
					} else { // Match key values
						while (!$rs->EOF) {
							if (strval($CCEPayments->PaymentID->CurrentValue) == strval($rs->fields('PaymentID'))) {
								$CCEPayments->setStartRecordNumber($this->lStartRec); // Save record position
								$bMatchRecord = TRUE;
								break;
							} else {
								$this->lStartRec++;
								$rs->MoveNext();
							}
						}
					}
					if (!$bMatchRecord) {
						$this->setMessage($Language->Phrase("NoRecord")); // Set no record message
						$sReturnUrl = "CCEPaymentslist.php"; // No matching record, return to list
					} else {
						$this->LoadRowValues($rs); // Load row values
					}
			}

			// Export data only
			if (in_array($CCEPayments->Export, array("html","word","excel","xml","csv","email"))) {
				$this->ExportData();
				if ($CCEPayments->Export <> "email")
					$this->Page_Terminate(); // Terminate response
				exit();
			}
		} else {
			$sReturnUrl = "CCEPaymentslist.php"; // Not page request, return to list
		}
		if ($sReturnUrl <> "")
			$this->Page_Terminate($sReturnUrl);

		// Render row
		$CCEPayments->RowType = EW_ROWTYPE_VIEW;
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $CCEPayments;
		if ($this->lDisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->lStartRec = $_GET[EW_TABLE_START_REC];
				$CCEPayments->setStartRecordNumber($this->lStartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($this->nPageNo)) {
					$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
					if ($this->lStartRec <= 0) {
						$this->lStartRec = 1;
					} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
						$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
					}
					$CCEPayments->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $CCEPayments->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
			$this->lStartRec = 1; // Reset start record counter
			$CCEPayments->setStartRecordNumber($this->lStartRec);
		} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
			$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
			$CCEPayments->setStartRecordNumber($this->lStartRec);
		} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
			$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
			$CCEPayments->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn, $CCEPayments;

		// Call Recordset Selecting event
		$CCEPayments->Recordset_Selecting($CCEPayments->CurrentFilter);

		// Load List page SQL
		$sSql = $CCEPayments->SelectSQL();
		if ($offset > -1 && $rowcnt > -1)
			$sSql .= " LIMIT $offset, $rowcnt";

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$CCEPayments->Recordset_Selected($rs);
		return $rs;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $CCEPayments;
		$sFilter = $CCEPayments->KeyFilter();

		// Call Row Selecting event
		$CCEPayments->Row_Selecting($sFilter);

		// Load SQL based on filter
		$CCEPayments->CurrentFilter = $sFilter;
		$sSql = $CCEPayments->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$CCEPayments->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $CCEPayments;
		$CCEPayments->PaymentID->setDbValue($rs->fields('PaymentID'));
		$CCEPayments->CourseID->setDbValue($rs->fields('CourseID'));
		$CCEPayments->StudentID->setDbValue($rs->fields('StudentID'));
		$CCEPayments->AmountDue->setDbValue($rs->fields('AmountDue'));
		$CCEPayments->AmountPaid->setDbValue($rs->fields('AmountPaid'));
		$CCEPayments->Refund->setDbValue($rs->fields('Refund'));
		$CCEPayments->AmountOStd->setDbValue($rs->fields('AmountOStd'));
		$CCEPayments->DatePaid->setDbValue($rs->fields('DatePaid'));
		$CCEPayments->Method->setDbValue($rs->fields('Method'));
		$CCEPayments->Reference->setDbValue($rs->fields('Reference'));
		$CCEPayments->AccountNo->setDbValue($rs->fields('AccountNo'));
		$CCEPayments->InvoiceDate->setDbValue($rs->fields('InvoiceDate'));
		$CCEPayments->InvoiceNo->setDbValue($rs->fields('InvoiceNo'));
		$CCEPayments->StockCode->setDbValue($rs->fields('StockCode'));
		$CCEPayments->ReceiptNo->setDbValue($rs->fields('ReceiptNo'));
		$CCEPayments->CreditNoteNo->setDbValue($rs->fields('CreditNoteNo'));
		$CCEPayments->CESADiscount->setDbValue($rs->fields('CESADiscount'));
		$CCEPayments->EBDiscount->setDbValue($rs->fields('EBDiscount'));
		$CCEPayments->AmountDep->setDbValue($rs->fields('AmountDep'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $CCEPayments;

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print&" . "PaymentID=" . urlencode($CCEPayments->PaymentID->CurrentValue);
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html&" . "PaymentID=" . urlencode($CCEPayments->PaymentID->CurrentValue);
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel&" . "PaymentID=" . urlencode($CCEPayments->PaymentID->CurrentValue);
		$this->ExportWordUrl = $this->PageUrl() . "export=word&" . "PaymentID=" . urlencode($CCEPayments->PaymentID->CurrentValue);
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml&" . "PaymentID=" . urlencode($CCEPayments->PaymentID->CurrentValue);
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv&" . "PaymentID=" . urlencode($CCEPayments->PaymentID->CurrentValue);
		$this->AddUrl = $CCEPayments->AddUrl();
		$this->EditUrl = $CCEPayments->EditUrl();
		$this->CopyUrl = $CCEPayments->CopyUrl();
		$this->DeleteUrl = $CCEPayments->DeleteUrl();
		$this->ListUrl = $CCEPayments->ListUrl();

		// Call Row_Rendering event
		$CCEPayments->Row_Rendering();

		// Common render codes for all row types
		// CourseID

		$CCEPayments->CourseID->CellCssStyle = ""; $CCEPayments->CourseID->CellCssClass = "";
		$CCEPayments->CourseID->CellAttrs = array(); $CCEPayments->CourseID->ViewAttrs = array(); $CCEPayments->CourseID->EditAttrs = array();

		// StudentID
		$CCEPayments->StudentID->CellCssStyle = ""; $CCEPayments->StudentID->CellCssClass = "";
		$CCEPayments->StudentID->CellAttrs = array(); $CCEPayments->StudentID->ViewAttrs = array(); $CCEPayments->StudentID->EditAttrs = array();

		// AmountDue
		$CCEPayments->AmountDue->CellCssStyle = ""; $CCEPayments->AmountDue->CellCssClass = "";
		$CCEPayments->AmountDue->CellAttrs = array(); $CCEPayments->AmountDue->ViewAttrs = array(); $CCEPayments->AmountDue->EditAttrs = array();

		// AmountPaid
		$CCEPayments->AmountPaid->CellCssStyle = ""; $CCEPayments->AmountPaid->CellCssClass = "";
		$CCEPayments->AmountPaid->CellAttrs = array(); $CCEPayments->AmountPaid->ViewAttrs = array(); $CCEPayments->AmountPaid->EditAttrs = array();

		// Refund
		$CCEPayments->Refund->CellCssStyle = ""; $CCEPayments->Refund->CellCssClass = "";
		$CCEPayments->Refund->CellAttrs = array(); $CCEPayments->Refund->ViewAttrs = array(); $CCEPayments->Refund->EditAttrs = array();

		// AmountOStd
		$CCEPayments->AmountOStd->CellCssStyle = ""; $CCEPayments->AmountOStd->CellCssClass = "";
		$CCEPayments->AmountOStd->CellAttrs = array(); $CCEPayments->AmountOStd->ViewAttrs = array(); $CCEPayments->AmountOStd->EditAttrs = array();

		// DatePaid
		$CCEPayments->DatePaid->CellCssStyle = ""; $CCEPayments->DatePaid->CellCssClass = "";
		$CCEPayments->DatePaid->CellAttrs = array(); $CCEPayments->DatePaid->ViewAttrs = array(); $CCEPayments->DatePaid->EditAttrs = array();

		// Method
		$CCEPayments->Method->CellCssStyle = ""; $CCEPayments->Method->CellCssClass = "";
		$CCEPayments->Method->CellAttrs = array(); $CCEPayments->Method->ViewAttrs = array(); $CCEPayments->Method->EditAttrs = array();

		// Reference
		$CCEPayments->Reference->CellCssStyle = ""; $CCEPayments->Reference->CellCssClass = "";
		$CCEPayments->Reference->CellAttrs = array(); $CCEPayments->Reference->ViewAttrs = array(); $CCEPayments->Reference->EditAttrs = array();

		// AccountNo
		$CCEPayments->AccountNo->CellCssStyle = ""; $CCEPayments->AccountNo->CellCssClass = "";
		$CCEPayments->AccountNo->CellAttrs = array(); $CCEPayments->AccountNo->ViewAttrs = array(); $CCEPayments->AccountNo->EditAttrs = array();

		// InvoiceDate
		$CCEPayments->InvoiceDate->CellCssStyle = ""; $CCEPayments->InvoiceDate->CellCssClass = "";
		$CCEPayments->InvoiceDate->CellAttrs = array(); $CCEPayments->InvoiceDate->ViewAttrs = array(); $CCEPayments->InvoiceDate->EditAttrs = array();

		// InvoiceNo
		$CCEPayments->InvoiceNo->CellCssStyle = ""; $CCEPayments->InvoiceNo->CellCssClass = "";
		$CCEPayments->InvoiceNo->CellAttrs = array(); $CCEPayments->InvoiceNo->ViewAttrs = array(); $CCEPayments->InvoiceNo->EditAttrs = array();

		// StockCode
		$CCEPayments->StockCode->CellCssStyle = ""; $CCEPayments->StockCode->CellCssClass = "";
		$CCEPayments->StockCode->CellAttrs = array(); $CCEPayments->StockCode->ViewAttrs = array(); $CCEPayments->StockCode->EditAttrs = array();

		// ReceiptNo
		$CCEPayments->ReceiptNo->CellCssStyle = ""; $CCEPayments->ReceiptNo->CellCssClass = "";
		$CCEPayments->ReceiptNo->CellAttrs = array(); $CCEPayments->ReceiptNo->ViewAttrs = array(); $CCEPayments->ReceiptNo->EditAttrs = array();

		// CreditNoteNo
		$CCEPayments->CreditNoteNo->CellCssStyle = ""; $CCEPayments->CreditNoteNo->CellCssClass = "";
		$CCEPayments->CreditNoteNo->CellAttrs = array(); $CCEPayments->CreditNoteNo->ViewAttrs = array(); $CCEPayments->CreditNoteNo->EditAttrs = array();

		// AmountDep
		$CCEPayments->AmountDep->CellCssStyle = ""; $CCEPayments->AmountDep->CellCssClass = "";
		$CCEPayments->AmountDep->CellAttrs = array(); $CCEPayments->AmountDep->ViewAttrs = array(); $CCEPayments->AmountDep->EditAttrs = array();
		if ($CCEPayments->RowType == EW_ROWTYPE_VIEW) { // View row

			// PaymentID
			$CCEPayments->PaymentID->ViewValue = $CCEPayments->PaymentID->CurrentValue;
			$CCEPayments->PaymentID->CssStyle = "";
			$CCEPayments->PaymentID->CssClass = "";
			$CCEPayments->PaymentID->ViewCustomAttributes = "";

			// CourseID
			if (strval($CCEPayments->CourseID->CurrentValue) <> "") {
				$sFilterWrk = "CCECourseSchedules.CCECourseScheduleID = " . ew_AdjustSql($CCEPayments->CourseID->CurrentValue) . "";
			$sSqlWrk = "SELECT CCECourses.CCECourseName AS `CCECourseName`, CCECourseSchedules.StartDate AS `StartDate` FROM CCECourses Inner Join CCECourseSchedules On CCECourseSchedules.CCECourseID = CCECourses.CCECourseID";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY CCECourses.CCECourseName, CCECourseSchedules.StartDate";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEPayments->CourseID->ViewValue = $rswrk->fields('CCECourseName');
					$CCEPayments->CourseID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('StartDate');
					$rswrk->Close();
				} else {
					$CCEPayments->CourseID->ViewValue = $CCEPayments->CourseID->CurrentValue;
				}
			} else {
				$CCEPayments->CourseID->ViewValue = NULL;
			}
			$CCEPayments->CourseID->CssStyle = "";
			$CCEPayments->CourseID->CssClass = "";
			$CCEPayments->CourseID->ViewCustomAttributes = "";

			// StudentID
			if (strval($CCEPayments->StudentID->CurrentValue) <> "") {
				$sFilterWrk = "`CCEStudentID` = " . ew_AdjustSql($CCEPayments->StudentID->CurrentValue) . "";
			$sSqlWrk = "SELECT `FirstName`, `Surname` FROM `CCEStudents`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `Surname`";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$CCEPayments->StudentID->ViewValue = $rswrk->fields('FirstName');
					$CCEPayments->StudentID->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('Surname');
					$rswrk->Close();
				} else {
					$CCEPayments->StudentID->ViewValue = $CCEPayments->StudentID->CurrentValue;
				}
			} else {
				$CCEPayments->StudentID->ViewValue = NULL;
			}
			$CCEPayments->StudentID->CssStyle = "";
			$CCEPayments->StudentID->CssClass = "";
			$CCEPayments->StudentID->ViewCustomAttributes = "";

			// AmountDue
			$CCEPayments->AmountDue->ViewValue = $CCEPayments->AmountDue->CurrentValue;
			$CCEPayments->AmountDue->CssStyle = "";
			$CCEPayments->AmountDue->CssClass = "";
			$CCEPayments->AmountDue->ViewCustomAttributes = "";

			// AmountPaid
			$CCEPayments->AmountPaid->ViewValue = $CCEPayments->AmountPaid->CurrentValue;
			$CCEPayments->AmountPaid->CssStyle = "";
			$CCEPayments->AmountPaid->CssClass = "";
			$CCEPayments->AmountPaid->ViewCustomAttributes = "";

			// Refund
			$CCEPayments->Refund->ViewValue = $CCEPayments->Refund->CurrentValue;
			$CCEPayments->Refund->CssStyle = "";
			$CCEPayments->Refund->CssClass = "";
			$CCEPayments->Refund->ViewCustomAttributes = "";

			// AmountOStd
			$CCEPayments->AmountOStd->ViewValue = $CCEPayments->AmountOStd->CurrentValue;
			$CCEPayments->AmountOStd->CssStyle = "";
			$CCEPayments->AmountOStd->CssClass = "";
			$CCEPayments->AmountOStd->ViewCustomAttributes = "";

			// DatePaid
			$CCEPayments->DatePaid->ViewValue = $CCEPayments->DatePaid->CurrentValue;
			$CCEPayments->DatePaid->ViewValue = ew_FormatDateTime($CCEPayments->DatePaid->ViewValue, 5);
			$CCEPayments->DatePaid->CssStyle = "";
			$CCEPayments->DatePaid->CssClass = "";
			$CCEPayments->DatePaid->ViewCustomAttributes = "";

			// Method
			$CCEPayments->Method->ViewValue = $CCEPayments->Method->CurrentValue;
			$CCEPayments->Method->CssStyle = "";
			$CCEPayments->Method->CssClass = "";
			$CCEPayments->Method->ViewCustomAttributes = "";

			// Reference
			$CCEPayments->Reference->ViewValue = $CCEPayments->Reference->CurrentValue;
			$CCEPayments->Reference->CssStyle = "";
			$CCEPayments->Reference->CssClass = "";
			$CCEPayments->Reference->ViewCustomAttributes = "";

			// AccountNo
			$CCEPayments->AccountNo->ViewValue = $CCEPayments->AccountNo->CurrentValue;
			$CCEPayments->AccountNo->CssStyle = "";
			$CCEPayments->AccountNo->CssClass = "";
			$CCEPayments->AccountNo->ViewCustomAttributes = "";

			// InvoiceDate
			$CCEPayments->InvoiceDate->ViewValue = $CCEPayments->InvoiceDate->CurrentValue;
			$CCEPayments->InvoiceDate->ViewValue = ew_FormatDateTime($CCEPayments->InvoiceDate->ViewValue, 5);
			$CCEPayments->InvoiceDate->CssStyle = "";
			$CCEPayments->InvoiceDate->CssClass = "";
			$CCEPayments->InvoiceDate->ViewCustomAttributes = "";

			// InvoiceNo
			$CCEPayments->InvoiceNo->ViewValue = $CCEPayments->InvoiceNo->CurrentValue;
			$CCEPayments->InvoiceNo->CssStyle = "";
			$CCEPayments->InvoiceNo->CssClass = "";
			$CCEPayments->InvoiceNo->ViewCustomAttributes = "";

			// StockCode
			$CCEPayments->StockCode->ViewValue = $CCEPayments->StockCode->CurrentValue;
			$CCEPayments->StockCode->CssStyle = "";
			$CCEPayments->StockCode->CssClass = "";
			$CCEPayments->StockCode->ViewCustomAttributes = "";

			// ReceiptNo
			$CCEPayments->ReceiptNo->ViewValue = $CCEPayments->ReceiptNo->CurrentValue;
			$CCEPayments->ReceiptNo->CssStyle = "";
			$CCEPayments->ReceiptNo->CssClass = "";
			$CCEPayments->ReceiptNo->ViewCustomAttributes = "";

			// CreditNoteNo
			$CCEPayments->CreditNoteNo->ViewValue = $CCEPayments->CreditNoteNo->CurrentValue;
			$CCEPayments->CreditNoteNo->CssStyle = "";
			$CCEPayments->CreditNoteNo->CssClass = "";
			$CCEPayments->CreditNoteNo->ViewCustomAttributes = "";

			// CESADiscount
			$CCEPayments->CESADiscount->ViewValue = $CCEPayments->CESADiscount->CurrentValue;
			$CCEPayments->CESADiscount->CssStyle = "";
			$CCEPayments->CESADiscount->CssClass = "";
			$CCEPayments->CESADiscount->ViewCustomAttributes = "";

			// EBDiscount
			$CCEPayments->EBDiscount->ViewValue = $CCEPayments->EBDiscount->CurrentValue;
			$CCEPayments->EBDiscount->CssStyle = "";
			$CCEPayments->EBDiscount->CssClass = "";
			$CCEPayments->EBDiscount->ViewCustomAttributes = "";

			// AmountDep
			$CCEPayments->AmountDep->ViewValue = $CCEPayments->AmountDep->CurrentValue;
			$CCEPayments->AmountDep->CssStyle = "";
			$CCEPayments->AmountDep->CssClass = "";
			$CCEPayments->AmountDep->ViewCustomAttributes = "";

			// CourseID
			$CCEPayments->CourseID->HrefValue = "";
			$CCEPayments->CourseID->TooltipValue = "";

			// StudentID
			$CCEPayments->StudentID->HrefValue = "";
			$CCEPayments->StudentID->TooltipValue = "";

			// AmountDue
			$CCEPayments->AmountDue->HrefValue = "";
			$CCEPayments->AmountDue->TooltipValue = "";

			// AmountPaid
			$CCEPayments->AmountPaid->HrefValue = "";
			$CCEPayments->AmountPaid->TooltipValue = "";

			// Refund
			$CCEPayments->Refund->HrefValue = "";
			$CCEPayments->Refund->TooltipValue = "";

			// AmountOStd
			$CCEPayments->AmountOStd->HrefValue = "";
			$CCEPayments->AmountOStd->TooltipValue = "";

			// DatePaid
			$CCEPayments->DatePaid->HrefValue = "";
			$CCEPayments->DatePaid->TooltipValue = "";

			// Method
			$CCEPayments->Method->HrefValue = "";
			$CCEPayments->Method->TooltipValue = "";

			// Reference
			$CCEPayments->Reference->HrefValue = "";
			$CCEPayments->Reference->TooltipValue = "";

			// AccountNo
			$CCEPayments->AccountNo->HrefValue = "";
			$CCEPayments->AccountNo->TooltipValue = "";

			// InvoiceDate
			$CCEPayments->InvoiceDate->HrefValue = "";
			$CCEPayments->InvoiceDate->TooltipValue = "";

			// InvoiceNo
			$CCEPayments->InvoiceNo->HrefValue = "";
			$CCEPayments->InvoiceNo->TooltipValue = "";

			// StockCode
			$CCEPayments->StockCode->HrefValue = "";
			$CCEPayments->StockCode->TooltipValue = "";

			// ReceiptNo
			$CCEPayments->ReceiptNo->HrefValue = "";
			$CCEPayments->ReceiptNo->TooltipValue = "";

			// CreditNoteNo
			$CCEPayments->CreditNoteNo->HrefValue = "";
			$CCEPayments->CreditNoteNo->TooltipValue = "";

			// AmountDep
			$CCEPayments->AmountDep->HrefValue = "";
			$CCEPayments->AmountDep->TooltipValue = "";
		}

		// Call Row Rendered event
		if ($CCEPayments->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$CCEPayments->Row_Rendered();
	}

	// Export data in HTML/CSV/Word/Excel/XML/Email format
	function ExportData() {
		global $CCEPayments;
		$utf8 = FALSE;
		$bSelectLimit = FALSE;

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $CCEPayments->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;
		$this->SetUpStartRec(); // Set up start record position

		// Set the last record to display
		if ($this->lDisplayRecs < 0) {
			$this->lStopRec = $this->lTotalRecs;
		} else {
			$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
		}
		if (!$rs) {
			header("Content-Type:"); // Remove header
			header("Content-Disposition:");
			$this->ShowMessage();
			return;
		}
		if ($CCEPayments->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($CCEPayments, "v");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($CCEPayments->PaymentID);
				$ExportDoc->ExportCaption($CCEPayments->CourseID);
				$ExportDoc->ExportCaption($CCEPayments->StudentID);
				$ExportDoc->ExportCaption($CCEPayments->AmountDue);
				$ExportDoc->ExportCaption($CCEPayments->AmountPaid);
				$ExportDoc->ExportCaption($CCEPayments->Refund);
				$ExportDoc->ExportCaption($CCEPayments->AmountOStd);
				$ExportDoc->ExportCaption($CCEPayments->DatePaid);
				$ExportDoc->ExportCaption($CCEPayments->Method);
				$ExportDoc->ExportCaption($CCEPayments->Reference);
				$ExportDoc->ExportCaption($CCEPayments->AccountNo);
				$ExportDoc->ExportCaption($CCEPayments->InvoiceDate);
				$ExportDoc->ExportCaption($CCEPayments->InvoiceNo);
				$ExportDoc->ExportCaption($CCEPayments->StockCode);
				$ExportDoc->ExportCaption($CCEPayments->ReceiptNo);
				$ExportDoc->ExportCaption($CCEPayments->CreditNoteNo);
				$ExportDoc->ExportCaption($CCEPayments->CESADiscount);
				$ExportDoc->ExportCaption($CCEPayments->EBDiscount);
				$ExportDoc->ExportCaption($CCEPayments->AmountDep);
				$ExportDoc->EndExportRow();
			}
		}

		// Move to first record
		$this->lRecCnt = $this->lStartRec - 1;
		if (!$rs->EOF) {
			$rs->MoveFirst();
			if (!$bSelectLimit && $this->lStartRec > 1)
				$rs->Move($this->lStartRec - 1);
		}
		while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
			$this->lRecCnt++;
			if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
				$this->LoadRowValues($rs);

				// Render row
				$CCEPayments->CssClass = "";
				$CCEPayments->CssStyle = "";
				$CCEPayments->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($CCEPayments->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('PaymentID', $CCEPayments->PaymentID->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('CourseID', $CCEPayments->CourseID->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('StudentID', $CCEPayments->StudentID->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('AmountDue', $CCEPayments->AmountDue->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('AmountPaid', $CCEPayments->AmountPaid->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('Refund', $CCEPayments->Refund->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('AmountOStd', $CCEPayments->AmountOStd->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('DatePaid', $CCEPayments->DatePaid->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('Method', $CCEPayments->Method->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('Reference', $CCEPayments->Reference->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('AccountNo', $CCEPayments->AccountNo->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('InvoiceDate', $CCEPayments->InvoiceDate->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('InvoiceNo', $CCEPayments->InvoiceNo->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('StockCode', $CCEPayments->StockCode->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('ReceiptNo', $CCEPayments->ReceiptNo->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('CreditNoteNo', $CCEPayments->CreditNoteNo->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('CESADiscount', $CCEPayments->CESADiscount->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('EBDiscount', $CCEPayments->EBDiscount->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
					$XmlDoc->AddField('AmountDep', $CCEPayments->AmountDep->ExportValue($CCEPayments->Export, $CCEPayments->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($CCEPayments->PaymentID);
					$ExportDoc->ExportField($CCEPayments->CourseID);
					$ExportDoc->ExportField($CCEPayments->StudentID);
					$ExportDoc->ExportField($CCEPayments->AmountDue);
					$ExportDoc->ExportField($CCEPayments->AmountPaid);
					$ExportDoc->ExportField($CCEPayments->Refund);
					$ExportDoc->ExportField($CCEPayments->AmountOStd);
					$ExportDoc->ExportField($CCEPayments->DatePaid);
					$ExportDoc->ExportField($CCEPayments->Method);
					$ExportDoc->ExportField($CCEPayments->Reference);
					$ExportDoc->ExportField($CCEPayments->AccountNo);
					$ExportDoc->ExportField($CCEPayments->InvoiceDate);
					$ExportDoc->ExportField($CCEPayments->InvoiceNo);
					$ExportDoc->ExportField($CCEPayments->StockCode);
					$ExportDoc->ExportField($CCEPayments->ReceiptNo);
					$ExportDoc->ExportField($CCEPayments->CreditNoteNo);
					$ExportDoc->ExportField($CCEPayments->CESADiscount);
					$ExportDoc->ExportField($CCEPayments->EBDiscount);
					$ExportDoc->ExportField($CCEPayments->AmountDep);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($CCEPayments->Export <> "xml")
			$ExportDoc->ExportFooter();

		// Close recordset
		$rs->Close();

		// Clean output buffer
		if (!EW_DEBUG_ENABLED && ob_get_length())
			ob_end_clean();

		// Write BOM if utf-8
		if ($utf8 && !in_array($CCEPayments->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

		// Write debug message if enabled
		if (EW_DEBUG_ENABLED)
			echo ew_DebugMsg();

		// Output data
		if ($CCEPayments->Export == "xml") {
			header("Content-Type: text/xml");
			echo $XmlDoc->XML();
		} elseif ($CCEPayments->Export == "email") {
			$this->ExportEmail($ExportDoc->Text);
			$this->Page_Terminate($CCEPayments->ExportReturnUrl());
		} else {
			echo $ExportDoc->Text;
		}
	}

	// Export email
	function ExportEmail($EmailContent) {
		global $Language, $CCEPayments;
		$sSender = @$_GET["sender"];
		$sRecipient = @$_GET["recipient"];
		$sCc = @$_GET["cc"];
		$sBcc = @$_GET["bcc"];
		$sContentType = @$_GET["contenttype"];

		// Subject
		$sSubject = ew_StripSlashes(@$_GET["subject"]);
		$sEmailSubject = $sSubject;

		// Message
		$sContent = ew_StripSlashes(@$_GET["message"]);
		$sEmailMessage = $sContent;

		// Check sender
		if ($sSender == "") {
			$this->setMessage($Language->Phrase("EnterSenderEmail"));
			return;
		}
		if (!ew_CheckEmail($sSender)) {
			$this->setMessage($Language->Phrase("EnterProperSenderEmail"));
			return;
		}

		// Check recipient
		if (!ew_CheckEmailList($sRecipient, EW_MAX_EMAIL_RECIPIENT)) {
			$this->setMessage($Language->Phrase("EnterProperRecipientEmail"));
			return;
		}

		// Check cc
		if (!ew_CheckEmailList($sCc, EW_MAX_EMAIL_RECIPIENT)) {
			$this->setMessage($Language->Phrase("EnterProperCcEmail"));
			return;
		}

		// Check bcc
		if (!ew_CheckEmailList($sBcc, EW_MAX_EMAIL_RECIPIENT)) {
			$this->setMessage($Language->Phrase("EnterProperBccEmail"));
			return;
		}

		// Check email sent count
		if (!isset($_SESSION[EW_EXPORT_EMAIL_COUNTER]))
			$_SESSION[EW_EXPORT_EMAIL_COUNTER] = 0;
		if (intval($_SESSION[EW_EXPORT_EMAIL_COUNTER]) > EW_MAX_EMAIL_SENT_COUNT) {
			$this->setMessage($Language->Phrase("ExceedMaxEmailExport"));
			return;
		}
		if ($sEmailMessage <> "") {
			$sEmailMessage = ew_RemoveXSS($sEmailMessage);
			$sEmailMessage .= ($sContentType == "url") ? "\r\n\r\n" : "<br><br>";
		}
		if ($sContentType == "url") {
			$sUrl = ew_ConvertFullUrl(ew_CurrentPage() . "?" . $this->ExportQueryString());
			$sEmailMessage .= $sUrl; // send URL only
		} else {
			$sEmailMessage .= $EmailContent; // send HTML
		}

		// Send email
		$Email = new cEmail();
		$Email->Sender = $sSender; // Sender
		$Email->Recipient = $sRecipient; // Recipient
		$Email->Cc = $sCc; // Cc
		$Email->Bcc = $sBcc; // Bcc
		$Email->Subject = $sEmailSubject; // Subject
		$Email->Content = $sEmailMessage; // Content
		$Email->Format = ($sContentType == "url") ? "text" : "html";
		$Email->Charset = EW_EMAIL_CHARSET;
		$EventArgs = array();
		$bEmailSent = FALSE;
		if ($CCEPayments->Email_Sending($Email, $EventArgs))
			$bEmailSent = $Email->Send();

		// Check email sent status
		if ($bEmailSent) {

			// Update email sent count
			$_SESSION[EW_EXPORT_EMAIL_COUNTER]++;

			// Sent email success
			$this->setMessage($Language->Phrase("SendEmailSuccess"));
		} else {

			// Sent email failure
			$this->setMessage($Email->SendErrDescription);
		}
	}

	// Export QueryString
	function ExportQueryString() {
		global $CCEPayments;

		// Initialize
		$sQry = "export=html";

		// Add record key QueryString
		$sQry .= "&" . substr($CCEPayments->KeyUrl("", ""), 1);
		return $sQry;
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	function Message_Showing(&$msg) {

		// Example:
		//$msg = "your new message";

	}
}
?>