Exemplo n.º 1
0
 def on_botonAltaReservas_clicked(self, widget):
     '''
     Inserta una reserva en la base de datos.
         :return: void
     '''
     try:
         if variables.reserva == 1:
             dni_reserva = variables.mensajes_label[4].get_text()
             check_in = variables.entries_reserva[0].get_text()
             check_out = variables.entries_reserva[1].get_text()
             noches = int(variables.mensajes_label[2].get_text())
             reserva = (dni_reserva, variables.numero_habitacion_reserva,
                        check_in, check_out, noches, 'SI')
             if funciones_reserva.esta_libre(
                     variables.numero_habitacion_reserva
             ) and dni_reserva != '':
                 funciones_reserva.insertar_reserva(reserva)
                 funciones_reserva.actualizar_lista_reservas()
                 funciones_habitacion.cambiar_estado_habitacion(
                     'NO', variables.numero_habitacion_reserva)
                 funciones_habitacion.actualizar_lista_habitaciones(
                     variables.lista_habitaciones)
                 funciones_habitacion.limpiar_entries_habitacion(
                     variables.entries_habitacion)
                 funciones_reserva.limpiar_entries_reserva(
                     variables.entries_reserva)
             else:
                 print('Habitación ocupada o falta el dni del cliente')
     except Exception as e:
         print(e)
         print('Error en on_botonAltaReservas_clicked')
Exemplo n.º 2
0
 def on_botonRefrescarToolBar_clicked(self, widget):
     '''
     Actualiza los TreeViews y limpia todos los entries.
         :return: void
     '''
     try:
         funciones_clientes.actualizar_lista_clientes(
             variables.lista_clientes)
         funciones_habitacion.actualizar_lista_habitaciones(
             variables.lista_habitaciones)
         funciones_reserva.actualizar_lista_reservas()
         funciones_servicios.actualizar_lista_servicios(
             variables.lista_servicios, -1)
         funciones_habitacion.limpiar_entries_habitacion(
             variables.entries_habitacion)
         funciones_clientes.limpiar_entries_cliente(
             variables.entries_cliente)
         funciones_reserva.limpiar_entries_reserva(
             variables.entries_reserva)
         funciones_servicios.limpiar_entries_servicios(
             variables.entries_servicios_adicionales)
         funciones_servicios.limpiar_labels_servicios(
             variables.labels_servicios)
         facturacion.limpiar_labels_factura(variables.labels_factura)
     except:
         print('Error en on_botonRefrescarToolBar_clicked')
Exemplo n.º 3
0
 def on_botonModificarHabitacion_clicked(self, widget):
     '''
     Modifica los datos de una habitación.
         :return: void
     '''
     try:
         numero_habitacion = variables.entries_habitacion[0].get_text()
         prezo = variables.entries_habitacion[1].get_text()
         if variables.switch_habitaciones.get_active():
             libre = 'SI'
         else:
             libre = 'NO'
         if variables.radiobuttons_tipo_habitacion[0].get_active():
             tipo = 'simple'
         elif variables.radiobuttons_tipo_habitacion[1].get_active():
             tipo = 'doble'
         elif variables.radiobuttons_tipo_habitacion[2].get_active():
             tipo = 'family'
         habitacion = (prezo, tipo, libre)
         if numero_habitacion != '':
             funciones_habitacion.modificar_habitacion(
                 habitacion, numero_habitacion)
             funciones_habitacion.actualizar_lista_habitaciones(
                 variables.lista_habitaciones)
             funciones_habitacion.limpiar_entries_habitacion(
                 variables.entries_habitacion)
         else:
             print('Falta el número de la habitación')
     except Exception as e:
         print(e)
         print('Error en on_botonModificarHabitacion_clicked')
Exemplo n.º 4
0
 def on_treeHabitaciones_cursor_changed(self, widget):
     '''
     Muestra los datos de una habitación al seleccionarla en el TreeView.
         :return: void
     '''
     try:
         model, iter = variables.tree_habitaciones.get_selection(
         ).get_selected()
         funciones_habitacion.limpiar_entries_habitacion(
             variables.entries_habitacion)
         if iter != None:
             numero_habitacion_seleccionado = model.get_value(iter, 0)
             tipo_seleccionado = model.get_value(iter, 1)
             precio_seleccionado = model.get_value(iter, 2)
             precio_seleccionado = round(precio_seleccionado, 2)
             variables.entries_habitacion[0].set_text(
                 str(numero_habitacion_seleccionado))
             variables.entries_habitacion[1].set_text(
                 str(precio_seleccionado))
             if tipo_seleccionado == str('simple'):
                 variables.radiobuttons_tipo_habitacion[0].set_active(True)
             elif tipo_seleccionado == str('doble'):
                 variables.radiobuttons_tipo_habitacion[1].set_active(True)
             elif tipo_seleccionado == str('family'):
                 variables.radiobuttons_tipo_habitacion[2].set_active(True)
             estado_libre_seleccionado = model.get_value(iter, 3)
             if estado_libre_seleccionado == str('SI'):
                 variables.switch_habitaciones.set_active(True)
             else:
                 variables.switch_habitaciones.set_active(False)
     except Exception as e:
         print(e)
         print("Error en on_treeHabitaciones_cursor_changed")
Exemplo n.º 5
0
 def on_botonBajaHabitacion_clicked(self, widget):
     '''
     Elimina una habitación de la base de datos.
         :return: void
     '''
     try:
         numero_habitacion = variables.entries_habitacion[0].get_text()
         if numero_habitacion != '':
             funciones_habitacion.baja_habitacion(numero_habitacion)
             funciones_habitacion.limpiar_entries_habitacion(
                 variables.entries_habitacion)
             funciones_habitacion.actualizar_lista_habitaciones(
                 variables.lista_habitaciones)
         else:
             pass
     except:
         print('Error en on_botonBajaHabitacion_clicked')
Exemplo n.º 6
0
    def on_botonAltaHabitacion_clicked(self, widget):
        '''
        Inserta una habitación en la base de datos.
            :return: void
        '''
        try:
            numero_habitacion = variables.entries_habitacion[0].get_text()
            precio_habitacion = variables.entries_habitacion[1].get_text()
            precio_habitacion = precio_habitacion.replace(',', '.')
            precio_habitacion = float(precio_habitacion)
            precio_habitacion = round(precio_habitacion, 2)
            if variables.radiobuttons_tipo_habitacion[0].get_active():
                tipo = 'simple'
            elif variables.radiobuttons_tipo_habitacion[1].get_active():
                tipo = 'doble'
            elif variables.radiobuttons_tipo_habitacion[2].get_active():
                tipo = 'family'
            else:
                pass

            if variables.switch_habitaciones.get_active():
                libre = 'SI'
            else:
                libre = 'NO'
            registro = (numero_habitacion, tipo, precio_habitacion, libre)
            if numero_habitacion is not None:
                funciones_habitacion.insertar_habitacion_BD(registro)
                funciones_habitacion.actualizar_lista_habitaciones(
                    variables.lista_habitaciones)
                funciones_habitacion.actualizar_numeros_habitacion()
                funciones_habitacion.limpiar_entries_habitacion(
                    variables.entries_habitacion)
            else:
                pass
        except Exception as e:
            print(e)
            print("Error en on_botonAltaHabitacion_clicked")