Skip to content

Commit

Permalink
Merge pull request #50 from PratapRathi/fix-inconsistent_currency
Browse files Browse the repository at this point in the history
Fix: Inconsistent Currency in PDF Invoice
  • Loading branch information
aayushchugh authored Dec 10, 2024
2 parents 7fcdfe4 + 693ca72 commit 6dbf968
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/components/ui/invoice/pdf/EntriesTablePDF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { Entry } from "../../../../services/invoiceService";
interface EntriesTableProps {
entries: Entry[];
totalAmount: string;
activeCurrency: string;
}

const EntriesTable = ({ entries, totalAmount }: EntriesTableProps) => {
const EntriesTable = ({ entries, totalAmount, activeCurrency }: EntriesTableProps) => {
const tableRows = entries.map((entry, index) => (
<View style={styles.row} key={index}>
<Text style={styles.description}>{entry.description}</Text>
<Text style={styles.quantity}>{entry.quantity}</Text>
<Text style={styles.amount}>${(entry.amount * entry.quantity).toFixed(2)}</Text>
<Text style={styles.amount}>{activeCurrency}{(entry.amount * entry.quantity).toFixed(2)}</Text>
</View>
));

Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/invoice/pdf/GenerateInvoicePDF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ const GenerateInvoicePDF = ({
totalAmount,
totalWithTax,
}: GenerateInvoicePDFProps) => {
const activeCurrency = totalAmount.substring(0, 1);
return (
<Document>
<Page style={styles.page}>
<InvoiceHeader headerDetails={headerDetails} />
<BillingInfo billingDetails={billingDetails} />
<EntriesTable entries={entries} totalAmount={totalAmount} />
<EntriesTable entries={entries} totalAmount={totalAmount} activeCurrency={activeCurrency}/>
<TaxDetailsTable taxDetails={taxDetails} />
<InvoiceFooter totalWithTax={totalWithTax} customMessage={customMessage} />
</Page>
Expand Down

0 comments on commit 6dbf968

Please sign in to comment.