SELECT 'I' as Ind,inventory_item_id,(SELECT ITEM_NAME FROM $master_db.Sales_Inventory_Items WHERE ITEM_ID = INVENTORY_ITEM_ID) AS Item,SUM(QUANTITY) as Qty, SUM(SUBTOTAL) as Amount FROM $trans_db.PURCHASE_INVOICE_DETAILS WHERE VOUCHER_DATE >= str_to_date('$fromDateTime','%Y-%m-%d %H:%i:%s') AND VOUCHER_DATE <= str_to_date('$toDateTime','%Y-%m-%d %H:%i:%s') GROUP BY INVENTORY_ITEM_ID ORDER BY 1