fix: paid_amount when the group is mode of payment #36092
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OBS: R$ is a currency
Problem: If i create a invoice with total amount of R$ 100, paying this with two mode of payments:
Cash / Money: R$ 80
Credit Card: R$ 20
Using the report POS Register, set the filter "group_by" based on payment method, column Paid Amount show R$ 100 for both mode of payments, this is wrong.
>> Now With the fix <<
Now whent we group based on payment method, the amount will be based on mode of payment Cash / Money: R$ 80 and Credit Card: R$ 20
If we have change, this amount will be discounted on CASH type.
Example 1: one sale with amount R$ 90.
![image](https://private-user-images.githubusercontent.com/25017988/252703816-84504cb1-b522-4636-9e22-b23b46525728.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzMDMyNTksIm5iZiI6MTcyMTMwMjk1OSwicGF0aCI6Ii8yNTAxNzk4OC8yNTI3MDM4MTYtODQ1MDRjYjEtYjUyMi00NjM2LTllMjItYjIzYjQ2NTI1NzI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE4VDExNDIzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxMDc1YTk3Y2YzNjhhYTkwYmZlNDY3MGM2Y2NmMzU2N2ZiYjZlNGM1YWRmNzZhM2RlMjMxMzQzNTVlMTY4YWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.3HHkpzt2qgmYS6NeIzIs6YsPE_9ugrRn9oJWAE_Zbmc)
![image](https://private-user-images.githubusercontent.com/25017988/252705699-1428f39b-52d4-462f-9664-880144993ded.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEzMDMyNTksIm5iZiI6MTcyMTMwMjk1OSwicGF0aCI6Ii8yNTAxNzk4OC8yNTI3MDU2OTktMTQyOGYzOWItNTJkNC00NjJmLTk2NjQtODgwMTQ0OTkzZGVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE4VDExNDIzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI2ODBlZmRmMzhmZGUwYzk5ZDA2NGYwOTg3NDM0ZTdiNjBmZDVmOTk1ZjJmMTgzNDRhMGY5ZWI0MDA2OTkzMTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.xkRT6lPatpyEJIn3jFdGl1c9GlQjchJoBLYFDUaPV0M)
Example 2:
This situation is not common, and is not allowed in many establishments, but it is the following, R$ 100 was sold, with payment of R$ 120 on the credit card, generating a change of R$ 20, the change will be made and deducted from the cash payment method.
As the amount came out of the drawer to give change, in this case it will be negative, deducting from the general balance of the payment in "Cash / Money"