mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix financial statements.
This commit is contained in:
@@ -157,6 +157,10 @@ function GeneralLedgerTable({
|
|||||||
() => defaultExpanderReducer(generalLedgerTableRows, 1),
|
() => defaultExpanderReducer(generalLedgerTableRows, 1),
|
||||||
[generalLedgerTableRows]);
|
[generalLedgerTableRows]);
|
||||||
|
|
||||||
|
const rowClassNames = (row) => ([
|
||||||
|
`row-type--${row.original.rowType}`,
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
companyName={companyName}
|
companyName={companyName}
|
||||||
@@ -171,10 +175,13 @@ function GeneralLedgerTable({
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
data={generalLedgerTableRows}
|
data={generalLedgerTableRows}
|
||||||
onFetchData={handleFetchData}
|
onFetchData={handleFetchData}
|
||||||
|
rowClassNames={rowClassNames}
|
||||||
expanded={expandedRows}
|
expanded={expandedRows}
|
||||||
virtualizedRows={true}
|
virtualizedRows={true}
|
||||||
fixedItemSize={37}
|
fixedItemSize={37}
|
||||||
fixedSizeHeight={1000} />
|
fixedSizeHeight={1000}
|
||||||
|
expandable={true}
|
||||||
|
expandToggleColumn={1} />
|
||||||
</FinancialSheet>
|
</FinancialSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import withDashboard from 'containers/Dashboard/withDashboard';
|
|||||||
import withJournalActions from './withJournalActions';
|
import withJournalActions from './withJournalActions';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Journal({
|
function Journal({
|
||||||
// #withJournalActions
|
// #withJournalActions
|
||||||
requestFetchJournalSheet,
|
requestFetchJournalSheet,
|
||||||
@@ -40,7 +39,7 @@ function Journal({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const fetchHook = useQuery(['journal', filter],
|
const fetchHook = useQuery(['journal', filter],
|
||||||
(key, query) => { requestFetchJournalSheet(query); },
|
(key, query) => requestFetchJournalSheet(query),
|
||||||
{ manual: true });
|
{ manual: true });
|
||||||
|
|
||||||
// Handle financial statement filter change.
|
// Handle financial statement filter change.
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ function JournalSheetTable({
|
|||||||
onFetchData,
|
onFetchData,
|
||||||
companyName,
|
companyName,
|
||||||
}) {
|
}) {
|
||||||
|
const { formatMessage } = useIntl();
|
||||||
|
|
||||||
const rowTypeFilter = (rowType, value, types) => {
|
const rowTypeFilter = (rowType, value, types) => {
|
||||||
return (types.indexOf(rowType) === -1) ? '' : value;
|
return (types.indexOf(rowType) === -1) ? '' : value;
|
||||||
};
|
};
|
||||||
@@ -32,7 +34,6 @@ function JournalSheetTable({
|
|||||||
const exceptRowTypes = (rowType, value, types) => {
|
const exceptRowTypes = (rowType, value, types) => {
|
||||||
return (types.indexOf(rowType) !== -1) ? '' : value;
|
return (types.indexOf(rowType) !== -1) ? '' : value;
|
||||||
};
|
};
|
||||||
const {formatMessage} =useIntl();
|
|
||||||
|
|
||||||
const columns = useMemo(() => [
|
const columns = useMemo(() => [
|
||||||
{
|
{
|
||||||
@@ -100,9 +101,8 @@ const {formatMessage} =useIntl();
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
data={journalSheetTableRows}
|
data={journalSheetTableRows}
|
||||||
onFetchData={handleFetchData}
|
onFetchData={handleFetchData}
|
||||||
noResults={"This report does not contain any data."}
|
noResults={"This report does not contain any data between date period."}
|
||||||
expanded={expandedRows}
|
expanded={expandedRows} />
|
||||||
noInitialFetch={true} />
|
|
||||||
</FinancialSheet>
|
</FinancialSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,45 +27,6 @@ function ProfitLossSheetTable({
|
|||||||
const {formatMessage} =useIntl();
|
const {formatMessage} =useIntl();
|
||||||
|
|
||||||
const columns = useMemo(() => [
|
const columns = useMemo(() => [
|
||||||
{
|
|
||||||
// Build our expander column
|
|
||||||
id: 'expander', // Make sure it has an ID
|
|
||||||
className: 'expander',
|
|
||||||
Header: ({
|
|
||||||
getToggleAllRowsExpandedProps,
|
|
||||||
isAllRowsExpanded
|
|
||||||
}) => (
|
|
||||||
<span {...getToggleAllRowsExpandedProps()} className="toggle">
|
|
||||||
{isAllRowsExpanded ?
|
|
||||||
(<span class="arrow-down" />) :
|
|
||||||
(<span class="arrow-right" />)
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
Cell: ({ row }) =>
|
|
||||||
// Use the row.canExpand and row.getToggleRowExpandedProps prop getter
|
|
||||||
// to build the toggle for expanding a row
|
|
||||||
row.canExpand ? (
|
|
||||||
<span
|
|
||||||
{...row.getToggleRowExpandedProps({
|
|
||||||
style: {
|
|
||||||
// We can even use the row.depth property
|
|
||||||
// and paddingLeft to indicate the depth
|
|
||||||
// of the row
|
|
||||||
paddingLeft: `${row.depth * 2}rem`,
|
|
||||||
},
|
|
||||||
className: 'toggle',
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{row.isExpanded ?
|
|
||||||
(<span class="arrow-down" />) :
|
|
||||||
(<span class="arrow-right" />)
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
) : null,
|
|
||||||
width: 20,
|
|
||||||
disableResizing: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Header: formatMessage({id:'account_name'}),
|
Header: formatMessage({id:'account_name'}),
|
||||||
accessor: 'name',
|
accessor: 'name',
|
||||||
@@ -116,11 +77,9 @@ function ProfitLossSheetTable({
|
|||||||
[profitLossTableRows]);
|
[profitLossTableRows]);
|
||||||
|
|
||||||
// Retrieve conditional datatable row classnames.
|
// Retrieve conditional datatable row classnames.
|
||||||
const rowClassNames = useCallback((row) => {
|
const rowClassNames = useCallback((row) => ({
|
||||||
return {
|
[`row--${row.rowType}`]: row.rowType,
|
||||||
[`row--${row.rowType}`]: row.rowType,
|
}), []);
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FinancialSheet
|
<FinancialSheet
|
||||||
@@ -138,7 +97,9 @@ function ProfitLossSheetTable({
|
|||||||
data={profitLossTableRows}
|
data={profitLossTableRows}
|
||||||
onFetchData={handleFetchData}
|
onFetchData={handleFetchData}
|
||||||
expanded={expandedRows}
|
expanded={expandedRows}
|
||||||
rowClassNames={rowClassNames} />
|
rowClassNames={rowClassNames}
|
||||||
|
expandable={true}
|
||||||
|
expandToggleColumn={1} />
|
||||||
</FinancialSheet>
|
</FinancialSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,65 +31,30 @@ function TrialBalanceSheetTable({
|
|||||||
|
|
||||||
const columns = useMemo(() => [
|
const columns = useMemo(() => [
|
||||||
{
|
{
|
||||||
// Build our expander column
|
Header: formatMessage({ id:'account_name' }),
|
||||||
id: 'expander', // Make sure it has an ID
|
|
||||||
className: 'expander',
|
|
||||||
Header: ({
|
|
||||||
getToggleAllRowsExpandedProps,
|
|
||||||
isAllRowsExpanded
|
|
||||||
}) => (
|
|
||||||
<span {...getToggleAllRowsExpandedProps()} className="toggle">
|
|
||||||
{isAllRowsExpanded ?
|
|
||||||
(<span class="arrow-down" />) : (<span class="arrow-right" />)
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
Cell: ({ row }) =>
|
|
||||||
// Use the row.canExpand and row.getToggleRowExpandedProps prop getter
|
|
||||||
// to build the toggle for expanding a row
|
|
||||||
row.canExpand ? (
|
|
||||||
<span
|
|
||||||
{...row.getToggleRowExpandedProps({
|
|
||||||
style: {
|
|
||||||
// We can even use the row.depth property
|
|
||||||
// and paddingLeft to indicate the depth
|
|
||||||
// of the row
|
|
||||||
paddingLeft: `${row.depth * 2}rem`,
|
|
||||||
},
|
|
||||||
className: 'toggle',
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{row.isExpanded ? (<span class="arrow-down" />) : (<span class="arrow-right" />) }
|
|
||||||
</span>
|
|
||||||
) : null,
|
|
||||||
width: 20,
|
|
||||||
disableResizing: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Header: formatMessage({id:'account_name'}),
|
|
||||||
accessor: 'name',
|
accessor: 'name',
|
||||||
className: "name",
|
className: "name",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({id:'code'}),
|
Header: formatMessage({ id:'code' }),
|
||||||
accessor: 'code',
|
accessor: 'code',
|
||||||
className: "code",
|
className: "code",
|
||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({id:'credit'}),
|
Header: formatMessage({ id:'credit' }),
|
||||||
accessor: r => (<Money amount={r.credit} currency="USD" />),
|
accessor: r => (<Money amount={r.credit} currency="USD" />),
|
||||||
className: 'credit',
|
className: 'credit',
|
||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({id:'debit'}),
|
Header: formatMessage({ id:'debit' }),
|
||||||
accessor: r => (<Money amount={r.debit} currency="USD" />),
|
accessor: r => (<Money amount={r.debit} currency="USD" />),
|
||||||
className: 'debit',
|
className: 'debit',
|
||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: formatMessage({id:'balance'}),
|
Header: formatMessage({ id:'balance' }),
|
||||||
accessor: r => (<Money amount={r.balance} currency="USD" />),
|
accessor: r => (<Money amount={r.balance} currency="USD" />),
|
||||||
className: 'balance',
|
className: 'balance',
|
||||||
width: 120,
|
width: 120,
|
||||||
@@ -113,12 +78,13 @@ function TrialBalanceSheetTable({
|
|||||||
className="bigcapital-datatable--financial-report"
|
className="bigcapital-datatable--financial-report"
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={trialBalanceAccounts}
|
data={trialBalanceAccounts}
|
||||||
onFetchData={handleFetchData} />
|
onFetchData={handleFetchData}
|
||||||
|
expandable={true}
|
||||||
|
expandToggleColumn={1} />
|
||||||
</FinancialSheet>
|
</FinancialSheet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
const { trialBalanceQuery } = props;
|
const { trialBalanceQuery } = props;
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -39,12 +39,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.financial-sheet{
|
.financial-sheet{
|
||||||
border: 1px solid #E2E2E2;
|
border: 1px solid #EEE;
|
||||||
min-width: 640px;
|
min-width: 640px;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: 30px 20px;
|
padding: 30px 20px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin: 25px auto 35px;
|
margin: 15px auto 35px;
|
||||||
min-height: 400px;
|
min-height: 400px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -109,6 +109,27 @@
|
|||||||
&--trial-balance{
|
&--trial-balance{
|
||||||
min-width: 720px;
|
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,
|
&--general-ledger,
|
||||||
&--journal{
|
&--journal{
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ export default {
|
|||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const accountsDepGraph = await Account.depGraph().query().remember();
|
const accountsDepGraph = await Account.depGraph().query();
|
||||||
const journalPoster = new JournalPoster(accountsDepGraph);
|
const journalPoster = new JournalPoster(accountsDepGraph);
|
||||||
|
|
||||||
entries.forEach((entry) => {
|
entries.forEach((entry) => {
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ export default class Account extends mixin(TenantModel, [CachableModel, DateSess
|
|||||||
return CachableQueryBuilder;
|
return CachableQueryBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query return override.
|
||||||
|
* @param {...any} args
|
||||||
|
*/
|
||||||
static query(...args) {
|
static query(...args) {
|
||||||
return super.query(...args).runAfter((result) => {
|
return super.query(...args).runAfter((result) => {
|
||||||
if (Array.isArray(result)) {
|
if (Array.isArray(result)) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
tenantFactory,
|
tenantFactory,
|
||||||
tenantWebsite
|
tenantWebsite
|
||||||
} from '~/dbInit';
|
} from '~/dbInit';
|
||||||
|
import DependencyGraph from '@/lib/DependencyGraph';
|
||||||
|
|
||||||
describe('Model: Account', () => {
|
describe('Model: Account', () => {
|
||||||
it('Should account model belongs to the associated account type model.', async () => {
|
it('Should account model belongs to the associated account type model.', async () => {
|
||||||
@@ -42,4 +42,9 @@ describe('Model: Account', () => {
|
|||||||
|
|
||||||
expect(transactionsModels.length).equals(1);
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
} from '~/dbInit';
|
} from '~/dbInit';
|
||||||
|
|
||||||
|
|
||||||
describe.only('routes: `/items`', () => {
|
describe('routes: `/items`', () => {
|
||||||
describe('POST: `/items`', () => {
|
describe('POST: `/items`', () => {
|
||||||
it('Should not create a new item if the user was not authorized.', async () => {
|
it('Should not create a new item if the user was not authorized.', async () => {
|
||||||
const res = await request()
|
const res = await request()
|
||||||
|
|||||||
Reference in New Issue
Block a user