select 1009 as SOURCETYPE, BEGINNINGINVENTORYLINE.ITSID as SOURCEID, 15 as SOURCEOWNERTYPE, BEGINNINGINVENTORY.ITSID as SOURCEOWNERID, BEGINNINGINVENTORY.ITSDATE, THEREST
from BEGINNINGINVENTORYLINE
join BEGINNINGINVENTORY on BEGINNINGINVENTORY.ITSID = BEGINNINGINVENTORYLINE.ITSOWNER
where BEGINNINGINVENTORYLINE.REVERSEDID is null and THEREST>0 and INVITEM=:INVITEM and UNITOFMEASURE=:UNITOFMEASURE

