Private
Public Access
hecha funcionalidad de modificacion/cancelacion de facturas
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
94a4e292c4
commit
6331e16dc5
39 files changed
+2283
-104
No files matched your search
@@ -13,6 +13,7 @@ type RepositorioFactura interface {
|
||||
Listar(filtros decorator.FiltrosFactura) ([]models.Factura, error)
|
||||
ObtenerConRelaciones(id uint) (*models.Factura, error)
|
||||
CrearConDetalles(tx *gorm.DB, factura *models.Factura) error
|
||||
GuardarAjuste(tx *gorm.DB, factura *models.Factura) error
|
||||
BloquearPorID(tx *gorm.DB, id uint) (*models.Factura, error)
|
||||
ActualizarEstadoSaldo(tx *gorm.DB, id uint, estado string, saldo float64) error
|
||||
ExisteNumero(numero string) (bool, error)
|
||||
@@ -70,6 +71,19 @@ func (r *repositorioFactura) CrearConDetalles(tx *gorm.DB, factura *models.Factu
|
||||
return tx.Create(factura).Error
|
||||
}
|
||||
|
||||
// GuardarAjuste persiste la factura completa después de modificar sus ítems,
|
||||
// totales e historial. Se omiten las asociaciones para que no se reescriban
|
||||
// cliente, almacén ni proveedor.
|
||||
func (r *repositorioFactura) GuardarAjuste(tx *gorm.DB, factura *models.Factura) error {
|
||||
if factura == nil {
|
||||
return gorm.ErrInvalidValue
|
||||
}
|
||||
if r.empresaID > 0 {
|
||||
factura.EmpresaID = r.empresaID
|
||||
}
|
||||
return tx.Omit(clause.Associations).Save(factura).Error
|
||||
}
|
||||
|
||||
func (r *repositorioFactura) BloquearPorID(tx *gorm.DB, id uint) (*models.Factura, error) {
|
||||
var factura models.Factura
|
||||
db := tx
|
||||
|
||||
Reference in new issue
Block a user