Exemplo n.º 1
0
 public static function getHotelVoucherAmount($voucher)
 {
     $voucherAmount = 0.0;
     $check_in = $voucher->check_in;
     $check_out = $voucher->check_out;
     foreach ($voucher->roomBooking as $roomBooking) {
         $voucherAmount += $roomBooking->unit_cost_price * $roomBooking->room_count * Voucher::getNights($check_in, $check_out)->days + $roomBooking->unit_supplement_price;
     }
     return $voucherAmount;
 }
Exemplo n.º 2
0
                    </td>
                    <td>
                        <?php 
    echo $roomBooking->roomType->room_type;
    ?>
 <br>
                        <?php 
    echo $roomBooking->mealBasis->meal_basis;
    ?>
 <br>
                        <?php 
    echo $roomBooking->room_count;
    ?>
 <br>
                        USD <?php 
    echo number_format($roomBooking->room_count * $roomBooking->unit_price * Voucher::getNights($voucher->check_in, $voucher->check_out)->days, 2);
    ?>
                    </td>

                </tr>
            <?php 
}
?>

            <tr style="background: lightgrey">
                <th>Total Amount</th>
                <td>USD <?php 
echo number_format(Voucher::getVoucherAmount($voucher), 2);
?>
</td>
            </tr>
echo $voucher->check_in;
?>
</td>
                </tr>
                <tr>
                    <th>Checkout</th>
                    <td>: <?php 
echo $voucher->check_out;
?>
</td>
                </tr>
                <tr>
                    <th>#Nights</th>
                    <td>
                        : <?php 
echo Voucher::getNights($voucher->check_out, $voucher->check_in)->days;
?>
                    </td>
                </tr>
                <tr>
                    <th>Rooms</th>
                    <td>
                        <?php 
foreach ($voucher->roomBooking as $roomBooking) {
    ?>
                           : <?php 
    echo $roomBooking->room_count . ' ' . $roomBooking->roomSpecification->room_specification . ' ' . $roomBooking->roomType->room_type . 's on ' . $roomBooking->mealBasis->meal_basis . ' basis';
    ?>
<br>
                        <?php 
}
Exemplo n.º 4
0
 public function addToCart()
 {
     $hot_id = Input::get('hotel_id');
     if (Input::has('room_refer_id')) {
         $room_identity = Input::get('room_refer_id');
         $room_identity_array = explode("_", $room_identity);
         $hotel_id = $room_identity_array[0];
         $room_id = $room_identity_array[1];
         $room_specification_id = $room_identity_array[2];
         $meal_basis_id = $room_identity_array[3];
         $room_count = Session::get('room_count');
         $hotel_name = Hotel::where('id', $hotel_id)->first()->name;
         $hotel_address = Hotel::where('id', $hotel_id)->first()->address;
         $room_name = RoomType::where('id', $room_id)->first()->room_type;
         $room_specification = RoomSpecification::where('id', $room_specification_id)->first()->room_specification;
         $meal_basis = MealBasis::where('id', $meal_basis_id)->first()->meal_basis_name;
         $adult = RoomSpecification::where('id', $room_specification_id)->first()->adults;
         $child = RoomSpecification::where('id', $room_specification_id)->first()->children;
         $nights = Session::get('date_gap');
         $st_date = date('Y-m-d', strtotime(Session::get('st_date')));
         $ed_date = date('Y-m-d', strtotime(Session::get('ed_date')));
         $date_count = Voucher::getNights($st_date, $ed_date)->days;
         //dd($room_id.'/'.$room_specification_id.'/'.$meal_basis_id);
         $room_rate = Rate::lowestRoomRate($hotel_id, $room_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date);
         $room_rate_with_tax = Rate::lowestRoomRateWithTax($hotel_id, $room_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date);
         $room_cost = $room_rate_with_tax * $room_count * $date_count;
         if (Session::has('market')) {
             $market = Session::get('market');
         } else {
             $market = 1;
         }
         $get_market_details = Market::where('id', $market)->first();
         $tax_type = $get_market_details->tax_type;
         $tax = $get_market_details->tax;
         $handling_fee_type = $get_market_details->handling_fee_type;
         $handling_fee = $get_market_details->handling_fee;
         $supplement_rate = Rate::supplementRate($hotel_id, $room_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date);
         if ($market == 1) {
             if ($tax_type == 0) {
                 $total_tax = $room_rate_with_tax / 100 * $tax;
             } else {
                 $total_tax = $tax;
             }
             if ($handling_fee_type == 0) {
                 $total_handling_fee = $room_rate / 100 * $handling_fee;
             } else {
                 $total_handling_fee = $handling_fee;
             }
             $hotel_handling_fee = $total_handling_fee;
             $hotel_tax = $total_tax;
         } else {
             $total_tax = 0;
             if ($handling_fee_type == 0) {
                 $total_handling_fee = $room_rate / 100 * $handling_fee;
             } else {
                 $total_handling_fee = $handling_fee;
             }
             $hotel_tax = $total_tax;
             $hotel_handling_fee = $total_handling_fee;
         }
         $rate_box_details = array('hotel_id' => $hotel_id, 'hotel_name' => $hotel_name, 'hotel_address' => $hotel_address, 'room_name' => $room_name, 'room_type_id' => $room_id, 'room_specification' => $room_specification, 'room_specification_id' => $room_specification_id, 'meal_basis' => $meal_basis, 'meal_basis_id' => $meal_basis_id, 'room_cost' => $room_cost, 'hotel_tax' => $hotel_tax, 'hotel_handling_fee' => $hotel_handling_fee, 'supplement_rate' => $supplement_rate, 'room_count' => $room_count, 'unit_price' => $room_rate_with_tax, 'hotel_room_price' => $room_rate, 'adult' => $adult, 'child' => $child, 'nights' => $nights, 'room_identity' => $room_identity, 'check_in' => $st_date, 'check_out' => $ed_date, 'unit_cost_price' => (double) $hotel_tax + (double) $room_cost);
         if (Session::has('rate_box_details_' . $hotel_id)) {
             $data = Session::get('rate_box_details_' . $hotel_id);
             $data[$room_identity] = $rate_box_details;
         } else {
             $data = [];
             $data[$room_identity] = $rate_box_details;
         }
         Session::put('rate_box_details_' . $hotel_id, $data);
     }
     //dd(Session::get('rate_box_details_'.$hotel_id));
     return Response::json($hotel_id);
 }