.DocEntry = INV0.DocEntry AND INV0.VisOrder = 0 LEFT JOIN OITM ON INV0.ItemCode = OITM.ItemCode  LEFT JOIN OITB ON OITM.ItmsGrpCod = OITB.ItmsGrpCod  LEFT JOIN OACT AS CurrCode (NOLOCK) ON OITB.RevenuesAc = CurrCode.AcctCode   WHERE DATEPART(WEEK, O