https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37108 --- Comment #1 from Marie-Luce Laflamme <marie-luce.laflamme@inlibro.com> --- I've left this query to highlight the behaviour after running your tests. SELECT debit.accountlines_id, debit.borrowernumber, debit.itemnumber, debit.date AS "Invoice date", debit.amount, debit.description, debit.debit_type_code, credit.amountoutstanding, debit.timestamp, credit.manager_id , borrowers.branchcode AS "manager branchcode", credit.register_id, credit.branchcode AS "accountlines branchcode" FROM account_offsets JOIN accountlines AS debit ON (debit.accountlines_id = account_offsets.debit_id) JOIN accountlines AS credit ON (credit.accountlines_id = account_offsets.credit_id) JOIN account_debit_types ON (debit.debit_type_code = account_debit_types.code) LEFT JOIN borrowers ON (credit.manager_id = borrowers.borrowernumber) WHERE type IN ("APPLY") AND account_offsets.debit_id IS NOT NULL AND credit.credit_type_code ="PAYMENT" AND debit.debit_type_code NOT IN ('VOID') AND DATE(created_on)='yyyy-mm-dd'; -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.