function getReceipt($receiptID) { $receipt = new Receipt(); $receipt->selectRecord($receiptID); if (!($domDoc = $receipt->getDomDocument())) { return false; } else { $xmlStr = $domDoc->dump_mem(true); return $xmlStr; } }
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; } }
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; } }
function getReceipt($receiptID) { $receipt = new Receipt($this->dbName); if ($receipt->selectRecord($receiptID)) { return $receipt; } return false; }
function searchRecords($searchKey, $fields, $limit) { $condition = "where ("; foreach ($fields as $key => $value) { if ($key == 0) { $condition = $condition . $value . " like '%" . $searchKey . "%'"; } else { $condition = $condition . "or " . $value . " like '%" . $searchKey . "%' "; } } if (!strstr(strtoupper($limit), 'ORDER')) { $sql = sprintf("select * from %s %s;", RECEIPT_TABLE, $condition . ") and status != 'cancelled' ORDER BY receiptID DESC " . $limit); } else { $limit = str_replace("WHERE", "and", $limit); $sql = sprintf("select * from %s %s;", RECEIPT_TABLE, $condition . ") " . $limit); } //echo $sql; $this->setDB(); $this->db->query($sql); while ($this->db->next_record()) { $receipt = new Receipt(); $receipt->selectRecord($this->db->f("receiptID")); $this->arrayList[] = $receipt; } if (count($this->arrayList) > 0) { $this->setDomDocument(); return true; } else { return false; } }