Advertisement
psi_mmobile

Untitled

Oct 15th, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.83 KB | None | 0 0
  1. SELECT PdTrfDay.DATE_DAY,
  2. PdTrfDay.PD_TRF_DAY_ID,
  3. PdTrfDay.DESTINATION_POI_ID,
  4. PdTrfDay.IS_LOCKED,
  5. PdTrfDay.IS_MODIFIED_BY_USER,
  6. PdTrfDay.OC_AGGREG_ADMIN_STATUS_ID,
  7. PdTrfDay.OC_DAY_AGGREG_ID,
  8. PdTrfDay.OPERATION_MODE_ID,
  9. PdTrfDay.PD_TRF_TYPE_ID,
  10. PdTrfDay.PD_TRF_USER_COMMENT,
  11. PdTrfDay.PERSON_ID,
  12. PdTrfDay.REF_NUMBER,
  13. CAST(PdTrfDay.START_TIME AS TIMESTAMP) AS STARTTIME,
  14. CAST(PdTrfDay.STOP_TIME AS TIMESTAMP) AS STOPTIME,
  15. PdTrfDay.TRF_DHR,
  16. PdTrfDay.TRF_PHR,
  17. PdTrfDay.WBS_ID,
  18. PdTrfDay.WORK_CODE_ID,
  19. PdTrfDay.VEHICLE_ID,
  20. WorkCode.WORK_CODE_ID AS WORK_CODE_ID1,
  21. GuPerson.GUI_USER_ID,
  22. GuPerson.PERSON_ID AS PERSON_ID1,
  23. OperationMode.NAME,
  24. OperationMode.OPERATION_MODE_ID AS OPERATION_MODE_ID1,
  25. OperationMode.SHORT_NAME,
  26. OcAggregAdminStatus.OC_AGGREG_ADMIN_STATUS_ID AS OC_AGGREG_ADMIN_STATUS_ID1,
  27. OcDayAggreg.OC_DAY_AGGREG_ID AS OC_DAY_AGGREG_ID1,
  28. OcPoi.POI_ID,
  29. VoPersonCategory.VO_PERSON_CATEGORY_ID,
  30. Person.PERSON_ID AS PERSON_ID2,
  31. (Person.Last_name || ' ' || Person.First_Name) AS VIEW_ATTR,
  32. TO_CHAR(PdTrfDay.date_day, 'Dy', 'nls_date_language=' || (select case when language = 'DU' then 'Dutch' when language = 'FR' then 'French' else 'English' end from gui_users gu where gu.gui_user_id = GuPerson.gui_user_id)) AS VIEW_ATTR,
  33. TO_CHAR( PdTrfDay.date_day,'dd') AS VIEW_ATTR,
  34. to_char ( PdTrfDay.DATE_DAY , 'dd/MM/yyyy' ) AS VIEW_ATTR,
  35. DECODE(PdTrfDay.start_poi_id,NULL,PdTrfDay.start_location_name, DECODE(OcPoi.oc_poi_status_id,4, '[' || OcPoi.short_name || '].'|| p_vd_poi.getVehicleDataAddress(PdTrfDay.start_vehicle_data_id), p_wbs.getWbsName(PdTrfDay.wbs_Id, PdTrfDay.start_poi_id))) AS VIEW_ATTR,
  36. mod(DENSE_RANK () OVER (order by Person.company_nr, person.last_name, person.person_id, PdTrfDay.date_day), 2) AS VIEW_ATTR,
  37. PdTrfDay.START_POI_ID,
  38. PdTrfDay.TOT_PRIVATE_KM,
  39. PdTrfDay.TOT_DRIVER_WITH_P_KM,
  40. PdTrfDay.TOT_PASSENGER_KM,
  41. OcAggregAdminStatus.FLAG_COLOUR,
  42. VoPersonCategory.VEHICLE_OWNER_ID,
  43. decode(OperationMode.short_name,'NW','#223c4a','CO','#f75414','') AS VIEW_ATTR,
  44. PdTrfDay.USER_COMMENT,
  45. (Select work_code_id From work_code Where vehicle_owner_id = VoPersonCategory.vehicle_owner_id And work_code_std_id=110 And order_num = ( select min(order_num) From work_code Where vehicle_owner_id = VoPersonCategory.vehicle_owner_id And work_code_std_id=110)) AS VIEW_ATTR,
  46. (VoPersonCategory.VEHICLE_OWNER_ID) AS VIEW_ATTR,
  47. (Person.Company_nr) AS VIEW_ATTR,
  48. (VoPersonCategory.Name) AS VIEW_ATTR,
  49. (VehicleOwner.Company_name) AS VIEW_ATTR,
  50. PdTrfDay.ACTIVITY_ID,
  51. PdDay.PD_DAY_ID,
  52. (PdDay.TRF_DHR_SUPP_TO_STORE) AS VIEW_ATTR,
  53. row_number () over (PARTITION by pdday.pd_day_id order by PdTrfDay.order_num, PdTrfDay.START_TIME) AS ROW_NUM,
  54. (PdDay.TRF_DHR_SUPP_TO_PAY) AS VIEW_ATTR,
  55. (PdDay.MOBILITY_ZONE_ID) AS VIEW_ATTR,
  56. (Pdday.MOBILITY_COMPENSATION) AS VIEW_ATTR,
  57. (PdDay.MEAL_ALLOWANCE) AS VIEW_ATTR,
  58. (Vehicle.COMPANY_NR || ' ' || Vehicle.NUMBERPLATE) AS VIEW_ATTR,
  59. PdTrfDay.START_LOCATION_ADDRESS,
  60. (Vehicle.NUMBERPLATE) AS VIEW_ATTR,
  61. (Vehicle.COMPANY_NR) AS VIEW_ATTR,
  62. PdTrfDay.TRF_IHR,
  63. (PDDAY.Declared_Vehicle_Km) AS VIEW_ATTR,
  64. (PDDAY.Declared_Vehicle_Ref) AS VIEW_ATTR,
  65. (PDDAY.pause) AS VIEW_ATTR,
  66. (PDDAY.Declared_Private_Km) AS VIEW_ATTR,
  67. PdTrfDay.START_LOCATION_NAME,
  68. PdTrfDay.ERP_SIGN_ATTACHED_DOC_ID,
  69. PdTrfDay.VALIDATED_BY_EMAIL,
  70. PdTrfDay.VALIDATED_BY_NAME,
  71. PdTrfDay.VALIDATION_COMMENT,
  72. (PDDAY.Declared_On_Foot_Km) AS VIEW_ATTR,
  73. (PDDAY.Declared_Bicycle_Km) AS VIEW_ATTR,
  74. (PDDAY.public_transport) AS VIEW_ATTR,
  75. (Private_Vehicle) AS VIEW_ATTR,
  76. (PDDAY.Company_Vehicle) AS VIEW_ATTR,
  77. (PDDAY.long_distance) AS VIEW_ATTR,
  78. (PDDAY.TRAJECT) AS VIEW_ATTR,
  79. (PDDAY.Transport) AS VIEW_ATTR,
  80. (PDDAY.DECLARED_JOURNEY_TYPE_ID) AS VIEW_ATTR,
  81. (PDDAY.WORK_LOCATION_CATEGORY) AS VIEW_ATTR,
  82. (PDDAY.WORK_LOCATION_POST_CODE) AS VIEW_ATTR,
  83. (PDDAY.MEETING_POINT_POST_CODE) AS VIEW_ATTR,
  84. SUM( case when WorkCode.work_code_std_type_id = 1 then PdTrfDay.TRF_DHR else 0 end) OVER (PARTITION BY PdTrfDay.date_day,PdTrfDay.person_id) AS VIEW_ATTR,
  85. GraphicalSymbol.GRAPHICAL_SYMBOL_ID,
  86. (GraphicalSymbol.NAME) AS VIEW_ATTR,
  87. P_WBS.getWBSPathWithNames(PdTrfDay.wbs_Id) AS VIEW_ATTR,
  88. P_WBS.getWBSPathWithREF_number(PdTrfDay.WBS_ID) AS VIEW_ATTR,
  89. P_WBS.getWBSPathWithShortName(PdTrfDay.WBS_ID) AS VIEW_ATTR,
  90. (PDDAY.WORK_LOCATION_CITY) AS VIEW_ATTR,
  91. (PDDAY.MEETING_POINT_CITY) AS VIEW_ATTR,
  92. (PDDAY.PLANNED_WORK_DURATION) AS VIEW_ATTR,
  93. WorkCode.WORK_CODE_STD_TYPE_ID,
  94. PdTrfDay.HEAVY_WORK,
  95. nvl(PdTrfDay.is_exported, 'N') AS Is_Exported,
  96. P_WBS.getlvl0WbsRefNumber(PdTrfDay.WBS_ID) AS VIEW_ATTR,
  97. P_WBS.getlvl1WbsRefNumber(PdTrfDay.WBS_ID) AS VIEW_ATTR,
  98. P_WBS.getlvl2WbsRefNumber(PdTrfDay.WBS_ID) AS VIEW_ATTR,
  99. (OcAggregAdminStatus.NAME) AS VIEW_ATTR,
  100. (WorkCode.short_code) AS VIEW_ATTR,
  101. PdTrfDay.REF_NUMBER_TASK_CODE,
  102. (Vehicle1.COMPANY_NR || ' ' || Vehicle1.NUMBERPLATE) AS VIEW_ATTR,
  103. (PdTrfDay.Person_id) AS VIEW_ATTR,
  104. PdTrfDay.ORDER_NUM,
  105. PdTrfDay.EXPORT_FILE_NAME,
  106. PdTrfDay.TRF_PRICE,
  107. (WorkCode.WORK_CODE_NAME) AS VIEW_ATTR,
  108. PdTrfDay.TRF_KM_ROUTE,
  109. PdTrfDay.TRF_KM_ESTIMATED,
  110. DECODE (IVehicle.vehicle_id, NULL, DECODE (PdTrfVehicle.vehicle_id, NULL, NULL, trim(DECODE(PdTrfVehicle.company_nr, NULL, '', PdTrfVehicle.company_nr || ' - ') || PdTrfVehicle.numberplate)), trim(DECODE(IVehicle.company_nr, NULL, '', IVehicle.company_nr || ' - ') || IVehicle.numberplate)) AS VIEW_ATTR,
  111. (PDDAY.MAINTENANCE) AS VIEW_ATTR,
  112. (PDDAY.LAUNDRY) AS VIEW_ATTR,
  113. (PDDAY.DAY_JOURNEY_ROLE) AS VIEW_ATTR,
  114. (OcPoi.name) AS POI_NAME,
  115. PdTrfDay.SUBMITTED_BY_PERSON_ID,
  116. PdTrfDay.SUBMITTED_BY_DATE_DAY,
  117. PdTrfDay.VALIDATION_STATUS_ID,
  118. (OperationMode.SHORT_NAME) AS VIEW_ATTR,
  119. (OperationMode.NAME) AS VIEW_ATTR,
  120. (PDDAY.WORK_DURATION) AS VIEW_ATTR,
  121. (PDDAY.DRIVER_KM) AS VIEW_ATTR,
  122. (PDDAY.PASSENGER_KM) AS VIEW_ATTR
  123. FROM PD_TRF_DAY PdTrfDay, PERSON Person, VO_PERSON_CATEGORY VoPersonCategory, OC_POI OcPoi, OC_DAY_AGGREG OcDayAggreg, OC_AGGREG_ADMIN_STATUS OcAggregAdminStatus, OPERATION_MODE OperationMode, GU_PERSON GuPerson, WORK_CODE WorkCode, VEHICLE_OWNER VehicleOwner, PD_DAY PdDay, VEHICLE Vehicle, OF_OWNER.ACTIVITY Activity, OF_OWNER.GRAPHICAL_SYMBOL GraphicalSymbol, VEHICLE Vehicle1, VEHICLE IVehicle, VEHICLE PdTrfVehicle
  124. WHERE PdTrfDay.start_poi_id = OcPoi.poi_id (+)
  125. and PdTrfDay.oc_day_aggreg_id = OcDayAggreg.oc_day_aggreg_id (+)
  126. and PdTrfDay.OC_AGGREG_ADMIN_STATUS_ID = OcAggregAdminStatus.OC_AGGREG_ADMIN_STATUS_ID (+)
  127. and PdTrfDay.Operation_mode_id = OperationMode.Operation_mode_id (+)
  128. and PdTrfDay.work_code_id = WorkCode.work_code_id (+)
  129. and WorkCode.GRAPHICAL_SYMBOL_ID = GraphicalSymbol.GRAPHICAL_SYMBOL_ID (+)
  130. and PdTrfDay.person_id = Person.person_id
  131. and Person.Vo_Person_Category_id = VoPersonCategory.Vo_Person_Category_id
  132. and VoPersonCategory.Vehicle_owner_id = VehicleOwner.vehicle_owner_id
  133. and Person.PERSON_ID = GuPerson.PERSON_ID
  134. and PdTrfDay.date_day = PdDay.date_day
  135. and PdTrfDay.person_id = PdDay.person_id
  136. and PdTrfDay.activity_id = activity.activity_id(+)
  137. and pdday.vehicle_id = vehicle.vehicle_id (+)
  138. and pdday.vehicle2_id = vehicle1.vehicle_id (+)
  139. and PdTrfDay.TRF_I_VEHICLE_ID = IVehicle.vehicle_id (+)
  140. and PdTrfDay.VEHICLE_ID = PdTrfVehicle.VEHICLE_ID (+)
  141. and nvl (GuPerson.caw_limited, 'N') <> 'Y'
  142. and GuPerson.gui_user_id = 102594
  143. and (Person.vo_person_category_id = -1 or -1 = -1)
  144. and PdTrfDay.date_day >= to_date('08/10/2019','DD/MM/YYYY') and PdTrfDay.date_day < to_date('09/10/2019','DD/MM/YYYY')
  145. and (Person.PERSON_ID = 0 or 0 = 0)
  146. and ((nvl (PdTrfDay.TRF_DHR, 0) + nvl (PdTrfDay.TRF_PHR, 0)) > 0 or 'true' = 'true')
  147. and ('true'='true' OR TO_CHAR (PdTrfDay.date_day, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') not IN ('SAT', 'SUN')
  148. OR (nvl (PdTrfDay.TRF_DHR, 0) + nvl (PdTrfDay.TRF_PHR, 0)) > 0)
  149. and ('false' = 'false' OR OcAggregAdminStatus.name != 'Normal')
  150. and (('false' = 'false') OR (nvl(PdTrfDay.is_locked,'N')='N'))
  151. and (('false' = 'false') OR (OperationMode.OPERATION_MODE_ID=2))
  152. and ('-1' = '-1' or Person.Person_ID in (select person_id from vo_group_person where vo_group_id in ( select regexp_substr( '-1' ,'[^,]+', 1, level) from dual
  153. connect by regexp_substr( '-1', '[^,]+', 1, level) is not null )))
  154. and ('-1' = '-1' or P_WBS.getlvl0WbsRefNumber(PdTrfDay.WBS_ID) = '-1' )
  155. and Person.Vo_Person_category_id in (
  156. select VFmxPc.VO_PERSON_CATEGORY_ID from V_FMX_PC VFmxPc
  157. WHERE VFmxPc.OPERATION_CENTER_ID in
  158. (
  159. select OPERATION_CENTER_ID from GUI_USERS where GUI_USER_ID = 102594
  160. )
  161. and VFmxPc.VO_PERSON_CATEGORY_ID in (select distinct VO_PERSON_CATEGORY_ID from GU_PERSON gu, PERSON p where gu.PERSON_ID = p.PERSON_ID and gu.GUI_USER_ID = 102594)
  162. )
  163. and INSTR('0,1,2,3,4',TO_CHAR(WorkCode.WORK_CODE_STD_TYPE_ID)) > 0
  164. and INSTR('1,2,3,4,5',TO_CHAR(WorkCode.WORK_CODE_STD_CATEGORY_ID)) > 0
  165. and (('false' = 'false') OR (nvl(PdTrfDay.is_exported,'N')='N'))
  166. and ('false' = 'false' OR NVL(VoPersonCategory.IS_EXPORTED_TO_PAYROLL,'Y')='Y')
  167. and PdTrfDay.PD_TRF_DAY_ID IN (142954867,142954858,142954859,142954862,142954863,142954864,142954865)
  168. ORDER BY Person.COMPANY_NR, Person.Last_name, PdTrfDay.date_day, PdTrfDay.START_TIME, row_num;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement