mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: general ledger and journal rows types
This commit is contained in:
@@ -13,6 +13,7 @@ import FinancialSheet from '../FinancialSheet';
|
||||
import { FinancialSheetStructure } from '../FinancialSheetStructure';
|
||||
import { FinancialTable } from '../FinancialTable';
|
||||
import { tableRowMapper } from '@/utils';
|
||||
import { ROW_TYPE } from './utils';
|
||||
|
||||
export class GeneralLedgerTable extends R.compose(
|
||||
FinancialTable,
|
||||
@@ -135,8 +136,10 @@ export class GeneralLedgerTable extends R.compose(
|
||||
): ITableRow => {
|
||||
const columns = this.transactionColumnAccessors();
|
||||
const data = { ...transaction, account };
|
||||
|
||||
return tableRowMapper(data, columns, {});
|
||||
const meta = {
|
||||
rowTypes: [ROW_TYPE.TRANSACTION],
|
||||
};
|
||||
return tableRowMapper(data, columns, meta);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -162,8 +165,10 @@ export class GeneralLedgerTable extends R.compose(
|
||||
account: IGeneralLedgerSheetAccount
|
||||
): ITableRow => {
|
||||
const columns = this.openingBalanceColumnsAccessors();
|
||||
|
||||
return tableRowMapper(account, columns, {});
|
||||
const meta = {
|
||||
rowTypes: [ROW_TYPE.OPENING_BALANCE],
|
||||
};
|
||||
return tableRowMapper(account, columns, meta);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -173,8 +178,10 @@ export class GeneralLedgerTable extends R.compose(
|
||||
*/
|
||||
private closingBalanceMapper = (account: IGeneralLedgerSheetAccount) => {
|
||||
const columns = this.closingBalanceColumnAccessors();
|
||||
|
||||
return tableRowMapper(account, columns, {});
|
||||
const meta = {
|
||||
rowTypes: [ROW_TYPE.CLOSING_BALANCE],
|
||||
};
|
||||
return tableRowMapper(account, columns, meta);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -199,8 +206,11 @@ export class GeneralLedgerTable extends R.compose(
|
||||
*/
|
||||
private accountMapper = (account: IGeneralLedgerSheetAccount): ITableRow => {
|
||||
const columns = this.accountColumnsAccessors();
|
||||
const row = tableRowMapper(account, columns, {});
|
||||
const transactions = this.transactionsNode(account);
|
||||
const meta = {
|
||||
rowTypes: [ROW_TYPE.ACCOUNT],
|
||||
};
|
||||
const row = tableRowMapper(account, columns, meta);
|
||||
|
||||
return R.assoc('children', transactions)(row);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export enum ROW_TYPE {
|
||||
ACCOUNT = 'ACCOUNT',
|
||||
OPENING_BALANCE = 'OPENING_BALANCE',
|
||||
TRANSACTION = 'TRANSACTION',
|
||||
CLOSING_BALANCE = 'CLOSING_BALANCE',
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// @ts-nocheck
|
||||
import React, { useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import styled from 'styled-components';
|
||||
|
||||
@@ -79,23 +79,20 @@ const GeneralLedgerDataTable = styled(ReportDataTable)`
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tr:not(.no-results) .td:not(:first-of-type) {
|
||||
border-left: 1px solid #ececec;
|
||||
}
|
||||
.tr:last-child .td {
|
||||
border-bottom: 1px solid #ececec;
|
||||
}
|
||||
|
||||
.tr.row_type {
|
||||
&--ACCOUNT_ROW {
|
||||
&--ACCOUNT {
|
||||
.td {
|
||||
&.date {
|
||||
font-weight: 500;
|
||||
|
||||
.cell-inner {
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +100,6 @@ const GeneralLedgerDataTable = styled(ReportDataTable)`
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
&--OPENING_BALANCE,
|
||||
&--CLOSING_BALANCE {
|
||||
.amount {
|
||||
|
||||
@@ -83,10 +83,9 @@ const JournalDataTable = styled(ReportDataTable)`
|
||||
border-bottom: 1px solid #dbdbdb;
|
||||
}
|
||||
}
|
||||
.tr.row_type--TOTAL_ENTRIES {
|
||||
.tr.row_type--TOTAL{
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tr:not(.no-results) {
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user