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


PHP Sessions::setOnlinePaymentRateWithCurrency方法代码示例

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


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

示例1: getBookingRoomRatesOnBookings

function getBookingRoomRatesOnBookings()
{
    $total = 0;
    $total_lkr = 0;
    $price_tag = 0;
    $room_rate = 0;
    $rate = 0;
    $zeroRateDetected = false;
    $roomTypeId = $_REQUEST['roomTypeId'];
    $room_bed_type = $_REQUEST['room_bed_type'];
    $room_meal_type = $_REQUEST['room_meal_type'];
    $room_count = $_REQUEST['room_count'];
    $display_rate_in = $_REQUEST['display_rate_in'];
    $_SESSION['display_rate_in'] = $display_rate_in;
    $day = 86400;
    $startTime = strtotime($_SESSION['check_in_date']);
    $endTime = strtotime($_SESSION['check_out_date']);
    $numDays = round(($endTime - $startTime) / $day);
    $hotelRoomRates = new HotelRoomRates();
    $hotelRoomRates->setHotelRoomTypeId($roomTypeId);
    //$room_rate = $hotelRoomRates->getRateInRoomType($room_bed_type, $room_meal_type);
    foreach (Common::createDateRangeArray($_SESSION['check_in_date'], date("Y-m-d", strtotime("-1 days", strtotime($_SESSION['check_out_date'])))) as $key => $value) {
        $rate = $hotelRoomRates->getRateInRoomTypeForDate($room_bed_type, $room_meal_type, $value);
        if ($rate > 0) {
            $room_rate = $room_rate + $rate;
        } else {
            $zeroRateDetected = true;
        }
    }
    if ($zeroRateDetected == false && $room_rate > 0) {
        //if ($room_rate > 0) {
        // replace LKR with current currency session
        if ($display_rate_in == "LKR") {
            $converted_rate = Common::currencyConvert("USD", $display_rate_in, $room_rate);
        } else {
            $converted_rate = $room_rate;
        }
        $total = $room_rate * $room_count;
        // * $numDays;
        $total_lkr = $converted_rate * $room_count;
        // * $numDays;
    } else {
        $total = 0;
        $total_lkr = 0;
    }
    if ($display_rate_in == "LKR") {
        Sessions::setOnlinePaymentRateWithCurrency($total_lkr, $display_rate_in);
        $price_tag = number_format($total_lkr, 2) . " " . $display_rate_in;
    } else {
        Sessions::setOnlinePaymentRateWithCurrency($total, $display_rate_in);
        $price_tag = number_format($total, 2) . " " . $display_rate_in;
    }
    $_final = array("total" => number_format($total, 2), "total_lkr" => $total_lkr, "display_rate_in" => $display_rate_in, "price_tag" => $price_tag);
    echo json_encode($_final);
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:55,代码来源:hotelroomrates-controller.php


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