fix: bugs in financial statements.

This commit is contained in:
Ahmed Bouhuolia
2020-05-26 19:50:30 +02:00
parent 2321c3be99
commit 1e663b6e49
9 changed files with 393 additions and 459 deletions

View File

@@ -34,7 +34,6 @@ 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(() => {
@@ -54,20 +53,13 @@ function ProfitLossSheet({
to_date: moment(filter.to_date).format('YYYY-MM-DD'),
};
setFilter(_filter);
setRefetch(true);
fetchHook.refetch({ force: true });
}, []);
// Handle fetch data of profit/loss sheet table.
const handleFetchData = useCallback(() => {
setRefetch(true);
}, [fetchHook]);
useEffect(() => {
if (refetch) {
fetchHook.refetch({ force: true });
setRefetch(false);
}
}, [fetchHook, refetch]);
fetchHook.refetch({ force: true });
}, []);
return (
<DashboardInsider>