예제 #1
0
 public static function getTotalVoucherAmount($booking)
 {
     $total = 0.0;
     foreach ($booking->voucher as $voucher) {
         if ($voucher->val == 1) {
             $total += Voucher::getVoucherAmount($voucher);
         }
     }
     return $total;
 }
예제 #2
0
 public static function getInvoiceAmount($booking)
 {
     $total = 0;
     /**
      *  Hotel Booking Amount
      */
     if (count($booking->voucher)) {
         foreach ($booking->voucher as $voucher) {
             $total += Voucher::getVoucherAmount($voucher);
         }
     }
     /**
      *  Transportation Bookings
      */
     return $total;
 }
예제 #3
0
 <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>


        </table>
    </div>

</div>
<br/>
<?php 
require_once 'emailStructure/footer.php';
예제 #4
0
 public function cancelVoucher($voucherid)
 {
     $percentage_charged = 0;
     $voucher = Voucher::findOrFail($voucherid);
     $daysToBooking = Voucher::getDaysToBooking($voucher)->days;
     $cancellation_policies = CancellationPolicy::where('hotel_id', $voucher->hotel_id)->get();
     foreach ($cancellation_policies as $policy) {
         if ($daysToBooking >= $policy->from && $daysToBooking <= $policy->to) {
             $percentage_charged = $policy->percentage_charged;
             break;
         } else {
             if (empty($policy->to)) {
                 $percentage_charged = $policy->percentage_charged;
                 break;
             }
         }
     }
     $bookingAmount = Voucher::getVoucherAmount($voucher);
     $cancellation_amount = $bookingAmount * $percentage_charged * 0.01;
     $voucher->val = 0;
     $voucher->cancellation_amount = $cancellation_amount;
     $voucher->save();
     $agent_user = $voucher->booking->user;
     $pdf = PDF::loadView('emails/cancellation-voucher', array('voucher' => $voucher));
     $pdf->save(public_path() . '/temp-files/cancellation-voucher.pdf');
     $hotel = Hotel::findOrFail($voucher->hotel_id);
     $hotel_users = $hotel->user;
     Mail::send('emails/cancellation-voucher-mail', array('voucher' => $voucher), function ($message) use($voucher, $agent_user, $hotel_users) {
         $message->attach(public_path() . '/temp-files/cancellation-voucher.pdf')->subject('Cancellation Voucher :' . $voucher->reference_number)->from('*****@*****.**');
         if (!empty($hotel_users)) {
             foreach ($hotel_users as $hotel_user) {
                 $message->to($hotel_user->email, $hotel_user->first_name);
             }
         }
         if (!empty($agent_user)) {
             $message->to($agent_user->email, $agent_user->first_name);
         }
     });
     Booking::getTotalBookingAmount($voucher->booking);
     return Redirect::back();
 }