From eeede417ebd20962e084a36d676335e86a87a41c Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 17 May 2022 12:24:35 +0200 Subject: [PATCH 1/3] feat: update date depending of accountingType --- back/models/accounting-type.json | 3 +++ db/changes/10470-family/00-accountingType.sql | 2 ++ db/dump/fixtures.sql | 19 ++++++++++--------- modules/client/front/balance/create/index.js | 14 ++++++++------ 4 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 db/changes/10470-family/00-accountingType.sql diff --git a/back/models/accounting-type.json b/back/models/accounting-type.json index be08ac533..086be9d13 100644 --- a/back/models/accounting-type.json +++ b/back/models/accounting-type.json @@ -28,6 +28,9 @@ }, "maxAmount": { "type": "number" + }, + "daysInFuture": { + "type": "number" } }, "acls": [{ diff --git a/db/changes/10470-family/00-accountingType.sql b/db/changes/10470-family/00-accountingType.sql new file mode 100644 index 000000000..f3c092a34 --- /dev/null +++ b/db/changes/10470-family/00-accountingType.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`accountingType` ADD daysInFuture INT NULL; +ALTER TABLE `vn`.`accountingType` MODIFY COLUMN daysInFuture int(11) DEFAULT 0 NULL; \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c329e4c6e..8fb4fd1fd 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -156,22 +156,23 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park ('HEJ', 2, 0, 1, 0, 1106), ('UXN', 1, 0, 1, 0, 1106); -INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`) +INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`) VALUES - (1, 'CC y Polizas de crédito', NULL, NULL, NULL), - (2, 'Cash', 'Cash', 'cash', 1000), - (3, 'Credit card', 'Credit Card', 'creditCard', NULL), - (4, 'Finalcial lines', NULL, NULL, NULL), - (5, 'Other products', NULL, NULL, NULL), - (6, 'Loans', NULL, NULL, NULL), - (7, 'Leasing', NULL, NULL, NULL), - (8, 'Compensations', 'Compensations', 'compensation', NULL); + (1, 'CC y Polizas de crédito', 'Transferencias', 'wireTransfer', NULL, 1), + (2, 'Cash', 'Cash', 'cash', 1000, 0), + (3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0), + (4, 'Finalcial lines', NULL, NULL, NULL, 0), + (5, 'Other products', NULL, NULL, NULL, 0), + (6, 'Loans', NULL, NULL, NULL, 0), + (7, 'Leasing', NULL, NULL, NULL, 0), + (8, 'Compensations', 'Compensations', 'compensation', NULL, 0); INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) VALUES (1, 'Pay on receipt', '5720000001', 3, 0, 1, 1), (2, 'Cash', '5700000001', 2, 0, 1, 1), (3, 'Compensation', '4000000000', 8, 0, 1, 1), + (4, 'Transferencias', '4000000001', 1, 0, 1, 1), (3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 3117, 1, 1); diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 454e5e44d..4e60a0cd1 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -6,12 +6,7 @@ class Controller extends Dialog { super($element, $, $transclude); this.vnReport = vnReport; - - const tomorrow = new Date(); - tomorrow.setDate(tomorrow.getDate() + 1); - this.receipt = { - payed: tomorrow - }; + this.receipt = {}; } set payed(value) { @@ -72,6 +67,13 @@ class Controller extends Dialog { `${accountingType && accountingType.receiptDescription}`; } this.maxAmount = accountingType && accountingType.maxAmount; + + if (accountingType.daysInFuture) { + const date = new Date(); + date.setDate(date.getDate() + accountingType.daysInFuture); + this.receipt.payed = date; + } else + this.receipt.payed = new Date(); } } -- 2.40.1 From 875e9503c3bfc25a5585019d142a87b07c0d60b2 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 20 May 2022 13:16:47 +0200 Subject: [PATCH 2/3] refactor: request changes --- db/dump/fixtures.sql | 2 +- modules/client/front/balance/create/index.js | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 8fb4fd1fd..723c8c4e4 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -158,7 +158,7 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`) VALUES - (1, 'CC y Polizas de crédito', 'Transferencias', 'wireTransfer', NULL, 1), + (1, 'CC and credit policies', 'Transfers', 'wireTransfer', NULL, 1), (2, 'Cash', 'Cash', 'cash', 1000, 0), (3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0), (4, 'Finalcial lines', NULL, NULL, NULL, 0), diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 4e60a0cd1..c6a6e7ff9 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -68,12 +68,9 @@ class Controller extends Dialog { } this.maxAmount = accountingType && accountingType.maxAmount; - if (accountingType.daysInFuture) { - const date = new Date(); - date.setDate(date.getDate() + accountingType.daysInFuture); - this.receipt.payed = date; - } else - this.receipt.payed = new Date(); + this.receipt.payed = new Date(); + if (accountingType.daysInFuture) + this.receipt.payed.setDate(this.receipt.payed.getDate() + accountingType.daysInFuture); } } -- 2.40.1 From ab6a0425f5fd5b324164cae0c45d6f316808d90b Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 23 May 2022 12:47:43 +0200 Subject: [PATCH 3/3] refactor: translate fixtures --- db/dump/fixtures.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 723c8c4e4..4871dde30 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -172,7 +172,7 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, (1, 'Pay on receipt', '5720000001', 3, 0, 1, 1), (2, 'Cash', '5700000001', 2, 0, 1, 1), (3, 'Compensation', '4000000000', 8, 0, 1, 1), - (4, 'Transferencias', '4000000001', 1, 0, 1, 1), + (4, 'Transfers', '4000000001', 1, 0, 1, 1), (3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 3117, 1, 1); -- 2.40.1