Advertisement
psi_mmobile

Untitled

Feb 12th, 2021
1,268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 2.99 KB | None | 0 0
  1. -- #1
  2.  
  3.   SELECT gu.gui_user_id,TRUNC(touserdate(sot.work_date,oc.timezone)) AS DAY_OF_WEEK,COUNT(*) AS NUMBER_OF_SOT
  4.   FROM social_office_transaction sot, gu_person gp, person p, gui_users gu, operation_center oc, vo_person_category vopc
  5.   WHERE gu.gui_user_id = gp.gui_user_id
  6.   AND gp.person_id = p.person_id
  7.   AND p.person_id = sot.person_id
  8.   AND gu.operation_center_id = oc.operation_center_id
  9.   AND sot.work_date BETWEEN TRUNC(toutcdate(SYSDATE,'iw'),oc.timezone) AND TRUNC(toutcdate(SYSDATE,'iw'),oc.timezone) + 6
  10.   AND p.person_status_id = 0
  11.   AND p.vo_person_category_id = vopc.vo_person_category_id
  12.   AND NVL(vopc.is_active,'Y') = 'Y'
  13.   AND gu.user_admin_right != 'MF'
  14.   GROUP BY gu.gui_user_id,TRUNC(touserdate(sot.work_date,oc.timezone));
  15.  
  16. -- #2
  17.   SELECT gu.gui_user_id,TO_CHAR(TRUNC(touserdate(vd.gps_full_date,oc.timezone),'HH'),'dd/mm/yyyy HH24:MI') AS REPORTED_BY_HOUR, COUNT(vd.vehicle_data_id) AS NUMBER_OF_BADGES
  18.   FROM gui_users gu,operation_center oc, gu_vehicle guv, vehicle v, vo_vehicle_category vovc, vehicle_data vd
  19.   WHERE gu.operation_center_id = oc.operation_center_id
  20.   AND gu.gui_user_id = guv.gui_user_id
  21.   AND guv.vehicle_id = v.vehicle_id
  22.   AND v.vehicle_id = vd.vehicle_id
  23.   AND v.vo_vehicle_category_id = vovc.vo_vehicle_category_id
  24.   AND NVL(vovc.is_active,'Y') = 'Y'
  25.   AND NVL(v.vehicle_status_id,0) = 0
  26.   AND vd.event_type_id = 103
  27.   AND gu.user_admin_right != 'MF'
  28.   AND vd.date_day = TRUNC(toutcdate(SYSDATE,oc.timezone))
  29.   GROUP BY gu.gui_user_id,TRUNC(touserdate(vd.gps_full_date,oc.timezone),'HH');
  30.  
  31. -- #3
  32.  
  33. SELECT gu.gui_user_id, ptd.date_day AS WORK_DATE, TRIM(TO_CHAR(NVL(SUM(ptd.TRF_DHR),0), '999990.99')) AS WORKED_HOURS
  34. FROM gui_users gu, gu_person gp, person p, vo_person_category vopc, pd_trf_day ptd, work_code wc
  35. WHERE gu.gui_user_id = gp.gui_user_id
  36. AND gp.person_id = p.person_id
  37. AND p.person_id = ptd.person_id
  38. AND ptd.work_code_id = wc.work_code_id
  39. AND (wc.work_code_std_type_id = 1 OR wc.work_code_std_category_id = 1)
  40. AND p.vo_person_category_id = vopc.vo_person_category_id
  41. AND p.person_status_id = 0
  42. AND NVL(vopc.is_active,'Y') = 'Y'
  43. AND NVL(wc.is_active,'Y') = 'Y'
  44. AND gu.user_admin_right != 'MF'
  45. AND ptd.date_day BETWEEN TRUNC(SYSDATE,'iw') AND TRUNC(SYSDATE,'iw') + 6
  46. GROUP BY gu.gui_user_id,ptd.date_day;
  47.  
  48.  
  49. -- #4
  50.   SELECT gu.gui_user_id,wc.short_code,wc.work_code_name AS WORK_CODE, SUM(ptd.trf_dhr) AS WORKED_HOURS
  51.   FROM gui_users gu, gu_person gp, person p, vo_person_category vopc, pd_trf_day ptd, work_code wc
  52.   WHERE gu.gui_user_id = gp.gui_user_id
  53.   AND gp.person_id = p.person_id
  54.   AND p.person_id = ptd.person_id
  55.   AND ptd.work_code_id = wc.work_code_id
  56.   AND (wc.work_code_std_type_id = 1 OR wc.work_code_std_category_id = 1)
  57.   AND p.vo_person_category_id = vopc.vo_person_category_id
  58.   AND p.person_status_id = 0
  59.   AND NVL(vopc.is_active,'Y') = 'Y'
  60.   AND NVL(wc.is_active,'Y') = 'Y'
  61.   AND gu.user_admin_right != 'MF'
  62.   AND TRUNC(ptd.date_day,'mm') = TRUNC(SYSDATE,'mm')
  63.   GROUP BY gu.gui_user_id,wc.short_code,wc.work_code_name;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement