<?php

// Global variable for table object
$estimasi_stok = NULL;

//
// Table class for estimasi_stok
//
class crestimasi_stok extends crTableCrosstab {
	var $tanggal_akses;
	var $var_nama;
	var $jenis_lahan;
	var $tanggal_panen;
	var $tanggal_kirim;
	var $jumlah_estimasi;
	var $jumlah_order;
	var $stok;
	var $tanggal_stok;
	var $YEAR__tanggal_stok;

	//
	// Table class constructor
	//
	function __construct() {
		global $ReportLanguage, $gsLanguage;
		$this->TableVar = 'estimasi_stok';
		$this->TableName = 'estimasi_stok';
		$this->TableType = 'REPORT';
		$this->DBID = 'DB';
		$this->ExportAll = FALSE;
		$this->ExportPageBreakCount = 0;

		// tanggal_akses
		$this->tanggal_akses = new crField('estimasi_stok', 'estimasi_stok', 'x_tanggal_akses', 'tanggal_akses', '`tanggal_akses`', 133, EWR_DATATYPE_DATE, 0);
		$this->tanggal_akses->Sortable = TRUE; // Allow sort
		$this->tanggal_akses->FldDefaultErrMsg = str_replace("%s", $GLOBALS["EWR_DATE_FORMAT"], $ReportLanguage->Phrase("IncorrectDate"));
		$this->fields['tanggal_akses'] = &$this->tanggal_akses;
		$this->tanggal_akses->DateFilter = "";
		$this->tanggal_akses->SqlSelect = "";
		$this->tanggal_akses->SqlOrderBy = "";

		// var_nama
		$this->var_nama = new crField('estimasi_stok', 'estimasi_stok', 'x_var_nama', 'var_nama', '`var_nama`', 200, EWR_DATATYPE_STRING, -1);
		$this->var_nama->Sortable = TRUE; // Allow sort
		$this->var_nama->GroupingFieldId = 1;
		$this->fields['var_nama'] = &$this->var_nama;
		$this->var_nama->DateFilter = "";
		$this->var_nama->SqlSelect = "";
		$this->var_nama->SqlOrderBy = "";

		// jenis_lahan
		$this->jenis_lahan = new crField('estimasi_stok', 'estimasi_stok', 'x_jenis_lahan', 'jenis_lahan', '`jenis_lahan`', 200, EWR_DATATYPE_STRING, -1);
		$this->jenis_lahan->Sortable = TRUE; // Allow sort
		$this->jenis_lahan->GroupingFieldId = 2;
		$this->fields['jenis_lahan'] = &$this->jenis_lahan;
		$this->jenis_lahan->DateFilter = "";
		$this->jenis_lahan->SqlSelect = "";
		$this->jenis_lahan->SqlOrderBy = "";

		// tanggal_panen
		$this->tanggal_panen = new crField('estimasi_stok', 'estimasi_stok', 'x_tanggal_panen', 'tanggal_panen', '`tanggal_panen`', 133, EWR_DATATYPE_DATE, 0);
		$this->tanggal_panen->Sortable = TRUE; // Allow sort
		$this->tanggal_panen->FldDefaultErrMsg = str_replace("%s", $GLOBALS["EWR_DATE_FORMAT"], $ReportLanguage->Phrase("IncorrectDate"));
		$this->fields['tanggal_panen'] = &$this->tanggal_panen;
		$this->tanggal_panen->DateFilter = "Day";
		$this->tanggal_panen->SqlSelect = "";
		$this->tanggal_panen->SqlOrderBy = "";
		ewr_RegisterFilter($this->tanggal_panen, "@@Last30Days", $ReportLanguage->Phrase("Last30Days"), "ewr_IsLast30Days");
		ewr_RegisterFilter($this->tanggal_panen, "@@Last14Days", $ReportLanguage->Phrase("Last14Days"), "ewr_IsLast14Days");
		ewr_RegisterFilter($this->tanggal_panen, "@@Last7Days", $ReportLanguage->Phrase("Last7Days"), "ewr_IsLast7Days");
		ewr_RegisterFilter($this->tanggal_panen, "@@Next7Days", $ReportLanguage->Phrase("Next7Days"), "ewr_IsNext7Days");
		ewr_RegisterFilter($this->tanggal_panen, "@@Next14Days", $ReportLanguage->Phrase("Next14Days"), "ewr_IsNext14Days");
		ewr_RegisterFilter($this->tanggal_panen, "@@Next30Days", $ReportLanguage->Phrase("Next30Days"), "ewr_IsNext30Days");

		// tanggal_kirim
		$this->tanggal_kirim = new crField('estimasi_stok', 'estimasi_stok', 'x_tanggal_kirim', 'tanggal_kirim', '`tanggal_kirim`', 133, EWR_DATATYPE_DATE, 0);
		$this->tanggal_kirim->Sortable = TRUE; // Allow sort
		$this->tanggal_kirim->FldDefaultErrMsg = str_replace("%s", $GLOBALS["EWR_DATE_FORMAT"], $ReportLanguage->Phrase("IncorrectDate"));
		$this->fields['tanggal_kirim'] = &$this->tanggal_kirim;
		$this->tanggal_kirim->DateFilter = "Day";
		$this->tanggal_kirim->SqlSelect = "";
		$this->tanggal_kirim->SqlOrderBy = "";
		ewr_RegisterFilter($this->tanggal_kirim, "@@Last30Days", $ReportLanguage->Phrase("Last30Days"), "ewr_IsLast30Days");
		ewr_RegisterFilter($this->tanggal_kirim, "@@Last14Days", $ReportLanguage->Phrase("Last14Days"), "ewr_IsLast14Days");
		ewr_RegisterFilter($this->tanggal_kirim, "@@Last7Days", $ReportLanguage->Phrase("Last7Days"), "ewr_IsLast7Days");
		ewr_RegisterFilter($this->tanggal_kirim, "@@Next7Days", $ReportLanguage->Phrase("Next7Days"), "ewr_IsNext7Days");
		ewr_RegisterFilter($this->tanggal_kirim, "@@Next14Days", $ReportLanguage->Phrase("Next14Days"), "ewr_IsNext14Days");
		ewr_RegisterFilter($this->tanggal_kirim, "@@Next30Days", $ReportLanguage->Phrase("Next30Days"), "ewr_IsNext30Days");

		// jumlah_estimasi
		$this->jumlah_estimasi = new crField('estimasi_stok', 'estimasi_stok', 'x_jumlah_estimasi', 'jumlah_estimasi', '`jumlah_estimasi`', 3, EWR_DATATYPE_NUMBER, -1);
		$this->jumlah_estimasi->Sortable = TRUE; // Allow sort
		$this->jumlah_estimasi->FldDefaultErrMsg = $ReportLanguage->Phrase("IncorrectInteger");
		$this->fields['jumlah_estimasi'] = &$this->jumlah_estimasi;
		$this->jumlah_estimasi->DateFilter = "";
		$this->jumlah_estimasi->SqlSelect = "";
		$this->jumlah_estimasi->SqlOrderBy = "";

		// jumlah_order
		$this->jumlah_order = new crField('estimasi_stok', 'estimasi_stok', 'x_jumlah_order', 'jumlah_order', '`jumlah_order`', 3, EWR_DATATYPE_NUMBER, -1);
		$this->jumlah_order->Sortable = TRUE; // Allow sort
		$this->jumlah_order->FldDefaultErrMsg = $ReportLanguage->Phrase("IncorrectInteger");
		$this->fields['jumlah_order'] = &$this->jumlah_order;
		$this->jumlah_order->DateFilter = "";
		$this->jumlah_order->SqlSelect = "";
		$this->jumlah_order->SqlOrderBy = "";

		// stok
		$this->stok = new crField('estimasi_stok', 'estimasi_stok', 'x_stok', 'stok', '`stok`', 3, EWR_DATATYPE_NUMBER, -1);
		$this->stok->Sortable = TRUE; // Allow sort
		$this->stok->FldDefaultErrMsg = $ReportLanguage->Phrase("IncorrectInteger");
		$this->fields['stok'] = &$this->stok;
		$this->stok->DateFilter = "";
		$this->stok->SqlSelect = "";
		$this->stok->SqlOrderBy = "";

		// tanggal_stok
		$this->tanggal_stok = new crField('estimasi_stok', 'estimasi_stok', 'x_tanggal_stok', 'tanggal_stok', '`tanggal_stok`', 133, EWR_DATATYPE_DATE, 0);
		$this->tanggal_stok->Sortable = TRUE; // Allow sort
		$this->tanggal_stok->FldDefaultErrMsg = str_replace("%s", $GLOBALS["EWR_DATE_FORMAT"], $ReportLanguage->Phrase("IncorrectDate"));
		$this->fields['tanggal_stok'] = &$this->tanggal_stok;
		$this->tanggal_stok->DateFilter = "";
		$this->tanggal_stok->SqlSelect = "";
		$this->tanggal_stok->SqlOrderBy = "";

		// YEAR__tanggal_stok
		$this->YEAR__tanggal_stok = new crField('estimasi_stok', 'estimasi_stok', 'x_YEAR__tanggal_stok', 'YEAR__tanggal_stok', 'YEAR(`tanggal_stok`)', 3, EWR_DATATYPE_NUMBER, 0, FALSE);
		$this->fields['YEAR__tanggal_stok'] = &$this->YEAR__tanggal_stok;
		$this->YEAR__tanggal_stok->SqlSelect = "SELECT DISTINCT YEAR(`tanggal_stok`), YEAR(`tanggal_stok`) AS `DispFld` FROM " . $this->getSqlFrom();
		$this->YEAR__tanggal_stok->SqlOrderBy = "YEAR(`tanggal_stok`)";
	}

	// Set Field Visibility
	function SetFieldVisibility($fldparm) {
		global $Security;
		return $this->$fldparm->Visible; // Returns original value
	}

	// Single column sort
	function UpdateSort(&$ofld) {
		if ($this->CurrentOrder == $ofld->FldName) {
			$sSortField = $ofld->FldExpression;
			$sLastSort = $ofld->getSort();
			if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") {
				$sThisSort = $this->CurrentOrderType;
			} else {
				$sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC";
			}
			$ofld->setSort($sThisSort);
			if ($ofld->GroupingFieldId == 0)
				$this->setDetailOrderBy($sSortField . " " . $sThisSort); // Save to Session
		} else {
			if ($ofld->GroupingFieldId == 0) $ofld->setSort("");
		}
	}

	// Get Sort SQL
	function SortSql() {
		$sDtlSortSql = $this->getDetailOrderBy(); // Get ORDER BY for detail fields from session
		$argrps = array();
		foreach ($this->fields as $fld) {
			if ($fld->getSort() <> "") {
				$fldsql = $fld->FldExpression;
				if ($fld->GroupingFieldId > 0) {
					if ($fld->FldGroupSql <> "")
						$argrps[$fld->GroupingFieldId] = str_replace("%s", $fldsql, $fld->FldGroupSql) . " " . $fld->getSort();
					else
						$argrps[$fld->GroupingFieldId] = $fldsql . " " . $fld->getSort();
				}
			}
		}
		$sSortSql = "";
		foreach ($argrps as $grp) {
			if ($sSortSql <> "") $sSortSql .= ", ";
			$sSortSql .= $grp;
		}
		if ($sDtlSortSql <> "") {
			if ($sSortSql <> "") $sSortSql .= ", ";
			$sSortSql .= $sDtlSortSql;
		}
		return $sSortSql;
	}

	// Table level SQL
	// Column field

	var $ColumnField = "";

	function getColumnField() {
		return ($this->ColumnField <> "") ? $this->ColumnField : "`tanggal_stok`";
	}

	function setColumnField($v) {
		$this->ColumnField = $v;
	}

	// Column date type
	var $ColumnDateType = "";

	function getColumnDateType() {
		return ($this->ColumnDateType <> "") ? $this->ColumnDateType : "m";
	}

	function setColumnDateType($v) {
		$this->ColumnDateType = $v;
	}

	// Column captions
	var $ColumnCaptions = "";

	function getColumnCaptions() {
		global $ReportLanguage;
		return ($this->ColumnCaptions <> "") ? $this->ColumnCaptions : $ReportLanguage->Phrase("MonthJan") . "," . $ReportLanguage->Phrase("MonthFeb") . "," . $ReportLanguage->Phrase("MonthMar") . "," . $ReportLanguage->Phrase("MonthApr") . "," . $ReportLanguage->Phrase("MonthMay") . "," . $ReportLanguage->Phrase("MonthJun") . "," . $ReportLanguage->Phrase("MonthJul") . "," . $ReportLanguage->Phrase("MonthAug") . "," . $ReportLanguage->Phrase("MonthSep") . "," . $ReportLanguage->Phrase("MonthOct") . "," . $ReportLanguage->Phrase("MonthNov") . "," . $ReportLanguage->Phrase("MonthDec");
	}

	function setColumnCaptions($v) {
		$this->ColumnCaptions = $v;
	}

	// Column names
	var $ColumnNames = "";

	function getColumnNames() {
		return ($this->ColumnNames <> "") ? $this->ColumnNames : "MonthJan,MonthFeb,MonthMar,MonthApr,MonthMay,MonthJun,MonthJul,MonthAug,MonthSep,MonthOct,MonthNov,MonthDec";
	}

	function setColumnNames($v) {
		$this->ColumnNames = $v;
	}

	// Column values
	var $ColumnValues = "";

	function getColumnValues() {
		return ($this->ColumnValues <> "") ? $this->ColumnValues : "1,2,3,4,5,6,7,8,9,10,11,12";
	}

	function setColumnValues($v) {
		$this->ColumnValues = $v;
	}

	// From
	var $_SqlFrom = "";

	function getSqlFrom() {
		return ($this->_SqlFrom <> "") ? $this->_SqlFrom : "`view3`";
	}

	function SqlFrom() { // For backward compatibility
		return $this->getSqlFrom();
	}

	function setSqlFrom($v) {
		$this->_SqlFrom = $v;
	}

	// Select
	var $_SqlSelect = "";

	function getSqlSelect() {
		return ($this->_SqlSelect <> "") ? $this->_SqlSelect : "SELECT `var_nama`, `jenis_lahan`, YEAR(`tanggal_stok`) AS `YEAR__tanggal_stok`, <DistinctColumnFields> FROM " . $this->getSqlFrom();
	}

	function SqlSelect() { // For backward compatibility
		return $this->getSqlSelect();
	}

	function setSqlSelect($v) {
		$this->_SqlSelect = $v;
	}

	// Where
	var $_SqlWhere = "";

	function getSqlWhere() {
		$sWhere = ($this->_SqlWhere <> "") ? $this->_SqlWhere : "";
		return $sWhere;
	}

	function SqlWhere() { // For backward compatibility
		return $this->getSqlWhere();
	}

	function setSqlWhere($v) {
		$this->_SqlWhere = $v;
	}

	// Group By
	var $_SqlGroupBy = "";

	function getSqlGroupBy() {
		return ($this->_SqlGroupBy <> "") ? $this->_SqlGroupBy : "`var_nama`, `jenis_lahan`, YEAR(`tanggal_stok`)";
	}

	function SqlGroupBy() { // For backward compatibility
		return $this->getSqlGroupBy();
	}

	function setSqlGroupBy($v) {
		$this->_SqlGroupBy = $v;
	}

	// Having
	var $_SqlHaving = "";

	function getSqlHaving() {
		return ($this->_SqlHaving <> "") ? $this->_SqlHaving : "";
	}

	function SqlHaving() { // For backward compatibility
		return $this->getSqlHaving();
	}

	function setSqlHaving($v) {
		$this->_SqlHaving = $v;
	}

	// Order By
	var $_SqlOrderBy = "";

	function getSqlOrderBy() {
		return ($this->_SqlOrderBy <> "") ? $this->_SqlOrderBy : "`var_nama` ASC, `jenis_lahan` ASC, YEAR(`tanggal_stok`)";
	}

	function SqlOrderBy() { // For backward compatibility
		return $this->getSqlOrderBy();
	}

	function setSqlOrderBy($v) {
		$this->_SqlOrderBy = $v;
	}

	// Crosstab Year
	var $_SqlCrosstabYear = "";

	function getSqlCrosstabYear() {
		return ($this->_SqlCrosstabYear <> "") ? $this->_SqlCrosstabYear : "SELECT DISTINCT YEAR(`tanggal_stok`) AS `YEAR__tanggal_stok` FROM `view3` ORDER BY YEAR(`tanggal_stok`)";
	}

	function SqlCrosstabYear() { // For backward compatibility
		return $this->getSqlCrosstabYear();
	}

	function setSqlCrosstabYear($v) {
		$this->_SqlCrosstabYear = $v;
	}
	var $ColCount;
	var $Col;
	var $DistinctColumnFields = "";

	// Load column values
	function LoadColumnValues($filter = "") {
		global $ReportLanguage;
		$conn = &$this->Connection();
		$arColumnCaptions = explode(",", $this->getColumnCaptions());
		$arColumnNames = explode(",", $this->getColumnNames());
		$arColumnValues = explode(",", $this->getColumnValues());

		// Get distinct column count
		$this->ColCount = count($arColumnNames);
		$this->Col = &ewr_Init2DArray($this->ColCount+1, 3, NULL);
		for ($colcnt = 1; $colcnt <= $this->ColCount; $colcnt++) {
			$this->Col[$colcnt] = new crCrosstabColumn($arColumnValues[$colcnt-1], $arColumnCaptions[$colcnt-1], TRUE);
		}

		// 1st dimension = no of groups (level 0 used for grand total)
		// 2nd dimension = no of distinct values

		$nGrps = 2;
		$this->SummaryFields[0] = new crSummaryField('x_stok', 'stok', '`stok`', 'SUM');
		$this->SummaryFields[0]->SummaryCaption = $ReportLanguage->Phrase("RptSum");
		$this->SummaryFields[0]->SummaryVal = &ewr_InitArray($this->ColCount+1, NULL);
		$this->SummaryFields[0]->SummaryValCnt = &ewr_InitArray($this->ColCount+1, NULL);
		$this->SummaryFields[0]->SummaryCnt = &ewr_Init2DArray($this->ColCount+1, $nGrps+1, NULL);
		$this->SummaryFields[0]->SummarySmry = &ewr_Init2DArray($this->ColCount+1, $nGrps+1, NULL);
		$this->SummaryFields[0]->SummarySmryCnt = &ewr_Init2DArray($this->ColCount+1, $nGrps+1, NULL);
		$this->SummaryFields[0]->SummaryInitValue = 0;

		// Update crosstab sql
		$sSqlFlds = "";
		$cnt = count($this->SummaryFields);
		for ($is = 0; $is < $cnt; $is++) {
			$smry = &$this->SummaryFields[$is];
			for ($i = 0; $i < $this->ColCount; $i++) {
				$sFld = ewr_CrossTabField($smry->SummaryType, $smry->FldExpression,
					$this->getColumnField(), $this->getColumnDateType(), $arColumnValues[$i], "", $arColumnNames[$i] . $is, $this->DBID);
				if ($sSqlFlds <> "")
					$sSqlFlds .= ", ";
				$sSqlFlds .= $sFld;
			}
		}
		$this->DistinctColumnFields = $sSqlFlds;
	}

	// Table Level Group SQL
	// First Group Field

	var $_SqlFirstGroupField = "";

	function getSqlFirstGroupField() {
		return ($this->_SqlFirstGroupField <> "") ? $this->_SqlFirstGroupField : "`var_nama`";
	}

	function SqlFirstGroupField() { // For backward compatibility
		return $this->getSqlFirstGroupField();
	}

	function setSqlFirstGroupField($v) {
		$this->_SqlFirstGroupField = $v;
	}

	// Select Group
	var $_SqlSelectGroup = "";

	function getSqlSelectGroup() {
		return ($this->_SqlSelectGroup <> "") ? $this->_SqlSelectGroup : "SELECT DISTINCT " . $this->getSqlFirstGroupField() . " FROM " . $this->getSqlFrom();
	}

	function SqlSelectGroup() { // For backward compatibility
		return $this->getSqlSelectGroup();
	}

	function setSqlSelectGroup($v) {
		$this->_SqlSelectGroup = $v;
	}

	// Order By Group
	var $_SqlOrderByGroup = "";

	function getSqlOrderByGroup() {
		return ($this->_SqlOrderByGroup <> "") ? $this->_SqlOrderByGroup : "`var_nama` ASC";
	}

	function SqlOrderByGroup() { // For backward compatibility
		return $this->getSqlOrderByGroup();
	}

	function setSqlOrderByGroup($v) {
		$this->_SqlOrderByGroup = $v;
	}

	// Select Aggregate
	var $_SqlSelectAgg = "";

	function getSqlSelectAgg() {
		return ($this->_SqlSelectAgg <> "") ? $this->_SqlSelectAgg : "SELECT YEAR(`tanggal_stok`) AS `YEAR__tanggal_stok`, <DistinctColumnFields> FROM " . $this->getSqlFrom();
	}

	function SqlSelectAgg() { // For backward compatibility
		return $this->getSqlSelectAgg();
	}

	function setSqlSelectAgg($v) {
		$this->_SqlSelectAgg = $v;
	}

	// Group By Aggregate
	var $_SqlGroupByAgg = "";

	function getSqlGroupByAgg() {
		return ($this->_SqlGroupByAgg <> "") ? $this->_SqlGroupByAgg : "YEAR(`tanggal_stok`)";
	}

	function SqlGroupByAgg() { // For backward compatibility
		return $this->getSqlGroupByAgg();
	}

	function setSqlGroupByAgg($v) {
		$this->_SqlGroupByAgg = $v;
	}

	// Sort URL
	function SortUrl(&$fld) {
		return "";
	}

	// Setup lookup filters of a field
	function SetupLookupFilters($fld) {
		global $gsLanguage;
		switch ($fld->FldVar) {
		case "x_var_nama":
			$sSqlWrk = "";
		$sSqlWrk = "SELECT DISTINCT `var_nama`, `var_nama` AS `DispFld`, '' AS `DispFld2`, '' AS `DispFld3`, '' AS `DispFld4` FROM `view3`";
		$sWhereWrk = "";
		$this->var_nama->LookupFilters = array();
			$fld->LookupFilters += array("s" => $sSqlWrk, "d" => "DB", "f0" => '`var_nama` = {filter_value}', "t0" => "200", "fn0" => "", "dlm" => ewr_Encrypt($fld->FldDelimiter));
			$sSqlWrk = "";
		$this->Lookup_Selecting($this->var_nama, $sWhereWrk); // Call Lookup selecting
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
		$sSqlWrk .= " ORDER BY `var_nama` ASC";
			if ($sSqlWrk <> "")
				$fld->LookupFilters["s"] .= $sSqlWrk;
			break;
		case "x_jenis_lahan":
			$sSqlWrk = "";
		$sSqlWrk = "SELECT DISTINCT `jenis_lahan`, `jenis_lahan` AS `DispFld`, '' AS `DispFld2`, '' AS `DispFld3`, '' AS `DispFld4` FROM `view3`";
		$sWhereWrk = "";
		$this->jenis_lahan->LookupFilters = array();
			$fld->LookupFilters += array("s" => $sSqlWrk, "d" => "DB", "f0" => '`jenis_lahan` = {filter_value}', "t0" => "200", "fn0" => "", "dlm" => ewr_Encrypt($fld->FldDelimiter));
			$sSqlWrk = "";
		$this->Lookup_Selecting($this->jenis_lahan, $sWhereWrk); // Call Lookup selecting
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
		$sSqlWrk .= " ORDER BY `jenis_lahan` ASC";
			if ($sSqlWrk <> "")
				$fld->LookupFilters["s"] .= $sSqlWrk;
			break;
		}
	}

	// Setup AutoSuggest filters of a field
	function SetupAutoSuggestFilters($fld) {
		global $gsLanguage;
		switch ($fld->FldVar) {
		}
	}

	// Table level events
	// Page Selecting event
	function Page_Selecting(&$filter) {

		// Enter your code here
	}

	// Page Breaking event
	function Page_Breaking(&$break, &$content) {

		// Example:
		//$break = FALSE; // Skip page break, or
		//$content = "<div style=\"page-break-after:always;\">&nbsp;</div>"; // Modify page break content

	}

	// Row Rendering event
	function Row_Rendering() {

		// Enter your code here
	}

	// Cell Rendered event
	function Cell_Rendered(&$Field, $CurrentValue, &$ViewValue, &$ViewAttrs, &$CellAttrs, &$HrefValue, &$LinkAttrs) {

		//$ViewValue = "xxx";
		//$ViewAttrs["style"] = "xxx";

	}

	// Row Rendered event
	function Row_Rendered() {

		// To view properties of field class, use:
		//var_dump($this-><FieldName>);

	}

	// User ID Filtering event
	function UserID_Filtering(&$filter) {

		// Enter your code here
	}

	// Load Filters event
	function Page_FilterLoad() {

		// Enter your code here
		// Example: Register/Unregister Custom Extended Filter
		//ewr_RegisterFilter($this-><Field>, 'StartsWithA', 'Starts With A', 'GetStartsWithAFilter'); // With function, or
		//ewr_RegisterFilter($this-><Field>, 'StartsWithA', 'Starts With A'); // No function, use Page_Filtering event
		//ewr_UnregisterFilter($this-><Field>, 'StartsWithA');

	}

	// Page Filter Validated event
	function Page_FilterValidated() {

		// Example:
		//$this->MyField1->SearchValue = "your search criteria"; // Search value

	}

	// Page Filtering event
	function Page_Filtering(&$fld, &$filter, $typ, $opr = "", $val = "", $cond = "", $opr2 = "", $val2 = "") {

		// Note: ALWAYS CHECK THE FILTER TYPE ($typ)! Example:
		//if ($typ == "dropdown" && $fld->FldName == "MyField") // Dropdown filter
		//	$filter = "..."; // Modify the filter
		//if ($typ == "extended" && $fld->FldName == "MyField") // Extended filter
		//	$filter = "..."; // Modify the filter
		//if ($typ == "popup" && $fld->FldName == "MyField") // Popup filter
		//	$filter = "..."; // Modify the filter
		//if ($typ == "custom" && $opr == "..." && $fld->FldName == "MyField") // Custom filter, $opr is the custom filter ID
		//	$filter = "..."; // Modify the filter

	}

	// Email Sending event
	function Email_Sending(&$Email, &$Args) {

		//var_dump($Email); var_dump($Args); exit();
		return TRUE;
	}

	// Lookup Selecting event
	function Lookup_Selecting($fld, &$filter) {

		// Enter your code here
	}
}
?>
