Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/beige-spiders-ask.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mpesa2csv": patch
---

fix: reorder columns and update total charges display in xlsx charges sheet export
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions src/services/xlsxService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ export class XlsxService {
chargesWorksheet.columns = [
{ header: "Receipt No", key: "receiptNo", width: 12 },
{ header: "Date", key: "date", width: 12 },
{ header: "Time", key: "time", width: 10 },
{ header: "Amount", key: "amount", width: 12 },
{ header: "Full Details", key: "fullDetails", width: 40 },
{ header: "Amount", key: "amount", width: 12 },
];

// Style the header row
Expand All @@ -130,8 +129,8 @@ export class XlsxService {
chargesWorksheet.addRow({
receiptNo: transaction.receiptNo,
date: transaction.completionTime,
amount: amount,
fullDetails: transaction.details,
amount: amount,
});
});

Expand Down Expand Up @@ -160,9 +159,9 @@ export class XlsxService {

chargesWorksheet.getCell(`A${summaryStartRow}`).value = "Total Charges:";
chargesWorksheet.getCell(`A${summaryStartRow}`).font = { bold: true };
chargesWorksheet.getCell(`E${summaryStartRow}`).value = totalCharges;
chargesWorksheet.getCell(`E${summaryStartRow}`).font = { bold: true };
chargesWorksheet.getCell(`E${summaryStartRow}`).fill = {
chargesWorksheet.getCell(`D${summaryStartRow}`).value = totalCharges;
chargesWorksheet.getCell(`D${summaryStartRow}`).font = { bold: true };
chargesWorksheet.getCell(`D${summaryStartRow}`).fill = {
type: "pattern",
pattern: "solid",
fgColor: { argb: "FFFFE4B5" },
Expand All @@ -171,9 +170,9 @@ export class XlsxService {
chargesWorksheet.getCell(`A${summaryStartRow + 1}`).value =
"Number of Charge Transactions:";
chargesWorksheet.getCell(`A${summaryStartRow + 1}`).font = { bold: true };
chargesWorksheet.getCell(`E${summaryStartRow + 1}`).value =
chargesWorksheet.getCell(`D${summaryStartRow + 1}`).value =
chargeTransactions.length;
chargesWorksheet.getCell(`E${summaryStartRow + 1}`).font = { bold: true };
chargesWorksheet.getCell(`D${summaryStartRow + 1}`).font = { bold: true };
}

static getFileName(statement: MPesaStatement, timestamp?: string): string {
Expand Down
Loading