Private
Public Access
commit parcial con la parte de email y comprobante correjido
Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
fcf16df5d3
commit
320cc9c241
13 files changed
+813
-36
No files matched your search
@@ -38,9 +38,11 @@ func (r *repositorioPago) Registrar(tx *gorm.DB, pago *models.Pago) error {
|
||||
return tx.Create(pago).Error
|
||||
}
|
||||
|
||||
// ListarPorFactura devuelve los pagos de una factura, con la forma de pago
|
||||
// precargada para poder mostrar su descripción.
|
||||
func (r *repositorioPago) ListarPorFactura(facturaID uint) ([]models.Pago, error) {
|
||||
var pagos []models.Pago
|
||||
if err := r.db.Where("factura_id = ?", facturaID).Find(&pagos).Error; err != nil {
|
||||
if err := r.db.Where("facturaId = ?", facturaID).Preload("FormaDePago").Find(&pagos).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pagos, nil
|
||||
@@ -48,7 +50,7 @@ func (r *repositorioPago) ListarPorFactura(facturaID uint) ([]models.Pago, error
|
||||
|
||||
func (r *repositorioPago) SumarPorFactura(facturaID uint) (float64, error) {
|
||||
var total float64
|
||||
if err := r.db.Model(&models.Pago{}).Where("factura_id = ?", facturaID).Select("COALESCE(SUM(importe),0)").Scan(&total).Error; err != nil {
|
||||
if err := r.db.Model(&models.Pago{}).Where("facturaId = ?", facturaID).Select("COALESCE(SUM(importe),0)").Scan(&total).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return total, nil
|
||||
|
||||
Reference in new issue
Block a user