Queryq=dao.getQuery("select sum(oi.total) from OrderItem oi join oi.reqItem ri join ri.requirement rq join rq.workgroup w where ri.delivered = true and w = :workgroup");
Queryq=dao.getQuery("select sum(oi.totalInvoice) from OrderItem oi join oi.reqItem ri join ri.requirement rq join rq.workgroup w where (ri.orderNum is not null or ri.orderNum = '') and w = :workgroup ");