mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 15:50:32 +00:00
fix(Journal): account balance with journal entries.
This commit is contained in:
@@ -4,12 +4,9 @@ import preferencesRoutes from 'routes/preferences'
|
|||||||
|
|
||||||
|
|
||||||
export default function DashboardContentRoute() {
|
export default function DashboardContentRoute() {
|
||||||
const defaultTab = '/preferences/general';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Route pathname="/preferences">
|
<Route pathname="/preferences">
|
||||||
<Redirect from='/preferences' to={defaultTab} />
|
|
||||||
|
|
||||||
<Switch>
|
<Switch>
|
||||||
{ preferencesRoutes.map((route, index) => (
|
{ preferencesRoutes.map((route, index) => (
|
||||||
<Route
|
<Route
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const useTrialBalanceTableColumns = () => {
|
|||||||
Header: formatMessage({ id: 'account_name' }),
|
Header: formatMessage({ id: 'account_name' }),
|
||||||
accessor: (row) => (row.code ? `${row.name} - ${row.code}` : row.name),
|
accessor: (row) => (row.code ? `${row.name} - ${row.code}` : row.name),
|
||||||
className: 'name',
|
className: 'name',
|
||||||
width: 160,
|
width: 180,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -33,14 +33,14 @@ export const useTrialBalanceTableColumns = () => {
|
|||||||
accessor: 'formatted_credit',
|
accessor: 'formatted_credit',
|
||||||
className: 'credit',
|
className: 'credit',
|
||||||
width: getColumnWidth(tableRows, `credit`, {
|
width: getColumnWidth(tableRows, `credit`, {
|
||||||
minWidth: 95,
|
minWidth: 80,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({ id: 'debit' }),
|
Header: formatMessage({ id: 'debit' }),
|
||||||
Cell: CellTextSpan,
|
Cell: CellTextSpan,
|
||||||
accessor: 'formatted_debit',
|
accessor: 'formatted_debit',
|
||||||
width: getColumnWidth(tableRows, `debit`, { minWidth: 95 }),
|
width: getColumnWidth(tableRows, `debit`, { minWidth: 80 }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({ id: 'balance' }),
|
Header: formatMessage({ id: 'balance' }),
|
||||||
@@ -48,7 +48,7 @@ export const useTrialBalanceTableColumns = () => {
|
|||||||
accessor: 'formatted_balance',
|
accessor: 'formatted_balance',
|
||||||
className: 'balance',
|
className: 'balance',
|
||||||
width: getColumnWidth(tableRows, `balance`, {
|
width: getColumnWidth(tableRows, `balance`, {
|
||||||
minWidth: 95,
|
minWidth: 80,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
8
client/src/containers/Preferences/DefaultRoute.js
Normal file
8
client/src/containers/Preferences/DefaultRoute.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
|
export default function DefaultRoute() {
|
||||||
|
const defaultTab = '/preferences/general';
|
||||||
|
|
||||||
|
return (<Redirect from='/preferences' to={defaultTab} />);
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import Accountant from 'containers/Preferences/Accountant/Accountant';
|
|||||||
import Accounts from 'containers/Preferences/Accounts/Accounts';
|
import Accounts from 'containers/Preferences/Accounts/Accounts';
|
||||||
import Currencies from 'containers/Preferences/Currencies/Currencies';
|
import Currencies from 'containers/Preferences/Currencies/Currencies';
|
||||||
import Item from 'containers/Preferences/Item/Item';
|
import Item from 'containers/Preferences/Item/Item';
|
||||||
|
import DefaultRoute from '../containers/Preferences/DefaultRoute';
|
||||||
|
|
||||||
const BASE_URL = '/preferences';
|
const BASE_URL = '/preferences';
|
||||||
|
|
||||||
@@ -33,4 +34,9 @@ export default [
|
|||||||
component: Item,
|
component: Item,
|
||||||
exact: true,
|
exact: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: `${BASE_URL}/`,
|
||||||
|
component: DefaultRoute,
|
||||||
|
exact: true,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tr{
|
.tr:not(.no-results) {
|
||||||
height: 28px;
|
height: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ export function formattedAmount(cents, currency, props) {
|
|||||||
precision: 0,
|
precision: 0,
|
||||||
format: {
|
format: {
|
||||||
pos: '%s%v',
|
pos: '%s%v',
|
||||||
neg: '%s%v',
|
neg: '%s-%v',
|
||||||
zero: parsedProps.noZero ? '' : '%s%v',
|
zero: parsedProps.noZero ? '' : '%s%v',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,7 +72,14 @@ export default class Bill extends TenantModel {
|
|||||||
*/
|
*/
|
||||||
fromDate(query, fromDate) {
|
fromDate(query, fromDate) {
|
||||||
query.where('bill_date', '<=', fromDate)
|
query.where('bill_date', '<=', fromDate)
|
||||||
}
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort the bills by full-payment bills.
|
||||||
|
*/
|
||||||
|
sortByStatus(query, order) {
|
||||||
|
query.orderByRaw(`PAYMENT_AMOUNT = AMOUNT ${order}`);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +306,9 @@ export default class Bill extends TenantModel {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sortQuery(query, role) {
|
||||||
|
query.modify('sortByStatus', role.order);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
label: 'Amount',
|
label: 'Amount',
|
||||||
|
|||||||
@@ -278,13 +278,13 @@ export default class JournalPoster implements IJournalPoster {
|
|||||||
let change = 0;
|
let change = 0;
|
||||||
|
|
||||||
if (accountChange.credit) {
|
if (accountChange.credit) {
|
||||||
change =
|
change +=
|
||||||
normal === 'credit'
|
normal === 'credit'
|
||||||
? accountChange.credit
|
? accountChange.credit
|
||||||
: -1 * accountChange.credit;
|
: -1 * accountChange.credit;
|
||||||
}
|
}
|
||||||
if (accountChange.debit) {
|
if (accountChange.debit) {
|
||||||
change =
|
change +=
|
||||||
normal === 'debit' ? accountChange.debit : -1 * accountChange.debit;
|
normal === 'debit' ? accountChange.debit : -1 * accountChange.debit;
|
||||||
}
|
}
|
||||||
mappedList.push({ account, change });
|
mappedList.push({ account, change });
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ export default class ManualJournalsService implements IManualJournalsService {
|
|||||||
'[manual_journal] trying to save manual journal to the storage.',
|
'[manual_journal] trying to save manual journal to the storage.',
|
||||||
{ tenantId, manualJournalDTO }
|
{ tenantId, manualJournalDTO }
|
||||||
);
|
);
|
||||||
|
// Upsert the manual journal object.
|
||||||
const manualJournal = await ManualJournal.query().upsertGraph({
|
const manualJournal = await ManualJournal.query().upsertGraph({
|
||||||
...manualJournalObj,
|
...manualJournalObj,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user