.
This commit is contained in:
parent
a810312f01
commit
a43dbe4952
@ -183,14 +183,6 @@ INSERT INTO proformas (
|
|||||||
language_code,
|
language_code,
|
||||||
currency_code,
|
currency_code,
|
||||||
customer_id,
|
customer_id,
|
||||||
customer_tin,
|
|
||||||
customer_name,
|
|
||||||
customer_street,
|
|
||||||
customer_street2,
|
|
||||||
customer_city,
|
|
||||||
customer_province,
|
|
||||||
customer_postal_code,
|
|
||||||
customer_country,
|
|
||||||
payment_method_id,
|
payment_method_id,
|
||||||
payment_term_id,
|
payment_term_id,
|
||||||
tax_regime_code,
|
tax_regime_code,
|
||||||
@ -237,14 +229,6 @@ SELECT
|
|||||||
language_code,
|
language_code,
|
||||||
currency_code,
|
currency_code,
|
||||||
customer_id,
|
customer_id,
|
||||||
customer_tin,
|
|
||||||
customer_name,
|
|
||||||
customer_street,
|
|
||||||
customer_street2,
|
|
||||||
customer_city,
|
|
||||||
customer_province,
|
|
||||||
customer_postal_code,
|
|
||||||
customer_country,
|
|
||||||
payment_method_id,
|
payment_method_id,
|
||||||
NULL AS payment_term_id,
|
NULL AS payment_term_id,
|
||||||
tax_regime_code,
|
tax_regime_code,
|
||||||
@ -368,8 +352,8 @@ SELECT
|
|||||||
NULL AS payment_term_name,
|
NULL AS payment_term_name,
|
||||||
NULL AS payment_term_description,
|
NULL AS payment_term_description,
|
||||||
NULL AS payment_term_snapshot_json,
|
NULL AS payment_term_snapshot_json,
|
||||||
tax_regime_code,
|
COALESCE(tax_regime_code, "01"),
|
||||||
COALESCE(tax_regime_description, tax_regime_code),
|
COALESCE(tax_regime_description, "01: Operación de régimen general."),
|
||||||
subtotal_amount_value,
|
subtotal_amount_value,
|
||||||
subtotal_amount_scale,
|
subtotal_amount_scale,
|
||||||
items_discount_amount_value,
|
items_discount_amount_value,
|
||||||
@ -443,7 +427,9 @@ INSERT INTO proforma_items (
|
|||||||
taxes_amount_value,
|
taxes_amount_value,
|
||||||
taxes_amount_scale,
|
taxes_amount_scale,
|
||||||
total_amount_value,
|
total_amount_value,
|
||||||
total_amount_scale
|
total_amount_scale,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
i.item_id,
|
i.item_id,
|
||||||
@ -486,13 +472,105 @@ SELECT
|
|||||||
i.taxes_amount_value,
|
i.taxes_amount_value,
|
||||||
i.taxes_amount_scale,
|
i.taxes_amount_scale,
|
||||||
i.total_amount_value,
|
i.total_amount_value,
|
||||||
i.total_amount_scale
|
i.total_amount_scale,
|
||||||
|
now(),
|
||||||
|
now()
|
||||||
FROM customer_invoice_items i
|
FROM customer_invoice_items i
|
||||||
JOIN customer_invoices ci ON ci.id = i.invoice_id
|
JOIN customer_invoices ci ON ci.id = i.invoice_id
|
||||||
WHERE ci.is_proforma = 1;
|
WHERE ci.is_proforma = 1;
|
||||||
|
|
||||||
INSERT INTO issued_invoice_items (...)
|
|
||||||
SELECT ...
|
|
||||||
|
|
||||||
|
INSERT INTO issued_invoice_items (
|
||||||
|
item_id,
|
||||||
|
issued_invoice_id,
|
||||||
|
position,
|
||||||
|
description,
|
||||||
|
quantity_value,
|
||||||
|
quantity_scale,
|
||||||
|
unit_amount_value,
|
||||||
|
unit_amount_scale,
|
||||||
|
subtotal_amount_value,
|
||||||
|
subtotal_amount_scale,
|
||||||
|
item_discount_percentage_value,
|
||||||
|
item_discount_percentage_scale,
|
||||||
|
item_discount_amount_value,
|
||||||
|
item_discount_amount_scale,
|
||||||
|
global_discount_percentage_value,
|
||||||
|
global_discount_percentage_scale,
|
||||||
|
global_discount_amount_value,
|
||||||
|
global_discount_amount_scale,
|
||||||
|
total_discount_amount_value,
|
||||||
|
total_discount_amount_scale,
|
||||||
|
taxable_amount_value,
|
||||||
|
taxable_amount_scale,
|
||||||
|
iva_code,
|
||||||
|
iva_percentage_value,
|
||||||
|
iva_percentage_scale,
|
||||||
|
iva_amount_value,
|
||||||
|
iva_amount_scale,
|
||||||
|
rec_code,
|
||||||
|
rec_percentage_value,
|
||||||
|
rec_percentage_scale,
|
||||||
|
rec_amount_value,
|
||||||
|
rec_amount_scale,
|
||||||
|
retention_code,
|
||||||
|
retention_percentage_value,
|
||||||
|
retention_percentage_scale,
|
||||||
|
retention_amount_value,
|
||||||
|
retention_amount_scale,
|
||||||
|
taxes_amount_value,
|
||||||
|
taxes_amount_scale,
|
||||||
|
total_amount_value,
|
||||||
|
total_amount_scale,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
i.item_id,
|
||||||
|
i.invoice_id,
|
||||||
|
i.position,
|
||||||
|
i.description,
|
||||||
|
i.quantity_value,
|
||||||
|
i.quantity_scale,
|
||||||
|
i.unit_amount_value,
|
||||||
|
i.unit_amount_scale,
|
||||||
|
i.subtotal_amount_value,
|
||||||
|
i.subtotal_amount_scale,
|
||||||
|
i.item_discount_percentage_value,
|
||||||
|
i.item_discount_percentage_scale,
|
||||||
|
i.item_discount_amount_value,
|
||||||
|
i.item_discount_amount_scale,
|
||||||
|
i.global_discount_percentage_value,
|
||||||
|
i.global_discount_percentage_scale,
|
||||||
|
i.global_discount_amount_value,
|
||||||
|
i.global_discount_amount_scale,
|
||||||
|
i.total_discount_amount_value,
|
||||||
|
i.total_discount_amount_scale,
|
||||||
|
i.taxable_amount_value,
|
||||||
|
i.taxable_amount_scale,
|
||||||
|
i.iva_code,
|
||||||
|
i.iva_percentage_value,
|
||||||
|
i.iva_percentage_scale,
|
||||||
|
i.iva_amount_value,
|
||||||
|
i.iva_amount_scale,
|
||||||
|
i.rec_code,
|
||||||
|
i.rec_percentage_value,
|
||||||
|
i.rec_percentage_scale,
|
||||||
|
i.rec_amount_value,
|
||||||
|
i.rec_amount_scale,
|
||||||
|
i.retention_code,
|
||||||
|
i.retention_percentage_value,
|
||||||
|
i.retention_percentage_scale,
|
||||||
|
i.retention_amount_value,
|
||||||
|
i.retention_amount_scale,
|
||||||
|
i.taxes_amount_value,
|
||||||
|
i.taxes_amount_scale,
|
||||||
|
i.total_amount_value,
|
||||||
|
i.total_amount_scale,
|
||||||
|
now(),
|
||||||
|
now()
|
||||||
FROM customer_invoice_items i
|
FROM customer_invoice_items i
|
||||||
JOIN customer_invoices ci ON ci.id = i.invoice_id
|
JOIN customer_invoices ci ON ci.id = i.invoice_id
|
||||||
WHERE ci.is_proforma = 0;
|
WHERE ci.is_proforma = 0;
|
||||||
@ -522,7 +600,9 @@ INSERT INTO proforma_taxes (
|
|||||||
retention_amount_value,
|
retention_amount_value,
|
||||||
retention_amount_scale,
|
retention_amount_scale,
|
||||||
taxes_amount_value,
|
taxes_amount_value,
|
||||||
taxes_amount_scale
|
taxes_amount_scale,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
t.tax_id,
|
t.tax_id,
|
||||||
@ -545,13 +625,60 @@ SELECT
|
|||||||
t.retention_amount_value,
|
t.retention_amount_value,
|
||||||
t.retention_amount_scale,
|
t.retention_amount_scale,
|
||||||
t.taxes_amount_value,
|
t.taxes_amount_value,
|
||||||
t.taxes_amount_scale
|
t.taxes_amount_scale,
|
||||||
|
now(),
|
||||||
|
now()
|
||||||
FROM customer_invoice_taxes t
|
FROM customer_invoice_taxes t
|
||||||
JOIN customer_invoices ci ON ci.id = t.invoice_id
|
JOIN customer_invoices ci ON ci.id = t.invoice_id
|
||||||
WHERE ci.is_proforma = 1;
|
WHERE ci.is_proforma = 1;
|
||||||
|
|
||||||
INSERT INTO issued_invoice_taxes (...)
|
INSERT INTO issued_invoice_taxes (tax_id,
|
||||||
SELECT ...
|
issued_invoice_id,
|
||||||
|
taxable_amount_value,
|
||||||
|
taxable_amount_scale,
|
||||||
|
iva_code,
|
||||||
|
iva_percentage_value,
|
||||||
|
iva_percentage_scale,
|
||||||
|
iva_amount_value,
|
||||||
|
iva_amount_scale,
|
||||||
|
rec_code,
|
||||||
|
rec_percentage_value,
|
||||||
|
rec_percentage_scale,
|
||||||
|
rec_amount_value,
|
||||||
|
rec_amount_scale,
|
||||||
|
retention_code,
|
||||||
|
retention_percentage_value,
|
||||||
|
retention_percentage_scale,
|
||||||
|
retention_amount_value,
|
||||||
|
retention_amount_scale,
|
||||||
|
taxes_amount_value,
|
||||||
|
taxes_amount_scale,
|
||||||
|
created_at,
|
||||||
|
updated_at)
|
||||||
|
SELECT
|
||||||
|
t.tax_id,
|
||||||
|
t.invoice_id,
|
||||||
|
t.taxable_amount_value,
|
||||||
|
t.taxable_amount_scale,
|
||||||
|
t.iva_code,
|
||||||
|
t.iva_percentage_value,
|
||||||
|
t.iva_percentage_scale,
|
||||||
|
t.iva_amount_value,
|
||||||
|
t.iva_amount_scale,
|
||||||
|
t.rec_code,
|
||||||
|
t.rec_percentage_value,
|
||||||
|
t.rec_percentage_scale,
|
||||||
|
t.rec_amount_value,
|
||||||
|
t.rec_amount_scale,
|
||||||
|
t.retention_code,
|
||||||
|
t.retention_percentage_value,
|
||||||
|
t.retention_percentage_scale,
|
||||||
|
t.retention_amount_value,
|
||||||
|
t.retention_amount_scale,
|
||||||
|
t.taxes_amount_value,
|
||||||
|
t.taxes_amount_scale,
|
||||||
|
now(),
|
||||||
|
now()
|
||||||
FROM customer_invoice_taxes t
|
FROM customer_invoice_taxes t
|
||||||
JOIN customer_invoices ci ON ci.id = t.invoice_id
|
JOIN customer_invoices ci ON ci.id = t.invoice_id
|
||||||
WHERE ci.is_proforma = 0;
|
WHERE ci.is_proforma = 0;
|
||||||
|
|||||||
@ -512,6 +512,14 @@ export default (database: Sequelize) => {
|
|||||||
fields: ["source_proforma_id"],
|
fields: ["source_proforma_id"],
|
||||||
unique: true,
|
unique: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Quiksearch => "CriteriaToSequelizeConverter" construye la sentencia SQL de búsqueda FULLTEXT
|
||||||
|
// a partir de este índice. Las columnas deben coincidir con los campos de búsqueda rápida definidos en el repositorio.
|
||||||
|
{
|
||||||
|
name: "idx_qs_issued_invoices",
|
||||||
|
type: "FULLTEXT",
|
||||||
|
fields: ["invoice_number", "reference", "description"],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
whereMergeStrategy: "and",
|
whereMergeStrategy: "and",
|
||||||
defaultScope: {},
|
defaultScope: {},
|
||||||
|
|||||||
@ -419,6 +419,14 @@ export default (database: Sequelize) => {
|
|||||||
fields: ["company_id", "proforma_reference"],
|
fields: ["company_id", "proforma_reference"],
|
||||||
unique: true,
|
unique: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Quiksearch => "CriteriaToSequelizeConverter" construye la sentencia SQL de búsqueda FULLTEXT
|
||||||
|
// a partir de este índice. Las columnas deben coincidir con los campos de búsqueda rápida definidos en el repositorio.
|
||||||
|
{
|
||||||
|
name: "idx_qs_proformas",
|
||||||
|
type: "FULLTEXT",
|
||||||
|
fields: ["proforma_reference", "reference", "description"],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
whereMergeStrategy: "and",
|
whereMergeStrategy: "and",
|
||||||
defaultScope: {},
|
defaultScope: {},
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
export * from "./issued-invoice-public-services";
|
|
||||||
export * from "./issued-invoice-persistence.di";
|
export * from "./issued-invoice-persistence.di";
|
||||||
export * from "./issued-invoice-persistence-mappers-v2.di";
|
export * from "./issued-invoice-persistence-mappers-v2.di";
|
||||||
export * from "./issued-invoice-persistence-mappers.di";
|
export * from "./issued-invoice-public-services";
|
||||||
|
//export * from "./issued-invoice-persistence-mappers.di";
|
||||||
export * from "./issued-invoice-repositories-v2.di";
|
export * from "./issued-invoice-repositories-v2.di";
|
||||||
export * from "./issued-invoice-repositories.di";
|
//export * from "./issued-invoice-repositories.di";
|
||||||
export * from "./issued-invoices.di";
|
export * from "./issued-invoices.di";
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
export * from "./sequelize-issued-invoice-v2-domain.mapper";
|
export * from "./sequelize-issued-invoice-v2-domain.mapper";
|
||||||
/*export * from "./sequelize-issued-invoice-v2-item-domain.mapper";
|
export * from "./sequelize-issued-invoice-v2-item-domain.mapper";
|
||||||
export * from "./sequelize-issued-invoice-v2-recipient-domain.mapper";
|
export * from "./sequelize-issued-invoice-v2-recipient-domain.mapper";
|
||||||
export * from "./sequelize-issued-invoice-v2-taxes-domain.mapper";
|
export * from "./sequelize-issued-invoice-v2-taxes-domain.mapper";
|
||||||
export * from "./sequelize-issued-invoice-v2-verifactu-domain.mapper";
|
export * from "./sequelize-issued-invoice-v2-verifactu-domain.mapper";
|
||||||
*/
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user