Use OUTER APPLY. Also I’m not sure if the ON clause after the OUTER APPLY is really needed. If the invoiceid is the same coming out as going in then probably not.
Select iv.invoiceno, iv.invoiceitem,iv.invoiceno
from invoice iv
inner join deal d
on d.dealid=iv.dealid
inner join invoiceitemview ivt
on iv.invoiceid=ivt.invoiceid and iv.invoiceno=ivt.invoiceno
inner join warehouse w
on w.locationid=iv.locationid and w.inactive<>'T'
left join category c
on c.categoryid=ivt.categoryid
left join ordernoteview n
on ivt.orderid=n.orderid and n.billing ='T'
OUTER APPLY dbo.funcglforinvoice(iv.invoiceid, null, null) as tot