예제 #1
0
 def on_pay_click(self):
     """save payment details to database"""
     booking_id = self.id
     discount = self.entry_discount.get()
     paid_amount = self.grand_total.cget("text")
     payment_type = self.combo_pay.get()
     billed_by = self.user
     status = "Cleaning"
     if payment_type == "":
         messagebox.showerror('Payment Failed',
                              'Please select payment mode',
                              parent=self.win_bill)
     else:
         room = self.room_no
         save = Bill()
         if save.save_payment(booking_id, discount, paid_amount,
                              payment_type, billed_by):
             a = messagebox.showinfo('Success',
                                     'Bill Paid successfully',
                                     parent=self.win_bill)
             up = Booking()
             up.booking_stat(booking_id)
             stat = Room()
             stat.change_status(status, room)
             if a == 'ok':
                 self.win_bill.destroy()
         else:
             messagebox.showerror('Payment Failed',
                                  'Please Try Again',
                                  parent=self.win_bill)
예제 #2
0
 def show_room_tree(self):
     """display rooms in treeview"""
     self.room_tree.delete(*self.room_tree.get_children())
     ret = Room()
     data = ret.show_rooms_stat()
     for i in data:
         self.room_tree.insert("", "end", text=i[0], values=i)
     self.room_tree.bind("<Double-1>", self.send_room)
예제 #3
0
 def show_room_tree(self):
     """show all rooms details of hotel"""
     self.room_tree.delete(*self.room_tree.get_children())
     ret = Room()
     data = ret.show_rooms()
     for i in data:
         self.room_tree.insert("", "end", text=i[0], values=i)
     self.room_tree.bind("<Double-1>", self.select_item)
예제 #4
0
 def on_delete_click(self):
     """deletes the room from database"""
     room_no = self.entry_number.get()
     a = messagebox.askyesno(
         "Delete", "Are you sure you want to delete room: " + str(room_no))
     if a == 1:
         delete = Room()
         delete.delete_rooms(room_no)
         self.show_room_tree()
예제 #5
0
 def on_room_search(self):
     """search for rooms and display in room's treeview"""
     category = self.combo_search1.get()
     value = self.entry_search1.get()
     if category == "" or value == "":
         messagebox.showerror("Error", "Enter all the values for searching")
     else:
         self.room_tree.delete(*self.room_tree.get_children())
         ret = Room()
         data = ret.search_rooms(category, value)
         for i in data:
             self.room_tree.insert("", "end", text=i[0], values=i)
예제 #6
0
 def on_room_change(self):
     """updates room status in database"""
     room_no = self.entry_room1.get()
     room_stat = self.combo_change.get()
     if room_stat == "":
         messagebox.showerror("Error", "Select the current room status")
     elif room_no == "":
         messagebox.showerror("Error",
                              "Select room number from available rooms")
     else:
         ret = Room()
         ret.change_status(room_stat, room_no)
         self.show_room_tree()
         self.combo_rooms()
예제 #7
0
    def on_submit_click(self):
        """changes the current room status to  cleaning or available"""
        room_no = self.entry_room1.get()
        room_stat = self.combo_status.get()

        if room_stat == "":
            messagebox.showerror("Error", "Select the current room status")
        elif self.stat == "Occupied":
            messagebox.showerror("Error",
                                 "Occupied room's status can not be changed")
        else:
            ret = Room()
            ret.change_status(room_stat, room_no)
            self.show_room_tree()
예제 #8
0
    def on_update_click(self):
        """update room details in database"""
        room_no = self.entry_number.get()
        room_category = self.combo_category.get()
        room_description = self.entry_description.get()
        price = self.entry_price.get()

        update = Room()
        if update.update_rooms(room_category, room_description, price,
                               room_no):
            a = messagebox.showinfo('Success', 'Room Updated successfully')
            if a == 'ok':
                self.on_reset_click()
                self.show_room_tree()
        else:
            messagebox.showerror('Room Update Failed', 'Please Try Again')
예제 #9
0
    def on_save_click(self):
        """save new room details to database"""
        room_no = self.entry_number.get()
        room_category = self.combo_category.get()
        room_description = self.entry_description.get()
        price = self.entry_price.get()

        save = Room()
        if room_no == "" or room_category == "" or room_description == "" or price == "":
            messagebox.showerror("Error", "Enter all values")
        else:
            if save.create_rooms(room_no, room_category, room_description,
                                 price):
                a = messagebox.showinfo('Success',
                                        'Room Registered successfully')
                if a == 'ok':
                    self.on_reset_click()
                    self.show_room_tree()
            else:
                messagebox.showerror('Room Registration Failed',
                                     'Please Try Again')
예제 #10
0
    def on_save_click(self):
        """verify for data given in entrybox and save them in database"""
        name = self.entry_name.get()
        phone = self.entry_phone.get()
        address = self.entry_address.get()
        email = self.entry_email.get()
        staying = self.combo_stay.get()
        room = self.combo_room.get()
        adults = self.entry_adult.get()
        children = self.entry_child.get()
        if not staying.isnumeric() or not adults.isnumeric(
        ) or not room.isnumeric():
            messagebox.showerror(
                "Error",
                "Enter Number for adults and children and staying days")
        else:
            check_in = datetime.now().strftime('%Y/%m/%d')
            stay = datetime.now() + timedelta(days=int(staying))
            check_out = '{:%Y/%m/%d}'.format(stay)
            status = "Occupied"

            save = Booking()
            stat = Room()

            if name == "" or room == "":
                messagebox.showerror("Error", "Name and Room No is must")

            else:
                if save.new_booking(name, phone, address, email, check_in,
                                    check_out, room, adults, children):
                    stat.change_status(status, room)
                    a = messagebox.showinfo('Success',
                                            'Room Booked successfully')
                    if a == 'ok':
                        self.on_reset_click()
                        self.show_room_tree()
                        self.show_book_tree()
                        self.combo_rooms()
                else:
                    messagebox.showerror('Booking Failed', 'Please Try Again')
예제 #11
0
 def combo_rooms(self):
     """returns available rooms to combobox"""
     ret = Room()
     data = ret.available_rooms()
     self.combo_room['values'] = data