fix: BIG-132 AR/AP aging summary report filter by none transactions/zero contacts.

This commit is contained in:
a.bouhuolia
2021-10-31 12:35:50 +02:00
parent 60f45f281a
commit cbce9f6d50
32 changed files with 241 additions and 122 deletions

View File

@@ -17,7 +17,7 @@ import withAPAgingSummaryActions from './withAPAgingSummaryActions';
import { compose } from 'utils';
/**
* AP aging summary report.
* A/P aging summary report.
*/
function APAgingSummary({
// #withSettings
@@ -28,9 +28,10 @@ function APAgingSummary({
}) {
const [filter, setFilter] = useState({
asDate: moment().endOf('day').format('YYYY-MM-DD'),
agingBeforeDays: 30,
agingDaysBefore: 30,
agingPeriods: 3,
vendorsIds: [],
filterByOption: 'without-zero-balance',
});
// Handle filter submit.

View File

@@ -49,6 +49,7 @@ function APAgingSummaryHeader({
agingDaysBefore: 30,
agingPeriods: 3,
vendorsIds: [],
filterByOption: 'without-zero-balance',
};
// Formik initial values.
const initialValues = transformToForm(pageFilter, defaultValues);
@@ -61,10 +62,14 @@ function APAgingSummaryHeader({
};
// Handle cancel button click.
const handleCancelClick = () => { toggleFilterDrawerDisplay(false); };
const handleCancelClick = () => {
toggleFilterDrawerDisplay(false);
};
// Handle the drawer closing.
const handleDrawerClose = () => { toggleFilterDrawerDisplay(false); };
const handleDrawerClose = () => {
toggleFilterDrawerDisplay(false);
};
return (
<FinancialStatementHeader

View File

@@ -17,6 +17,8 @@ import {
FieldHint,
} from 'components';
import { useAPAgingSummaryGeneralContext } from './APAgingSummaryGeneralProvider';
import FinancialStatementsFilter from '../FinancialStatementsFilter';
import { filterVendorsOptions } from './constants';
import {
momentFormatter,
tansformDateValue,
@@ -90,6 +92,15 @@ export default function APAgingSummaryHeaderGeneralContent() {
</Col>
</Row>
<Row>
<Col xs={5}>
<FinancialStatementsFilter
items={filterVendorsOptions}
label={<T id={'AP_aging_summary.filter_options.label'} />}
/>
</Col>
</Row>
<Row>
<Col xs={5}>
<Field name={'vendorsIds'}>

View File

@@ -1,6 +1,7 @@
import React, { useMemo, createContext, useContext } from 'react';
import FinancialReportPage from '../FinancialReportPage';
import { useAPAgingSummaryReport, useVendors } from 'hooks/query';
import { useAPAgingSummaryReport } from '../../../hooks/query';
import { transformFilterFormToQuery } from '../common';
const APAgingSummaryContext = createContext();

View File

@@ -0,0 +1,14 @@
import intl from 'react-intl-universal';
export const filterVendorsOptions = [
{
key: 'all-vendors',
name: intl.get('AP_aging_summary.filter_vendors.all_vendors'),
hint: intl.get('AP_aging_summary.filter_vendors.all_vendors.hint'),
},
{
key: 'without-zero-balance',
name: intl.get('AP_aging_summary.filter_vendors.without_zero_balance'),
hint: intl.get('AP_aging_summary.filter_vendors.without_zero_balance.hint'),
},
];