protected function _assign(Dwoo_Data $data)
 {
     $details = $this->_eventData->getAllDetails();
     $reservationID = $this->_eventData->getReservationID();
     $reservationModel = new RM_Reservations();
     $reservation = $reservationModel->find($reservationID)->current();
     $arrayDetails = array();
     foreach ($details as $detail) {
         $arrayDetails[] = array('unit' => $detail->getUnit()->toArray(), 'period' => (array) $detail->getPeriod(), 'periodtime' => (array) $detail->getPeriod(true), 'persons' => $detail->getPersons(), 'total' => $detail->getTotal());
     }
     // total paid and total due
     $billing = new RM_Billing();
     $priceCharges = $billing->getPrice($reservationID);
     $billingArray['tax'] = $priceCharges->tax;
     $billingArray['paid'] = $billing->getPaymentsTotal($reservation);
     $billingArray['due'] = $priceCharges->total;
     $billingArray['confirmed'] = $reservation->confirmed ? $translate->_('MessageYes') : $translate->_('MessageNo');
     $data->assign('details', $arrayDetails);
     $data->assign('reservation_id', $this->_eventData->getReservationID());
     return $data;
 }
 protected function _assign(Dwoo_Data $data)
 {
     $translate = RM_Environment::getInstance()->getTranslation(RM_Environment::TRANSLATE_MAIN);
     $locationsDAO = new RM_Locations();
     $reservationID = $this->_eventData->getReservationID();
     $reservationModel = new RM_Reservations();
     $reservation = $reservationModel->find($reservationID)->current();
     // reservation details
     $details = $this->_eventData->getAllDetails();
     $arrayDetails = array();
     foreach ($details as $detail) {
         $unit = $detail->getUnit()->toArray();
         $period = $detail->getPeriod()->toArray();
         $periodWithTime = $detail->getPeriod()->toArray(true);
         $location = $locationsDAO->fetchByUnit($unit['id'])->toArray();
         $extrasForTemplate = array();
         $extras = $detail->getExtras();
         foreach ($extras as $extra) {
             $extrasForTemplate[] = $extra->toArray();
         }
         $arrayDetails[] = array('unit' => $unit, 'locationInfo' => isset($location[0]) ? $location[0] : '', 'period' => $period, 'periodtime' => $periodWithTime, 'persons' => $detail->getPersons()->getAll(), 'total' => $detail->getTotal(), 'extras' => $extrasForTemplate);
     }
     // total paid and total due
     $billing = new RM_Billing();
     $priceCharges = $billing->getPrice($reservationID);
     $billingArray['tax'] = $priceCharges->tax;
     $billingArray['paid'] = $billing->getPaymentsTotal($reservation);
     $billingArray['due'] = $priceCharges->total;
     $billingArray['confirmed'] = $reservation->confirmed ? $translate->_('MessageYes') : $translate->_('MessageNo');
     // return the data to the template
     $data->assign('extras', $extrasForTemplate);
     $data->assign('details', $arrayDetails);
     $data->assign('user', $this->_eventData->getUser()->toArray());
     $data->assign('reservation_id', $reservationID);
     $data->assign('billing', $billingArray);
     return $data;
 }
예제 #3
0
파일: Row.php 프로젝트: laiello/resmania
 /**
  * Returns total paid for this reservation
  *
  * @return float
  */
 public function getTotalPaid()
 {
     $billingModel = new RM_Billing();
     $billingTotal = $billingModel->getPaymentsTotal($this);
     return $billingTotal;
 }
예제 #4
0
 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);
 }