añadidos entidades, repos y facturacionservice

This commit is contained in:
2025-12-30 19:51:04 +01:00
parent 98a5fcaa0b
commit 089641b601
18 changed files with 1200 additions and 1 deletions

View File

@ -0,0 +1,407 @@
databaseChangeLog:
- changeSet:
id: 20251230-01-pedidos-lineas-enviado
author: jjo
changes:
- modifyDataType:
tableName: pedidos_lineas
columnName: estado
newDataType: >
ENUM(
'pendiente_pago',
'procesando_pago',
'denegado_pago',
'aprobado',
'maquetacion',
'haciendo_ferro',
'esperando_aceptacion_ferro',
'produccion',
'terminado',
'enviado',
'cancelado'
)
rollback:
- modifyDataType:
tableName: pedidos_lineas
columnName: estado
newDataType: >
ENUM(
'pendiente_pago',
'procesando_pago',
'denegado_pago',
'aprobado',
'maquetacion',
'haciendo_ferro',
'esperando_aceptacion_ferro',
'produccion',
'terminado',
'cancelado'
)
# -------------------------------------------------
- changeSet:
id: 20251230-02-series-facturas
author: jjo
changes:
- createTable:
tableName: series_facturas
columns:
- column:
name: id
type: BIGINT
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: nombre_serie
type: VARCHAR(100)
constraints:
nullable: false
- column:
name: prefijo
type: VARCHAR(10)
constraints:
nullable: false
- column:
name: tipo
type: ENUM('facturacion')
defaultValue: facturacion
- column:
name: numero_actual
type: BIGINT
defaultValueNumeric: 1
- column:
name: created_at
type: TIMESTAMP
- column:
name: updated_at
type: TIMESTAMP
- column:
name: deleted_at
type: TIMESTAMP
- column:
name: created_by
type: BIGINT
- column:
name: updated_by
type: BIGINT
- column:
name: deleted_by
type: BIGINT
- addForeignKeyConstraint:
constraintName: fk_series_facturas_created_by
baseTableName: series_facturas
baseColumnNames: created_by
referencedTableName: users
referencedColumnNames: id
onDelete: SET NULL
- addForeignKeyConstraint:
constraintName: fk_series_facturas_updated_by
baseTableName: series_facturas
baseColumnNames: updated_by
referencedTableName: users
referencedColumnNames: id
onDelete: SET NULL
- addForeignKeyConstraint:
constraintName: fk_series_facturas_deleted_by
baseTableName: series_facturas
baseColumnNames: deleted_by
referencedTableName: users
referencedColumnNames: id
onDelete: SET NULL
rollback:
- dropTable:
tableName: series_facturas
# -------------------------------------------------
- changeSet:
id: 20251230-03-facturas
author: jjo
changes:
- createTable:
tableName: facturas
columns:
- column:
name: id
type: BIGINT
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: pedido_id
type: BIGINT
- column:
name: factura_rectificada_id
type: BIGINT
- column:
name: factura_rectificativa_id
type: BIGINT
- column:
name: cliente_id
type: BIGINT
- column:
name: serie_id
type: BIGINT
- column:
name: numero_factura
type: VARCHAR(50)
- column:
name: estado
type: ENUM('borrador','validada')
defaultValue: borrador
- column:
name: estado_pago
type: ENUM('pendiente','pagada','cancelada')
defaultValue: pendiente
- column:
name: tipo_pago
type: ENUM('tpv_tarjeta','tpv_bizum','transferencia','otros')
defaultValue: otros
- column:
name: fecha_emision
type: DATETIME
- column:
name: base_imponible
type: DECIMAL(10,2)
- column:
name: iva_4
type: DECIMAL(10,2)
- column:
name: iva_21
type: DECIMAL(10,2)
- column:
name: total_factura
type: DECIMAL(10,2)
- column:
name: total_pagado
type: DECIMAL(10,2)
defaultValueNumeric: 0.00
- column:
name: notas
type: TEXT
- column:
name: created_at
type: TIMESTAMP
- column:
name: updated_at
type: TIMESTAMP
- column:
name: deleted_at
type: TIMESTAMP
- column:
name: created_by
type: BIGINT
- column:
name: updated_by
type: BIGINT
- column:
name: deleted_by
type: BIGINT
- addUniqueConstraint:
constraintName: uq_facturas_numero_factura
tableName: facturas
columnNames: numero_factura
- addForeignKeyConstraint:
constraintName: fk_facturas_pedido
baseTableName: facturas
baseColumnNames: pedido_id
referencedTableName: pedidos
referencedColumnNames: id
- addForeignKeyConstraint:
constraintName: fk_facturas_cliente
baseTableName: facturas
baseColumnNames: cliente_id
referencedTableName: users
referencedColumnNames: id
- addForeignKeyConstraint:
constraintName: fk_facturas_serie
baseTableName: facturas
baseColumnNames: serie_id
referencedTableName: series_facturas
referencedColumnNames: id
- addForeignKeyConstraint:
constraintName: fk_facturas_rectificada
baseTableName: facturas
baseColumnNames: factura_rectificada_id
referencedTableName: facturas
referencedColumnNames: id
- addForeignKeyConstraint:
constraintName: fk_facturas_rectificativa
baseTableName: facturas
baseColumnNames: factura_rectificativa_id
referencedTableName: facturas
referencedColumnNames: id
rollback:
- dropTable:
tableName: facturas
# -------------------------------------------------
- changeSet:
id: 20251230-04-facturas-lineas
author: jjo
changes:
- createTable:
tableName: facturas_lineas
columns:
- column:
name: id
type: BIGINT
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: factura_id
type: BIGINT
- column:
name: descripcion
type: TEXT
- column:
name: cantidad
type: INT
- column:
name: base_linea
type: DECIMAL(10,2)
- column:
name: iva_4_linea
type: DECIMAL(10,2)
- column:
name: iva_21_linea
type: DECIMAL(10,2)
- column:
name: total_linea
type: DECIMAL(10,2)
- column:
name: created_at
type: TIMESTAMP
- column:
name: updated_at
type: TIMESTAMP
- column:
name: deleted_at
type: TIMESTAMP
- column:
name: created_by
type: BIGINT
- column:
name: updated_by
type: BIGINT
- column:
name: deleted_by
type: BIGINT
- addForeignKeyConstraint:
constraintName: fk_facturas_lineas_factura
baseTableName: facturas_lineas
baseColumnNames: factura_id
referencedTableName: facturas
referencedColumnNames: id
rollback:
- dropTable:
tableName: facturas_lineas
# -------------------------------------------------
- changeSet:
id: 20251230-05-facturas-pagos
author: jjo
changes:
- createTable:
tableName: facturas_pagos
columns:
- column:
name: id
type: BIGINT
autoIncrement: true
constraints:
primaryKey: true
nullable: false
- column:
name: factura_id
type: BIGINT
- column:
name: metodo_pago
type: ENUM('tpv_tarjeta','tpv_bizum','transferencia','otros')
defaultValue: otros
- column:
name: cantidad_pagada
type: DECIMAL(10,2)
- column:
name: fecha_pago
type: DATETIME
- column:
name: notas
type: TEXT
- column:
name: created_at
type: TIMESTAMP
- column:
name: updated_at
type: TIMESTAMP
- column:
name: deleted_at
type: TIMESTAMP
- column:
name: created_by
type: BIGINT
- column:
name: updated_by
type: BIGINT
- column:
name: deleted_by
type: BIGINT
- addForeignKeyConstraint:
constraintName: fk_facturas_pagos_factura
baseTableName: facturas_pagos
baseColumnNames: factura_id
referencedTableName: facturas
referencedColumnNames: id
rollback:
- dropTable:
tableName: facturas_pagos

View File

@ -42,4 +42,6 @@ databaseChangeLog:
- include:
file: db/changelog/changesets/0021-add-email-and-is-palets-to-pedidos-direcciones.yml
- include:
file: db/changelog/changesets/0022-add-estados-pago-to-pedidos-lineas-3.yml
file: db/changelog/changesets/0022-add-estados-pago-to-pedidos-lineas-3.yml
- include:
file: db/changelog/changesets/0023-facturacion.yml