Repository: fossasia/open-event-server

Issue:
Overview of ticket income shows incorrect number
Comparing numbers in the ticket sales of organizers and in the admin ticket dashboard shows different numbers. Numbers in the specific event ticket dashboard are correct.

![screenshot from 2017-01-19 13-26-05](https://cloud.githubusercontent.com/assets/1583873/22106840/fd61506c-de4a-11e6-9676-721528644717.png)



Discussion:
I'd like to do this

The numbers in the subtab in the admin sales section still do not add up correctly. Please see example below in screenshot.

![screenshot from 2017-01-28 02-33-53](https://cloud.githubusercontent.com/assets/1583873/22393141/51130ae4-e502-11e6-8ec5-6f8f99e9b8a3.png)


Resolving patch:
diff --git a/app/views/super_admin/sales.py b/app/views/super_admin/sales.py
--- a/app/views/super_admin/sales.py
+++ b/app/views/super_admin/sales.py
@@ -375,25 +375,31 @@ def sales_by_events_view(path):
                     if discount and str(ticket.id) in discount.tickets.split(","):
                         if discount.type == "amount":
                             tickets_summary_event_wise[str(order.event_id)][str(order.status)][
-                                'sales'] += order_ticket.quantity * (ticket.price - discount.value)
+                                'sales'] += forex(order.event.payment_currency, display_currency, \
+                                            order_ticket.quantity * (ticket.price - discount.value))
                             tickets_summary_organizer_wise[str(order.event.creator_id)][str(order.status)][
-                                'sales'] += order_ticket.quantity * (ticket.price - discount.value)
+                                'sales'] += forex(order.event.payment_currency, display_currency, \
+                                            order_ticket.quantity * (ticket.price - discount.value))
                             tickets_summary_location_wise[str(order.event.searchable_location_name)][str(order.status)][
-                                'sales'] += order_ticket.quantity * (ticket.price - discount.value)
+                                'sales'] += forex(order.event.payment_currency, display_currency, \
+                                            order_ticket.quantity * (ticket.price - discount.value))
                         else:
                             tickets_summary_event_wise[str(order.event_id)][str(order.status)]['sales'] += \
-                                order_ticket.quantity * (ticket.price - discount.value * ticket.price / 100.0)
+                                forex(order.event.payment_currency, display_currency, \
+                                    order_ticket.quantity * (ticket.price - discount.value * ticket.price / 100.0))
                             tickets_summary_organizer_wise[str(order.event.creator_id)][str(order.status)]['sales'] += \
-                                order_ticket.quantity * (ticket.price - discount.value * ticket.price / 100.0)
+                                forex(order.event.payment_currency, display_currency, \
+                                    order_ticket.quantity * (ticket.price - discount.value * ticket.price / 100.0))
                             tickets_summary_location_wise[str(order.event.searchable_location_name)][str(order.status)]['sales'] += \
-                                order_ticket.quantity * (ticket.price - discount.value * ticket.price / 100.0)
+                                forex(order.event.payment_currency, display_currency, \
+                                    order_ticket.quantity * (ticket.price - discount.value * ticket.price / 100.0))
                     else:
                         tickets_summary_event_wise[str(order.event_id)][str(order.status)][
-                            'sales'] += order_ticket.quantity * ticket.price
+                            'sales'] += forex(order.event.payment_currency, display_currency, order_ticket.quantity * ticket.price)
                         tickets_summary_organizer_wise[str(order.event.creator_id)][str(order.status)][
-                            'sales'] += order_ticket.quantity * ticket.price
+                            'sales'] += forex(order.event.payment_currency, display_currency, order_ticket.quantity * ticket.price)
                         tickets_summary_location_wise[str(order.event.searchable_location_name)][str(order.status)][
-                            'sales'] += order_ticket.quantity * ticket.price
+                            'sales'] += forex(order.event.payment_currency, display_currency, order_ticket.quantity * ticket.price)
     if path == 'events' or path == 'discounted-events':
         return render_template('gentelella/admin/super_admin/sales/by_events.html',
                                tickets_summary=tickets_summary_event_wise,


Test patch: