Пример #1
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");
 }
Пример #2
0
 function Main()
 {
     global $sess;
     $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);
             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 "taxableYear":
                         $this->tpl->set_var("taxableYear", $value);
                         $dueDate = $value;
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $this->tpl->set_block("rptsTemplate", "JSTDList", "JSTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "BacktaxTDTable", "BacktaxTDTableBlock");
                         $this->unpaidTDCount = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             foreach ($value as $tkey => $tvalue) {
                                 $propertyType = $tvalue->getPropertyType();
                                 $propertyID = $tvalue->getPropertyID();
                                 $afsID = $tvalue->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $listValues['propertyIndexNumber'] = $afs->getPropertyIndexNumber();
                                 $assessedValue = $tvalue->getAssessedValue();
                                 #echo("assessedValue=$assessedValue<br7>");
                                 $listValues['taxBeginsWithTheYear'] = $tvalue->getTaxBeginsWithTheYear();
                                 $listValues['tdNum'] = $tvalue->getTaxDeclarationNumber();
                                 $tdID = $tvalue->getTdID();
                                 $listValues['tdID'] = $tdID;
                                 #echo("tdID=$tdID, dueDate=$dueDate<br>");
                                 $dues = new Dues($tdID, $dueDate);
                                 if (!$dues->create($tdID, $dueDate, $assessedValue)) {
                                     $dues->setBasic($assessedValue);
                                     $dues->setSEF($assessedValue);
                                     # check if land is idle, if yes, set assessed value
                                     # getIdleStatus -- temporary function
                                     if ($dues->getIdleStatus() == 1) {
                                         #echo("idle<br>");
                                         $dues->setIdle($assessedValue);
                                     }
                                 }
                                 // Refresh for amnesty and paymentPeriod
                                 if ($this->formArray["formAction"] == "refresh") {
                                     $amnesty = $this->formArray[amnesty];
                                     $dues->setAmnesty($amnesty);
                                     $paymentPeriod = $this->formArray[paymentPeriod];
                                     $dues->setPaymentMode($paymentPeriod);
                                 }
                                 if ($dues->getAmnesty() == "Yes") {
                                     $dues->resetPenalty();
                                     $dues->computePenalty($paymentPeriod, "now");
                                 }
                                 $paymentPeriod = $dues->getPaymentMode();
                                 $amnesty = $dues->getAmnesty();
                                 $dues->store();
                                 switch ($paymentPeriod) {
                                     case 'Quarter':
                                         $this->tpl->set_var("selectedQuarter", "selected");
                                         $this->tpl->set_var("paymentPeriod", $paymentPeriod);
                                         $this->tpl->set_var("installmentNumber", ceil(date("n") / 3));
                                         $this->tpl->set_var("netDueFullAmount", number_format($dues->getTotalDue("Annual"), 2));
                                         break;
                                     default:
                                         #Annual
                                         $this->tpl->set_block("rptsTemplate", "QuarterNetDue", "QuarterNetDueBlock");
                                         $this->tpl->set_var("QuarterNetDueBlock", "");
                                         $this->tpl->set_var("selectedAnnual", "selected");
                                         $this->tpl->set_var("paymentPeriod", $paymentPeriod);
                                         break;
                                 }
                                 //$totalDue = $dues->getTotalDue($paymentPeriod);
                                 $totalDue = $dues->getTotalDue($paymentPeriod);
                                 $basic = $dues->getBasic($paymentPeriod);
                                 $sef = $dues->getSEF($paymentPeriod);
                                 $penalty = $dues->getPenalty($paymentPeriod);
                                 $discount = $dues->getDiscount();
                                 $totalPaid = $dues->getPaidBasic($paymentPeriod) + $dues->getPaidPenalty($paymentPeriod) + $dues->getPaidSEF($paymentPeriod);
                                 $listValues['taxDue'] = $totalDue;
                                 $listValues['basic'] = number_format($basic, 2);
                                 $listValues['sef'] = number_format($sef, 2);
                                 $listValues['penalty'] = number_format($penalty, 2);
                                 $listValues['discount'] = number_format($discount, 2);
                                 $listValues['totalPaid'] = number_format($totalPaid, 2);
                                 $listValues['strTaxDue'] = number_format($totalDue, 2);
                                 //$basic = $dues->getBasic($paymentPeriod);
                                 #echo("basic=$basic<br>");
                                 //$sef = $dues->getSEF($paymentPeriod);
                                 #echo("sef=$sef<br>");
                                 if (!$this->isPriorTDPaid($tdID)) {
                                     $backtaxes = true;
                                     $paidStatus = "<input type=\"checkbox\" name=\"tdID[" . $tdID . "]\" value=\"" . $tdID . "\" onclick=\"javascript: toggle(this, '" . $tdID . "'); updateTotalTaxDue(this," . $tdID . ");\" disabled>";
                                 } else {
                                     $backtaxes = false;
                                     $paidStatus = $totalDue <= 0 ? $basic <= 0 ? "N.A." : "PAID" : "<input type=\"checkbox\" name=\"tdID[" . $tdID . "]\" value=\"" . $tdID . "\" onclick=\"javascript: toggle(this, '" . $tdID . "'); updateTotalTaxDue(this," . $tdID . ");\">";
                                 }
                                 $listValues['paidStatus'] = $paidStatus;
                                 $listValues['tdBgcolor'] = '#f6f6f6';
                                 $this->tpl->set_var($listValues);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 if ($backtaxes) {
                                     $oldestUnpaidTD = $this->unpaidTDArray[count($this->unpaidTDArray) - 1];
                                     $this->displayBacktaxTD($oldestUnpaidTD->getTdID());
                                     $this->displayPriorTDs($tdID);
                                     unset($this->unpaidTDArray);
                                 } else {
                                     $this->displayBacktaxTD($tdID);
                                     $this->tpl->set_var("JSTDListBlock", "");
                                 }
                                 //$this->tpl->parse("BacktaxTDTableBlock", "BacktaxTDTable", true);
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "CheckAll", "CheckAllBlock");
                             $this->tpl->set_var("CheckAllBlock", "");
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("rptopID", $rptopID);
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $this->tpl->set_var(amnestyChecked, $amnesty == "Yes" ? " checked" : "");
     $this->tpl->set_var("Session", $sess->url("") . $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");
 }