Beispiel #1
0
 function getMunicipalityCity($municipalityCityID)
 {
     $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
     if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($municipalityCityID))) {
         $ret = "MunicipalityCity DB empty";
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $ret = "error municipalityCityXmlDoc";
         } else {
             $municipalityCity = new MunicipalityCity();
             $municipalityCity->parseDomDocument($domDoc);
             $ret = $municipalityCity->getDescription();
         }
     }
     return $ret;
 }
 function displayPageHeading()
 {
     $BarangayList = new SoapObject(NCCBIZ . "BarangayList.php", "urn:Object");
     if (!($this->formArray["noBgys"] = $BarangayList->getBarangayCount("WHERE " . BARANGAY_TABLE . ".status='active'"))) {
         $this->formArray["noBgys"] = 0;
     }
     $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
     if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray["municipalityCityID"]))) {
         exit("no municipality/city selected");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             exit("no municipality/city selected");
         } else {
             $municipalityCity = new MunicipalityCity();
             $municipalityCity->parseDomDocument($domDoc);
             $this->formArray["municipalityCity"] = $municipalityCity->getDescription();
             $this->formArray["provinceID"] = $municipalityCity->getProvinceID();
             $ProvinceDetails = new SoapObject(NCCBIZ . "ProvinceDetails.php", "urn:Object");
             if (!($xmlStr = $ProvinceDetails->getProvinceDetails($this->formArray["provinceID"]))) {
                 exit("no province associated with selected municipality/city");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("no province associated with selected municipality/city");
                 } else {
                     $province = new Province();
                     $province->parseDomDocument($domDoc);
                     $this->formArray["province"] = $province->getDescription();
                 }
             }
         }
     }
     $quarterEndingDateArray = array("Q1" => "March 31", "Q2" => "June 30", "Q3" => "September 30", "Q4" => "December 31");
     $quarterBeginningDateArray = array("Q1" => "January 1", "Q2" => "April 1", "Q3" => "July 1", "Q4" => "October 1");
     $this->formArray["quarterEndingDate"] = $quarterEndingDateArray[$this->formArray["quarter"]];
     $this->formArray["quarterBeginningDate"] = $quarterBeginningDateArray[$this->formArray["quarter"]];
 }
Beispiel #3
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $this->tpl->set_var("MessageBlock", "");
             $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
             if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray["municipalityCityID"]))) {
                 $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                 $this->tpl->set_var("TableBlock", "record not found");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                 } else {
                     $municipalityCity = new MunicipalityCity();
                     $municipalityCity->parseDomDocument($domDoc);
                     $this->formArray["municipalityCityID"] = $municipalityCity->getMunicipalityCityID();
                     $this->formArray["code"] = $municipalityCity->getCode();
                     $this->formArray["provinceID"] = $municipalityCity->getProvinceID();
                     $this->formArray["description"] = $municipalityCity->getDescription();
                     $this->formArray["status"] = $municipalityCity->getStatus();
                 }
             }
             break;
         case "save":
             if ($this->codeAlreadyExists() == true) {
                 $this->message = "Error. Cannot Save. Code already exists.";
                 $this->tpl->set_var("message", $this->message);
                 $this->tpl->parse("MessageBlock", "Message", true);
                 break;
             } else {
                 $this->tpl->set_var("MessageBlock", "");
             }
             $MunicipalityCityEncode = new SoapObject(NCCBIZ . "MunicipalityCityEncode.php", "urn:Object");
             if ($this->formArray["municipalityCityID"] != "") {
                 $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
                 if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray["municipalityCityID"]))) {
                     exit("record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $municipalityCity = new MunicipalityCity();
                         $municipalityCity->parseDomDocument($domDoc);
                         $municipalityCity->setMunicipalityCityID($this->formArray["municipalityCityID"]);
                         $municipalityCity->setCode($this->formArray["code"]);
                         $municipalityCity->setProvinceID($this->formArray["provinceID"]);
                         $municipalityCity->setDescription($this->formArray["description"]);
                         $municipalityCity->setStatus($this->formArray["status"]);
                         $municipalityCity->setDomDocument();
                         $doc = $municipalityCity->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $MunicipalityCityEncode->updateMunicipalityCity($xmlStr))) {
                             exit("error update");
                         }
                     }
                 }
             } else {
                 $municipalityCity = new MunicipalityCity();
                 $municipalityCity->setMunicipalityCityID($this->formArray["municipalityCityID"]);
                 $municipalityCity->setCode($this->formArray["code"]);
                 $municipalityCity->setProvinceID($this->formArray["provinceID"]);
                 $municipalityCity->setDescription($this->formArray["description"]);
                 $municipalityCity->setStatus($this->formArray["status"]);
                 $municipalityCity->setDomDocument();
                 $doc = $municipalityCity->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $MunicipalityCityEncode->saveMunicipalityCity($xmlStr))) {
                     exit("error save");
                 }
             }
             $this->formArray["municipalityCityID"] = $ret;
             header("location: MunicipalityCityClose.php" . $this->sess->url("") . $this->sess->add_query(array("municipalityCityID" => $ret)));
             //header("location: MunicipalityCityEncode.php?".$this->sess->name."=".$this->sess->id."&municipalityCityID=".$ret.".&formAction=edit");
             exit;
             break;
         case "cancel":
             header("location: MunicipalityCityClose.php" . $this->sess->url("") . $this->sess->add_query(array("municipalityCityID" => $ret)));
             //header("location: MunicipalityCityList.php?".$this->sess->name."=".$this->sess->id."&municipalityCityID=".$ret.".&formAction=edit");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "MunicipalityCityID", "MunicipalityCityIDBlock");
             $this->tpl->set_var("MunicipalityCityIDBlock", "");
             $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
             $this->tpl->set_var("ACKBlock", "");
             $this->tpl->set_var("MessageBlock", "");
     }
     $this->setForm();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Beispiel #4
0
 function Main()
 {
     $this->formArray['currentDate'] = date("F d, Y");
     $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
     #test values
     //$this->formArray['municipalityCityID']=1;
     if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray['municipalityCityID']))) {
         #echo($xmlStr);
         //exit("xml failed for municipality");
         header("Location: " . $this->sess->url("ViewSOA.php") . "&status=2");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             echo "error xmlDoc";
         } else {
             $MunicipalityCity = new MunicipalityCity();
             $MunicipalityCity->parseDomDocument($domDoc);
             $this->formArray['municipality'] = $MunicipalityCity->getDescription();
         }
     }
     #test values
     //$this->formArray['ownerID']=5;
     #echo("ownerID=".$this->formArray['ownerID']."<br>");
     //			$this->displayOwnerList($this->formArray['ownerID']);
     #test values
     //$this->formArray["rptopID"]=15;
     if ($this->formArray['personID'] != "") {
         $person = new Person();
         $person->selectRecord($this->formArray['personID']);
         $this->tpl->set_var(ownerName, $person->getFullName());
         $this->tpl->set_var(ownerNo, $person->getTin());
         $address = $person->addressArray[0];
         $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['personID'];
         $db->query($sql);
     } else {
         $company = new Company();
         $company->selectRecord($this->formArray['companyID']);
         $this->tpl->set_var(ownerName, $company->getCompanyName());
         $this->tpl->set_var(ownerNo, $company->getCompanyID());
         $address = $company->addressArray[0];
         $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['companyID'];
         $db->query($sql);
     }
     /*$person = new Person();
     		$person->selectRecord($this->formArray['personID']);
     		$this->tpl->set_var(ownerName,$person->getFullName());
     		$this->tpl->set_var(ownerNo,$person->getTin());
     		$address = $person->addressArray[0];
     		$this->tpl->set_var(ownerAddress,$address->getNumber() ." ".$address->getStreet()." ".$address->getBarangay()." ".$address->getDistrict()." ".$address->getMunicipalitycity()." ".$address->getProvince());
     		$db = new DB_RPTS();
     
     		$sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=".$this->formArray['personID'];
     		$db->query($sql);*/
     $this->tpl->set_block("rptsTemplate", "ROW", "RowBlk");
     for ($i = 0; $db->next_record(); $i++) {
         $rptopID = $db->f("rptopID");
         $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
         if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
             //	exit("xml failed for RPTOP");
             header("Location: " . $this->sess->url("ViewSOA.php") . "&status=1");
         } else {
             //echo $xmlStr;
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                 $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
             } else {
                 $rptop = new RPTOP();
                 $td = new TD();
                 $rptop->parseDomDocument($domDoc);
                 foreach ($rptop as $key => $value) {
                     $this->formArray['payableYear'] = $rptop->getTaxableYear();
                     $rptopID = $rptop->getRptopID();
                     if ($key == "tdArray") {
                         $tdCtr = 0;
                         if (count($value)) {
                             foreach ($value as $tkey => $tvalue) {
                                 $td->selectRecord($tvalue->getTdID());
                                 $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                 $propertyType = $td->getPropertyType();
                                 $TaxDeclarationNumber = $td->getTaxDeclarationNumber();
                                 //										$this->tpl->set_var(kind,$propertyType);
                                 //										$this->tpl->set_var(currentTDNo,$TaxDeclarationNumber);
                                 /*									$dues = new Dues();
                                 									$dues->create($td->getTdID(), "","","","2003");
                                 									$this->tpl->set_var(basic,$dues->getBasic());
                                 									$totBasic += $dues->getBasic();
                                 									$this->tpl->set_var(sef,$dues->getSEF());
                                 									$totSEF += $dues->getSEF();
                                 									$this->tpl->set_var(total,$dues->getSEF()+$dues->getBasic());
                                 									$totTaxDue += $dues->getSEF()+$dues->getBasic();*/
                                 $afsID = $td->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $od = new OD();
                                 $od->selectRecord($afs->getOdID());
                                 $addr = $od->getLocationAddress();
                                 if (count($addr)) {
                                     $location = $addr->getFullAddress();
                                     //												$this->tpl->set_var(location,$addr->getFullAddress());
                                     $munCityID = $addr->getMunicipalityCityID();
                                     //											if($munCityID == $this->formArray['municipalityCityID'])
                                     //												$this->tpl->set_var(municipality,$addr->getMunicipalityCity());
                                 }
                                 if (count($afs->landArray)) {
                                     foreach ($afs->landArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $landActualUses = new LandActualUses();
                                         $landActualUses->selectRecord($actualUse);
                                         //$this->tpl->set_var("class",$landActualUses->getCode());
                                         $Code = $landActualUses->getCode();
                                     }
                                 }
                                 if (count($afs->improvementsBuildingsArray)) {
                                     foreach ($afs->improvementsBuildingsArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $improvementsBuildingsActualUses = new improvementsBuildingsActualUses();
                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                         //$this->tpl->set_var("class",$improvementsBuildingsActualUses->getCode());
                                         $Code = $improvementsBuildingsActualUses->getCode();
                                     }
                                 }
                                 //echo $afs->get
                                 //											echo $munCityID ."==". $this->formArray['municipalityCityID']."<br>";
                                 if ($munCityID == $this->formArray['municipalityCityID']) {
                                     $this->tpl->set_var(location, $location);
                                     $this->tpl->set_var("class", $Code);
                                     $this->tpl->set_var(kind, $propertyType);
                                     $this->tpl->set_var(currentTDNo, $TaxDeclarationNumber);
                                     $this->tpl->set_var(municipality, $addr->getMunicipalityCity());
                                     $dues = new Dues();
                                     $dues->create($td->getTdID(), "", "", "", "2003");
                                     $totTaxDue += $dues->getSEF() + $dues->getBasic();
                                     $basic = number_format($dues->getBasic(), "2", ".", "");
                                     $this->tpl->set_var(basic, $basic);
                                     $totBasic += $basic;
                                     $sef = number_format($dues->getSEF(), "2", ".", "");
                                     $this->tpl->set_var(sef, $sef);
                                     $totSEF += number_format($sef, "2", ".", "");
                                     $this->tpl->set_var(total, number_format($sef + $basic, "2", ".", ""));
                                     $this->tpl->set_var(marketValue, number_format($afs->getTotalMarketValue(), 2));
                                     $totMarketValue += $afs->getTotalMarketValue();
                                     $this->tpl->set_var(assessedValue, number_format($afs->getTotalAssessedValue(), 2));
                                     $totAssessedValue += $afs->getTotalAssessedValue();
                                     $pIndexNo = $afs->getPropertyIndexNumber();
                                     if ($pIndexNo == "") {
                                         $pIndexNo = "No value specified";
                                     }
                                     $this->tpl->set_var(pin, $pIndexNo);
                                     //echo $afs->getTotalMarketValue();
                                     /*									if(count($afs->landArray)){
                                     										foreach($afs->landArray as $afsKey => $afsValue){
                                     											$this->tpl->set_var(pin,$afsValue->getPropertyIndexNumber());
                                     										}
                                     								}							
                                     */
                                     $this->tpl->parse("RowBlk", "ROW", true);
                                 }
                                 //else{
                                 //											$this->tpl->set_var("RowBlk","");
                                 //								}
                             }
                             #end foreach($value)
                         }
                         #end if coun value
                         $this->tpl->set_var(totalMarketValue, number_format($totMarketValue, 2));
                         $this->tpl->set_var(totalAssessedValue, number_format($totAssessedValue, 2));
                         $this->tpl->set_var(totalBasic, number_format($totBasic, 2));
                         $this->tpl->set_var(totalSEF, number_format($totSEF, 2));
                         $this->tpl->set_var(totalTaxDue, number_format($totTaxDue, 2));
                     }
                 }
             }
             //				$this->tpl->parse("RowBlk","ROW",true);
         }
     }
     //		$owner
     /*		$RPTOPDetails = new SoapObject(NCCBIZ."RPTOPDetails.php", "urn:Object");
     		if (!$xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"])){
     			//exit("xml failed for RPTOP");
     			header("Location: ".$this->sess->url("ViewSOA.php")."&status=1");
     		}
     		else{
     			//echo $xmlStr;
     			if(!$domDoc = domxml_open_mem($xmlStr)) {
     				$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
     				$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
     			}
     			else {
     				$rptop = new RPTOP;
     				$td = new TD();
     				$rptop->parseDomDocument($domDoc);
     				$status_report = "";
     				foreach($rptop as $key => $value){
     					$this->formArray['payableYear'] = $rptop->getTaxableYear();
     					$rptopID = $rptop->getRptopID();
     					if($key=="tdArray"){
     						$tdCtr = 0;
     							if (count($value)){	
     							$this->tpl->set_block("rptsTemplate","ROW","RowBlk");	
     								foreach($value as $tkey => $tvalue){			
     									$td->selectRecord($tvalue->getTdID());
     
     									$assessedValue = number_format($td->getAssessedValue(),2,".","");
     									$propertyType = $td->getPropertyType();
     									$TaxDeclarationNumber = $td->getTaxDeclarationNumber();
     									//$tdCtr++;
     									$this->tpl->set_var(kind,$propertyType);
     									$this->tpl->set_var(currentTDNo,$TaxDeclarationNumber);
     
     /*									$dues = new Dues();
     									$dues->create($td->getTdID(), "","","","2003");
     									$this->tpl->set_var(basic,$dues->getBasic());
     									$totBasic += $dues->getBasic();
     									$this->tpl->set_var(sef,$dues->getSEF());
     									$totSEF += $dues->getSEF();
     									$this->tpl->set_var(total,$dues->getSEF()+$dues->getBasic());
     									$totTaxDue += $dues->getSEF()+$dues->getBasic();*/
     /*								$afsID = $td->getAfsID();
     									$afs = new AFS();
     									$afs->selectRecord($afsID);
     									$od = new OD();
     									$od->selectRecord($afs->getOdID());
     									$addr = $od->getLocationAddress();
     									if(count($addr)){
     									$this->tpl->set_var(location,$addr->getFullAddress());
     									$munCityID = $addr->getMunicipalityCityID();
     										if($munCityID == $this->formArray['municipalityCityID'])
     										$this->tpl->set_var(municipality,$addr->getMunicipalityCity());
     									}
     									if(count($afs->landArray)){
     										foreach($afs->landArray as $afsKey => $afsValue){
     											$actualUse = $afsValue->getActualUse();
     											$landActualUses = new LandActualUses();
     											$landActualUses->selectRecord($actualUse);
     											$this->tpl->set_var("class",$landActualUses->getCode());
     										}
     									}
     									if(count($afs->improvementsBuildingsArray)){
     										foreach($afs->improvementsBuildingsArray as $afsKey => $afsValue){
     											$actualUse = $afsValue->getActualUse();
     											$improvementsBuildingsActualUses = new improvementsBuildingsActualUses();
     											$improvementsBuildingsActualUses->selectRecord($actualUse);
     											$this->tpl->set_var("class",$improvementsBuildingsActualUses->getCode());
     										}
     									}
     									//echo $afs->get
     
     									if($munCityID == $this->formArray['municipalityCityID']){
     									$dues = new Dues();
     									$dues->create($td->getTdID(), "","","","2003");
     									$this->tpl->set_var(basic,number_format($dues->getBasic(),"2",".",""));
     									$totBasic += $dues->getBasic();
     									$this->tpl->set_var(sef,number_format($dues->getSEF(),"2",".",""));
     									$totSEF += $dues->getSEF();
     									$this->tpl->set_var(total,number_format($dues->getSEF()+$dues->getBasic(),"2",".",""));
     									$pIndexNo = $afs->getPropertyIndexNumber();
     									if($pIndexNo==""){
     										$pIndexNo = "No value specified";	
     									}
     									$this->tpl->set_var(pin,$pIndexNo);
     									
     									$this->tpl->set_var(marketValue,$afs->getTotalMarketValue());
     									$totMarketValue += $afs->getTotalMarketValue();
     									$this->tpl->set_var(assessedValue,$afs->getTotalAssessedValue());
     									$totAssessedValue += $afs->getTotalAssessedValue();																
     									//echo $afs->getTotalMarketValue();
     /*									if(count($afs->landArray)){
     										foreach($afs->landArray as $afsKey => $afsValue){
     											$this->tpl->set_var(pin,$afsValue->getPropertyIndexNumber());
     										}
     									}							
     */
     /*								$this->tpl->parse("RowBlk","ROW",true);
     								}else{
     								$this->tpl->set_var("RowBlk","");
     								}
     								}#end foreach($value)						
     							}#end if coun value
     
     //				$this->tpl->set_block("rptsTemplate","STAT",sBlk);
     //				$this->tpl->set_var(status_report,$status_report);
     //				$this->tpl->parse(sBlk,"STAT",true);
     							
     							$this->tpl->set_var(totalMarketValue,$totMarketValue);
     							$this->tpl->set_var(totalAssessedValue,$totAssessedValue);
     							$this->tpl->set_var(totalBasic,$totBasic);
     							$this->tpl->set_var(totalSEF,$totSEF);
     							$this->tpl->set_var(totalTaxDue,$totTaxDue);
     					}
     				}
     				
     			}
     		}*/
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Beispiel #5
0
 function Main()
 {
     $this->formArray['currentDate'] = date("F d, Y");
     $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
     #test values
     //$this->formArray['municipalityCityID']=1;
     if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray['municipalityCityID']))) {
         #echo($xmlStr);
         exit("xml failed for municipality");
         //header("Location: ".$this->sess->url("ViewSOA.php")."&status=2");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             echo "error xmlDoc";
         } else {
             $MunicipalityCity = new MunicipalityCity();
             $MunicipalityCity->parseDomDocument($domDoc);
             $this->formArray['municipality'] = $MunicipalityCity->getDescription();
         }
     }
     if ($this->formArray['personID'] != "") {
         $person = new Person();
         $person->selectRecord($this->formArray['personID']);
         $this->tpl->set_var(ownerName, $person->getFullName());
         $this->tpl->set_var(ownerNo, $person->getTin());
         $address = $person->addressArray[0];
         if (is_object($address)) {
             $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         } else {
             $this->tpl->set_var(ownerAddress, "");
         }
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['personID'];
         $db->query($sql);
     } else {
         $company = new Company();
         $company->selectRecord($this->formArray['companyID']);
         $this->tpl->set_var(ownerName, $company->getCompanyName());
         $this->tpl->set_var(ownerNo, $company->getCompanyID());
         $address = $company->addressArray[0];
         $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['companyID'];
         $db->query($sql);
     }
     $ypos = 325;
     $this->tpl->set_block("rptsTemplate", "ROW", "RowBlk");
     for ($i = 0; $db->next_record(); $i++) {
         $rptopID = $db->f("rptopID");
         $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
         if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
             //	exit("xml failed for RPTOP");
             header("Location: " . $this->sess->url("ViewSOA.php") . "&status=1");
         } else {
             //echo $xmlStr;
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                 $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
             } else {
                 $rptop = new RPTOP();
                 $td = new TD();
                 $rptop->parseDomDocument($domDoc);
                 foreach ($rptop as $key => $value) {
                     $this->formArray['payableYear'] = $rptop->getTaxableYear();
                     $rptopID = $rptop->getRptopID();
                     if ($key == "tdArray") {
                         $tdCtr = 0;
                         if (count($value)) {
                             foreach ($value as $tkey => $tvalue) {
                                 $td->selectRecord($tvalue->getTdID());
                                 $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                 $propertyType = $td->getPropertyType();
                                 $TaxDeclarationNumber = $td->getTaxDeclarationNumber();
                                 $afsID = $td->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $od = new OD();
                                 $od->selectRecord($afs->getOdID());
                                 $addr = $od->getLocationAddress();
                                 if (count($addr)) {
                                     $location = strtoupper($addr->getNumber() . " " . substr($addr->getBarangay(), 0, 4) . " " . substr($addr->getMunicipalityCity(), 0, 3) . " " . substr($addr->getProvince(), 0, 3));
                                     $munCityID = $addr->getMunicipalityCityID();
                                 }
                                 if (count($afs->landArray)) {
                                     foreach ($afs->landArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $landActualUses = new LandActualUses();
                                         $landActualUses->selectRecord($actualUse);
                                         $Code = $landActualUses->getCode();
                                     }
                                 }
                                 if (count($afs->improvementsBuildingsArray)) {
                                     foreach ($afs->improvementsBuildingsArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $improvementsBuildingsActualUses = new improvementsBuildingsActualUses();
                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                         $Code = $improvementsBuildingsActualUses->getCode();
                                     }
                                 }
                                 if ($munCityID == $this->formArray['municipalityCityID']) {
                                     $this->tpl->set_var(location, $location);
                                     $this->tpl->set_var("class", $Code);
                                     $this->tpl->set_var(kind, strtoupper(substr($propertyType, 0, 4)));
                                     $this->tpl->set_var(currentTDNo, $TaxDeclarationNumber);
                                     $this->tpl->set_var(municipality, $addr->getMunicipalityCity());
                                     //$dues = new Dues();
                                     //$dues->create($td->getTdID(),"2003");
                                     //$totTaxDue += $dues->getSEF()+$dues->getBasic();
                                     $dues = new Dues($tvalue->getTdID(), $rptop->getTaxableYear(), $assessedValue);
                                     $paymentPeriod = $dues->getPaymentMode();
                                     $totalTaxDue = $dues->getPaidBasic($paymentPeriod) + $dues->getPaidSEF($paymentPeriod) + $dues->getPaidIdle($paymentPeriod);
                                     if ($dues->getAmnesty()) {
                                         $dues->setPctPenalty(0.0);
                                     } else {
                                         $totalTaxDue += $dues->getPenalty($paymentPeriod);
                                     }
                                     if ($dues->getIsDiscount()) {
                                         $taxDue->setDiscount($totalTaxDue);
                                         $totalTaxDue -= $dues->getDiscount();
                                     }
                                     $interest = $dues->getPctPenalty();
                                     if ($interest > 0 && $paymentPeriod != "Annual") {
                                         $paymentPeriod = "Annual";
                                     }
                                     $basic = number_format($dues->getPaidBasic(), "2", ".", "");
                                     $this->tpl->set_var(basic, $basic);
                                     $totBasic += $basic;
                                     $sef = number_format($dues->getPaidSEF(), "2", ".", "");
                                     $this->tpl->set_var(sef, $sef);
                                     $totSEF += number_format($sef, "2", ".", "");
                                     $this->tpl->set_var(total, number_format($sef + $basic, "2", ".", ""));
                                     $this->tpl->set_var(marketValue, number_format($afs->getTotalMarketValue(), 2));
                                     $totMarketValue += $afs->getTotalMarketValue();
                                     $this->tpl->set_var(assessedValue, number_format($afs->getTotalAssessedValue(), 2));
                                     $totAssessedValue += $afs->getTotalAssessedValue();
                                     $pIndexNo = $afs->getPropertyIndexNumber();
                                     if ($pIndexNo == "") {
                                         $pIndexNo = "No value specified";
                                     }
                                     $ypos = $ypos - 10;
                                     $this->tpl->set_var(ypos, $ypos);
                                     $this->tpl->set_var(pin, $pIndexNo);
                                     $this->tpl->parse("RowBlk", "ROW", true);
                                 }
                             }
                             #end foreach($value)
                         }
                         #end if coun value
                         $this->tpl->set_var(totalMarketValue, number_format($totMarketValue, 2));
                         $this->tpl->set_var(totalAssessedValue, number_format($totAssessedValue, 2));
                         $this->tpl->set_var(totalBasic, number_format($totBasic, 2));
                         $this->tpl->set_var(totalSEF, number_format($totSEF, 2));
                         $this->tpl->set_var(totalTaxDue, number_format($totalTaxDue, 2));
                     }
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     /*		$this->tpl->parse("templatePage", "rptsTemplate");
     		$this->tpl->finish("templatePage");
     		$this->tpl->p("templatePage");
     */
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $rptrpdf = new PDFWriter();
     $rptrpdf->setOutputXML($this->tpl->get('templatePage'), "string");
     $rptrpdf->writePDF("viewSOA.pdf");
 }