Ejemplo n.º 1
0
	/**
	 * @param Array keys
	 * @param Boolean forLookup
	 * @param String _table
	 * @param String _field
	 * @param String pageType
	 * @return Array
	 */
	public function GetAddedDataLookupQuery($keys, $forLookup, $_table, $_field, $pageType)
	{	
		$lookupMainSettings = getLookupMainTableSettings($this->tName, $_table, $_field, $pageType);
		if(!$lookupMainSettings)
			return array();

		global $conn;		
		$LookupSQL = "";
		$mainField = $_field;	
		$mainTable = $lookupMainSettings->getTableName();
		$linkFieldName = $lookupMainSettings->getLinkField($mainField);
		$dispfield = $lookupMainSettings->getDisplayField($mainField);
		
		$nLookupType = $lookupMainSettings->getLookupType($mainField);
		if($nLookupType == LT_QUERY)
		{
			if($lookupMainSettings->getCustomDisplay($mainField))
				$this->pSet->getSQLQuery()->AddCustomExpression($dispfield, $this->pSet, $mainTable, $mainField);
			$lookupQueryObj = $this->pSet->getSQLQuery()->CloneObject();
		}
		else
		{
			$LookupSQL = "select ";
			$LookupSQL .= GetFullFieldName($linkFieldName, $this->tName, true);
			if($linkFieldName != $dispfield)
				$LookupSQL .= "," . $this->pSet->getLWDisplayField($mainField, true);
			$LookupSQL.=" from ".AddTableWrappers($this->strOriginalTableName);
		}
			
		$data = 0;
		$lookupIndexes = array("linkFieldIndex" => 0, "displayFieldIndex" => 0);
		if(count($keys))
		{
			$where = KeyWhere($keys);
			if($nLookupType == LT_QUERY)
				$LookupSQL = $lookupQueryObj->toSql(whereAdd($lookupQueryObj->m_where->toSql($lookupQueryObj), $where));
			else 
				$LookupSQL.=" where ".$where;
			$lookupIndexes = GetLookupFieldsIndexes($lookupMainSettings, $mainField);
			LogInfo($LookupSQL);
			if($forLookup)
			{
				$rs=db_query($LookupSQL,$conn);
				$data = $this->cipherer->DecryptFetchedArray($rs);
			}
			else if($LookupSQL)
			{
				$rs = db_query($LookupSQL,$conn);
				$data = db_fetch_numarray($rs);
				$data[$lookupIndexes["linkFieldIndex"]] = $this->cipherer->DecryptField($linkFieldName, $data[$lookupIndexes["linkFieldIndex"]]);
				if($nLookupType == LT_QUERY)
					$data[$lookupIndexes["displayFieldIndex"]] = $this->cipherer->DecryptField($dispfield, $data[$lookupIndexes["displayFieldIndex"]]);		
			}
		}

		return array($data, array("linkField" => $linkFieldName, "displayField" => $dispfield
			, "linkFieldIndex" => $lookupIndexes["linkFieldIndex"], "displayFieldIndex" => $lookupIndexes["displayFieldIndex"]));
	}	
Ejemplo n.º 2
0
 function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
 {
     $baseResult = $this->baseSQLWhere($strSearchOption);
     if ($baseResult === false) {
         return "";
     }
     if ($baseResult != "") {
         return $baseResult;
     }
     if ($SearchFor == "none") {
         return "";
     }
     if (NeedQuotes($this->type)) {
         $fullFieldName = GetFullFieldName($this->field);
         if ($SearchFor == "on") {
             $whereStr = "(" . $fullFieldName . "<>'0' ";
             if (!$this->isOracle) {
                 $whereStr .= " and " . $fullFieldName . "<>'' ";
             }
             $whereStr .= " and " . $fullFieldName . " is not null)";
             $whereStr .= " and abs(case textregexeq(" . $fullFieldName . ", '^(\\-)?[[:digit:]]+(\\.[[:digit:]]+)?\$') when true then to_number(" . $fullFieldName . ", '999999999') else 0 end) > 0";
             $whereStr .= " and abs(val(" . $fullFieldName . ")) > 0";
             return $whereStr;
         } elseif ($SearchFor == "off") {
             $whereStr = "(" . GetFullFieldName($this->field) . "='0' ";
             if (!$this->isOracle) {
                 $whereStr .= " or " . GetFullFieldName($this->field) . "='' ";
             }
             $whereStr .= " or " . GetFullFieldName($this->field) . " is null)";
             $whereStr .= " or abs(case textregexeq(" . $fullFieldName . ", '^(\\-)?[[:digit:]]+(\\.[[:digit:]]+)?\$') when true then to_number(" . $fullFieldName . ", '999999999') else 0 end) = 0";
             $whereStr .= " or abs(val(" . $fullFieldName . ")) = 0";
             return $whereStr;
         }
     } else {
         if ($SearchFor == "on") {
             return "(" . GetFullFieldName($this->field) . "<>0 and " . GetFullFieldName($this->field) . " is not null)";
         } elseif ($SearchFor == "off") {
             return "(" . GetFullFieldName($this->field) . "=0 or " . GetFullFieldName($this->field) . " is null)";
         }
     }
     return "";
 }
        }
    }
    if (isset($_SESSION[$strTableName . "_masterkey" . $i])) {
        unset($_SESSION[$strTableName . "_masterkey" . $i]);
    }
} else {
    $mastertable = $_SESSION[$strTableName . "_mastertable"];
}
//$strSQL = $gstrSQL;
if ($mastertable == "pad.pad_kecamatan") {
    $where = "";
    $where .= GetFullFieldName("kecamatan_id", $strTableName, false) . "=" . make_db_value("kecamatan_id", $_SESSION[$strTableName . "_masterkey1"]);
}
if ($mastertable == "pad.pad_kelurahan") {
    $where = "";
    $where .= GetFullFieldName("kelurahan_id", $strTableName, false) . "=" . make_db_value("kelurahan_id", $_SESSION[$strTableName . "_masterkey1"]);
}
$str = SecuritySQL("Search");
if (strlen($str)) {
    $where .= " and " . $str;
}
$strSQL = $gQuery->gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = $gQuery->gSQLRowCount($where);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
    $xt->assign("details_data", true);
    $rs = db_query($strSQL, $conn);
    $display_count = 10;
    if ($mode == "inline") {
        $display_count *= 2;
function DisplayMasterTableInfo_Module($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "dbo.Module";
    //$strSQL = "SELECT ID,   [Module Type],   [Module Status],   [Module Condition],   [Serial Num],   [Entry Date]  FROM dbo.[Module]";
    $sqlHead = "SELECT ID,   [Module Type],   [Module Status],   [Module Condition],   [Serial Num],   [Entry Date]";
    $sqlFrom = "FROM dbo.[Module]";
    $sqlWhere = "";
    $sqlTail = "";
    $where = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterprint", "BoldOrange", "MobileOrange");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["Module_masterprint"] = $layout;
    if ($detailtable == "dbo.Anomalies") {
        $where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
    }
    if ($detailtable == "dbo.Customer Module Assignment") {
        $where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
    }
    if ($detailtable == "dbo.Readings") {
        $where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Export");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($sqlWhere, $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $sqlHead . ' ' . $sqlFrom . $strWhere . $sqlTail;
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = db_fetch_array($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["ID"]));
    //	ID -
    $value = "";
    $value = ProcessLargeText(GetData($data, "ID", ""), "field=ID" . $keylink, "", MODE_PRINT);
    $xt->assign("ID_mastervalue", $value);
    //	Module Type -
    $value = "";
    $value = DisplayLookupWizard("Module Type", $data["Module Type"], $data, $keylink, MODE_PRINT);
    $xt->assign("Module_Type_mastervalue", $value);
    //	Module Status -
    $value = "";
    $value = DisplayLookupWizard("Module Status", $data["Module Status"], $data, $keylink, MODE_PRINT);
    $xt->assign("Module_Status_mastervalue", $value);
    //	Module Condition -
    $value = "";
    $value = DisplayLookupWizard("Module Condition", $data["Module Condition"], $data, $keylink, MODE_PRINT);
    $xt->assign("Module_Condition_mastervalue", $value);
    //	Serial Num -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Serial Num", ""), "field=Serial+Num" . $keylink, "", MODE_PRINT);
    $xt->assign("Serial_Num_mastervalue", $value);
    //	Entry Date - Short Date
    $value = "";
    $value = ProcessLargeText(GetData($data, "Entry Date", "Short Date"), "field=Entry+Date" . $keylink, "", MODE_PRINT);
    $xt->assign("Entry_Date_mastervalue", $value);
    $xt->display("Module_masterprint.htm");
    $strTableName = $oldTableName;
}
            $_SESSION[$strTableName . "_masterkey" . $i] = $masterKeys["masterkey" . $i];
            $i++;
        }
    }
    if (isset($_SESSION[$strTableName . "_masterkey" . $i])) {
        unset($_SESSION[$strTableName . "_masterkey" . $i]);
    }
} else {
    $mastertable = $_SESSION[$strTableName . "_mastertable"];
}
//$strSQL = $gstrSQL;
if ($mastertable == "pad.pad_jenis_pajak") {
    $where = "";
    $where .= GetFullFieldName("pajak_id", $strTableName, false) . "=" . make_db_value("pajak_id", $_SESSION[$strTableName . "_masterkey1"]);
    $where .= " and ";
    $where .= GetFullFieldName("pajak_id", $strTableName, false) . "=" . make_db_value("pajak_id", $_SESSION[$strTableName . "_masterkey2"]);
}
$str = SecuritySQL("Search");
if (strlen($str)) {
    $where .= " and " . $str;
}
$strSQL = $gQuery->gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = $gQuery->gSQLRowCount($where);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
    $xt->assign("details_data", true);
    $rs = db_query($strSQL, $conn);
    $display_count = 10;
    if ($mode == "inline") {
        $display_count *= 2;
Ejemplo n.º 6
0
			else
				$value=(0+$value);
		}
		$sWhere.=" or ".GetFullFieldName($cEmailField,"webreport_users",false)."=".$value.")";
	
		if($tosearch && $globalEvents->exists("BeforeRemindPassword"))
			$tosearch = $globalEvents->BeforeRemindPassword($strUsernameEmail,$strUsernameEmail, $pageObject);
		
		if($tosearch)
		{
			$selectClause = "select ".GetFullFieldName($cUserNameField,"webreport_users",false)." as ".AddFieldWrappers($cUserNameField)
				.",".GetFullFieldName($cPasswordField,"webreport_users",false)." as ".AddFieldWrappers($cPasswordField);
			
			// prevent aliases mixing
			if( $cUserNameField != $cEmailField )
				$strSQL.= ",".GetFullFieldName($cEmailField,"webreport_users",false)." as ".AddFieldWrappers($cEmailField);

				
			$strSQL = $selectClause." from ".AddTableWrappers("webreport_users")." where ".$sWhere;
			
			$rs = db_query($strSQL, $conn);
			$data = $cipherer->DecryptFetchedArray($rs);
			if($data)
			{
				$password=$data[$cPasswordField];
				$strUsername = $data[$cUserNameField];
		
	
				$url = GetSiteUrl();
				$url.= $_SERVER["SCRIPT_NAME"];
				$url2 = str_replace("remind.","login.",$url)."?username=".$data[$cUserNameField];
        $i++;
    }
    if (isset($_SESSION[$strTableName . "_masterkey" . $i])) {
        unset($_SESSION[$strTableName . "_masterkey" . $i]);
    }
} else {
    $mastertable = $_SESSION[$strTableName . "_mastertable"];
}
//$strSQL = $gstrSQL;
if ($mastertable == "dbo.LU_Customer Type") {
    $where = "";
    $where .= GetFullFieldName("Customer Type") . "=" . make_db_value("Customer Type", $_SESSION[$strTableName . "_masterkey1"]);
}
if ($mastertable == "dbo.LU_Locations") {
    $where = "";
    $where .= GetFullFieldName("Location") . "=" . make_db_value("Location", $_SESSION[$strTableName . "_masterkey1"]);
}
$str = SecuritySQL("Search");
if (strlen($str)) {
    $where .= " and " . $str;
}
$strSQL = gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = gSQLRowCount($where);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
    $xt->assign("details_data", true);
    $rs = db_query($strSQL, $conn);
    $display_count = 10;
    if ($mode == "inline") {
        $display_count *= 2;
Ejemplo n.º 8
0
 /**
  * add where clause with foreign keys of current table and it's master table master keys
  *
  * @return string
  */
 function addWhereWithMasterTable()
 {
     $where = "";
     if (count($this->detailKeysByM)) {
         for ($i = 0; $i < count($this->detailKeysByM); $i++) {
             if ($i != 0) {
                 $where .= " and ";
             }
             if ($this->cipherer && isEncryptionByPHPEnabled()) {
                 $mValue = $this->cipherer->MakeDBValue($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
             } else {
                 $mValue = make_db_value($this->detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]);
             }
             if (!empty($mValue)) {
                 $where .= GetFullFieldName($this->detailKeysByM[$i], "", false) . "=" . $mValue;
             } else {
                 $where .= "1=0";
             }
         }
     }
     return $where;
 }
Ejemplo n.º 9
0
 function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
 {
     $baseResult = $this->baseSQLWhere($strSearchOption);
     if ($baseResult === false) {
         return "";
     }
     if ($baseResult != "") {
         return $baseResult;
     }
     if (IsCharType($this->type)) {
         if (!$this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
             $gstrField = $this->pageObject->pSetEdit->isEnableUpper(GetFullFieldName($this->field, "", false));
         } else {
             $gstrField = GetFullFieldName($this->field, "", false);
         }
     } elseif ($strSearchOption == "Contains" || $strSearchOption == "Starts with") {
         $gstrField = db_field2char(GetFullFieldName($this->field, "", false), $this->type);
     } else {
         $gstrField = GetFullFieldName($this->field, "", false);
     }
     $ret = "";
     if ($this->isMysql) {
         $SearchFor = str_replace('\\\\', '\\\\\\\\', $SearchFor);
     }
     if ($strSearchOption == "Contains") {
         $SearchFor = "%" . $SearchFor . "%";
     } else {
         if ($strSearchOption == "Starts with") {
             $SearchFor = $SearchFor . "%";
         }
     }
     if ($strSearchOption == "Contains" || $strSearchOption == "Starts with" || $strSearchOption == "Equals") {
         return $this->buildWhere($gstrField, $SearchFor, $strSearchOption == "Equals");
     }
     return "";
 }
Ejemplo n.º 10
0
 /**
  * Use for count details recs number, if subQueryes not supported, or keys have different types
  *
  * @param integer $i
  * @param array $detailid
  */
 function countDetailsRecsNoSubQ($dInd, &$detailid)
 {
     global $tables_data;
     global $masterTablesData;
     global $detailsTablesData;
     $dDataSourceTable = $this->allDetailsTablesArr[$dInd]['dDataSourceTable'];
     $gQuery = GetTableData($dDataSourceTable, '.sqlquery', null);
     $dObjHaving = $gQuery->Having();
     $dSqlHaving = $dObjHaving->toSql($gQuery);
     $dSqlGroupBy = $gQuery->GroupByToSql();
     $dSqlHead = $this->allDetailsTablesArr[$dInd]['sqlHead'];
     $dSqlFrom = $this->allDetailsTablesArr[$dInd]['sqlFrom'];
     $dSqlWhere = $this->allDetailsTablesArr[$dInd]['sqlWhere'];
     //$sqlTail = $detailTableInfo['sqlTail'];
     $detailKeys = GetDetailKeysByMasterTable($this->tName, $dDataSourceTable);
     $securityClause = SecuritySQL("Search", $dDataSourceTable);
     // add where
     if (strlen($securityClause)) {
         $dSqlWhere = whereAdd($dSqlWhere, $securityClause);
     }
     $masterwhere = "";
     foreach ($this->masterKeysByD[$dInd] as $idx => $val) {
         if ($masterwhere) {
             $masterwhere .= " and ";
         }
         $masterwhere .= GetFullFieldName($detailKeys[$idx], $dDataSourceTable) . "=" . make_db_value($detailKeys[$idx], $detailid[$idx]);
     }
     return gSQLRowCount_int($dSqlHead, $dSqlFrom, $dSqlWhere, $dSqlGroupBy, $dSqlHaving, $masterwhere, "");
 }
function DoInsertRecordSQL($table, &$avalues, &$blobfields, $pageid, &$pageObject)
{
    global $error_happened, $conn, $inlineadd, $usermessage, $message, $failed_inline_add, $keys, $strTableName;
    //	make SQL string
    $strSQL = "insert into " . AddTableWrappers($table) . " ";
    $strFields = "(";
    $strValues = "(";
    $blobs = PrepareBlobs($avalues, $blobfields);
    foreach ($avalues as $akey => $value) {
        $strFields .= GetFullFieldName($akey) . ", ";
        if (in_array($akey, $blobfields)) {
            $strValues .= $value . ", ";
        } else {
            $strValues .= add_db_quotes($akey, $value) . ", ";
        }
    }
    if (substr($strFields, -2) == ", ") {
        $strFields = substr($strFields, 0, strlen($strFields) - 2);
    }
    if (substr($strValues, -2) == ", ") {
        $strValues = substr($strValues, 0, strlen($strValues) - 2);
    }
    $strSQL .= $strFields . ") values " . $strValues . ")";
    if (!ExecuteUpdate($strSQL, $blobs, true)) {
        return false;
    }
    if ($error_happened) {
        return false;
    }
    $pageObject->ProcessFiles();
    if ($inlineadd == ADD_INLINE) {
        $status = "ADDED";
        $message = "" . mlang_message("RECORD_ADDED") . "";
        $IsSaved = true;
    } else {
        $message = "<<< " . mlang_message("RECORD_ADDED") . " >>>";
    }
    if ($usermessage != "") {
        $message = $usermessage;
    }
    $auditObj = GetAuditObject($table);
    if ($inlineadd == ADD_SIMPLE || $inlineadd == ADD_INLINE || $inlineadd == ADD_ONTHEFLY || $inlineadd == ADD_POPUP || $inlineadd == ADD_MASTER || tableEventExists("AfterAdd", $strTableName) || $auditObj) {
        $failed_inline_add = false;
        $keyfields = GetTableKeys();
        foreach ($keyfields as $k) {
            if (array_key_exists($k, $avalues)) {
                $keys[$k] = $avalues[$k];
            } elseif (IsAutoincField($k)) {
                $lastrs = db_query("select @@IDENTITY", $conn);
                if ($lastdata = db_fetch_numarray($lastrs)) {
                    $keys[$k] = $lastdata[0];
                }
            } else {
                $failed_inline_add = true;
            }
        }
    }
    return true;
}
Ejemplo n.º 12
0
	/**
	 * Get the substitute columns list for the SELECT Clause and the FORM clause part 
	 * that will be joined to the basic page's FROM clause 	 
	 * @param String searchFor
	 * @param String searchOpt
	 * @param Boolean isSuggest
	 * @return Array
	 */
	public function getSelectColumnsAndJoinFromPart($searchFor, $searchOpt, $isSuggest)
	{
		return array(
			"selectColumns"=> GetFullFieldName( $this->field ),
			"joinFromPart"=> ""
		);
	}
Ejemplo n.º 13
0
function DisplayMasterTableInfo_pad_pad_spt($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    $detailPageObj = $params["detailPageObj"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "pad.pad_spt";
    $settings = new ProjectSettings($strTableName, PAGE_LIST);
    $cipherer = new RunnerCipherer($strTableName);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_LIST);
    $where = "";
    $mKeys = array();
    $showKeys = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterlist", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["pad_pad_spt_masterlist"] = $layout;
    if ($detailtable == "pad.pad_air_tanah_hit") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_stpd") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Search");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->WhereToSql(), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL = AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	id -
    $value = "";
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	tahun -
    $value = "";
    $xt->assign("tahun_mastervalue", $viewControls->showDBValue("tahun", $data, $keylink));
    //	sptno -
    $value = "";
    $xt->assign("sptno_mastervalue", $viewControls->showDBValue("sptno", $data, $keylink));
    //	customer_id -
    $value = "";
    $xt->assign("customer_id_mastervalue", $viewControls->showDBValue("customer_id", $data, $keylink));
    //	customer_usaha_id -
    $value = "";
    $xt->assign("customer_usaha_id_mastervalue", $viewControls->showDBValue("customer_usaha_id", $data, $keylink));
    //	rekening_id -
    $value = "";
    $xt->assign("rekening_id_mastervalue", $viewControls->showDBValue("rekening_id", $data, $keylink));
    //	pajak_id -
    $value = "";
    $xt->assign("pajak_id_mastervalue", $viewControls->showDBValue("pajak_id", $data, $keylink));
    //	type_id -
    $value = "";
    $xt->assign("type_id_mastervalue", $viewControls->showDBValue("type_id", $data, $keylink));
    //	so -
    $value = "";
    $xt->assign("so_mastervalue", $viewControls->showDBValue("so", $data, $keylink));
    //	masadari - Short Date
    $value = "";
    $xt->assign("masadari_mastervalue", $viewControls->showDBValue("masadari", $data, $keylink));
    //	masasd - Short Date
    $value = "";
    $xt->assign("masasd_mastervalue", $viewControls->showDBValue("masasd", $data, $keylink));
    //	jatuhtempotgl - Short Date
    $value = "";
    $xt->assign("jatuhtempotgl_mastervalue", $viewControls->showDBValue("jatuhtempotgl", $data, $keylink));
    //	r_bayarid -
    $value = "";
    $xt->assign("r_bayarid_mastervalue", $viewControls->showDBValue("r_bayarid", $data, $keylink));
    //	minimal_omset - Number
    $value = "";
    $xt->assign("minimal_omset_mastervalue", $viewControls->showDBValue("minimal_omset", $data, $keylink));
    //	dasar - Number
    $value = "";
    $xt->assign("dasar_mastervalue", $viewControls->showDBValue("dasar", $data, $keylink));
    //	tarif - Number
    $value = "";
    $xt->assign("tarif_mastervalue", $viewControls->showDBValue("tarif", $data, $keylink));
    //	denda - Number
    $value = "";
    $xt->assign("denda_mastervalue", $viewControls->showDBValue("denda", $data, $keylink));
    //	bunga - Number
    $value = "";
    $xt->assign("bunga_mastervalue", $viewControls->showDBValue("bunga", $data, $keylink));
    //	setoran - Number
    $value = "";
    $xt->assign("setoran_mastervalue", $viewControls->showDBValue("setoran", $data, $keylink));
    //	kenaikan - Number
    $value = "";
    $xt->assign("kenaikan_mastervalue", $viewControls->showDBValue("kenaikan", $data, $keylink));
    //	kompensasi - Number
    $value = "";
    $xt->assign("kompensasi_mastervalue", $viewControls->showDBValue("kompensasi", $data, $keylink));
    //	lain2 - Number
    $value = "";
    $xt->assign("lain2_mastervalue", $viewControls->showDBValue("lain2", $data, $keylink));
    //	pajak_terhutang -
    $value = "";
    $xt->assign("pajak_terhutang_mastervalue", $viewControls->showDBValue("pajak_terhutang", $data, $keylink));
    //	air_manfaat_id -
    $value = "";
    $xt->assign("air_manfaat_id_mastervalue", $viewControls->showDBValue("air_manfaat_id", $data, $keylink));
    //	air_zona_id -
    $value = "";
    $xt->assign("air_zona_id_mastervalue", $viewControls->showDBValue("air_zona_id", $data, $keylink));
    //	meteran_awal -
    $value = "";
    $xt->assign("meteran_awal_mastervalue", $viewControls->showDBValue("meteran_awal", $data, $keylink));
    //	meteran_akhir -
    $value = "";
    $xt->assign("meteran_akhir_mastervalue", $viewControls->showDBValue("meteran_akhir", $data, $keylink));
    //	volume - Number
    $value = "";
    $xt->assign("volume_mastervalue", $viewControls->showDBValue("volume", $data, $keylink));
    //	satuan -
    $value = "";
    $xt->assign("satuan_mastervalue", $viewControls->showDBValue("satuan", $data, $keylink));
    //	r_panjang - Number
    $value = "";
    $xt->assign("r_panjang_mastervalue", $viewControls->showDBValue("r_panjang", $data, $keylink));
    //	r_lebar - Number
    $value = "";
    $xt->assign("r_lebar_mastervalue", $viewControls->showDBValue("r_lebar", $data, $keylink));
    //	r_muka - Number
    $value = "";
    $xt->assign("r_muka_mastervalue", $viewControls->showDBValue("r_muka", $data, $keylink));
    //	r_banyak - Number
    $value = "";
    $xt->assign("r_banyak_mastervalue", $viewControls->showDBValue("r_banyak", $data, $keylink));
    //	r_luas - Number
    $value = "";
    $xt->assign("r_luas_mastervalue", $viewControls->showDBValue("r_luas", $data, $keylink));
    //	r_tarifid -
    $value = "";
    $xt->assign("r_tarifid_mastervalue", $viewControls->showDBValue("r_tarifid", $data, $keylink));
    //	r_kontrak - Number
    $value = "";
    $xt->assign("r_kontrak_mastervalue", $viewControls->showDBValue("r_kontrak", $data, $keylink));
    //	r_lama -
    $value = "";
    $xt->assign("r_lama_mastervalue", $viewControls->showDBValue("r_lama", $data, $keylink));
    //	r_jalan_id -
    $value = "";
    $xt->assign("r_jalan_id_mastervalue", $viewControls->showDBValue("r_jalan_id", $data, $keylink));
    //	r_jalanklas_id -
    $value = "";
    $xt->assign("r_jalanklas_id_mastervalue", $viewControls->showDBValue("r_jalanklas_id", $data, $keylink));
    //	r_lokasi -
    $value = "";
    $xt->assign("r_lokasi_mastervalue", $viewControls->showDBValue("r_lokasi", $data, $keylink));
    //	r_judul -
    $value = "";
    $xt->assign("r_judul_mastervalue", $viewControls->showDBValue("r_judul", $data, $keylink));
    //	r_kelurahan_id -
    $value = "";
    $xt->assign("r_kelurahan_id_mastervalue", $viewControls->showDBValue("r_kelurahan_id", $data, $keylink));
    //	r_lokasi_id -
    $value = "";
    $xt->assign("r_lokasi_id_mastervalue", $viewControls->showDBValue("r_lokasi_id", $data, $keylink));
    //	r_calculated - Number
    $value = "";
    $xt->assign("r_calculated_mastervalue", $viewControls->showDBValue("r_calculated", $data, $keylink));
    //	r_nsr - Number
    $value = "";
    $xt->assign("r_nsr_mastervalue", $viewControls->showDBValue("r_nsr", $data, $keylink));
    //	r_nsrno -
    $value = "";
    $xt->assign("r_nsrno_mastervalue", $viewControls->showDBValue("r_nsrno", $data, $keylink));
    //	r_nsrtgl - Short Date
    $value = "";
    $xt->assign("r_nsrtgl_mastervalue", $viewControls->showDBValue("r_nsrtgl", $data, $keylink));
    //	r_nsl_kecamatan_id -
    $value = "";
    $xt->assign("r_nsl_kecamatan_id_mastervalue", $viewControls->showDBValue("r_nsl_kecamatan_id", $data, $keylink));
    //	r_nsl_type_id -
    $value = "";
    $xt->assign("r_nsl_type_id_mastervalue", $viewControls->showDBValue("r_nsl_type_id", $data, $keylink));
    //	r_nsl_nilai - Number
    $value = "";
    $xt->assign("r_nsl_nilai_mastervalue", $viewControls->showDBValue("r_nsl_nilai", $data, $keylink));
    //	notes -
    $value = "";
    $xt->assign("notes_mastervalue", $viewControls->showDBValue("notes", $data, $keylink));
    //	unit_id -
    $value = "";
    $xt->assign("unit_id_mastervalue", $viewControls->showDBValue("unit_id", $data, $keylink));
    //	enabled -
    $value = "";
    $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink));
    //	created - Short Date
    $value = "";
    $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink));
    //	create_uid -
    $value = "";
    $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink));
    //	updated - Short Date
    $value = "";
    $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink));
    //	update_uid -
    $value = "";
    $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink));
    //	terimanip -
    $value = "";
    $xt->assign("terimanip_mastervalue", $viewControls->showDBValue("terimanip", $data, $keylink));
    //	terimatgl - Short Date
    $value = "";
    $xt->assign("terimatgl_mastervalue", $viewControls->showDBValue("terimatgl", $data, $keylink));
    //	kirimtgl - Short Date
    $value = "";
    $xt->assign("kirimtgl_mastervalue", $viewControls->showDBValue("kirimtgl", $data, $keylink));
    //	isprint_dc -
    $value = "";
    $xt->assign("isprint_dc_mastervalue", $viewControls->showDBValue("isprint_dc", $data, $keylink));
    //	r_nsr_id -
    $value = "";
    $xt->assign("r_nsr_id_mastervalue", $viewControls->showDBValue("r_nsr_id", $data, $keylink));
    //	r_lokasi_pasang_id -
    $value = "";
    $xt->assign("r_lokasi_pasang_id_mastervalue", $viewControls->showDBValue("r_lokasi_pasang_id", $data, $keylink));
    //	r_lokasi_pasang_val - Number
    $value = "";
    $xt->assign("r_lokasi_pasang_val_mastervalue", $viewControls->showDBValue("r_lokasi_pasang_val", $data, $keylink));
    //	r_jalanklas_val - Number
    $value = "";
    $xt->assign("r_jalanklas_val_mastervalue", $viewControls->showDBValue("r_jalanklas_val", $data, $keylink));
    //	r_sudut_pandang_id -
    $value = "";
    $xt->assign("r_sudut_pandang_id_mastervalue", $viewControls->showDBValue("r_sudut_pandang_id", $data, $keylink));
    //	r_sudut_pandang_val - Number
    $value = "";
    $xt->assign("r_sudut_pandang_val_mastervalue", $viewControls->showDBValue("r_sudut_pandang_val", $data, $keylink));
    //	r_tinggi - Number
    $value = "";
    $xt->assign("r_tinggi_mastervalue", $viewControls->showDBValue("r_tinggi", $data, $keylink));
    //	r_njop - Number
    $value = "";
    $xt->assign("r_njop_mastervalue", $viewControls->showDBValue("r_njop", $data, $keylink));
    //	r_status -
    $value = "";
    $xt->assign("r_status_mastervalue", $viewControls->showDBValue("r_status", $data, $keylink));
    //	r_njop_ketinggian - Number
    $value = "";
    $xt->assign("r_njop_ketinggian_mastervalue", $viewControls->showDBValue("r_njop_ketinggian", $data, $keylink));
    //	status_pembayaran -
    $value = "";
    $xt->assign("status_pembayaran_mastervalue", $viewControls->showDBValue("status_pembayaran", $data, $keylink));
    //	rek_no_paneng -
    $value = "";
    $xt->assign("rek_no_paneng_mastervalue", $viewControls->showDBValue("rek_no_paneng", $data, $keylink));
    //	sptno_lengkap -
    $value = "";
    $xt->assign("sptno_lengkap_mastervalue", $viewControls->showDBValue("sptno_lengkap", $data, $keylink));
    //	sptno_lama -
    $value = "";
    $xt->assign("sptno_lama_mastervalue", $viewControls->showDBValue("sptno_lama", $data, $keylink));
    //	r_nama -
    $value = "";
    $xt->assign("r_nama_mastervalue", $viewControls->showDBValue("r_nama", $data, $keylink));
    //	r_alamat -
    $value = "";
    $xt->assign("r_alamat_mastervalue", $viewControls->showDBValue("r_alamat", $data, $keylink));
    //	omset1 - Number
    $value = "";
    $xt->assign("omset1_mastervalue", $viewControls->showDBValue("omset1", $data, $keylink));
    //	omset2 - Number
    $value = "";
    $xt->assign("omset2_mastervalue", $viewControls->showDBValue("omset2", $data, $keylink));
    //	omset3 - Number
    $value = "";
    $xt->assign("omset3_mastervalue", $viewControls->showDBValue("omset3", $data, $keylink));
    //	omset4 - Number
    $value = "";
    $xt->assign("omset4_mastervalue", $viewControls->showDBValue("omset4", $data, $keylink));
    //	omset5 - Number
    $value = "";
    $xt->assign("omset5_mastervalue", $viewControls->showDBValue("omset5", $data, $keylink));
    //	omset6 - Number
    $value = "";
    $xt->assign("omset6_mastervalue", $viewControls->showDBValue("omset6", $data, $keylink));
    //	omset7 - Number
    $value = "";
    $xt->assign("omset7_mastervalue", $viewControls->showDBValue("omset7", $data, $keylink));
    //	omset8 - Number
    $value = "";
    $xt->assign("omset8_mastervalue", $viewControls->showDBValue("omset8", $data, $keylink));
    //	omset9 - Number
    $value = "";
    $xt->assign("omset9_mastervalue", $viewControls->showDBValue("omset9", $data, $keylink));
    //	omset10 - Number
    $value = "";
    $xt->assign("omset10_mastervalue", $viewControls->showDBValue("omset10", $data, $keylink));
    //	omset11 - Number
    $value = "";
    $xt->assign("omset11_mastervalue", $viewControls->showDBValue("omset11", $data, $keylink));
    //	omset12 - Number
    $value = "";
    $xt->assign("omset12_mastervalue", $viewControls->showDBValue("omset12", $data, $keylink));
    //	omset13 - Number
    $value = "";
    $xt->assign("omset13_mastervalue", $viewControls->showDBValue("omset13", $data, $keylink));
    //	omset14 - Number
    $value = "";
    $xt->assign("omset14_mastervalue", $viewControls->showDBValue("omset14", $data, $keylink));
    //	omset15 - Number
    $value = "";
    $xt->assign("omset15_mastervalue", $viewControls->showDBValue("omset15", $data, $keylink));
    //	omset16 - Number
    $value = "";
    $xt->assign("omset16_mastervalue", $viewControls->showDBValue("omset16", $data, $keylink));
    //	omset17 - Number
    $value = "";
    $xt->assign("omset17_mastervalue", $viewControls->showDBValue("omset17", $data, $keylink));
    //	omset18 - Number
    $value = "";
    $xt->assign("omset18_mastervalue", $viewControls->showDBValue("omset18", $data, $keylink));
    //	omset19 - Number
    $value = "";
    $xt->assign("omset19_mastervalue", $viewControls->showDBValue("omset19", $data, $keylink));
    //	omset20 - Number
    $value = "";
    $xt->assign("omset20_mastervalue", $viewControls->showDBValue("omset20", $data, $keylink));
    //	omset21 - Number
    $value = "";
    $xt->assign("omset21_mastervalue", $viewControls->showDBValue("omset21", $data, $keylink));
    //	omset22 - Number
    $value = "";
    $xt->assign("omset22_mastervalue", $viewControls->showDBValue("omset22", $data, $keylink));
    //	omset23 - Number
    $value = "";
    $xt->assign("omset23_mastervalue", $viewControls->showDBValue("omset23", $data, $keylink));
    //	omset24 - Number
    $value = "";
    $xt->assign("omset24_mastervalue", $viewControls->showDBValue("omset24", $data, $keylink));
    //	omset25 - Number
    $value = "";
    $xt->assign("omset25_mastervalue", $viewControls->showDBValue("omset25", $data, $keylink));
    //	omset26 - Number
    $value = "";
    $xt->assign("omset26_mastervalue", $viewControls->showDBValue("omset26", $data, $keylink));
    //	omset27 - Number
    $value = "";
    $xt->assign("omset27_mastervalue", $viewControls->showDBValue("omset27", $data, $keylink));
    //	omset28 - Number
    $value = "";
    $xt->assign("omset28_mastervalue", $viewControls->showDBValue("omset28", $data, $keylink));
    //	omset29 - Number
    $value = "";
    $xt->assign("omset29_mastervalue", $viewControls->showDBValue("omset29", $data, $keylink));
    //	omset30 - Number
    $value = "";
    $xt->assign("omset30_mastervalue", $viewControls->showDBValue("omset30", $data, $keylink));
    //	omset31 - Number
    $value = "";
    $xt->assign("omset31_mastervalue", $viewControls->showDBValue("omset31", $data, $keylink));
    //	keterangan1 -
    $value = "";
    $xt->assign("keterangan1_mastervalue", $viewControls->showDBValue("keterangan1", $data, $keylink));
    //	keterangan2 -
    $value = "";
    $xt->assign("keterangan2_mastervalue", $viewControls->showDBValue("keterangan2", $data, $keylink));
    //	keterangan3 -
    $value = "";
    $xt->assign("keterangan3_mastervalue", $viewControls->showDBValue("keterangan3", $data, $keylink));
    //	keterangan4 -
    $value = "";
    $xt->assign("keterangan4_mastervalue", $viewControls->showDBValue("keterangan4", $data, $keylink));
    //	keterangan5 -
    $value = "";
    $xt->assign("keterangan5_mastervalue", $viewControls->showDBValue("keterangan5", $data, $keylink));
    //	keterangan6 -
    $value = "";
    $xt->assign("keterangan6_mastervalue", $viewControls->showDBValue("keterangan6", $data, $keylink));
    //	keterangan7 -
    $value = "";
    $xt->assign("keterangan7_mastervalue", $viewControls->showDBValue("keterangan7", $data, $keylink));
    //	keterangan8 -
    $value = "";
    $xt->assign("keterangan8_mastervalue", $viewControls->showDBValue("keterangan8", $data, $keylink));
    //	keterangan9 -
    $value = "";
    $xt->assign("keterangan9_mastervalue", $viewControls->showDBValue("keterangan9", $data, $keylink));
    //	keterangan10 -
    $value = "";
    $xt->assign("keterangan10_mastervalue", $viewControls->showDBValue("keterangan10", $data, $keylink));
    //	keterangan11 -
    $value = "";
    $xt->assign("keterangan11_mastervalue", $viewControls->showDBValue("keterangan11", $data, $keylink));
    //	keterangan12 -
    $value = "";
    $xt->assign("keterangan12_mastervalue", $viewControls->showDBValue("keterangan12", $data, $keylink));
    //	keterangan13 -
    $value = "";
    $xt->assign("keterangan13_mastervalue", $viewControls->showDBValue("keterangan13", $data, $keylink));
    //	keterangan14 -
    $value = "";
    $xt->assign("keterangan14_mastervalue", $viewControls->showDBValue("keterangan14", $data, $keylink));
    //	keterangan15 -
    $value = "";
    $xt->assign("keterangan15_mastervalue", $viewControls->showDBValue("keterangan15", $data, $keylink));
    //	keterangan16 -
    $value = "";
    $xt->assign("keterangan16_mastervalue", $viewControls->showDBValue("keterangan16", $data, $keylink));
    //	keterangan17 -
    $value = "";
    $xt->assign("keterangan17_mastervalue", $viewControls->showDBValue("keterangan17", $data, $keylink));
    //	keterangan18 -
    $value = "";
    $xt->assign("keterangan18_mastervalue", $viewControls->showDBValue("keterangan18", $data, $keylink));
    //	keterangan19 -
    $value = "";
    $xt->assign("keterangan19_mastervalue", $viewControls->showDBValue("keterangan19", $data, $keylink));
    //	keterangan20 -
    $value = "";
    $xt->assign("keterangan20_mastervalue", $viewControls->showDBValue("keterangan20", $data, $keylink));
    //	keterangan21 -
    $value = "";
    $xt->assign("keterangan21_mastervalue", $viewControls->showDBValue("keterangan21", $data, $keylink));
    //	keterangan22 -
    $value = "";
    $xt->assign("keterangan22_mastervalue", $viewControls->showDBValue("keterangan22", $data, $keylink));
    //	keterangan23 -
    $value = "";
    $xt->assign("keterangan23_mastervalue", $viewControls->showDBValue("keterangan23", $data, $keylink));
    //	keterangan24 -
    $value = "";
    $xt->assign("keterangan24_mastervalue", $viewControls->showDBValue("keterangan24", $data, $keylink));
    //	keterangan25 -
    $value = "";
    $xt->assign("keterangan25_mastervalue", $viewControls->showDBValue("keterangan25", $data, $keylink));
    //	keterangan26 -
    $value = "";
    $xt->assign("keterangan26_mastervalue", $viewControls->showDBValue("keterangan26", $data, $keylink));
    //	keterangan27 -
    $value = "";
    $xt->assign("keterangan27_mastervalue", $viewControls->showDBValue("keterangan27", $data, $keylink));
    //	keterangan28 -
    $value = "";
    $xt->assign("keterangan28_mastervalue", $viewControls->showDBValue("keterangan28", $data, $keylink));
    //	keterangan29 -
    $value = "";
    $xt->assign("keterangan29_mastervalue", $viewControls->showDBValue("keterangan29", $data, $keylink));
    //	keterangan30 -
    $value = "";
    $xt->assign("keterangan30_mastervalue", $viewControls->showDBValue("keterangan30", $data, $keylink));
    //	keterangan31 -
    $value = "";
    $xt->assign("keterangan31_mastervalue", $viewControls->showDBValue("keterangan31", $data, $keylink));
    //	doc_no -
    $value = "";
    $xt->assign("doc_no_mastervalue", $viewControls->showDBValue("doc_no", $data, $keylink));
    //	cara_bayar -
    $value = "";
    $xt->assign("cara_bayar_mastervalue", $viewControls->showDBValue("cara_bayar", $data, $keylink));
    //	kelompok_usaha_id -
    $value = "";
    $xt->assign("kelompok_usaha_id_mastervalue", $viewControls->showDBValue("kelompok_usaha_id", $data, $keylink));
    //	zona_id -
    $value = "";
    $xt->assign("zona_id_mastervalue", $viewControls->showDBValue("zona_id", $data, $keylink));
    //	manfaat_id -
    $value = "";
    $xt->assign("manfaat_id_mastervalue", $viewControls->showDBValue("manfaat_id", $data, $keylink));
    //	golongan -
    $value = "";
    $xt->assign("golongan_mastervalue", $viewControls->showDBValue("golongan", $data, $keylink));
    //	omset_lain - Number
    $value = "";
    $xt->assign("omset_lain_mastervalue", $viewControls->showDBValue("omset_lain", $data, $keylink));
    //	keterangan_lain -
    $value = "";
    $xt->assign("keterangan_lain_mastervalue", $viewControls->showDBValue("keterangan_lain", $data, $keylink));
    //	ijin_no -
    $value = "";
    $xt->assign("ijin_no_mastervalue", $viewControls->showDBValue("ijin_no", $data, $keylink));
    //	jenis_masa -
    $value = "";
    $xt->assign("jenis_masa_mastervalue", $viewControls->showDBValue("jenis_masa", $data, $keylink));
    //	skpd_lama -
    $value = "";
    $xt->assign("skpd_lama_mastervalue", $viewControls->showDBValue("skpd_lama", $data, $keylink));
    //	proses -
    $value = "";
    $xt->assign("proses_mastervalue", $viewControls->showDBValue("proses", $data, $keylink));
    //	tanggal_validasi - Short Date
    $value = "";
    $xt->assign("tanggal_validasi_mastervalue", $viewControls->showDBValue("tanggal_validasi", $data, $keylink));
    //	bulan -
    $value = "";
    $xt->assign("bulan_mastervalue", $viewControls->showDBValue("bulan", $data, $keylink));
    //	no_telp -
    $value = "";
    $xt->assign("no_telp_mastervalue", $viewControls->showDBValue("no_telp", $data, $keylink));
    //	usaha_id -
    $value = "";
    $xt->assign("usaha_id_mastervalue", $viewControls->showDBValue("usaha_id", $data, $keylink));
    //	multiple -
    $value = "";
    $xt->assign("multiple_mastervalue", $viewControls->showDBValue("multiple", $data, $keylink));
    //	bulan_telat -
    $value = "";
    $xt->assign("bulan_telat_mastervalue", $viewControls->showDBValue("bulan_telat", $data, $keylink));
    $viewControls->addControlsJSAndCSS();
    $detailPageObj->viewControlsMap['mViewControlsMap'] = $viewControls->viewControlsMap;
    $layout = GetPageLayout("pad_pad_spt", 'masterlist');
    if ($layout) {
        $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"');
    }
    $xt->display("pad_pad_spt_masterlist.htm");
    $strTableName = $oldTableName;
}
Ejemplo n.º 14
0
 function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
 {
     $baseResult = $this->baseSQLWhere($strSearchOption);
     if ($baseResult === false) {
         return "";
     }
     if ($baseResult != "") {
         return $baseResult;
     }
     $value1 = $this->pageObject->cipherer->MakeDBValue($this->field, $SearchFor, $etype, "", true);
     $value2 = false;
     $cleanvalue2 = false;
     if ($strSearchOption == "Between") {
         $cleanvalue2 = prepare_for_db($this->field, $SearchFor2, $etype);
         $value2 = make_db_value($this->field, $SearchFor2, $etype);
     }
     if ($strSearchOption != "Contains" && $strSearchOption != "Starts with" && ($value1 === "null" || $value2 === "null") && !$this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
         return "";
     }
     if (IsCharType($this->type) && !$this->btexttype) {
         if (!$this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
             $value1 = $this->pageObject->pSetEdit->isEnableUpper($value1);
             $value2 = $this->pageObject->pSetEdit->isEnableUpper($value2);
             $gstrField = $this->pageObject->pSetEdit->isEnableUpper(GetFullFieldName($this->field, "", false));
         } else {
             $gstrField = GetFullFieldName($this->field, "", false);
         }
     } elseif ($strSearchOption == "Contains" || $strSearchOption == "Starts with") {
         $gstrField = db_field2char(GetFullFieldName($this->field, "", false), $this->type);
     } elseif ($this->pageObject->pSetEdit->getViewFormat($this->field) == FORMAT_TIME) {
         $gstrField = db_field2time(GetFullFieldName($this->field, "", false), $this->type);
     } else {
         $gstrField = GetFullFieldName($this->field, "", false);
     }
     $ret = "";
     if ($strSearchOption == "Contains") {
         $SearchFor = $this->escapeSearchValForMySQL($SearchFor);
         if ($this->pageObject->cipherer->isFieldPHPEncrypted($this->field)) {
             return $gstrField . "=" . $this->pageObject->cipherer->MakeDBValue($this->field, $SearchFor);
         }
         if (IsCharType($this->type) && !$this->btexttype) {
             return $gstrField . " " . $this->like . " " . $this->pageObject->pSetEdit->isEnableUpper(db_prepare_string("%" . $SearchFor . "%"));
         } else {
             return $gstrField . " " . $this->like . " " . db_prepare_string("%" . $SearchFor . "%");
         }
     } else {
         if ($strSearchOption == "Equals") {
             return $gstrField . "=" . $value1;
         } else {
             if ($strSearchOption == "Starts with") {
                 $SearchFor = $this->escapeSearchValForMySQL($SearchFor);
                 if (IsCharType($this->type) && !$this->btexttype) {
                     return $gstrField . " " . $this->like . " " . $this->pageObject->pSetEdit->isEnableUpper(db_prepare_string($SearchFor . "%"));
                 } else {
                     return $gstrField . " " . $this->like . " " . db_prepare_string($SearchFor . "%");
                 }
             } else {
                 if ($strSearchOption == "More than") {
                     return $gstrField . ">" . $value1;
                 } else {
                     if ($strSearchOption == "Less than") {
                         return $gstrField . "<" . $value1;
                     } else {
                         if ($strSearchOption == "Equal or more than") {
                             return $gstrField . ">=" . $value1;
                         } else {
                             if ($strSearchOption == "Equal or less than") {
                                 return $gstrField . "<=" . $value1;
                             } else {
                                 if ($strSearchOption == "Between") {
                                     $ret = $gstrField . ">=" . $value1 . " and ";
                                     if (IsDateFieldType($this->type)) {
                                         $timeArr = db2time($cleanvalue2);
                                         // for dates without time, add one day
                                         if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
                                             $timeArr = adddays($timeArr, 1);
                                             $value2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
                                             $value2 = add_db_quotes($this->field, $value2, $this->pageObject->tName);
                                             $ret .= $gstrField . "<" . $value2;
                                         } else {
                                             $ret .= $gstrField . "<=" . $value2;
                                         }
                                     } else {
                                         $ret .= $gstrField . "<=" . $value2;
                                     }
                                     return $ret;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return "";
 }
Ejemplo n.º 15
0
 function SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest)
 {
     if ($this->lookupType == LT_LISTOFVALUES) {
         return parent::SQLWhere($SearchFor, $strSearchOption, $SearchFor2, $etype, $isSuggest);
     }
     $baseResult = $this->baseSQLWhere($strSearchOption);
     if ($baseResult === false) {
         return "";
     }
     if ($baseResult != "") {
         return $baseResult;
     }
     $displayFieldType = $this->type;
     if ($this->lookupType == LT_QUERY) {
         $displayFieldType = $this->lookupPSet->getFieldType($this->field);
         $this->btexttype = IsTextType($displayFieldType);
     }
     if ($this->multiselect) {
         $SearchFor = splitvalues($SearchFor);
     } else {
         $SearchFor = array($SearchFor);
     }
     $ret = "";
     if ($this->linkAndDisplaySame) {
         $gstrField = GetFullFieldName($this->field, "", false);
     } else {
         $gstrField = GetFullFieldName($this->displayFieldName, $this->lookupTable, false);
     }
     if ($this->customDisplay) {
         $gstrField = $this->lwDisplayFieldWrapped;
     } else {
         if (!$this->linkAndDisplaySame && $this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype && !$this->ciphererDisplay->isFieldPHPEncrypted($this->displayFieldName)) {
             $gstrField = $this->lookupPSet->isEnableUpper(GetFullFieldName($this->displayFieldName, $this->lookupTable, false));
         }
     }
     foreach ($SearchFor as $value) {
         if (!($value == "null" || $value == "Null" || $value == "")) {
             if (strlen(trim($ret))) {
                 $ret .= " or ";
             }
             if (!$this->multiselect) {
                 if ($strSearchOption == "Starts with") {
                     $value .= '%';
                 }
                 if ($isSuggest || $strSearchOption == "Contains") {
                     $value = '%' . $value . '%';
                 }
                 if ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between" || $strSearchOption == "Equals" && $this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
                     $value = $this->escapeSearchValForMySQL($value);
                     if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
                         $value = $this->lookupPSet->isEnableUpper(db_prepare_string($value));
                     } else {
                         $value = db_prepare_string($value);
                     }
                 } else {
                     if ($strSearchOption == "Equals") {
                         $value = make_db_value($this->field, $value);
                     }
                 }
             }
             if ($strSearchOption == "Equals") {
                 if (!($value == "null" || $value == "Null")) {
                     if ($this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
                         $condition = $gstrField . '=' . $value;
                     } else {
                         $condition = GetFullFieldName($this->field, "", false) . '=' . $value;
                     }
                 }
             } else {
                 if ($strSearchOption == "Starts with" || $strSearchOption == "Contains" && !$this->multiselect) {
                     $condition = $gstrField . " " . $this->like . " " . $value;
                 } else {
                     if ($strSearchOption == "More than") {
                         $condition = $gstrField . " > " . $value;
                     } else {
                         if ($strSearchOption == "Less than") {
                             $condition = $gstrField . "<" . $value;
                         } else {
                             if ($strSearchOption == "Equal or more than") {
                                 $condition = $gstrField . ">=" . $value1;
                             } else {
                                 if ($strSearchOption == "Equal or less than") {
                                     $condition = $gstrField . "<=" . $value1;
                                 } else {
                                     if ($strSearchOption == "Between") {
                                         if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
                                             $value2 = $this->lookupPSet->isEnableUpper(db_prepare_string($SearchFor2));
                                         } else {
                                             $value2 = db_prepare_string($SearchFor2);
                                         }
                                         $condition = $gstrField . ">=" . $value . " and ";
                                         if (IsDateFieldType($this->type)) {
                                             $timeArr = db2time($SearchFor2);
                                             // for dates without time, add one day
                                             if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
                                                 $timeArr = adddays($timeArr, 1);
                                                 $SearchFor2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
                                                 $SearchFor2 = add_db_quotes($this->field, $SearchFor2, $this->pageObject->tName);
                                                 $condition .= $gstrField . "<" . $SearchFor2;
                                             } else {
                                                 $condition .= $gstrField . "<=" . $value2;
                                             }
                                         } else {
                                             $condition .= $gstrField . "<=" . $value2;
                                         }
                                     } else {
                                         if (strpos($value, ",") !== false || strpos($value, '"') !== false) {
                                             $value = '"' . str_replace('"', '""', $value) . '"';
                                         }
                                         $value = $this->escapeSearchValForMySQL($value);
                                         //for search by multiply Lookup wizard field
                                         $ret .= GetFullFieldName($this->field, "", false) . " = " . db_prepare_string($value);
                                         $ret .= " or " . GetFullFieldName($this->field, "", false) . " " . $this->like . " " . db_prepare_string("%," . $value . ",%");
                                         $ret .= " or " . GetFullFieldName($this->field, "", false) . " " . $this->like . " " . db_prepare_string("%," . $value);
                                         $ret .= " or " . GetFullFieldName($this->field, "", false) . " " . $this->like . " " . db_prepare_string($value . ",%");
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             if ($condition != "" && ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Equals" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between")) {
                 if ($this->linkAndDisplaySame || $strSearchOption == "Equals" && $this->LCType != LCT_AJAX) {
                     $ret .= " " . $condition;
                 } else {
                     if ($this->lookupType == LT_QUERY) {
                         $lookupQueryObj = $this->lookupPSet->getSQLQuery();
                         $ret .= " EXISTS (" . $lookupQueryObj->toSql($condition . " and " . GetFullFieldName($this->linkFieldName, $this->lookupTable, false) . " = " . AddTableWrappers($this->pageObject->pSetEdit->getStrOriginalTableName()) . "." . AddFieldWrappers($this->field), '', null, false) . ")";
                     } else {
                         $ret .= " EXISTS (SELECT 1 as fld from " . AddTableWrappers($this->lookupTable) . " where " . $condition . " and " . $this->lwLinkField . " = " . AddTableWrappers($this->pageObject->pSetEdit->getStrOriginalTableName()) . "." . AddFieldWrappers($this->field) . ")";
                     }
                 }
             }
         }
     }
     if (strlen(trim($ret))) {
         $ret = "(" . $ret . ")";
     } else {
         $ret = trim($ret);
     }
     return $ret;
 }
function DisplayMasterTableInfo_pad_pad_jenis_pajak($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "pad.pad_jenis_pajak";
    //$strSQL = "SELECT id,   usaha_id,   nama,   rekening_id,   rekening_kd_sub,   rekdenda_id,   masapajak,   jatuhtempo,   multiple,   jalan_kelas_id,   tmt,   enabled,   created,   create_uid,   updated,   update_uid  FROM \"pad\".pad_jenis_pajak ";
    $cipherer = new RunnerCipherer($strTableName);
    $settings = new ProjectSettings($strTableName, PAGE_PRINT);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_PRINT);
    $where = "";
    global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["pad_pad_jenis_pajak_masterprint"] = $layout;
    $showKeys = "";
    if ($detailtable == "pad.pad_spt") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_tarif_pajak") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $where .= " and ";
        $showKeys .= " , ";
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[2 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[2 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_terima_line") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Export");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	id -
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	usaha_id -
    $xt->assign("usaha_id_mastervalue", $viewControls->showDBValue("usaha_id", $data, $keylink));
    //	nama -
    $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink));
    //	rekening_id -
    $xt->assign("rekening_id_mastervalue", $viewControls->showDBValue("rekening_id", $data, $keylink));
    //	rekening_kd_sub -
    $xt->assign("rekening_kd_sub_mastervalue", $viewControls->showDBValue("rekening_kd_sub", $data, $keylink));
    //	rekdenda_id -
    $xt->assign("rekdenda_id_mastervalue", $viewControls->showDBValue("rekdenda_id", $data, $keylink));
    //	masapajak -
    $xt->assign("masapajak_mastervalue", $viewControls->showDBValue("masapajak", $data, $keylink));
    //	jatuhtempo -
    $xt->assign("jatuhtempo_mastervalue", $viewControls->showDBValue("jatuhtempo", $data, $keylink));
    //	multiple -
    $xt->assign("multiple_mastervalue", $viewControls->showDBValue("multiple", $data, $keylink));
    //	jalan_kelas_id -
    $xt->assign("jalan_kelas_id_mastervalue", $viewControls->showDBValue("jalan_kelas_id", $data, $keylink));
    //	tmt - Short Date
    $xt->assign("tmt_mastervalue", $viewControls->showDBValue("tmt", $data, $keylink));
    //	enabled -
    $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink));
    //	created - Short Date
    $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink));
    //	create_uid -
    $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink));
    //	updated - Short Date
    $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink));
    //	update_uid -
    $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink));
    $xt->display("pad_pad_jenis_pajak_masterprint.htm");
    $strTableName = $oldTableName;
}
function DisplayMasterTableInfo_Customers($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "dbo.Customers";
    //$strSQL = "SELECT ID,   Name,   [Father Name],   Address,   Contact,   Location,   [Customer Type]  FROM dbo.Customers";
    $sqlHead = "SELECT ID,   Name,   [Father Name],   Address,   Contact,   Location,   [Customer Type]";
    $sqlFrom = "FROM dbo.Customers";
    $sqlWhere = "";
    $sqlTail = "";
    $where = "";
    $mKeys = array();
    $showKeys = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterlist", "BoldOrange", "MobileOrange");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["Customers_masterlist"] = $layout;
    if ($detailtable == "dbo.Customer Module Assignment") {
        $where .= GetFullFieldName("ID") . "=" . make_db_value("ID", $keys[1 - 1]);
        $showKeys .= " " . GetFieldLabel("dbo_Customers", "ID") . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Search");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($sqlWhere, $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $sqlHead . ' ' . $sqlFrom . $strWhere . $sqlTail;
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = db_fetch_array($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["ID"]));
    //	ID -
    $value = "";
    $value = ProcessLargeText(GetData($data, "ID", ""), "field=ID" . $keylink);
    $xt->assign("ID_mastervalue", $value);
    //	Name -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Name", ""), "field=Name" . $keylink);
    $xt->assign("Name_mastervalue", $value);
    //	Father Name -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Father Name", ""), "field=Father+Name" . $keylink);
    $xt->assign("Father_Name_mastervalue", $value);
    //	Address -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Address", ""), "field=Address" . $keylink);
    $xt->assign("Address_mastervalue", $value);
    //	Contact -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Contact", ""), "field=Contact" . $keylink);
    $xt->assign("Contact_mastervalue", $value);
    //	Location -
    $value = "";
    $value = DisplayLookupWizard("Location", $data["Location"], $data, $keylink, MODE_LIST);
    $xt->assign("Location_mastervalue", $value);
    //	Customer Type -
    $value = "";
    $value = DisplayLookupWizard("Customer Type", $data["Customer Type"], $data, $keylink, MODE_LIST);
    $xt->assign("Customer_Type_mastervalue", $value);
    $xt->display("Customers_masterlist.htm");
    $strTableName = $oldTableName;
}
Ejemplo n.º 18
0
 /**
  * Use for count details recs number, if subQueryes not supported, or keys have different types
  *
  * @param integer $i
  * @param array $detailid
  * @intellisense
  */
 function countDetailsRecsNoSubQ($dInd, &$detailid)
 {
     global $tables_data;
     global $masterTablesData;
     global $detailsTablesData;
     global $allDetailsTablesArr;
     $dDataSourceTable = $this->allDetailsTablesArr[$dInd]['dDataSourceTable'];
     $masterPSet = $this->pSet->getTable($dDataSourceTable);
     $detailsQuery = $masterPSet->getSQLQuery();
     $dSqlWhere = $detailsQuery->WhereToSql();
     $detailKeys = $masterPSet->getDetailKeysByMasterTable($this->tName);
     $securityClause = SecuritySQL("Search", $dDataSourceTable);
     // add where
     if (strlen($securityClause)) {
         $dSqlWhere = whereAdd($dSqlWhere, $securityClause);
     }
     $masterwhere = "";
     foreach ($this->masterKeysByD[$dInd] as $idx => $val) {
         if ($masterwhere) {
             $masterwhere .= " and ";
         }
         $mastervalue = $this->cipherer->MakeDBValue($detailKeys[$idx], $detailid[$idx], "", $dDataSourceTable, true);
         if ($mastervalue == "null") {
             $masterwhere .= GetFullFieldNameForInsert($masterPSet, $detailKeys[$idx]) . " is NULL ";
         } else {
             $masterwhere .= GetFullFieldName($detailKeys[$idx], $dDataSourceTable, false) . "=" . $mastervalue;
         }
     }
     return SQLQuery::gSQLRowCount_int($detailsQuery->HeadToSql(), $detailsQuery->FromToSql(), $dSqlWhere, $detailsQuery->GroupByToSql(), $detailsQuery->Having()->toSql($detailsQuery), $masterwhere, "");
 }
function DisplayMasterTableInfo_LU_Anomaly_Type($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "dbo.LU_Anomaly Type";
    //$strSQL = "SELECT Code,   [Tamper Type]  FROM dbo.[LU_Anomaly Type]";
    $sqlHead = "SELECT Code,   [Tamper Type]";
    $sqlFrom = "FROM dbo.[LU_Anomaly Type]";
    $sqlWhere = "";
    $sqlTail = "";
    $where = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterprint", "BoldOrange", "MobileOrange");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["LU_Anomaly_Type_masterprint"] = $layout;
    if ($detailtable == "dbo.Anomalies") {
        $where .= GetFullFieldName("Code") . "=" . make_db_value("Code", $keys[1 - 1]);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Export");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($sqlWhere, $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $sqlHead . ' ' . $sqlFrom . $strWhere . $sqlTail;
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = db_fetch_array($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["Code"]));
    //	Code -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Code", ""), "field=Code" . $keylink, "", MODE_PRINT);
    $xt->assign("Code_mastervalue", $value);
    //	Tamper Type -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Tamper Type", ""), "field=Tamper+Type" . $keylink, "", MODE_PRINT);
    $xt->assign("Tamper_Type_mastervalue", $value);
    $xt->display("LU_Anomaly_Type_masterprint.htm");
    $strTableName = $oldTableName;
}
function DisplayMasterTableInfo_LU_Module_Status($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "dbo.LU_Module Status";
    //$strSQL = "SELECT Code,   Status  FROM dbo.[LU_Module Status]";
    $sqlHead = "SELECT Code,   Status";
    $sqlFrom = "FROM dbo.[LU_Module Status]";
    $sqlWhere = "";
    $sqlTail = "";
    $where = "";
    $mKeys = array();
    $showKeys = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterlist", "BoldOrange", "MobileOrange");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["LU_Module_Status_masterlist"] = $layout;
    if ($detailtable == "dbo.Module") {
        $where .= GetFullFieldName("Code") . "=" . make_db_value("Code", $keys[1 - 1]);
        $showKeys .= " " . GetFieldLabel("dbo_LU_Module_Status", "Code") . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Search");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($sqlWhere, $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $sqlHead . ' ' . $sqlFrom . $strWhere . $sqlTail;
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = db_fetch_array($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["Code"]));
    //	Code -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Code", ""), "field=Code" . $keylink);
    $xt->assign("Code_mastervalue", $value);
    //	Status -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Status", ""), "field=Status" . $keylink);
    $xt->assign("Status_mastervalue", $value);
    $xt->display("LU_Module_Status_masterlist.htm");
    $strTableName = $oldTableName;
}
    //	copy keys to session
    $i = 1;
    while (isset($_REQUEST["masterkey" . $i])) {
        $_SESSION[$strTableName . "_masterkey" . $i] = $_REQUEST["masterkey" . $i];
        $i++;
    }
    if (isset($_SESSION[$strTableName . "_masterkey" . $i])) {
        unset($_SESSION[$strTableName . "_masterkey" . $i]);
    }
} else {
    $mastertable = $_SESSION[$strTableName . "_mastertable"];
}
//$strSQL = $gstrSQL;
if ($mastertable == "dbo.Module") {
    $where = "";
    $where .= GetFullFieldName("Module ID") . "=" . make_db_value("Module ID", $_SESSION[$strTableName . "_masterkey1"]);
}
$str = SecuritySQL("Search");
if (strlen($str)) {
    $where .= " and " . $str;
}
$strSQL = gSQLWhere($where);
$strSQL .= " " . $gstrOrderBy;
$rowcount = gSQLRowCount($where);
$xt->assign("row_count", $rowcount);
if ($rowcount) {
    $xt->assign("details_data", true);
    $rs = db_query($strSQL, $conn);
    $display_count = 10;
    if ($mode == "inline") {
        $display_count *= 2;
function DisplayMasterTableInfo_pad_pad_daftar_status($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "pad.pad_daftar_status";
    //$strSQL = "SELECT id,   kode,   uraian  FROM \"pad\".pad_daftar_status ";
    $cipherer = new RunnerCipherer($strTableName);
    $settings = new ProjectSettings($strTableName, PAGE_PRINT);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_PRINT);
    $where = "";
    global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["pad_pad_daftar_status_masterprint"] = $layout;
    $showKeys = "";
    if ($detailtable == "pad.pad_daftar_hist") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Export");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	id -
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	kode -
    $xt->assign("kode_mastervalue", $viewControls->showDBValue("kode", $data, $keylink));
    //	uraian -
    $xt->assign("uraian_mastervalue", $viewControls->showDBValue("uraian", $data, $keylink));
    $xt->display("pad_pad_daftar_status_masterprint.htm");
    $strTableName = $oldTableName;
}
Ejemplo n.º 23
0
function DisplayMasterTableInfo_app_users($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "app.users";
    //$strSQL = "SELECT userid,   nama,   created,   disabled,   passwd,   id,   kd_kantor,   kd_kanwil,   kd_tp,   kd_kanwil_bank,   kd_kppbb_bank,   kd_bank_tunggal,   kd_bank_persepsi,   nip,   jabatan,   handphone,   create_uid,   update_uid,   updated,   last_login,   is_login,   is_logout,   last_ip  FROM app.users ";
    $cipherer = new RunnerCipherer($strTableName);
    $settings = new ProjectSettings($strTableName, PAGE_PRINT);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_PRINT);
    $where = "";
    global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["app_users_masterprint"] = $layout;
    $showKeys = "";
    if ($detailtable == "app.user_groups") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Export");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	userid -
    $xt->assign("userid_mastervalue", $viewControls->showDBValue("userid", $data, $keylink));
    //	nama -
    $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink));
    //	created - Short Date
    $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink));
    //	disabled -
    $xt->assign("disabled_mastervalue", $viewControls->showDBValue("disabled", $data, $keylink));
    //	passwd -
    $xt->assign("passwd_mastervalue", $viewControls->showDBValue("passwd", $data, $keylink));
    //	id -
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	kd_kantor -
    $xt->assign("kd_kantor_mastervalue", $viewControls->showDBValue("kd_kantor", $data, $keylink));
    //	kd_kanwil -
    $xt->assign("kd_kanwil_mastervalue", $viewControls->showDBValue("kd_kanwil", $data, $keylink));
    //	kd_tp -
    $xt->assign("kd_tp_mastervalue", $viewControls->showDBValue("kd_tp", $data, $keylink));
    //	kd_kanwil_bank -
    $xt->assign("kd_kanwil_bank_mastervalue", $viewControls->showDBValue("kd_kanwil_bank", $data, $keylink));
    //	kd_kppbb_bank -
    $xt->assign("kd_kppbb_bank_mastervalue", $viewControls->showDBValue("kd_kppbb_bank", $data, $keylink));
    //	kd_bank_tunggal -
    $xt->assign("kd_bank_tunggal_mastervalue", $viewControls->showDBValue("kd_bank_tunggal", $data, $keylink));
    //	kd_bank_persepsi -
    $xt->assign("kd_bank_persepsi_mastervalue", $viewControls->showDBValue("kd_bank_persepsi", $data, $keylink));
    //	nip -
    $xt->assign("nip_mastervalue", $viewControls->showDBValue("nip", $data, $keylink));
    //	jabatan -
    $xt->assign("jabatan_mastervalue", $viewControls->showDBValue("jabatan", $data, $keylink));
    //	handphone -
    $xt->assign("handphone_mastervalue", $viewControls->showDBValue("handphone", $data, $keylink));
    //	create_uid -
    $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink));
    //	update_uid -
    $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink));
    //	updated - Short Date
    $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink));
    //	last_login - Short Date
    $xt->assign("last_login_mastervalue", $viewControls->showDBValue("last_login", $data, $keylink));
    //	is_login -
    $xt->assign("is_login_mastervalue", $viewControls->showDBValue("is_login", $data, $keylink));
    //	is_logout -
    $xt->assign("is_logout_mastervalue", $viewControls->showDBValue("is_logout", $data, $keylink));
    //	last_ip -
    $xt->assign("last_ip_mastervalue", $viewControls->showDBValue("last_ip", $data, $keylink));
    $xt->display("app_users_masterprint.htm");
    $strTableName = $oldTableName;
}
function DisplayMasterTableInfo_pad_pad_customer($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    $detailPageObj = $params["detailPageObj"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "pad.pad_customer";
    $settings = new ProjectSettings($strTableName, PAGE_LIST);
    $cipherer = new RunnerCipherer($strTableName);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_LIST);
    $where = "";
    $mKeys = array();
    $showKeys = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterlist", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["pad_pad_customer_masterlist"] = $layout;
    if ($detailtable == "pad.pad_spt") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_customer_usaha") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_customer_detail") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_terima") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Search");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->WhereToSql(), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL = AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	id -
    $value = "";
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	parent -
    $value = "";
    $xt->assign("parent_mastervalue", $viewControls->showDBValue("parent", $data, $keylink));
    //	npwpd -
    $value = "";
    $xt->assign("npwpd_mastervalue", $viewControls->showDBValue("npwpd", $data, $keylink));
    //	rp -
    $value = "";
    $xt->assign("rp_mastervalue", $viewControls->showDBValue("rp", $data, $keylink));
    //	pb -
    $value = "";
    $xt->assign("pb_mastervalue", $viewControls->showDBValue("pb", $data, $keylink));
    //	formno -
    $value = "";
    $xt->assign("formno_mastervalue", $viewControls->showDBValue("formno", $data, $keylink));
    //	reg_date - Short Date
    $value = "";
    $xt->assign("reg_date_mastervalue", $viewControls->showDBValue("reg_date", $data, $keylink));
    //	nama -
    $value = "";
    $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink));
    //	kecamatan_id -
    $value = "";
    $xt->assign("kecamatan_id_mastervalue", $viewControls->showDBValue("kecamatan_id", $data, $keylink));
    //	kelurahan_id -
    $value = "";
    $xt->assign("kelurahan_id_mastervalue", $viewControls->showDBValue("kelurahan_id", $data, $keylink));
    //	kabupaten -
    $value = "";
    $xt->assign("kabupaten_mastervalue", $viewControls->showDBValue("kabupaten", $data, $keylink));
    //	alamat -
    $value = "";
    $xt->assign("alamat_mastervalue", $viewControls->showDBValue("alamat", $data, $keylink));
    //	kodepos -
    $value = "";
    $xt->assign("kodepos_mastervalue", $viewControls->showDBValue("kodepos", $data, $keylink));
    //	telphone -
    $value = "";
    $xt->assign("telphone_mastervalue", $viewControls->showDBValue("telphone", $data, $keylink));
    //	wpnama -
    $value = "";
    $xt->assign("wpnama_mastervalue", $viewControls->showDBValue("wpnama", $data, $keylink));
    //	wpalamat -
    $value = "";
    $xt->assign("wpalamat_mastervalue", $viewControls->showDBValue("wpalamat", $data, $keylink));
    //	wpkelurahan -
    $value = "";
    $xt->assign("wpkelurahan_mastervalue", $viewControls->showDBValue("wpkelurahan", $data, $keylink));
    //	wpkecamatan -
    $value = "";
    $xt->assign("wpkecamatan_mastervalue", $viewControls->showDBValue("wpkecamatan", $data, $keylink));
    //	wpkabupaten -
    $value = "";
    $xt->assign("wpkabupaten_mastervalue", $viewControls->showDBValue("wpkabupaten", $data, $keylink));
    //	wptelp -
    $value = "";
    $xt->assign("wptelp_mastervalue", $viewControls->showDBValue("wptelp", $data, $keylink));
    //	wpkodepos -
    $value = "";
    $xt->assign("wpkodepos_mastervalue", $viewControls->showDBValue("wpkodepos", $data, $keylink));
    //	pnama -
    $value = "";
    $xt->assign("pnama_mastervalue", $viewControls->showDBValue("pnama", $data, $keylink));
    //	palamat -
    $value = "";
    $xt->assign("palamat_mastervalue", $viewControls->showDBValue("palamat", $data, $keylink));
    //	pkelurahan -
    $value = "";
    $xt->assign("pkelurahan_mastervalue", $viewControls->showDBValue("pkelurahan", $data, $keylink));
    //	pkecamatan -
    $value = "";
    $xt->assign("pkecamatan_mastervalue", $viewControls->showDBValue("pkecamatan", $data, $keylink));
    //	pkabupaten -
    $value = "";
    $xt->assign("pkabupaten_mastervalue", $viewControls->showDBValue("pkabupaten", $data, $keylink));
    //	ptelp -
    $value = "";
    $xt->assign("ptelp_mastervalue", $viewControls->showDBValue("ptelp", $data, $keylink));
    //	pkodepos -
    $value = "";
    $xt->assign("pkodepos_mastervalue", $viewControls->showDBValue("pkodepos", $data, $keylink));
    //	ijin1 -
    $value = "";
    $xt->assign("ijin1_mastervalue", $viewControls->showDBValue("ijin1", $data, $keylink));
    //	ijin1no -
    $value = "";
    $xt->assign("ijin1no_mastervalue", $viewControls->showDBValue("ijin1no", $data, $keylink));
    //	ijin1tgl - Short Date
    $value = "";
    $xt->assign("ijin1tgl_mastervalue", $viewControls->showDBValue("ijin1tgl", $data, $keylink));
    //	ijin1tglakhir - Short Date
    $value = "";
    $xt->assign("ijin1tglakhir_mastervalue", $viewControls->showDBValue("ijin1tglakhir", $data, $keylink));
    //	ijin2 -
    $value = "";
    $xt->assign("ijin2_mastervalue", $viewControls->showDBValue("ijin2", $data, $keylink));
    //	ijin2no -
    $value = "";
    $xt->assign("ijin2no_mastervalue", $viewControls->showDBValue("ijin2no", $data, $keylink));
    //	ijin2tgl - Short Date
    $value = "";
    $xt->assign("ijin2tgl_mastervalue", $viewControls->showDBValue("ijin2tgl", $data, $keylink));
    //	ijin2tglakhir - Short Date
    $value = "";
    $xt->assign("ijin2tglakhir_mastervalue", $viewControls->showDBValue("ijin2tglakhir", $data, $keylink));
    //	ijin3 -
    $value = "";
    $xt->assign("ijin3_mastervalue", $viewControls->showDBValue("ijin3", $data, $keylink));
    //	ijin3no -
    $value = "";
    $xt->assign("ijin3no_mastervalue", $viewControls->showDBValue("ijin3no", $data, $keylink));
    //	ijin3tgl - Short Date
    $value = "";
    $xt->assign("ijin3tgl_mastervalue", $viewControls->showDBValue("ijin3tgl", $data, $keylink));
    //	ijin3tglakhir - Short Date
    $value = "";
    $xt->assign("ijin3tglakhir_mastervalue", $viewControls->showDBValue("ijin3tglakhir", $data, $keylink));
    //	ijin4 -
    $value = "";
    $xt->assign("ijin4_mastervalue", $viewControls->showDBValue("ijin4", $data, $keylink));
    //	ijin4no -
    $value = "";
    $xt->assign("ijin4no_mastervalue", $viewControls->showDBValue("ijin4no", $data, $keylink));
    //	ijin4tgl - Short Date
    $value = "";
    $xt->assign("ijin4tgl_mastervalue", $viewControls->showDBValue("ijin4tgl", $data, $keylink));
    //	ijin4tglakhir - Short Date
    $value = "";
    $xt->assign("ijin4tglakhir_mastervalue", $viewControls->showDBValue("ijin4tglakhir", $data, $keylink));
    //	kukuhno -
    $value = "";
    $xt->assign("kukuhno_mastervalue", $viewControls->showDBValue("kukuhno", $data, $keylink));
    //	kukuhnip -
    $value = "";
    $xt->assign("kukuhnip_mastervalue", $viewControls->showDBValue("kukuhnip", $data, $keylink));
    //	kukuhtgl - Short Date
    $value = "";
    $xt->assign("kukuhtgl_mastervalue", $viewControls->showDBValue("kukuhtgl", $data, $keylink));
    //	kukuh_jabat_id -
    $value = "";
    $xt->assign("kukuh_jabat_id_mastervalue", $viewControls->showDBValue("kukuh_jabat_id", $data, $keylink));
    //	kukuhprinted -
    $value = "";
    $xt->assign("kukuhprinted_mastervalue", $viewControls->showDBValue("kukuhprinted", $data, $keylink));
    //	enabled -
    $value = "";
    $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink));
    //	create_uid -
    $value = "";
    $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink));
    //	tmt - Short Date
    $value = "";
    $xt->assign("tmt_mastervalue", $viewControls->showDBValue("tmt", $data, $keylink));
    //	customer_status_id -
    $value = "";
    $xt->assign("customer_status_id_mastervalue", $viewControls->showDBValue("customer_status_id", $data, $keylink));
    //	kembalitgl - Short Date
    $value = "";
    $xt->assign("kembalitgl_mastervalue", $viewControls->showDBValue("kembalitgl", $data, $keylink));
    //	kembalioleh -
    $value = "";
    $xt->assign("kembalioleh_mastervalue", $viewControls->showDBValue("kembalioleh", $data, $keylink));
    //	kartuprinted -
    $value = "";
    $xt->assign("kartuprinted_mastervalue", $viewControls->showDBValue("kartuprinted", $data, $keylink));
    //	kembalinip -
    $value = "";
    $xt->assign("kembalinip_mastervalue", $viewControls->showDBValue("kembalinip", $data, $keylink));
    //	penerimanm -
    $value = "";
    $xt->assign("penerimanm_mastervalue", $viewControls->showDBValue("penerimanm", $data, $keylink));
    //	penerimaalamat -
    $value = "";
    $xt->assign("penerimaalamat_mastervalue", $viewControls->showDBValue("penerimaalamat", $data, $keylink));
    //	penerimatgl - Short Date
    $value = "";
    $xt->assign("penerimatgl_mastervalue", $viewControls->showDBValue("penerimatgl", $data, $keylink));
    //	catatnip -
    $value = "";
    $xt->assign("catatnip_mastervalue", $viewControls->showDBValue("catatnip", $data, $keylink));
    //	kirimtgl - Short Date
    $value = "";
    $xt->assign("kirimtgl_mastervalue", $viewControls->showDBValue("kirimtgl", $data, $keylink));
    //	batastgl - Short Date
    $value = "";
    $xt->assign("batastgl_mastervalue", $viewControls->showDBValue("batastgl", $data, $keylink));
    //	petugas_jabat_id -
    $value = "";
    $xt->assign("petugas_jabat_id_mastervalue", $viewControls->showDBValue("petugas_jabat_id", $data, $keylink));
    //	pencatat_jabat_id -
    $value = "";
    $xt->assign("pencatat_jabat_id_mastervalue", $viewControls->showDBValue("pencatat_jabat_id", $data, $keylink));
    //	created - Short Date
    $value = "";
    $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink));
    //	updated - Short Date
    $value = "";
    $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink));
    //	update_uid -
    $value = "";
    $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink));
    //	npwpd_old -
    $value = "";
    $xt->assign("npwpd_old_mastervalue", $viewControls->showDBValue("npwpd_old", $data, $keylink));
    //	id_old -
    $value = "";
    $xt->assign("id_old_mastervalue", $viewControls->showDBValue("id_old", $data, $keylink));
    $viewControls->addControlsJSAndCSS();
    $detailPageObj->viewControlsMap['mViewControlsMap'] = $viewControls->viewControlsMap;
    $layout = GetPageLayout("pad_pad_customer", 'masterlist');
    if ($layout) {
        $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"');
    }
    $xt->display("pad_pad_customer_masterlist.htm");
    $strTableName = $oldTableName;
}
function DisplayMasterTableInfo_pad_pad_kelurahan($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    $detailPageObj = $params["detailPageObj"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "pad.pad_kelurahan";
    $settings = new ProjectSettings($strTableName, PAGE_LIST);
    $cipherer = new RunnerCipherer($strTableName);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_LIST);
    $where = "";
    $mKeys = array();
    $showKeys = "";
    global $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterlist", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["pad_pad_kelurahan_masterlist"] = $layout;
    if ($detailtable == "pad.pad_customer_usaha") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_customer") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if ($detailtable == "pad.pad_daftar") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $where .= " and ";
        $showKeys .= " , ";
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[2 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[2 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Search");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->WhereToSql(), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL = AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	id -
    $value = "";
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	kecamatan_id -
    $value = "";
    $xt->assign("kecamatan_id_mastervalue", $viewControls->showDBValue("kecamatan_id", $data, $keylink));
    //	kode -
    $value = "";
    $xt->assign("kode_mastervalue", $viewControls->showDBValue("kode", $data, $keylink));
    //	nama -
    $value = "";
    $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink));
    //	tmt - Short Date
    $value = "";
    $xt->assign("tmt_mastervalue", $viewControls->showDBValue("tmt", $data, $keylink));
    //	enabled -
    $value = "";
    $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink));
    //	created - Short Date
    $value = "";
    $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink));
    //	create_uid -
    $value = "";
    $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink));
    //	updated - Short Date
    $value = "";
    $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink));
    //	update_uid -
    $value = "";
    $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink));
    $viewControls->addControlsJSAndCSS();
    $detailPageObj->viewControlsMap['mViewControlsMap'] = $viewControls->viewControlsMap;
    $layout = GetPageLayout("pad_pad_kelurahan", 'masterlist');
    if ($layout) {
        $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"');
    }
    $xt->display("pad_pad_kelurahan_masterlist.htm");
    $strTableName = $oldTableName;
}
Ejemplo n.º 26
0
 function getOrderSql()
 {
     if ($this->_interval == 0) {
         $fname = $this->_oldAlgorithm ? GetFullFieldName($this->_name) : cached_ffn($this->_name);
         return $fname . ' ' . $this->_orderBy . ' ';
     } else {
         $grp = $this->getSqlList();
         $newgrp = array();
         foreach ($grp as $g) {
             $newgrp[] = $g . ' ' . $this->_orderBy . ' ';
         }
         return join(', ', $newgrp);
     }
 }
Ejemplo n.º 27
0
function DisplayMasterTableInfo_pad_pad_sspd($params)
{
    $detailtable = $params["detailtable"];
    $keys = $params["keys"];
    global $conn, $strTableName;
    $xt = new Xtempl();
    $oldTableName = $strTableName;
    $strTableName = "pad.pad_sspd";
    //$strSQL = "SELECT id,   tahun,   sspdno,   sspdtgl,   sspdjam,   invoice_id,   keterangan,   bulan_telat,   hitung_bunga,   denda,   bunga,   jml_bayar,   sisa,   jenis_bayar,   printed,   tp_id,   is_validated,   is_valid,   enabled,   created,   create_uid,   updated,   update_uid,   petugas_id,   pejabat_id  FROM \"pad\".pad_sspd ";
    $cipherer = new RunnerCipherer($strTableName);
    $settings = new ProjectSettings($strTableName, PAGE_PRINT);
    $masterQuery = $settings->getSQLQuery();
    $viewControls = new ViewControlsContainer($settings, PAGE_PRINT);
    $where = "";
    global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles;
    $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen");
    $layout->blocks["bare"] = array();
    $layout->containers["0"] = array();
    $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1);
    $layout->skins["0"] = "empty";
    $layout->blocks["bare"][] = "0";
    $layout->containers["mastergrid"] = array();
    $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1);
    $layout->skins["mastergrid"] = "grid";
    $layout->blocks["bare"][] = "mastergrid";
    $page_layouts["pad_pad_sspd_masterprint"] = $layout;
    $showKeys = "";
    if ($detailtable == "public.pad_payment") {
        $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true);
        $showKeys .= " " . "Id" . ": " . $keys[1 - 1];
        $xt->assign('showKeys', $showKeys);
    }
    if (!$where) {
        $strTableName = $oldTableName;
        return;
    }
    $str = SecuritySQL("Export");
    if (strlen($str)) {
        $where .= " and " . $str;
    }
    $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where);
    if (strlen($strWhere)) {
        $strWhere = " where " . $strWhere . " ";
    }
    $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql();
    //	$strSQL=AddWhere($strSQL,$where);
    LogInfo($strSQL);
    $rs = db_query($strSQL, $conn);
    $data = $cipherer->DecryptFetchedArray($rs);
    if (!$data) {
        $strTableName = $oldTableName;
        return;
    }
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"]));
    //	id -
    $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));
    //	tahun -
    $xt->assign("tahun_mastervalue", $viewControls->showDBValue("tahun", $data, $keylink));
    //	sspdno -
    $xt->assign("sspdno_mastervalue", $viewControls->showDBValue("sspdno", $data, $keylink));
    //	sspdtgl - Short Date
    $xt->assign("sspdtgl_mastervalue", $viewControls->showDBValue("sspdtgl", $data, $keylink));
    //	sspdjam - Time
    $xt->assign("sspdjam_mastervalue", $viewControls->showDBValue("sspdjam", $data, $keylink));
    //	invoice_id -
    $xt->assign("invoice_id_mastervalue", $viewControls->showDBValue("invoice_id", $data, $keylink));
    //	keterangan -
    $xt->assign("keterangan_mastervalue", $viewControls->showDBValue("keterangan", $data, $keylink));
    //	bulan_telat -
    $xt->assign("bulan_telat_mastervalue", $viewControls->showDBValue("bulan_telat", $data, $keylink));
    //	hitung_bunga -
    $xt->assign("hitung_bunga_mastervalue", $viewControls->showDBValue("hitung_bunga", $data, $keylink));
    //	denda - Number
    $xt->assign("denda_mastervalue", $viewControls->showDBValue("denda", $data, $keylink));
    //	bunga - Number
    $xt->assign("bunga_mastervalue", $viewControls->showDBValue("bunga", $data, $keylink));
    //	jml_bayar -
    $xt->assign("jml_bayar_mastervalue", $viewControls->showDBValue("jml_bayar", $data, $keylink));
    //	sisa - Number
    $xt->assign("sisa_mastervalue", $viewControls->showDBValue("sisa", $data, $keylink));
    //	jenis_bayar -
    $xt->assign("jenis_bayar_mastervalue", $viewControls->showDBValue("jenis_bayar", $data, $keylink));
    //	printed -
    $xt->assign("printed_mastervalue", $viewControls->showDBValue("printed", $data, $keylink));
    //	tp_id -
    $xt->assign("tp_id_mastervalue", $viewControls->showDBValue("tp_id", $data, $keylink));
    //	is_validated -
    $xt->assign("is_validated_mastervalue", $viewControls->showDBValue("is_validated", $data, $keylink));
    //	is_valid -
    $xt->assign("is_valid_mastervalue", $viewControls->showDBValue("is_valid", $data, $keylink));
    //	enabled -
    $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink));
    //	created - Short Date
    $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink));
    //	create_uid -
    $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink));
    //	updated - Short Date
    $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink));
    //	update_uid -
    $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink));
    //	petugas_id -
    $xt->assign("petugas_id_mastervalue", $viewControls->showDBValue("petugas_id", $data, $keylink));
    //	pejabat_id -
    $xt->assign("pejabat_id_mastervalue", $viewControls->showDBValue("pejabat_id", $data, $keylink));
    $xt->display("pad_pad_sspd_masterprint.htm");
    $strTableName = $oldTableName;
}
 $fType = GetFieldType($f, $strTableName);
 // filter fields by type
 if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || IsTextType($fType)) {
     continue;
 }
 // get suggest for field
 if (($searchField == '' || $searchField == GoodFieldName($f)) && CheckFieldPermissions($f)) {
     $where = "";
     $having = "";
     if (!$gQuery->IsAggrFuncField(GetFieldIndex($f) - 1)) {
         $where = $searchClauseObj->getSuggestWhere($f, $fType, $suggestAllContent, $searchFor);
     } elseif ($gQuery->IsAggrFuncField(GetFieldIndex($f) - 1)) {
         $having = $searchClauseObj->getSuggestWhere($f, $fType, $suggestAllContent, $searchFor);
     }
     // prepare common vals
     $sqlHead = "SELECT DISTINCT " . GetFullFieldName($f) . " ";
     $oHaving = $gQuery->Having();
     $sqlHaving = $oHaving->toSql($gQuery);
     $sqlGroupBy = $gQuery->GroupByToSql();
     $where = whereAdd($where, $strSecuritySql);
     $strSQL = gSQLWhere_having($sqlHead, $gsqlFrom, $gsqlWhereExpr, $sqlGroupBy, $sqlHaving, $where, $having);
     $strSQL .= " ORDER BY 1 ";
     $rs = db_query($strSQL, $conn);
     $i = 0;
     while ($row = db_fetch_numarray($rs)) {
         $i++;
         $val = $row[0];
         if (IsGuid($fType)) {
             $val = substr($val, 1, -1);
         }
         $pos = strpos($val, "\n");
function InsertRecord($arr, $recInd)
{
    global $goodlines, $conn, $error_message, $keys_present, $keys, $strOriginalTableName, $strTableName, $eventObj, $locale_info, $auditObj;
    $ret = 1;
    $rawvalues = array();
    foreach ($arr as $key => $val) {
        $rawvalues[$key] = $val;
        $type = GetFieldType($key);
        if (!NeedQuotes($type)) {
            $value = (string) $val;
            $value = str_replace(",", ".", $value);
            if (strlen($value) > 0) {
                $value = str_replace($locale_info["LOCALE_SCURRENCY"], "", $value);
                $arr[$key] = 0 + $value;
            } else {
                $arr[$key] = NULL;
            }
        }
    }
    $retval = true;
    if ($eventObj->exists('BeforeInsert')) {
        $retval = $eventObj->BeforeInsert($rawvalues, $arr);
    }
    if ($retval) {
        $fields = array_keys($arr);
        foreach ($fields as $key => $val) {
            $fields_list[$key] = AddFieldWrappers(GetFullFieldName($val));
        }
        $values_list = "";
        foreach ($arr as $key => $val) {
            if (!is_null($arr[$key])) {
                $values_list .= add_db_quotes($key, $val) . ", ";
            } else {
                $values_list .= "NULL, ";
            }
        }
        if (strlen($values_list) > 0) {
            $values_list = substr($values_list, 0, strlen($values_list) - 2);
        }
        $sql = "insert into " . AddTableWrappers($strOriginalTableName) . " (" . implode(",", $fields_list) . ") values (" . $values_list . ")";
        if (db_exec_import($sql, $conn)) {
            $goodlines++;
            if ($auditObj) {
                $aKeys = GetKeysArray($arr, true);
                $auditObj->LogAdd($strTableName, $arr, $aKeys);
            }
        } else {
            $temp_error_message = "<b>Error:</b> in the line: " . implode(",", $arr) . '&nbsp;&nbsp;<a linkType="debugOpener" recId="' . $recInd . '" href="" onclick="importMore(' . $recInd . ');">More info</a><br>';
            $temp_error_message .= '<div id="importDebugInfoTable' . $recInd . '" cellpadding="3" cellspacing="1" align="center" style="display: none;"><p class="error">SQL query: ' . $sql . '; </p><p class="error">DB error: ' . db_error($conn) . ';</p></div>';
            $temp_error_message .= "<br><br>";
            // we'll try to update the record
            if ($keys_present) {
                $sql = "update " . AddTableWrappers($strOriginalTableName) . " set ";
                $sqlset = "";
                $where = " where ";
                foreach ($fields as $k => $val) {
                    if (!in_array(AddFieldWrappers($fields[$k]), $keys)) {
                        if (!is_null($arr[$val])) {
                            $sqlset .= $fields_list[$k] . "=" . add_db_quotes($val, $arr[$val]) . ", ";
                        } else {
                            $sqlset .= $fields_list[$k] . "=NULL, ";
                        }
                    } else {
                        $where .= $fields_list[$k] . "=" . add_db_quotes($val, $arr[$val]) . " and ";
                    }
                }
                if (strlen($sqlset) > 0) {
                    $sql .= substr($sqlset, 0, strlen($sqlset) - 2);
                }
                $where = substr($where, 0, strlen($where) - 5);
                $sql .= " " . $where;
                $rstmp = db_query("select * from " . AddTableWrappers($strOriginalTableName) . " " . $where, $conn);
                $data = db_fetch_array($rstmp);
                if ($data) {
                    if ($auditObj) {
                        foreach ($data as $key => $val) {
                            $auditOldValues[$key] = $val;
                        }
                    }
                    if (db_exec_import($sql, $conn)) {
                        // update successfull
                        $goodlines++;
                        if ($auditObj) {
                            $aKeys = GetKeysArray($arr);
                            $auditObj->LogEdit($strTableName, $arr, $auditOldValues, $aKeys);
                        }
                    } else {
                        echo 'not updated';
                        // update not successfull
                        $error_message .= $temp_error_message;
                        $ret = 0;
                    }
                } else {
                    $error_message .= $temp_error_message;
                    $ret = 0;
                }
            } else {
                $error_message .= $temp_error_message;
            }
        }
        return $ret;
    }
}
Ejemplo n.º 30
0
function buildLookupSQL($pageType, $field, $table, $parentVal, $childVal = "", $doCategoryFilter = true, $doValueFilter = false, $addCategoryField = false, $doWhereFilter = true, $oneRecordMode = false, $doValueFilterByLinkField = false)
{
    global $strTableName;
    if (!strlen($table)) {
        $table = $strTableName;
    }
    $pSet = new ProjectSettings($table, $pageType);
    //	read settings
    $nLookupType = $pSet->getLookupType($field);
    if ($nLookupType != LT_LOOKUPTABLE && $nLookupType != LT_QUERY) {
        return "";
    }
    $lookupTable = $pSet->getLookupTable($field);
    $displayFieldName = $pSet->getDisplayField($field);
    $linkFieldName = $pSet->getLinkField($field);
    $linkAndDisplaySame = $displayFieldName == $linkFieldName;
    $bUnique = $pSet->isLookupUnique($field);
    $strLookupWhere = GetLWWhere($field, $pageType, $table);
    $strOrderBy = $pSet->getLookupOrderBy($field);
    if (strlen($strOrderBy)) {
        $strOrderBy = GetFullFieldName($strOrderBy, $lookupTable);
        if ($pSet->isLookupDesc($field)) {
            $strOrderBy .= ' DESC';
        }
    }
    $bDesc = $pSet->isLookupDesc($field);
    $strCategoryFilter = $pSet->getCategoryFilter($field);
    if ($nLookupType == LT_QUERY) {
        $lookupPSet = new ProjectSettings($lookupTable, $pageType);
        $cipherer = new RunnerCipherer($lookupTable, $lookupPSet);
    } else {
        $cipherer = new RunnerCipherer($table, $pSet);
    }
    if ($doCategoryFilter) {
        if ($nLookupType == LT_QUERY) {
            $parentVal = $cipherer->MakeDBValue($strCategoryFilter, $parentVal, "", $lookupTable, true);
        } else {
            $parentVal = make_db_value($pSet->getCategoryControl($field), $parentVal, '', '', $table);
        }
    }
    if ($doValueFilter) {
        if ($pageType != PAGE_SEARCH || $doValueFilterByLinkField) {
            if ($nLookupType == LT_QUERY) {
                $childWhereField = $pSet->getLWLinkField($field, false);
            } else {
                $childWhereField = $pSet->getLWLinkField($field, true);
            }
        } else {
            if ($nLookupType == LT_QUERY) {
                $childWhereField = $pSet->getLWDisplayField($field, false);
            } else {
                $childWhereField = $pSet->getLWDisplayField($field, true);
            }
        }
        if ($nLookupType == LT_QUERY) {
            $childVal = $cipherer->MakeDBValue($childWhereField, $childVal, "", $lookupTable, true);
        } else {
            if ($linkAndDisplaySame) {
                $childVal = make_db_value($field, $childVal, '', '', $table);
            } else {
                $childVal = add_db_quotes($field, $childVal, $table, 200);
            }
        }
    }
    //	build Where clause
    $categoryWhere = "";
    $childWhere = "";
    if ($pSet->useCategory($field) && $doCategoryFilter) {
        $condition = "=" . $parentVal;
        if ($parentVal === "null") {
            $condition = " is null";
        }
        if ($nLookupType == LT_QUERY) {
            $categoryWhere = $cipherer->GetFieldName(AddFieldWrappers($strCategoryFilter), $strCategoryFilter) . $condition;
        } else {
            $categoryWhere = AddFieldWrappers($strCategoryFilter) . $condition;
        }
    }
    if ($doValueFilter) {
        $condition = "=" . $childVal;
        if ($childVal === "null") {
            $condition = " is null";
        }
        if ($nLookupType == LT_QUERY) {
            if ($pageType != PAGE_SEARCH || $pSet->lookupControlType($field) == LCT_LIST || $doValueFilterByLinkField) {
                $childWhere = GetFullFieldName($pSet->getLinkField($field), $lookupTable, false) . $condition;
            } else {
                if (!$pSet->getCustomDisplay($field)) {
                    $childWhere = $cipherer->GetFieldName($lookupPSet->getFullNameField($displayFieldName), $field) . $condition;
                } else {
                    $childWhere = $pSet->getDisplayField($field) . $condition;
                }
            }
        } else {
            if ($pageType != PAGE_SEARCH || $doValueFilterByLinkField) {
                $childWhere = $pSet->getLWLinkField($field, true) . $condition;
            } else {
                $childWhere = $pSet->getLWDisplayField($field, true) . $condition;
            }
        }
    }
    $strWhere = "";
    if ($doWhereFilter && strlen($strLookupWhere)) {
        $strWhere = "(" . $strLookupWhere . ")";
    }
    if (strlen($categoryWhere)) {
        if (strlen($strWhere)) {
            $strWhere .= " AND ";
        }
        $strWhere .= $categoryWhere;
    }
    if (strlen($childWhere)) {
        if (strlen($strWhere)) {
            $strWhere .= " AND ";
        }
        $strWhere .= $childWhere;
    }
    //	build SQL string
    if ($nLookupType == LT_QUERY) {
        $lookupQueryObj = $lookupPSet->getSQLQuery();
        if ($pSet->getCustomDisplay($field)) {
            $lookupQueryObj->AddCustomExpression($displayFieldName, $lookupPSet, $table, $field);
        }
        $lookupQueryObj->ReplaceFieldsWithDummies($lookupPSet->getBinaryFieldsIndices());
        $strWhere = whereAdd($lookupQueryObj->m_where->toSql($lookupQueryObj), $strWhere);
        $LookupSQL = $lookupQueryObj->toSql($strWhere, strlen($strOrderBy) ? ' ORDER BY ' . $strOrderBy : null, null, $oneRecordMode);
    } else {
        $LookupSQL = "SELECT ";
        if ($bUnique && !$oneRecordMode) {
            $LookupSQL .= "DISTINCT ";
        }
        $LookupSQL .= $pSet->getLWLinkField($field);
        if (!$linkAndDisplaySame) {
            $LookupSQL .= "," . $pSet->getLWDisplayField($field);
        }
        if ($addCategoryField && strlen($strCategoryFilter)) {
            $LookupSQL .= "," . AddFieldWrappers($strCategoryFilter);
        }
        $LookupSQL .= " FROM " . AddTableWrappers($lookupTable);
        if (strlen($strWhere)) {
            $LookupSQL .= " WHERE " . $strWhere;
        }
        //	order by clause
        if (strlen($strOrderBy)) {
            $LookupSQL .= " ORDER BY " . AddTableWrappers($lookupTable) . "." . $strOrderBy;
        }
        if ($oneRecordMode) {
            $LookupSQL .= " limit 1";
        }
    }
    return $LookupSQL;
}