Example #1
0
 function getTDNumber($tdID, $backtaxTDID)
 {
     if ($tdID != "") {
         $td = new TD();
         $td->selectRecord($tdID);
         $tdNumber = $td->getTaxDeclarationNumber();
     } else {
         if ($backtaxTDID != "") {
             $backtaxTD = new BacktaxTD();
             $backtaxTD->selectRecord("", $backtaxTDID);
             $tdNumber = $backtaxTD->getTDNumber();
         }
     }
     return $tdNumber;
 }
Example #2
0
 function displayDetails($value)
 {
     foreach ($value as $lkey => $lvalue) {
         switch ($lkey) {
             case "propertyAdministrator":
                 if (is_a($lvalue, Person)) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue->getBirthday());
                     $this->tpl->set_var("personID", $lvalue->getPersonID());
                     $this->tpl->set_var("lastName", $lvalue->getLastName());
                     $this->tpl->set_var("firstName", $lvalue->getFirstName());
                     $this->tpl->set_var("middleName", $lvalue->getMiddleName());
                     $this->tpl->set_var("gender", $lvalue->getGender());
                     $this->tpl->set_var("birth_year", removePreZero($dateArr["year"]));
                     $this->tpl->set_var("birth_month", removePreZero($dateArr["month"]));
                     $this->tpl->set_var("birth_day", removePreZero($dateArr["day"]));
                     $this->tpl->set_var("maritalStatus", $lvalue->getMaritalStatus());
                     $this->tpl->set_var("tin", $lvalue->getTin());
                     $this->tpl->set_var("addressID", $lvalue->addressArray[0]->getAddressID());
                     $this->tpl->set_var("number", $lvalue->addressArray[0]->getNumber());
                     $this->tpl->set_var("street", $lvalue->addressArray[0]->getStreet());
                     $this->tpl->set_var("barangay", $lvalue->addressArray[0]->getBarangay());
                     $this->tpl->set_var("district", $lvalue->addressArray[0]->getDistrict());
                     $this->tpl->set_var("municipalityCity", $lvalue->addressArray[0]->getMunicipalityCity());
                     $this->tpl->set_var("province", $lvalue->addressArray[0]->getProvince());
                     $this->tpl->set_var("telephone", $lvalue->getTelephone());
                     $this->tpl->set_var("mobileNumber", $lvalue->getMobileNumber());
                     $this->tpl->set_var("email", $lvalue->getEmail());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "verifiedBy":
                 if (is_a($lvalue, Assessor)) {
                     $this->tpl->set_var("verifiedByID", $lvalue->getAssessorID());
                     $this->tpl->set_var("verifiedByName", $lvalue->getFullName());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "plottingsBy":
                 if (is_a($lvalue, Assessor)) {
                     $this->tpl->set_var("plottingsByID", $lvalue->getAssessorID());
                     $this->tpl->set_var("plottingsByName", $lvalue->getFullName());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "notedBy":
                 if (is_a($lvalue, Assessor)) {
                     $this->tpl->set_var("notedByID", $lvalue->getAssessorID());
                     $this->tpl->set_var("notedByName", $lvalue->getFullName());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "appraisedBy":
                 if (is_a($lvalue, Assessor)) {
                     $this->tpl->set_var("appraisedByID", $lvalue->getAssessorID());
                     $this->tpl->set_var("appraisedByName", $lvalue->getFullName());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "appraisedByDate":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("as_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("as_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("as_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "recommendingApproval":
                 if (is_a($lvalue, Assessor)) {
                     $this->tpl->set_var("recommendingApprovalID", $lvalue->getAssessorID());
                     $this->tpl->set_var("recommendingApprovalName", $lvalue->getFullName());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "recommendingApprovalDate":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("re_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("re_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("re_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
             case "approvedBy":
                 if (is_a($lvalue, Assessor)) {
                     $this->tpl->set_var("approvedByID", $lvalue->getAssessorID());
                     $this->tpl->set_var("approvedByName", $lvalue->getFullName());
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "approvedByDate":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("av_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("av_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("av_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->tpl->set_var($lkey, "");
                 }
                 break;
             case "dateConstructed":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("dc_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("dc_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("dc_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             case "dateOccupied":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("do_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("do_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("do_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             case "dateCompleted":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("dm_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("dm_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("dm_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             case "dateAcquired":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("da_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("da_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("da_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             case "dateOfInstallation":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("di_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("di_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("di_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             case "dateOfOperation":
                 if (true) {
                     list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $lvalue);
                     $this->tpl->set_var("do_yearValue", removePreZero($dateArr["year"]));
                     eval(MONTH_ARRAY);
                     //$monthArray
                     $this->tpl->set_var("do_month", $monthArray[removePreZero($dateArr["month"])]);
                     $this->tpl->set_var("do_dayValue", removePreZero($dateArr["day"]));
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             case "propertyID":
                 if (true) {
                     switch (get_class($value)) {
                         case "land":
                             $propertyType = "Land";
                             break;
                         case "improvementsbuildings":
                             $propertyType = "ImprovementsBuildings";
                             break;
                         case "plantstrees":
                             $propertyType = "PlantsTrees";
                             break;
                         case "machineries":
                             $propertyType = "Machineries";
                             break;
                     }
                     $this->tpl->set_var($lkey, $lvalue);
                     $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
                     if (!($xmlStr = $TDDetails->getTD("", $lvalue, $propertyType))) {
                         $this->tpl->set_var("tdNumber", "enter TD");
                         $this->tpl->set_var("tdID", "");
                         $this->tpl->set_var("propertyType", $propertyType);
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             $this->tpl->set_var("tdNumber", "enter TD");
                             $this->tpl->set_var("tdID", "");
                             $this->tpl->set_var("propertyType", $propertyType);
                         } else {
                             $td = new TD();
                             $td->parseDomDocument($domDoc);
                             $this->tpl->set_var("tdNumber", $td->getTaxDeclarationNumber());
                             foreach ($td as $tdkey => $tdvalue) {
                                 switch ($tdkey) {
                                     case "provincialAssessor":
                                         if (is_a($tdvalue, Assessor)) {
                                             $this->tpl->set_var("provincialAssessorID", $tdvalue->getAssessorID());
                                             $this->tpl->set_var("provincialAssessorName", $tdvalue->getFullName());
                                         } else {
                                             $this->tpl->set_var($tdkey, "");
                                         }
                                         break;
                                     case "provincialAssessorDate":
                                         if (true) {
                                             list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tdvalue);
                                             $this->tpl->set_var("pa_yearValue", removePreZero($dateArr["year"]));
                                             eval(MONTH_ARRAY);
                                             //$monthArray
                                             $this->tpl->set_var("pa_month", $monthArray[removePreZero($dateArr["month"])]);
                                             $this->tpl->set_var("pa_dayValue", removePreZero($dateArr["day"]));
                                         } else {
                                             $this->tpl->set_var($tdkey, "");
                                         }
                                         break;
                                     case "cityMunicipalAssessor":
                                         if (is_a($tdvalue, Assessor)) {
                                             $this->tpl->set_var("cityMunicipalAssessorID", $tdvalue->getAssessorID());
                                             $this->tpl->set_var("cityMunicipalAssessorName", $tdvalue->getFullName());
                                         } else {
                                             $this->tpl->set_var($tdkey, "");
                                         }
                                         break;
                                     case "cityMunicipalAssessorDate":
                                         if (true) {
                                             list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tdvalue);
                                             $this->tpl->set_var("cm_yearValue", removePreZero($dateArr["year"]));
                                             eval(MONTH_ARRAY);
                                             //$monthArray
                                             $this->tpl->set_var("cm_month", $monthArray[removePreZero($dateArr["month"])]);
                                             $this->tpl->set_var("cm_dayValue", removePreZero($dateArr["day"]));
                                         } else {
                                             $this->tpl->set_var($tdkey, "");
                                         }
                                         break;
                                     case "enteredInRPARForBy":
                                         if (is_a($tdvalue, Assessor)) {
                                             $this->tpl->set_var("enteredInRPARForByID", $tdvalue->getAssessorID());
                                             $this->tpl->set_var("enteredInRPARForByName", $tdvalue->getFullName());
                                         } else {
                                             $this->tpl->set_var($tdkey, "");
                                         }
                                         break;
                                     default:
                                         $this->tpl->set_var($tdkey, $tdvalue);
                                 }
                             }
                         }
                     }
                 } else {
                     $this->formArray[$key] = "";
                 }
                 break;
             default:
                 $this->tpl->set_var($lkey, $lvalue);
         }
     }
 }
Example #3
0
 function displayTDDetails($propertyType)
 {
     $afsID = $this->formArray["afsID"];
     $propertyID = $this->formArray["propertyID"];
     $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
     if (!($xmlStr = $TDDetails->getTD("", $afsID, $propertyID, $propertyType))) {
         $this->formArray["tdNumber"] = "";
         $this->formArray["tdID"] = "";
         $this->formArray["propertyType"] = $propertyType;
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->formArray["tdNumber"] = "";
             $this->formArray["tdID"] = "";
             $this->formArray["propertyType"] = $propertyType;
         } else {
             $td = new TD();
             $td->parseDomDocument($domDoc);
             $this->formArray["tdNumber"] = $td->getTaxDeclarationNumber();
             foreach ($td as $tdkey => $tdvalue) {
                 switch ($tdkey) {
                     case "provincialAssessor":
                         if (is_a($tdvalue, Assessor)) {
                             $this->formArray["provincialAssessorID"] = $tdvalue->getAssessorID();
                             $this->formArray["provincialAssessorName"] = $tdvalue->getFullName();
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "provincialAssessorDate":
                         if (true) {
                             list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tdvalue);
                             $this->formArray["pa_yearValue"] = removePreZero($dateArr["year"]);
                             eval(MONTH_ARRAY);
                             //$monthArray
                             $this->formArray["pa_month"] = $monthArray[removePreZero($dateArr["month"])];
                             $this->formArray["pa_dayValue"] = removePreZero($dateArr["day"]);
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "cityMunicipalAssessor":
                         if (is_a($tdvalue, Assessor)) {
                             $this->formArray["cityMunicipalAssessorID"] = $tdvalue->getAssessorID();
                             $this->formArray["cityMunicipalAssessorName"] = $tdvalue->getFullName();
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "cityMunicipalAssessorDate":
                         if (true) {
                             list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tdvalue);
                             $this->formArray["cm_yearValue"] = removePreZero($dateArr["year"]);
                             eval(MONTH_ARRAY);
                             //$monthArray
                             $this->formArray["cm_month"] = $monthArray[removePreZero($dateArr["month"])];
                             $this->formArray["cm_dayValue"] = removePreZero($dateArr["day"]);
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "enteredInRPARForBy":
                         if (is_a($tdvalue, Assessor)) {
                             $this->formArray["enteredInRPARForByID"] = $tdvalue->getAssessorID();
                             $this->formArray["enteredInRPARForByName"] = $tdvalue->getFullName();
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     default:
                         $this->formArray[$tdkey] = $tdvalue;
                 }
             }
         }
     }
 }
Example #4
0
 function displayTDDetails()
 {
     $afsID = $this->formArray["afsID"];
     $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
     if (!($xmlStr = $TDDetails->getTD("", $afsID, "", ""))) {
         // error xml
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             // error domDoc
         } else {
             $td = new TD();
             $td->parseDomDocument($domDoc);
             $this->formArray["taxDeclarationNumber"] = $td->getTaxDeclarationNumber();
             $this->formArray["memoranda"] = $td->getMemoranda();
             $this->formArray["cancelsTDNumber"] = $td->getCancelsTDNumber();
             //cityMunicipalAssessor
             if (is_numeric($td->getCityMunicipalAssessor())) {
                 $cityMunicipalAssessor = new Person();
                 $cityMunicipalAssessor->selectRecord($td->cityMunicipalAssessor);
                 $this->formArray["cityAssessor"] = $cityMunicipalAssessor->getFullName();
             } else {
                 $this->formArray["cityAssessor"] = $td->getCityMunicipalAssessor;
             }
             $this->formArray["propertyType"] = $td->getPropertyType();
         }
     }
 }
Example #5
0
 function displayRecords()
 {
     $this->selectRecords();
     $this->tpl->set_block("rptsTemplate", "OwnerPersonList", "OwnerPersonListBlock");
     $this->tpl->set_block("OwnerPersonList", "ODList", "ODListBlock");
     foreach ($this->arrayList as $person) {
         $this->tpl->set_var("personID", $person->getPersonID());
         $this->tpl->set_var("lastName", $person->getLastName());
         $this->tpl->set_var("firstName", $person->getFirstName());
         $this->tpl->set_var("middleName", $person->getMiddleName());
         $this->tpl->set_var("gender", $person->getGender());
         $this->tpl->set_var("birthday", $person->getBirthday());
         $this->tpl->set_var("maritalStatus", $person->getMaritalStatus());
         $this->tpl->set_var("tin", $person->getTin());
         $this->tpl->set_var("telephone", $person->getTelephone());
         $this->tpl->set_var("mobileNumber", $person->getMobileNumber());
         $this->tpl->set_var("email", $person->getEmail());
         if (is_array($person->addressArray)) {
             $address = $person->addressArray[0];
             $this->tpl->set_var("address", $address->getFullAddress());
         }
         // capture OD, AFS, and TD info
         $this->setDB();
         $sql = sprintf("SELECT DISTINCT(Owner.odID) as odID" . " FROM Owner,OwnerPerson " . " WHERE " . " Owner.ownerID = OwnerPerson.ownerID AND " . " OwnerPerson.personID = '%s' ", $person->getPersonID());
         $this->db->query($sql);
         while ($this->db->next_record()) {
             $od = new OD();
             if ($od->selectRecord($this->db->f("odID"))) {
                 $this->ODArray[] = $od;
                 $this->tpl->set_var("odID", $od->getOdID());
                 if (is_object($od->locationAddress)) {
                     $this->tpl->set_var("locationAddress", $od->locationAddress->getFullAddress());
                 } else {
                     $this->tpl->set_var("locationAddress", "");
                 }
                 $afs = new AFS();
                 if ($afs->selectRecord("", "", $od->getOdID(), "")) {
                     $this->tpl->set_var("afsID", $afs->getAfsID());
                     $this->tpl->set_var("propertyIndexNumber", $afs->getPropertyIndexNumber());
                     $this->tpl->set_var("arpNumber", $afs->getArpNumber());
                     if (is_array($afs->landArray)) {
                         $this->displayLandList($afs->landArray);
                     }
                     if (is_array($afs->plantsTreesArray)) {
                         $this->displayPlantsTreesList($afs->plantsTreesArray);
                     }
                     if (is_array($afs->improvementsBuildingsArray)) {
                         $this->displayImprovementsBuildingsList($afs->improvementsBuildingsArray);
                     }
                     if (is_array($afs->machineriesArray)) {
                         $this->displayMachineriesList($afs->machineriesArray);
                     }
                     $td = new TD();
                     if ($td->selectRecord("", $afs->getAfsID(), "", "", "")) {
                         $this->tpl->set_var("tdID", $td->getTdID());
                         $this->tpl->set_var("taxDeclarationNumber", $td->getTaxDeclarationNumber());
                         $this->tpl->set_var("propertyType", $td->getPropertyType());
                     }
                 }
                 unset($td);
                 unset($afs);
                 unset($od);
                 $this->tpl->parse("ODListBlock", "ODList", true);
             }
         }
         $this->tpl->parse("OwnerPersonListBlock", "OwnerPersonList", true);
         $this->tpl->set_var("ODListBlock", "");
         $this->clearPropertyElements();
         unset($this->ODArray);
         unset($this->AFSArray);
         unset($this->TDArray);
         unset($this->db);
     }
 }
Example #6
0
 function setDetails()
 {
     global $sess;
     # set the RPTOP to get the owner's object and information
     # get it from POST if possible, otherwise from GET
     $rptopID = isset($_POST['rptopID']) ? $_POST['rptopID'] : $_GET['rptopID'];
     //$rptopID = 14;
     $rptop = new RPTOP();
     $rptop->selectRecord($rptopID);
     $amountPaid = str_replace(",", "", $_POST['amountPaid']);
     $dateDue = $rptop->getTaxableYear();
     # must be a usable format
     $formValues['datePaid'] = date("F j, Y");
     $pORDate = $_POST['prevORDate'];
     if ($pORDate) {
         list($pmonth, $pday, $pyear) = explode("-", $pORDate);
         $formValues['porMonth'] = date("F", mktime(0, 0, 0, $pmonth + 1, 0, 0));
         $formValues['porYear'] = $pyear;
         $formValues['porDay'] = $pday;
     } else {
         $formValues['porMonth'] = "";
         $formValues['porYear'] = "";
         $formValues['porDay'] = "";
     }
     $formValues['orYear'] = substr($rptop->getTaxableYear(), 2);
     $formValues['orMonth'] = date("F");
     $formValues['orDay'] = date("j");
     $formValues['taxableYear'] = $rptop->getTaxableYear();
     $formValues['rptopNum'] = $rptop->getRptopNumber();
     $formValues['prevORNum'] = $_POST['prevORNum'];
     $formValues['orNum'] = $_POST['receiptNo'];
     $formValues['kindOfPayment'] = $_POST['kindOfPayment'];
     $formValues['checkNumber'] = $_POST['checkNum'];
     $formValues['checkDate'] = $_POST['checkDate'];
     # set the specific TD (although this is in the RPTOP), hard to search for it.
     # get the tdID from POST or GET to initialize the TD
     $tdID = isset($_POST['tdID']) ? $_POST['tdID'] : $_GET['tdID'];
     //$tdID = array(2,1);
     //$ownerID=5;
     $td = new TD();
     $ctr = 0;
     # $this->tpl->set_block('step3','PrintTDID','PrintTDIDs');
     //$this->tpl->set_block('step3','TDID','TDIDs');
     $this->tpl->set_block('receipt', 'Property', 'Properties');
     $this->tpl->set_block('Property', 'Owner', 'Owners');
     $n = 165;
     if (is_array($tdID)) {
         foreach ($tdID as $key => $id) {
             # set/pass tdIDs to form
             $this->tpl->set_var(tdID, $id);
             $this->tpl->parse('TDIDs', 'TDID', 'true');
             $td->selectRecord($id);
             $tdNum = $td->getTaxDeclarationNumber();
             $afs = new AFS();
             $formValues['tdNum'] = $tdNum;
             $afs->selectRecord($td->getAfsID());
             $od = new OD();
             $od->selectRecord($afs->getOdID());
             $addr = $od->getLocationAddress();
             # get municipality/province and city(same for all tds)
             //$lotAddress = new LocationAddress;
             //$lotAddress->selectRecordFromTdID($id);
             //$formValues['province'] = $lotAddress->getProvince();
             //$formValues['city'] = $lotAddress->getMunicipalityCity();
             $formValues['city'] = $addr->getMunicipalityCity();
             $formValues['province'] = $addr->getProvince();
             $formValues['municipalityCityID'] = $addr->getMunicipalityCityID();
             # get location/ block and lot number OR Barangay
             #$formValues['lotAddress'] = $lotAddress->getFullAddress();
             $formValues['lotAddress'] = $addr->getNumber . " " . $addr->getStreet();
             if ($formValues['lotAddress'] == "") {
                 $formValues['lotAddress'] = $addr->getBarangay();
             }
             $propertyType = $td->getPropertyType();
             $propertyID = $td->getPropertyID();
             $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
             $formAssessedValue = number_format($td->getAssessedValue(), 2);
             # separate assessed value of land and others(plantsTrees, improvementsBuildings, machineries)
             if ($propertyType == "Land") {
                 $formValues['assessedValueLand'] = $formAssessedValue;
                 $formValues['assessedValueOthers'] = "";
             } else {
                 $formValues['assessedValueLand'] = "";
                 $formValues['assessedValueOthers'] = $formAssessedValue;
             }
             $formValues['assessedValue'] = $formAssessedValue;
             $formValues['propertyType'] = $propertyType;
             # set the owner's List
             # we define the owner from the RPTOP
             $ownerSwitch = true;
             if ($ctr > 0) {
                 $ownerValues['ownerName'] = "";
                 $ownerValues['ownerAddress'] = "";
                 $this->tpl->set_var($ownerValues);
                 $this->tpl->parse(Owners, Owner, false);
             } else {
                 $owner = $rptop->getOwner();
                 $personArray = $owner->getPersonArray();
                 if (is_array($personArray)) {
                     foreach ($personArray as $person) {
                         $ownerValues['ownerKey'] = "personID";
                         $ownerValues['ownerScript'] = "PersonDetails.php";
                         $ownerValues['ownerID'] = $person->getPersonID();
                         $ownerValues['ownerName'] = $person->getLastName() . ", " . $person->getFirstName() . " " . $person->getMiddleName();
                         /*$addressArray = $person->getAddressArray();
                           $address = $addressArray[0];
                         		$ownerValues['ownerAddress'] = $address->getNumber()." ".
                             		                           $address->getStreet()."<br>".
                           		  		                           $address->getBarangay().", ".
                               		   		                       $address->getMunicipalityCity()."<br>".
                                   		   		                   $address->getProvince();*/
                         $this->tpl->set_var($ownerValues);
                         $this->tpl->parse('Owners', 'Owner', 'true');
                     }
                 }
                 $companyArray = $owner->getCompanyArray();
                 if (is_array($companyArray)) {
                     foreach ($companyArray as $company) {
                         $ownerValues['cownerKey'] = "companyID";
                         $ownerValues['cownerScript'] = "CompanyDetails.php";
                         $ownerValues['cownerID'] = $company->getCompanyID();
                         $ownerValues['cownerName'] = $company->getCompanyName();
                         /*$addressArray = $company->getAddressArray();
                           $address = $addressArray[0];
                          	$ownerValues['ownerAddress'] = $address->getNumber()." ".
                            	    	                           $address->getStreet()."<br>".
                          		    	    	                       $address->getBarangay().", ".
                              		    	    	                   $address->getMunicipalityCity()."<br> ".
                                  		    	    	               $address->getProvince();
                                  */
                         $this->tpl->set_var($ownerValues);
                         $this->tpl->parse('Owners', 'Owner', 'true');
                     }
                 }
                 if (is_array($personArray)) {
                     if (count($personArray) > 1) {
                         $receivedFrom = $personArray[0]->getFirstName() . " " . $personArray[0]->getMiddleName() . " " . $personArray[0]->getLastName() . " et al.";
                     } else {
                         $receivedFrom = $personArray[0]->getFirstName() . " " . $personArray[0]->getMiddleName() . " " . $personArray[0]->getLastName();
                     }
                 } else {
                     if (is_array($companyArray)) {
                         if (count($companyArray) > 1) {
                             $receivedFrom = $companyArray[0]->getCompanyName() . " et al.";
                         } else {
                             $receivedFrom = $companyArray[0]->getCompanyName();
                         }
                     }
                 }
                 $formValues['receivedFrom'] = $receivedFrom;
             }
             //end if ($ctr > 0)
             # tax dues are defined from TDNumber and taxableYear
             # compute for taxes; to create dues obj pass tdID and due date (where due date is beginning of taxable year) -- 14 Aug 2003
             //     $taxDue = new Dues($id,$dateDue,$assessedValue);
             $taxDue = new Dues();
             /*		    if(!$taxDue->create($id,$dateDue)){
                    		    $taxDue->setBasic($assessedValue);
                        		$taxDue->setSEF($assessedValue);
             				# check if land is idle, if yes, set assessed value
             				if($taxDue->getIdleStatus() == 1){
             					$taxDue->setIdle($assessedValue);
             					$idleStatus = 1;
             				}else{
             					$taxDue->setIdle(0);
             					$idleStatus = 0;
             				}
                     	}
             */
             $dateDue = $td->getTaxBeginsWithTheYear();
             $taxDue = new Dues($id, $dateDue);
             if (!$taxDue->create($id, $dateDue)) {
                 $taxDue->setBasic($assessedValue);
                 $taxDue->setSEF($assessedValue);
                 $taxDue->setIsDiscount(0);
                 # check if land is idle, if yes, set assessed value
                 # getIdleStatus -- temporary function
                 if ($taxDue->getIdleStatus() == 1) {
                     #echo("idle<br>");
                     $taxDue->setIdle($assessedValue);
                 }
             } else {
                 $taxDue->setIsDiscount($dateDue == date("Y") && date("n") <= $taxDue->discountPeriod && $taxDue->getPaymentMode() == "Annual");
             }
             $paymentPeriod = $_POST['paymentPeriod'];
             # set amnesty to object
             //$amnesty = $_POST['amnesty'];
             //$taxDue->setAmnesty($amnesty=="Yes");
             //	$taxDue->store();
             $totalTaxDue = $taxDue->getTotalDue($paymentPeriod);
             $totalAmount = $taxDue->getTotalDue($paymentPeriod);
             //    $paymentPeriod= "Annual";
             /*    	    if(isset($_POST['paymentPeriod'])){
                     	    $paymentPeriod = $_POST['paymentPeriod'];
             				
                     	}*/
             $formValues['paymentPeriod'] = $paymentPeriod;
             $this->tpl->set_var($formValues);
             ## Compute taxes and set the page values
             //$totalTaxDue = $taxDue->getTotalDue($paymentPeriod);
             $interest = $taxDue->getPctPenalty();
             if ($interest > 0 && $paymentPeriod != "Annual") {
                 $paymentPeriod = "Annual";
             }
             $basic = $taxDue->getBalanceBasic($paymentPeriod);
             $sef = $taxDue->getBalanceSEF($paymentPeriod);
             $idle = $taxDue->getBalanceIdle($paymentPeriod);
             $discount = $taxDue->getDiscount($basic + $sef);
             $penalty = $taxDue->getBalancePenalty($paymentPeriod);
             $taxValues['idleStatus'] = $idleStatus == 0 ? "" : "(I)";
             $taxValues['basic'] = number_format($basic, 2);
             $taxValues['sef'] = number_format($sef, 2);
             $taxValues['pd1185'] = number_format(0.0, 2);
             $taxValues['subTotal'] = number_format($totalTaxDue, 2);
             $taxValues['periodTotal'] = number_format($basic + $sef + $idle, 2);
             $taxValues['interest'] = number_format($interest * 100.0, 1) . "%";
             $taxValues['penalty'] = number_format($interest * 100, 0);
             $taxValues['discount'] = number_format($discount * 100.0, 1) . "%";
             $taxValues['totBasic'] = number_format($basic * (1 + $interest), 2);
             $taxValues['totSEF'] = number_format($sef * (1 + $interest), 2);
             $taxValues['totPD1185'] = number_format(0, 2);
             $taxValues['totSubTotal'] = number_format(round($totalTaxDue, 2), 2);
             $taxValues['grandTotal'] = number_format($totalTaxDue, 2);
             # further breakdown of basic tax for RPT Receipt
             $taxValues['gf'] = number_format($basic * 0.7, 2);
             // 70% of basic
             $taxValues['ib'] = number_format($basic * 0.15, 2);
             // 15% of basic
             $taxValues['cb'] = number_format($basic * 0.15, 2);
             // 15% of basic for a total if 100%
             $taxValues['totGF'] = number_format($basic * 0.7 * (1 + $interest), 2);
             $taxValues['totIB'] = number_format($basic * 0.15 * (1 + $interest), 2);
             $taxValues['totCB'] = number_format($basic * 0.15 * (1 + $interest), 2);
             if ($paymentPeriod == "Annual") {
                 $this->tpl->set_var("fullPmt", $taxValues['subTotal']);
                 $this->tpl->set_var("partialPmt", "");
                 # get full payment total
                 $fullPmtTotal += str_replace(",", "", $taxValues['subTotal']);
                 $this->tpl->set_var("fullPmtTotal", number_format($fullPmtTotal, 2));
             } else {
                 $this->tpl->set_var("partialPmt", $taxValues['subTotal']);
                 $this->tpl->set_var("num", ceil(date("n") / 3));
                 $this->tpl->set_var("fullPmt", "");
                 # get partial payment total
                 $partialPmtTotal += str_replace(",", "", $taxValues['subTotal']);
                 $this->tpl->set_var("partialPmtTotal", number_format($partialPmtTotal, 2));
             }
             $this->tpl->set_var($taxValues);
             $this->tpl->parse('Properties', 'Property', 'true');
             $ctr++;
             # get totals for penalty and grand total
             # $penaltyTotal += ($basic*$interest); -- removed bec penalty in percent
             $total += $totalTaxDue;
             # $this->tpl->set_var("penaltyTotal", number_format($penaltyTotal,2));
         }
     }
     # end foreach
     if ($total > $totalTaxDue) {
         $totalTaxDue = $total;
     }
     // if backtaxTDCheckbox is checked
     if ($_POST['backtaxTDCheckbox'] && $_POST['backtaxTDCheckbox'] != "") {
         $totalTaxDue += $this->displayBacktaxTD($ownerSwitch);
         $fullPmtTotal = $totalTaxDue;
         $this->tpl->set_var("fullPmtTotal", number_format($fullPmtTotal, 2));
     }
     # if amnesty checked/unchecked form will submit, set kind of payment and other details
     /*switch($formValues['kindOfPayment']){
     			case 'check':
     				$this->tpl->set_var("selectedCheck","selected");
     				$this->tpl->set_var("disabledOn","");
     				$this->tpl->set_var("checkNum",$formValues['checkNum']);
     				$this->tpl->set_var("checkDate",$formValues['checkDate']);
     				break;
     			case 'treasury note':
     				$this->tpl->set_var("selectedTNote","selected");
     				$this->tpl->set_var("disabledOn","disabled");
     				$this->tpl->set_var("checkNum","");
     				$this->tpl->set_var("checkDate","");
     				break;
     			case 'cash':
     			default:
     				$this->tpl->set_var("selectedCash","selected");
     				$this->tpl->set_var("disabledOn","disabled");
     				$this->tpl->set_var("checkNum","");
     				$this->tpl->set_var("checkDate","");								
     				break;
     		}*/
     # get totals in words
     $amountPaid = $amountPaid ? number_format($amountPaid, 2) : number_format($total, 2);
     $this->tpl->set_var("total", number_format($total, 2));
     $this->tpl->set_var("amountPaid", $amountPaid);
     $this->tpl->set_var("balance", $total - $amountPaid);
     $numToWords = new NumbersToWords();
     $totalInWords = $numToWords->num_to_string(number_format(str_replace(",", "", $amountPaid), 2));
     $this->tpl->set_var("totalInWords", $totalInWords);
     //$this->tpl->set_var("amnestyChecked", ($formValues['amnesty']=="Yes") ? " checked" : "");
     //if(!isset($_POST['printReceipt_x']))
     //  	$this->tpl->set_var("Session", $sess->url(""));
 }
Example #7
0
 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");
 }
Example #8
0
foreach ($td2 as $key => $value) {
    echo "{$key} = {$value}<br>\n";
}
$propertyType = $td1->propertyType;
$property1 = new Land();
$property1->selectRecord($td1->propertyID);
echo "property1 values<br>\n";
foreach ($property1 as $key => $value) {
    echo "{$key} = {$value}<br>\n";
}
$afsID = $property1->getAfsID();
$afs = new AFS();
$afs->selectRecord($afsID);
echo "AFS values<br>\n";
foreach ($afs as $key => $value) {
    echo "{$key} = {$value}<br>\n";
}
$tdNum = $td1->getTaxDeclarationNumber();
$taxDue = new Dues();
$taxDue->create($tdNum, "2002-01-01");
echo "taxDue values<br>\n";
foreach ($taxDue as $key => $value) {
    echo "{$key} = {$value}<br>\n";
}
$dueDate = $taxDue->getDueDate();
$dueTime = strtotime($dueDate);
echo "TaxDue date {$dueDate} and time {$dueTime} <br>\n";
echo "End test <br>\n";
?>

 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "view":
             $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object");
             // paging
             $condition = " WHERE ";
             $condition .= " " . OD_TABLE . ".odID=" . AFS_TABLE . ".odID ";
             $condition .= " AND " . AFS_TABLE . ".taxability='Taxable' ";
             $condition .= $this->filterArchives();
             $sqlCount = "SELECT COUNT(" . OD_TABLE . ".odID) as count FROM ";
             $sqlCount .= OD_TABLE . ", ";
             $sqlCount .= AFS_TABLE . " ";
             $sqlCount .= $condition;
             $dbCount = new DB_RPTS();
             $dbCount->query($sqlCount);
             if ($dbCount->next_record()) {
                 $count = $dbCount->f("count");
                 $numOfPages = ceil($count / PAGE_BY);
                 $this->tpl->set_var("currentPage", $this->formArray["page"]);
                 $this->tpl->set_var("numOfPages", $numOfPages);
                 $this->tpl->set_block("rptsTemplate", "PageListOne", "PageListOneBlock");
                 for ($p = 1; $p <= $numOfPages; $p++) {
                     $this->tpl->set_var("page", $p);
                     $this->initSelected("page", $p);
                     $this->tpl->parse("PageListOneBlock", "PageListOne", true);
                 }
             } else {
                 $this->tpl->set_block("rptsTemplate", "PageNavigationOne", "PageNavigationOneBlock");
                 $this->tpl->set_var("PageNavigationOneBlock", "");
                 $count = 0;
             }
             // listing
             $sql = "SELECT " . OD_TABLE . ".odID as odID, ";
             $sql .= AFS_TABLE . ".afsID as afsID FROM ";
             $sql .= OD_TABLE . ", ";
             $sql .= AFS_TABLE . " ";
             if ($this->formArray["page"] > 0) {
                 $initialLimit = ($this->formArray["page"] - 1) * PAGE_BY;
                 $condition .= " LIMIT " . $initialLimit . "," . PAGE_BY;
             }
             $sql = $sql . $condition;
             $db = new DB_RPTS();
             $db->query($sql);
             $odRecords = new ODRecords();
             while ($db->next_record()) {
                 $od = new OD();
                 $od->selectRecord($db->f("odID"));
                 $odRecords->arrayList[] = $od;
             }
             if (!is_array($odRecords->getArrayList())) {
                 $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                 $this->tpl->set_var("message", "properties not found");
                 $this->tpl->parse("NotFoundBlock", "NotFound", true);
                 $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
                 $this->tpl->set_var("ReportBlock", "");
             } else {
                 $list = $odRecords->getArrayList();
                 if (count($list)) {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $this->tpl->set_block("rptsTemplate", "ReportList", "ReportListBlock");
                     foreach ($list as $key => $value) {
                         $afs = $this->getAFSDetails($value->getOdID());
                         if (is_object($afs)) {
                             $this->tpl->set_var("taxability", $afs->getTaxability());
                             if ($afs->getTaxability() == "Taxable") {
                                 //$this->formArray["odID"] = $value->getOdID();
                                 //$this->formArray["afsID"] = $afs->getAfsID();
                                 $td = new TD();
                                 if ($td->selectRecord("", $this->formArray["afsID"])) {
                                     $this->tpl->set_var("taxDeclarationNumber", $td->getTaxDeclarationNumber());
                                 } else {
                                     $this->tpl->set_var("taxDeclarationNumber", "");
                                 }
                                 $locationAddress = $value->locationAddress->getFullAddress();
                                 $this->tpl->set_var("locationAddress", $locationAddress);
                                 $this->tpl->set_var("area", $value->getLandArea());
                                 $this->tpl->set_var("propertyIndexNumber", $afs->getPropertyIndexNumber());
                                 $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue()));
                                 $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                 $landList = $afs->getLandArray();
                                 $plantsTreesList = $afs->getPlantsTreesArray();
                                 $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                                 $machineriesList = $afs->getMachineriesArray();
                                 $kind = "";
                                 $class = "";
                                 $remarks = "";
                                 if (count($landList)) {
                                     $kind = "Land";
                                     $land = $landList[0];
                                     $class = $land->getClassification();
                                     $landClasses = new LandClasses();
                                     $landClasses->selectRecord($class);
                                     $class = $landClasses->getDescription();
                                     $remarks = $land->getMemoranda();
                                 } else {
                                     if (count($plantsTreesList)) {
                                         $kind = "Land";
                                         $plantsTrees = $plantsTreesList[0];
                                         $class = $plantsTrees->getProductClass();
                                         $plantsTreesClasses = new PlantsTreesClasses();
                                         $plantsTreesClasses->selectRecord($class);
                                         $class = $plantsTreesClasses->getDescription();
                                         $remarks = $plantsTrees->getMemoranda();
                                     } else {
                                         if (count($improvementsBuildingsList)) {
                                             $kind = "Improvements/Buildings";
                                             $improvementsBuildings = $improvementsBuildingsList[0];
                                             $class = $improvementsBuildings->getBuildingClassification();
                                             $improvementsBuildingsClasses = new ImprovementsBuildingsClasses();
                                             $improvementsBuildingsClasses->selectRecord($class);
                                             $class = $improvementsBuildingsClasses->getDescription();
                                             $remarks = $improvementsBuildings->getMemoranda();
                                         } else {
                                             if (count($machineriesList)) {
                                                 $kind = "Machineries";
                                                 $machineries = $machineriesList[0];
                                                 $class = $machineries->getKind();
                                                 $remarks = $machineries->getMemoranda();
                                             }
                                         }
                                     }
                                 }
                                 $this->tpl->set_var("kind", $kind);
                                 $this->tpl->set_var("classification", $class);
                                 $this->tpl->set_var("remarks", $remarks);
                                 $oValue = $value->owner;
                                 if (count($oValue->personArray)) {
                                     $firstOwner = $oValue->personArray[0]->getLastName();
                                     $firstOwner .= ", ";
                                     $firstOwner .= $oValue->personArray[0]->getFirstName();
                                     $firstOwner .= " ";
                                     $firstOwner .= substr($oValue->personArray[0]->getMiddleName(), 0, 1) . ".";
                                     $pAddress = $oValue->personArray[0]->addressArray ? $oValue->personArray[0]->addressArray[0]->getFullAddress() : "no address";
                                     $firstOwnerAddress = $pAddress;
                                     $firstOwnerTelephone = $oValue->personArray[0]->getTelephone();
                                     $this->tpl->set_var("firstOwner", $firstOwner);
                                     $this->tpl->set_var("firstOwnerAddress", $firstOwnerAddress);
                                     //$this->tpl->set_var("firstOwnerTelephone", $firstOwnerTelephone);
                                 }
                                 if (count($oValue->companyArray)) {
                                     if ($firstOwner == "") {
                                         $firstOwner = $oValue->companyArray[0]->getCompanyName();
                                         $cAddress = $oValue->companyArray[0]->addressArray ? $oValue->companyArray[0]->addressArray[0]->getFullAddress() : "no \taddress";
                                         $firstOwnerAddress = $cAddress;
                                         $firstOwnerTelephone = $oValue->companyArray[0]->getTelephone();
                                         $this->tpl->set_var("firstOwner", $firstOwner);
                                         $this->tpl->set_var("firstOwnerAddress", $firstOwnerAddress);
                                         //$this->tpl->set_var("firstOwnerTelephone", $firstOwnerTelephone);
                                     }
                                 }
                                 if ($firstOwner != "") {
                                     $this->tpl->set_var("none", "");
                                     if (count($oValue->personArray) + count($oValue->companyArray) > 1) {
                                         $this->tpl->set_var("andOthers", "(and others)");
                                     } else {
                                         $this->tpl->set_var("andOthers", "");
                                     }
                                 } else {
                                     $this->tpl->set_var("none", "none");
                                     $this->tpl->set_var("firstOwner", "");
                                     $this->tpl->set_var("andOthers", "");
                                     $this->tpl->set_var("firstOwnerAddress", "");
                                     $this->tpl->set_var("firstOwnerTelephone", "");
                                 }
                                 $this->tpl->parse("ReportListBlock", "ReportList", true);
                             }
                         }
                     }
                 }
             }
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("message", "select a location to view report");
             $this->tpl->parse("NotFoundBlock", "NotFound", true);
             $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
             $this->tpl->set_var("ReportBlock", "");
             break;
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->set_var("rpts_Session", $this->sess->id);
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "view":
             $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object");
             $condition = "";
             if ($this->formArray["filterByLocation"] == "true") {
                 if ($condition == "") {
                     $condition = " WHERE ";
                 }
                 $condition .= $this->filterLocationAddress();
             } else {
                 $this->tpl->set_block("rptsTemplate", "FilterLocationDetails", "FilterLocationDetailsBlock");
                 $this->tpl->set_var("FilterLocationDetailsBlock", "");
             }
             if ($this->formArray["filterByDate"] == "true") {
                 if ($condition == "") {
                     $condition = " WHERE ";
                 } else {
                     $condition .= " AND ";
                 }
                 $condition .= $this->filterDate();
             } else {
                 $this->tpl->set_block("rptsTemplate", "FilterDateDetails", "FilterDateDetailsBlock");
                 $this->tpl->set_var("FilterDateDetailsBlock", "");
             }
             $condition .= $this->filterArchives();
             $odRecords = new ODRecords();
             if ($this->formArray["filterByClassification"] == "true") {
                 $odIDArray = $this->filterByClassification($condition);
                 if (is_array($odIDArray)) {
                     $count = count($odIDArray);
                     $numOfPages = ceil($count / PAGE_BY);
                     $pLowerLimit = ($this->formArray["page"] - 1) * PAGE_BY;
                     $pUpperLimit = $pLowerLimit + PAGE_BY;
                     $this->tpl->set_var("currentPage", $this->formArray["page"]);
                     $this->tpl->set_var("numOfPages", $numOfPages);
                     $this->tpl->set_block("rptsTemplate", "PageListOne", "PageListOneBlock");
                     for ($p = 1; $p <= $numOfPages; $p++) {
                         $this->tpl->set_var("page", $p);
                         $this->initSelected("page", $p);
                         $this->tpl->parse("PageListOneBlock", "PageListOne", true);
                     }
                     for ($p = $pLowerLimit; $p < $pUpperLimit; $p++) {
                         if ($p < count($odIDArray)) {
                             $od = new OD();
                             $od->selectRecord($odIDArray[$p]);
                             $odRecords->arrayList[] = $od;
                         }
                     }
                 } else {
                     $this->tpl->set_block("rptsTemplate", "PageNavigationOne", "PageNavigationOneBlock");
                     $this->tpl->set_var("PageNavigationOneBlock", "");
                 }
             } else {
                 if (!($count = $odRecords->countRecords($condition))) {
                     $this->tpl->set_block("rptsTemplate", "PageNavigationOne", "PageNavigationOneBlock");
                     $this->tpl->set_var("PageNavigationOneBlock", "");
                 } else {
                     $numOfPages = ceil($count / PAGE_BY);
                     $this->tpl->set_var("currentPage", $this->formArray["page"]);
                     $this->tpl->set_var("numOfPages", $numOfPages);
                     $this->tpl->set_block("rptsTemplate", "PageListOne", "PageListOneBlock");
                     for ($p = 1; $p <= $numOfPages; $p++) {
                         $this->tpl->set_var("page", $p);
                         $this->initSelected("page", $p);
                         $this->tpl->parse("PageListOneBlock", "PageListOne", true);
                     }
                 }
                 $condition .= " LIMIT 0, 10";
                 $odRecords->selectRecords($condition);
             }
             if (!is_array($odRecords->getArrayList())) {
                 $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                 $this->tpl->set_var("message", "properties not found");
                 $this->tpl->parse("NotFoundBlock", "NotFound", true);
                 $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
                 $this->tpl->set_var("ReportBlock", "");
             } else {
                 $list = $odRecords->getArrayList();
                 $count = 0;
                 if (count($list)) {
                     $this->tpl->set_block("rptsTemplate", "ReportList", "ReportListBlock");
                     $noneFound = true;
                     foreach ($list as $key => $value) {
                         $afs = $this->getAFSDetails($value->getOdID());
                         if (is_object($afs)) {
                             $landList = $afs->getLandArray();
                             $plantsTreesList = $afs->getPlantsTreesArray();
                             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                             $machineriesList = $afs->getMachineriesArray();
                             $kind = "";
                             $class = "";
                             $remarks = "";
                             $actualUse = "";
                             $actualUseReportCode = "";
                             if (is_array($landList)) {
                                 $kind = "Land";
                                 $land = $landList[0];
                                 $actualUse = $land->getActualUse();
                                 $landActualUses = new LandActualUses();
                                 $landActualUses->selectRecord($actualUse);
                                 $actualUse = $landActualUses->getDescription();
                                 $actualUseReportCode = $landActualUses->getReportCode();
                                 $remarks = $land->getMemoranda();
                             } else {
                                 if (is_array($plantsTreesList)) {
                                     $kind = "Land";
                                     $plantsTrees = $plantsTreesList[0];
                                     $actualUse = $plantsTrees->getActualUse();
                                     $plantsTreesActualUses = new PlantsTreesActualUses();
                                     $plantsTreesActualUses->selectRecord($actualUse);
                                     $actualUse = $plantsTreesActualUses->getDescription();
                                     $actualUseReportCode = $plantsTreesActualUses->getReportCode();
                                     $remarks = $plantsTrees->getMemoranda();
                                 } else {
                                     if (is_array($improvementsBuildingsList)) {
                                         $kind = "Improvements/Buildings";
                                         $improvementsBuildings = $improvementsBuildingsList[0];
                                         $actualUse = $improvementsBuildings->getActualUse();
                                         $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                         $actualUse = $improvementsBuildingsActualUses->getDescription();
                                         $actualUseReportCode = $improvementsBuildingsActualUses->getReportCode();
                                         $remarks = $improvementsBuildings->getMemoranda();
                                     } else {
                                         if (is_array($machineriesList)) {
                                             $kind = "Machineries";
                                             $machineries = $machineriesList[0];
                                             $actualUse = $machineries->getActualUse();
                                             $machineriesActualUses = new MachineriesActualUses();
                                             $machineriesActualUses->selectRecord($actualUse);
                                             $actualUse = $machineriesActualUses->getDescription();
                                             $actualUseReportCode = $machineriesActualUses->getReportCode();
                                             $remarks = $machineries->getMemoranda();
                                         }
                                     }
                                 }
                             }
                             $this->tpl->set_var("kind", $kind);
                             $this->tpl->set_var("actualUse", $actualUse);
                             $this->tpl->set_var("actualUseReportCode", $actualUseReportCode);
                             $this->tpl->set_var("remarks", $remarks);
                             $this->tpl->set_var("taxability", $afs->getTaxability());
                             $this->formArray["odID"] = $value->getOdID();
                             $this->formArray["afsID"] = $afs->getAfsID();
                             $td = new TD();
                             if ($td->selectRecord("", $this->formArray["afsID"])) {
                                 $this->tpl->set_var("taxDeclarationNumber", $td->getTaxDeclarationNumber());
                             } else {
                                 $this->tpl->set_var("taxDeclarationNumber", "");
                             }
                             $this->tpl->set_var("area", $value->getLandArea());
                             $this->tpl->set_var("propertyIndexNumber", $afs->getPropertyIndexNumber());
                             $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue()));
                             $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                             $oValue = $value->owner;
                             if (count($oValue->personArray)) {
                                 $firstOwner = $oValue->personArray[0]->getLastName();
                                 $firstOwner .= ", ";
                                 $firstOwner .= $oValue->personArray[0]->getFirstName();
                                 $firstOwner .= " ";
                                 $firstOwner .= substr($oValue->personArray[0]->getMiddleName(), 0, 1) . ".";
                                 $pAddress = $oValue->personArray[0]->addressArray ? $oValue->personArray[0]->addressArray[0]->getFullAddress() : "no address";
                                 $firstOwnerAddress = $pAddress;
                                 $firstOwnerTelephone = $oValue->personArray[0]->getTelephone();
                                 $this->tpl->set_var("firstOwner", $firstOwner);
                                 $this->tpl->set_var("firstOwnerAddress", $firstOwnerAddress);
                             }
                             if (count($oValue->companyArray)) {
                                 if ($firstOwner == "") {
                                     $firstOwner = $oValue->companyArray[0]->getCompanyName();
                                     $cAddress = $oValue->companyArray[0]->addressArray ? $oValue->companyArray[0]->addressArray[0]->getFullAddress() : "no \taddress";
                                     $firstOwnerAddress = $cAddress;
                                     $firstOwnerTelephone = $oValue->companyArray[0]->getTelephone();
                                     $this->tpl->set_var("firstOwner", $firstOwner);
                                     $this->tpl->set_var("firstOwnerAddress", $firstOwnerAddress);
                                 }
                             }
                             if ($firstOwner != "") {
                                 $this->tpl->set_var("none", "");
                                 if (count($oValue->personArray) + count($oValue->companyArray) > 1) {
                                     $this->tpl->set_var("andOthers", "(and others)");
                                 } else {
                                     $this->tpl->set_var("andOthers", "");
                                 }
                             } else {
                                 $this->tpl->set_var("none", "none");
                                 $this->tpl->set_var("firstOwner", "");
                                 $this->tpl->set_var("andOthers", "");
                                 $this->tpl->set_var("firstOwnerAddress", "");
                                 $this->tpl->set_var("firstOwnerTelephone", "");
                             }
                             if (is_array($oValue->personArray)) {
                                 foreach ($oValue->personArray as $person) {
                                     $ownerNamesArray[] = $person->getFullName();
                                 }
                             }
                             if (is_array($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $company) {
                                     $ownerNamesArray[] = $company->getCompanyName();
                                 }
                             }
                             if (is_array($ownerNamesArray)) {
                                 $this->tpl->set_var("ownerNames", implode(",<br>", $ownerNamesArray));
                             } else {
                                 $this->tpl->set_var("ownerNames", "");
                             }
                             unset($ownerNamesArray);
                             $locationAddress = $value->locationAddress->getFullAddress();
                             $this->tpl->set_var("location", $locationAddress);
                             $this->tpl->set_var("transactionCode", $value->getTransactionCode());
                             $this->tpl->set_var("assessorsLotNo", $value->getLotNumber());
                             $this->tpl->set_var("dateCreated", date('F j, Y, g:i a', $value->getDateCreated()));
                             if ($this->formArray["filterByClassification"] == "true") {
                                 $count++;
                                 if ($this->checkActualUseReportCode($landList, $plantsTreesList, $improvementsBuildingsList, $machineriesList)) {
                                     $noneFound = false;
                                     $this->tpl->parse("ReportListBlock", "ReportList", true);
                                 }
                             } else {
                                 $noneFound = false;
                                 $this->tpl->set_block("rptsTemplate", "FilterClassificationDetails", "FilterClassificationDetailsBlock");
                                 $this->tpl->set_var("FilterClassificationDetailsBlock", "");
                                 $this->tpl->parse("ReportListBlock", "ReportList", true);
                             }
                         }
                     }
                     if ($noneFound == true) {
                         $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                         $this->tpl->parse("NotFoundBlock", "NotFound", true);
                         $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
                         $this->tpl->set_var("ReportBlock", "");
                     } else {
                         $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                         $this->tpl->set_var("NotFoundBlock", "");
                     }
                 }
             }
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("message", "select a location to view report");
             $this->tpl->parse("NotFoundBlock", "NotFound", true);
             $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
             $this->tpl->set_var("ReportBlock", "");
             break;
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->set_var("rpts_Session", $this->sess->id);
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #11
0
 function Main()
 {
     $this->formArray['currentDate'] = date("F d, Y");
     $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
     #test values
     //$this->formArray['municipalityCityID']=1;
     if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray['municipalityCityID']))) {
         #echo($xmlStr);
         //exit("xml failed for municipality");
         header("Location: " . $this->sess->url("ViewSOA.php") . "&status=2");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             echo "error xmlDoc";
         } else {
             $MunicipalityCity = new MunicipalityCity();
             $MunicipalityCity->parseDomDocument($domDoc);
             $this->formArray['municipality'] = $MunicipalityCity->getDescription();
         }
     }
     #test values
     //$this->formArray['ownerID']=5;
     #echo("ownerID=".$this->formArray['ownerID']."<br>");
     //			$this->displayOwnerList($this->formArray['ownerID']);
     #test values
     //$this->formArray["rptopID"]=15;
     if ($this->formArray['personID'] != "") {
         $person = new Person();
         $person->selectRecord($this->formArray['personID']);
         $this->tpl->set_var(ownerName, $person->getFullName());
         $this->tpl->set_var(ownerNo, $person->getTin());
         $address = $person->addressArray[0];
         $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['personID'];
         $db->query($sql);
     } else {
         $company = new Company();
         $company->selectRecord($this->formArray['companyID']);
         $this->tpl->set_var(ownerName, $company->getCompanyName());
         $this->tpl->set_var(ownerNo, $company->getCompanyID());
         $address = $company->addressArray[0];
         $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['companyID'];
         $db->query($sql);
     }
     /*$person = new Person();
     		$person->selectRecord($this->formArray['personID']);
     		$this->tpl->set_var(ownerName,$person->getFullName());
     		$this->tpl->set_var(ownerNo,$person->getTin());
     		$address = $person->addressArray[0];
     		$this->tpl->set_var(ownerAddress,$address->getNumber() ." ".$address->getStreet()." ".$address->getBarangay()." ".$address->getDistrict()." ".$address->getMunicipalitycity()." ".$address->getProvince());
     		$db = new DB_RPTS();
     
     		$sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=".$this->formArray['personID'];
     		$db->query($sql);*/
     $this->tpl->set_block("rptsTemplate", "ROW", "RowBlk");
     for ($i = 0; $db->next_record(); $i++) {
         $rptopID = $db->f("rptopID");
         $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
         if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
             //	exit("xml failed for RPTOP");
             header("Location: " . $this->sess->url("ViewSOA.php") . "&status=1");
         } else {
             //echo $xmlStr;
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                 $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
             } else {
                 $rptop = new RPTOP();
                 $td = new TD();
                 $rptop->parseDomDocument($domDoc);
                 foreach ($rptop as $key => $value) {
                     $this->formArray['payableYear'] = $rptop->getTaxableYear();
                     $rptopID = $rptop->getRptopID();
                     if ($key == "tdArray") {
                         $tdCtr = 0;
                         if (count($value)) {
                             foreach ($value as $tkey => $tvalue) {
                                 $td->selectRecord($tvalue->getTdID());
                                 $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                 $propertyType = $td->getPropertyType();
                                 $TaxDeclarationNumber = $td->getTaxDeclarationNumber();
                                 //										$this->tpl->set_var(kind,$propertyType);
                                 //										$this->tpl->set_var(currentTDNo,$TaxDeclarationNumber);
                                 /*									$dues = new Dues();
                                 									$dues->create($td->getTdID(), "","","","2003");
                                 									$this->tpl->set_var(basic,$dues->getBasic());
                                 									$totBasic += $dues->getBasic();
                                 									$this->tpl->set_var(sef,$dues->getSEF());
                                 									$totSEF += $dues->getSEF();
                                 									$this->tpl->set_var(total,$dues->getSEF()+$dues->getBasic());
                                 									$totTaxDue += $dues->getSEF()+$dues->getBasic();*/
                                 $afsID = $td->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $od = new OD();
                                 $od->selectRecord($afs->getOdID());
                                 $addr = $od->getLocationAddress();
                                 if (count($addr)) {
                                     $location = $addr->getFullAddress();
                                     //												$this->tpl->set_var(location,$addr->getFullAddress());
                                     $munCityID = $addr->getMunicipalityCityID();
                                     //											if($munCityID == $this->formArray['municipalityCityID'])
                                     //												$this->tpl->set_var(municipality,$addr->getMunicipalityCity());
                                 }
                                 if (count($afs->landArray)) {
                                     foreach ($afs->landArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $landActualUses = new LandActualUses();
                                         $landActualUses->selectRecord($actualUse);
                                         //$this->tpl->set_var("class",$landActualUses->getCode());
                                         $Code = $landActualUses->getCode();
                                     }
                                 }
                                 if (count($afs->improvementsBuildingsArray)) {
                                     foreach ($afs->improvementsBuildingsArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $improvementsBuildingsActualUses = new improvementsBuildingsActualUses();
                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                         //$this->tpl->set_var("class",$improvementsBuildingsActualUses->getCode());
                                         $Code = $improvementsBuildingsActualUses->getCode();
                                     }
                                 }
                                 //echo $afs->get
                                 //											echo $munCityID ."==". $this->formArray['municipalityCityID']."<br>";
                                 if ($munCityID == $this->formArray['municipalityCityID']) {
                                     $this->tpl->set_var(location, $location);
                                     $this->tpl->set_var("class", $Code);
                                     $this->tpl->set_var(kind, $propertyType);
                                     $this->tpl->set_var(currentTDNo, $TaxDeclarationNumber);
                                     $this->tpl->set_var(municipality, $addr->getMunicipalityCity());
                                     $dues = new Dues();
                                     $dues->create($td->getTdID(), "", "", "", "2003");
                                     $totTaxDue += $dues->getSEF() + $dues->getBasic();
                                     $basic = number_format($dues->getBasic(), "2", ".", "");
                                     $this->tpl->set_var(basic, $basic);
                                     $totBasic += $basic;
                                     $sef = number_format($dues->getSEF(), "2", ".", "");
                                     $this->tpl->set_var(sef, $sef);
                                     $totSEF += number_format($sef, "2", ".", "");
                                     $this->tpl->set_var(total, number_format($sef + $basic, "2", ".", ""));
                                     $this->tpl->set_var(marketValue, number_format($afs->getTotalMarketValue(), 2));
                                     $totMarketValue += $afs->getTotalMarketValue();
                                     $this->tpl->set_var(assessedValue, number_format($afs->getTotalAssessedValue(), 2));
                                     $totAssessedValue += $afs->getTotalAssessedValue();
                                     $pIndexNo = $afs->getPropertyIndexNumber();
                                     if ($pIndexNo == "") {
                                         $pIndexNo = "No value specified";
                                     }
                                     $this->tpl->set_var(pin, $pIndexNo);
                                     //echo $afs->getTotalMarketValue();
                                     /*									if(count($afs->landArray)){
                                     										foreach($afs->landArray as $afsKey => $afsValue){
                                     											$this->tpl->set_var(pin,$afsValue->getPropertyIndexNumber());
                                     										}
                                     								}							
                                     */
                                     $this->tpl->parse("RowBlk", "ROW", true);
                                 }
                                 //else{
                                 //											$this->tpl->set_var("RowBlk","");
                                 //								}
                             }
                             #end foreach($value)
                         }
                         #end if coun value
                         $this->tpl->set_var(totalMarketValue, number_format($totMarketValue, 2));
                         $this->tpl->set_var(totalAssessedValue, number_format($totAssessedValue, 2));
                         $this->tpl->set_var(totalBasic, number_format($totBasic, 2));
                         $this->tpl->set_var(totalSEF, number_format($totSEF, 2));
                         $this->tpl->set_var(totalTaxDue, number_format($totTaxDue, 2));
                     }
                 }
             }
             //				$this->tpl->parse("RowBlk","ROW",true);
         }
     }
     //		$owner
     /*		$RPTOPDetails = new SoapObject(NCCBIZ."RPTOPDetails.php", "urn:Object");
     		if (!$xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"])){
     			//exit("xml failed for RPTOP");
     			header("Location: ".$this->sess->url("ViewSOA.php")."&status=1");
     		}
     		else{
     			//echo $xmlStr;
     			if(!$domDoc = domxml_open_mem($xmlStr)) {
     				$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
     				$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
     			}
     			else {
     				$rptop = new RPTOP;
     				$td = new TD();
     				$rptop->parseDomDocument($domDoc);
     				$status_report = "";
     				foreach($rptop as $key => $value){
     					$this->formArray['payableYear'] = $rptop->getTaxableYear();
     					$rptopID = $rptop->getRptopID();
     					if($key=="tdArray"){
     						$tdCtr = 0;
     							if (count($value)){	
     							$this->tpl->set_block("rptsTemplate","ROW","RowBlk");	
     								foreach($value as $tkey => $tvalue){			
     									$td->selectRecord($tvalue->getTdID());
     
     									$assessedValue = number_format($td->getAssessedValue(),2,".","");
     									$propertyType = $td->getPropertyType();
     									$TaxDeclarationNumber = $td->getTaxDeclarationNumber();
     									//$tdCtr++;
     									$this->tpl->set_var(kind,$propertyType);
     									$this->tpl->set_var(currentTDNo,$TaxDeclarationNumber);
     
     /*									$dues = new Dues();
     									$dues->create($td->getTdID(), "","","","2003");
     									$this->tpl->set_var(basic,$dues->getBasic());
     									$totBasic += $dues->getBasic();
     									$this->tpl->set_var(sef,$dues->getSEF());
     									$totSEF += $dues->getSEF();
     									$this->tpl->set_var(total,$dues->getSEF()+$dues->getBasic());
     									$totTaxDue += $dues->getSEF()+$dues->getBasic();*/
     /*								$afsID = $td->getAfsID();
     									$afs = new AFS();
     									$afs->selectRecord($afsID);
     									$od = new OD();
     									$od->selectRecord($afs->getOdID());
     									$addr = $od->getLocationAddress();
     									if(count($addr)){
     									$this->tpl->set_var(location,$addr->getFullAddress());
     									$munCityID = $addr->getMunicipalityCityID();
     										if($munCityID == $this->formArray['municipalityCityID'])
     										$this->tpl->set_var(municipality,$addr->getMunicipalityCity());
     									}
     									if(count($afs->landArray)){
     										foreach($afs->landArray as $afsKey => $afsValue){
     											$actualUse = $afsValue->getActualUse();
     											$landActualUses = new LandActualUses();
     											$landActualUses->selectRecord($actualUse);
     											$this->tpl->set_var("class",$landActualUses->getCode());
     										}
     									}
     									if(count($afs->improvementsBuildingsArray)){
     										foreach($afs->improvementsBuildingsArray as $afsKey => $afsValue){
     											$actualUse = $afsValue->getActualUse();
     											$improvementsBuildingsActualUses = new improvementsBuildingsActualUses();
     											$improvementsBuildingsActualUses->selectRecord($actualUse);
     											$this->tpl->set_var("class",$improvementsBuildingsActualUses->getCode());
     										}
     									}
     									//echo $afs->get
     
     									if($munCityID == $this->formArray['municipalityCityID']){
     									$dues = new Dues();
     									$dues->create($td->getTdID(), "","","","2003");
     									$this->tpl->set_var(basic,number_format($dues->getBasic(),"2",".",""));
     									$totBasic += $dues->getBasic();
     									$this->tpl->set_var(sef,number_format($dues->getSEF(),"2",".",""));
     									$totSEF += $dues->getSEF();
     									$this->tpl->set_var(total,number_format($dues->getSEF()+$dues->getBasic(),"2",".",""));
     									$pIndexNo = $afs->getPropertyIndexNumber();
     									if($pIndexNo==""){
     										$pIndexNo = "No value specified";	
     									}
     									$this->tpl->set_var(pin,$pIndexNo);
     									
     									$this->tpl->set_var(marketValue,$afs->getTotalMarketValue());
     									$totMarketValue += $afs->getTotalMarketValue();
     									$this->tpl->set_var(assessedValue,$afs->getTotalAssessedValue());
     									$totAssessedValue += $afs->getTotalAssessedValue();																
     									//echo $afs->getTotalMarketValue();
     /*									if(count($afs->landArray)){
     										foreach($afs->landArray as $afsKey => $afsValue){
     											$this->tpl->set_var(pin,$afsValue->getPropertyIndexNumber());
     										}
     									}							
     */
     /*								$this->tpl->parse("RowBlk","ROW",true);
     								}else{
     								$this->tpl->set_var("RowBlk","");
     								}
     								}#end foreach($value)						
     							}#end if coun value
     
     //				$this->tpl->set_block("rptsTemplate","STAT",sBlk);
     //				$this->tpl->set_var(status_report,$status_report);
     //				$this->tpl->parse(sBlk,"STAT",true);
     							
     							$this->tpl->set_var(totalMarketValue,$totMarketValue);
     							$this->tpl->set_var(totalAssessedValue,$totAssessedValue);
     							$this->tpl->set_var(totalBasic,$totBasic);
     							$this->tpl->set_var(totalSEF,$totSEF);
     							$this->tpl->set_var(totalTaxDue,$totTaxDue);
     					}
     				}
     				
     			}
     		}*/
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #12
0
 function Main()
 {
     $this->formArray['currentDate'] = date("F d, Y");
     $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object");
     #test values
     //$this->formArray['municipalityCityID']=1;
     if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray['municipalityCityID']))) {
         #echo($xmlStr);
         exit("xml failed for municipality");
         //header("Location: ".$this->sess->url("ViewSOA.php")."&status=2");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             echo "error xmlDoc";
         } else {
             $MunicipalityCity = new MunicipalityCity();
             $MunicipalityCity->parseDomDocument($domDoc);
             $this->formArray['municipality'] = $MunicipalityCity->getDescription();
         }
     }
     if ($this->formArray['personID'] != "") {
         $person = new Person();
         $person->selectRecord($this->formArray['personID']);
         $this->tpl->set_var(ownerName, $person->getFullName());
         $this->tpl->set_var(ownerNo, $person->getTin());
         $address = $person->addressArray[0];
         if (is_object($address)) {
             $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         } else {
             $this->tpl->set_var(ownerAddress, "");
         }
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['personID'];
         $db->query($sql);
     } else {
         $company = new Company();
         $company->selectRecord($this->formArray['companyID']);
         $this->tpl->set_var(ownerName, $company->getCompanyName());
         $this->tpl->set_var(ownerNo, $company->getCompanyID());
         $address = $company->addressArray[0];
         $this->tpl->set_var(ownerAddress, $address->getNumber() . " " . $address->getStreet() . " " . $address->getBarangay() . " " . $address->getDistrict() . " " . $address->getMunicipalitycity() . " " . $address->getProvince());
         $db = new DB_RPTS();
         $sql = "SELECT rptopID FROM Owner inner join OwnerPerson on Owner.ownerID=OwnerPerson.ownerID WHERE Owner.rptopID <> '' AND OwnerPerson.personID=" . $this->formArray['companyID'];
         $db->query($sql);
     }
     $ypos = 325;
     $this->tpl->set_block("rptsTemplate", "ROW", "RowBlk");
     for ($i = 0; $db->next_record(); $i++) {
         $rptopID = $db->f("rptopID");
         $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
         if (!($xmlStr = $RPTOPDetails->getRPTOP($rptopID))) {
             //	exit("xml failed for RPTOP");
             header("Location: " . $this->sess->url("ViewSOA.php") . "&status=1");
         } else {
             //echo $xmlStr;
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                 $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
             } else {
                 $rptop = new RPTOP();
                 $td = new TD();
                 $rptop->parseDomDocument($domDoc);
                 foreach ($rptop as $key => $value) {
                     $this->formArray['payableYear'] = $rptop->getTaxableYear();
                     $rptopID = $rptop->getRptopID();
                     if ($key == "tdArray") {
                         $tdCtr = 0;
                         if (count($value)) {
                             foreach ($value as $tkey => $tvalue) {
                                 $td->selectRecord($tvalue->getTdID());
                                 $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                 $propertyType = $td->getPropertyType();
                                 $TaxDeclarationNumber = $td->getTaxDeclarationNumber();
                                 $afsID = $td->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $od = new OD();
                                 $od->selectRecord($afs->getOdID());
                                 $addr = $od->getLocationAddress();
                                 if (count($addr)) {
                                     $location = strtoupper($addr->getNumber() . " " . substr($addr->getBarangay(), 0, 4) . " " . substr($addr->getMunicipalityCity(), 0, 3) . " " . substr($addr->getProvince(), 0, 3));
                                     $munCityID = $addr->getMunicipalityCityID();
                                 }
                                 if (count($afs->landArray)) {
                                     foreach ($afs->landArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $landActualUses = new LandActualUses();
                                         $landActualUses->selectRecord($actualUse);
                                         $Code = $landActualUses->getCode();
                                     }
                                 }
                                 if (count($afs->improvementsBuildingsArray)) {
                                     foreach ($afs->improvementsBuildingsArray as $afsKey => $afsValue) {
                                         $actualUse = $afsValue->getActualUse();
                                         $improvementsBuildingsActualUses = new improvementsBuildingsActualUses();
                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                         $Code = $improvementsBuildingsActualUses->getCode();
                                     }
                                 }
                                 if ($munCityID == $this->formArray['municipalityCityID']) {
                                     $this->tpl->set_var(location, $location);
                                     $this->tpl->set_var("class", $Code);
                                     $this->tpl->set_var(kind, strtoupper(substr($propertyType, 0, 4)));
                                     $this->tpl->set_var(currentTDNo, $TaxDeclarationNumber);
                                     $this->tpl->set_var(municipality, $addr->getMunicipalityCity());
                                     //$dues = new Dues();
                                     //$dues->create($td->getTdID(),"2003");
                                     //$totTaxDue += $dues->getSEF()+$dues->getBasic();
                                     $dues = new Dues($tvalue->getTdID(), $rptop->getTaxableYear(), $assessedValue);
                                     $paymentPeriod = $dues->getPaymentMode();
                                     $totalTaxDue = $dues->getPaidBasic($paymentPeriod) + $dues->getPaidSEF($paymentPeriod) + $dues->getPaidIdle($paymentPeriod);
                                     if ($dues->getAmnesty()) {
                                         $dues->setPctPenalty(0.0);
                                     } else {
                                         $totalTaxDue += $dues->getPenalty($paymentPeriod);
                                     }
                                     if ($dues->getIsDiscount()) {
                                         $taxDue->setDiscount($totalTaxDue);
                                         $totalTaxDue -= $dues->getDiscount();
                                     }
                                     $interest = $dues->getPctPenalty();
                                     if ($interest > 0 && $paymentPeriod != "Annual") {
                                         $paymentPeriod = "Annual";
                                     }
                                     $basic = number_format($dues->getPaidBasic(), "2", ".", "");
                                     $this->tpl->set_var(basic, $basic);
                                     $totBasic += $basic;
                                     $sef = number_format($dues->getPaidSEF(), "2", ".", "");
                                     $this->tpl->set_var(sef, $sef);
                                     $totSEF += number_format($sef, "2", ".", "");
                                     $this->tpl->set_var(total, number_format($sef + $basic, "2", ".", ""));
                                     $this->tpl->set_var(marketValue, number_format($afs->getTotalMarketValue(), 2));
                                     $totMarketValue += $afs->getTotalMarketValue();
                                     $this->tpl->set_var(assessedValue, number_format($afs->getTotalAssessedValue(), 2));
                                     $totAssessedValue += $afs->getTotalAssessedValue();
                                     $pIndexNo = $afs->getPropertyIndexNumber();
                                     if ($pIndexNo == "") {
                                         $pIndexNo = "No value specified";
                                     }
                                     $ypos = $ypos - 10;
                                     $this->tpl->set_var(ypos, $ypos);
                                     $this->tpl->set_var(pin, $pIndexNo);
                                     $this->tpl->parse("RowBlk", "ROW", true);
                                 }
                             }
                             #end foreach($value)
                         }
                         #end if coun value
                         $this->tpl->set_var(totalMarketValue, number_format($totMarketValue, 2));
                         $this->tpl->set_var(totalAssessedValue, number_format($totAssessedValue, 2));
                         $this->tpl->set_var(totalBasic, number_format($totBasic, 2));
                         $this->tpl->set_var(totalSEF, number_format($totSEF, 2));
                         $this->tpl->set_var(totalTaxDue, number_format($totalTaxDue, 2));
                     }
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     /*		$this->tpl->parse("templatePage", "rptsTemplate");
     		$this->tpl->finish("templatePage");
     		$this->tpl->p("templatePage");
     */
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $rptrpdf = new PDFWriter();
     $rptrpdf->setOutputXML($this->tpl->get('templatePage'), "string");
     $rptrpdf->writePDF("viewSOA.pdf");
 }
Example #13
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "view":
             $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object");
             $condition = "";
             if ($this->formArray["filterByLocation"] == "true") {
                 if ($condition == "") {
                     $condition = " WHERE ";
                 }
                 $condition .= $this->filterLocationAddress();
             } else {
                 $this->tpl->set_block("rptsTemplate", "FilterLocationDetails", "FilterLocationDetailsBlock");
                 $this->tpl->set_var("FilterLocationDetailsBlock", "");
             }
             if ($this->formArray["filterByDate"] == "true") {
                 if ($condition == "") {
                     $condition = " WHERE ";
                 } else {
                     $condition .= " AND ";
                 }
                 $condition .= $this->filterDate();
             } else {
                 $this->tpl->set_block("rptsTemplate", "FilterDateDetails", "FilterDateDetailsBlock");
                 $this->tpl->set_var("FilterDateDetailsBlock", "");
             }
             $condition .= $this->filterArchives();
             $odRecords = new ODRecords();
             // paging
             if (!($count = $odRecords->countRecords($condition))) {
                 $this->tpl->set_block("rptsTemplate", "PageNavigationOne", "PageNavigationOneBlock");
                 $this->tpl->set_var("PageNavigationOneBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 $this->tpl->set_var("currentPage", $this->formArray["page"]);
                 $this->tpl->set_var("numOfPages", $numOfPages);
                 $this->tpl->set_block("rptsTemplate", "PageListOne", "PageListOneBlock");
                 for ($p = 1; $p <= $numOfPages; $p++) {
                     $this->tpl->set_var("page", $p);
                     $this->initSelected("page", $p);
                     $this->tpl->parse("PageListOneBlock", "PageListOne", true);
                 }
             }
             if ($this->formArray["page"] > 0) {
                 $initialLimit = ($this->formArray["page"] - 1) * PAGE_BY;
                 $condition .= " LIMIT " . $initialLimit . "," . PAGE_BY;
             }
             // listing
             if (!$odRecords->selectRecords($condition)) {
                 $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                 $this->tpl->set_var("message", "properties not found");
                 $this->tpl->parse("NotFoundBlock", "NotFound", true);
                 $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
                 $this->tpl->set_var("ReportBlock", "");
             } else {
                 $list = $odRecords->getArrayList();
                 if (count($list)) {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $this->tpl->set_block("rptsTemplate", "ReportList", "ReportListBlock");
                     foreach ($list as $key => $value) {
                         $this->formArray["odID"] = $value->getOdID();
                         $this->tpl->set_var("odID", $value->getOdID());
                         $afs = $this->getAFSDetails($value->getOdID());
                         if (is_object($afs)) {
                             $this->tpl->set_var("propertyIndexNumber", $afs->getPropertyIndexNumber());
                             $this->tpl->set_var("arpNumber", $afs->getArpNumber());
                             $this->formArray["odID"] = $value->getOdID();
                             $this->formArray["afsID"] = $afs->getAfsID();
                             //$od = $this->getODDetails($value->getOdID());
                             $this->tpl->set_var("transactionCode", $value->getTransactionCode());
                             $td = new TD();
                             if ($td->selectRecord("", $this->formArray["afsID"])) {
                                 $this->tpl->set_var("taxDeclarationNumber", $td->getTaxDeclarationNumber());
                             } else {
                                 $this->tpl->set_var("taxDeclarationNumber", "");
                             }
                             $this->tpl->set_var("area", $value->getLandArea());
                             $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue()));
                             $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("cancelsTDNumber", $td->getCancelsTDNumber());
                             $this->tpl->set_var("previousAssessedValue", $td->getPreviousAssessedValue());
                             $this->tpl->set_var("previousOwner", $td->getPreviousOwner());
                             $this->tpl->set_var("canceledByTDNumber", $td->getCanceledByTDNumber());
                             $landList = $afs->getLandArray();
                             $plantsTreesList = $afs->getPlantsTreesArray();
                             $improvementsBuildingsList = $afs->getImprovementsBuildingsArray();
                             $machineriesList = $afs->getMachineriesArray();
                             $this->tpl->set_var("taxability", $afs->getTaxability());
                             $this->tpl->set_var("effectivity", $afs->getEffectivity());
                             $kind = "";
                             $class = "";
                             if (count($landList)) {
                                 $kind = "Land";
                                 $land = $landList[0];
                                 $class = $land->getClassification();
                                 $landClasses = new LandClasses();
                                 $landClasses->selectRecord($class);
                                 $class = $landClasses->getDescription();
                             } else {
                                 if (count($plantsTreesList)) {
                                     $kind = "Land";
                                     $plantsTrees = $plantsTreesList[0];
                                     $class = $plantsTrees->getProductClass();
                                     $plantsTreesClasses = new PlantsTreesClasses();
                                     $plantsTreesClasses->selectRecord($class);
                                     $class = $plantsTreesClasses->getDescription();
                                 } else {
                                     if (count($improvementsBuildingsList)) {
                                         $kind = "Improvements/Buildings";
                                         $improvementsBuildings = $improvementsBuildingsList[0];
                                         $class = $improvementsBuildings->getBuildingClassification();
                                         $improvementsBuildingsClasses = new ImprovementsBuildingsClasses();
                                         $improvementsBuildingsClasses->selectRecord($class);
                                         $class = $improvementsBuildingsClasses->getDescription();
                                     } else {
                                         if (count($machineriesList)) {
                                             $kind = "Machineries";
                                             $machineries = $machineriesList[0];
                                             $class = $machineries->getKind();
                                         }
                                     }
                                 }
                             }
                             $this->tpl->set_var("kind", $kind);
                             $this->tpl->set_var("class", $class);
                             $oValue = $value->owner;
                             if (is_array($oValue->personArray)) {
                                 foreach ($oValue->personArray as $person) {
                                     $ownerNamesArray[] = $person->getName();
                                 }
                             }
                             if (is_array($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $company) {
                                     $ownerNamesArray[] = $company->getCompanyName();
                                 }
                             }
                             if (is_array($ownerNamesArray)) {
                                 $this->tpl->set_var("ownerNames", implode(",<br>", $ownerNamesArray));
                             } else {
                                 $this->tpl->set_var("ownerNames", "");
                             }
                             unset($ownerNamesArray);
                             if (count($oValue->personArray)) {
                                 $firstOwner = $oValue->personArray[0]->getLastName();
                                 $firstOwner .= ", ";
                                 $firstOwner .= $oValue->personArray[0]->getFirstName();
                                 $firstOwner .= " ";
                                 $firstOwner .= substr($oValue->personArray[0]->getMiddleName(), 0, 1) . ".";
                                 $pAddress = $oValue->personArray[0]->addressArray ? $oValue->personArray[0]->addressArray[0]->getFullAddress() : "no address";
                                 $firstOwnerAddress = $pAddress;
                                 $firstOwnerTelephone = $oValue->personArray[0]->getTelephone();
                                 $this->tpl->set_var("firstOwner", $firstOwner);
                                 $this->tpl->set_var("firstOwnerAddress", $firstOwnerAddress);
                                 $this->tpl->set_var("firstOwnerTelephone", $firstOwnerTelephone);
                             }
                             if (count($oValue->companyArray)) {
                                 if ($firstOwner == "") {
                                     $firstOwner = $oValue->companyArray[0]->getCompanyName();
                                     $cAddress = $oValue->companyArray[0]->addressArray ? $oValue->companyArray[0]->addressArray[0]->getFullAddress() : "no address";
                                     $firstOwnerAddress = $cAddress;
                                     $firstOwnerTelephone = $oValue->companyArray[0]->getTelephone();
                                     $this->tpl->set_var("firstOwner", $firstOwner);
                                     $this->tpl->set_var("firstOwnerAddress", $firstOwnerAddress);
                                     $this->tpl->set_var("firstOwnerTelephone", $firstOwnerTelephone);
                                 }
                             }
                             if ($firstOwner != "") {
                                 $this->tpl->set_var("none", "");
                                 if (count($oValue->personArray) + count($oValue->companyArray) > 1) {
                                     $this->tpl->set_var("andOthers", "(and others)");
                                 } else {
                                     $this->tpl->set_var("andOthers", "");
                                 }
                             } else {
                                 $this->tpl->set_var("none", "none");
                                 $this->tpl->set_var("firstOwner", "");
                                 $this->tpl->set_var("andOthers", "");
                                 $this->tpl->set_var("firstOwnerAddress", "");
                                 $this->tpl->set_var("firstOwnerTelephone", "");
                             }
                             $locationAddress = $value->locationAddress->getFullAddress();
                             $this->tpl->set_var("locationAddress", $locationAddress);
                             $this->displayPrecedingOD();
                             $this->displaySucceedingOD();
                             //$this->tpl->set_var("transactionCode", $value->getTransactionCode());
                             $this->tpl->parse("ReportListBlock", "ReportList", true);
                         }
                     }
                 }
             }
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("message", "select a location to view report");
             $this->tpl->parse("NotFoundBlock", "NotFound", true);
             $this->tpl->set_block("rptsTemplate", "Report", "ReportBlock");
             $this->tpl->set_var("ReportBlock", "");
             break;
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->set_var("rpts_Session", $this->sess->id);
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #14
0
 function displayTDDetails($propertyType)
 {
     $afsID = $this->formArray["afsID"];
     $propertyID = $this->formArray["propertyID"];
     $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
     if (!($xmlStr = $TDDetails->getTD("", $afsID, $propertyID, $propertyType))) {
         $this->formArray["tdNumber"] = "";
         $this->formArray["tdID"] = "";
         $this->formArray["propertyType"] = $propertyType;
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->formArray["tdNumber"] = "";
             $this->formArray["tdID"] = "";
             $this->formArray["propertyType"] = $propertyType;
         } else {
             $td = new TD();
             $td->parseDomDocument($domDoc);
             $this->formArray["tdNumber"] = $td->getTaxDeclarationNumber();
             //$this->formArray["effectivity"] = $td->taxBeginsWithTheYear();
             foreach ($td as $tdkey => $tdvalue) {
                 switch ($tdkey) {
                     case "provincialAssessor":
                         if (is_a($tdvalue, Assessor)) {
                             $this->formArray["provincialAssessorID"] = $tdvalue->getAssessorID();
                             $this->formArray["provincialAssessorName"] = $tdvalue->getFullName();
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "provincialAssessorDate":
                         if (true) {
                             list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tdvalue);
                             $this->formArray["pa_yearValue"] = removePreZero($dateArr["year"]);
                             eval(MONTH_ARRAY);
                             //$monthArray
                             $this->formArray["pa_month"] = $monthArray[removePreZero($dateArr["month"])];
                             $this->formArray["pa_dayValue"] = removePreZero($dateArr["day"]);
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         $this->formArray[$tdkey] = $tdvalue;
                         //RC 20091007
                         break;
                     case "cityMunicipalAssessor":
                         if (is_a($tdvalue, Assessor)) {
                             $this->formArray["cityMunicipalAssessorID"] = $tdvalue->getAssessorID();
                             $this->formArray["cityMunicipalAssessorName"] = $tdvalue->getFullName();
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "cityMunicipalAssessorDate":
                         if (true) {
                             list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tdvalue);
                             $this->formArray["cm_yearValue"] = removePreZero($dateArr["year"]);
                             eval(MONTH_ARRAY);
                             //$monthArray
                             $this->formArray["cm_month"] = $monthArray[removePreZero($dateArr["month"])];
                             $this->formArray["cm_dayValue"] = removePreZero($dateArr["day"]);
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         $this->formArray[$tdkey] = $tdvalue;
                         //RC 20091007
                         break;
                     case "enteredInRPARForBy":
                         if (is_a($tdvalue, Assessor)) {
                             $this->formArray["enteredInRPARForByID"] = $tdvalue->getAssessorID();
                             $this->formArray["enteredInRPARForByName"] = $tdvalue->getFullName();
                         } else {
                             $this->formArray[$tdkey] = "";
                         }
                         break;
                     case "previousOwner":
                         // RC 20091006 This case allows for extra info
                         $posSlash = strpos($tdvalue, "/");
                         if ($posSlash !== false) {
                             $this->formArray[$tdkey] = substr($tdvalue, 0, $posSlash);
                             $this->formArray["previousOwnerExtra"] = substr($tdvalue, $posSlash + 1);
                         } else {
                             $this->formArray[$tdkey] = $tdvalue;
                         }
                         break;
                     case "cancelsTDNumber":
                         // RC 20091006 allow for extra info
                         $posSlash = strpos($tdvalue, "/");
                         if ($posSlash !== false) {
                             $this->formArray[$tdkey] = substr($tdvalue, 0, $posSlash);
                             $this->formArray["cancelsTDNumberExtra"] = substr($tdvalue, $posSlash + 1);
                         } else {
                             $this->formArray[$tdkey] = $tdvalue;
                         }
                         break;
                     default:
                         $this->formArray[$tdkey] = $tdvalue;
                 }
             }
         }
     }
 }
Example #15
0
 function displayTD($afsID)
 {
     $TDDetails = new SoapObject(NCCBIZ . "TDDetails.php", "urn:Object");
     if (!($xmlStr = $TDDetails->getTDFromAfsID($this->formArray["afsID"]))) {
         // xml failed
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             // error domDoc
         } else {
             $td = new TD();
             $td->parseDomDocument($domDoc);
             $this->formArray["memoranda"] = $td->getMemoranda();
             $this->formArray["taxDeclarationNumber"] = $td->getTaxDeclarationNumber();
             $this->formArray["cancelsTDNumber"] = $td->getCancelsTDNumber();
             $this->formArray["previousOwner"] = $td->getPreviousOwner();
             $this->formArray["previousAssessedValue"] = $td->getPreviousAssessedValue();
         }
     }
 }
Example #16
0
 function setDetails()
 {
     global $sess;
     $this->tpl->set_var($_GET);
     $this->tpl->set_var($_POST);
     # set the RPTOP to get the owner's object and information
     # get it from POST if possible, otherwise from GET
     $rptopID = isset($_POST['rptopID']) ? $_POST['rptopID'] : $_GET['rptopID'];
     $rptop = new RPTOP();
     $rptop->selectRecord($rptopID);
     $dateDue = $rptop->getTaxableYear() . "-01-01";
     # must be a usable format
     $formValues['taxableYear'] = $rptop->getTaxableYear();
     $formValues['rptopNum'] = $rptop->getRptopNumber();
     # set the specific TD (although this is in the RPTOP), hard to search for it.
     # get the tdID from POST or GET to initialize the TD
     $tdID = isset($_POST['tdID']) ? $_POST['tdID'] : $_GET['tdID'];
     $td = new TD();
     $td->selectRecord($tdID);
     $tdNum = $td->getTaxDeclarationNumber();
     $formValues['tdNum'] = $tdNum;
     # we define the property from the TD
     $propertyType = $td->getPropertyType();
     $propertyID = $td->getPropertyID();
     switch ($propertyType) {
         case "Land":
             $property = new Land();
             break;
         case "PlantsTrees":
             $property = new PlantsTrees();
             break;
         case "ImprovementsBuildings":
             $property = new ImprovementsBuildings();
             break;
         case "Machineries":
             $property = new Machineries();
             break;
         default:
             echo "cannot be! {$propertyType}";
             break;
     }
     if (is_object($property)) {
         $property->selectRecord($propertyID);
         $assessedValue = number_format($property->getAssessedValue(), 2, ".", "");
         $formValues['assessedValue'] = number_format($property->getAssessedValue(), 2);
     }
     $formValues['propertyType'] = $propertyType;
     # set the owner's List
     # we define the owner from the RPTOP
     $this->tpl->set_block('step3', 'Owner', 'Owners');
     $owner = $rptop->getOwner();
     $personArray = $owner->getPersonArray();
     if (is_array($personArray)) {
         foreach ($personArray as $person) {
             $ownerValues['ownerName'] = $person->getLastName() . ", " . $person->getFirstName() . " " . $person->getMiddleName();
             $addressArray = $person->getAddressArray();
             $address = $addressArray[0];
             $ownerValues['ownerAddress'] = $address->getNumber() . " " . $address->getStreet() . "<br>" . $address->getBarangay() . ", " . $address->getMunicipalityCity() . "<br>" . $address->getProvince();
             $this->tpl->set_var($ownerValues);
             $this->tpl->parse('Owners', 'Owner', 'true');
         }
     }
     $companyArray = $owner->getCompanyArray();
     if (is_array($companyArray)) {
         foreach ($companyArray as $company) {
             $ownerValues['ownerName'] = $company->getCompanyName();
             $addressArray = $company->getAddressArray();
             $address = $addressArray[0];
             $ownerValues['ownerAddress'] = $address->getNumber() . " " . $address->getStreet() . "<br>" . $address->getBarangay() . ", " . $address->getMunicipalityCity() . "<br> " . $address->getProvince();
             $this->tpl->set_var($ownerValues);
             $this->tpl->parse('Owners', 'Owner', 'true');
         }
     }
     # tax dues are defined from TDNumber and taxableYear
     # compute for taxes
     $taxDue = new Dues();
     if ($taxDue->create($tdNum, $dateDue) == false) {
         $taxDue->setBasic($assessedValue);
         $taxDue->setSEF($assessedValue);
         $taxDue->setDueDate($dateDue);
         $taxDue->setUpdateDate();
     }
     $paymentPeriod = "Annual";
     if (isset($_POST['paymentPeriod'])) {
         $paymentPeriod = $_POST['paymentPeriod'];
     }
     switch ($paymentPeriod) {
         case 'Annual':
             $this->tpl->set_var("checkedAnnual", "checked");
             break;
         case 'Q1':
             $this->tpl->set_var("checkedQ1", "checked");
             break;
         case 'Q2':
             $this->tpl->set_var("checkedQ2", "checked");
             break;
         case 'Q3':
             $this->tpl->set_var("checkedQ3", "checked");
             break;
         case 'Q4':
             $this->tpl->set_var("checkedQ4", "checked");
             break;
         default:
             break;
     }
     $this->tpl->set_var($formValues);
     ## Compute taxes and set the page values
     $basic = $taxDue->getBalanceBasic($paymentPeriod);
     $sef = $taxDue->getBalanceSEF($paymentPeriod);
     $interest = $taxDue->computePenalty($paymentPeriod);
     $taxValues['basic'] = number_format($basic, 2);
     $taxValues['sef'] = number_format($sef, 2);
     $taxValues['pd1185'] = number_format(0.0, 2);
     $taxValues['subTotal'] = number_format($basic + $sef, 2);
     $taxValues['periodTotal'] = number_format($basic + $sef, 2);
     $taxValues['discount'] = "0.0%";
     $taxValues['interest'] = number_format($interest * 100.0, 1) . "%";
     $taxValues['totBasic'] = number_format($basic * (1 + $interest), 2);
     $taxValues['totSEF'] = number_format($sef * (1 + $interest), 2);
     $taxValues['totPD1185'] = number_format(0, 2);
     $taxValues['totSubTotal'] = number_format(($basic + $sef) * (1 + $interest), 2);
     $taxValues['grandTotal'] = number_format(($basic + $sef) * (1 + $interest), 2);
     # further breakdown of basic tax for RPT Receipt
     $taxValues['gf'] = number_format($basic * 0.7, 2);
     // 70% of basic
     $taxValues['ib'] = number_format($basic * 0.15, 2);
     // 15% of basic
     $taxValues['cb'] = number_format($basic * 0.15, 2);
     // 15% of basic for a total if 100%
     $taxValues['totGF'] = number_format($basic * 0.7 * (1 + $interest), 2);
     $taxValues['totIB'] = number_format($basic * 0.15 * (1 + $interest), 2);
     $taxValues['totCB'] = number_format($basic * 0.15 * (1 + $interest), 2);
     $this->tpl->set_var($taxValues);
     if (!isset($_POST['printReceipt_x'])) {
         $this->tpl->set_var("Session", $sess->url(""));
     }
 }
Example #17
0
 function recordReceipt($varValues)
 {
     # create receipt object
     $collections = new Collections();
     # set the details of the receipt
     $collections->setOldReceiptNum($varValues['prevORNum']);
     $collections->setRPTOPNum($varValues['rptopNum']);
     $tdID = $varValues['tdID'];
     $amountPaid = $varValues['amountPaid'];
     $isAmnesty = isset($varValues['amnesty']) ? "Yes" : "No";
     $proceed = true;
     // insert backtaxTD record as a payment
     // and FLAG backtaxTD as PAID!!! ;)
     if ($_POST["backtaxTDCheckbox"]) {
         $backtaxTDID = $_POST['backtaxTDCheckbox'];
         $backtaxTD = new BacktaxTD();
         $backtaxTD->selectRecord("", $backtaxTDID);
         $assessedValue = $backtaxTD->getTotalAssessedValue();
         $paymentPeriod = $_POST['paymentPeriod'];
         $application = $paymentPeriod;
         $penalty = $backtaxTD->getTotalPenalties();
         $totalTaxDue = $backtaxTD->getTotalTaxDue();
         $totalTaxes = $backtaxTD->getTotalTaxes();
         $amountPaid = str_replace(",", "", $amountPaid);
         if ($totalTaxDue > $amountPaid) {
             // payment is partial
             $totalPaid = $backtaxTD->getTotalPaid() + $amountPaid;
             $backtaxTD->setTotalPaid($totalPaid);
             $backtaxTD->updateRecord();
             // FLAG paidStatus as "" (NOT YET FULLY PAID) for backtaxTDRecord
             $backtaxTD->updatePaidStatus("");
             $amountPaid = 0;
         } else {
             if ($totalTaxDue <= $amountPaid) {
                 // payment is full or exceeding full to payoff successive TD's
                 // FLAG paidStatus as PAID for backtaxTDRecord
                 $backtaxTD->updatePaidStatus("PAID");
                 $backtaxTD->setTotalPaid($totalTaxes);
                 $backtaxTD->updateRecord();
                 $amountPaid = $amountPaid - $totalTaxDue;
             }
         }
         //Partial payment handler??
         $basic = $backtaxTD->getTotalBasicTax();
         $sef = $backtaxTD->getTotalSEFTax();
         $idle = $backtaxTD->getTotalIdleTax();
         $discount = 0;
         # record the payments for each receipt
         # recomputed instead of getting values from $_POST
         # used createRecord
         $payments[0] = new Payment("sef");
         $payments[0]->setApplication($application);
         $payments[0]->createRecord("000");
         $payments[0]->setAmount($sef);
         $payments[0]->setDiscount("0");
         $payments[0]->setPenalty("0");
         $payments[0]->setDueID("000");
         $payments[0]->setDueType("backtaxTDID-sef,backtaxTDID=" . $backtaxTD->getBacktaxTDID());
         $payments[0]->setReceiptNum($varValues['receiptNo']);
         $payments[0]->storeRecord();
         $collections->addPayment($payments[0]);
         $payments[1] = new Payment("basic");
         $payments[1]->setApplication($application);
         $payments[1]->createRecord("000");
         $payments[1]->setAmount($basic);
         $payments[1]->setDiscount("0");
         $payments[1]->setPenalty("0");
         $payments[1]->setDueID("000");
         $payments[1]->setDueType("backtaxTD-basic,backtaxTDID=" . $backtaxTD->getBacktaxTDID());
         $payments[1]->setReceiptNum($varValues['receiptNo']);
         $payments[1]->storeRecord();
         $collections->addPayment($payments[1]);
         $payments[2] = new Payment("idle");
         $payments[2]->setApplication($application);
         $payments[2]->createRecord("000");
         $payments[2]->setAmount($idle);
         $payments[2]->setDiscount("0");
         $payments[2]->setPenalty("0");
         $payments[2]->setDueID("000");
         $payments[2]->setDueType("backtaxTD-idle,backtaxTDID=" . $backtaxTD->getBacktaxTDID());
         $payments[2]->setReceiptNum($varValues['receiptNo']);
         $payments[2]->storeRecord();
         $collections->addPayment($payments[2]);
         $payments[3] = new Payment("penalty");
         $payments[3]->setApplication($application);
         $payments[3]->createRecord("0");
         $payments[3]->setAmount($penalty);
         $payments[3]->setDiscount("0");
         $payments[3]->setPenalty("0");
         $payments[3]->setDueID("000");
         $payments[3]->setDueType("backtaxTD-penalty,backtaxTDID=" . $backtaxTD->getBacktaxTDID());
         $payments[3]->setReceiptNum($varValues['receiptNo']);
         $payments[3]->storeRecord();
         $collections->addPayment($payments[3]);
         $payments[4] = new Payment("pd1185");
         $payments[4]->setApplication($application);
         $payments[4]->createRecord("000");
         $payments[4]->setAmount("0");
         $payments[4]->setDiscount("0");
         $payments[4]->setPenalty("0");
         $payments[4]->setDueID("000");
         $payments[4]->setDueType("backtaxTD-pd1185,backtaxTDID=" . $backtaxTD->getBacktaxTDID());
         $payments[4]->setReceiptNum($varValues['receiptNo']);
         $payments[4]->storeRecord();
         $collections->addPayment($payments[4]);
         //$taxDue->reapplyPayments();
         //$taxDue->store();
         //print_r($payments);
         if (!$proceed) {
             break;
         }
     }
     if (is_array($tdID)) {
         foreach ($tdID as $key => $id) {
             $td = new TD();
             $td->selectRecord($id);
             # get assessed value and use it to compute taxes -- 07 Aug 2003
             $propertyType = $td->getPropertyType();
             $propertyID = $td->getPropertyID();
             $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
             $tdNum = $td->getTaxDeclarationNumber();
             $collections->setTDNum($tdNum);
             # get the specific due by using the tdNum and the date on the RPTOP
             $rptop = new RPTOP();
             # changed to taxableYear & selected record using rptopID instead of rptopNum
             if ($rptop->selectRecord($varValues['rptopID'])) {
                 $dueDate = $rptop->getTaxableYear();
             } else {
                 # did not find due date in POST
                 // if there is no valid RPTOP provided, then just use the dueDate
                 $dueDate = $varValues['dueDate'];
             }
             $dueDate = $td->getTaxBeginsWithTheYear();
             $taxDue = new Dues($id, $dueDate);
             /*$taxDue = new Dues();*/
             if (!$taxDue->create($id, $dueDate)) {
                 $taxDue->setBasic($assessedValue);
                 $taxDue->setSEF($assessedValue);
                 # check if land is idle, if yes, set assessed value
                 if ($taxDue->getIdleStatus() == 1) {
                     $taxDue->setIdle($assessedValue);
                     $idleStatus = 1;
                 } else {
                     $taxDue->setIdle(0);
                     $idleStatus = 0;
                 }
             }
             $paymentPeriod = $taxDue->getPaymentMode();
             if ($taxDue->getPctPenalty() > 0 && $paymentPeriod != "Annual") {
                 $paymentPeriod = "Annual";
             }
             $application = $paymentPeriod;
             if ($application == "Quarter") {
                 $application = "Q" . ceil(date("n") / 3);
                 $taxDue->setPaidQuarters(ceil(date("n") / 3));
             }
             #echo("b=$basic<br>s=$sef<br>i=$idle");
             # if amnesty declared, no interest on late payments, set penalty to 0
             if (isset($varValues['amnesty']) || $taxDue->getIsDiscount()) {
                 $taxDue->setAmnesty("Yes");
                 $taxDue->resetPenalty();
                 $interest = 0;
             } else {
                 $taxDue->setAmnesty("No");
                 $interest = $taxDue->getPctPenalty();
             }
             $penalty = $taxDue->getBalancePenalty($paymentPeriod);
             $totalTaxDue = $taxDue->getTotalDue($paymentPeriod);
             //Partial payment handler
             $basic = $taxDue->getBalanceBasic($paymentPeriod);
             $sef = $taxDue->getBalanceSEF($paymentPeriod);
             $idle = $taxDue->getBalanceIdle($paymentPeriod);
             $discount = $taxDue->getDiscount();
             $discountSEF = $taxDue->getIsDiscount() ? $sef * $taxDue->getDiscountPercentage() / 100 : 0;
             $discountBasic = $taxDue->getIsDiscount() ? $basic * $taxDue->getDiscountPercentage() / 100 : 0;
             if (str_replace(",", "", $amountPaid) < $totalTaxDue) {
                 $basic = round(str_replace(",", "", $amountPaid) * (($basic - $discountBasic) / $totalTaxDue), 2);
                 $sef = round(str_replace(",", "", $amountPaid) * (($sef - $discountSEF) / $totalTaxDue), 2);
                 $idle = round(str_replace(",", "", $amountPaid) * ($idle / $totalTaxDue), 2);
                 $penalty = round(str_replace(",", "", $amountPaid) * ($penalty / $totalTaxDue), 2);
                 $proceed = false;
             }
             # record the payments for each receipt
             # recomputed instead of getting values from $_POST
             # used createRecord
             $payments[0] = new Payment("sef");
             $payments[0]->setApplication($application);
             $payments[0]->createRecord($taxDue->getDueID());
             $payments[0]->setAmount($sef);
             $payments[0]->setDiscount($discountSEF);
             $payments[0]->setPenalty($sef * $interest);
             $payments[0]->setDueID($taxDue->getDueID());
             $payments[0]->setDueType("sef");
             $payments[0]->setReceiptNum($varValues['receiptNo']);
             $payments[0]->storeRecord();
             $collections->addPayment($payments[0]);
             # $gfTotal = ($basic*0.7)*(1+interest);
             # $ibTotal = ($basic*0.15)*(1+interest);
             # $cbTotal = ($basic*0.15)*(1+interest);
             $payments[1] = new Payment("basic");
             $payments[1]->setApplication($application);
             $payments[1]->createRecord($taxDue->getDueID());
             $payments[1]->setAmount($basic);
             $payments[1]->setDiscount($discountBasic);
             $payments[1]->setPenalty($basic * $interest);
             $payments[1]->setDueID($taxDue->getDueID());
             $payments[1]->setDueType("basic");
             $payments[1]->setReceiptNum($varValues['receiptNo']);
             $payments[1]->storeRecord();
             $collections->addPayment($payments[1]);
             $payments[2] = new Payment("idle");
             $payments[2]->setApplication($application);
             $payments[2]->createRecord($taxDue->getDueID());
             $payments[2]->setAmount($idle);
             $payments[2]->setDiscount(0);
             $payments[2]->setPenalty($idle * $interest);
             $payments[2]->setDueID($taxDue->getDueID());
             $payments[2]->setDueType("idle");
             $payments[2]->setReceiptNum($varValues['receiptNo']);
             $payments[2]->storeRecord();
             $collections->addPayment($payments[2]);
             $payments[3] = new Payment("penalty");
             $payments[3]->setApplication($application);
             $payments[3]->createRecord($taxDue->getDueID());
             $payments[3]->setAmount($penalty);
             $payments[3]->setDiscount(0);
             $payments[3]->setPenalty(0);
             $payments[3]->setDueID($taxDue->getDueID());
             $payments[3]->setDueType("penalty");
             $payments[3]->setReceiptNum($varValues['receiptNo']);
             $payments[3]->storeRecord();
             $collections->addPayment($payments[3]);
             $payments[4] = new Payment("pd1185");
             $payments[4]->setApplication($application);
             $payments[4]->createRecord($taxDue->getDueID());
             $payments[4]->setAmount(round(0, 2));
             $payments[4]->setDiscount(0);
             $payments[4]->setPenalty(0);
             $payments[4]->setDueID($taxDue->getDueID());
             $payments[4]->setDueType("pd1185");
             $payments[4]->setReceiptNum($varValues['receiptNo']);
             #				print_r($payments);
             $payments[4]->storeRecord();
             $collections->addPayment($payments[4]);
             $taxDue->reapplyPayments();
             $taxDue->store();
             if (!$proceed) {
                 break;
             }
         }
     }
     # end foreach
     //*
     // get parent TD
     //$tdID = $backtaxTD->getTDID();
     //*/
     # set collection details and save to db; no receipt number yet
     # format date to db date YYYY-MM-DD
     list($month, $day, $year) = explode("-", $varValues['checkDate']);
     list($oldReceiptMonth, $oldReceiptDay, $oldReceiptYear) = explode("-", $varValues['prevORDate']);
     $collections->setCollectionDate(date("Y-m-d"));
     $collections->setCollectionSum($varValues['collectionSum']);
     $collections->setReceivedFrom($varValues['receivedFrom']);
     $collections->setKindOfPayment($varValues['kindOfPayment']);
     $collections->setCheckNum($varValues['checkNum']);
     $collections->setCheckDate($year . "-" . $month . "-" . $day);
     $collections->setOldReceiptNum($varValues['prevORNum']);
     $collections->setOldReceiptDate($oldReceiptYear . "-" . $oldReceiptMonth . "-" . $oldReceiptDay);
     $collections->setMunicipality($varValues['municipalityCityID']);
     $collections->setAmnesty($isAmnesty);
     $collections->createRecord();
     $collections->storeRecord();
     # get collection id and use it to close receipt
     $collectionID = $collections->getCollectionID();
     $_POST['collectionID'] = $collectionID;
 }