DBA Data[Home] [Help]

VIEW: APPS.MST_R_MAS_CARR_LTL_PARC_V

Source

View Text - Preformatted

SELECT distinct mt.plan_id , wlo.owner_type , fte.facility_id , fte1.facility_id , md.organization_id , md.customer_id , md.supplier_id , mt.carrier_id , wc.freight_code , wcs.service_level , mt.trip_number , mt.origin_location_id , wl1.location_code , substr(mst_wb_util.get_name(wl1.wsh_location_id),1,80) , wl1.address1 , wl1.city , wl1.state , wl1.postal_code , mst_wb_util.Get_Contact_Name(wl1.wsh_location_id) , mst_wb_util.get_phone_number(wl1.wsh_location_id) , mt.trip_start_date , substr(mst_wb_util.get_local_chardt(wl1.wsh_location_id, mt.trip_start_date),1,20) , substr(mst_wb_util.get_local_chardt(wl1.wsh_location_id, mt.trip_end_date),1,20) , mt.destination_location_id , wl2.location_code , substr(mst_wb_util.get_name(wl2.wsh_location_id),1,80) , wl2.address1 , wl2.city , wl2.state , wl2.postal_code , mst_wb_util.Get_Contact_Name(wl2.wsh_location_id) , mst_wb_util.get_phone_number(wl2.wsh_location_id) , substr(mst_wb_util.get_local_chardt(wl2.wsh_location_id ,(select max(mdd1.earliest_acceptable_date) from mst_delivery_details mdd1 , mst_delivery_assignments mda1 WHERE mda1.plan_id = mt.plan_id and mda1.delivery_id in (select distinct mdl1.delivery_id from mst_delivery_legs mdl1 where mdl1.plan_id = mda1.plan_id and mdl1.trip_id = mt.trip_id) and mda1.delivery_detail_id = mdd1.delivery_detail_id and mdd1.plan_id = mda1.plan_id)),1,20) , substr(mst_wb_util.get_local_chardt(wl2.wsh_location_id ,(select min(mdd1.latest_acceptable_date) from mst_delivery_details mdd1 , mst_delivery_assignments mda1 where mda1.plan_id = mt.plan_id and mda1.delivery_id in (select distinct mdl1.delivery_id from mst_delivery_legs mdl1 where mdl1.plan_id = mda1.plan_id and mdl1.trip_id = mt.trip_id) and mda1.delivery_detail_id = mdd1.delivery_detail_id and mdd1.plan_id = mda1.plan_id)),1,20) , (select sum(md.number_of_pieces) from mst_deliveries md , mst_delivery_legs mdl where md.plan_id = mdl.plan_id and md.delivery_id = mdl.delivery_id and mdl.plan_id = mt.plan_id and mdl.trip_id = mt.trip_id) , (select sum(md.volume) from mst_deliveries md , mst_delivery_legs mdl where md.plan_id = mdl.plan_id and md.delivery_id = mdl.delivery_id and mdl.plan_id = mt.plan_id and mdl.trip_id = mt.trip_id) , (select sum(md.gross_weight) from mst_deliveries md , mst_delivery_legs mdl where md.plan_id = mdl.plan_id and md.delivery_id = mdl.delivery_id and mdl.plan_id = mt.plan_id and mdl.trip_id = mt.trip_id) , nvl(mt.total_basic_transport_cost,0) + nvl(mt.total_accessorial_cost,0) , mdd.tp_refer_header_number , mdd.source_header_number , mst_reports_pkg.get_freight_classes_per_order(mt.plan_id, mdd.source_header_number) from mst_trips mt , mst_delivery_legs mdl , mst_deliveries md , mst_delivery_assignments mda , mst_delivery_details mdd , wsh_carriers wc , fte_location_parameters fte , fte_location_parameters fte1 , wsh_location_owners wlo , wsh_carrier_services wcs , wsh_locations wl1 , wsh_locations wl2 where md.plan_id = mdl.plan_id and md.delivery_id = mdl.delivery_id and mdl.plan_id = mt.plan_id and mdl.trip_id = mt.trip_id and (mt.mode_of_transport = 'LTL' or mt.mode_of_transport = 'PARCEL') and mda.plan_id = md.plan_id and mda.delivery_id = md.delivery_id and mda.delivery_detail_id = mdd.delivery_detail_id and mdd.plan_id = md.plan_id and fte.location_id = mt.origin_location_id and fte1.location_id = mt.destination_location_id and wlo.wsh_location_id = fte.location_id and mt.carrier_id = wc.carrier_id and mt.carrier_service_id = wcs.carrier_service_id and wl1.wsh_location_id = mt.origin_location_id and wl2.wsh_location_id = mt.destination_location_id
View Text - HTML Formatted

SELECT DISTINCT MT.PLAN_ID
, WLO.OWNER_TYPE
, FTE.FACILITY_ID
, FTE1.FACILITY_ID
, MD.ORGANIZATION_ID
, MD.CUSTOMER_ID
, MD.SUPPLIER_ID
, MT.CARRIER_ID
, WC.FREIGHT_CODE
, WCS.SERVICE_LEVEL
, MT.TRIP_NUMBER
, MT.ORIGIN_LOCATION_ID
, WL1.LOCATION_CODE
, SUBSTR(MST_WB_UTIL.GET_NAME(WL1.WSH_LOCATION_ID)
, 1
, 80)
, WL1.ADDRESS1
, WL1.CITY
, WL1.STATE
, WL1.POSTAL_CODE
, MST_WB_UTIL.GET_CONTACT_NAME(WL1.WSH_LOCATION_ID)
, MST_WB_UTIL.GET_PHONE_NUMBER(WL1.WSH_LOCATION_ID)
, MT.TRIP_START_DATE
, SUBSTR(MST_WB_UTIL.GET_LOCAL_CHARDT(WL1.WSH_LOCATION_ID
, MT.TRIP_START_DATE)
, 1
, 20)
, SUBSTR(MST_WB_UTIL.GET_LOCAL_CHARDT(WL1.WSH_LOCATION_ID
, MT.TRIP_END_DATE)
, 1
, 20)
, MT.DESTINATION_LOCATION_ID
, WL2.LOCATION_CODE
, SUBSTR(MST_WB_UTIL.GET_NAME(WL2.WSH_LOCATION_ID)
, 1
, 80)
, WL2.ADDRESS1
, WL2.CITY
, WL2.STATE
, WL2.POSTAL_CODE
, MST_WB_UTIL.GET_CONTACT_NAME(WL2.WSH_LOCATION_ID)
, MST_WB_UTIL.GET_PHONE_NUMBER(WL2.WSH_LOCATION_ID)
, SUBSTR(MST_WB_UTIL.GET_LOCAL_CHARDT(WL2.WSH_LOCATION_ID
, (SELECT MAX(MDD1.EARLIEST_ACCEPTABLE_DATE)
FROM MST_DELIVERY_DETAILS MDD1
, MST_DELIVERY_ASSIGNMENTS MDA1
WHERE MDA1.PLAN_ID = MT.PLAN_ID
AND MDA1.DELIVERY_ID IN (SELECT DISTINCT MDL1.DELIVERY_ID
FROM MST_DELIVERY_LEGS MDL1
WHERE MDL1.PLAN_ID = MDA1.PLAN_ID
AND MDL1.TRIP_ID = MT.TRIP_ID)
AND MDA1.DELIVERY_DETAIL_ID = MDD1.DELIVERY_DETAIL_ID
AND MDD1.PLAN_ID = MDA1.PLAN_ID))
, 1
, 20)
, SUBSTR(MST_WB_UTIL.GET_LOCAL_CHARDT(WL2.WSH_LOCATION_ID
, (SELECT MIN(MDD1.LATEST_ACCEPTABLE_DATE)
FROM MST_DELIVERY_DETAILS MDD1
, MST_DELIVERY_ASSIGNMENTS MDA1
WHERE MDA1.PLAN_ID = MT.PLAN_ID
AND MDA1.DELIVERY_ID IN (SELECT DISTINCT MDL1.DELIVERY_ID
FROM MST_DELIVERY_LEGS MDL1
WHERE MDL1.PLAN_ID = MDA1.PLAN_ID
AND MDL1.TRIP_ID = MT.TRIP_ID)
AND MDA1.DELIVERY_DETAIL_ID = MDD1.DELIVERY_DETAIL_ID
AND MDD1.PLAN_ID = MDA1.PLAN_ID))
, 1
, 20)
, (SELECT SUM(MD.NUMBER_OF_PIECES)
FROM MST_DELIVERIES MD
, MST_DELIVERY_LEGS MDL
WHERE MD.PLAN_ID = MDL.PLAN_ID
AND MD.DELIVERY_ID = MDL.DELIVERY_ID
AND MDL.PLAN_ID = MT.PLAN_ID
AND MDL.TRIP_ID = MT.TRIP_ID)
, (SELECT SUM(MD.VOLUME)
FROM MST_DELIVERIES MD
, MST_DELIVERY_LEGS MDL
WHERE MD.PLAN_ID = MDL.PLAN_ID
AND MD.DELIVERY_ID = MDL.DELIVERY_ID
AND MDL.PLAN_ID = MT.PLAN_ID
AND MDL.TRIP_ID = MT.TRIP_ID)
, (SELECT SUM(MD.GROSS_WEIGHT)
FROM MST_DELIVERIES MD
, MST_DELIVERY_LEGS MDL
WHERE MD.PLAN_ID = MDL.PLAN_ID
AND MD.DELIVERY_ID = MDL.DELIVERY_ID
AND MDL.PLAN_ID = MT.PLAN_ID
AND MDL.TRIP_ID = MT.TRIP_ID)
, NVL(MT.TOTAL_BASIC_TRANSPORT_COST
, 0) + NVL(MT.TOTAL_ACCESSORIAL_COST
, 0)
, MDD.TP_REFER_HEADER_NUMBER
, MDD.SOURCE_HEADER_NUMBER
, MST_REPORTS_PKG.GET_FREIGHT_CLASSES_PER_ORDER(MT.PLAN_ID
, MDD.SOURCE_HEADER_NUMBER)
FROM MST_TRIPS MT
, MST_DELIVERY_LEGS MDL
, MST_DELIVERIES MD
, MST_DELIVERY_ASSIGNMENTS MDA
, MST_DELIVERY_DETAILS MDD
, WSH_CARRIERS WC
, FTE_LOCATION_PARAMETERS FTE
, FTE_LOCATION_PARAMETERS FTE1
, WSH_LOCATION_OWNERS WLO
, WSH_CARRIER_SERVICES WCS
, WSH_LOCATIONS WL1
, WSH_LOCATIONS WL2
WHERE MD.PLAN_ID = MDL.PLAN_ID
AND MD.DELIVERY_ID = MDL.DELIVERY_ID
AND MDL.PLAN_ID = MT.PLAN_ID
AND MDL.TRIP_ID = MT.TRIP_ID
AND (MT.MODE_OF_TRANSPORT = 'LTL' OR MT.MODE_OF_TRANSPORT = 'PARCEL')
AND MDA.PLAN_ID = MD.PLAN_ID
AND MDA.DELIVERY_ID = MD.DELIVERY_ID
AND MDA.DELIVERY_DETAIL_ID = MDD.DELIVERY_DETAIL_ID
AND MDD.PLAN_ID = MD.PLAN_ID
AND FTE.LOCATION_ID = MT.ORIGIN_LOCATION_ID
AND FTE1.LOCATION_ID = MT.DESTINATION_LOCATION_ID
AND WLO.WSH_LOCATION_ID = FTE.LOCATION_ID
AND MT.CARRIER_ID = WC.CARRIER_ID
AND MT.CARRIER_SERVICE_ID = WCS.CARRIER_SERVICE_ID
AND WL1.WSH_LOCATION_ID = MT.ORIGIN_LOCATION_ID
AND WL2.WSH_LOCATION_ID = MT.DESTINATION_LOCATION_ID