示例#1
0
function CountDate($first_date, $last_date)
{
    $year = date('Y');
    $first_date = $year . '-' . $first_date;
    $last_date = $year . '-' . $last_date;
    $data = Bookings::where('date_booking', '>=', $first_date)->where('date_booking', '<=', $last_date);
    return $data->count();
}
示例#2
0
 public function getPayments()
 {
     $first_date = Input::get('first_date');
     $last_date = Input::get('last_date');
     $submit = Input::get('submit');
     $page = Input::get('page');
     if (isset($first_date) && isset($last_date)) {
         $data = Bookings::where('date_booking', '>=', $first_date)->where('date_booking', '<=', $last_date)->paginate(10);
     } else {
         $data = Bookings::orderBy('id', 'desc')->paginate(10);
     }
     if (isset($submit) && $submit == 'print') {
         if (isset($page)) {
             $no = $page * 10 - 9;
         } else {
             $no = 1;
         }
         $pdf = App::make('dompdf');
         $html = '<center><b>Report of Financial</b></center>';
         $html .= '<br><br><br>';
         $html .= '<table border="1" align="center" width="100%" padding="0" cellpadding="5">';
         $html .= '<tr>';
         $html .= '<td>No</td>';
         $html .= '<td>Booking Code</td>';
         $html .= '<td>Date Booking</td>';
         $html .= '<td>Date Expired</td>';
         $html .= '<td>Service & Room Count</td>';
         $html .= '<td>Total</td>';
         $html .= '</tr>';
         foreach ($data as $row) {
             $temp = CountService($row->id) + CountRoom($row->id);
             $html .= '<tr>';
             $html .= '<td>' . $no . '</td>';
             $html .= '<td>' . $row->booking_code . '</td>';
             $html .= '<td>' . $row->date_booking . '</td>';
             $html .= '<td>' . $row->date_booking_to . '</td>';
             $html .= '<td>' . $temp . '</td>';
             $html .= '<td>' . Total($row->id) . '</td>';
             $html .= '</tr>';
             $no++;
         }
         $html .= '</table>';
         $pdf->loadHTML($html)->setPaper('a4')->setOrientation('potrait');
         return $pdf->download('Report Of Financial.pdf');
     } else {
         return View::make('home/dashboard', array())->nest('content', 'payments/report', array('data' => $data));
     }
 }
示例#3
0
    /**
     * Run - called by outside cron
     */
    public static function Run()
    {
        // add here your code...
        // Class::Method();
        $perform_actions = false;
        // update last time running
        $sql = 'SELECT
					cron_type,
					cron_run_last_time,
					cron_run_period,
					cron_run_period_value,
					CASE
						WHEN cron_run_last_time = \'0000-00-00 00:00:00\' THEN \'999\'
						WHEN cron_run_period = \'minute\' THEN TIMESTAMPDIFF(MINUTE, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
						ELSE TIMESTAMPDIFF(HOUR, cron_run_last_time, \'' . date('Y-m-d H:i:s') . '\')
					END as time_diff										
				FROM ' . TABLE_SETTINGS;
        $result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        if ($result['cron_type'] == 'batch') {
            $perform_actions = true;
        } else {
            if ($result['cron_type'] == 'non-batch' && $result['time_diff'] > $result['cron_run_period_value']) {
                $perform_actions = true;
            } else {
                $perform_actions = false;
            }
        }
        if ($perform_actions) {
            // update Feeds
            RSSFeed::UpdateFeeds();
            if (self::$PROJECT == 'ShoppingCart') {
                // close expired discount campaigns
                Campaigns::UpdateStatus();
                // remove expired orders
                Orders::RemoveExpired();
            } else {
                if (self::$PROJECT == 'HotelSite') {
                    // close expired discount campaigns
                    Campaigns::UpdateStatus();
                    // close expired coupons
                    Coupons::UpdateStatus();
                    // remove expired 'Preparing' bookings
                    Bookings::RemoveExpired();
                } else {
                    if (self::$PROJECT == 'BusinnessDirectory') {
                        // close expired lisitngs
                        Listings::UpdateStatus();
                        // remove old inquiries
                        Inquiries::RemoveOld();
                    } else {
                        if (self::$PROJECT == 'MedicalAppointment') {
                            // remove expired appointments
                            Appointments::RemoveExpired();
                            // send reminders for patient and doctor
                            Appointments::SendReminders();
                        } else {
                            if (self::$PROJECT == 'MicroBlog') {
                                // close expired polls
                                Pools::UpdateStatus();
                            }
                        }
                    }
                }
            }
            // update last time running
            $sql = 'UPDATE ' . TABLE_SETTINGS . ' SET cron_run_last_time = \'' . date('Y-m-d H:i:s') . '\'';
            database_void_query($sql);
        }
    }
示例#4
0
        function testBookings() 
        {
			
			//
			// load()
			//
			$BookingsAPI = new Bookings("ws.bookings.nl", "/xml-rpc", "username", "password");

			
			// Get countries
			$cc = $BookingsAPI->GetCountryList();
			$this->assertTrue(count($cc) > 0, "Get countries list");	
			
			// Get cities
			$cities = $BookingsAPI->GetCityList($cc[0]["code"]);
			$this->assertTrue(count($cities) > 0, "Get cities list");
			
			// get Hotel list
			$hotels = $BookingsAPI->GetHotelList($cities[0]["city_id"]);
			$this->assertTrue(count($hotels) > 0, "Get hotels list");
			
			// get Hotel details
			$hotel_details = $BookingsAPI->GetHotelDetails($hotels[0]["id"]);
			$this->assertTrue((is_array($hotel_details) && $hotel_details["lang"]["maxrate"]), "Get hotel details");
			
			// Get rooms list
			$rooms = $BookingsAPI->GetRoomsList($hotels[0]["id"]);
			$this->assertTrue(count($rooms) > 0, "Get rooms list");
			
			// get Room type
			$type = $BookingsAPI->GetRoomType($rooms[0]["roomtype_id"]);
			$this->assertTrue(count($type) > 0, "Get roomtype name");
			
			$id = $BookingsAPI->GetHotelID($hotels[0]["name"], $cities[0]["city_id"]);
			$this->assertTrue($id, "Get Hotel id by name");
			
			$id = $BookingsAPI->GetCityID($cities[0]["name"], $cc[0]["code"]);
			$this->assertTrue($id, "Get City id by name");
			
			$id = $BookingsAPI->GetCountryCode($cc[0]["name"]);
			$this->assertTrue($id, "Get Country code by name");
			
			$fac = $BookingsAPI->GetHotelFacilities($hotels[2]["id"]);
			$this->assertTrue(count($fac) > 0, "Get Hotel Facilities");
			
			// get Room info
        }
示例#5
0
 public function getDashboard()
 {
     $options = array('guest' => Guest::count(), 'bookings' => Bookings::count(), 'rooms' => Room::count(), 'service' => Services::count(), 'data' => Bookings::orderBy('id', 'desc')->paginate(10));
     $view = View::make('home/dashboard', array())->nest('content', 'home/home', $options);
     return $view;
 }
示例#6
0
 public function getPrint($id)
 {
     $pdf = App::make('dompdf');
     $data = Bookings::find($id);
     $rooms = BookingRooms::where('booking_id', '=', $id)->get();
     $service = BookingServices::where('booking_id', '=', $id)->get();
     $payment = Payments::where('booking_id', '=', $id)->first();
     if (isset($data->employee->full_name)) {
         $employee = $data->employee->full_name;
     } else {
         $employee = 'Administrator';
     }
     $x = str_replace('-', '0', $data->date_booking);
     $y = str_replace('-', '0', $data->date_booking_to);
     $z = $y - $x;
     $html = '<center><b>Detail Of Payments</b></center>';
     $html .= '<table border="0" align="center" width="100%" padding="0" cellpadding="5">';
     $html .= '<tr>';
     $html .= '<td>Receptionist</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $employee . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Booking Code</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $data->booking_code . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Date of Bookings</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $data->date_booking . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Number Of Days</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $z . ' Days</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Date of Checkout</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $data->date_booking_to . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Guest Name</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $data->guest->full_name . '</td>';
     $html .= '</tr>';
     $html .= '</table>';
     $html .= '<br>';
     $html .= '<center><b>Detail Of Service</b></center>';
     $html .= '<table border="1" align="center" width="100%" padding="0" cellpadding="5">';
     $html .= '<tr>';
     $html .= '<td>No</td>';
     $html .= '<td>Service Name</td>';
     $html .= '<td>Price</td>';
     $html .= '</tr>';
     $no = 1;
     $ts = 0;
     foreach ($service as $s) {
         $html .= '<tr>';
         $html .= '<td>' . $no . '</td>';
         $html .= '<td>' . $s->service->name . '</td>';
         $html .= '<td>' . $s->service->price . '</td>';
         $html .= '</tr>';
         $no++;
         $ts += $s->service->price;
     }
     $html .= '<tr>';
     $html .= '<td>-</td>';
     $html .= '<td>-</td>';
     $html .= '<td>-</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>-</td>';
     $html .= '<td>-</td>';
     $html .= '<td>' . $ts . '</td>';
     $html .= '</tr>';
     $html .= '</table>';
     $html .= '<br>';
     $html .= '<center><b>Detail Of Rooms</b></center>';
     $html .= '<table border="1"  align="center" width="100%" padding="0" cellpadding="5">';
     $html .= '<tr>';
     $html .= '<td>No</td>';
     $html .= '<td>Room Name</td>';
     $html .= '<td>Price</td>';
     $html .= '</tr>';
     $no = 1;
     $tr = 0;
     foreach ($rooms as $r) {
         $html .= '<tr>';
         $html .= '<td>' . $no . '</td>';
         $html .= '<td>' . $r->room->name . '</td>';
         $html .= '<td>' . $r->room->type->price . '</td>';
         $html .= '</tr>';
         $no++;
         $tr += $r->room->type->price;
     }
     $html .= '<tr>';
     $html .= '<td>-</td>';
     $html .= '<td>-</td>';
     $html .= '<td>-</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>-</td>';
     $html .= '<td>-</td>';
     $html .= '<td>' . $tr . '</td>';
     $html .= '</tr>';
     $html .= '</table>';
     $html .= '<br>';
     $html .= '<table border="0" align="center" width="100%" padding="0" cellpadding="5">';
     $html .= '<tr>';
     $html .= '<td>Subtotal</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . ($tr + $ts) * $z . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Disc</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $payment->disc * 100 . ' %</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>Discount</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $payment->subtotal * $payment->disc . '</td>';
     $html .= '</tr>';
     $html .= '<tr>';
     $html .= '<td>GrandTotal</td>';
     $html .= '<td>:</td>';
     $html .= '<td>' . $payment->grand_total . '</td>';
     $html .= '</tr>';
     $html .= '</table>';
     // echo $html;
     $pdf->loadHTML($html)->setPaper('a4')->setOrientation('potrait');
     return $pdf->download($data->booking_code . '.pdf');
 }