select B.booking_no 'Booking #',
CASE WHEN B.Booking_type_v32 = 0 THEN 'Rental'
WHEN B.booking_type_v32 = 1 THEN 'Sub Hire'
WHEN B.booking_type_v32 = 2 THEN 'Quote'
ELSE '' END AS Type,
B.dDate 'Warehouse Out',
B.rDate 'Warehouse In',
t.product_code 'Product Code',
a.DESCRIPTION 'Description',
t.stock_number 'Stock #',
a.ASSET_CODE 'Barcode',
a.RFIDTag 'RFID' ,
l.Locn_name 'Location',
a.LOCATION 'Bin Location'
from tblAssetran t
left outer join tblItemtran I on I.SubRentalLinkID = t.ItemTranID
left outer join tblbookings b on b.booking_no = I.booking_no_v32
left outer join tblasset01 A on a.PRODUCT_COde = t.product_code and a.STOCK_NUMBER = t.stock_number
left outer join tblLocnlist l on l.Locn_number = a.locn
where b.rdate <= getdate() and t.stock_number <> '65535' and t.ActInDate = '1980-01-01 00:00:00.000' and booking_type_v32 in (0,1,2,5)
order by b.rDate,b.booking_no