Compare commits

..

2 Commits

Author SHA1 Message Date
allcontributors[bot]
537e21130f docs: update .all-contributorsrc [skip ci] 2024-01-20 22:21:14 +00:00
allcontributors[bot]
2d6697f0b5 docs: update README.md [skip ci] 2024-01-20 22:21:13 +00:00
4 changed files with 8 additions and 12 deletions

View File

@@ -259,6 +259,6 @@ export class InventoryValuationSheet extends FinancialSheet {
const items = this.itemsSection();
const total = this.totalSection(items);
return { items, total };
return items.length > 0 ? { items, total } : {};
}
}

View File

@@ -84,9 +84,7 @@ export class InventoryValuationSheetTable extends R.compose(
const itemsRows = this.itemsRowsMapper(this.data.items);
const totalRow = this.totalRowMapper(this.data.total);
return R.compose(
R.when(R.always(R.not(R.isEmpty(itemsRows))), R.append(totalRow))
)([...itemsRows]) as ITableRow[];
return [...itemsRows, totalRow];
}
/**

View File

@@ -7,7 +7,7 @@ import {
IAccountTransaction,
ISalesByItemsItem,
ISalesByItemsTotal,
ISalesByItemsSheetData,
ISalesByItemsSheetStatement,
IItem,
} from '@/interfaces';
@@ -146,7 +146,7 @@ export default class SalesByItemsReport extends FinancialSheet {
* @param {IInventoryValuationItem[]} items
* @returns {IInventoryValuationTotal}
*/
private totalSection(items: ISalesByItemsItem[]): ISalesByItemsTotal {
totalSection(items: ISalesByItemsItem[]): ISalesByItemsTotal {
const quantitySold = sumBy(items, (item) => item.quantitySold);
const soldCost = sumBy(items, (item) => item.soldCost);
@@ -163,12 +163,12 @@ export default class SalesByItemsReport extends FinancialSheet {
/**
* Retrieve the sheet data.
* @returns {ISalesByItemsSheetData}
* @returns {ISalesByItemsSheetStatement}
*/
public reportData(): ISalesByItemsSheetData {
reportData(): ISalesByItemsSheetStatement {
const items = this.itemsSection();
const total = this.totalSection(items);
return { items, total };
return items.length > 0 ? { items, total } : {};
}
}

View File

@@ -83,9 +83,7 @@ export class SalesByItemsTable extends R.compose(
const itemsRows = this.itemsMap(this.data.items);
const totalRow = this.totalMap(this.data.total);
return R.compose(
R.when(R.always(R.not(R.isEmpty(itemsRows))), R.append(totalRow))
)([...itemsRows]) as ITableRow[];
return [...itemsRows, totalRow];
}
/**