Location: PHPKode > projects > Science Lab Inventory & Order Management > sciencelabinv/order_detaildelete.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 "order_detailinfo.php" ?>
<?php include "ordersinfo.php" ?>
<?php include "itemsinfo.php" ?>
<?php include "unitinfo.php" ?>
<?php include "useraccountsinfo.php" ?>
<?php include "userfn7.php" ?>
<?php

// Create page object
$order_detail_delete = new corder_detail_delete();
$Page =& $order_detail_delete;

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

// Page main
$order_detail_delete->Page_Main();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--

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

// page properties
order_detail_delete.PageID = "delete"; // page ID
order_detail_delete.FormID = "forder_detaildelete"; // form ID
var EW_PAGE_ID = order_detail_delete.PageID; // for backward compatibility

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

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

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

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

</script>
<?php

// Load records for display
if ($rs = $order_detail_delete->LoadRecordset())
	$order_detail_deletelTotalRecs = $rs->RecordCount(); // Get record count
if ($order_detail_deletelTotalRecs <= 0) { // No record found, exit
	if ($rs)
		$rs->Close();
	$order_detail_delete->Page_Terminate("order_detaillist.php"); // Return to list
}
?>
<p><span class="phpmaker"><?php echo $Language->Phrase("Delete") ?>&nbsp;<?php echo $Language->Phrase("TblTypeTABLE") ?><?php echo $order_detail->TableCaption() ?><br><br>
<a href="<?php echo $order_detail->getReturnUrl() ?>"><?php echo $Language->Phrase("GoBack") ?></a></span></p>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$order_detail_delete->ShowMessage();
?>
<form action="<?php echo ew_CurrentPage() ?>" method="post">
<p>
<input type="hidden" name="t" id="t" value="order_detail">
<input type="hidden" name="a_delete" id="a_delete" value="D">
<?php foreach ($order_detail_delete->arRecKeys as $key) { ?>
<input type="hidden" name="key_m[]" id="key_m[]" value="<?php echo ew_HtmlEncode($key) ?>">
<?php } ?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable ewTableSeparate">
<?php echo $order_detail->TableCustomInnerHtml ?>
	<thead>
	<tr class="ewTableHeader">
		<td valign="top"><?php echo $order_detail->id->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->order_id->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->item_id->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->quantity->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->unit->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->concentration->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->room_id->FldCaption() ?></td>
		<td valign="top"><?php echo $order_detail->store_id->FldCaption() ?></td>
	</tr>
	</thead>
	<tbody>
<?php
$order_detail_delete->lRecCnt = 0;
$i = 0;
while (!$rs->EOF) {
	$order_detail_delete->lRecCnt++;

	// Set row properties
	$order_detail->CssClass = "";
	$order_detail->CssStyle = "";
	$order_detail->RowAttrs = array();
	$order_detail->RowType = EW_ROWTYPE_VIEW; // View

	// Get the field contents
	$order_detail_delete->LoadRowValues($rs);

	// Render row
	$order_detail_delete->RenderRow();
?>
	<tr<?php echo $order_detail->RowAttributes() ?>>
		<td<?php echo $order_detail->id->CellAttributes() ?>>
<div<?php echo $order_detail->id->ViewAttributes() ?>><?php echo $order_detail->id->ListViewValue() ?></div></td>
		<td<?php echo $order_detail->order_id->CellAttributes() ?>>
<div<?php echo $order_detail->order_id->ViewAttributes() ?>><?php echo $order_detail->order_id->ListViewValue() ?></div></td>
		<td<?php echo $order_detail->item_id->CellAttributes() ?>>
<div<?php echo $order_detail->item_id->ViewAttributes() ?>>
<?php if ($order_detail->item_id->HrefValue <> "" || $order_detail->item_id->TooltipValue <> "" || $order_detail->note->ViewValue <> "") { ?>
<a href="javascript:void(0);" onmouseover="ew_ShowTooltip(this, 'tt_order_detail_x_item_id');" onmouseout="ew_HideTooltip();"><?php echo $order_detail->item_id->ListViewValue() ?></a>
<?php } else { ?>
<?php echo $order_detail->item_id->ListViewValue() ?>
<?php } ?>
</div><div id="tt_order_detail_x_item_id" style="display: none">
<?php if ($order_detail->item_id->TooltipValue <> "") { ?>
<?php echo $order_detail->item_id->TooltipValue ?>
<?php } else { ?>
<div<?php echo $order_detail->note->ViewAttributes() ?>><?php echo $order_detail->note->ViewValue ?></div>
<?php } ?>
</div></td>
		<td<?php echo $order_detail->quantity->CellAttributes() ?>>
<div<?php echo $order_detail->quantity->ViewAttributes() ?>><?php echo $order_detail->quantity->ListViewValue() ?></div></td>
		<td<?php echo $order_detail->unit->CellAttributes() ?>>
<div<?php echo $order_detail->unit->ViewAttributes() ?>><?php echo $order_detail->unit->ListViewValue() ?></div></td>
		<td<?php echo $order_detail->concentration->CellAttributes() ?>>
<div<?php echo $order_detail->concentration->ViewAttributes() ?>><?php echo $order_detail->concentration->ListViewValue() ?></div></td>
		<td<?php echo $order_detail->room_id->CellAttributes() ?>>
<div<?php echo $order_detail->room_id->ViewAttributes() ?>><?php echo $order_detail->room_id->ListViewValue() ?></div></td>
		<td<?php echo $order_detail->store_id->CellAttributes() ?>>
<div<?php echo $order_detail->store_id->ViewAttributes() ?>><?php echo $order_detail->store_id->ListViewValue() ?></div></td>
	</tr>
<?php
	$rs->MoveNext();
}
$rs->Close();
?>
</tbody>
</table>
</div>
</td></tr></table>
<p>
<input type="submit" name="Action" id="Action" value="<?php echo ew_BtnCaption($Language->Phrase("DeleteBtn")) ?>">
</form>
<script language="JavaScript" type="text/javascript">
<!--

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

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

//
// Page class
//
class corder_detail_delete {

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

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

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

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

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

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

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

		// Table object (order_detail)
		$GLOBALS["order_detail"] = new corder_detail();

		// Table object (orders)
		$GLOBALS['orders'] = new corders();

		// Table object (items)
		$GLOBALS['items'] = new citems();

		// Table object (unit)
		$GLOBALS['unit'] = new cunit();

		// Table object (useraccounts)
		$GLOBALS['useraccounts'] = new cuseraccounts();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		// Load key parameters
		$sKey = "";
		$bSingleDelete = TRUE; // Initialize as single delete
		$nKeySelected = 0; // Initialize selected key count
		$sFilter = "";
		if (@$_GET["id"] <> "") {
			$order_detail->id->setQueryStringValue($_GET["id"]);
			if (!is_numeric($order_detail->id->QueryStringValue))
				$this->Page_Terminate("order_detaillist.php"); // Prevent SQL injection, exit
			$sKey .= $order_detail->id->QueryStringValue;
		} else {
			$bSingleDelete = FALSE;
		}
		if ($bSingleDelete) {
			$nKeySelected = 1; // Set up key selected count
			$this->arRecKeys[0] = $sKey;
		} else {
			if (isset($_POST["key_m"])) { // Key in form
				$nKeySelected = count($_POST["key_m"]); // Set up key selected count
				$this->arRecKeys = ew_StripSlashes($_POST["key_m"]);
			}
		}
		if ($nKeySelected <= 0)
			$this->Page_Terminate("order_detaillist.php"); // No key specified, return to list

		// Build filter
		foreach ($this->arRecKeys as $sKey) {
			$sFilter .= "(";

			// Set up key field
			$sKeyFld = $sKey;
			if (!is_numeric($sKeyFld))
				$this->Page_Terminate("order_detaillist.php"); // Prevent SQL injection, return to list
			$sFilter .= "`id`=" . ew_AdjustSql($sKeyFld) . " AND ";
			if (substr($sFilter, -5) == " AND ") $sFilter = substr($sFilter, 0, strlen($sFilter)-5) . ") OR ";
		}
		if (substr($sFilter, -4) == " OR ") $sFilter = substr($sFilter, 0, strlen($sFilter)-4);

		// Set up filter (SQL WHHERE clause) and get return SQL
		// SQL constructor in order_detail class, order_detailinfo.php

		$order_detail->CurrentFilter = $sFilter;

		// Get action
		if (@$_POST["a_delete"] <> "") {
			$order_detail->CurrentAction = $_POST["a_delete"];
		} else {
			$order_detail->CurrentAction = "I"; // Display record
		}
		switch ($order_detail->CurrentAction) {
			case "D": // Delete
				$order_detail->SendEmail = TRUE; // Send email on delete success
				if ($this->DeleteRows()) { // delete rows
					$this->setMessage($Language->Phrase("DeleteSuccess")); // Set up success message
					$this->Page_Terminate($order_detail->getReturnUrl()); // Return to caller
				}
		}
	}

	//
	// Delete records based on current filter
	//
	function DeleteRows() {
		global $conn, $Language, $Security, $order_detail;
		$DeleteRows = TRUE;
		$sWrkFilter = $order_detail->CurrentFilter;

		// Set up filter (SQL WHERE clause) and get return SQL
		// SQL constructor in order_detail class, order_detailinfo.php

		$order_detail->CurrentFilter = $sWrkFilter;
		$sSql = $order_detail->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE) {
			return FALSE;
		} elseif ($rs->EOF) {
			$this->setMessage($Language->Phrase("NoRecord")); // No record found
			$rs->Close();
			return FALSE;
		}
		$conn->BeginTrans();

		// Clone old rows
		$rsold = ($rs) ? $rs->GetRows() : array();
		if ($rs)
			$rs->Close();

		// Call row deleting event
		if ($DeleteRows) {
			foreach ($rsold as $row) {
				$DeleteRows = $order_detail->Row_Deleting($row);
				if (!$DeleteRows) break;
			}
		}
		if ($DeleteRows) {
			$sKey = "";
			foreach ($rsold as $row) {
				$sThisKey = "";
				if ($sThisKey <> "") $sThisKey .= EW_COMPOSITE_KEY_SEPARATOR;
				$sThisKey .= $row['id'];
				$conn->raiseErrorFn = 'ew_ErrorFn';
				$DeleteRows = $conn->Execute($order_detail->DeleteSQL($row)); // Delete
				$conn->raiseErrorFn = '';
				if ($DeleteRows === FALSE)
					break;
				if ($sKey <> "") $sKey .= ", ";
				$sKey .= $sThisKey;
			}
		} else {

			// Set up error message
			if ($order_detail->CancelMessage <> "") {
				$this->setMessage($order_detail->CancelMessage);
				$order_detail->CancelMessage = "";
			} else {
				$this->setMessage($Language->Phrase("DeleteCancelled"));
			}
		}
		if ($DeleteRows) {
			$conn->CommitTrans(); // Commit the changes
		} else {
			$conn->RollbackTrans(); // Rollback changes
		}

		// Call Row Deleted event
		if ($DeleteRows) {
			foreach ($rsold as $row) {
				$order_detail->Row_Deleted($row);
			}	
		}
		return $DeleteRows;
	}

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

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

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

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

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

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

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

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

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

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $order_detail;
		$order_detail->id->setDbValue($rs->fields('id'));
		$order_detail->order_id->setDbValue($rs->fields('order_id'));
		$order_detail->item_id->setDbValue($rs->fields('item_id'));
		$order_detail->quantity->setDbValue($rs->fields('quantity'));
		$order_detail->unit->setDbValue($rs->fields('unit'));
		$order_detail->concentration->setDbValue($rs->fields('concentration'));
		$order_detail->note->setDbValue($rs->fields('note'));
		$order_detail->room_id->setDbValue($rs->fields('room_id'));
		$order_detail->store_id->setDbValue($rs->fields('store_id'));
	}

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

		// Initialize URLs
		// Call Row_Rendering event

		$order_detail->Row_Rendering();

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

		$order_detail->id->CellCssStyle = ""; $order_detail->id->CellCssClass = "";
		$order_detail->id->CellAttrs = array(); $order_detail->id->ViewAttrs = array(); $order_detail->id->EditAttrs = array();

		// order_id
		$order_detail->order_id->CellCssStyle = ""; $order_detail->order_id->CellCssClass = "";
		$order_detail->order_id->CellAttrs = array(); $order_detail->order_id->ViewAttrs = array(); $order_detail->order_id->EditAttrs = array();

		// item_id
		$order_detail->item_id->CellCssStyle = ""; $order_detail->item_id->CellCssClass = "";
		$order_detail->item_id->CellAttrs = array(); $order_detail->item_id->ViewAttrs = array(); $order_detail->item_id->EditAttrs = array();

		// quantity
		$order_detail->quantity->CellCssStyle = ""; $order_detail->quantity->CellCssClass = "";
		$order_detail->quantity->CellAttrs = array(); $order_detail->quantity->ViewAttrs = array(); $order_detail->quantity->EditAttrs = array();

		// unit
		$order_detail->unit->CellCssStyle = ""; $order_detail->unit->CellCssClass = "";
		$order_detail->unit->CellAttrs = array(); $order_detail->unit->ViewAttrs = array(); $order_detail->unit->EditAttrs = array();

		// concentration
		$order_detail->concentration->CellCssStyle = ""; $order_detail->concentration->CellCssClass = "";
		$order_detail->concentration->CellAttrs = array(); $order_detail->concentration->ViewAttrs = array(); $order_detail->concentration->EditAttrs = array();

		// room_id
		$order_detail->room_id->CellCssStyle = ""; $order_detail->room_id->CellCssClass = "";
		$order_detail->room_id->CellAttrs = array(); $order_detail->room_id->ViewAttrs = array(); $order_detail->room_id->EditAttrs = array();

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

			// id
			$order_detail->id->ViewValue = $order_detail->id->CurrentValue;
			$order_detail->id->CssStyle = "";
			$order_detail->id->CssClass = "";
			$order_detail->id->ViewCustomAttributes = "";

			// order_id
			if (strval($order_detail->order_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = " . ew_AdjustSql($order_detail->order_id->CurrentValue) . "";
			$sSqlWrk = "SELECT `teacher`, `lesson` FROM `orders`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `request_date` Desc";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$order_detail->order_id->ViewValue = $rswrk->fields('teacher');
					$order_detail->order_id->ViewValue .= ew_ValueSeparator(0) . $rswrk->fields('lesson');
					$rswrk->Close();
				} else {
					$order_detail->order_id->ViewValue = $order_detail->order_id->CurrentValue;
				}
			} else {
				$order_detail->order_id->ViewValue = NULL;
			}
			$order_detail->order_id->CssStyle = "font-weight:bold;";
			$order_detail->order_id->CssClass = "";
			$order_detail->order_id->ViewCustomAttributes = "";

			// item_id
			if (strval($order_detail->item_id->CurrentValue) <> "") {
				$sFilterWrk = "`id` = " . ew_AdjustSql($order_detail->item_id->CurrentValue) . "";
			$sSqlWrk = "SELECT DISTINCT `name` FROM `items`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `name` Asc";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$order_detail->item_id->ViewValue = $rswrk->fields('name');
					$rswrk->Close();
				} else {
					$order_detail->item_id->ViewValue = $order_detail->item_id->CurrentValue;
				}
			} else {
				$order_detail->item_id->ViewValue = NULL;
			}
			$order_detail->item_id->CssStyle = "";
			$order_detail->item_id->CssClass = "";
			$order_detail->item_id->ViewCustomAttributes = "";

			// quantity
			$order_detail->quantity->ViewValue = $order_detail->quantity->CurrentValue;
			$order_detail->quantity->CssStyle = "";
			$order_detail->quantity->CssClass = "";
			$order_detail->quantity->ViewCustomAttributes = "";

			// unit
			if (strval($order_detail->unit->CurrentValue) <> "") {
				$sFilterWrk = "`unit` = '" . ew_AdjustSql($order_detail->unit->CurrentValue) . "'";
			$sSqlWrk = "SELECT `unit` FROM `unit`";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$sSqlWrk .= " ORDER BY `unit` Asc";
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$order_detail->unit->ViewValue = $rswrk->fields('unit');
					$rswrk->Close();
				} else {
					$order_detail->unit->ViewValue = $order_detail->unit->CurrentValue;
				}
			} else {
				$order_detail->unit->ViewValue = NULL;
			}
			$order_detail->unit->CssStyle = "";
			$order_detail->unit->CssClass = "";
			$order_detail->unit->ViewCustomAttributes = "";

			// concentration
			$order_detail->concentration->ViewValue = $order_detail->concentration->CurrentValue;
			$order_detail->concentration->CssStyle = "";
			$order_detail->concentration->CssClass = "";
			$order_detail->concentration->ViewCustomAttributes = "";

			// room_id
			$order_detail->room_id->ViewValue = $order_detail->room_id->CurrentValue;
			$order_detail->room_id->CssStyle = "font-weight:bold;font-style:italic;";
			$order_detail->room_id->CssClass = "";
			$order_detail->room_id->ViewCustomAttributes = "";

			// store_id
			$order_detail->store_id->ViewValue = $order_detail->store_id->CurrentValue;
			$order_detail->store_id->CssStyle = "font-weight:bold;font-style:italic;";
			$order_detail->store_id->CssClass = "";
			$order_detail->store_id->ViewCustomAttributes = "";

			// id
			$order_detail->id->HrefValue = "";
			$order_detail->id->TooltipValue = "";

			// order_id
			$order_detail->order_id->HrefValue = "";
			$order_detail->order_id->TooltipValue = "";

			// item_id
			$order_detail->item_id->HrefValue = "";
			$order_detail->item_id->TooltipValue = $order_detail->note->CurrentValue;

			// quantity
			$order_detail->quantity->HrefValue = "";
			$order_detail->quantity->TooltipValue = "";

			// unit
			$order_detail->unit->HrefValue = "";
			$order_detail->unit->TooltipValue = "";

			// concentration
			$order_detail->concentration->HrefValue = "";
			$order_detail->concentration->TooltipValue = "";

			// room_id
			$order_detail->room_id->HrefValue = "";
			$order_detail->room_id->TooltipValue = "";

			// store_id
			$order_detail->store_id->HrefValue = "";
			$order_detail->store_id->TooltipValue = "";
		}

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

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

	}
}
?>
Return current item: Science Lab Inventory & Order Management