function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "save":
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 exit("error xml");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("error domDoc");
                 } else {
                     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $afs->setArpNumber($this->formArray["arpNumber"]);
                     $afs->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                     $afs->setTaxability($this->formArray["taxability"]);
                     $afs->setEffectivity($this->formArray["effectivity"]);
                     $afs->setDomDocument();
                     $doc = $afs->getDomDocument();
                     $xmlStr = $doc->dump_mem(true);
                     if (!($ret = $AFSEncode->updateAFS($xmlStr))) {
                         exit("error update");
                     }
                 }
             }
             header("location: RPUIdentificationClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         default:
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 exit("error xml");
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("error domDoc");
                 } else {
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $this->formArray["afsID"] = $afs->getAfsID();
                     $this->formArray["arpNumber"] = $afs->getArpNumber();
                     $this->formArray["taxability"] = $afs->getTaxability();
                     $this->formArray["effectivity"] = $afs->getEffectivity();
                     $this->formArray["propertyIndexNumber"] = $afs->getPropertyIndexNumber();
                 }
             }
             break;
     }
     $this->setForm();
     $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");
 }
Beispiel #2
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());
         }
     }
 }
Beispiel #3
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");
 }
Beispiel #4
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("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());
                                 $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);
                                         $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 Due from tdID
                                 $this->formArray["totalTaxDue"] = 0.0;
                                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                 if (!($xmlStr = $DueDetails->getDueFromTdID($tvalue->getTdID(), $rptop->getTaxableYear()))) {
                                     $this->tpl->set_var("dueID", "");
                                     $this->tpl->set_var("dueDate", "---/--/--");
                                     $this->tpl->set_var("basicTax", "uncalculated");
                                     $this->tpl->set_var("sefTax", "uncalculated");
                                     $this->tpl->set_var("idleTax", "uncalculated");
                                     $this->tpl->set_var("taxDue", "uncalculated");
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         $this->tpl->set_var("dueDate", "---/--/--");
                                         $this->tpl->set_var("dueID", "uncalculated");
                                         $this->tpl->set_var("basicTax", "uncalculated");
                                         $this->tpl->set_var("sefTax", "uncalculated");
                                         $this->tpl->set_var("idleTax", "uncalculated");
                                         $this->tpl->set_var("taxDue", "uncalculated");
                                     } else {
                                         $due = new Due();
                                         $due->parseDomDocument($domDoc);
                                         $this->tpl->set_var("dueID", $due->getDueID());
                                         $this->tpl->set_var("dueDate", date("M. d, Y", strtotime($due->getDueDate())));
                                         $this->tpl->set_var("basicTax", formatCurrency($due->getBasicTax()));
                                         $this->tpl->set_var("sefTax", formatCurrency($due->getSEFTax()));
                                         $this->tpl->set_var("idleTax", formatCurrency($due->getIdleTax()));
                                         $this->tpl->set_var("taxDue", formatCurrency($due->getTaxDue()));
                                         $this->formArray["totalTaxDue"] += $due->getTaxDue();
                                     }
                                 }
                                 // refresh tdHistory
                                 // insert/update Dues from PreviousTD as BacktaxTD for CurrentTD
                                 // if previous TD has no Dues, create a Due and insert as BacktaxTD
                                 $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                                 $this->refreshTDHistory($tvalue);
                                 $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");
 }
Beispiel #5
0
 function Main()
 {
     //echo $this->formArray["formAction"];
     switch ($this->formArray["formAction"]) {
         case "save":
             $TDEncode = new SoapObject(NCCBIZ . "TDEncode.php", "urn:Object");
             if ($this->formArray["tdID"] != "") {
                 $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
                 if (!($xmlStr = $TDDetails->getTD($this->formArray["tdID"]))) {
                     $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 {
                         $td = new TD();
                         $td->parseDomDocument($domDoc);
                         $td->setTdID($this->formArray["tdID"]);
                         $td->setAfsID($this->formArray["afsID"]);
                         $td->setPropertyID($this->formArray["propertyID"]);
                         $td->setPropertyType($this->formArray["propertyType"]);
                         $td->setTaxDeclarationNumber($this->formArray["taxDeclarationNumber"]);
                         $td->setProvincialAssessor($this->formArray["provincialAssessorID"]);
                         $td->setProvincialAssessorDate($this->formArray["provincialAssessorDate"]);
                         $td->setCityMunicipalAssessor($this->formArray["cityMunicipalAssessorID"]);
                         $td->setCityMunicipalAssessorDate($this->formArray["cityMunicipalAssessorDate"]);
                         $td->setCancelsTDNumber($this->formArray["cancelsTDNumber"]);
                         $td->setCanceledByTDNumber($this->formArray["canceledByTDNumber"]);
                         $td->setTaxBeginsWithTheYear($this->formArray["taxBeginsWithTheYear"]);
                         $td->setCeasesWithTheYear($this->formArray["ceasesWithTheYear"]);
                         $td->setEnteredInRPARForYear($this->formArray["enteredInRPARForYear"]);
                         $td->setEnteredInRPARForBy($this->formArray["enteredInRPARForByID"]);
                         $td->setPreviousOwner($this->formArray["previousOwner"]);
                         $td->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                         $td->setMemoranda($this->formArray["memoranda"]);
                         $td->setCreatedBy($this->userID);
                         $td->setModifiedBy($this->userID);
                         $td->setDomDocument();
                         $doc = $td->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         //exit($xmlStr);
                         if (!($ret = $TDEncode->updateTD($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $td = new TD();
                 $td->parseDomDocument($domDoc);
                 //$td->setTdID($this->formArray["tdID"]);
                 $td->setAfsID($this->formArray["afsID"]);
                 $td->setPropertyID($this->formArray["propertyID"]);
                 $td->setPropertyType($this->formArray["propertyType"]);
                 $td->setTaxDeclarationNumber($this->formArray["taxDeclarationNumber"]);
                 $td->setProvincialAssessor($this->formArray["provincialAssessorID"]);
                 $td->setProvincialAssessorDate($this->formArray["provincialAssessorDate"]);
                 $td->setCityMunicipalAssessor($this->formArray["cityMunicipalAssessorID"]);
                 $td->setCityMunicipalAssessorDate($this->formArray["cityMunicipalAssessorDate"]);
                 $td->setCancelsTDNumber($this->formArray["cancelsTDNumber"]);
                 $td->setCanceledByTDNumber($this->formArray["canceledByTDNumber"]);
                 $td->setTaxBeginsWithTheYear($this->formArray["taxBeginsWithTheYear"]);
                 $td->setCeasesWithTheYear($this->formArray["ceasesWithTheYear"]);
                 $td->setEnteredInRPARForYear($this->formArray["enteredInRPARForYear"]);
                 $td->setEnteredInRPARForBy($this->formArray["enteredInRPARForByID"]);
                 $td->setPreviousOwner($this->formArray["previousOwner"]);
                 $td->setPreviousAssessedValue($this->formArray["previousAssessedValue"]);
                 $td->setMemoranda($this->formArray["memoranda"]);
                 $td->setCreatedBy($this->userID);
                 $td->setModifiedBy($this->userID);
                 $td->setDomDocument();
                 $doc = $td->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 //echo $xmlStr;
                 if (!($ret = $TDEncode->saveTD($xmlStr))) {
                     echo "Error saving";
                 }
             }
             $this->formArray["propertyID"] = $ret;
             header("location: TDClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit($ret);
             break;
         case "cancel":
             header("location: TDList.php");
             exit;
             break;
         default:
             if ($this->formArray["tdID"]) {
                 $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
                 if (!($xmlStr = $TDDetails->getTD($this->formArray["tdID"]))) {
                     echo "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 {
                         $td = new TD();
                         $td->parseDomDocument($domDoc);
                         if ($td->getCancelsTDNumber() == "") {
                             $td = $this->updateTDCancelsTDNumber($td);
                         }
                         if ($td->getCanceledByTDNumber() == "") {
                             $td = $this->updateTDCanceledByTDNumber($td);
                         }
                         foreach ($td as $key => $value) {
                             switch ($key) {
                                 case "provincialAssessorDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["pa_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["pa_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["pa_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "cityMunicipalAssessorDate":
                                     if (true) {
                                         list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $value);
                                         $this->formArray["cm_year"] = removePreZero($dateArr["year"]);
                                         $this->formArray["cm_month"] = removePreZero($dateArr["month"]);
                                         $this->formArray["cm_day"] = removePreZero($dateArr["day"]);
                                     } else {
                                         $this->formArray[$key] = "";
                                     }
                                     break;
                                 case "propertyType":
                                     // so it wont go to the default loop. so that propertyType can refresh from the GET input
                                     break;
                                 default:
                                     //echo $key."=>".$value."<br>";
                                     $this->formArray[$key] = $value;
                             }
                         }
                     }
                 }
             } else {
                 $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["taxDeclarationNumber"] = $afs->getARPNumber();
                         $this->formArray["odID"] = $afs->getOdID();
                         // default cancelsTDNumber and canceledByTDNumber
                         $cancelsTDNumberArray = $this->getCancelsTDNumberArray();
                         if (is_array($cancelsTDNumberArray)) {
                             $this->formArray["cancelsTDNumber"] = implode(", ", $cancelsTDNumberArray);
                         }
                         $canceledByTDNumberArray = $this->getCanceledByTDNumberArray();
                         if (is_array($canceledByTDNumberArray)) {
                             $this->formArray["canceledByTDNumber"] = implode(", ", $canceledByTDNumberArray);
                         }
                         // default memoranda from properties
                         $this->formArray["memoranda"] = "";
                         if (is_array($afs->landArray)) {
                             if (is_object($afs->landArray[0])) {
                                 if ($afs->landArray[0]->memoranda != "") {
                                     $this->formArray["memoranda"] .= "Land Memo:\n" . $afs->landArray[0]->memoranda;
                                 }
                             }
                         }
                         if (is_array($afs->plantsTreesArray)) {
                             if (is_object($afs->plantsTreesArray[0])) {
                                 if ($afs->plantsTreesArray[0]->memoranda != "") {
                                     $this->formArray["memoranda"] .= "\nPlants Trees Memo:\n" . $afs->plantsTreesArray[0]->memoranda;
                                 }
                             }
                         }
                         if (is_array($afs->improvementsBuildingsArray)) {
                             if (is_object($afs->improvementsBuildingsArray[0])) {
                                 if ($afs->improvementsBuildingsArray[0]->memoranda != "") {
                                     $this->formArray["memoranda"] .= "\nImprovements/Buildings Memo:\n" . $afs->improvementsBuildingsArray[0]->memoranda;
                                 }
                             }
                         }
                         if (is_array($afs->machineriesArray)) {
                             if (is_object($afs->machineriesArray[0])) {
                                 if ($afs->machineriesArray[0]->memoranda != "") {
                                     $this->formArray["memoranda"] .= "\nMachineries Memo:\n" . $afs->machineriesArray[0]->memoranda;
                                 }
                             }
                         }
                     }
                 }
             }
             $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
             $this->tpl->set_var("odIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("tdID" => $this->formArray["tdID"], "propertyType" => $this->formArray["propertyType"], "propertyID" => $this->formArray["propertyID"], "afsID" => $this->formArray["afsID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
 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 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;
                 }
             }
         }
     }
 }
Beispiel #8
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;
         }
     }
 }
Beispiel #9
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 "save":
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 exit("error xml");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("error domDoc");
                 } else {
                     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $afs->setArpNumber($this->formArray["arpNumber"]);
                     $afs->setCadastralLotNumber($this->formArray["cadastralLotNumber"]);
                     // convert $pointsArray to $gisTechnicalDescription string
                     // separate each point with "-" and each pointRecord with ","
                     $pointsArray = $this->formArray["pointsArray"];
                     $pointID = 1;
                     if (is_array($pointsArray)) {
                         for ($pointID = 1; $pointID <= count($pointsArray); $pointID++) {
                             $pointArray = array($pointID, $pointsArray[$pointID]["pointType"], $pointsArray[$pointID]["quadrant"], $pointsArray[$pointID]["bearingDeg"], $pointsArray[$pointID]["bearingMin"], $pointsArray[$pointID]["distance"]);
                             $pointString = implode("-", $pointArray);
                             $gisTechDescArray[$pointID] = $pointString;
                         }
                         $gisTechnicalDescription = implode(",", $gisTechDescArray);
                         $this->formArray["gisTechnicalDescription"] = $gisTechnicalDescription;
                     }
                     $afs->setGISTechnicalDescription($this->formArray["gisTechnicalDescription"]);
                     $afs->setDomDocument();
                     $doc = $afs->getDomDocument();
                     $xmlStr = $doc->dump_mem(true);
                     if (!($ret = $AFSEncode->updateAFS($xmlStr))) {
                         exit("error update");
                     }
                 }
             }
             header("location: GISTechnicalDescriptionClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         case "del":
             // temporarily del points
             $delPointsArray = $this->formArray["pointsArray"];
             $pointID = 1;
             if (is_array($delPointsArray)) {
                 for ($delPointID = 1; $delPointID <= count($delPointsArray); $delPointID++) {
                     if ($delPointID != $this->formArray["delPointID"]) {
                         $pointsArray[$pointID]["pointType"] = $delPointsArray[$delPointID]["pointType"];
                         $pointsArray[$pointID]["quadrant"] = $delPointsArray[$delPointID]["quadrant"];
                         $pointsArray[$pointID]["bearingDeg"] = $delPointsArray[$delPointID]["bearingDeg"];
                         $pointsArray[$pointID]["bearingMin"] = $delPointsArray[$delPointID]["bearingMin"];
                         $pointsArray[$pointID]["distance"] = $delPointsArray[$delPointID]["distance"];
                         $pointID++;
                     }
                 }
                 if (is_array($pointsArray)) {
                     $this->tpl->set_block("rptsTemplate", "PointsList", "PointsListBlock");
                     for ($pointID = 1; $pointID <= count($pointsArray); $pointID++) {
                         $this->tpl->set_var("pointID", $pointID);
                         $this->tpl->set_var("pointType", $pointsArray[$pointID]["pointType"]);
                         $this->tpl->set_var("quadrant", $pointsArray[$pointID]["quadrant"]);
                         $this->tpl->set_var("bearingDeg", $pointsArray[$pointID]["bearingDeg"]);
                         $this->tpl->set_var("bearingMin", $pointsArray[$pointID]["bearingMin"]);
                         $this->tpl->set_var("distance", $pointsArray[$pointID]["distance"]);
                         $this->tpl->parse("PointsListBlock", "PointsList", true);
                     }
                     $this->formArray["pointsExist"] = "true";
                 } else {
                     $this->formArray["pointsExist"] = "false";
                     $this->hideBlock("PointsList");
                 }
             }
             break;
         case "add":
             // temporarily add points
             $pointsArray = $this->formArray["pointsArray"];
             $pointID = 1;
             if (is_array($pointsArray)) {
                 $this->tpl->set_block("rptsTemplate", "PointsList", "PointsListBlock");
                 for ($pointID = 1; $pointID <= count($pointsArray); $pointID++) {
                     $this->tpl->set_var("pointID", $pointID);
                     $this->tpl->set_var("pointType", $pointsArray[$pointID]["pointType"]);
                     $this->tpl->set_var("quadrant", $pointsArray[$pointID]["quadrant"]);
                     $this->tpl->set_var("bearingDeg", $pointsArray[$pointID]["bearingDeg"]);
                     $this->tpl->set_var("bearingMin", $pointsArray[$pointID]["bearingMin"]);
                     $this->tpl->set_var("distance", $pointsArray[$pointID]["distance"]);
                     $this->tpl->parse("PointsListBlock", "PointsList", true);
                 }
                 $pointsArray[$pointID]["pointType"] = $this->formArray["pointType"];
                 $pointsArray[$pointID]["quadrant"] = $this->formArray["quadrant"];
                 $pointsArray[$pointID]["bearingDeg"] = $this->formArray["bearingDeg"];
                 $pointsArray[$pointID]["bearingMin"] = $this->formArray["bearingMin"];
                 $pointsArray[$pointID]["distance"] = $this->formArray["distance"];
                 $this->tpl->set_var("pointID", $pointID);
                 $this->tpl->set_var("pointType", $pointsArray[$pointID]["pointType"]);
                 $this->tpl->set_var("quadrant", $pointsArray[$pointID]["quadrant"]);
                 $this->tpl->set_var("bearingDeg", $pointsArray[$pointID]["bearingDeg"]);
                 $this->tpl->set_var("bearingMin", $pointsArray[$pointID]["bearingMin"]);
                 $this->tpl->set_var("distance", $pointsArray[$pointID]["distance"]);
                 $this->tpl->parse("PointsListBlock", "PointsList", true);
             } else {
                 $pointsArray[$pointID]["pointType"] = $this->formArray["pointType"];
                 $pointsArray[$pointID]["quadrant"] = $this->formArray["quadrant"];
                 $pointsArray[$pointID]["bearingDeg"] = $this->formArray["bearingDeg"];
                 $pointsArray[$pointID]["bearingMin"] = $this->formArray["bearingMin"];
                 $pointsArray[$pointID]["distance"] = $this->formArray["distance"];
                 $this->tpl->set_block("rptsTemplate", "PointsList", "PointsListBlock");
                 $this->tpl->set_var("pointID", $pointID);
                 $this->tpl->set_var("pointType", $pointsArray[$pointID]["pointType"]);
                 $this->tpl->set_var("quadrant", $pointsArray[$pointID]["quadrant"]);
                 $this->tpl->set_var("bearingDeg", $pointsArray[$pointID]["bearingDeg"]);
                 $this->tpl->set_var("bearingMin", $pointsArray[$pointID]["bearingMin"]);
                 $this->tpl->set_var("distance", $pointsArray[$pointID]["distance"]);
                 $this->tpl->parse("PointsListBlock", "PointsList", true);
             }
             $this->formArray["pointsExist"] = "true";
             break;
         default:
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 exit("error xml");
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("error domDoc");
                 } else {
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $this->formArray["afsID"] = $afs->getAfsID();
                     $this->formArray["cadastralLotNumber"] = $afs->getCadastralLotNumber();
                     $this->formArray["gisTechnicalDescription"] = $afs->getGISTechnicalDescription();
                     if ($this->formArray["gisTechnicalDescription"] == "") {
                         $this->formArray["pointsExist"] = "false";
                         $this->hideBlock("PointsList");
                     } else {
                         $this->formArray["pointsExist"] = "true";
                         // parse gisTechnicalDescription into $pointsArray
                         // separate each pointRecord at "," and each point at "-"
                         $gisTechDescArray = explode(",", $this->formArray["gisTechnicalDescription"]);
                         foreach ($gisTechDescArray as $pointString) {
                             $pointArray = explode("-", $pointString);
                             $pointID = $pointArray[0];
                             $pointsArray[$pointID]["pointType"] = $pointArray[1];
                             $pointsArray[$pointID]["quadrant"] = $pointArray[2];
                             $pointsArray[$pointID]["bearingDeg"] = $pointArray[3];
                             $pointsArray[$pointID]["bearingMin"] = $pointArray[4];
                             $pointsArray[$pointID]["distance"] = $pointArray[5];
                         }
                         if (is_array($pointsArray)) {
                             $this->tpl->set_block("rptsTemplate", "PointsList", "PointsListBlock");
                             for ($pointID = 1; $pointID <= count($pointsArray); $pointID++) {
                                 $this->tpl->set_var("pointID", $pointID);
                                 $this->tpl->set_var("pointType", $pointsArray[$pointID]["pointType"]);
                                 $this->tpl->set_var("quadrant", $pointsArray[$pointID]["quadrant"]);
                                 $this->tpl->set_var("bearingDeg", $pointsArray[$pointID]["bearingDeg"]);
                                 $this->tpl->set_var("bearingMin", $pointsArray[$pointID]["bearingMin"]);
                                 $this->tpl->set_var("distance", $pointsArray[$pointID]["distance"]);
                                 $this->tpl->parse("PointsListBlock", "PointsList", true);
                             }
                         }
                     }
                 }
             }
             break;
     }
     $this->setForm();
     $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");
 }
Beispiel #11
0
 function Main()
 {
     $this->displayLGUName();
     $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))) {
             exit("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) {
                                 // xml failed
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     // error domdoc
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         }
                         break;
                     case "cityAssessor":
                         if (is_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->formArray["municipalAssessor"] = $cityAssessor->getName();
                         } else {
                             $cityAssessor = $value;
                             $this->formArray["municipalAssessor"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->formArray["municipalTreasurer"] = $cityTreasurer->getName();
                         } else {
                             $cityTreasurer = $value;
                             $this->formArray["municipalTreasurer"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         $tdCtr = 1;
                         $tdContinuousCtr = 1;
                         if (count($value)) {
                             $this->tdPagingArray["tdCount"] = count($value);
                             $this->tdPagingArray["tdPageRecordsCounter"] = 1;
                             $this->tdPagingArray["tdTotalPages"] = ceil($this->tdPagingArray["tdCount"] / $this->tdPagingArray["tdPageBy"]);
                             $this->tdPagingArray["tdPageNumber"] = 1;
                             $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
                             $this->tpl->set_block("Page", "FirstPageText", "FirstPageTextBlock");
                             $this->tpl->set_block("Page", "ContinuedFromPreviousPageText", "ContinuedFromPreviousPageTextBlock");
                             $this->tpl->set_block("Page", "ContinuedNextPageText", "ContinuedNextPageTextBlock");
                             $this->tpl->set_block("Page", "Totals", "TotalsBlock");
                             foreach ($value as $tkey => $tvalue) {
                                 $this->formArray["arpNumber" . $tdCtr] = $tvalue->getTaxDeclarationNumber();
                                 // word wrap arpNumber
                                 if (strlen($this->formArray["arpNumber" . $tdCtr]) > 13) {
                                     $this->formArray["arpNumber" . $tdCtr . "a"] = substr($this->formArray["arpNumber" . $tdCtr], 0, 12);
                                     $this->formArray["arpNumber" . $tdCtr . "b"] = substr($this->formArray["arpNumber" . $tdCtr], 12);
                                     $this->formArray["arpNumber" . $tdCtr] = "";
                                 }
                                 $this->formArray["afsID"] = $tvalue->getAfsID();
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     // xml failed
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         // error domDoc
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $this->formArray["odID"] = $afs->getOdID();
                                         $od = new OD();
                                         $od->selectRecord($this->formArray["odID"]);
                                         $locationNumber = $od->locationAddress->getNumber();
                                         $locationStreet = $od->locationAddress->getStreet();
                                         $locationBarangay = $od->locationAddress->getBarangay();
                                         $locationDistrict = $od->locationAddress->getDistrict();
                                         $locationMunicipalityCity = $od->locationAddress->getMunicipalityCity();
                                         $locationProvince = $od->locationAddress->getProvince();
                                         $this->formArray["location" . $tdCtr] = $locationNumber . " " . $locationStreet . " " . $locationBarangay;
                                         // word wrap location
                                         if (strlen($this->formArray["location" . $tdCtr]) > 26) {
                                             $this->formArray["location" . $tdCtr . "a"] = $locationNumber . " " . $locationStreet;
                                             $this->formArray["location" . $tdCtr . "b"] = $locationBarangay;
                                             $this->formArray["location" . $tdCtr] = "";
                                         }
                                         $this->formArray["province"] = $locationProvince;
                                         $this->formArray["municipalityCity"] = strtoupper($locationMunicipalityCity);
                                         $this->formArray["area" . $tdCtr] = $od->getLandArea();
                                         $this->formArray["lotNo" . $tdCtr] = $od->getLotNumber();
                                         $this->formArray["pin" . $tdCtr] = $afs->getPropertyIndexNumber();
                                         // word wrap pin
                                         if (strlen($this->formArray["pin" . $tdCtr]) > 13) {
                                             $this->formArray["pin" . $tdCtr . "a"] = substr($this->formArray["pin" . $tdCtr], 0, 12);
                                             $this->formArray["pin" . $tdCtr . "b"] = substr($this->formArray["pin" . $tdCtr], 12);
                                             $this->formArray["pin" . $tdCtr] = "";
                                         }
                                         $landList = $afs->getLandArray();
                                         $plantsTreesList = $afs->getPlantsTreesArray();
                                         $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                                         $machineriesList = $afs->getMachineriesArray();
                                         $kind = "";
                                         $actualUse = "";
                                         if (count($landList)) {
                                             $kind = "Land";
                                             $land = $landList[0];
                                             $actualUse = $land->getActualUse();
                                             $landActualUses = new LandActualUses();
                                             $landActualUses->selectRecord($actualUse);
                                             $actualUse = $landActualUses->getDescription();
                                             $actualUseReportCode = $landActualUses->getReportCode();
                                         } else {
                                             if (count($plantsTreesList)) {
                                                 $kind = "Land";
                                                 $plantsTrees = $plantsTreesList[0];
                                                 $actualUse = $plantsTrees->getActualUse();
                                                 $plantsTreesActualUses = new PlantsTreesActualUses();
                                                 $plantsTreesActualUses->selectRecord($actualUse);
                                                 $actualUse = $plantsTreesActualUses->getDescription();
                                                 $actualUseReportCode = $plantsTreesActualUses->getReportCode();
                                             } else {
                                                 if (count($improvementsBuildingsList)) {
                                                     $kind = "Improvements/Buildings";
                                                     $improvementsBuildings = $improvementsBuildingsList[0];
                                                     $actualUse = $improvementsBuildings->getActualUse();
                                                     $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                                     $improvementsBuildingsActualUses->selectRecord($actualUse);
                                                     $actualUse = $improvementsBuildingsActualUses->getDescription();
                                                     $actualUseReportCode = $improvementsBuildingsActualUses->getReportCode();
                                                 } else {
                                                     if (count($machineriesList)) {
                                                         $kind = "Machineries";
                                                         $machineries = $machineriesList[0];
                                                         $actualUse = $machineries->getActualUse();
                                                         $machineriesActualUses = new MachineriesActualUses();
                                                         $machineriesActualUses->selectRecord($actualUse);
                                                         $actualUse = $machineriesActualUses->getDescription();
                                                         $actualUseReportCode = $machineriesActualUses->getReportCode();
                                                     }
                                                 }
                                             }
                                         }
                                         eval(REPORT_CODE_LIST);
                                         foreach ($reportCodeList as $key => $reportCode) {
                                             if ($reportCode["code"] == $actualUseReportCode) {
                                                 $reportCodeDescription = $reportCode["description"];
                                                 break;
                                             }
                                         }
                                         $this->formArray["classification" . $tdCtr] = $reportCodeDescription;
                                         $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["marketValue" . $tdCtr] += $afs->getTotalMarketValue();
                                         $this->formArray["assessedValue" . $tdCtr] += $afs->getTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $this->formArray["marketValue"];
                                         $this->formArray["totalAssessedValue"] += $this->formArray["assessedValue"];
                                         // grab Due from tdID
                                         $this->formArray["totalTaxDue"] = 0.0;
                                         $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                         if (!($xmlStr = $DueDetails->getDueFromTdID($tvalue->getTdID()))) {
                                             $this->formArray["basic" . $tdCtr] = "";
                                             $this->formArray["sef" . $tdCtr] = "";
                                             $this->formArray["totalTax" . $tdCtr] = "";
                                             $this->formArray["totalBasic"] += 0;
                                             $this->formArray["totalSef"] += 0;
                                             $this->formArray["totalTaxes"] += 0;
                                         } else {
                                             if (!($domDoc = domxml_open_mem($xmlStr))) {
                                                 $this->formArray["basic" . $tdCtr] = "";
                                                 $this->formArray["sef" . $tdCtr] = "";
                                                 $this->formArray["totalTax" . $tdCtr] = "";
                                                 $this->formArray["totalBasic"] += 0;
                                                 $this->formArray["totalSef"] += 0;
                                                 $this->formArray["totalTaxes"] += 0;
                                             } else {
                                                 $due = new Due();
                                                 $due->parseDomDocument($domDoc);
                                                 $this->formArray["basic" . $tdCtr] = $due->getBasicTax();
                                                 $this->formArray["sef" . $tdCtr] = $due->getSEFTax();
                                                 $this->formArray["totalTax" . $tdCtr] = $due->getTaxDue();
                                                 //WRONG CODE -------------------------------------------------->
                                                 //$this->formArray["totalBasic"] += $due->getBasicTax();
                                                 //$this->formArray["totalSef"] += $due->getSEFTax();
                                                 //$this->formArray["totalTaxes"] += $due->getTaxDue();
                                                 //------------------------------------------------------------->
                                             }
                                         }
                                     }
                                 }
                                 $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"];
                                 //NEW CODE - Argao----Added on 03152008-------------------------------------------->
                                 //Computes Grand Totals on Basic, SEF and Total-----By CHT
                                 $this->formArray["totalBasic"] = $this->formArray["totalAssessedValue"] * 0.01;
                                 $this->formArray["totalSef"] = $this->formArray["totalAssessedValue"] * 0.01;
                                 $this->formArray["totalTaxes"] = $this->formArray["totalBasic"] + $this->formArray["totalSef"];
                                 //--------------------------------------------------------------------------------->
                                 if ($this->tdPagingArray["tdPageRecordsCounter"] == $this->tdPagingArray["tdPageBy"]) {
                                     // if 6
                                     $this->setForm();
                                     $this->resetTDPageRecords();
                                     $this->tpl->set_var("tdPageNumber", $this->tdPagingArray["tdPageNumber"]);
                                     $this->tpl->set_var("tdTotalPages", $this->tdPagingArray["tdTotalPages"]);
                                     if ($this->tdPagingArray["tdPageNumber"] > 1) {
                                         $this->tpl->set_var("FirstPageTextBlock", "");
                                         $this->tpl->parse("ContinuedFromPreviousPageTextBlock", "ContinuedFromPreviousPageText", true);
                                     } else {
                                         if ($this->tdPagingArray["tdPageNumber"] == 1) {
                                             $this->tpl->parse("FirstPageTextBlock", "FirstPageText", true);
                                             $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                         }
                                     }
                                     if ($this->tdPagingArray["tdTotalPages"] > 1 && $this->tdPagingArray["tdPageNumber"] < $this->tdPagingArray["tdTotalPages"]) {
                                         $this->tpl->parse("ContinuedNextPageTextBlock", "ContinuedNextPageText", true);
                                     } else {
                                         if ($this->tdPagingArray["tdTotalPages"] == 1) {
                                             $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                         }
                                     }
                                     if ($this->tdPagingArray["tdTotalPages"] == $this->tdPagingArray["tdPageNumber"]) {
                                         $this->tpl->parse("TotalsBlock", "Totals", true);
                                     } else {
                                         $this->tpl->set_var("TotalsBlock", "");
                                     }
                                     $this->tpl->parse("PageBlock", "Page", true);
                                     $this->tpl->set_var("FirstPageTextBlock", "");
                                     $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                     $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                     $this->tpl->set_var("TotalsBlock", "");
                                     $this->tdPagingArray["tdPageNumber"]++;
                                     $this->formArray["pageNumber"]++;
                                     // reset counter
                                     $this->tdPagingArray["tdPageRecordsCounter"] = 0;
                                     $tdCtr = 0;
                                 } else {
                                     if ($tdContinuousCtr == $this->tdPagingArray["tdCount"]) {
                                         // if this is the last record, and count is still not 6
                                         $this->setForm();
                                         $this->resetTDPageRecords();
                                         $this->tpl->set_var("tdPageNumber", $this->tdPagingArray["tdPageNumber"]);
                                         $this->tpl->set_var("tdTotalPages", $this->tdPagingArray["tdTotalPages"]);
                                         if ($this->tdPagingArray["tdPageNumber"] > 1) {
                                             $this->tpl->set_var("FirstPageTextBlock", "");
                                             $this->tpl->parse("ContinuedFromPreviousPageTextBlock", "ContinuedFromPreviousPageText", true);
                                         } else {
                                             if ($this->tdPagingArray["tdPageNumber"] == 1) {
                                                 $this->tpl->parse("FirstPageTextBlock", "FirstPageText", true);
                                                 $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                             }
                                         }
                                         if ($this->tdPagingArray["tdTotalPages"] > 1 && $this->tdPagingArray["tdPageNumber"] < $this->tdPagingArray["tdTotalPages"]) {
                                             $this->tpl->parse("ContinuedNextPageTextBlock", "ContinuedNextPageText", true);
                                         } else {
                                             if ($this->tdPagingArray["tdTotalPages"] == 1) {
                                                 $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                             }
                                         }
                                         if ($this->tdPagingArray["tdTotalPages"] == $this->tdPagingArray["tdPageNumber"]) {
                                             $this->tpl->parse("TotalsBlock", "Totals", true);
                                         } else {
                                             $this->tpl->set_var("TotalsBlock", "");
                                         }
                                         $this->tpl->parse("PageBlock", "Page", true);
                                         $this->tpl->set_var("FirstPageTextBlock", "");
                                         $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                         $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                         $this->tpl->set_var("TotalsBlock", "");
                                         $this->tdPagingArray["tdPageNumber"]++;
                                         $this->formArray["pageNumber"]++;
                                     }
                                 }
                                 $tdCtr++;
                                 $tdContinuousCtr++;
                                 $this->tdPagingArray["tdPageRecordsCounter"]++;
                             }
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             unset($rptop);
         }
     }
     $this->tpl->set_block("rptsTemplate", "Totals", "TotalsBlock");
     $this->tpl->set_var("TotalsBlock", "");
     //$this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     //		print_r($this->tpl->get("templatePage"));
     //		exit;
     $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);
 }
Beispiel #12
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;
             }
             //land
             $landList = $afs->getLandArray();
             if (count($landList)) {
                 $this->displayLandList($landList);
             } else {
                 $this->tpl->set_var("landCtr", 0);
                 $this->tpl->set_block("rptsTemplate", "defaultLandList", "defaultLandListBlock");
                 $this->tpl->set_var("defaultLandListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "toggleLandList", "toggleLandListBlock");
                 $this->tpl->set_var("toggleLandListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "LandList", "LandListBlock");
                 $this->tpl->set_var("LandListBlock", "");
             }
             //plantsTrees
             $plantsTreesList = $afs->getPlantsTreesArray();
             if (count($plantsTreesList)) {
                 $this->displayPlantsTreesList($plantsTreesList);
             } else {
                 $this->tpl->set_var("plantsTreesCtr", 0);
                 $this->tpl->set_block("rptsTemplate", "defaultPlantsTreesList", "defaultPlantsTreesListBlock");
                 $this->tpl->set_var("defaultPlantsTreesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "togglePlantsTreesList", "togglePlantsTreesListBlock");
                 $this->tpl->set_var("togglePlantsTreesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PlantsTreesList", "PlantsTreesListBlock");
                 $this->tpl->set_var("PlantsTreesListBlock", "");
             }
             //improvementsBuildings
             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
             if (count($improvementsBuildingsList)) {
                 $this->displayImprovementsBuildingsList($improvementsBuildingsList);
             } else {
                 $this->tpl->set_var("improvementsBuildingsCtr", 0);
                 $this->tpl->set_block("rptsTemplate", "defaultImprovementsBuildingsList", "defaultImprovementsBuildingsListBlock");
                 $this->tpl->set_var("defaultImprovementsBuildingsListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "toggleImprovementsBuildingsList", "toggleImprovementsBuildingsListBlock");
                 $this->tpl->set_var("toggleImprovementsBuildingsListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "ImprovementsBuildingsList", "ImprovementsBuildingsListBlock");
                 $this->tpl->set_var("ImprovementsBuildingsListBlock", "");
             }
             //machineries
             $machineriesList = $afs->getMachineriesArray();
             //print_r($machineriesList);
             if (count($machineriesList)) {
                 $this->displayMachineriesList($machineriesList);
             } else {
                 $this->tpl->set_var("machineriesCtr", 0);
                 $this->tpl->set_block("rptsTemplate", "defaultMachineriesList", "defaultMachineriesListBlock");
                 $this->tpl->set_var("defaultMachineriesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "toggleMachineriesList", "toggleMachineriesListBlock");
                 $this->tpl->set_var("toggleMachineriesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "MachineriesList", "MachineriesListBlock");
                 $this->tpl->set_var("MachineriesListBlock", "");
             }
             $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->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->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");
 }
 function getAFSDetails($odID)
 {
     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
     $this->formArray["afsID"] = $AFSEncode->getAFSID($odID);
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
         // error xml
         return false;
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             // error domDoc
             return false;
         } else {
             $afs = new AFS();
             $afs->parseDomDocument($domDoc);
             return $afs;
         }
     }
 }
 function Main()
 {
     $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);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->formArray["ownerName"] = "";
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->formArray["ownerName"] = "";
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->formArray["ownerNames"] = "";
                         }
                         break;
                     case "tdArray":
                         $tdCtr = 0;
                         if (count($value)) {
                             foreach ($value as $tkey => $tvalue) {
                                 $this->tdRecord["arpNumber"] = $tvalue->getTaxDeclarationNumber();
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     // error xml
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         // error domDoc
                                     } 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();
                                         }
                                         $this->tdRecord["assessedValue"] = $afs->getTotalAssessedValue();
                                         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;
                                                     }
                                                 }
                                         }
                                     }
                                 }
                                 // 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()))) {
                                     // error xml
                                     // taxDue = uncalculated
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         // error domDoc
                                         // taxDue = uncalculated
                                     } 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();
                                                             $this->tdRecord["basic"] = $due->getBasicTax();
                                                             $this->tdRecord["sef"] = $due->getSEFTax();
                                                         }
                                                         $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();
                                         // 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 (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")) {
                                                 $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["advancedDiscountPercentage"] / 100));
                                             }
                                             $latestPaymentDate = $this->getLatestPaymentDate($dueArrayList);
                                             $amountPaidForDue = $this->getAmountPaidForDue($dueArrayList);
                                             $amnestyStatus = $this->getAmnestyStatusForDue($dueArrayList);
                                             // calculate Penalties verses either today or verses the last paymentDate
                                             if ($latestPaymentDate != "") {
                                                 $dueArrayList[$dKey] = $this->computePenalty($latestPaymentDate, $dueArrayList[$dKey]);
                                                 // if balance is 0 leave penalty as is, otherwise calculatePenalty according to date now
                                                 $balance = $dueArrayList[$dKey]->getInitialNetDue() - $amountPaidForDue;
                                                 if (round($balance, 4) > 0) {
                                                     $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("initialNetDue[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getInitialNetDue()));
                                             $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                             if ($amnestyStatus) {
                                                 $this->initialNetDue[$dKey] -= $dueArrayList[$dKey]->getPenalty();
                                                 $this->tpl->set_var("amnesty[" . $dKey . "]", "Yes");
                                             } else {
                                                 $this->tpl->set_var("amnesty[" . $dKey . "]", "No");
                                             }
                                             if ($dKey == "Annual") {
                                                 $this->tdRecord["penalty"] = $dueArrayList[$dKey]->getPenalty();
                                             }
                                         }
                                     }
                                 }
                                 // 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);
                                 $tdCtr++;
                             }
                         } else {
                             // 0
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                 }
             }
         }
     }
     if (is_array($this->tdArrayList)) {
         ksort($this->tdArrayList);
         reset($this->tdArrayList);
         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
         $this->formArray["totalTaxDue"] = 0;
         foreach ($this->tdArrayList as $tdRecord) {
             $this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
             $this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
             $this->tpl->set_var("class", $tdRecord["class"]);
             if (strlen($tdRecord["location"]) > 25) {
                 $this->formArray["tdYPosValue"] -= 15;
             }
             $this->tpl->set_var("location", $tdRecord["location"]);
             $this->tpl->set_var("year", $tdRecord["year"]);
             $this->tpl->set_var("assessedValue", formatCurrency($tdRecord["assessedValue"]));
             $this->tpl->set_var("basic", formatCurrency($tdRecord["basic"]));
             $this->tpl->set_var("sef", formatCurrency($tdRecord["sef"]));
             $this->tpl->set_var("penalty", formatCurrency($tdRecord["penalty"]));
             $this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
             $this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
             $this->tpl->parse("TDListBlock", "TDList", true);
             $this->formArray["tdYPosValue"] -= 15;
         }
     }
     $this->setForm();
     $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 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 "";
 }
Beispiel #16
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");
 }
Beispiel #17
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("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());
                                 $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);
                                         $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
                                 $this->formArray["totalTaxDue"] = 0.0;
                                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                                 $dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                                 if (!($xmlStr = $DueList->getDueList($tvalue->getTdID()))) {
                                     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())));
                                                         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, " . date("Y") . " - " . date("F d, Y", strtotime(date("Y") . "-" . $treasurySettings->getDiscountPeriod())));
                                         $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
                                         $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                                         $this->formArray["discountPeriod_End"] = strtotime(date("Y") . "-" . $this->formArray["discountPeriod"]);
                                         $this->formArray["discountPeriod_Start"] = strtotime(date("Y") . "-01-01");
                                         // initialize penaltyLUTArray
                                         $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
                                             if (strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]) {
                                                 $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                             } else {
                                                 $dueArrayList[$dKey]->setEarlyPaymentDiscount(0.0);
                                             }
                                             // compute Penalty as of today
                                             // check if today is exceeding dueDate and compute penalty
                                             if (strtotime($this->now) > strtotime($dueArrayList[$dKey]->getDueDate())) {
                                                 // count months
                                                 // numYears = today[year] - dueDate[year]
                                                 $numYears = date("Y", strtotime($this->now)) - date("Y", strtotime($dueArrayList[$dKey]->getDueDate()));
                                                 // numMonths = today[month] - dueDate[month]
                                                 $numMonths = date("n", strtotime($this->now)) - date("n", strtotime($dueArrayList[$dKey]->getDueDate()));
                                                 // totalMonths = (numYears*12) + numMonths
                                                 $totalMonths = $numYears * 12 + $numMonths;
                                                 // associate penaltyPercentage
                                                 if ($totalMonths >= count($penaltyLUTArray)) {
                                                     $penaltyPercentage = 0.72;
                                                 } else {
                                                     $penaltyPercentage = $penaltyLUTArray[$totalMonths];
                                                 }
                                                 $penalty = $dueArrayList[$dKey]->getTaxDue() * $penaltyPercentage;
                                                 $dueArrayList[$dKey]->setMonthsOverDue($totalMonths);
                                                 $dueArrayList[$dKey]->setPenaltyPercentage($penaltyPercentage);
                                                 $dueArrayList[$dKey]->setPenalty($penalty);
                                             } else {
                                                 $dueArrayList[$dKey]->setMonthsOverDue(0);
                                                 $dueArrayList[$dKey]->setPenaltyPercentage(0.0);
                                                 $dueArrayList[$dKey]->setPenalty(0.0);
                                             }
                                             $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("netDue", formatCurrency($dueArrayList["Annual"]->getNetDue()));
                                     }
                                 }
                                 $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", 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");
 }
Beispiel #18
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;
 }
Beispiel #19
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 echo "xml failed";
             } else {
                 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->parseDomAFS($domDoc);
                     foreach ($afs as $key => $value) {
                         $this->formArray[$key] = $value;
                     }
                     //print_r($afs);
                     //exit();
                     $administrator = $afs->getAdministratorArray();
                     foreach ($administrator as $key => $value) {
                         $this->formArray["lastName"] = $value->getLastName();
                         $this->formArray["firstName"] = $value->getFirstName();
                         $this->formArray["middleName"] = $value->getMiddleName();
                         $this->formArray["number"] = $value->getNumber();
                         $this->formArray["street"] = $value->getStreet();
                         $this->formArray["barangay"] = $value->getBarangay();
                         $this->formArray["district"] = $value->getDistrict();
                         $this->formArray["municipalityCity"] = $value->getMunicipalityCity();
                         $this->formArray["province"] = $value->getProvince();
                         $this->formArray["telephone"] = $value->getTelephone();
                     }
                 }
             }
             break;
         case "save":
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             if ($this->formArray["afsID"] != "") {
                 $afs = new AFS();
                 $afs->selectAFS($this->formArray["afsID"]);
                 $afs->setOdID($this->formArray["odID"]);
                 $afs->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $afs->setCertificateOfTitleNumber($this->formArray["certificateOfTitleNumber"]);
                 $afs->setCadastralLotNumber($this->formArray["cadastralLotNumber"]);
                 $afs->setNorth($this->formArray["north"]);
                 $afs->setSouth($this->formArray["south"]);
                 $afs->setEast($this->formArray["east"]);
                 $afs->setWest($this->formArray["west"]);
                 $afs->setCreatedBy($this->userID);
                 $afs->setModifiedBy($this->userID);
                 $person = new Person();
                 $person->setPersonID($afs->getAdministrator());
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setNumber($this->formArray["number"]);
                 $person->setStreet($this->formArray["street"]);
                 $person->setBarangay($this->formArray["barangay"]);
                 $person->setDistrict($this->formArray["district"]);
                 $person->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $person->setProvince($this->formArray["province"]);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setDom();
                 $afs->setAdministratorArray($person);
                 $afs->setDomAFS();
                 $doc = $afs->getDomAFS();
                 $xmlStr = $doc->dump_mem();
                 if (!($ret = $AFSEncode->updateAFS($xmlStr))) {
                     echo "error update";
                 }
                 header("location: AFSClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $ret)));
                 exit;
             } else {
                 $afs = new AFS();
                 $afs->setOdID($this->formArray["odID"]);
                 $afs->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                 $afs->setCertificateOfTitleNumber($this->formArray["certificateOfTitleNumber"]);
                 $afs->setCadastralLotNumber($this->formArray["cadastralLotNumber"]);
                 $afs->setNorth($this->formArray["north"]);
                 $afs->setSouth($this->formArray["south"]);
                 $afs->setEast($this->formArray["east"]);
                 $afs->setWest($this->formArray["west"]);
                 $afs->setCreatedBy($this->userID);
                 $afs->setModifiedBy($this->userID);
                 $adminAddress = new Address();
                 $adminAddress->setNumber($this->formArray["number"]);
                 $adminAddress->setStreet($this->formArray["street"]);
                 $adminAddress->setBarangay($this->formArray["barangay"]);
                 $adminAddress->setDistrict($this->formArray["district"]);
                 $adminAddress->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $adminAddress->setProvince($this->formArray["province"]);
                 $adminAddress->setDomDocument();
                 $person = new Person();
                 $person->setLastName($this->formArray["lastName"]);
                 $person->setFirstName($this->formArray["firstName"]);
                 $person->setMiddleName($this->formArray["middleName"]);
                 $person->setTelephone($this->formArray["telephone"]);
                 $person->setDomDocument();
                 $afs->setAdministratorArray($person);
                 $afs->setDomDocument();
                 $doc = $afs->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $AFSEncode->saveAFS($xmlStr))) {
                     echo "ret=" . $ret;
                 }
                 $this->formArray["afsID"] = $ret;
                 header("location: AFSClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $ret)));
                 exit;
             }
             break;
         case "cancel":
             header("location: AFSList.php");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
             $this->tpl->set_var("odIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
     }
     $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");
 }
Beispiel #20
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");
 }
 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"]);
             $this->displayPostingSummary($afs);
             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
             if (count($improvementsBuildingsList)) {
                 $this->displayImprovementsBuildingsList($improvementsBuildingsList);
             }
         }
     }
     $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("ImprovementsBuildingsFAAS.pdf");
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF("ImprovementsBuildingsFAAS.pdf");
     }
     //		header("location: ".$testpdf->pdfPath);
     exit;
 }
Beispiel #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;
 }
 function Main()
 {
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
     // start batch loop
     $rptopIDArray = $this->formArray["rptopIDArray"];
     foreach ($rptopIDArray as $key => $rptopID) {
         $this->formArray["rptopID"] = $rptopID;
         $this->pageNumber++;
         if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
             exit("xml failed");
         } else {
             //echo($xmlStr);
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 exit("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) {
                                     // xml failed
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         // error domdoc
                                     } else {
                                         $this->displayOwnerList($domDoc);
                                     }
                                 }
                             }
                             break;
                         case "cityAssessor":
                             if (is_numeric($value)) {
                                 $cityAssessor = new Person();
                                 $cityAssessor->selectRecord($value);
                                 $this->formArray["municipalAssessor"] = $cityAssessor->getName();
                             } else {
                                 $cityAssessor = $value;
                                 $this->formArray["municipalAssessor"] = $cityAssessor;
                             }
                             break;
                         case "cityTreasurer":
                             if (is_numeric($value)) {
                                 $cityTreasurer = new Person();
                                 $cityTreasurer->selectRecord($value);
                                 $this->formArray["municipalTreasurer"] = $cityTreasurer->getName();
                             } else {
                                 $cityTreasurer = $value;
                                 $this->formArray["municipalTreasurer"] = $cityTreasurer;
                             }
                             break;
                         case "tdArray":
                             $tdCtr = 1;
                             $tdPageNumber = 1;
                             // RC 20091012 Modified to handle multiple page RPTOPS
                             $totalBasic = 0;
                             $totalSef = 0;
                             $totalTaxes = 0;
                             if (count($value)) {
                                 $tdTotalPages = intval((count($value) - 1) / 6) + 1;
                                 //RC 20091012 Calculate 1 to 6 = 1.
                                 foreach ($value as $tkey => $tvalue) {
                                     if ($tdCtr > 6) {
                                         // RC 20091012 Deal with multiple page RPTOP (i.e. more than 6 TDs)
                                         $this->formArray["tdPageNumber"] = $tdPageNumber;
                                         $this->formArray["tdTotalPages"] = $tdTotalPages;
                                         $this->formArray["totalOnLastPage"] = "Please Refer to Totals on Last Page...";
                                         $this->setForm();
                                         // generate page of output
                                         $this->clearDetails();
                                         // clear the values from Form
                                         $this->pageNumber++;
                                         //increment PDF Page Number
                                         $tdPageNumber++;
                                         $tdCtr = 1;
                                         //reset count for lines on new page of RPTOP
                                         $this->formArray["totalOnLastPage"] = "";
                                     }
                                     $this->formArray["arpNumber" . $tdCtr] = $tvalue->getTaxDeclarationNumber();
                                     // word wrap arpNumber
                                     if (strlen($this->formArray["arpNumber" . $tdCtr]) > 13) {
                                         $this->formArray["arpNumber" . $tdCtr . "a"] = substr($this->formArray["arpNumber" . $tdCtr], 0, 12);
                                         $this->formArray["arpNumber" . $tdCtr . "b"] = substr($this->formArray["arpNumber" . $tdCtr], 12);
                                         $this->formArray["arpNumber" . $tdCtr] = "";
                                     }
                                     $this->formArray["afsID"] = $tvalue->getAfsID();
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                         // xml failed
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             // error domDoc
                                         } else {
                                             $afs = new AFS();
                                             $afs->parseDomDocument($domDoc);
                                             $this->formArray["odID"] = $afs->getOdID();
                                             $od = new OD();
                                             $od->selectRecord($this->formArray["odID"]);
                                             $locationNumber = $od->locationAddress->getNumber();
                                             $locationStreet = $od->locationAddress->getStreet();
                                             $locationBarangay = $od->locationAddress->getBarangay();
                                             $locationDistrict = $od->locationAddress->getDistrict();
                                             $locationMunicipalityCity = $od->locationAddress->getMunicipalityCity();
                                             $locationProvince = $od->locationAddress->getProvince();
                                             $this->formArray["location" . $tdCtr] = $locationNumber . " " . $locationStreet . " " . $locationBarangay;
                                             // word wrap location
                                             if (strlen($this->formArray["location" . $tdCtr]) > 26) {
                                                 $this->formArray["location" . $tdCtr . "a"] = $locationNumber . " " . $locationStreet;
                                                 $this->formArray["location" . $tdCtr . "b"] = $locationBarangay;
                                                 $this->formArray["location" . $tdCtr] = "";
                                             }
                                             $this->formArray["province"] = $locationProvince;
                                             $this->formArray["municipalityCity"] = strtoupper($locationMunicipalityCity);
                                             $this->formArray["area" . $tdCtr] = $od->getLandArea();
                                             $this->formArray["lotNo" . $tdCtr] = $od->getLotNumber();
                                             $this->formArray["pin" . $tdCtr] = $afs->getPropertyIndexNumber();
                                             // word wrap pin
                                             if (strlen($this->formArray["pin" . $tdCtr]) > 25) {
                                                 $this->formArray["pin" . $tdCtr . "a"] = substr($this->formArray["pin" . $tdCtr], 0, 25);
                                                 $this->formArray["pin" . $tdCtr . "b"] = substr($this->formArray["pin" . $tdCtr], 25);
                                                 $this->formArray["pin" . $tdCtr] = "";
                                             }
                                             $landList = $afs->getLandArray();
                                             $plantsTreesList = $afs->getPlantsTreesArray();
                                             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                                             $machineriesList = $afs->getMachineriesArray();
                                             $kind = "";
                                             $actualUse = "";
                                             if (count($landList)) {
                                                 $kind = "Land";
                                                 $land = $landList[0];
                                                 $actualUse = $land->getActualUse();
                                                 $landActualUses = new LandActualUses();
                                                 $landActualUses->selectRecord($actualUse);
                                                 $actualUse = $landActualUses->getDescription();
                                                 $actualUseReportCode = $landActualUses->getReportCode();
                                             } else {
                                                 if (count($plantsTreesList)) {
                                                     $kind = "Land";
                                                     $plantsTrees = $plantsTreesList[0];
                                                     $actualUse = $plantsTrees->getActualUse();
                                                     $plantsTreesActualUses = new PlantsTreesActualUses();
                                                     $plantsTreesActualUses->selectRecord($actualUse);
                                                     $actualUse = $plantsTreesActualUses->getDescription();
                                                     $actualUseReportCode = $plantsTreesActualUses->getReportCode();
                                                 } else {
                                                     if (count($improvementsBuildingsList)) {
                                                         $kind = "Improvements/Buildings";
                                                         $improvementsBuildings = $improvementsBuildingsList[0];
                                                         $actualUse = $improvementsBuildings->getActualUse();
                                                         $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                                         $actualUse = $improvementsBuildingsActualUses->getDescription();
                                                         $actualUseReportCode = $improvementsBuildingsActualUses->getReportCode();
                                                     } else {
                                                         if (count($machineriesList)) {
                                                             $kind = "Machineries";
                                                             $machineries = $machineriesList[0];
                                                             $actualUse = $machineries->getActualUse();
                                                             $machineriesActualUses = new MachineriesActualUses();
                                                             $machineriesActualUses->selectRecord($actualUse);
                                                             $actualUse = $machineriesActualUses->getDescription();
                                                             $actualUseReportCode = $machineriesActualUses->getReportCode();
                                                         }
                                                     }
                                                 }
                                             }
                                             eval(REPORT_CODE_LIST);
                                             foreach ($reportCodeList as $key => $reportCode) {
                                                 if ($reportCode["code"] == $actualUseReportCode) {
                                                     $reportCodeDescription = $reportCode["description"];
                                                     break;
                                                 }
                                             }
                                             $this->formArray["classification" . $tdCtr] = $reportCodeDescription;
                                             $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["marketValue" . $tdCtr] += $afs->getTotalMarketValue();
                                             $this->formArray["assessedValue" . $tdCtr] += $afs->getTotalAssessedValue();
                                             //RC											$this->formArray["totalMarketValue"] += $this->formArray["marketValue"];
                                             //RC											$this->formArray["totalAssessedValue"] += $this->formArray["assessedValue"];
                                             // grab Due from tdID
                                             $this->formArray["totalTaxDue"] = 0.0;
                                             $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                             if (!($xmlStr = $DueDetails->getDueFromTdID($tvalue->getTdID()))) {
                                                 $this->formArray["basic" . $tdCtr] = "";
                                                 $this->formArray["sef" . $tdCtr] = "";
                                                 $this->formArray["totalTax" . $tdCtr] = "";
                                                 $this->formArray["totalBasic"] += 0;
                                                 $this->formArray["totalSef"] += 0;
                                                 $this->formArray["totalTaxes"] += 0;
                                             } else {
                                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                                     $this->formArray["basic" . $tdCtr] = "";
                                                     $this->formArray["sef" . $tdCtr] = "";
                                                     $this->formArray["totalTax" . $tdCtr] = "";
                                                     $this->formArray["totalBasic"] += 0;
                                                     $this->formArray["totalSef"] += 0;
                                                     $this->formArray["totalTaxes"] += 0;
                                                 } else {
                                                     $due = new Due();
                                                     $due->parseDomDocument($domDoc);
                                                     $this->formArray["basic" . $tdCtr] = $due->getBasicTax();
                                                     $this->formArray["sef" . $tdCtr] = $due->getSEFTax();
                                                     $this->formArray["totalTax" . $tdCtr] = $due->getTaxDue();
                                                     /* RC 20091012 revised to not print total until last page of RPTOP 
                                                     			$this->formArray["totalBasic"] += $due->getBasicTax();
                                                     			$this->formArray["totalSef"] += $due->getSEFTax();
                                                     			$this->formArray["totalTaxes"] += $due->getTaxDue();  */
                                                     $totalBasic += $due->getBasicTax();
                                                     $totalSef += $due->getSEFTax();
                                                     $totalTaxes += $due->getTaxDue();
                                                 }
                                             }
                                         }
                                     }
                                     $tdCtr++;
                                 }
                             }
                             break;
                         default:
                             $this->formArray[$key] = $value;
                     }
                 }
                 $this->formArray["tdPageNumber"] = $tdPageNumber;
                 $this->formArray["tdTotalPages"] = $tdTotalPages;
                 $this->formArray["totalBasic"] += $totalBasic;
                 // RC 20091012 set values for last page of RPTOP
                 $this->formArray["totalSef"] += $totalSef;
                 $this->formArray["totalTaxes"] += $totalTaxes;
                 $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);
             }
         }
         $this->setForm();
         // send XML to file
         $this->clearForm();
         // clear the XML form values
     }
     // end batch loop
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     $testpdf->writePDF("RPTOPBatch.pdf");
     // popup the IE Save to File thingee...
     exit;
 }
Beispiel #24
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;
 }
Beispiel #25
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "updateCalculation":
             if (is_array($this->formArray["rptopID"])) {
                 $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 $DueEncode = new SoapObject(NCCBIZ . "DueEncode.php", "urn:Object");
                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                 $dueIDArray = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                 $treasurySettings = new TreasurySettings();
                 $treasurySettings->selectRecord();
                 $this->formArray["masterBasicTaxRate"] = $treasurySettings->getPctRPTax();
                 $this->formArray["masterSEFTaxRate"] = $treasurySettings->getPctSEF();
                 $this->formArray["masterIdleTaxRate"] = $treasurySettings->getPctIdle();
                 $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                 $this->formArray["annualDueDate"] = $treasurySettings->getAnnualDueDate();
                 foreach ($this->formArray["rptopID"] as $rptopID) {
                     if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
                         // error xmlStr
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             // error domDoc
                         } else {
                             $rptop = new RPTOP();
                             $rptop->parseDomDocument($domDoc);
                             $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                             $tdArray = $rptop->getTDArray();
                             if (is_array($tdArray)) {
                                 foreach ($tdArray as $td) {
                                     $this->formArray["assessedValue"] = "";
                                     $this->formArray["taxability"] = "";
                                     $this->formArray["idle"] = "";
                                     $this->formArray["tdID"] = $td->getTdID();
                                     $this->formArray["dueID"] = "";
                                     $this->formArray["propertyType"] = $td->getPropertyType();
                                     if (!($afsXmlStr = $AFSDetails->getAFS($td->getAfsID()))) {
                                         // error afsXmlStr
                                     } else {
                                         if (!($afsDomDoc = domxml_open_mem($afsXmlStr))) {
                                             // error afsDomDoc
                                         } else {
                                             $afs = new AFS();
                                             $afs->parseDomDocument($afsDomDoc);
                                             $this->formArray["assessedValue"] = $afs->getTotalAssessedValue();
                                             $this->formArray["taxability"] = $afs->getTaxability();
                                             $this->formArray["effectivity"] = $afs->getEffectivity();
                                             $this->formArray["dueDate"] = date("Y-n-d", strtotime($this->formArray["taxableYear"] . "-" . $this->formArray["annualDueDate"]));
                                             if ($this->formArray["propertyType"] == "Land") {
                                                 if (is_array($afs->getLandArray())) {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                     }
                                     if (!($dueXmlStr = $DueList->getDueList($td->getTdID(), $rptop->getTaxableYear()))) {
                                         $this->formArray["dueID"] = "";
                                         $dueIDArray["Annual"] = "";
                                     } else {
                                         if (!($dueDomDoc = domxml_open_mem($dueXmlStr))) {
                                             $this->formArray["dueID"] = "";
                                             $dueIDArray["Annual"] = "";
                                         } else {
                                             //print_r(htmlspecialchars($xmlStr));
                                             //exit;
                                             $dueRecords = new DueRecords();
                                             $dueRecords->parseDomDocument($dueDomDoc);
                                             foreach ($dueRecords->getArrayList() as $due) {
                                                 foreach ($due as $dueKey => $dueValue) {
                                                     switch ($dueKey) {
                                                         case "dueType":
                                                             $dueIDArray[$dueValue] = $due->getDueID();
                                                             break;
                                                     }
                                                 }
                                             }
                                             $this->formArray["dueID"] = $dueIDArray["Annual"];
                                         }
                                     }
                                     $this->formArray["basicTaxRate"] = $this->formArray["masterBasicTaxRate"];
                                     $this->formArray["sefTaxRate"] = $this->formArray["masterSEFTaxRate"];
                                     $this->formArray["idleTaxRate"] = $this->formArray["masterIdleTaxRate"];
                                     $this->formArray["basicTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["basicTaxRate"];
                                     $this->formArray["sefTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["sefTaxRate"];
                                     // if land->idle is "Yes", compute idleTax, otherwise set idleTax to zero
                                     if ($this->formArray["propertyType"] == "Land") {
                                         if ($this->formArray["idle"] == "Yes") {
                                             $this->formArray["idleTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["idleTaxRate"];
                                         } else {
                                             $this->formArray["idleTax"] = "0.00";
                                         }
                                     }
                                     // if afs->taxability is "Exempt", reset computations to zero.
                                     if ($this->formArray["taxability"] == "Exempt") {
                                         $this->formArray["basicTax"] = "0.00";
                                         $this->formArray["sefTax"] = "0.00";
                                         $this->formArray["idleTax"] = "0.00";
                                     }
                                     if ($dueIDArray["Annual"] != "") {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->updateDue($xmlStr))) {
                                                 // error update
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     } else {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->saveDue($xmlStr))) {
                                                 // error save
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     }
                                     $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                                     $this->refreshTDHistory($td);
                                 }
                             }
                             unset($tdArray);
                         }
                     }
                 }
             }
             if ($this->formArray["searchKey"] != "") {
                 $this->formArray["formAction"] = "search";
             } else {
                 $this->formArray["formAction"] = "";
             }
             header("Location: CalculateRPTOPBatch.php" . $this->sess->url("") . "&page=" . $this->formArray["page"] . "&sortBy=" . $this->formArray["sortBy"] . "&sortOrder=" . $this->formArray["sortOrder"] . "&formAction=" . $this->formArray["formAction"] . "&searchKey=" . $this->formArray["searchKey"]);
             exit;
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOPBatch.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }