#6492 refactor vn2008 procedures #2159
|
@ -3739,15 +3739,15 @@ INSERT INTO `vn`.`supplierDms`(`supplierFk`, `dmsFk`, `editorFk`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`accountReconciliation` (supplierAccountFk,operationDated,valueDated,amount,concept,debitCredit,calculatedCode,created)
|
INSERT INTO `vn`.`accountReconciliation` (supplierAccountFk,operationDated,valueDated,amount,concept,debitCredit,calculatedCode,created)
|
||||||
VALUES
|
VALUES
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-07 00:00:00.000',19.36,'BEL 1',1,'2','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-07 00:00:00.000',19.36,'BEL 1','debit','2','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-07 00:00:00.000',30226.43,'BEL 2',1,'1','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-07 00:00:00.000',30226.43,'BEL 2','debit','1','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',118.81,'RCBO',1,'10','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',118.81,'RCBO','debit','10','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',150.03,'TJ',1,'12','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',150.03,'TJ','debit','12','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',150.03,'TJ',1,'12','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',150.03,'TJ','debit','12','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',2149.71,'RCBO.AMAZON',1,'122','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',2149.71,'RCBO.AMAZON','debit','122','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',3210.5,'RCBO.VOLVO',1,'121','2023-12-14 08:39:53.000'),
|
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',3210.5,'RCBO.VOLVO','debit','121','2023-12-14 08:39:53.000'),
|
||||||
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',6513.7,'RCBO.ENERPLUS',1,'120','2023-12-14 08:39:53.000');
|
(241,'2023-12-13 00:00:00.000','2023-12-13 00:00:00.000',6513.7,'RCBO.ENERPLUS','debit','120','2023-12-14 08:39:53.000');
|
||||||
|
|
||||||
INSERT INTO `vn`.`accountReconciliationConfig`(debitCredit, debitCredit2, currencyFk, warehouseFk)
|
INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 1, 1);
|
(1, 1);
|
||||||
|
|
|
@ -46,15 +46,15 @@ BEGIN
|
||||||
TRUE,
|
TRUE,
|
||||||
'MB',
|
'MB',
|
||||||
ar.concept,
|
ar.concept,
|
||||||
IF(ar.debitCredit = arc.debitCredit2 AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
IF(ar.debitCredit = 'credit' AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
||||||
IF(ar.debitCredit = arc.debitCredit AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
IF(ar.debitCredit = 'debit' AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
||||||
a.id,
|
a.id,
|
||||||
sa.supplierFk,
|
sa.supplierFk,
|
||||||
arc.warehouseFk,
|
arc.warehouseFk,
|
||||||
ar.supplierAccountFk,
|
ar.supplierAccountFk,
|
||||||
ar.calculatedCode,
|
ar.calculatedCode,
|
||||||
IF(ar.debitCredit = arc.debitCredit2 AND NOT a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
IF(ar.debitCredit = 'credit' AND NOT a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
||||||
IF(ar.debitCredit = arc.debitCredit AND NOT a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
IF(ar.debitCredit = 'debit' AND NOT a.currencyFk = arc.currencyFk, ar.amount, NULL),
|
||||||
account.myUser_getId()
|
account.myUser_getId()
|
||||||
FROM accountReconciliation ar
|
FROM accountReconciliation ar
|
||||||
JOIN supplierAccount sa ON sa.id = ar.supplierAccountFk
|
JOIN supplierAccount sa ON sa.id = ar.supplierAccountFk
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
CREATE OR REPLACE TABLE `vn`.`accountReconciliationConfig` (
|
CREATE OR REPLACE TABLE `vn`.`accountReconciliationConfig` (
|
||||||
`id` INT AUTO_INCREMENT,
|
`id` INT AUTO_INCREMENT,
|
||||||
`debitCredit` INT(6),
|
|
||||||
`debitCredit2` INT(6),
|
|
||||||
`currencyFk` TINYINT(3) unsigned,
|
`currencyFk` TINYINT(3) unsigned,
|
||||||
`warehouseFk` SMALLINT(6) unsigned,
|
`warehouseFk` SMALLINT(6) unsigned,
|
||||||
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
INSERT INTO `vn`.`accountReconciliationConfig`(debitCredit, debitCredit2, currencyFk, warehouseFk)
|
INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
|
||||||
VALUES (1, 2, 1, 1);
|
VALUES (1, 1);
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`accountReconciliation` MODIFY debitCredit ENUM('debit', 'credit');
|
Loading…
Reference in New Issue
Vamos hacer un campo ENUM que sea debit, credit y eliminamos las 2 variables