def Facturas(self, widget, data=None): self.LoadMesas() self.ListF_Cliente.clear() Res = BD_Conect.Load(1) for i in Res: fila = (i[0], i[1], i[2], i[3], i[4], i[5]) BD_Conect.AltaLista(self.TreeF_Cliente, self.ListF_Cliente, fila) self.ListF_Factura.clear() Res = BD_Conect.Load(4) for i in Res: fila = (i[0], i[1], i[2], i[3], i[4]) BD_Conect.AltaLista(self.TreeF_Factura, self.ListF_Factura, fila) self.NB_Principal.set_current_page(2)
def LoadS(self): self.CursorServicesSelected = False self.ListServicios.clear() Res = BD_Conect.Load(2) for i in Res: fila = (i[1], str(i[2]), i[0]) BD_Conect.AltaLista(self.TreeServicios, self.ListServicios, fila)
def LoadClientes(self): ### Limpiamos la lista actual del treeview self.ListClientes.clear() ResCli = BD_Conect.Load(1) for i in ResCli: fila = (i[0], i[1], i[2]) BD_Conect.AltaLista(self.TreeClientes, self.ListClientes, fila)
def Servicios(self, widget, data=None): self.LoadS() self.LoadMesas() self.ServiceSelected = 0 Res = BD_Conect.Load(3) self.ListFactsLite.clear() for i in Res: file = (i[0], i[1], i[4]) BD_Conect.AltaLista(self.TreeFactsLite, self.ListFactsLite, file) self.EB_S_Selected.set_text("") self.EB_S_Camarero.set_text("") self.EB_S_Cliente.set_text("") self.EB_S_CosteTotal.set_text("") self.CursorServicesSelected = False self.CursorFactLiteSlected = False self.NB_Principal.set_current_page(1)
def LoadMesas(self): ### Limpiamos la lista actual del treeview self.ListMesas.clear() ### Obtenemos una lista de todas las mesas y su estado. Res = BD_Conect.Load(0) ### Para cada mesa comprobamos si está ocupada, en ese caso el botón cambio de imagen y se bloquea ### Si no está ocupada el botón se desbloquea y la imágen vuelve a la de disponible for i in Res: fila = (i[0], i[1], i[2]) if fila[0] == 1: if fila[2] == 'Si': self.IMG_Mesa1.set_from_file("../IMG/Mesa4_NO.jpg") self.BT_Mesa1.set_sensitive(False) else: self.IMG_Mesa1.set_from_file("../IMG/Mesa4_SI.jpg") self.BT_Mesa1.set_sensitive(True) elif fila[0] == 2: if fila[2] == 'Si': self.IMG_Mesa2.set_from_file("../IMG/Mesa4_NO.jpg") self.BT_Mesa2.set_sensitive(False) else: self.IMG_Mesa2.set_from_file("../IMG/Mesa4_SI.jpg") self.BT_Mesa2.set_sensitive(True) elif fila[0] == 3: if fila[2] == 'Si': self.IMG_Mesa3.set_from_file("../IMG/Mesa4_NO.jpg") self.BT_Mesa3.set_sensitive(False) else: self.IMG_Mesa3.set_from_file("../IMG/Mesa4_SI.jpg") self.BT_Mesa3.set_sensitive(True) elif fila[0] == 4: if fila[2] == 'Si': self.IMG_Mesa4.set_from_file("../IMG/Mesa4_NO.jpg") self.BT_Mesa4.set_sensitive(False) else: self.IMG_Mesa4.set_from_file("../IMG/Mesa4_SI.jpg") self.BT_Mesa4.set_sensitive(True) elif fila[0] == 5: if fila[2] == 'Si': self.IMG_Mesa5.set_from_file("../IMG/Mesa6_NO.jpg") self.BT_Mesa5.set_sensitive(False) else: self.IMG_Mesa5.set_from_file("../IMG/Mesa6_SI.jpg") self.BT_Mesa5.set_sensitive(True) elif fila[0] == 6: if fila[2] == 'Si': self.IMG_Mesa6.set_from_file("../IMG/Mesa6_NO.jpg") self.BT_Mesa6.set_sensitive(False) else: self.IMG_Mesa6.set_from_file("../IMG/Mesa6_SI.jpg") self.BT_Mesa6.set_sensitive(True) elif fila[0] == 7: if fila[2] == 'Si': self.IMG_Mesa7.set_from_file("../IMG/Mesa8_NO.jpg") self.BT_Mesa7.set_sensitive(False) else: self.IMG_Mesa7.set_from_file("../IMG/Mesa8_SI.jpg") self.BT_Mesa7.set_sensitive(True) elif fila[0] == 8: if fila[2] == 'Si': self.IMG_Mesa8.set_from_file("../IMG/Mesa8_NO.jpg") self.BT_Mesa8.set_sensitive(False) else: self.IMG_Mesa8.set_from_file("../IMG/Mesa8_SI.jpg") self.BT_Mesa8.set_sensitive(True) ### Obtenemos una lista sólo de las mesas ocupadas para poner en el tree view ResOcuped = BD_Conect.LoadOccuped() for i in ResOcuped: fila = (i[0], i[1], i[2]) BD_Conect.AltaLista(self.TreeMesas, self.ListMesas, fila)