diff --git a/packages/server/src/services/FinancialStatements/JournalSheet/JournalSheetTable.ts b/packages/server/src/services/FinancialStatements/JournalSheet/JournalSheetTable.ts index 2854154e2..e1f4ec8fe 100644 --- a/packages/server/src/services/FinancialStatements/JournalSheet/JournalSheetTable.ts +++ b/packages/server/src/services/FinancialStatements/JournalSheet/JournalSheetTable.ts @@ -1,7 +1,8 @@ import * as R from 'ramda'; +import { first } from 'lodash'; import { + IColumnMapperMeta, IJournalEntry, - IJournalReport, IJournalReportEntriesGroup, IJournalReportQuery, IJournalTableData, @@ -13,7 +14,7 @@ import { tableRowMapper } from '@/utils'; import { FinancialTable } from '../FinancialTable'; import { FinancialSheetStructure } from '../FinancialSheetStructure'; import FinancialSheet from '../FinancialSheet'; -import { first } from 'lodash'; +import { ROW_TYPE } from './types'; export class JournalSheetTable extends R.compose( FinancialTable, @@ -70,6 +71,10 @@ export class JournalSheetTable extends R.compose( ]; }; + /** + * Retrieves the total entry column accessors. + * @returns {ITableColumnAccessor[]} + */ private totalEntryColumnAccessors = (): ITableColumnAccessor[] => { return [ { key: 'date', accessor: '_empty_' }, @@ -83,6 +88,23 @@ export class JournalSheetTable extends R.compose( ]; }; + /** + * Retrieves the total entry column accessors. + * @returns {IColumnMapperMeta[]} + */ + private blankEnrtyColumnAccessors = (): IColumnMapperMeta[] => { + return [ + { key: 'date', value: '' }, + { key: 'transaction_type', value: '' }, + { key: 'transaction_number', value: '' }, + { key: 'description', value: '' }, + { key: 'account_code', value: '' }, + { key: 'account_name', value: '' }, + { key: 'credit', value: '' }, + { key: 'debit', value: '' }, + ]; + }; + /** * Retrieves the common columns. * @returns {ITableColumn[]} @@ -113,6 +135,7 @@ export class JournalSheetTable extends R.compose( }; const computedGroup = { ...group, entry: first(group.entries) }; const columns = this.groupColumnsAccessors(); + return tableRowMapper(computedGroup, columns, meta); }; @@ -153,6 +176,16 @@ export class JournalSheetTable extends R.compose( return tableRowMapper(group, total, meta); }; + /** + * Retrieves the blank entry row. + * @returns {ITableRow} + */ + private blankEntryMapper = (): ITableRow => { + const columns = this.blankEnrtyColumnAccessors(); + const meta = {}; + return tableRowMapper({} as IJournalEntry, columns, meta); + }; + /** * Maps the entry group to table rows. * @param {IJournalReportEntriesGroup} group - @@ -162,8 +195,9 @@ export class JournalSheetTable extends R.compose( const firstRow = this.firstEntryGroupMapper(group); const lastRows = this.entriesMapper(group); const totalRow = this.totalEntryMapper(group); + const blankRow = this.blankEntryMapper(); - return [firstRow, ...lastRows, totalRow]; + return [firstRow, ...lastRows, totalRow, blankRow]; }; /** diff --git a/packages/server/src/services/FinancialStatements/JournalSheet/types.ts b/packages/server/src/services/FinancialStatements/JournalSheet/types.ts index f71970251..6eff84957 100644 --- a/packages/server/src/services/FinancialStatements/JournalSheet/types.ts +++ b/packages/server/src/services/FinancialStatements/JournalSheet/types.ts @@ -1,6 +1,5 @@ - -enum ROW_TYPE { +export enum ROW_TYPE { ENTRY = 'ENTRY', TOTAL = 'TOTAL' }; \ No newline at end of file diff --git a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.tsx b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.tsx index 971da31d9..e450c78bb 100644 --- a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.tsx +++ b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/GeneralLedgerActionsBar.tsx @@ -12,6 +12,7 @@ import { import classNames from 'classnames'; import { DashboardActionsBar, FormattedMessage as T, Icon } from '@/components'; +import { GeneralLedgerSheetExportMenu } from './components'; import { useGeneralLedgerContext } from './GeneralLedgerProvider'; import { compose } from '@/utils'; @@ -84,11 +85,18 @@ function GeneralLedgerActionsBar({ icon={} text={} /> -