Your IP : 216.73.217.79


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

<html>

<head>
	<style>
		body,
		p,
		td,
		th {
			font: 12px/170% Verdana, sans-serif;
		}
	</style>
</head>

<body>
	<?php
	include('inc_db.php');
	$db = mysql_connect($loghost, $logid, $logpwd);

	mysql_select_db($dbname, $db);

	$sql = "SELECT SchoolEvents.EventID, SchoolEvents.EventName, SchoolEvents.City,	SchoolEvents.CostPerPerson, 
			SchoolEvents.AccredNum, SchoolEvents.CPD, SchoolEvents.Cancelled, SchoolEvents.Venue, 
			CourseVenues.CourseVenueCity, MIN(EventSchedules.ScheduleDate) AS StartDate, 
			MAX(EventSchedules.ScheduleDate) AS EndDate
		FROM (SchoolEvents 
		LEFT JOIN CourseVenues ON SchoolEvents.Venue = CourseVenues.CourseVenueName)
		LEFT JOIN EventSchedules ON SchoolEvents.EventID=EventSchedules.EventID
		LEFT JOIN SchoolWebCategories ON (SchoolEvents.WebCategory=SchoolWebCategories.WebCategoryID)
		WHERE Cancelled = 0 AND (SchoolWebCategories.DisplayOrder IS NULL OR SchoolWebCategories.DisplayOrder > 0)
		GROUP BY SchoolEvents.EventID, SchoolEvents.EventName, SchoolEvents.City, SchoolEvents.CostPerPerson, 
			SchoolEvents.AccredNum, SchoolEvents.CPD, SchoolEvents.Cancelled, SchoolEvents.Venue, 
			CourseVenues.CourseVenueCity
		HAVING StartDate >= '2020-06-01'
		ORDER BY EventName, Cancelled, AccredNum, CPD, StartDate";

	$queryresultall = mysql_query($sql) or die(mysql_error() . " " . $sql);

	while ($rowall = mysql_fetch_array($queryresultall)) {

		$id = intval($rowall["EventID"]);

		$sql = "SELECT SchoolEvents.EventID, SchoolEvents.EventName, SchoolEvents.Level, SchoolEvents.City, SchoolEvents.Venue, SchoolEvents.StartTime, 
					SchoolEvents.EndTime, 
					SchoolEvents.AvailableSpaces, SchoolEvents.CostPerPerson, SchoolEvents.EventDescription, SchoolFacilitators.FacilitatorName, 
					SchoolFacilitators.PhoneNumber, SchoolFacilitators.MobileNumber, SchoolFacilitators.FaxNumber, SchoolFacilitators.EmailAddress, 
					SchoolProviders.ProviderName, SchoolProviders.PhoneNumber, SchoolProviders.MobileNumber, SchoolProviders.FaxNumber, 
					SchoolProviders.EmailAddress, SchoolPresenters.PresenterName, SchoolPresenters.PhoneNumber, SchoolPresenters.MobileNumber, 
					SchoolPresenters.FaxNumber, SchoolPresenters.EmailAddress, SchoolEvents.Hours, SchoolEvents.CPD, SchoolEvents.CODE, 
					SchoolEvents.NQFLevel, SchoolEvents.AccredNum, SchoolEvents.Province, SchoolEvents.RegDeadline,
					SchoolEvents.MemberDiscount, SchoolEvents.EarlyBirdDiscount, SchoolEvents.Cancelled,
					CourseVenues.CourseVenueCity, CourseVenues.CourseVenueArea, SchoolEvents.ProviderID,
					SchoolEvents.SACPCMPNum, SchoolEvents.SACPCMPCategory, SchoolEvents.SACPCMP_CPDPoints
				FROM (SchoolProviders 
					RIGHT JOIN (SchoolFacilitators 
					RIGHT JOIN (SchoolEvents 
					LEFT JOIN CourseVenues ON SchoolEvents.Venue = CourseVenues.CourseVenueName)
						ON SchoolFacilitators.FacilitatorID=SchoolEvents.FacilitatorID) 
						ON SchoolProviders.ProviderID=SchoolEvents.ProviderID) 
					LEFT JOIN SchoolPresenters ON SchoolEvents.PresenterID=SchoolPresenters.PresenterID
				WHERE SchoolEvents.EventID=" . $id;

		// echo 'Please ignore debug info: ' . $sql . '<br />';

		$queryresult = mysql_query($sql) or die(mysql_error() . $sql);

		//odbc_longreadlen($queryresult, 16384);

		if ($row = mysql_fetch_array($queryresult)) {
			$eventname = $row["EventName"];
			$pagetitle = "SCE Event: " . $eventname;


			$bEventInPast = true;
			$DateList = "";

			$sql2 = "SELECT * FROM EventSchedules WHERE EventID=" . $id . " ORDER BY ScheduleDate";
			$queryresult2 = mysql_query($sql2);
			while ($row2 = mysql_fetch_array($queryresult2)) {
				$StartDatePlusTime = date("Y-m-d", strtotime($row2["ScheduleDate"])) . " " . date("H:i:s", strtotime(substr($row2["StartTime"], 11, 5)));
				// echo $StartDatePlusTime;
				$DateList .= "<li>" . date("D j F Y", strtotime($row2["ScheduleDate"])) . "&nbsp;&nbsp;" . substr($row2["StartTime"], 0, 5)
					. " to " . substr($row2["EndTime"], 0, 5) . "<BR></li>";
				if (strtotime($StartDatePlusTime) > time()) $bEventInPast = false;
			}
	?>
			<center>
				<h3><? echo $eventname; ?></h3>
			</center>
			<table border=0 width=100% cellspacing=5 cellpadding=5>
				<tr>
					<td valign=top colspan="2">
						<? echo $row["EventDescription"]; ?></td>
				</tr>
				<?php
				if ($row["Cancelled"] == 1) {
					echo "</table><p><b>This event has been cancelled</b></p>";
				} else {
				?>
					<tr>
						<td valign=top><b>Fee:</b></td>
						<td>
							<?php
							$sql = "SELECT SELECT SchoolCostPackageOptions.`CostPackageOptionID`, EventID, StartDate, OptionName, OptionDesc, AddCost, DisplayOrder
								FROM SchoolEvents 
								JOIN SchoolCostPackages ON (SchoolEvents.`CostPackage`=SchoolCostPackages.`CostPackageID`)
								JOIN SchoolCostPackageOptions ON (SchoolCostPackages.`CostPackageID`=SchoolCostPackageOptions.`PackageID`)
								WHERE SchoolEvents.EventID=" . $row["EventID"] . " 
								ORDER BY SchoolCostPackageOptions.DisplayOrder";
							$recCO = mysql_query($sql);

							$courseStartDate = new DateTime($row["StartDate"]);

							if (mysql_num_rows($recCO) == 0) {
							?>
								<b><? echo "R " . number_format($row["CostPerPerson"], 2, ".", " "); ?>&nbsp;excl. VAT<br />
									<? echo "R " . number_format(ceil($row["CostPerPerson"] * $incvat), 2, ".", " "); ?>&nbsp;incl. VAT<br /></b>
							<?php
							} else {
							?>
								<table border="1" cellspacing="0" cellpadding="2">
									<?php
									
									$numRows = mysql_num_rows($recCO);

									while ($rowCO = mysql_fetch_assoc($recCO)) {
										$courseStartDate = new DateTime($rowCO["StartDate"]);
									?>
										<tr>
											<td><?php echo $rowCO["OptionName"]; ?></td>
											<td>
												<b><? echo "R " . number_format($row["CostPerPerson"] + $rowCO["AddCost"], 2, ".", " "); ?>&nbsp;excl. VAT<br />
													<? echo "R " . number_format(ceil(($row["CostPerPerson"] + $rowCO["AddCost"]) * $incvat), 2, ".", " "); ?>&nbsp;incl. VAT<br /></b>
												<i><?php echo nl2br($rowCO["OptionDesc"]); ?></i>
											</td>
										<?php
									}
										?>
								</table>
							<?php
							}
							if (!empty($row["MemberDiscount"]) && ($row["MemberDiscount"] > 0)) {
							?>
								<i><b class="fee-display">CESA <?php if ($row["ProviderID"] == 155) echo "/ SAICE "; ?>member fee:
										R<?php echo number_format($row["CostPerPerson"] - $row["MemberDiscount"], 2, ".", " "); ?> excl. VAT</b></i><br />
							<?php
							}
							//echo strtotime($row["RegDeadline"])."<br>".time()."<br>";
							if (!empty($row["EarlyBirdDiscount"]) && ($row["EarlyBirdDiscount"] > 0) && (strtotime($row["RegDeadline"]) > time())) {
							?>
								<i><b>R<?php echo number_format($row["EarlyBirdDiscount"], 2); ?> discount excl. VAT for registrations received before
										<?php echo date("d M Y", strtotime($row["RegDeadline"])); ?></b></i><br />
							<?php
							}
							?>
						</td>
					</tr>
					<tr>
						<td valign=top><b>CESA Validation Num:</b></td>
						<td><? echo $row["AccredNum"]; ?></td>
					</tr>
					<tr>
						<td valign=top><b>CPD Points:</b></td>
						<td><? echo $row["CPD"]; ?></td>
					</tr>
					<?php
					
					if (!empty($row["SACPCMPNum"])) {
						?>
						<tr>
							<td valign=top><b>SACPCMP Num:</b></td>
							<td><? echo $row["SACPCMPNum"]; ?></td>
						</tr>
						<tr>
							<td valign=top><b>SACPCMP Category:</b></td>
							<td><? echo $row["SACPCMPCategory"]; ?></td>
						</tr>
						<tr>
							<td valign=top><b>SACPCMP CPD Points:</b></td>
							<td><? echo $row["SACPCMP_CPDPoints"]; ?></td>
						</tr>
						<?php
					}
					
					if (!empty($row["SACNASP_ValidationNumber"])) {
						?>
							<tr>
								<td valign=top><b>SACNASP Validation Number:</b></td>
								<td><? echo $row["SACNASP_ValidationNumber"]; ?></td>
							</tr>
							<tr>
								<td valign=top><b>SACNASP CPD Points:</b></td>
								<td><? echo $row["SACNASP_CPD_Points"]; ?></td>
							</tr>
						<?php
					}
				?>
			</table>
			<hr style="page-break-after:always">
<?php
				}
			}
		}

		mysql_close();

?>
</body>

</html>