Private
Public Access
hecho lo ded Registro de pagos
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
b68db07c92
commit
09830e15ec
19 files changed
+722
-46
No files matched your search
@@ -9,6 +9,8 @@ import (
|
||||
type RepositorioFormaDePago interface {
|
||||
IRepositorio[models.FormaDePago]
|
||||
ObtenerPorDescripcion(descripcion string) (*models.FormaDePago, error)
|
||||
ListarActivas() ([]models.FormaDePago, error)
|
||||
ObtenerActivaPorID(id uint) (*models.FormaDePago, error)
|
||||
}
|
||||
|
||||
type repositorioFormaDePago struct {
|
||||
@@ -34,3 +36,21 @@ func (r *repositorioFormaDePago) ObtenerPorDescripcion(descripcion string) (*mod
|
||||
}
|
||||
return &fp, nil
|
||||
}
|
||||
|
||||
// ListarActivas devuelve las formas de pago vigentes de la empresa.
|
||||
func (r *repositorioFormaDePago) ListarActivas() ([]models.FormaDePago, error) {
|
||||
var formas []models.FormaDePago
|
||||
if err := r.db.Order("descripcion ASC").Find(&formas).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return formas, nil
|
||||
}
|
||||
|
||||
// ObtenerActivaPorID busca una forma de pago vigente de la empresa.
|
||||
func (r *repositorioFormaDePago) ObtenerActivaPorID(id uint) (*models.FormaDePago, error) {
|
||||
var fp models.FormaDePago
|
||||
if err := r.db.First(&fp, id).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &fp, nil
|
||||
}
|
||||
Reference in new issue
Block a user