From c65d8145b78bdd1a24b14955703e9ac44eb22376 Mon Sep 17 00:00:00 2001 From: iamareebjamal Date: Mon, 1 Jun 2020 03:06:20 +0530 Subject: [PATCH] fix: Properly format money everywhere --- app/initializers/accounting.js | 8 ++++++++ .../admin/sales/discounted-events.hbs | 12 +++++------ app/templates/admin/sales/index.hbs | 12 +++++------ app/templates/admin/sales/locations.hbs | 12 +++++------ app/templates/admin/sales/marketer.hbs | 6 +++--- app/templates/admin/sales/organizers.hbs | 12 +++++------ app/templates/admin/sales/revenue.hbs | 6 +++--- .../event-invoice/invoice-summary.hbs | 2 +- .../events/view/overview/event-tickets.hbs | 2 +- .../components/orders/order-summary.hbs | 14 ++++++------- .../components/public/ticket-list.hbs | 20 +++++++++---------- .../cell/admin/sales/status/cell-amount.hbs | 2 +- .../ui-table/cell/events/cell-amount.hbs | 2 +- .../view/tickets/attendees/cell-price.hbs | 2 +- .../view/tickets/cell-add-order-price.hbs | 2 +- .../view/tickets/cell-add-order-total.hbs | 2 +- .../view/tickets/orders/cell-amount.hbs | 2 +- app/templates/event-invoice/review.hbs | 2 +- 18 files changed, 64 insertions(+), 56 deletions(-) create mode 100644 app/initializers/accounting.js diff --git a/app/initializers/accounting.js b/app/initializers/accounting.js new file mode 100644 index 00000000000..be36fb5c77e --- /dev/null +++ b/app/initializers/accounting.js @@ -0,0 +1,8 @@ +import { currency } from 'accounting/settings'; + +export default { + name: 'accounting.js', + initialize() { + currency.symbol = ''; + } +}; diff --git a/app/templates/admin/sales/discounted-events.hbs b/app/templates/admin/sales/discounted-events.hbs index a0258ab2ce4..8405f9efaad 100644 --- a/app/templates/admin/sales/discounted-events.hbs +++ b/app/templates/admin/sales/discounted-events.hbs @@ -63,19 +63,19 @@ {{entry.sales.completed.ticket_count}} - {{currency-symbol this.order.paymentCurrency}} {{format-number entry.sales.completed.sales_total}} + {{currency-symbol this.order.paymentCurrency}} {{format-money entry.sales.completed.sales_total}} {{entry.sales.placed.ticket_count}} - {{currency-symbol this.order.paymentCurrency}} {{format-number entry.sales.places.sales_total}} + {{currency-symbol this.order.paymentCurrency}} {{format-money entry.sales.places.sales_total}} {{entry.sales.pending.ticket_count}} - {{currency-symbol this.order.paymentCurrency}} {{format-number entry.sales.pending.sales_total}} + {{currency-symbol this.order.paymentCurrency}} {{format-money entry.sales.pending.sales_total}} {{/each}} @@ -91,19 +91,19 @@ {{totalCompletedTickets}} - US$ {{format-number totalCompletedSales}} + US$ {{format-money totalCompletedSales}} {{totalPlacedTickets}} - US$ {{format-number totalPlacedSales}} + US$ {{format-money totalPlacedSales}} {{totalPendingTickets}} - US$ {{format-number totalPendingSales}} + US$ {{format-money totalPendingSales}} --}} diff --git a/app/templates/admin/sales/index.hbs b/app/templates/admin/sales/index.hbs index b0d467ecdcb..9300c008193 100644 --- a/app/templates/admin/sales/index.hbs +++ b/app/templates/admin/sales/index.hbs @@ -28,11 +28,11 @@ {{entry.name}} {{moment-format entry.startsAt 'ddd, MMM DD \at h:mm A'}} {{entry.sales.completed.ticket_count}} - {{currency-symbol entry.paymentCurrency}} {{format-number entry.sales.completed.sales_total}} + {{currency-symbol entry.paymentCurrency}} {{format-money entry.sales.completed.sales_total}} {{entry.sales.placed.ticket_count}} - {{currency-symbol entry.paymentCurrency}} {{format-number entry.sales.placed.sales_total}} + {{currency-symbol entry.paymentCurrency}} {{format-money entry.sales.placed.sales_total}} {{entry.sales.pending.ticket_count}} - {{currency-symbol entry.paymentCurrency}} {{format-number entry.sales.pending.sales_total}} + {{currency-symbol entry.paymentCurrency}} {{format-money entry.sales.pending.sales_total}} {{/each}} @@ -45,19 +45,19 @@ {{totalCompletedTickets}} - US$ {{format-number totalCompletedSales}} + US$ {{format-money totalCompletedSales}} {{totalPlacedTickets}} - US$ {{format-number totalPlacedSales}} + US$ {{format-money totalPlacedSales}} {{totalPendingTickets}} - US$ {{format-number totalPendingSales}} + US$ {{format-money totalPendingSales}} --}} diff --git a/app/templates/admin/sales/locations.hbs b/app/templates/admin/sales/locations.hbs index b7a6425da26..bfd0b3ef024 100644 --- a/app/templates/admin/sales/locations.hbs +++ b/app/templates/admin/sales/locations.hbs @@ -26,11 +26,11 @@ {{entry.locationName}} {{entry.sales.completed.ticket_count}} - US$ {{format-number entry.sales.completed.sales_total}} + US$ {{format-money entry.sales.completed.sales_total}} {{entry.sales.placed.ticket_count}} - US$ {{format-number entry.sales.placed.sales_total}} + US$ {{format-money entry.sales.placed.sales_total}} {{entry.sales.pending.ticket_count}} - US$ {{format-number entry.sales.pending.sales_total}} + US$ {{format-money entry.sales.pending.sales_total}} {{/each}} @@ -38,11 +38,11 @@ {{t 'Total'}} {{totalCompletedTickets}} - US$ {{format-number totalCompletedSales}} + US$ {{format-money totalCompletedSales}} {{totalPlacedTickets}} - US$ {{format-number totalPlacedSales}} + US$ {{format-money totalPlacedSales}} {{totalPendingTickets}} - US$ {{format-number totalPendingSales}} + US$ {{format-money totalPendingSales}} --}} diff --git a/app/templates/admin/sales/marketer.hbs b/app/templates/admin/sales/marketer.hbs index 43e07a51ed4..1dcab6b6617 100644 --- a/app/templates/admin/sales/marketer.hbs +++ b/app/templates/admin/sales/marketer.hbs @@ -25,7 +25,7 @@ {{entry.sales.completed.ticket_count}} - US$ {{format-number entry.sales.completed.sales_total}} + US$ {{format-money entry.sales.completed.sales_total}} {{/each}} @@ -38,8 +38,8 @@ {{ticketsTotal}} - US$ {{format-number salesTotal}} - US$ {{format-number discountsTotal}} + US$ {{format-money salesTotal}} + US$ {{format-money discountsTotal}} --}} diff --git a/app/templates/admin/sales/organizers.hbs b/app/templates/admin/sales/organizers.hbs index 5ee0bb34b9e..7dadd0b2ac5 100644 --- a/app/templates/admin/sales/organizers.hbs +++ b/app/templates/admin/sales/organizers.hbs @@ -56,19 +56,19 @@ {{entry.sales.completed.ticket_count}} - US$ {{format-number entry.sales.completed.sales_total}} + US$ {{format-money entry.sales.completed.sales_total}} {{entry.sales.placed.ticket_count}} - US$ {{format-number entry.sales.places.sales_total}} + US$ {{format-money entry.sales.places.sales_total}} {{entry.sales.pending.ticket_count}} - US$ {{format-number entry.sales.pending.sales_total}} + US$ {{format-money entry.sales.pending.sales_total}} {{/each}} @@ -84,19 +84,19 @@ {{totalCompletedTickets}} - US$ {{format-number totalCompletedSales}} + US$ {{format-money totalCompletedSales}} {{totalPlacedTickets}} - US$ {{format-number totalPlacedSales}} + US$ {{format-money totalPlacedSales}} {{totalPendingTickets}} - US$ {{format-number totalPendingSales}} + US$ {{format-money totalPendingSales}} --}} diff --git a/app/templates/admin/sales/revenue.hbs b/app/templates/admin/sales/revenue.hbs index f909f5f93e1..e52c6c0cb42 100644 --- a/app/templates/admin/sales/revenue.hbs +++ b/app/templates/admin/sales/revenue.hbs @@ -44,13 +44,13 @@ {{order.ticketCount}} - {{format-number order.feePercentage}}% + {{format-money order.feePercentage}}% {{#if order.maximumFee}} [{{t 'Max.'}} {{currency-symbol order.paymentCurrency}} {{order.maximumFee}}] {{/if}} - {{currency-symbol order.paymentCurrency}} {{format-number order.revenue}} + {{currency-symbol order.paymentCurrency}} {{format-money order.revenue}} {{/each}} @@ -66,7 +66,7 @@ {{ticketsTotal}} - US$ {{format-number revenueTotal}} + US$ {{format-money revenueTotal}} --}} diff --git a/app/templates/components/event-invoice/invoice-summary.hbs b/app/templates/components/event-invoice/invoice-summary.hbs index 4d3b8fa7436..5c1f1ea08d5 100644 --- a/app/templates/components/event-invoice/invoice-summary.hbs +++ b/app/templates/components/event-invoice/invoice-summary.hbs @@ -28,7 +28,7 @@ {{this.event.name}} {{moment-format this.data.createdAt 'MM/DD/YYYY'}} {{moment-format this.data.completedAt 'MM/DD/YYYY'}} - {{currency-symbol this.eventCurrency}} {{format-number this.data.amount}} + {{currency-symbol this.eventCurrency}} {{format-money this.data.amount}} diff --git a/app/templates/components/events/view/overview/event-tickets.hbs b/app/templates/components/events/view/overview/event-tickets.hbs index 25d8782f9f1..8ec48f00731 100644 --- a/app/templates/components/events/view/overview/event-tickets.hbs +++ b/app/templates/components/events/view/overview/event-tickets.hbs @@ -15,7 +15,7 @@ {{t 'Sales (amount)'}} - {{currency-symbol this.data.event.paymentCurrency}} {{format-number this.sales}} + {{currency-symbol this.data.event.paymentCurrency}} {{format-money this.sales}} diff --git a/app/templates/components/orders/order-summary.hbs b/app/templates/components/orders/order-summary.hbs index 75cdc381e65..2538abca713 100644 --- a/app/templates/components/orders/order-summary.hbs +++ b/app/templates/components/orders/order-summary.hbs @@ -75,10 +75,10 @@ {{#if this.data.discountCode}} - {{currency-symbol this.eventCurrency}} {{format-number ticket.price}} - {{currency-symbol this.eventCurrency}} {{format-number ticket.discount}} + {{currency-symbol this.eventCurrency}} {{format-money ticket.price}} + {{currency-symbol this.eventCurrency}} {{format-money ticket.discount}} - {{currency-symbol this.eventCurrency}} {{format-number (mult (sub ticket.price ticket.discount) (ticket-attendees this.data.attendees ticket.attendees))}} + {{currency-symbol this.eventCurrency}} {{format-money (mult (sub ticket.price ticket.discount) (ticket-attendees this.data.attendees ticket.attendees))}} {{/if}} {{ticket-attendees this.data.attendees ticket.attendees}} @@ -88,9 +88,9 @@ {{ticket.name}} - {{currency-symbol this.eventCurrency}} {{format-number ticket.price}} + {{currency-symbol this.eventCurrency}} {{format-money ticket.price}} {{#if this.data.discountCode}} - {{currency-symbol this.eventCurrency}} {{format-number ticket.discount}} + {{currency-symbol this.eventCurrency}} {{format-money ticket.discount}} {{/if}} {{ticket-attendees this.data.attendees ticket.attendees}} {{#if this.event.tax}} @@ -107,7 +107,7 @@ {{/if}} - {{currency-symbol this.eventCurrency}} {{format-number (mult (sub ticket.price ticket.discount) (ticket-attendees this.data.attendees ticket.attendees))}} + {{currency-symbol this.eventCurrency}} {{format-money (mult (sub ticket.price ticket.discount) (ticket-attendees this.data.attendees ticket.attendees))}} {{/if}} @@ -136,7 +136,7 @@ - {{currency-symbol this.eventCurrency}} {{format-number this.data.amount}} + {{currency-symbol this.eventCurrency}} {{format-money this.data.amount}} diff --git a/app/templates/components/public/ticket-list.hbs b/app/templates/components/public/ticket-list.hbs index cc3083968e3..cc043c7a8df 100644 --- a/app/templates/components/public/ticket-list.hbs +++ b/app/templates/components/public/ticket-list.hbs @@ -32,19 +32,19 @@ {{#if ticket.discount}}
- {{this.eventCurrency}} {{format-number ticket.price}} + {{this.eventCurrency}} {{format-money ticket.price}}
- {{this.eventCurrency}} {{format-number (sub ticket.price ticket.discount)}} + {{this.eventCurrency}} {{format-money (sub ticket.price ticket.discount)}} {{#if this.taxInfo}} {{#if this.showTaxIncludedMessage}} - {{t 'includes'}} {{this.eventCurrency}} {{format-number ticket.includedTaxAmount}} + {{t 'includes'}} {{this.eventCurrency}} {{format-money ticket.includedTaxAmount}} {{else}} + {{this.eventCurrency}} - {{format-number (add (sub ticket.ticketPriceWithTax ticket.price) ticket.discount)}} + {{format-money (add (sub ticket.ticketPriceWithTax ticket.price) ticket.discount)}} {{/if}}
@@ -65,16 +65,16 @@ @value={{ticket.price}} />
{{else}} - {{this.eventCurrency}} {{format-number ticket.price}} + {{this.eventCurrency}} {{format-money ticket.price}} {{/if}} {{#if (and this.taxInfo (not-eq ticket.type 'free'))}} {{#if this.showTaxIncludedMessage}} - {{t 'includes'}} {{this.eventCurrency}} {{format-number ticket.includedTaxAmount}} + {{t 'includes'}} {{this.eventCurrency}} {{format-money ticket.includedTaxAmount}} {{else}} - + {{this.eventCurrency}} {{format-number (sub ticket.ticketPriceWithTax ticket.price)}} + + {{this.eventCurrency}} {{format-money (sub ticket.ticketPriceWithTax ticket.price)}} {{/if}}
@@ -107,9 +107,9 @@ {{#if this.taxInfo}} {{this.eventCurrency}} - {{format-number (mult (sub ticket.ticketPriceWithTax ticket.discount) ticket.orderQuantity)}} + {{format-money (mult (sub ticket.ticketPriceWithTax ticket.discount) ticket.orderQuantity)}} {{else}} - {{this.eventCurrency}} {{format-number (mult (sub ticket.price ticket.discount) ticket.orderQuantity)}} + {{this.eventCurrency}} {{format-money (mult (sub ticket.price ticket.discount) ticket.orderQuantity)}} {{/if}} @@ -124,7 +124,7 @@
- {{t 'Total'}}: {{this.eventCurrency}} {{format-number this.total}} + {{t 'Total'}}: {{this.eventCurrency}} {{format-money this.total}}
diff --git a/app/templates/components/ui-table/cell/admin/sales/status/cell-amount.hbs b/app/templates/components/ui-table/cell/admin/sales/status/cell-amount.hbs index 750ce8dfc36..cc6416c6289 100644 --- a/app/templates/components/ui-table/cell/admin/sales/status/cell-amount.hbs +++ b/app/templates/components/ui-table/cell/admin/sales/status/cell-amount.hbs @@ -1,3 +1,3 @@ - US$ {{format-number this.record}} + US$ {{format-money this.record}} diff --git a/app/templates/components/ui-table/cell/events/cell-amount.hbs b/app/templates/components/ui-table/cell/events/cell-amount.hbs index a1e2e368fcf..e83e637bc7f 100644 --- a/app/templates/components/ui-table/cell/events/cell-amount.hbs +++ b/app/templates/components/ui-table/cell/events/cell-amount.hbs @@ -1 +1 @@ -{{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-number this.record}} \ No newline at end of file +{{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-money this.record}} \ No newline at end of file diff --git a/app/templates/components/ui-table/cell/events/view/tickets/attendees/cell-price.hbs b/app/templates/components/ui-table/cell/events/view/tickets/attendees/cell-price.hbs index 9e9d62fffd4..da86755929b 100644 --- a/app/templates/components/ui-table/cell/events/view/tickets/attendees/cell-price.hbs +++ b/app/templates/components/ui-table/cell/events/view/tickets/attendees/cell-price.hbs @@ -1,5 +1,5 @@
- {{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-number this.record}} + {{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-money this.record}}
{{#if this.extraRecords.discountCode.code}}
diff --git a/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-price.hbs b/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-price.hbs index 3fb59246e1a..7151b217b10 100644 --- a/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-price.hbs +++ b/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-price.hbs @@ -1 +1 @@ -{{currency-symbol this.paymentCurrency}} {{format-number this.record.price}} \ No newline at end of file +{{currency-symbol this.paymentCurrency}} {{format-money this.record.price}} \ No newline at end of file diff --git a/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-total.hbs b/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-total.hbs index 86c1a0e484d..ae7401d4517 100644 --- a/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-total.hbs +++ b/app/templates/components/ui-table/cell/events/view/tickets/cell-add-order-total.hbs @@ -1 +1 @@ -{{currency-symbol this.paymentCurrency}} {{format-number (mult this.record.orderQuantity this.record.price)}} \ No newline at end of file +{{currency-symbol this.paymentCurrency}} {{format-money (mult this.record.orderQuantity this.record.price)}} \ No newline at end of file diff --git a/app/templates/components/ui-table/cell/events/view/tickets/orders/cell-amount.hbs b/app/templates/components/ui-table/cell/events/view/tickets/orders/cell-amount.hbs index 20194065587..9683e7e77c0 100644 --- a/app/templates/components/ui-table/cell/events/view/tickets/orders/cell-amount.hbs +++ b/app/templates/components/ui-table/cell/events/view/tickets/orders/cell-amount.hbs @@ -1,5 +1,5 @@
- {{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-number this.record}} + {{currency-symbol this.extraRecords.event.paymentCurrency}} {{format-money this.record}}
{{#if this.extraRecords.discountCode.code}}
diff --git a/app/templates/event-invoice/review.hbs b/app/templates/event-invoice/review.hbs index ec507ee28f7..e3eba47e055 100644 --- a/app/templates/event-invoice/review.hbs +++ b/app/templates/event-invoice/review.hbs @@ -65,7 +65,7 @@ {{t 'Date Issued'}}: {{moment-format this.model.createdAt 'MM/DD/YYYY'}}
- {{t 'Total Invoice Amount'}}: {{currency-symbol this.model.event.paymentCurrency}} {{format-number this.model.amount}} + {{t 'Total Invoice Amount'}}: {{currency-symbol this.model.event.paymentCurrency}} {{format-money this.model.amount}}