mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -76,4 +76,17 @@ export function toggleARAgingSummaryFilterDrawer(toggle) {
|
||||
toggle,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles display of the AP aging summary filter drawer.
|
||||
* @param {boolean} toggle -
|
||||
*/
|
||||
export function toggleAPAgingSummaryFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.AP_AGING_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle,
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -137,6 +137,41 @@ export const ARAgingSummaryTableRowsMapper = (sheet, total) => {
|
||||
];
|
||||
};
|
||||
|
||||
export const APAgingSummaryTableRowsMapper = (sheet, total) => {
|
||||
const rows = [];
|
||||
|
||||
const mapAging = (agingPeriods) => {
|
||||
return agingPeriods.reduce((acc, aging, index) => {
|
||||
acc[`aging-${index}`] = aging.total.formatted_amount;
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
sheet.vendors.forEach((vendor) => {
|
||||
const agingRow = mapAging(vendor.aging);
|
||||
|
||||
rows.push({
|
||||
rowType: 'vendor',
|
||||
name: vendor.vendor_name,
|
||||
...agingRow,
|
||||
current: vendor.current.formatted_amount,
|
||||
total: vendor.total.formatted_amount,
|
||||
});
|
||||
});
|
||||
if (rows.length <= 0) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
...rows,
|
||||
{
|
||||
name: '',
|
||||
rowType: 'total',
|
||||
current: sheet.total.current.formatted_amount,
|
||||
...mapAging(sheet.total.aging),
|
||||
total: sheet.total.total.formatted_amount,
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const mapTrialBalanceSheetToRows = (sheet) => {
|
||||
const results = [];
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@ export const ARAgingSummaryFilterDrawerSelector = (state) => {
|
||||
return filterDrawerByTypeSelector('ARAgingSummary')(state);
|
||||
};
|
||||
|
||||
export const APAgingSummaryFilterDrawerSelector = (state) => {
|
||||
return filterDrawerByTypeSelector('APAgingSummary')(state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve balance sheet filter drawer.
|
||||
*/
|
||||
@@ -94,6 +99,17 @@ export const getARAgingSummaryFilterDrawer = createSelector(
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve whether display AR aging summary drawer filter.
|
||||
*/
|
||||
export const getAPAgingSummaryFilterDrawer = createSelector(
|
||||
APAgingSummaryFilterDrawerSelector,
|
||||
(isOpen) => {
|
||||
return isOpen;
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* Retrieve financial statement query by the given sheet index.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user