feat(server): styling financial reports

This commit is contained in:
Ahmed Bouhuolia
2024-02-20 21:36:16 +02:00
parent c06a8d9ca3
commit f6f6bc31b6
12 changed files with 147 additions and 13 deletions

View File

@@ -3,7 +3,7 @@ block head
include ../../css/modules/financial-sheet.css include ../../css/modules/financial-sheet.css
style. style.
#{customCSS} !{customCSS}
block content block content
.sheet .sheet
@@ -16,9 +16,9 @@ block content
thead thead
tr tr
each column in table.columns each column in table.columns
th(style=column.style)= column.label th(style=column.style class='column--' + column.key)= column.label
tbody tbody
each row in table.rows each row in table.rows
tr(class=row.classNames) tr(class=row.classNames)
each cell in row.cells each cell in row.cells
td!= cell.value td(class='cell--' + cell.key)!= cell.value

View File

@@ -23,4 +23,42 @@ table tr.row-type--total.row-id--assets td,
table tr.row-type--total.row-id--liability-equity td { table tr.row-type--total.row-id--liability-equity td {
border-bottom: 3px double #000; border-bottom: 3px double #000;
} }
table .column--name,
table .cell--name {
width: 400px;
}
table .column--total {
width: 25%;
}
table td.cell--total,
table td.cell--previous_year,
table td.cell--previous_year_change,
table td.cell--previous_year_percentage,
table td.cell--previous_period,
table td.cell--previous_period_change,
table td.cell--previous_period_percentage,
table td.cell--percentage_of_row,
table td.cell--percentage_of_column,
table td[class*="cell--date-range"] {
text-align: right;
}
table .column--total,
table .column--previous_year,
table .column--previous_year_change,
table .column--previous_year_percentage,
table .column--previous_period,
table .column--previous_period_change,
table .column--previous_period_percentage,
table .column--percentage_of_row,
table .column--percentage_of_column,
table [class*="column--date-range"] {
text-align: right;
}
`; `;

View File

@@ -76,7 +76,7 @@ export default class CashFlowTable implements ICashFlowTable {
*/ */
private commonColumns = () => { private commonColumns = () => {
return R.compose( return R.compose(
R.concat([{ key: 'label', accessor: 'label' }]), R.concat([{ key: 'name', accessor: 'label' }]),
R.when( R.when(
R.always(this.isDisplayColumnsBy(DISPLAY_COLUMNS_BY.DATE_PERIODS)), R.always(this.isDisplayColumnsBy(DISPLAY_COLUMNS_BY.DATE_PERIODS)),
R.concat(this.datePeriodsColumnsAccessors()) R.concat(this.datePeriodsColumnsAccessors())

View File

@@ -23,8 +23,11 @@ export class CashflowSheetMeta {
const formattedFromDate = moment(query.fromDate).format('YYYY/MM/DD'); const formattedFromDate = moment(query.fromDate).format('YYYY/MM/DD');
const formattedDateRange = `From ${formattedFromDate} | To ${formattedToDate}`; const formattedDateRange = `From ${formattedFromDate} | To ${formattedToDate}`;
const sheetName = 'Statement of Cash Flow';
return { return {
...meta, ...meta,
sheetName,
formattedToDate, formattedToDate,
formattedFromDate, formattedFromDate,
formattedDateRange, formattedDateRange,

View File

@@ -8,7 +8,7 @@ export const HtmlTableCustomCss = `
table tr.row-type--accounts td { table tr.row-type--accounts td {
border-top: 1px solid #bbb; border-top: 1px solid #bbb;
} }
table tr.row-id--cash-end-period { table tr.row-id--cash-end-period td {
border-bottom: 3px double #333; border-bottom: 3px double #333;
} }
table tr.row-type--total { table tr.row-type--total {
@@ -19,4 +19,15 @@ table tr.row-type--total td {
} }
table tr.row-type--total:not(:first-child) td { table tr.row-type--total:not(:first-child) td {
border-top: 1px solid #bbb; border-top: 1px solid #bbb;
}`; }
table .column--name,
table .cell--name {
width: 400px;
}
table .column--total,
table .cell--total,
table [class*="column--date-range"],
table [class*="cell--date-range"] {
text-align: right;
}
`;

View File

@@ -7,4 +7,11 @@ table tr td:not(:first-child) {
} }
table tr:last-child td { table tr:last-child td {
border-bottom: 1px solid #ececec; border-bottom: 1px solid #ececec;
}`; }
table .cell--credit,
table .cell--debit,
table .column--credit,
table .column--debit{
text-align: right;
}
`;

View File

@@ -26,4 +26,44 @@ table tr.row-type--total td {
border-top: 1px solid #bbb; border-top: 1px solid #bbb;
color: #000; color: #000;
} }
table tr.row-id--net-income td{
border-bottom: 3px double #000;
}
table .column--name,
table .cell--name {
width: 400px;
}
table .column--total {
width: 25%;
}
table td.cell--total,
table td.cell--previous_year,
table td.cell--previous_year_change,
table td.cell--previous_year_percentage,
table td.cell--previous_period,
table td.cell--previous_period_change,
table td.cell--previous_period_percentage,
table td.cell--percentage_of_row,
table td.cell--percentage_of_column,
table td[class*="cell--date-range"] {
text-align: right;
}
table .column--total,
table .column--previous_year,
table .column--previous_year_change,
table .column--previous_year_percentage,
table .column--previous_period,
table .column--previous_period_change,
table .column--previous_period_percentage,
table .column--percentage_of_row,
table .column--percentage_of_column,
table [class*="column--date-range"] {
text-align: right;
}
`; `;

View File

@@ -1,7 +1,6 @@
export enum ROW_TYPE { export enum ROW_TYPE {
TOTAL = 'TOTAL', TOTAL = 'TOTAL',
ITEM = 'ITEM' ITEM = 'ITEM',
} }
export const HtmlTableCustomCss = ` export const HtmlTableCustomCss = `
@@ -10,4 +9,15 @@ table tr.row-type--total td {
border-bottom: 3px double #000; border-bottom: 3px double #000;
font-weight: 600; font-weight: 600;
} }
`; table .column--item_name{
width: 300px;
}
table .column--quantity_purchases,
table .column--purchase_amount,
table .column--average_cost,
table .cell--quantity_purchases,
table .cell--purchase_amount,
table .cell--average_cost{
text-align: right;
}
`;

View File

@@ -9,4 +9,15 @@ table tr.row-type--total td {
border-bottom: 3px double #000; border-bottom: 3px double #000;
font-weight: 600; font-weight: 600;
} }
table .column--item_name{
width: 300px;
}
table .column--average_price,
table .column--sold_quantity,
table .column--sold_amount,
table .cell--average_price,
table .cell--sold_quantity,
table .cell--sold_amount{
text-align: right;
}
`; `;

View File

@@ -19,12 +19,13 @@ export class TrialBalanceSheetTable extends R.compose(
FinancialSheetStructure FinancialSheetStructure
)(FinancialSheet) { )(FinancialSheet) {
/** /**
* Trial balance sheet data.
* @param {ITrialBalanceSheetData} * @param {ITrialBalanceSheetData}
*/ */
public data: ITrialBalanceSheetData; public data: ITrialBalanceSheetData;
/** /**
* Balance sheet query. * Trial balance sheet query.
* @param {ITrialBalanceSheetQuery} * @param {ITrialBalanceSheetQuery}
*/ */
public query: ITrialBalanceSheetQuery; public query: ITrialBalanceSheetQuery;
@@ -135,7 +136,7 @@ export class TrialBalanceSheetTable extends R.compose(
return R.compose( return R.compose(
this.tableColumnsCellIndexing, this.tableColumnsCellIndexing,
R.concat([ R.concat([
{ key: 'account_name', label: 'Account' }, { key: 'account', label: 'Account' },
{ key: 'debit', label: 'Debit' }, { key: 'debit', label: 'Debit' },
{ key: 'credit', label: 'Credit' }, { key: 'credit', label: 'Credit' },
{ key: 'total', label: 'Total' }, { key: 'total', label: 'Total' },

View File

@@ -9,4 +9,17 @@ table tr.row-type--total td{
font-weight: 500; font-weight: 500;
border-bottom: 3px double #000; border-bottom: 3px double #000;
} }
table .column--account {
width: 400px;
}
table .column--debit,
table .column--credit,
table .column--total,
table .cell--debit,
table .cell--credit,
table .cell--total{
text-align: right;
}
`; `;

View File

@@ -44,7 +44,7 @@ const dynamicColumnMapper = R.curry((data, column) => {
const totalColumn = amountAccessor(data); const totalColumn = amountAccessor(data);
return R.compose( return R.compose(
R.when(R.pathEq(['key'], 'account_name'), accountNameColumn), R.when(R.pathEq(['key'], 'account'), accountNameColumn),
R.when(R.pathEq(['key'], 'credit'), creditColumn), R.when(R.pathEq(['key'], 'credit'), creditColumn),
R.when(R.pathEq(['key'], 'debit'), debitColumn), R.when(R.pathEq(['key'], 'debit'), debitColumn),
R.when(R.pathEq(['key'], 'total'), totalColumn), R.when(R.pathEq(['key'], 'total'), totalColumn),