/** * Add Payment * * Create a PaymentDBO and add it to the database */ function add_payment() { // If the use entered the Invoice ID directly, use that. Otherwise, use the // Invoice selected from the drop-down menu $invoice = isset($this->post['invoiceint']) ? $this->post['invoiceint'] : $this->post['invoiceselect']; // Create a new payment DBO $payment_dbo = new PaymentDBO(); $payment_dbo->setInvoiceID($invoice->getID()); $payment_dbo->setDate(DBConnection::format_datetime($this->post['date'])); $payment_dbo->setAmount($this->post['amount']); $payment_dbo->setType($this->post['type']); $payment_dbo->setTransaction1($this->post['transaction1']); $payment_dbo->setTransaction2($this->post['transaction2']); $payment_dbo->setStatus($this->post['status']); // Insert Payment into database add_PaymentDBO($payment_dbo); // Success $this->setMessage(array("type" => "[PAYMENT_ENTERED]")); $this->reload(); }
/** * Add Payment * * Create a new PaymentDBO and add it to the database */ function add_payment() { // Create a new payment DBO $invoice_id = isset($this->get['invoice']) ? $this->get['invoice']->getID() : $this->session['new_payment']['invoice']->getID(); $payment_dbo = new PaymentDBO(); $payment_dbo->setInvoiceID($invoice_id); $payment_dbo->setDate(DBConnection::format_datetime($this->post['date'])); $payment_dbo->setAmount($this->post['amount']); $payment_dbo->setType($this->post['type']); $payment_dbo->setStatus("Completed"); $payment_dbo->setTransaction1($this->post['transaction1']); $payment_dbo->setTransaction2($this->post['transaction2']); // Insert Payment into database add_PaymentDBO($payment_dbo); // Success $this->setMessage(array("type" => "[PAYMENT_ENTERED]")); $this->gotoPage("billing_view_invoice", null, "invoice=" . $payment_dbo->getInvoiceID()); }