2025-06-11 15:13:44 +00:00
|
|
|
import { CustomerInvoiceItem } from "#/server/domain";
|
2025-05-02 21:43:51 +00:00
|
|
|
import { IInvoicingContext } from "#/server/intrastructure";
|
|
|
|
|
import { Collection } from "@rdx/core";
|
2025-03-18 08:05:00 +00:00
|
|
|
|
2025-06-11 15:13:44 +00:00
|
|
|
export const customerCustomerInvoiceItemPresenter = (items: Collection<CustomerInvoiceItem>, context: IInvoicingContext) =>
|
2025-03-18 08:05:00 +00:00
|
|
|
items.totalCount > 0
|
2025-06-11 15:13:44 +00:00
|
|
|
? items.items.map((item: CustomerInvoiceItem) => ({
|
2025-03-18 08:05:00 +00:00
|
|
|
description: item.description.toString(),
|
|
|
|
|
quantity: item.quantity.toString(),
|
|
|
|
|
unit_measure: "",
|
2025-04-01 14:26:15 +00:00
|
|
|
unit_price: item.unitPrice.toPrimitive() as IMoney_Response_DTO,
|
|
|
|
|
subtotal: item.calculateSubtotal().toPrimitive() as IMoney_Response_DTO,
|
|
|
|
|
tax_amount: item.calculateTaxAmount().toPrimitive() as IMoney_Response_DTO,
|
|
|
|
|
total: item.calculateTotal().toPrimitive() as IMoney_Response_DTO,
|
2025-03-18 08:05:00 +00:00
|
|
|
}))
|
|
|
|
|
: [];
|