コード例 #1
0
ファイル: DueEncode.php プロジェクト: armic/erpts
 function updateDue($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $due = new Due();
     $due->parseDomDocument($domDoc);
     $ret = $due->updateRecord();
     return $ret;
 }
コード例 #2
0
 public function actionAdmin()
 {
     Controller::scriptBasico(5);
     $model = new Due('search');
     $model->unsetAttributes();
     if (isset($_GET['Due'])) {
         $model->setAttributes($_GET['Due']);
     }
     $this->render('admin', array('model' => $model));
 }
コード例 #3
0
ファイル: CalculateRPTOP.php プロジェクト: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOP.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
コード例 #4
0
ファイル: DueEncode.php プロジェクト: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "save":
             $DueEncode = new SoapObject(NCCBIZ . "DueEncode.php", "urn:Object");
             if ($this->formArray["dueID"] != "") {
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 if (!($xmlStr = $DueDetails->getDue($this->formArray["dueID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "record not found");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                         $this->tpl->set_var("TableBlock", "error xmlDoc");
                     } else {
                         $dueArray = $this->setDues();
                         foreach ($dueArray as $due) {
                             $doc = $due->getDomDocument();
                             $xmlStr = $doc->dump_mem(true);
                             if (!($ret = $DueEncode->updateDue($xmlStr))) {
                                 exit("error update");
                             }
                             unset($doc);
                             unset($xmlStr);
                         }
                     }
                 }
             } else {
                 $dueArray = $this->setDues();
                 foreach ($dueArray as $due) {
                     $doc = $due->getDomDocument();
                     $xmlStr = $doc->dump_mem(true);
                     if (!($ret = $DueEncode->saveDue($xmlStr))) {
                         exit("error saving");
                     }
                     unset($doc);
                     unset($xmlStr);
                 }
             }
             $this->formArray["dueID"] = $ret;
             header("location: DueClose.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit($ret);
             break;
         default:
             // grab current tax rates from TreasurySettings
             $treasurySettings = new TreasurySettings();
             $treasurySettings->selectRecord();
             $this->formArray["masterBasicTaxRate"] = $treasurySettings->getPctRPTax();
             $this->formArray["masterSEFTaxRate"] = $treasurySettings->getPctSEF();
             $this->formArray["masterIdleTaxRate"] = $treasurySettings->getPctIdle();
             $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
             $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
             if (!($xmlStr = $TDDetails->getTD($this->formArray["tdID"]))) {
                 // xml failed
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     // domDoc empty
                 } else {
                     $td = new TD();
                     $td->parseDomDocument($domDoc);
                     $this->formArray["afsID"] = $td->getAfsID();
                     $this->formArray["taxDeclarationNumber"] = $td->getTaxDeclarationNumber();
                     $this->formArray["taxBeginsWithTheYear"] = $td->getTaxBeginsWithTheYear();
                 }
             }
             unset($xmlStr);
             unset($domDoc);
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 // xml failed
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     // domDoc empty
                 } else {
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $this->formArray["assessedValue"] = $afs->getTotalAssessedValue();
                     $this->formArray["taxability"] = $afs->getTaxability();
                     $this->formArray["effectivity"] = $afs->getEffectivity();
                     $this->formArray["propertyType"] = $td->getPropertyType();
                     $this->formArray["idle"] = "No";
                     if ($td->getPropertyType() == "Land") {
                         if (is_array($afs->landArray)) {
                             // if land is stripped
                             if (count($afs->landArray) > 1) {
                                 foreach ($afs->landArray as $land) {
                                     if ($land->getIdle() == "Yes") {
                                         $this->formArray["idle"] = "Yes";
                                         break;
                                     }
                                 }
                             } else {
                                 $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                             }
                         }
                     }
                     if ($this->formArray["idle"] == "") {
                         $this->formArray["idle"] = "No";
                     }
                 }
             }
             if ($this->formArray["dueID"] != "") {
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 if (!($xmlStr = $DueDetails->getDue($this->formArray["dueID"]))) {
                     echo "xml failed";
                 } else {
                     //echo $xmlStr;
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         echo "error xmlDoc";
                     } else {
                         $due = new Due();
                         $due->parseDomDocument($domDoc);
                         foreach ($due as $key => $value) {
                             switch ($key) {
                                 default:
                                     $this->formArray[$key] = $value;
                             }
                         }
                         $this->formArray["dueDate_str"] = date("F d, Y", strtotime($this->formArray["dueDate"]));
                         $this->formArray["taxDue"] = $due->getTaxDue();
                     }
                 }
             } else {
                 // select RPTOP taxable year from rptopID
                 $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
                 if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
                     exit("xml failed");
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         exit("error domDoc");
                     } else {
                         $rptop = new RPTOP();
                         $rptop->parseDomDocument($domDoc);
                         $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                     }
                 }
                 // display default Due details
                 $this->formArray["dueDate"] = date("Y-n-d", strtotime($this->formArray["taxableYear"] . "-" . $treasurySettings->getAnnualDueDate()));
                 $this->formArray["dueDate_str"] = date("F d, Y", strtotime($this->formArray["dueDate"]));
                 $this->formArray["basicTaxRate"] = $this->formArray["masterBasicTaxRate"];
                 $this->formArray["sefTaxRate"] = $this->formArray["masterSEFTaxRate"];
                 $this->formArray["idleTaxRate"] = $this->formArray["masterIdleTaxRate"];
                 $this->formArray["basicTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["basicTaxRate"];
                 $this->formArray["sefTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["sefTaxRate"];
                 // if land->idle is "Yes", compute idleTax, otherwise set idleTax to zero
                 if ($this->formArray["propertyType"] == "Land") {
                     if ($this->formArray["idle"] == "Yes") {
                         $this->formArray["idleTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["idleTaxRate"];
                     } else {
                         $this->formArray["idleTax"] = "0.00";
                     }
                 }
                 // if afs->taxability is "Exempt", reset computations to zero.
                 if ($this->formArray["taxability"] == "Exempt") {
                     $this->formArray["basicTax"] = 0.0;
                     $this->formArray["sefTax"] = 0.0;
                     $this->formArray["idleTax"] = 0.0;
                 }
                 $this->formArray["taxDue"] = $this->formArray["basicTax"] + $this->formArray["sefTax"] + $this->formArray["idleTax"];
             }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("dueID" => $this->formArray["dueID"], "tdID" => $this->formArray["tdID"], "rptopID" => $this->formArray["rptopID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
コード例 #5
0
ファイル: CalculateRPTOPDetails.php プロジェクト: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")";
             $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
             if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) {
                 if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                     //echo "SOAP failed";
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     //select
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo($xmlStr);
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             //print_r($rptop);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID());
                             $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName());
                             $this->formArray["cityAssessorName"] = $cityAssessor->getFullName();
                         } else {
                             $cityAssessor = $value;
                             $this->tpl->set_var("cityAssessorID", $cityAssessor);
                             $this->tpl->set_var("cityAssessorName", $cityAssessor);
                             $this->formArray["cityAssessorName"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID());
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName());
                             $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName();
                         } else {
                             $cityTreasurer = $value;
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer);
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer);
                             $this->formArray["cityTreasurerName"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $tdCtr = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             /*
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             */
                             foreach ($value as $tkey => $tvalue) {
                                 //foreach($tvalue as $column => $val){
                                 //	$this->tpl->set_var($column,$val);
                                 //}
                                 $this->tpl->set_var("tdID", $tvalue->getTDID());
                                 $this->tpl->set_var("taxDeclarationNumber", $tvalue->getTaxDeclarationNumber());
                                 $this->tpl->set_var("afsID", $tvalue->getAfsID());
                                 $this->tpl->set_var("cancelsTDNumber", $tvalue->getCancelsTDNumber());
                                 $this->tpl->set_var("canceledByTDNumber", $tvalue->getCanceledByTDNumber());
                                 $this->tpl->set_var("taxBeginsWithTheYear", $tvalue->getTaxBeginsWithTheYear());
                                 $this->tpl->set_var("ceasesWithTheYear", $tvalue->getCeasesWithTheYear());
                                 $this->tpl->set_var("enteredInRPARForBy", $tvalue->getEnteredInRPARForBy());
                                 $this->tpl->set_var("enteredInRPARForYear", $tvalue->getEnteredInRPARForYear());
                                 $this->tpl->set_var("previousOwner", $tvalue->getPreviousOwner());
                                 $this->tpl->set_var("previousAssessedValue", $tvalue->getPreviousAssessedValue());
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getProvincialAssessorDate());
                                 $this->tpl->set_var("pa_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("pa_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("pa_dayValue", removePreZero($dateArr["day"]));
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getCityMunicipalAssessorDate());
                                 $this->tpl->set_var("cm_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("cm_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("cm_dayValue", removePreZero($dateArr["day"]));
                                 $this->tpl->set_var("provincialAssessorName", $tvalue->provincialAssessor);
                                 $this->tpl->set_var("cityMunicipalAssessorName", $tvalue->cityMunicipalAssessor);
                                 //$this->tpl->set_var("assessedValue",$tvalue->getAssessedValue());
                                 $this->tpl->set_var("propertyType", $tvalue->getPropertyType());
                                 $this->tpl->set_var("basicTax", "");
                                 $this->tpl->set_var("sefTax", "");
                                 $this->tpl->set_var("total", "");
                                 //$this->tpl->set_var("basicTax",$tvalue->getBasicTax());
                                 //$this->tpl->set_var("sefTax",$tvalue->getSefTax());
                                 //$this->tpl->set_var("total",$tvalue->getTotal());
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     //$this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                                     //$this->tpl->set_var("AFSTableBlock", "afs not found");
                                 } else {
                                     //echo $xmlStr;
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         //$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                         //$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue();
                                         $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue();
                                         $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                         $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                         $this->tpl->set_var("taxability", $afs->getTaxability());
                                         $this->tpl->set_var("effectivity", $afs->getEffectivity());
                                         $this->formArray["idle"] = "No";
                                         if ($tvalue->getPropertyType() == "Land") {
                                             if (is_array($afs->landArray)) {
                                                 // if land is stripped
                                                 if (count($afs->landArray) > 1) {
                                                     foreach ($afs->landArray as $land) {
                                                         if ($land->getIdle() == "Yes") {
                                                             $this->formArray["idle"] = "Yes";
                                                             break;
                                                         }
                                                     }
                                                 } else {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                         if ($this->formArray["idle"] == "") {
                                             $this->formArray["idle"] = "No";
                                         }
                                         $this->tpl->set_var("idle", $this->formArray["idle"]);
                                     }
                                 }
                                 // grab Due from tdID
                                 $this->formArray["totalTaxDue"] = 0.0;
                                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                 if (!($xmlStr = $DueDetails->getDueFromTdID($tvalue->getTdID(), $rptop->getTaxableYear()))) {
                                     $this->tpl->set_var("dueID", "");
                                     $this->tpl->set_var("dueDate", "---/--/--");
                                     $this->tpl->set_var("basicTax", "uncalculated");
                                     $this->tpl->set_var("sefTax", "uncalculated");
                                     $this->tpl->set_var("idleTax", "uncalculated");
                                     $this->tpl->set_var("taxDue", "uncalculated");
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         $this->tpl->set_var("dueDate", "---/--/--");
                                         $this->tpl->set_var("dueID", "uncalculated");
                                         $this->tpl->set_var("basicTax", "uncalculated");
                                         $this->tpl->set_var("sefTax", "uncalculated");
                                         $this->tpl->set_var("idleTax", "uncalculated");
                                         $this->tpl->set_var("taxDue", "uncalculated");
                                     } else {
                                         $due = new Due();
                                         $due->parseDomDocument($domDoc);
                                         $this->tpl->set_var("dueID", $due->getDueID());
                                         $this->tpl->set_var("dueDate", date("M. d, Y", strtotime($due->getDueDate())));
                                         $this->tpl->set_var("basicTax", formatCurrency($due->getBasicTax()));
                                         $this->tpl->set_var("sefTax", formatCurrency($due->getSEFTax()));
                                         $this->tpl->set_var("idleTax", formatCurrency($due->getIdleTax()));
                                         $this->tpl->set_var("taxDue", formatCurrency($due->getTaxDue()));
                                         $this->formArray["totalTaxDue"] += $due->getTaxDue();
                                     }
                                 }
                                 // refresh tdHistory
                                 // insert/update Dues from PreviousTD as BacktaxTD for CurrentTD
                                 // if previous TD has no Dues, create a Due and insert as BacktaxTD
                                 $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                                 $this->refreshTDHistory($tvalue);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("defaultTDListBlock", "defaultTDList", true);
                                 $this->tpl->parse("toggleTDListBlock", "toggleTDList", true);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 /*
                                 $this->tpl->set_var("LandBlock", "");
                                 $this->tpl->set_var("PlantsTreesBlock", "");
                                 $this->tpl->set_var("ImprovementsBuildingsBlock", "");
                                 $this->tpl->set_var("MachineriesBlock", "");
                                 */
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("defaultTDListBlock", "//no default");
                             $this->tpl->set_var("toggleTDListBlock", "//no Toggle");
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     case "landTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "landTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
             $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
             unset($rptop);
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             $rptop = new RPTOP();
             $rptop->setRptopID($this->formArray["rptopID"]);
             $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
             $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
             $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
             $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
             $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
             $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
             $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
             $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
             $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]);
             $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
             $rptop->setCreatedBy($this->userID);
             $rptop->setModifiedBy($this->userID);
             $rptop->setDomDocument();
             $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object");
             $rptop->setDomDocument();
             $doc = $rptop->getDomDocument();
             $xmlStr = $doc->dump_mem(true);
             //echo $xmlStr;
             if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) {
                 echo "ret=" . $ret;
             }
             //echo $ret;
         }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
コード例 #6
0
ファイル: collectionReport9.php プロジェクト: armic/erpts
 function Main()
 {
     $eRPTSSettings = new eRPTSSettings();
     if ($eRPTSSettings->selectRecord(1)) {
         $this->tpl->set_var("lguType", strtoupper($eRPTSSettings->getLguType()));
         $this->tpl->set_var("lguName", strtoupper($eRPTSSettings->getLguName()));
     }
     $dbTD = new DB_RPTS();
     $dbBacktaxTD = new DB_RPTS();
     $dbPaymentBacktaxTD = new DB_RPTS();
     $dbPaymentTD = new DB_RPTS();
     $dbCollectionBacktaxTD = new DB_RPTS();
     $dbCollectionTD = new DB_RPTS();
     $dbDue = new DB_RPTS();
     // gather TD's
     $sql = "SELECT Due.dueID as dueID, " . "Due.tdID as tdID, " . "Due.dueType as dueType, " . "Due.dueDate as dueDate, " . "Due.basicTax as basicTax, " . "Due.basicTaxRate as basicTaxRate, " . "Due.sefTax as sefTax, " . "Due.sefTaxRate as sefTaxRate, " . "Due.idleTax as idleTax, " . "Due.idleTaxRate as idleTaxRate, " . "TD.afsID as afsID, " . "TD.propertyType as propertyType, " . "TD.taxDeclarationNumber as taxDeclarationNumber, " . "AFS.odID as odID, " . "AFS.arpNumber as arpNumber, " . "AFS.propertyIndexNumber as propertyIndexNumber, " . "AFS.taxability as taxability, " . "AFS.effectivity as effectivity, " . "AFS.totalMarketValue as totalMarketValue, " . "AFS.totalAssessedValue as totalAssessedValue " . "FROM Due, TD, AFS " . "WHERE Due.tdID = TD.tdID " . "AND TD.afsID = AFS.afsID " . "AND AFS.archive != 'true' " . "AND TD.archive != 'true' " . "AND Due.dueType = 'Annual' " . "AND TD.propertyType LIKE '" . $this->formArray["classification"] . "' " . "GROUP BY Due.tdID, YEAR(Due.dueDate) " . "ORDER BY Due.dueDate DESC";
     $dbTD->query($sql);
     if ($dbTD->nf() > 0) {
         // gather BacktaxTD's
         while ($dbTD->next_record()) {
             $sqlBacktaxTD = "SELECT backtaxTDID, " . "tdID, " . "tdNumber, " . "startYear, " . "endYear, " . "startQuarter, " . "assessedValue, " . "basicRate, " . "sefRate, " . "basicTax, " . "sefTax, " . "idleTax, " . "penalties, " . "paid, " . "balance, " . "total " . "FROM BacktaxTD " . "WHERE tdID='" . $dbTD->f("tdID") . "' " . "ORDER BY startYear ASC ";
             $dbBacktaxTD->query($sqlBacktaxTD);
             if ($dbBacktaxTD->nf() > 0) {
                 while ($dbBacktaxTD->next_record()) {
                     $backtaxTDRecordArray[] = $dbBacktaxTD->Record;
                 }
             }
             $tdRecordArray[] = array("td" => $dbTD->Record, "backtaxTD" => $backtaxTDRecordArray);
             unset($backtaxTDRecordArray);
         }
     }
     if (is_array($tdRecordArray)) {
         foreach ($tdRecordArray as $recordArray) {
             // gather backtaxTD details
             if (is_array($recordArray["backtaxTD"])) {
                 foreach ($recordArray["backtaxTD"] as $backtaxTDRecord) {
                     $paidBasic = 0;
                     $paidSEF = 0;
                     $paidPenalty = 0;
                     $totalTaxCollected = 0;
                     $basic = 0;
                     $sef = 0;
                     $penalty = 0;
                     $totalCollectible = 0;
                     // get totalTaxCollected
                     $sqlPaymentBacktaxTD = "SELECT paymentID, " . "dueType, " . "backtaxTDID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE backtaxTDID='" . $backtaxTDRecord["backtaxTDID"] . "' " . "AND status!='cancelled'";
                     $dbPaymentBacktaxTD->query($sqlPaymentBacktaxTD);
                     if ($dbPaymentBacktaxTD->nf() > 0) {
                         while ($dbPaymentBacktaxTD->next_record()) {
                             $sqlCollectionBacktaxTD = "SELECT * " . "FROM Collection " . "WHERE paymentID='" . $dbPaymentBacktaxTD->f("paymentID") . "' " . "AND status!='cancelled' ";
                             $dbCollectionBacktaxTD->query($sqlCollectionBacktaxTD);
                             if ($dbCollectionBacktaxTD->nf() > 0) {
                                 while ($dbCollectionBacktaxTD->next_record()) {
                                     switch ($dbCollectionBacktaxTD->f("taxType")) {
                                         case "basic":
                                             if ($dbCollectionBacktaxTD->f("amnesty") != "true") {
                                                 $paidBasic += $dbCollectionBacktaxTD->f("amountPaid") - $dbCollectionBacktaxTD->f("penalty");
                                                 $paidPenalty += $dbCollectionBacktaxTD->f("penalty");
                                                 $totalTaxCollected += $dbCollectionBacktaxTD->f("amountPaid");
                                             } else {
                                                 $paidBasic += $dbCollectionBacktaxTD->f("amountPaid");
                                                 $totalTaxCollected += $paidBasic;
                                             }
                                             break;
                                         case "sef":
                                             if ($dbCollectionBacktaxTD->f("amnesty") != "true") {
                                                 $paidSEF += $dbCollectionBacktaxTD->f("amountPaid") - $dbCollectionBacktaxTD->f("penalty");
                                                 $paidPenalty += $dbCollectionBacktaxTD->f("penalty");
                                                 $totalTaxCollected += $dbCollectionBacktaxTD->f("amountPaid");
                                             } else {
                                                 $paidSEF += $dbCollectionBacktaxTD->f("amountPaid");
                                                 $totalTaxCollected += $paidSEF;
                                             }
                                             break;
                                     }
                                 }
                             }
                         }
                     }
                     // get totalCollectible
                     $basic = $backtaxTDRecord["basicTax"];
                     $sef = $backtaxTDRecord["sefTax"];
                     $backtaxTD = new BacktaxTD();
                     $backtaxTD->selectRecord("", $backtaxTDRecord["backtaxTDID"], "");
                     $backtaxTD->calculatePenalty(date("Y-m-d"));
                     $penalty = $backtaxTD->getPenalties();
                     $totalCollectible = $basic + $sef + $penalty;
                     $lineRecordArray[] = array("propertyIndexNumber" => "TD#:" . $backtaxTDRecord["tdNumber"] . " (" . $backtaxTDRecord["startYear"] . ")", "tdNumber" => $backtaxTDRecord["tdNumber"], "paidBasic" => $paidBasic, "paidSEF" => $paidSEF, "paidPenalty" => $paidPenalty, "totalTaxCollected" => $totalTaxCollected, "basic" => $basic, "sef" => $sef, "penalty" => $penalty, "totalCollectible" => $totalCollectible);
                 }
             }
             $paidBasic = 0;
             $paidSEF = 0;
             $paidPenalty = 0;
             $totalTaxCollected = 0;
             $basic = 0;
             $sef = 0;
             $penalty = 0;
             $totalCollectible = 0;
             // gather TD details
             if (is_array($recordArray["td"])) {
                 $tdRecord = $recordArray["td"];
                 // get totalTaxCollected
                 $sqlPaymentTD = "SELECT paymentID, " . "dueType, " . "backtaxTDID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE tdID='" . $tdRecord["tdID"] . "' " . "AND status!='cancelled'";
                 $dbPaymentTD->query($sqlPaymentTD);
                 if ($dbPaymentTD->nf() > 0) {
                     while ($dbPaymentTD->next_record()) {
                         $sqlCollectionTD = "SELECT * " . "FROM Collection " . "WHERE paymentID='" . $dbPaymentTD->f("paymentID") . "' " . "AND status!='cancelled' ";
                         $dbCollectionTD->query($sqlCollectionTD);
                         if ($dbCollectionTD->nf() > 0) {
                             while ($dbCollectionTD->next_record()) {
                                 switch ($dbCollectionTD->f("taxType")) {
                                     case "basic":
                                         if ($dbCollectionTD->f("amnesty") != "true") {
                                             $paidBasic += $dbCollectionTD->f("amountPaid") - $dbCollectionTD->f("penalty");
                                             $paidPenalty += $dbCollectionTD->f("penalty");
                                             $totalTaxCollected += $dbCollectionTD->f("amountPaid");
                                         } else {
                                             $paidBasic += $dbCollectionTD->f("amountPaid");
                                             $totalTaxCollected += $paidBasic;
                                         }
                                         break;
                                     case "sef":
                                         if ($dbCollectionTD->f("amnesty") != "true") {
                                             $paidSEF += $dbCollectionTD->f("amountPaid") - $dbCollectionTD->f("penalty");
                                             $paidPenalty += $dbCollectionTD->f("penalty");
                                             $totalTaxCollected += $dbCollectionTD->f("amountPaid");
                                         } else {
                                             $paidSEF += $dbCollectionTD->f("amountPaid");
                                             $totalTaxCollected += $paidSEF;
                                         }
                                         break;
                                 }
                             }
                         }
                     }
                 }
                 // get totalCollectible
                 $due = new Due();
                 if ($due->selectRecord($tdRecord["dueID"])) {
                     $basic = $due->getBasicTax();
                     $sef = $due->getSefTax();
                     $due = $this->computePenalty(date("Y-m-d"), $due);
                     $penalty = $due->getPenalty();
                     $totalCollectible = $basic + $sef + $penalty;
                 }
                 $lineRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "tdNumber" => $tdRecord["taxDeclarationNumber"], "paidBasic" => $paidBasic, "paidSEF" => $paidSEF, "paidPenalty" => $paidPenalty, "totalTaxCollected" => $totalTaxCollected, "basic" => $basic, "sef" => $sef, "penalty" => $penalty, "totalCollectible" => $totalCollectible);
             }
         }
     }
     // print page
     if (is_array($lineRecordArray)) {
         $ypos = 400;
         $decrementYposBy = 12;
         $linesPerPage = 20;
         $count = count($lineRecordArray);
         $numOfPages = ceil($count / $linesPerPage);
         $pageCtr = 1;
         $lineCtr = 1;
         $recordCtr = 1;
         $this->tpl->set_var("classification", $this->formArray["classification"]);
         $this->tpl->set_var("numOfPages", $numOfPages);
         $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
         $this->tpl->set_block("Page", "Row", "RowBlock");
         $this->tpl->set_block("Page", "Totals", "TotalsBlock");
         $totalsArray = array("totalPaidBasic" => 0, "totalPaidSEF" => 0, "totalPaidPenalty" => 0, "totalTotalTaxCollected" => 0, "totalBasic" => 0, "totalSef" => 0, "totalPenalty" => 0, "totalTotalCollectible" => 0);
         foreach ($lineRecordArray as $recordArray) {
             $this->tpl->set_var("ypos", $ypos);
             $this->tpl->set_var("recordCtr", $recordCtr);
             // tally totals
             $totalsArray["totalPaidBasic"] += un_number_format($recordArray["paidBasic"]);
             $totalsArray["totalPaidSEF"] += un_number_format($recordArray["paidSEF"]);
             $totalsArray["totalPaidPenalty"] += un_number_format($recordArray["paidPenalty"]);
             $totalsArray["totalTotalTaxCollected"] += un_number_format($recordArray["totalTaxCollected"]);
             $totalsArray["totalBasic"] += un_number_format($recordArray["basic"]);
             $totalsArray["totalSef"] += un_number_format($recordArray["sef"]);
             $totalsArray["totalPenalty"] += un_number_format($recordArray["penalty"]);
             $totalsArray["totalTotalCollectible"] += un_number_format($recordArray["totalCollectible"]);
             // write values
             foreach ($recordArray as $key => $value) {
                 switch ($key) {
                     case "paidBasic":
                     case "paidSEF":
                     case "paidPenalty":
                     case "totalTaxCollected":
                     case "basic":
                     case "sef":
                     case "penalty":
                     case "totalCollectible":
                         $value = formatCurrency($value);
                         break;
                 }
                 $this->tpl->set_var($key, $value);
             }
             $this->tpl->parse("RowBlock", "Row", true);
             if ($recordCtr == count($lineRecordArray) || $lineCtr == $linesPerPage) {
                 if ($pageCtr == $numOfPages) {
                     foreach ($totalsArray as $key => $value) {
                         $value = formatCurrency($value);
                         $this->tpl->set_var($key, $value);
                     }
                     $this->tpl->parse("TotalsBlock", "Totals", true);
                 } else {
                     $this->tpl->set_var("TotalsBlock", "");
                 }
                 $this->tpl->set_var("page", $pageCtr);
                 $this->tpl->parse("PageBlock", "Page", true);
                 $this->tpl->set_var("RowBlock", "");
                 $this->tpl->set_var("TotalsBlock", "");
                 $ypos = 400;
                 $lineCtr = 0;
                 $pageCtr++;
             }
             $lineCtr++;
             $recordCtr++;
             $ypos = $ypos - $decrementYposBy;
         }
         $this->tpl->parse("templatePage", "rptsTemplate");
         $this->tpl->finish("templatePage");
         $testpdf = new PDFWriter();
         $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
         if (isset($this->formArray["print"])) {
             $testpdf->writePDF($name);
             //,$this->formArray["print"]);
         } else {
             $testpdf->writePDF($name);
         }
     } else {
         exit("no records to display");
     }
 }
コード例 #7
0
 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;
 }
コード例 #8
0
ファイル: _search.php プロジェクト: MGGROUP/SAMDEPURACION
	<div class="row">
		<?php 
echo $form->label($model, 'iddue_documento');
?>
		<?php 
echo $form->textField($model, 'iddue_documento', array('maxlength' => 10));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'due_id');
?>
		<?php 
echo $form->dropDownList($model, 'due_id', GxHtml::listDataEx(Due::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All')));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'longitud');
?>
		<?php 
echo $form->textField($model, 'longitud', array('maxlength' => 50));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'latitud');
コード例 #9
0
ファイル: collectionReport5.php プロジェクト: armic/erpts
 function Main()
 {
     $eRPTSSettings = new eRPTSSettings();
     if ($eRPTSSettings->selectRecord(1)) {
         $this->tpl->set_var("lguType", strtoupper($eRPTSSettings->getLguType()));
         $this->tpl->set_var("lguName", strtoupper($eRPTSSettings->getLguName()));
     }
     $dbTD = new DB_RPTS();
     $dbBacktaxTD = new DB_RPTS();
     $dbPaymentBacktaxTD = new DB_RPTS();
     $dbPaymentTD = new DB_RPTS();
     $dbDues = new DB_RPTS();
     // gather TD's
     $sql = "SELECT Due.dueID as dueID, " . "Due.tdID as tdID, " . "Due.dueType as dueType, " . "Due.dueDate as dueDate, " . "Due.basicTax as basicTax, " . "Due.basicTaxRate as basicTaxRate, " . "Due.sefTax as sefTax, " . "Due.sefTaxRate as sefTaxRate, " . "Due.idleTax as idleTax, " . "Due.idleTaxRate as idleTaxRate, " . "TD.afsID as afsID, " . "TD.propertyType as propertyType, " . "TD.taxDeclarationNumber as taxDeclarationNumber, " . "AFS.odID as odID, " . "AFS.arpNumber as arpNumber, " . "AFS.propertyIndexNumber as propertyIndexNumber, " . "AFS.taxability as taxability, " . "AFS.effectivity as effectivity, " . "AFS.totalMarketValue as totalMarketValue, " . "AFS.totalAssessedValue as totalAssessedValue " . "FROM Due, TD, AFS " . "WHERE Due.tdID = TD.tdID " . "AND TD.afsID = AFS.afsID " . "AND AFS.archive != 'true' " . "AND TD.archive != 'true' " . "AND Due.dueType = 'Annual' " . "AND YEAR(Due.dueDate)  <= YEAR(NOW()) " . "AND TD.propertyType LIKE '" . $this->formArray["classification"] . "' " . "GROUP BY Due.tdID, YEAR(Due.dueDate) " . "ORDER BY Due.dueDate DESC";
     $dbTD->query($sql);
     if ($dbTD->nf() > 0) {
         // gather BacktaxTD's
         while ($dbTD->next_record()) {
             $sqlBacktaxTD = "SELECT backtaxTDID, " . "tdID, " . "tdNumber, " . "startYear, " . "endYear, " . "startQuarter, " . "assessedValue, " . "basicRate, " . "sefRate, " . "basicTax, " . "sefTax, " . "idleTax, " . "penalties, " . "paid, " . "balance, " . "total " . "FROM BacktaxTD " . "WHERE tdID='" . $dbTD->f("tdID") . "' " . "ORDER BY startYear ASC ";
             $dbBacktaxTD->query($sqlBacktaxTD);
             if ($dbBacktaxTD->nf() > 0) {
                 while ($dbBacktaxTD->next_record()) {
                     $backtaxTDRecordArray[] = $dbBacktaxTD->Record;
                 }
             }
             $tdRecordArray[] = array("td" => $dbTD->Record, "backtaxTD" => $backtaxTDRecordArray);
             unset($backtaxTDRecordArray);
         }
     }
     if (is_array($tdRecordArray)) {
         // verify whether each TD Record or BacktaxTD Record is delinquent by comparing it to Payment
         // if it is not in Payment it is considered delinquent
         // if amountPaid is insufficient to amountDue, it is considered delinquent
         foreach ($tdRecordArray as $recordArray) {
             $basicAmountDelinquent = 0;
             $sefAmountDelinquent = 0;
             $penalty = 0;
             $totalDelinquent = 0;
             // find delinquent backtaxTD's
             if (is_array($recordArray["backtaxTD"])) {
                 foreach ($recordArray["backtaxTD"] as $backtaxTDRecord) {
                     $basicAmountDelinquent = 0;
                     $sefAmountDelinquent = 0;
                     $penalty = 0;
                     $totalDelinquent = 0;
                     $sqlPaymentBacktaxTD = "SELECT paymentID, " . "dueType, " . "backtaxTDID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE backtaxTDID='" . $backtaxTDRecord["backtaxTDID"] . "' " . "AND status!='cancelled'";
                     $dbPaymentBacktaxTD->query($sqlPaymentBacktaxTD);
                     if ($dbPaymentBacktaxTD->nf() > 0) {
                         if ($dbPaymentBacktaxTD->next_record()) {
                             // if amountPaid is less than balanceDue, it is delinquent
                             if ($dbPaymentBacktaxTD->f("amountPaid") < $dbPaymentBacktaxTD->f("balanceDue")) {
                                 $paidBasic = $backtaxTDRecord["basicRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $dbPaymentBacktaxTD->f("amountPaid");
                                 $paidSef = $backtaxTDRecord["sefRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $dbPaymentBacktaxTD->f("amountPaid");
                                 $basicAmountDelinquent = $backtaxTDRecord["basicTax"] - $paidBasic;
                                 $sefAmountDelinquent = $backtaxTDRecord["sefTax"] - $paidSef;
                                 $backtaxTD = new BacktaxTD();
                                 $backtaxTD->selectRecord("", $backtaxTDRecord["backtaxTDID"], "");
                                 $backtaxTD->calculatePenalty(date("Y-m-d"));
                                 $penalty = $backtaxTD->getPenalties();
                                 $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty;
                                 $delinquentRecordArray[] = array("propertyIndexNumber" => "", "taxDeclarationNumber" => $backtaxTDRecord["tdNumber"], "yearDelinquent" => $backtaxTDRecord["startYear"], "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent);
                             }
                         }
                     } else {
                         $paidBasic = $backtaxTDRecord["basicRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $backtaxTDRecord["paid"];
                         $paidSef = $backtaxTDRecord["sefRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $backtaxTDRecord["paid"];
                         $basicAmountDelinquent = $backtaxTDRecord["basicTax"] - $paidBasic;
                         $sefAmountDelinquent = $backtaxTDRecord["sefTax"] - $paidSef;
                         $backtaxTD = new BacktaxTD();
                         $backtaxTD->selectRecord("", $backtaxTDRecord["backtaxTDID"], "");
                         $backtaxTD->calculatePenalty(date("Y-m-d"));
                         $penalty = $backtaxTD->getPenalties();
                         $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty;
                         $delinquentRecordArray[] = array("propertyIndexNumber" => "", "taxDeclarationNumber" => $backtaxTDRecord["tdNumber"], "yearDelinquent" => $backtaxTDRecord["startYear"], "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent);
                     }
                 }
             }
             // find delinquent TD's
             if (is_array($recordArray["td"])) {
                 $tdRecord = $recordArray["td"];
                 $basicAmountDelinquent = 0;
                 $sefAmountDelinquent = 0;
                 $penalty = 0;
                 $totalDelinquent = 0;
                 $sqlPaymentTD = "SELECT paymentID, " . "dueID, " . "dueType, " . "tdID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE tdID='" . $tdRecord["tdID"] . "' " . "AND status!='cancelled'";
                 $dbPaymentTD->query($sqlPaymentTD);
                 if ($dbPaymentTD->nf() > 0) {
                     while ($dbPaymentTD->next_record()) {
                         if ($dbPaymentTD->f("dueType") == "Annual") {
                             if ($dbPaymentTD->f("amountPaid") < $dbPaymentTD->f("balanceDue")) {
                                 $paidBasic = $tdRecord["basicRate"] / ($tdRecord["basicRate"] + $tdRecord["sefRate"]) * $dbPaymentTD->f("amountPaid");
                                 $paidSef = $tdRecord["sefRate"] / ($tdRecord["basicRate"] + $tdRecord["sefRate"]) * $dbPaymentTD->f("amountPaid");
                                 $basicAmountDelinquent = $tdRecord["basicTax"] - $paidBasic;
                                 $sefAmountDelinquent = $tdRecord["sefTax"] - $paidSef;
                                 $due = new Due();
                                 $due->selectRecord($tdRecord["dueID"]);
                                 $due = $this->computePenalty(date("Y-m-d"), $due);
                                 $penalty = $due->getPenalty();
                                 $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty;
                                 $delinquentRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "taxDeclarationNumber" => $tdRecord["taxDeclarationNumber"], "yearDelinquent" => date("Y", strtotime($tdRecord["dueDate"])), "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent);
                             }
                             break;
                         } else {
                             $tmpPaidQuarterDues[] = $dbPaymentTD->f("dueID");
                         }
                     }
                     if (is_array($tmpPaidQuarterDues)) {
                         // not all quarters have been paid if less than four
                         if (count($tmpPaidQuarterDues) < 4) {
                             foreach ($tmpPaidQuarterDues as $dueID) {
                                 $sqlDueCondition .= " AND Due.dueID!='" . $dueID . "' ";
                             }
                             // grab unpaid quarterly dues that have not been paid before quarterly dueDate
                             $sqlDues = "SELECT Due.dueID as dueID, " . "Due.dueType as dueType, " . "Due.tdID as tdID " . "FROM Due, TD, AFS " . "WHERE TD.afsID = AFS.afsID " . "AND AFS.archive != 'true' " . "AND TD.archive != 'true' " . "AND Due.dueType != 'Annual' " . "AND Due.tdID = '" . $tdRecord["tdID"] . "'" . "AND TD.propertyType LIKE '" . $this->formArray["classification"] . "' " . "AND YEAR(Due.dueDate)  <= " . date("Y", strtotime($tdRecord["dueDate"])) . " " . "AND Due.dueDate <= '" . date("Y-m-d") . "' " . $sqlDueCondition . " " . "GROUP BY Due.tdID, Due.dueDate " . "ORDER BY Due.dueDate DESC";
                             $dbDues->query($sqlDues);
                             while ($dbDues->next_record()) {
                                 $due = new Due();
                                 $due->selectRecord($dbDues->f("dueID"));
                                 $basicAmountDelinquent += $due->getBasicTax();
                                 $sefAmountDelinquent += $due->getSefTax();
                                 $due = $this->computePenalty(date("Y-m-d"), $due);
                                 $penalty += $due->getPenalty();
                             }
                             $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty;
                             $delinquentRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "taxDeclarationNumber" => $tdRecord["taxDeclarationNumber"], "yearDelinquent" => date("Y", strtotime($tdRecord["dueDate"])), "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent);
                         }
                         unset($sqlDueCondition);
                         unset($tmpPaidQuarterDues);
                     }
                 } else {
                     $basicAmountDelinquent = $tdRecord["basicTax"];
                     $sefAmountDelinquent = $tdRecord["sefTax"];
                     $due = new Due();
                     $due->selectRecord($tdRecord["dueID"]);
                     $due = $this->computePenalty(date("Y-m-d"), $due);
                     $penalty = $due->getPenalty();
                     $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty;
                     $delinquentRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "taxDeclarationNumber" => $tdRecord["taxDeclarationNumber"], "yearDelinquent" => date("Y", strtotime($tdRecord["dueDate"])), "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent);
                 }
             }
         }
     }
     // print page
     if (is_array($delinquentRecordArray)) {
         $ypos = 615;
         $decrementYposBy = 12;
         $linesPerPage = 42;
         $count = count($delinquentRecordArray);
         $numOfPages = ceil($count / $linesPerPage);
         $pageCtr = 1;
         $lineCtr = 1;
         $recordCtr = 1;
         $this->tpl->set_var("classification", $this->formArray["classification"]);
         $this->tpl->set_var("numOfPages", $numOfPages);
         $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
         $this->tpl->set_block("Page", "Row", "RowBlock");
         $this->tpl->set_block("Page", "Totals", "TotalsBlock");
         $totalsArray = array("totalBasicAmountDelinquent" => 0, "totalSefAmountDelinquent" => 0, "totalPenalty" => 0, "totalTotalDelinquent" => 0);
         foreach ($delinquentRecordArray as $recordArray) {
             $this->tpl->set_var("ypos", $ypos);
             $this->tpl->set_var("recordCtr", $recordCtr);
             // write values
             $totalsArray["totalBasicAmountDelinquent"] += un_number_format($recordArray["basicAmountDelinquent"]);
             $totalsArray["totalSefAmountDelinquent"] += un_number_format($recordArray["sefAmountDelinquent"]);
             $totalsArray["totalPenalty"] += un_number_format($recordArray["penalty"]);
             $totalsArray["totalTotalDelinquent"] += un_number_format($recordArray["totalDelinquent"]);
             foreach ($recordArray as $key => $value) {
                 switch ($key) {
                     case "basicAmountDelinquent":
                     case "sefAmountDelinquent":
                     case "penalty":
                     case "totalDelinquent":
                         $value = formatCurrency($value);
                         break;
                 }
                 $this->tpl->set_var($key, $value);
             }
             $this->tpl->parse("RowBlock", "Row", true);
             if ($recordCtr == count($delinquentRecordArray) || $lineCtr == $linesPerPage) {
                 if ($pageCtr == $numOfPages) {
                     foreach ($totalsArray as $key => $value) {
                         $value = formatCurrency($value);
                         $this->tpl->set_var($key, $value);
                     }
                     $this->tpl->parse("TotalsBlock", "Totals", true);
                 } else {
                     $this->tpl->set_var("TotalsBlock", "");
                 }
                 $this->tpl->set_var("page", $pageCtr);
                 $this->tpl->parse("PageBlock", "Page", true);
                 $this->tpl->set_var("RowBlock", "");
                 $this->tpl->set_var("TotalsBlock", "");
                 $ypos = 615;
                 $lineCtr = 0;
                 $pageCtr++;
             }
             $lineCtr++;
             $recordCtr++;
             $ypos = $ypos - $decrementYposBy;
         }
         $this->tpl->parse("templatePage", "rptsTemplate");
         $this->tpl->finish("templatePage");
         $testpdf = new PDFWriter();
         $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
         if (isset($this->formArray["print"])) {
             $testpdf->writePDF($name);
             //,$this->formArray["print"]);
         } else {
             $testpdf->writePDF($name);
         }
     } else {
         exit("no delinquent collectible records to display");
     }
 }
コード例 #10
0
ファイル: admin.php プロジェクト: MGGROUP/SAMDEPURACION
<?php

$this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage'));
$this->menu = array(array('label' => Yii::t('app', 'Listar') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Crear') . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\r\n\$('.search-button').click(function(){\r\n\t\$('.search-form').toggle();\r\n\treturn false;\r\n});\r\n\$('.search-form form').submit(function(){\r\n\t\$.fn.yiiGridView.update('due-documento-grid', {\r\n\t\tdata: \$(this).serialize()\r\n\t});\r\n\treturn false;\r\n});\r\n");
?>

<h1><?php 
echo Yii::t('app', 'Administrar') . ' ' . GxHtml::encode($model->label(2));
?>
</h1>

<p>
Si lo desea, puede entrar en un operador de comparación (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; o =) al principio de cada uno de los valores de la búsqueda para especificar la forma en la comparación se debe hacer.
</p>

<?php 
echo GxHtml::link(Yii::t('app', 'Búsqueda Avanzada'), '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'due-documento-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('iddue_documento', array('name' => 'due_id', 'value' => 'GxHtml::valueEx($data->due)', 'filter' => GxHtml::listDataEx(Due::model()->findAllAttributes(null, true))), 'longitud', 'latitud', 'altitud', 'existe', array('class' => 'CButtonColumn'))));
 function getCollectionTargetsForCurrentQuarter($year)
 {
     $conditionQuarterEndingDate = date("Y-m-d", strtotime($this->formArray["quarterEndingDate"] . " " . $year));
     $conditionQuarterBeginningDate = date("Y-m-d", strtotime($this->formArray["quarterBeginningDate"] . " " . $year));
     $sql = "SELECT * FROM " . DUE_TABLE . " WHERE dueDate >= '" . $conditionQuarterBeginningDate . "' AND dueDate <= '" . $conditionQuarterEndingDate . "';";
     $db = new DB_RPTS();
     $db->query($sql);
     $dueRecords = new DueRecords();
     $dueRecords = new DueRecords();
     while ($db->next_record()) {
         $due = new Due();
         $due->selectRecord($db->f("dueID"));
         $dueRecords->arrayList[] = $due;
     }
     if (is_array($dueRecords->arrayList)) {
         foreach ($dueRecords->arrayList as $due) {
             if ($due->getDueType() != "Q1") {
                 $this->formArray["basic"] += $due->getBasicTax();
                 $this->formArray["sef"] += $due->getSefTax();
                 $this->formArray["idle"] += $due->getIdleTax();
             }
         }
     }
 }
コード例 #12
0
ファイル: DueRecords.php プロジェクト: armic/erpts
 function selectRecords($tdID = "", $taxableYear = "", $condition = "")
 {
     if ($tdID != "") {
         $condition = "WHERE tdID='" . $tdID . "' AND dueDate LIKE '" . $taxableYear . "%'";
     }
     $sql = sprintf("select * from %s %s;", DUE_TABLE, $condition);
     $this->setDB();
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $due = new Due();
         $due->selectRecord($this->db->f("dueID"));
         $this->arrayList[] = $due;
         unset($due);
     }
     unset($this->db);
     if (count($this->arrayList) > 0) {
         $this->setDomDocument();
         return true;
     } else {
         return false;
     }
 }
コード例 #13
0
ファイル: PrintRPTOPDetailsPDF.php プロジェクト: armic/erpts
 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);
 }
コード例 #14
0
 function getDue($dueID)
 {
     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
     if (!($xmlStr = $DueDetails->getDue($dueID))) {
         // error xmlStr
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             // error domDoc
         } else {
             $due = new Due();
             $due->parseDomDocument($domDoc);
             return $due;
         }
     }
 }
コード例 #15
0
ファイル: DueDetails.php プロジェクト: armic/erpts
 function getDueIDFromTDID($tdID, $dueType, $year)
 {
     $due = new Due();
     $condition = "WHERE tdID='" . $tdID . "' AND dueDate LIKE '" . $year . "%' AND dueType='" . $dueType . "'";
     $due->selectRecordFromCondition($condition);
     $dueID = $due->getDueID();
     return $dueID;
 }
コード例 #16
0
ファイル: index.php プロジェクト: MGGROUP/SAMDEPURACION
<?php

$this->breadcrumbs = array(Due::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Crear') . ' ' . Due::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Administrar') . ' ' . Due::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(Due::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
コード例 #17
0
ファイル: CalculateRPTOPBatch.php プロジェクト: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "updateCalculation":
             if (is_array($this->formArray["rptopID"])) {
                 $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                 $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                 $DueEncode = new SoapObject(NCCBIZ . "DueEncode.php", "urn:Object");
                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                 $dueIDArray = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                 $treasurySettings = new TreasurySettings();
                 $treasurySettings->selectRecord();
                 $this->formArray["masterBasicTaxRate"] = $treasurySettings->getPctRPTax();
                 $this->formArray["masterSEFTaxRate"] = $treasurySettings->getPctSEF();
                 $this->formArray["masterIdleTaxRate"] = $treasurySettings->getPctIdle();
                 $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                 $this->formArray["annualDueDate"] = $treasurySettings->getAnnualDueDate();
                 foreach ($this->formArray["rptopID"] as $rptopID) {
                     if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
                         // error xmlStr
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             // error domDoc
                         } else {
                             $rptop = new RPTOP();
                             $rptop->parseDomDocument($domDoc);
                             $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                             $tdArray = $rptop->getTDArray();
                             if (is_array($tdArray)) {
                                 foreach ($tdArray as $td) {
                                     $this->formArray["assessedValue"] = "";
                                     $this->formArray["taxability"] = "";
                                     $this->formArray["idle"] = "";
                                     $this->formArray["tdID"] = $td->getTdID();
                                     $this->formArray["dueID"] = "";
                                     $this->formArray["propertyType"] = $td->getPropertyType();
                                     if (!($afsXmlStr = $AFSDetails->getAFS($td->getAfsID()))) {
                                         // error afsXmlStr
                                     } else {
                                         if (!($afsDomDoc = domxml_open_mem($afsXmlStr))) {
                                             // error afsDomDoc
                                         } else {
                                             $afs = new AFS();
                                             $afs->parseDomDocument($afsDomDoc);
                                             $this->formArray["assessedValue"] = $afs->getTotalAssessedValue();
                                             $this->formArray["taxability"] = $afs->getTaxability();
                                             $this->formArray["effectivity"] = $afs->getEffectivity();
                                             $this->formArray["dueDate"] = date("Y-n-d", strtotime($this->formArray["taxableYear"] . "-" . $this->formArray["annualDueDate"]));
                                             if ($this->formArray["propertyType"] == "Land") {
                                                 if (is_array($afs->getLandArray())) {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                     }
                                     if (!($dueXmlStr = $DueList->getDueList($td->getTdID(), $rptop->getTaxableYear()))) {
                                         $this->formArray["dueID"] = "";
                                         $dueIDArray["Annual"] = "";
                                     } else {
                                         if (!($dueDomDoc = domxml_open_mem($dueXmlStr))) {
                                             $this->formArray["dueID"] = "";
                                             $dueIDArray["Annual"] = "";
                                         } else {
                                             //print_r(htmlspecialchars($xmlStr));
                                             //exit;
                                             $dueRecords = new DueRecords();
                                             $dueRecords->parseDomDocument($dueDomDoc);
                                             foreach ($dueRecords->getArrayList() as $due) {
                                                 foreach ($due as $dueKey => $dueValue) {
                                                     switch ($dueKey) {
                                                         case "dueType":
                                                             $dueIDArray[$dueValue] = $due->getDueID();
                                                             break;
                                                     }
                                                 }
                                             }
                                             $this->formArray["dueID"] = $dueIDArray["Annual"];
                                         }
                                     }
                                     $this->formArray["basicTaxRate"] = $this->formArray["masterBasicTaxRate"];
                                     $this->formArray["sefTaxRate"] = $this->formArray["masterSEFTaxRate"];
                                     $this->formArray["idleTaxRate"] = $this->formArray["masterIdleTaxRate"];
                                     $this->formArray["basicTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["basicTaxRate"];
                                     $this->formArray["sefTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["sefTaxRate"];
                                     // if land->idle is "Yes", compute idleTax, otherwise set idleTax to zero
                                     if ($this->formArray["propertyType"] == "Land") {
                                         if ($this->formArray["idle"] == "Yes") {
                                             $this->formArray["idleTax"] = un_number_format($this->formArray["assessedValue"]) * $this->formArray["idleTaxRate"];
                                         } else {
                                             $this->formArray["idleTax"] = "0.00";
                                         }
                                     }
                                     // if afs->taxability is "Exempt", reset computations to zero.
                                     if ($this->formArray["taxability"] == "Exempt") {
                                         $this->formArray["basicTax"] = "0.00";
                                         $this->formArray["sefTax"] = "0.00";
                                         $this->formArray["idleTax"] = "0.00";
                                     }
                                     if ($dueIDArray["Annual"] != "") {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->updateDue($xmlStr))) {
                                                 // error update
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     } else {
                                         $dueArray = $this->setDues();
                                         foreach ($dueArray as $due) {
                                             $doc = $due->getDomDocument();
                                             $xmlStr = $doc->dump_mem(true);
                                             if (!($ret = $DueEncode->saveDue($xmlStr))) {
                                                 // error save
                                             }
                                             unset($doc);
                                             unset($xmlStr);
                                         }
                                     }
                                     $this->formArray["taxableYear"] = $rptop->getTaxableYear();
                                     $this->refreshTDHistory($td);
                                 }
                             }
                             unset($tdArray);
                         }
                     }
                 }
             }
             if ($this->formArray["searchKey"] != "") {
                 $this->formArray["formAction"] = "search";
             } else {
                 $this->formArray["formAction"] = "";
             }
             header("Location: CalculateRPTOPBatch.php" . $this->sess->url("") . "&page=" . $this->formArray["page"] . "&sortBy=" . $this->formArray["sortBy"] . "&sortOrder=" . $this->formArray["sortOrder"] . "&formAction=" . $this->formArray["formAction"] . "&searchKey=" . $this->formArray["searchKey"]);
             exit;
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOPBatch.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }