function Main() { switch ($this->formArray["formAction"]) { case "remove": //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")"; $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object"); if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) { if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) { $this->tpl->set_var("msg", "SOAP failed"); //echo "SOAP failed"; } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"]))); exit; break; default: $this->tpl->set_var("msg", ""); } //select $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object"); if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) { exit("xml failed"); } else { //echo($xmlStr); if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $rptop = new RPTOP(); $rptop->parseDomDocument($domDoc); //print_r($rptop); foreach ($rptop as $key => $value) { switch ($key) { case "owner": //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object"); if (is_a($value, "Owner")) { $this->formArray["ownerID"] = $rptop->owner->getOwnerID(); $xmlStr = $rptop->owner->domDocument->dump_mem(true); if (!$xmlStr) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", ""); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $this->displayOwnerList($domDoc); } } } else { $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock"); $this->tpl->set_var("PersonListBlock", ""); $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock"); $this->tpl->set_var("CompanyListBlock", ""); } break; case "cityAssessor": if (is_numeric($value)) { $cityAssessor = new Person(); $cityAssessor->selectRecord($value); $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID()); $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName()); $this->formArray["cityAssessorName"] = $cityAssessor->getFullName(); } else { $cityAssessor = $value; $this->tpl->set_var("cityAssessorID", $cityAssessor); $this->tpl->set_var("cityAssessorName", $cityAssessor); $this->formArray["cityAssessorName"] = $cityAssessor; } break; case "cityTreasurer": if (is_numeric($value)) { $cityTreasurer = new Person(); $cityTreasurer->selectRecord($value); $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID()); $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName()); $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName(); } else { $cityTreasurer = $value; $this->tpl->set_var("cityTreasurerID", $cityTreasurer); $this->tpl->set_var("cityTreasurerName", $cityTreasurer); $this->formArray["cityTreasurerName"] = $cityTreasurer; } break; case "tdArray": //$this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock"); //$this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock"); //$this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock"); //$this->tpl->set_block("TDList", "BacktaxesList", "BacktaxesListBlock"); $tdCtr = 0; if (count($value)) { $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock"); $this->tpl->set_var("TDDBEmptyBlock", ""); /* $this->tpl->set_block("TDList", "Land", "LandBlock"); $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock"); $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock"); $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock"); */ foreach ($value as $tkey => $tvalue) { //foreach($tvalue as $column => $val){ // $this->tpl->set_var($column,$val); //} /* $this->tpl->set_var("tdID",$tvalue->getTDID()); $this->tpl->set_var("taxDeclarationNumber",$tvalue->getTaxDeclarationNumber()); $this->tpl->set_var("afsID",$tvalue->getAfsID()); $this->tpl->set_var("cancelsTDNumber",$tvalue->getCancelsTDNumber()); $this->tpl->set_var("canceledByTDNumber",$tvalue->getCanceledByTDNumber()); $this->tpl->set_var("taxBeginsWithTheYear",$tvalue->getTaxBeginsWithTheYear()); $this->tpl->set_var("ceasesWithTheYear",$tvalue->getCeasesWithTheYear()); $this->tpl->set_var("enteredInRPARForBy",$tvalue->getEnteredInRPARForBy()); $this->tpl->set_var("enteredInRPARForYear",$tvalue->getEnteredInRPARForYear()); $this->tpl->set_var("previousOwner",$tvalue->getPreviousOwner()); $this->tpl->set_var("previousAssessedValue",$tvalue->getPreviousAssessedValue()); list($dateArr["year"],$dateArr["month"],$dateArr["day"]) = explode("-",$tvalue->getProvincialAssessorDate()); $this->tpl->set_var("pa_yearValue",removePreZero($dateArr["year"])); $this->tpl->set_var("pa_month",removePreZero($dateArr["month"])); $this->tpl->set_var("pa_dayValue",removePreZero($dateArr["day"])); list($dateArr["year"],$dateArr["month"],$dateArr["day"]) = explode("-",$tvalue->getCityMunicipalAssessorDate()); $this->tpl->set_var("cm_yearValue",removePreZero($dateArr["year"])); $this->tpl->set_var("cm_month",removePreZero($dateArr["month"])); $this->tpl->set_var("cm_dayValue",removePreZero($dateArr["day"])); $this->tpl->set_var("provincialAssessorName",$tvalue->provincialAssessor); $this->tpl->set_var("cityMunicipalAssessorName",$tvalue->cityMunicipalAssessor); //$this->tpl->set_var("assessedValue",$tvalue->getAssessedValue()); $this->tpl->set_var("propertyType",$tvalue->getPropertyType()); $this->tpl->set_var("basicTax",""); $this->tpl->set_var("sefTax", ""); $this->tpl->set_var("total", ""); //$this->tpl->set_var("basicTax",$tvalue->getBasicTax()); //$this->tpl->set_var("sefTax",$tvalue->getSefTax()); //$this->tpl->set_var("total",$tvalue->getTotal()); */ $this->tdRecord["arpNumber"] = $tvalue->getTaxDeclarationNumber(); $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object"); if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) { //$this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock"); //$this->tpl->set_var("AFSTableBlock", "afs not found"); } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { //$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); //$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $afs = new AFS(); $afs->parseDomDocument($domDoc); $odID = $afs->getOdID(); $od = new OD(); $od->selectRecord($odID); if (is_object($od->locationAddress)) { $locationAddress = $od->getLocationAddress(); $this->tdRecord["location"] = $locationAddress->getBarangay() . ", " . $locationAddress->getMunicipalityCity(); } switch ($tvalue->getPropertyType()) { case "ImprovementsBuildings": if (is_array($afs->getImprovementsBuildingsArray())) { $improvementsBuildings = $afs->improvementsBuildingsArray[0]; $actualUse = $improvementsBuildings->getActualUse(); if (is_numeric($actualUse)) { $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses(); $improvementsBuildingsActualUses->selectRecord($actualUse); $actualUse = $improvementsBuildingsActualUses->getCode(); //$actualUse = $improvementsBuildingsActualUses->getDescription(); } $this->tdRecord["class"] = $actualUse; } break; case "Machineries": if (is_array($afs->getMachineriesArray())) { $machineries = $afs->machineriesArray[0]; $actualUse = $machineries->getActualUse(); if (is_numeric($actualUse)) { $machineriesActualUses = new MachineriesActualUses(); $machineriesActualUses->selectRecord($actualUse); $actualUse = $machineriesActualUses->getCode(); //$actualUse = $machineriesActualUses->getDescription(); } $this->tdRecord["class"] = $actualUse; } break; case "Land": default: if (is_array($afs->getLandArray())) { $land = $afs->landArray[0]; $actualUse = $land->getActualUse(); if (is_numeric($actualUse)) { $landActualUses = new LandActualUses(); $landActualUses->selectRecord($actualUse); $actualUse = $landActualUses->getCode(); //$actualUse = $landActualUses->getDescription(); } $this->tdRecord["class"] = $actualUse; } else { if (is_array($afs->getPlantsTreesArray())) { if (is_numeric($actualUse)) { $plantsTreesActualUses = new PlantsTreesActualUses(); $plantsTreesActualUses->selectRecord($actualUse); $actualUse = $plantsTreesActualUses->getCode(); //$actualUse = $plantsTreesActualUses->getDescription(); } $this->tdRecord["class"] = $actualUse; } } } $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue(); $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue(); $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue(); $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue(); $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue(); $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue(); $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue(); $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue(); $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue(); $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue(); $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ',')); $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ',')); $this->tpl->set_var("taxability", $afs->getTaxability()); $this->tpl->set_var("effectivity", $afs->getEffectivity()); $this->formArray["idle"] = "No"; if ($tvalue->getPropertyType() == "Land") { if (is_array($afs->landArray)) { // if land is stripped if (count($afs->landArray) > 1) { foreach ($afs->landArray as $land) { if ($land->getIdle() == "Yes") { $this->formArray["idle"] = "Yes"; break; } } } else { $this->formArray["idle"] = $afs->landArray[0]->getIdle(); } } } if ($this->formArray["idle"] == "") { $this->formArray["idle"] = "No"; } $this->tpl->set_var("idle", $this->formArray["idle"]); } } // grab DueRecords from tdID $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object"); $dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => ""); if (!($xmlStr = $DueList->getDueList($tvalue->getTdID(), $rptop->getTaxableYear()))) { if ($this->formArray["rptopID"] != "") { $redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>."; } else { $redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list."; } exit($redirectMessage); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { if ($this->formArray["rptopID"] != "") { $redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>."; } else { $redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list."; } exit($redirectMessage); } else { $dueRecords = new DueRecords(); $dueRecords->parseDomDocument($domDoc); foreach ($dueRecords->getArrayList() as $due) { foreach ($due as $dueKey => $dueValue) { switch ($dueKey) { case "dueType": if ($dueValue == "Annual") { $this->formArray["totalTaxDue"] += $due->getTaxDue(); } $dueArrayList[$dueValue] = $due; $this->tpl->set_var("basicTax[" . $dueValue . "]", formatCurrency($due->getBasicTax())); $this->tpl->set_var("sefTax[" . $dueValue . "]", formatCurrency($due->getSEFTax())); $this->tpl->set_var("idleTax[" . $dueValue . "]", formatCurrency($due->getIdleTax())); $this->tpl->set_var("taxDue[" . $dueValue . "]", formatCurrency($due->getTaxDue())); $this->tpl->set_var("dueDate[" . $dueValue . "]", date("M. d, Y", strtotime($due->getDueDate()))); $dueDateYear = date("Y", strtotime($due->getDueDate())); $this->tdRecord["year"] = $dueDateYear; break; } } } $treasurySettings = new TreasurySettings(); $treasurySettings->selectRecord(); // initialize discountPeriod and discountPercentage for earlyPaymentDiscount $this->tpl->set_var("discountPercentage", $treasurySettings->getDiscountPercentage() . "%"); $this->tpl->set_var("discountPeriod", "January 01, " . $dueDateYear . " - " . date("F d, Y", strtotime($dueDateYear . "-" . $treasurySettings->getDiscountPeriod()))); $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage(); $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod(); $this->formArray["discountPeriod_End"] = strtotime($dueDateYear . "-" . $this->formArray["discountPeriod"]); $this->formArray["discountPeriod_Start"] = strtotime($dueDateYear . "-01-01"); // initialize advancedDiscountPercentage for advancedPayment $this->tpl->set_var("advancedDiscountPercentage", $treasurySettings->getAdvancedDiscountPercentage() . "%"); $this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage(); $this->tpl->set_var("q1AdvancedDiscountPercentage", $treasurySettings->getQ1AdvancedDiscountPercentage() . "%"); $this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage(); // initialize penaltyLUTArray $penaltyLUTArray = $treasurySettings->getPenaltyLUT(); $this->penaltyLUTArray = $treasurySettings->getPenaltyLUT(); foreach ($dueArrayList as $dKey => $due) { $dueArrayList[$dKey]->setEarlyPaymentDiscountPeriod($this->formArray["discountPeriod"]); $dueArrayList[$dKey]->setEarlyPaymentDiscountPercentage($this->formArray["discountPercentage"]); // compute earlyPaymentDiscount as of today // check if today is within the discountPeriod and compute Discount // AND if today is BEFORE annual dueDate $dueArrayList[$dKey]->setEarlyPaymentDiscount(0.0); if ($due->getDueType() == "Annual") { if (strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]) { if (strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())) { $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100)); } } } else { // if today is BEFORE dueDate if (strtotime($this->now) <= strtotime($due->getDueDate()) && strtotime($this->now) >= $this->formArray["discountPeriod_Start"]) { $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100)); } // commented out Febuary 08, 2005 : Provide Quarterly Discounts // earlyPaymentDiscount aren't given to Quarterly Dues except for Quarter 1 /* if($due->getDueType()=="Q1"){ if(strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]){ if(strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())){ $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"]/100)); } } } */ } // compute advancedPaymentDiscount as of today // check if today is BEFORE January 1 of the year of the annual dueDate $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0.0); if (strtotime($this->now) < strtotime(date("Y", strtotime($dueArrayList[$dKey]->getDueDate())) . "-01-01")) { // for advanced payments, give 20% discount to annual dues [advanced discount] // give 10% discount to quarterly dues [early discount] if ($due->getDueType() == "Annual") { $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["advancedDiscountPercentage"] / 100)); } else { if ($due->getDueType() == "Q1") { $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"] / 100)); } else { $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100)); } // commented out: February 08, 2005 // advancedPaymentDiscount aren't given to Quarterly Dues except for Quarter 1 /* if($due->getDueType()=="Q1"){ $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"]/100)); } */ } } $latestPaymentDate[$dKey] = $this->getLatestPaymentDateForDue($dueArrayList[$dKey]); $amountPaidForDue = $this->getAmountPaidForDue($dueArrayList); $latestPaymentDueType = $this->getLatestPaymentDueType($dueArrayList); $amnestyStatus[$dKey] = $this->getAmnestyStatusForDue($dueArrayList[$dKey]); $totalEarlyPaymentDiscount = $this->getTotalEarlyPaymentDiscountForDue($dueArrayList); $totalAdvancedPaymentDiscount = $this->getTotalAdvancedPaymentDiscountForDue($dueArrayList); if ($totalEarlyPaymentDiscount > 0) { $earlyPaymentDiscountForDueType = $this->getTotalEarlyPaymentDiscountForDueType($dueArrayList[$dKey]); if ($earlyPaymentDiscountForDueType > 0) { $dueArrayList[$dKey]->setEarlyPaymentDiscount($earlyPaymentDiscountForDueType); } } if ($totalAdvancedPaymentDiscount > 0) { $advancedPaymentDiscountForDueType = $this->getTotalAdvancedPaymentDiscountForDueType($dueArrayList[$dKey]); if ($advancedPaymentDiscountForDueType > 0) { $dueArrayList[$dKey]->setAdvancedPaymentDiscount($advancedPaymentDiscountForDueType); } } // calculate Penalties verses either today or verses the last paymentDate if ($latestPaymentDate[$dKey] != "" || $latestPaymentDate[$dKey] != "now") { $dueArrayList[$dKey] = $this->computePenalty($latestPaymentDate[$dKey], $dueArrayList[$dKey]); // if balance is 0 leave penalty as is, otherwise calculatePenalty according to date now $balance = round($dueArrayList[$dKey]->getInitialNetDue() - $amountPaidForDue, 4); // 0.1 is used instead of 0 because a lot of balances may end up as 0.002 or so... if ($balance > 0.1) { $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]); } } else { $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]); } //print_r($dueArrayList[$dKey]); //echo "<hr>"; $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount())); $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount())); $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue()); $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100); $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty())); $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue(); if ($amnestyStatus[$dKey]) { $this->initialNetDue[$dKey] -= $dueArrayList[$dKey]->getPenalty(); $this->tpl->set_var("amnesty[" . $dKey . "]", "Yes"); } else { $this->tpl->set_var("amnesty[" . $dKey . "]", "No"); } $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($this->initialNetDue[$dKey])); } // out of the loop, // verify balances to make disable penalties and discounts for Annual if ALL QUARTERS have been paid // and to disable penalties and discounts for Quarters if ALL of ANNUAL has been paid // example: Q1, Q2, Q3 and Q4 have been fully paid. Annual should not show any payables. // Likewise if Annual has been fully paid, Q1, Q2, Q3 and Q4 should not show any payables. $totalQuarterlyNetDue = 0; $totalQuarterlyNetDue += $dueArrayList["Q1"]->getBasicTax() + $dueArrayList["Q1"]->getSefTax() + $dueArrayList["Q1"]->getIdleTax(); $totalQuarterlyNetDue -= $dueArrayList["Q1"]->getEarlyPaymentDiscount() + $dueArrayList["Q1"]->getAdvancedPaymentDiscount(); if (!$amnestyStatus["Q1"]) { $totalQuarterlyNetDue += $dueArrayList["Q1"]->getPenalty(); } $totalQuarterlyNetDue += $dueArrayList["Q2"]->getBasicTax() + $dueArrayList["Q2"]->getSefTax() + $dueArrayList["Q2"]->getIdleTax(); $totalQuarterlyNetDue -= $dueArrayList["Q2"]->getEarlyPaymentDiscount() + $dueArrayList["Q2"]->getAdvancedPaymentDiscount(); if (!$amnestyStatus["Q2"]) { $totalQuarterlyNetDue += $dueArrayList["Q2"]->getPenalty(); } $totalQuarterlyNetDue += $dueArrayList["Q3"]->getBasicTax() + $dueArrayList["Q3"]->getSefTax() + $dueArrayList["Q3"]->getIdleTax(); $totalQuarterlyNetDue -= $dueArrayList["Q3"]->getEarlyPaymentDiscount() + $dueArrayList["Q3"]->getAdvancedPaymentDiscount(); if (!$amnestyStatus["Q3"]) { $totalQuarterlyNetDue += $dueArrayList["Q3"]->getPenalty(); } $totalQuarterlyNetDue += $dueArrayList["Q4"]->getBasicTax() + $dueArrayList["Q4"]->getSefTax() + $dueArrayList["Q4"]->getIdleTax(); $totalQuarterlyNetDue -= $dueArrayList["Q4"]->getEarlyPaymentDiscount() + $dueArrayList["Q4"]->getAdvancedPaymentDiscount(); if (!$amnestyStatus["Q4"]) { $totalQuarterlyNetDue += $dueArrayList["Q4"]->getPenalty(); } $totalAnnualNetDue = 0; $totalAnnualNetDue += $dueArrayList["Annual"]->getBasicTax() + $dueArrayList["Annual"]->getSefTax() + $dueArrayList["Annual"]->getIdleTax(); $totalAnnualNetDue -= $dueArrayList["Annual"]->getEarlyPaymentDiscount() + $dueArrayList["Annual"]->getAdvancedPaymentDiscount(); if (!$amnestyStatus["Annual"]) { $totalAnnualNetDue += $dueArrayList["Annual"]->getPenalty(); } if ($latestPaymentDueType != "Annual" && $totalQuarterlyNetDue - $amountPaidForDue <= 0) { // all QUARTERLY DUES have been paid, modify Annual Due values $dueArrayList["Annual"]->setAdvancedPaymentDiscount(0); $dueArrayList["Annual"]->setEarlyPaymentDiscount(0); $dueArrayList["Annual"]->setMonthsOverDue(0); $dueArrayList["Annual"]->setPenaltyPercentage(0); $dueArrayList["Annual"]->setPenalty(0); $this->initialNetDue["Annual"] = $dueArrayList["Annual"]->getInitialNetDue(); $this->tpl->set_var("advancedPaymentDiscount[Annual]", formatCurrency($dueArrayList["Annual"]->getAdvancedPaymentDiscount())); $this->tpl->set_var("earlyPaymentDiscount[Annual]", formatCurrency($dueArrayList["Annual"]->getEarlyPaymentDiscount())); $this->tpl->set_var("monthsOverDue[Annual]", $dueArrayList["Annual"]->getMonthsOverDue()); $this->tpl->set_var("penaltyPercentage[Annual]", $dueArrayList["Annual"]->getPenaltyPercentage() * 100); $this->tpl->set_var("penalty[Annual]", formatCurrency($dueArrayList["Annual"]->getPenalty())); $this->tpl->set_var("amnesty[Annual]", "No"); $this->tpl->set_var("initialNetDue[Annual]", formatCurrency($this->initialNetDue["Annual"])); } else { if ($latestPaymentDueType == "Annual" && $totalAnnualNetDue - $amountPaidForDue <= 0) { // all of ANNUAL Due has been fully paid, modify Quarterly Due values $quarterlyDueKeys = array("Q1", "Q2", "Q3", "Q4"); foreach ($quarterlyDueKeys as $dKey) { $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0); $dueArrayList[$dKey]->setEarlyPaymentDiscount(0); $dueArrayList[$dKey]->setMonthsOverDue(0); $dueArrayList[$dKey]->setPenaltyPercentage(0); $dueArrayList[$dKey]->setPenalty(0); $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue(); $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount())); $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount())); $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue()); $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100); $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty())); $this->tpl->set_var("amnesty[" . $dKey . "]", "No"); $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($this->initialNetDue[$dKey])); } } } } } // display Backtaxes and previousTD Backtaxes $this->formArray["totalBacktaxesBalance"] = 0; $this->displayBacktaxTD($tvalue->getTdID()); $precedingTDArray = $this->getPrecedingTDArray($tvalue); if (is_array($precedingTDArray)) { foreach ($precedingTDArray as $precedingTD) { $this->displayBacktaxTD($precedingTD->getTdID()); } } $this->tpl->set_var("total", number_format($this->formArray["totalBacktaxesDue"], 2)); $this->tpl->set_var("totalBacktaxesBalance", number_format($this->formArray["totalBacktaxesBalance"], 2)); // grab dueID's and backtaxTDID's to run through payments // create $dueIDArray foreach ($dueArrayList as $due) { $this->dueIDArray[] = $due->getDueID(); } $this->displayTotalPaid(); $this->displayNetDue(); $this->tdArrayList[$this->tdRecord["year"] . $this->tdArrayListCounter] = $this->tdRecord; $this->tdArrayListCounter++; unset($this->tdRecord); $this->tpl->set_var("ctr", $tdCtr); //$this->tpl->parse("defaultTDListBlock", "defaultTDList", true); //$this->tpl->parse("toggleTDListBlock", "toggleTDList", true); //$this->tpl->parse("TDListBlock", "TDList", true); //$this->tpl->set_var("BacktaxesListBlock", ""); /* $this->tpl->set_var("LandBlock", ""); $this->tpl->set_var("PlantsTreesBlock", ""); $this->tpl->set_var("ImprovementsBuildingsBlock", ""); $this->tpl->set_var("MachineriesBlock", ""); */ $tdCtr++; } } else { $this->tpl->set_var("defaultTDListBlock", "//no default"); $this->tpl->set_var("toggleTDListBlock", "//no Toggle"); $this->tpl->set_var("TDListBlock", ""); } $this->tpl->set_var("tdCtr", $tdCtr); break; case "landTotalMarketValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "landTotalAssessedValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "plantTotalMarketValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "plantTotalAssessedValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "bldgTotalMarketValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "bldgTotalAssessedValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "machTotalMarketValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "machTotalAssessedValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "totalMarketValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; case "totalAssessedValue": if (!$this->formArray[$key]) { $this->formArray[$key] = $value; } break; default: $this->formArray[$key] = $value; } } $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"]; $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"]; unset($rptop); $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object"); $rptop = new RPTOP(); $rptop->setRptopID($this->formArray["rptopID"]); $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]); $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]); $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]); $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]); $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]); $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]); $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]); $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]); $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]); $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]); $rptop->setCreatedBy($this->userID); $rptop->setModifiedBy($this->userID); $rptop->setDomDocument(); $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object"); $rptop->setDomDocument(); $doc = $rptop->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $xmlStr; if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) { echo "ret=" . $ret; } //echo $ret; } } if (is_array($this->tdArrayList)) { ksort($this->tdArrayList); reset($this->tdArrayList); // $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock"); $this->tpl->set_block("rptsTemplate", "Page", "PageBlock"); $this->tpl->set_block("Page", "TDList", "TDListBlock"); $this->tpl->set_block("Page", "TotalDue", "TotalDueBlock"); $this->formArray["totalTaxDue"] = 0; $maxRows = 20; $numRows = count($this->tdArrayList); $numPages = ceil($numRows / $maxRows); $rowStr = ""; $j = 0; $page = 0; foreach ($this->tdArrayList as $tdRecord) { ++$j; if ($j > $maxRows) { $this->formArray["tdYPosValue"] = "564"; $this->tpl->set_var("TDListBlock", $rowStr); $this->tpl->set_var("PageNumber", ++$page); if ($page == $numPages) { $this->tpl->set_var("TotalDueBlock", $this->tpl->subst("TotalDue")); } else { $this->tpl->set_var("TotalDueBlock", ""); } $this->tpl->parse("PageBlock", "Page", true); $rowStr = ""; $j = 1; } $this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]); $this->tpl->set_var("class", $tdRecord["class"]); $this->tpl->set_var("location", $tdRecord["location"]); $this->tpl->set_var("year", $tdRecord["year"]); $this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"])); $this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]); $this->formArray["tdYPosValue"] -= 15; $this->formArray["totalTaxDue"] += $tdRecord["taxDue"]; $rowStr .= $this->tpl->subst("TDList"); } $this->tpl->set_var("TDListBlock", $rowStr); $this->tpl->set_var("PageNumber", ++$page); if ($page == $numPages) { $this->tpl->set_var("TotalDueBlock", $this->tpl->subst("TotalDue")); } else { $this->tpl->set_var("TotalDueBlock", ""); } $this->tpl->parse("PageBlock", "Page", true); // echo $this->tpl->subst("Page"); /* $maxRows = 5; $numRows = count($this->tdArrayList); $numPages = ceil($numRows/$maxRows); $tdRecord = current($this->tdArrayList); for ($page=0; $page<$numPages; ++$page) { $rowStr = ""; $this->formArray["tdYPosValue"] = "564"; for ($currRow=0; $currRow<$maxRows; ++$currRow) { // $tdRecord = $this->tdArrayList[($page*$maxRows)+$currRow]; $this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]); $this->tpl->set_var("class", $tdRecord["class"]); $this->tpl->set_var("location", $tdRecord["location"]); $this->tpl->set_var("year", $tdRecord["year"]); $this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"])); $this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]); $this->formArray["tdYPosValue"]-=15; $rowStr .= $this->tpl->subst("TDList"); $this->formArray["totalTaxDue"] += $tdRecord["taxDue"]; $tdRecord = next($this->tdArrayList); } echo $rowStr; $this->tpl->set_var("TDListBlock", $rowStr); $this->tpl->set_var("PageNum", $page+1); $this->tpl->parse("PageBlock", "Page", true); } foreach($this->tdArrayList as $tdRecord){ $this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]); $this->tpl->set_var("class", $tdRecord["class"]); $this->tpl->set_var("location", $tdRecord["location"]); $this->tpl->set_var("year", $tdRecord["year"]); $this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"])); $this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]); $this->formArray["totalTaxDue"] += $tdRecord["taxDue"]; $this->tpl->parse("TDListBlock", "TDList", true); $this->formArray["tdYPosValue"]-=15; } */ } $this->setForm(); /* $this->setPageDetailPerms(); $this->tpl->set_var("uname", $this->user["uname"]); $this->tpl->set_var("today", date("F j, Y",strtotime($this->now))); $this->tpl->set_var("Session", $this->sess->url("").$this->sess->add_query(array("rptopID"=>$this->formArray["rptopID"],"ownerID" => $this->formArray["ownerID"]))); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); */ $this->tpl->set_var("today", date("F j, Y", strtotime($this->now))); $this->setLguDetails(); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $testpdf = new PDFWriter(); $testpdf->setOutputXML($this->tpl->get("templatePage"), "test"); if (isset($this->formArray["print"])) { $testpdf->writePDF($name); //,$this->formArray["print"]); } else { $testpdf->writePDF($name); } // header("location: ".$testpdf->pdfPath); exit; }
function 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"); }
** 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; }
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"); }
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; }