Coverage for backend \ app \ Venta \ models \ ventaModel.py: 100.00%
21 statements
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-29 16:13 -0500
« prev ^ index » next coverage.py v7.13.0, created at 2025-12-29 16:13 -0500
1from sqlalchemy import Column, Integer, Float, DateTime, String, ForeignKey, func
2from sqlalchemy.orm import relationship
3from app.database import Base
5class Venta(Base):
6 __tablename__ = "venta"
7 idVenta = Column(Integer, primary_key=True, autoincrement=True)
8 idCaja = Column(Integer, ForeignKey("cajahistorial.idCaja"), nullable=False)
9 idUsuarioVenta = Column(Integer, ForeignKey("usuario.idUsuario"), nullable=False)
10 idCliente = Column(Integer, ForeignKey("cliente.idCliente"), nullable=False)
11 fechaVenta = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
12 subtotalVenta = Column(Float, nullable=False)
13 descuentoGeneral = Column(Float, nullable=False)
14 totalDescuento = Column(Float, nullable=False)
15 baseIVA = Column(Float, nullable=False)
16 totalIVA = Column(Float, nullable=False)
17 totalPagar = Column(Float, nullable=False)
18 metodoPago = Column(String(50), nullable=False)
19 estadoVenta = Column(String(30), nullable=False)
21 usuario = relationship("Usuario", back_populates="ventas")
22 cliente = relationship("Cliente", back_populates="ventas")
23 detalles = relationship("DetalleVenta", back_populates="venta")