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 items = this.itemsSection();
const total = this.totalSection(items); 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 itemsRows = this.itemsRowsMapper(this.data.items);
const totalRow = this.totalRowMapper(this.data.total); const totalRow = this.totalRowMapper(this.data.total);
return R.compose( return [...itemsRows, totalRow];
R.when(R.always(R.not(R.isEmpty(itemsRows))), R.append(totalRow))
)([...itemsRows]) as ITableRow[];
} }
/** /**

View File

@@ -7,7 +7,7 @@ import {
IAccountTransaction, IAccountTransaction,
ISalesByItemsItem, ISalesByItemsItem,
ISalesByItemsTotal, ISalesByItemsTotal,
ISalesByItemsSheetData, ISalesByItemsSheetStatement,
IItem, IItem,
} from '@/interfaces'; } from '@/interfaces';
@@ -146,7 +146,7 @@ export default class SalesByItemsReport extends FinancialSheet {
* @param {IInventoryValuationItem[]} items * @param {IInventoryValuationItem[]} items
* @returns {IInventoryValuationTotal} * @returns {IInventoryValuationTotal}
*/ */
private totalSection(items: ISalesByItemsItem[]): ISalesByItemsTotal { totalSection(items: ISalesByItemsItem[]): ISalesByItemsTotal {
const quantitySold = sumBy(items, (item) => item.quantitySold); const quantitySold = sumBy(items, (item) => item.quantitySold);
const soldCost = sumBy(items, (item) => item.soldCost); const soldCost = sumBy(items, (item) => item.soldCost);
@@ -163,12 +163,12 @@ export default class SalesByItemsReport extends FinancialSheet {
/** /**
* Retrieve the sheet data. * Retrieve the sheet data.
* @returns {ISalesByItemsSheetData} * @returns {ISalesByItemsSheetStatement}
*/ */
public reportData(): ISalesByItemsSheetData { reportData(): ISalesByItemsSheetStatement {
const items = this.itemsSection(); const items = this.itemsSection();
const total = this.totalSection(items); 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 itemsRows = this.itemsMap(this.data.items);
const totalRow = this.totalMap(this.data.total); const totalRow = this.totalMap(this.data.total);
return R.compose( return [...itemsRows, totalRow];
R.when(R.always(R.not(R.isEmpty(itemsRows))), R.append(totalRow))
)([...itemsRows]) as ITableRow[];
} }
/** /**