class Factura: def __init__(self): self.conexion = Conexion() def listar(self, fechaFactura): query = f"select f.idFactura, f.fechaFactura, c.nombreCliente from factura f inner join cliente c on f.idCliente = c.idCliente where f.fechaFactura = '{fechaFactura}' " resultado = self.conexion.ejecutar_query(query) filas = resultado.fetchall() print(filas)
class Detalle: def __init__(self): self.conexion = Conexion() def listar(self, idFactura): query = f"select d.idFactura, p.nombreProducto, d.cantidadProducto from detalle d inner join producto p on d.idProducto = p.idProducto where idFactura = '{idFactura}'" resultado = self.conexion.ejecutar_query(query) filas = resultado.fetchall() print(filas)
class Boleta: def __init__(self): self.conexion=Conexion() # listara las boletas que sean de la fecha ingresada def listarVentas(self,fechaBoleta): query=f'select * from mydb.boleta where fechaBoleta="{fechaBoleta}"' resultado=self.conexion.ejecutar_query(query) filas = resultado.fetchall() print(filas) # imprimira los productos de una boleta ingresando el id de la boleta def listarBoleta(self,idBoleta): query=f'select productos.nombreProducto from productos inner join detalle on productos.idProducto=detalle.PRODUCTOS_idProductos where detalle.BOLETA_idBoleta={idBoleta}' resultado=self.conexion.ejecutar_query(query) filas = resultado.fetchall() print("---------------------------") for fila in filas: print(fila[0])
class Boleta: def __init__(self): self.conexion = Conexion() # listara las boletas que sean de la fecha ingresada def listarVentas(self, fechaFactura): query = f'select * from registro_ventas.factura where fecha_factura="{fechaFactura}"' resultado = self.conexion.ejecutar_query(query) filas = resultado.fetchall() print(filas)