diff --git a/pkg/models/contabilidad.go b/pkg/models/contabilidad.go index 1399b56..b297055 100644 --- a/pkg/models/contabilidad.go +++ b/pkg/models/contabilidad.go @@ -407,7 +407,7 @@ func SeedBalanceData() { } } - // ─── CUENTAS DE COBRO ─────────────────────────────────────────────────── + // ─── CUENTAS DE COBRO (las que te pasan a ti) → CuentasPagar ──────────── cobros := []struct{ entidad string; valor float64; fecha string }{ {"NATALIA", 2000000, "2026-01-01 00:00:00"}, {"FELIPE", 2000000, "2026-01-01 00:00:00"}, @@ -419,34 +419,23 @@ func SeedBalanceData() { {"FELIPE", 520000, "2026-04-01 00:00:00"}, {"ANDREMER", 80000, "2026-04-01 00:00:00"}, {"NATALIA", 2000000, "2026-04-01 00:00:00"}, + // FAC POR PAGAR + {"TECZONE", 2687849, "2026-01-01 00:00:00"}, } for _, cb := range cobros { eid := getEntidad(cb.entidad) - desc := fmt.Sprintf("Cobro %s %s", cb.entidad, cb.fecha[:7]) - var existing CuentaCobro + desc := fmt.Sprintf("%s %s", cb.entidad, cb.fecha[:7]) + var existing CuentaPagar if db.Where("descripcion = ?", desc).First(&existing).Error != nil { df := parseDate(cb.fecha) - db.Create(&CuentaCobro{ + db.Create(&CuentaPagar{ EntidadID: *eid, Fecha: df, Descripcion: desc, Valor: cb.valor, Estado: "pendiente", - FechaVencimiento: &df, }) } } - // ─── FAC POR PAGAR ────────────────────────────────────────────────────── - var existingCp CuentaPagar - if db.Where("descripcion = ?", "TECZONE ene 2026").First(&existingCp).Error != nil { - eid := getEntidad("TECZONE") - f := parseDate("2026-01-01 00:00:00") - db.Create(&CuentaPagar{ - EntidadID: *eid, Fecha: f, - Descripcion: "TECZONE ene 2026", - Valor: 2687849, Estado: "pendiente", - }) - } - // ─── CONSOLIDADO POR MES ─────────────────────────────────────────────── consols := []struct{ mes int; ing, egre, resul float64 }{ {1, 12669000, 8467849, 4201151}, @@ -680,14 +669,13 @@ func SeedContabilidad() { } entidades := []Entidad{ - {Nombre: "ANDREMER", Tipo: "cliente"}, - {Nombre: "GIAF SAS", Tipo: "cliente"}, - {Nombre: "TECZONE", Tipo: "cliente"}, - {Nombre: "DOCUXER", Tipo: "cliente"}, - {Nombre: "FELIPE", Tipo: "cliente"}, - {Nombre: "NATALIA", Tipo: "cliente"}, - {Nombre: "CONTADORA", Tipo: "cliente"}, - {Nombre: "ANDREMER", Tipo: "cliente"}, + {Nombre: "DOCUXER", Tipo: "cliente"}, + {Nombre: "GIAF SAS", Tipo: "cliente"}, + {Nombre: "TECZONE", Tipo: "proveedor"}, + {Nombre: "FELIPE", Tipo: "proveedor"}, + {Nombre: "NATALIA", Tipo: "proveedor"}, + {Nombre: "CONTADORA", Tipo: "proveedor"}, + {Nombre: "ANDREMER", Tipo: "proveedor"}, } for _, e := range entidades { var existing Entidad