diff --git a/client/src/components/DataTableCells/ContactsListFieldCell.js b/client/src/components/DataTableCells/ContactsListFieldCell.js
new file mode 100644
index 000000000..4ee7a6502
--- /dev/null
+++ b/client/src/components/DataTableCells/ContactsListFieldCell.js
@@ -0,0 +1,35 @@
+import React, { useCallback, useMemo } from 'react';
+import { FormGroup, Classes } from "@blueprintjs/core";
+import classNames from 'classnames';
+import ContactsListField from 'components/ContactsListField';
+
+export default function ContactsListCellRenderer({
+ column: { id, value },
+ row: { index, original },
+ cell: { value: initialValue },
+ payload: { contacts, updateData, errors }
+}) {
+ const handleContactSelected = useCallback((contactId) => {
+ updateData(index, id, contactId)
+ }, [updateData, index, id]);
+
+ const initialContact = useMemo(() => {
+ return contacts.find(c => c.id === initialValue);
+ }, [contacts, initialValue]);
+
+ return (
+
+
+
+ )
+}
\ No newline at end of file
diff --git a/client/src/components/DataTableCells/index.js b/client/src/components/DataTableCells/index.js
index a7bc525cb..60232831e 100644
--- a/client/src/components/DataTableCells/index.js
+++ b/client/src/components/DataTableCells/index.js
@@ -1,9 +1,11 @@
import AccountsListFieldCell from './AccountsListFieldCell';
import MoneyFieldCell from './MoneyFieldCell';
import InputGroupCell from './InputGroupCell';
+import ContactsListFieldCell from './ContactsListFieldCell';
export {
AccountsListFieldCell,
MoneyFieldCell,
InputGroupCell,
+ ContactsListFieldCell,
}
\ No newline at end of file
diff --git a/client/src/components/FieldHint.js b/client/src/components/FieldHint.js
index 34d66f740..53e2c98d0 100644
--- a/client/src/components/FieldHint.js
+++ b/client/src/components/FieldHint.js
@@ -3,6 +3,8 @@ import Icon from './Icon';
export default function FieldHint({ hint }) {
return (
-
+
+
+
);
}
\ No newline at end of file
diff --git a/client/src/components/MenuItemLabel.js b/client/src/components/MenuItemLabel.js
new file mode 100644
index 000000000..c11b9a2d2
--- /dev/null
+++ b/client/src/components/MenuItemLabel.js
@@ -0,0 +1,7 @@
+import React from 'react';
+
+export default function MenuItemLabel({
+ text
+}) {
+ return ();
+}
\ No newline at end of file
diff --git a/client/src/components/Sidebar/SidebarMenu.js b/client/src/components/Sidebar/SidebarMenu.js
index e0d885be8..4354e9e5e 100644
--- a/client/src/components/Sidebar/SidebarMenu.js
+++ b/client/src/components/Sidebar/SidebarMenu.js
@@ -4,6 +4,7 @@ import { useHistory, useLocation } from 'react-router-dom';
import sidebarMenuList from 'config/sidebarMenu';
import Icon from 'components/Icon';
import MenuItem from 'components/MenuItem';
+import { MenuItemLabel } from 'components';
import classNames from 'classnames';
export default function SidebarMenu() {
@@ -29,6 +30,8 @@ export default function SidebarMenu() {
) : item.divider ? (
+ ) : item.label ? (
+
) : (
,
disabled: false,
href: '/homepage',
@@ -15,9 +13,12 @@ export default [
{
divider: true,
},
+
+ {
+ text: 'Sales & inventory',
+ label: true,
+ },
{
- icon: 'homepage',
- iconSize: 20,
text:
,
children: [
{
@@ -35,11 +36,41 @@ export default [
],
},
{
- spacer: true,
+ text:
,
+ children: [],
+ },
+ {
+ text:
,
+ children: [
+ {
+ icon: 'cut',
+ text: 'cut',
+ label: '⌘C',
+ disabled: false,
+ },
+ ],
+ },
+ {
+ text:
,
+ children: [
+ {
+ text:
,
+ // href: '/',
+ },
+ {
+ text:
,
+ href: '/customers/new',
+ },
+ ],
+ },
+ {
+ divider: true,
+ },
+ {
+ text: 'Financial accounting',
+ label: true,
},
{
- icon: 'balance-scale',
- iconSize: 20,
text:
,
children: [
{
@@ -61,92 +92,60 @@ export default [
],
},
{
- icon: 'university',
- iconSize: 20,
text:
,
children: [],
},
+
{
- icon: 'shopping-cart',
- iconSize: 20,
- text:
,
- children: [],
- },
- {
- icon: 'balance-scale',
- iconSize: 20,
- text:
,
- children: [
- {
- icon: 'cut',
- text: 'cut',
- label: '⌘C',
- disabled: false,
- },
- ],
- },
- {
- icon: 'analytics',
- iconSize: 18,
text:
,
children: [
+ {
+ text:
,
+ href: '/financial-reports',
+ },
+ {
+ divider: true,
+ },
{
text:
,
- href: '/balance-sheet',
+ href: '/financial-reports/balance-sheet',
},
{
text:
,
- href: '/trial-balance-sheet',
+ href: '/financial-reports/trial-balance-sheet',
},
{
text:
,
- href: '/journal-sheet',
+ href: '/financial-reports/journal-sheet',
},
{
text:
,
- href: '/general-ledger',
+ href: '/financial-reports/general-ledger',
},
{
text:
,
- href: '/profit-loss-sheet',
+ href: '/financial-reports/profit-loss-sheet',
},
{
text: 'Receivable Aging Summary',
- href: '/receivable-aging-summary'
+ href: '/financial-reports/receivable-aging-summary'
},
{
text: 'Payable Aging Summary',
- href: '/payable-aging-summary'
+ href: '/financial-reports/payable-aging-summary'
}
],
},
{
text:
,
- icon: 'receipt',
- iconSize: 18,
children: [
- {
- text:
,
- href: '/expenses/new',
- },
{
text: ,
href: '/expenses-list',
},
- ],
- },
- {
- text: ,
- icon: 'receipt',
- iconSize: 18,
- children: [
{
- text: ,
- // href: '/',
- },
- {
- text: ,
- href: '/customers/new',
+ text: ,
+ href: '/expenses/new',
},
],
},
diff --git a/client/src/containers/Accounting/MakeJournalEntriesForm.js b/client/src/containers/Accounting/MakeJournalEntriesForm.js
index df4359e1d..101557f6a 100644
--- a/client/src/containers/Accounting/MakeJournalEntriesForm.js
+++ b/client/src/containers/Accounting/MakeJournalEntriesForm.js
@@ -97,6 +97,7 @@ function MakeJournalEntriesForm({
is: (credit, debit) => credit || debit,
then: Yup.number().required(),
}),
+ contact_id: Yup.number().nullable(),
note: Yup.string().nullable(),
}),
),
@@ -114,6 +115,7 @@ function MakeJournalEntriesForm({
const defaultEntry = useMemo(
() => ({
account_id: null,
+ contact_id: null,
credit: 0,
debit: 0,
note: '',
diff --git a/client/src/containers/Accounting/MakeJournalEntriesHeader.js b/client/src/containers/Accounting/MakeJournalEntriesHeader.js
index 7b4d4d839..53c9069a0 100644
--- a/client/src/containers/Accounting/MakeJournalEntriesHeader.js
+++ b/client/src/containers/Accounting/MakeJournalEntriesHeader.js
@@ -30,7 +30,7 @@ export default function MakeJournalEntriesHeader({
return (
);
}
diff --git a/client/src/containers/Expenses/ExpenseFormHeader.js b/client/src/containers/Expenses/ExpenseFormHeader.js
index a5303fb23..5c2baf532 100644
--- a/client/src/containers/Expenses/ExpenseFormHeader.js
+++ b/client/src/containers/Expenses/ExpenseFormHeader.js
@@ -117,7 +117,7 @@ function ExpenseFormHeader({
return (
-
+
}
className={classNames('form-group--select-list', Classes.FILL)}
@@ -141,7 +141,8 @@ function ExpenseFormHeader({
/>
-
+
+
}
className={classNames(
@@ -177,8 +178,9 @@ function ExpenseFormHeader({
+
-
+
}
labelInfo={infoIcon}
@@ -189,17 +191,17 @@ function ExpenseFormHeader({
helperText={
}
- minimal={true}
>
-
+
+
}
className={classNames(
@@ -223,23 +225,25 @@ function ExpenseFormHeader({
onItemSelect={onItemsSelect('currency_code')}
selectedItem={values.currency_code}
selectedItemProp={'currency_code'}
- defaultText={}
+ defaultText={}
labelProp={'currency_code'}
/>
-
+
}
- className={'form-group--ref_no'}
+ className={classNames(
+ 'form-group--ref_no',
+ Classes.FILL,
+ )}
intent={
errors.reference_no && touched.reference_no && Intent.DANGER
}
helperText={
}
- minimal={true}
>
}
- iconSize={14}
- className="ml2"
- minimal={true}
- intent={Intent.DANGER}
- onClick={onClickRemoveRole}
- />
+ } position={Position.LEFT}>
+ }
+ iconSize={14}
+ className="ml2"
+ minimal={true}
+ intent={Intent.DANGER}
+ onClick={onClickRemoveRole}
+ />
+
);
};
@@ -144,8 +147,7 @@ function ExpenseTable({
disableSortBy: true,
},
{
- // @todo Add hint component after the header label.
- Header: formatMessage({ id: 'expense_category' }),
+ Header: (<>{ formatMessage({ id: 'expense_category' }) }>),
id: 'expense_account_id',
accessor: 'expense_account_id',
Cell: TotalExpenseCellRenderer(AccountsListFieldCell),
@@ -161,6 +163,7 @@ function ExpenseTable({
disableSortBy: true,
disableResizing: true,
width: 150,
+ className: 'amount',
},
{
Header: formatMessage({ id: 'description' }),
@@ -195,7 +198,6 @@ function ExpenseTable({
[rows],
);
-
return (
({
accounts,
})),
-
)(ExpenseTable);
diff --git a/client/src/containers/Expenses/ExpensesList.js b/client/src/containers/Expenses/ExpensesList.js
index 4e972bc56..804fd3226 100644
--- a/client/src/containers/Expenses/ExpensesList.js
+++ b/client/src/containers/Expenses/ExpensesList.js
@@ -12,6 +12,7 @@ import ExpenseDataTable from 'containers/Expenses/ExpenseDataTable';
import ExpenseActionsBar from 'containers/Expenses/ExpenseActionsBar';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
+import withExpenses from 'containers/Expenses/withExpenses';
import withExpensesActions from 'containers/Expenses/withExpensesActions';
import withViewsActions from 'containers/Views/withViewsActions';
@@ -24,6 +25,9 @@ function ExpensesList({
// #withViewsActions
requestFetchResourceViews,
+ // #withExpenses
+ expensesTableQuery,
+
//#withExpensesActions
requestFetchExpensesTable,
requestDeleteExpense,
@@ -44,8 +48,9 @@ function ExpensesList({
return requestFetchResourceViews('expenses');
});
- const fetchExpenses = useQuery('expenses-table', () =>
- requestFetchExpensesTable(),
+ const fetchExpenses = useQuery(
+ ['expenses-table', expensesTableQuery],
+ () => requestFetchExpensesTable(),
);
useEffect(() => {
@@ -53,7 +58,6 @@ function ExpensesList({
}, [changePageTitle, formatMessage]);
// Handle delete expense click.
-
const handleDeleteExpense = useCallback(
(expnese) => {
setDeleteExpense(expnese);
@@ -108,8 +112,6 @@ function ExpensesList({
.catch((error) => {
setBulkDelete(false);
});
-
- // @todo
}, [requestDeleteBulkExpenses, bulkDelete, formatMessage, selectedRowsCount]);
// Handle cancel bulk delete alert.
@@ -149,6 +151,7 @@ function ExpensesList({
message: formatMessage({ id: 'the_expense_id_has_been_published' }),
});
});
+ fetchExpenses.refetch();
},
[requestPublishExpense, formatMessage],
);
@@ -163,7 +166,7 @@ function ExpensesList({
return (
({ expensesTableQuery })),
withViewsActions,
)(ExpensesList);
diff --git a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js
index 26f4fa219..6f6ffe78f 100644
--- a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js
+++ b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheet.js
@@ -26,7 +26,6 @@ function BalanceSheet({
fetchBalanceSheet,
// #withBalanceSheetDetail
- balanceSheetLoading,
balanceSheetFilter,
// #withPreferences
@@ -41,6 +40,7 @@ function BalanceSheet({
display_columns_by: '',
none_zero: false,
});
+ const [refresh, setRefresh] = useState(true);
const fetchHook = useQuery(
['balance-sheet', filter],
@@ -50,7 +50,7 @@ function BalanceSheet({
// Handle fetch the data of balance sheet.
const handleFetchData = useCallback(() => {
- fetchHook.refetch({ force: true });
+ setRefresh(true);
}, []);
useEffect(() => {
@@ -66,11 +66,18 @@ function BalanceSheet({
to_date: moment(filter.to_date).format('YYYY-MM-DD'),
};
setFilter({ ..._filter });
- fetchHook.refetch({ force: true });
+ setRefresh(true);
},
[setFilter],
);
+ useEffect(() => {
+ if (refresh) {
+ fetchHook.refetch({ force: true });
+ setRefresh(false);
+ }
+ }, [refresh]);
+
return (
@@ -86,7 +93,6 @@ function BalanceSheet({
@@ -100,8 +106,7 @@ function BalanceSheet({
export default compose(
withDashboardActions,
withBalanceSheetActions,
- withBalanceSheetDetail(({ balanceSheetLoading, balanceSheetFilter }) => ({
- balanceSheetLoading,
+ withBalanceSheetDetail(({ balanceSheetFilter }) => ({
balanceSheetFilter,
})),
withSettings,
diff --git a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetActionsBar.js b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetActionsBar.js
index 24393c077..b32218d82 100644
--- a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetActionsBar.js
+++ b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetActionsBar.js
@@ -22,8 +22,12 @@ import withBalanceSheetActions from './withBalanceSheetActions';
function BalanceSheetActionsBar({
+ // #withBalanceSheetDetail
balanceSheetFilter,
+
+ // #withBalanceSheetActions
toggleBalanceSheetFilter,
+ refreshBalanceSheet
}) {
const filterDropdown = FilterDropdown({
fields: [],
@@ -34,6 +38,10 @@ function BalanceSheetActionsBar({
toggleBalanceSheetFilter();
};
+ const handleRecalcReport = () => {
+ refreshBalanceSheet(true);
+ };
+
return (
@@ -44,6 +52,16 @@ function BalanceSheetActionsBar({
/>
+ }
+ onClick={handleRecalcReport}
+ icon={}
+ />
+
}
/>
-
+
+
}
diff --git a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetHeader.js b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetHeader.js
index 6c0586d12..6c7d2ff68 100644
--- a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetHeader.js
+++ b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetHeader.js
@@ -1,6 +1,6 @@
-import React, { useMemo, useCallback } from 'react';
+import React, { useMemo, useCallback, useEffect } from 'react';
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
-import { Row, Col } from 'react-grid-system';
+import { Row, Col, Visible } from 'react-grid-system';
import {
Button,
FormGroup,
@@ -17,11 +17,19 @@ import FinancialStatementDateRange from 'containers/FinancialStatements/Financia
import SelectDisplayColumnsBy from '../SelectDisplayColumnsBy';
import RadiosAccountingBasis from '../RadiosAccountingBasis';
+import withBalanceSheet from './withBalanceSheetDetail';
+import withBalanceSheetActions from './withBalanceSheetActions';
-export default function BalanceSheetHeader({
+import { compose } from 'utils';
+
+function BalanceSheetHeader({
onSubmitFilter,
pageFilter,
- show
+ show,
+ refresh,
+
+ // #withBalanceSheetActions
+ refreshBalanceSheet
}) {
const { formatMessage } = useIntl();
@@ -49,11 +57,6 @@ export default function BalanceSheetHeader({
formik.setFieldValue('display_columns_by', item.by);
}, [formik]);
- // Handle submit filter submit button.
- const handleSubmitClick = useCallback(() => {
- formik.submitForm();
- }, [formik]);
-
const filterAccountsOptions = useMemo(() => [
{ key: '', name: formatMessage({ id: 'accounts_with_zero_balance' }) },
{ key: 'all-trans', name: formatMessage({ id: 'all_transactions' }) },
@@ -63,24 +66,31 @@ export default function BalanceSheetHeader({
return ();
}, []);
- const infoIcon = useMemo(() =>
- (), []);
-
const handleAccountingBasisChange = useCallback((value) => {
formik.setFieldValue('basis', value);
}, [formik]);
+ // Handle submit filter submit button.
+ useEffect(() => {
+ if (refresh) {
+ formik.submitForm();
+ refreshBalanceSheet(false);
+ }
+ }, [refresh]);
+
return (
-
-
-
+
+
+
+
+
-
+
}
className="form-group--select-list bp3-fill"
@@ -95,22 +105,19 @@ export default function BalanceSheetHeader({
-
+
-
-
-
-
)
-}
\ No newline at end of file
+}
+
+export default compose(
+ withBalanceSheet(({ balanceSheetRefresh }) => ({
+ refresh: balanceSheetRefresh,
+ })),
+ withBalanceSheetActions,
+)(BalanceSheetHeader);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js
index ccec75450..94090a0b0 100644
--- a/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js
+++ b/client/src/containers/FinancialStatements/BalanceSheet/BalanceSheetTable.js
@@ -1,4 +1,4 @@
-import React, { useMemo, useCallback } from 'react';
+import React, { useMemo, useEffect, useState, useCallback } from 'react';
import { connect } from 'react-redux';
import { useIntl } from 'react-intl';
@@ -20,23 +20,26 @@ function BalanceSheetTable({
balanceSheetAccounts,
balanceSheetColumns,
balanceSheetQuery,
+ balanceSheetLoading,
// #ownProps
onFetchData,
- loading,
}) {
const { formatMessage } = useIntl();
+
const columns = useMemo(
() => [
{
Header: formatMessage({ id: 'account_name' }),
accessor: 'name',
className: 'account_name',
+ width: 100,
},
{
- Header: formatMessage({ id: 'code' }),
+ Header: formatMessage({ id: 'account_code' }),
accessor: 'code',
className: 'code',
+ width: 80,
},
...(balanceSheetQuery.display_columns_type === 'total'
? [
@@ -55,7 +58,8 @@ function BalanceSheetTable({
}
return '';
},
- className: 'credit',
+ className: 'total',
+ width: 80,
},
]
: []),
@@ -70,7 +74,7 @@ function BalanceSheetTable({
}
return '';
},
- width: 100,
+ width: 80,
}))
: []),
],
@@ -89,18 +93,20 @@ function BalanceSheetTable({
return (
({
+ ({
balanceSheetAccounts,
balanceSheetColumns,
balanceSheetQuery,
+ balanceSheetLoading,
+ }) => ({
+ balanceSheetAccounts,
+ balanceSheetColumns,
+ balanceSheetQuery,
+ balanceSheetLoading,
}),
),
withSettings,
diff --git a/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetActions.js b/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetActions.js
index 465487ceb..20bbacb4e 100644
--- a/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetActions.js
+++ b/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetActions.js
@@ -1,11 +1,14 @@
-import {connect} from 'react-redux';
+import { connect } from 'react-redux';
import {
fetchBalanceSheet,
+ balanceSheetRefresh,
} from 'store/financialStatement/financialStatements.actions';
const mapDispatchToProps = (dispatch) => ({
- fetchBalanceSheet: (query = {}) => dispatch(fetchBalanceSheet({ query })),
- toggleBalanceSheetFilter: () => dispatch({ type: 'BALANCE_SHEET_FILTER_TOGGLE' }),
+ fetchBalanceSheet: (query = {}) => dispatch(fetchBalanceSheet({ query })),
+ toggleBalanceSheetFilter: () =>
+ dispatch({ type: 'BALANCE_SHEET_FILTER_TOGGLE' }),
+ refreshBalanceSheet: (refresh) => dispatch(balanceSheetRefresh(refresh)),
});
-export default connect(null, mapDispatchToProps);
\ No newline at end of file
+export default connect(null, mapDispatchToProps);
diff --git a/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetDetail.js b/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetDetail.js
index 630981e5e..e69448f30 100644
--- a/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetDetail.js
+++ b/client/src/containers/FinancialStatements/BalanceSheet/withBalanceSheetDetail.js
@@ -17,6 +17,7 @@ export default (mapState) => {
balanceSheetQuery: getFinancialSheetQuery(state.financialStatements.balanceSheet.sheets, balanceSheetIndex),
balanceSheetLoading: state.financialStatements.balanceSheet.loading,
balanceSheetFilter: state.financialStatements.balanceSheet.filter,
+ balanceSheetRefresh: state.financialStatements.balanceSheet.refresh,
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/FinancialStatements/FinancialReports.js b/client/src/containers/FinancialStatements/FinancialReports.js
new file mode 100644
index 000000000..7cf8eac75
--- /dev/null
+++ b/client/src/containers/FinancialStatements/FinancialReports.js
@@ -0,0 +1,59 @@
+import React, { useEffect } from 'react';
+import { useIntl } from 'react-intl';
+import { Link } from 'react-router-dom';
+import { For } from 'components';
+
+import financialReportMenus from 'config/financialReportsMenu';
+import withDashboardActions from 'containers/Dashboard/withDashboardActions';
+
+import { compose } from 'utils';
+
+
+function FinancialReportsItem({
+ title,
+ desc,
+ link
+}) {
+ return (
+
+ );
+}
+
+function FinancialReportsSection({
+ sectionTitle,
+ reports
+}) {
+ return (
+
+
{ sectionTitle }
+
+
+
+
+
+ )
+}
+
+function FinancialReports({
+ // #withDashboardActions
+ changePageTitle,
+}) {
+ const { formatMessage } = useIntl();
+
+ useEffect(() => {
+ changePageTitle(formatMessage({ id: 'all_financial_reports' }));
+ }, [changePageTitle, formatMessage]);
+
+ return (
+
+
+
+ );
+}
+
+export default compose(
+ withDashboardActions
+)(FinancialReports);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/FinancialStatementDateRange.js b/client/src/containers/FinancialStatements/FinancialStatementDateRange.js
index 2df5d3dd9..40261062d 100644
--- a/client/src/containers/FinancialStatements/FinancialStatementDateRange.js
+++ b/client/src/containers/FinancialStatements/FinancialStatementDateRange.js
@@ -1,96 +1,98 @@
-import React, {useState, useCallback, useMemo} from 'react';
-import {Row, Col} from 'react-grid-system';
-import {momentFormatter} from 'utils';
-import {DateInput} from '@blueprintjs/datetime';
+import React, { useState, useCallback, useMemo } from 'react';
+import { Row, Col } from 'react-grid-system';
+import { momentFormatter } from 'utils';
+import { DateInput } from '@blueprintjs/datetime';
import { useIntl } from 'react-intl';
-import {
- HTMLSelect,
- FormGroup,
- Intent,
- Position,
-} from '@blueprintjs/core';
+import { HTMLSelect, FormGroup, Intent, Position } from '@blueprintjs/core';
import Icon from 'components/Icon';
import { FieldHint } from 'components';
-import {
- parseDateRangeQuery
-} from 'utils';
+import { parseDateRangeQuery } from 'utils';
-export default function FinancialStatementDateRange({
- formik,
-}) {
+export default function FinancialStatementDateRange({ formik }) {
const intl = useIntl();
const [reportDateRange, setReportDateRange] = useState('this_year');
- const dateRangeOptions = useMemo(() => [
- {value: 'today', label: 'Today', },
- {value: 'this_week', label: 'This Week'},
- {value: 'this_month', label: 'This Month'},
- {value: 'this_quarter', label: 'This Quarter'},
- {value: 'this_year', label: 'This Year'},
- {value: 'custom', label: 'Custom Range'},
- ], []);
+ const dateRangeOptions = useMemo(
+ () => [
+ { value: 'today', label: 'Today' },
+ { value: 'this_week', label: 'This Week' },
+ { value: 'this_month', label: 'This Month' },
+ { value: 'this_quarter', label: 'This Quarter' },
+ { value: 'this_year', label: 'This Year' },
+ { value: 'custom', label: 'Custom Range' },
+ ],
+ [],
+ );
- const handleDateChange = useCallback((name) => (date) => {
- setReportDateRange('custom');
- formik.setFieldValue(name, date);
- }, [setReportDateRange, formik]);
+ const handleDateChange = useCallback(
+ (name) => (date) => {
+ setReportDateRange('custom');
+ formik.setFieldValue(name, date);
+ },
+ [setReportDateRange, formik],
+ );
// Handles date range field change.
- const handleDateRangeChange = useCallback((e) => {
- const value = e.target.value;
- if (value !== 'custom') {
- const dateRange = parseDateRangeQuery(value);
- if (dateRange) {
- formik.setFieldValue('from_date', dateRange.from_date);
- formik.setFieldValue('to_date', dateRange.to_date);
+ const handleDateRangeChange = useCallback(
+ (e) => {
+ const value = e.target.value;
+ if (value !== 'custom') {
+ const dateRange = parseDateRangeQuery(value);
+ if (dateRange) {
+ formik.setFieldValue('from_date', dateRange.from_date);
+ formik.setFieldValue('to_date', dateRange.to_date);
+ }
}
- }
- setReportDateRange(value);
- }, [formik]);
+ setReportDateRange(value);
+ },
+ [formik],
+ );
- const infoIcon = useMemo(() => (), []);
+ const infoIcon = useMemo(() => , []);
return (
-
-
+ <>
+
-
+ fill={true}
+ >
+ onChange={handleDateRangeChange}
+ />
-
+
-
+ intent={formik.errors.from_date && Intent.DANGER}
+ >
+ fill={true}
+ />
-
+
}
+ label={intl.formatMessage({ id: 'to_date' })}
+ labelInfo={}
fill={true}
- intent={formik.errors.to_date && Intent.DANGER}>
-
+ intent={formik.errors.to_date && Intent.DANGER}
+ >
+ intent={formik.errors.to_date && Intent.DANGER}
+ />
-
+ >
);
-}
\ No newline at end of file
+}
diff --git a/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.js b/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.js
index a6fbe6f76..0d40ea6fa 100644
--- a/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.js
+++ b/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.js
@@ -29,6 +29,7 @@ function GeneralLedgerActionsBar({
// #withGeneralLedgerActions
toggleGeneralLedgerSheetFilter,
+ refreshGeneralLedgerSheet
}) {
const filterDropdown = FilterDropdown({
fields: [],
@@ -41,6 +42,10 @@ function GeneralLedgerActionsBar({
toggleGeneralLedgerSheetFilter();
};
+ const handleRecalcReport = () => {
+ refreshGeneralLedgerSheet(true);
+ };
+
return (
@@ -52,6 +57,16 @@ function GeneralLedgerActionsBar({
+ }
+ />
+
-
} />
+
+
}
diff --git a/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeader.js b/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeader.js
index 99ad10f02..bd4aa0dba 100644
--- a/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeader.js
+++ b/client/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerHeader.js
@@ -1,6 +1,6 @@
-import React, { useCallback } from 'react';
+import React, { useEffect, useCallback } from 'react';
import { Button, FormGroup, Classes } from '@blueprintjs/core';
-import { Row, Col } from 'react-grid-system';
+import { Row, Col, Visible } from 'react-grid-system';
import moment from 'moment';
import * as Yup from 'yup';
import { useFormik } from 'formik';
@@ -13,9 +13,12 @@ import withAccounts from 'containers/Accounts/withAccounts';
import classNames from 'classnames';
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
import RadiosAccountingBasis from '../RadiosAccountingBasis';
-import { compose } from 'utils';
import withGeneralLedger from './withGeneralLedger';
+import withGeneralLedgerActions from './withGeneralLedgerActions';
+
+import { compose } from 'utils';
+
function GeneralLedgerHeader({
onSubmitFilter,
@@ -24,8 +27,12 @@ function GeneralLedgerHeader({
// #withAccounts
accounts,
+ // #withGeneralLedgerActions
+ refreshGeneralLedgerSheet,
+
// #withGeneralLedger
generalLedgerSheetFilter,
+ generalLedgerSheetRefresh
}) {
const formik = useFormik({
enableReinitialize: true,
@@ -44,13 +51,8 @@ function GeneralLedgerHeader({
},
});
- // handle submit filter submit button.
- const handleSubmitClick = useCallback(() => {
- formik.submitForm();
- }, []);
-
const onAccountSelected = useCallback((selectedAccounts) => {
- console.log(selectedAccounts);
+
}, []);
const handleAccountingBasisChange = useCallback(
@@ -59,13 +61,23 @@ function GeneralLedgerHeader({
},
[formik],
);
+
+ // handle submit filter submit button.
+ useEffect(() => {
+ if (generalLedgerSheetRefresh) {
+ formik.submitForm();
+ refreshGeneralLedgerSheet(false);
+ }
+ }, [formik, generalLedgerSheetRefresh])
return (
-
-
-
+
+
+
+
+
}
className={classNames('form-group--select-list', Classes.FILL)}
@@ -77,23 +89,13 @@ function GeneralLedgerHeader({
-
+
-
-
-
);
@@ -103,7 +105,9 @@ export default compose(
withAccounts(({ accounts }) => ({
accounts,
})),
- withGeneralLedger(({ generalLedgerSheetFilter }) => ({
+ withGeneralLedger(({ generalLedgerSheetFilter, generalLedgerSheetRefresh }) => ({
generalLedgerSheetFilter,
+ generalLedgerSheetRefresh,
})),
+ withGeneralLedgerActions,
)(GeneralLedgerHeader);
diff --git a/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedger.js b/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedger.js
index 0844c9e1a..fd8ab6662 100644
--- a/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedger.js
+++ b/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedger.js
@@ -1,11 +1,10 @@
-import {connect} from 'react-redux';
+import { connect } from 'react-redux';
import {
getFinancialSheet,
getFinancialSheetQuery,
getFinancialSheetTableRows,
} from 'store/financialStatement/financialStatements.selectors';
-
export default (mapState) => {
const mapStateToProps = (state, props) => {
const { generalLedgerIndex } = props;
@@ -23,8 +22,11 @@ export default (mapState) => {
state.financialStatements.generalLedger.sheets,
generalLedgerIndex,
),
- generalLedgerSheetLoading: state.financialStatements.generalLedger.loading,
+ generalLedgerSheetLoading:
+ state.financialStatements.generalLedger.loading,
generalLedgerSheetFilter: state.financialStatements.generalLedger.filter,
+ generalLedgerSheetRefresh:
+ state.financialStatements.generalLedger.refresh,
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedgerActions.js b/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedgerActions.js
index 89fac1c1b..a7568dc4a 100644
--- a/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedgerActions.js
+++ b/client/src/containers/FinancialStatements/GeneralLedger/withGeneralLedgerActions.js
@@ -1,11 +1,13 @@
import {connect} from 'react-redux';
import {
fetchGeneralLedger,
+ refreshGeneralLedgerSheet,
} from 'store/financialStatement/financialStatements.actions';
const mapDispatchToProps = (dispatch) => ({
fetchGeneralLedger: (query = {}) => dispatch(fetchGeneralLedger({ query })),
toggleGeneralLedgerSheetFilter: () => dispatch({ type: 'GENERAL_LEDGER_FILTER_TOGGLE' }),
+ refreshGeneralLedgerSheet: (refresh) => dispatch(refreshGeneralLedgerSheet(refresh)),
});
export default connect(null, mapDispatchToProps);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/Journal/JournalActionsBar.js b/client/src/containers/FinancialStatements/Journal/JournalActionsBar.js
index 544ad3190..3a1c30d03 100644
--- a/client/src/containers/FinancialStatements/Journal/JournalActionsBar.js
+++ b/client/src/containers/FinancialStatements/Journal/JournalActionsBar.js
@@ -27,6 +27,7 @@ function JournalActionsBar({
// #withJournalActions
toggleJournalSheetFilter,
+ refreshJournalSheet,
}) {
const filterDropdown = FilterDropdown({
fields: [],
@@ -37,6 +38,10 @@ function JournalActionsBar({
toggleJournalSheetFilter();
};
+ const handleRecalcReport = () => {
+ refreshJournalSheet(true);
+ };
+
return (
@@ -47,6 +52,13 @@ function JournalActionsBar({
/>
+ }
+ />
+
-
+
+
}
+ icon={}
text={}
/>
@@ -88,8 +92,5 @@ function ProfitLossSheet({
export default compose(
withDashboardActions,
withProfitLossActions,
- withProfitLoss(({ profitLossSheetLoading }) => ({
- profitLossSheetLoading,
- })),
withSettings,
)(ProfitLossSheet);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetHeader.js b/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetHeader.js
index e38f9dade..b3ab27135 100644
--- a/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetHeader.js
+++ b/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetHeader.js
@@ -1,5 +1,5 @@
-import React, { useCallback } from 'react';
-import { Row, Col } from 'react-grid-system';
+import React, { useCallback, useEffect } from 'react';
+import { Row, Col, Visible } from 'react-grid-system';
import { Button } from '@blueprintjs/core';
import moment from 'moment';
import { useFormik } from 'formik';
@@ -11,6 +11,7 @@ import SelectsListColumnsBy from '../SelectDisplayColumnsBy';
import RadiosAccountingBasis from '../RadiosAccountingBasis';
import withProfitLoss from './withProfitLoss';
+import withProfitLossActions from './withProfitLossActions';
import { compose } from 'utils';
@@ -21,6 +22,10 @@ function ProfitLossHeader({
// #withProfitLoss
profitLossSheetFilter,
+ profitLossSheetRefresh,
+
+ // #withProfitLossActions
+ refreshProfitLossSheet,
}) {
const { formatMessage } = useIntl();
const formik = useFormik({
@@ -54,10 +59,6 @@ function ProfitLossHeader({
[formik],
);
- const handleSubmitClick = useCallback(() => {
- formik.submitForm();
- }, [formik]);
-
const handleAccountingBasisChange = useCallback(
(value) => {
formik.setFieldValue('basis', value);
@@ -65,36 +66,41 @@ function ProfitLossHeader({
[formik],
);
+ useEffect(() => {
+ if (profitLossSheetRefresh) {
+ formik.submitForm();
+ refreshProfitLossSheet(false);
+ }
+ }, [profitLossSheetRefresh]);
+
return (
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
);
}
export default compose(
- withProfitLoss(({ profitLossSheetFilter }) => ({ profitLossSheetFilter })),
+ withProfitLoss(({
+ profitLossSheetFilter,
+ profitLossSheetRefresh,
+ }) => ({
+ profitLossSheetFilter,
+ profitLossSheetRefresh,
+ })),
+ withProfitLossActions,
)(ProfitLossHeader);
diff --git a/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js b/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js
index 2d728ceaf..2333c3cea 100644
--- a/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js
+++ b/client/src/containers/FinancialStatements/ProfitLossSheet/ProfitLossSheetTable.js
@@ -15,9 +15,9 @@ function ProfitLossSheetTable({
profitLossTableRows,
profitLossQuery,
profitLossColumns,
+ profitLossSheetLoading,
// #ownProps
- loading,
onFetchData,
companyName,
}) {
@@ -31,7 +31,7 @@ function ProfitLossSheetTable({
className: 'name',
},
{
- Header: formatMessage({ id: 'acc_code' }),
+ Header: formatMessage({ id: 'account_code' }),
accessor: 'code',
className: 'account_code',
},
@@ -102,7 +102,7 @@ function ProfitLossSheetTable({
fromDate={profitLossQuery.from_date}
toDate={profitLossQuery.to_date}
name="profit-loss-sheet"
- loading={loading}
+ loading={profitLossSheetLoading}
basis={profitLossQuery.basis}
>
({
+ ({ profitLossQuery, profitLossColumns, profitLossTableRows, profitLossSheetLoading }) => ({
profitLossColumns,
profitLossQuery,
profitLossTableRows,
+ profitLossSheetLoading,
}),
),
)(ProfitLossSheetTable);
diff --git a/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLoss.js b/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLoss.js
index 9aee1d7f6..9b4fb3da6 100644
--- a/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLoss.js
+++ b/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLoss.js
@@ -20,6 +20,7 @@ export default (mapState) => {
profitLossSheetLoading: state.financialStatements.profitLoss.loading,
profitLossSheetFilter: state.financialStatements.profitLoss.filter,
+ profitLossSheetRefresh: state.financialStatements.profitLoss.refresh,
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLossActions.js b/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLossActions.js
index ec08bf6c0..ef75185ec 100644
--- a/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLossActions.js
+++ b/client/src/containers/FinancialStatements/ProfitLossSheet/withProfitLossActions.js
@@ -1,11 +1,13 @@
import {connect} from 'react-redux';
import {
fetchProfitLossSheet,
+ profitLossRefresh,
} from 'store/financialStatement/financialStatements.actions';
export const mapDispatchToProps = (dispatch) => ({
fetchProfitLossSheet: (query = {}) => dispatch(fetchProfitLossSheet({ query })),
toggleProfitLossSheetFilter: () => dispatch({ type: 'PROFIT_LOSS_FILTER_TOGGLE' }),
+ refreshProfitLossSheet: (refresh) => dispatch(profitLossRefresh(refresh)),
});
export default connect(null, mapDispatchToProps);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummary.js b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummary.js
index bc3792f17..4f323a047 100644
--- a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummary.js
+++ b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummary.js
@@ -25,23 +25,25 @@ function ReceivableAgingSummarySheet({
}) {
const { formatMessage } = useIntl();
const [query, setQuery] = useState({
- as_date: moment().format('YYYY-MM-DD'),
+ as_date: moment().endOf('day').format('YYYY-MM-DD'),
aging_before_days: 30,
aging_periods: 3,
});
+ const [refresh, setRefresh] = useState(true);
useEffect(() => {
changePageTitle(formatMessage({ id: 'receivable_aging_summary' }));
}, []);
- const fetchSheet = useQuery(['receivable-aging-summary', query],
+ const fetchSheet = useQuery(
+ ['receivable-aging-summary', query],
(key, q) => requestReceivableAgingSummary(q),
{ manual: true });
// Handle fetch the data of receivable aging summary sheet.
- const handleFetchData = useCallback(() => {
- fetchSheet.refetch({ force: true });
- }, [fetchSheet]);
+ const handleFetchData = useCallback((...args) => {
+ setRefresh(true);
+ }, []);
const handleFilterSubmit = useCallback((filter) => {
const _filter = {
@@ -49,8 +51,15 @@ function ReceivableAgingSummarySheet({
as_date: moment(filter.as_date).format('YYYY-MM-DD'),
};
setQuery(_filter);
- fetchSheet.refetch({ force: true });
- }, [fetchSheet]);
+ setRefresh(true);
+ }, []);
+
+ useEffect(() => {
+ if (refresh) {
+ fetchSheet.refetch({ force: true });
+ setRefresh(false);
+ }
+ }, [fetchSheet, refresh]);
return (
@@ -59,6 +68,7 @@ function ReceivableAgingSummarySheet({
diff --git a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryActionsBar.js b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryActionsBar.js
index 4dbb07771..345ed53a0 100644
--- a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryActionsBar.js
+++ b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryActionsBar.js
@@ -23,8 +23,12 @@ import { compose } from 'utils';
function ReceivableAgingSummaryActionsBar({
- toggleFilterReceivableAgingSummary,
+ // #withReceivableAging
receivableAgingFilter,
+
+ // #withReceivableAgingActions
+ toggleFilterReceivableAgingSummary,
+ refreshReceivableAgingSummary,
}) {
const filterDropdown = FilterDropdown({
fields: [],
@@ -35,6 +39,10 @@ function ReceivableAgingSummaryActionsBar({
toggleFilterReceivableAgingSummary();
};
+ const handleRecalcReport = () => {
+ refreshReceivableAgingSummary(true);
+ };
+
return (
@@ -45,6 +53,16 @@ function ReceivableAgingSummaryActionsBar({
/>
+ }
+ icon={}
+ onClick={handleRecalcReport}
+ />
+
}
/>
-
+
+
}
diff --git a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryHeader.js b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryHeader.js
index a51c70caa..59564d68f 100644
--- a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryHeader.js
+++ b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryHeader.js
@@ -1,6 +1,6 @@
-import React, { useCallback } from 'react';
-import { useIntl, FormattedMessage as T, } from 'react-intl';
-import { useFormik } from "formik";
+import React, { useCallback, useEffect } from 'react';
+import { useIntl, FormattedMessage as T } from 'react-intl';
+import { useFormik } from 'formik';
import { Row, Col } from 'react-grid-system';
import * as Yup from 'yup';
import {
@@ -11,22 +11,27 @@ import {
Button,
} from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
+import moment from 'moment';
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
-import {
- ErrorMessage,
- FieldHint,
- FieldRequiredHint,
-} from 'components';
-import {
- momentFormatter,
-} from 'utils';
+import { ErrorMessage, FieldHint, FieldRequiredHint } from 'components';
+import { momentFormatter } from 'utils';
import withReceivableAging from './withReceivableAgingSummary';
+import withReceivableAgingActions from './withReceivableAgingSummaryActions';
+
import { compose } from 'utils';
+
function ReceivableAgingSummaryHeader({
- onSubmitFilter,
+ pageFilter,
+ onSubmitFilter,
receivableAgingFilter,
+
+ // #withReceivableAgingSummary
+ receivableAgingRefresh,
+
+ // #withReceivableAgingSummaryActions
+ refreshReceivableAgingSummary
}) {
const { formatMessage } = useIntl();
@@ -37,61 +42,75 @@ function ReceivableAgingSummaryHeader({
setFieldValue,
getFieldProps,
submitForm,
- isSubmitting
+ isSubmitting,
} = useFormik({
enableReinitialize: true,
initialValues: {
- // as_date: new Date(),
+ as_date: moment(pageFilter.as_date).toDate(),
aging_before_days: 30,
aging_periods: 3,
},
validationSchema: Yup.object().shape({
- as_date: Yup.date().required().label('As date'),
- aging_before_days: Yup.number().required().integer().positive().label('aging_before_days'),
- aging_periods: Yup.number().required().integer().positive().label('aging_periods'),
+ as_date: Yup.date().required().label('as_date'),
+ aging_before_days: Yup.number()
+ .required()
+ .integer()
+ .positive()
+ .label('aging_before_days'),
+ aging_periods: Yup.number()
+ .required()
+ .integer()
+ .positive()
+ .label('aging_periods'),
}),
onSubmit: (values, { setSubmitting }) => {
onSubmitFilter(values);
setSubmitting(false);
- }
+ },
});
- const handleDateChange = useCallback((name) => (date) => {
- setFieldValue(name, date);
- }, []);
+ const handleDateChange = useCallback(
+ (name) => (date) => {
+ setFieldValue(name, date);
+ },
+ [],
+ );
// Handle submit filter submit button.
- const handleSubmitClick = useCallback(() => {
- submitForm();
- }, [submitForm]);
+ useEffect(() => {
+ if (receivableAgingRefresh) {
+ submitForm();
+ refreshReceivableAgingSummary(false);
+ }
+ }, [submitForm, receivableAgingRefresh]);
return (
-
+
}
fill={true}
- intent={errors.as_date && Intent.DANGER}>
-
+ intent={errors.as_date && Intent.DANGER}
+ >
+ fill={true}
+ />
-
+
}
labelInfo={}
className={'form-group--aging-before-days'}
intent={errors.aging_before_days && Intent.DANGER}
- helperText={}
>
-
+
}
labelInfo={}
className={'form-group--aging-periods'}
intent={errors.aging_before_days && Intent.DANGER}
- helperText={}
>
-
-
-
-
-
-
-
-
);
}
export default compose(
- withReceivableAging(({ receivableAgingSummaryFilter }) => ({
+ withReceivableAgingActions,
+ withReceivableAging(({ receivableAgingSummaryFilter, receivableAgingSummaryRefresh }) => ({
receivableAgingFilter: receivableAgingSummaryFilter,
+ receivableAgingRefresh: receivableAgingSummaryRefresh
})),
-)(ReceivableAgingSummaryHeader);
\ No newline at end of file
+)(ReceivableAgingSummaryHeader);
diff --git a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryTable.js b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryTable.js
index db07dab81..c10bd09d2 100644
--- a/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryTable.js
+++ b/client/src/containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummaryTable.js
@@ -15,19 +15,18 @@ function ReceivableAgingSummaryTable({
organizationSettings,
// #withReceivableAgingSummary
- receviableAgingRows = [],
+ receivableAgingRows,
receivableAgingLoading,
receivableAgingColumns,
// #ownProps
- receivableAgingSummaryQuery,
onFetchData,
}) {
const { formatMessage } = useIntl();
const agingColumns = useMemo(() => {
return receivableAgingColumns.map((agingColumn) => {
- return `${agingColumn.before_days} - ${agingColumn.to_days || '<'}`;
+ return `${agingColumn.before_days} - ${agingColumn.to_days || 'And Over'}`;
});
}, [receivableAgingColumns]);
@@ -36,25 +35,38 @@ function ReceivableAgingSummaryTable({
Header: (),
accessor: 'customer_name',
className: 'customer_name',
+ sticky: 'left',
},
...agingColumns.map((agingColumn, index) => ({
Header: agingColumn,
- id: `asd-${index}`,
+ accessor: (row) => {
+ const amount = row[`aging-${index}`];
+ if (row.rowType === 'total') {
+ return
+ }
+ return amount > 0 ? amount : '';
+ },
})),
{
Header: (),
- accessor: 'total',
+ id: 'total',
+ accessor: (row) => {
+ return ;
+ },
className: 'total',
},
]), [agingColumns]);
+ const rowClassNames = (row) => [`row-type--${row.original.rowType}`];
+
const handleFetchData = useCallback((...args) => {
onFetchData && onFetchData(...args);
- }, [onFetchData]);
+ }, []);
return (
@@ -62,8 +74,10 @@ function ReceivableAgingSummaryTable({
@@ -75,8 +89,11 @@ export default compose(
withReceivableAgingSummaryTable,
withReceivableAgingSummary(({
receivableAgingSummaryLoading,
- receivableAgingSummaryColumns }) => ({
+ receivableAgingSummaryColumns,
+ receivableAgingSummaryRows,
+ }) => ({
receivableAgingLoading: receivableAgingSummaryLoading,
- receivableAgingColumns: receivableAgingSummaryColumns
+ receivableAgingColumns: receivableAgingSummaryColumns,
+ receivableAgingRows: receivableAgingSummaryRows,
})),
)(ReceivableAgingSummaryTable);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummary.js b/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummary.js
index 2d7412a4e..95320b756 100644
--- a/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummary.js
+++ b/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummary.js
@@ -2,6 +2,7 @@ import { connect } from 'react-redux';
import {
getFinancialSheet,
getFinancialSheetColumns,
+ getFinancialSheetTableRows,
} from 'store/financialStatement/financialStatements.selectors';
export default (mapState) => {
@@ -17,10 +18,16 @@ export default (mapState) => {
state.financialStatements.receivableAgingSummary.sheets,
receivableAgingSummaryIndex,
),
+ receivableAgingSummaryRows: getFinancialSheetTableRows(
+ state.financialStatements.receivableAgingSummary.sheets,
+ receivableAgingSummaryIndex,
+ ),
receivableAgingSummaryLoading:
state.financialStatements.receivableAgingSummary.loading,
receivableAgingSummaryFilter:
state.financialStatements.receivableAgingSummary.filter,
+ receivableAgingSummaryRefresh:
+ state.financialStatements.receivableAgingSummary.refresh,
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummaryActions.js b/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummaryActions.js
index 37cf35297..2e0923a12 100644
--- a/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummaryActions.js
+++ b/client/src/containers/FinancialStatements/ReceivableAgingSummary/withReceivableAgingSummaryActions.js
@@ -1,12 +1,18 @@
import { connect } from 'react-redux';
-import { fetchReceivableAgingSummary } from 'store/financialStatement/financialStatements.actions';
+import {
+ fetchReceivableAgingSummary,
+ receivableAgingSummaryRefresh,
+} from 'store/financialStatement/financialStatements.actions';
const mapActionsToProps = (dispatch) => ({
requestReceivableAgingSummary: (query) =>
dispatch(fetchReceivableAgingSummary({ query })),
- toggleFilterReceivableAgingSummary: () => dispatch({
- type: 'RECEIVABLE_AGING_SUMMARY_FILTER_TOGGLE',
- }),
+ toggleFilterReceivableAgingSummary: () =>
+ dispatch({
+ type: 'RECEIVABLE_AGING_SUMMARY_FILTER_TOGGLE',
+ }),
+ refreshReceivableAgingSummary: (refresh) =>
+ dispatch(receivableAgingSummaryRefresh(refresh)),
});
export default connect(null, mapActionsToProps);
diff --git a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceActionsBar.js b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceActionsBar.js
index 936bb66a3..91656578f 100644
--- a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceActionsBar.js
+++ b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceActionsBar.js
@@ -20,12 +20,17 @@ function TrialBalanceActionsBar({
// #withTrialBalanceActions
toggleTrialBalanceFilter,
+ refreshTrialBalance,
}) {
const handleFilterToggleClick = () => {
toggleTrialBalanceFilter();
};
+ const handleRecalcReport = () => {
+ refreshTrialBalance(true);
+ };
+
return (
@@ -36,6 +41,16 @@ function TrialBalanceActionsBar({
/>
+ }
+ />
+
{
- fetchHook.refetch({ force: true });
+ setRefresh(true);
}, []);
// Change page title of the dashboard.
@@ -62,11 +58,18 @@ function TrialBalanceSheet({
to_date: moment(filter.to_date).format('YYYY-MM-DD'),
};
setFilter(parsedFilter);
- fetchHook.refetch({ force: true });
+ setRefresh(true);
},
[fetchHook],
);
+ useEffect(() => {
+ if (refresh) {
+ fetchHook.refetch({ force: true });
+ setRefresh(false);
+ }
+ }, [refresh, fetchHook.refetch]);
+
return (
@@ -83,7 +86,6 @@ function TrialBalanceSheet({
companyName={organizationSettings.name}
trialBalanceQuery={filter}
onFetchData={handleFetchData}
- loading={trialBalanceSheetLoading}
/>
@@ -95,8 +97,5 @@ function TrialBalanceSheet({
export default compose(
withDashboardActions,
withTrialBalanceActions,
- withTrialBalance(({ trialBalanceSheetLoading }) => ({
- trialBalanceSheetLoading,
- })),
withSettings,
)(TrialBalanceSheet);
diff --git a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeader.js b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeader.js
index 3f80964fc..16f4e8cd2 100644
--- a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeader.js
+++ b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetHeader.js
@@ -1,4 +1,4 @@
-import React, { useCallback } from 'react';
+import React, { useEffect } from 'react';
import * as Yup from 'yup';
import moment from 'moment';
import { Row, Col } from 'react-grid-system';
@@ -9,6 +9,7 @@ import { Button } from "@blueprintjs/core";
import FinancialStatementHeader from 'containers/FinancialStatements/FinancialStatementHeader';
import FinancialStatementDateRange from 'containers/FinancialStatements/FinancialStatementDateRange';
import withTrialBalance from './withTrialBalance';
+import withTrialBalanceActions from './withTrialBalanceActions';
import { compose } from 'utils';
@@ -19,6 +20,10 @@ function TrialBalanceSheetHeader({
// #withTrialBalance
trialBalanceSheetFilter,
+ trialBalanceSheetRefresh,
+
+ // #withTrialBalanceActions
+ refreshTrialBalance,
}) {
const { formatMessage } = useIntl();
const formik = useFormik({
@@ -38,29 +43,29 @@ function TrialBalanceSheetHeader({
}
});
- const handleSubmitClick = useCallback(() => {
- formik.submitForm();
- }, [formik]);
+ useEffect(() => {
+ if (trialBalanceSheetRefresh) {
+ formik.submitForm();
+ refreshTrialBalance(false);
+ }
+ }, [formik, trialBalanceSheetRefresh]);
return (
-
-
-
-
-
-
-
+
);
}
export default compose(
- withTrialBalance(({ trialBalanceSheetFilter }) => ({ trialBalanceSheetFilter })),
+ withTrialBalance(({
+ trialBalanceSheetFilter,
+ trialBalanceSheetRefresh,
+ }) => ({
+ trialBalanceSheetFilter,
+ trialBalanceSheetRefresh
+ })),
+ withTrialBalanceActions,
)(TrialBalanceSheetHeader);
\ No newline at end of file
diff --git a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js
index 7181d5d5e..193ed756c 100644
--- a/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js
+++ b/client/src/containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetTable.js
@@ -14,13 +14,13 @@ import { compose } from 'utils';
function TrialBalanceSheetTable({
// #withTrialBalanceDetail
trialBalanceAccounts,
+ trialBalanceSheetLoading,
// #withTrialBalanceTable
trialBalanceIndex,
trialBalanceQuery,
onFetchData,
- loading,
companyName,
}) {
const { formatMessage } = useIntl();
@@ -31,30 +31,41 @@ function TrialBalanceSheetTable({
Header: formatMessage({ id: 'account_name' }),
accessor: 'name',
className: 'name',
+ minWidth: 150,
+ maxWidth: 150,
+ width: 150,
},
{
Header: formatMessage({ id: 'code' }),
accessor: 'code',
className: 'code',
- width: 120,
+ minWidth: 80,
+ maxWidth: 80,
+ width: 80,
},
{
Header: formatMessage({ id: 'credit' }),
accessor: (r) => ,
className: 'credit',
- width: 120,
+ minWidth: 95,
+ maxWidth: 95,
+ width: 95,
},
{
Header: formatMessage({ id: 'debit' }),
accessor: (r) => ,
className: 'debit',
- width: 120,
+ minWidth: 95,
+ maxWidth: 95,
+ width: 95,
},
{
Header: formatMessage({ id: 'balance' }),
accessor: (r) => ,
className: 'balance',
- width: 120,
+ minWidth: 95,
+ maxWidth: 95,
+ width: 95,
},
],
[formatMessage],
@@ -71,7 +82,7 @@ function TrialBalanceSheetTable({
fromDate={trialBalanceQuery.from_date}
toDate={trialBalanceQuery.to_date}
name="trial-balance"
- loading={loading}
+ loading={trialBalanceSheetLoading}
>
({
+ withTrialBalance(({
trialBalanceAccounts,
+ trialBalanceSheetLoading,
+ }) => ({
+ trialBalanceAccounts,
+ trialBalanceSheetLoading
})),
)(TrialBalanceSheetTable);
diff --git a/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalance.js b/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalance.js
index 7efb1e9c6..421c18217 100644
--- a/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalance.js
+++ b/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalance.js
@@ -19,6 +19,7 @@ export default (mapState) => {
),
trialBalanceSheetLoading: state.financialStatements.trialBalance.loading,
trialBalanceSheetFilter: state.financialStatements.trialBalance.filter,
+ trialBalanceSheetRefresh: state.financialStatements.trialBalance.refresh,
};
return mapState ? mapState(mapped, state, props) : mapped;
};
diff --git a/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalanceActions.js b/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalanceActions.js
index c5d5b6b15..1904599ad 100644
--- a/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalanceActions.js
+++ b/client/src/containers/FinancialStatements/TrialBalanceSheet/withTrialBalanceActions.js
@@ -1,11 +1,13 @@
import {connect} from 'react-redux';
import {
- fetchTrialBalanceSheet
+ fetchTrialBalanceSheet,
+ trialBalanceRefresh,
} from 'store/financialStatement/financialStatements.actions';
export const mapDispatchToProps = (dispatch) => ({
fetchTrialBalanceSheet: (query = {}) => dispatch(fetchTrialBalanceSheet({ query })),
toggleTrialBalanceFilter: () => dispatch({ type: 'TRIAL_BALANCE_FILTER_TOGGLE' }),
+ refreshTrialBalance: (refresh) => dispatch(trialBalanceRefresh(refresh)),
});
export default connect(null, mapDispatchToProps);
\ No newline at end of file
diff --git a/client/src/lang/en/index.js b/client/src/lang/en/index.js
index 274d88081..c9bbca452 100644
--- a/client/src/lang/en/index.js
+++ b/client/src/lang/en/index.js
@@ -260,6 +260,7 @@ export default {
sales: 'Sales',
purchases: 'Purchases',
financial_reports: 'Financial Reports',
+ all_financial_reports: 'All Financial Reports',
balance_sheet: 'Balance Sheet',
trial_balance_sheet: 'Trial Balance Sheet',
journal: 'Journal',
@@ -347,7 +348,7 @@ export default {
select_language: 'Select Language',
select_date_format: 'Select Date Format',
select_time_zone: 'Select Time Zone',
- select_currency_code: 'Select Currency Code',
+ select_currency: 'Select Currency',
select_parent_category: 'Select Parent Category',
the_options_has_been_successfully_created:
'The options has been successfully created',
@@ -422,7 +423,7 @@ export default {
payment_account_: 'Payment account',
expense_category: 'Expense Category',
total_currency: 'Total ({currency})',
- amount_currency: 'Amount({currency})',
+ amount_currency: 'Amount ({currency})',
publish_expense: 'Publish Expense',
edit_expense: 'Edit Expense',
delete_expense: 'Delete Expense',
@@ -459,4 +460,12 @@ export default {
display_name:'Display Name',
the_customer_has_been_successfully_created:
'The customer has been successfully created.',
+ select_contact: 'Select contact',
+ contact: 'Contact',
+ contacts: 'Contacts',
+ close_sidebar: 'Close sidebar.',
+ recalc_report: 'Re-calc Report',
+ remove_the_line: 'Remove the line',
+ no_results: 'No results',
+ all_reports: 'All Reports',
};
diff --git a/client/src/routes/dashboard.js b/client/src/routes/dashboard.js
index 884724e73..d18587114 100644
--- a/client/src/routes/dashboard.js
+++ b/client/src/routes/dashboard.js
@@ -92,7 +92,7 @@ export default [
// Financial Reports.
{
- path: `/general-ledger`,
+ path: `/financial-reports/general-ledger`,
component: LazyLoader({
loader: () =>
import('containers/FinancialStatements/GeneralLedger/GeneralLedger'),
@@ -100,7 +100,7 @@ export default [
breadcrumb: 'General Ledger',
},
{
- path: `/balance-sheet`,
+ path: `/financial-reports/balance-sheet`,
component: LazyLoader({
loader: () =>
import('containers/FinancialStatements/BalanceSheet/BalanceSheet'),
@@ -108,42 +108,49 @@ export default [
breadcrumb: 'Balance Sheet',
},
{
- path: `/trial-balance-sheet`,
+ path: `/financial-reports/trial-balance-sheet`,
component: LazyLoader({
loader: () =>
import(
'containers/FinancialStatements/TrialBalanceSheet/TrialBalanceSheet'
),
- breadcrumb: 'Trial Balance Sheet',
}),
+ breadcrumb: 'Trial Balance Sheet',
},
{
- path: `/profit-loss-sheet`,
+ path: `/financial-reports/profit-loss-sheet`,
component: LazyLoader({
loader: () =>
import(
'containers/FinancialStatements/ProfitLossSheet/ProfitLossSheet'
),
- breadcrumb: 'Profit Loss Sheet',
}),
+ breadcrumb: 'Profit Loss Sheet',
},
{
- path: '/receivable-aging-summary',
+ path: '/financial-reports/receivable-aging-summary',
component: LazyLoader({
loader: () =>
import(
'containers/FinancialStatements/ReceivableAgingSummary/ReceivableAgingSummary'
),
- breadcrumb: 'Receivable Aging Summary',
}),
+ breadcrumb: 'Receivable Aging Summary',
},
{
- path: `/journal-sheet`,
+ path: `/financial-reports/journal-sheet`,
component: LazyLoader({
loader: () => import('containers/FinancialStatements/Journal/Journal'),
}),
breadcrumb: 'Journal Sheet',
},
+ {
+ path: '/financial-reports',
+ component: LazyLoader({
+ loader: () => import('containers/FinancialStatements/FinancialReports'),
+ }),
+ breadcrumb: 'Financial Reports',
+ },
{
path: `/ExchangeRates`,
component: LazyLoader({
@@ -158,7 +165,6 @@ export default [
loader: () => import('containers/Expenses/Expenses'),
}),
breadcrumb: 'Expenses',
-
},
{
path: `/expenses/:id/edit`,
diff --git a/client/src/static/json/icons.js b/client/src/static/json/icons.js
index 4f253a4be..993dfd993 100644
--- a/client/src/static/json/icons.js
+++ b/client/src/static/json/icons.js
@@ -5,12 +5,6 @@ export default {
],
viewBox: '0 0 640 512',
},
- homepage: {
- path: [
- 'M4,7.5H7.5V4H4V7.5ZM9.25,18h3.5V14.5H9.25V18ZM4,18H7.5V14.5H4V18Zm0-5.25H7.5V9.25H4v3.5Zm5.25,0h3.5V9.25H9.25v3.5ZM14.5,4V7.5H18V4ZM9.25,7.5h3.5V4H9.25V7.5Zm5.25,5.25H18V9.25H14.5v3.5Zm0,5.25H18V14.5H14.5V18Z',
- ],
- viewBox: '0 0 20 20',
- },
university: {
path: [
'M472 440h-8v-56c0-13.255-10.745-24-24-24h-16V208h-48v152h-48V208h-48v152h-48V208h-48v152h-48V208H88v152H72c-13.255 0-24 10.745-24 24v56h-8c-13.255 0-24 10.745-24 24v16a8 8 0 0 0 8 8h464a8 8 0 0 0 8-8v-16c0-13.255-10.745-24-24-24zm-56 0H96v-32h320v32zm72.267-322.942L271.179 26.463a48.004 48.004 0 0 0-30.358 0L23.733 117.058A11.999 11.999 0 0 0 16 128.274V156c0 6.627 5.373 12 12 12h20v12c0 6.627 5.373 12 12 12h392c6.627 0 12-5.373 12-12v-12h20c6.627 0 12-5.373 12-12v-27.726c0-4.982-3.077-9.445-7.733-11.216zM64 144l192-72 192 72H64z',
@@ -263,4 +257,10 @@ export default {
],
viewBox: '0 0 16 16',
},
+ 'refresh-16': {
+ path: [
+ 'M13.645,2.35A8.0014,8.0014,0,1,0,15.725,10h-2.08a5.9972,5.9972,0,1,1-5.65-8,5.9149,5.9149,0,0,1,4.22,1.78L8.995,7h7V0Z',
+ ],
+ viewBox: '0 0 16 16',
+ },
};
diff --git a/client/src/store/expenses/expenses.reducer.js b/client/src/store/expenses/expenses.reducer.js
index 4eed317db..60335dd8c 100644
--- a/client/src/store/expenses/expenses.reducer.js
+++ b/client/src/store/expenses/expenses.reducer.js
@@ -89,5 +89,5 @@ const reducer = createReducer(initialState, {
export default createTableQueryReducers('expenses', reducer);
export const getExpenseById = (state, id) => {
- return state.expenses.items[id] || {};
+ return state.expenses.items[id];
};
diff --git a/client/src/store/financialStatement/financialStatements.actions.js b/client/src/store/financialStatement/financialStatements.actions.js
index 1b51824f7..7d1125637 100644
--- a/client/src/store/financialStatement/financialStatements.actions.js
+++ b/client/src/store/financialStatement/financialStatements.actions.js
@@ -1,6 +1,13 @@
import ApiService from "services/ApiService";
import t from 'store/types';
+export const balanceSheetRefresh = (refresh) => {
+ return dispatch => dispatch({
+ type: 'BALANCE_SHEET_REFRESH',
+ payload: { refresh },
+ });
+};
+
export const fetchGeneralLedger = ({ query }) => {
return (dispatch) => new Promise((resolve, reject) => {
dispatch({
@@ -21,6 +28,13 @@ export const fetchGeneralLedger = ({ query }) => {
});
};
+export const refreshGeneralLedgerSheet = (refresh) => {
+ return (dispatch) => dispatch({
+ type: t.GENERAL_LEDGER_REFRESH,
+ payload: { refresh },
+ });
+};
+
export const fetchBalanceSheet = ({ query }) => {
return (dispatch) => new Promise((resolve, reject) => {
dispatch({
@@ -65,6 +79,13 @@ export const fetchTrialBalanceSheet = ({ query }) => {
})
};
+export const trialBalanceRefresh = (refresh) => {
+ return (dispatch) => dispatch({
+ type: t.TRIAL_BALANCE_REFRESH,
+ payload: { refresh },
+ });
+};
+
export const fetchProfitLossSheet = ({ query }) => {
return (dispatch) => new Promise((resolve, reject) => {
dispatch({
@@ -87,6 +108,13 @@ export const fetchProfitLossSheet = ({ query }) => {
})
};
+export const profitLossRefresh = (refresh) => {
+ return dispatch => dispatch({
+ type: t.PROFIT_LOSS_REFRESH,
+ payload: { refresh },
+ });
+}
+
export const fetchJournalSheet = ({ query }) => {
return (dispatch) => new Promise((resolve, reject) => {
dispatch({
@@ -108,6 +136,13 @@ export const fetchJournalSheet = ({ query }) => {
});
};
+export const refreshJournalSheet = (refresh) => {
+ return dispatch => dispatch({
+ type: t.JOURNAL_SHEET_REFRESH,
+ payload: { refresh },
+ });
+}
+
export const fetchReceivableAgingSummary = ({ query }) => {
return (dispatch) => new Promise((resolve, reject) => {
dispatch({
@@ -139,4 +174,11 @@ export const fetchReceivableAgingSummary = ({ query }) => {
reject(error);
})
});
+}
+
+export const receivableAgingSummaryRefresh = (refresh) => {
+ return (dispatch) => dispatch({
+ type: t.RECEIVABLE_AGING_SUMMARY_REFRESH,
+ payload: { refresh },
+ });
}
\ No newline at end of file
diff --git a/client/src/store/financialStatement/financialStatements.reducer.js b/client/src/store/financialStatement/financialStatements.reducer.js
index d65e3c59b..d3832aa80 100644
--- a/client/src/store/financialStatement/financialStatements.reducer.js
+++ b/client/src/store/financialStatement/financialStatements.reducer.js
@@ -8,28 +8,32 @@ import { omit } from 'lodash';
const initialState = {
balanceSheet: {
sheets: [],
- loading: false,
+ loading: true,
filter: true,
+ refresh: false,
},
trialBalance: {
sheets: [],
- loading: false,
+ loading: true,
filter: true,
+ refresh: false,
},
generalLedger: {
sheets: [],
loading: false,
filter: true,
+ refresh: false,
},
journal: {
sheets: [],
loading: false,
tableRows: [],
filter: true,
+ refresh: true,
},
profitLoss: {
sheets: [],
- loading: false,
+ loading: true,
tableRows: [],
filter: true,
},
@@ -38,6 +42,7 @@ const initialState = {
loading: false,
tableRows: [],
filter: true,
+ refresh: false,
},
};
@@ -88,6 +93,36 @@ const mapJournalTableRows = (journal) => {
}, []);
};
+
+const mapContactAgingSummary = sheet => {
+ const rows = [];
+
+ const mapAging = (agingPeriods) => {
+ return agingPeriods.reduce((acc, aging, index) => {
+ acc[`aging-${index}`] = aging.formatted_total;
+ return acc;
+ }, {});
+ }
+ sheet.customers.forEach((customer) => {
+ const agingRow = mapAging(customer.aging);
+
+ rows.push({
+ rowType: 'customer',
+ customer_name: customer.customer_name,
+ ...agingRow,
+ total: customer.total,
+ });
+ });
+
+ rows.push({
+ rowType: 'total',
+ customer_name: 'Total',
+ ...mapAging(sheet.total),
+ total: 0,
+ });
+ return rows;
+};
+
const mapProfitLossToTableRows = (profitLoss) => {
return [
{
@@ -152,6 +187,12 @@ export default createReducer(initialState, {
[t.BALANCE_SHEET_LOADING]: (state, action) => {
state.balanceSheet.loading = !!action.loading;
},
+
+ [t.BALANCE_SHEET_REFRESH]: (state, action) => {
+ const { refresh } = action.payload;
+ state.balanceSheet.refresh = refresh;
+ },
+
...financialStatementFilterToggle('BALANCE_SHEET', 'balanceSheet'),
[t.TRAIL_BALANCE_STATEMENT_SET]: (state, action) => {
@@ -173,6 +214,12 @@ export default createReducer(initialState, {
[t.TRIAL_BALANCE_SHEET_LOADING]: (state, action) => {
state.trialBalance.loading = !!action.loading;
},
+
+ [t.TRIAL_BALANCE_REFRESH]: (state, action) => {
+ const { refresh } = action.payload;
+ state.trialBalance.refresh = refresh;
+ },
+
...financialStatementFilterToggle('TRIAL_BALANCE', 'trialBalance'),
[t.JOURNAL_SHEET_SET]: (state, action) => {
@@ -196,6 +243,10 @@ export default createReducer(initialState, {
[t.JOURNAL_SHEET_LOADING]: (state, action) => {
state.journal.loading = !!action.loading;
},
+ [t.JOURNAL_SHEET_REFRESH]: (state, action) => {
+ const { refresh } = action.payload;
+ state.journal.refresh = !!refresh;
+ },
...financialStatementFilterToggle('JOURNAL', 'journal'),
[t.GENERAL_LEDGER_STATEMENT_SET]: (state, action) => {
@@ -219,6 +270,10 @@ export default createReducer(initialState, {
[t.GENERAL_LEDGER_SHEET_LOADING]: (state, action) => {
state.generalLedger.loading = !!action.loading;
},
+ [t.GENERAL_LEDGER_REFRESH]: (state, action) => {
+ const { refresh } = action.payload;
+ state.generalLedger.refresh = !!refresh;
+ },
...financialStatementFilterToggle('GENERAL_LEDGER', 'generalLedger'),
[t.PROFIT_LOSS_SHEET_SET]: (state, action) => {
@@ -243,6 +298,12 @@ export default createReducer(initialState, {
[t.PROFIT_LOSS_SHEET_LOADING]: (state, action) => {
state.profitLoss.loading = !!action.loading;
},
+
+ [t.PROFIT_LOSS_REFRESH]: (state, action) => {
+ const { refresh } = action.payload;
+ state.profitLoss.refresh = !!refresh;
+ },
+
...financialStatementFilterToggle('PROFIT_LOSS', 'profitLoss'),
[t.RECEIVABLE_AGING_SUMMARY_LOADING]: (state, action) => {
@@ -258,7 +319,7 @@ export default createReducer(initialState, {
query,
columns,
aging,
- tableRows: aging
+ tableRows: mapContactAgingSummary(aging)
};
if (index !== -1) {
state.receivableAgingSummary[index] = receivableSheet;
@@ -266,5 +327,9 @@ export default createReducer(initialState, {
state.receivableAgingSummary.sheets.push(receivableSheet);
}
},
+ [t.RECEIVABLE_AGING_SUMMARY_REFRESH]: (state, action) => {
+ const { refresh } = action.payload;
+ state.receivableAgingSummary.refresh = !!refresh;
+ },
...financialStatementFilterToggle('RECEIVABLE_AGING_SUMMARY', 'receivableAgingSummary'),
});
diff --git a/client/src/store/financialStatement/financialStatements.types.js b/client/src/store/financialStatement/financialStatements.types.js
index 0343dd8e9..0747c6fbf 100644
--- a/client/src/store/financialStatement/financialStatements.types.js
+++ b/client/src/store/financialStatement/financialStatements.types.js
@@ -3,19 +3,26 @@
export default {
GENERAL_LEDGER_STATEMENT_SET: 'GENERAL_LEDGER_STATEMENT_SET',
GENERAL_LEDGER_SHEET_LOADING: 'GENERAL_LEDGER_SHEET_LOADING',
+ GENERAL_LEDGER_REFRESH: 'GENERAL_LEDGER_REFRESH',
BALANCE_SHEET_STATEMENT_SET: 'BALANCE_SHEET_STATEMENT_SET',
BALANCE_SHEET_LOADING: 'BALANCE_SHEET_LOADING',
+ BALANCE_SHEET_REFRESH: 'BALANCE_SHEET_REFRESH',
TRAIL_BALANCE_STATEMENT_SET: 'TRAIL_BALANCE_STATEMENT_SET',
TRIAL_BALANCE_SHEET_LOADING: 'TRIAL_BALANCE_SHEET_LOADING',
+ TRIAL_BALANCE_REFRESH: 'TRIAL_BALANCE_REFRESH',
JOURNAL_SHEET_SET: 'JOURNAL_SHEET_SET',
JOURNAL_SHEET_LOADING: 'JOURNAL_SHEET_LOADING',
+ JOURNAL_SHEET_REFRESH: 'JOURNAL_SHEET_REFRESH',
PROFIT_LOSS_SHEET_SET: 'PROFIT_LOSS_SHEET_SET',
PROFIT_LOSS_SHEET_LOADING: 'PROFIT_LOSS_SHEET_LOADING',
+ PROFIT_LOSS_REFRESH: 'PROFIT_LOSS_REFRESH',
RECEIVABLE_AGING_SUMMARY_LOADING: 'RECEIVABLE_AGING_SUMMARY_LOADING',
RECEIVABLE_AGING_SUMMARY_SET: 'RECEIVABLE_AGING_SUMMARY_SET',
+ RECEIVABLE_AGING_REFRECH: 'RECEIVABLE_AGING_REFRECH',
+ RECEIVABLE_AGING_SUMMARY_REFRESH: 'RECEIVABLE_AGING_SUMMARY_REFRESH',
}
\ No newline at end of file
diff --git a/client/src/style/App.scss b/client/src/style/App.scss
index f5ae44263..45e8632f3 100644
--- a/client/src/style/App.scss
+++ b/client/src/style/App.scss
@@ -6,6 +6,11 @@ $pt-popover-box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.02),
@import '@blueprintjs/core/src/common/_variables.scss';
// @import "@blueprintjs/core/src/common/colors.scss";
+$blue1: #0069ff;
+$blue2: #0052ff;
+$blue3: rgb(0, 82, 204);
+$pt-link-color: $blue3;
+$pt-intent-primary: $blue1;
$menu-item-color-hover: $light-gray4;
$menu-item-color-active: $light-gray3;
@@ -118,3 +123,13 @@ body.authentication {
.bp3-datepicker-caption .bp3-html-select::after{
margin-right: 6px;
}
+
+
+.hint{
+ color: #a1b2c5;
+ margin-left: 6px;
+
+ .bp3-icon{
+ vertical-align: middle;
+ }
+}
\ No newline at end of file
diff --git a/client/src/style/components/data-table.scss b/client/src/style/components/data-table.scss
index 9373d14aa..f76ea6a3b 100644
--- a/client/src/style/components/data-table.scss
+++ b/client/src/style/components/data-table.scss
@@ -254,10 +254,16 @@
border-top: 1px solid #666;
border-bottom: 1px solid #666;
- padding: 10px 0.4rem;
+ padding: 8px 0.4rem;
color: #222;
}
}
+
+ .tbody{
+ .tr .td{
+ border-bottom: 1px dotted #BBB;
+ }
+ }
}
}
}
diff --git a/client/src/style/objects/form.scss b/client/src/style/objects/form.scss
index a2448e4ec..1dfcd0057 100644
--- a/client/src/style/objects/form.scss
+++ b/client/src/style/objects/form.scss
@@ -1,4 +1,5 @@
$form-check-input-checked-color: #fff;
+$form-check-input-checked-bg-color: $blue1;
$form-check-input-checked-bg-image: url("data:image/svg+xml,") !default;
$form-check-input-indeterminate-bg-image: url("data:image/svg+xml,") !default;
@@ -9,7 +10,7 @@ $form-check-input-indeterminate-bg-image: url("data:image/svg+xml,