mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat( financial statment) :sales & purchases by items & inventory query.
This commit is contained in:
@@ -7,39 +7,64 @@ export default [
|
||||
reports: [
|
||||
{
|
||||
title: 'Balance Sheet Report',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/balance-sheet',
|
||||
},
|
||||
{
|
||||
title: 'Trial Balance Sheet',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/trial-balance-sheet',
|
||||
},
|
||||
{
|
||||
title: 'Journal Report',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/journal-sheet',
|
||||
},
|
||||
{
|
||||
title: 'Profit/Loss Report',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/profit-loss-sheet',
|
||||
},
|
||||
{
|
||||
title: 'General Ledger Report',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/general-ledger',
|
||||
},
|
||||
{
|
||||
title: 'Receivable Aging Summary',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/receivable-aging-summary',
|
||||
},
|
||||
{
|
||||
title: 'Payable Aging Summary',
|
||||
desc: 'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/payable-aging-summary',
|
||||
},
|
||||
]
|
||||
{
|
||||
title: 'Purchases By Items',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/purchases-by-items',
|
||||
},
|
||||
{
|
||||
title: 'Sales by Items',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/sales-by-items',
|
||||
},
|
||||
{
|
||||
title: 'Inventory valuation',
|
||||
desc:
|
||||
'Shows the average age of unresolved issues for a project or filter. This helps you see whether your backlog is being kept up to date.',
|
||||
link: '/financial-reports/inventory-valuation',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -27,7 +27,7 @@ import { saveInvoke, compose } from 'utils';
|
||||
*/
|
||||
function APAgingSummaryActionsBar({
|
||||
// #withPayableAgingSummary
|
||||
payableAgingFilter,
|
||||
isFilterDrawerOpen,
|
||||
|
||||
// #withARAgingSummaryActions
|
||||
toggleAPAgingSummaryFilterDrawer: toggleFilterDrawerDisplay,
|
||||
@@ -66,14 +66,14 @@ function APAgingSummaryActionsBar({
|
||||
className={classNames(Classes.MINIMAL, 'button--table-views')}
|
||||
icon={<Icon icon="cog-16" iconSize={16} />}
|
||||
text={
|
||||
payableAgingFilter ? (
|
||||
isFilterDrawerOpen ? (
|
||||
<T id={'hide_customizer'} />
|
||||
) : (
|
||||
<T id={'customize_report'} />
|
||||
)
|
||||
}
|
||||
onClick={handleFilterToggleClick}
|
||||
active={payableAgingFilter}
|
||||
active={isFilterDrawerOpen}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<Popover
|
||||
|
||||
@@ -308,3 +308,53 @@ export const APAgingSummaryTableRowsMapper = (sheet, total) => {
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const inventoryValuationReducer = (sheet) => {
|
||||
const results = [];
|
||||
|
||||
if (sheet.items) {
|
||||
sheet.items.forEach((item) => {
|
||||
results.push(item);
|
||||
});
|
||||
}
|
||||
if (sheet.total) {
|
||||
results.push({
|
||||
rowType: 'total',
|
||||
...sheet.total,
|
||||
});
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
export const purchasesByItemsReducer = (sheet) => {
|
||||
const results = [];
|
||||
|
||||
if (sheet.items) {
|
||||
sheet.items.forEach((item) => {
|
||||
results.push(item);
|
||||
});
|
||||
}
|
||||
if (sheet.total) {
|
||||
results.push({
|
||||
rowType: 'total',
|
||||
...sheet.total,
|
||||
});
|
||||
}
|
||||
return results;
|
||||
};
|
||||
export const salesByItemsReducer = (sheet) => {
|
||||
const results = [];
|
||||
|
||||
if (sheet.items) {
|
||||
sheet.items.forEach((item) => {
|
||||
results.push(item);
|
||||
});
|
||||
}
|
||||
if (sheet.total) {
|
||||
results.push({
|
||||
rowType: 'total',
|
||||
...sheet.total,
|
||||
});
|
||||
}
|
||||
return results;
|
||||
};
|
||||
@@ -7,6 +7,9 @@ import {
|
||||
journalTableRowsReducer,
|
||||
ARAgingSummaryTableRowsMapper,
|
||||
APAgingSummaryTableRowsMapper,
|
||||
inventoryValuationReducer,
|
||||
purchasesByItemsReducer,
|
||||
salesByItemsReducer,
|
||||
} from 'containers/FinancialStatements/reducers';
|
||||
import t from './types';
|
||||
|
||||
@@ -94,13 +97,12 @@ export function useProfitLossSheet(query, props) {
|
||||
* Retrieve general ledger (GL) sheet.
|
||||
*/
|
||||
export function useGeneralLedgerSheet(query, props) {
|
||||
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.GENERAL_LEDGER, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/general_ledger',
|
||||
params: query,
|
||||
method: 'get',
|
||||
url: '/financial_statements/general_ledger',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
@@ -208,3 +210,80 @@ export function useAPAgingSummaryReport(query, props) {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve inventory valuation.
|
||||
*/
|
||||
export function useInventoryValuation(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.INVENTORY_VALUATION, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/inventory-valuation',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
tableRows: inventoryValuationReducer(res.data.data),
|
||||
...res.data,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
data: [],
|
||||
query: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Retrieve purchases by items.
|
||||
*/
|
||||
export function usePurchasesByItems(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.PURCHASES_BY_ITEMS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/purchases-by-items',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
tableRows: purchasesByItemsReducer(res.data.data),
|
||||
...res.data,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
data: [],
|
||||
query: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve sales by items.
|
||||
*/
|
||||
export function useSalesByItems(query, props) {
|
||||
return useRequestQuery(
|
||||
[t.FINANCIAL_REPORT, t.SALES_BY_ITEMS, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: '/financial_statements/sales-by-items',
|
||||
params: query,
|
||||
},
|
||||
{
|
||||
select: (res) => ({
|
||||
tableRows: salesByItemsReducer(res.data.data),
|
||||
...res.data,
|
||||
}),
|
||||
defaultData: {
|
||||
tableRows: [],
|
||||
data: [],
|
||||
query: {},
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1037,4 +1037,16 @@ export default {
|
||||
currency_sign: 'Currency sign',
|
||||
cannot_change_item_inventory_account:
|
||||
'Cannot change item inventory account while the item has transactions.',
|
||||
|
||||
purchases_by_items: 'Purchases by items',
|
||||
quantity_purchased: 'Quantity purchased',
|
||||
purchase_amount: 'Purchase amount',
|
||||
average_price: 'Average price',
|
||||
sales_by_items: 'Sales by items',
|
||||
sold_quantity: 'Sold quantity',
|
||||
sold_amount: 'Sold amount',
|
||||
average_price: 'Average price',
|
||||
asset_value: 'Asset value',
|
||||
average: 'Average',
|
||||
inventory_valuation: 'Inventory valuation',
|
||||
};
|
||||
|
||||
@@ -182,6 +182,43 @@ export default [
|
||||
sidebarShrink: true,
|
||||
backLink: true,
|
||||
},
|
||||
{
|
||||
path: `/financial-reports/purchases-by-items`,
|
||||
component: lazy(() =>
|
||||
import(
|
||||
'containers/FinancialStatements/PurchasesByItems/PurchasesByItems'
|
||||
),
|
||||
),
|
||||
breadcrumb: 'Purchases by Items',
|
||||
// hotkey: '',
|
||||
pageTitle: formatMessage({ id: 'purchases_by_items' }),
|
||||
backLink: true,
|
||||
sidebarShrink: true,
|
||||
},
|
||||
{
|
||||
path: `/financial-reports/sales-by-items`,
|
||||
component: lazy(() =>
|
||||
import('containers/FinancialStatements/SalesByItems/SalesByItems'),
|
||||
),
|
||||
breadcrumb: 'Sales by Items',
|
||||
// hotkey: '',
|
||||
pageTitle: formatMessage({ id: 'sales_by_items' }),
|
||||
backLink: true,
|
||||
sidebarShrink: true,
|
||||
},
|
||||
{
|
||||
path: `/financial-reports/inventory-valuation`,
|
||||
component: lazy(() =>
|
||||
import(
|
||||
'containers/FinancialStatements/InventoryValuation/InventoryValuation'
|
||||
),
|
||||
),
|
||||
breadcrumb: 'Inventory Valuation ',
|
||||
// hotkey: '',
|
||||
pageTitle: formatMessage({ id: 'inventory_valuation' }),
|
||||
backLink: true,
|
||||
sidebarShrink: true,
|
||||
},
|
||||
{
|
||||
path: '/financial-reports',
|
||||
component: lazy(() =>
|
||||
|
||||
@@ -2,20 +2,20 @@ import t from 'store/types';
|
||||
|
||||
/**
|
||||
* Toggles display of the balance sheet filter drawer.
|
||||
* @param {boolean} toggle
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleBalanceSheetFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.BALANCE_SHEET}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles display of the trial balance sheet filter drawer.
|
||||
* @param {boolean} toggle
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleTrialBalanceSheetFilterDrawer(toggle) {
|
||||
return {
|
||||
@@ -28,39 +28,39 @@ export function toggleTrialBalanceSheetFilterDrawer(toggle) {
|
||||
|
||||
/**
|
||||
* Toggles display of the journal sheet filter drawer.
|
||||
* @param {boolean} toggle
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleJournalSheeetFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.JOURNAL}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles display of the profit/loss filter drawer.
|
||||
* @param {boolean} toggle
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleProfitLossFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.PROFIT_LOSS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles display of the general ledger filter drawer.
|
||||
* @param {boolean} toggle
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleGeneralLedgerFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.GENERAL_LEDGER}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export function toggleARAgingSummaryFilterDrawer(toggle) {
|
||||
type: `${t.AR_AGING_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,6 +87,44 @@ export function toggleAPAgingSummaryFilterDrawer(toggle) {
|
||||
type: `${t.AP_AGING_SUMMARY}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles display of the purchases by items filter drawer.
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function togglePurchasesByItemsFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.PURCHASES_BY_ITEMS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles display of the sells by items filter drawer.
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleSalesByItemsFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.SALES_BY_ITEMS}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Toggles display of the inventory valuation filter drawer.
|
||||
* @param {boolean} toggle
|
||||
*/
|
||||
export function toggleInventoryValuationFilterDrawer(toggle) {
|
||||
return {
|
||||
type: `${t.INVENTORY_VALUATION}/${t.DISPLAY_FILTER_DRAWER_TOGGLE}`,
|
||||
payload: {
|
||||
toggle,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -24,6 +24,15 @@ const initialState = {
|
||||
APAgingSummary: {
|
||||
displayFilterDrawer: false,
|
||||
},
|
||||
purchasesByItems: {
|
||||
displayFilterDrawer: false,
|
||||
},
|
||||
salesByItems: {
|
||||
displayFilterDrawer: false,
|
||||
},
|
||||
inventoryValuation: {
|
||||
displayFilterDrawer: false,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -48,4 +57,10 @@ export default createReducer(initialState, {
|
||||
...financialStatementFilterToggle(t.PROFIT_LOSS, 'profitLoss'),
|
||||
...financialStatementFilterToggle(t.AR_AGING_SUMMARY, 'ARAgingSummary'),
|
||||
...financialStatementFilterToggle(t.AP_AGING_SUMMARY, 'APAgingSummary'),
|
||||
...financialStatementFilterToggle(t.PURCHASES_BY_ITEMS, 'purchasesByItems'),
|
||||
...financialStatementFilterToggle(t.SALES_BY_ITEMS, 'salesByItems'),
|
||||
...financialStatementFilterToggle(
|
||||
t.INVENTORY_VALUATION,
|
||||
'inventoryValuation',
|
||||
),
|
||||
});
|
||||
|
||||
@@ -36,8 +36,18 @@ export const ARAgingSummaryFilterDrawerSelector = (state) => {
|
||||
|
||||
export const APAgingSummaryFilterDrawerSelector = (state) => {
|
||||
return filterDrawerByTypeSelector('APAgingSummary')(state);
|
||||
}
|
||||
};
|
||||
|
||||
export const purchasesByItemsFilterDrawerSelector = (state) => {
|
||||
return filterDrawerByTypeSelector('purchasesByItems')(state);
|
||||
};
|
||||
|
||||
export const salesByItemsFilterDrawerSelector = (state) => {
|
||||
return filterDrawerByTypeSelector('salesByItems')(state);
|
||||
};
|
||||
export const inventoryValuationFilterDrawerSelector = (state) => {
|
||||
return filterDrawerByTypeSelector('inventoryValuation')(state);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve balance sheet filter drawer.
|
||||
@@ -99,7 +109,6 @@ export const getARAgingSummaryFilterDrawer = createSelector(
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve whether display AR aging summary drawer filter.
|
||||
*/
|
||||
@@ -117,3 +126,33 @@ export const getFinancialSheetQueryFactory = (sheetType) =>
|
||||
createSelector(sheetByTypeSelector(sheetType), (sheet) => {
|
||||
return sheet && sheet.query ? sheet.query : {};
|
||||
});
|
||||
|
||||
/**
|
||||
* Retrieve whether purchases by items display filter drawer.
|
||||
*/
|
||||
export const getPurchasesByItemsFilterDrawer = createSelector(
|
||||
purchasesByItemsFilterDrawerSelector,
|
||||
(isOpen) => {
|
||||
return isOpen;
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* Retrieve whether sales by items display filter drawer.
|
||||
*/
|
||||
export const getSalesByItemsFilterDrawer = createSelector(
|
||||
salesByItemsFilterDrawerSelector,
|
||||
(isOpen) => {
|
||||
return isOpen;
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* Retrieve whether sells by items display filter drawer.
|
||||
*/
|
||||
export const getInventoryValuationFilterDrawer = createSelector(
|
||||
inventoryValuationFilterDrawerSelector,
|
||||
(isOpen) => {
|
||||
return isOpen;
|
||||
},
|
||||
);
|
||||
|
||||
@@ -6,5 +6,8 @@ export default {
|
||||
PROFIT_LOSS: 'PROFIT_LOSS',
|
||||
AR_AGING_SUMMARY: 'AR_AGING_SUMMARY',
|
||||
AP_AGING_SUMMARY: 'AP_AGING_SUMMARY',
|
||||
DISPLAY_FILTER_DRAWER_TOGGLE: 'DISPLAY_FILTER_DRAWER_TOGGLE'
|
||||
DISPLAY_FILTER_DRAWER_TOGGLE: 'DISPLAY_FILTER_DRAWER_TOGGLE',
|
||||
PURCHASES_BY_ITEMS: 'PURCHASES_BY_ITEMS',
|
||||
SALES_BY_ITEMS: 'SALES_BY_ITEMS',
|
||||
INVENTORY_VALUATION: 'INVENTORY_VALUATION',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user