/** * This method internally return total reservation due for payment * There could be a deposit system installed and enabled * * @deprecated * @param RM_Reservation_Row $reservation * @return float */ public function getTotalPrice(RM_Reservation_Row $reservation) { $totalPrice = $reservation->getTotalPrice(); $depositSystem = RM_Environment::getInstance()->getDepositSystem(); if ($depositSystem == null) { return $totalPrice; } if ($depositSystem->isDepositUsedFor($reservation->id)) { return $depositSystem->calculate($totalPrice); } return $totalPrice; }
function markPaid(RM_Reservation_Row $reservation) { $totalPrice = $reservation->getTotalPrice(); $billingModel = new RM_Billing(); $totalPaid = $billingModel->getPaymentsTotal($reservation); $total = $totalPrice - $totalPaid; $billingID = $billingModel->createRow(array('reservation_id' => $reservation->id, 'total_paid' => $total))->save(); $billingPaymentsModel = new RM_BillingPayments(); $billingPaymentsModel->createRow(array('id' => $billingID, 'provider' => 'Administrator', 'transaction_id' => '0', 'status' => 'success', 'total' => $total, 'transaction_date' => date('Y-m-d H:i:s')))->save(); $this->confirm($reservation); }