here's my sql:
select receipt.id as "Receipt ID",
receiptline.item as "Item ID",
ABS(receiptline.foreignamount) as "Amount",
receipt.trandate as "DeliveryDate",
receipt.tranid as "DeliveryNumber",
receiptline.quantity as "Quantity",
receiptline.foreignamount / DECODE(receiptline.quantity,0,1,NVL(receiptline.quantity, 1)) as "UnitPrice",
BUILTIN.CF(poheader.status)
From
Transaction receipt,
transactionLine receiptline,
transaction poheader,
transactionLine poline
Where
receipt.type = 'ItemRcpt'
and receiptline.transaction = receipt.id
and poline.transaction = poheader.id
and receiptline.createdfrom = poheader.id
and receiptline.item = poline.item
and
BUILTIN.CF(poheader.status) in ('PurchOrd:B', 'PurchOrd:D', 'PurchOrd:E', 'PurchOrd:F')
order by 1