Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shabana.navas created an issue. See original summary.

shabana.navas’s picture

Title: Add a cash and credit breakdown column on the reports when user sorts by payment type » Add a cash/credit breakdown column on the reports when user sorts by payment type
shabana.navas’s picture

Status: Active » Needs review
FileSize
2.73 KB
shabana.navas’s picture

Title: Add a cash/credit breakdown column on the reports when user sorts by payment type » Add a cash/credit breakdown column on the reports
FileSize
17.02 KB
221.19 KB
193.58 KB

A more elaborate patch that displays a column for all the different payment methods by default. When a filter is selected, it display a column for only that payment type. See attached images.

shabana.navas’s picture

FileSize
5.47 KB

Oops posted wrong patch in #4. Here's the correct one.

krystalcode’s picture

@shabana.navas I've made some improvements, patch attached. Changes:

1. Some optimizations to avoid looping over payment methods that are not going to be displayed.
2. Related, the sql query was getting the sum for all payments methods, now it does that only for the payment methods we need.
3. Since the module does not explicitly require at least php 5.4, changed one instance of using modern array syntax to the old one.

There is a potential bug introduced here that we should work before considering this done though. There may be different currencies per transaction (maybe even per payment?), and for the Order Total column (sum value) this is currently done by aggregating per currency and displaying all currencies separated with a line break i.e.

$12 USD
$24 CAD

We should be doing the same for the new columns.

There could be the option to convert between currencies, but that would be a separate issue.

krystalcode’s picture

Status: Needs review » Needs work
shabana.navas’s picture

Thanks @krystalcode, the improved patch looks really good. Regarding the potential bug, maybe @tbradbury or @smccabe might have some insights.

krystalcode’s picture

@shabana.navas, I haven't figured out yet how to make a POS payment in different currency so that I can test the patch in multi-currency situations. I've enabled more than one currency in the Currency Settings page, but I don't get a currency option when making a Cash payment. Any ideas?

krystalcode’s picture

Status: Needs work » Needs review
FileSize
6.39 KB

So, there's not support at the moment for switching currency per POS payment or per POS transaction. If the site's default currency is changed however there can be multiple currencies displayed in the report. The updated patch displays the SUMs per currency in the new payment method columns in the same way done in the Order Total column.

Way to reproduce is to enable more than one currency in the site's configuration, make one or more POS transactions, switch the site's default currency, make one or more POS transactions, go to the report page. Payment method columns should be displaying the SUMs per currency.

shabana.navas’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, code looks really good Dimitris. Btw, can you please post a screenshot of how it looks with the different currency transactions? That'll help everyone understand what we're trying to do without having to test it out.

krystalcode’s picture

Screenshot attached.

shabana.navas’s picture

Status: Reviewed & tested by the community » Needs work

There is an issue here where the cash totals need to be minus any change given back and overall, the payment type totals should be only showing 'success' payment transactions as well. Fix coming up on Monday.

shabana.navas’s picture

Status: Needs work » Needs review
FileSize
7.7 KB

smccabe’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.