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(); } }