You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Daily Sales overall Cash total changes when switching pages #3138
(If applicable) Installation package for the LAMP/LEMP stack is:
Issue / Bug / Question / New Feature
Looks like when I have more than 10 sales showing in the daily sales and I choose to switch to the next page the total for Cash changes but the others don't. These aren't the "Total" row values. They're the ones below that. I believe it should be the overall total, not the total for the page. I think the row named "Total" is for that. I tested this on dev.opensourcepos.org.
I never noticed that, but I can't say I ever looked at it closely. My test sets are rather small and rarely go to a second page. I believe the values should change only if the search criteria changes. I'll take a look at it this week.
@chunter2 I just went through a couple of test scenarios but could not replicate the issue. Can you provide a bit more information about the types of sales and your configuration? Such as what type of taxing are you using? Internal tax or Sales tax? Do your sales involve tax rounding? (I tested with tax rounding an nothing seemed to change.) Do you have an idea of where the differences might be? (You understand your data better than me, so your guesses are most likely better educated.)
@SteveIreland I just checked the dev server and it looks like it was updated or cleared so my tests are gone. I just recreated 11 sales there. If you go to the daily sales for today and choose 10 per page and then switch pages you'll see the cash total change per page but the other two don't. I didn't use tax or discounts for this test.
Okay, thanks for the info. The difference in the cash reported between the first page and the second page was 40.08 which is the amount of the change due.
According to the code, amount refunded from cash transactions should be deducted from the payment amounts before display the payment summary at the bottom of the page. So the first page is correct and for some reason the cash refund isn't being subtracted on the second page Now that I know what's happening I can debug it and hopefully figure out the resolution for it. I can't find anything in the code that looks like an opportunity for that bug.
@SteveIreland If it's any help my "production" system is at version 3.3.2 and the bug is there as well. I'm pretty sure I noticed it before manually hand picking some commits along the way.
The reason why this amount changes is because the sale transactions have a different offset while the totals do not. So in this summary we substract the change due for cash transactions, but only for the resultset you are currently viewing. So that's the reason why you see the values changing when you switch pages.
So conclusion is that this correction can't be done correctly in the current setup. We should query the amount - cash refund in SQL directly instead (cfr the fix @SteveIreland did recently)
In attachment an example of my local version with the fix applied. So in this case the sale was paid with 40$ of cash, and amount was 20$. We show that there is change due, and payments for cash in total are 20$ (so refunds subtracted).
@jekkos Just tested out your changes on my system and it looks like it's fixed. Switching pages now keeps the values at the bottom fixed. I also checked the summary payments report for the daily sales day I tested and the numbers match.
One more request if it's not too much. Would it be an idea to include a "Total" line as well? It would just be the total of the above (in my case 3) line. It would save us having to go to the summary payments report.
I was just looking for one more line under Debit Card like this.
Total: $1143.50
Just figured I'd mention this since you were in the code at that point. No need to rush on this. I can open a new ticket for this, maybe after 3.3.4 is released.
Activity
SteveIreland commentedon Mar 21, 2021
I never noticed that, but I can't say I ever looked at it closely. My test sets are rather small and rarely go to a second page. I believe the values should change only if the search criteria changes. I'll take a look at it this week.
SteveIreland commentedon Mar 21, 2021
@chunter2 I just went through a couple of test scenarios but could not replicate the issue. Can you provide a bit more information about the types of sales and your configuration? Such as what type of taxing are you using? Internal tax or Sales tax? Do your sales involve tax rounding? (I tested with tax rounding an nothing seemed to change.) Do you have an idea of where the differences might be? (You understand your data better than me, so your guesses are most likely better educated.)
chunter2 commentedon Mar 22, 2021
@SteveIreland I just checked the dev server and it looks like it was updated or cleared so my tests are gone. I just recreated 11 sales there. If you go to the daily sales for today and choose 10 per page and then switch pages you'll see the cash total change per page but the other two don't. I didn't use tax or discounts for this test.
SteveIreland commentedon Mar 22, 2021
Okay, thanks for the info. The difference in the cash reported between the first page and the second page was 40.08 which is the amount of the change due.
According to the code, amount refunded from cash transactions should be deducted from the payment amounts before display the payment summary at the bottom of the page. So the first page is correct and for some reason the cash refund isn't being subtracted on the second page Now that I know what's happening I can debug it and hopefully figure out the resolution for it. I can't find anything in the code that looks like an opportunity for that bug.
jekkos commentedon Apr 5, 2021
So @SteveIreland were you able to reproduce the issue, or do you have any idea why it would happen that on the second page totals are off?
SteveIreland commentedon Apr 5, 2021
I was able to reproduce the error but I have absolutely no idea what is triggering it.
chunter2 commentedon Apr 6, 2021
@SteveIreland If it's any help my "production" system is at version 3.3.2 and the bug is there as well. I'm pretty sure I noticed it before manually hand picking some commits along the way.
jekkos commentedon Apr 6, 2021
The reason why this amount changes is because the sale transactions have a different offset while the totals do not. So in this summary we substract the change due for cash transactions, but only for the resultset you are currently viewing. So that's the reason why you see the values changing when you switch pages.
So conclusion is that this correction can't be done correctly in the current setup. We should query the amount - cash refund in SQL directly instead (cfr the fix @SteveIreland did recently)
Fix cash totals in payment summary (#3138)
jekkos commentedon Apr 6, 2021
Ok if someone can review / test this last patch, then we can close and release.
jekkos commentedon Apr 6, 2021
In attachment an example of my local version with the fix applied. So in this case the sale was paid with 40$ of cash, and amount was 20$. We show that there is change due, and payments for cash in total are 20$ (so refunds subtracted).
chunter2 commentedon Apr 6, 2021
@jekkos Just tested out your changes on my system and it looks like it's fixed. Switching pages now keeps the values at the bottom fixed. I also checked the summary payments report for the daily sales day I tested and the numbers match.
One more request if it's not too much. Would it be an idea to include a "Total" line as well? It would just be the total of the above (in my case 3) line. It would save us having to go to the summary payments report.
Thanks again for looking into this.
jekkos commentedon Apr 6, 2021
@chunter2 thanks for testing and quick confirmation.
Not sure where you want this total exactly?
I was mainly focusing on bugfixing for now, you can open a new issue to ask for this enhancement if you want. My time is a bit limited atm.
chunter2 commentedon Apr 6, 2021
@jekkos Just for clarity, so an example of the bottom of the daily sales page looks like this for me.
Cash: $308.18
Credit Card: $258.20
Debit Card: $577.12
I was just looking for one more line under Debit Card like this.
Total: $1143.50
Just figured I'd mention this since you were in the code at that point. No need to rush on this. I can open a new ticket for this, maybe after 3.3.4 is released.
Thanks again.
Add sales total to daily overview (#3138)
jekkos commentedon Apr 6, 2021
@chunter2 thanks for the example, all clear now. Find this improvement in my last commit here. I hope it'll save you some time.
chunter2 commentedon Apr 6, 2021
@jekkos Works great. :) Thanks again.
Fix cash totals in payment summary (#3138)
Add sales total to daily overview (#3138)