diff --git a/back/models/factura.go b/back/models/factura.go index 52c2eca..8546078 100644 --- a/back/models/factura.go +++ b/back/models/factura.go @@ -5,7 +5,6 @@ type Factura struct { Comprobante ClienteID uint `gorm:"column:ClienteID"` Cliente Cliente `gorm:"foreignKey:ClienteID" json:"cliente"` - Total float64 `gorm:"not null;default:0" json:"total"` Detalles []FacturaDetalle `gorm:"type:json" json:"detalles,omitempty"` } diff --git a/back/models/repuesto.go b/back/models/repuesto.go index 7e041ea..d727e5f 100644 --- a/back/models/repuesto.go +++ b/back/models/repuesto.go @@ -11,7 +11,8 @@ type Repuesto struct { Precio float64 `gorm:"not null;type:decimal(10,2)" json:"precio" binding:"required"` StockMinimo int64 `gorm:"not null;type:bigint" json:"stockMinimo" binding:"required"` Descripcion string `gorm:"uniqueIndex;not null;type:varchar(70)" json:"descripcion" binding:"required"` - Marca Marca `gorm:"foreignKey:marcaId"` + MarcaID uint `gorm:"column:marcaID"` + Marca Marca `gorm:"foreignKey:marcaID"` Aliases datatypes.JSONSlice[string] `gorm:"type:json" json:"aliases,omitempty"` Stocks []Stock `gorm:"foreignKey:RepuestoID" json:"stocks,omitempty"` } diff --git a/docs/diagramas/plantuml/D-CLA-DOM-001.org b/docs/diagramas/plantuml/D-CLA-DOM-001.org index 83b8fca..7cf30af 100644 --- a/docs/diagramas/plantuml/D-CLA-DOM-001.org +++ b/docs/diagramas/plantuml/D-CLA-DOM-001.org @@ -6,36 +6,50 @@ title SAP-TFI-2026 — Diagrama de Dominio (iteracion 1) skinparam classAttributeIconSize 0 +class "gorm.Model" { + ID: uint + CreatedAt: Time + UpdatedAt: Time + DeletedAt: Time +} + class "Almacen" as A { ID: string - Razon: string - Stock: []Stock + Ubicacion: string + Stocks: []Stock } Almacen -- Stock +class "Cliente" as CC { + Nombre: string + Facturas: []Factura + Recibos: []Recibo +} +Cliente -- Factura +Cliente -- Recibo +Cliente --|> gorm.Model + +class "Comprobante" as CBT { + Numero: string + Estado: string + Total: float64 + ResponsableID: uint + Responsable: Usuario +} +Comprobante --|> gorm.Model +Comprobante -- Usuario + class "Factura" as F { - ID: uint64 - UsuarioID: uint64 - Fecha: time.Time ClienteID uint64 Cliente Cliente - Total: float64 Detalles: []FacturaDetalle - ComprobanteID: uint64 - Comprobante: Comprobante - Usuario: Usuario } Factura -- FacturaDetalle -Factura -- Comprobante +Factura --|> Comprobante Factura -- Cliente -class "Cliente" as CL { - ID: uint - Nombre: uint - Facturas: []Factura -} class "FacturaDetalle" as FD { RepuestoID: uint64 @@ -46,38 +60,57 @@ class "FacturaDetalle" as FD { FacturaDetalle -- Repuesto +class "FormaPago" as FPF { + Descripcion: string +} +FormaPago --|> gorm.Model + class "Marca" as M { - ID: uint Nombre: string Repuestos: []Repuesto - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt } Marca -- Repuesto +Marca --|> gorm.Model + +class "NotaCredito" as NC { + Motivo: string + FacturaOrigenID: uint + FacturaOrigen: Factura +} +NotaCredito --|> Comprobante +NotaCredito -- Factura + +class "NotaDebito" as NC { + Motivo: string + FacturaOrigenID: uint + FacturaOrigen: Factura +} +NotaDebito --|> Comprobante +NotaDebito -- Factura class "OrdenCompra" as O { - ID: uint64 - UsuarioID: uint64 - Fecha: time.Time - Total: float64 - Detalles: []OrdenCompraDetalle - Usuario: Usuario ProveedorId: uint Proveedor: Proveedor - ComprobanteID: uint64 - Comprobante: Comprobante + Detalles: []OrdenCompraDetalle } OrdenCompra -- OrdenCompraDetalle OrdenCompra -- Proveedor -OrdenCompra -- Comprobante +OrdenCompra --|> Comprobante + +class "Pago" as PPP { + FormaDePagoID: uint + FormaDePago: FormaPago + Importe: float64 +} +Pago --|> gorm.Model class "Proveedor" as PR { - ID: uint Nombre: uint Facturas: []Factura } +Proveedor --|> gorm.Model +Proveedor -- Factura class "OrdenCompraDetalle" as OD { RepuestoID: uint64 @@ -88,57 +121,47 @@ class "OrdenCompraDetalle" as OD { OrdenCompraDetalle -- Repuesto +class "Recibo" as RC { + Pagos: []Pago +} +Recibo -- Pago +Recibo --|> Comprobante + class "Repuesto" as R { - ID: uint64 Nombre: string Precio: float64 StockMinimo: int64 Descripcion: string - MarcaID: string + MarcaID: uint + Marca: Marca Aliases: []string Stocks: []Stock - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt } - +Repuesto --|> Comprobante Repuesto -- Stock +Repuesto -- Marca class "Stock" as S { ID: uint64 RepuestoID: uint64 - CajonID: string Cantidad: uint Repuesto: Repuesto - Cajon: Cajon } package Contabilidad { class "CuentaContable" as CC { - ID: uint - Codigo: string Nombre: string - Tipo: TipoCuenta + Tipo: string Movimientos: []MovimientoContable - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt } class "AsientoContable" as AC { - ID: uint - Fecha: time.Time Descripcion: string - ComprobanteID: uint Movimientos: []MovimientoContable - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt } class "MovimientoContable" as MC { - ID: uint AsientoID: uint Asiento: AsientoContable CuentaID: uint @@ -146,98 +169,18 @@ package Contabilidad { Debe: float64 Haber: float64 Descripcion: string - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt - } - class "Comprobante" as CB{ - ID: uint - Tipo TipoComprobante - Numero string - Fecha time.Time - Estado EstadoComprobante - Total decimal.Decimal - AsientoID *uint - Asiento *AsientoContable - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt - } - - class "Recibo" as RC { - ID: uint - Cliente: string - Fecha: time.Time - Total: float64 - ComprobanteID: uint64 - Comprobante: Comprobante - Pagos: []Pago - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt - } - - class "OrdenPago" as OP { - ID: uint64 - Proveedor: string - Fecha: time.Time - Total: float64 - ComprobanteID: uint64 - Comprobante: Comprobante - Pagos: []Pago - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt - } - - class "NotaCredito" as NC { - ID: uint64 - Motivo: string - Fecha: time.Time - Total: float64 - ComprobanteID: uint64 - Comprobante: Comprobante - ComprobanteOrigenID: uint64 - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt - } - - class "NotaDebito" as ND { - ID: uint64 - Motivo: string - Fecha: time.Time - Total: float64 - ComprobanteID: uint64 - Comprobante: Comprobante - ComprobanteOrigenID: uint64 - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt - } - - class "Pago" as PG { - ID: uint64 - FormaPago: FormaPago - Importe: float64 - CreatedAt: time.Time - UpdatedAt: time.Time - DeletedAt: gorm.DeletedAt } } + AsientoContable --|> gorm.Model + MovimientoContable --|> gorm.Model + CuentaContable --|> gorm.Model + CuentaContable -- MovimientoContable AsientoContable -- MovimientoContable Comprobante -- AsientoContable - Recibo -- Pago - OrdenPago -- Pago - - Recibo -- Comprobante - OrdenPago -- Comprobante - NotaCredito -- Comprobante - NotaDebito -- Comprobante @enduml #+end_src diff --git a/docs/diagramas/png/D-CLA-DOM-001.png b/docs/diagramas/png/D-CLA-DOM-001.png index f09f76b..188aa49 100644 Binary files a/docs/diagramas/png/D-CLA-DOM-001.png and b/docs/diagramas/png/D-CLA-DOM-001.png differ