function displayOwnerPersonList() { // list all Person Owners within limit and alphaFilter who DO NOT have an RPTOP for // the selected taxableYear $rptopBatchRecords = new RPTOPBatchRecords(); $db = new DB_RPTS(); if ($this->formArray["alphaFilter"] != "%") { $condition = "WHERE " . PERSON_TABLE . ".personType NOT LIKE 'propertyAdmin'" . "AND " . PERSON_TABLE . ".lastName LIKE '" . $this->formArray["alphaFilter"] . "%'"; } else { $notRegExp = ""; foreach ($this->alphaFilterListArray as $alphaFilter) { if ($alphaFilter != "%") { if ($notRegExp != "") { $notRegExp .= "|"; } $notRegExp .= strtoupper($alphaFilter) . "|" . strtolower($alphaFilter); } } $condition = "WHERE " . PERSON_TABLE . ".personType NOT LIKE 'propertyAdmin'" . "AND " . PERSON_TABLE . ".lastName NOT REGEXP '^" . $notRegExp . "'"; } $condition .= " ORDER BY " . PERSON_TABLE . ".lastName, " . PERSON_TABLE . ".firstName, " . PERSON_TABLE . ".middleName ASC;"; $sql = "SELECT " . PERSON_TABLE . ".personID as personID, " . PERSON_TABLE . ".lastName as lastName, " . PERSON_TABLE . ".firstName as firstName, " . PERSON_TABLE . ".middleName as middleName " . "FROM " . PERSON_TABLE . " " . $condition; $db->query($sql); if (!$db->next_record()) { $this->tpl->set_var("total", 0); $this->removeTplBlock("OwnerListColumns"); $this->removeTplBlock("OwnerList"); } else { $this->removeTplBlock("OwnerListEmpty"); $this->tpl->set_block("rptsTemplate", "OwnerList", "OwnerListBlock"); while ($db->next_record()) { if ($ownerCtr < $this->formArray["limit"]) { // check if owner has no other RPTOPs generated for the year if (!$rptopBatchRecords->getOwnerRPTOPArray($db->f("personID"), "Person", $this->formArray["taxableYear"])) { // check if owner has TDs for year <-- bottleneck $tdArray = $rptopBatchRecords->getTDListOf($db->f("personID"), "Person", $this->formArray["taxableYear"]); if (is_array($tdArray)) { $ownerCtr++; if ($db->f("lastName") == "" && $db->f("firstName") == "") { $ownerName = "BLANK OWNER"; } else { $ownerName = $db->f("lastName") . ", " . $db->f("firstName") . " " . $db->f("middleName"); } $this->tpl->set_var("ownerName", $ownerName); $this->tpl->set_var("personOrCompanyID", $db->f("personID")); $this->tpl->set_var("i", $ownerCtr); $this->tpl->parse("OwnerListBlock", "OwnerList", true); } } } else { break; } } $this->tpl->set_var("total", $ownerCtr); } }