Example #1
0
 function generateTDHistory($tdID)
 {
     $td = new TD();
     $td->selectRecord($tdID);
     $afsID = $td->getAfsID();
     //		echo("afsID=$afsID<br>");
     $afs = new AFS();
     $afs->selectRecord($afsID);
     $odID = $afs->getOdID();
     //	echo("odID=$odID<br>");
     $condition = sprintf(" WHERE presentODID='%s' ", fixQuotes($odID));
     $odHistoryRecords = new ODHistoryRecords();
     $odHistoryRecords->selectRecords($condition);
     if (count($odHistoryRecords->arrayList) > 0) {
         //	echo("count>0<br>");
         foreach ($odHistoryRecords->arrayList as $key => $odHistory) {
             $previousODID = $odHistory->getPreviousODID();
             $presentODID = $odHistory->getPresentODID();
             $previousAFS = new AFS();
             $previousAFS->selectRecord($afsID = "", $limit = "", $previousODID);
             $previousAFSID = $previousAFS->getAfsID();
             $previousTD = new TD();
             $previousTD->selectRecord($tdID = "", $previousAFSID);
             $previousTDID = $previousTD->getTdID();
             $this->tdHistory[] = $previousTD;
             $this->generateTDHistory($previousTDID);
         }
     } else {
         //echo("count==0<br>");
         return false;
     }
 }
Example #2
0
 function Main()
 {
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->formArray["mergeBasketArray"] = explode(",", $this->formArray["mergeBasketCSV"]);
     if (is_array($this->formArray["mergeBasketArray"])) {
         $this->tpl->set_block("rptsTemplate", "NoODList", "NoODListBlock");
         $this->tpl->set_var("NoODListBlock", "");
         $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock");
         $this->tpl->set_var("totalInMergeBasket", count($this->formArray["mergeBasketArray"]));
         foreach ($this->formArray["mergeBasketArray"] as $odID) {
             $od = new OD();
             $od->selectRecord($odID);
             $owner = $od->owner;
             $ownerStr = "";
             if (is_array($owner->personArray)) {
                 foreach ($owner->personArray as $pKey => $pValue) {
                     $ownerArray[] = $pValue->getFullName();
                 }
             }
             if (is_array($owner->companyArray)) {
                 foreach ($owner->companyArray as $cKey => $cValue) {
                     $ownerArray[] = $cValue->getCompanyName();
                 }
             }
             if (is_object($od->locationAddress)) {
                 $this->tpl->set_var("locationAddress", $od->locationAddress->getFullAddress());
             } else {
                 $this->tpl->set_var("locationAddress", "");
             }
             $this->tpl->set_var("landArea", number_format($od->getLandArea(), 2, '.', ','));
             $this->tpl->set_var("odID", $od->getOdID());
             if (is_array($ownerArray)) {
                 $this->tpl->set_var("ownerName", implode(",", $ownerArray));
             } else {
                 $this->tpl->set_var("ownerName", "");
             }
             $afs = new AFS();
             $afs->selectRecord("", "", $odID, "");
             if (is_object($afs)) {
                 if ($afs->getPropertyIndexNumber() != "") {
                     $propertyIndexNumber = $afs->getPropertyIndexNumber();
                 } else {
                     $propertyIndexNumber = "";
                 }
             }
             $this->tpl->set_var("propertyIndexNumber", $propertyIndexNumber);
             $this->tpl->parse("ODListBlock", "ODList", true);
             unset($ownerArray);
         }
     } else {
         $this->tpl->set_block("rptsTemplate", "ShowODList", "ShowODListBlock");
         $this->tpl->set_var("ShowODListBlock", "");
         $this->tpl->set_var("totalInMergeBasket", 0);
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #3
0
 function getAfsID($odID)
 {
     $afs = new AFS();
     if (!($afsID = $afs->checkAfsID($odID))) {
         return false;
     } else {
         return $afsID;
     }
 }
Example #4
0
 function getAFSForList($afsID)
 {
     $afs = new AFS();
     $afs->selectRecordForList($afsID);
     if (!($domDoc = $afs->getDomDocument())) {
         return false;
     } else {
         $xmlStr = $domDoc->dump_mem(true);
         return $xmlStr;
     }
 }
Example #5
0
 function getOdIDFromTdID($tdID)
 {
     $ret = false;
     $td = new TD();
     if ($td->selectRecord($tdID)) {
         $afsID = $td->getAfsID();
         if ($afs = new AFS()) {
             $afs->selectRecord($afsID);
             $odID = $afs->getOdID();
             $ret = $odID;
         }
     }
     return $ret;
 }
Example #6
0
 function displayEffectivity($afsID)
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($afsID))) {
         $this->tpl->set_var("effectivity", "");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_var("effectivity", "");
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             $this->tpl->set_var("effectivity", $afs->getEffectivity());
         }
     }
 }
 function getAFSDetails($odID)
 {
     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
     $this->formArray["afsID"] = $AFSEncode->getAFSID($odID);
     if ($this->formArray["afsID"]) {
         $afs = new AFS();
         if ($afs->selectRecord($this->formArray["afsID"])) {
             return $afs;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Example #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");
             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");
 }
Example #9
0
 function Main()
 {
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo $xmlStr;
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $td = new TD();
             $rptop->parseDomDocument($domDoc);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityAssessorID", $value->getAssessorID());
                             $this->tpl->set_var("cityAssessorName", $value->getFullName());
                             $this->formArray["cityAssessorName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "cityTreasurer":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityTreasurerID", $value->getAssessorID());
                             $this->tpl->set_var("cityTreasurerName", $value->getFullName());
                             $this->formArray["cityTreasurerName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "tdArray":
                         //$this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         //$this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $tdCtr = 0;
                         //echo("count=".count($value)."<br>");
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             foreach ($value as $tkey => $tvalue) {
                                 $td->selectRecord($tvalue->getTdID());
                                 $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                 $propertyType = $td->getPropertyType();
                                 $afsID = $td->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $PropertyIndexNumber = $afs->getPropertyIndexNumber();
                                 $idleStatus = $td->getIdleStatus();
                                 $formAssessedValue = number_format($td->getAssessedValue(), 2);
                                 if ($propertyType == "Land") {
                                     $formValues['assessedValueLand'] = $formAssessedValue;
                                     $formValues['assessedValueOthers'] = "";
                                 } else {
                                     $formValues['assessedValueLand'] = "";
                                     $formValues['assessedValueOthers'] = $formAssessedValue;
                                 }
                                 $formValues['assessedValue'] = $formAssessedValue;
                                 $formValues['propertyType'] = $propertyType;
                                 $taxDue = new Dues($tvalue->getTdID(), $this->formArray['taxableYear']);
                                 $taxDue->setBasic($assessedValue);
                                 $taxDue->setSEF($assessedValue);
                                 $taxDue->setIdleStatus($idleStatus);
                                 if ($taxDue->getIdleStatus()) {
                                     $taxDue->setIdle($assessedValue);
                                 } else {
                                     $taxDue->setIdle(0);
                                 }
                                 $taxDue->store();
                                 $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;
                                 $this->tpl->set_var($dueValues);
                                 $tdValues['assessedValue'] = number_format($assessedValue, 2);
                                 $tdValues['tdNumber'] = $tvalue->getTaxDeclarationNumber();
                                 $tdValues['propertyIndexNumber'] = $PropertyIndexNumber;
                                 $this->tpl->set_var($tdValues);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $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);
     $this->tpl->set_var($totalValues);
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #10
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "search":
             $this->tpl->set_var("msg", "");
             $AFSList = new SoapObject(NCCBIZ . "AFSList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $condition = $this->filterArchives();
             if (!($count = $AFSList->getSearchCount($this->formArray["searchKey"], $condition))) {
                 $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 . "&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->filterArchives();
             $condition .= $this->sortBlocks();
             if (!($xmlStr = $AFSList->searchAFS($this->formArray["page"], $this->formArray["searchKey"], $condition))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                 $this->tpl->set_var("AFSTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "AFSDBEmpty", "AFSDBEmptyBlock");
                 $this->tpl->set_var("AFSDBEmptyBlock", "");
                 $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 {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "AFSListTable", "AFSListTableBlock");
                     $this->tpl->set_var("AFSListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $odRecords = new ODRecords();
                     $odRecords->parseDomDocument($domDoc);
                     $list = $odRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "AFSDBEmpty", "AFSDBEmptyBlock");
                         $this->tpl->set_var("AFSDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "AFSList", "AFSListBlock");
                         $this->tpl->set_block("AFSList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("AFSList", "CompanyList", "CompanyListBlock");
                         //echo hello;
                         foreach ($list as $key => $value) {
                             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
                             $this->afsID = $AFSEncode->getAFSID($value->getOdID());
                             if (!($xmlStr = $AFSEncode->getAFSForList($this->afsID))) {
                                 echo "error domdoc";
                             } else {
                                 //echo $xmlStr."<br><br><br>";
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     echo "hello";
                                     $this->tpl->set_var("totalMarketValue", "");
                                     $this->tpl->set_var("totalAssessedValue", "");
                                     //$this->tpl->set_block("rptsTemplate", "AFSListTable", "AFSListTableBlock");
                                     //$this->tpl->set_var("AFSListTableBlock", "error xmlDoc");
                                 } else {
                                     $afs = new AFS();
                                     $afs->parseDomDocument($domDoc);
                                     $this->tpl->set_var("totalMarketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                     $this->tpl->set_var("totalAssessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                 }
                             }
                             $this->tpl->set_var("odID", $value->getOdID());
                             $this->tpl->set_var("afsID", $this->afsID);
                             $oValue = $value->owner;
                             $this->tpl->set_var("ownerID", $oValue->getOwnerID());
                             $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");
                             }
                             //*/
                             //echo method_exists($value->location,getFullAddress);
                             $this->tpl->set_var("locationAddress", $value->locationAddress->getFullAddress());
                             $this->tpl->set_var("landArea", $value->getLandArea());
                             $this->setAFSListBlockPerms();
                             $this->tpl->parse("AFSListBlock", "AFSList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "AFSList", "AFSListBlock");
                         $this->tpl->set_var("AFSListBlock", "huh");
                     }
                 }
             }
             break;
         default:
             $this->tpl->set_var("msg", "");
             $AFSList = new SoapObject(NCCBIZ . "AFSList.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", "");
             $condition = $this->filterArchives();
             if (!($count = $AFSList->getAFSCount($condition))) {
                 $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->filterArchives();
             $condition .= $this->sortBlocks();
             if (!($xmlStr = $AFSList->getAFSList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                 $this->tpl->set_var("AFSTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                     $this->tpl->set_var("AFSTableBlock", "");
                 } else {
                     $odRecords = new ODRecords();
                     $odRecords->parseDomDocument($domDoc);
                     $list = $odRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "AFSDBEmpty", "AFSDBEmptyBlock");
                         $this->tpl->set_var("AFSDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "AFSList", "AFSListBlock");
                         $this->tpl->set_block("AFSList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("AFSList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
                             $this->afsID = $AFSEncode->getAFSID($value->getOdID());
                             if (!($xmlStr = $AFSEncode->getAFSForList($this->afsID))) {
                                 echo "error domdoc";
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_var("totalMarketValue", "");
                                     $this->tpl->set_var("totalAssessedValue", "");
                                     //$this->tpl->set_block("rptsTemplate", "AFSListTable", "AFSListTableBlock");
                                     //$this->tpl->set_var("AFSListTableBlock", "error xmlDoc");
                                 } else {
                                     $afs = new AFS();
                                     $afs->parseDomDocument($domDoc);
                                     $this->tpl->set_var("totalMarketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                     $this->tpl->set_var("totalAssessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                 }
                             }
                             $this->tpl->set_var("odID", $value->getOdID());
                             $this->tpl->set_var("afsID", $this->afsID);
                             $oValue = $value->owner;
                             $this->tpl->set_var("ownerID", $oValue->getOwnerID());
                             $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");
                             }
                             //*/
                             //echo method_exists($value->location,getFullAddress);
                             $this->tpl->set_var("locationAddress", $value->locationAddress->getFullAddress());
                             $this->tpl->set_var("landArea", $value->getLandArea());
                             $this->setAFSListBlockPerms();
                             $this->tpl->parse("AFSListBlock", "AFSList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "AFSList", "AFSListBlock");
                         $this->tpl->set_var("AFSListBlock", "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");
 }
Example #11
0
 function Main()
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
         exit("afs not found");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             exit("error xmlDoc");
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             $this->formArray["propertyIndexNumber"] = $afs->getPropertyIndexNumber();
             $this->formArray["arpNumber"] = $afs->getArpNumber();
             $this->formArray["effectivity"] = $afs->getEffectivity();
             if ($afs->getTaxability() == "Taxable") {
                 $this->formArray["isTaxable"] = "X";
                 $this->formArray["isExempt"] = "  ";
             } else {
                 if ($afs->getTaxability() == "Exempt") {
                     $this->formArray["isExempt"] = "X";
                     $this->formArray["isTaxable"] = "  ";
                 }
             }
             $this->displayODAFS($this->formArray["afsID"]);
             $this->displayTDDetails();
             // if propertyType is "Land", grab Land values plus PlantsTrees values
             // if propertyType is "ImprovementsBuildings" or "Machineries", system should later on grab
             // "Land" from another AFS from based on bldg->landPin or mach->landPin field
             // still needs to be resolved whether to do it this way or not
             switch ($this->formArray["propertyType"]) {
                 case "Land":
                     $landList = $afs->getLandArray();
                     $plantsTreesList = $afs->getPlantsTreesArray();
                     if (is_array($landList)) {
                         $this->displayLandDetails($landList);
                         $this->displayLandList($landList);
                     }
                     if (is_array($plantsTreesList)) {
                         $this->displayPlantsTreesList($plantsTreesList);
                     }
                     break;
                 case "ImprovementsBuildings":
                     $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                     if (is_array($improvementsBuildingsList)) {
                         $this->displayImprovementsBuildingsList($improvementsBuildingsList);
                     }
                     break;
                 case "Machineries":
                     $machineriesList = $afs->getMachineriesArray();
                     if (is_array($machineriesList)) {
                         $this->displayMachineriesList($machineriesList);
                     }
                     break;
             }
             // UNCOMMENT LINES TO GRAB totalMarketValue and totalAssessedValue from AFS object instead of
             // computing from each property:
             //$this->formArray["totalMarketValue"] = $afs->getTotalMarketValue();
             //$this->formArray["totalAssessedValue"] = $afs->getTotalAssessedValue();
             $this->formArray["totalAssessedValueInWords"] = makewords($this->formArray["totalAssessedValue"]);
         }
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
     //		header("location: ".$testpdf->pdfPath);
     exit;
 }
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")";
             $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
             if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) {
                 if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                     //echo "SOAP failed";
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     //select
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             //print_r($rptop);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID());
                             $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName());
                             $this->formArray["cityAssessorName"] = $cityAssessor->getFullName();
                         } else {
                             $cityAssessor = $value;
                             $this->tpl->set_var("cityAssessorID", $cityAssessor);
                             $this->tpl->set_var("cityAssessorName", $cityAssessor);
                             $this->formArray["cityAssessorName"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID());
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName());
                             $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName();
                         } else {
                             $cityTreasurer = $value;
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer);
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer);
                             $this->formArray["cityTreasurerName"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         //$this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         //$this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         //$this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         //$this->tpl->set_block("TDList", "BacktaxesList", "BacktaxesListBlock");
                         $tdCtr = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             /*
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             */
                             foreach ($value as $tkey => $tvalue) {
                                 //foreach($tvalue as $column => $val){
                                 //	$this->tpl->set_var($column,$val);
                                 //}
                                 /*
                                 $this->tpl->set_var("tdID",$tvalue->getTDID());
                                 $this->tpl->set_var("taxDeclarationNumber",$tvalue->getTaxDeclarationNumber());
                                 $this->tpl->set_var("afsID",$tvalue->getAfsID());
                                 $this->tpl->set_var("cancelsTDNumber",$tvalue->getCancelsTDNumber());
                                 $this->tpl->set_var("canceledByTDNumber",$tvalue->getCanceledByTDNumber());
                                 $this->tpl->set_var("taxBeginsWithTheYear",$tvalue->getTaxBeginsWithTheYear());
                                 $this->tpl->set_var("ceasesWithTheYear",$tvalue->getCeasesWithTheYear());
                                 $this->tpl->set_var("enteredInRPARForBy",$tvalue->getEnteredInRPARForBy());
                                 $this->tpl->set_var("enteredInRPARForYear",$tvalue->getEnteredInRPARForYear());
                                 $this->tpl->set_var("previousOwner",$tvalue->getPreviousOwner());
                                 $this->tpl->set_var("previousAssessedValue",$tvalue->getPreviousAssessedValue());
                                 
                                 list($dateArr["year"],$dateArr["month"],$dateArr["day"]) = explode("-",$tvalue->getProvincialAssessorDate());
                                 $this->tpl->set_var("pa_yearValue",removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("pa_month",removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("pa_dayValue",removePreZero($dateArr["day"]));
                                 list($dateArr["year"],$dateArr["month"],$dateArr["day"]) = explode("-",$tvalue->getCityMunicipalAssessorDate());
                                 $this->tpl->set_var("cm_yearValue",removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("cm_month",removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("cm_dayValue",removePreZero($dateArr["day"]));
                                 
                                 $this->tpl->set_var("provincialAssessorName",$tvalue->provincialAssessor);
                                 $this->tpl->set_var("cityMunicipalAssessorName",$tvalue->cityMunicipalAssessor);
                                 //$this->tpl->set_var("assessedValue",$tvalue->getAssessedValue());
                                 
                                 $this->tpl->set_var("propertyType",$tvalue->getPropertyType());
                                 
                                 $this->tpl->set_var("basicTax","");
                                 $this->tpl->set_var("sefTax", "");
                                 $this->tpl->set_var("total", "");
                                 
                                 //$this->tpl->set_var("basicTax",$tvalue->getBasicTax());
                                 //$this->tpl->set_var("sefTax",$tvalue->getSefTax());
                                 //$this->tpl->set_var("total",$tvalue->getTotal());
                                 */
                                 $this->tdRecord["arpNumber"] = $tvalue->getTaxDeclarationNumber();
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     //$this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                                     //$this->tpl->set_var("AFSTableBlock", "afs not found");
                                 } else {
                                     //echo $xmlStr;
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         //$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                         //$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $odID = $afs->getOdID();
                                         $od = new OD();
                                         $od->selectRecord($odID);
                                         if (is_object($od->locationAddress)) {
                                             $locationAddress = $od->getLocationAddress();
                                             $this->tdRecord["location"] = $locationAddress->getBarangay() . ", " . $locationAddress->getMunicipalityCity();
                                         }
                                         switch ($tvalue->getPropertyType()) {
                                             case "ImprovementsBuildings":
                                                 if (is_array($afs->getImprovementsBuildingsArray())) {
                                                     $improvementsBuildings = $afs->improvementsBuildingsArray[0];
                                                     $actualUse = $improvementsBuildings->getActualUse();
                                                     if (is_numeric($actualUse)) {
                                                         $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                                         $actualUse = $improvementsBuildingsActualUses->getCode();
                                                         //$actualUse = $improvementsBuildingsActualUses->getDescription();
                                                     }
                                                     $this->tdRecord["class"] = $actualUse;
                                                 }
                                                 break;
                                             case "Machineries":
                                                 if (is_array($afs->getMachineriesArray())) {
                                                     $machineries = $afs->machineriesArray[0];
                                                     $actualUse = $machineries->getActualUse();
                                                     if (is_numeric($actualUse)) {
                                                         $machineriesActualUses = new MachineriesActualUses();
                                                         $machineriesActualUses->selectRecord($actualUse);
                                                         $actualUse = $machineriesActualUses->getCode();
                                                         //$actualUse = $machineriesActualUses->getDescription();
                                                     }
                                                     $this->tdRecord["class"] = $actualUse;
                                                 }
                                                 break;
                                             case "Land":
                                             default:
                                                 if (is_array($afs->getLandArray())) {
                                                     $land = $afs->landArray[0];
                                                     $actualUse = $land->getActualUse();
                                                     if (is_numeric($actualUse)) {
                                                         $landActualUses = new LandActualUses();
                                                         $landActualUses->selectRecord($actualUse);
                                                         $actualUse = $landActualUses->getCode();
                                                         //$actualUse = $landActualUses->getDescription();
                                                     }
                                                     $this->tdRecord["class"] = $actualUse;
                                                 } else {
                                                     if (is_array($afs->getPlantsTreesArray())) {
                                                         if (is_numeric($actualUse)) {
                                                             $plantsTreesActualUses = new PlantsTreesActualUses();
                                                             $plantsTreesActualUses->selectRecord($actualUse);
                                                             $actualUse = $plantsTreesActualUses->getCode();
                                                             //$actualUse = $plantsTreesActualUses->getDescription();
                                                         }
                                                         $this->tdRecord["class"] = $actualUse;
                                                     }
                                                 }
                                         }
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue();
                                         $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue();
                                         $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                         $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                         $this->tpl->set_var("taxability", $afs->getTaxability());
                                         $this->tpl->set_var("effectivity", $afs->getEffectivity());
                                         $this->formArray["idle"] = "No";
                                         if ($tvalue->getPropertyType() == "Land") {
                                             if (is_array($afs->landArray)) {
                                                 // if land is stripped
                                                 if (count($afs->landArray) > 1) {
                                                     foreach ($afs->landArray as $land) {
                                                         if ($land->getIdle() == "Yes") {
                                                             $this->formArray["idle"] = "Yes";
                                                             break;
                                                         }
                                                     }
                                                 } else {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                         if ($this->formArray["idle"] == "") {
                                             $this->formArray["idle"] = "No";
                                         }
                                         $this->tpl->set_var("idle", $this->formArray["idle"]);
                                     }
                                 }
                                 // grab DueRecords from tdID
                                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                                 $dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                                 if (!($xmlStr = $DueList->getDueList($tvalue->getTdID(), $rptop->getTaxableYear()))) {
                                     if ($this->formArray["rptopID"] != "") {
                                         $redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>.";
                                     } else {
                                         $redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list.";
                                     }
                                     exit($redirectMessage);
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         if ($this->formArray["rptopID"] != "") {
                                             $redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>.";
                                         } else {
                                             $redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list.";
                                         }
                                         exit($redirectMessage);
                                     } else {
                                         $dueRecords = new DueRecords();
                                         $dueRecords->parseDomDocument($domDoc);
                                         foreach ($dueRecords->getArrayList() as $due) {
                                             foreach ($due as $dueKey => $dueValue) {
                                                 switch ($dueKey) {
                                                     case "dueType":
                                                         if ($dueValue == "Annual") {
                                                             $this->formArray["totalTaxDue"] += $due->getTaxDue();
                                                         }
                                                         $dueArrayList[$dueValue] = $due;
                                                         $this->tpl->set_var("basicTax[" . $dueValue . "]", formatCurrency($due->getBasicTax()));
                                                         $this->tpl->set_var("sefTax[" . $dueValue . "]", formatCurrency($due->getSEFTax()));
                                                         $this->tpl->set_var("idleTax[" . $dueValue . "]", formatCurrency($due->getIdleTax()));
                                                         $this->tpl->set_var("taxDue[" . $dueValue . "]", formatCurrency($due->getTaxDue()));
                                                         $this->tpl->set_var("dueDate[" . $dueValue . "]", date("M. d, Y", strtotime($due->getDueDate())));
                                                         $dueDateYear = date("Y", strtotime($due->getDueDate()));
                                                         $this->tdRecord["year"] = $dueDateYear;
                                                         break;
                                                 }
                                             }
                                         }
                                         $treasurySettings = new TreasurySettings();
                                         $treasurySettings->selectRecord();
                                         // initialize discountPeriod and discountPercentage for earlyPaymentDiscount
                                         $this->tpl->set_var("discountPercentage", $treasurySettings->getDiscountPercentage() . "%");
                                         $this->tpl->set_var("discountPeriod", "January 01, " . $dueDateYear . " - " . date("F d, Y", strtotime($dueDateYear . "-" . $treasurySettings->getDiscountPeriod())));
                                         $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
                                         $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                                         $this->formArray["discountPeriod_End"] = strtotime($dueDateYear . "-" . $this->formArray["discountPeriod"]);
                                         $this->formArray["discountPeriod_Start"] = strtotime($dueDateYear . "-01-01");
                                         // initialize advancedDiscountPercentage for advancedPayment
                                         $this->tpl->set_var("advancedDiscountPercentage", $treasurySettings->getAdvancedDiscountPercentage() . "%");
                                         $this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage();
                                         $this->tpl->set_var("q1AdvancedDiscountPercentage", $treasurySettings->getQ1AdvancedDiscountPercentage() . "%");
                                         $this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage();
                                         // initialize penaltyLUTArray
                                         $penaltyLUTArray = $treasurySettings->getPenaltyLUT();
                                         $this->penaltyLUTArray = $treasurySettings->getPenaltyLUT();
                                         foreach ($dueArrayList as $dKey => $due) {
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPeriod($this->formArray["discountPeriod"]);
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPercentage($this->formArray["discountPercentage"]);
                                             // compute earlyPaymentDiscount as of today
                                             // check if today is within the discountPeriod and compute Discount
                                             // AND if today is BEFORE annual dueDate
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscount(0.0);
                                             if ($due->getDueType() == "Annual") {
                                                 if (strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]) {
                                                     if (strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())) {
                                                         $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                 }
                                             } else {
                                                 // if today is BEFORE dueDate
                                                 if (strtotime($this->now) <= strtotime($due->getDueDate()) && strtotime($this->now) >= $this->formArray["discountPeriod_Start"]) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                 }
                                                 // commented out Febuary 08, 2005 : Provide Quarterly Discounts
                                                 // earlyPaymentDiscount aren't given to Quarterly Dues except for Quarter 1
                                                 /*
                                                 if($due->getDueType()=="Q1"){
                                                 	if(strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]){
                                                 		if(strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())){
                                                 			$dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"]/100));
                                                 		}
                                                 	}
                                                 }
                                                 */
                                             }
                                             // compute advancedPaymentDiscount as of today
                                             // check if today is BEFORE January 1 of the year of the annual dueDate
                                             $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0.0);
                                             if (strtotime($this->now) < strtotime(date("Y", strtotime($dueArrayList[$dKey]->getDueDate())) . "-01-01")) {
                                                 // for advanced payments, give 20% discount to annual dues [advanced discount]
                                                 // give 10% discount to quarterly dues [early discount]
                                                 if ($due->getDueType() == "Annual") {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["advancedDiscountPercentage"] / 100));
                                                 } else {
                                                     if ($due->getDueType() == "Q1") {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"] / 100));
                                                     } else {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                     // commented out: February 08, 2005
                                                     // advancedPaymentDiscount aren't given to Quarterly Dues except for Quarter 1
                                                     /*
                                                     if($due->getDueType()=="Q1"){
                                                     	$dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"]/100));
                                                     }
                                                     */
                                                 }
                                             }
                                             $latestPaymentDate[$dKey] = $this->getLatestPaymentDateForDue($dueArrayList[$dKey]);
                                             $amountPaidForDue = $this->getAmountPaidForDue($dueArrayList);
                                             $latestPaymentDueType = $this->getLatestPaymentDueType($dueArrayList);
                                             $amnestyStatus[$dKey] = $this->getAmnestyStatusForDue($dueArrayList[$dKey]);
                                             $totalEarlyPaymentDiscount = $this->getTotalEarlyPaymentDiscountForDue($dueArrayList);
                                             $totalAdvancedPaymentDiscount = $this->getTotalAdvancedPaymentDiscountForDue($dueArrayList);
                                             if ($totalEarlyPaymentDiscount > 0) {
                                                 $earlyPaymentDiscountForDueType = $this->getTotalEarlyPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($earlyPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($earlyPaymentDiscountForDueType);
                                                 }
                                             }
                                             if ($totalAdvancedPaymentDiscount > 0) {
                                                 $advancedPaymentDiscountForDueType = $this->getTotalAdvancedPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($advancedPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($advancedPaymentDiscountForDueType);
                                                 }
                                             }
                                             // calculate Penalties verses either today or verses the last paymentDate
                                             if ($latestPaymentDate[$dKey] != "" || $latestPaymentDate[$dKey] != "now") {
                                                 $dueArrayList[$dKey] = $this->computePenalty($latestPaymentDate[$dKey], $dueArrayList[$dKey]);
                                                 // if balance is 0 leave penalty as is, otherwise calculatePenalty according to date now
                                                 $balance = round($dueArrayList[$dKey]->getInitialNetDue() - $amountPaidForDue, 4);
                                                 // 0.1 is used instead of 0 because a lot of balances may end up as 0.002 or so...
                                                 if ($balance > 0.1) {
                                                     $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                                 }
                                             } else {
                                                 $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                             }
                                             //print_r($dueArrayList[$dKey]);
                                             //echo "<hr>";
                                             $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount()));
                                             $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount()));
                                             $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue());
                                             $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100);
                                             $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty()));
                                             $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                             if ($amnestyStatus[$dKey]) {
                                                 $this->initialNetDue[$dKey] -= $dueArrayList[$dKey]->getPenalty();
                                                 $this->tpl->set_var("amnesty[" . $dKey . "]", "Yes");
                                             } else {
                                                 $this->tpl->set_var("amnesty[" . $dKey . "]", "No");
                                             }
                                             $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($this->initialNetDue[$dKey]));
                                         }
                                         // out of the loop,
                                         // verify balances to make disable penalties and discounts for Annual if ALL QUARTERS have been paid
                                         // and to disable penalties and discounts for Quarters if ALL of ANNUAL has been paid
                                         // example: Q1, Q2, Q3 and Q4 have been fully paid. Annual should not show any payables.
                                         //          Likewise if Annual has been fully paid, Q1, Q2, Q3 and Q4 should not show any payables.
                                         $totalQuarterlyNetDue = 0;
                                         $totalQuarterlyNetDue += $dueArrayList["Q1"]->getBasicTax() + $dueArrayList["Q1"]->getSefTax() + $dueArrayList["Q1"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q1"]->getEarlyPaymentDiscount() + $dueArrayList["Q1"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q1"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q1"]->getPenalty();
                                         }
                                         $totalQuarterlyNetDue += $dueArrayList["Q2"]->getBasicTax() + $dueArrayList["Q2"]->getSefTax() + $dueArrayList["Q2"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q2"]->getEarlyPaymentDiscount() + $dueArrayList["Q2"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q2"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q2"]->getPenalty();
                                         }
                                         $totalQuarterlyNetDue += $dueArrayList["Q3"]->getBasicTax() + $dueArrayList["Q3"]->getSefTax() + $dueArrayList["Q3"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q3"]->getEarlyPaymentDiscount() + $dueArrayList["Q3"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q3"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q3"]->getPenalty();
                                         }
                                         $totalQuarterlyNetDue += $dueArrayList["Q4"]->getBasicTax() + $dueArrayList["Q4"]->getSefTax() + $dueArrayList["Q4"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q4"]->getEarlyPaymentDiscount() + $dueArrayList["Q4"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q4"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q4"]->getPenalty();
                                         }
                                         $totalAnnualNetDue = 0;
                                         $totalAnnualNetDue += $dueArrayList["Annual"]->getBasicTax() + $dueArrayList["Annual"]->getSefTax() + $dueArrayList["Annual"]->getIdleTax();
                                         $totalAnnualNetDue -= $dueArrayList["Annual"]->getEarlyPaymentDiscount() + $dueArrayList["Annual"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Annual"]) {
                                             $totalAnnualNetDue += $dueArrayList["Annual"]->getPenalty();
                                         }
                                         if ($latestPaymentDueType != "Annual" && $totalQuarterlyNetDue - $amountPaidForDue <= 0) {
                                             // all QUARTERLY DUES have been paid, modify Annual Due values
                                             $dueArrayList["Annual"]->setAdvancedPaymentDiscount(0);
                                             $dueArrayList["Annual"]->setEarlyPaymentDiscount(0);
                                             $dueArrayList["Annual"]->setMonthsOverDue(0);
                                             $dueArrayList["Annual"]->setPenaltyPercentage(0);
                                             $dueArrayList["Annual"]->setPenalty(0);
                                             $this->initialNetDue["Annual"] = $dueArrayList["Annual"]->getInitialNetDue();
                                             $this->tpl->set_var("advancedPaymentDiscount[Annual]", formatCurrency($dueArrayList["Annual"]->getAdvancedPaymentDiscount()));
                                             $this->tpl->set_var("earlyPaymentDiscount[Annual]", formatCurrency($dueArrayList["Annual"]->getEarlyPaymentDiscount()));
                                             $this->tpl->set_var("monthsOverDue[Annual]", $dueArrayList["Annual"]->getMonthsOverDue());
                                             $this->tpl->set_var("penaltyPercentage[Annual]", $dueArrayList["Annual"]->getPenaltyPercentage() * 100);
                                             $this->tpl->set_var("penalty[Annual]", formatCurrency($dueArrayList["Annual"]->getPenalty()));
                                             $this->tpl->set_var("amnesty[Annual]", "No");
                                             $this->tpl->set_var("initialNetDue[Annual]", formatCurrency($this->initialNetDue["Annual"]));
                                         } else {
                                             if ($latestPaymentDueType == "Annual" && $totalAnnualNetDue - $amountPaidForDue <= 0) {
                                                 // all of ANNUAL Due has been fully paid, modify Quarterly Due values
                                                 $quarterlyDueKeys = array("Q1", "Q2", "Q3", "Q4");
                                                 foreach ($quarterlyDueKeys as $dKey) {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0);
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount(0);
                                                     $dueArrayList[$dKey]->setMonthsOverDue(0);
                                                     $dueArrayList[$dKey]->setPenaltyPercentage(0);
                                                     $dueArrayList[$dKey]->setPenalty(0);
                                                     $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                                     $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount()));
                                                     $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount()));
                                                     $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue());
                                                     $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100);
                                                     $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty()));
                                                     $this->tpl->set_var("amnesty[" . $dKey . "]", "No");
                                                     $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($this->initialNetDue[$dKey]));
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 // display Backtaxes and previousTD Backtaxes
                                 $this->formArray["totalBacktaxesBalance"] = 0;
                                 $this->displayBacktaxTD($tvalue->getTdID());
                                 $precedingTDArray = $this->getPrecedingTDArray($tvalue);
                                 if (is_array($precedingTDArray)) {
                                     foreach ($precedingTDArray as $precedingTD) {
                                         $this->displayBacktaxTD($precedingTD->getTdID());
                                     }
                                 }
                                 $this->tpl->set_var("total", number_format($this->formArray["totalBacktaxesDue"], 2));
                                 $this->tpl->set_var("totalBacktaxesBalance", number_format($this->formArray["totalBacktaxesBalance"], 2));
                                 // grab dueID's and backtaxTDID's to run through payments
                                 // create $dueIDArray
                                 foreach ($dueArrayList as $due) {
                                     $this->dueIDArray[] = $due->getDueID();
                                 }
                                 $this->displayTotalPaid();
                                 $this->displayNetDue();
                                 $this->tdArrayList[$this->tdRecord["year"] . $this->tdArrayListCounter] = $this->tdRecord;
                                 $this->tdArrayListCounter++;
                                 unset($this->tdRecord);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 //$this->tpl->parse("defaultTDListBlock", "defaultTDList", true);
                                 //$this->tpl->parse("toggleTDListBlock", "toggleTDList", true);
                                 //$this->tpl->parse("TDListBlock", "TDList", true);
                                 //$this->tpl->set_var("BacktaxesListBlock", "");
                                 /*
                                 $this->tpl->set_var("LandBlock", "");
                                 $this->tpl->set_var("PlantsTreesBlock", "");
                                 $this->tpl->set_var("ImprovementsBuildingsBlock", "");
                                 $this->tpl->set_var("MachineriesBlock", "");
                                 */
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("defaultTDListBlock", "//no default");
                             $this->tpl->set_var("toggleTDListBlock", "//no Toggle");
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     case "landTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "landTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
             $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
             unset($rptop);
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             $rptop = new RPTOP();
             $rptop->setRptopID($this->formArray["rptopID"]);
             $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
             $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
             $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
             $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
             $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
             $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
             $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
             $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
             $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]);
             $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
             $rptop->setCreatedBy($this->userID);
             $rptop->setModifiedBy($this->userID);
             $rptop->setDomDocument();
             $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object");
             $rptop->setDomDocument();
             $doc = $rptop->getDomDocument();
             $xmlStr = $doc->dump_mem(true);
             //echo $xmlStr;
             if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) {
                 echo "ret=" . $ret;
             }
             //echo $ret;
         }
     }
     if (is_array($this->tdArrayList)) {
         ksort($this->tdArrayList);
         reset($this->tdArrayList);
         //			$this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
         $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
         $this->tpl->set_block("Page", "TDList", "TDListBlock");
         $this->tpl->set_block("Page", "TotalDue", "TotalDueBlock");
         $this->formArray["totalTaxDue"] = 0;
         $maxRows = 20;
         $numRows = count($this->tdArrayList);
         $numPages = ceil($numRows / $maxRows);
         $rowStr = "";
         $j = 0;
         $page = 0;
         foreach ($this->tdArrayList as $tdRecord) {
             ++$j;
             if ($j > $maxRows) {
                 $this->formArray["tdYPosValue"] = "564";
                 $this->tpl->set_var("TDListBlock", $rowStr);
                 $this->tpl->set_var("PageNumber", ++$page);
                 if ($page == $numPages) {
                     $this->tpl->set_var("TotalDueBlock", $this->tpl->subst("TotalDue"));
                 } else {
                     $this->tpl->set_var("TotalDueBlock", "");
                 }
                 $this->tpl->parse("PageBlock", "Page", true);
                 $rowStr = "";
                 $j = 1;
             }
             $this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
             $this->tpl->set_var("class", $tdRecord["class"]);
             $this->tpl->set_var("location", $tdRecord["location"]);
             $this->tpl->set_var("year", $tdRecord["year"]);
             $this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
             $this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
             $this->formArray["tdYPosValue"] -= 15;
             $this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
             $rowStr .= $this->tpl->subst("TDList");
         }
         $this->tpl->set_var("TDListBlock", $rowStr);
         $this->tpl->set_var("PageNumber", ++$page);
         if ($page == $numPages) {
             $this->tpl->set_var("TotalDueBlock", $this->tpl->subst("TotalDue"));
         } else {
             $this->tpl->set_var("TotalDueBlock", "");
         }
         $this->tpl->parse("PageBlock", "Page", true);
         //			echo $this->tpl->subst("Page");
         /*
         			$maxRows = 5;
         			$numRows = count($this->tdArrayList);
         			$numPages = ceil($numRows/$maxRows);
         			$tdRecord = current($this->tdArrayList);
         			for ($page=0; $page<$numPages; ++$page) {
         				$rowStr = "";
         				$this->formArray["tdYPosValue"] = "564";
         				for ($currRow=0; $currRow<$maxRows; ++$currRow) {
         //					$tdRecord = $this->tdArrayList[($page*$maxRows)+$currRow];
         
         					$this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
         					$this->tpl->set_var("class", $tdRecord["class"]);
         					$this->tpl->set_var("location", $tdRecord["location"]);
         					$this->tpl->set_var("year", $tdRecord["year"]);
         					$this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
         					$this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
         					$this->formArray["tdYPosValue"]-=15;
         					$rowStr .= $this->tpl->subst("TDList");
         
         					$this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
         					$tdRecord = next($this->tdArrayList);
         				}
         				echo $rowStr;
         				$this->tpl->set_var("TDListBlock", $rowStr);
         				$this->tpl->set_var("PageNum", $page+1);
         				$this->tpl->parse("PageBlock", "Page", true);
         			}
         
         			foreach($this->tdArrayList as $tdRecord){
         				$this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
         				$this->tpl->set_var("class", $tdRecord["class"]);
         				$this->tpl->set_var("location", $tdRecord["location"]);
         				$this->tpl->set_var("year", $tdRecord["year"]);
         				$this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
         				$this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
         
         				$this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
         				$this->tpl->parse("TDListBlock", "TDList", true);
         				$this->formArray["tdYPosValue"]-=15;
         			}
         */
     }
     $this->setForm();
     /*
     $this->setPageDetailPerms();
     
     $this->tpl->set_var("uname", $this->user["uname"]);
     
     $this->tpl->set_var("today", date("F j, Y",strtotime($this->now)));
     
     $this->tpl->set_var("Session", $this->sess->url("").$this->sess->add_query(array("rptopID"=>$this->formArray["rptopID"],"ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
     */
     $this->tpl->set_var("today", date("F j, Y", strtotime($this->now)));
     $this->setLguDetails();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
     //		header("location: ".$testpdf->pdfPath);
     exit;
 }
 function getTDArrayFromCompany($companyID)
 {
     $this->setDB();
     $sql = sprintf("SELECT DISTINCT(Owner.odID) as odID" . " FROM Owner,OwnerCompany " . " WHERE " . " Owner.ownerID = OwnerCompany.ownerID AND " . " OwnerCompany.companyID = '%s' ", $companyID);
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $od = new OD();
         if ($od->selectRecord($this->db->f("odID"))) {
             $this->ODArray[] = $od;
             $afs = new AFS();
             if ($afs->selectRecord("", "", $od->getOdID(), "")) {
                 $td = new TD();
                 if ($td->selectRecord("", $afs->getAfsID(), "", "", "")) {
                     $tdArray[] = $td;
                 }
             }
         }
     }
     if (!is_array($tdArray)) {
         $tdArray = false;
     }
     return $tdArray;
 }
Example #14
0
 function getOdID($tdID)
 {
     $afsID = $this->getAfsID($tdID);
     $afs = new AFS();
     $afs->selectRecord($afsID);
     $odID = $afsID->odID;
     return $odID;
 }
 function Main()
 {
     //echo $this->formArray["formAction"];
     switch ($this->formArray["formAction"]) {
         case "delete":
             if (count($this->formArray["personID"]) > 0) {
                 $PersonList = new SoapObject(NCCBIZ . "PersonList.php", "urn:Object");
                 if (!($deletedRows = $PersonList->deleteRecord($this->formArray["personID"]))) {
                     $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");
             }
             if (count($this->formArray["companyID"]) > 0) {
                 $CompanyList = new SoapObject(NCCBIZ . "CompanyList.php", "urn:Object");
                 if (!($deletedRows = $CompanyList->deleteRecord($this->formArray["companyID"]))) {
                     $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");
             }
             header("location: ChangeOfOwnershipODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"])));
             exit;
             break;
         case "remove":
             if (count($this->formArray["personID"])) {
                 $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
                 if (!($deletedRows = $OwnerList->removeOwnerPerson($this->formArray["ownerID"], $this->formArray["personID"]))) {
                     $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");
             }
             if (count($this->formArray["companyID"]) > 0) {
                 $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
                 if (!($deletedRows = $OwnerList->removeOwnerCompany($this->formArray["ownerID"], $this->formArray["companyID"]))) {
                     $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");
             }
             header("location: ChangeOfOwnershipODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
     if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) {
         exit("xml failed");
     } else {
         //exit($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $od = new OD();
             $od->parseDomDocument($domDoc);
             foreach ($od as $key => $value) {
                 if ($key == "locationAddress" && is_object($value)) {
                     foreach ($value as $lkey => $lvalue) {
                         $this->formArray[$lkey] = $lvalue;
                     }
                 } else {
                     $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["landArea"] = number_format($od->getLandArea(), 4, '.', ',');
             $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
             $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
             //$OwnerList = new SoapObject(NCCBIZ."OwnerList.php", "urn:Object");
             $xmlStr = $od->owner->domDocument->dump_mem(true);
             if (!$xmlStr) {
                 //exit(print_r($OwnerList));
                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                 $this->tpl->set_var("OwnerListTableBlock", "");
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $this->displayOwnerList($domDoc);
                 }
             }
         }
     }
     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
     if (!($afsID = $AFSEncode->getAfsID($this->formArray["odID"]))) {
         //$this->tpl->set_block("rptsTemplate", "AFSDetails", "AFSDetailsBlock");
         //$this->tpl->set_var("AFSDetailsBlock", "");
         //echo "1afsID=".$afsID."=>".$this->formArray["odID"];
         $afs = new AFS();
         $afs->setOdID($this->formArray["odID"]);
         $afs->setDomDocument();
         $doc = $afs->getDomDocument();
         $xmlStr = $doc->dump_mem(true);
         //echo $xmlStr;
         if (!($afsID = $AFSEncode->saveAFS($xmlStr))) {
             echo "ret=" . $afsID;
         }
         //echo "<br>afsID=".$afsID;
     } else {
         //echo "2afsID=".$afsID."=>".$this->formArray["odID"];
         //$this->tpl->set_block("rptsTemplate", "AFSEncode", "AFSEncodeBlock");
         //$this->tpl->set_var("AFSEncodeBlock", "");
     }
     $this->formArray["afsID"] = $afsID;
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #16
0
 function Main()
 {
     //echo $this->formArray["formAction"];
     switch ($this->formArray["formAction"]) {
         case "delete":
             if (count($this->formArray["personID"]) > 0) {
                 $PersonList = new SoapObject(NCCBIZ . "PersonList.php", "urn:Object");
                 if (!($deletedRows = $PersonList->deleteRecord($this->formArray["personID"]))) {
                     $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");
             }
             if (count($this->formArray["companyID"]) > 0) {
                 $CompanyList = new SoapObject(NCCBIZ . "CompanyList.php", "urn:Object");
                 if (!($deletedRows = $CompanyList->deleteRecord($this->formArray["companyID"]))) {
                     $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");
             }
             header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"])));
             exit;
             break;
         case "remove":
             if (count($this->formArray["personID"])) {
                 $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
                 if (!($deletedRows = $OwnerList->removeOwnerPerson($this->formArray["ownerID"], $this->formArray["personID"]))) {
                     $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");
             }
             if (count($this->formArray["companyID"]) > 0) {
                 $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
                 if (!($deletedRows = $OwnerList->removeOwnerCompany($this->formArray["ownerID"], $this->formArray["companyID"]))) {
                     $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");
             }
             header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
     if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) {
         exit("xml failed");
     } else {
         //exit($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $od = new OD();
             $od->parseDomDocument($domDoc);
             foreach ($od as $key => $value) {
                 if ($key == "locationAddress" && is_object($value)) {
                     foreach ($value as $lkey => $lvalue) {
                         $this->formArray[$lkey] = $lvalue;
                     }
                 } else {
                     $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["landArea"] = number_format($od->getLandArea(), 4, '.', ',');
             // confirmation for double transaction
             $this->formArray["TRANSACTION_MAX_DAYDIFFERENCE"] = TRANSACTION_MAX_DAYDIFFERENCE;
             $this->formArray["dayDifference"] = getDateDifference($od->getDateCreated(), strtotime("now"), "d");
             $this->formArray["dayDifferenceText"] = getOnlyDays($this->formArray["dayDifference"]);
             $this->formArray["transactionCode"] = $od->getTransactionCode();
             $this->formArray["blockDoubleTransaction"] = $od->getArchive();
             $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
             $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
             //$OwnerList = new SoapObject(NCCBIZ."OwnerList.php", "urn:Object");
             $xmlStr = $od->owner->domDocument->dump_mem(true);
             if (!$xmlStr) {
                 //exit(print_r($OwnerList));
                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                 $this->tpl->set_var("OwnerListTableBlock", "");
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $this->displayOwnerList($domDoc);
                 }
             }
         }
     }
     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
     if (!($afsID = $AFSEncode->getAfsID($this->formArray["odID"]))) {
         //$this->tpl->set_block("rptsTemplate", "AFSDetails", "AFSDetailsBlock");
         //$this->tpl->set_var("AFSDetailsBlock", "");
         //echo "1afsID=".$afsID."=>".$this->formArray["odID"];
         $afs = new AFS();
         $afs->setOdID($this->formArray["odID"]);
         $afs->setDomDocument();
         $doc = $afs->getDomDocument();
         $xmlStr = $doc->dump_mem(true);
         //echo $xmlStr;
         if (!($afsID = $AFSEncode->saveAFS($xmlStr))) {
             echo "ret=" . $afsID;
         }
         //echo "<br>afsID=".$afsID;
     } else {
         //echo "2afsID=".$afsID."=>".$this->formArray["odID"];
         //$this->tpl->set_block("rptsTemplate", "AFSEncode", "AFSEncodeBlock");
         //$this->tpl->set_var("AFSEncodeBlock", "");
     }
     $this->displayODHistory();
     $this->formArray["afsID"] = $afsID;
     $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->sess->add_query(array("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #17
0
 function getTDListOf($id, $type, $year)
 {
     $owner = new Owner();
     //echo("\$ownerIDArray = \$owner->selectOwner".$type."(".$id.");");
     eval("\$ownerIDArray = \$owner->selectOwner" . $type . "(" . $id . ");");
     if ($ownerIDArray) {
         $odArray = "";
         foreach ($ownerIDArray as $key => $value) {
             eval("\$odID = \$owner->selectOD" . $type . "({$value});");
             if ($odID) {
                 $odArray[] = $odID;
             }
         }
         unset($owner);
         if ($odArray) {
             $afsArray = "";
             foreach ($odArray as $key => $value) {
                 $afs = new AFS();
                 $afsIDArray[] = $afs->checkAfsID($value);
             }
             unset($afs);
             if ($afsIDArray) {
                 $tdRecords = new TDRecords();
                 $tdIDArray = "";
                 foreach ($afsIDArray as $tkey => $tvalue) {
                     $td = new TD();
                     if ($td->selectRecord("", $tvalue, "", "", $year)) {
                         $tdIDArray[] = $td->getTdID();
                     }
                     unset($td);
                     /*
                     						$afs = new AFS;
                     						$afs->selectRecord($tvalue);
                     						//print_r($afs);
                     						//echo "<br>";
                     						$landArray = $afs->getLandArray();
                     						$plantsTreesArray = $afs->getPlantsTreesArray();
                     						$improvementsBuildingsArray = $afs->getImprovementsBuildingsArray();
                     						$machineriesArray = $afs->getMachineriesArray();
                     						unset($afs);
                     						if ($landArray){
                     							foreach($landArray as $lkey => $lvalue){
                     								//echo($lvalue->getPropertyID()."<br>");
                     								$td = new TD;
                     								if ($td->selectRecord("",$lvalue->getPropertyID(),"Land",$year)){
                     									$tdRecords->setArrayList($td);
                     									$tdIDArray[] = $td->getTdID();
                     								}
                     								unset($td);
                     							}
                     						}
                     						if ($plantsTreesArray){
                     							foreach($plantsTreesArray as $lkey => $lvalue){
                     								//echo($lvalue->getPropertyID()."<br>");
                     								$td = new TD;
                     								if ($td->selectRecord("",$lvalue->getPropertyID(),"PlantsTrees",$year)){
                     									$tdRecords->setArrayList($td);
                     									$tdIDArray[] = $td->getTdID();
                     								}
                     								unset($td);
                     							}
                     						}
                     						if ($improvementsBuildingsArray){
                     							foreach($improvementsBuildingsArray as $lkey => $lvalue){
                     								//echo($lvalue->getPropertyID()."<br>");
                     								$td = new TD;
                     								if ($td->selectRecord("",$lvalue->getPropertyID(),"ImprovementsBuildings",$year)){
                     									$tdRecords->setArrayList($td);
                     									$tdIDArray[] = $td->getTdID();
                     								}
                     								unset($td);
                     							}
                     						}
                     						if ($machineriesArray){
                     							foreach($machineriesArray as $lkey => $lvalue){
                     								//echo($lvalue->getPropertyID()."<br>");
                     								$td = new TD;
                     								if ($td->selectRecord("",$lvalue->getPropertyID(),"Machineries",$year)){
                     									$tdRecords->setArrayList($td);
                     									$tdIDArray[] = $td->getTdID();
                     								}
                     								unset($td);
                     							}
                     						}*/
                 }
                 $ret = $tdIDArray;
                 //print_r($tdRecords->getArrayList());
                 /*if ($tdRecords->getArrayList()){
                 			$tdRecords->setDomDocument();
                 			if(!$domDoc = $tdRecords->getDomDocument()){
                 				return $ret = false;
                 			}
                 			else {
                 				$xmlStr = $domDoc->dump_mem(true);
                 				return $ret = $xmlStr;
                 			}
                 		}
                 		else $ret = false;*/
             } else {
                 $ret = false;
             }
         } else {
             $ret = false;
         }
     } else {
         $ret = false;
     }
     return $ret;
 }
Example #18
0
 function RunGeneralRevision($odID, $userID = "", $transactionCode = "GR")
 {
     $newOdID = $this->CreateNewRPU_AFS_TD($odID, $userID, $transactionCode);
     // archive old OD
     $oldOD = new OD();
     $oldOD->selectRecord($odID);
     $oldOD->archive = "true";
     $oldOD->modifiedBy = $userID;
     $oldOD->updateRecord();
     // using archiveRecord 'might' be faster
     //$oldOD->archiveRecord($odID,"true",$userID);
     // update new OD/AFS
     $newAFS = new AFS();
     $newAFS->selectRecord($afsID = "", $limit = "", $newOdID);
     $newAFS->modifiedBy = $userID;
     $newAFS->effectivity = date("Y") + 1;
     $newAFS->updateRecord();
     return $newOdID;
 }
Example #19
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "save":
             $DueEncode = new SoapObject(NCCBIZ . "DueEncode.php", "urn:Object");
             if ($this->formArray["dueID"] != "") {
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 if (!($xmlStr = $DueDetails->getDue($this->formArray["dueID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $dueArray = $this->setDues();
                         foreach ($dueArray as $due) {
                             $doc = $due->getDomDocument();
                             $xmlStr = $doc->dump_mem(true);
                             if (!($ret = $DueEncode->updateDue($xmlStr))) {
                                 exit("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))) {
                         exit("error saving");
                     }
                     unset($doc);
                     unset($xmlStr);
                 }
             }
             $this->formArray["dueID"] = $ret;
             header("location: DueClose.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit($ret);
             break;
         default:
             // grab current tax rates from TreasurySettings
             $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();
             $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
             if (!($xmlStr = $TDDetails->getTD($this->formArray["tdID"]))) {
                 // xml failed
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     // domDoc empty
                 } else {
                     $td = new TD();
                     $td->parseDomDocument($domDoc);
                     $this->formArray["afsID"] = $td->getAfsID();
                     $this->formArray["taxDeclarationNumber"] = $td->getTaxDeclarationNumber();
                     $this->formArray["taxBeginsWithTheYear"] = $td->getTaxBeginsWithTheYear();
                 }
             }
             unset($xmlStr);
             unset($domDoc);
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 // xml failed
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     // domDoc empty
                 } else {
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $this->formArray["assessedValue"] = $afs->getTotalAssessedValue();
                     $this->formArray["taxability"] = $afs->getTaxability();
                     $this->formArray["effectivity"] = $afs->getEffectivity();
                     $this->formArray["propertyType"] = $td->getPropertyType();
                     $this->formArray["idle"] = "No";
                     if ($td->getPropertyType() == "Land") {
                         if (is_array($afs->landArray)) {
                             // if land is stripped
                             if (count($afs->landArray) > 1) {
                                 foreach ($afs->landArray as $land) {
                                     if ($land->getIdle() == "Yes") {
                                         $this->formArray["idle"] = "Yes";
                                         break;
                                     }
                                 }
                             } else {
                                 $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                             }
                         }
                     }
                     if ($this->formArray["idle"] == "") {
                         $this->formArray["idle"] = "No";
                     }
                 }
             }
             if ($this->formArray["dueID"] != "") {
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 if (!($xmlStr = $DueDetails->getDue($this->formArray["dueID"]))) {
                     echo "xml failed";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         echo "error xmlDoc";
                     } else {
                         $due = new Due();
                         $due->parseDomDocument($domDoc);
                         foreach ($due as $key => $value) {
                             switch ($key) {
                                 default:
                                     $this->formArray[$key] = $value;
                             }
                         }
                         $this->formArray["dueDate_str"] = date("F d, Y", strtotime($this->formArray["dueDate"]));
                         $this->formArray["taxDue"] = $due->getTaxDue();
                     }
                 }
             } else {
                 // select RPTOP taxable year from rptopID
                 $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
                 if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
                     exit("xml failed");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         exit("error domDoc");
                     } else {
                         $rptop = new RPTOP();
                         $rptop->parseDomDocument($domDoc);
                         $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                     }
                 }
                 // display default Due details
                 $this->formArray["dueDate"] = date("Y-n-d", strtotime($this->formArray["taxableYear"] . "-" . $treasurySettings->getAnnualDueDate()));
                 $this->formArray["dueDate_str"] = date("F d, Y", strtotime($this->formArray["dueDate"]));
                 $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.0;
                     $this->formArray["sefTax"] = 0.0;
                     $this->formArray["idleTax"] = 0.0;
                 }
                 $this->formArray["taxDue"] = $this->formArray["basicTax"] + $this->formArray["sefTax"] + $this->formArray["idleTax"];
             }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("dueID" => $this->formArray["dueID"], "tdID" => $this->formArray["tdID"], "rptopID" => $this->formArray["rptopID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #20
0
 function Main()
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
         exit("afs not found");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             exit("error xmlDoc");
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             $this->formArray["arpNumber"] = $afs->arpNumber;
             $this->formArray["propertyIndexNumber"] = $afs->propertyIndexNumber;
             $this->displayODAFS($this->formArray["afsID"]);
             $landList = $afs->getLandArray();
             if (count($landList)) {
                 $this->displayLandList($landList);
             }
             $plantsTreesList = $afs->getPlantsTreesArray();
             if (count($plantsTreesList)) {
                 $this->displayPlantsTreesList($plantsTreesList);
             }
         }
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
     //header("location: ".$testpdf->pdfPath);
     exit;
 }
Example #21
0
 function getAFS($afsID)
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($afsID))) {
         // error xmlStr
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             // error domDoc
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             return $afs;
         }
     }
 }
Example #22
0
 function Main()
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
         exit("afs not found");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             exit("error xmlDoc");
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             $this->displayODAFS($this->formArray["afsID"]);
             $this->formArray["propertyIndexNumber"] = $afs->propertyIndexNumber;
             //inserted this code for arpNumber - renonj
             $this->formArray["arpNumber"] = $afs->getArpNumber();
             $this->formArray["taxability"] = $afs->getTaxability();
             //Inserted by CHT 07292008
             if ($afs->getTaxability() == "Taxable") {
                 $this->formArray["isTaxable"] = "X";
                 $this->formArray["isExempt"] = "  ";
             } else {
                 if ($afs->getTaxability() == "Exempt") {
                     $this->formArray["isExempt"] = "X";
                     $this->formArray["isTaxable"] = "  ";
                 }
             }
             //End
             //land
             $landList = $afs->getLandArray();
             if (count($landList)) {
                 $this->displayLandList($landList);
             }
             //plantsTrees
             $plantsTreesList = $afs->getPlantsTreesArray();
             if (count($plantsTreesList)) {
                 $this->displayPlantsTreesList($plantsTreesList);
             }
             //improvementsBuildings
             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
             if (count($improvementsBuildingsList)) {
                 $this->displayImprovementsBuildingsList($improvementsBuildingsList);
             }
             //machineries
             $machineriesList = $afs->getMachineriesArray();
             if (count($machineriesList)) {
                 $this->displayMachineriesList($machineriesList);
             }
             $this->displayAssessedValues($landList, $plantsTreesList, $improvementsBuildingsList, $machineriesList);
             $this->displayLGUInfo();
         }
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF("TDSummary.pdf");
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF("TDSummary.pdf");
     }
     //		header("location: ".$testpdf->pdfPath);
     exit;
 }
Example #23
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             if (count($this->formArray["landID"])) {
                 //print_r($this->formArray["landID"]);
                 $LandList = new SoapObject(NCCBIZ . "LandList.php", "urn:Object");
                 if (!($deletedRows = $LandList->removeLand($this->formArray["landID"]))) {
                     $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");
             }
             if (count($this->formArray["plantsTreesID"])) {
                 //print_r($this->formArray["plantsTreesID"]);
                 $PlantsTreesList = new SoapObject(NCCBIZ . "PlantsTreesList.php", "urn:Object");
                 if (!($deletedRows = $PlantsTreesList->removePlantsTrees($this->formArray["plantsTreesID"]))) {
                     $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");
             }
             if (count($this->formArray["machineriesID"])) {
                 //print_r($this->formArray["machineriesID"]);
                 $MachineriesList = new SoapObject(NCCBIZ . "MachineriesList.php", "urn:Object");
                 if (!($deletedRows = $MachineriesList->removeMachineries($this->formArray["machineriesID"]))) {
                     $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");
             }
             if (count($this->formArray["improvementsBuildingsID"])) {
                 //print_r($this->formArray["improvementsBuildingsID"]);
                 $ImprovementsBuildingsList = new SoapObject(NCCBIZ . "ImprovementsBuildingsList.php", "urn:Object");
                 if (!($deletedRows = $ImprovementsBuildingsList->removeImprovementsBuildings($this->formArray["improvementsBuildingsID"]))) {
                     $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");
             }
             if (count($this->formArray["storeyID"])) {
                 //print_r($this->formArray["storeyID"]);
                 $StoreyList = new SoapObject(NCCBIZ . "StoreyList.php", "urn:Object");
                 if (!($deletedRows = $StoreyList->removeStorey($this->formArray["storeyID"]))) {
                     $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");
             }
             header("location: AFSDetails.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
         $this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
         $this->tpl->set_var("AFSTableBlock", "afs not found");
     } else {
         //echo $xmlStr;
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             //print_r($afs);
             foreach ($afs as $key => $value) {
                 $this->formArray[$key] = $value;
                 $this->formArray["totalMarketValue"] = 0;
                 $this->formArray["totalAssessedValue"] = 0;
             }
             // RPU Identification Numbers
             $this->displayRPUIdentification($afs);
             $landList = $afs->getLandArray();
             $plantsTreesList = $afs->getPlantsTreesArray();
             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
             $machineriesList = $afs->getMachineriesArray();
             if (count($landList)) {
                 $hideTD = false;
                 $this->formArray["propertyType"] = "Land";
                 $this->displayLandPlantsTrees($landList, $plantsTreesList);
                 $this->hideProperty('ImprovementsBuildings', 'improvementsBuildings');
                 $this->hideProperty('Machineries', 'machineries');
             } else {
                 if (count($plantsTreesList)) {
                     $hideTD = false;
                     $this->formArray["propertyType"] = "Land";
                     $this->displayLandPlantsTrees($landList, $plantsTreesList);
                     $this->hideProperty('ImprovementsBuildings', 'improvementsBuildings');
                     $this->hideProperty('Machineries', 'machineries');
                 } else {
                     if (count($improvementsBuildingsList)) {
                         $hideTD = false;
                         $this->formArray["propertyType"] = "ImprovementsBuildings";
                         $this->displayImprovementsBuildings($improvementsBuildingsList);
                         $this->hideProperty('Land', 'land');
                         $this->hideProperty('PlantsTrees', 'plantsTrees');
                         $this->hideProperty('Machineries', 'machineries');
                     } else {
                         if (count($machineriesList)) {
                             $hideTD = false;
                             $this->formArray["propertyType"] = "Machineries";
                             $this->displayMachineries($machineriesList);
                             $this->hideProperty('Land', 'land');
                             $this->hideProperty('PlantsTrees', 'plantsTrees');
                             $this->hideProperty('ImprovementsBuildings', 'improvementsBuildings');
                         } else {
                             $hideTD = true;
                             $this->displayLandPlantsTrees($landList, $plantsTreesList);
                             $this->displayImprovementsBuildingsMachineries($improvementsBuildingsList, $machineriesList);
                             $this->formArray["landTotalMarketValue"] = 0;
                             $this->formArray["landTotalAssessedValue"] = 0;
                             $this->formArray["plantTotalMarketValue"] = 0;
                             $this->formArray["plantTotalAssessedValue"] = 0;
                             $this->formArray["bldgTotalMarketValue"] = 0;
                             $this->formArray["bldgTotalAssessedValue"] = 0;
                             $this->formArray["machTotalMarketValue"] = 0;
                             $this->formArray["machTotalAssessedValue"] = 0;
                         }
                     }
                 }
             }
             if ($hideTD == false) {
                 // Display TD
                 $this->displayTD($afs->afsID);
             } else {
                 // Hide TD
                 $this->tpl->set_block("rptsTemplate", "DeclarationOfProperty", "DeclarationOfPropertyBlock");
                 $this->tpl->set_var("DeclarationOfPropertyBlock", "");
             }
             $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
             if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) {
                 exit("xml failed");
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $od = new OD();
                     $od->parseDomDocument($domDoc);
                     foreach ($od as $key => $value) {
                         if ($key == "locationAddress" && is_object($value)) {
                             foreach ($value as $lkey => $lvalue) {
                                 $this->formArray[$lkey] = $lvalue;
                             }
                         } else {
                             $this->formArray[$key] = $value;
                         }
                     }
                     $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
                     $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
                     $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
                     if (!($xmlStr = $OwnerList->getOwnerList($this->formArray["ownerID"]))) {
                         //exit(print_r($OwnerList));
                         $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                         $this->tpl->set_var("OwnerListTableBlock", "");
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                         } else {
                             $this->displayOwnerList($domDoc);
                         }
                     }
                 }
             }
         }
     }
     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
     $afs = new AFS();
     $afs->selectRecord($this->formArray["afsID"]);
     $afs->setAfsID($this->formArray["afsID"]);
     $afs->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
     $afs->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
     $afs->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
     $afs->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
     $afs->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
     $afs->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
     $afs->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
     $afs->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
     $afs->setTotalMarketValue($this->formArray["totalMarketValue"]);
     $afs->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
     $afs->setDomDocument();
     $doc = $afs->getDomDocument();
     $xmlStr = $doc->dump_mem(true);
     //print_r($AFSEncode);
     //echo $xmlStr;
     if (!($ret = $AFSEncode->updateAFS($xmlStr))) {
         echo "ret=" . $ret;
     }
     //echo $ret;
     $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->sess->add_query(array("afsID" => $this->formArray["afsID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #24
0
 function setDetails()
 {
     global $sess;
     # set the RPTOP to get the owner's object and information
     # get it from POST if possible, otherwise from GET
     $rptopID = isset($_POST['rptopID']) ? $_POST['rptopID'] : $_GET['rptopID'];
     //$rptopID = 14;
     $rptop = new RPTOP();
     $rptop->selectRecord($rptopID);
     $amountPaid = str_replace(",", "", $_POST['amountPaid']);
     $dateDue = $rptop->getTaxableYear();
     # must be a usable format
     $formValues['datePaid'] = date("F j, Y");
     $pORDate = $_POST['prevORDate'];
     if ($pORDate) {
         list($pmonth, $pday, $pyear) = explode("-", $pORDate);
         $formValues['porMonth'] = date("F", mktime(0, 0, 0, $pmonth + 1, 0, 0));
         $formValues['porYear'] = $pyear;
         $formValues['porDay'] = $pday;
     } else {
         $formValues['porMonth'] = "";
         $formValues['porYear'] = "";
         $formValues['porDay'] = "";
     }
     $formValues['orYear'] = substr($rptop->getTaxableYear(), 2);
     $formValues['orMonth'] = date("F");
     $formValues['orDay'] = date("j");
     $formValues['taxableYear'] = $rptop->getTaxableYear();
     $formValues['rptopNum'] = $rptop->getRptopNumber();
     $formValues['prevORNum'] = $_POST['prevORNum'];
     $formValues['orNum'] = $_POST['receiptNo'];
     $formValues['kindOfPayment'] = $_POST['kindOfPayment'];
     $formValues['checkNumber'] = $_POST['checkNum'];
     $formValues['checkDate'] = $_POST['checkDate'];
     # set the specific TD (although this is in the RPTOP), hard to search for it.
     # get the tdID from POST or GET to initialize the TD
     $tdID = isset($_POST['tdID']) ? $_POST['tdID'] : $_GET['tdID'];
     //$tdID = array(2,1);
     //$ownerID=5;
     $td = new TD();
     $ctr = 0;
     # $this->tpl->set_block('step3','PrintTDID','PrintTDIDs');
     //$this->tpl->set_block('step3','TDID','TDIDs');
     $this->tpl->set_block('receipt', 'Property', 'Properties');
     $this->tpl->set_block('Property', 'Owner', 'Owners');
     $n = 165;
     if (is_array($tdID)) {
         foreach ($tdID as $key => $id) {
             # set/pass tdIDs to form
             $this->tpl->set_var(tdID, $id);
             $this->tpl->parse('TDIDs', 'TDID', 'true');
             $td->selectRecord($id);
             $tdNum = $td->getTaxDeclarationNumber();
             $afs = new AFS();
             $formValues['tdNum'] = $tdNum;
             $afs->selectRecord($td->getAfsID());
             $od = new OD();
             $od->selectRecord($afs->getOdID());
             $addr = $od->getLocationAddress();
             # get municipality/province and city(same for all tds)
             //$lotAddress = new LocationAddress;
             //$lotAddress->selectRecordFromTdID($id);
             //$formValues['province'] = $lotAddress->getProvince();
             //$formValues['city'] = $lotAddress->getMunicipalityCity();
             $formValues['city'] = $addr->getMunicipalityCity();
             $formValues['province'] = $addr->getProvince();
             $formValues['municipalityCityID'] = $addr->getMunicipalityCityID();
             # get location/ block and lot number OR Barangay
             #$formValues['lotAddress'] = $lotAddress->getFullAddress();
             $formValues['lotAddress'] = $addr->getNumber . " " . $addr->getStreet();
             if ($formValues['lotAddress'] == "") {
                 $formValues['lotAddress'] = $addr->getBarangay();
             }
             $propertyType = $td->getPropertyType();
             $propertyID = $td->getPropertyID();
             $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
             $formAssessedValue = number_format($td->getAssessedValue(), 2);
             # separate assessed value of land and others(plantsTrees, improvementsBuildings, machineries)
             if ($propertyType == "Land") {
                 $formValues['assessedValueLand'] = $formAssessedValue;
                 $formValues['assessedValueOthers'] = "";
             } else {
                 $formValues['assessedValueLand'] = "";
                 $formValues['assessedValueOthers'] = $formAssessedValue;
             }
             $formValues['assessedValue'] = $formAssessedValue;
             $formValues['propertyType'] = $propertyType;
             # set the owner's List
             # we define the owner from the RPTOP
             $ownerSwitch = true;
             if ($ctr > 0) {
                 $ownerValues['ownerName'] = "";
                 $ownerValues['ownerAddress'] = "";
                 $this->tpl->set_var($ownerValues);
                 $this->tpl->parse(Owners, Owner, false);
             } else {
                 $owner = $rptop->getOwner();
                 $personArray = $owner->getPersonArray();
                 if (is_array($personArray)) {
                     foreach ($personArray as $person) {
                         $ownerValues['ownerKey'] = "personID";
                         $ownerValues['ownerScript'] = "PersonDetails.php";
                         $ownerValues['ownerID'] = $person->getPersonID();
                         $ownerValues['ownerName'] = $person->getLastName() . ", " . $person->getFirstName() . " " . $person->getMiddleName();
                         /*$addressArray = $person->getAddressArray();
                           $address = $addressArray[0];
                         		$ownerValues['ownerAddress'] = $address->getNumber()." ".
                             		                           $address->getStreet()."<br>".
                           		  		                           $address->getBarangay().", ".
                               		   		                       $address->getMunicipalityCity()."<br>".
                                   		   		                   $address->getProvince();*/
                         $this->tpl->set_var($ownerValues);
                         $this->tpl->parse('Owners', 'Owner', 'true');
                     }
                 }
                 $companyArray = $owner->getCompanyArray();
                 if (is_array($companyArray)) {
                     foreach ($companyArray as $company) {
                         $ownerValues['cownerKey'] = "companyID";
                         $ownerValues['cownerScript'] = "CompanyDetails.php";
                         $ownerValues['cownerID'] = $company->getCompanyID();
                         $ownerValues['cownerName'] = $company->getCompanyName();
                         /*$addressArray = $company->getAddressArray();
                           $address = $addressArray[0];
                          	$ownerValues['ownerAddress'] = $address->getNumber()." ".
                            	    	                           $address->getStreet()."<br>".
                          		    	    	                       $address->getBarangay().", ".
                              		    	    	                   $address->getMunicipalityCity()."<br> ".
                                  		    	    	               $address->getProvince();
                                  */
                         $this->tpl->set_var($ownerValues);
                         $this->tpl->parse('Owners', 'Owner', 'true');
                     }
                 }
                 if (is_array($personArray)) {
                     if (count($personArray) > 1) {
                         $receivedFrom = $personArray[0]->getFirstName() . " " . $personArray[0]->getMiddleName() . " " . $personArray[0]->getLastName() . " et al.";
                     } else {
                         $receivedFrom = $personArray[0]->getFirstName() . " " . $personArray[0]->getMiddleName() . " " . $personArray[0]->getLastName();
                     }
                 } else {
                     if (is_array($companyArray)) {
                         if (count($companyArray) > 1) {
                             $receivedFrom = $companyArray[0]->getCompanyName() . " et al.";
                         } else {
                             $receivedFrom = $companyArray[0]->getCompanyName();
                         }
                     }
                 }
                 $formValues['receivedFrom'] = $receivedFrom;
             }
             //end if ($ctr > 0)
             # tax dues are defined from TDNumber and taxableYear
             # compute for taxes; to create dues obj pass tdID and due date (where due date is beginning of taxable year) -- 14 Aug 2003
             //     $taxDue = new Dues($id,$dateDue,$assessedValue);
             $taxDue = new Dues();
             /*		    if(!$taxDue->create($id,$dateDue)){
                    		    $taxDue->setBasic($assessedValue);
                        		$taxDue->setSEF($assessedValue);
             				# check if land is idle, if yes, set assessed value
             				if($taxDue->getIdleStatus() == 1){
             					$taxDue->setIdle($assessedValue);
             					$idleStatus = 1;
             				}else{
             					$taxDue->setIdle(0);
             					$idleStatus = 0;
             				}
                     	}
             */
             $dateDue = $td->getTaxBeginsWithTheYear();
             $taxDue = new Dues($id, $dateDue);
             if (!$taxDue->create($id, $dateDue)) {
                 $taxDue->setBasic($assessedValue);
                 $taxDue->setSEF($assessedValue);
                 $taxDue->setIsDiscount(0);
                 # check if land is idle, if yes, set assessed value
                 # getIdleStatus -- temporary function
                 if ($taxDue->getIdleStatus() == 1) {
                     #echo("idle<br>");
                     $taxDue->setIdle($assessedValue);
                 }
             } else {
                 $taxDue->setIsDiscount($dateDue == date("Y") && date("n") <= $taxDue->discountPeriod && $taxDue->getPaymentMode() == "Annual");
             }
             $paymentPeriod = $_POST['paymentPeriod'];
             # set amnesty to object
             //$amnesty = $_POST['amnesty'];
             //$taxDue->setAmnesty($amnesty=="Yes");
             //	$taxDue->store();
             $totalTaxDue = $taxDue->getTotalDue($paymentPeriod);
             $totalAmount = $taxDue->getTotalDue($paymentPeriod);
             //    $paymentPeriod= "Annual";
             /*    	    if(isset($_POST['paymentPeriod'])){
                     	    $paymentPeriod = $_POST['paymentPeriod'];
             				
                     	}*/
             $formValues['paymentPeriod'] = $paymentPeriod;
             $this->tpl->set_var($formValues);
             ## Compute taxes and set the page values
             //$totalTaxDue = $taxDue->getTotalDue($paymentPeriod);
             $interest = $taxDue->getPctPenalty();
             if ($interest > 0 && $paymentPeriod != "Annual") {
                 $paymentPeriod = "Annual";
             }
             $basic = $taxDue->getBalanceBasic($paymentPeriod);
             $sef = $taxDue->getBalanceSEF($paymentPeriod);
             $idle = $taxDue->getBalanceIdle($paymentPeriod);
             $discount = $taxDue->getDiscount($basic + $sef);
             $penalty = $taxDue->getBalancePenalty($paymentPeriod);
             $taxValues['idleStatus'] = $idleStatus == 0 ? "" : "(I)";
             $taxValues['basic'] = number_format($basic, 2);
             $taxValues['sef'] = number_format($sef, 2);
             $taxValues['pd1185'] = number_format(0.0, 2);
             $taxValues['subTotal'] = number_format($totalTaxDue, 2);
             $taxValues['periodTotal'] = number_format($basic + $sef + $idle, 2);
             $taxValues['interest'] = number_format($interest * 100.0, 1) . "%";
             $taxValues['penalty'] = number_format($interest * 100, 0);
             $taxValues['discount'] = number_format($discount * 100.0, 1) . "%";
             $taxValues['totBasic'] = number_format($basic * (1 + $interest), 2);
             $taxValues['totSEF'] = number_format($sef * (1 + $interest), 2);
             $taxValues['totPD1185'] = number_format(0, 2);
             $taxValues['totSubTotal'] = number_format(round($totalTaxDue, 2), 2);
             $taxValues['grandTotal'] = number_format($totalTaxDue, 2);
             # further breakdown of basic tax for RPT Receipt
             $taxValues['gf'] = number_format($basic * 0.7, 2);
             // 70% of basic
             $taxValues['ib'] = number_format($basic * 0.15, 2);
             // 15% of basic
             $taxValues['cb'] = number_format($basic * 0.15, 2);
             // 15% of basic for a total if 100%
             $taxValues['totGF'] = number_format($basic * 0.7 * (1 + $interest), 2);
             $taxValues['totIB'] = number_format($basic * 0.15 * (1 + $interest), 2);
             $taxValues['totCB'] = number_format($basic * 0.15 * (1 + $interest), 2);
             if ($paymentPeriod == "Annual") {
                 $this->tpl->set_var("fullPmt", $taxValues['subTotal']);
                 $this->tpl->set_var("partialPmt", "");
                 # get full payment total
                 $fullPmtTotal += str_replace(",", "", $taxValues['subTotal']);
                 $this->tpl->set_var("fullPmtTotal", number_format($fullPmtTotal, 2));
             } else {
                 $this->tpl->set_var("partialPmt", $taxValues['subTotal']);
                 $this->tpl->set_var("num", ceil(date("n") / 3));
                 $this->tpl->set_var("fullPmt", "");
                 # get partial payment total
                 $partialPmtTotal += str_replace(",", "", $taxValues['subTotal']);
                 $this->tpl->set_var("partialPmtTotal", number_format($partialPmtTotal, 2));
             }
             $this->tpl->set_var($taxValues);
             $this->tpl->parse('Properties', 'Property', 'true');
             $ctr++;
             # get totals for penalty and grand total
             # $penaltyTotal += ($basic*$interest); -- removed bec penalty in percent
             $total += $totalTaxDue;
             # $this->tpl->set_var("penaltyTotal", number_format($penaltyTotal,2));
         }
     }
     # end foreach
     if ($total > $totalTaxDue) {
         $totalTaxDue = $total;
     }
     // if backtaxTDCheckbox is checked
     if ($_POST['backtaxTDCheckbox'] && $_POST['backtaxTDCheckbox'] != "") {
         $totalTaxDue += $this->displayBacktaxTD($ownerSwitch);
         $fullPmtTotal = $totalTaxDue;
         $this->tpl->set_var("fullPmtTotal", number_format($fullPmtTotal, 2));
     }
     # if amnesty checked/unchecked form will submit, set kind of payment and other details
     /*switch($formValues['kindOfPayment']){
     			case 'check':
     				$this->tpl->set_var("selectedCheck","selected");
     				$this->tpl->set_var("disabledOn","");
     				$this->tpl->set_var("checkNum",$formValues['checkNum']);
     				$this->tpl->set_var("checkDate",$formValues['checkDate']);
     				break;
     			case 'treasury note':
     				$this->tpl->set_var("selectedTNote","selected");
     				$this->tpl->set_var("disabledOn","disabled");
     				$this->tpl->set_var("checkNum","");
     				$this->tpl->set_var("checkDate","");
     				break;
     			case 'cash':
     			default:
     				$this->tpl->set_var("selectedCash","selected");
     				$this->tpl->set_var("disabledOn","disabled");
     				$this->tpl->set_var("checkNum","");
     				$this->tpl->set_var("checkDate","");								
     				break;
     		}*/
     # get totals in words
     $amountPaid = $amountPaid ? number_format($amountPaid, 2) : number_format($total, 2);
     $this->tpl->set_var("total", number_format($total, 2));
     $this->tpl->set_var("amountPaid", $amountPaid);
     $this->tpl->set_var("balance", $total - $amountPaid);
     $numToWords = new NumbersToWords();
     $totalInWords = $numToWords->num_to_string(number_format(str_replace(",", "", $amountPaid), 2));
     $this->tpl->set_var("totalInWords", $totalInWords);
     //$this->tpl->set_var("amnestyChecked", ($formValues['amnesty']=="Yes") ? " checked" : "");
     //if(!isset($_POST['printReceipt_x']))
     //  	$this->tpl->set_var("Session", $sess->url(""));
 }
 function getPropertyClassificationFromTD($tdID)
 {
     $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
     if (!($xmlStr = $TDDetails->getTD($tdID))) {
         return false;
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             return false;
         } else {
             $td = new TD();
             $td->parseDomDocument($domDoc);
             $afsID = $td->getAfsID();
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($afsID))) {
                 return false;
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     return false;
                 } else {
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $LandActualUsesDetails = new SoapObject(NCCBIZ . "LandActualUsesDetails.php", "urn:Object");
                     $PlantsTreesActualUsesDetails = new SoapObject(NCCBIZ . "PlantsTreesActualUsesDetails.php", "urn:Object");
                     $ImprovementsBuildingsActualUsesDetails = new SoapObject(NCCBIZ . "ImprovementsBuildingsActualUsesDetails.php", "urn:Object");
                     $MachineriesActualUsesDetails = new SoapObject(NCCBIZ . "MachineriesActualUsesDetails.php", "urn:Object");
                     if (is_array($afs->landArray)) {
                         foreach ($afs->landArray as $land) {
                             $landActualUsesID = $land->getActualUse();
                             if ($xmlStr = $LandActualUsesDetails->getLandActualUsesDetails($landActualUsesID)) {
                                 if ($domDoc = domxml_open_mem($xmlStr)) {
                                     $landActualUses = new LandActualUses();
                                     $landActualUses->parseDomDocument($domDoc);
                                     return $landActualUses->getReportCode();
                                 }
                             }
                         }
                     } else {
                         if (is_array($afs->plantsTreesArray)) {
                             foreach ($afs->plantsTreesArray as $plantsTrees) {
                                 $plantsTreesActualUsesID = $plantsTrees->getActualUse();
                                 if ($xmlStr = $PlantsTreesActualUsesDetails->getPlantsTreesActualUsesDetails($plantsTreesActualUsesID)) {
                                     if ($domDoc = domxml_open_mem($xmlStr)) {
                                         $plantsTreesActualUses = new PlantsTreesActualUses();
                                         $plantsTreesActualUses->parseDomDocument($domDoc);
                                         return $plantsTreesActualUses->getReportCode();
                                     }
                                 }
                             }
                         } else {
                             if (is_array($afs->improvementsBuildingsArray)) {
                                 foreach ($afs->improvementsBuildingsArray as $improvementsBuildings) {
                                     $improvementsBuildingsActualUsesID = $improvementsBuildings->getActualUse();
                                     if ($xmlStr = $ImprovementsBuildingsActualUsesDetails->getImprovementsBuildingsActualUsesDetails($improvementsBuildingsActualUsesID)) {
                                         if ($domDoc = domxml_open_mem($xmlStr)) {
                                             $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                             $improvementsBuildingsActualUses->parseDomDocument($domDoc);
                                             return $improvementsBuildingsActualUses->getReportCode();
                                         }
                                     }
                                 }
                             } else {
                                 if (is_array($afs->machineriesArray)) {
                                     foreach ($afs->machineriesArray as $machineries) {
                                         $machineriesActualUsesID = $machineries->getActualUse();
                                         if ($xmlStr = $MachineriesActualUsesDetails->getMachineriesActualUsesDetails($machineriesActualUsesID)) {
                                             if ($domDoc = domxml_open_mem($xmlStr)) {
                                                 $machineriesActualUses = new MachineriesActualUses();
                                                 $machineriesActualUses->parseDomDocument($domDoc);
                                                 return $machineriesActualUses->getReportCode();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     return true;
                 }
             }
         }
     }
 }
Example #26
0
 function displayRecords()
 {
     $this->selectRecords();
     $this->tpl->set_block("rptsTemplate", "OwnerPersonList", "OwnerPersonListBlock");
     $this->tpl->set_block("OwnerPersonList", "ODList", "ODListBlock");
     foreach ($this->arrayList as $person) {
         $this->tpl->set_var("personID", $person->getPersonID());
         $this->tpl->set_var("lastName", $person->getLastName());
         $this->tpl->set_var("firstName", $person->getFirstName());
         $this->tpl->set_var("middleName", $person->getMiddleName());
         $this->tpl->set_var("gender", $person->getGender());
         $this->tpl->set_var("birthday", $person->getBirthday());
         $this->tpl->set_var("maritalStatus", $person->getMaritalStatus());
         $this->tpl->set_var("tin", $person->getTin());
         $this->tpl->set_var("telephone", $person->getTelephone());
         $this->tpl->set_var("mobileNumber", $person->getMobileNumber());
         $this->tpl->set_var("email", $person->getEmail());
         if (is_array($person->addressArray)) {
             $address = $person->addressArray[0];
             $this->tpl->set_var("address", $address->getFullAddress());
         }
         // capture OD, AFS, and TD info
         $this->setDB();
         $sql = sprintf("SELECT DISTINCT(Owner.odID) as odID" . " FROM Owner,OwnerPerson " . " WHERE " . " Owner.ownerID = OwnerPerson.ownerID AND " . " OwnerPerson.personID = '%s' ", $person->getPersonID());
         $this->db->query($sql);
         while ($this->db->next_record()) {
             $od = new OD();
             if ($od->selectRecord($this->db->f("odID"))) {
                 $this->ODArray[] = $od;
                 $this->tpl->set_var("odID", $od->getOdID());
                 if (is_object($od->locationAddress)) {
                     $this->tpl->set_var("locationAddress", $od->locationAddress->getFullAddress());
                 } else {
                     $this->tpl->set_var("locationAddress", "");
                 }
                 $afs = new AFS();
                 if ($afs->selectRecord("", "", $od->getOdID(), "")) {
                     $this->tpl->set_var("afsID", $afs->getAfsID());
                     $this->tpl->set_var("propertyIndexNumber", $afs->getPropertyIndexNumber());
                     $this->tpl->set_var("arpNumber", $afs->getArpNumber());
                     if (is_array($afs->landArray)) {
                         $this->displayLandList($afs->landArray);
                     }
                     if (is_array($afs->plantsTreesArray)) {
                         $this->displayPlantsTreesList($afs->plantsTreesArray);
                     }
                     if (is_array($afs->improvementsBuildingsArray)) {
                         $this->displayImprovementsBuildingsList($afs->improvementsBuildingsArray);
                     }
                     if (is_array($afs->machineriesArray)) {
                         $this->displayMachineriesList($afs->machineriesArray);
                     }
                     $td = new TD();
                     if ($td->selectRecord("", $afs->getAfsID(), "", "", "")) {
                         $this->tpl->set_var("tdID", $td->getTdID());
                         $this->tpl->set_var("taxDeclarationNumber", $td->getTaxDeclarationNumber());
                         $this->tpl->set_var("propertyType", $td->getPropertyType());
                     }
                 }
                 unset($td);
                 unset($afs);
                 unset($od);
                 $this->tpl->parse("ODListBlock", "ODList", true);
             }
         }
         $this->tpl->parse("OwnerPersonListBlock", "OwnerPersonList", true);
         $this->tpl->set_var("ODListBlock", "");
         $this->clearPropertyElements();
         unset($this->ODArray);
         unset($this->AFSArray);
         unset($this->TDArray);
         unset($this->db);
     }
 }
Example #27
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")";
             $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
             if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) {
                 if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                     //echo "SOAP failed";
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     //select
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             //print_r($rptop);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID());
                             $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName());
                             $this->formArray["cityAssessorName"] = $cityAssessor->getFullName();
                         } else {
                             $cityAssessor = $value;
                             $this->tpl->set_var("cityAssessorID", $cityAssessor);
                             $this->tpl->set_var("cityAssessorName", $cityAssessor);
                             $this->formArray["cityAssessorName"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID());
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName());
                             $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName();
                         } else {
                             $cityTreasurer = $value;
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer);
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer);
                             $this->formArray["cityTreasurerName"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $tdCtr = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             /*
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             */
                             foreach ($value as $tkey => $tvalue) {
                                 //foreach($tvalue as $column => $val){
                                 //	$this->tpl->set_var($column,$val);
                                 //}
                                 $this->tpl->set_var("taxDeclarationNumber", $tvalue->getTaxDeclarationNumber());
                                 $this->tpl->set_var("afsID", $tvalue->getAfsID());
                                 $this->tpl->set_var("cancelsTDNumber", $tvalue->getCancelsTDNumber());
                                 $this->tpl->set_var("canceledByTDNumber", $tvalue->getCanceledByTDNumber());
                                 $this->tpl->set_var("taxBeginsWithTheYear", $tvalue->getTaxBeginsWithTheYear());
                                 $this->tpl->set_var("ceasesWithTheYear", $tvalue->getCeasesWithTheYear());
                                 $this->tpl->set_var("enteredInRPARForBy", $tvalue->getEnteredInRPARForBy());
                                 $this->tpl->set_var("enteredInRPARForYear", $tvalue->getEnteredInRPARForYear());
                                 $this->tpl->set_var("previousOwner", $tvalue->getPreviousOwner());
                                 $this->tpl->set_var("previousAssessedValue", $tvalue->getPreviousAssessedValue());
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getProvincialAssessorDate());
                                 $this->tpl->set_var("pa_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("pa_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("pa_dayValue", removePreZero($dateArr["day"]));
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getCityMunicipalAssessorDate());
                                 $this->tpl->set_var("cm_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("cm_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("cm_dayValue", removePreZero($dateArr["day"]));
                                 $this->tpl->set_var("provincialAssessorName", $tvalue->provincialAssessor);
                                 $this->tpl->set_var("cityMunicipalAssessorName", $tvalue->cityMunicipalAssessor);
                                 //$this->tpl->set_var("assessedValue",$tvalue->getAssessedValue());
                                 $this->tpl->set_var("basicTax", "");
                                 $this->tpl->set_var("sefTax", "");
                                 $this->tpl->set_var("total", "");
                                 //$this->tpl->set_var("basicTax",$tvalue->getBasicTax());
                                 //$this->tpl->set_var("sefTax",$tvalue->getSefTax());
                                 //$this->tpl->set_var("total",$tvalue->getTotal());
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFSForList($tvalue->getAfsID()))) {
                                     //$this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                                     //$this->tpl->set_var("AFSTableBlock", "afs not found");
                                 } else {
                                     //echo $xmlStr;
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         //$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                         //$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue();
                                         $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue();
                                         $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                         $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                     }
                                 }
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("defaultTDListBlock", "defaultTDList", true);
                                 $this->tpl->parse("toggleTDListBlock", "toggleTDList", true);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 /*
                                 $this->tpl->set_var("LandBlock", "");
                                 $this->tpl->set_var("PlantsTreesBlock", "");
                                 $this->tpl->set_var("ImprovementsBuildingsBlock", "");
                                 $this->tpl->set_var("MachineriesBlock", "");
                                 */
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("defaultTDListBlock", "//no default");
                             $this->tpl->set_var("toggleTDListBlock", "//no Toggle");
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     case "landTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "landTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
             $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
             unset($rptop);
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             $rptop = new RPTOP();
             $rptop->setRptopID($this->formArray["rptopID"]);
             $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
             $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
             $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
             $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
             $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
             $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
             $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
             $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
             $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]);
             $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
             $rptop->setCreatedBy($this->userID);
             $rptop->setModifiedBy($this->userID);
             $rptop->setDomDocument();
             $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object");
             $rptop->setDomDocument();
             $doc = $rptop->getDomDocument();
             $xmlStr = $doc->dump_mem(true);
             //echo $xmlStr;
             if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) {
                 echo "ret=" . $ret;
             }
             //echo $ret;
         }
     }
     $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->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
 function getTDNumberListLine($td)
 {
     if (is_object($td)) {
         $tdNumber = $td->getTaxDeclarationNumber();
         $propertyType = $td->getPropertyType();
         $afsID = $td->getAfsID();
         // get classification
         $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
         if (!($xmlStr = $AFSDetails->getAFS($afsID))) {
             $classification = "";
         } else {
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 $classification = "";
             } else {
                 $afs = new AFS();
                 $afs->parseDomDocument($domDoc);
                 switch ($propertyType) {
                     case "ImprovementsBuildings":
                         $improvementsBuildingsArray = $afs->getImprovementsBuildingsArray();
                         if (is_array($improvementsBuildingsArray)) {
                             $classification = $improvementsBuildingsArray[0]->getActualUse();
                             if (is_numeric($classification)) {
                                 $classification = $this->getImprovementsBuildingsActualUsesText($classification);
                             }
                         }
                         break;
                     case "Machineries":
                         $machineriesArray = $afs->getMachineriesArray();
                         if (is_array($machineriesArray)) {
                             $classification = $machineriesArray[0]->getActualUse();
                             if (is_numeric($classification)) {
                                 $classification = $this->getMachineriesActualUsesText($classification);
                             }
                         }
                         break;
                     case "Land":
                     default:
                         $landArray = $afs->getLandArray();
                         $plantsTreesArray = $afs->getPlantsTreesArray();
                         if (is_array($landArray)) {
                             $classification = $landArray[0]->getActualUse();
                             if (is_numeric($classification)) {
                                 $classification = $this->getLandActualUsesText($classification);
                             }
                         } else {
                             if (is_array($plantsTreesArray)) {
                                 $classification = $plantsArray[0]->getActualUse();
                                 if (is_numeric($classification)) {
                                     $classification = $this->getPlantsTreesActualUsesText($classification);
                                 }
                             }
                         }
                 }
             }
         }
         $tdNumberListLine = $tdNumber . " --- " . $propertyType . " --- " . $classification;
         return $tdNumberListLine;
     }
     return "";
 }
Example #29
0
 function Main()
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
         exit("afs not found");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             exit("error xmlDoc");
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             $this->formArray["arpNumber"] = $afs->arpNumber;
             $this->formArray["propertyIndexNumber"] = $afs->propertyIndexNumber;
             $this->formArray["taxability"] = $afs->taxability;
             $this->formArray["effectivity"] = $afs->effectivity;
             $this->displayODAFS($this->formArray["afsID"]);
             $this->displayTD($this->formArray["afsID"]);
             $landList = $afs->getLandArray();
             if (count($landList)) {
                 $this->displayLandList($landList);
             }
             $plantsTreesList = $afs->getPlantsTreesArray();
             if (count($plantsTreesList)) {
                 $this->displayPlantsTreesList($plantsTreesList);
             }
             $fp = fopen("/home/site/log/faasland1.xml", "w");
             fwrite($fp, "---landitems---\r\n");
             fwrite($fp, $this->formArray["landitems"] . "\r\n");
             fwrite($fp, "---plantitems---\r\n");
             fwrite($fp, $this->formArray["plantitems"] . "\r\n");
             fwrite($fp, "---adjitems---\r\n");
             fwrite($fp, $this->formArray["adjitems"] . "\r\n");
             fwrite($fp, "---summtems---\r\n");
             fwrite($fp, $this->formArray["summitems"] . "\r\n");
             fclose($fp);
         }
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     //		$this->tpl->p("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
     //header("location: ".$testpdf->pdfPath);
     exit;
 }
Example #30
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")";
             $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
             if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) {
                 if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                     //echo "SOAP failed";
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     //select
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             //print_r($rptop);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID());
                             $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName());
                             $this->formArray["cityAssessorName"] = $cityAssessor->getFullName();
                         } else {
                             $cityAssessor = $value;
                             $this->tpl->set_var("cityAssessorID", $cityAssessor);
                             $this->tpl->set_var("cityAssessorName", $cityAssessor);
                             $this->formArray["cityAssessorName"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID());
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName());
                             $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName();
                         } else {
                             $cityTreasurer = $value;
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer);
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer);
                             $this->formArray["cityTreasurerName"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $this->tpl->set_block("rptsTemplate", "JSTDList", "JSTDListBlock");
                         $this->tpl->set_block("TDList", "DueTypeList", "DueTypeListBlock");
                         $this->tpl->set_block("TDList", "BacktaxesList", "BacktaxesListBlock");
                         $this->tpl->set_block("JSTDList", "JSBacktaxesList", "JSBacktaxesListBlock");
                         $this->tpl->set_block("BacktaxesList", "BacktaxDueTypeList", "BacktaxDueTypeListBlock");
                         $tdCtr = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             foreach ($value as $tkey => $tvalue) {
                                 $this->tpl->set_var("tdID", $tvalue->getTDID());
                                 $this->tpl->set_var("taxDeclarationNumber", $tvalue->getTaxDeclarationNumber());
                                 $this->tpl->set_var("afsID", $tvalue->getAfsID());
                                 $this->tpl->set_var("cancelsTDNumber", $tvalue->getCancelsTDNumber());
                                 $this->tpl->set_var("canceledByTDNumber", $tvalue->getCanceledByTDNumber());
                                 $this->tpl->set_var("taxBeginsWithTheYear", $tvalue->getTaxBeginsWithTheYear());
                                 $this->tpl->set_var("ceasesWithTheYear", $tvalue->getCeasesWithTheYear());
                                 $this->tpl->set_var("enteredInRPARForBy", $tvalue->getEnteredInRPARForBy());
                                 $this->tpl->set_var("enteredInRPARForYear", $tvalue->getEnteredInRPARForYear());
                                 $this->tpl->set_var("previousOwner", $tvalue->getPreviousOwner());
                                 $this->tpl->set_var("previousAssessedValue", $tvalue->getPreviousAssessedValue());
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getProvincialAssessorDate());
                                 $this->tpl->set_var("pa_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("pa_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("pa_dayValue", removePreZero($dateArr["day"]));
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getCityMunicipalAssessorDate());
                                 $this->tpl->set_var("cm_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("cm_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("cm_dayValue", removePreZero($dateArr["day"]));
                                 $this->tpl->set_var("provincialAssessorName", $tvalue->provincialAssessor);
                                 $this->tpl->set_var("cityMunicipalAssessorName", $tvalue->cityMunicipalAssessor);
                                 $this->tpl->set_var("propertyType", $tvalue->getPropertyType());
                                 $this->tpl->set_var("basicTax", "");
                                 $this->tpl->set_var("sefTax", "");
                                 $this->tpl->set_var("total", "");
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     //
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         //
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue();
                                         $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue();
                                         $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                         $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                         $this->tpl->set_var("taxability", $afs->getTaxability());
                                         $this->tpl->set_var("effectivity", $afs->getEffectivity());
                                         $this->formArray["idle"] = "No";
                                         if ($tvalue->getPropertyType() == "Land") {
                                             if (is_array($afs->landArray)) {
                                                 // if land is stripped
                                                 if (count($afs->landArray) > 1) {
                                                     foreach ($afs->landArray as $land) {
                                                         if ($land->getIdle() == "Yes") {
                                                             $this->formArray["idle"] = "Yes";
                                                             break;
                                                         }
                                                     }
                                                 } else {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                         if ($this->formArray["idle"] == "") {
                                             $this->formArray["idle"] = "No";
                                         }
                                         $this->tpl->set_var("idle", $this->formArray["idle"]);
                                     }
                                 }
                                 // grab DueRecords from tdID
                                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                                 $dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                                 $this->tpl->set_var("dueYear", $rptop->getTaxableYear());
                                 if (!($xmlStr = $DueList->getDueList($tvalue->getTdID(), $rptop->getTaxableYear()))) {
                                     foreach ($dueArrayList as $dueKey => $dueValue) {
                                         $this->tpl->set_var("basicTax[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("sefTax[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("idleTax[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("taxDue[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("dueDate[" . $dueKey . "]", "-");
                                     }
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         foreach ($dueArrayList as $dueKey => $dueValue) {
                                             $this->tpl->set_var("basicTax[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("sefTax[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("idleTax[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("taxDue[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("dueDate[" . $dueKey . "]", "-");
                                         }
                                     } else {
                                         $dueRecords = new DueRecords();
                                         $dueRecords->parseDomDocument($domDoc);
                                         foreach ($dueRecords->getArrayList() as $due) {
                                             foreach ($due as $dueKey => $dueValue) {
                                                 switch ($dueKey) {
                                                     case "dueType":
                                                         if ($dueValue == "Annual") {
                                                             $this->formArray["totalTaxDue"] += $due->getTaxDue();
                                                         }
                                                         $dueArrayList[$dueValue] = $due;
                                                         $this->tpl->set_var("basicTax[" . $dueValue . "]", formatCurrency($due->getBasicTax()));
                                                         $this->tpl->set_var("sefTax[" . $dueValue . "]", formatCurrency($due->getSEFTax()));
                                                         $this->tpl->set_var("idleTax[" . $dueValue . "]", formatCurrency($due->getIdleTax()));
                                                         $this->tpl->set_var("taxDue[" . $dueValue . "]", formatCurrency($due->getTaxDue()));
                                                         $this->tpl->set_var("dueDate[" . $dueValue . "]", date("M. d, Y", strtotime($due->getDueDate())));
                                                         $this->tpl->set_var("dueID[" . $dueValue . "]", $due->getDueID());
                                                         break;
                                                 }
                                             }
                                         }
                                         // initialize discountPeriod and discountPercentage for earlyPaymentDiscount
                                         $treasurySettings = $this->getTreasurySettings();
                                         $this->tpl->set_var("discountPercentage", $treasurySettings->getDiscountPercentage() . "%");
                                         $this->tpl->set_var("discountPeriod", "January 01, " . $rptop->getTaxableYear() . " - " . date("F d, Y", strtotime($rptop->getTaxableYear() . "-" . $treasurySettings->getDiscountPeriod())));
                                         $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
                                         $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                                         $this->formArray["discountPeriod_End"] = strtotime($rptop->getTaxableYear() . "-" . $this->formArray["discountPeriod"]);
                                         $this->formArray["discountPeriod_Start"] = strtotime($rptop->getTaxableYear() . "-01-01");
                                         // initialize advancedDiscountPercentage for advancedPayment
                                         $this->tpl->set_var("advancedDiscountPercentage", $treasurySettings->getAdvancedDiscountPercentage() . "%");
                                         $this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage();
                                         $this->tpl->set_var("q1AdvancedDiscountPercentage", $treasurySettings->getQ1AdvancedDiscountPercentage() . "%");
                                         $this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage();
                                         // initialize penaltyLUTArray
                                         $penaltyLUTArray = $this->getPenaltyLUTArray();
                                         // get paymentHistory
                                         $defaultDueType = "Annual";
                                         $allowableDueTypesArray = array("Annual", "Q1", "Q2", "Q3", "Q4");
                                         /* alxjvr 2006.03.22
                                         											if(!$paymentHistory = $this->getPaymentHistory($dueArrayList,"")){
                                         												$defaultDueType = "Annual";
                                         												$allowableDueTypesArray = array("Annual","Q1");
                                         											}
                                         											else{
                                         												$defaultDueType = $paymentHistory->arrayList[0]->getDueType();
                                         
                                         												if($defaultDueType=="Annual"){
                                         													$allowableDueTypesArray = array("Annual");
                                         												}
                                         												else{
                                         													switch($defaultDueType){
                                         														case "Q1":
                                         															$allowableDueTypesArray = array("Q1", "Q2");
                                         															break;
                                         														case "Q2":
                                         															$allowableDueTypesArray = array("Q2", "Q3");
                                         															break;
                                         														case "Q3":
                                         															$allowableDueTypesArray = array("Q3", "Q4");
                                         															break;
                                         														case "Q4":
                                         															$allowableDueTypesArray = array("Q4");
                                         															break;
                                         													}
                                         												}
                                         											}
                                         											*/
                                         foreach ($dueArrayList as $dKey => $due) {
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPeriod($this->formArray["discountPeriod"]);
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPercentage($this->formArray["discountPercentage"]);
                                             // compute earlyPaymentDiscount as of today
                                             // check if today is within the discountPeriod and compute Discount
                                             // AND if today is BEFORE annual dueDate
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscount(0.0);
                                             if ($due->getDueType() == "Annual") {
                                                 if (strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]) {
                                                     if (strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())) {
                                                         $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                 }
                                             } else {
                                                 // if today is BEFORE dueDate
                                                 if (strtotime($this->now) <= strtotime($due->getDueDate()) && strtotime($this->now) >= $this->formArray["discountPeriod_Start"]) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                 }
                                                 // commented out: February 08, 2005
                                                 // earlyPaymentDiscount aren't given to Quarterly Dues except for Quarter 1
                                                 /*
                                                 if($due->getDueType()=="Q1"){
                                                 	if(strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]){
                                                 		if(strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())){
                                                 			$dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"]/100));
                                                 		}
                                                 	}
                                                 }
                                                 */
                                             }
                                             // compute advancedPaymentDiscount as of today
                                             // check if today is BEFORE January 1 of the year of the annual dueDate
                                             $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0.0);
                                             if (strtotime($this->now) < strtotime(date("Y", strtotime($dueArrayList[$dKey]->getDueDate())) . "-01-01")) {
                                                 // for advanced payments, give 20% discount to annual dues [advanced discount]
                                                 // give 10% discount to quarterly dues [early discount]
                                                 if ($due->getDueType() == "Annual") {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["advancedDiscountPercentage"] / 100));
                                                 } else {
                                                     // commented out: February 08, 2005
                                                     // advancedPaymentDiscount aren't given to Quarterly Dues
                                                     // except for Quarter 1
                                                     if ($due->getDueType() == "Q1") {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"] / 100));
                                                     } else {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                 }
                                             }
                                             $latestPaymentDate[$dKey] = $this->getLatestPaymentDateForDue($dueArrayList[$dKey]);
                                             $amountPaidForDue = $this->getAmountPaidForDue($dueArrayList);
                                             $amnestyStatus = $this->getAmnestyStatusForDue($dueArrayList);
                                             $totalEarlyPaymentDiscount = $this->getTotalEarlyPaymentDiscountForDue($dueArrayList);
                                             $totalAdvancedPaymentDiscount = $this->getTotalAdvancedPaymentDiscountForDue($dueArrayList);
                                             if ($totalEarlyPaymentDiscount > 0) {
                                                 $earlyPaymentDiscountForDueType = $this->getTotalEarlyPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($earlyPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($earlyPaymentDiscountForDueType);
                                                 }
                                             }
                                             if ($totalAdvancedPaymentDiscount > 0) {
                                                 $advancedPaymentDiscountForDueType = $this->getTotalAdvancedPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($advancedPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($advancedPaymentDiscountForDueType);
                                                 }
                                             }
                                             if ($amnestyStatus) {
                                                 $this->tpl->set_var("amnesty_status", "checked");
                                             } else {
                                                 $this->tpl->set_var("amnesty_status", "");
                                             }
                                             // calculate Penalties verses either today or verses the last paymentDate
                                             if ($latestPaymentDate[$dKey] != "" || $latestPaymentDate[$dKey] != "now") {
                                                 $dueArrayList[$dKey] = $this->computePenalty($latestPaymentDate[$dKey], $dueArrayList[$dKey]);
                                                 // if balance is 0 leave penalty as is, otherwise calculatePenalty according to date now
                                                 $balance = $dueArrayList[$dKey]->getInitialNetDue() - $amountPaidForDue;
                                                 // 0.1 is used instead of 0 because sometimes rounded off balances intended to be 0 end up appearing as 0.002 or so...
                                                 if (round($balance, 4) > 0.1) {
                                                     $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                                 }
                                             } else {
                                                 $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                             }
                                             $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount()));
                                             $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount()));
                                             $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue());
                                             $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100);
                                             $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty()));
                                             $this->tpl->set_var("totalPaid[" . $dKey . "]", formatCurrency($this->getAmountPaidForDueID($dueArrayList[$dKey]->getDueID())));
                                             $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getInitialNetDue()));
                                             $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                         }
                                         // revert Back to Annual mode if Quarterly Dues have Penalties
                                         foreach ($dueArrayList as $dKey => $due) {
                                             if ($dKey != "Annual") {
                                                 if ($dueArrayList[$dKey]->getPenalty() > 0) {
                                                     $defaultDueType = "Annual";
                                                     $allowableDueTypesArray = array("Annual");
                                                     $revertedBackToAnnual = true;
                                                     break;
                                                 }
                                             }
                                         }
                                         foreach ($allowableDueTypesArray as $allowableDueType) {
                                             $this->tpl->set_var("allowableDueType", $allowableDueType);
                                             $this->tpl->parse("DueTypeListBlock", "DueTypeList", true);
                                         }
                                         $this->tpl->set_var("dueType[Annual]_status", "checked");
                                         $this->tpl->set_var("dueType[Q1]_status", "");
                                         $this->tpl->set_var("dueType[Q2]_status", "");
                                         $this->tpl->set_var("dueType[Q3]_status", "");
                                         $this->tpl->set_var("dueType[Q4]_status", "");
                                         $this->tpl->set_var("dueDate", date("M. d, Y", strtotime($dueArrayList[$defaultDueType]->getDueDate())));
                                         $this->tpl->set_var("basicTax", formatCurrency($dueArrayList[$defaultDueType]->getBasicTax()));
                                         $this->tpl->set_var("sefTax", formatCurrency($dueArrayList[$defaultDueType]->getSEFTax()));
                                         $this->tpl->set_var("idleTax", formatCurrency($dueArrayList[$defaultDueType]->getIdleTax()));
                                         $this->tpl->set_var("taxDue", formatCurrency($dueArrayList[$defaultDueType]->getTaxDue()));
                                         $this->tpl->set_var("advancedPaymentDiscount", formatCurrency($dueArrayList[$defaultDueType]->getAdvancedPaymentDiscount()));
                                         $this->tpl->set_var("earlyPaymentDiscount", formatCurrency($dueArrayList[$defaultDueType]->getEarlyPaymentDiscount()));
                                         $this->tpl->set_var("penalty", formatCurrency($dueArrayList[$defaultDueType]->getPenalty()));
                                         // get amountPaid for defaultDueType
                                         // but if dues have been reverted back to "Annual" mode from "Quarterly" mode
                                         // get amountPaid for all the quarters that have been paid so far
                                         if ($revertedBackToAnnual) {
                                             $amountPaid = 0;
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Annual"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q1"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q2"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q3"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q4"]->getDueID());
                                         } else {
                                             $amountPaid = $this->getAmountPaidForDueID($dueArrayList[$defaultDueType]->getDueID());
                                         }
                                         $this->tpl->set_var("amountPaid", formatCurrency($amountPaid));
                                         $balance = $dueArrayList[$defaultDueType]->getTaxDue();
                                         if ($dueArrayList[$defaultDueType]->getAdvancedPaymentDiscount() > 0) {
                                             $balance = $dueArrayList[$defaultDueType]->getTaxDue() - $dueArrayList[$defaultDueType]->getAdvancedPaymentDiscount();
                                         } else {
                                             if ($dueArrayList[$defaultDueType]->getEarlyPaymentDiscount() > 0) {
                                                 $balance = $dueArrayList[$defaultDueType]->getTaxDue() - $dueArrayList[$defaultDueType]->getEarlyPaymentDiscount();
                                             }
                                         }
                                         $balance = round($balance + $dueArrayList[$defaultDueType]->getPenalty() - $amountPaid, 2);
                                         $this->tpl->set_var("balance", formatCurrency($balance));
                                     }
                                 }
                                 // display Backtaxes and previousTD Backtaxes
                                 $this->formArray["totalBacktaxesBalance"] = 0;
                                 $this->displayBacktaxTD($tvalue->getTdID());
                                 $precedingTDArray = $this->getPrecedingTDArray($tvalue);
                                 if (is_array($precedingTDArray)) {
                                     foreach ($precedingTDArray as $precedingTD) {
                                         $this->displayBacktaxTD($precedingTD->getTdID());
                                     }
                                 }
                                 $this->tpl->set_var("total", number_format($this->formArray["totalBacktaxesDue"], 2));
                                 $this->tpl->set_var("totalBacktaxesBalance", number_format($this->formArray["totalBacktaxesBalance"], 2));
                                 // grab dueID's and backtaxTDID's to run through payments
                                 // create $dueIDArray
                                 foreach ($dueArrayList as $due) {
                                     $this->dueIDArray[] = $due->getDueID();
                                 }
                                 $this->displayTotalPaid();
                                 $this->displayNetDue();
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("defaultTDListBlock", "defaultTDList", true);
                                 $this->tpl->parse("toggleTDListBlock", "toggleTDList", true);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 $this->tpl->parse("JSTDListBlock", "JSTDList", true);
                                 $this->tpl->set_var("DueTypeListBlock", "");
                                 // added following line Feb.22,2005 to solve erpts issue (2005-22), backtaxTD blocking bug.
                                 $this->tpl->set_var("BacktaxesListBlock", "");
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("defaultTDListBlock", "//no default");
                             $this->tpl->set_var("toggleTDListBlock", "//no Toggle");
                             $this->tpl->set_var("TDListBlock", "");
                             $this->tpl->set_var("JSTDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     case "landTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "landTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
             $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
             unset($rptop);
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             $rptop = new RPTOP();
             $rptop->setRptopID($this->formArray["rptopID"]);
             $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
             $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
             $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
             $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
             $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
             $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
             $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
             $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
             $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]);
             $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
             $rptop->setCreatedBy($this->userID);
             $rptop->setModifiedBy($this->userID);
             $rptop->setDomDocument();
             $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object");
             $rptop->setDomDocument();
             $doc = $rptop->getDomDocument();
             $xmlStr = $doc->dump_mem(true);
             //echo $xmlStr;
             if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) {
                 echo "ret=" . $ret;
             }
             //echo $ret;
         }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y", strtotime($this->now)));
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }