Example #1
0
 function getCollection($collectionID)
 {
     $collection = new Collection();
     $collection->selectRecord($collectionID);
     if (!($domDoc = $collection->getDomDocument())) {
         return false;
     } else {
         $xmlStr = $domDoc->dump_mem(true);
         return $xmlStr;
     }
 }
Example #2
0
 function selectRecordsFromDueTaxType($dueID, $backtaxTDID, $dueType, $taxType, $status = "")
 {
     $sql = sprintf("SELECT " . COLLECTION_TABLE . ".collectionID as collectionID FROM %s, %s WHERE" . " " . PAYMENT_TABLE . ".paymentID = " . COLLECTION_TABLE . ".paymentID" . " AND" . " (" . " " . PAYMENT_TABLE . ".dueID='%s'" . " AND" . " " . PAYMENT_TABLE . ".backtaxTDID='%s'" . ")" . " AND" . " " . PAYMENT_TABLE . ".dueType='%s'" . " AND" . " " . COLLECTION_TABLE . ".taxType='%s'" . " AND" . " " . COLLECTION_TABLE . ".status='%s'" . " AND" . " " . PAYMENT_TABLE . ".status='%s'", COLLECTION_TABLE, PAYMENT_TABLE, $dueID, $backtaxTDID, $dueType, $taxType, $status, $status);
     $this->setDB();
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $collection = new Collection();
         $collection->selectRecord($this->db->f("collectionID"));
         $this->arrayList[] = $collection;
         unset($collection);
     }
     unset($this->db);
     if (count($this->arrayList) > 0) {
         $this->setDomDocument();
         return true;
     } else {
         return false;
     }
 }
Example #3
0
 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;
     }
 }