4022-client.balance.create #976

Merged
carlosjr merged 5 commits from 4022-client.balance.create into dev 2022-05-23 12:52:23 +00:00
4 changed files with 20 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

@ -162,22 +162,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 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),
(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, 'Transfers', '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,10 @@ class Controller extends Dialog {
`${accountingType && accountingType.receiptDescription}`;
}
this.maxAmount = accountingType && accountingType.maxAmount;
vicent marked this conversation as resolved
Review

// this.receipt.payed is going to be 100% of the times a date object therefore you can write more simplistic code:

pseudocode example:

this.receipt.payed = new Date()
if (accountingType.daysInFuture)
this.receipt.payed.setDate(this.receipt.payed.getDate() + accountingType.daysInFuture);

// this.receipt.payed is going to be 100% of the times a date object therefore you can write more simplistic code: pseudocode example: this.receipt.payed = new Date() if (accountingType.daysInFuture) this.receipt.payed.setDate(this.receipt.payed.getDate() + accountingType.daysInFuture);
this.receipt.payed = new Date();
if (accountingType.daysInFuture)
this.receipt.payed.setDate(this.receipt.payed.getDate() + accountingType.daysInFuture);
}
}