Exemplo n.º 1
0
 function getTreasurySettings()
 {
     $treasurySettings = new TreasurySettings();
     $treasurySettings->selectRecord();
     return $treasurySettings;
 }
 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;
 }
Exemplo n.º 3
0
 function Main()
 {
     $treasurySettings = new TreasurySettings();
     switch ($this->formArray["formAction"]) {
         case "reset":
             // If TreasurySettings Table doesn't exist, Create table and insert defaults from masterTables
             $treasurySettings->setPenaltyLUT($this->masterTables["penaltyLUT"]);
             $treasurySettings->setAnnualDueDate($this->masterTables["annualDueDate"]);
             $treasurySettings->setPctRPTax($this->masterTables["pctRPTax"]);
             $treasurySettings->setPctSEF($this->masterTables["pctSEF"]);
             $treasurySettings->setPctIdle($this->masterTables["pctIdle"]);
             $treasurySettings->setDiscountPercentage($this->masterTables["discountPercentage"]);
             $treasurySettings->setDiscountPeriod($this->masterTables["discountPeriod"]);
             $treasurySettings->setAdvancedDiscountPercentage($this->masterTables["advancedDiscountPercentage"]);
             $treasurySettings->setQ1AdvancedDiscountPercentage($this->masterTables["q1AdvancedDiscountPercentage"]);
             if (!$treasurySettings->tableExists()) {
                 $treasurySettings->createTable();
                 $treasurySettings->insertRecord();
             } else {
                 $treasurySettings->updateRecord();
             }
             $this->formArray["message"] = "Variables reset to default values.";
             break;
         case "save":
             if ($treasurySettings->tableExists()) {
                 ksort($this->formArray["penaltyLUT"]);
                 reset($this->formArray["penaltyLUT"]);
                 $treasurySettings->setPenaltyLUT($this->formArray["penaltyLUT"]);
                 $treasurySettings->setAnnualDueDate($this->formArray["annualDueDate"]);
                 $treasurySettings->setPctRPTax($this->formArray["pctRPTax"]);
                 $treasurySettings->setPctSEF($this->formArray["pctSEF"]);
                 $treasurySettings->setPctIdle($this->formArray["pctIdle"]);
                 $treasurySettings->setDiscountPercentage($this->formArray["discountPercentage"]);
                 $treasurySettings->setDiscountPeriod($this->formArray["discountPeriod"]);
                 $treasurySettings->setAdvancedDiscountPercentage($this->formArray["advancedDiscountPercentage"]);
                 $treasurySettings->setQ1AdvancedDiscountPercentage($this->formArray["q1AdvancedDiscountPercentage"]);
                 if ($treasurySettings->updateRecord()) {
                     $this->formArray["message"] = "Treasury Settings saved.";
                 } else {
                     $this->formArray["message"] = "Error saving. Try clicking 'Reset' to restore defaults.";
                 }
             } else {
                 $this->formArray["message"] = "Error saving. Try clicking 'Reset' to restore defaults.";
             }
             break;
         default:
             // If TreasurySettings Table doesn't exist, Create table and insert defaults from masterTables (upon installation)
             if (!$treasurySettings->tableExists()) {
                 $treasurySettings->createTable();
             }
             // If somehow no record exists in Treasury Settings, Insert a Record (unlikely to occur)
             if (!$treasurySettings->selectRecord()) {
                 $treasurySettings->setPenaltyLUT($this->masterTables["penaltyLUT"]);
                 $treasurySettings->setAnnualDueDate($this->masterTables["annualDueDate"]);
                 $treasurySettings->setPctRPTax($this->masterTables["pctRPTax"]);
                 $treasurySettings->setPctSEF($this->masterTables["pctSEF"]);
                 $treasurySettings->setPctIdle($this->masterTables["pctIdle"]);
                 $treasurySettings->setDiscountPercentage($this->masterTables["discountPercentage"]);
                 $treasurySettings->setDiscountPeriod($this->masterTables["discountPeriod"]);
                 $treasurySettings->setAdvancedDiscountPercentage($this->masterTables["advancedDiscountPercentage"]);
                 $treasurySettings->setQ1AdvancedDiscountPercentage($this->masterTables["q1AdvancedDiscountPercentage"]);
                 $treasurySettings->insertRecord();
             }
             // If somehow more than 1 record exists in Treasury Settings, delete all records and Insert Record (unlikely to occur)
             if ($treasurySettings->countRecord() > 1) {
                 $treasurySettings->deleteRecord();
                 $treasurySettings->setPenaltyLUT($this->masterTables["penaltyLUT"]);
                 $treasurySettings->setAnnualDueDate($this->masterTables["annualDueDate"]);
                 $treasurySettings->setPctRPTax($this->masterTables["pctRPTax"]);
                 $treasurySettings->setPctSEF($this->masterTables["pctSEF"]);
                 $treasurySettings->setPctIdle($this->masterTables["pctIdle"]);
                 $treasurySettings->setDiscountPercentage($this->masterTables["discountPercentage"]);
                 $treasurySettings->setDiscountPeriod($this->masterTables["discountPeriod"]);
                 $treasurySettings->setAdvancedDiscountPercentage($this->masterTables["advancedDiscountPercentage"]);
                 $treasurySettings->setQ1AdvancedDiscountPercentage($this->masterTables["q1AdvancedDiscountPercentage"]);
                 $treasurySettings->insertRecord();
             }
     }
     if ($treasurySettings->selectRecord()) {
         $this->formArray["penaltyLUT"] = $treasurySettings->getPenaltyLUT();
         $this->formArray["annualDueDate"] = $treasurySettings->getAnnualDueDate();
         $this->formArray["pctRPTax"] = $treasurySettings->getPctRPTax();
         $this->formArray["pctSEF"] = $treasurySettings->getPctSEF();
         $this->formArray["pctIdle"] = $treasurySettings->getPctIdle();
         $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
         $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
         $this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage();
         $this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage();
     } else {
         foreach ($this->masterTables as $key => $value) {
             $this->formArray[$key] = $value;
         }
     }
     $this->showPenaltyLUTList();
     $this->setForm();
     $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");
 }
Exemplo n.º 4
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");
 }
Exemplo n.º 5
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");
 }
Exemplo n.º 6
0
 function Main()
 {
     global $DBid;
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->set_var("date", date("F d, Y"));
     $this->subRETaxableRealPropertyUnits = 0;
     $this->subRETaxableLandArea = 0;
     $this->subAGTaxableRealPropertyUnits = 0;
     $this->subAGTaxableLandArea = 0;
     $this->subCOTaxableRealPropertyUnits = 0;
     $this->subCOTaxableLandArea = 0;
     $this->subINTaxableRealPropertyUnits = 0;
     $this->subINTaxableLandArea = 0;
     $this->subMITaxableRealPropertyUnits = 0;
     $this->subMITaxableLandArea = 0;
     $this->subTITaxableRealPropertyUnits = 0;
     $this->subTITaxableLandArea = 0;
     $this->subSPTaxableRealPropertyUnits = 0;
     $this->subSPTaxableLandArea = 0;
     $this->subHOTaxableRealPropertyUnits = 0;
     $this->subHOTaxableLandArea = 0;
     $this->subSCTaxableRealPropertyUnits = 0;
     $this->subSCTaxableLandArea = 0;
     $this->subCUTaxableRealPropertyUnits = 0;
     $this->subCUTaxableLandArea = 0;
     $this->subOTTaxableRealPropertyUnits = 0;
     $this->subOTTaxableLandArea = 0;
     $this->subGOExemptRealPropertyUnits = 0;
     $this->subGOExemptLandArea = 0;
     $this->subRLExemptRealPropertyUnits = 0;
     $this->subRLExemptLandArea = 0;
     $this->subCHExemptRealPropertyUnits = 0;
     $this->subCHExemptLandArea = 0;
     $this->subEDExemptRealPropertyUnits = 0;
     $this->subEDExemptLandArea = 0;
     $this->subOTExemptRealPropertyUnits = 0;
     $this->subOTExemptLandArea = 0;
     $this->subRETaxableLandMarketValue = 0;
     $this->subRETaxableLandAssessedValue = 0;
     $this->subAGTaxableLandMarketValue = 0;
     $this->subAGTaxableLandAssessedValue = 0;
     $this->subCOTaxableLandMarketValue = 0;
     $this->subCOTaxableLandAssessedValue = 0;
     $this->subINTaxableLandMarketValue = 0;
     $this->subINTaxableLandAssessedValue = 0;
     $this->subMITaxableLandMarketValue = 0;
     $this->subMITaxableLandAssessedValue = 0;
     $this->subTITaxableLandMarketValue = 0;
     $this->subTITaxableLandAssessedValue = 0;
     $this->subSPTaxableLandMarketValue = 0;
     $this->subSPTaxableLandAssessedValue = 0;
     $this->subHOTaxableLandMarketValue = 0;
     $this->subHOTaxableLandAssessedValue = 0;
     $this->subSCTaxableLandMarketValue = 0;
     $this->subSCTaxableLandAssessedValue = 0;
     $this->subCUTaxableLandMarketValue = 0;
     $this->subCUTaxableLandAssessedValue = 0;
     $this->subOTTaxableLandMarketValue = 0;
     $this->subOTTaxableLandAssessedValue = 0;
     $this->subGOExemptLandMarketValue = 0;
     $this->subGOExemptLandAssessedValue = 0;
     $this->subRLExemptLandMarketValue = 0;
     $this->subRLExemptLandAssessedValue = 0;
     $this->subCHExemptLandMarketValue = 0;
     $this->subCHExemptLandAssessedValue = 0;
     $this->subEDExemptLandMarketValue = 0;
     $this->subEDExemptLandAssessedValue = 0;
     $this->subOTExemptLandMarketValue = 0;
     $this->subOTExemptLandAssessedValue = 0;
     $this->subRETaxableBldgLessMarketValue = 0;
     $this->subRETaxableBldgLessAssessedValue = 0;
     $this->subAGTaxableBldgLessMarketValue = 0;
     $this->subAGTaxableBldgLessAssessedValue = 0;
     $this->subCOTaxableBldgLessMarketValue = 0;
     $this->subCOTaxableBldgLessAssessedValue = 0;
     $this->subINTaxableBldgLessMarketValue = 0;
     $this->subINTaxableBldgLessAssessedValue = 0;
     $this->subMITaxableBldgLessMarketValue = 0;
     $this->subMITaxableBldgLessAssessedValue = 0;
     $this->subTITaxableBldgLessMarketValue = 0;
     $this->subTITaxableBldgLessAssessedValue = 0;
     $this->subSPTaxableBldgLessMarketValue = 0;
     $this->subSPTaxableBldgLessAssessedValue = 0;
     $this->subHOTaxableBldgLessMarketValue = 0;
     $this->subHOTaxableBldgLessAssessedValue = 0;
     $this->subSCTaxableBldgLessMarketValue = 0;
     $this->subSCTaxableBldgLessAssessedValue = 0;
     $this->subCUTaxableBldgLessMarketValue = 0;
     $this->subCUTaxableBldgLessAssessedValue = 0;
     $this->subOTTaxableBldgLessMarketValue = 0;
     $this->subOTTaxableBldgLessAssessedValue = 0;
     $this->subGOExemptBldgLessMarketValue = 0;
     $this->subGOExemptBldgLessAssessedValue = 0;
     $this->subRLExemptBldgLessMarketValue = 0;
     $this->subRLExemptBldgLessAssessedValue = 0;
     $this->subCHExemptBldgLessMarketValue = 0;
     $this->subCHExemptBldgLessAssessedValue = 0;
     $this->subEDExemptBldgLessMarketValue = 0;
     $this->subEDExemptBldgLessAssessedValue = 0;
     $this->subOTExemptBldgLessMarketValue = 0;
     $this->subOTExemptBldgLessAssessedValue = 0;
     $this->subRETaxableBldgOverMarketValue = 0;
     $this->subRETaxableBldgOverAssessedValue = 0;
     $this->subAGTaxableBldgOverMarketValue = 0;
     $this->subAGTaxableBldgOverAssessedValue = 0;
     $this->subCOTaxableBldgOverMarketValue = 0;
     $this->subCOTaxableBldgOverAssessedValue = 0;
     $this->subINTaxableBldgOverMarketValue = 0;
     $this->subINTaxableBldgOverAssessedValue = 0;
     $this->subMITaxableBldgOverMarketValue = 0;
     $this->subMITaxableBldgOverAssessedValue = 0;
     $this->subTITaxableBldgOverMarketValue = 0;
     $this->subTITaxableBldgOverAssessedValue = 0;
     $this->subSPTaxableBldgOverMarketValue = 0;
     $this->subSPTaxableBldgOverAssessedValue = 0;
     $this->subHOTaxableBldgOverMarketValue = 0;
     $this->subHOTaxableBldgOverAssessedValue = 0;
     $this->subSCTaxableBldgOverMarketValue = 0;
     $this->subSCTaxableBldgOverAssessedValue = 0;
     $this->subCUTaxableBldgOverMarketValue = 0;
     $this->subCUTaxableBldgOverAssessedValue = 0;
     $this->subOTTaxableBldgOverMarketValue = 0;
     $this->subOTTaxableBldgOverAssessedValue = 0;
     $this->subGOExemptBldgOverMarketValue = 0;
     $this->subGOExemptBldgOverAssessedValue = 0;
     $this->subRLExemptBldgOverMarketValue = 0;
     $this->subRLExemptBldgOverAssessedValue = 0;
     $this->subCHExemptBldgOverMarketValue = 0;
     $this->subCHExemptBldgOverAssessedValue = 0;
     $this->subEDExemptBldgOverMarketValue = 0;
     $this->subEDExemptBldgOverAssessedValue = 0;
     $this->subOTExemptBldgOverMarketValue = 0;
     $this->subOTExemptBldgOverAssessedValue = 0;
     $this->subRETaxableMachMarketValue = 0;
     $this->subRETaxableMachAssessedValue = 0;
     $this->subAGTaxableMachMarketValue = 0;
     $this->subAGTaxableMachAssessedValue = 0;
     $this->subCOTaxableMachMarketValue = 0;
     $this->subCOTaxableMachAssessedValue = 0;
     $this->subINTaxableMachMarketValue = 0;
     $this->subINTaxableMachAssessedValue = 0;
     $this->subMITaxableMachMarketValue = 0;
     $this->subMITaxableMachAssessedValue = 0;
     $this->subTITaxableMachMarketValue = 0;
     $this->subTITaxableMachAssessedValue = 0;
     $this->subSPTaxableMachMarketValue = 0;
     $this->subSPTaxableMachAssessedValue = 0;
     $this->subHOTaxableMachMarketValue = 0;
     $this->subHOTaxableMachAssessedValue = 0;
     $this->subSCTaxableMachMarketValue = 0;
     $this->subSCTaxableMachAssessedValue = 0;
     $this->subCUTaxableMachMarketValue = 0;
     $this->subCUTaxableMachAssessedValue = 0;
     $this->subOTTaxableMachMarketValue = 0;
     $this->subOTTaxableMachAssessedValue = 0;
     $this->subGOExemptMachMarketValue = 0;
     $this->subGOExemptMachAssessedValue = 0;
     $this->subRLExemptMachMarketValue = 0;
     $this->subRLExemptMachAssessedValue = 0;
     $this->subCHExemptMachMarketValue = 0;
     $this->subCHExemptMachAssessedValue = 0;
     $this->subEDExemptMachMarketValue = 0;
     $this->subEDExemptMachAssessedValue = 0;
     $this->subOTExemptMachMarketValue = 0;
     $this->subOTExemptMachAssessedValue = 0;
     $this->subRETaxableOtherMarketValue = 0;
     $this->subRETaxableOtherAssessedValue = 0;
     $this->subAGTaxableOtherMarketValue = 0;
     $this->subAGTaxableOtherAssessedValue = 0;
     $this->subCOTaxableOtherMarketValue = 0;
     $this->subCOTaxableOtherAssessedValue = 0;
     $this->subINTaxableOtherMarketValue = 0;
     $this->subINTaxableOtherAssessedValue = 0;
     $this->subMITaxableOtherMarketValue = 0;
     $this->subMITaxableOtherAssessedValue = 0;
     $this->subTITaxableOtherMarketValue = 0;
     $this->subTITaxableOtherAssessedValue = 0;
     $this->subSPTaxableOtherMarketValue = 0;
     $this->subSPTaxableOtherAssessedValue = 0;
     $this->subHOTaxableOtherMarketValue = 0;
     $this->subHOTaxableOtherAssessedValue = 0;
     $this->subSCTaxableOtherMarketValue = 0;
     $this->subSCTaxableOtherAssessedValue = 0;
     $this->subCUTaxableOtherMarketValue = 0;
     $this->subCUTaxableOtherAssessedValue = 0;
     $this->subOTTaxableOtherMarketValue = 0;
     $this->subOTTaxableOtherAssessedValue = 0;
     $this->subGOExemptOtherMarketValue = 0;
     $this->subGOExemptOtherAssessedValue = 0;
     $this->subRLExemptOtherMarketValue = 0;
     $this->subRLExemptOtherAssessedValue = 0;
     $this->subCHExemptOtherMarketValue = 0;
     $this->subCHExemptOtherAssessedValue = 0;
     $this->subEDExemptOtherMarketValue = 0;
     $this->subEDExemptOtherAssessedValue = 0;
     $this->subOTExemptOtherMarketValue = 0;
     $this->subOTExemptOtherAssessedValue = 0;
     $this->totalRETaxableMarketValue = 0;
     $this->totalRETaxableAssessedValue = 0;
     $this->totalAGTaxableMarketValue = 0;
     $this->totalAGTaxableAssessedValue = 0;
     $this->totalCOTaxableMarketValue = 0;
     $this->totalCOTaxableAssessedValue = 0;
     $this->totalINTaxableMarketValue = 0;
     $this->totalINTaxableAssessedValue = 0;
     $this->totalMITaxableMarketValue = 0;
     $this->totalMITaxableAssessedValue = 0;
     $this->totalTITaxableMarketValue = 0;
     $this->totalTITaxableAssessedValue = 0;
     $this->totalSPTaxableMarketValue = 0;
     $this->totalSPTaxableAssessedValue = 0;
     $this->totalHOTaxableMarketValue = 0;
     $this->totalHOTaxableAssessedValue = 0;
     $this->totalSCTaxableMarketValue = 0;
     $this->totalSCTaxableAssessedValue = 0;
     $this->totalCUTaxableMarketValue = 0;
     $this->totalCUTaxableAssessedValue = 0;
     $this->totalOTTaxableMarketValue = 0;
     $this->totalOTTaxableAssessedValue = 0;
     $this->totalGOExemptMarketValue = 0;
     $this->totalGOExemptAssessedValue = 0;
     $this->totalRLExemptMarketValue = 0;
     $this->totalRLExemptAssessedValue = 0;
     $this->totalCHExemptMarketValue = 0;
     $this->totalCHExemptAssessedValue = 0;
     $this->totalEDExemptMarketValue = 0;
     $this->totalEDExemptAssessedValue = 0;
     $this->totalOTExemptMarketValue = 0;
     $this->totalOTExemptAssessedValue = 0;
     $this->totalTaxableRealPropertyUnits = 0;
     $this->totalTaxableLandArea = 0;
     $this->totalTaxableLandMarketValue = 0;
     $this->totalTaxableLandAssessedValue = 0;
     $this->totalTaxableBldgLessMarketValue = 0;
     $this->totalTaxableBldgLessAssessedValue = 0;
     $this->totalTaxableBldgOverMarketValue = 0;
     $this->totalTaxableBldgOverAssessedValue = 0;
     $this->totalTaxableMachMarketValue = 0;
     $this->totalTaxableMachAssessedValue = 0;
     $this->totalTaxableOtherMarketValue = 0;
     $this->totalTaxableOtherAssessedValue = 0;
     $this->totalTaxableMarketValue = 0;
     $this->totalTaxableAssessedValue = 0;
     $this->totalExemptRealPropertyUnits = 0;
     $this->totalExemptLandArea = 0;
     $this->totalExemptLandMarketValue = 0;
     $this->totalExemptLandAssessedValue = 0;
     $this->totalExemptBldgLessMarketValue = 0;
     $this->totalExemptBldgLessAssessedValue = 0;
     $this->totalExemptBldgOverMarketValue = 0;
     $this->totalExemptBldgOverAssessedValue = 0;
     $this->totalExemptMachMarketValue = 0;
     $this->totalExemptMachAssessedValue = 0;
     $this->totalExemptOtherMarketValue = 0;
     $this->totalExemptOtherAssessedValue = 0;
     $this->totalExemptMarketValue = 0;
     $this->totalExemptAssessedValue = 0;
     $this->totalRealPropertyUnits = 0;
     $this->totalLandArea = 0;
     $this->totalLandMarketValue = 0;
     $this->totalLandAssessedValue = 0;
     $this->totalBldgLessMarketValue = 0;
     $this->totalBldgLessAssessedValue = 0;
     $this->totalBldgOverMarketValue = 0;
     $this->totalBldgOverAssessedValue = 0;
     $this->totalMachMarketValue = 0;
     $this->totalMachAssessedValue = 0;
     $this->totalOtherMarketValue = 0;
     $this->totalOtherAssessedValue = 0;
     $this->totalMarketValue = 0;
     $this->totalAssessedValue = 0;
     $ctr = 1;
     $this->dbs = "";
     foreach ($DBid as $key => $value) {
         $lgu = new LGU();
         $lgu->selectRecord($value);
         $this->dbName = $lgu->getLGUDB();
         if ($ctr == 1) {
             $this->dbs = $lgu->getLGUName();
         } else {
             $this->dbs .= " - " . $lgu->getLGUName();
         }
         $ctr++;
         $sql = "SELECT a.reportCode as reportCode, b.actualUse, count(b.propertyID) as rpu, sum( b.assessedValue ) as assessedValue, sum( b.adjustedMarketValue ) as adjustedMarketValue, sum(area) as area" . " FROM LandActualUses a" . " LEFT  JOIN Land b ON a.landActualUsesID = b.actualUse" . " GROUP  BY a.reportCode;";
         $this->computeProperty("Land", $sql);
         $sql = "SELECT a.reportCode as reportCode, b.actualUse, count(b.propertyID), sum( b.assessedValue ) as assessedValue, sum( b.adjustedMarketValue ) as adjustedMarketValue" . " FROM ImprovementsBuildingsActualUses a" . " LEFT  JOIN ImprovementsBuildings b ON a.improvementsBuildingsActualUsesID = b.actualUse AND b.adjustedMarketValue <= 175000" . " GROUP  BY a.reportCode;";
         $this->computeProperty("BldgLess", $sql);
         $sql = "SELECT a.reportCode as reportCode, b.actualUse, count(b.propertyID), sum( b.assessedValue ) as assessedValue, sum( b.adjustedMarketValue ) as adjustedMarketValue" . " FROM ImprovementsBuildingsActualUses a" . " LEFT  JOIN ImprovementsBuildings b ON a.improvementsBuildingsActualUsesID = b.actualUse AND b.adjustedMarketValue > 175000" . " GROUP  BY a.reportCode;";
         $this->computeProperty("BldgOver", $sql);
         $sql = "SELECT a.reportCode as reportCode, b.actualUse, count(b.propertyID), sum( b.assessedValue ) as assessedValue, sum( b.adjustedMarketValue ) as adjustedMarketValue" . " FROM MachineriesActualUses a" . " LEFT  JOIN Machineries b ON a.machineriesActualUsesID = b.actualUse" . " GROUP  BY a.reportCode;";
         $this->computeProperty("Mach", $sql);
         $this->countRealPropertyUnits();
     }
     $this->tpl->set_var("RETaxable_RealPropertyUnits", number_format($this->subRETaxableRealPropertyUnits));
     $this->tpl->set_var("RETaxable_LandArea", $this->checkNumericFormat($this->subRETaxableLandArea));
     $this->tpl->set_var("AGTaxable_RealPropertyUnits", number_format($this->subAGTaxableRealPropertyUnits));
     $this->tpl->set_var("AGTaxable_LandArea", $this->checkNumericFormat($this->subAGTaxableLandArea));
     $this->tpl->set_var("COTaxable_RealPropertyUnits", number_format($this->subCOTaxableRealPropertyUnits));
     $this->tpl->set_var("COTaxable_LandArea", $this->checkNumericFormat($this->subCOTaxableLandArea));
     $this->tpl->set_var("INTaxable_RealPropertyUnits", number_format($this->subINTaxableRealPropertyUnits));
     $this->tpl->set_var("INTaxable_LandArea", $this->checkNumericFormat($this->subINTaxableLandArea));
     $this->tpl->set_var("MITaxable_RealPropertyUnits", number_format($this->subMITaxableRealPropertyUnits));
     $this->tpl->set_var("MITaxable_LandArea", $this->checkNumericFormat($this->subMITaxableLandArea));
     $this->tpl->set_var("TITaxable_RealPropertyUnits", number_format($this->subTITaxableRealPropertyUnits));
     $this->tpl->set_var("TITaxable_LandArea", $this->checkNumericFormat($this->subTITaxableLandArea));
     $this->tpl->set_var("SPTaxable_RealPropertyUnits", number_format($this->subSPTaxableRealPropertyUnits));
     $this->tpl->set_var("SPTaxable_LandArea", $this->checkNumericFormat($this->subSPTaxableLandArea));
     $this->tpl->set_var("HOTaxable_RealPropertyUnits", number_format($this->subHOTaxableRealPropertyUnits));
     $this->tpl->set_var("HOTaxable_LandArea", $this->checkNumericFormat($this->subHOTaxableLandArea));
     $this->tpl->set_var("SCTaxable_RealPropertyUnits", number_format($this->subSCTaxableRealPropertyUnits));
     $this->tpl->set_var("SCTaxable_LandArea", $this->checkNumericFormat($this->subSCTaxableLandArea));
     $this->tpl->set_var("CUTaxable_RealPropertyUnits", number_format($this->subCUTaxableRealPropertyUnits));
     $this->tpl->set_var("CUTaxable_LandArea", $this->checkNumericFormat($this->subCUTaxableLandArea));
     $this->tpl->set_var("OTTaxable_RealPropertyUnits", number_format($this->subOTTaxableRealPropertyUnits));
     $this->tpl->set_var("OTTaxable_LandArea", $this->checkNumericFormat($this->subOTTaxableLandArea));
     $this->tpl->set_var("GOExempt_RealPropertyUnits", number_format($this->subGOExemptRealPropertyUnits));
     $this->tpl->set_var("GOExempt_LandArea", $this->checkNumericFormat($this->subGOExemptLandArea));
     $this->tpl->set_var("RLExempt_RealPropertyUnits", number_format($this->subRLExemptRealPropertyUnits));
     $this->tpl->set_var("RLExempt_LandArea", $this->checkNumericFormat($this->subRLExemptLandArea));
     $this->tpl->set_var("CHExempt_RealPropertyUnits", number_format($this->subCHExemptRealPropertyUnits));
     $this->tpl->set_var("CHExempt_LandArea", $this->checkNumericFormat($this->subCHExemptLandArea));
     $this->tpl->set_var("EDExempt_RealPropertyUnits", number_format($this->subEDExemptRealPropertyUnits));
     $this->tpl->set_var("EDExempt_LandArea", $this->checkNumericFormat($this->subEDExemptLandArea));
     $this->tpl->set_var("OTExempt_RealPropertyUnits", number_format($this->subOTExemptRealPropertyUnits));
     $this->tpl->set_var("OTExempt_LandArea", $this->checkNumericFormat($this->subOTExemptLandArea));
     $this->tpl->set_var("RETaxable_LandMV", $this->checkNumericFormat($this->subRETaxableLandMarketValue));
     $this->tpl->set_var("RETaxable_LandAV", $this->checkNumericFormat($this->subRETaxableLandAssessedValue));
     $this->tpl->set_var("AGTaxable_LandMV", $this->checkNumericFormat($this->subAGTaxableLandMarketValue));
     $this->tpl->set_var("AGTaxable_LandAV", $this->checkNumericFormat($this->subAGTaxableLandAssessedValue));
     $this->tpl->set_var("COTaxable_LandMV", $this->checkNumericFormat($this->subCOTaxableLandMarketValue));
     $this->tpl->set_var("COTaxable_LandAV", $this->checkNumericFormat($this->subCOTaxableLandAssessedValue));
     $this->tpl->set_var("INTaxable_LandMV", $this->checkNumericFormat($this->subINTaxableLandMarketValue));
     $this->tpl->set_var("INTaxable_LandAV", $this->checkNumericFormat($this->subINTaxableLandAssessedValue));
     $this->tpl->set_var("MITaxable_LandMV", $this->checkNumericFormat($this->subMITaxableLandMarketValue));
     $this->tpl->set_var("MITaxable_LandAV", $this->checkNumericFormat($this->subMITaxableLandAssessedValue));
     $this->tpl->set_var("TITaxable_LandMV", $this->checkNumericFormat($this->subTITaxableLandMarketValue));
     $this->tpl->set_var("TITaxable_LandAV", $this->checkNumericFormat($this->subTITaxableLandAssessedValue));
     $this->tpl->set_var("SPTaxable_LandMV", $this->checkNumericFormat($this->subSPTaxableLandMarketValue));
     $this->tpl->set_var("SPTaxable_LandAV", $this->checkNumericFormat($this->subSPTaxableLandAssessedValue));
     $this->tpl->set_var("HOTaxable_LandMV", $this->checkNumericFormat($this->subHOTaxableLandMarketValue));
     $this->tpl->set_var("HOTaxable_LandAV", $this->checkNumericFormat($this->subHOTaxableLandAssessedValue));
     $this->tpl->set_var("SCTaxable_LandMV", $this->checkNumericFormat($this->subSCTaxableLandMarketValue));
     $this->tpl->set_var("SCTaxable_LandAV", $this->checkNumericFormat($this->subSCTaxableLandAssessedValue));
     $this->tpl->set_var("CUTaxable_LandMV", $this->checkNumericFormat($this->subCUTaxableLandMarketValue));
     $this->tpl->set_var("CUTaxable_LandAV", $this->checkNumericFormat($this->subCUTaxableLandAssessedValue));
     $this->tpl->set_var("OTTaxable_LandMV", $this->checkNumericFormat($this->subOTTaxableLandMarketValue));
     $this->tpl->set_var("OTTaxable_LandAV", $this->checkNumericFormat($this->subOTTaxableLandAssessedValue));
     $this->tpl->set_var("GOExempt_LandMV", $this->checkNumericFormat($this->subGOExemptLandMarketValue));
     $this->tpl->set_var("GOExempt_LandAV", $this->checkNumericFormat($this->subGOExemptLandAssessedValue));
     $this->tpl->set_var("RLExempt_LandMV", $this->checkNumericFormat($this->subRLExemptLandMarketValue));
     $this->tpl->set_var("RLExempt_LandAV", $this->checkNumericFormat($this->subRLExemptLandAssessedValue));
     $this->tpl->set_var("CHExempt_LandMV", $this->checkNumericFormat($this->subCHExemptLandMarketValue));
     $this->tpl->set_var("CHExempt_LandAV", $this->checkNumericFormat($this->subCHExemptLandAssessedValue));
     $this->tpl->set_var("EDExempt_LandMV", $this->checkNumericFormat($this->subEDExemptLandMarketValue));
     $this->tpl->set_var("EDExempt_LandAV", $this->checkNumericFormat($this->subEDExemptLandAssessedValue));
     $this->tpl->set_var("OTExempt_LandMV", $this->checkNumericFormat($this->subOTExemptLandMarketValue));
     $this->tpl->set_var("OTExempt_LandAV", $this->checkNumericFormat($this->subOTExemptLandAssessedValue));
     $this->tpl->set_var("RETaxable_BldgLessMV", $this->checkNumericFormat($this->subRETaxableBldgLessMarketValue));
     $this->tpl->set_var("RETaxable_BldgLessAV", $this->checkNumericFormat($this->subRETaxableBldgLessAssessedValue));
     $this->tpl->set_var("AGTaxable_BldgLessMV", $this->checkNumericFormat($this->subAGTaxableBldgLessMarketValue));
     $this->tpl->set_var("AGTaxable_BldgLessAV", $this->checkNumericFormat($this->subAGTaxableBldgLessAssessedValue));
     $this->tpl->set_var("COTaxable_BldgLessMV", $this->checkNumericFormat($this->subCOTaxableBldgLessMarketValue));
     $this->tpl->set_var("COTaxable_BldgLessAV", $this->checkNumericFormat($this->subCOTaxableBldgLessAssessedValue));
     $this->tpl->set_var("INTaxable_BldgLessMV", $this->checkNumericFormat($this->subINTaxableBldgLessMarketValue));
     $this->tpl->set_var("INTaxable_BldgLessAV", $this->checkNumericFormat($this->subINTaxableBldgLessAssessedValue));
     $this->tpl->set_var("MITaxable_BldgLessMV", $this->checkNumericFormat($this->subMITaxableBldgLessMarketValue));
     $this->tpl->set_var("MITaxable_BldgLessAV", $this->checkNumericFormat($this->subMITaxableBldgLessAssessedValue));
     $this->tpl->set_var("TITaxable_BldgLessMV", $this->checkNumericFormat($this->subTITaxableBldgLessMarketValue));
     $this->tpl->set_var("TITaxable_BldgLessAV", $this->checkNumericFormat($this->subTITaxableBldgLessAssessedValue));
     $this->tpl->set_var("SPTaxable_BldgLessMV", $this->checkNumericFormat($this->subSPTaxableBldgLessMarketValue));
     $this->tpl->set_var("SPTaxable_BldgLessAV", $this->checkNumericFormat($this->subSPTaxableBldgLessAssessedValue));
     $this->tpl->set_var("HOTaxable_BldgLessMV", $this->checkNumericFormat($this->subHOTaxableBldgLessMarketValue));
     $this->tpl->set_var("HOTaxable_BldgLessAV", $this->checkNumericFormat($this->subHOTaxableBldgLessAssessedValue));
     $this->tpl->set_var("SCTaxable_BldgLessMV", $this->checkNumericFormat($this->subSCTaxableBldgLessMarketValue));
     $this->tpl->set_var("SCTaxable_BldgLessAV", $this->checkNumericFormat($this->subSCTaxableBldgLessAssessedValue));
     $this->tpl->set_var("CUTaxable_BldgLessMV", $this->checkNumericFormat($this->subCUTaxableBldgLessMarketValue));
     $this->tpl->set_var("CUTaxable_BldgLessAV", $this->checkNumericFormat($this->subCUTaxableBldgLessAssessedValue));
     $this->tpl->set_var("OTTaxable_BldgLessMV", $this->checkNumericFormat($this->subOTTaxableBldgLessMarketValue));
     $this->tpl->set_var("OTTaxable_BldgLessAV", $this->checkNumericFormat($this->subOTTaxableBldgLessAssessedValue));
     $this->tpl->set_var("GOExempt_BldgLessMV", $this->checkNumericFormat($this->subGOExemptBldgLessMarketValue));
     $this->tpl->set_var("GOExempt_BldgLessAV", $this->checkNumericFormat($this->subGOExemptBldgLessAssessedValue));
     $this->tpl->set_var("RLExempt_BldgLessMV", $this->checkNumericFormat($this->subRLExemptBldgLessMarketValue));
     $this->tpl->set_var("RLExempt_BldgLessAV", $this->checkNumericFormat($this->subRLExemptBldgLessAssessedValue));
     $this->tpl->set_var("CHExempt_BldgLessMV", $this->checkNumericFormat($this->subCHExemptBldgLessMarketValue));
     $this->tpl->set_var("CHExempt_BldgLessAV", $this->checkNumericFormat($this->subCHExemptBldgLessAssessedValue));
     $this->tpl->set_var("EDExempt_BldgLessMV", $this->checkNumericFormat($this->subEDExemptBldgLessMarketValue));
     $this->tpl->set_var("EDExempt_BldgLessAV", $this->checkNumericFormat($this->subEDExemptBldgLessAssessedValue));
     $this->tpl->set_var("OTExempt_BldgLessMV", $this->checkNumericFormat($this->subOTExemptBldgLessMarketValue));
     $this->tpl->set_var("OTExempt_BldgLessAV", $this->checkNumericFormat($this->subOTExemptBldgLessAssessedValue));
     $this->tpl->set_var("RETaxable_BldgOverMV", $this->checkNumericFormat($this->subRETaxableBldgOverMarketValue));
     $this->tpl->set_var("RETaxable_BldgOverAV", $this->checkNumericFormat($this->subRETaxableBldgOverAssessedValue));
     $this->tpl->set_var("AGTaxable_BldgOverMV", $this->checkNumericFormat($this->subAGTaxableBldgOverMarketValue));
     $this->tpl->set_var("AGTaxable_BldgOverAV", $this->checkNumericFormat($this->subAGTaxableBldgOverAssessedValue));
     $this->tpl->set_var("COTaxable_BldgOverMV", $this->checkNumericFormat($this->subCOTaxableBldgOverMarketValue));
     $this->tpl->set_var("COTaxable_BldgOverAV", $this->checkNumericFormat($this->subCOTaxableBldgOverAssessedValue));
     $this->tpl->set_var("INTaxable_BldgOverMV", $this->checkNumericFormat($this->subINTaxableBldgOverMarketValue));
     $this->tpl->set_var("INTaxable_BldgOverAV", $this->checkNumericFormat($this->subINTaxableBldgOverAssessedValue));
     $this->tpl->set_var("MITaxable_BldgOverMV", $this->checkNumericFormat($this->subMITaxableBldgOverMarketValue));
     $this->tpl->set_var("MITaxable_BldgOverAV", $this->checkNumericFormat($this->subMITaxableBldgOverAssessedValue));
     $this->tpl->set_var("TITaxable_BldgOverMV", $this->checkNumericFormat($this->subTITaxableBldgOverMarketValue));
     $this->tpl->set_var("TITaxable_BldgOverAV", $this->checkNumericFormat($this->subTITaxableBldgOverAssessedValue));
     $this->tpl->set_var("SPTaxable_BldgOverMV", $this->checkNumericFormat($this->subSPTaxableBldgOverMarketValue));
     $this->tpl->set_var("SPTaxable_BldgOverAV", $this->checkNumericFormat($this->subSPTaxableBldgOverAssessedValue));
     $this->tpl->set_var("HOTaxable_BldgOverMV", $this->checkNumericFormat($this->subHOTaxableBldgOverMarketValue));
     $this->tpl->set_var("HOTaxable_BldgOverAV", $this->checkNumericFormat($this->subHOTaxableBldgOverAssessedValue));
     $this->tpl->set_var("SCTaxable_BldgOverMV", $this->checkNumericFormat($this->subSCTaxableBldgOverMarketValue));
     $this->tpl->set_var("SCTaxable_BldgOverAV", $this->checkNumericFormat($this->subSCTaxableBldgOverAssessedValue));
     $this->tpl->set_var("CUTaxable_BldgOverMV", $this->checkNumericFormat($this->subCUTaxableBldgOverMarketValue));
     $this->tpl->set_var("CUTaxable_BldgOverAV", $this->checkNumericFormat($this->subCUTaxableBldgOverAssessedValue));
     $this->tpl->set_var("OTTaxable_BldgOverMV", $this->checkNumericFormat($this->subOTTaxableBldgOverMarketValue));
     $this->tpl->set_var("OTTaxable_BldgOverAV", $this->checkNumericFormat($this->subOTTaxableBldgOverAssessedValue));
     $this->tpl->set_var("GOExempt_BldgOverMV", $this->checkNumericFormat($this->subGOExemptBldgOverMarketValue));
     $this->tpl->set_var("GOExempt_BldgOverAV", $this->checkNumericFormat($this->subGOExemptBldgOverAssessedValue));
     $this->tpl->set_var("RLExempt_BldgOverMV", $this->checkNumericFormat($this->subRLExemptBldgOverMarketValue));
     $this->tpl->set_var("RLExempt_BldgOverAV", $this->checkNumericFormat($this->subRLExemptBldgOverAssessedValue));
     $this->tpl->set_var("CHExempt_BldgOverMV", $this->checkNumericFormat($this->subCHExemptBldgOverMarketValue));
     $this->tpl->set_var("CHExempt_BldgOverAV", $this->checkNumericFormat($this->subCHExemptBldgOverAssessedValue));
     $this->tpl->set_var("EDExempt_BldgOverMV", $this->checkNumericFormat($this->subEDExemptBldgOverMarketValue));
     $this->tpl->set_var("EDExempt_BldgOverAV", $this->checkNumericFormat($this->subEDExemptBldgOverAssessedValue));
     $this->tpl->set_var("OTExempt_BldgOverMV", $this->checkNumericFormat($this->subOTExemptBldgOverMarketValue));
     $this->tpl->set_var("OTExempt_BldgOverAV", $this->checkNumericFormat($this->subOTExemptBldgOverAssessedValue));
     $this->tpl->set_var("RETaxable_MachMV", $this->checkNumericFormat($this->subRETaxableMachMarketValue));
     $this->tpl->set_var("RETaxable_MachAV", $this->checkNumericFormat($this->subRETaxableMachAssessedValue));
     $this->tpl->set_var("AGTaxable_MachMV", $this->checkNumericFormat($this->subAGTaxableMachMarketValue));
     $this->tpl->set_var("AGTaxable_MachAV", $this->checkNumericFormat($this->subAGTaxableMachAssessedValue));
     $this->tpl->set_var("COTaxable_MachMV", $this->checkNumericFormat($this->subCOTaxableMachMarketValue));
     $this->tpl->set_var("COTaxable_MachAV", $this->checkNumericFormat($this->subCOTaxableMachAssessedValue));
     $this->tpl->set_var("INTaxable_MachMV", $this->checkNumericFormat($this->subINTaxableMachMarketValue));
     $this->tpl->set_var("INTaxable_MachAV", $this->checkNumericFormat($this->subINTaxableMachAssessedValue));
     $this->tpl->set_var("MITaxable_MachMV", $this->checkNumericFormat($this->subMITaxableMachMarketValue));
     $this->tpl->set_var("MITaxable_MachAV", $this->checkNumericFormat($this->subMITaxableMachAssessedValue));
     $this->tpl->set_var("TITaxable_MachMV", $this->checkNumericFormat($this->subTITaxableMachMarketValue));
     $this->tpl->set_var("TITaxable_MachAV", $this->checkNumericFormat($this->subTITaxableMachAssessedValue));
     $this->tpl->set_var("SPTaxable_MachMV", $this->checkNumericFormat($this->subSPTaxableMachMarketValue));
     $this->tpl->set_var("SPTaxable_MachAV", $this->checkNumericFormat($this->subSPTaxableMachAssessedValue));
     $this->tpl->set_var("HOTaxable_MachMV", $this->checkNumericFormat($this->subHOTaxableMachMarketValue));
     $this->tpl->set_var("HOTaxable_MachAV", $this->checkNumericFormat($this->subHOTaxableMachAssessedValue));
     $this->tpl->set_var("SCTaxable_MachMV", $this->checkNumericFormat($this->subSCTaxableMachMarketValue));
     $this->tpl->set_var("SCTaxable_MachAV", $this->checkNumericFormat($this->subSCTaxableMachAssessedValue));
     $this->tpl->set_var("CUTaxable_MachMV", $this->checkNumericFormat($this->subCUTaxableMachMarketValue));
     $this->tpl->set_var("CUTaxable_MachAV", $this->checkNumericFormat($this->subCUTaxableMachAssessedValue));
     $this->tpl->set_var("OTTaxable_MachMV", $this->checkNumericFormat($this->subOTTaxableMachMarketValue));
     $this->tpl->set_var("OTTaxable_MachAV", $this->checkNumericFormat($this->subOTTaxableMachAssessedValue));
     $this->tpl->set_var("GOExempt_MachMV", $this->checkNumericFormat($this->subGOExemptMachMarketValue));
     $this->tpl->set_var("GOExempt_MachAV", $this->checkNumericFormat($this->subGOExemptMachAssessedValue));
     $this->tpl->set_var("RLExempt_MachMV", $this->checkNumericFormat($this->subRLExemptMachMarketValue));
     $this->tpl->set_var("RLExempt_MachAV", $this->checkNumericFormat($this->subRLExemptMachAssessedValue));
     $this->tpl->set_var("CHExempt_MachMV", $this->checkNumericFormat($this->subCHExemptMachMarketValue));
     $this->tpl->set_var("CHExempt_MachAV", $this->checkNumericFormat($this->subCHExemptMachAssessedValue));
     $this->tpl->set_var("EDExempt_MachMV", $this->checkNumericFormat($this->subEDExemptMachMarketValue));
     $this->tpl->set_var("EDExempt_MachAV", $this->checkNumericFormat($this->subEDExemptMachAssessedValue));
     $this->tpl->set_var("OTExempt_MachMV", $this->checkNumericFormat($this->subOTExemptMachMarketValue));
     $this->tpl->set_var("OTExempt_MachAV", $this->checkNumericFormat($this->subOTExemptMachAssessedValue));
     $this->tpl->set_var("RETaxable_OtherMV", $this->checkNumericFormat($this->subRETaxableOtherMarketValue));
     $this->tpl->set_var("RETaxable_OtherAV", $this->checkNumericFormat($this->subRETaxableOtherAssessedValue));
     $this->tpl->set_var("AGTaxable_OtherMV", $this->checkNumericFormat($this->subAGTaxableOtherMarketValue));
     $this->tpl->set_var("AGTaxable_OtherAV", $this->checkNumericFormat($this->subAGTaxableOtherAssessedValue));
     $this->tpl->set_var("COTaxable_OtherMV", $this->checkNumericFormat($this->subCOTaxableOtherMarketValue));
     $this->tpl->set_var("COTaxable_OtherAV", $this->checkNumericFormat($this->subCOTaxableOtherAssessedValue));
     $this->tpl->set_var("INTaxable_OtherMV", $this->checkNumericFormat($this->subINTaxableOtherMarketValue));
     $this->tpl->set_var("INTaxable_OtherAV", $this->checkNumericFormat($this->subINTaxableOtherAssessedValue));
     $this->tpl->set_var("MITaxable_OtherMV", $this->checkNumericFormat($this->subMITaxableOtherMarketValue));
     $this->tpl->set_var("MITaxable_OtherAV", $this->checkNumericFormat($this->subMITaxableOtherAssessedValue));
     $this->tpl->set_var("TITaxable_OtherMV", $this->checkNumericFormat($this->subTITaxableOtherMarketValue));
     $this->tpl->set_var("TITaxable_OtherAV", $this->checkNumericFormat($this->subTITaxableOtherAssessedValue));
     $this->tpl->set_var("SPTaxable_OtherMV", $this->checkNumericFormat($this->subSPTaxableOtherMarketValue));
     $this->tpl->set_var("SPTaxable_OtherAV", $this->checkNumericFormat($this->subSPTaxableOtherAssessedValue));
     $this->tpl->set_var("HOTaxable_OtherMV", $this->checkNumericFormat($this->subHOTaxableOtherMarketValue));
     $this->tpl->set_var("HOTaxable_OtherAV", $this->checkNumericFormat($this->subHOTaxableOtherAssessedValue));
     $this->tpl->set_var("SCTaxable_OtherMV", $this->checkNumericFormat($this->subSCTaxableOtherMarketValue));
     $this->tpl->set_var("SCTaxable_OtherAV", $this->checkNumericFormat($this->subSCTaxableOtherAssessedValue));
     $this->tpl->set_var("CUTaxable_OtherMV", $this->checkNumericFormat($this->subCUTaxableOtherMarketValue));
     $this->tpl->set_var("CUTaxable_OtherAV", $this->checkNumericFormat($this->subCUTaxableOtherAssessedValue));
     $this->tpl->set_var("OTTaxable_OtherMV", $this->checkNumericFormat($this->subOTTaxableOtherMarketValue));
     $this->tpl->set_var("OTTaxable_OtherAV", $this->checkNumericFormat($this->subOTTaxableOtherAssessedValue));
     $this->tpl->set_var("GOExempt_OtherMV", $this->checkNumericFormat($this->subGOExemptOtherMarketValue));
     $this->tpl->set_var("GOExempt_OtherAV", $this->checkNumericFormat($this->subGOExemptOtherAssessedValue));
     $this->tpl->set_var("RLExempt_OtherMV", $this->checkNumericFormat($this->subRLExemptOtherMarketValue));
     $this->tpl->set_var("RLExempt_OtherAV", $this->checkNumericFormat($this->subRLExemptOtherAssessedValue));
     $this->tpl->set_var("CHExempt_OtherMV", $this->checkNumericFormat($this->subCHExemptOtherMarketValue));
     $this->tpl->set_var("CHExempt_OtherAV", $this->checkNumericFormat($this->subCHExemptOtherAssessedValue));
     $this->tpl->set_var("EDExempt_OtherMV", $this->checkNumericFormat($this->subEDExemptOtherMarketValue));
     $this->tpl->set_var("EDExempt_OtherAV", $this->checkNumericFormat($this->subEDExemptOtherAssessedValue));
     $this->tpl->set_var("OTExempt_OtherMV", $this->checkNumericFormat($this->subOTExemptOtherMarketValue));
     $this->tpl->set_var("OTExempt_OtherAV", $this->checkNumericFormat($this->subOTExemptOtherAssessedValue));
     $this->tpl->set_var("RETaxable_TotalMV", $this->checkNumericFormat($this->totalRETaxableMarketValue));
     $this->tpl->set_var("RETaxable_TotalAV", $this->checkNumericFormat($this->totalRETaxableAssessedValue));
     $this->tpl->set_var("AGTaxable_TotalMV", $this->checkNumericFormat($this->totalAGTaxableMarketValue));
     $this->tpl->set_var("AGTaxable_TotalAV", $this->checkNumericFormat($this->totalAGTaxableAssessedValue));
     $this->tpl->set_var("COTaxable_TotalMV", $this->checkNumericFormat($this->totalCOTaxableMarketValue));
     $this->tpl->set_var("COTaxable_TotalAV", $this->checkNumericFormat($this->totalCOTaxableAssessedValue));
     $this->tpl->set_var("INTaxable_TotalMV", $this->checkNumericFormat($this->totalINTaxableMarketValue));
     $this->tpl->set_var("INTaxable_TotalAV", $this->checkNumericFormat($this->totalINTaxableAssessedValue));
     $this->tpl->set_var("MITaxable_TotalMV", $this->checkNumericFormat($this->totalMITaxableMarketValue));
     $this->tpl->set_var("MITaxable_TotalAV", $this->checkNumericFormat($this->totalMITaxableAssessedValue));
     $this->tpl->set_var("TITaxable_TotalMV", $this->checkNumericFormat($this->totalTITaxableMarketValue));
     $this->tpl->set_var("TITaxable_TotalAV", $this->checkNumericFormat($this->totalTITaxableAssessedValue));
     $this->tpl->set_var("SPTaxable_TotalMV", $this->checkNumericFormat($this->totalSPTaxableMarketValue));
     $this->tpl->set_var("SPTaxable_TotalAV", $this->checkNumericFormat($this->totalSPTaxableAssessedValue));
     $this->tpl->set_var("HOTaxable_TotalMV", $this->checkNumericFormat($this->totalHOTaxableMarketValue));
     $this->tpl->set_var("HOTaxable_TotalAV", $this->checkNumericFormat($this->totalHOTaxableAssessedValue));
     $this->tpl->set_var("SCTaxable_TotalMV", $this->checkNumericFormat($this->totalSCTaxableMarketValue));
     $this->tpl->set_var("SCTaxable_TotalAV", $this->checkNumericFormat($this->totalSCTaxableAssessedValue));
     $this->tpl->set_var("CUTaxable_TotalMV", $this->checkNumericFormat($this->totalCUTaxableMarketValue));
     $this->tpl->set_var("CUTaxable_TotalAV", $this->checkNumericFormat($this->totalCUTaxableAssessedValue));
     $this->tpl->set_var("OTTaxable_TotalMV", $this->checkNumericFormat($this->totalOTTaxableMarketValue));
     $this->tpl->set_var("OTTaxable_TotalAV", $this->checkNumericFormat($this->totalOTTaxableAssessedValue));
     $this->tpl->set_var("GOExempt_TotalMV", $this->checkNumericFormat($this->totalGOExemptMarketValue));
     $this->tpl->set_var("GOExempt_TotalAV", $this->checkNumericFormat($this->totalGOExemptAssessedValue));
     $this->tpl->set_var("RLExempt_TotalMV", $this->checkNumericFormat($this->totalRLExemptMarketValue));
     $this->tpl->set_var("RLExempt_TotalAV", $this->checkNumericFormat($this->totalRLExemptAssessedValue));
     $this->tpl->set_var("CHExempt_TotalMV", $this->checkNumericFormat($this->totalCHExemptMarketValue));
     $this->tpl->set_var("CHExempt_TotalAV", $this->checkNumericFormat($this->totalCHExemptAssessedValue));
     $this->tpl->set_var("EDExempt_TotalMV", $this->checkNumericFormat($this->totalEDExemptMarketValue));
     $this->tpl->set_var("EDExempt_TotalAV", $this->checkNumericFormat($this->totalEDExemptAssessedValue));
     $this->tpl->set_var("OTExempt_TotalMV", $this->checkNumericFormat($this->totalOTExemptMarketValue));
     $this->tpl->set_var("OTExempt_TotalAV", $this->checkNumericFormat($this->totalOTExemptAssessedValue));
     $this->tpl->set_var("Taxable_RealPropertyUnits", number_format($this->totalTaxableRealPropertyUnits));
     $this->tpl->set_var("Taxable_LandArea", $this->checkNumericFormat($this->totalTaxableLandArea));
     $this->tpl->set_var("Taxable_LandMV", $this->checkNumericFormat($this->totalTaxableLandMarketValue));
     $this->tpl->set_var("Taxable_LandAV", $this->checkNumericFormat($this->totalTaxableLandAssessedValue));
     $this->tpl->set_var("Taxable_BldgLessMV", $this->checkNumericFormat($this->totalTaxableBldgLessMarketValue));
     $this->tpl->set_var("Taxable_BldgLessAV", $this->checkNumericFormat($this->totalTaxableBldgLessAssessedValue));
     $this->tpl->set_var("Taxable_BldgOverMV", $this->checkNumericFormat($this->totalTaxableBldgOverMarketValue));
     $this->tpl->set_var("Taxable_BldgOverAV", $this->checkNumericFormat($this->totalTaxableBldgOverAssessedValue));
     $this->tpl->set_var("Taxable_MachMV", $this->checkNumericFormat($this->totalTaxableMachMarketValue));
     $this->tpl->set_var("Taxable_MachAV", $this->checkNumericFormat($this->totalTaxableMachAssessedValue));
     $this->tpl->set_var("Taxable_OtherMV", $this->checkNumericFormat($this->totalTaxableOtherMarketValue));
     $this->tpl->set_var("Taxable_OtherAV", $this->checkNumericFormat($this->totalTaxableOtherAssessedValue));
     $this->tpl->set_var("Taxable_TotalMV", $this->checkNumericFormat($this->totalTaxableMarketValue));
     $this->tpl->set_var("Taxable_TotalAV", $this->checkNumericFormat($this->totalTaxableAssessedValue));
     $this->tpl->set_var("Exempt_RealPropertyUnits", $this->checkNumericFormat($this->totalExemptRealPropertyUnits));
     $this->tpl->set_var("Exempt_LandArea", $this->checkNumericFormat($this->totalExemptLandArea));
     $this->tpl->set_var("Exempt_LandMV", $this->checkNumericFormat($this->totalExemptLandMarketValue));
     $this->tpl->set_var("Exempt_LandAV", $this->checkNumericFormat($this->totalExemptLandAssessedValue));
     $this->tpl->set_var("Exempt_BldgLessMV", $this->checkNumericFormat($this->totalExemptBldgLessMarketValue));
     $this->tpl->set_var("Exempt_BldgLessAV", $this->checkNumericFormat($this->totalExemptBldgLessAssessedValue));
     $this->tpl->set_var("Exempt_BldgOverMV", $this->checkNumericFormat($this->totalExemptBldgOverMarketValue));
     $this->tpl->set_var("Exempt_BldgOverAV", $this->checkNumericFormat($this->totalExemptBldgOverAssessedValue));
     $this->tpl->set_var("Exempt_MachMV", $this->checkNumericFormat($this->totalExemptMachMarketValue));
     $this->tpl->set_var("Exempt_MachAV", $this->checkNumericFormat($this->totalExemptMachAssessedValue));
     $this->tpl->set_var("Exempt_OtherMV", $this->checkNumericFormat($this->totalExemptOtherMarketValue));
     $this->tpl->set_var("Exempt_OtherAV", $this->checkNumericFormat($this->totalExemptOtherAssessedValue));
     $this->tpl->set_var("Exempt_TotalMV", $this->checkNumericFormat($this->totalExemptMarketValue));
     $this->tpl->set_var("Exempt_TotalAV", $this->checkNumericFormat($this->totalExemptAssessedValue));
     $this->tpl->set_var("TOTAL_RealPropertyUnits", number_format($this->totalRealPropertyUnits));
     $this->tpl->set_var("TOTAL_LandArea", $this->checkNumericFormat($this->totalLandArea));
     $this->tpl->set_var("TOTAL_LandMV", $this->checkNumericFormat($this->totalLandMarketValue));
     $this->tpl->set_var("TOTAL_LandAV", $this->checkNumericFormat($this->totalLandAssessedValue));
     $this->tpl->set_var("TOTAL_BldgLessMV", $this->checkNumericFormat($this->totalBldgLessMarketValue));
     $this->tpl->set_var("TOTAL_BldgLessAV", $this->checkNumericFormat($this->totalBldgLessAssessedValue));
     $this->tpl->set_var("TOTAL_BldgOverMV", $this->checkNumericFormat($this->totalBldgOverMarketValue));
     $this->tpl->set_var("TOTAL_BldgOverAV", $this->checkNumericFormat($this->totalBldgOverAssessedValue));
     $this->tpl->set_var("TOTAL_MachMV", $this->checkNumericFormat($this->totalMachMarketValue));
     $this->tpl->set_var("TOTAL_MachAV", $this->checkNumericFormat($this->totalMachAssessedValue));
     $this->tpl->set_var("TOTAL_OtherMV", $this->checkNumericFormat($this->totalOtherMarketValue));
     $this->tpl->set_var("TOTAL_OtherAV", $this->checkNumericFormat($this->totalOtherAssessedValue));
     $this->tpl->set_var("TOTAL_TotalMV", $this->checkNumericFormat($this->totalMarketValue));
     $this->tpl->set_var("TOTAL_TotalAV", $this->checkNumericFormat($this->totalAssessedValue));
     $treasurySettings = new TreasurySettings();
     $treasurySettings->selectRecord();
     $this->basicTaxRate = $treasurySettings->getPctRPTax() * 100;
     $this->sefTaxRate = $treasurySettings->getPctSEF() * 100;
     $this->rateOfLevy = $this->basicTaxRate + $this->sefTaxRate;
     $this->taxableBasicCollectibles = 0;
     $this->taxableSEFCollectibles = 0;
     $this->totalBasicCollectibles = 0;
     $this->totalSEFCollectibles = 0;
     $this->reTaxableBasicCollectibles = $this->totalRETaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->reTaxableSEFCollectibles = $this->totalRETaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->reTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->reTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->reTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->reTaxableSEFCollectibles;
     $this->tpl->set_var("RETaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("RETaxable_BasicCollectibles", $this->checkNumericFormat($this->reTaxableBasicCollectibles));
     $this->tpl->set_var("RETaxable_SEFCollectibles", $this->checkNumericFormat($this->reTaxableSEFCollectibles));
     $this->agTaxableBasicCollectibles = $this->totalAGTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->agTaxableSEFCollectibles = $this->totalAGTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->agTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->agTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->agTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->agTaxableSEFCollectibles;
     $this->tpl->set_var("AGTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("AGTaxable_BasicCollectibles", $this->checkNumericFormat($this->agTaxableBasicCollectibles));
     $this->tpl->set_var("AGTaxable_SEFCollectibles", $this->checkNumericFormat($this->agTaxableSEFCollectibles));
     $this->coTaxableBasicCollectibles = $this->totalCOTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->coTaxableSEFCollectibles = $this->totalCOTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->coTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->coTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->coTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->coTaxableSEFCollectibles;
     $this->tpl->set_var("COTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("COTaxable_BasicCollectibles", $this->checkNumericFormat($this->coTaxableBasicCollectibles));
     $this->tpl->set_var("COTaxable_SEFCollectibles", $this->checkNumericFormat($this->coTaxableSEFCollectibles));
     $this->inTaxableBasicCollectibles = $this->totalINTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->inTaxableSEFCollectibles = $this->totalINTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->inTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->inTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->inTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->inTaxableSEFCollectibles;
     $this->tpl->set_var("INTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("INTaxable_BasicCollectibles", $this->checkNumericFormat($this->inTaxableBasicCollectibles));
     $this->tpl->set_var("INTaxable_SEFCollectibles", $this->checkNumericFormat($this->inTaxableSEFCollectibles));
     $this->miTaxableBasicCollectibles = $this->totalMITaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->miTaxableSEFCollectibles = $this->totalMITaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->miTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->miTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->miTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->miTaxableSEFCollectibles;
     $this->tpl->set_var("MITaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("MITaxable_BasicCollectibles", $this->checkNumericFormat($this->miTaxableBasicCollectibles));
     $this->tpl->set_var("MITaxable_SEFCollectibles", $this->checkNumericFormat($this->miTaxableSEFCollectibles));
     $this->tiTaxableBasicCollectibles = $this->totalTITaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->tiTaxableSEFCollectibles = $this->totalTITaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->tiTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->tiTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->tiTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->tiTaxableSEFCollectibles;
     $this->tpl->set_var("TITaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("TITaxable_BasicCollectibles", $this->checkNumericFormat($this->tiTaxableBasicCollectibles));
     $this->tpl->set_var("TITaxable_SEFCollectibles", $this->checkNumericFormat($this->tiTaxableSEFCollectibles));
     $this->spTaxableBasicCollectibles = $this->totalSPTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->spTaxableSEFCollectibles = $this->totalSPTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->spTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->spTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->spTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->spTaxableSEFCollectibles;
     $this->tpl->set_var("SPTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("SPTaxable_BasicCollectibles", $this->checkNumericFormat($this->spTaxableBasicCollectibles));
     $this->tpl->set_var("SPTaxable_SEFCollectibles", $this->checkNumericFormat($this->spTaxableSEFCollectibles));
     $this->hoTaxableBasicCollectibles = $this->totalHOTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->hoTaxableSEFCollectibles = $this->totalHOTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->hoTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->hoTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->hoTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->hoTaxableSEFCollectibles;
     $this->tpl->set_var("HOTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("HOTaxable_BasicCollectibles", $this->checkNumericFormat($this->hoTaxableBasicCollectibles));
     $this->tpl->set_var("HOTaxable_SEFCollectibles", $this->checkNumericFormat($this->hoTaxableSEFCollectibles));
     $this->scTaxableBasicCollectibles = $this->totalSCTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->scTaxableSEFCollectibles = $this->totalSCTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->scTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->scTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->scTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->scTaxableSEFCollectibles;
     $this->tpl->set_var("SCTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("SCTaxable_BasicCollectibles", $this->checkNumericFormat($this->scTaxableBasicCollectibles));
     $this->tpl->set_var("SCTaxable_SEFCollectibles", $this->checkNumericFormat($this->scTaxableSEFCollectibles));
     $this->cuTaxableBasicCollectibles = $this->totalCUTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->cuTaxableSEFCollectibles = $this->totalCUTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->cuTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->cuTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->cuTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->cuTaxableSEFCollectibles;
     $this->tpl->set_var("CUTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("CUTaxable_BasicCollectibles", $this->checkNumericFormat($this->cuTaxableBasicCollectibles));
     $this->tpl->set_var("CUTaxable_SEFCollectibles", $this->checkNumericFormat($this->cuTaxableSEFCollectibles));
     $this->otTaxableBasicCollectibles = $this->totalOTTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->otTaxableSEFCollectibles = $this->totalOTTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->otTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->otTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->otTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->otTaxableSEFCollectibles;
     $this->tpl->set_var("OTTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("OTTaxable_BasicCollectibles", $this->checkNumericFormat($this->otTaxableBasicCollectibles));
     $this->tpl->set_var("OTTaxable_SEFCollectibles", $this->checkNumericFormat($this->otTaxableSEFCollectibles));
     $this->taTaxableBasicCollectibles = $this->totalTaTaxableAssessedValue * ($this->basicTaxRate / 100);
     $this->taTaxableSEFCollectibles = $this->totalTaTaxableAssessedValue * ($this->sefTaxRate / 100);
     $this->taxableBasicCollectibles += $this->taTaxableBasicCollectibles;
     $this->taxableSEFCollectibles += $this->taTaxableSEFCollectibles;
     $this->totalBasicCollectibles += $this->taTaxableBasicCollectibles;
     $this->totalSEFCollectibles += $this->taTaxableSEFCollectibles;
     $this->tpl->set_var("TaTaxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("TaTaxable_BasicCollectibles", $this->checkNumericFormat($this->taTaxableBasicCollectibles));
     $this->tpl->set_var("TaTaxable_SEFCollectibles", $this->checkNumericFormat($this->taTaxableSEFCollectibles));
     $this->tpl->set_var("Taxable_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("Taxable_BasicCollectibles", $this->checkNumericFormat($this->taxableBasicCollectibles));
     $this->tpl->set_var("Taxable_SEFCollectibles", $this->checkNumericFormat($this->taxableSEFCollectibles));
     $this->tpl->set_var("TOTAL_RateOfLevy", $this->rateOfLevy . "%");
     $this->tpl->set_var("TOTAL_BasicCollectibles", $this->checkNumericFormat($this->totalBasicCollectibles));
     $this->tpl->set_var("TOTAL_SEFCollectibles", $this->checkNumericFormat($this->totalSEFCollectibles));
     $this->setPageDetailPerms();
     $this->tpl->set_var("dbs", $this->dbs);
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     if ($this->reportType == "HTML") {
         $this->tpl->p("templatePage");
     } else {
         $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);
         }
     }
 }
Exemplo n.º 7
0
 ** Sec. 235. Additional Levy on Real Property for the Special Education Fund.
 ** - A province or city, or a municipality within the Metropolitan Manila Area,
 ** may levy and collect an annual tax of one percent (1%) on the assessed value
 ** of real property which shall be in addition to the basic real property tax.
 ** The proceeds thereof shall exclusively accrue to the Special Education Fund (SEF).
 **/
$pctSEF = 0.01;
/** The $pctIdle is the percentage value of the assessed value that is
 ** the resulting idle land tax  i.e. assessed value * pctIdle = Idle land tax
 **/
$pctIdle = 0.01;
$discountPercentage = 10;
$discountPeriod = "03-31";
$advancedDiscountPercentage = 20;
$q1AdvancedDiscountPercentage = 10;
// Match Defaults against TreasurySettings values in database:
// and make sure $_POST["formAction"] is not "reset" in TreasurySettings admin
$treasurySettings = new TreasurySettings();
if ($treasurySettings->selectRecord() && $_POST["formAction"] != "reset") {
    $penaltyLUT = $treasurySettings->getPenaltyLUT();
    $pctRPTax = $treasurySettings->getPctRPTax();
    $pctSEF = $treasurySettings->getPctSEF();
    $pctIdle = $treasurySettings->getPctIdle();
    $discountPercentage = $treasurySettings->getDiscountPercentage();
    $discountPeriod = $treasurySettings->getDiscountPeriod();
}
## create a function to set these tables and master values from the database
function setMasterValues()
{
    global $penaltyLUT, $pctRPTax, $pctSEF, $pctIdle, $discountPercentage, $discountPeriod, $advancedDiscountPercentage;
}
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "updateCalculation":
             if (is_array($this->formArray["rptopID"])) {
                 $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 $DueEncode = new SoapObject(NCCBIZ . "DueEncode.php", "urn:Object");
                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                 $dueIDArray = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                 $treasurySettings = new TreasurySettings();
                 $treasurySettings->selectRecord();
                 $this->formArray["masterBasicTaxRate"] = $treasurySettings->getPctRPTax();
                 $this->formArray["masterSEFTaxRate"] = $treasurySettings->getPctSEF();
                 $this->formArray["masterIdleTaxRate"] = $treasurySettings->getPctIdle();
                 $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                 $this->formArray["annualDueDate"] = $treasurySettings->getAnnualDueDate();
                 foreach ($this->formArray["rptopID"] as $rptopID) {
                     if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
                         // error xmlStr
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             // error domDoc
                         } else {
                             $rptop = new RPTOP();
                             $rptop->parseDomDocument($domDoc);
                             $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                             $tdArray = $rptop->getTDArray();
                             if (is_array($tdArray)) {
                                 foreach ($tdArray as $td) {
                                     $this->formArray["assessedValue"] = "";
                                     $this->formArray["taxability"] = "";
                                     $this->formArray["idle"] = "";
                                     $this->formArray["tdID"] = $td->getTdID();
                                     $this->formArray["dueID"] = "";
                                     $this->formArray["propertyType"] = $td->getPropertyType();
                                     if (!($afsXmlStr = $AFSDetails->getAFS($td->getAfsID()))) {
                                         // error afsXmlStr
                                     } else {
                                         if (!($afsDomDoc = domxml_open_mem($afsXmlStr))) {
                                             // error afsDomDoc
                                         } else {
                                             $afs = new AFS();
                                             $afs->parseDomDocument($afsDomDoc);
                                             $this->formArray["assessedValue"] = $afs->getTotalAssessedValue();
                                             $this->formArray["taxability"] = $afs->getTaxability();
                                             $this->formArray["effectivity"] = $afs->getEffectivity();
                                             $this->formArray["dueDate"] = date("Y-n-d", strtotime($this->formArray["taxableYear"] . "-" . $this->formArray["annualDueDate"]));
                                             if ($this->formArray["propertyType"] == "Land") {
                                                 if (is_array($afs->getLandArray())) {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                     }
                                     if (!($dueXmlStr = $DueList->getDueList($td->getTdID(), $rptop->getTaxableYear()))) {
                                         $this->formArray["dueID"] = "";
                                         $dueIDArray["Annual"] = "";
                                     } else {
                                         if (!($dueDomDoc = domxml_open_mem($dueXmlStr))) {
                                             $this->formArray["dueID"] = "";
                                             $dueIDArray["Annual"] = "";
                                         } else {
                                             //print_r(htmlspecialchars($xmlStr));
                                             //exit;
                                             $dueRecords = new DueRecords();
                                             $dueRecords->parseDomDocument($dueDomDoc);
                                             foreach ($dueRecords->getArrayList() as $due) {
                                                 foreach ($due as $dueKey => $dueValue) {
                                                     switch ($dueKey) {
                                                         case "dueType":
                                                             $dueIDArray[$dueValue] = $due->getDueID();
                                                             break;
                                                     }
                                                 }
                                             }
                                             $this->formArray["dueID"] = $dueIDArray["Annual"];
                                         }
                                     }
                                     $this->formArray["basicTaxRate"] = $this->formArray["masterBasicTaxRate"];
                                     $this->formArray["sefTaxRate"] = $this->formArray["masterSEFTaxRate"];
                                     $this->formArray["idleTaxRate"] = $this->formArray["masterIdleTaxRate"];
                                     $this->formArray["basicTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["basicTaxRate"];
                                     $this->formArray["sefTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["sefTaxRate"];
                                     // if land->idle is "Yes", compute idleTax, otherwise set idleTax to zero
                                     if ($this->formArray["propertyType"] == "Land") {
                                         if ($this->formArray["idle"] == "Yes") {
                                             $this->formArray["idleTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["idleTaxRate"];
                                         } else {
                                             $this->formArray["idleTax"] = "0.00";
                                         }
                                     }
                                     // if afs->taxability is "Exempt", reset computations to zero.
                                     if ($this->formArray["taxability"] == "Exempt") {
                                         $this->formArray["basicTax"] = "0.00";
                                         $this->formArray["sefTax"] = "0.00";
                                         $this->formArray["idleTax"] = "0.00";
                                     }
                                     if ($dueIDArray["Annual"] != "") {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->updateDue($xmlStr))) {
                                                 // error update
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     } else {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->saveDue($xmlStr))) {
                                                 // error save
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     }
                                     $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                                     $this->refreshTDHistory($td);
                                 }
                             }
                             unset($tdArray);
                         }
                     }
                 }
             }
             if ($this->formArray["searchKey"] != "") {
                 $this->formArray["formAction"] = "search";
             } else {
                 $this->formArray["formAction"] = "";
             }
             header("Location: CalculateRPTOPBatch.php" . $this->sess->url("") . "&page=" . $this->formArray["page"] . "&sortBy=" . $this->formArray["sortBy"] . "&sortOrder=" . $this->formArray["sortOrder"] . "&formAction=" . $this->formArray["formAction"] . "&searchKey=" . $this->formArray["searchKey"]);
             exit;
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOPBatch.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }