function getDue($dueID) { $due = new Due(); $due->selectRecord($dueID); if (!($domDoc = $due->getDomDocument())) { return false; } else { $xmlStr = $domDoc->dump_mem(true); return $xmlStr; } }
function Main() { $eRPTSSettings = new eRPTSSettings(); if ($eRPTSSettings->selectRecord(1)) { $this->tpl->set_var("lguType", strtoupper($eRPTSSettings->getLguType())); $this->tpl->set_var("lguName", strtoupper($eRPTSSettings->getLguName())); } $dbTD = new DB_RPTS(); $dbBacktaxTD = new DB_RPTS(); $dbPaymentBacktaxTD = new DB_RPTS(); $dbPaymentTD = new DB_RPTS(); $dbCollectionBacktaxTD = new DB_RPTS(); $dbCollectionTD = new DB_RPTS(); $dbDue = new DB_RPTS(); // gather TD's $sql = "SELECT Due.dueID as dueID, " . "Due.tdID as tdID, " . "Due.dueType as dueType, " . "Due.dueDate as dueDate, " . "Due.basicTax as basicTax, " . "Due.basicTaxRate as basicTaxRate, " . "Due.sefTax as sefTax, " . "Due.sefTaxRate as sefTaxRate, " . "Due.idleTax as idleTax, " . "Due.idleTaxRate as idleTaxRate, " . "TD.afsID as afsID, " . "TD.propertyType as propertyType, " . "TD.taxDeclarationNumber as taxDeclarationNumber, " . "AFS.odID as odID, " . "AFS.arpNumber as arpNumber, " . "AFS.propertyIndexNumber as propertyIndexNumber, " . "AFS.taxability as taxability, " . "AFS.effectivity as effectivity, " . "AFS.totalMarketValue as totalMarketValue, " . "AFS.totalAssessedValue as totalAssessedValue " . "FROM Due, TD, AFS " . "WHERE Due.tdID = TD.tdID " . "AND TD.afsID = AFS.afsID " . "AND AFS.archive != 'true' " . "AND TD.archive != 'true' " . "AND Due.dueType = 'Annual' " . "AND TD.propertyType LIKE '" . $this->formArray["classification"] . "' " . "GROUP BY Due.tdID, YEAR(Due.dueDate) " . "ORDER BY Due.dueDate DESC"; $dbTD->query($sql); if ($dbTD->nf() > 0) { // gather BacktaxTD's while ($dbTD->next_record()) { $sqlBacktaxTD = "SELECT backtaxTDID, " . "tdID, " . "tdNumber, " . "startYear, " . "endYear, " . "startQuarter, " . "assessedValue, " . "basicRate, " . "sefRate, " . "basicTax, " . "sefTax, " . "idleTax, " . "penalties, " . "paid, " . "balance, " . "total " . "FROM BacktaxTD " . "WHERE tdID='" . $dbTD->f("tdID") . "' " . "ORDER BY startYear ASC "; $dbBacktaxTD->query($sqlBacktaxTD); if ($dbBacktaxTD->nf() > 0) { while ($dbBacktaxTD->next_record()) { $backtaxTDRecordArray[] = $dbBacktaxTD->Record; } } $tdRecordArray[] = array("td" => $dbTD->Record, "backtaxTD" => $backtaxTDRecordArray); unset($backtaxTDRecordArray); } } if (is_array($tdRecordArray)) { foreach ($tdRecordArray as $recordArray) { // gather backtaxTD details if (is_array($recordArray["backtaxTD"])) { foreach ($recordArray["backtaxTD"] as $backtaxTDRecord) { $paidBasic = 0; $paidSEF = 0; $paidPenalty = 0; $totalTaxCollected = 0; $basic = 0; $sef = 0; $penalty = 0; $totalCollectible = 0; // get totalTaxCollected $sqlPaymentBacktaxTD = "SELECT paymentID, " . "dueType, " . "backtaxTDID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE backtaxTDID='" . $backtaxTDRecord["backtaxTDID"] . "' " . "AND status!='cancelled'"; $dbPaymentBacktaxTD->query($sqlPaymentBacktaxTD); if ($dbPaymentBacktaxTD->nf() > 0) { while ($dbPaymentBacktaxTD->next_record()) { $sqlCollectionBacktaxTD = "SELECT * " . "FROM Collection " . "WHERE paymentID='" . $dbPaymentBacktaxTD->f("paymentID") . "' " . "AND status!='cancelled' "; $dbCollectionBacktaxTD->query($sqlCollectionBacktaxTD); if ($dbCollectionBacktaxTD->nf() > 0) { while ($dbCollectionBacktaxTD->next_record()) { switch ($dbCollectionBacktaxTD->f("taxType")) { case "basic": if ($dbCollectionBacktaxTD->f("amnesty") != "true") { $paidBasic += $dbCollectionBacktaxTD->f("amountPaid") - $dbCollectionBacktaxTD->f("penalty"); $paidPenalty += $dbCollectionBacktaxTD->f("penalty"); $totalTaxCollected += $dbCollectionBacktaxTD->f("amountPaid"); } else { $paidBasic += $dbCollectionBacktaxTD->f("amountPaid"); $totalTaxCollected += $paidBasic; } break; case "sef": if ($dbCollectionBacktaxTD->f("amnesty") != "true") { $paidSEF += $dbCollectionBacktaxTD->f("amountPaid") - $dbCollectionBacktaxTD->f("penalty"); $paidPenalty += $dbCollectionBacktaxTD->f("penalty"); $totalTaxCollected += $dbCollectionBacktaxTD->f("amountPaid"); } else { $paidSEF += $dbCollectionBacktaxTD->f("amountPaid"); $totalTaxCollected += $paidSEF; } break; } } } } } // get totalCollectible $basic = $backtaxTDRecord["basicTax"]; $sef = $backtaxTDRecord["sefTax"]; $backtaxTD = new BacktaxTD(); $backtaxTD->selectRecord("", $backtaxTDRecord["backtaxTDID"], ""); $backtaxTD->calculatePenalty(date("Y-m-d")); $penalty = $backtaxTD->getPenalties(); $totalCollectible = $basic + $sef + $penalty; $lineRecordArray[] = array("propertyIndexNumber" => "TD#:" . $backtaxTDRecord["tdNumber"] . " (" . $backtaxTDRecord["startYear"] . ")", "tdNumber" => $backtaxTDRecord["tdNumber"], "paidBasic" => $paidBasic, "paidSEF" => $paidSEF, "paidPenalty" => $paidPenalty, "totalTaxCollected" => $totalTaxCollected, "basic" => $basic, "sef" => $sef, "penalty" => $penalty, "totalCollectible" => $totalCollectible); } } $paidBasic = 0; $paidSEF = 0; $paidPenalty = 0; $totalTaxCollected = 0; $basic = 0; $sef = 0; $penalty = 0; $totalCollectible = 0; // gather TD details if (is_array($recordArray["td"])) { $tdRecord = $recordArray["td"]; // get totalTaxCollected $sqlPaymentTD = "SELECT paymentID, " . "dueType, " . "backtaxTDID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE tdID='" . $tdRecord["tdID"] . "' " . "AND status!='cancelled'"; $dbPaymentTD->query($sqlPaymentTD); if ($dbPaymentTD->nf() > 0) { while ($dbPaymentTD->next_record()) { $sqlCollectionTD = "SELECT * " . "FROM Collection " . "WHERE paymentID='" . $dbPaymentTD->f("paymentID") . "' " . "AND status!='cancelled' "; $dbCollectionTD->query($sqlCollectionTD); if ($dbCollectionTD->nf() > 0) { while ($dbCollectionTD->next_record()) { switch ($dbCollectionTD->f("taxType")) { case "basic": if ($dbCollectionTD->f("amnesty") != "true") { $paidBasic += $dbCollectionTD->f("amountPaid") - $dbCollectionTD->f("penalty"); $paidPenalty += $dbCollectionTD->f("penalty"); $totalTaxCollected += $dbCollectionTD->f("amountPaid"); } else { $paidBasic += $dbCollectionTD->f("amountPaid"); $totalTaxCollected += $paidBasic; } break; case "sef": if ($dbCollectionTD->f("amnesty") != "true") { $paidSEF += $dbCollectionTD->f("amountPaid") - $dbCollectionTD->f("penalty"); $paidPenalty += $dbCollectionTD->f("penalty"); $totalTaxCollected += $dbCollectionTD->f("amountPaid"); } else { $paidSEF += $dbCollectionTD->f("amountPaid"); $totalTaxCollected += $paidSEF; } break; } } } } } // get totalCollectible $due = new Due(); if ($due->selectRecord($tdRecord["dueID"])) { $basic = $due->getBasicTax(); $sef = $due->getSefTax(); $due = $this->computePenalty(date("Y-m-d"), $due); $penalty = $due->getPenalty(); $totalCollectible = $basic + $sef + $penalty; } $lineRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "tdNumber" => $tdRecord["taxDeclarationNumber"], "paidBasic" => $paidBasic, "paidSEF" => $paidSEF, "paidPenalty" => $paidPenalty, "totalTaxCollected" => $totalTaxCollected, "basic" => $basic, "sef" => $sef, "penalty" => $penalty, "totalCollectible" => $totalCollectible); } } } // print page if (is_array($lineRecordArray)) { $ypos = 400; $decrementYposBy = 12; $linesPerPage = 20; $count = count($lineRecordArray); $numOfPages = ceil($count / $linesPerPage); $pageCtr = 1; $lineCtr = 1; $recordCtr = 1; $this->tpl->set_var("classification", $this->formArray["classification"]); $this->tpl->set_var("numOfPages", $numOfPages); $this->tpl->set_block("rptsTemplate", "Page", "PageBlock"); $this->tpl->set_block("Page", "Row", "RowBlock"); $this->tpl->set_block("Page", "Totals", "TotalsBlock"); $totalsArray = array("totalPaidBasic" => 0, "totalPaidSEF" => 0, "totalPaidPenalty" => 0, "totalTotalTaxCollected" => 0, "totalBasic" => 0, "totalSef" => 0, "totalPenalty" => 0, "totalTotalCollectible" => 0); foreach ($lineRecordArray as $recordArray) { $this->tpl->set_var("ypos", $ypos); $this->tpl->set_var("recordCtr", $recordCtr); // tally totals $totalsArray["totalPaidBasic"] += un_number_format($recordArray["paidBasic"]); $totalsArray["totalPaidSEF"] += un_number_format($recordArray["paidSEF"]); $totalsArray["totalPaidPenalty"] += un_number_format($recordArray["paidPenalty"]); $totalsArray["totalTotalTaxCollected"] += un_number_format($recordArray["totalTaxCollected"]); $totalsArray["totalBasic"] += un_number_format($recordArray["basic"]); $totalsArray["totalSef"] += un_number_format($recordArray["sef"]); $totalsArray["totalPenalty"] += un_number_format($recordArray["penalty"]); $totalsArray["totalTotalCollectible"] += un_number_format($recordArray["totalCollectible"]); // write values foreach ($recordArray as $key => $value) { switch ($key) { case "paidBasic": case "paidSEF": case "paidPenalty": case "totalTaxCollected": case "basic": case "sef": case "penalty": case "totalCollectible": $value = formatCurrency($value); break; } $this->tpl->set_var($key, $value); } $this->tpl->parse("RowBlock", "Row", true); if ($recordCtr == count($lineRecordArray) || $lineCtr == $linesPerPage) { if ($pageCtr == $numOfPages) { foreach ($totalsArray as $key => $value) { $value = formatCurrency($value); $this->tpl->set_var($key, $value); } $this->tpl->parse("TotalsBlock", "Totals", true); } else { $this->tpl->set_var("TotalsBlock", ""); } $this->tpl->set_var("page", $pageCtr); $this->tpl->parse("PageBlock", "Page", true); $this->tpl->set_var("RowBlock", ""); $this->tpl->set_var("TotalsBlock", ""); $ypos = 400; $lineCtr = 0; $pageCtr++; } $lineCtr++; $recordCtr++; $ypos = $ypos - $decrementYposBy; } $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $testpdf = new PDFWriter(); $testpdf->setOutputXML($this->tpl->get("templatePage"), "test"); if (isset($this->formArray["print"])) { $testpdf->writePDF($name); //,$this->formArray["print"]); } else { $testpdf->writePDF($name); } } else { exit("no records to display"); } }
function getCollectionTargetsForCurrentQuarter($year) { $conditionQuarterEndingDate = date("Y-m-d", strtotime($this->formArray["quarterEndingDate"] . " " . $year)); $conditionQuarterBeginningDate = date("Y-m-d", strtotime($this->formArray["quarterBeginningDate"] . " " . $year)); $sql = "SELECT * FROM " . DUE_TABLE . " WHERE dueDate >= '" . $conditionQuarterBeginningDate . "' AND dueDate <= '" . $conditionQuarterEndingDate . "';"; $db = new DB_RPTS(); $db->query($sql); $dueRecords = new DueRecords(); $dueRecords = new DueRecords(); while ($db->next_record()) { $due = new Due(); $due->selectRecord($db->f("dueID")); $dueRecords->arrayList[] = $due; } if (is_array($dueRecords->arrayList)) { foreach ($dueRecords->arrayList as $due) { if ($due->getDueType() != "Q1") { $this->formArray["basic"] += $due->getBasicTax(); $this->formArray["sef"] += $due->getSefTax(); $this->formArray["idle"] += $due->getIdleTax(); } } } }
function Main() { $eRPTSSettings = new eRPTSSettings(); if ($eRPTSSettings->selectRecord(1)) { $this->tpl->set_var("lguType", strtoupper($eRPTSSettings->getLguType())); $this->tpl->set_var("lguName", strtoupper($eRPTSSettings->getLguName())); } $dbTD = new DB_RPTS(); $dbBacktaxTD = new DB_RPTS(); $dbPaymentBacktaxTD = new DB_RPTS(); $dbPaymentTD = new DB_RPTS(); $dbDues = new DB_RPTS(); // gather TD's $sql = "SELECT Due.dueID as dueID, " . "Due.tdID as tdID, " . "Due.dueType as dueType, " . "Due.dueDate as dueDate, " . "Due.basicTax as basicTax, " . "Due.basicTaxRate as basicTaxRate, " . "Due.sefTax as sefTax, " . "Due.sefTaxRate as sefTaxRate, " . "Due.idleTax as idleTax, " . "Due.idleTaxRate as idleTaxRate, " . "TD.afsID as afsID, " . "TD.propertyType as propertyType, " . "TD.taxDeclarationNumber as taxDeclarationNumber, " . "AFS.odID as odID, " . "AFS.arpNumber as arpNumber, " . "AFS.propertyIndexNumber as propertyIndexNumber, " . "AFS.taxability as taxability, " . "AFS.effectivity as effectivity, " . "AFS.totalMarketValue as totalMarketValue, " . "AFS.totalAssessedValue as totalAssessedValue " . "FROM Due, TD, AFS " . "WHERE Due.tdID = TD.tdID " . "AND TD.afsID = AFS.afsID " . "AND AFS.archive != 'true' " . "AND TD.archive != 'true' " . "AND Due.dueType = 'Annual' " . "AND YEAR(Due.dueDate) <= YEAR(NOW()) " . "AND TD.propertyType LIKE '" . $this->formArray["classification"] . "' " . "GROUP BY Due.tdID, YEAR(Due.dueDate) " . "ORDER BY Due.dueDate DESC"; $dbTD->query($sql); if ($dbTD->nf() > 0) { // gather BacktaxTD's while ($dbTD->next_record()) { $sqlBacktaxTD = "SELECT backtaxTDID, " . "tdID, " . "tdNumber, " . "startYear, " . "endYear, " . "startQuarter, " . "assessedValue, " . "basicRate, " . "sefRate, " . "basicTax, " . "sefTax, " . "idleTax, " . "penalties, " . "paid, " . "balance, " . "total " . "FROM BacktaxTD " . "WHERE tdID='" . $dbTD->f("tdID") . "' " . "ORDER BY startYear ASC "; $dbBacktaxTD->query($sqlBacktaxTD); if ($dbBacktaxTD->nf() > 0) { while ($dbBacktaxTD->next_record()) { $backtaxTDRecordArray[] = $dbBacktaxTD->Record; } } $tdRecordArray[] = array("td" => $dbTD->Record, "backtaxTD" => $backtaxTDRecordArray); unset($backtaxTDRecordArray); } } if (is_array($tdRecordArray)) { // verify whether each TD Record or BacktaxTD Record is delinquent by comparing it to Payment // if it is not in Payment it is considered delinquent // if amountPaid is insufficient to amountDue, it is considered delinquent foreach ($tdRecordArray as $recordArray) { $basicAmountDelinquent = 0; $sefAmountDelinquent = 0; $penalty = 0; $totalDelinquent = 0; // find delinquent backtaxTD's if (is_array($recordArray["backtaxTD"])) { foreach ($recordArray["backtaxTD"] as $backtaxTDRecord) { $basicAmountDelinquent = 0; $sefAmountDelinquent = 0; $penalty = 0; $totalDelinquent = 0; $sqlPaymentBacktaxTD = "SELECT paymentID, " . "dueType, " . "backtaxTDID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE backtaxTDID='" . $backtaxTDRecord["backtaxTDID"] . "' " . "AND status!='cancelled'"; $dbPaymentBacktaxTD->query($sqlPaymentBacktaxTD); if ($dbPaymentBacktaxTD->nf() > 0) { if ($dbPaymentBacktaxTD->next_record()) { // if amountPaid is less than balanceDue, it is delinquent if ($dbPaymentBacktaxTD->f("amountPaid") < $dbPaymentBacktaxTD->f("balanceDue")) { $paidBasic = $backtaxTDRecord["basicRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $dbPaymentBacktaxTD->f("amountPaid"); $paidSef = $backtaxTDRecord["sefRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $dbPaymentBacktaxTD->f("amountPaid"); $basicAmountDelinquent = $backtaxTDRecord["basicTax"] - $paidBasic; $sefAmountDelinquent = $backtaxTDRecord["sefTax"] - $paidSef; $backtaxTD = new BacktaxTD(); $backtaxTD->selectRecord("", $backtaxTDRecord["backtaxTDID"], ""); $backtaxTD->calculatePenalty(date("Y-m-d")); $penalty = $backtaxTD->getPenalties(); $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty; $delinquentRecordArray[] = array("propertyIndexNumber" => "", "taxDeclarationNumber" => $backtaxTDRecord["tdNumber"], "yearDelinquent" => $backtaxTDRecord["startYear"], "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent); } } } else { $paidBasic = $backtaxTDRecord["basicRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $backtaxTDRecord["paid"]; $paidSef = $backtaxTDRecord["sefRate"] / ($backtaxTDRecord["basicRate"] + $backtaxTDRecord["sefRate"]) * $backtaxTDRecord["paid"]; $basicAmountDelinquent = $backtaxTDRecord["basicTax"] - $paidBasic; $sefAmountDelinquent = $backtaxTDRecord["sefTax"] - $paidSef; $backtaxTD = new BacktaxTD(); $backtaxTD->selectRecord("", $backtaxTDRecord["backtaxTDID"], ""); $backtaxTD->calculatePenalty(date("Y-m-d")); $penalty = $backtaxTD->getPenalties(); $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty; $delinquentRecordArray[] = array("propertyIndexNumber" => "", "taxDeclarationNumber" => $backtaxTDRecord["tdNumber"], "yearDelinquent" => $backtaxTDRecord["startYear"], "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent); } } } // find delinquent TD's if (is_array($recordArray["td"])) { $tdRecord = $recordArray["td"]; $basicAmountDelinquent = 0; $sefAmountDelinquent = 0; $penalty = 0; $totalDelinquent = 0; $sqlPaymentTD = "SELECT paymentID, " . "dueID, " . "dueType, " . "tdID, " . "taxDue, " . "earlyPaymentDiscount, " . "advancedPaymentDiscount, " . "penalty, " . "amnesty, " . "balanceDue, " . "amountPaid, " . "dueDate, " . "paymentDate " . "FROM Payment " . "WHERE tdID='" . $tdRecord["tdID"] . "' " . "AND status!='cancelled'"; $dbPaymentTD->query($sqlPaymentTD); if ($dbPaymentTD->nf() > 0) { while ($dbPaymentTD->next_record()) { if ($dbPaymentTD->f("dueType") == "Annual") { if ($dbPaymentTD->f("amountPaid") < $dbPaymentTD->f("balanceDue")) { $paidBasic = $tdRecord["basicRate"] / ($tdRecord["basicRate"] + $tdRecord["sefRate"]) * $dbPaymentTD->f("amountPaid"); $paidSef = $tdRecord["sefRate"] / ($tdRecord["basicRate"] + $tdRecord["sefRate"]) * $dbPaymentTD->f("amountPaid"); $basicAmountDelinquent = $tdRecord["basicTax"] - $paidBasic; $sefAmountDelinquent = $tdRecord["sefTax"] - $paidSef; $due = new Due(); $due->selectRecord($tdRecord["dueID"]); $due = $this->computePenalty(date("Y-m-d"), $due); $penalty = $due->getPenalty(); $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty; $delinquentRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "taxDeclarationNumber" => $tdRecord["taxDeclarationNumber"], "yearDelinquent" => date("Y", strtotime($tdRecord["dueDate"])), "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent); } break; } else { $tmpPaidQuarterDues[] = $dbPaymentTD->f("dueID"); } } if (is_array($tmpPaidQuarterDues)) { // not all quarters have been paid if less than four if (count($tmpPaidQuarterDues) < 4) { foreach ($tmpPaidQuarterDues as $dueID) { $sqlDueCondition .= " AND Due.dueID!='" . $dueID . "' "; } // grab unpaid quarterly dues that have not been paid before quarterly dueDate $sqlDues = "SELECT Due.dueID as dueID, " . "Due.dueType as dueType, " . "Due.tdID as tdID " . "FROM Due, TD, AFS " . "WHERE TD.afsID = AFS.afsID " . "AND AFS.archive != 'true' " . "AND TD.archive != 'true' " . "AND Due.dueType != 'Annual' " . "AND Due.tdID = '" . $tdRecord["tdID"] . "'" . "AND TD.propertyType LIKE '" . $this->formArray["classification"] . "' " . "AND YEAR(Due.dueDate) <= " . date("Y", strtotime($tdRecord["dueDate"])) . " " . "AND Due.dueDate <= '" . date("Y-m-d") . "' " . $sqlDueCondition . " " . "GROUP BY Due.tdID, Due.dueDate " . "ORDER BY Due.dueDate DESC"; $dbDues->query($sqlDues); while ($dbDues->next_record()) { $due = new Due(); $due->selectRecord($dbDues->f("dueID")); $basicAmountDelinquent += $due->getBasicTax(); $sefAmountDelinquent += $due->getSefTax(); $due = $this->computePenalty(date("Y-m-d"), $due); $penalty += $due->getPenalty(); } $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty; $delinquentRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "taxDeclarationNumber" => $tdRecord["taxDeclarationNumber"], "yearDelinquent" => date("Y", strtotime($tdRecord["dueDate"])), "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent); } unset($sqlDueCondition); unset($tmpPaidQuarterDues); } } else { $basicAmountDelinquent = $tdRecord["basicTax"]; $sefAmountDelinquent = $tdRecord["sefTax"]; $due = new Due(); $due->selectRecord($tdRecord["dueID"]); $due = $this->computePenalty(date("Y-m-d"), $due); $penalty = $due->getPenalty(); $totalDelinquent = $basicAmountDelinquent + $sefAmountDelinquent + $penalty; $delinquentRecordArray[] = array("propertyIndexNumber" => $tdRecord["propertyIndexNumber"], "taxDeclarationNumber" => $tdRecord["taxDeclarationNumber"], "yearDelinquent" => date("Y", strtotime($tdRecord["dueDate"])), "basicAmountDelinquent" => $basicAmountDelinquent, "sefAmountDelinquent" => $sefAmountDelinquent, "penalty" => $penalty, "totalDelinquent" => $totalDelinquent); } } } } // print page if (is_array($delinquentRecordArray)) { $ypos = 615; $decrementYposBy = 12; $linesPerPage = 42; $count = count($delinquentRecordArray); $numOfPages = ceil($count / $linesPerPage); $pageCtr = 1; $lineCtr = 1; $recordCtr = 1; $this->tpl->set_var("classification", $this->formArray["classification"]); $this->tpl->set_var("numOfPages", $numOfPages); $this->tpl->set_block("rptsTemplate", "Page", "PageBlock"); $this->tpl->set_block("Page", "Row", "RowBlock"); $this->tpl->set_block("Page", "Totals", "TotalsBlock"); $totalsArray = array("totalBasicAmountDelinquent" => 0, "totalSefAmountDelinquent" => 0, "totalPenalty" => 0, "totalTotalDelinquent" => 0); foreach ($delinquentRecordArray as $recordArray) { $this->tpl->set_var("ypos", $ypos); $this->tpl->set_var("recordCtr", $recordCtr); // write values $totalsArray["totalBasicAmountDelinquent"] += un_number_format($recordArray["basicAmountDelinquent"]); $totalsArray["totalSefAmountDelinquent"] += un_number_format($recordArray["sefAmountDelinquent"]); $totalsArray["totalPenalty"] += un_number_format($recordArray["penalty"]); $totalsArray["totalTotalDelinquent"] += un_number_format($recordArray["totalDelinquent"]); foreach ($recordArray as $key => $value) { switch ($key) { case "basicAmountDelinquent": case "sefAmountDelinquent": case "penalty": case "totalDelinquent": $value = formatCurrency($value); break; } $this->tpl->set_var($key, $value); } $this->tpl->parse("RowBlock", "Row", true); if ($recordCtr == count($delinquentRecordArray) || $lineCtr == $linesPerPage) { if ($pageCtr == $numOfPages) { foreach ($totalsArray as $key => $value) { $value = formatCurrency($value); $this->tpl->set_var($key, $value); } $this->tpl->parse("TotalsBlock", "Totals", true); } else { $this->tpl->set_var("TotalsBlock", ""); } $this->tpl->set_var("page", $pageCtr); $this->tpl->parse("PageBlock", "Page", true); $this->tpl->set_var("RowBlock", ""); $this->tpl->set_var("TotalsBlock", ""); $ypos = 615; $lineCtr = 0; $pageCtr++; } $lineCtr++; $recordCtr++; $ypos = $ypos - $decrementYposBy; } $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $testpdf = new PDFWriter(); $testpdf->setOutputXML($this->tpl->get("templatePage"), "test"); if (isset($this->formArray["print"])) { $testpdf->writePDF($name); //,$this->formArray["print"]); } else { $testpdf->writePDF($name); } } else { exit("no delinquent collectible records to display"); } }
function selectRecords($tdID = "", $taxableYear = "", $condition = "") { if ($tdID != "") { $condition = "WHERE tdID='" . $tdID . "' AND dueDate LIKE '" . $taxableYear . "%'"; } $sql = sprintf("select * from %s %s;", DUE_TABLE, $condition); $this->setDB(); $this->db->query($sql); while ($this->db->next_record()) { $due = new Due(); $due->selectRecord($this->db->f("dueID")); $this->arrayList[] = $due; unset($due); } unset($this->db); if (count($this->arrayList) > 0) { $this->setDomDocument(); return true; } else { return false; } }