function getCollectionList($condition = "") { $collectionRecords = new CollectionRecords(); if ($collectionRecords->selectRecords($condition)) { if (!($domDoc = $collectionRecords->getDomDocument())) { return false; } else { $xmlStr = $domDoc->dump_mem(true); return $xmlStr; } } else { return false; } }
function getCollectionRecordsFromPaymentID($paymentID) { $condition = " WHERE paymentID=" . $paymentID . " AND status!='cancelled' AND taxType!='idle' "; $collectionRecords = new CollectionRecords(); $collectionRecords->selectRecords($condition); if (is_array($collectionRecords->arrayList)) { return $collectionRecords; } else { return false; } }
function getTaxType($receiptID) { $taxType = ""; $condition = "WHERE receiptID='" . $receiptID . "'"; $collectionRecords = new CollectionRecords(); if ($collectionRecords->selectRecords($condition)) { if (count($collectionRecords->arrayList) > 0) { $collection = $collectionRecords->arrayList[0]; $taxType = strtoupper($collection->getTaxType()); } } return $taxType; }
function incrementValues($suffixKey, $payment) { $collectionRecords = new CollectionRecords($this->dbName); $condition = "WHERE " . COLLECTION_TABLE . ".paymentID='" . $payment->getPaymentID() . "' AND " . COLLECTION_TABLE . ".status!='cancelled'"; if ($collectionRecords->selectRecords($condition)) { if (is_array($collectionRecords->getArrayList())) { $list = $collectionRecords->getArrayList(); foreach ($list as $collection) { $receipt = $this->getReceipt($collection->getReceiptID()); if (is_object($receipt)) { if ($receipt->getPaymentMode() == "cash") { switch ($collection->getTaxType()) { case "basic": $dueDateYear = date("Y", strtotime($payment->getDueDate())); if ($dueDateYear < $this->formArray["year"]) { $this->computeIncrementValues($suffixKey, $collection, "prior", "basic"); } else { $this->computeIncrementValues($suffixKey, $collection, "current", "basic"); } break; case "sef": $dueDateYear = date("Y", strtotime($payment->getDueDate())); if ($dueDateYear < $this->formArray["year"]) { $this->computeIncrementValues($suffixKey, $collection, "prior", "sef"); } else { $this->computeIncrementValues($suffixKey, $collection, "current", "sef"); } break; case "idle": $dueDateYear = date("Y", strtotime($payment->getDueDate())); if ($dueDateYear < $this->formArray["year"]) { $this->computeIncrementValues($suffixKey, $collection, "prior", "idle"); } else { $this->computeIncrementValues($suffixKey, $collection, "current", "idle"); } break; } } else { $this->formArray["totalNonCash" . $suffixKey] += $collection->getAmountPaid(); $this->formArray["grandTotalNetCol" . $suffixKey] += $collection->getAmountPaid(); } } } } } }
function cancelReceiptList($receiptIDArray = "") { if (is_array($receiptIDArray)) { $collectionRecords = new CollectionRecords(); $collection = new Collection(); $receipt = new Receipt(); $payment = new Payment(); foreach ($receiptIDArray as $receiptID) { // find other receipts associated to payment $collectionRecords->selectRecords("WHERE receiptID='" . $receiptID . "'"); $paymentID = $collectionRecords->arrayList[0]->getPaymentID(); $collectionRecords->selectRecords("WHERE paymentID='" . $paymentID . "'"); if (is_array($collectionRecords->getArrayList())) { foreach ($collectionRecords->getArrayList() as $collection) { $cancelReceiptIDArray[] = $collection->getReceiptID(); $cancelPaymentIDArray[] = $collection->getPaymentID(); $cancelCollectionIDArray[] = $collection->getCollectionID(); } } } $cancelCollectionIDArray = array_unique($cancelCollectionIDArray); $cancelReceiptIDArray = array_unique($cancelReceiptIDArray); $cancelPaymentIDArray = array_unique($cancelPaymentIDArray); foreach ($cancelCollectionIDArray as $collectionID) { $collection->selectRecord($collectionID); $collection->setStatus("cancelled"); $collection->updateRecord(); } $condition = " WHERE "; foreach ($cancelReceiptIDArray as $receiptID) { if ($condition != " WHERE ") { $condition .= " OR "; } $condition .= " receiptID = '" . $receiptID . "' "; $receipt->selectRecord($receiptID); $receipt->setStatus("cancelled"); $receipt->updateRecord(); } foreach ($cancelPaymentIDArray as $paymentID) { $payment->selectRecord($paymentID); $payment->setStatus("cancelled"); $payment->updateRecord(); } // cancel associated mergedReceipts $receiptRecords = new ReceiptRecords(); if ($receiptRecords->selectRecords($condition)) { if (!($domDoc = $receiptRecords->getDomDocument())) { return false; } else { $xmlStr = $domDoc->dump_mem(true); return $xmlStr; } } else { return false; } } else { return false; } }