WIP Financial statements.

This commit is contained in:
Ahmed Bouhuolia
2020-04-05 14:27:06 +02:00
parent 4227f2f9a8
commit b09fc58042
33 changed files with 725 additions and 343 deletions

View File

@@ -0,0 +1,27 @@
import {connect} from 'react-redux';
import {
fetchBalanceSheet,
} from 'store/financialStatement/financialStatements.actions';
import {
getFinancialSheetIndexByQuery,
getFinancialSheet,
getFinancialSheetAccounts,
getFinancialSheetColumns,
getFinancialSheetQuery,
} from 'store/financialStatement/financialStatements.selectors';
export const mapStateToProps = (state, props) => ({
getBalanceSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.balanceSheet.sheets, query),
getBalanceSheet: (index) => getFinancialSheet(state.financialStatements.balanceSheet.sheets, index),
getBalanceSheetAccounts: (index) => getFinancialSheetAccounts(state.financialStatements.balanceSheet.sheets, index),
getBalanceSheetColumns:(index) => getFinancialSheetColumns(state.financialStatements.balanceSheet.sheets, index),
getBalanceSheetQuery: (index) => getFinancialSheetQuery(state.financialStatements.balanceSheet.sheets, index),
balanceSheetLoading: state.financialStatements.balanceSheet.loading,
});
export const mapDispatchToProps = (dispatch) => ({
fetchBalanceSheet: (query = {}) => dispatch(fetchBalanceSheet({ query })),
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -0,0 +1,27 @@
import {connect} from 'react-redux';
import {
fetchBalanceSheet,
} from 'store/financialStatement/financialStatements.actions';
import {
getFinancialSheetIndexByQuery,
getFinancialSheet,
getFinancialSheetsAccounts,
getFinancialSheetsColumns,
} from 'store/financialStatement/financialStatements.selectors';
export const mapStateToProps = (state, props) => {
const sheetIndex = props.balanceSheetIndex;
return {
balanceSheetAccounts: props.getBalanceSheetAccounts(sheetIndex),
balanceSheetQuery: props.getBalanceSheetQuery(sheetIndex),
balanceSheetColumns: props.getBalanceSheetColumns(sheetIndex),
};
};
export const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -5,11 +5,19 @@ import {
import {
getFinancialSheetIndexByQuery,
getFinancialSheet,
getFinancialSheetColumns,
getFinancialSheetQuery,
getFinancialSheetTableRows,
} from 'store/financialStatement/financialStatements.selectors';
export const mapStateToProps = (state, props) => ({
getProfitLossSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.profitLoss.sheets, query),
getProfitLossSheet: (index) => getFinancialSheet(state.financialStatements.profitLoss.sheets, index),
getProfitLossColumns: (index) => getFinancialSheetColumns(state.financialStatements.profitLoss.sheets, index),
getProfitLossQuery: (index) => getFinancialSheetQuery(state.financialStatements.profitLoss.sheets, index),
getProfitLossTableRows: (index) => getFinancialSheetTableRows(state.financialStatements.profitLoss.sheets, index),
profitLossSheetLoading: state.financialStatements.profitLoss.loading,
});
export const mapDispatchToProps = (dispatch) => ({

View File

@@ -0,0 +1,17 @@
import {connect} from 'react-redux';
export const mapStateToProps = (state, props) => {
const sheetIndex = props.profitLossSheetIndex;
return {
profitLossTableRows: props.getProfitLossTableRows(sheetIndex),
profitLossColumns: props.getProfitLossColumns(sheetIndex),
profitLossQuery: props.getProfitLossQuery(sheetIndex),
};
};
export const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps);

View File

@@ -3,16 +3,15 @@ import {
fetchTrialBalanceSheet
} from 'store/financialStatement/financialStatements.actions';
import {
getTrialBalanceSheetIndex,
getTrialBalanceAccounts,
getTrialBalanceQuery,
getFinancialSheetIndexByQuery,
getFinancialSheetAccounts,
getFinancialSheetQuery,
} from 'store/financialStatement/financialStatements.selectors';
export const mapStateToProps = (state, props) => ({
getTrialBalanceSheetIndex: (query) => getFinancialSheetIndexByQuery(state.financialStatements.trialBalance.sheets, query),
getTrialBalanceAccounts: (sheetIndex) => getTrialBalanceAccounts(state.financialStatements.trialBalance.sheets, sheetIndex),
getTrialBalanceQuery: (sheetIndex) => getTrialBalanceQuery(state.financialStatements.trialBalance.sheets, sheetIndex),
getTrialBalanceAccounts: (sheetIndex) => getFinancialSheetAccounts(state.financialStatements.trialBalance.sheets, sheetIndex),
getTrialBalanceQuery: (sheetIndex) => getFinancialSheetQuery(state.financialStatements.trialBalance.sheets, sheetIndex),
trialBalanceSheetLoading: state.financialStatements.trialBalance.loading,
});