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
@@ -0,0 +1,15 @@
|
||||
package dto
|
||||
|
||||
import "repuestera_back/models"
|
||||
|
||||
// AjusteFacturaResponse devuelve la factura actualizada y la nota emitida por
|
||||
// una modificación de ítems. También informa el impacto sobre el saldo y el
|
||||
// stock para que el frontend pueda refrescar la vista sin otra consulta.
|
||||
type AjusteFacturaResponse struct {
|
||||
Factura *FacturaResponse `json:"factura"`
|
||||
Nota *NotaResumen `json:"nota,omitempty"`
|
||||
Diferencia float64 `json:"diferencia"`
|
||||
SaldoAnterior float64 `json:"saldoAnterior"`
|
||||
SaldoNuevo float64 `json:"saldoNuevo"`
|
||||
Stocks []*models.Stock `json:"stocks,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package dto
|
||||
|
||||
// CancelarFacturaDto contiene el motivo obligatorio de la anulación.
|
||||
type CancelarFacturaDto struct {
|
||||
Motivo string `json:"motivo" binding:"required,max=40"`
|
||||
}
|
||||
@@ -6,4 +6,5 @@ package dto
|
||||
type ComprobanteResponse struct {
|
||||
*FacturaResponse
|
||||
Pagos []PagoResumen `json:"pagos"`
|
||||
Notas []NotaResumen `json:"notas"`
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package dto
|
||||
|
||||
type CrearFacturaDto struct {
|
||||
ClienteID uint `json:"clienteId" binding:"required"`
|
||||
AlmacenID uint `json:"almacenId" binding:"required"`
|
||||
Items []ItemFacturaDto `json:"items" binding:"required,min=1"`
|
||||
DescuentoID uint `json:"descuentoId"`
|
||||
Pagos []PagoFacturaDto `json:"pagos"`
|
||||
EnviarEmail bool `json:"enviarEmail"`
|
||||
Observacion string `json:"observacion"`
|
||||
ReservaID uint `json:"reservaId"`
|
||||
ClienteID uint `json:"clienteId" binding:"required"`
|
||||
AlmacenID uint `json:"almacenId" binding:"required"`
|
||||
Items []ItemFacturaDto `json:"items" binding:"required,min=1"`
|
||||
DescuentoID uint `json:"descuentoId"`
|
||||
Pagos []PagoFacturaDto `json:"pagos"`
|
||||
EnviarEmail bool `json:"enviarEmail"`
|
||||
Observacion string `json:"observacion"`
|
||||
ReservaID uint `json:"reservaId"`
|
||||
}
|
||||
|
||||
type ItemFacturaDto struct {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"repuestera_back/models"
|
||||
)
|
||||
|
||||
// FacturaAjusteDto reúne los datos calculados que se aplican a una factura
|
||||
// existente al modificarla o cancelarla, junto con el detalle de auditoría.
|
||||
type FacturaAjusteDto struct {
|
||||
Detalles []models.FacturaDetalle
|
||||
Subtotal float64
|
||||
DescuentoTotal float64
|
||||
Impuestos float64
|
||||
Total float64
|
||||
Saldo float64
|
||||
Estado string
|
||||
Motivo string
|
||||
UsuarioID uint
|
||||
ItemsAnteriores []models.FacturaDetalle
|
||||
TotalAnterior float64
|
||||
ItemsNuevos []models.FacturaDetalle
|
||||
TotalNuevo float64
|
||||
NotaTipo string
|
||||
NotaID uint
|
||||
Fecha time.Time
|
||||
}
|
||||
@@ -13,29 +13,31 @@ import (
|
||||
// los resúmenes de cliente, proveedor y responsable, pero no las
|
||||
// relaciones internas de esos modelos.
|
||||
type FacturaResponse struct {
|
||||
ID uint `json:"ID"`
|
||||
CreatedAt time.Time `json:"CreatedAt"`
|
||||
UpdatedAt time.Time `json:"UpdatedAt"`
|
||||
DeletedAt *time.Time `json:"DeletedAt"`
|
||||
EmpresaID uint `json:"empresaId"`
|
||||
Numero string `json:"numero"`
|
||||
Estado string `json:"estado"`
|
||||
Total float64 `json:"total"`
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
DescuentoTotal float64 `json:"descuentoTotal"`
|
||||
Impuestos float64 `json:"impuestos"`
|
||||
AlicuotaIVA float64 `json:"alicuotaIva"`
|
||||
Saldo float64 `json:"saldo"`
|
||||
AlmacenID uint `json:"almacenId"`
|
||||
FechaEmision time.Time `json:"fechaEmision"`
|
||||
Observacion string `json:"observacion,omitempty"`
|
||||
Version int `json:"version"`
|
||||
ClienteID uint `json:"ClienteID,omitempty"`
|
||||
Cliente dto_clientes.ClienteResumen `json:"cliente"`
|
||||
ProveedorID *uint `json:"proveedorId,omitempty"`
|
||||
Proveedor *dto_proveedores.ProveedorResumen `json:"proveedor,omitempty"`
|
||||
SeAviso bool `json:"seAviso"`
|
||||
Detalles []models.FacturaDetalle `json:"detalles,omitempty"`
|
||||
ResponsableID uint `json:"ResponsableID,omitempty"`
|
||||
Responsable *dto_base.UsuarioResumen `json:"usuario,omitempty"`
|
||||
ID uint `json:"ID"`
|
||||
CreatedAt time.Time `json:"CreatedAt"`
|
||||
UpdatedAt time.Time `json:"UpdatedAt"`
|
||||
DeletedAt *time.Time `json:"DeletedAt"`
|
||||
EmpresaID uint `json:"empresaId"`
|
||||
Numero string `json:"numero"`
|
||||
Estado string `json:"estado"`
|
||||
Total float64 `json:"total"`
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
DescuentoTotal float64 `json:"descuentoTotal"`
|
||||
Impuestos float64 `json:"impuestos"`
|
||||
AlicuotaIVA float64 `json:"alicuotaIva"`
|
||||
Saldo float64 `json:"saldo"`
|
||||
AlmacenID uint `json:"almacenId"`
|
||||
FechaEmision time.Time `json:"fechaEmision"`
|
||||
Observacion string `json:"observacion,omitempty"`
|
||||
Version int `json:"version"`
|
||||
ClienteID uint `json:"ClienteID,omitempty"`
|
||||
Cliente dto_clientes.ClienteResumen `json:"cliente"`
|
||||
ProveedorID *uint `json:"proveedorId,omitempty"`
|
||||
Proveedor *dto_proveedores.ProveedorResumen `json:"proveedor,omitempty"`
|
||||
SeAviso bool `json:"seAviso"`
|
||||
Detalles []models.FacturaDetalle `json:"detalles,omitempty"`
|
||||
Historial []models.FacturaCambio `json:"historial,omitempty"`
|
||||
MotivoUltimaEdicion string `json:"motivoUltimaEdicion,omitempty"`
|
||||
ResponsableID uint `json:"ResponsableID,omitempty"`
|
||||
Responsable *dto_base.UsuarioResumen `json:"usuario,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package dto
|
||||
|
||||
// ModificarFacturaDto reemplaza los ítems de una factura existente.
|
||||
// El motivo queda registrado en la auditoría y en la nota de ajuste.
|
||||
type ModificarFacturaDto struct {
|
||||
Items []ItemFacturaDto `json:"items" binding:"required,min=1,dive"`
|
||||
Motivo string `json:"motivo" binding:"required,max=40"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
// NotaResumen es la representación pública de una nota de crédito o débito.
|
||||
// El número se deriva del ID porque el modelo persistido no guarda un número
|
||||
// propio para estos comprobantes.
|
||||
type NotaResumen struct {
|
||||
ID uint `json:"id"`
|
||||
Tipo string `json:"tipo"`
|
||||
Numero string `json:"numero"`
|
||||
Motivo string `json:"motivo"`
|
||||
Importe float64 `json:"importe"`
|
||||
Fecha time.Time `json:"fecha"`
|
||||
FacturaID uint `json:"facturaId"`
|
||||
}
|
||||
@@ -5,11 +5,11 @@ import "time"
|
||||
// PagoResumen es la representación ligera de un pago de factura,
|
||||
// usada para mostrar el historial de pagos en el comprobante.
|
||||
type PagoResumen struct {
|
||||
ID uint `json:"id"`
|
||||
FacturaID uint `json:"facturaId,omitempty"`
|
||||
FormaDePagoID uint `json:"formaDePagoId,omitempty"`
|
||||
FormaDePago string `json:"formaDePago,omitempty"`
|
||||
Importe float64 `json:"importe"`
|
||||
ID uint `json:"id"`
|
||||
FacturaID uint `json:"facturaId,omitempty"`
|
||||
FormaDePagoID uint `json:"formaDePagoId,omitempty"`
|
||||
FormaDePago string `json:"formaDePago,omitempty"`
|
||||
Importe float64 `json:"importe"`
|
||||
Fecha time.Time `json:"fecha"`
|
||||
Observacion string `json:"observacion,omitempty"`
|
||||
Observacion string `json:"observacion,omitempty"`
|
||||
}
|
||||
Reference in new issue
Block a user