[Koha-bugs] [Bug 33756] New: Wrong calculation of total amount spent?

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 17 19:18:34 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33756

            Bug ID: 33756
           Summary: Wrong calculation of total amount spent?
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P5 - low
         Component: Acquisitions
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: katrin.fischer at bsz-bw.de
        QA Contact: testopia at bugs.koha-community.org

I am trying to work out something in acquisitions and stumbled on this bit:

https://git.koha-community.org/Koha-community/Koha/src/branch/master/C4/Budgets.pm#L553
        # Get all the budgets totals in as few queries as possible
        my $hr_budget_spent = $dbh->selectall_hashref(q|
            SELECT aqorders.budget_id, aqbudgets.budget_parent_id,
                SUM( | .
C4::Acquisition::get_rounding_sql(qq|COALESCE(unitprice_tax_included,
ecost_tax_included)|) . q| * quantity ) AS budget_spent
            FROM aqorders JOIN aqbudgets USING (budget_id)
            WHERE quantityreceived > 0 AND datecancellationprinted IS NULL
            GROUP BY budget_id, budget_parent_id
            |, 'budget_id');


If the amount is spent, I feel multiplying by quantity is incorrect. It should
be quantityreceived.

I am not sure yet where this is used and how it manifests.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list