Report Name: Total amount of order given to each Vendor in active budget year Purpose: This report gives you data about the total amount of order given to a particular vendor in active budget year. It will help in proper distribution of orders among the vendors. Status: Complete tested ok Koha 16.11.07 SELECT b.booksellerid 'Vendor ID', bb.name AS 'Vendor Name', SUM(r.ecost * r.quantity) AS 'Total Amount' FROM aqorders r LEFT JOIN aqbasket b ON b.basketno=r.basketno LEFT JOIN aqbooksellers bb ON bb.id=b.booksellerid LEFT JOIN aqbudgets bbb ON bbb.budget_id=r.budget_id LEFT JOIN aqbudgetperiods bbbb ON bbbb.budget_period_id=bbb.budget_period_id WHERE NOT r.orderstatus='cancelled' AND bbbb.budget_period_active LIKE '1' GROUP BY bb.id