Пример #1
0
 function searchRPTOP($page = 0, $condition = "", $searchKey)
 {
     if ($page > 0) {
         $page = ($page - 1) * PAGE_BY;
         $condition .= " LIMIT {$page}," . PAGE_BY;
     }
     $fields = array(RPTOP_TABLE . ".rptopNumber", COMPANY_TABLE . ".companyName", PERSON_TABLE . ".lastName", PERSON_TABLE . ".middleName", PERSON_TABLE . ".firstName", TD_TABLE . ".taxDeclarationNumber");
     $rptopRecords = new RPTOPRecords();
     if ($rptopRecords->searchRecords($searchKey, $fields, $condition)) {
         if (!($domDoc = $rptopRecords->getDomDocument())) {
             return false;
         } else {
             $xmlStr = $domDoc->dump_mem(true);
             return $xmlStr;
         }
     } else {
         return false;
     }
 }
Пример #2
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOP.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Пример #3
0
 function getLatestRPTOPNumber()
 {
     $latestRPTOPNumber = array("latestRPTOPNumber" => "", "prefix" => "", "delimeter" => "", "startNumber" => "");
     $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
     $condition = " WHERE " . RPTOP_TABLE . ".archive!='true' ORDER BY rptopID DESC LIMIT 1";
     if (!($xmlStr = $RPTOPList->getRPTOPList(0, $condition))) {
         // no latest available RPTOP
         $this->tpl->set_var("latestRPTOPNumber", "");
         $this->tpl->set_var("rptopNumber[prefix]", "");
         $this->tpl->set_var("rptopNumber[delimeter]", "");
         $this->tpl->set_var("rptopNumber[startNumber]", "");
         $this->tpl->set_var("rptopNumber[sample]", "");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             // no latest available RPTOP
             $this->tpl->set_var("latestRPTOPNumber", "");
             $this->tpl->set_var("rptopNumber[prefix]", "");
             $this->tpl->set_var("rptopNumber[delimeter]", "");
             $this->tpl->set_var("rptopNumber[startNumber]", "");
             $this->tpl->set_var("rptopNumber[sample]", "");
         } else {
             $rptopRecords = new RPTOPRecords();
             $rptopRecords->parseDomDocument($domDoc);
             $arrayList = $rptopRecords->getArrayList();
             if (is_array($arrayList)) {
                 foreach ($arrayList as $key => $rptop) {
                     // get delimeter and prefix
                     $latestRPTOPNumber = $rptop->getRptopNumber();
                     $splitArray = split("[^0-9]", $latestRPTOPNumber);
                     $prefix = "";
                     if (is_array($splitArray)) {
                         $i = 0;
                         $j = 0;
                         foreach ($splitArray as $str) {
                             if ($i < count($splitArray) - 1) {
                                 $prefix .= $splitArray[$i];
                                 $prefix .= substr($latestRPTOPNumber, $j + strlen($splitArray[$i]), 1);
                                 $j += strlen($splitArray[$i]) + 1;
                             }
                             $i++;
                         }
                         $delimeter = substr($prefix, strlen($prefix) - 1, 1);
                         $prefix = substr($prefix, 0, strlen($prefix) - 1);
                         $startNumber = $splitArray[count($splitArray) - 1] + 1;
                     }
                     $rptopNumber["prefix"] = $prefix;
                     $rptopNumber["delimeter"] = $delimeter;
                     $rptopNumber["startNumber"] = $startNumber;
                     $rptopNumber["sample"] = $prefix . $delimeter . $startNumber;
                     $this->tpl->set_var("latestRPTOPNumber", $latestRPTOPNumber);
                     $this->tpl->set_var("rptopNumber[prefix]", $rptopNumber["prefix"]);
                     $this->tpl->set_var("rptopNumber[delimeter]", $rptopNumber["delimeter"]);
                     $this->tpl->set_var("rptopNumber[startNumber]", $rptopNumber["startNumber"]);
                     $this->tpl->set_var("rptopNumber[sample]", $rptopNumber["sample"]);
                     break;
                 }
             } else {
                 // no latest available RPTOP
                 $this->tpl->set_var("latestRPTOPNumber", "");
             }
         }
     }
 }
Пример #4
0
 function removeOwnerRPTOP($rptopID, $ownerID, $personIDArray = false, $companyIDArray = false)
 {
     $owner = new Owner();
     $owner->selectRecord($ownerID);
     $ctr = 0;
     $refreshArr = "";
     $ownerPersonIDArray = $owner->getPersonIDArray();
     $ownerCompanyIDArray = $owner->getCompanyIDArray();
     //*
     if ($personIDArray) {
         foreach ($personIDArray as $key => $value) {
             $owner->deleteOwnerPerson($value);
             //$rptop = new RPTOP;
             //$rptop->selectRecordForList($rptopID);
             //$year = $rptop->getTaxableYear();
             //$tdIDArray = $this->getTDListOf($value,"Person",$year);
             //foreach ($tdIDArray as $tdKey => $tdValue){
             //	$rptop->deleteRptopTd($rptopID,$tdValue);
             //$ctr++;
             //}
             //unset($rptop);
         }
         $ownerPersonIDArray = array_diff($ownerPersonIDArray, $personIDArray);
     }
     if ($companyIDArray) {
         foreach ($companyIDArray as $key => $value) {
             $owner->deleteOwnerCompany($value);
             //$rptop = new RPTOP;
             //$rptop->selectRecordForList($rptopID);
             //$year = $rptop->getTaxableYear();
             //$tdIDArray = $this->getTDListOf($value,"Company",$year);
             //foreach ($tdIDArray as $tdKey => $tdValue){
             //	$rptop->deleteRptopTd($rptopID,$tdValue);
             //$ctr++;
             //}
             //unset($rptop);
         }
         $ownerCompanyIDArray = array_diff($ownerCompanyIDArray, $companyIDArray);
     }
     //*/
     //echo "personArray<br>";
     //print_r($ownerPersonIDArray);
     //echo "<br>companyArray<br>";
     //print_r($ownerCompanyIDArray);
     //echo "<br><br>";
     $rptopRecords = new RPTOPRecords();
     $ret = $rptopRecords->deleteRPTOPTD($rptopID);
     //if ($personIDArray) $ownerPersonIDArray = array_diff($ownerPersonIDArray,$personIDArray);
     //if ($companyIDArray) $ownerCompanyIDArray = array_diff($ownerCompanyIDArray,$companyIDArray);
     if (is_array($ownerPersonIDArray)) {
         $this->addOwnerPersonRPTOP($rptopID, $ownerID, $ownerPersonIDArray);
     }
     if (is_array($ownerCompanyIDArray)) {
         $this->addOwnerCompanyRPTOP($rptopID, $ownerID, $ownerCompanyIDArray);
     }
     unset($owner);
     $ret = $ctr;
     return $ret;
 }
Пример #5
0
 function Main()
 {
     $numOfPages = 1;
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "cancel":
             header("location: RPTOPList.php");
             exit;
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $count = $this->formArray["formAction"] == "search" ? $RPTOPList->getSearchCount($this->formArray["searchKey"]) : $RPTOPList->getRPTOPCount();
             if (!$count) {
                 $this->tpl->set_var("PagesBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = " ORDER BY " . RPTOP_TABLE . ".rptopID desc";
             $xmlStr = $this->formArray["formAction"] == "search" ? $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]) : $RPTOPList->getRPTOPList($this->formArray["page"]);
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = " ORDER BY " . RPTOP_TABLE . ".rptopID desc";
             $xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition);
     }
     /*		$RPTOPList = new SoapObject(NCCBIZ."RPTOPList.php", "urn:Object");
     		$this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
     		
     		$count = ($this->formArray["formAction"]=="search") ? 
     				$RPTOPList->getSearchCount($this->formArray["searchKey"]) : $RPTOPList->getRPTOPCount();
     
     		if (!$count){
     			$this->tpl->set_var("PagesBlock", "");
     		}
     		else{
     			$numOfPages = ceil($count / PAGE_BY);
     			for($i=1;$i<=$numOfPages;$i++){
     				if ($i==$this->formArray["page"]){
     					$this->tpl->set_var("pages","");
     					$this->tpl->set_var("paged",$i);
     				}
     				else{
     					$this->tpl->set_var("pages",$i);
     					$this->tpl->set_var("paged","");
     				}
     				$this->tpl->parse("PagesBlock", "Pages", true);
     			}
     		}
     		if ($numOfPages == $this->formArray["page"]){
     			$this->tpl->set_var("nextTxt", "");
     		}
     		else{
     			$this->tpl->set_var("next", $this->formArray["page"]+1);
     			$this->tpl->set_var("nextTxt", "next");
     		}
     		if ($this->formArray["page"] == 1){
     			$this->tpl->set_var("previousTxt", "");
     		}
     		else {
     			$this->tpl->set_var("previous", $this->formArray["page"]-1);
     			$this->tpl->set_var("previousTxt", "previous");
     		}
     		$this->tpl->set_var("pageOf", $this->formArray["page"]." of ".$numOfPages);
     
     		$condition = " ORDER BY ".RPTOP_TABLE.".rptopID desc";
     
     		$xmlStr = ($this->formArray["formAction"]=="search") ?
     				$RPTOPList->searchRPTOP($this->formArray["page"],$condition,$this->formArray["searchKey"]) :
     				$RPTOPList->getRPTOPList($this->formArray["page"]);
     	*/
     if (!$xmlStr) {
         $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
         $this->tpl->set_var("RPTOPTableBlock", "page not found");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
             $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
         } else {
             $rptopRecords = new RPTOPRecords();
             $rptopRecords->parseDomDocument($domDoc);
             $list = $rptopRecords->getArrayList();
             if ($this->formArray["sortOrder"] == "") {
                 $this->formArray["sortOrder"] = "desc";
             }
             $this->tpl->set_var("sortOrder", $this->formArray["sortOrder"] == "asc" ? "desc" : "asc");
             if ($this->formArray["sortKey"] == "rptopID") {
                 $this->tpl->set_var("sortImageID", "<img src=\"images/" . $this->formArray["sortOrder"] . "_order.png\" border=0 alt=\"" . ucfirst($this->formArray["sortOrder"]) . "ending\">");
                 $this->tpl->set_var("sortImageName", "");
             } elseif ($this->formArray["sortKey"] == "ownerName") {
                 $this->tpl->set_var("sortImageID", "");
                 $this->tpl->set_var("sortImageName", "<img src=\"images/" . $this->formArray["sortOrder"] . "_order.png\" border=0 alt=\"" . ucfirst($this->formArray["sortOrder"]) . "ending\">");
             }
             if (count($list)) {
                 $this->removeNotFoundBlock();
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                 $this->tpl->set_block("RPTOPList", "TaxableYear", "TaxableYearBlock");
                 $this->tpl->set_block("RPTOPList", "OwnerList", "OwnerListBlock");
                 #$this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                 #$this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                 $i = 0;
                 $buffer = array();
                 foreach ($list as $key => $value) {
                     $buffer[$i]["rptopID"] = $value->getRptopID();
                     # $forDate = getdate(strtotime($value->getTaxableYear()));
                     $buffer[$i]["taxableYear"] = $value->getTaxableYear();
                     $buffer[$i]["ownerName"] = "";
                     /*
                     $this->tpl->set_var("rptopID", $value->getRptopID());
                     $forDate = getdate(strtotime($value->getRptopDate()));
                     $this->tpl->set_var("rptopDate", $forDate['year']);
                     */
                     $oValue = $value->owner;
                     $pOwnerStr = "";
                     if (count($oValue->personArray)) {
                         foreach ($oValue->personArray as $pKey => $pValue) {
                             $ownerRecord = array("ownerScript" => "PersonDetails.php", "ownerKey" => "personID", "ownerID" => $pValue->getPersonID(), "ownerName" => $pValue->getFullName());
                             $ownerRecords[] = $ownerRecord;
                             $buffer[$i]["ownerRecords"] = $ownerRecords;
                             $buffer[$i]["ownerName"] .= $pValue->getFullName();
                             /*
                             $this->tpl->set_var("personID",$pValue->getPersonID());
                             $this->tpl->set_var("OwnerPerson",$pValue->getFullName());
                             $this->tpl->parse("PersonListBlock", "PersonList", true);
                             */
                         }
                     }
                     if (count($oValue->companyArray)) {
                         foreach ($oValue->companyArray as $cKey => $cValue) {
                             $ownerRecord = array("ownerScript" => "CompanyDetails.php", "ownerKey" => "companyID", "ownerID" => $cValue->getCompanyID(), "ownerName" => $cValue->getCompanyName());
                             $ownerRecords[] = $ownerRecord;
                             $buffer[$i]["ownerRecords"] = $ownerRecords;
                             $buffer[$i]["ownerName"] .= $cValue->getCompanyName();
                             /*
                             $this->tpl->set_var("companyID",$cValue->getCompanyID());
                             $this->tpl->set_var("OwnerCompany",$cValue->getCompanyName());
                             $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                             */
                         }
                     }
                     if (count($oValue->personArray) || count($oValue->companyArray)) {
                         $this->tpl->set_var("none", "");
                     } else {
                         $this->tpl->set_var("none", "none");
                     }
                     unset($ownerRecords);
                     $i++;
                 }
                 #end  foreach ($list)
                 $buffer = $this->sortArray($buffer, $this->formArray["sortKey"], $this->formArray["sortOrder"]);
                 for ($i = 0; $i < count($buffer); $i++) {
                     //$this->tpl->set_var($buffer[$i]);
                     $rptopRecord = $buffer[$i];
                     $ownerRecords = $rptopRecord["ownerRecords"];
                     $this->tpl->set_var("rptopID", $rptopRecord["rptopID"]);
                     $this->tpl->set_var("taxableYear", $rptopRecord["taxableYear"]);
                     if ($rptopRecord["ownerName"] == "") {
                         $this->tpl->set_var("OwnerListBlock", "");
                         $this->tpl->set_var("none", "none");
                     } else {
                         $this->tpl->set_var("OwnerListBlock", "");
                         foreach ($ownerRecords as $key => $ownerRecord) {
                             $this->tpl->set_var("ownerScript", $ownerRecord["ownerScript"]);
                             $this->tpl->set_var("ownerKey", $ownerRecord["ownerKey"]);
                             $this->tpl->set_var("ownerID", $ownerRecord["ownerID"]);
                             $this->tpl->set_var("ownerName", $ownerRecord["ownerName"]);
                             $this->tpl->parse("OwnerListBlock", "OwnerList", true);
                         }
                         $this->tpl->set_var("none", "");
                     }
                     //$this->tpl->set_var("totalAssessedValue", "00000");
                     //$this->tpl->set_var("totalTaxDue", "96876565765");
                     $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                     $this->tpl->set_var("PersonListBlock", "");
                     $this->tpl->set_var("CompanyListBlock", "");
                 }
                 #end  foreach ($list)
             } else {
                 $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                 $this->tpl->set_var("RPTOPListBlock", "huh");
             }
         }
     }
     $this->tpl->set_var("page", $this->formArray["page"]);
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Пример #6
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             $numberOfRecordsRemoved = 0;
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 $numberOfRecordsRemoved = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]);
             }
             $url = "&formAction=" . urlencode($this->formArray["previousFormAction"]);
             if ($this->formArray["previousFormAction"] == "search") {
                 $url .= "&searchKey=" . urlencode($this->formArray["searchKey"]);
             }
             $url .= "&page=" . $this->formArray["page"];
             $url .= "&searchKey=" . $this->formArray["searchKey"];
             $url .= "&sortBy=" . $this->formArray["sortBy"];
             $url .= "&sortOrder=" . $this->formArray["sortOrder"];
             $url .= "&numberOfRecordsRemoved=" . $numberOfRecordsRemoved;
             header("location: RPTOPList.php" . $this->sess->url("") . $url);
             break;
         case "search":
             if ($this->formArray["numberOfRecordsRemoved"] == "" || $this->formArray["numberOfRecordsRemoved"] == 0) {
                 $this->tpl->set_block("rptsTemplate", "RecordsRemovedMessage", "RecordsRemovedMessageBlock");
                 $this->tpl->set_var("RecordsRemovedMessageBlock", "");
             } else {
                 if ($this->formArray["numberOfRecordsRemoved"] == 1) {
                     $this->tpl->set_var("plural", "");
                 } else {
                     $this->tpl->set_var("plural", "s");
                 }
             }
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         //$totalTaxDue = "uncalculated";
                                         $checkboxDisabled = "";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             //$totalTaxDue = "uncalculated";
                                             $checkboxDisabled = "";
                                         } else {
                                             $checkboxDisabled = "disabled";
                                             /* sum up total tax due
                                             												$due = new Due;
                                             												$due->parseDomDocument($domDoc);
                                             	
                                             												$totalTaxDue += $due->getTaxDue();								
                                             												*/
                                         }
                                     }
                                 }
                             } else {
                                 $checkboxDisabled = "";
                                 //$totalTaxDue = "no TD's";
                             }
                             //if(is_numeric($totalTaxDue)) $totalTaxDue = formatCurrency($totalTaxDue);
                             //$this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->tpl->set_var("checkboxDisabled", $checkboxDisabled);
                             $checkboxDisabled = "";
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         default:
             if ($this->formArray["numberOfRecordsRemoved"] == "" || $this->formArray["numberOfRecordsRemoved"] == 0) {
                 $this->tpl->set_block("rptsTemplate", "RecordsRemovedMessage", "RecordsRemovedMessageBlock");
                 $this->tpl->set_var("RecordsRemovedMessageBlock", "");
             } else {
                 if ($this->formArray["numberOfRecordsRemoved"] == 1) {
                     $this->tpl->set_var("plural", "");
                 } else {
                     $this->tpl->set_var("plural", "s");
                 }
             }
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         //$totalTaxDue = "uncalculated";
                                         $checkboxDisabled = "";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             //$totalTaxDue = "uncalculated";
                                             $checkboxDisabled = "";
                                         } else {
                                             $checkboxDisabled = "disabled";
                                             /* sum up total tax due
                                             												$due = new Due;
                                             												$due->parseDomDocument($domDoc);
                                             	
                                             												$totalTaxDue += $due->getTaxDue();								
                                             												*/
                                         }
                                     }
                                 }
                             } else {
                                 $checkboxDisabled = "";
                                 //$totalTaxDue = "no TD's";
                             }
                             //if(is_numeric($totalTaxDue)) $totalTaxDue = formatCurrency($totalTaxDue);
                             //$this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->tpl->set_var("checkboxDisabled", $checkboxDisabled);
                             $checkboxDisabled = "";
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Пример #7
0
 function Main()
 {
     //	$fp = fopen("batchCalculate.log", "w") or die("Couldn't create new file");
     $numOfPages = 1;
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "cancel":
             header("location: RPTOPList.php");
             exit;
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $count = $this->formArray["formAction"] == "search" ? $RPTOPList->getSearchCount($this->formArray["searchKey"]) : $RPTOPList->getRPTOPCount();
             if (!$count) {
                 $this->tpl->set_var("PagesBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = " ORDER BY " . RPTOP_TABLE . ".rptopID desc";
             $xmlStr = $this->formArray["formAction"] == "search" ? $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]) : $RPTOPList->getRPTOPList($this->formArray["page"]);
             break;
         default:
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = " ORDER BY " . RPTOP_TABLE . ".rptopID desc";
             $xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition);
     }
     /*	switch ($this->formArray["formAction"]){
     		case "delete":
     			if (count($this->formArray["rptopID"]) > 0) {
     				$RPTOPList = new SoapObject(NCCBIZ."RPTOPList.php", "urn:Object");
     				if (!$deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"])){
     					$this->tpl->set_var("msg", "SOAP failed");
     				}else{
     					$this->tpl->set_var("msg", $deletedRows." records deleted");
     				}
     			}else 
     				$this->tpl->set_var("msg", "0 records deleted");
     				break;				
     		case "cancel":
     				header("location: RPTOPList.php");
     				exit;
     				break;
     		default:
     				$this->tpl->set_var("msg", "");
     	}
     */
     /*	$RPTOPList = new SoapObject(NCCBIZ."RPTOPList.php", "urn:Object");
     	$this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
     		
     	$count = ($this->formArray["formAction"]=="search") ? 
     			$RPTOPList->getSearchCount($this->formArray["searchKey"]) : $RPTOPList->getRPTOPCount();
     
     	if (!$count){
     		$this->tpl->set_var("PagesBlock", "");
     	}else{
     		$numOfPages = ceil($count / PAGE_BY);
     		for($i=1;$i<=$numOfPages;$i++){
     			if ($i==$this->formArray["page"]){
     				$this->tpl->set_var("pages","");
     				$this->tpl->set_var("paged",$i);
     			}else{
     				$this->tpl->set_var("pages",$i);
     				$this->tpl->set_var("paged","");
     			}
     				$this->tpl->parse("PagesBlock", "Pages", true);
     		}
     	}
     	if ($numOfPages == $this->formArray["page"]){
     		$this->tpl->set_var("nextTxt", "");
     	}else{
     		$this->tpl->set_var("next", $this->formArray["page"]+1);
     		$this->tpl->set_var("nextTxt", "next");
     	}
     	if ($this->formArray["page"] == 1){
     		$this->tpl->set_var("previousTxt", "");
     	}else {
     		$this->tpl->set_var("previous", $this->formArray["page"]-1);
     		$this->tpl->set_var("previousTxt", "previous");
     	}
     		$this->tpl->set_var("pageOf", $this->formArray["page"]." of ".$numOfPages);
     	
     	$xmlStr = ($this->formArray["formAction"]=="search") ?
     			$RPTOPList->searchRPTOP($this->formArray["page"],"",$this->formArray["searchKey"]) :
     			$RPTOPList->getRPTOPList($this->formArray["page"]);
     */
     if (!$xmlStr) {
         $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
         $this->tpl->set_var("RPTOPTableBlock", "page not found");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
             $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
         } else {
             $rptopRecords = new RPTOPRecords();
             $rptopRecords->parseDomDocument($domDoc);
             $list = $rptopRecords->getArrayList();
             //echo $this->formArray["sortOrder"];
             if ($this->formArray["sortOrder"] == "") {
                 $this->formArray["sortOrder"] = "desc";
             }
             $this->tpl->set_var("sortOrder", $this->formArray["sortOrder"] == "asc" ? "desc" : "asc");
             if ($this->formArray["sortKey"] == "rptopID") {
                 $this->tpl->set_var("sortImageID", "<img src=\"images/" . $this->formArray["sortOrder"] . "_order.png\" border=0 alt=\"" . ucfirst($this->formArray["sortOrder"]) . "ending\">");
                 $this->tpl->set_var("sortImageName", "");
             } elseif ($this->formArray["sortKey"] == "ownerName") {
                 $this->tpl->set_var("sortImageID", "");
                 $this->tpl->set_var("sortImageName", "<img src=\"images/" . $this->formArray["sortOrder"] . "_order.png\" border=0 alt=\"" . ucfirst($this->formArray["sortOrder"]) . "ending\">");
             }
             if (count($list)) {
                 $this->removeNotFoundBlock();
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                 $this->tpl->set_block("RPTOPList", "TaxableYear", "TaxableYearBlock");
                 $this->tpl->set_block("RPTOPList", "OwnerList", "OwnerListBlock");
                 $i = 0;
                 $buffer = array();
                 foreach ($list as $key => $value) {
                     $buffer[$i]["rptopID"] = $value->getRptopID();
                     # $forDate = getdate(strtotime($value->getTaxableYear()));
                     $buffer[$i]["taxableYear"] = $value->getTaxableYear();
                     $buffer[$i]["ownerName"] = "";
                     $oValue = $value->owner;
                     $pOwnerStr = "";
                     if (count($oValue->personArray)) {
                         foreach ($oValue->personArray as $pKey => $pValue) {
                             $ownerRecord = array("ownerScript" => "PersonDetails.php", "ownerKey" => "personID", "ownerID" => $pValue->getPersonID(), "ownerName" => $pValue->getFullName());
                             $ownerRecords[] = $ownerRecord;
                             $buffer[$i]["ownerRecords"] = $ownerRecords;
                             $buffer[$i]["ownerName"] .= $pValue->getFullName();
                         }
                     }
                     if (count($oValue->companyArray)) {
                         foreach ($oValue->companyArray as $cKey => $cValue) {
                             $ownerRecord = array("ownerScript" => "CompanyDetails.php", "ownerKey" => "companyID", "ownerID" => $cValue->getCompanyID(), "ownerName" => $cValue->getCompanyName());
                             $ownerRecords[] = $ownerRecord;
                             $buffer[$i]["ownerRecords"] = $ownerRecords;
                             $buffer[$i]["ownerName"] .= $cValue->getCompanyName();
                         }
                     }
                     if (count($oValue->personArray) || count($oValue->companyArray)) {
                         $this->tpl->set_var("none", "");
                     } else {
                         $this->tpl->set_var("none", "none");
                     }
                     unset($ownerRecords);
                     /*							$RPTOPDetails = new SoapObject(NCCBIZ."RPTOPDetails.php", "urn:Object");
                     							if (!$xmlStr = $RPTOPDetails->getRPTOP($value->getRptopID())){
                     								exit("xml failed");
                     							}else{
                     								fwrite($fp,"\r\nrptopid: ".$value->getRptopID()."\r\n");
                     								if(!$domDoc = domxml_open_mem($xmlStr)) {
                     									echo "error xmlDoc";
                     								}else {
                     									$rptop = new RPTOP;
                     									$td = new TD();
                     									$rptop->parseDomDocument($domDoc);
                     									foreach($rptop as $key => $rvalue){						
                     										if ($key == "tdArray") {					
                     											$tdCtr = 0;
                     											if (count($rvalue)){		
                     												foreach($rvalue as $tkey => $tvalue){			
                     													$td->selectRecord($tvalue->getTdID());
                     													$assessedValue = number_format($td->getAssessedValue(),2,".","");
                     													$taxDue = new Dues($tvalue->getTdID(), $this->formArray['taxableYear']);
                     													$taxDue->setBasic($assessedValue);
                     													$taxDue->setSEF($assessedValue);
                     													$taxDue->setIdle($assessedValue);
                     													$taxDue->store();
                     													fwrite($fp,"TD: ".$tvalue->getTdID()."...PROCESSED COMPLETE\r\n");
                     													//$dueValues['basic'] = number_format($taxDue->getBasic(),2);
                     													//$dueValues['sef'] = number_format($taxDue->getSEF(),2);
                     													//$dueValues['total'] = number_format($taxDue->getBasic() + $taxDue->getSEF(),2);
                     													//$totalValues['totBasic'] += $taxDue->getBasic();
                     													//$totalValues['totSEF'] += $taxDue->getSEF();
                     													//$totalValues['totTotal'] += ($taxDue->getBasic() + $taxDue->getSEF());
                     													//$totalValues['totAssessedValue'] += $assessedValue;
                     													//$tdValues['assessedValue'] = number_format($assessedValue,2);
                     													//$tdValues['tdNumber'] = $tvalue->getTaxDeclarationNumber();
                     													//$tdValues['propertyIndexNumber'] = $PropertyIndexNumber;
                     													$tdCtr++;
                     												}#foreach $rvaklue blk
                     											}#if count(rvalue)
                     										}#if key="tdArray"
                     									}#rptopBlk
                     								}#else block !domDoc	
                     							}#else !xmlstr*/
                     //$totalValues['totBasic'] = number_format($totalValues['totBasic'],2);
                     //$totalValues['totSEF'] = number_format($totalValues['totSEF'],2);
                     //$totalValues['totTotal'] = number_format($totalValues['totTotal'],2);
                     //$totalValues['totAssessedValue'] = number_format($totalValues['totAssessedValue'],2);
                     $i++;
                 }
                 #end  foreach ($list)
                 $buffer = $this->sortArray($buffer, $this->formArray["sortKey"], $this->formArray["sortOrder"]);
                 for ($i = 0; $i < count($buffer); $i++) {
                     //$this->tpl->set_var($buffer[$i]);
                     $rptopRecord = $buffer[$i];
                     $ownerRecords = $rptopRecord["ownerRecords"];
                     $this->tpl->set_var("rptopID", $rptopRecord["rptopID"]);
                     $this->tpl->set_var("taxableYear", $rptopRecord["taxableYear"]);
                     if ($rptopRecord["ownerName"] == "") {
                         $this->tpl->set_var("OwnerListBlock", "");
                         $this->tpl->set_var("none", "none");
                     } else {
                         $this->tpl->set_var("OwnerListBlock", "");
                         foreach ($ownerRecords as $key => $ownerRecord) {
                             $this->tpl->set_var("ownerScript", $ownerRecord["ownerScript"]);
                             $this->tpl->set_var("ownerKey", $ownerRecord["ownerKey"]);
                             $this->tpl->set_var("ownerID", $ownerRecord["ownerID"]);
                             $this->tpl->set_var("ownerName", $ownerRecord["ownerName"]);
                             $this->tpl->parse("OwnerListBlock", "OwnerList", true);
                         }
                         $this->tpl->set_var("none", "");
                     }
                     //$this->tpl->set_var("totalAssessedValue", "00000");
                     //$this->tpl->set_var("totalTaxDue", "96876565765");
                     $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                     $this->tpl->set_var("PersonListBlock", "");
                     $this->tpl->set_var("CompanyListBlock", "");
                 }
             }
             #end if countlist
         }
         #end else	domDoc
     }
     #end  else xmlstr
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $this->tpl->set_var("page", $this->formArray["page"]);
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Пример #8
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: RPTOPList.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Пример #9
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "updateCalculation":
             if (is_array($this->formArray["rptopID"])) {
                 $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 $DueEncode = new SoapObject(NCCBIZ . "DueEncode.php", "urn:Object");
                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                 $dueIDArray = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                 $treasurySettings = new TreasurySettings();
                 $treasurySettings->selectRecord();
                 $this->formArray["masterBasicTaxRate"] = $treasurySettings->getPctRPTax();
                 $this->formArray["masterSEFTaxRate"] = $treasurySettings->getPctSEF();
                 $this->formArray["masterIdleTaxRate"] = $treasurySettings->getPctIdle();
                 $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                 $this->formArray["annualDueDate"] = $treasurySettings->getAnnualDueDate();
                 foreach ($this->formArray["rptopID"] as $rptopID) {
                     if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
                         // error xmlStr
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             // error domDoc
                         } else {
                             $rptop = new RPTOP();
                             $rptop->parseDomDocument($domDoc);
                             $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                             $tdArray = $rptop->getTDArray();
                             if (is_array($tdArray)) {
                                 foreach ($tdArray as $td) {
                                     $this->formArray["assessedValue"] = "";
                                     $this->formArray["taxability"] = "";
                                     $this->formArray["idle"] = "";
                                     $this->formArray["tdID"] = $td->getTdID();
                                     $this->formArray["dueID"] = "";
                                     $this->formArray["propertyType"] = $td->getPropertyType();
                                     if (!($afsXmlStr = $AFSDetails->getAFS($td->getAfsID()))) {
                                         // error afsXmlStr
                                     } else {
                                         if (!($afsDomDoc = domxml_open_mem($afsXmlStr))) {
                                             // error afsDomDoc
                                         } else {
                                             $afs = new AFS();
                                             $afs->parseDomDocument($afsDomDoc);
                                             $this->formArray["assessedValue"] = $afs->getTotalAssessedValue();
                                             $this->formArray["taxability"] = $afs->getTaxability();
                                             $this->formArray["effectivity"] = $afs->getEffectivity();
                                             $this->formArray["dueDate"] = date("Y-n-d", strtotime($this->formArray["taxableYear"] . "-" . $this->formArray["annualDueDate"]));
                                             if ($this->formArray["propertyType"] == "Land") {
                                                 if (is_array($afs->getLandArray())) {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                     }
                                     if (!($dueXmlStr = $DueList->getDueList($td->getTdID(), $rptop->getTaxableYear()))) {
                                         $this->formArray["dueID"] = "";
                                         $dueIDArray["Annual"] = "";
                                     } else {
                                         if (!($dueDomDoc = domxml_open_mem($dueXmlStr))) {
                                             $this->formArray["dueID"] = "";
                                             $dueIDArray["Annual"] = "";
                                         } else {
                                             //print_r(htmlspecialchars($xmlStr));
                                             //exit;
                                             $dueRecords = new DueRecords();
                                             $dueRecords->parseDomDocument($dueDomDoc);
                                             foreach ($dueRecords->getArrayList() as $due) {
                                                 foreach ($due as $dueKey => $dueValue) {
                                                     switch ($dueKey) {
                                                         case "dueType":
                                                             $dueIDArray[$dueValue] = $due->getDueID();
                                                             break;
                                                     }
                                                 }
                                             }
                                             $this->formArray["dueID"] = $dueIDArray["Annual"];
                                         }
                                     }
                                     $this->formArray["basicTaxRate"] = $this->formArray["masterBasicTaxRate"];
                                     $this->formArray["sefTaxRate"] = $this->formArray["masterSEFTaxRate"];
                                     $this->formArray["idleTaxRate"] = $this->formArray["masterIdleTaxRate"];
                                     $this->formArray["basicTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["basicTaxRate"];
                                     $this->formArray["sefTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["sefTaxRate"];
                                     // if land->idle is "Yes", compute idleTax, otherwise set idleTax to zero
                                     if ($this->formArray["propertyType"] == "Land") {
                                         if ($this->formArray["idle"] == "Yes") {
                                             $this->formArray["idleTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["idleTaxRate"];
                                         } else {
                                             $this->formArray["idleTax"] = "0.00";
                                         }
                                     }
                                     // if afs->taxability is "Exempt", reset computations to zero.
                                     if ($this->formArray["taxability"] == "Exempt") {
                                         $this->formArray["basicTax"] = "0.00";
                                         $this->formArray["sefTax"] = "0.00";
                                         $this->formArray["idleTax"] = "0.00";
                                     }
                                     if ($dueIDArray["Annual"] != "") {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->updateDue($xmlStr))) {
                                                 // error update
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     } else {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->saveDue($xmlStr))) {
                                                 // error save
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     }
                                     $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                                     $this->refreshTDHistory($td);
                                 }
                             }
                             unset($tdArray);
                         }
                     }
                 }
             }
             if ($this->formArray["searchKey"] != "") {
                 $this->formArray["formAction"] = "search";
             } else {
                 $this->formArray["formAction"] = "";
             }
             header("Location: CalculateRPTOPBatch.php" . $this->sess->url("") . "&page=" . $this->formArray["page"] . "&sortBy=" . $this->formArray["sortBy"] . "&sortOrder=" . $this->formArray["sortOrder"] . "&formAction=" . $this->formArray["formAction"] . "&searchKey=" . $this->formArray["searchKey"]);
             exit;
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOPBatch.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }