7806_devToTest_2332 #2801
|
@ -1,5 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(vInvoiceInFk INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInDueDay_calculate`(
|
||||||
|
vInvoiceInFk INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula los vctos. de una factura recibida
|
* Calcula los vctos. de una factura recibida
|
||||||
|
@ -56,12 +58,13 @@ BEGIN
|
||||||
COUNT(DISTINCT(pdd.detail)) cont,
|
COUNT(DISTINCT(pdd.detail)) cont,
|
||||||
s.payDay,
|
s.payDay,
|
||||||
ii.issued,
|
ii.issued,
|
||||||
DATE(ii.created) + INTERVAL 2 DAY created
|
DATE(ii.created) + INTERVAL iic.dueDateMarginDays DAY created
|
||||||
FROM invoiceIn ii
|
FROM invoiceIn ii
|
||||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||||
LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk
|
LEFT JOIN sage.TiposIva ti ON ti.CodigoIva= iit.taxTypeSageFk
|
||||||
JOIN supplier s ON s.id = ii.supplierFk
|
JOIN supplier s ON s.id = ii.supplierFk
|
||||||
JOIN payDemDetail pdd ON pdd.id = s.payDemFk
|
JOIN payDemDetail pdd ON pdd.id = s.payDemFk
|
||||||
|
JOIN invoiceInConfig iic
|
||||||
WHERE ii.id = vInvoiceInFk
|
WHERE ii.id = vInvoiceInFk
|
||||||
GROUP BY ii.id
|
GROUP BY ii.id
|
||||||
)sub
|
)sub
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.invoiceInConfig
|
||||||
|
ADD dueDateMarginDays INT UNSIGNED DEFAULT 2 NULL;
|
Loading…
Reference in New Issue