From 3232c7f6ff5c5ea960bb162cff99e8ebc1dcecc1 Mon Sep 17 00:00:00 2001 From: "a.bouhuolia" Date: Wed, 31 Mar 2021 14:18:13 +0200 Subject: [PATCH] feat(Reports): content. --- .../Dashboard/DashboardContentRoute.js | 1 + .../src/components/Dashboard/DashboardPage.js | 10 +++++++ .../components/Dashboard/DashboardTopbar.js | 16 +++++------ client/src/config/financialReportsMenu.js | 27 +++++++------------ .../QuickPaymentReceiveForm.js | 12 +++++---- client/src/routes/dashboard.js | 11 ++++++-- .../src/store/dashboard/dashboard.actions.js | 7 +++++ .../src/store/dashboard/dashboard.reducer.js | 2 +- .../FinancialStatements/FinancialSheets.scss | 2 +- .../api/controllers/Sales/SalesInvoices.ts | 1 + 10 files changed, 53 insertions(+), 36 deletions(-) diff --git a/client/src/components/Dashboard/DashboardContentRoute.js b/client/src/components/Dashboard/DashboardContentRoute.js index 02add34a3..b464095d8 100644 --- a/client/src/components/Dashboard/DashboardContentRoute.js +++ b/client/src/components/Dashboard/DashboardContentRoute.js @@ -21,6 +21,7 @@ export default function DashboardContentRoute() { Component={route.component} pageTitle={route.pageTitle} backLink={route.backLink} + hint={route.hint} sidebarShrink={route.sidebarShrink} /> diff --git a/client/src/components/Dashboard/DashboardPage.js b/client/src/components/Dashboard/DashboardPage.js index 2d9045ab1..1738cb615 100644 --- a/client/src/components/Dashboard/DashboardPage.js +++ b/client/src/components/Dashboard/DashboardPage.js @@ -12,12 +12,14 @@ function DashboardPage({ sidebarShrink, Component, name, + hint, // #withDashboardActions changePageTitle, setDashboardBackLink, setSidebarShrink, resetSidebarPreviousExpand, + changePageHint, }) { useEffect(() => { pageTitle && changePageTitle(pageTitle); @@ -27,6 +29,14 @@ function DashboardPage({ }; }); + useEffect(() => { + hint && changePageHint(hint); + + return () => { + hint && changePageHint(''); + } + }, [hint, changePageHint]); + useEffect(() => { backLink && setDashboardBackLink(backLink); diff --git a/client/src/components/Dashboard/DashboardTopbar.js b/client/src/components/Dashboard/DashboardTopbar.js index f29a3509c..a597962c4 100644 --- a/client/src/components/Dashboard/DashboardTopbar.js +++ b/client/src/components/Dashboard/DashboardTopbar.js @@ -31,6 +31,7 @@ function DashboardTopbar({ // #withDashboard pageTitle, editViewId, + pageHint, // #withDashboardActions toggleSidebarExpend, @@ -97,13 +98,9 @@ function DashboardTopbar({

{pageTitle}

- +
- +
@@ -119,7 +116,7 @@ function DashboardTopbar({
- +
@@ -132,7 +129,7 @@ function DashboardTopbar({ icon={} text={} /> - + } position={Position.BOTTOM} @@ -161,10 +158,11 @@ function DashboardTopbar({ export default compose( withSearch, - withDashboard(({ pageTitle, editViewId, sidebarExpended }) => ({ + withDashboard(({ pageTitle, pageHint, editViewId, sidebarExpended }) => ({ pageTitle, editViewId, sidebarExpended, + pageHint, })), withSettings(({ organizationSettings }) => ({ organizationName: organizationSettings.name, diff --git a/client/src/config/financialReportsMenu.js b/client/src/config/financialReportsMenu.js index 138ebbbe7..f32beaf2f 100644 --- a/client/src/config/financialReportsMenu.js +++ b/client/src/config/financialReportsMenu.js @@ -1,6 +1,3 @@ -import React from 'react'; -import { FormattedMessage as T } from 'react-intl'; - export const financialReportMenus = [ { sectionTitle: 'Financial Accounting', @@ -8,43 +5,38 @@ export const financialReportMenus = [ { 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.', + "Reports a company's assets, liabilities and shareholders' equity at a specific point in time with comparison period(s).", 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: 'Summarizes the credit and debit balance of each account in your chart of accounts at a specific point in time.', 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.', + 'The debit and credit entries of system transactions, sorted by 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: "Reports the revenues, costs and expenses incurred during a specific point in time with comparison period(s).", 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: "Reports every transaction going in and out of your accounts and organized by accounts and date to monitoring activity of accounts.", 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: "Summarize total unpaid balances of customers invoices with number of days the unpaid invoice is overdue.", 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: "Summarize total unpaid balances of vendors purchase invoices with the number of days the unpaid invoice is overdue.", link: '/financial-reports/payable-aging-summary', }, ], @@ -64,13 +56,12 @@ export const SalesAndPurchasesReportMenus = [ { 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.', + "Summarize the business’s sold items quantity, income and average income rate of each item during a specific point in time.", 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.', + desc: 'Summarize the business’s purchase items quantity, cost and average cost rate of each item during a specific point in time.', link: '/financial-reports/inventory-valuation', }, ], diff --git a/client/src/containers/Dialogs/QuickPaymentReceiveFormDialog/QuickPaymentReceiveForm.js b/client/src/containers/Dialogs/QuickPaymentReceiveFormDialog/QuickPaymentReceiveForm.js index a705da1ca..88d400830 100644 --- a/client/src/containers/Dialogs/QuickPaymentReceiveFormDialog/QuickPaymentReceiveForm.js +++ b/client/src/containers/Dialogs/QuickPaymentReceiveFormDialog/QuickPaymentReceiveForm.js @@ -1,8 +1,8 @@ import React from 'react'; import { Formik } from 'formik'; import { Intent } from '@blueprintjs/core'; -import { FormattedMessage as T, useIntl } from 'react-intl'; -import { pick, defaultTo } from 'lodash'; +import { useIntl } from 'react-intl'; +import { pick, defaultTo, omit } from 'lodash'; import { AppToaster } from 'components'; import { useQuickPaymentReceiveContext } from './QuickPaymentReceiveFormProvider'; @@ -51,8 +51,7 @@ function QuickPaymentReceiveForm({ }; // Handles the form submit. - const handleFormSubmit = (values, { setSubmitting, setFieldError, status }) => { - debugger; + const handleFormSubmit = (values, { setSubmitting, setFieldError }) => { const entries = [values] .filter((entry) => entry.id && entry.payment_amount) .map((entry) => ({ @@ -61,7 +60,10 @@ function QuickPaymentReceiveForm({ })); const form = { - ...values, + ...omit(values, ['payment_receive_no']), + ...(!paymentReceiveAutoIncrement && { + payment_receive_no: values.payment_receive_no, + }), customer_id: values.customer.id, entries, }; diff --git a/client/src/routes/dashboard.js b/client/src/routes/dashboard.js index 902ba5dd4..70816143e 100644 --- a/client/src/routes/dashboard.js +++ b/client/src/routes/dashboard.js @@ -111,6 +111,7 @@ export default [ import('containers/FinancialStatements/GeneralLedger/GeneralLedger'), ), breadcrumb: 'General Ledger', + hint: "Reports every transaction going in and out of your accounts and organized by accounts and date to monitoring activity of accounts.", hotkey: 'shift+4', pageTitle: formatMessage({ id: 'general_ledger' }), backLink: true, @@ -122,6 +123,7 @@ export default [ import('containers/FinancialStatements/BalanceSheet/BalanceSheet'), ), breadcrumb: 'Balance Sheet', + hint: "Reports a company's assets, liabilities and shareholders' equity at a specific point in time with comparison period(s).", hotkey: 'shift+1', pageTitle: formatMessage({ id: 'balance_sheet' }), backLink: true, @@ -135,6 +137,7 @@ export default [ ), ), breadcrumb: 'Trial Balance Sheet', + hint: "Summarizes the credit and debit balance of each account in your chart of accounts at a specific point in time. ", hotkey: 'shift+5', pageTitle: formatMessage({ id: 'trial_balance_sheet' }), backLink: true, @@ -146,6 +149,7 @@ export default [ import('containers/FinancialStatements/ProfitLossSheet/ProfitLossSheet'), ), breadcrumb: 'Profit Loss Sheet', + hint: "Reports the revenues, costs and expenses incurred during a specific point in time with comparison period(s).", hotkey: 'shift+2', pageTitle: formatMessage({ id: 'profit_loss_sheet' }), backLink: true, @@ -157,6 +161,7 @@ export default [ import('containers/FinancialStatements/ARAgingSummary/ARAgingSummary'), ), breadcrumb: 'Receivable Aging Summary', + hint: "Summarize total unpaid balances of customers invoices with number of days the unpaid invoice is overdue.", pageTitle: formatMessage({ id: 'receivable_aging_summary' }), backLink: true, sidebarShrink: true, @@ -167,6 +172,7 @@ export default [ import('containers/FinancialStatements/APAgingSummary/APAgingSummary'), ), breadcrumb: 'Payable Aging Summary', + hint: "Summarize total unpaid balances of vendors purchase invoices with the number of days the unpaid invoice is overdue.", pageTitle: formatMessage({ id: 'payable_aging_summary' }), backLink: true, sidebarShrink: true, @@ -177,6 +183,7 @@ export default [ import('containers/FinancialStatements/Journal/Journal'), ), breadcrumb: 'Journal Sheet', + hint: "The debit and credit entries of system transactions, sorted by date.", hotkey: 'shift+3', pageTitle: formatMessage({ id: 'journal_sheet' }), sidebarShrink: true, @@ -201,8 +208,8 @@ export default [ import('containers/FinancialStatements/SalesByItems/SalesByItems'), ), breadcrumb: 'Sales by Items', - // hotkey: '', pageTitle: formatMessage({ id: 'sales_by_items' }), + hint: 'Summarize the business’s sold items quantity, income and average income rate of each item during a specific point in time.', backLink: true, sidebarShrink: true, }, @@ -214,7 +221,7 @@ export default [ ), ), breadcrumb: 'Inventory Valuation ', - // hotkey: '', + hint: 'Summerize your transactions for each inventory item and how they affect quantity, valuation and weighted average.', pageTitle: formatMessage({ id: 'inventory_valuation' }), backLink: true, sidebarShrink: true, diff --git a/client/src/store/dashboard/dashboard.actions.js b/client/src/store/dashboard/dashboard.actions.js index 9e05f5d9a..4eb52517b 100644 --- a/client/src/store/dashboard/dashboard.actions.js +++ b/client/src/store/dashboard/dashboard.actions.js @@ -7,6 +7,13 @@ export function dashboardPageTitle(pageTitle) { }; } +export function dashboardPageHint(pageHint) { + return { + type: t.CHANGE_DASHBOARD_PAGE_HINT, + pageHint, + }; +} + export function openDialog(name, payload) { return { type: t.OPEN_DIALOG, diff --git a/client/src/store/dashboard/dashboard.reducer.js b/client/src/store/dashboard/dashboard.reducer.js index c88704b54..b65161323 100644 --- a/client/src/store/dashboard/dashboard.reducer.js +++ b/client/src/store/dashboard/dashboard.reducer.js @@ -36,7 +36,7 @@ const reducerInstance = createReducer(initialState, { }, [t.CHANGE_DASHBOARD_PAGE_HINT]: (state, action) => { - state.pageHint = action.pageHint; + state.pageHint = action.payload.pageHint; }, [t.CHANGE_PREFERENCES_PAGE_TITLE]: (state, action) => { diff --git a/client/src/style/pages/FinancialStatements/FinancialSheets.scss b/client/src/style/pages/FinancialStatements/FinancialSheets.scss index 609a332b7..41f21197d 100644 --- a/client/src/style/pages/FinancialStatements/FinancialSheets.scss +++ b/client/src/style/pages/FinancialStatements/FinancialSheets.scss @@ -31,7 +31,7 @@ .desc { color: rgb(31, 50, 85); line-height: 1.55; - margin-top: 12px; + margin-top: 8px; margin-bottom: 0; } } diff --git a/server/src/api/controllers/Sales/SalesInvoices.ts b/server/src/api/controllers/Sales/SalesInvoices.ts index c2fbc8aa1..64ff7e03d 100644 --- a/server/src/api/controllers/Sales/SalesInvoices.ts +++ b/server/src/api/controllers/Sales/SalesInvoices.ts @@ -271,6 +271,7 @@ export default class SaleInvoicesController extends BaseController { next(error); } } + /** * Retrieve paginated sales invoices with custom view metadata. * @param {Request} req