Private
Public Access
commit parcial: refactor de decorator factura, añadida parcialemnte
funcionalidad de facturas tengo sueño Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
1 parent
3c4bc5c008
commit
42bf987ffc
19 files changed
+525
-37
No files matched your search
+18
-1
@@ -1,14 +1,31 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Factura struct {
|
||||
Comprobante
|
||||
Numero string `gorm:"type:varchar(30);index" json:"numero"`
|
||||
ClienteID uint `gorm:"column:ClienteID"`
|
||||
ClienteID uint `gorm:"column:ClienteID;not null;index" json:"clienteId"`
|
||||
Cliente Cliente `gorm:"foreignKey:ClienteID" json:"cliente"`
|
||||
ProveedorID *uint `json:"proveedorId,omitempty"`
|
||||
Proveedor *Proveedor `gorm:"foreignKey:ProveedorID" json:"proveedor,omitempty"`
|
||||
AlmacenID uint `gorm:"column:almacenId;not null;default:1;index" json:"almacenId"`
|
||||
Almacen Almacen `gorm:"foreignKey:AlmacenID" json:"almacen,omitempty"`
|
||||
FechaEmision time.Time `gorm:"not null" json:"fechaEmision"`
|
||||
Subtotal float64 `gorm:"type:decimal(15,2);not null;default:0" json:"subtotal"`
|
||||
DescuentoID uint `gorm:"column:descuentoId" json:"descuentoId"`
|
||||
DescuentoTotal float64 `gorm:"type:decimal(15,2);not null;default:0" json:"descuentoTotal"`
|
||||
Impuestos float64 `gorm:"type:decimal(15,2);not null;default:0" json:"impuestos"`
|
||||
AlicuotaIVA float64 `gorm:"type:decimal(5,2);not null;default:21" json:"alicuotaIva"`
|
||||
Saldo float64 `gorm:"type:decimal(15,2);not null;default:0" json:"saldo"`
|
||||
SeAviso bool `gorm:"" json:"seAviso"`
|
||||
Detalles []FacturaDetalle `gorm:"serializer:json;type:json" json:"detalles,omitempty"`
|
||||
Historial []FacturaCambio `gorm:"serializer:json;type:json" json:"historial,omitempty"`
|
||||
Version int `gorm:"not null;default:1" json:"version"`
|
||||
EditadaPorID *uint `gorm:"column:editadaPorId" json:"editadaPorId,omitempty"`
|
||||
EditadaAt *time.Time `gorm:"column:editadaAt" json:"editadaAt,omitempty"`
|
||||
MotivoUltimaEdicion string `gorm:"type:varchar(200)" json:"motivoUltimaEdicion,omitempty"`
|
||||
Observacion string `gorm:"type:varchar(255)" json:"observacion,omitempty"`
|
||||
}
|
||||
|
||||
func (Factura) TableName() string {
|
||||
|
||||
@@ -2,9 +2,10 @@ package models
|
||||
|
||||
type FacturaDetalle struct {
|
||||
RepuestoID uint64 `json:"repuestoId"`
|
||||
Cantidad uint `json:"cantidad"`
|
||||
Cantidad float64 `json:"cantidad"`
|
||||
DescuentoID uint `json:"descuentoId"`
|
||||
Descuento float64 `json:"descuento"`
|
||||
PrecioUnitario float64 `json:"precioUnitario"`
|
||||
Subtotal float64 `json:"subtotal"`
|
||||
AlicuotaIVA float64 `json:"alicuotaIva"`
|
||||
}
|
||||
+11
-3
@@ -1,15 +1,23 @@
|
||||
package models
|
||||
|
||||
import "gorm.io/gorm"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Pago struct {
|
||||
gorm.Model
|
||||
EmpresaID uint `gorm:"not null;default:1;index" json:"empresaId"`
|
||||
FacturaID uint `gorm:"column:facturaId;index" json:"facturaId"`
|
||||
Factura *Factura `gorm:"foreignKey:FacturaID" json:"factura,omitempty"`
|
||||
FormaDePagoID uint `gorm:"column:formaDePagoID"`
|
||||
FormaDePago FormaDePago `gorm:"foreignKey:FormaDePagoID"`
|
||||
ReciboID uint `json:"reciboId"`
|
||||
Recibo Recibo `gorm:"foreignKey:ReciboID" json:"recibo,omitempty"`
|
||||
ReciboID *uint `json:"reciboId,omitempty"`
|
||||
Recibo *Recibo `gorm:"foreignKey:ReciboID" json:"recibo,omitempty"`
|
||||
Importe float64 `gorm:"type:decimal(10,2)"`
|
||||
Fecha time.Time `gorm:"not null" json:"fecha"`
|
||||
Observacion string `gorm:"type:varchar(255)" json:"observacion,omitempty"`
|
||||
}
|
||||
|
||||
func (Pago) TableName() string {
|
||||
|
||||
Reference in new issue
Block a user