mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix: financial statements.
This commit is contained in:
@@ -34,6 +34,7 @@ function ProfitLossSheet({
|
||||
from_date: moment().startOf('year').format('YYYY-MM-DD'),
|
||||
to_date: moment().endOf('year').format('YYYY-MM-DD'),
|
||||
});
|
||||
const [refetch, setRefetch] = useState(false);
|
||||
|
||||
// Change page title of the dashboard.
|
||||
useEffect(() => {
|
||||
@@ -42,7 +43,8 @@ function ProfitLossSheet({
|
||||
|
||||
// Fetches profit/loss sheet.
|
||||
const fetchHook = useQuery(['profit-loss', filter],
|
||||
(key, query) => { fetchProfitLossSheet(query); });
|
||||
(key, query) => fetchProfitLossSheet(query),
|
||||
{ manual: true });
|
||||
|
||||
// Handle submit filter.
|
||||
const handleSubmitFilter = useCallback((filter) => {
|
||||
@@ -52,13 +54,21 @@ function ProfitLossSheet({
|
||||
to_date: moment(filter.to_date).format('YYYY-MM-DD'),
|
||||
};
|
||||
setFilter(_filter);
|
||||
setRefetch(true);
|
||||
}, []);
|
||||
|
||||
// Handle fetch data of profit/loss sheet table.
|
||||
const handleFetchData = useCallback(() => {
|
||||
fetchHook.refetch();
|
||||
setRefetch(true);
|
||||
}, [fetchHook]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refetch) {
|
||||
fetchHook.refetch({ force: true });
|
||||
setRefetch(false);
|
||||
}
|
||||
}, [fetchHook, refetch]);
|
||||
|
||||
return (
|
||||
<DashboardInsider>
|
||||
<ProfitLossActionsBar />
|
||||
|
||||
@@ -122,7 +122,8 @@ function ProfitLossSheetTable({
|
||||
<FinancialSheet
|
||||
companyName={companyName}
|
||||
sheetType={'Profit/Loss Sheet'}
|
||||
date={new Date()}
|
||||
fromDate={profitLossQuery.from_date}
|
||||
toDate={profitLossQuery.to_date}
|
||||
name="profit-loss-sheet"
|
||||
loading={loading}
|
||||
basis={profitLossQuery.basis}>
|
||||
@@ -133,8 +134,7 @@ function ProfitLossSheetTable({
|
||||
data={profitLossTableRows}
|
||||
onFetchData={handleFetchData}
|
||||
expanded={expandedRows}
|
||||
rowClassNames={rowClassNames}
|
||||
noInitialFetch={true} />
|
||||
rowClassNames={rowClassNames} />
|
||||
</FinancialSheet>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user