Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/cpdadmin/
Upload File :
Current File : /var/www/cesa.co.za/cpdadmin/vwCPD_SPLatestlist.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 "vwCPD_SPLatestinfo.php" ?>
<?php include "CPDAdminUsersinfo.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
$vwCPD_SPLatest_list = new cvwCPD_SPLatest_list();
$Page =& $vwCPD_SPLatest_list;

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

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

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

// page properties
vwCPD_SPLatest_list.PageID = "list"; // page ID
vwCPD_SPLatest_list.FormID = "fvwCPD_SPLatestlist"; // form ID
var EW_PAGE_ID = vwCPD_SPLatest_list.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
vwCPD_SPLatest_list.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) { ?>
vwCPD_SPLatest_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
vwCPD_SPLatest_list.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</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 } ?>
<?php if ($vwCPD_SPLatest->Export == "") { ?>
<?php } ?>
<?php
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$vwCPD_SPLatest_list->lTotalRecs = $vwCPD_SPLatest->SelectRecordCount();
	} else {
		if ($rs = $vwCPD_SPLatest_list->LoadRecordset())
			$vwCPD_SPLatest_list->lTotalRecs = $rs->RecordCount();
	}
	$vwCPD_SPLatest_list->lStartRec = 1;
	if ($vwCPD_SPLatest_list->lDisplayRecs <= 0 || ($vwCPD_SPLatest->Export <> "" && $vwCPD_SPLatest->ExportAll)) // Display all records
		$vwCPD_SPLatest_list->lDisplayRecs = $vwCPD_SPLatest_list->lTotalRecs;
	if (!($vwCPD_SPLatest->Export <> "" && $vwCPD_SPLatest->ExportAll))
		$vwCPD_SPLatest_list->SetUpStartRec(); // Set up start record position
	if ($bSelectLimit)
		$rs = $vwCPD_SPLatest_list->LoadRecordset($vwCPD_SPLatest_list->lStartRec-1, $vwCPD_SPLatest_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeVIEW") ?><?php echo $vwCPD_SPLatest->TableCaption() ?>
<?php if ($vwCPD_SPLatest->Export == "" && $vwCPD_SPLatest->CurrentAction == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $vwCPD_SPLatest_list->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 $vwCPD_SPLatest_list->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 $vwCPD_SPLatest_list->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_vwCPD_SPLatest" id="emf_vwCPD_SPLatest" href="javascript:void(0);" onclick="ew_EmailDialogShow({lnk:'emf_vwCPD_SPLatest',hdr:ewLanguage.Phrase('ExportToEmail'),f:document.fvwCPD_SPLatestlist,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 } ?>
</span></p>
<?php if ($Security->IsLoggedIn()) { ?>
<?php if ($vwCPD_SPLatest->Export == "" && $vwCPD_SPLatest->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(vwCPD_SPLatest_list);" style="text-decoration: none;"><img id="vwCPD_SPLatest_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("Search") ?></span><br>
<div id="vwCPD_SPLatest_list_SearchPanel">
<form name="fvwCPD_SPLatestlistsrch" id="fvwCPD_SPLatestlistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<input type="hidden" id="t" name="t" value="vwCPD_SPLatest">
<table class="ewBasicSearch">
	<tr>
		<td><span class="phpmaker">
			<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($vwCPD_SPLatest->getSessionBasicSearchKeyword()) ?>">
			<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">&nbsp;
			<a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>&nbsp;
		</span></td>
	</tr>
	<tr>
	<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($vwCPD_SPLatest->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($vwCPD_SPLatest->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($vwCPD_SPLatest->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
	</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$vwCPD_SPLatest_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<?php if ($vwCPD_SPLatest->Export == "") { ?>
<div class="ewGridUpperPanel">
<?php if ($vwCPD_SPLatest->CurrentAction <> "gridadd" && $vwCPD_SPLatest->CurrentAction <> "gridedit") { ?>
<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($vwCPD_SPLatest_list->Pager)) $vwCPD_SPLatest_list->Pager = new cPrevNextPager($vwCPD_SPLatest_list->lStartRec, $vwCPD_SPLatest_list->lDisplayRecs, $vwCPD_SPLatest_list->lTotalRecs) ?>
<?php if ($vwCPD_SPLatest_list->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 ($vwCPD_SPLatest_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 ($vwCPD_SPLatest_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 $vwCPD_SPLatest_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($vwCPD_SPLatest_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 ($vwCPD_SPLatest_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 $vwCPD_SPLatest_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $vwCPD_SPLatest_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $vwCPD_SPLatest_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $vwCPD_SPLatest_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($vwCPD_SPLatest_list->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 } ?>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<span class="phpmaker">
</span>
</div>
<?php } ?>
<form name="fvwCPD_SPLatestlist" id="fvwCPD_SPLatestlist" class="ewForm" action="" method="post">
<div id="gmp_vwCPD_SPLatest" class="ewGridMiddlePanel">
<?php if ($vwCPD_SPLatest_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $vwCPD_SPLatest->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$vwCPD_SPLatest_list->RenderListOptions();

// Render list options (header, left)
$vwCPD_SPLatest_list->ListOptions->Render("header", "left");
?>
<?php if ($vwCPD_SPLatest->CPDProviderID->Visible) { // CPDProviderID ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->CPDProviderID) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->CPDProviderID->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->CPDProviderID) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->CPDProviderID->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->CPDProviderID->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->CPDProviderID->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->CompanyName->Visible) { // CompanyName ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->CompanyName) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->CompanyName->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->CompanyName) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->CompanyName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->CompanyName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->CompanyName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->TradingAs->Visible) { // TradingAs ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->TradingAs) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->TradingAs->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->TradingAs) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->TradingAs->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->TradingAs->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->TradingAs->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactTitle->Visible) { // ContactTitle ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactTitle) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactTitle->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactTitle) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactTitle->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactTitle->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactTitle->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactInitials->Visible) { // ContactInitials ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactInitials) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactInitials->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactInitials) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactInitials->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactInitials->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactInitials->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactFirstName->Visible) { // ContactFirstName ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactFirstName) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactFirstName->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactFirstName) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactFirstName->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactFirstName->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactFirstName->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactSurname->Visible) { // ContactSurname ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactSurname) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactSurname->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactSurname) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactSurname->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactSurname->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactSurname->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactPosition->Visible) { // ContactPosition ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactPosition) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactPosition->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactPosition) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactPosition->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactPosition->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactPosition->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactIDNum->Visible) { // ContactIDNum ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactIDNum) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactIDNum->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactIDNum) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactIDNum->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactIDNum->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactIDNum->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->PhoneNumber->Visible) { // PhoneNumber ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->PhoneNumber) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->PhoneNumber->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->PhoneNumber) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->PhoneNumber->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->PhoneNumber->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->PhoneNumber->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactEmail->Visible) { // ContactEmail ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactEmail) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactEmail->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactEmail) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactEmail->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactEmail->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactEmail->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->DateUpdated->Visible) { // DateUpdated ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateUpdated) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->DateUpdated->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateUpdated) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->DateUpdated->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->DateUpdated->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->DateUpdated->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactPhone->Visible) { // ContactPhone ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactPhone) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactPhone->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactPhone) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactPhone->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactPhone->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactPhone->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->Approved->Visible) { // Approved ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->Approved) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->Approved->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->Approved) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->Approved->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->Approved->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->Approved->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->DateAssessed->Visible) { // DateAssessed ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateAssessed) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->DateAssessed->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateAssessed) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->DateAssessed->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->DateAssessed->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->DateAssessed->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->EmailAddress->Visible) { // EmailAddress ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->EmailAddress) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->EmailAddress->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->EmailAddress) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->EmailAddress->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->EmailAddress->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->EmailAddress->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->SPNumber->Visible) { // SPNumber ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->SPNumber) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->SPNumber->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->SPNumber) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->SPNumber->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->SPNumber->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->SPNumber->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->DateExpires->Visible) { // DateExpires ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateExpires) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->DateExpires->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateExpires) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->DateExpires->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->DateExpires->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->DateExpires->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->CellNumber->Visible) { // CellNumber ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->CellNumber) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->CellNumber->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->CellNumber) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->CellNumber->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->CellNumber->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->CellNumber->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->ContactCell->Visible) { // ContactCell ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactCell) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->ContactCell->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->ContactCell) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->ContactCell->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->ContactCell->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->ContactCell->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->DatePaid->Visible) { // DatePaid ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DatePaid) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->DatePaid->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DatePaid) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->DatePaid->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->DatePaid->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->DatePaid->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->NumReminders->Visible) { // NumReminders ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->NumReminders) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->NumReminders->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->NumReminders) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->NumReminders->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->NumReminders->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->NumReminders->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->LastReminder->Visible) { // LastReminder ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->LastReminder) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->LastReminder->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->LastReminder) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->LastReminder->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->LastReminder->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->LastReminder->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->PrevSPNumber->Visible) { // PrevSPNumber ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->PrevSPNumber) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->PrevSPNumber->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->PrevSPNumber) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->PrevSPNumber->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->PrevSPNumber->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->PrevSPNumber->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->Renewal->Visible) { // Renewal ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->Renewal) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->Renewal->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->Renewal) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->Renewal->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->Renewal->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->Renewal->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($vwCPD_SPLatest->DateCreated->Visible) { // DateCreated ?>
	<?php if ($vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateCreated) == "") { ?>
		<td><?php echo $vwCPD_SPLatest->DateCreated->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vwCPD_SPLatest->SortUrl($vwCPD_SPLatest->DateCreated) ?>',2);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $vwCPD_SPLatest->DateCreated->FldCaption() ?></td><td style="width: 10px;"><?php if ($vwCPD_SPLatest->DateCreated->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vwCPD_SPLatest->DateCreated->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$vwCPD_SPLatest_list->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<?php
if ($vwCPD_SPLatest->ExportAll && $vwCPD_SPLatest->Export <> "") {
	$vwCPD_SPLatest_list->lStopRec = $vwCPD_SPLatest_list->lTotalRecs;
} else {
	$vwCPD_SPLatest_list->lStopRec = $vwCPD_SPLatest_list->lStartRec + $vwCPD_SPLatest_list->lDisplayRecs - 1; // Set the last record to display
}
$vwCPD_SPLatest_list->lRecCount = $vwCPD_SPLatest_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
	$rs->MoveFirst();
	if (!$bSelectLimit && $vwCPD_SPLatest_list->lStartRec > 1)
		$rs->Move($vwCPD_SPLatest_list->lStartRec - 1);
}

// Initialize aggregate
$vwCPD_SPLatest->RowType = EW_ROWTYPE_AGGREGATEINIT;
$vwCPD_SPLatest_list->RenderRow();
$vwCPD_SPLatest_list->lRowCnt = 0;
while (($vwCPD_SPLatest->CurrentAction == "gridadd" || !$rs->EOF) &&
	$vwCPD_SPLatest_list->lRecCount < $vwCPD_SPLatest_list->lStopRec) {
	$vwCPD_SPLatest_list->lRecCount++;
	if (intval($vwCPD_SPLatest_list->lRecCount) >= intval($vwCPD_SPLatest_list->lStartRec)) {
		$vwCPD_SPLatest_list->lRowCnt++;

	// Init row class and style
	$vwCPD_SPLatest->CssClass = "";
	$vwCPD_SPLatest->CssStyle = "";
	$vwCPD_SPLatest->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
	if ($vwCPD_SPLatest->CurrentAction == "gridadd") {
		$vwCPD_SPLatest_list->LoadDefaultValues(); // Load default values
	} else {
		$vwCPD_SPLatest_list->LoadRowValues($rs); // Load row values
	}
	$vwCPD_SPLatest->RowType = EW_ROWTYPE_VIEW; // Render view

	// Render row
	$vwCPD_SPLatest_list->RenderRow();

	// Render list options
	$vwCPD_SPLatest_list->RenderListOptions();
?>
	<tr<?php echo $vwCPD_SPLatest->RowAttributes() ?>>
<?php

// Render list options (body, left)
$vwCPD_SPLatest_list->ListOptions->Render("body", "left");
?>
	<?php if ($vwCPD_SPLatest->CPDProviderID->Visible) { // CPDProviderID ?>
		<td<?php echo $vwCPD_SPLatest->CPDProviderID->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->CPDProviderID->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->CPDProviderID->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->CompanyName->Visible) { // CompanyName ?>
		<td<?php echo $vwCPD_SPLatest->CompanyName->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->CompanyName->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->CompanyName->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->TradingAs->Visible) { // TradingAs ?>
		<td<?php echo $vwCPD_SPLatest->TradingAs->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->TradingAs->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->TradingAs->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactTitle->Visible) { // ContactTitle ?>
		<td<?php echo $vwCPD_SPLatest->ContactTitle->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactTitle->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactTitle->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactInitials->Visible) { // ContactInitials ?>
		<td<?php echo $vwCPD_SPLatest->ContactInitials->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactInitials->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactInitials->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactFirstName->Visible) { // ContactFirstName ?>
		<td<?php echo $vwCPD_SPLatest->ContactFirstName->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactFirstName->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactFirstName->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactSurname->Visible) { // ContactSurname ?>
		<td<?php echo $vwCPD_SPLatest->ContactSurname->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactSurname->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactSurname->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactPosition->Visible) { // ContactPosition ?>
		<td<?php echo $vwCPD_SPLatest->ContactPosition->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactPosition->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactPosition->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactIDNum->Visible) { // ContactIDNum ?>
		<td<?php echo $vwCPD_SPLatest->ContactIDNum->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactIDNum->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactIDNum->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->PhoneNumber->Visible) { // PhoneNumber ?>
		<td<?php echo $vwCPD_SPLatest->PhoneNumber->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->PhoneNumber->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->PhoneNumber->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactEmail->Visible) { // ContactEmail ?>
		<td<?php echo $vwCPD_SPLatest->ContactEmail->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactEmail->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactEmail->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->DateUpdated->Visible) { // DateUpdated ?>
		<td<?php echo $vwCPD_SPLatest->DateUpdated->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->DateUpdated->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->DateUpdated->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactPhone->Visible) { // ContactPhone ?>
		<td<?php echo $vwCPD_SPLatest->ContactPhone->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactPhone->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactPhone->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->Approved->Visible) { // Approved ?>
		<td<?php echo $vwCPD_SPLatest->Approved->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->Approved->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->Approved->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->DateAssessed->Visible) { // DateAssessed ?>
		<td<?php echo $vwCPD_SPLatest->DateAssessed->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->DateAssessed->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->DateAssessed->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->EmailAddress->Visible) { // EmailAddress ?>
		<td<?php echo $vwCPD_SPLatest->EmailAddress->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->EmailAddress->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->EmailAddress->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->SPNumber->Visible) { // SPNumber ?>
		<td<?php echo $vwCPD_SPLatest->SPNumber->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->SPNumber->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->SPNumber->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->DateExpires->Visible) { // DateExpires ?>
		<td<?php echo $vwCPD_SPLatest->DateExpires->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->DateExpires->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->DateExpires->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->CellNumber->Visible) { // CellNumber ?>
		<td<?php echo $vwCPD_SPLatest->CellNumber->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->CellNumber->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->CellNumber->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->ContactCell->Visible) { // ContactCell ?>
		<td<?php echo $vwCPD_SPLatest->ContactCell->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->ContactCell->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->ContactCell->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->DatePaid->Visible) { // DatePaid ?>
		<td<?php echo $vwCPD_SPLatest->DatePaid->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->DatePaid->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->DatePaid->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->NumReminders->Visible) { // NumReminders ?>
		<td<?php echo $vwCPD_SPLatest->NumReminders->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->NumReminders->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->NumReminders->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->LastReminder->Visible) { // LastReminder ?>
		<td<?php echo $vwCPD_SPLatest->LastReminder->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->LastReminder->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->LastReminder->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->PrevSPNumber->Visible) { // PrevSPNumber ?>
		<td<?php echo $vwCPD_SPLatest->PrevSPNumber->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->PrevSPNumber->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->PrevSPNumber->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->Renewal->Visible) { // Renewal ?>
		<td<?php echo $vwCPD_SPLatest->Renewal->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->Renewal->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->Renewal->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($vwCPD_SPLatest->DateCreated->Visible) { // DateCreated ?>
		<td<?php echo $vwCPD_SPLatest->DateCreated->CellAttributes() ?>>
<div<?php echo $vwCPD_SPLatest->DateCreated->ViewAttributes() ?>><?php echo $vwCPD_SPLatest->DateCreated->ListViewValue() ?></div>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$vwCPD_SPLatest_list->ListOptions->Render("body", "right");
?>
	</tr>
<?php
	}
	if ($vwCPD_SPLatest->CurrentAction <> "gridadd")
		$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php

// Close recordset
if ($rs)
	$rs->Close();
?>
<?php if ($vwCPD_SPLatest_list->lTotalRecs > 0) { ?>
<?php if ($vwCPD_SPLatest->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($vwCPD_SPLatest->CurrentAction <> "gridadd" && $vwCPD_SPLatest->CurrentAction <> "gridedit") { ?>
<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($vwCPD_SPLatest_list->Pager)) $vwCPD_SPLatest_list->Pager = new cPrevNextPager($vwCPD_SPLatest_list->lStartRec, $vwCPD_SPLatest_list->lDisplayRecs, $vwCPD_SPLatest_list->lTotalRecs) ?>
<?php if ($vwCPD_SPLatest_list->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 ($vwCPD_SPLatest_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 ($vwCPD_SPLatest_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 $vwCPD_SPLatest_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($vwCPD_SPLatest_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 ($vwCPD_SPLatest_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $vwCPD_SPLatest_list->PageUrl() ?>start=<?php echo $vwCPD_SPLatest_list->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 $vwCPD_SPLatest_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $vwCPD_SPLatest_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $vwCPD_SPLatest_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $vwCPD_SPLatest_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($vwCPD_SPLatest_list->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 } ?>
		</td>
	</tr>
</table>
</form>
<?php } ?>
<?php //if ($vwCPD_SPLatest_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
</span>
<?php //} ?>
</div>
<?php } ?>
<?php } ?>
</td></tr></table>
<?php if ($vwCPD_SPLatest->Export == "" && $vwCPD_SPLatest->CurrentAction == "") { ?>
<?php } ?>
<?php if ($vwCPD_SPLatest->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
$vwCPD_SPLatest_list->Page_Terminate();
?>
<?php

//
// Page class
//
class cvwCPD_SPLatest_list {

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

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

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

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

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $vwCPD_SPLatest;
		if ($vwCPD_SPLatest->UseTokenInUrl) $PageUrl .= "t=" . $vwCPD_SPLatest->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, $vwCPD_SPLatest;
		if ($vwCPD_SPLatest->UseTokenInUrl) {
			if ($objForm)
				return ($vwCPD_SPLatest->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($vwCPD_SPLatest->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

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

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

		// Table object (vwCPD_SPLatest)
		$GLOBALS["vwCPD_SPLatest"] = new cvwCPD_SPLatest();

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print";
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
		$this->ExportWordUrl = $this->PageUrl() . "export=word";
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
		$this->AddUrl = $GLOBALS["vwCPD_SPLatest"]->AddUrl();
		$this->InlineAddUrl = $this->PageUrl() . "a=add";
		$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
		$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
		$this->MultiDeleteUrl = "vwCPD_SPLatestdelete.php";
		$this->MultiUpdateUrl = "vwCPD_SPLatestupdate.php";

		// Table object (CPDAdminUsers)
		$GLOBALS['CPDAdminUsers'] = new cCPDAdminUsers();

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

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

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

		// Open connection
		$conn = ew_Connect();

		// List options
		$this->ListOptions = new cListOptions();
	}

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

		// User profile
		$UserProfile = new cUserProfile();
		$UserProfile->LoadProfile(@$_SESSION[EW_SESSION_USER_PROFILE]);

		// Security
		$Security = new cAdvancedSecurity();
		if (IsPasswordExpired())
			$this->Page_Terminate("changepwd.php");
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

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

	// Class variables
	var $ListOptions; // List options
	var $lDisplayRecs = 20;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $sSrchWhere = ""; // Search WHERE clause
	var $lRecCnt = 0; // Record count
	var $lEditRowCnt;
	var $lRowCnt;
	var $lRowIndex; // Row index
	var $lRecPerRow = 0;
	var $lColCnt = 0;
	var $sDbMasterFilter = ""; // Master filter
	var $sDbDetailFilter = ""; // Detail filter
	var $bMasterRecordExists;	
	var $sMultiSelectKey;
	var $RestoreSearch;

	//
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsSearchError, $Security, $vwCPD_SPLatest;

		// Search filters
		$sSrchAdvanced = ""; // Advanced search filter
		$sSrchBasic = ""; // Basic search filter
		$sFilter = "";
		if ($this->IsPageRequest()) { // Validate request

			// Handle reset command
			$this->ResetCmd();

			// Set up list options
			$this->SetupListOptions();

			// Get basic search values
			$this->LoadBasicSearchValues();

			// Restore search parms from Session
			$this->RestoreSearchParms();

			// Call Recordset SearchValidated event
			$vwCPD_SPLatest->Recordset_SearchValidated();

			// Set up sorting order
			$this->SetUpSortOrder();

			// Get basic search criteria
			if ($gsSearchError == "")
				$sSrchBasic = $this->BasicSearchWhere();
		}

		// Restore display records
		if ($vwCPD_SPLatest->getRecordsPerPage() <> "") {
			$this->lDisplayRecs = $vwCPD_SPLatest->getRecordsPerPage(); // Restore from Session
		} else {
			$this->lDisplayRecs = 20; // Load default
		}

		// Load Sorting Order
		$this->LoadSortOrder();

		// Build search criteria
		if ($sSrchAdvanced <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
		if ($sSrchBasic <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;

		// Call Recordset_Searching event
		$vwCPD_SPLatest->Recordset_Searching($this->sSrchWhere);

		// Save search criteria
		if ($this->sSrchWhere <> "") {
			if ($sSrchBasic == "")
				$this->ResetBasicSearchParms();
			$vwCPD_SPLatest->setSearchWhere($this->sSrchWhere); // Save to Session
			if (!$this->RestoreSearch) {
				$this->lStartRec = 1; // Reset start record counter
				$vwCPD_SPLatest->setStartRecordNumber($this->lStartRec);
			}
		} else {
			$this->sSrchWhere = $vwCPD_SPLatest->getSearchWhere();
		}

		// Build filter
		$sFilter = "";
		if ($this->sDbDetailFilter <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
		if ($this->sSrchWhere <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;

		// Set up filter in session
		$vwCPD_SPLatest->setSessionWhere($sFilter);
		$vwCPD_SPLatest->CurrentFilter = "";

		// Export data only
		if (in_array($vwCPD_SPLatest->Export, array("html","word","excel","xml","csv","email"))) {
			$this->ExportData();
			if ($vwCPD_SPLatest->Export <> "email")
				$this->Page_Terminate(); // Terminate response
			exit();
		}
	}

	// Return basic search SQL
	function BasicSearchSQL($Keyword) {
		global $vwCPD_SPLatest;
		$sKeyword = ew_AdjustSql($Keyword);
		$sWhere = "";
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->CompanyName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->TradingAs, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactTitle, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactInitials, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactFirstName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactSurname, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactPosition, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactIDNum, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhoneNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactEmail, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->Password, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhysicalAddress1, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhysicalAddress2, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhysicalCity, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhysicalCode, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhysicalProvince, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PhysicalCountry, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PostalAddress1, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PostalAddress2, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PostalCity, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PostalCode, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PostalProvince, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PostalCountry, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->Website, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->VATNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->UpdatedBy, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactPhone, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminTitle, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminInitials, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminFirstName, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminSurname, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminPosition, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminIDNum, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminEmail, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminPhone, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->Approved, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->EmailAddress, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->SPNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->InvoiceCode, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->InvoiceNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->Comments, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->CellNumber, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ContactCell, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->AdminCell, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->InvoiceFile, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->ProofOfPayment, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->EvaluatorInvoice, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->EvaluatorTimesheet, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $vwCPD_SPLatest->PrevSPNumber, $Keyword);
		return $sWhere;
	}

	// Build basic search SQL
	function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
		$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
		$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
		if ($lFldDataType == EW_DATATYPE_NUMBER) {
			$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
		} else {
			$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
		}
		if ($Where <> "") $Where .= " OR ";
		$Where .= $sWrk;
	}

	// Return basic search WHERE clause based on search keyword and type
	function BasicSearchWhere() {
		global $Security, $vwCPD_SPLatest;
		$sSearchStr = "";
		$sSearchKeyword = $vwCPD_SPLatest->BasicSearchKeyword;
		$sSearchType = $vwCPD_SPLatest->BasicSearchType;
		if ($sSearchKeyword <> "") {
			$sSearch = trim($sSearchKeyword);
			if ($sSearchType <> "") {
				while (strpos($sSearch, "  ") !== FALSE)
					$sSearch = str_replace("  ", " ", $sSearch);
				$arKeyword = explode(" ", trim($sSearch));
				foreach ($arKeyword as $sKeyword) {
					if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
					$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
				}
			} else {
				$sSearchStr = $this->BasicSearchSQL($sSearch);
			}
		}
		if ($sSearchKeyword <> "") {
			$vwCPD_SPLatest->setSessionBasicSearchKeyword($sSearchKeyword);
			$vwCPD_SPLatest->setSessionBasicSearchType($sSearchType);
		}
		return $sSearchStr;
	}

	// Clear all search parameters
	function ResetSearchParms() {
		global $vwCPD_SPLatest;

		// Clear search WHERE clause
		$this->sSrchWhere = "";
		$vwCPD_SPLatest->setSearchWhere($this->sSrchWhere);

		// Clear basic search parameters
		$this->ResetBasicSearchParms();
	}

	// Clear all basic search parameters
	function ResetBasicSearchParms() {
		global $vwCPD_SPLatest;
		$vwCPD_SPLatest->setSessionBasicSearchKeyword("");
		$vwCPD_SPLatest->setSessionBasicSearchType("");
	}

	// Restore all search parameters
	function RestoreSearchParms() {
		global $vwCPD_SPLatest;
		$bRestore = TRUE;
		if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
		$this->RestoreSearch = $bRestore;
		if ($bRestore) {

			// Restore basic search values
			$vwCPD_SPLatest->BasicSearchKeyword = $vwCPD_SPLatest->getSessionBasicSearchKeyword();
			$vwCPD_SPLatest->BasicSearchType = $vwCPD_SPLatest->getSessionBasicSearchType();
		}
	}

	// Set up sort parameters
	function SetUpSortOrder() {
		global $vwCPD_SPLatest;

		// Check for Ctrl pressed
		$bCtrl = (@$_GET["ctrl"] <> "");

		// Check for "order" parameter
		if (@$_GET["order"] <> "") {
			$vwCPD_SPLatest->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
			$vwCPD_SPLatest->CurrentOrderType = @$_GET["ordertype"];
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->CPDProviderID, $bCtrl); // CPDProviderID
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->CompanyName, $bCtrl); // CompanyName
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->TradingAs, $bCtrl); // TradingAs
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactTitle, $bCtrl); // ContactTitle
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactInitials, $bCtrl); // ContactInitials
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactFirstName, $bCtrl); // ContactFirstName
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactSurname, $bCtrl); // ContactSurname
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactPosition, $bCtrl); // ContactPosition
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactIDNum, $bCtrl); // ContactIDNum
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->PhoneNumber, $bCtrl); // PhoneNumber
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactEmail, $bCtrl); // ContactEmail
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->DateUpdated, $bCtrl); // DateUpdated
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactPhone, $bCtrl); // ContactPhone
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->Approved, $bCtrl); // Approved
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->DateAssessed, $bCtrl); // DateAssessed
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->EmailAddress, $bCtrl); // EmailAddress
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->SPNumber, $bCtrl); // SPNumber
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->DateExpires, $bCtrl); // DateExpires
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->CellNumber, $bCtrl); // CellNumber
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->ContactCell, $bCtrl); // ContactCell
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->DatePaid, $bCtrl); // DatePaid
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->NumReminders, $bCtrl); // NumReminders
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->LastReminder, $bCtrl); // LastReminder
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->PrevSPNumber, $bCtrl); // PrevSPNumber
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->Renewal, $bCtrl); // Renewal
			$vwCPD_SPLatest->UpdateSort($vwCPD_SPLatest->DateCreated, $bCtrl); // DateCreated
			$vwCPD_SPLatest->setStartRecordNumber(1); // Reset start position
		}
	}

	// Load sort order parameters
	function LoadSortOrder() {
		global $vwCPD_SPLatest;
		$sOrderBy = $vwCPD_SPLatest->getSessionOrderBy(); // Get ORDER BY from Session
		if ($sOrderBy == "") {
			if ($vwCPD_SPLatest->SqlOrderBy() <> "") {
				$sOrderBy = $vwCPD_SPLatest->SqlOrderBy();
				$vwCPD_SPLatest->setSessionOrderBy($sOrderBy);
			}
		}
	}

	// Reset command
	// cmd=reset (Reset search parameters)
	// cmd=resetall (Reset search and master/detail parameters)
	// cmd=resetsort (Reset sort parameters)
	function ResetCmd() {
		global $vwCPD_SPLatest;

		// Get reset command
		if (@$_GET["cmd"] <> "") {
			$sCmd = $_GET["cmd"];

			// Reset search criteria
			if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
				$this->ResetSearchParms();

			// Reset sorting order
			if (strtolower($sCmd) == "resetsort") {
				$sOrderBy = "";
				$vwCPD_SPLatest->setSessionOrderBy($sOrderBy);
				$vwCPD_SPLatest->CPDProviderID->setSort("");
				$vwCPD_SPLatest->CompanyName->setSort("");
				$vwCPD_SPLatest->TradingAs->setSort("");
				$vwCPD_SPLatest->ContactTitle->setSort("");
				$vwCPD_SPLatest->ContactInitials->setSort("");
				$vwCPD_SPLatest->ContactFirstName->setSort("");
				$vwCPD_SPLatest->ContactSurname->setSort("");
				$vwCPD_SPLatest->ContactPosition->setSort("");
				$vwCPD_SPLatest->ContactIDNum->setSort("");
				$vwCPD_SPLatest->PhoneNumber->setSort("");
				$vwCPD_SPLatest->ContactEmail->setSort("");
				$vwCPD_SPLatest->DateUpdated->setSort("");
				$vwCPD_SPLatest->ContactPhone->setSort("");
				$vwCPD_SPLatest->Approved->setSort("");
				$vwCPD_SPLatest->DateAssessed->setSort("");
				$vwCPD_SPLatest->EmailAddress->setSort("");
				$vwCPD_SPLatest->SPNumber->setSort("");
				$vwCPD_SPLatest->DateExpires->setSort("");
				$vwCPD_SPLatest->CellNumber->setSort("");
				$vwCPD_SPLatest->ContactCell->setSort("");
				$vwCPD_SPLatest->DatePaid->setSort("");
				$vwCPD_SPLatest->NumReminders->setSort("");
				$vwCPD_SPLatest->LastReminder->setSort("");
				$vwCPD_SPLatest->PrevSPNumber->setSort("");
				$vwCPD_SPLatest->Renewal->setSort("");
				$vwCPD_SPLatest->DateCreated->setSort("");
			}

			// Reset start position
			$this->lStartRec = 1;
			$vwCPD_SPLatest->setStartRecordNumber($this->lStartRec);
		}
	}

	// Set up list options
	function SetupListOptions() {
		global $Security, $vwCPD_SPLatest;

		// "detail_CPDServiceProvider"
		$this->ListOptions->Add("detail_CPDServiceProvider");
		$item =& $this->ListOptions->Items["detail_CPDServiceProvider"];
		$item->CssStyle = "white-space: nowrap;";
		$item->Visible = $Security->IsLoggedIn();
		$item->OnLeft = FALSE;

		// Call ListOptions_Load event
		$this->ListOptions_Load();
		if ($vwCPD_SPLatest->Export <> "" ||
			$vwCPD_SPLatest->CurrentAction == "gridadd" ||
			$vwCPD_SPLatest->CurrentAction == "gridedit")
			$this->ListOptions->HideAllOptions();
	}

	// Render list options
	function RenderListOptions() {
		global $Security, $Language, $vwCPD_SPLatest;
		$this->ListOptions->LoadDefault();

		// "detail_CPDServiceProvider"
		$oListOpt =& $this->ListOptions->Items["detail_CPDServiceProvider"];
		if ($Security->IsLoggedIn()) {
			$oListOpt->Body = "<img src=\"images/detail.gif\" alt=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" title=\"" . ew_HtmlEncode($Language->Phrase("DetailLink")) . "\" width=\"16\" height=\"16\" border=\"0\">" . $Language->TablePhrase("CPDServiceProvider", "TblCaption");
			$oListOpt->Body = "<a href=\"CPDServiceProviderlist.php?" . EW_TABLE_SHOW_MASTER . "=vwCPD_SPLatest&CPDProviderID=" . urlencode(strval($vwCPD_SPLatest->CPDProviderID->CurrentValue)) . "\">" . $oListOpt->Body . "</a>";
		}
		$this->RenderListOptionsExt();

		// Call ListOptions_Rendered event
		$this->ListOptions_Rendered();
	}

	function RenderListOptionsExt() {
		global $Security, $Language, $vwCPD_SPLatest;
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $vwCPD_SPLatest;
		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];
				$vwCPD_SPLatest->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;
					}
					$vwCPD_SPLatest->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $vwCPD_SPLatest->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
			$vwCPD_SPLatest->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
			$vwCPD_SPLatest->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
			$vwCPD_SPLatest->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load basic search values
	function LoadBasicSearchValues() {
		global $vwCPD_SPLatest;
		$vwCPD_SPLatest->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
		$vwCPD_SPLatest->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
	}

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

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

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

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

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

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $vwCPD_SPLatest;
		$vwCPD_SPLatest->CPDProviderID->setDbValue($rs->fields('CPDProviderID'));
		$vwCPD_SPLatest->CompanyName->setDbValue($rs->fields('CompanyName'));
		$vwCPD_SPLatest->TradingAs->setDbValue($rs->fields('TradingAs'));
		$vwCPD_SPLatest->ContactTitle->setDbValue($rs->fields('ContactTitle'));
		$vwCPD_SPLatest->ContactInitials->setDbValue($rs->fields('ContactInitials'));
		$vwCPD_SPLatest->ContactFirstName->setDbValue($rs->fields('ContactFirstName'));
		$vwCPD_SPLatest->ContactSurname->setDbValue($rs->fields('ContactSurname'));
		$vwCPD_SPLatest->ContactPosition->setDbValue($rs->fields('ContactPosition'));
		$vwCPD_SPLatest->ContactIDNum->setDbValue($rs->fields('ContactIDNum'));
		$vwCPD_SPLatest->PhoneNumber->setDbValue($rs->fields('PhoneNumber'));
		$vwCPD_SPLatest->ContactEmail->setDbValue($rs->fields('ContactEmail'));
		$vwCPD_SPLatest->Password->setDbValue($rs->fields('Password'));
		$vwCPD_SPLatest->PhysicalAddress1->setDbValue($rs->fields('PhysicalAddress1'));
		$vwCPD_SPLatest->PhysicalAddress2->setDbValue($rs->fields('PhysicalAddress2'));
		$vwCPD_SPLatest->PhysicalCity->setDbValue($rs->fields('PhysicalCity'));
		$vwCPD_SPLatest->PhysicalCode->setDbValue($rs->fields('PhysicalCode'));
		$vwCPD_SPLatest->PhysicalProvince->setDbValue($rs->fields('PhysicalProvince'));
		$vwCPD_SPLatest->PhysicalCountry->setDbValue($rs->fields('PhysicalCountry'));
		$vwCPD_SPLatest->PostalAddress1->setDbValue($rs->fields('PostalAddress1'));
		$vwCPD_SPLatest->PostalAddress2->setDbValue($rs->fields('PostalAddress2'));
		$vwCPD_SPLatest->PostalCity->setDbValue($rs->fields('PostalCity'));
		$vwCPD_SPLatest->PostalCode->setDbValue($rs->fields('PostalCode'));
		$vwCPD_SPLatest->PostalProvince->setDbValue($rs->fields('PostalProvince'));
		$vwCPD_SPLatest->PostalCountry->setDbValue($rs->fields('PostalCountry'));
		$vwCPD_SPLatest->Website->setDbValue($rs->fields('Website'));
		$vwCPD_SPLatest->VATNumber->setDbValue($rs->fields('VATNumber'));
		$vwCPD_SPLatest->DateUpdated->setDbValue($rs->fields('DateUpdated'));
		$vwCPD_SPLatest->UpdatedBy->setDbValue($rs->fields('UpdatedBy'));
		$vwCPD_SPLatest->Archived->setDbValue($rs->fields('Archived'));
		$vwCPD_SPLatest->ContactPhone->setDbValue($rs->fields('ContactPhone'));
		$vwCPD_SPLatest->AdminTitle->setDbValue($rs->fields('AdminTitle'));
		$vwCPD_SPLatest->AdminInitials->setDbValue($rs->fields('AdminInitials'));
		$vwCPD_SPLatest->AdminFirstName->setDbValue($rs->fields('AdminFirstName'));
		$vwCPD_SPLatest->AdminSurname->setDbValue($rs->fields('AdminSurname'));
		$vwCPD_SPLatest->AdminPosition->setDbValue($rs->fields('AdminPosition'));
		$vwCPD_SPLatest->AdminIDNum->setDbValue($rs->fields('AdminIDNum'));
		$vwCPD_SPLatest->AdminEmail->setDbValue($rs->fields('AdminEmail'));
		$vwCPD_SPLatest->AdminPhone->setDbValue($rs->fields('AdminPhone'));
		$vwCPD_SPLatest->Approved->setDbValue($rs->fields('Approved'));
		$vwCPD_SPLatest->DateAssessed->setDbValue($rs->fields('DateAssessed'));
		$vwCPD_SPLatest->EmailAddress->setDbValue($rs->fields('EmailAddress'));
		$vwCPD_SPLatest->SPNumber->setDbValue($rs->fields('SPNumber'));
		$vwCPD_SPLatest->DateExpires->setDbValue($rs->fields('DateExpires'));
		$vwCPD_SPLatest->EvaluatorID->setDbValue($rs->fields('EvaluatorID'));
		$vwCPD_SPLatest->EvaluatorID2->setDbValue($rs->fields('EvaluatorID2'));
		$vwCPD_SPLatest->EvaluatorID3->setDbValue($rs->fields('EvaluatorID3'));
		$vwCPD_SPLatest->InvoiceCode->setDbValue($rs->fields('InvoiceCode'));
		$vwCPD_SPLatest->InvoiceNumber->setDbValue($rs->fields('InvoiceNumber'));
		$vwCPD_SPLatest->Cost->setDbValue($rs->fields('Cost'));
		$vwCPD_SPLatest->EvaluatorFee->setDbValue($rs->fields('EvaluatorFee'));
		$vwCPD_SPLatest->EvaluatorFeeAmount->setDbValue($rs->fields('EvaluatorFeeAmount'));
		$vwCPD_SPLatest->EvaluatorFeeDate->setDbValue($rs->fields('EvaluatorFeeDate'));
		$vwCPD_SPLatest->Comments->setDbValue($rs->fields('Comments'));
		$vwCPD_SPLatest->CellNumber->setDbValue($rs->fields('CellNumber'));
		$vwCPD_SPLatest->ContactCell->setDbValue($rs->fields('ContactCell'));
		$vwCPD_SPLatest->AdminCell->setDbValue($rs->fields('AdminCell'));
		$vwCPD_SPLatest->DepositAmt->setDbValue($rs->fields('DepositAmt'));
		$vwCPD_SPLatest->InvoiceFile->setDbValue($rs->fields('InvoiceFile'));
		$vwCPD_SPLatest->InvoiceDate->setDbValue($rs->fields('InvoiceDate'));
		$vwCPD_SPLatest->DatePaid->setDbValue($rs->fields('DatePaid'));
		$vwCPD_SPLatest->ProofOfPayment->setDbValue($rs->fields('ProofOfPayment'));
		$vwCPD_SPLatest->EvaluatorInvoice->setDbValue($rs->fields('EvaluatorInvoice'));
		$vwCPD_SPLatest->EvaluatorTimesheet->setDbValue($rs->fields('EvaluatorTimesheet'));
		$vwCPD_SPLatest->NumReminders->setDbValue($rs->fields('NumReminders'));
		$vwCPD_SPLatest->LastReminder->setDbValue($rs->fields('LastReminder'));
		$vwCPD_SPLatest->PrevSPNumber->setDbValue($rs->fields('PrevSPNumber'));
		$vwCPD_SPLatest->Renewal->setDbValue($rs->fields('Renewal'));
		$vwCPD_SPLatest->DateCreated->setDbValue($rs->fields('DateCreated'));
	}

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

		// Initialize URLs
		$this->ViewUrl = $vwCPD_SPLatest->ViewUrl();
		$this->EditUrl = $vwCPD_SPLatest->EditUrl();
		$this->InlineEditUrl = $vwCPD_SPLatest->InlineEditUrl();
		$this->CopyUrl = $vwCPD_SPLatest->CopyUrl();
		$this->InlineCopyUrl = $vwCPD_SPLatest->InlineCopyUrl();
		$this->DeleteUrl = $vwCPD_SPLatest->DeleteUrl();

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

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

		$vwCPD_SPLatest->CPDProviderID->CellCssStyle = ""; $vwCPD_SPLatest->CPDProviderID->CellCssClass = "";
		$vwCPD_SPLatest->CPDProviderID->CellAttrs = array(); $vwCPD_SPLatest->CPDProviderID->ViewAttrs = array(); $vwCPD_SPLatest->CPDProviderID->EditAttrs = array();

		// CompanyName
		$vwCPD_SPLatest->CompanyName->CellCssStyle = ""; $vwCPD_SPLatest->CompanyName->CellCssClass = "";
		$vwCPD_SPLatest->CompanyName->CellAttrs = array(); $vwCPD_SPLatest->CompanyName->ViewAttrs = array(); $vwCPD_SPLatest->CompanyName->EditAttrs = array();

		// TradingAs
		$vwCPD_SPLatest->TradingAs->CellCssStyle = ""; $vwCPD_SPLatest->TradingAs->CellCssClass = "";
		$vwCPD_SPLatest->TradingAs->CellAttrs = array(); $vwCPD_SPLatest->TradingAs->ViewAttrs = array(); $vwCPD_SPLatest->TradingAs->EditAttrs = array();

		// ContactTitle
		$vwCPD_SPLatest->ContactTitle->CellCssStyle = ""; $vwCPD_SPLatest->ContactTitle->CellCssClass = "";
		$vwCPD_SPLatest->ContactTitle->CellAttrs = array(); $vwCPD_SPLatest->ContactTitle->ViewAttrs = array(); $vwCPD_SPLatest->ContactTitle->EditAttrs = array();

		// ContactInitials
		$vwCPD_SPLatest->ContactInitials->CellCssStyle = ""; $vwCPD_SPLatest->ContactInitials->CellCssClass = "";
		$vwCPD_SPLatest->ContactInitials->CellAttrs = array(); $vwCPD_SPLatest->ContactInitials->ViewAttrs = array(); $vwCPD_SPLatest->ContactInitials->EditAttrs = array();

		// ContactFirstName
		$vwCPD_SPLatest->ContactFirstName->CellCssStyle = ""; $vwCPD_SPLatest->ContactFirstName->CellCssClass = "";
		$vwCPD_SPLatest->ContactFirstName->CellAttrs = array(); $vwCPD_SPLatest->ContactFirstName->ViewAttrs = array(); $vwCPD_SPLatest->ContactFirstName->EditAttrs = array();

		// ContactSurname
		$vwCPD_SPLatest->ContactSurname->CellCssStyle = ""; $vwCPD_SPLatest->ContactSurname->CellCssClass = "";
		$vwCPD_SPLatest->ContactSurname->CellAttrs = array(); $vwCPD_SPLatest->ContactSurname->ViewAttrs = array(); $vwCPD_SPLatest->ContactSurname->EditAttrs = array();

		// ContactPosition
		$vwCPD_SPLatest->ContactPosition->CellCssStyle = ""; $vwCPD_SPLatest->ContactPosition->CellCssClass = "";
		$vwCPD_SPLatest->ContactPosition->CellAttrs = array(); $vwCPD_SPLatest->ContactPosition->ViewAttrs = array(); $vwCPD_SPLatest->ContactPosition->EditAttrs = array();

		// ContactIDNum
		$vwCPD_SPLatest->ContactIDNum->CellCssStyle = ""; $vwCPD_SPLatest->ContactIDNum->CellCssClass = "";
		$vwCPD_SPLatest->ContactIDNum->CellAttrs = array(); $vwCPD_SPLatest->ContactIDNum->ViewAttrs = array(); $vwCPD_SPLatest->ContactIDNum->EditAttrs = array();

		// PhoneNumber
		$vwCPD_SPLatest->PhoneNumber->CellCssStyle = ""; $vwCPD_SPLatest->PhoneNumber->CellCssClass = "";
		$vwCPD_SPLatest->PhoneNumber->CellAttrs = array(); $vwCPD_SPLatest->PhoneNumber->ViewAttrs = array(); $vwCPD_SPLatest->PhoneNumber->EditAttrs = array();

		// ContactEmail
		$vwCPD_SPLatest->ContactEmail->CellCssStyle = ""; $vwCPD_SPLatest->ContactEmail->CellCssClass = "";
		$vwCPD_SPLatest->ContactEmail->CellAttrs = array(); $vwCPD_SPLatest->ContactEmail->ViewAttrs = array(); $vwCPD_SPLatest->ContactEmail->EditAttrs = array();

		// DateUpdated
		$vwCPD_SPLatest->DateUpdated->CellCssStyle = ""; $vwCPD_SPLatest->DateUpdated->CellCssClass = "";
		$vwCPD_SPLatest->DateUpdated->CellAttrs = array(); $vwCPD_SPLatest->DateUpdated->ViewAttrs = array(); $vwCPD_SPLatest->DateUpdated->EditAttrs = array();

		// ContactPhone
		$vwCPD_SPLatest->ContactPhone->CellCssStyle = ""; $vwCPD_SPLatest->ContactPhone->CellCssClass = "";
		$vwCPD_SPLatest->ContactPhone->CellAttrs = array(); $vwCPD_SPLatest->ContactPhone->ViewAttrs = array(); $vwCPD_SPLatest->ContactPhone->EditAttrs = array();

		// Approved
		$vwCPD_SPLatest->Approved->CellCssStyle = ""; $vwCPD_SPLatest->Approved->CellCssClass = "";
		$vwCPD_SPLatest->Approved->CellAttrs = array(); $vwCPD_SPLatest->Approved->ViewAttrs = array(); $vwCPD_SPLatest->Approved->EditAttrs = array();

		// DateAssessed
		$vwCPD_SPLatest->DateAssessed->CellCssStyle = ""; $vwCPD_SPLatest->DateAssessed->CellCssClass = "";
		$vwCPD_SPLatest->DateAssessed->CellAttrs = array(); $vwCPD_SPLatest->DateAssessed->ViewAttrs = array(); $vwCPD_SPLatest->DateAssessed->EditAttrs = array();

		// EmailAddress
		$vwCPD_SPLatest->EmailAddress->CellCssStyle = ""; $vwCPD_SPLatest->EmailAddress->CellCssClass = "";
		$vwCPD_SPLatest->EmailAddress->CellAttrs = array(); $vwCPD_SPLatest->EmailAddress->ViewAttrs = array(); $vwCPD_SPLatest->EmailAddress->EditAttrs = array();

		// SPNumber
		$vwCPD_SPLatest->SPNumber->CellCssStyle = ""; $vwCPD_SPLatest->SPNumber->CellCssClass = "";
		$vwCPD_SPLatest->SPNumber->CellAttrs = array(); $vwCPD_SPLatest->SPNumber->ViewAttrs = array(); $vwCPD_SPLatest->SPNumber->EditAttrs = array();

		// DateExpires
		$vwCPD_SPLatest->DateExpires->CellCssStyle = ""; $vwCPD_SPLatest->DateExpires->CellCssClass = "";
		$vwCPD_SPLatest->DateExpires->CellAttrs = array(); $vwCPD_SPLatest->DateExpires->ViewAttrs = array(); $vwCPD_SPLatest->DateExpires->EditAttrs = array();

		// CellNumber
		$vwCPD_SPLatest->CellNumber->CellCssStyle = ""; $vwCPD_SPLatest->CellNumber->CellCssClass = "";
		$vwCPD_SPLatest->CellNumber->CellAttrs = array(); $vwCPD_SPLatest->CellNumber->ViewAttrs = array(); $vwCPD_SPLatest->CellNumber->EditAttrs = array();

		// ContactCell
		$vwCPD_SPLatest->ContactCell->CellCssStyle = ""; $vwCPD_SPLatest->ContactCell->CellCssClass = "";
		$vwCPD_SPLatest->ContactCell->CellAttrs = array(); $vwCPD_SPLatest->ContactCell->ViewAttrs = array(); $vwCPD_SPLatest->ContactCell->EditAttrs = array();

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

		// NumReminders
		$vwCPD_SPLatest->NumReminders->CellCssStyle = ""; $vwCPD_SPLatest->NumReminders->CellCssClass = "";
		$vwCPD_SPLatest->NumReminders->CellAttrs = array(); $vwCPD_SPLatest->NumReminders->ViewAttrs = array(); $vwCPD_SPLatest->NumReminders->EditAttrs = array();

		// LastReminder
		$vwCPD_SPLatest->LastReminder->CellCssStyle = ""; $vwCPD_SPLatest->LastReminder->CellCssClass = "";
		$vwCPD_SPLatest->LastReminder->CellAttrs = array(); $vwCPD_SPLatest->LastReminder->ViewAttrs = array(); $vwCPD_SPLatest->LastReminder->EditAttrs = array();

		// PrevSPNumber
		$vwCPD_SPLatest->PrevSPNumber->CellCssStyle = ""; $vwCPD_SPLatest->PrevSPNumber->CellCssClass = "";
		$vwCPD_SPLatest->PrevSPNumber->CellAttrs = array(); $vwCPD_SPLatest->PrevSPNumber->ViewAttrs = array(); $vwCPD_SPLatest->PrevSPNumber->EditAttrs = array();

		// Renewal
		$vwCPD_SPLatest->Renewal->CellCssStyle = ""; $vwCPD_SPLatest->Renewal->CellCssClass = "";
		$vwCPD_SPLatest->Renewal->CellAttrs = array(); $vwCPD_SPLatest->Renewal->ViewAttrs = array(); $vwCPD_SPLatest->Renewal->EditAttrs = array();

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

			// CPDProviderID
			$vwCPD_SPLatest->CPDProviderID->ViewValue = $vwCPD_SPLatest->CPDProviderID->CurrentValue;
			$vwCPD_SPLatest->CPDProviderID->CssStyle = "";
			$vwCPD_SPLatest->CPDProviderID->CssClass = "";
			$vwCPD_SPLatest->CPDProviderID->ViewCustomAttributes = "";

			// CompanyName
			$vwCPD_SPLatest->CompanyName->ViewValue = $vwCPD_SPLatest->CompanyName->CurrentValue;
			$vwCPD_SPLatest->CompanyName->CssStyle = "";
			$vwCPD_SPLatest->CompanyName->CssClass = "";
			$vwCPD_SPLatest->CompanyName->ViewCustomAttributes = "";

			// TradingAs
			$vwCPD_SPLatest->TradingAs->ViewValue = $vwCPD_SPLatest->TradingAs->CurrentValue;
			$vwCPD_SPLatest->TradingAs->CssStyle = "";
			$vwCPD_SPLatest->TradingAs->CssClass = "";
			$vwCPD_SPLatest->TradingAs->ViewCustomAttributes = "";

			// ContactTitle
			$vwCPD_SPLatest->ContactTitle->ViewValue = $vwCPD_SPLatest->ContactTitle->CurrentValue;
			$vwCPD_SPLatest->ContactTitle->CssStyle = "";
			$vwCPD_SPLatest->ContactTitle->CssClass = "";
			$vwCPD_SPLatest->ContactTitle->ViewCustomAttributes = "";

			// ContactInitials
			$vwCPD_SPLatest->ContactInitials->ViewValue = $vwCPD_SPLatest->ContactInitials->CurrentValue;
			$vwCPD_SPLatest->ContactInitials->CssStyle = "";
			$vwCPD_SPLatest->ContactInitials->CssClass = "";
			$vwCPD_SPLatest->ContactInitials->ViewCustomAttributes = "";

			// ContactFirstName
			$vwCPD_SPLatest->ContactFirstName->ViewValue = $vwCPD_SPLatest->ContactFirstName->CurrentValue;
			$vwCPD_SPLatest->ContactFirstName->CssStyle = "";
			$vwCPD_SPLatest->ContactFirstName->CssClass = "";
			$vwCPD_SPLatest->ContactFirstName->ViewCustomAttributes = "";

			// ContactSurname
			$vwCPD_SPLatest->ContactSurname->ViewValue = $vwCPD_SPLatest->ContactSurname->CurrentValue;
			$vwCPD_SPLatest->ContactSurname->CssStyle = "";
			$vwCPD_SPLatest->ContactSurname->CssClass = "";
			$vwCPD_SPLatest->ContactSurname->ViewCustomAttributes = "";

			// ContactPosition
			$vwCPD_SPLatest->ContactPosition->ViewValue = $vwCPD_SPLatest->ContactPosition->CurrentValue;
			$vwCPD_SPLatest->ContactPosition->CssStyle = "";
			$vwCPD_SPLatest->ContactPosition->CssClass = "";
			$vwCPD_SPLatest->ContactPosition->ViewCustomAttributes = "";

			// ContactIDNum
			$vwCPD_SPLatest->ContactIDNum->ViewValue = $vwCPD_SPLatest->ContactIDNum->CurrentValue;
			$vwCPD_SPLatest->ContactIDNum->CssStyle = "";
			$vwCPD_SPLatest->ContactIDNum->CssClass = "";
			$vwCPD_SPLatest->ContactIDNum->ViewCustomAttributes = "";

			// PhoneNumber
			$vwCPD_SPLatest->PhoneNumber->ViewValue = $vwCPD_SPLatest->PhoneNumber->CurrentValue;
			$vwCPD_SPLatest->PhoneNumber->CssStyle = "";
			$vwCPD_SPLatest->PhoneNumber->CssClass = "";
			$vwCPD_SPLatest->PhoneNumber->ViewCustomAttributes = "";

			// ContactEmail
			$vwCPD_SPLatest->ContactEmail->ViewValue = $vwCPD_SPLatest->ContactEmail->CurrentValue;
			$vwCPD_SPLatest->ContactEmail->CssStyle = "";
			$vwCPD_SPLatest->ContactEmail->CssClass = "";
			$vwCPD_SPLatest->ContactEmail->ViewCustomAttributes = "";

			// Password
			$vwCPD_SPLatest->Password->ViewValue = $vwCPD_SPLatest->Password->CurrentValue;
			$vwCPD_SPLatest->Password->CssStyle = "";
			$vwCPD_SPLatest->Password->CssClass = "";
			$vwCPD_SPLatest->Password->ViewCustomAttributes = "";

			// PhysicalAddress1
			$vwCPD_SPLatest->PhysicalAddress1->ViewValue = $vwCPD_SPLatest->PhysicalAddress1->CurrentValue;
			$vwCPD_SPLatest->PhysicalAddress1->CssStyle = "";
			$vwCPD_SPLatest->PhysicalAddress1->CssClass = "";
			$vwCPD_SPLatest->PhysicalAddress1->ViewCustomAttributes = "";

			// PhysicalAddress2
			$vwCPD_SPLatest->PhysicalAddress2->ViewValue = $vwCPD_SPLatest->PhysicalAddress2->CurrentValue;
			$vwCPD_SPLatest->PhysicalAddress2->CssStyle = "";
			$vwCPD_SPLatest->PhysicalAddress2->CssClass = "";
			$vwCPD_SPLatest->PhysicalAddress2->ViewCustomAttributes = "";

			// PhysicalCity
			$vwCPD_SPLatest->PhysicalCity->ViewValue = $vwCPD_SPLatest->PhysicalCity->CurrentValue;
			$vwCPD_SPLatest->PhysicalCity->CssStyle = "";
			$vwCPD_SPLatest->PhysicalCity->CssClass = "";
			$vwCPD_SPLatest->PhysicalCity->ViewCustomAttributes = "";

			// PhysicalCode
			$vwCPD_SPLatest->PhysicalCode->ViewValue = $vwCPD_SPLatest->PhysicalCode->CurrentValue;
			$vwCPD_SPLatest->PhysicalCode->CssStyle = "";
			$vwCPD_SPLatest->PhysicalCode->CssClass = "";
			$vwCPD_SPLatest->PhysicalCode->ViewCustomAttributes = "";

			// PhysicalProvince
			$vwCPD_SPLatest->PhysicalProvince->ViewValue = $vwCPD_SPLatest->PhysicalProvince->CurrentValue;
			$vwCPD_SPLatest->PhysicalProvince->CssStyle = "";
			$vwCPD_SPLatest->PhysicalProvince->CssClass = "";
			$vwCPD_SPLatest->PhysicalProvince->ViewCustomAttributes = "";

			// PhysicalCountry
			$vwCPD_SPLatest->PhysicalCountry->ViewValue = $vwCPD_SPLatest->PhysicalCountry->CurrentValue;
			$vwCPD_SPLatest->PhysicalCountry->CssStyle = "";
			$vwCPD_SPLatest->PhysicalCountry->CssClass = "";
			$vwCPD_SPLatest->PhysicalCountry->ViewCustomAttributes = "";

			// PostalAddress1
			$vwCPD_SPLatest->PostalAddress1->ViewValue = $vwCPD_SPLatest->PostalAddress1->CurrentValue;
			$vwCPD_SPLatest->PostalAddress1->CssStyle = "";
			$vwCPD_SPLatest->PostalAddress1->CssClass = "";
			$vwCPD_SPLatest->PostalAddress1->ViewCustomAttributes = "";

			// PostalAddress2
			$vwCPD_SPLatest->PostalAddress2->ViewValue = $vwCPD_SPLatest->PostalAddress2->CurrentValue;
			$vwCPD_SPLatest->PostalAddress2->CssStyle = "";
			$vwCPD_SPLatest->PostalAddress2->CssClass = "";
			$vwCPD_SPLatest->PostalAddress2->ViewCustomAttributes = "";

			// PostalCity
			$vwCPD_SPLatest->PostalCity->ViewValue = $vwCPD_SPLatest->PostalCity->CurrentValue;
			$vwCPD_SPLatest->PostalCity->CssStyle = "";
			$vwCPD_SPLatest->PostalCity->CssClass = "";
			$vwCPD_SPLatest->PostalCity->ViewCustomAttributes = "";

			// PostalCode
			$vwCPD_SPLatest->PostalCode->ViewValue = $vwCPD_SPLatest->PostalCode->CurrentValue;
			$vwCPD_SPLatest->PostalCode->CssStyle = "";
			$vwCPD_SPLatest->PostalCode->CssClass = "";
			$vwCPD_SPLatest->PostalCode->ViewCustomAttributes = "";

			// PostalProvince
			$vwCPD_SPLatest->PostalProvince->ViewValue = $vwCPD_SPLatest->PostalProvince->CurrentValue;
			$vwCPD_SPLatest->PostalProvince->CssStyle = "";
			$vwCPD_SPLatest->PostalProvince->CssClass = "";
			$vwCPD_SPLatest->PostalProvince->ViewCustomAttributes = "";

			// PostalCountry
			$vwCPD_SPLatest->PostalCountry->ViewValue = $vwCPD_SPLatest->PostalCountry->CurrentValue;
			$vwCPD_SPLatest->PostalCountry->CssStyle = "";
			$vwCPD_SPLatest->PostalCountry->CssClass = "";
			$vwCPD_SPLatest->PostalCountry->ViewCustomAttributes = "";

			// Website
			$vwCPD_SPLatest->Website->ViewValue = $vwCPD_SPLatest->Website->CurrentValue;
			$vwCPD_SPLatest->Website->CssStyle = "";
			$vwCPD_SPLatest->Website->CssClass = "";
			$vwCPD_SPLatest->Website->ViewCustomAttributes = "";

			// VATNumber
			$vwCPD_SPLatest->VATNumber->ViewValue = $vwCPD_SPLatest->VATNumber->CurrentValue;
			$vwCPD_SPLatest->VATNumber->CssStyle = "";
			$vwCPD_SPLatest->VATNumber->CssClass = "";
			$vwCPD_SPLatest->VATNumber->ViewCustomAttributes = "";

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

			// UpdatedBy
			$vwCPD_SPLatest->UpdatedBy->ViewValue = $vwCPD_SPLatest->UpdatedBy->CurrentValue;
			$vwCPD_SPLatest->UpdatedBy->CssStyle = "";
			$vwCPD_SPLatest->UpdatedBy->CssClass = "";
			$vwCPD_SPLatest->UpdatedBy->ViewCustomAttributes = "";

			// Archived
			$vwCPD_SPLatest->Archived->ViewValue = $vwCPD_SPLatest->Archived->CurrentValue;
			$vwCPD_SPLatest->Archived->CssStyle = "";
			$vwCPD_SPLatest->Archived->CssClass = "";
			$vwCPD_SPLatest->Archived->ViewCustomAttributes = "";

			// ContactPhone
			$vwCPD_SPLatest->ContactPhone->ViewValue = $vwCPD_SPLatest->ContactPhone->CurrentValue;
			$vwCPD_SPLatest->ContactPhone->CssStyle = "";
			$vwCPD_SPLatest->ContactPhone->CssClass = "";
			$vwCPD_SPLatest->ContactPhone->ViewCustomAttributes = "";

			// AdminTitle
			$vwCPD_SPLatest->AdminTitle->ViewValue = $vwCPD_SPLatest->AdminTitle->CurrentValue;
			$vwCPD_SPLatest->AdminTitle->CssStyle = "";
			$vwCPD_SPLatest->AdminTitle->CssClass = "";
			$vwCPD_SPLatest->AdminTitle->ViewCustomAttributes = "";

			// AdminInitials
			$vwCPD_SPLatest->AdminInitials->ViewValue = $vwCPD_SPLatest->AdminInitials->CurrentValue;
			$vwCPD_SPLatest->AdminInitials->CssStyle = "";
			$vwCPD_SPLatest->AdminInitials->CssClass = "";
			$vwCPD_SPLatest->AdminInitials->ViewCustomAttributes = "";

			// AdminFirstName
			$vwCPD_SPLatest->AdminFirstName->ViewValue = $vwCPD_SPLatest->AdminFirstName->CurrentValue;
			$vwCPD_SPLatest->AdminFirstName->CssStyle = "";
			$vwCPD_SPLatest->AdminFirstName->CssClass = "";
			$vwCPD_SPLatest->AdminFirstName->ViewCustomAttributes = "";

			// AdminSurname
			$vwCPD_SPLatest->AdminSurname->ViewValue = $vwCPD_SPLatest->AdminSurname->CurrentValue;
			$vwCPD_SPLatest->AdminSurname->CssStyle = "";
			$vwCPD_SPLatest->AdminSurname->CssClass = "";
			$vwCPD_SPLatest->AdminSurname->ViewCustomAttributes = "";

			// AdminPosition
			$vwCPD_SPLatest->AdminPosition->ViewValue = $vwCPD_SPLatest->AdminPosition->CurrentValue;
			$vwCPD_SPLatest->AdminPosition->CssStyle = "";
			$vwCPD_SPLatest->AdminPosition->CssClass = "";
			$vwCPD_SPLatest->AdminPosition->ViewCustomAttributes = "";

			// AdminIDNum
			$vwCPD_SPLatest->AdminIDNum->ViewValue = $vwCPD_SPLatest->AdminIDNum->CurrentValue;
			$vwCPD_SPLatest->AdminIDNum->CssStyle = "";
			$vwCPD_SPLatest->AdminIDNum->CssClass = "";
			$vwCPD_SPLatest->AdminIDNum->ViewCustomAttributes = "";

			// AdminEmail
			$vwCPD_SPLatest->AdminEmail->ViewValue = $vwCPD_SPLatest->AdminEmail->CurrentValue;
			$vwCPD_SPLatest->AdminEmail->CssStyle = "";
			$vwCPD_SPLatest->AdminEmail->CssClass = "";
			$vwCPD_SPLatest->AdminEmail->ViewCustomAttributes = "";

			// AdminPhone
			$vwCPD_SPLatest->AdminPhone->ViewValue = $vwCPD_SPLatest->AdminPhone->CurrentValue;
			$vwCPD_SPLatest->AdminPhone->CssStyle = "";
			$vwCPD_SPLatest->AdminPhone->CssClass = "";
			$vwCPD_SPLatest->AdminPhone->ViewCustomAttributes = "";

			// Approved
			$vwCPD_SPLatest->Approved->ViewValue = $vwCPD_SPLatest->Approved->CurrentValue;
			$vwCPD_SPLatest->Approved->CssStyle = "";
			$vwCPD_SPLatest->Approved->CssClass = "";
			$vwCPD_SPLatest->Approved->ViewCustomAttributes = "";

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

			// EmailAddress
			$vwCPD_SPLatest->EmailAddress->ViewValue = $vwCPD_SPLatest->EmailAddress->CurrentValue;
			$vwCPD_SPLatest->EmailAddress->CssStyle = "";
			$vwCPD_SPLatest->EmailAddress->CssClass = "";
			$vwCPD_SPLatest->EmailAddress->ViewCustomAttributes = "";

			// SPNumber
			$vwCPD_SPLatest->SPNumber->ViewValue = $vwCPD_SPLatest->SPNumber->CurrentValue;
			$vwCPD_SPLatest->SPNumber->CssStyle = "";
			$vwCPD_SPLatest->SPNumber->CssClass = "";
			$vwCPD_SPLatest->SPNumber->ViewCustomAttributes = "";

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

			// EvaluatorID
			$vwCPD_SPLatest->EvaluatorID->ViewValue = $vwCPD_SPLatest->EvaluatorID->CurrentValue;
			$vwCPD_SPLatest->EvaluatorID->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorID->CssClass = "";
			$vwCPD_SPLatest->EvaluatorID->ViewCustomAttributes = "";

			// EvaluatorID2
			$vwCPD_SPLatest->EvaluatorID2->ViewValue = $vwCPD_SPLatest->EvaluatorID2->CurrentValue;
			$vwCPD_SPLatest->EvaluatorID2->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorID2->CssClass = "";
			$vwCPD_SPLatest->EvaluatorID2->ViewCustomAttributes = "";

			// EvaluatorID3
			$vwCPD_SPLatest->EvaluatorID3->ViewValue = $vwCPD_SPLatest->EvaluatorID3->CurrentValue;
			$vwCPD_SPLatest->EvaluatorID3->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorID3->CssClass = "";
			$vwCPD_SPLatest->EvaluatorID3->ViewCustomAttributes = "";

			// InvoiceCode
			$vwCPD_SPLatest->InvoiceCode->ViewValue = $vwCPD_SPLatest->InvoiceCode->CurrentValue;
			$vwCPD_SPLatest->InvoiceCode->CssStyle = "";
			$vwCPD_SPLatest->InvoiceCode->CssClass = "";
			$vwCPD_SPLatest->InvoiceCode->ViewCustomAttributes = "";

			// InvoiceNumber
			$vwCPD_SPLatest->InvoiceNumber->ViewValue = $vwCPD_SPLatest->InvoiceNumber->CurrentValue;
			$vwCPD_SPLatest->InvoiceNumber->CssStyle = "";
			$vwCPD_SPLatest->InvoiceNumber->CssClass = "";
			$vwCPD_SPLatest->InvoiceNumber->ViewCustomAttributes = "";

			// Cost
			$vwCPD_SPLatest->Cost->ViewValue = $vwCPD_SPLatest->Cost->CurrentValue;
			$vwCPD_SPLatest->Cost->CssStyle = "";
			$vwCPD_SPLatest->Cost->CssClass = "";
			$vwCPD_SPLatest->Cost->ViewCustomAttributes = "";

			// EvaluatorFee
			$vwCPD_SPLatest->EvaluatorFee->ViewValue = $vwCPD_SPLatest->EvaluatorFee->CurrentValue;
			$vwCPD_SPLatest->EvaluatorFee->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorFee->CssClass = "";
			$vwCPD_SPLatest->EvaluatorFee->ViewCustomAttributes = "";

			// EvaluatorFeeAmount
			$vwCPD_SPLatest->EvaluatorFeeAmount->ViewValue = $vwCPD_SPLatest->EvaluatorFeeAmount->CurrentValue;
			$vwCPD_SPLatest->EvaluatorFeeAmount->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorFeeAmount->CssClass = "";
			$vwCPD_SPLatest->EvaluatorFeeAmount->ViewCustomAttributes = "";

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

			// CellNumber
			$vwCPD_SPLatest->CellNumber->ViewValue = $vwCPD_SPLatest->CellNumber->CurrentValue;
			$vwCPD_SPLatest->CellNumber->CssStyle = "";
			$vwCPD_SPLatest->CellNumber->CssClass = "";
			$vwCPD_SPLatest->CellNumber->ViewCustomAttributes = "";

			// ContactCell
			$vwCPD_SPLatest->ContactCell->ViewValue = $vwCPD_SPLatest->ContactCell->CurrentValue;
			$vwCPD_SPLatest->ContactCell->CssStyle = "";
			$vwCPD_SPLatest->ContactCell->CssClass = "";
			$vwCPD_SPLatest->ContactCell->ViewCustomAttributes = "";

			// AdminCell
			$vwCPD_SPLatest->AdminCell->ViewValue = $vwCPD_SPLatest->AdminCell->CurrentValue;
			$vwCPD_SPLatest->AdminCell->CssStyle = "";
			$vwCPD_SPLatest->AdminCell->CssClass = "";
			$vwCPD_SPLatest->AdminCell->ViewCustomAttributes = "";

			// DepositAmt
			$vwCPD_SPLatest->DepositAmt->ViewValue = $vwCPD_SPLatest->DepositAmt->CurrentValue;
			$vwCPD_SPLatest->DepositAmt->CssStyle = "";
			$vwCPD_SPLatest->DepositAmt->CssClass = "";
			$vwCPD_SPLatest->DepositAmt->ViewCustomAttributes = "";

			// InvoiceFile
			$vwCPD_SPLatest->InvoiceFile->ViewValue = $vwCPD_SPLatest->InvoiceFile->CurrentValue;
			$vwCPD_SPLatest->InvoiceFile->CssStyle = "";
			$vwCPD_SPLatest->InvoiceFile->CssClass = "";
			$vwCPD_SPLatest->InvoiceFile->ViewCustomAttributes = "";

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

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

			// ProofOfPayment
			$vwCPD_SPLatest->ProofOfPayment->ViewValue = $vwCPD_SPLatest->ProofOfPayment->CurrentValue;
			$vwCPD_SPLatest->ProofOfPayment->CssStyle = "";
			$vwCPD_SPLatest->ProofOfPayment->CssClass = "";
			$vwCPD_SPLatest->ProofOfPayment->ViewCustomAttributes = "";

			// EvaluatorInvoice
			$vwCPD_SPLatest->EvaluatorInvoice->ViewValue = $vwCPD_SPLatest->EvaluatorInvoice->CurrentValue;
			$vwCPD_SPLatest->EvaluatorInvoice->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorInvoice->CssClass = "";
			$vwCPD_SPLatest->EvaluatorInvoice->ViewCustomAttributes = "";

			// EvaluatorTimesheet
			$vwCPD_SPLatest->EvaluatorTimesheet->ViewValue = $vwCPD_SPLatest->EvaluatorTimesheet->CurrentValue;
			$vwCPD_SPLatest->EvaluatorTimesheet->CssStyle = "";
			$vwCPD_SPLatest->EvaluatorTimesheet->CssClass = "";
			$vwCPD_SPLatest->EvaluatorTimesheet->ViewCustomAttributes = "";

			// NumReminders
			$vwCPD_SPLatest->NumReminders->ViewValue = $vwCPD_SPLatest->NumReminders->CurrentValue;
			$vwCPD_SPLatest->NumReminders->CssStyle = "";
			$vwCPD_SPLatest->NumReminders->CssClass = "";
			$vwCPD_SPLatest->NumReminders->ViewCustomAttributes = "";

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

			// PrevSPNumber
			$vwCPD_SPLatest->PrevSPNumber->ViewValue = $vwCPD_SPLatest->PrevSPNumber->CurrentValue;
			$vwCPD_SPLatest->PrevSPNumber->CssStyle = "";
			$vwCPD_SPLatest->PrevSPNumber->CssClass = "";
			$vwCPD_SPLatest->PrevSPNumber->ViewCustomAttributes = "";

			// Renewal
			$vwCPD_SPLatest->Renewal->ViewValue = $vwCPD_SPLatest->Renewal->CurrentValue;
			$vwCPD_SPLatest->Renewal->CssStyle = "";
			$vwCPD_SPLatest->Renewal->CssClass = "";
			$vwCPD_SPLatest->Renewal->ViewCustomAttributes = "";

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

			// CPDProviderID
			$vwCPD_SPLatest->CPDProviderID->HrefValue = "";
			$vwCPD_SPLatest->CPDProviderID->TooltipValue = "";

			// CompanyName
			$vwCPD_SPLatest->CompanyName->HrefValue = "";
			$vwCPD_SPLatest->CompanyName->TooltipValue = "";

			// TradingAs
			$vwCPD_SPLatest->TradingAs->HrefValue = "";
			$vwCPD_SPLatest->TradingAs->TooltipValue = "";

			// ContactTitle
			$vwCPD_SPLatest->ContactTitle->HrefValue = "";
			$vwCPD_SPLatest->ContactTitle->TooltipValue = "";

			// ContactInitials
			$vwCPD_SPLatest->ContactInitials->HrefValue = "";
			$vwCPD_SPLatest->ContactInitials->TooltipValue = "";

			// ContactFirstName
			$vwCPD_SPLatest->ContactFirstName->HrefValue = "";
			$vwCPD_SPLatest->ContactFirstName->TooltipValue = "";

			// ContactSurname
			$vwCPD_SPLatest->ContactSurname->HrefValue = "";
			$vwCPD_SPLatest->ContactSurname->TooltipValue = "";

			// ContactPosition
			$vwCPD_SPLatest->ContactPosition->HrefValue = "";
			$vwCPD_SPLatest->ContactPosition->TooltipValue = "";

			// ContactIDNum
			$vwCPD_SPLatest->ContactIDNum->HrefValue = "";
			$vwCPD_SPLatest->ContactIDNum->TooltipValue = "";

			// PhoneNumber
			$vwCPD_SPLatest->PhoneNumber->HrefValue = "";
			$vwCPD_SPLatest->PhoneNumber->TooltipValue = "";

			// ContactEmail
			$vwCPD_SPLatest->ContactEmail->HrefValue = "";
			$vwCPD_SPLatest->ContactEmail->TooltipValue = "";

			// DateUpdated
			$vwCPD_SPLatest->DateUpdated->HrefValue = "";
			$vwCPD_SPLatest->DateUpdated->TooltipValue = "";

			// ContactPhone
			$vwCPD_SPLatest->ContactPhone->HrefValue = "";
			$vwCPD_SPLatest->ContactPhone->TooltipValue = "";

			// Approved
			$vwCPD_SPLatest->Approved->HrefValue = "";
			$vwCPD_SPLatest->Approved->TooltipValue = "";

			// DateAssessed
			$vwCPD_SPLatest->DateAssessed->HrefValue = "";
			$vwCPD_SPLatest->DateAssessed->TooltipValue = "";

			// EmailAddress
			$vwCPD_SPLatest->EmailAddress->HrefValue = "";
			$vwCPD_SPLatest->EmailAddress->TooltipValue = "";

			// SPNumber
			$vwCPD_SPLatest->SPNumber->HrefValue = "";
			$vwCPD_SPLatest->SPNumber->TooltipValue = "";

			// DateExpires
			$vwCPD_SPLatest->DateExpires->HrefValue = "";
			$vwCPD_SPLatest->DateExpires->TooltipValue = "";

			// CellNumber
			$vwCPD_SPLatest->CellNumber->HrefValue = "";
			$vwCPD_SPLatest->CellNumber->TooltipValue = "";

			// ContactCell
			$vwCPD_SPLatest->ContactCell->HrefValue = "";
			$vwCPD_SPLatest->ContactCell->TooltipValue = "";

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

			// NumReminders
			$vwCPD_SPLatest->NumReminders->HrefValue = "";
			$vwCPD_SPLatest->NumReminders->TooltipValue = "";

			// LastReminder
			$vwCPD_SPLatest->LastReminder->HrefValue = "";
			$vwCPD_SPLatest->LastReminder->TooltipValue = "";

			// PrevSPNumber
			$vwCPD_SPLatest->PrevSPNumber->HrefValue = "";
			$vwCPD_SPLatest->PrevSPNumber->TooltipValue = "";

			// Renewal
			$vwCPD_SPLatest->Renewal->HrefValue = "";
			$vwCPD_SPLatest->Renewal->TooltipValue = "";

			// DateCreated
			$vwCPD_SPLatest->DateCreated->HrefValue = "";
			$vwCPD_SPLatest->DateCreated->TooltipValue = "";
		}

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

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

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $vwCPD_SPLatest->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;

		// Export all
		if ($vwCPD_SPLatest->ExportAll) {
			$this->lDisplayRecs = $this->lTotalRecs;
			$this->lStopRec = $this->lTotalRecs;
		} else { // Export one page only
			$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 ($bSelectLimit)
			$rs = $this->LoadRecordset($this->lStartRec-1, $this->lDisplayRecs);
		if (!$rs) {
			header("Content-Type:"); // Remove header
			header("Content-Disposition:");
			$this->ShowMessage();
			return;
		}
		if ($vwCPD_SPLatest->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($vwCPD_SPLatest, "h");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($vwCPD_SPLatest->CPDProviderID);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->CompanyName);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->TradingAs);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactTitle);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactInitials);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactFirstName);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactSurname);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactPosition);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactIDNum);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhoneNumber);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactEmail);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->Password);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhysicalAddress1);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhysicalAddress2);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhysicalCity);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhysicalCode);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhysicalProvince);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PhysicalCountry);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PostalAddress1);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PostalAddress2);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PostalCity);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PostalCode);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PostalProvince);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PostalCountry);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->Website);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->VATNumber);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->DateUpdated);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->UpdatedBy);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->Archived);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactPhone);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminTitle);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminInitials);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminFirstName);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminSurname);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminPosition);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminIDNum);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminEmail);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminPhone);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->Approved);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->DateAssessed);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EmailAddress);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->SPNumber);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->DateExpires);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorID);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorID2);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorID3);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->InvoiceCode);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->InvoiceNumber);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->Cost);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorFee);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorFeeAmount);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorFeeDate);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->CellNumber);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ContactCell);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->AdminCell);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->DepositAmt);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->InvoiceFile);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->InvoiceDate);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->DatePaid);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->ProofOfPayment);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorInvoice);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->EvaluatorTimesheet);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->NumReminders);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->LastReminder);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->PrevSPNumber);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->Renewal);
				$ExportDoc->ExportCaption($vwCPD_SPLatest->DateCreated);
				$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
				$vwCPD_SPLatest->CssClass = "";
				$vwCPD_SPLatest->CssStyle = "";
				$vwCPD_SPLatest->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($vwCPD_SPLatest->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('CPDProviderID', $vwCPD_SPLatest->CPDProviderID->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('CompanyName', $vwCPD_SPLatest->CompanyName->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('TradingAs', $vwCPD_SPLatest->TradingAs->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactTitle', $vwCPD_SPLatest->ContactTitle->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactInitials', $vwCPD_SPLatest->ContactInitials->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactFirstName', $vwCPD_SPLatest->ContactFirstName->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactSurname', $vwCPD_SPLatest->ContactSurname->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactPosition', $vwCPD_SPLatest->ContactPosition->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactIDNum', $vwCPD_SPLatest->ContactIDNum->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhoneNumber', $vwCPD_SPLatest->PhoneNumber->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactEmail', $vwCPD_SPLatest->ContactEmail->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('Password', $vwCPD_SPLatest->Password->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhysicalAddress1', $vwCPD_SPLatest->PhysicalAddress1->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhysicalAddress2', $vwCPD_SPLatest->PhysicalAddress2->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhysicalCity', $vwCPD_SPLatest->PhysicalCity->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhysicalCode', $vwCPD_SPLatest->PhysicalCode->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhysicalProvince', $vwCPD_SPLatest->PhysicalProvince->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PhysicalCountry', $vwCPD_SPLatest->PhysicalCountry->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PostalAddress1', $vwCPD_SPLatest->PostalAddress1->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PostalAddress2', $vwCPD_SPLatest->PostalAddress2->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PostalCity', $vwCPD_SPLatest->PostalCity->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PostalCode', $vwCPD_SPLatest->PostalCode->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PostalProvince', $vwCPD_SPLatest->PostalProvince->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PostalCountry', $vwCPD_SPLatest->PostalCountry->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('Website', $vwCPD_SPLatest->Website->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('VATNumber', $vwCPD_SPLatest->VATNumber->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('DateUpdated', $vwCPD_SPLatest->DateUpdated->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('UpdatedBy', $vwCPD_SPLatest->UpdatedBy->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('Archived', $vwCPD_SPLatest->Archived->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactPhone', $vwCPD_SPLatest->ContactPhone->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminTitle', $vwCPD_SPLatest->AdminTitle->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminInitials', $vwCPD_SPLatest->AdminInitials->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminFirstName', $vwCPD_SPLatest->AdminFirstName->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminSurname', $vwCPD_SPLatest->AdminSurname->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminPosition', $vwCPD_SPLatest->AdminPosition->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminIDNum', $vwCPD_SPLatest->AdminIDNum->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminEmail', $vwCPD_SPLatest->AdminEmail->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminPhone', $vwCPD_SPLatest->AdminPhone->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('Approved', $vwCPD_SPLatest->Approved->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('DateAssessed', $vwCPD_SPLatest->DateAssessed->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EmailAddress', $vwCPD_SPLatest->EmailAddress->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('SPNumber', $vwCPD_SPLatest->SPNumber->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('DateExpires', $vwCPD_SPLatest->DateExpires->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorID', $vwCPD_SPLatest->EvaluatorID->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorID2', $vwCPD_SPLatest->EvaluatorID2->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorID3', $vwCPD_SPLatest->EvaluatorID3->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('InvoiceCode', $vwCPD_SPLatest->InvoiceCode->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('InvoiceNumber', $vwCPD_SPLatest->InvoiceNumber->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('Cost', $vwCPD_SPLatest->Cost->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorFee', $vwCPD_SPLatest->EvaluatorFee->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorFeeAmount', $vwCPD_SPLatest->EvaluatorFeeAmount->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorFeeDate', $vwCPD_SPLatest->EvaluatorFeeDate->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('CellNumber', $vwCPD_SPLatest->CellNumber->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ContactCell', $vwCPD_SPLatest->ContactCell->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('AdminCell', $vwCPD_SPLatest->AdminCell->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('DepositAmt', $vwCPD_SPLatest->DepositAmt->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('InvoiceFile', $vwCPD_SPLatest->InvoiceFile->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('InvoiceDate', $vwCPD_SPLatest->InvoiceDate->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('DatePaid', $vwCPD_SPLatest->DatePaid->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('ProofOfPayment', $vwCPD_SPLatest->ProofOfPayment->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorInvoice', $vwCPD_SPLatest->EvaluatorInvoice->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('EvaluatorTimesheet', $vwCPD_SPLatest->EvaluatorTimesheet->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('NumReminders', $vwCPD_SPLatest->NumReminders->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('LastReminder', $vwCPD_SPLatest->LastReminder->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('PrevSPNumber', $vwCPD_SPLatest->PrevSPNumber->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('Renewal', $vwCPD_SPLatest->Renewal->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
					$XmlDoc->AddField('DateCreated', $vwCPD_SPLatest->DateCreated->ExportValue($vwCPD_SPLatest->Export, $vwCPD_SPLatest->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($vwCPD_SPLatest->CPDProviderID);
					$ExportDoc->ExportField($vwCPD_SPLatest->CompanyName);
					$ExportDoc->ExportField($vwCPD_SPLatest->TradingAs);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactTitle);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactInitials);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactFirstName);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactSurname);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactPosition);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactIDNum);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhoneNumber);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactEmail);
					$ExportDoc->ExportField($vwCPD_SPLatest->Password);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhysicalAddress1);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhysicalAddress2);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhysicalCity);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhysicalCode);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhysicalProvince);
					$ExportDoc->ExportField($vwCPD_SPLatest->PhysicalCountry);
					$ExportDoc->ExportField($vwCPD_SPLatest->PostalAddress1);
					$ExportDoc->ExportField($vwCPD_SPLatest->PostalAddress2);
					$ExportDoc->ExportField($vwCPD_SPLatest->PostalCity);
					$ExportDoc->ExportField($vwCPD_SPLatest->PostalCode);
					$ExportDoc->ExportField($vwCPD_SPLatest->PostalProvince);
					$ExportDoc->ExportField($vwCPD_SPLatest->PostalCountry);
					$ExportDoc->ExportField($vwCPD_SPLatest->Website);
					$ExportDoc->ExportField($vwCPD_SPLatest->VATNumber);
					$ExportDoc->ExportField($vwCPD_SPLatest->DateUpdated);
					$ExportDoc->ExportField($vwCPD_SPLatest->UpdatedBy);
					$ExportDoc->ExportField($vwCPD_SPLatest->Archived);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactPhone);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminTitle);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminInitials);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminFirstName);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminSurname);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminPosition);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminIDNum);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminEmail);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminPhone);
					$ExportDoc->ExportField($vwCPD_SPLatest->Approved);
					$ExportDoc->ExportField($vwCPD_SPLatest->DateAssessed);
					$ExportDoc->ExportField($vwCPD_SPLatest->EmailAddress);
					$ExportDoc->ExportField($vwCPD_SPLatest->SPNumber);
					$ExportDoc->ExportField($vwCPD_SPLatest->DateExpires);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorID);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorID2);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorID3);
					$ExportDoc->ExportField($vwCPD_SPLatest->InvoiceCode);
					$ExportDoc->ExportField($vwCPD_SPLatest->InvoiceNumber);
					$ExportDoc->ExportField($vwCPD_SPLatest->Cost);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorFee);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorFeeAmount);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorFeeDate);
					$ExportDoc->ExportField($vwCPD_SPLatest->CellNumber);
					$ExportDoc->ExportField($vwCPD_SPLatest->ContactCell);
					$ExportDoc->ExportField($vwCPD_SPLatest->AdminCell);
					$ExportDoc->ExportField($vwCPD_SPLatest->DepositAmt);
					$ExportDoc->ExportField($vwCPD_SPLatest->InvoiceFile);
					$ExportDoc->ExportField($vwCPD_SPLatest->InvoiceDate);
					$ExportDoc->ExportField($vwCPD_SPLatest->DatePaid);
					$ExportDoc->ExportField($vwCPD_SPLatest->ProofOfPayment);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorInvoice);
					$ExportDoc->ExportField($vwCPD_SPLatest->EvaluatorTimesheet);
					$ExportDoc->ExportField($vwCPD_SPLatest->NumReminders);
					$ExportDoc->ExportField($vwCPD_SPLatest->LastReminder);
					$ExportDoc->ExportField($vwCPD_SPLatest->PrevSPNumber);
					$ExportDoc->ExportField($vwCPD_SPLatest->Renewal);
					$ExportDoc->ExportField($vwCPD_SPLatest->DateCreated);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($vwCPD_SPLatest->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($vwCPD_SPLatest->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

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

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

	// Export email
	function ExportEmail($EmailContent) {
		global $Language, $vwCPD_SPLatest;
		$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 ($vwCPD_SPLatest->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 $vwCPD_SPLatest;

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

		// Build QueryString for search
		if ($vwCPD_SPLatest->getSessionBasicSearchKeyword() <> "") {
			$sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . $vwCPD_SPLatest->getSessionBasicSearchKeyword() . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . $vwCPD_SPLatest->getSessionBasicSearchType();
		}

		// Build QueryString for pager
		$sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . $vwCPD_SPLatest->getRecordsPerPage() . "&" . EW_TABLE_START_REC . "=" . $vwCPD_SPLatest->getStartRecordNumber();
		return $sQry;
	}

	// Add search QueryString
	function AddSearchQueryString(&$Qry, &$Fld) {
		global $vwCPD_SPLatest;
		$FldParm = substr($Fld->FldVar, 2);
		$FldSearchValue = $vwCPD_SPLatest->GetAdvancedSearch("x_" . $FldParm);
		if (strval($FldSearchValue) <> "") {
			$Qry .= "&x_" . $FldParm . "=" . FldSearchValue .
				"&z_" . $FldParm . "=" . $vwCPD_SPLatest->GetAdvancedSearch("z_" . $FldParm);
		}
		$FldSearchValue2 = $vwCPD_SPLatest->GetAdvancedSearch("y_" . $FldParm);
		if (strval($FldSearchValue2) <> "") {
			$Qry .= "&v_" . $FldParm . "=" . $vwCPD_SPLatest->GetAdvancedSearch("v_" . $FldParm) .
				"&y_" . $FldParm . "=" . $FldSearchValue2 .
				"&w_" . $FldParm . "=" . $vwCPD_SPLatest->GetAdvancedSearch("w_" . $FldParm);
		}
	}

	// 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";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}

	// ListOptions Load event
	function ListOptions_Load() {

		// Example: 
		//$this->ListOptions->Add("new");
		//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
		//$this->ListOptions->MoveItem("new", 0); // Move to first column

	}

	// ListOptions Rendered event
	function ListOptions_Rendered() {

		// Example: 
		//$this->ListOptions->Items["new"]->Body = "xxx";

	}
}
?>