Added discounts to invoices
Some checks failed
Docker Deploy / build-and-push (push) Has been cancelled
Some checks failed
Docker Deploy / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -40,6 +40,9 @@ interface Invoice {
|
||||
dueDate: Date;
|
||||
currency: string;
|
||||
subtotal: number;
|
||||
discountValue: number | null;
|
||||
discountType: string | null;
|
||||
discountAmount: number | null;
|
||||
taxRate: number | null;
|
||||
taxAmount: number;
|
||||
total: number;
|
||||
@@ -503,6 +506,24 @@ export function createInvoiceDocument(props: InvoiceDocumentProps) {
|
||||
formatCurrency(invoice.subtotal),
|
||||
),
|
||||
]),
|
||||
(invoice.discountAmount ?? 0) > 0
|
||||
? h(View, { style: styles.totalRow }, [
|
||||
h(
|
||||
Text,
|
||||
{ style: styles.totalLabel },
|
||||
`Discount${
|
||||
invoice.discountType === "percentage"
|
||||
? ` (${invoice.discountValue}%)`
|
||||
: ""
|
||||
}`,
|
||||
),
|
||||
h(
|
||||
Text,
|
||||
{ style: styles.totalValue },
|
||||
`-${formatCurrency(invoice.discountAmount ?? 0)}`,
|
||||
),
|
||||
])
|
||||
: null,
|
||||
(invoice.taxRate ?? 0) > 0
|
||||
? h(View, { style: styles.totalRow }, [
|
||||
h(
|
||||
|
||||
Reference in New Issue
Block a user