Skip to content

Commit

Permalink
fix: make manual entries adjust decimal credit/debit amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Nov 13, 2024
1 parent f5834c7 commit 6c1870b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as R from 'ramda';
import moment from 'moment';
import intl from 'react-intl-universal';
import { Intent } from '@blueprintjs/core';
import { sumBy, setWith, toSafeInteger, get, first } from 'lodash';
import { sumBy, setWith, get, first, toNumber } from 'lodash';
import {
updateTableCell,
repeatValue,
Expand Down Expand Up @@ -91,8 +91,8 @@ export function transformToEditForm(manualJournal) {
* Entries adjustment.
*/
function adjustmentEntries(entries) {
const credit = sumBy(entries, (e) => toSafeInteger(e.credit));
const debit = sumBy(entries, (e) => toSafeInteger(e.debit));
const credit = sumBy(entries, (e) => toNumber(e.credit));
const debit = sumBy(entries, (e) => toNumber(e.debit));

return {
debit: Math.max(credit - debit, 0),
Expand Down

0 comments on commit 6c1870b

Please sign in to comment.