@tomei/finance 0.6.99 → 0.6.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.6.99",
3
+ "version": "0.6.100",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -262,9 +262,12 @@ export default class Document extends AccountSystemEntity {
262
262
  * @returns {void}
263
263
  */
264
264
  async reCalculateAmount(): Promise<void> {
265
+ const roundToTwoDecimals = (value: number): number =>
266
+ Math.round(value * 100) / 100;
267
+
265
268
  this.Amount = 0;
266
269
  for (const documentItem of this._DocumentItems) {
267
- this.Amount += documentItem.Amount;
270
+ this.Amount = roundToTwoDecimals(this.Amount + documentItem.Amount);
268
271
  }
269
272
  }
270
273