feat: update date depending of accountingType
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-05-17 12:24:35 +02:00
parent bf8e7eed57
commit eeede417eb
4 changed files with 23 additions and 15 deletions

View File

@ -28,6 +28,9 @@
},
"maxAmount": {
"type": "number"
},
"daysInFuture": {
"type": "number"
}
},
"acls": [{

View File

@ -0,0 +1,2 @@
ALTER TABLE `vn`.`accountingType` ADD daysInFuture INT NULL;
ALTER TABLE `vn`.`accountingType` MODIFY COLUMN daysInFuture int(11) DEFAULT 0 NULL;

View File

@ -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);

View File

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