feat: general ledger and journal rows types

This commit is contained in:
Ahmed Bouhuolia
2024-01-06 22:30:41 +02:00
parent 79f3f1b63d
commit 7aee76e461
4 changed files with 27 additions and 16 deletions

View File

@@ -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);
};

View File

@@ -0,0 +1,6 @@
export enum ROW_TYPE {
ACCOUNT = 'ACCOUNT',
OPENING_BALANCE = 'OPENING_BALANCE',
TRANSACTION = 'TRANSACTION',
CLOSING_BALANCE = 'CLOSING_BALANCE',
}

View File

@@ -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 {

View File

@@ -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;
}