Exemplo n.º 1
0
 function Main()
 {
     $fp = fopen("batchCalculate.log", "w") or die("Couldn't create new file");
     $rptopID = isset($_POST['rptopID']) ? $_POST['rptopID'] : $_GET['rptopID'];
     if (is_array($rptopID)) {
         foreach ($rptopID as $key => $id) {
             $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
             if (!($xmlStr = $RPTOPDetails->getRPTOP($id))) {
                 exit("xml failed");
             } else {
                 fwrite($fp, "\r\nrptopid: " . $id . "\r\n");
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     echo "error xmlDoc";
                 } else {
                     $rptop = new RPTOP();
                     $td = new TD();
                     $rptop->parseDomDocument($domDoc);
                     foreach ($rptop as $key => $rvalue) {
                         if ($key == "tdArray") {
                             $tdCtr = 0;
                             if (count($rvalue)) {
                                 foreach ($rvalue as $tkey => $tvalue) {
                                     $td->selectRecord($tvalue->getTdID());
                                     $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                     $taxDue = new Dues($tvalue->getTdID(), $rptop->getTaxableYear());
                                     $taxDue->setBasic($assessedValue);
                                     $taxDue->setSEF($assessedValue);
                                     $taxDue->setIdleStatus($idleStatus);
                                     if ($taxDue->getIdleStatus()) {
                                         $taxDue->setIdle($assessedValue);
                                     } else {
                                         $taxDue->setIdle(0);
                                     }
                                     $taxDue->store();
                                     echo $id;
                                     echo "=>";
                                     echo $tvalue->getTdID();
                                     echo "<br>";
                                     fwrite($fp, "TD: " . $tvalue->getTdID() . "...PROCESSED COMPLETE\r\n");
                                     $tdCtr++;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         header("Location: batchCalculateDone.php" . $this->sess->url(""));
         exit;
     }
 }
Exemplo n.º 2
0
 function Main()
 {
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo $xmlStr;
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $td = new TD();
             $rptop->parseDomDocument($domDoc);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityAssessorID", $value->getAssessorID());
                             $this->tpl->set_var("cityAssessorName", $value->getFullName());
                             $this->formArray["cityAssessorName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "cityTreasurer":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityTreasurerID", $value->getAssessorID());
                             $this->tpl->set_var("cityTreasurerName", $value->getFullName());
                             $this->formArray["cityTreasurerName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "tdArray":
                         //$this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         //$this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $tdCtr = 0;
                         //echo("count=".count($value)."<br>");
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             foreach ($value as $tkey => $tvalue) {
                                 $td->selectRecord($tvalue->getTdID());
                                 $assessedValue = number_format($td->getAssessedValue(), 2, ".", "");
                                 $propertyType = $td->getPropertyType();
                                 $afsID = $td->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $PropertyIndexNumber = $afs->getPropertyIndexNumber();
                                 $idleStatus = $td->getIdleStatus();
                                 $formAssessedValue = number_format($td->getAssessedValue(), 2);
                                 if ($propertyType == "Land") {
                                     $formValues['assessedValueLand'] = $formAssessedValue;
                                     $formValues['assessedValueOthers'] = "";
                                 } else {
                                     $formValues['assessedValueLand'] = "";
                                     $formValues['assessedValueOthers'] = $formAssessedValue;
                                 }
                                 $formValues['assessedValue'] = $formAssessedValue;
                                 $formValues['propertyType'] = $propertyType;
                                 $taxDue = new Dues($tvalue->getTdID(), $this->formArray['taxableYear']);
                                 $taxDue->setBasic($assessedValue);
                                 $taxDue->setSEF($assessedValue);
                                 $taxDue->setIdleStatus($idleStatus);
                                 if ($taxDue->getIdleStatus()) {
                                     $taxDue->setIdle($assessedValue);
                                 } else {
                                     $taxDue->setIdle(0);
                                 }
                                 $taxDue->store();
                                 $dueValues['basic'] = number_format($taxDue->getBasic(), 2);
                                 $dueValues['sef'] = number_format($taxDue->getSEF(), 2);
                                 $dueValues['total'] = number_format($taxDue->getBasic() + $taxDue->getSEF(), 2);
                                 $totalValues['totBasic'] += $taxDue->getBasic();
                                 $totalValues['totSEF'] += $taxDue->getSEF();
                                 $totalValues['totTotal'] += $taxDue->getBasic() + $taxDue->getSEF();
                                 $totalValues['totAssessedValue'] += $assessedValue;
                                 $this->tpl->set_var($dueValues);
                                 $tdValues['assessedValue'] = number_format($assessedValue, 2);
                                 $tdValues['tdNumber'] = $tvalue->getTaxDeclarationNumber();
                                 $tdValues['propertyIndexNumber'] = $PropertyIndexNumber;
                                 $this->tpl->set_var($tdValues);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $totalValues['totBasic'] = number_format($totalValues['totBasic'], 2);
     $totalValues['totSEF'] = number_format($totalValues['totSEF'], 2);
     $totalValues['totTotal'] = number_format($totalValues['totTotal'], 2);
     $totalValues['totAssessedValue'] = number_format($totalValues['totAssessedValue'], 2);
     $this->tpl->set_var($totalValues);
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Exemplo n.º 3
0
 function recordReceipt($varValues)
 {
     # create receipt object
     $receipt = new Receipt();
     # set the details of the receipt
     $receipt->setOldReceiptNum($varValues['oldReceiptNum']);
     $receipt->setRPTOPNum($varValues['rptopNum']);
     $receipt->setTDNum($varValues['tdNum']);
     # get the specific due by using the tdNum and the date on the RPTOP
     $taxDue = new Dues();
     $rptop = new RPTOP();
     if ($rptop->selectRecord($varValues['rptopNum'])) {
         $dueDate = $rptop->getRptopDate();
     } else {
         // if there is no valid RPTOP provided, then just use the dueDate
         $dueDate = $varValue['dueDate'];
     }
     $taxDue->createByTDDate($tdNum, $dueDate, true);
     # create by date and true if it exists.
     $taxDue->store();
     # record the payments for each receipt
     $payments[0] = new Payment();
     $payments[0]->setAmount($varValues['sefTotal']);
     $payments[0]->setDueType("sef");
     $payments[0]->setDiscount($varValues['discount']);
     $payments[0]->setInterest($varValues['interest']);
     $payments[0]->setDueID($taxDue->getDueID());
     $payments[0]->setReceiptNum($receipt->getReceiptNum());
     $payments[0]->store();
     $receipt->addPayment($payments[0]);
     $payments[1] = new Payment();
     $payments[1]->setDueType("basic");
     $payments[1]->setAmount($varValues['gfTotal'] + $varValues['ibTotal'] + $varValues['cbTotal']);
     $payments[1]->setDiscount($varValues['discount']);
     $payments[1]->setInterest($varValues['interest']);
     $payments[1]->setDueID($taxDue->getDueID());
     $payments[1]->setReceiptNum($receipt->getReceiptNum());
     $payments[1]->store();
     $receipt->addPayment($payments[1]);
     $payments[2] = new Payment();
     $payments[2]->setDueType("pd1185");
     $payments[2]->setAmount($varValues['pd1185Total']);
     $payments[2]->setDueID($taxDue->getDueID());
     $payments[2]->setReceiptNum($receipt->getReceiptNum());
     $payments[2]->store();
     $receipt->addPayment($payments[2]);
     # store the receipt
     $receipt->store();
 }
Exemplo n.º 4
0
 function Main()
 {
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo $xmlStr;
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityAssessorID", $value->getAssessorID());
                             $this->tpl->set_var("cityAssessorName", $value->getFullName());
                             $this->formArray["cityAssessorName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "cityTreasurer":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityTreasurerID", $value->getAssessorID());
                             $this->tpl->set_var("cityTreasurerName", $value->getFullName());
                             $this->formArray["cityTreasurerName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $tdCtr = 0;
                         $totalBalance = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             foreach ($value as $tkey => $tvalue) {
                                 $propertyType = $tvalue->getPropertyType();
                                 $propertyID = $tvalue->getPropertyID();
                                 switch ($propertyType) {
                                     case "Land":
                                         $land = new Land();
                                         $land->selectRecord($propertyID);
                                         $assessedValue = $land->getAssessedValue();
                                         $propertyIdentityNumber = $land->getPropertyIndexNumber();
                                         break;
                                     case "PlantsTrees":
                                         $plantsTrees = new PlantsTrees();
                                         $plantsTrees->selectRecord($propertyID);
                                         $assessedValue = $plantsTrees->getAssessedValue();
                                         $PropertyIndexNumber = $plantsTrees->getPropertyIndexNumber();
                                         break;
                                     case "ImprovementsBuildings":
                                         $improvementsBuildings = new ImprovementsBuildings();
                                         $improvementsBuildings->selectRecord($propertyID);
                                         $assessedValue = $improvementsBuildings->getAssessedValue();
                                         $PropertyIndexNumber = $improvementsBuildings->getPropertyIndexNumber();
                                         break;
                                     case "Machineries":
                                         $machineries = new Machineries();
                                         $machineries->selectRecord($propertyID);
                                         $assessedValue = $machineries->getAssessedValue();
                                         $PropertyIndexNumber = $machineries->getPropertyIndexNumber();
                                         break;
                                     default:
                                         break;
                                 }
                                 # set or get the due for this TD
                                 $taxDue = new Dues();
                                 $taxDue->create($tvalue->getTaxDeclarationNumber(), "Jan 1, " . $rptop->getRptopdate());
                                 $taxDue->setBasic($assessedValue);
                                 $taxDue->setSEF($assessedValue);
                                 $taxDue->store();
                                 $dueValues['basic'] = number_format($taxDue->getBasic(), 2);
                                 $dueValues['penalty'] = number_format($taxDue->getPenalty(), 2);
                                 $dueValues['sef'] = number_format($taxDue->getSEF(), 2);
                                 $dueValues['total'] = number_format($taxDue->getBasic() + $taxDue->getSEF() + $taxDue->getPenalty(), 2);
                                 $this->tpl->set_var($dueValues);
                                 $paidValues['paidBasic'] = number_format($taxDue->getPaidBasic(), 2);
                                 $paidValues['paidPenalty'] = number_format($taxDue->getPaidPenalty(), 2);
                                 $paidValues['paidSEF'] = number_format($taxDue->getPaidSEF(), 2);
                                 $paidValues['paidTotal'] = number_format($taxDue->getPaidBasic() + $taxDue->getPaidPenalty() + $taxDue->getPaidSEF(), 2);
                                 $this->tpl->set_var($paidValues);
                                 $balance = $taxDue->getBasic() + $taxDue->getSEF() + $taxDue->getPenalty() - ($taxDue->getPaidBasic() + $taxDue->getPaidPenalty() + $taxDue->getPaidSEF());
                                 $totalBalance += $balance;
                                 $this->tpl->set_var(balance, number_format($balance, 2));
                                 $totalValues['totAssessedValue'] += $assessedValue;
                                 $totalValues['totBasic'] += $taxDue->getBasic();
                                 $totalValues['totPenalty'] += $taxDue->getPenalty();
                                 $totalValues['totSEF'] += $taxDue->getSEF();
                                 $totalValues['totTotal'] += $taxDue->getBasic() + $taxDue->getPenalty() + $taxDue->getSEF();
                                 $totalValues['totPaidBasic'] += $taxDue->getPaidBasic();
                                 $totalValues['totPaidPenalty'] += $taxDue->getPaidPenalty();
                                 $totalValues['totPaidSEF'] += $taxDue->getPaidSEF();
                                 $totalValues['totPaidTotal'] += $taxDue->getPaidBasic() + $taxDue->getPaidPenalty() + $taxDue->getPaidSEF();
                                 $tdValues['assessedValue'] = number_format($assessedValue, 2);
                                 $tdValues['tdNumber'] = $tvalue->getTaxDeclarationNumber();
                                 $tdValues['propertyIndexNumber'] = $PropertyIndexNumber;
                                 $this->tpl->set_var($tdValues);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var(totBalance, number_format($totalBalance, 2));
     $this->tpl->set_var(amountDue, number_format($totalValues['totTotal'] - $totalValues['totPaidTotal'], 2));
     $totalValues['totAssessedValue'] = number_format($totalValues['totAssessedValue'], 2);
     $totalValues['totBasic'] = number_format($totalValues['totBasic'], 2);
     $totalValues['totPenalty'] = number_format($totalValues['totPenalty'], 2);
     $totalValues['totSEF'] = number_format($totalValues['totSEF'], 2);
     $totalValues['totTotal'] = number_format($totalValues['totTotal'], 2);
     $totPaidalValues['totPaidBasic'] = number_format($totPaidalValues['totPaidBasic'], 2);
     $totPaidalValues['totPaidPenalty'] = number_format($totPaidalValues['totPaidPenalty'], 2);
     $totPaidalValues['totPaidSEF'] = number_format($totPaidalValues['totPaidSEF'], 2);
     $totPaidalValues['totPaidTotal'] = number_format($totPaidalValues['totPaidTotal'], 2);
     $this->tpl->set_var($totalValues);
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Exemplo n.º 5
0
 function purge()
 {
     $rptsDB = new DB_RPTS();
     $rptsDB2 = new DB_RPTS();
     $sqlselect = "SELECT collectionID FROM collections WHERE receiptNum = '' OR receiptNum is NULL;";
     $rptsDB->query($sqlselect);
     $due = new Dues();
     while ($rptsDB->next_record()) {
         $collectionID = $rptsDB->f("collectionID");
         $this->collectionID = $collectionID;
         $this->isStoredInDatabase = true;
         $sqlselect2 = "select payments.paymentID, payments.dueID from payments \n  \t\t\t\t\t\tinner join collectionPayments on payments.paymentID=collectionPayments.paymentID \n                        where collectionPayments.collectionID ={$collectionID}";
         #echo("$sqlselect2<br>");
         $rptsDB2->query($sqlselect2);
         $payment = new Payment();
         while ($rptsDB2->next_record()) {
             $payment->setPaymentID($rptsDB2->f("paymentID"));
             $payment->selectRecord();
             // if Payment is BacktaxTD, FLAG BacktaxTD paidStatus as '' for false / UNPAID
             if ($strstr = strstr($payment->dueType, ",")) {
                 $backtaxTDID = strstr($strstr, "=");
                 $backtaxTDID = str_replace("=", "", $backtaxTDID);
                 $backtaxTD = new BacktaxTD();
                 $backtaxTD->selectRecord("", $backtaxTDID);
                 $backtaxTD->setBacktaxTDID($backtaxTDID);
                 $backtaxTD->setTotalPaid(0);
                 $backtaxTD->updatePaidStatus("");
                 $backtaxTD->updateRecord();
             }
             $dueID = $rptsDB2->f("dueID");
             $due->setDueID($dueID);
             $due->select();
             $due->resetPayments();
             $due->store();
         }
         if (!$this->deleteRecord()) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
0
 function Main()
 {
     global $sess;
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo $xmlStr;
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "taxableYear":
                         $this->tpl->set_var("taxableYear", $value);
                         $dueDate = $value;
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $this->tpl->set_block("rptsTemplate", "JSTDList", "JSTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "BacktaxTDTable", "BacktaxTDTableBlock");
                         $this->unpaidTDCount = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             foreach ($value as $tkey => $tvalue) {
                                 $propertyType = $tvalue->getPropertyType();
                                 $propertyID = $tvalue->getPropertyID();
                                 $afsID = $tvalue->getAfsID();
                                 $afs = new AFS();
                                 $afs->selectRecord($afsID);
                                 $listValues['propertyIndexNumber'] = $afs->getPropertyIndexNumber();
                                 $assessedValue = $tvalue->getAssessedValue();
                                 #echo("assessedValue=$assessedValue<br7>");
                                 $listValues['taxBeginsWithTheYear'] = $tvalue->getTaxBeginsWithTheYear();
                                 $listValues['tdNum'] = $tvalue->getTaxDeclarationNumber();
                                 $tdID = $tvalue->getTdID();
                                 $listValues['tdID'] = $tdID;
                                 #echo("tdID=$tdID, dueDate=$dueDate<br>");
                                 $dues = new Dues($tdID, $dueDate);
                                 if (!$dues->create($tdID, $dueDate, $assessedValue)) {
                                     $dues->setBasic($assessedValue);
                                     $dues->setSEF($assessedValue);
                                     # check if land is idle, if yes, set assessed value
                                     # getIdleStatus -- temporary function
                                     if ($dues->getIdleStatus() == 1) {
                                         #echo("idle<br>");
                                         $dues->setIdle($assessedValue);
                                     }
                                 }
                                 // Refresh for amnesty and paymentPeriod
                                 if ($this->formArray["formAction"] == "refresh") {
                                     $amnesty = $this->formArray[amnesty];
                                     $dues->setAmnesty($amnesty);
                                     $paymentPeriod = $this->formArray[paymentPeriod];
                                     $dues->setPaymentMode($paymentPeriod);
                                 }
                                 if ($dues->getAmnesty() == "Yes") {
                                     $dues->resetPenalty();
                                     $dues->computePenalty($paymentPeriod, "now");
                                 }
                                 $paymentPeriod = $dues->getPaymentMode();
                                 $amnesty = $dues->getAmnesty();
                                 $dues->store();
                                 switch ($paymentPeriod) {
                                     case 'Quarter':
                                         $this->tpl->set_var("selectedQuarter", "selected");
                                         $this->tpl->set_var("paymentPeriod", $paymentPeriod);
                                         $this->tpl->set_var("installmentNumber", ceil(date("n") / 3));
                                         $this->tpl->set_var("netDueFullAmount", number_format($dues->getTotalDue("Annual"), 2));
                                         break;
                                     default:
                                         #Annual
                                         $this->tpl->set_block("rptsTemplate", "QuarterNetDue", "QuarterNetDueBlock");
                                         $this->tpl->set_var("QuarterNetDueBlock", "");
                                         $this->tpl->set_var("selectedAnnual", "selected");
                                         $this->tpl->set_var("paymentPeriod", $paymentPeriod);
                                         break;
                                 }
                                 //$totalDue = $dues->getTotalDue($paymentPeriod);
                                 $totalDue = $dues->getTotalDue($paymentPeriod);
                                 $basic = $dues->getBasic($paymentPeriod);
                                 $sef = $dues->getSEF($paymentPeriod);
                                 $penalty = $dues->getPenalty($paymentPeriod);
                                 $discount = $dues->getDiscount();
                                 $totalPaid = $dues->getPaidBasic($paymentPeriod) + $dues->getPaidPenalty($paymentPeriod) + $dues->getPaidSEF($paymentPeriod);
                                 $listValues['taxDue'] = $totalDue;
                                 $listValues['basic'] = number_format($basic, 2);
                                 $listValues['sef'] = number_format($sef, 2);
                                 $listValues['penalty'] = number_format($penalty, 2);
                                 $listValues['discount'] = number_format($discount, 2);
                                 $listValues['totalPaid'] = number_format($totalPaid, 2);
                                 $listValues['strTaxDue'] = number_format($totalDue, 2);
                                 //$basic = $dues->getBasic($paymentPeriod);
                                 #echo("basic=$basic<br>");
                                 //$sef = $dues->getSEF($paymentPeriod);
                                 #echo("sef=$sef<br>");
                                 if (!$this->isPriorTDPaid($tdID)) {
                                     $backtaxes = true;
                                     $paidStatus = "<input type=\"checkbox\" name=\"tdID[" . $tdID . "]\" value=\"" . $tdID . "\" onclick=\"javascript: toggle(this, '" . $tdID . "'); updateTotalTaxDue(this," . $tdID . ");\" disabled>";
                                 } else {
                                     $backtaxes = false;
                                     $paidStatus = $totalDue <= 0 ? $basic <= 0 ? "N.A." : "PAID" : "<input type=\"checkbox\" name=\"tdID[" . $tdID . "]\" value=\"" . $tdID . "\" onclick=\"javascript: toggle(this, '" . $tdID . "'); updateTotalTaxDue(this," . $tdID . ");\">";
                                 }
                                 $listValues['paidStatus'] = $paidStatus;
                                 $listValues['tdBgcolor'] = '#f6f6f6';
                                 $this->tpl->set_var($listValues);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 if ($backtaxes) {
                                     $oldestUnpaidTD = $this->unpaidTDArray[count($this->unpaidTDArray) - 1];
                                     $this->displayBacktaxTD($oldestUnpaidTD->getTdID());
                                     $this->displayPriorTDs($tdID);
                                     unset($this->unpaidTDArray);
                                 } else {
                                     $this->displayBacktaxTD($tdID);
                                     $this->tpl->set_var("JSTDListBlock", "");
                                 }
                                 //$this->tpl->parse("BacktaxTDTableBlock", "BacktaxTDTable", true);
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "CheckAll", "CheckAllBlock");
                             $this->tpl->set_var("CheckAllBlock", "");
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("rptopID", $rptopID);
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $this->tpl->set_var(amnestyChecked, $amnesty == "Yes" ? " checked" : "");
     $this->tpl->set_var("Session", $sess->url("") . $sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }