select d.DKL_LINE as linenumber,
d.DKL_PART as partcode,
d.DKL_LINERSTATUS as statuscode,
d.DKL_COUNTQTY as receiptquantity,
d.DKL_LOT as lotcode,
d.DKL_BIN as bincode,
p.PAR_DESC as partdescription,
ROUND(d.DKL_COUNTQTY/ifnull(o.orl_multiply,1), 6) as receiptuopquantity,
o.orl_puruom uop,
p.PAR_UOM as uom,
d.dkl_dckcode as receiptcode,
d.dkl_order_org as purchaseorderorganization,
d.dkl_updatecount as updatecount,
d.dkl_mobiledateupdated as mobiledateupdated
FROM r5dockreceipts r,  r5parts p, r5docklines d
LEFT OUTER JOIN r5orderlines o ON o.orl_order = d.dkl_order
AND o.orl_ordline = d.dkl_ordline
AND o.orl_order_org = d.dkl_order_org
LEFT OUTER JOIN r5events e on o.orl_event = e.evt_code
LEFT OUTER JOIN r5activities a on ( o.orl_event = a.act_event and o.orl_act = a.act_act )
WHERE d.dkl_dckcode = <param.poreceiptcode>
AND        d.dkl_linerstatus IN ( 'U', 'R' )
AND        r.dck_code = <param.poreceiptcode>
AND        d.dkl_part = p.par_code
AND        d.dkl_part_org = p.par_org
order by   d.dkl_line ASC
