Sunday, October 10, 2010

Tripid,deliveryid Sales Order

select wt.trip_id trip,
wt.status_code sc,
oola.line_id,
wtsp.stop_id ,
wtsp.status_code sc,
wtsp.pending_interface_flag pif,
wtsd.status_code sc,
wtsd.pending_interface_flag pif,
wtsd.lock_stop_id lockid,
wnd.organization_id org,
wnd.status_code,
wnd.planned_flag pf,
wdd.delivery_detail_id wddi,
wdd.released_status rs,
wdd.inv_interfaced_flag inv,
wdd.oe_interfaced_flag oe,
ooha.order_number,
oola.flow_status_code flow_status,
oola.org_id ordou,
wdd.org_id wddou,
wdd.source_code sc,
wdd.source_line_id line_id,
wdd.source_header_id hdr_id
from wsh_new_deliveries wnd,
wsh_delivery_assignments wda,
wsh_delivery_details wdd,
oe_order_headers_all ooha,
oe_order_lines_all oola,
wsh_delivery_legs wdl,
wsh_trip_stops wtsp,
wsh_trip_stops wtsd,
wsh_trips wt
where
ooha.order_number = nvl(:Order_numbe,ooha.order_number) and
wda.delivery_id(+) = wnd.delivery_id
and wdd.delivery_detail_id(+) = wda.delivery_detail_id
and ooha.header_id(+) = wdd.source_header_id
and oola.line_id(+) = wdd.source_line_id
and wdl.delivery_id (+) = wnd.delivery_id
and wtsp.stop_id (+) = wdl.pick_up_stop_id
and wtsd.stop_id (+) = wdl.drop_off_stop_id
and wt.trip_id (+) = wtsp.trip_id
order by ooha.order_number, oola.line_number;
/

No comments:

Post a Comment