Bug 29985 - Cashup summary shows unexplainable odd amounts
Summary: Cashup summary shows unexplainable odd amounts
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 13985
  Show dependency treegraph
 
Reported: 2022-01-31 21:34 UTC by Katrin Fischer
Modified: 2022-06-24 14:21 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2022-01-31 21:34:11 UTC
I performed some transactions testing bug 27779 in a fresh ktd instance. I used amounts like 4.50 or 10.00 or 1.55, nothing with more decimals, but I still ended up with this:


Cash register: This is a register.
Period: to 2022-01-31 21:22:40

Type 	Total
Total	0.0499999999999998
Cash	-0.0499999999999998

I have no idea how this can happen, since all amounts in my accountlines and account_offsets are only in 5 cent steps. 

With the patch from 27779 applies it also shows even amounts:

Cash register: This is a register.
Period: to 2022-01-31 21:22:40

Type 	Total
Refund against Manual fee	- 6
Refund against New card fee	- 6
Manual fee	4.55
USB Stick	1.5
Total	0.0499999999999998
Cash	-0.0499999999999998

As this should only be additions/subtractions, I have no idea how this could happen unless we have a bug somewhere?

Also display should be using Price (CurrencyFormat) system preference, but it doesn't, display remains unchanged with FR option.
Comment 1 Katrin Fischer 2022-01-31 21:39:54 UTC
Possibly easier to read if you copy from here to an editor:

MariaDB [koha_kohadev]> select * from accountlines;
+-----------------+----------+----------------+------------+---------------------+------------+-------------+------------------+-----------------+---------------+----------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
| accountlines_id | issue_id | borrowernumber | itemnumber | date                | amount     | description | credit_type_code | debit_type_code | credit_number | status   | payment_type | amountoutstanding | timestamp           | note | manager_id | register_id | interface | branchcode |
+-----------------+----------+----------------+------------+---------------------+------------+-------------+------------------+-----------------+---------------+----------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
|               1 |     NULL |             19 |       NULL | 2022-01-31 21:18:18 | -20.000000 |             | CREDIT           | NULL            | NULL          | NULL     | NULL         |          0.000000 | 2022-01-31 21:19:21 |      |         51 |        NULL | intranet  | CPL        |
|               2 |     NULL |             19 |       NULL | 2022-01-31 21:18:32 |   7.000000 | New card    | NULL             | NEW_CARD        | NULL          | REFUNDED | NULL         |          0.000000 | 2022-01-31 21:19:58 |      |         51 |        NULL | intranet  | CPL        |
|               3 |     NULL |             19 |       NULL | 2022-01-31 21:18:48 |  10.000000 | Umbrella    | NULL             | UMBR            | NULL          | NULL     | NULL         |          0.000000 | 2022-01-31 21:19:21 |      |         51 |        NULL | intranet  | CPL        |
|               4 |     NULL |             19 |       NULL | 2022-01-31 21:18:54 |   4.500000 | USB Stick   | NULL             | USB             | NULL          | NULL     | NULL         |          0.000000 | 2022-01-31 21:19:48 |      |         51 |        NULL | intranet  | CPL        |
|               5 |     NULL |             19 |       NULL | 2022-01-31 21:19:03 |   5.550000 | Manual fee  | NULL             | MANUAL          | NULL          | NULL     | NULL         |          0.000000 | 2022-01-31 21:20:14 |      |         51 |        NULL | intranet  | CPL        |
|               6 |     NULL |             19 |       NULL | 2022-01-31 21:19:36 |  -4.550000 |             | PAYMENT          | NULL            | NULL          | NULL     | CASH         |          0.000000 | 2022-01-31 21:19:36 |      |         51 |           1 | intranet  | CPL        |
|               7 |     NULL |             19 |       NULL | 2022-01-31 21:19:48 |  -1.500000 |             | PAYMENT          | NULL            | NULL          | NULL     | CASH         |          0.000000 | 2022-01-31 21:19:48 |      |         51 |           1 | intranet  | CPL        |
|               8 |     NULL |             19 |       NULL | 2022-01-31 21:19:58 |  -7.000000 | NULL        | REFUND           | NULL            | NULL          | ADDED    | NULL         |          0.000000 | 2022-01-31 21:20:56 | NULL |         51 |        NULL | intranet  | CPL        |
|               9 |     NULL |             19 |       NULL | 2022-01-31 21:20:56 |   6.000000 |             | NULL             | PAYOUT          | NULL          | PAID     | CASH         |          0.000000 | 2022-01-31 21:20:56 |      |       NULL |           1 | intranet  | NULL       |
+-----------------+----------+----------------+------------+---------------------+------------+-------------+------------------+-----------------+---------------+----------+--------------+-------------------+---------------------+------+------------+-------------+-----------+------------+
9 rows in set (0.002 sec)

MariaDB [koha_kohadev]> select * from account_offsets;
+----+-----------+----------+--------+------------+---------------------+
| id | credit_id | debit_id | type   | amount     | created_on          |
+----+-----------+----------+--------+------------+---------------------+
|  1 |         1 |     NULL | CREATE |  20.000000 | 2022-01-31 21:18:18 |
|  2 |      NULL |        2 | CREATE |   7.000000 | 2022-01-31 21:18:32 |
|  3 |      NULL |        3 | CREATE |  10.000000 | 2022-01-31 21:18:48 |
|  4 |      NULL |        4 | CREATE |   4.500000 | 2022-01-31 21:18:54 |
|  5 |      NULL |        5 | CREATE |   5.550000 | 2022-01-31 21:19:03 |
|  6 |         1 |        2 | APPLY  |  -7.000000 | 2022-01-31 21:19:21 |
|  7 |         1 |        3 | APPLY  | -10.000000 | 2022-01-31 21:19:21 |
|  8 |         1 |        4 | APPLY  |  -3.000000 | 2022-01-31 21:19:21 |
|  9 |         6 |     NULL | CREATE |   4.550000 | 2022-01-31 21:19:36 |
| 10 |         6 |        5 | APPLY  |  -4.550000 | 2022-01-31 21:19:36 |
| 11 |         7 |     NULL | CREATE |   1.500000 | 2022-01-31 21:19:48 |
| 12 |         7 |        4 | APPLY  |  -1.500000 | 2022-01-31 21:19:48 |
| 13 |         8 |     NULL | CREATE |  -7.000000 | 2022-01-31 21:19:58 |
| 14 |         8 |        2 | APPLY  |   0.000000 | 2022-01-31 21:19:58 |
| 15 |         8 |        5 | APPLY  |  -1.000000 | 2022-01-31 21:20:14 |
| 16 |      NULL |        9 | CREATE |   6.000000 | 2022-01-31 21:20:56 |
| 17 |         8 |        9 | APPLY  |  -6.000000 | 2022-01-31 21:20:56 |
+----+-----------+----------+--------+------------+---------------------+
Comment 2 Martin Renvoize 2022-06-24 13:57:24 UTC
I've tried this and am unable to replicate it at the moment.

What currently format are you using.. I wonder if there's a difference in configuration.
Comment 3 Katrin Fischer 2022-06-24 14:00:05 UTC
This was in January, so that database no longer exists. Chances are it was FR or US, unlikely to be CH.
Comment 4 Martin Renvoize 2022-06-24 14:21:01 UTC
OK, it may well be the FR currency.. I do see other bugs when I change to FR.

WIll come back to this.