/** * Get a Lookup Wizard Where expression * @return String */ protected function getLookupWhere() { $lookupWhere = GetLWWhere($this->field, $this->lookupPageType, $this->tName); if ($this->lookupType == LT_QUERY) { if ($this->lookupPSet->getAdvancedSecurityType() == ADVSECURITY_VIEW_OWN) { $lookupWhere = whereAdd($lookupWhere, SecuritySQL("Search", $this->lookupTable)); } } return $lookupWhere; }
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; }
function DisplayMasterTableInfo_BranchMaster($params) { global $cman; $detailtable = $params["detailtable"]; $keys = $params["keys"]; $xt = new Xtempl(); $tName = "BranchMaster"; $xt->eventsObject = getEventObject($tName); $settings = new ProjectSettings($tName, PAGE_LIST); $cipherer = new RunnerCipherer($tName); $connection = $cman->byTable($tName); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_LIST); $where = ""; $keysAssoc = array(); $showKeys = ""; if ($detailtable == "Fact_SalesTransaction") { $keysAssoc["GroupID"] = $keys[1 - 1]; $keysAssoc["CompanyID"] = $keys[2 - 1]; $where .= RunnerPage::_getFieldSQLDecrypt("GroupID", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("GroupID", $keys[1 - 1], "", true); $keyValue = $viewControls->showDBValue("GroupID", $keysAssoc); $showKeys .= " " . GetFieldLabel("BranchMaster", "GroupID") . ": " . $keyValue; $where .= " and "; $showKeys .= " , "; $where .= RunnerPage::_getFieldSQLDecrypt("CompanyID", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("CompanyID", $keys[2 - 1], "", true); $keyValue = $viewControls->showDBValue("CompanyID", $keysAssoc); $showKeys .= " " . GetFieldLabel("BranchMaster", "CompanyID") . ": " . $keyValue; $xt->assign('showKeys', $showKeys); } if (!$where) { return; } $str = SecuritySQL("Search", $tName); 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(); LogInfo($strSQL); $data = $cipherer->DecryptFetchedArray($connection->query($strSQL)->fetchAssoc()); if (!$data) { return; } // reassign pagetitlelabel function adding extra params $xt->assign_function("pagetitlelabel", "xt_pagetitlelabel", array("record" => $data, "settings" => $settings)); $keylink = ""; $xt->assign("BranchCloudFolder_mastervalue", $viewControls->showDBValue("BranchCloudFolder", $data, $keylink)); $format = $settings->getViewFormat("BranchCloudFolder"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("BranchCloudFolder"))) { $class = ' rnr-field-number'; } $xt->assign("BranchCloudFolder_class", $class); // add class for field header as field value $xt->assign("BranchLastSyncDate_mastervalue", $viewControls->showDBValue("BranchLastSyncDate", $data, $keylink)); $format = $settings->getViewFormat("BranchLastSyncDate"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("BranchLastSyncDate"))) { $class = ' rnr-field-number'; } $xt->assign("BranchLastSyncDate_class", $class); // add class for field header as field value $xt->assign("l_mastervalue", $viewControls->showDBValue("l", $data, $keylink)); $format = $settings->getViewFormat("l"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("l"))) { $class = ' rnr-field-number'; } $xt->assign("l_class", $class); // add class for field header as field value $layout = GetPageLayout("BranchMaster", 'masterlist'); if ($layout) { $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"'); } $xt->displayPartial(GetTemplateName("BranchMaster", "masterlist")); }
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; }
if (!checkTableName($table)) { exit(0); } require_once "include/" . $table . "_variables.php"; $searchFor = postvalue('searchFor'); // if nothing to search if ($searchFor == '') { echo printJSON(array('success' => true, 'result' => '')); return; } $_connection = $cman->byTable($strTableName); // array of vals $response = array(); $searchOpt = postvalue("start") ? "Starts with" : "Contains"; $searchField = GoodFieldName(postvalue('searchField')); $strSecuritySql = SecuritySQL("Search", $strTableName); $numberOfSuggests = GetGlobalData("searchSuggestsNumber", 10); $pSet = new ProjectSettings($strTableName, PAGE_SEARCH); if ($searchField == "") { $allSearchFields = $pSet->getGoogleLikeFields(); } else { // array of fields which were added in wizard for search $allSearchFields = $pSet->getAllSearchFields(); } require_once getabspath('classes/controls/EditControlsContainer.php'); $detailKeys = array(); $masterWhere = ""; $cipherer = new RunnerCipherer($strTableName); $controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer); if (@$_SESSION[$strTableName . "_mastertable"] != "") { $masterTablesInfoArr = $pSet->getMasterTablesArr($strTableName);
/** * Read current values from the database * * @return {array} array of current record data */ function getCurrentRecordInternal() { if (!is_null($this->data)) return $this->data; global $gstrOrderBy, $conn; $strWhereClause = ''; $strHavingClause = ''; if(!$this->all) { $strWhereClause = KeyWhere($this->keys); if($this->pSet->getAdvancedSecurityType()!=ADVSECURITY_ALL) $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search")); $strSQL = $this->gQuery->gSQLWhere($strWhereClause); } else { if ($_SESSION[$this->tName."_SelectedSQL"]!="" && @$_REQUEST["records"]=="") { $strSQL = $_SESSION[$this->tName."_SelectedSQL"]; $strWhereClause=@$_SESSION[$this->tName."_SelectedWhere"]; } else { $strWhereClause = @$_SESSION[$this->tName."_where"]; $strHavingClause = @$_SESSION[$this->tName."_having"]; $strSearchCriteria = @$_SESSION[$this->tName."_criteria"]; $joinFromPart = @$_SESSION[$this->tName."_joinFromPart"]; if($this->pSet->getAdvancedSecurityType()==ADVSECURITY_VIEW_OWN && $strWhereClause=="") $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search")); //$strSQL = $this->gQuery->gSQLWhere($strWhereClause, $strHavingClause, $strSearchCriteria); $strSQL = SQLQuery::gSQLWhere_having($this->gQuery->HeadToSql(), $this->gQuery->FromToSql().$joinFromPart, $this->gQuery->WhereToSql(), $this->gQuery->GroupByToSql(), $this->gQuery->Having()->toSql($this->gQuery), $strWhereClause, $strHavingClause, $strSearchCriteria); } // order by $strOrderBy = $_SESSION[$this->tName."_order"]; if(!$strOrderBy) $strOrderBy = $gstrOrderBy; $strSQL.=" ".trim($strOrderBy); } $strSQLbak = $strSQL; if($this->eventsObject->exists("BeforeQueryView")) $this->eventsObject->BeforeQueryView($strSQL, $strWhereClause, $this); if($strSQLbak == $strSQL) { //$strSQL = $this->gQuery->gSQLWhere($strWhereClause, $strHavingClause); $strSQL = SQLQuery::gSQLWhere_having($this->gQuery->HeadToSql(), $this->gQuery->FromToSql().$joinFromPart, $this->gQuery->WhereToSql(), $this->gQuery->GroupByToSql(), $this->gQuery->Having()->toSql($this->gQuery), $strWhereClause, $strHavingClause, $strSearchCriteria); if($this->all) { $numrows = $this->gQuery->gSQLRowCount($strWhereClause, $strHavingClause, $strSearchCriteria); $strSQL.=" ".trim($strOrderBy); } } else { // changed $strSQL - old style if($this->all) $numrows = GetRowCount($strSQL); } if(!$this->all) { LogInfo($strSQL); $rs = db_query($strSQL, $conn); } else { // Pagination: $nPageSize = 0; if(@$_REQUEST["records"]=="page" && $numrows) { $mypage = (integer)@$_SESSION[$this->tName."_pagenumber"]; $nPageSize = (integer)@$_SESSION[$this->tName."_pagesize"]; if($numrows <= ($mypage-1)*$nPageSize) $mypage = ceil($numrows/$nPageSize); if(!$nPageSize) $nPageSize = $gPageSize; if(!$mypage) $mypage = 1; $strSQL.=" limit ".(($mypage-1)*$nPageSize).",".$nPageSize; } $rs = db_query($strSQL,$conn); } $this->data = $this->cipherer->DecryptFetchedArray($rs); if(sizeof($this->data) && $this->eventsObject->exists("ProcessValuesView")) $this->eventsObject->ProcessValuesView($this->data, $this); return $this->data; }
function SecuritySQL($strAction, $table = "") { global $strTableName; if (!strlen($table)) { $table = $strTableName; } $strPerm = GetUserPermissions($table); $strPerm = !strlen($strPerm) ? "S" : $strPerm; return SecuritySQL($strAction, $table, $strPerm); }
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; }
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; }
/** * update record on Edit page * @intellisense */ function DoUpdateRecordSQL($pageObject) { $table = $pageObject->pSet->getOriginalTableName(); $strWhereClause = $pageObject->getWhereClause(true); $evalues = $pageObject->getNewRecordData(); $blobfields = $pageObject->getBlobFields(); if (!count($evalues)) { return true; } $strSQL = "update " . $pageObject->connection->addTableWrappers($table) . " set "; $blobs = PrepareBlobs($evalues, $blobfields, $pageObject); // construct SQL string foreach ($evalues as $ekey => $value) { if (in_array($ekey, $blobfields)) { $strValue = $value; } else { if (is_null($pageObject->cipherer)) { $strValue = add_db_quotes($ekey, $value); } else { $strValue = $pageObject->cipherer->AddDBQuotes($ekey, $value); } } $strSQL .= $pageObject->getTableField($ekey) . "=" . $strValue . ", "; } $strSQL = substr($strSQL, 0, strlen($strSQL) - 2); if ($strWhereClause === "") { $strWhereClause = " (1=1) "; } $strSQL .= " where " . $strWhereClause; if (SecuritySQL("Edit", $pageObject->tName)) { $strSQL .= " and (" . SecuritySQL("Edit", $pageObject->tName) . ")"; } if (!ExecuteUpdate($pageObject, $strSQL, $blobs)) { return false; } return true; }
/** * A wrapper for the SecuritySQL function * @param String strAction * @paran String table * @return String */ function SecuritySQL($strAction, $table = "") { return SecuritySQL($strAction, $table); }
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; }
return; } if (!$gQuery->HasGroupBy()) { // Do not select any fields except current (full text) field. // If query has 'group by' clause then other fields are used in it and we may not simply cut 'em off. // Just don't do anything in that case. $gQuery->RemoveAllFieldsExcept($pSet->getFieldIndex($field)); } $keysArr = $pSet->getTableKeys(); $keys = array(); foreach ($keysArr as $ind => $k) { $keys[$k] = postvalue("key" . ($ind + 1)); } $where = KeyWhere($keys); if ($pSet->getAdvancedSecurityType() == ADVSECURITY_VIEW_OWN) { $where = whereAdd($where, SecuritySQL("Search", $strTableName)); } $sql = $gQuery->gSQLWhere($where); $qResult = $_connection->query($sql); if (!$qResult || !($data = $cipherer->DecryptFetchedArray($qResult->fetchAssoc()))) { $returnJSON = array("success" => false, "error" => 'Error: Wrong SQL query'); echo printJSON($returnJSON); return; } $fieldValue = $data[$field]; $sessionPrefix = $pSet->getOriginalTableName(); if ($mode == LIST_DASHBOARD) { //set the session prefix for the dashboard list page $sessionPrefix = "Dashboard_" . $pSet->getOriginalTableName(); } if ($lookup) {
/** * 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, ""); }
/** * Set the defvalues property */ protected function prepareDefvalues() { if ((array_key_exists("copyid1", $_REQUEST) || array_key_exists("editid1", $_REQUEST)) && $this->mode != ADD_DASHBOARD) { // copy record $copykeys = array(); $keyFields = $this->pSet->getTableKeys(); $prefix = array_key_exists("copyid1", $_REQUEST) ? "copyid" : "editid"; foreach ($keyFields as $idx => $k) { $copykeys[$k] = postvalue($prefix . ($idx + 1)); } $strWhere = KeyWhere($copykeys); if ($this->pSet->getAdvancedSecurityType() != ADVSECURITY_ALL) { $strWhere = whereAdd($strWhere, SecuritySQL("Search", $this->tName)); } $strSQL = $this->gQuery->gSQLWhere($strWhere); $this->defvalues = $this->cipherer->DecryptFetchedArray($this->connection->query($strSQL)->fetchAssoc()); if (!$this->defvalues) { $this->defvalues = array(); } // clear key fields foreach ($keyFields as $idx => $k) { $this->defvalues[$k] = ""; } foreach ($this->addFields as $f) { if ($this->pSet->getEditFormat($f) == EDIT_FORMAT_FILE) { //#10023 $this->defvalues[$f] = $this->getControl($f, $this->id)->getFieldValueCopy($this->defvalues[$f]); } } // call CopyOnLoad event if ($this->eventsObject->exists("CopyOnLoad")) { $this->eventsObject->CopyOnLoad($this->defvalues, $strWhere, $this); } } else { foreach ($this->addFields as $f) { $defaultValue = GetDefaultValue($f, PAGE_ADD); if (strlen($defaultValue)) { $this->defvalues[$f] = $defaultValue; } } } $securityType = $this->pSet->getAdvancedSecurityType(); if (!$this->isAdminTable() && ($securityType == ADVSECURITY_EDIT_OWN || $securityType == ADVSECURITY_VIEW_OWN)) { $tableOwnerIdField = $this->pSet->getTableOwnerIdField(); // insert default owner id value if exists if ($this->checkIfToAddOwnerIdValue($tableOwnerIdField, '')) { $this->defvalues[$tableOwnerIdField] = prepare_for_db($tableOwnerIdField, $_SESSION["_" . $this->tName . "_OwnerID"]); } } $masterTables = $this->pSet->getMasterTablesArr($this->tName); // set default values for the foreign keys foreach ($masterTables as $mTableData) { if (@$_SESSION[$this->sessionPrefix . "_mastertable"] == $mTableData["mDataSourceTable"]) { foreach ($mTableData["detailKeys"] as $idx => $dk) { $masterkeyIdx = "masterkey" . ($idx + 1); if (postvalue($masterkeyIdx)) { $_SESSION[$this->sessionPrefix . "_" . $masterkeyIdx] = postvalue($masterkeyIdx); } if ($this->masterPageType != PAGE_ADD) { $this->defvalues[$dk] = @$_SESSION[$this->sessionPrefix . "_" . $masterkeyIdx]; } } } } $lookupMainSettings = getLookupMainTableSettings($this->tName, $this->mainTable, $this->mainField); if ($lookupMainSettings) { if ($lookupMainSettings->useCategory($this->mainField) && !isset($this->newRecordData[$lookupMainSettings->getCategoryFilter($this->mainField)])) { $this->defvalues[$lookupMainSettings->getCategoryFilter($this->mainField)] = $this->category; } } if ($this->readAddValues) { foreach ($this->addFields as $fName) { $editFormat = $this->pSet->getEditFormat($fName); if ($editFormat != EDIT_FORMAT_DATABASE_FILE && $editFormat != EDIT_FORMAT_DATABASE_IMAGE && $editFormat != EDIT_FORMAT_FILE) { $this->defvalues[$fName] = @$this->newRecordData[$fName]; } } } }
function Chart(&$ch_array, $param) { global $field_labels; if ($this->webchart) { $this->chrt_array = Convert_Old_Chart($ch_array); } else { $this->chrt_array = $ch_array; } $this->setConnection(); $this->pSet = new ProjectSettings($this->chrt_array['tables'][0]); $this->showDetails = $param['showDetails']; if ($this->showDetails) { $this->detailTablesData = $this->pSet->getDetailTablesArr(); } $this->hasFlash = $param["hasFlash"]; $this->pageId = $param["pageId"]; $this->chrt_array["appearance"]["autoupdate"] = false; $this->numRecordsToShow = $this->chrt_array['appearance']['maxbarscroll']; if ($this->numRecordsToShow < 1) { $this->numRecordsToShow = 1; } $this->table_type = $this->chrt_array["table_type"]; if (!$this->table_type) { $this->table_type = "project"; } $this->webchart = $param["webchart"]; $this->cname = $param["cname"]; $this->chartPreview = $param["chartPreview"]; $this->dashChart = $param["dashChart"]; $this->sessionPrefix = $this->chrt_array['tables'][0]; if ($this->dashChart) { $this->dashTName = $param["dashTName"]; $this->dashElementName = $param["dashElementName"]; $this->sessionPrefix = $this->dashTName . "_" . $this->sessionPrefix; } $this->gstrOrderBy = $param["gstrOrderBy"]; $TableName = GoodFieldName($this->chrt_array['tables'][0]); // #10461, $this->setConnection(); needs to be called after value is assigned to $this->webchart $this->setConnection(); if ($this->isProjectDB()) { $this->cipherer = new RunnerCipherer($this->chrt_array['tables'][0]); } $this->header = $this->chrt_array['appearance']['head']; $this->footer = $this->chrt_array['appearance']['foot']; $this->y_axis_label = $this->chrt_array['appearance']['y_axis_label']; for ($i = 0; $i < count($this->chrt_array['parameters']) - 1; $i++) { if (isset($this->chrt_array['parameters'][$i]['currencyFormat'])) { $this->arrFormatCurrency[] = $this->chrt_array['parameters'][$i]['currencyFormat']; } else { if ($this->chrt_array['appearance']['scur'] == "false") { $this->arrFormatCurrency[] = ""; } else { $this->arrFormatCurrency[] = $this->chrt_array['appearance']['scur']; } } if (isset($this->chrt_array['parameters'][$i]['decimalFormat'])) { $this->arrFormatDecimal[] = $this->chrt_array['parameters'][$i]['decimalFormat']; } else { $this->arrFormatDecimal[] = $this->chrt_array['appearance']['dec']; } $this->arrFormatCustomer[] = $this->chrt_array['parameters'][$i]['customFormat']; $this->arrFormatCustomerStr[] = $this->chrt_array['parameters'][$i]['customFormatStr']; if ($this->chrt_array["chart_type"]["type"] == "ohlc" || $this->chrt_array["chart_type"]["type"] == "candlestick") { $this->arrOHLC_color[] = "#" . $this->chrt_array['parameters'][$i]['ohlcColor']; if ($this->table_type != "db") { $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['ohlcOpen']; $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['ohlcHigh']; $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['ohlcLow']; $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['ohlcClose']; } else { if ($this->chrt_array['parameters'][$i]['agr_func']) { $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcOpen']; $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcHigh']; $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcLow']; $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcClose']; } else { $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcOpen']; $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcHigh']; $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcLow']; $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['ohlcClose']; } } if ($this->chrt_array["chart_type"]["type"] == "candlestick") { $this->arrOHLC_candle[] = "#" . $this->chrt_array['parameters'][$i]['ohlcCandleColor']; } } elseif ($this->chrt_array['parameters'][$i]['name'] != "") { if ($this->table_type != "db") { $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['label'] : $this->chrt_array['parameters'][$i]['name']; if ($this->chrt_array["chart_type"]["type"] == "bubble") { $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['size']; } } else { $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['agr_func'] . "_" . $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name'] : $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['name']; if ($this->chrt_array["chart_type"]["type"] == "bubble") { $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['table'] . "_" . $this->chrt_array['parameters'][$i]['size']; } } if (isset($this->chrt_array['appearance']['scolor' . ($i + 1) . '1'])) { $this->arrDataColor[] = $this->chrt_array['appearance']['scolor' . ($i + 1) . '1']; } else { $this->arrDataColor[] = $this->chrt_array['parameters'][$i]['series_color']; } if ($this->chrt_array["chart_type"]["type"] == "gauge") { for ($k = 0; is_array($this->chrt_array["parameters"][$i]["gaugeColorZone"]) && $k < count($this->chrt_array["parameters"][$i]["gaugeColorZone"]); $k++) { $beginColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeBeginColor"]; $endColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeEndColor"]; $gColor = "#" . @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeColor"]; $this->arrGaugeColor[count($this->arrDataSeries) - 1][] = array($beginColor, $endColor, $gColor); } } } if ($this->table_type == "project" && !$this->webchart) { if ($this->chrt_array["chart_type"]["type"] != "candlestick" && $this->chrt_array["chart_type"]["type"] != "ohlc") { $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['name']))); } else { $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['ohlcOpen']))); } } else { if (!$this->chart_xmlencode($this->chrt_array['parameters'][$i]['label'])) { if ($this->chrt_array["chart_type"]["type"] != "candlestick" && $this->chrt_array["chart_type"]["type"] != "ohlc") { $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['name']); } else { $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['ohlcOpen']); } } else { $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['label']); } } } if ($this->chrt_array["chart_type"]["type"] != "gauge") { if ($this->table_type != "db") { $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']; } else { $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['agr_func'] ? $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['agr_func'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] : $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['table'] . "_" . $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']; } for ($j = 0; $j < count($this->chrt_array['fields']); $j++) { if ($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] == $this->chrt_array['fields'][$j]['name']) { if ($this->table_type == "project") { $this->label2 = $this->chart_xmlencode(GetFieldLabel($TableName, GoodFieldName($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']))); } else { $this->label2 = $this->chart_xmlencode($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']); } } } } if ($this->chrt_array["chart_type"]["type"] != "ohlc" && $this->chrt_array["chart_type"]["type"] != "candlestick") { foreach ($this->arrDataColor as $ind => $val) { if ($ind == 0) { $this->arrAxesColor = "#000000"; } else { $this->arrAxesColor = "#" . $this->arrDataColor[$ind]; } } } else { foreach ($this->arrOHLC_color as $ind => $val) { if ($ind == 0) { $this->arrAxesColor = "#000000"; } else { $this->arrAxesColor = "#" . $this->arrOHLC_color[$ind]; } } } // prepare search params $gQuery = $this->pSet->getSQLQuery(); $masterWhere = ""; if (!$this->dashChart) { $masterTable = $_SESSION[$this->sessionPrefix . "_mastertable"]; $detailKeysByM = $this->pSet->getDetailKeysByMasterTable($masterTable); if (count($detailKeysByM)) { for ($i = 0; $i < count($detailKeysByM); $i++) { if ($i != 0) { $masterWhere .= " and "; } if ($this->cipherer && isEncryptionByPHPEnabled()) { $mValue = $this->cipherer->MakeDBValue($detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]); } else { $mValue = make_db_value($detailKeysByM[$i], $_SESSION[$this->sessionPrefix . "_masterkey" . ($i + 1)]); } if (strlen($mValue) != 0) { $masterWhere .= RunnerPage::_getFieldSQLDecrypt($detailKeysByM[$i], $this->connection, $this->pSet, $this->cipherer) . "=" . $mValue; } else { $masterWhere .= "1=0"; } } } } $strWhereClause = ""; $searchHavingClause = ""; $strSearchCriteria = "and"; global $strTableName; // search where for basic charts if (!$this->webchart) { if (!$this->chartPreview && isset($_SESSION[$this->sessionPrefix . '_advsearch'])) { $searchClauseObj = SearchClause::UnserializeObject($_SESSION[$this->sessionPrefix . '_advsearch']); include_once getabspath('classes/controls/EditControlsContainer.php'); $editControls = new EditControlsContainer(null, $this->pSet, PAGE_SEARCH, $this->cipherer); $whereComponents = RunnerPage::sGetWhereComponents($gQuery, $this->pSet, $searchClauseObj, $editControls, $this->connection); $strWhereClause = $whereComponents["searchWhere"]; foreach ($whereComponents["filterWhere"] as $fWhere) { $strWhereClause = whereAdd($strWhereClause, $fWhere); } $searchHavingClause = $whereComponents["searchHaving"]; foreach ($whereComponents["filterHaving"] as $fHaving) { $searchHavingClause = whereAdd($searchHavingClause, $fHaving); } $strSearchCriteria = $whereComponents["searchUnionRequired"] ? "or" : "and"; } } else { if ($this->table_type != "project") { $strTableName = "webchart" . $this->cname; } $strWhereClause = CalcSearchParam($this->table_type != "project"); } if ($strWhereClause) { $this->chrt_array['where'] .= $this->chrt_array['where'] ? " AND (" . $strWhereClause . ")" : " WHERE (" . $strWhereClause . ")"; } if ($this->table_type == "project") { if (SecuritySQL("Search", $this->chrt_array['tables'][0])) { $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search", $strTableName)); } $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria); $strOrderBy = $this->gstrOrderBy; $this->strSQL .= " " . $strOrderBy; if ($masterWhere) { $strWhereClause = whereAdd($strWhereClause, $masterWhere); } $strSQLbak = $this->strSQL; if (tableEventExists("BeforeQueryChart", $strTableName)) { $tstrSQL = $this->strSQL; $eventObj = getEventObject($strTableName); $eventObj->BeforeQueryChart($tstrSQL, $strWhereClause, $strOrderBy); $this->strSQL = $tstrSQL; } if ($strSQLbak == $this->strSQL) { $this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria); $this->strSQL .= " " . $strOrderBy; } } if ($this->cname && $this->table_type == "db") { $this->strSQL = $this->chrt_array['sql'] . $this->chrt_array['where'] . $this->chrt_array['group_by'] . $this->chrt_array['order_by']; } elseif ($this->cname && $this->table_type == "custom") { if (!IsStoredProcedure($this->chrt_array['sql'])) { $sql_query = $this->chrt_array['sql']; if ($this->connection->dbType == nDATABASE_MSSQLServer) { $pos = strrpos(strtoupper($sql_query), "ORDER BY"); if ($pos) { $sql_query = substr($sql_query, 0, $pos); } } if ($this->connection->dbType != nDATABASE_Oracle) { $this->strSQL = "select * from (" . $sql_query . ") as " . $this->connection->addFieldWrappers("custom_query") . $this->chrt_array['where']; } else { $this->strSQL = "select * from (" . $sql_query . ")" . $this->chrt_array['where']; } } else { $this->strSQL = $this->chrt_array['sql']; } } if (tableEventExists("UpdateChartSettings", $strTableName)) { $eventObj = getEventObject($strTableName); $eventObj->UpdateChartSettings($this); } }
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; }
/** * Read current values from the database * @return Array The current record data */ public function getCurrentRecordInternal() { if (!is_null($this->data)) { return $this->data; } $strWhereClause = ""; $orderClause = ""; $keysSet = $this->checkKeysSet(); if ($keysSet) { $strWhereClause = KeyWhere($this->keys); } elseif ($this->mode == VIEW_DASHBOARD) { $whereComponents = $this->getWhereComponents(); $strWhereClause = $whereComponents["searchWhere"]; } else { $orderClause = $this->getOrderByClause(); $strWhereClause = $_SESSION[$this->sessionPrefix . "_where"]; } if ($this->pSet->getAdvancedSecurityType() != ADVSECURITY_ALL) { $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search", $this->tName)); } $strSQL = $this->gQuery->gSQLWhere($strWhereClause); if (!$keysSet) { $strSQL = applyDBrecordLimit($strSQL . $orderClause, 1, $this->connection->dbType); } $strSQLbak = $strSQL; $strWhereClauseBak = $strWhereClause; if ($this->eventsObject->exists("BeforeQueryView")) { $this->eventsObject->BeforeQueryView($strSQL, $strWhereClause, $this); } if ($strSQLbak == $strSQL && $strWhereClauseBak != $strWhereClause) { // user didn't change the query string but changed $strWhereClause $strSQL = $this->gQuery->gSQLWhere($strWhereClause); if (!$keysSet) { $strSQL = applyDBrecordLimit($strSQL . $orderClause, 1, $this->connection->dbType); } } LogInfo($strSQL); $fetchedArray = $this->connection->query($strSQL)->fetchAssoc(); $this->data = $this->cipherer->DecryptFetchedArray($fetchedArray); if (!$keysSet) { $this->keys = $this->getKeysFromData($this->data); $this->setKeysForJs(); } if (sizeof($this->data) && $this->eventsObject->exists("ProcessValuesView")) { $this->eventsObject->ProcessValuesView($this->data, $this); } return $this->data; }
} else { $strSQL = $gQuery->gSQLWhere($strWhereClause); // order by $strSQL.=" " . trim($strOrderBy); } $xt->assign("userid", runner_htmlspecialchars($_SESSION["UserID"])); $xt->assign("guest", $_SESSION["AccessLevel"] == ACCESS_LEVEL_GUEST); // save SQL for use in "Export" and "Printer-friendly" pages if (!is_wr_project()) { $_SESSION[$sessPrefix . "_sql"] = $rpt_array['sql']; $_SESSION[$sessPrefix . "_where"] = $rpt_array['where']; $_SESSION[$sessPrefix . "_order"] = $rpt_array['order_by']; } else { $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search")); $_SESSION[$sessPrefix . "_sql"] = $strSQL; $_SESSION[$sessPrefix . "_where"] = $strWhereClause; $_SESSION[$sessPrefix . "_order"] = $strOrderBy; } // select all records $strSQLbak = $strSQL; if (is_wr_db()) { $strSQL = $rpt_array['sql'] . $rpt_array['where'] . $rpt_array['order_by']; } elseif (is_wr_project()) { $strSQL = $gQuery->gSQLWhere($strWhereClause); $strSQL .= " " . trim($strOrderBy); } elseif (is_wr_custom()) {
function DoUpdateRecordSQL($table, &$evalues, &$blobfields, $strWhereClause, $pageid, &$pageObject, &$cipherer) { global $error_happened, $conn, $inlineedit, $usermessage, $message; if (!count($evalues)) { return true; } $strSQL = "update " . AddTableWrappers($table) . " set "; $blobs = PrepareBlobs($evalues, $blobfields); // construct SQL string foreach ($evalues as $ekey => $value) { if (in_array($ekey, $blobfields)) { $strValues = $value; } else { if (is_null($cipherer)) { $strValues = add_db_quotes($ekey, $value); } else { $strValues = $cipherer->AddDBQuotes($ekey, $value); } } $strSQL .= $pageObject->pSet->getTableField($ekey) . "=" . $strValues . ", "; } if (substr($strSQL, -2) == ", ") { $strSQL = substr($strSQL, 0, strlen($strSQL) - 2); } if ($strWhereClause === "") { $strWhereClause = " (1=1) "; } $strSQL .= " where " . $strWhereClause; if (SecuritySQL("Edit")) { $strSQL .= " and (" . SecuritySQL("Edit") . ")"; } if (!ExecuteUpdate($pageObject, $strSQL, $blobs, false)) { return false; } // delete & move files $pageObject->ProcessFiles(); if ($inlineedit) { $status = "UPDATED"; $message = "" . "Record updated" . ""; $IsSaved = true; } else { $message = "<<< " . "Record updated" . " >>>"; } if ($usermessage != "") { $message = $usermessage; } return true; }
function SecuritySQL($strAction, $table = "") { global $strTableName; if (!strlen($table)) { $table = $strTableName; } $strPerm = GetUserPermissions($table); if (strpos($strPerm, "S") === false) { $strPerm .= "S"; } return SecuritySQL($strAction, $table, $strPerm); }
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_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; }
/** * Get the basic SQL query for a crosstable report * @return String */ protected function getBasicCrossTableSQL() { $_gQuery = $this->pSet->getSQLQuery(); $whereComponents = $this->getWhereComponents(); $gsqlWhereExpr = $this->getnoRecOnFirstPageWhereCondition(); $gsqlWhereExpr = combineSQLCriteria(array($gsqlWhereExpr, SecuritySQL("Search", $this->tName), $this->getFiltersWhere(), $whereComponents["commonWhere"])); $searchHavingClause = combineSQLCriteria(array($whereComponents["searchHaving"], $this->getFiltersHaving())); return $_gQuery->gSQLWhere_having_fromQuery($gsqlWhereExpr, $whereComponents["searchWhere"], $searchHavingClause, $this->searchClauseObj->getCriteriaCombineType()); }
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; }
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; }
function DisplayMasterTableInfo_GE_ESTADO_CIVIL($params) { global $cman; $detailtable = $params["detailtable"]; $keys = $params["keys"]; $xt = new Xtempl(); $tName = "GE.ESTADO_CIVIL"; $settings = new ProjectSettings($tName, PAGE_LIST); $cipherer = new RunnerCipherer($tName); $connection = $cman->byTable($tName); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_LIST); $where = ""; $keysAssoc = array(); $showKeys = ""; if ($detailtable == "GE.PERSONA_DISPONIBLE") { $keysAssoc["ESTADO_CIVIL_ID"] = $keys[1 - 1]; $where .= RunnerPage::_getFieldSQLDecrypt("ESTADO_CIVIL_ID", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("ESTADO_CIVIL_ID", $keys[1 - 1], "", true); $keyValue = $viewControls->showDBValue("ESTADO_CIVIL_ID", $keysAssoc); $showKeys .= " " . GetFieldLabel("GE_ESTADO_CIVIL", "ESTADO_CIVIL_ID") . ": " . $keyValue; $xt->assign('showKeys', $showKeys); } if (!$where) { 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(); LogInfo($strSQL); $data = $cipherer->DecryptFetchedArray($connection->query($strSQL)->fetchAssoc()); if (!$data) { return; } // reassign pagetitlelabel function adding extra params $xt->assign_function("pagetitlelabel", "xt_pagetitlelabel", array("record" => $data, "settings" => $settings)); $keylink = ""; $keylink .= "&key1=" . runner_htmlspecialchars(rawurlencode(@$data["ESTADO_CIVIL_ID"])); $xt->assign("ESTADO_CIVIL_ID_mastervalue", $viewControls->showDBValue("ESTADO_CIVIL_ID", $data, $keylink)); $format = $settings->getViewFormat("ESTADO_CIVIL_ID"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("ESTADO_CIVIL_ID"))) { $class = ' rnr-field-number'; } $xt->assign("ESTADO_CIVIL_ID_class", $class); // add class for field header as field value $xt->assign("NOMBRE_mastervalue", $viewControls->showDBValue("NOMBRE", $data, $keylink)); $format = $settings->getViewFormat("NOMBRE"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("NOMBRE"))) { $class = ' rnr-field-number'; } $xt->assign("NOMBRE_class", $class); // add class for field header as field value $xt->assign("FEC_CREACION_mastervalue", $viewControls->showDBValue("FEC_CREACION", $data, $keylink)); $format = $settings->getViewFormat("FEC_CREACION"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("FEC_CREACION"))) { $class = ' rnr-field-number'; } $xt->assign("FEC_CREACION_class", $class); // add class for field header as field value $xt->assign("USUARIO_CREACION_mastervalue", $viewControls->showDBValue("USUARIO_CREACION", $data, $keylink)); $format = $settings->getViewFormat("USUARIO_CREACION"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("USUARIO_CREACION"))) { $class = ' rnr-field-number'; } $xt->assign("USUARIO_CREACION_class", $class); // add class for field header as field value $xt->assign("FEC_ULTIMA_MOD_mastervalue", $viewControls->showDBValue("FEC_ULTIMA_MOD", $data, $keylink)); $format = $settings->getViewFormat("FEC_ULTIMA_MOD"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("FEC_ULTIMA_MOD"))) { $class = ' rnr-field-number'; } $xt->assign("FEC_ULTIMA_MOD_class", $class); // add class for field header as field value $xt->assign("USUARIO_ULTIMA_MOD_mastervalue", $viewControls->showDBValue("USUARIO_ULTIMA_MOD", $data, $keylink)); $format = $settings->getViewFormat("USUARIO_ULTIMA_MOD"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("USUARIO_ULTIMA_MOD"))) { $class = ' rnr-field-number'; } $xt->assign("USUARIO_ULTIMA_MOD_class", $class); // add class for field header as field value $layout = GetPageLayout("GE_ESTADO_CIVIL", 'masterlist'); if ($layout) { $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"'); } $xt->displayPartial(GetTemplateName("GE_ESTADO_CIVIL", "masterlist")); }
/** * Adds sub query for counting details recs number * */ function addMasterDetailSubQuery() { // add count of child records to SQL if ($this->subQueriesSupp && $this->subQueriesSupAccess && !$this->theSameFieldsType) { for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) { if ($this->allDetailsTablesArr[$i]['dispChildCount'] || $this->allDetailsTablesArr[$i]['hideChild']) { $origTName = $this->allDetailsTablesArr[$i]['dOriginalTable']; $dataSourceTName = $this->allDetailsTablesArr[$i]['dDataSourceTable']; $shortTName = $this->allDetailsTablesArr[$i]['dShortTable']; $detailsSettings = $this->pSet->getTable($dataSourceTName); $detailsQuery = $detailsSettings->getSQLQuery(); $detailsSqlWhere = $detailsQuery->WhereToSql(); $masterWhere = ""; foreach ($this->masterKeysByD[$i] as $idx => $val) { if ($masterWhere) { $masterWhere .= " and "; } $masterWhere .= $this->cipherer->GetFieldName(AddTableWrappers("subQuery_cnt") . "." . AddFieldWrappers($this->detailKeysByD[$i][$idx]), $this->masterKeysByD[$i][$idx]) . "=" . $this->cipherer->GetFieldName(AddTableWrappers($this->origTName) . "." . AddFieldWrappers($this->masterKeysByD[$i][$idx]), $this->masterKeysByD[$i][$idx]); } // add a key field to the select list $subQ = ""; foreach ($this->detailKeysByD[$i] as $k) { if (strlen($subQ)) { $subQ .= ","; } $subQ .= GetFullFieldNameForInsert($this->pSet, $k); } $subQ = "SELECT " . $subQ . " " . $detailsQuery->FromToSql(); // add security where clause for sub query $securityClause = SecuritySQL("Search", $dataSourceTName); if (strlen($securityClause)) { $subQ .= " WHERE " . whereAdd($detailsSqlWhere, $securityClause); } elseif (strlen($detailsSqlWhere)) { $subQ .= " WHERE " . whereAdd("", $detailsSqlWhere); } // add detail table query tail $subQ .= " " . $detailsQuery->TailToSql(); $countsql = "SELECT count(*) FROM (" . $subQ . ") " . AddTableWrappers("subQuery_cnt") . " WHERE " . $masterWhere; $this->gsqlHead .= ",(" . $countsql . ") as " . AddFieldWrappers($dataSourceTName . "_cnt") . " "; } } } }
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; } if ($rowcount > $display_count + 2) {
function DisplayMasterTableInfoForPrint_calendar_table($params) { global $cman; $detailtable = $params["detailtable"]; $keys = $params["keys"]; $xt = new Xtempl(); $tName = "calendar_table"; $xt->eventsObject = getEventObject($tName); $cipherer = new RunnerCipherer($tName); $settings = new ProjectSettings($tName, PAGE_PRINT); $connection = $cman->byTable($tName); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_PRINT); $where = ""; $keysAssoc = array(); $showKeys = ""; if ($detailtable == "Fact_SalesTransaction") { $keysAssoc["dt"] = $keys[1 - 1]; $where .= RunnerPage::_getFieldSQLDecrypt("dt", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("dt", $keys[1 - 1], "", true); $keyValue = $viewControls->showDBValue("dt", $keysAssoc); $showKeys .= " " . GetFieldLabel("calendar_table", "dt") . ": " . $keyValue; $xt->assign('showKeys', $showKeys); } if ($detailtable == "Current Year Sales") { $keysAssoc["dt"] = $keys[1 - 1]; $where .= RunnerPage::_getFieldSQLDecrypt("dt", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("dt", $keys[1 - 1], "", true); $keyValue = $viewControls->showDBValue("dt", $keysAssoc); $showKeys .= " " . GetFieldLabel("calendar_table", "dt") . ": " . $keyValue; $xt->assign('showKeys', $showKeys); } if (!$where) { return; } $str = SecuritySQL("Export", $tName); 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(); LogInfo($strSQL); $data = $cipherer->DecryptFetchedArray($connection->query($strSQL)->fetchAssoc()); if (!$data) { return; } // reassign pagetitlelabel function adding extra params $xt->assign_function("pagetitlelabel", "xt_pagetitlelabel", array("record" => $data, "settings" => $settings)); $keylink = ""; $keylink .= "&key1=" . runner_htmlspecialchars(rawurlencode(@$data["dt"])); $xt->assign("dt_mastervalue", $viewControls->showDBValue("dt", $data, $keylink)); $format = $settings->getViewFormat("dt"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("dt"))) { $class = ' rnr-field-number'; } $xt->assign("dt_class", $class); // add class for field header as field value $xt->assign("y_mastervalue", $viewControls->showDBValue("y", $data, $keylink)); $format = $settings->getViewFormat("y"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("y"))) { $class = ' rnr-field-number'; } $xt->assign("y_class", $class); // add class for field header as field value $xt->assign("q_mastervalue", $viewControls->showDBValue("q", $data, $keylink)); $format = $settings->getViewFormat("q"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("q"))) { $class = ' rnr-field-number'; } $xt->assign("q_class", $class); // add class for field header as field value $xt->assign("m_mastervalue", $viewControls->showDBValue("m", $data, $keylink)); $format = $settings->getViewFormat("m"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("m"))) { $class = ' rnr-field-number'; } $xt->assign("m_class", $class); // add class for field header as field value $xt->assign("d_mastervalue", $viewControls->showDBValue("d", $data, $keylink)); $format = $settings->getViewFormat("d"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("d"))) { $class = ' rnr-field-number'; } $xt->assign("d_class", $class); // add class for field header as field value $xt->assign("dw_mastervalue", $viewControls->showDBValue("dw", $data, $keylink)); $format = $settings->getViewFormat("dw"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("dw"))) { $class = ' rnr-field-number'; } $xt->assign("dw_class", $class); // add class for field header as field value $xt->assign("monthName_mastervalue", $viewControls->showDBValue("monthName", $data, $keylink)); $format = $settings->getViewFormat("monthName"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("monthName"))) { $class = ' rnr-field-number'; } $xt->assign("monthName_class", $class); // add class for field header as field value $xt->assign("dayName_mastervalue", $viewControls->showDBValue("dayName", $data, $keylink)); $format = $settings->getViewFormat("dayName"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("dayName"))) { $class = ' rnr-field-number'; } $xt->assign("dayName_class", $class); // add class for field header as field value $xt->assign("w_mastervalue", $viewControls->showDBValue("w", $data, $keylink)); $format = $settings->getViewFormat("w"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("w"))) { $class = ' rnr-field-number'; } $xt->assign("w_class", $class); // add class for field header as field value $xt->assign("isWeekday_mastervalue", $viewControls->showDBValue("isWeekday", $data, $keylink)); $format = $settings->getViewFormat("isWeekday"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("isWeekday"))) { $class = ' rnr-field-number'; } $xt->assign("isWeekday_class", $class); // add class for field header as field value $xt->assign("isHoliday_mastervalue", $viewControls->showDBValue("isHoliday", $data, $keylink)); $format = $settings->getViewFormat("isHoliday"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("isHoliday"))) { $class = ' rnr-field-number'; } $xt->assign("isHoliday_class", $class); // add class for field header as field value $xt->assign("holidayDescr_mastervalue", $viewControls->showDBValue("holidayDescr", $data, $keylink)); $format = $settings->getViewFormat("holidayDescr"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("holidayDescr"))) { $class = ' rnr-field-number'; } $xt->assign("holidayDescr_class", $class); // add class for field header as field value $xt->assign("isPayday_mastervalue", $viewControls->showDBValue("isPayday", $data, $keylink)); $format = $settings->getViewFormat("isPayday"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("isPayday"))) { $class = ' rnr-field-number'; } $xt->assign("isPayday_class", $class); // add class for field header as field value $xt->assign("yearQuarterText_mastervalue", $viewControls->showDBValue("yearQuarterText", $data, $keylink)); $format = $settings->getViewFormat("yearQuarterText"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("yearQuarterText"))) { $class = ' rnr-field-number'; } $xt->assign("yearQuarterText_class", $class); // add class for field header as field value $xt->assign("yearMonthInt_mastervalue", $viewControls->showDBValue("yearMonthInt", $data, $keylink)); $format = $settings->getViewFormat("yearMonthInt"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("yearMonthInt"))) { $class = ' rnr-field-number'; } $xt->assign("yearMonthInt_class", $class); // add class for field header as field value $xt->assign("yearMonthText_mastervalue", $viewControls->showDBValue("yearMonthText", $data, $keylink)); $format = $settings->getViewFormat("yearMonthText"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("yearMonthText"))) { $class = ' rnr-field-number'; } $xt->assign("yearMonthText_class", $class); // add class for field header as field value $xt->assign("yearWeekInt_mastervalue", $viewControls->showDBValue("yearWeekInt", $data, $keylink)); $format = $settings->getViewFormat("yearWeekInt"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("yearWeekInt"))) { $class = ' rnr-field-number'; } $xt->assign("yearWeekInt_class", $class); // add class for field header as field value $xt->assign("yearWeekText_mastervalue", $viewControls->showDBValue("yearWeekText", $data, $keylink)); $format = $settings->getViewFormat("yearWeekText"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("yearWeekText"))) { $class = ' rnr-field-number'; } $xt->assign("yearWeekText_class", $class); // add class for field header as field value $xt->assign("monthWeekInt_mastervalue", $viewControls->showDBValue("monthWeekInt", $data, $keylink)); $format = $settings->getViewFormat("monthWeekInt"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("monthWeekInt"))) { $class = ' rnr-field-number'; } $xt->assign("monthWeekInt_class", $class); // add class for field header as field value $xt->assign("monthWeekText_mastervalue", $viewControls->showDBValue("monthWeekText", $data, $keylink)); $format = $settings->getViewFormat("monthWeekText"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("monthWeekText"))) { $class = ' rnr-field-number'; } $xt->assign("monthWeekText_class", $class); // add class for field header as field value $xt->assign("fiscalYear_mastervalue", $viewControls->showDBValue("fiscalYear", $data, $keylink)); $format = $settings->getViewFormat("fiscalYear"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("fiscalYear"))) { $class = ' rnr-field-number'; } $xt->assign("fiscalYear_class", $class); // add class for field header as field value $xt->assign("fiscalMonth_mastervalue", $viewControls->showDBValue("fiscalMonth", $data, $keylink)); $format = $settings->getViewFormat("fiscalMonth"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("fiscalMonth"))) { $class = ' rnr-field-number'; } $xt->assign("fiscalMonth_class", $class); // add class for field header as field value $xt->assign("fiscalQuarter_mastervalue", $viewControls->showDBValue("fiscalQuarter", $data, $keylink)); $format = $settings->getViewFormat("fiscalQuarter"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("fiscalQuarter"))) { $class = ' rnr-field-number'; } $xt->assign("fiscalQuarter_class", $class); // add class for field header as field value $xt->assign("fiscalYearMonthText_mastervalue", $viewControls->showDBValue("fiscalYearMonthText", $data, $keylink)); $format = $settings->getViewFormat("fiscalYearMonthText"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("fiscalYearMonthText"))) { $class = ' rnr-field-number'; } $xt->assign("fiscalYearMonthText_class", $class); // add class for field header as field value $layout = GetPageLayout("calendar_table", 'masterprint'); if ($layout) { $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"'); } $xt->displayPartial(GetTemplateName("calendar_table", "masterprint")); }