Exemplo n.º 1
0
 function Main()
 {
     $this->setForm();
     $this->tpl->set_block("rptsTemplate", "ReceiptPage", "ReceiptPageBlock");
     $pageNumber = 1;
     $ReceiptDetails = new SoapObject(NCCBIZ . "ReceiptDetails.php", "urn:Object");
     $CollectionList = new SoapObject(NCCBIZ . "CollectionList.php", "urn:Object");
     $PaymentDetails = new SoapObject(NCCBIZ . "PaymentDetails.php", "urn:Object");
     foreach ($this->formArray["receiptIDArray"] as $receiptID) {
         $this->tpl->set_var("pageNumber", $pageNumber);
         $totalAmountPaid = 0;
         $eRPTSSettings = $this->getERPTSSettingsDetails();
         if ($eRPTSSettings->getLguType() == "City") {
             $this->setvar("city", $eRPTSSettings->getLguName());
             $this->setvar("province", "");
         } else {
             $this->setvar("city", "");
             $this->setvar("province", $eRPTSSettings->getLguName());
         }
         if (!($xmlStr = $ReceiptDetails->getReceipt($receiptID))) {
             //exit("xml failed.");
         } else {
             if (!($domDoc = domxml_open_mem($xmlStr))) {
                 //exit("error domDoc");
             } else {
                 $receipt = new Receipt();
                 $receipt->parseDomDocument($domDoc);
                 $this->setvar("prevORNum", $receipt->getPreviousReceiptNumber());
                 $porMonth = "";
                 $porDay = "";
                 $porYear = "";
                 if ($receipt->getPreviousReceiptDate() != "0000-00-00") {
                     $porMonth = date("F", strtotime($receipt->getPreviousReceiptDate()));
                     $porDay = date("d", strtotime($receipt->getPreviousReceiptDate()));
                     $porYear = date("Y", strtotime($receipt->getPreviousReceiptDate()));
                 }
                 $this->setvar("porMonth", $porMonth);
                 $this->setvar("porDay", $porDay);
                 $this->setvar("porYear", $porYear);
                 $this->setvar("orNum", $receipt->getReceiptNumber());
                 $orDate = "";
                 if ($receipt->getReceiptDate() != "0000-00-00") {
                     $orDate = date("F d, Y", strtotime($receipt->getReceiptDate()));
                 }
                 $this->setvar("orDate", $orDate);
                 $this->setvar("receivedFrom", $this->getReceivedFromName($receipt->getReceivedFrom()));
                 $this->setvar("paymentMode", $receipt->getPaymentMode());
                 if ($receipt->getPaymentMode() == "check") {
                     $this->setvar("checkNumber", "using Check Number : " . $receipt->getCheckNumber());
                     $this->setvar("dateOfCheck", " dated " . date("F d, Y", strtotime($receipt->getDateOfCheck())));
                     $this->setvar("draweeBank", "(" . $receipt->getDraweeBank() . ")");
                 }
                 $this->setvar("cityTreasurer", $this->getPersonName($receipt->getCityTreasurer()));
                 $this->setvar("deputyTreasurer", $this->getPersonName($receipt->getDeputyTreasurer()));
                 if (!($collectionXmlStr = $CollectionList->getCollectionListFromReceiptID($receiptID))) {
                     // xml failed
                 } else {
                     if (!($collectionDomDoc = domxml_open_mem($collectionXmlStr))) {
                         // error domDoc
                     } else {
                         $collectionRecords = new CollectionRecords();
                         $collectionRecords->parseDomDocument($collectionDomDoc);
                         $collectionArrayList = $collectionRecords->getArrayList();
                         $i = 0;
                         foreach ($collectionArrayList as $collection) {
                             $i++;
                             if ($i <= 1) {
                                 if ($collection->getTaxType() == "basic") {
                                     $this->setvar("receiptType", "[ X ]  BASIC TAX      [  ]  SPECIAL EDUCATION FUND");
                                 } else {
                                     if ($collection->getTaxType() == "sef") {
                                         $this->setvar("receiptType", "[  ]  BASIC TAX     [ X ]  SPECIAL EDUCATION FUND");
                                     } else {
                                         if ($collection->getTaxType() == "idle") {
                                             $this->setvar("receiptType", "[  ]  BASIC TAX     [  ]  SPECIAL EDUCATION FUND     [ X ]  IDLE TAX");
                                         }
                                     }
                                 }
                             }
                             $paymentID = $collection->getPaymentID();
                             if (!($paymentXmlStr = $PaymentDetails->getPayment($paymentID))) {
                                 // xml failed
                             } else {
                                 if (!($paymentDomDoc = domxml_open_mem($paymentXmlStr))) {
                                     // error domDoc
                                 } else {
                                     $payment = new Payment();
                                     $payment->parseDomDocument($paymentDomDoc);
                                     $assessedValue = 0;
                                     // added "orYear" for fix of Feb 08, 2005
                                     $this->formArray["orYear"] = substr($payment->dueDate, 0, 4);
                                     $this->setvar("orYear", $this->formArray["orYear"], false);
                                     if ($i <= 6) {
                                         $this->setvar("ownerName" . $i, $this->getReceivedFromName($receipt->getReceivedFrom()));
                                         if ($payment->getDueID() != "" && $payment->getDueID() != "0") {
                                             // due payment
                                             $due = $this->getDue($payment->getDueID());
                                             $td = $this->getTD($due->getTdID());
                                             $afs = $this->getAFS($td->getAfsID());
                                             $tdNum = $td->getTaxDeclarationNumber();
                                             if ($td->getPropertyType() == "Land") {
                                                 $this->setvar("assessedValueLand" . $i, $afs->getTotalAssessedValue(), true);
                                             } else {
                                                 $this->setvar("assessedValueOthers" . $i, $afs->getTotalAssessedValue(), true);
                                             }
                                             $assessedValue = $afs->getTotalAssessedValue();
                                             if ($payment->getDueType() == "Annual") {
                                                 // commented out: February 08, 2005
                                                 // "fullPmt" must be total paid less penalties... (tax due)
                                                 //$this->setvar("fullPmt".$i,$collection->getBalanceDue(),true);
                                                 $this->setvar("fullPmt" . $i, $collection->getTaxDue(), true);
                                             } else {
                                                 $this->setvar("num" . $i, $payment->getDueType());
                                                 // commented out: February 08, 2005
                                                 // $this->setvar("partialPmt".$i,$collection->getBalanceDue(),true);
                                                 $this->setvar("partialPmt" . $i, $collection->getTaxDue(), true);
                                             }
                                         } else {
                                             if ($payment->getBacktaxTDID() != "" && $payment->getBacktaxTDID() != "0") {
                                                 // backtaxtd payment
                                                 $backtaxTD = $this->getBacktaxTD($payment->getBacktaxTDID());
                                                 $parentTD = $this->getTD($backtaxTD->getTdID());
                                                 $afs = $this->getAFS($parentTD->getAfsID());
                                                 $tdNum = $backtaxTD->getTDNumber();
                                                 $assessedValue = $backtaxTD->getAssessedValue();
                                                 if ($payment->getDueType() == "Annual") {
                                                     // commented out: February 08, 2005
                                                     // $this->setvar("fullPmt".$i,$collection->getBalanceDue(),true);
                                                     $this->setvar("fullPmt" . $i, $collection->getTaxDue(), true);
                                                 } else {
                                                     $this->setvar("num" . $i, $payment->getDueType());
                                                     // commented out: February 08, 2005
                                                     // $this->setvar("partialPmt".$i,$collection->getBalanceDue(),true);
                                                     $this->setvar("partialPmt" . $i, $collection->getTaxDue(), true);
                                                 }
                                             }
                                         }
                                         $od = $this->getOD($afs->getOdID());
                                         $this->setvar("lotAddress" . $i, $od->locationAddress->getStreet() . ", " . $od->locationAddress->getBarangay());
                                         $this->setvar("blockNumber" . $i, $od->getLotNumber() . ", " . $od->getBlockNumber());
                                         $this->setvar("landClass" . $i, $payment->getPropertyClassification());
                                         $this->setvar("tdNum" . $i, $tdNum);
                                         $this->setvar("dueDate" . $i, "(" . substr($payment->getDueDate(), 0, 4) . ")");
                                         $this->setvar("assessedValue" . $i, $assessedValue, true);
                                         $this->setvar("subTotal" . $i, $collection->getTaxDue(), true);
                                         if ($collection->getPenalty() > 0) {
                                             if ($collection->getAmnesty() == "true") {
                                                 //	$this->setvar("penalty".$i,round((($collection->getPenalty()/$collection->getTaxDue())*100)) . " % (amnesty)",true);
                                                 $this->setvar("penalty" . $i, $collection->getPenalty());
                                             } else {
                                                 // $this->setvar("penalty".$i,round((($collection->getPenalty()/$collection->getTaxDue())*100)) . " %",true);
                                                 $this->setvar("penalty" . $i, $collection->getPenalty());
                                             }
                                         }
                                         $this->setvar("grandTotal" . $i, $collection->getAmountPaid(), true);
                                         $totalAmountPaid += $collection->getAmountPaid();
                                         //Inserted by cht 07282008
                                         $sefTotal = $total;
                                         $netAmountPaid = $totalAmountPaid * 2;
                                         //End
                                     }
                                 }
                             }
                         }
                     }
                     // ORIG
                     //$this->setvar("total",$totalAmountPaid,true);
                     //$this->setvar("amountPaid",$totalAmountPaid,true);
                     //$totalInWords = makewords($totalAmountPaid);
                     $this->setvar("sefTotal", $totalAmountPaid, true);
                     $this->setvar("total", $totalAmountPaid, true);
                     $this->setvar("amountPaid", $netAmountPaid, true);
                     $totalInWords = makewords($netAmountPaid);
                     //						$totalInWords = "One Hundred Thousand Two Hundred Thirty Four Pesos And Fifty Seven Centavos Only";
                     if (strlen($totalInWords) < 62) {
                         $this->setvar("y1TotalInWords", "254");
                     } else {
                         $this->setvar("y1TotalInWords", "263");
                     }
                     $this->setvar("totalInWords", $totalInWords);
                 }
             }
         }
         $this->tpl->parse("ReceiptPageBlock", "ReceiptPage", true);
         $pageNumber++;
         $this->clearLine();
     }
     //exit;
     $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);
     }
 }
Exemplo n.º 2
0
 function getCollectionArrayList()
 {
     $sortedOwnerIDArray = $this->getSortedOwnerIDArray();
     foreach ($sortedOwnerIDArray as $ownerID) {
         $ownerName = $this->getOwnerName($ownerID);
         $paymentRecords = $this->getPaymentRecordsOwnerID($ownerID);
         if (is_array($paymentRecords->arrayList)) {
             foreach ($paymentRecords->arrayList as $payment) {
                 $paymentID = $payment->getPaymentID();
                 $paymentDate = $payment->getPaymentDate();
                 $taxDeclarationNumber = $this->getTDNumberFromPayment($payment->getTdID(), $payment->getBacktaxTDID());
                 $collectionRecords = $this->getCollectionRecordsFromPaymentID($paymentID);
                 if (is_array($collectionRecords->arrayList)) {
                     foreach ($collectionRecords->arrayList as $collection) {
                         $receipt = new Receipt();
                         $receiptID = $collection->getReceiptID();
                         $receipt->selectRecord($receiptID);
                         $receiptNumber = $receipt->getReceiptNumber();
                         $basicTax = 0;
                         $sefTax = 0;
                         switch ($collection->getTaxType()) {
                             case "basic":
                                 $basicTax = $collection->getAmountPaid();
                                 break;
                             case "sef":
                                 $sefTax = $collection->getAmountPaid();
                                 break;
                         }
                         $total = $basicTax + $sefTax;
                         $collectionRecordArray = array("ownerName" => $ownerName, "taxDeclarationNumber" => $taxDeclarationNumber, "datePaid" => $paymentDate, "orNumber" => $receiptNumber, "basicTax" => $basicTax, "sefTax" => $sefTax, "total" => $total);
                         $collectionArrayList[] = $collectionRecordArray;
                     }
                 }
             }
         }
     }
     if (is_array($collectionArrayList)) {
         return $collectionArrayList;
     } else {
         return false;
     }
 }