當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Guest::join方法代碼示例

本文整理匯總了PHP中Guest::join方法的典型用法代碼示例。如果您正苦於以下問題:PHP Guest::join方法的具體用法?PHP Guest::join怎麽用?PHP Guest::join使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Guest的用法示例。


在下文中一共展示了Guest::join方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: showInvoice

 public function showInvoice($bookCode)
 {
     $about = About::all();
     $booking = DetailBooking::join('booking', 'booking.ID_Booking', '=', 'detail_booking.ID_Booking')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_booking.ID_RoomType')->join('guest', 'guest.ID_Booking', '=', 'detail_booking.ID_Booking')->join('payment', 'payment.ID_Booking', '=', 'detail_booking.ID_Booking')->join('extra', 'extra.ID_Booking', '=', 'detail_booking.ID_Booking')->where('booking.Booking_code', '=', $bookCode)->get();
     $guest = Guest::join('booking', 'booking.ID_Booking', '=', 'guest.ID_Booking')->where('booking.Booking_code', '=', $bookCode)->get();
     $tax = Tax::where('Status', '=', 'Active')->get();
     $detailAdd = DetailBooking::join('booking', 'booking.ID_Booking', '=', 'detail_booking.ID_Booking')->join('detail_additional', 'detail_additional.ID_Booking', '=', 'detail_booking.ID_Booking')->join('additional', 'additional.ID_Additional', '=', 'detail_additional.ID_Additional')->where('booking.Booking_code', '=', $bookCode)->get();
     $totalRoom = 0;
     foreach ($booking as $key => $value1) {
         $totalRoom += $value1->Price * $value1->Quantity * $value1->Number_nights;
     }
     //dd($totalRoom);
     $totalAdd = 0;
     foreach ($detailAdd as $key => $value) {
         $totalAdd += $value->Price * $value->Quantity;
     }
     //dd($totalAdd);
     $totalTax = 0;
     foreach ($tax as $key => $value2) {
         $totalTax += ($totalAdd + $totalRoom) * $value2->Tax;
     }
     //dd($totalTax);
     $grandTotal = $totalAdd + $totalRoom + $totalTax;
     //dd($grandTotal);
     return View::make('Books.View.show')->with('booking', $booking)->with('about', $about)->with('guest', $guest)->with('tax', $tax)->with('detailAdd', $detailAdd)->with('totalRoom', $totalRoom)->with('totalAdditional', $totalAdd)->with('totalTax', $totalTax)->with('grandTotal', $grandTotal);
 }
開發者ID:hilmysyarif,項目名稱:hotel-application-laravel,代碼行數:26,代碼來源:BooksController.php


注:本文中的Guest::join方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。