当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::evaluateTextline方法代码示例

本文整理汇总了PHP中Library\Utility\Helper::evaluateTextline方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::evaluateTextline方法的具体用法?PHP Helper::evaluateTextline怎么用?PHP Helper::evaluateTextline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library\Utility\Helper的用法示例。


在下文中一共展示了Helper::evaluateTextline方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendApplicantRejectionsAction

 public function sendApplicantRejectionsAction()
 {
     /**
      * @var \DDD\Service\Queue\EmailQueue $emailQueueService
      * @var \Mailer\Service\Email $mailer
      */
     $emailQueueService = $this->getServiceLocator()->get('service_queue_email_queue');
     $list = $emailQueueService->fetch(EmailQueue::TYPE_APPLICANT_REJECTION);
     if ($list && $list->count()) {
         /**
          * @var \DDD\Service\Textline $textlineService
          */
         $textlineService = $this->getServiceLocator()->get('service_textline');
         foreach ($list as $item) {
             //Don't send an email if applicant is not rejected anymore
             if (Applicant::APPLICANT_STATUS_REJECT != $item['status']) {
                 $emailQueueService->delete($item['id']);
                 continue;
             }
             $mailer = $this->getServiceLocator()->get('Mailer\\Email');
             $emailValidator = new EmailAddress();
             if (!$emailValidator->isValid($item['email'])) {
                 $this->outputMessage('[error] Applicant email is not valid: ' . $item['email'] . ' Removing from queue.');
                 $this->gr2err("Applicant rejection mail wasn't sent", ['applicant_id' => $item['entity_id'], 'applicant_name' => $item['applicant_name']]);
                 continue;
             }
             $mailer->send('applicant-rejection', ['to' => $item['email'], 'bcc' => EmailAliases::HR_EMAIL, 'to_name' => $item['applicant_name'], 'replyTo' => EmailAliases::HR_EMAIL, 'from_address' => EmailAliases::HR_EMAIL, 'from_name' => 'Ginosi Apartments', 'subject' => $textlineService->getUniversalTextline(1608, true), 'msg' => Helper::evaluateTextline($textlineService->getUniversalTextline(1607), ['{{APPLICANT_NAME}}' => $item['applicant_name'], '{{POSITION_TITLE}}' => $item['position_title']])]);
             $emailQueueService->delete($item['id']);
             $this->outputMessage("[1;32mRejection email to {$item['applicant_name']} sent. [0m");
         }
     } else {
         $this->outputMessage("[1;32mQueue is empty. [0m");
     }
     $this->outputMessage("[1;32mDone. [0m");
 }
开发者ID:arbi,项目名称:MyCode,代码行数:35,代码来源:EmailController.php

示例2: getAlreadyChargedItems

 /**
  * @param $reservationId
  * @return array
  */
 public function getAlreadyChargedItems($reservationId)
 {
     /**
      * @var \DDD\Dao\Booking\Charge $chargeDao
      * @var \DDD\Service\Textline $textlineService
      */
     $chargeDao = $this->getServiceLocator()->get('dao_booking_charge');
     $textlineService = $this->getServiceLocator()->get('service_textline');
     $charges = $chargeDao->getChargesForView($reservationId);
     $chargesList = [];
     $totalPrice = 0;
     $currencySymbol = '';
     foreach ($charges as $charge) {
         $totalPrice += $charge->getAmount();
         switch ($charge->getAddonsType()) {
             case BookingAddon::ADDON_TYPE_ACC:
                 array_push($chargesList, ['label' => Helper::evaluateTextline($textlineService->getUniversalTextline(1585), ['{{NIGHT_COUNT}}' => date(Constants::GLOBAL_DATE_FORMAT, strtotime($charge->getNightlyDate()))]), 'price_view' => $charge->getCurrencySymbol() . ' ' . number_format($charge->getAmount(), 2, '.', ' '), 'price' => $charge->getAmount(), 'percent' => 0, 'type' => 'night', 'class' => '', 'description' => '', 'tax_included' => '']);
                 $currencySymbol = $charge->getCurrencySymbol();
                 break;
             case BookingAddon::ADDON_TYPE_TAX_TOT:
             case BookingAddon::ADDON_TYPE_TAX_VAT:
             case BookingAddon::ADDON_TYPE_CITY_TAX:
             case BookingAddon::ADDON_TYPE_SALES_TAX:
                 $labelTextLineId = 0;
                 $descriptionTextLineId = 0;
                 if ($charge->getAddonsType() == BookingAddon::ADDON_TYPE_TAX_TOT) {
                     $descriptionTextLineId = 1429;
                     $labelTextLineId = 1259;
                 } elseif ($charge->getAddonsType() == BookingAddon::ADDON_TYPE_TAX_VAT) {
                     $descriptionTextLineId = 1430;
                     $labelTextLineId = 1260;
                 } elseif ($charge->getAddonsType() == BookingAddon::ADDON_TYPE_SALES_TAX) {
                     $descriptionTextLineId = 1431;
                     $labelTextLineId = 1261;
                 } elseif ($charge->getAddonsType() == BookingAddon::ADDON_TYPE_CITY_TAX) {
                     $descriptionTextLineId = 1432;
                     $labelTextLineId = 1262;
                 }
                 if ($charge->getTaxType() == Taxes::TAXES_TYPE_PERCENT) {
                     $taxValue = $charge->getAddonsValue() . ' %';
                 } else {
                     $taxNameTextline = 1473;
                     if ($charge->getTaxType() == BookingAddon::ADDON_TYPE_CITY_TAX && $charge->getTaxType() == Taxes::TAXES_TYPE_PER_PERSON) {
                         $taxNameTextline = 1493;
                     }
                     $taxValue = $charge->getCurrencySymbol() . ' ' . number_format($charge->getAddonsValue(), 2, '.', ' ') . ' ' . $textlineService->getUniversalTextline($taxNameTextline);
                 }
                 array_push($chargesList, ['label' => $textlineService->getUniversalTextline($labelTextLineId) . ' (' . $taxValue . ') ', 'price_view' => $charge->getCurrencySymbol() . ' ' . number_format($charge->getAmount(), 2, '.', ' '), 'price' => $charge->getAmount(), 'percent' => 0, 'type' => 'tax', 'class' => '', 'description' => $textlineService->getUniversalTextline($descriptionTextLineId), 'tax_included' => '', 'date' => $charge->getNightlyDate(), 'type_id' => $charge->getAddonsType()]);
                 break;
             case BookingAddon::ADDON_TYPE_DISCOUNT:
                 array_push($chargesList, ['label' => $textlineService->getUniversalTextline(1503), 'price_view' => $charge->getCurrencySymbol() . ' ' . number_format($charge->getAmount(), 2, '.', ' '), 'price' => $charge->getAmount(), 'percent' => 0, 'type' => 'discount', 'class' => 'text-danger', 'description' => '', 'tax_included' => '']);
                 break;
             case BookingAddon::ADDON_TYPE_CLEANING_FEE:
                 array_push($chargesList, ['label' => $textlineService->getUniversalTextline(1497), 'price_view' => $charge->getCurrencySymbol() . ' ' . number_format($charge->getAmount(), 2, '.', ' '), 'price' => $charge->getAmount(), 'percent' => 0, 'type' => 'fee', 'class' => 'text-danger', 'description' => $textlineService->getUniversalTextline(1498), 'tax_included' => '']);
                 break;
         }
     }
     // Total
     array_push($chargesList, ['label' => $textlineService->getUniversalTextline(1305), 'price_view' => $currencySymbol . ' ' . number_format($totalPrice, 2, '.', ' '), 'price' => $totalPrice, 'percent' => 0, 'type' => 'total', 'class' => '', 'description' => '', 'tax_included' => '']);
     return $chargesList;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:65,代码来源:Charge.php

示例3: indexAction

 /**
  * @return ViewModel
  */
 public function indexAction()
 {
     /**
      * @var \DDD\Service\Textline $textlineService
      * @var \DDD\Service\Lock\General $lockService
      */
     $textlineService = $this->getServiceLocator()->get('service_textline');
     $lockService = $this->getServiceLocator()->get('service_lock_general');
     $keyCode = $this->params()->fromQuery('code');
     $view = $this->params()->fromQuery('view');
     $godMode = $this->params()->fromQuery('bo', false) ?: false;
     if ($keyCode === null || !ClassicValidator::validateAlnum($keyCode)) {
         return $this->redirect()->toRoute('home')->setStatusCode('301');
     }
     /**
      * if have not key code in query...
      * OR not finded thicket...
      * OR "arrival date" NOT MORE than "5"
      * OR "depart date" NOT LESS than "-3"
      * redirect() -> Home
      */
     $bookingData = $this->getBookingData($keyCode);
     if (!$bookingData || !Helper::checkDatesByDaysCount(1, $bookingData->getDateTo())) {
         return $this->redirect()->toRoute('home')->setStatusCode('301');
     }
     $session = new SessionContainer('visitor');
     $parkingTextline = '';
     if ($bookingData->hasParking()) {
         $parkingTextline = $textlineService->getUniversalTextline($bookingData->getParkingTextlineId());
     }
     /**
      * @var \DDD\Service\Website\Textline $textlineService
      */
     $textlineService = $this->getServiceLocator()->get('service_website_textline');
     $keyDirectEntryTextline = Helper::evaluateTextline($textlineService->getApartmentDirectKeyInstructionTextline($bookingData->getApartmentId()), ['{{PARKING_TEXTLINE}}' => $parkingTextline]);
     $keyReceptionEntryTextline = Helper::evaluateTextline($textlineService->getApartmentReceptionKeyInstructionTextline($bookingData->getApartmentId()), ['{{PARKING_TEXTLINE}}' => $parkingTextline]);
     /* @var $customerService \DDD\Service\Customer */
     $customerService = $this->getServiceLocator()->get('service_customer');
     /**
      * If NOT HAVE flag from BO (view=0)...
      * Specify that looked & save the date view
      */
     if ($view !== '0' && $bookingData->isKiViewed() !== '1' && !$customerService->isBot($session)) {
         /**
          * @var \DDD\Service\Website\Booking $bookingService
          */
         $bookingService = $this->getServiceLocator()->get('service_website_booking');
         $bookingService->updateData($bookingData->getId(), ['ki_viewed' => '1', 'ki_viewed_date' => date('Y-m-d H:i:s')]);
     }
     $lockDatas = $lockService->getLockByReservationApartmentId($bookingData->getApartmentIdAssigned(), $bookingData->getPin(), [LockService::USAGE_APARTMENT_TYPE, LockService::USAGE_BUILDING_TYPE, LockService::USAGE_PARKING_TYPE], true);
     foreach ($lockDatas as $key => $lockData) {
         switch ($key) {
             case LockService::USAGE_APARTMENT_TYPE:
                 $bookingData->setPin($lockData['code']);
                 break;
             case LockService::USAGE_BUILDING_TYPE:
                 $bookingData->setOutsideDoorCode($lockData['code']);
                 break;
             case LockService::USAGE_PARKING_TYPE:
                 // TODO: to be or not to be, this is the question.
                 break;
         }
     }
     // get Office Address
     $officeAddress = false;
     if ($bookingData->getKiPageType() == Building::KI_PAGE_TYPE_RECEPTION) {
         /**
          * @var \DDD\Service\Office $officeService
          */
         $officeService = $this->getServiceLocator()->get('service_office');
         $officeManagement = $officeService->getData($bookingData->getOfficeId());
         /**
          * @var \DDD\Domain\Office\OfficeManager $officeData
          */
         $officeData = $officeManagement['office'];
         $officeAddress = $officeData->getAddress();
     }
     if ($view !== '0') {
         $this->checkCustomerIdentityData($bookingData);
     }
     $this->layout()->setTemplate('layout/layout-ki');
     $this->layout()->userTrackingInfo = ['res_number' => $bookingData->getResNumber(), 'partner_id' => $bookingData->getPartnerId()];
     $this->layout()->godMode = $godMode === substr(md5($keyCode), 12, 5);
     $this->layout()->keyData = $bookingData;
     $this->layout()->keyCode = $keyCode;
     $this->layout()->directEntryTextline = $keyDirectEntryTextline;
     $this->layout()->receptionEntryTextline = $keyReceptionEntryTextline;
     return new ViewModel(['keyData' => $bookingData, 'keyCode' => $keyCode, 'directEntryTextline' => $keyDirectEntryTextline, 'receptionEntryTextline' => $keyReceptionEntryTextline, 'godMode' => $godMode === substr(md5($keyCode), 12, 5), 'isGuest' => $view !== '0', 'officeAddress' => $officeAddress]);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:92,代码来源:KeyController.php

示例4: paginationViewItem

 /**
  *
  * @param int $totalCount
  * @param int $currentPage
  * @param int $viewCount
  * @return string
  */
 private function paginationViewItem($totalCount, $currentPage, $viewCount)
 {
     if ($totalCount <= $viewCount) {
         return '';
     }
     $viewFirst = $currentPage == 1 ? 1 : ($currentPage - 1) * $viewCount;
     $viewSecnd = $currentPage * $viewCount <= $totalCount ? $currentPage * $viewCount : $totalCount;
     return Helper::evaluateTextline($this->getTextLineSite(1215), ['{{PAGE_COUNT}}' => "{$viewFirst}-{$viewSecnd}", '{{ITEM_COUNT}}' => $totalCount]);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:16,代码来源:Search.php

示例5: cancelationPolicy

 /**
  *
  * @param array $data
  * @return array
  */
 public function cancelationPolicy($data)
 {
     $result = ['type' => '', 'description' => ''];
     if (isset($data['is_refundable']) && $data['is_refundable'] == 2) {
         //None refundable
         $result['type'] = $this->getTextLineSite(845);
         $result['description'] .= $this->getTextLineSite(861);
     } elseif (isset($data['is_refundable']) && $data['is_refundable'] == 1) {
         //Refundable
         $result['type'] = $this->getTextLineSite(846);
         $time = (int) $data['refundable_before_hours'];
         if ($time > 48) {
             $time = $time / 24 . ' ' . $this->getTextLineSite(977);
         } else {
             $time = $time . ' ' . $this->getTextLineSite(976);
         }
         //penalty
         $pen_val = '';
         switch ($data['penalty_type']) {
             case 1:
                 $pen_val = $data['penalty_percent'] . "%";
                 break;
             case 2:
                 $pen_val = $data['penalty_fixed_amount'] . ' ' . $data['code'];
                 break;
             case 3:
                 $night = $data['night_count'];
                 if ($night < $data['penalty_nights']) {
                     $pen_val = $night;
                 } else {
                     $pen_val = $data['penalty_nights'];
                 }
                 $pen_val .= ' ' . $this->getTextLineSite(862);
                 break;
         }
         $description = Helper::evaluateTextline($this->getTextLineSite(859), ['{{CXL_TIME}}' => $time, '{{CXL_PENALTY}}' => $pen_val]);
         $result['description'] .= $description;
     }
     return $result;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:45,代码来源:Apartment.php

示例6: sendReceiptAction

 public function sendReceiptAction()
 {
     /**
      * @var \DDD\Service\Booking\BookingTicket $bookingService
      */
     try {
         $serviceLocator = $this->getServiceLocator();
         $mailer = $serviceLocator->get('Mailer\\Email');
         $bookingService = $serviceLocator->get('service_booking_booking_ticket');
         $reservationId = $this->id;
         if (!$reservationId) {
             $this->gr2err("Reservation ID missing", ['reason' => 'Reservation Id not found']);
             return false;
         }
         $receiptData = $bookingService->getReceiptData($reservationId);
         $reservation = $receiptData['reservation'];
         $emailValidator = new EmailAddress();
         $email = $reservation['guest_email'];
         if ($this->getRequest()->getParam('email')) {
             $email = $this->getRequest()->getParam('email');
         }
         if ($receiptData['status'] != 'success' || !$emailValidator->isValid($email)) {
             $this->gr2err('Receipt status or mail is not correct', ['reservation_id' => $reservationId, 'reservation_number' => $reservation['res_number']]);
             return false;
         }
         /**
          * @var \DDD\Service\Textline $textlineService
          */
         $textlineService = $this->getServiceLocator()->get('service_textline');
         $mailSubject = 'Receipt for Transaction: ' . $reservation['res_number'];
         $title = 'Receipt';
         $reservationDetails = 'Reservation Details';
         $financeDetails = 'Finance Details';
         $receiptThankYou = TextConstants::RECEIPT_THANK_YOU;
         // added by me
         $reservationId = $reservation['id'];
         $reservationNumber = $reservation['res_number'];
         $receiptIssueDate = $receiptData['today'];
         $customerName = $reservation['guest_first_name'] . ' ' . $reservation['guest_last_name'];
         $customerAddress = $reservation['guest_address'];
         $checkInDate = date(Constants::GLOBAL_DATE_TIME_WO_SEC_FORMAT, strtotime($reservation['date_from'] . $reservation['check_in']));
         $checkOutDate = date(Constants::GLOBAL_DATE_TIME_WO_SEC_FORMAT, strtotime($reservation['date_to'] . $reservation['check_out']));
         $apartmentName = $reservation['apartment_name'];
         $apartmentAddress = $reservation['apartment_address'];
         $totalAmountToPay = 0;
         $nightsCount = 0;
         $taxes = [];
         if ($receiptData['charges'] && $receiptData['charges']) {
             foreach ($receiptData['charges'] as $charge) {
                 // calculate taxes
                 if ($charge['addon']) {
                     if ($charge['addons_type'] == 1) {
                         $chargeKey = ucfirst($textlineService->getUniversalTextline(669));
                         $nightsCount++;
                     } else {
                         $chargeKey = $charge['addon'];
                     }
                 } elseif ($charge['type'] == 'p') {
                     $chargeKey = 'Penalty';
                 } elseif ($charge['type'] == 'g') {
                     $chargeKey = 'Penalty Ginosi';
                 } else {
                     $chargeKey = 'Other';
                 }
                 if ($charge['addons_value'] > 0 && $charge['location_join'] != '') {
                     $chargeKey .= ' ' . $charge['addons_value'];
                     if ($charge['tax_type'] == Taxes::TAXES_TYPE_PERCENT) {
                         $chargeKey .= ' %';
                     } elseif ($charge['tax_type'] == Taxes::TAXES_TYPE_PER_NIGHT) {
                         $chargeKey .= ' p/n';
                     } elseif ($charge['tax_type'] == Taxes::TAXES_TYPE_PER_PERSON) {
                         $chargeKey .= ' p/p';
                     }
                 }
                 if (isset($taxes[$chargeKey])) {
                     $taxes[$chargeKey] += $charge['acc_amount'];
                 } else {
                     $taxes[$chargeKey] = $charge['acc_amount'];
                 }
                 // calculate all amount to pay
                 $totalAmountToPay += $charge['acc_amount'];
             }
         }
         $totalAmountToPaid = 0;
         if ($receiptData['transactions'] && $receiptData['transactions']->count()) {
             foreach ($receiptData['transactions'] as $key => $transaction) {
                 $totalAmountToPaid += $transaction['acc_amount'];
             }
         }
         $totalAmountPaid = $totalAmountToPaid;
         $balance = number_format($totalAmountToPay - $totalAmountToPaid, 2, '.', '');
         // analytics image
         $analyticsCode = $this->getAnalyticsCode();
         $analyticsImage = Helper::evaluateTextline($textlineService->getUniversalTextline(1681), ['{{ANALYTICS_CODE}}' => $analyticsCode, '{{ANALYTICS_RES_NUMBER}}' => $reservationNumber, '{{ANALYTICS_TEMPLATE}}' => 'receipt', '{{ANALYTICS_PARTNER_ID}}' => $reservation['partner_id']]);
         $analyticsQuery = Helper::evaluateTextline($textlineService->getUniversalTextline(1682), ['{{ANALYTICS_TEMPLATE}}' => 'key-instruction']);
         $mailer->send('receipt', array('layout' => 'layout-new', 'analyticsQuery' => $analyticsQuery, 'to' => $email, 'to_name' => $reservation['guest_first_name'] . ' ' . $reservation['guest_last_name'], 'replyTo' => EmailAliases::RT_RESERVATION, 'from_address' => EmailAliases::FROM_MAIN_MAIL, 'from_name' => 'Ginosi Apartments', 'subject' => $mailSubject, 'title' => $title, 'reservationDetails' => $reservationDetails, 'financeDetails' => $financeDetails, 'receiptThankYou' => $receiptThankYou, 'data' => $receiptData, 'reservationId' => $reservationId, 'reservationNumber' => $reservationNumber, 'reservationSymbol' => $reservation['symbol'], 'receiptIssueDate' => $receiptIssueDate, 'customerName' => $customerName, 'customerAddress' => $customerAddress, 'checkInDate' => $checkInDate, 'checkOutDate' => $checkOutDate, 'apartmentName' => $apartmentName, 'apartmentAddress' => $apartmentAddress, 'nightsCount' => $nightsCount, 'taxes' => $taxes, 'totalAmountPaid' => $totalAmountPaid, 'balance' => $balance, 'phone1' => $reservation['phone1'], 'phone2' => $reservation['phone2'], 'analyticsImage' => $analyticsImage));
         $this->gr2info('Sending Customer Receipt mail', ['reservation_number' => $reservation['res_number']]);
         return true;
     } catch (\Exception $e) {
         $msg = "[error]Error: Receipt mail wasn't sent";
//.........这里部分代码省略.........
开发者ID:arbi,项目名称:MyCode,代码行数:101,代码来源:ReservationEmailController.php

示例7: testGetToBeChargedItems

 /**
  * Testing GetToBeChargedItems method
  */
 public function testGetToBeChargedItems()
 {
     // get any reservation
     $isBookerPrice = false;
     /**
      * @var \DDD\Dao\Booking\Booking $reservationDao
      */
     $reservationDao = $this->getApplicationServiceLocator()->get('dao_booking_booking');
     //        $reservation    = $reservationDao->fetchOne(function(Select $select) {
     //            $select->order('id DESC');
     //        });
     $getReservationWithChargesAndBookedStatusQuery = new Select();
     $getReservationWithChargesAndBookedStatusQuery->join([DbTables::TBL_CHARGE => 'charges'], 'charges.reservation_id = ' . DbTables::TBL_BOOKINGS . '.id', ['charge_id' => 'id'], Select::JOIN_INNER);
     $getReservationWithChargesAndBookedStatusQuery->where->isNotNull('charge_id');
     $getReservationWithChargesAndBookedStatusQuery->where->equalTo(DbTables::TBL_BOOKINGS . '.status', Booking::BOOKING_STATUS_BOOKED);
     $getReservationWithChargesAndBookedStatusQuery->order([DbTables::TBL_BOOKINGS . '.id' => 'DESC']);
     $reservation = $reservationDao->fetchOne($getReservationWithChargesAndBookedStatusQuery);
     $this->assertNotNull($reservation);
     // get textvine service
     /**
      * @var \DDD\Service\Textline $textlineService
      */
     $textlineService = $this->getApplicationServiceLocator()->get('service_textline');
     // check chargeProcess domain
     $reservation = $reservationDao->getDataForToBeCharged($reservation->getId());
     $this->assertInstanceOf('\\DDD\\Domain\\Booking\\ChargeProcess', $reservation);
     // check booking ticket
     $bookingTicketService = $this->getApplicationServiceLocator()->get('service_booking_booking_ticket');
     $this->assertInstanceOf('\\DDD\\Service\\Booking\\BookingTicket', $bookingTicketService);
     // check discount getters
     $this->assertTrue(method_exists($reservation, 'getPartnerId'), 'Class does not have method getPartnerId');
     $this->assertTrue(method_exists($reservation, 'getGuestEmail'), 'Class does not have method getGuestEmail');
     $discountParams = [];
     if ($reservation->getPartnerId()) {
         $discountParams = ['aff_id' => $reservation->getPartnerId(), 'email' => $reservation->getGuestEmail()];
     }
     // check price getters
     $this->assertTrue(method_exists($reservation, 'getBookerPrice'), 'Booking Object does not have method getBookerPrice');
     $this->assertTrue(method_exists($reservation, 'getPrice'), 'Booking Object does not have method getPrice');
     if ($isBookerPrice) {
         $totalPrice = $reservation->getBookerPrice();
         $price = $reservation->getBookerPrice();
     } else {
         $totalPrice = $reservation->getPrice();
         $price = $reservation->getPrice();
     }
     $nightCount = Helper::getDaysFromTwoDate($reservation->getDateTo(), $reservation->getDateFrom());
     $currencySymbol = $reservation->getCurrencySymbol();
     // check night count
     $this->assertLessThan($nightCount, 0);
     // Night Charges
     $chargesList = [['label' => Helper::evaluateTextline($textlineService->getUniversalTextline(1580), ['{{NIGHT_COUNT}}' => $nightCount]), 'price_view' => $currencySymbol . number_format($totalPrice, 2, '.', ' '), 'price' => $totalPrice, 'percent' => 0, 'type' => 'night', 'class' => '', 'description' => '', 'tax_included' => '']];
     /********************************************************************************************************/
     /********************************* Check discount charges ***********************************************/
     /********************************************************************************************************/
     $discountValidator = $bookingTicketService->validateAndCheckDiscountData($discountParams, false);
     $discounted = false;
     if (isset($discountValidator['discount_value']) && $discountValidator['valid'] && isset($discountValidator['discount_value']) && ceil($discountValidator['discount_value'])) {
         $discountValue = $totalPrice * $discountValidator['discount_value'] / 100;
         $price = $totalPrice - $discountValue;
         $discounted = true;
         $totalPrice = $totalPrice - $discountValue;
         array_push($chargesList, ['label' => (isset($discountValidator['partner_name']) ? $discountValidator['partner_name'] : '') . ' ' . $textlineService->getUniversalTextline(1503), 'price_view' => '- ' . $currencySymbol . number_format($discountValue, 2, '.', ' '), 'price' => $discountValue, 'percent' => 0, 'type' => 'discount', 'class' => 'text-danger', 'description' => '', 'tax_included' => '']);
     }
     /********************************************************************************************************/
     /************************************** Check Tax Charges ***********************************************/
     /********************************************************************************************************/
     $currencyService = $this->getApplicationServiceLocator()->get('service_currency_currency');
     $this->assertInstanceOf('\\DDD\\Service\\Currency\\Currency', $currencyService);
     $currencyRate = 1;
     $this->assertTrue(method_exists($reservation, 'getGuestCurrency'), 'Booking Object does not have method getGuestCurrency');
     $this->assertTrue(method_exists($reservation, 'getApartmentCurrency'), 'Booking Object does not have method getApartmentCurrency');
     $this->assertTrue(method_exists($currencyService, 'getCurrencyConversionRate'), 'Booking Object does not have method getCurrencyConversionRate');
     if ($reservation->getGuestCurrency() != $reservation->getApartmentCurrency() && $isBookerPrice) {
         $currencyRate = $currencyService->getCurrencyConversionRate($reservation->getGuestCurrency(), $reservation->getApartmentCurrency());
     }
     $this->assertTrue(method_exists($reservation, 'getCityTotType'), 'Booking Object does not have method getCityTotType');
     $this->assertTrue(method_exists($reservation, 'getCityTot'), 'Booking Object does not have method getCityTot');
     $this->assertTrue(method_exists($reservation, 'getTotIncluded'), 'Booking Object does not have method getTotIncluded');
     if ($reservation->getCityTotType() > 0 && $reservation->getCityTot() > 0) {
         $taxDiscounted = false;
         $totDuration = $reservation->getTotMaxDuration() ? min($reservation->getTotMaxDuration(), $nightCount) : $nightCount;
         $totValue = $reservation->getCityTot() + $reservation->getTotAdditional();
         if ($reservation->getCityTotType() == Taxes::TAXES_TYPE_PERCENT) {
             $cityTot = $price / 100 * $totValue * $totDuration / $nightCount;
             $taxValue = $totValue . ' %';
             if ($discounted) {
                 $taxDiscounted = true;
             }
             $percent = $totValue;
         } else {
             $cityTot = $totDuration * $totValue * $currencyRate;
             $taxValue = $currencySymbol . ' ' . number_format($totValue * $currencyRate, 2, '.', ' ') . ' ' . $textlineService->getUniversalTextline(1473);
             $percent = 0;
         }
         array_push($chargesList, ['label' => $textlineService->getUniversalTextline(1259) . ' (' . $taxValue . ($reservation->getTotIncluded() == 1 ? ', ' . $textlineService->getUniversalTextline(1472) : '') . ') ' . ($taxDiscounted ? $textlineService->getUniversalTextline(1633) : ''), 'price_view' => $currencySymbol . number_format($cityTot, 2, '.', ' '), 'price' => $cityTot, 'percent' => $percent, 'duration' => $totDuration, 'type' => 'tax', 'class' => 'text-primary', 'description' => $textlineService->getUniversalTextline(1429), 'tax_included' => $reservation->getTotIncluded() == 1 ?: '']);
         if ($reservation->getTotIncluded() != 1) {
//.........这里部分代码省略.........
开发者ID:arbi,项目名称:MyCode,代码行数:101,代码来源:ChargeTest.php


注:本文中的Library\Utility\Helper::evaluateTextline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。