Example #1
0
 function displayODAFS($afsID)
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($odID = $AFSDetails->getOdID($afsID))) {
         echo "get od id failed";
     } else {
         $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
         if (!($xmlStr = $ODDetails->getOD($odID))) {
             exit("xml failed");
         } else {
             //exit($xmlStr);
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 echo "error open xml";
             } else {
                 $od = new OD();
                 $od->parseDomDocument($domDoc);
                 if (is_object($od->locationAddress)) {
                     $location = $od->locationAddress->getFullAddress();
                     $this->formArray["location"] = $location;
                     $this->formArray["number"] = $od->locationAddress->getNumber();
                     $this->formArray["street"] = $od->locationAddress->getStreet();
                     $this->formArray["barangay"] = $od->locationAddress->getBarangay();
                     $this->formArray["municipalityCity"] = $od->locationAddress->getMunicipalityCity();
                     $this->formArray["provinceName"] = $od->locationAddress->getProvince();
                     // RC 20091006 for BLGF standard
                     //$this->formArray["numberStreet"] = $od->locationAddress->getStreetNumber();
                 }
                 $this->formArray["lotNumber"] = $od->getLotNumber();
                 $this->formArray["blockNumber"] = $od->getBlockNumber();
                 $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
                 $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
                 $xmlStr = $od->owner->domDocument->dump_mem(true);
                 if (!$xmlStr) {
                     echo "error xml";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         echo "error open xml";
                     } else {
                         $this->displayOwnerList($domDoc);
                     }
                 }
             }
         }
     }
 }
Example #2
0
 function displayODAFS($afsID)
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($odID = $AFSDetails->getOdID($afsID))) {
         echo "get od id failed";
     } else {
         $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
         if (!($xmlStr = $ODDetails->getOD($odID))) {
             exit("xml failed");
         } else {
             //exit($xmlStr);
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 echo "error open xml";
             } else {
                 $od = new OD();
                 $od->parseDomDocument($domDoc);
                 if (is_object($od->locationAddress)) {
                     $location = $od->locationAddress->getFullAddress();
                     $this->formArray["location"] = $location;
                 }
                 $this->formArray["lotNumber"] = $od->getLotNumber();
                 $this->formArray["blockNumber"] = $od->getBlockNumber();
                 $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
                 $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
                 $xmlStr = $od->owner->domDocument->dump_mem(true);
                 if (!$xmlStr) {
                     echo "error xml";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         echo "error open xml";
                     } else {
                         $this->displayOwnerList($domDoc);
                     }
                 }
             }
         }
     }
 }
Example #3
0
 function displayODAFS($afsID)
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($odID = $AFSDetails->getOdID($afsID))) {
         echo "get od id failed";
     } else {
         $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
         if (!($xmlStr = $ODDetails->getOD($odID))) {
             exit("xml failed");
         } else {
             //exit($xmlStr);
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 echo "error open xml";
             } else {
                 $od = new OD();
                 $od->parseDomDocument($domDoc);
                 if (is_object($od->locationAddress)) {
                     $this->formArray["location"] = $od->locationAddress->getFullAddress();
                     if ($od->locationAddress->getNumber() != "" && $od->locationAddress->getNumber() != "--" && $od->locationAddress->getNumber() != " ") {
                         $this->formArray["numberStreet"] = $od->locationAddress->getNumber();
                     }
                     if ($od->locationAddress->getStreet() != "" && $od->locationAddress->getStreet() != "--" && $od->locationAddress->getStreet() != " ") {
                         $this->formArray["numberStreet"] .= " " . $od->locationAddress->getStreet();
                     }
                     $this->formArray["barangay"] = $od->locationAddress->getBarangay();
                     $this->formArray["municipalityCity"] = $od->locationAddress->getMunicipalityCity();
                 }
                 $this->formArray["lotNumber"] = $od->getLotNumber();
                 $this->formArray["blockNumber"] = $od->getBlockNumber();
                 // format textbox for lotNumber (maxlength for first line is:19)
                 if (strlen($this->formArray["lotNumber"]) <= 19) {
                     $spaceDifference = 19 - strlen($this->formarray["lotNumber"]);
                     for ($spaceCount = 0; $spaceCount < $spaceDifference; $spaceCount++) {
                         $this->formArray["lotNumber"] = " " . $this->formArray["lotNumber"];
                     }
                 }
                 // format textbox for blockNumber (maxlength for first line is:19)
                 if (strlen($this->formArray["blockNumber"]) <= 19) {
                     $spaceDifference = 19 - strlen($this->formarray["blockNumber"]);
                     for ($spaceCount = 0; $spaceCount < $spaceDifference; $spaceCount++) {
                         $this->formArray["blockNumber"] = " " . $this->formArray["blockNumber"];
                     }
                 }
                 $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
                 $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
                 $xmlStr = $od->owner->domDocument->dump_mem(true);
                 if (!$xmlStr) {
                     echo "error xml";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         echo "error open xml";
                     } else {
                         $this->displayOwnerList($domDoc);
                     }
                 }
             }
         }
     }
 }
 function Main()
 {
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
     // start batch loop
     $rptopIDArray = $this->formArray["rptopIDArray"];
     foreach ($rptopIDArray as $key => $rptopID) {
         $this->formArray["rptopID"] = $rptopID;
         $this->pageNumber++;
         if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
             exit("xml failed");
         } else {
             //echo($xmlStr);
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 exit("error xmlDoc");
             } else {
                 $rptop = new RPTOP();
                 $rptop->parseDomDocument($domDoc);
                 //print_r($rptop);
                 foreach ($rptop as $key => $value) {
                     switch ($key) {
                         case "owner":
                             //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                             if (is_a($value, "Owner")) {
                                 $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                                 $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                                 if (!$xmlStr) {
                                     // xml failed
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         // error domdoc
                                     } else {
                                         $this->displayOwnerList($domDoc);
                                     }
                                 }
                             }
                             break;
                         case "cityAssessor":
                             if (is_numeric($value)) {
                                 $cityAssessor = new Person();
                                 $cityAssessor->selectRecord($value);
                                 $this->formArray["municipalAssessor"] = $cityAssessor->getName();
                             } else {
                                 $cityAssessor = $value;
                                 $this->formArray["municipalAssessor"] = $cityAssessor;
                             }
                             break;
                         case "cityTreasurer":
                             if (is_numeric($value)) {
                                 $cityTreasurer = new Person();
                                 $cityTreasurer->selectRecord($value);
                                 $this->formArray["municipalTreasurer"] = $cityTreasurer->getName();
                             } else {
                                 $cityTreasurer = $value;
                                 $this->formArray["municipalTreasurer"] = $cityTreasurer;
                             }
                             break;
                         case "tdArray":
                             $tdCtr = 1;
                             $tdPageNumber = 1;
                             // RC 20091012 Modified to handle multiple page RPTOPS
                             $totalBasic = 0;
                             $totalSef = 0;
                             $totalTaxes = 0;
                             if (count($value)) {
                                 $tdTotalPages = intval((count($value) - 1) / 6) + 1;
                                 //RC 20091012 Calculate 1 to 6 = 1.
                                 foreach ($value as $tkey => $tvalue) {
                                     if ($tdCtr > 6) {
                                         // RC 20091012 Deal with multiple page RPTOP (i.e. more than 6 TDs)
                                         $this->formArray["tdPageNumber"] = $tdPageNumber;
                                         $this->formArray["tdTotalPages"] = $tdTotalPages;
                                         $this->formArray["totalOnLastPage"] = "Please Refer to Totals on Last Page...";
                                         $this->setForm();
                                         // generate page of output
                                         $this->clearDetails();
                                         // clear the values from Form
                                         $this->pageNumber++;
                                         //increment PDF Page Number
                                         $tdPageNumber++;
                                         $tdCtr = 1;
                                         //reset count for lines on new page of RPTOP
                                         $this->formArray["totalOnLastPage"] = "";
                                     }
                                     $this->formArray["arpNumber" . $tdCtr] = $tvalue->getTaxDeclarationNumber();
                                     // word wrap arpNumber
                                     if (strlen($this->formArray["arpNumber" . $tdCtr]) > 13) {
                                         $this->formArray["arpNumber" . $tdCtr . "a"] = substr($this->formArray["arpNumber" . $tdCtr], 0, 12);
                                         $this->formArray["arpNumber" . $tdCtr . "b"] = substr($this->formArray["arpNumber" . $tdCtr], 12);
                                         $this->formArray["arpNumber" . $tdCtr] = "";
                                     }
                                     $this->formArray["afsID"] = $tvalue->getAfsID();
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                         // xml failed
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             // error domDoc
                                         } else {
                                             $afs = new AFS();
                                             $afs->parseDomDocument($domDoc);
                                             $this->formArray["odID"] = $afs->getOdID();
                                             $od = new OD();
                                             $od->selectRecord($this->formArray["odID"]);
                                             $locationNumber = $od->locationAddress->getNumber();
                                             $locationStreet = $od->locationAddress->getStreet();
                                             $locationBarangay = $od->locationAddress->getBarangay();
                                             $locationDistrict = $od->locationAddress->getDistrict();
                                             $locationMunicipalityCity = $od->locationAddress->getMunicipalityCity();
                                             $locationProvince = $od->locationAddress->getProvince();
                                             $this->formArray["location" . $tdCtr] = $locationNumber . " " . $locationStreet . " " . $locationBarangay;
                                             // word wrap location
                                             if (strlen($this->formArray["location" . $tdCtr]) > 26) {
                                                 $this->formArray["location" . $tdCtr . "a"] = $locationNumber . " " . $locationStreet;
                                                 $this->formArray["location" . $tdCtr . "b"] = $locationBarangay;
                                                 $this->formArray["location" . $tdCtr] = "";
                                             }
                                             $this->formArray["province"] = $locationProvince;
                                             $this->formArray["municipalityCity"] = strtoupper($locationMunicipalityCity);
                                             $this->formArray["area" . $tdCtr] = $od->getLandArea();
                                             $this->formArray["lotNo" . $tdCtr] = $od->getLotNumber();
                                             $this->formArray["pin" . $tdCtr] = $afs->getPropertyIndexNumber();
                                             // word wrap pin
                                             if (strlen($this->formArray["pin" . $tdCtr]) > 25) {
                                                 $this->formArray["pin" . $tdCtr . "a"] = substr($this->formArray["pin" . $tdCtr], 0, 25);
                                                 $this->formArray["pin" . $tdCtr . "b"] = substr($this->formArray["pin" . $tdCtr], 25);
                                                 $this->formArray["pin" . $tdCtr] = "";
                                             }
                                             $landList = $afs->getLandArray();
                                             $plantsTreesList = $afs->getPlantsTreesArray();
                                             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                                             $machineriesList = $afs->getMachineriesArray();
                                             $kind = "";
                                             $actualUse = "";
                                             if (count($landList)) {
                                                 $kind = "Land";
                                                 $land = $landList[0];
                                                 $actualUse = $land->getActualUse();
                                                 $landActualUses = new LandActualUses();
                                                 $landActualUses->selectRecord($actualUse);
                                                 $actualUse = $landActualUses->getDescription();
                                                 $actualUseReportCode = $landActualUses->getReportCode();
                                             } else {
                                                 if (count($plantsTreesList)) {
                                                     $kind = "Land";
                                                     $plantsTrees = $plantsTreesList[0];
                                                     $actualUse = $plantsTrees->getActualUse();
                                                     $plantsTreesActualUses = new PlantsTreesActualUses();
                                                     $plantsTreesActualUses->selectRecord($actualUse);
                                                     $actualUse = $plantsTreesActualUses->getDescription();
                                                     $actualUseReportCode = $plantsTreesActualUses->getReportCode();
                                                 } else {
                                                     if (count($improvementsBuildingsList)) {
                                                         $kind = "Improvements/Buildings";
                                                         $improvementsBuildings = $improvementsBuildingsList[0];
                                                         $actualUse = $improvementsBuildings->getActualUse();
                                                         $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                                         $actualUse = $improvementsBuildingsActualUses->getDescription();
                                                         $actualUseReportCode = $improvementsBuildingsActualUses->getReportCode();
                                                     } else {
                                                         if (count($machineriesList)) {
                                                             $kind = "Machineries";
                                                             $machineries = $machineriesList[0];
                                                             $actualUse = $machineries->getActualUse();
                                                             $machineriesActualUses = new MachineriesActualUses();
                                                             $machineriesActualUses->selectRecord($actualUse);
                                                             $actualUse = $machineriesActualUses->getDescription();
                                                             $actualUseReportCode = $machineriesActualUses->getReportCode();
                                                         }
                                                     }
                                                 }
                                             }
                                             eval(REPORT_CODE_LIST);
                                             foreach ($reportCodeList as $key => $reportCode) {
                                                 if ($reportCode["code"] == $actualUseReportCode) {
                                                     $reportCodeDescription = $reportCode["description"];
                                                     break;
                                                 }
                                             }
                                             $this->formArray["classification" . $tdCtr] = $reportCodeDescription;
                                             $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                             $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                             $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                             $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                             $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                             $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                             $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                             $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                             $this->formArray["marketValue" . $tdCtr] += $afs->getTotalMarketValue();
                                             $this->formArray["assessedValue" . $tdCtr] += $afs->getTotalAssessedValue();
                                             //RC											$this->formArray["totalMarketValue"] += $this->formArray["marketValue"];
                                             //RC											$this->formArray["totalAssessedValue"] += $this->formArray["assessedValue"];
                                             // grab Due from tdID
                                             $this->formArray["totalTaxDue"] = 0.0;
                                             $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                             if (!($xmlStr = $DueDetails->getDueFromTdID($tvalue->getTdID()))) {
                                                 $this->formArray["basic" . $tdCtr] = "";
                                                 $this->formArray["sef" . $tdCtr] = "";
                                                 $this->formArray["totalTax" . $tdCtr] = "";
                                                 $this->formArray["totalBasic"] += 0;
                                                 $this->formArray["totalSef"] += 0;
                                                 $this->formArray["totalTaxes"] += 0;
                                             } else {
                                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                                     $this->formArray["basic" . $tdCtr] = "";
                                                     $this->formArray["sef" . $tdCtr] = "";
                                                     $this->formArray["totalTax" . $tdCtr] = "";
                                                     $this->formArray["totalBasic"] += 0;
                                                     $this->formArray["totalSef"] += 0;
                                                     $this->formArray["totalTaxes"] += 0;
                                                 } else {
                                                     $due = new Due();
                                                     $due->parseDomDocument($domDoc);
                                                     $this->formArray["basic" . $tdCtr] = $due->getBasicTax();
                                                     $this->formArray["sef" . $tdCtr] = $due->getSEFTax();
                                                     $this->formArray["totalTax" . $tdCtr] = $due->getTaxDue();
                                                     /* RC 20091012 revised to not print total until last page of RPTOP 
                                                     			$this->formArray["totalBasic"] += $due->getBasicTax();
                                                     			$this->formArray["totalSef"] += $due->getSEFTax();
                                                     			$this->formArray["totalTaxes"] += $due->getTaxDue();  */
                                                     $totalBasic += $due->getBasicTax();
                                                     $totalSef += $due->getSEFTax();
                                                     $totalTaxes += $due->getTaxDue();
                                                 }
                                             }
                                         }
                                     }
                                     $tdCtr++;
                                 }
                             }
                             break;
                         default:
                             $this->formArray[$key] = $value;
                     }
                 }
                 $this->formArray["tdPageNumber"] = $tdPageNumber;
                 $this->formArray["tdTotalPages"] = $tdTotalPages;
                 $this->formArray["totalBasic"] += $totalBasic;
                 // RC 20091012 set values for last page of RPTOP
                 $this->formArray["totalSef"] += $totalSef;
                 $this->formArray["totalTaxes"] += $totalTaxes;
                 $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
                 $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
                 unset($rptop);
             }
         }
         $this->setForm();
         // send XML to file
         $this->clearForm();
         // clear the XML form values
     }
     // end batch loop
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     $testpdf->writePDF("RPTOPBatch.pdf");
     // popup the IE Save to File thingee...
     exit;
 }
Example #5
0
 function displayODAFS($afsID)
 {
     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
     if (!($odID = $AFSDetails->getOdID($afsID))) {
         echo "get od id failed";
     } else {
         $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
         if (!($xmlStr = $ODDetails->getOD($odID))) {
             exit("xml failed");
         } else {
             //exit($xmlStr);
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 echo "error open xml";
             } else {
                 $od = new OD();
                 $od->parseDomDocument($domDoc);
                 if (is_object($od->locationAddress)) {
                     $this->tpl->set_var("location", htmlentities($od->locationAddress->getFullAddress()));
                     //$this->tpl->set_var("numberStreet",htmlentities($od->locationAddress->getNumber()." ".$od->locationAddress->getStreet()));
                     //$this->tpl->set_var("barangayDistrict",htmlentities($od->locationAddress->getBarangay().", ".$od->locationAddress->getDistrict()));
                     //$this->tpl->set_var("municipalityCityProvince",htmlentities($od->locationAddress->getMunicipalityCity().", ".$od->locationAddress->getProvince()));
                 }
                 $this->tpl->set_var("lotNumber", htmlentities($od->getLotNumber()));
                 $this->tpl->set_var("blockNumber", htmlentities($od->getBlockNumber()));
                 $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
                 $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
                 $xmlStr = $od->owner->domDocument->dump_mem(true);
                 if (!$xmlStr) {
                     echo "error xml";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         echo "error open xml";
                     } else {
                         $this->displayOwnerList($domDoc);
                     }
                 }
             }
         }
     }
 }
Example #6
0
 function Main()
 {
     $this->displayLGUName();
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             exit("error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             //print_r($rptop);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 // xml failed
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     // error domdoc
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         }
                         break;
                     case "cityAssessor":
                         if (is_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->formArray["municipalAssessor"] = $cityAssessor->getName();
                         } else {
                             $cityAssessor = $value;
                             $this->formArray["municipalAssessor"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->formArray["municipalTreasurer"] = $cityTreasurer->getName();
                         } else {
                             $cityTreasurer = $value;
                             $this->formArray["municipalTreasurer"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         $tdCtr = 1;
                         $tdContinuousCtr = 1;
                         if (count($value)) {
                             $this->tdPagingArray["tdCount"] = count($value);
                             $this->tdPagingArray["tdPageRecordsCounter"] = 1;
                             $this->tdPagingArray["tdTotalPages"] = ceil($this->tdPagingArray["tdCount"] / $this->tdPagingArray["tdPageBy"]);
                             $this->tdPagingArray["tdPageNumber"] = 1;
                             $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
                             $this->tpl->set_block("Page", "FirstPageText", "FirstPageTextBlock");
                             $this->tpl->set_block("Page", "ContinuedFromPreviousPageText", "ContinuedFromPreviousPageTextBlock");
                             $this->tpl->set_block("Page", "ContinuedNextPageText", "ContinuedNextPageTextBlock");
                             $this->tpl->set_block("Page", "Totals", "TotalsBlock");
                             foreach ($value as $tkey => $tvalue) {
                                 $this->formArray["arpNumber" . $tdCtr] = $tvalue->getTaxDeclarationNumber();
                                 // word wrap arpNumber
                                 if (strlen($this->formArray["arpNumber" . $tdCtr]) > 13) {
                                     $this->formArray["arpNumber" . $tdCtr . "a"] = substr($this->formArray["arpNumber" . $tdCtr], 0, 12);
                                     $this->formArray["arpNumber" . $tdCtr . "b"] = substr($this->formArray["arpNumber" . $tdCtr], 12);
                                     $this->formArray["arpNumber" . $tdCtr] = "";
                                 }
                                 $this->formArray["afsID"] = $tvalue->getAfsID();
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     // xml failed
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         // error domDoc
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $this->formArray["odID"] = $afs->getOdID();
                                         $od = new OD();
                                         $od->selectRecord($this->formArray["odID"]);
                                         $locationNumber = $od->locationAddress->getNumber();
                                         $locationStreet = $od->locationAddress->getStreet();
                                         $locationBarangay = $od->locationAddress->getBarangay();
                                         $locationDistrict = $od->locationAddress->getDistrict();
                                         $locationMunicipalityCity = $od->locationAddress->getMunicipalityCity();
                                         $locationProvince = $od->locationAddress->getProvince();
                                         $this->formArray["location" . $tdCtr] = $locationNumber . " " . $locationStreet . " " . $locationBarangay;
                                         // word wrap location
                                         if (strlen($this->formArray["location" . $tdCtr]) > 26) {
                                             $this->formArray["location" . $tdCtr . "a"] = $locationNumber . " " . $locationStreet;
                                             $this->formArray["location" . $tdCtr . "b"] = $locationBarangay;
                                             $this->formArray["location" . $tdCtr] = "";
                                         }
                                         $this->formArray["province"] = $locationProvince;
                                         $this->formArray["municipalityCity"] = strtoupper($locationMunicipalityCity);
                                         $this->formArray["area" . $tdCtr] = $od->getLandArea();
                                         $this->formArray["lotNo" . $tdCtr] = $od->getLotNumber();
                                         $this->formArray["pin" . $tdCtr] = $afs->getPropertyIndexNumber();
                                         // word wrap pin
                                         if (strlen($this->formArray["pin" . $tdCtr]) > 13) {
                                             $this->formArray["pin" . $tdCtr . "a"] = substr($this->formArray["pin" . $tdCtr], 0, 12);
                                             $this->formArray["pin" . $tdCtr . "b"] = substr($this->formArray["pin" . $tdCtr], 12);
                                             $this->formArray["pin" . $tdCtr] = "";
                                         }
                                         $landList = $afs->getLandArray();
                                         $plantsTreesList = $afs->getPlantsTreesArray();
                                         $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                                         $machineriesList = $afs->getMachineriesArray();
                                         $kind = "";
                                         $actualUse = "";
                                         if (count($landList)) {
                                             $kind = "Land";
                                             $land = $landList[0];
                                             $actualUse = $land->getActualUse();
                                             $landActualUses = new LandActualUses();
                                             $landActualUses->selectRecord($actualUse);
                                             $actualUse = $landActualUses->getDescription();
                                             $actualUseReportCode = $landActualUses->getReportCode();
                                         } else {
                                             if (count($plantsTreesList)) {
                                                 $kind = "Land";
                                                 $plantsTrees = $plantsTreesList[0];
                                                 $actualUse = $plantsTrees->getActualUse();
                                                 $plantsTreesActualUses = new PlantsTreesActualUses();
                                                 $plantsTreesActualUses->selectRecord($actualUse);
                                                 $actualUse = $plantsTreesActualUses->getDescription();
                                                 $actualUseReportCode = $plantsTreesActualUses->getReportCode();
                                             } else {
                                                 if (count($improvementsBuildingsList)) {
                                                     $kind = "Improvements/Buildings";
                                                     $improvementsBuildings = $improvementsBuildingsList[0];
                                                     $actualUse = $improvementsBuildings->getActualUse();
                                                     $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                                     $improvementsBuildingsActualUses->selectRecord($actualUse);
                                                     $actualUse = $improvementsBuildingsActualUses->getDescription();
                                                     $actualUseReportCode = $improvementsBuildingsActualUses->getReportCode();
                                                 } else {
                                                     if (count($machineriesList)) {
                                                         $kind = "Machineries";
                                                         $machineries = $machineriesList[0];
                                                         $actualUse = $machineries->getActualUse();
                                                         $machineriesActualUses = new MachineriesActualUses();
                                                         $machineriesActualUses->selectRecord($actualUse);
                                                         $actualUse = $machineriesActualUses->getDescription();
                                                         $actualUseReportCode = $machineriesActualUses->getReportCode();
                                                     }
                                                 }
                                             }
                                         }
                                         eval(REPORT_CODE_LIST);
                                         foreach ($reportCodeList as $key => $reportCode) {
                                             if ($reportCode["code"] == $actualUseReportCode) {
                                                 $reportCodeDescription = $reportCode["description"];
                                                 break;
                                             }
                                         }
                                         $this->formArray["classification" . $tdCtr] = $reportCodeDescription;
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["marketValue" . $tdCtr] += $afs->getTotalMarketValue();
                                         $this->formArray["assessedValue" . $tdCtr] += $afs->getTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $this->formArray["marketValue"];
                                         $this->formArray["totalAssessedValue"] += $this->formArray["assessedValue"];
                                         // grab Due from tdID
                                         $this->formArray["totalTaxDue"] = 0.0;
                                         $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                         if (!($xmlStr = $DueDetails->getDueFromTdID($tvalue->getTdID()))) {
                                             $this->formArray["basic" . $tdCtr] = "";
                                             $this->formArray["sef" . $tdCtr] = "";
                                             $this->formArray["totalTax" . $tdCtr] = "";
                                             $this->formArray["totalBasic"] += 0;
                                             $this->formArray["totalSef"] += 0;
                                             $this->formArray["totalTaxes"] += 0;
                                         } else {
                                             if (!($domDoc = domxml_open_mem($xmlStr))) {
                                                 $this->formArray["basic" . $tdCtr] = "";
                                                 $this->formArray["sef" . $tdCtr] = "";
                                                 $this->formArray["totalTax" . $tdCtr] = "";
                                                 $this->formArray["totalBasic"] += 0;
                                                 $this->formArray["totalSef"] += 0;
                                                 $this->formArray["totalTaxes"] += 0;
                                             } else {
                                                 $due = new Due();
                                                 $due->parseDomDocument($domDoc);
                                                 $this->formArray["basic" . $tdCtr] = $due->getBasicTax();
                                                 $this->formArray["sef" . $tdCtr] = $due->getSEFTax();
                                                 $this->formArray["totalTax" . $tdCtr] = $due->getTaxDue();
                                                 //WRONG CODE -------------------------------------------------->
                                                 //$this->formArray["totalBasic"] += $due->getBasicTax();
                                                 //$this->formArray["totalSef"] += $due->getSEFTax();
                                                 //$this->formArray["totalTaxes"] += $due->getTaxDue();
                                                 //------------------------------------------------------------->
                                             }
                                         }
                                     }
                                 }
                                 $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
                                 $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
                                 //NEW CODE - Argao----Added on 03152008-------------------------------------------->
                                 //Computes Grand Totals on Basic, SEF and Total-----By CHT
                                 $this->formArray["totalBasic"] = $this->formArray["totalAssessedValue"] * 0.01;
                                 $this->formArray["totalSef"] = $this->formArray["totalAssessedValue"] * 0.01;
                                 $this->formArray["totalTaxes"] = $this->formArray["totalBasic"] + $this->formArray["totalSef"];
                                 //--------------------------------------------------------------------------------->
                                 if ($this->tdPagingArray["tdPageRecordsCounter"] == $this->tdPagingArray["tdPageBy"]) {
                                     // if 6
                                     $this->setForm();
                                     $this->resetTDPageRecords();
                                     $this->tpl->set_var("tdPageNumber", $this->tdPagingArray["tdPageNumber"]);
                                     $this->tpl->set_var("tdTotalPages", $this->tdPagingArray["tdTotalPages"]);
                                     if ($this->tdPagingArray["tdPageNumber"] > 1) {
                                         $this->tpl->set_var("FirstPageTextBlock", "");
                                         $this->tpl->parse("ContinuedFromPreviousPageTextBlock", "ContinuedFromPreviousPageText", true);
                                     } else {
                                         if ($this->tdPagingArray["tdPageNumber"] == 1) {
                                             $this->tpl->parse("FirstPageTextBlock", "FirstPageText", true);
                                             $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                         }
                                     }
                                     if ($this->tdPagingArray["tdTotalPages"] > 1 && $this->tdPagingArray["tdPageNumber"] < $this->tdPagingArray["tdTotalPages"]) {
                                         $this->tpl->parse("ContinuedNextPageTextBlock", "ContinuedNextPageText", true);
                                     } else {
                                         if ($this->tdPagingArray["tdTotalPages"] == 1) {
                                             $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                         }
                                     }
                                     if ($this->tdPagingArray["tdTotalPages"] == $this->tdPagingArray["tdPageNumber"]) {
                                         $this->tpl->parse("TotalsBlock", "Totals", true);
                                     } else {
                                         $this->tpl->set_var("TotalsBlock", "");
                                     }
                                     $this->tpl->parse("PageBlock", "Page", true);
                                     $this->tpl->set_var("FirstPageTextBlock", "");
                                     $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                     $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                     $this->tpl->set_var("TotalsBlock", "");
                                     $this->tdPagingArray["tdPageNumber"]++;
                                     $this->formArray["pageNumber"]++;
                                     // reset counter
                                     $this->tdPagingArray["tdPageRecordsCounter"] = 0;
                                     $tdCtr = 0;
                                 } else {
                                     if ($tdContinuousCtr == $this->tdPagingArray["tdCount"]) {
                                         // if this is the last record, and count is still not 6
                                         $this->setForm();
                                         $this->resetTDPageRecords();
                                         $this->tpl->set_var("tdPageNumber", $this->tdPagingArray["tdPageNumber"]);
                                         $this->tpl->set_var("tdTotalPages", $this->tdPagingArray["tdTotalPages"]);
                                         if ($this->tdPagingArray["tdPageNumber"] > 1) {
                                             $this->tpl->set_var("FirstPageTextBlock", "");
                                             $this->tpl->parse("ContinuedFromPreviousPageTextBlock", "ContinuedFromPreviousPageText", true);
                                         } else {
                                             if ($this->tdPagingArray["tdPageNumber"] == 1) {
                                                 $this->tpl->parse("FirstPageTextBlock", "FirstPageText", true);
                                                 $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                             }
                                         }
                                         if ($this->tdPagingArray["tdTotalPages"] > 1 && $this->tdPagingArray["tdPageNumber"] < $this->tdPagingArray["tdTotalPages"]) {
                                             $this->tpl->parse("ContinuedNextPageTextBlock", "ContinuedNextPageText", true);
                                         } else {
                                             if ($this->tdPagingArray["tdTotalPages"] == 1) {
                                                 $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                             }
                                         }
                                         if ($this->tdPagingArray["tdTotalPages"] == $this->tdPagingArray["tdPageNumber"]) {
                                             $this->tpl->parse("TotalsBlock", "Totals", true);
                                         } else {
                                             $this->tpl->set_var("TotalsBlock", "");
                                         }
                                         $this->tpl->parse("PageBlock", "Page", true);
                                         $this->tpl->set_var("FirstPageTextBlock", "");
                                         $this->tpl->set_var("ContinuedFromPreviousPageTextBlock", "");
                                         $this->tpl->set_var("ContinuedNextPageTextBlock", "");
                                         $this->tpl->set_var("TotalsBlock", "");
                                         $this->tdPagingArray["tdPageNumber"]++;
                                         $this->formArray["pageNumber"]++;
                                     }
                                 }
                                 $tdCtr++;
                                 $tdContinuousCtr++;
                                 $this->tdPagingArray["tdPageRecordsCounter"]++;
                             }
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             unset($rptop);
         }
     }
     $this->tpl->set_block("rptsTemplate", "Totals", "TotalsBlock");
     $this->tpl->set_var("TotalsBlock", "");
     //$this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     //		print_r($this->tpl->get("templatePage"));
     //		exit;
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
     //header("location: ".$testpdf->pdfPath);
 }