Exemplo n.º 1
0
 function getPayment($paymentID)
 {
     $payment = new Payment();
     $payment->selectRecord($paymentID);
     if (!($domDoc = $payment->getDomDocument())) {
         return false;
     } else {
         $xmlStr = $domDoc->dump_mem(true);
         return $xmlStr;
     }
 }
Exemplo n.º 2
0
 function purge()
 {
     $rptsDB = new DB_RPTS();
     $rptsDB2 = new DB_RPTS();
     $sqlselect = "SELECT collectionID FROM collections WHERE receiptNum = '' OR receiptNum is NULL;";
     $rptsDB->query($sqlselect);
     $due = new Dues();
     while ($rptsDB->next_record()) {
         $collectionID = $rptsDB->f("collectionID");
         $this->collectionID = $collectionID;
         $this->isStoredInDatabase = true;
         $sqlselect2 = "select payments.paymentID, payments.dueID from payments \n  \t\t\t\t\t\tinner join collectionPayments on payments.paymentID=collectionPayments.paymentID \n                        where collectionPayments.collectionID ={$collectionID}";
         #echo("$sqlselect2<br>");
         $rptsDB2->query($sqlselect2);
         $payment = new Payment();
         while ($rptsDB2->next_record()) {
             $payment->setPaymentID($rptsDB2->f("paymentID"));
             $payment->selectRecord();
             // if Payment is BacktaxTD, FLAG BacktaxTD paidStatus as '' for false / UNPAID
             if ($strstr = strstr($payment->dueType, ",")) {
                 $backtaxTDID = strstr($strstr, "=");
                 $backtaxTDID = str_replace("=", "", $backtaxTDID);
                 $backtaxTD = new BacktaxTD();
                 $backtaxTD->selectRecord("", $backtaxTDID);
                 $backtaxTD->setBacktaxTDID($backtaxTDID);
                 $backtaxTD->setTotalPaid(0);
                 $backtaxTD->updatePaidStatus("");
                 $backtaxTD->updateRecord();
             }
             $dueID = $rptsDB2->f("dueID");
             $due->setDueID($dueID);
             $due->select();
             $due->resetPayments();
             $due->store();
         }
         if (!$this->deleteRecord()) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 3
0
 function selectRecords($condition = "")
 {
     $sql = sprintf("select * from %s %s;", PAYMENT_TABLE, $condition);
     //echo $sql;
     //echo "<hr>";
     $this->setDB();
     $this->db->query($sql);
     while ($this->db->next_record()) {
         $payment = new Payment();
         $payment->selectRecord($this->db->f("paymentID"));
         $this->arrayList[] = $payment;
         unset($payment);
     }
     unset($this->db);
     if (count($this->arrayList) > 0) {
         $this->setDomDocument();
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 4
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;
     }
 }