diff --git a/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.js b/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.js
index 679718f60..c73f6af28 100644
--- a/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.js
+++ b/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerTable.js
@@ -157,6 +157,10 @@ function GeneralLedgerTable({
() => defaultExpanderReducer(generalLedgerTableRows, 1),
[generalLedgerTableRows]);
+ const rowClassNames = (row) => ([
+ `row-type--${row.original.rowType}`,
+ ]);
+
return (
+ fixedSizeHeight={1000}
+ expandable={true}
+ expandToggleColumn={1} />
);
}
diff --git a/client/src/containers/FinancialStatements/Journal/Journal.js b/client/src/containers/FinancialStatements/Journal/Journal.js
index cd95965f3..a4344612e 100644
--- a/client/src/containers/FinancialStatements/Journal/Journal.js
+++ b/client/src/containers/FinancialStatements/Journal/Journal.js
@@ -16,7 +16,6 @@ import withDashboard from 'containers/Dashboard/withDashboard';
import withJournalActions from './withJournalActions';
-
function Journal({
// #withJournalActions
requestFetchJournalSheet,
@@ -40,7 +39,7 @@ function Journal({
}, []);
const fetchHook = useQuery(['journal', filter],
- (key, query) => { requestFetchJournalSheet(query); },
+ (key, query) => requestFetchJournalSheet(query),
{ manual: true });
// Handle financial statement filter change.
diff --git a/client/src/containers/FinancialStatements/Journal/JournalTable.js b/client/src/containers/FinancialStatements/Journal/JournalTable.js
index 26f280161..0342ffa5a 100644
--- a/client/src/containers/FinancialStatements/Journal/JournalTable.js
+++ b/client/src/containers/FinancialStatements/Journal/JournalTable.js
@@ -25,6 +25,8 @@ function JournalSheetTable({
onFetchData,
companyName,
}) {
+ const { formatMessage } = useIntl();
+
const rowTypeFilter = (rowType, value, types) => {
return (types.indexOf(rowType) === -1) ? '' : value;
};
@@ -32,7 +34,6 @@ function JournalSheetTable({
const exceptRowTypes = (rowType, value, types) => {
return (types.indexOf(rowType) !== -1) ? '' : value;
};
-const {formatMessage} =useIntl();
const columns = useMemo(() => [
{
@@ -100,9 +101,8 @@ const {formatMessage} =useIntl();
columns={columns}
data={journalSheetTableRows}
onFetchData={handleFetchData}
- noResults={"This report does not contain any data."}
- expanded={expandedRows}
- noInitialFetch={true} />
+ noResults={"This report does not contain any data between date period."}
+ expanded={expandedRows} />
);
}
diff --git a/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js b/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js
index aae09f036..0c68f5998 100644
--- a/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js
+++ b/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js
@@ -26,46 +26,7 @@ function ProfitLossSheetTable({
const {formatMessage} =useIntl();
- const columns = useMemo(() => [
- {
- // Build our expander column
- id: 'expander', // Make sure it has an ID
- className: 'expander',
- Header: ({
- getToggleAllRowsExpandedProps,
- isAllRowsExpanded
- }) => (
-
- {isAllRowsExpanded ?
- () :
- ()
- }
-
- ),
- Cell: ({ row }) =>
- // Use the row.canExpand and row.getToggleRowExpandedProps prop getter
- // to build the toggle for expanding a row
- row.canExpand ? (
-
- {row.isExpanded ?
- () :
- ()
- }
-
- ) : null,
- width: 20,
- disableResizing: true,
- },
+ const columns = useMemo(() => [
{
Header: formatMessage({id:'account_name'}),
accessor: 'name',
@@ -116,11 +77,9 @@ function ProfitLossSheetTable({
[profitLossTableRows]);
// Retrieve conditional datatable row classnames.
- const rowClassNames = useCallback((row) => {
- return {
- [`row--${row.rowType}`]: row.rowType,
- };
- }, []);
+ const rowClassNames = useCallback((row) => ({
+ [`row--${row.rowType}`]: row.rowType,
+ }), []);
return (
+ rowClassNames={rowClassNames}
+ expandable={true}
+ expandToggleColumn={1} />
);
}
diff --git a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js
index 25271f05e..f785e18be 100644
--- a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js
+++ b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js
@@ -31,65 +31,30 @@ function TrialBalanceSheetTable({
const columns = useMemo(() => [
{
- // Build our expander column
- id: 'expander', // Make sure it has an ID
- className: 'expander',
- Header: ({
- getToggleAllRowsExpandedProps,
- isAllRowsExpanded
- }) => (
-
- {isAllRowsExpanded ?
- () : ()
- }
-
- ),
- Cell: ({ row }) =>
- // Use the row.canExpand and row.getToggleRowExpandedProps prop getter
- // to build the toggle for expanding a row
- row.canExpand ? (
-
- {row.isExpanded ? () : () }
-
- ) : null,
- width: 20,
- disableResizing: true,
- },
- {
- Header: formatMessage({id:'account_name'}),
+ Header: formatMessage({ id:'account_name' }),
accessor: 'name',
className: "name",
},
{
- Header: formatMessage({id:'code'}),
+ Header: formatMessage({ id:'code' }),
accessor: 'code',
className: "code",
width: 120,
},
{
- Header: formatMessage({id:'credit'}),
+ Header: formatMessage({ id:'credit' }),
accessor: r => (),
className: 'credit',
width: 120,
},
{
- Header: formatMessage({id:'debit'}),
+ Header: formatMessage({ id:'debit' }),
accessor: r => (),
className: 'debit',
width: 120,
},
{
- Header: formatMessage({id:'balance'}),
+ Header: formatMessage({ id:'balance' }),
accessor: r => (),
className: 'balance',
width: 120,
@@ -113,12 +78,13 @@ function TrialBalanceSheetTable({
className="bigcapital-datatable--financial-report"
columns={columns}
data={trialBalanceAccounts}
- onFetchData={handleFetchData} />
+ onFetchData={handleFetchData}
+ expandable={true}
+ expandToggleColumn={1} />
);
}
-
const mapStateToProps = (state, props) => {
const { trialBalanceQuery } = props;
return {
diff --git a/client/src/style/pages/financial-statements.scss b/client/src/style/pages/financial-statements.scss
index cdc1cee7d..ccc29f8d4 100644
--- a/client/src/style/pages/financial-statements.scss
+++ b/client/src/style/pages/financial-statements.scss
@@ -39,12 +39,12 @@
}
.financial-sheet{
- border: 1px solid #E2E2E2;
+ border: 1px solid #EEE;
min-width: 640px;
width: auto;
padding: 30px 20px;
max-width: 100%;
- margin: 25px auto 35px;
+ margin: 15px auto 35px;
min-height: 400px;
display: flex;
flex-direction: column;
@@ -109,6 +109,27 @@
&--trial-balance{
min-width: 720px;
}
+ &--general-ledger{
+ .table .tbody{
+
+ .tr.row-type{
+
+ &--opening_balance,
+ &--closing_balance{
+ background-color: #fbfbfb;
+ }
+
+ &--closing_balance .td{
+ border-bottom-color: #666;
+ }
+
+ &--account_name .td.name{
+ font-weight: 500;
+ }
+ }
+ }
+ }
+
&--general-ledger,
&--journal{
width: auto;
diff --git a/server/src/http/controllers/Accounting.js b/server/src/http/controllers/Accounting.js
index fbd6c3646..db349cb14 100644
--- a/server/src/http/controllers/Accounting.js
+++ b/server/src/http/controllers/Accounting.js
@@ -270,7 +270,7 @@ export default {
user_id: user.id,
});
- const accountsDepGraph = await Account.depGraph().query().remember();
+ const accountsDepGraph = await Account.depGraph().query();
const journalPoster = new JournalPoster(accountsDepGraph);
entries.forEach((entry) => {
diff --git a/server/src/models/Account.js b/server/src/models/Account.js
index e8d21fb99..6d7ac44f3 100644
--- a/server/src/models/Account.js
+++ b/server/src/models/Account.js
@@ -27,6 +27,10 @@ export default class Account extends mixin(TenantModel, [CachableModel, DateSess
return CachableQueryBuilder;
}
+ /**
+ * Query return override.
+ * @param {...any} args
+ */
static query(...args) {
return super.query(...args).runAfter((result) => {
if (Array.isArray(result)) {
diff --git a/server/tests/models/Account.test.js b/server/tests/models/Account.test.js
index 4faacc8e6..08b6e32aa 100644
--- a/server/tests/models/Account.test.js
+++ b/server/tests/models/Account.test.js
@@ -7,7 +7,7 @@ import {
tenantFactory,
tenantWebsite
} from '~/dbInit';
-
+import DependencyGraph from '@/lib/DependencyGraph';
describe('Model: Account', () => {
it('Should account model belongs to the associated account type model.', async () => {
@@ -42,4 +42,9 @@ describe('Model: Account', () => {
expect(transactionsModels.length).equals(1);
});
+
+ it('Should retrieve dependency graph.', async () => {
+ const accountsDepGraph = await Account.tenant().depGraph().query();
+ expect(accountsDepGraph).to.be.an.instanceOf(DependencyGraph);
+ });
});
diff --git a/server/tests/routes/items.test.js b/server/tests/routes/items.test.js
index f3773be25..84dee7c94 100644
--- a/server/tests/routes/items.test.js
+++ b/server/tests/routes/items.test.js
@@ -10,7 +10,7 @@ import {
} from '~/dbInit';
-describe.only('routes: `/items`', () => {
+describe('routes: `/items`', () => {
describe('POST: `/items`', () => {
it('Should not create a new item if the user was not authorized.', async () => {
const res = await request()