#6492 refactor vn2008 procedures #2159

Merged
jorgep merged 18 commits from 6492-refactorProceduresVn2008 into dev 2024-04-10 09:42:07 +00:00
5 changed files with 17 additions and 18 deletions
Showing only changes of commit a3c1bceb7e - Show all commits

View File

@ -3739,15 +3739,15 @@ INSERT INTO `vn`.`supplierDms`(`supplierFk`, `dmsFk`, `editorFk`)
INSERT INTO `vn`.`accountReconciliation` (supplierAccountFk,operationDated,valueDated,amount,concept,debitCredit,calculatedCode,created)
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',30226.43,'BEL 2',1,'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',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',1,'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',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',6513.7,'RCBO.ENERPLUS',1,'120','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','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','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','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','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','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','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','debit','120','2023-12-14 08:39:53.000');
INSERT INTO `vn`.`accountReconciliationConfig`(debitCredit, debitCredit2, currencyFk, warehouseFk)
INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
VALUES
(1, 2, 1, 1);
(1, 1);

View File

@ -46,15 +46,15 @@ BEGIN
TRUE,
'MB',
ar.concept,
IF(ar.debitCredit = arc.debitCredit2 AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
IF(ar.debitCredit = arc.debitCredit AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
IF(ar.debitCredit = 'credit' AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
IF(ar.debitCredit = 'debit' AND a.currencyFk = arc.currencyFk, ar.amount, NULL),
a.id,
sa.supplierFk,
arc.warehouseFk,
ar.supplierAccountFk,
ar.calculatedCode,
IF(ar.debitCredit = arc.debitCredit2 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 = 'credit' 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()
FROM accountReconciliation ar
JOIN supplierAccount sa ON sa.id = ar.supplierAccountFk

View File

@ -1,7 +1,5 @@
CREATE OR REPLACE TABLE `vn`.`accountReconciliationConfig` (
`id` INT AUTO_INCREMENT,
`debitCredit` INT(6),
`debitCredit2` INT(6),
`currencyFk` TINYINT(3) unsigned,
`warehouseFk` SMALLINT(6) unsigned,
Review

Vamos hacer un campo ENUM que sea debit, credit y eliminamos las 2 variables

Vamos hacer un campo ENUM que sea debit, credit y eliminamos las 2 variables
PRIMARY KEY (`id`),

View File

@ -1,2 +1,2 @@
INSERT INTO `vn`.`accountReconciliationConfig`(debitCredit, debitCredit2, currencyFk, warehouseFk)
VALUES (1, 2, 1, 1);
INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
VALUES (1, 1);

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`accountReconciliation` MODIFY debitCredit ENUM('debit', 'credit');