psi_mmobile

Untitled

Jul 7th, 2026
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.21 KB | None | 0 0
  1. SELECT
  2. GenericEvent.COST,
  3. GenericEvent.CREATION_DATE,
  4. GenericEvent.GE_COMMENT,
  5. GenericEvent.GE_DATE,
  6. GenericEvent.GE_HR,
  7. GenericEvent.GE_KM,
  8. GenericEvent.GE_TYPE_ID,
  9. GenericEvent.GENERIC_EVENT_ID,
  10. GenericEvent.GUI_USER_ID,
  11. GenericEvent.LM_COMMENT,
  12. GenericEvent.LM_DATE,
  13. GenericEvent.LM_NAME,
  14. GenericEvent.NAME,
  15. GenericEvent.poi_id,
  16. GenericEvent.SHORT_NAME,
  17. null vehicle_id,
  18. GenericEvent.wbs_id,
  19. Person.person_id,
  20. (Person.LAST_NAME || ' ' || Person.FIRST_NAME) person_name,
  21. vopc.name category_name,
  22. vopc.graphical_symbol,
  23. P_WBS.getWbsName(GenericEvent.wbs_id, GenericEvent.POI_ID) wbs_name,
  24. (GuiUsers.LAST_NAME || ' ' || GuiUsers.FIRST_NAME) user_full_name,
  25. GenericEvent.REF_NUMBER,
  26. GenericEvent.GE_TYPE_STATUS_ID,
  27. null vehicle_name,
  28. null object_id,
  29. null object_name,
  30. GeTypeStatus.ICON_NAME status_icon,
  31. GenericEvent.IS_PAID,
  32. VoTin.Tin vo_tin_tin,
  33. VoTin.Real_Employer_Name vo_tin_real_employer_name,
  34. poi.short_name poi_short_name,
  35. poi.name poi_name
  36. from
  37. generic_event GenericEvent,
  38. person Person,
  39. gu_person GuPerson,
  40. ge_type_status GeTypeStatus,
  41. vo_tin VoTin,
  42. vo_person_category vopc,
  43. gui_users GuiUsers,
  44. oc_poi poi
  45. where
  46. GenericEvent.person_id = GuPerson.person_id
  47. and GuPerson.gui_user_id = GuiUsers.gui_user_id
  48. and GuiUsers.gui_user_id = :gui_user_id
  49. and GuPerson.person_id = Person.person_id
  50. and Person.vo_person_category_id = vopc.vo_person_category_id
  51. and Person.REAL_EMPLOYER_TIN = VoTin.TIN (+)
  52. AND vopc.vehicle_owner_id = VoTin.vehicle_owner_id(+)
  53. AND GenericEvent.GE_DATE between trunc(sysdate - 1) AND trunc(sysdate + 1)
  54. and GenericEvent.ge_type_status_id = GeTypeStatus.ge_type_status_id(+)
  55. and nvl(vopc.is_active, 'Y') = 'Y'
  56. and GenericEvent.poi_id = poi.poi_id(+)
  57. and Person.person_status_id = 0
  58. union all
  59. SELECT
  60. GenericEvent.COST,
  61. GenericEvent.CREATION_DATE,
  62. GenericEvent.GE_COMMENT,
  63. GenericEvent.GE_DATE,
  64. GenericEvent.GE_HR,
  65. GenericEvent.GE_KM,
  66. GenericEvent.GE_TYPE_ID,
  67. GenericEvent.GENERIC_EVENT_ID,
  68. GenericEvent.GUI_USER_ID,
  69. GenericEvent.LM_COMMENT,
  70. GenericEvent.LM_DATE,
  71. GenericEvent.LM_NAME,
  72. GenericEvent.NAME,
  73. GenericEvent.poi_id,
  74. GenericEvent.SHORT_NAME,
  75. Vehicle.vehicle_id,
  76. GenericEvent.wbs_id,
  77. null person_id,
  78. null person_name,
  79. vovc.name category_name,
  80. vovc.graphical_symbol,
  81. P_WBS.getWbsName(GenericEvent.wbs_id, GenericEvent.POI_ID) wbs_name,
  82. (GuiUsers.LAST_NAME || ' ' || GuiUsers.FIRST_NAME) user_full_name,
  83. GenericEvent.REF_NUMBER,
  84. GenericEvent.GE_TYPE_STATUS_ID,
  85. (Vehicle.COMPANY_NR || ' ' || Vehicle.NUMBERPLATE) vehicle_name,
  86. null object_id,
  87. null object_name,
  88. GeTypeStatus.ICON_NAME status_icon,
  89. GenericEvent.IS_PAID,
  90. null vo_tin_tin,
  91. null vo_tin_real_employer_name,
  92. poi.short_name poi_short_name,
  93. poi.name poi_name
  94. from
  95. generic_event GenericEvent,
  96. vehicle Vehicle,
  97. gu_vehicle GuVehicle,
  98. ge_type_status GeTypeStatus,
  99. vo_vehicle_category vovc,
  100. gui_users GuiUsers,
  101. oc_poi poi
  102. where
  103. GenericEvent.vehicle_id = GuVehicle.vehicle_id
  104. and GuVehicle.gui_user_id = GuiUsers.gui_user_id
  105. and GuiUsers.gui_user_id = :gui_user_id
  106. and GuVehicle.vehicle_id = Vehicle.vehicle_id
  107. and Vehicle.vo_vehicle_category_id = vovc.vo_vehicle_category_id
  108. AND GenericEvent.GE_DATE between trunc(sysdate - 1) AND trunc(sysdate + 1)
  109. and GenericEvent.ge_type_status_id = GeTypeStatus.ge_type_status_id(+)
  110. and nvl(vovc.is_active, 'Y') = 'Y'
  111. and nvl(vovc.is_object, 'N') = 'N'
  112. and GenericEvent.poi_id = poi.poi_id(+)
  113. union all
  114. SELECT
  115. GenericEvent.COST,
  116. GenericEvent.CREATION_DATE,
  117. GenericEvent.GE_COMMENT,
  118. GenericEvent.GE_DATE,
  119. GenericEvent.GE_HR,
  120. GenericEvent.GE_KM,
  121. GenericEvent.GE_TYPE_ID,
  122. GenericEvent.GENERIC_EVENT_ID,
  123. GenericEvent.GUI_USER_ID,
  124. GenericEvent.LM_COMMENT,
  125. GenericEvent.LM_DATE,
  126. GenericEvent.LM_NAME,
  127. GenericEvent.NAME,
  128. GenericEvent.poi_id,
  129. GenericEvent.SHORT_NAME,
  130. null vehicle_id,
  131. GenericEvent.wbs_id,
  132. null person_id,
  133. null person_name,
  134. vooc.name category_name,
  135. vooc.graphical_symbol,
  136. P_WBS.getWbsName(GenericEvent.wbs_id, GenericEvent.POI_ID) wbs_name,
  137. (GuiUsers.LAST_NAME || ' ' || GuiUsers.FIRST_NAME) user_full_name,
  138. GenericEvent.REF_NUMBER,
  139. GenericEvent.GE_TYPE_STATUS_ID,
  140. null vehicle_name,
  141. GenericEvent.object_id,
  142. NVL2(Object.vehicle_id, '['|| Object.COMPANY_NR || '].[' || Object.NUMBERPLATE || ']', NULL) object_name,
  143. GeTypeStatus.ICON_NAME status_icon,
  144. GenericEvent.IS_PAID,
  145. null vo_tin_tin,
  146. null vo_tin_real_employer_name,
  147. poi.short_name poi_short_name,
  148. poi.name poi_name
  149. from
  150. generic_event GenericEvent,
  151. vehicle Object,
  152. gu_vehicle GuObject,
  153. ge_type_status GeTypeStatus,
  154. vo_vehicle_category vooc,
  155. gui_users GuiUsers,
  156. oc_poi poi
  157. where
  158. GenericEvent.vehicle_id = GuObject.vehicle_id
  159. and GuObject.gui_user_id = GuiUsers.gui_user_id
  160. and GuiUsers.gui_user_id = :gui_user_id
  161. and GuObject.vehicle_id = Object.vehicle_id
  162. and Object.vo_vehicle_category_id = vooc.vo_vehicle_category_id
  163. AND GenericEvent.GE_DATE between trunc(sysdate - 1) AND trunc(sysdate + 1)
  164. and GenericEvent.ge_type_status_id = GeTypeStatus.ge_type_status_id(+)
  165. and nvl(vooc.is_active, 'Y') = 'Y'
  166. and nvl(vooc.is_object, 'N') = 'Y'
  167. and GenericEvent.poi_id = poi.poi_id(+)
  168. union all
  169. SELECT
  170. GenericEvent.COST,
  171. GenericEvent.CREATION_DATE,
  172. GenericEvent.GE_COMMENT,
  173. GenericEvent.GE_DATE,
  174. GenericEvent.GE_HR,
  175. GenericEvent.GE_KM,
  176. GenericEvent.GE_TYPE_ID,
  177. GenericEvent.GENERIC_EVENT_ID,
  178. GenericEvent.GUI_USER_ID,
  179. GenericEvent.LM_COMMENT,
  180. GenericEvent.LM_DATE,
  181. GenericEvent.LM_NAME,
  182. GenericEvent.NAME,
  183. GenericEvent.poi_id,
  184. GenericEvent.SHORT_NAME,
  185. null vehicle_id,
  186. GenericEvent.wbs_id,
  187. null person_id,
  188. null person_name,
  189. vowc.name category_name,
  190. vowc.graphical_symbol,
  191. P_WBS.getWbsName(GenericEvent.wbs_id, GenericEvent.POI_ID) wbs_name,
  192. (GuiUsers.LAST_NAME || ' ' || GuiUsers.FIRST_NAME) user_full_name,
  193. GenericEvent.REF_NUMBER,
  194. GenericEvent.GE_TYPE_STATUS_ID,
  195. null vehicle_name,
  196. null object_id,
  197. null object_name,
  198. GeTypeStatus.ICON_NAME status_icon,
  199. GenericEvent.IS_PAID,
  200. null vo_tin_tin,
  201. null vo_tin_real_employer_name,
  202. poi.short_name poi_short_name,
  203. poi.name poi_name
  204. from
  205. generic_event GenericEvent,
  206. vehicle Object,
  207. v_gui_user_oc_poi vguop,
  208. ge_type_status GeTypeStatus,
  209. vo_wbs_category vowc,
  210. gui_users GuiUsers,
  211. oc_poi poi,
  212. wbs Wbs,
  213. gu_wbs GuWbs
  214. where
  215. GenericEvent.poi_id = vguop.poi_id
  216. and vguop.gui_user_id = GuiUsers.gui_user_id
  217. and GuiUsers.gui_user_id = :gui_user_id
  218. and vguop.poi_id = poi.poi_id
  219. and GenericEvent.wbs_id = GuWbs.wbs_id
  220. and GuWbs.gui_user_id = GuiUsers.gui_user_id
  221. and GuWbs.wbs_id = Wbs.wbs_id
  222. and Wbs.vo_wbs_category_id = vowc.vo_wbs_category_id
  223. AND GenericEvent.GE_DATE between trunc(sysdate - 1) AND trunc(sysdate + 1)
  224. and GenericEvent.ge_type_status_id = GeTypeStatus.ge_type_status_id(+);
Advertisement
Add Comment
Please, Sign In to add comment