Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Page Properties

Summary

The view shows crew with expired current and planned activities.

Keywords

Activity

Description

The view shows crew members with expired current and planned activities.

The view checks for the current activities that remain open through the EED is in the past, and for the planned activities that remain planned though the Date From is in the past.

SQL Statement

Code Block
languagesql
SELECT 
       p01.PIN,
	   p01.Name,
       p01.Firstname  'First Name',
       p01.Lastname  'Last Name',
	   ORG.NAME 'ORG. NAME',
       c12plan.TEXT  'Activity',
       case when p03plan.PLANNED='Y' then 'Planned' else 'Current' end as 'Act.State',
       p03plan.DATEFROM  'Start Date',
       p03plan.TODATEESTIMATED  'Estimated End Date',
       plan_pos.NAME  Position,
       plan_ves.NAME Vessel,
       P01.client NUMORGID,
       p01.employmentstartdate,
       p01.employmentenddate
FROM   PW001P01 p01

       JOIN PW001P03 p03plan
            ON  p03plan.PIN = p01.PIN
       LEFT JOIN PW001C12 c12plan
            ON  c12plan.CODE = p03plan.CODE

       LEFT JOIN PWORG plan_ves
            ON  plan_ves.NUMORGID = dbo.ad_scanorgtree(p03plan.NUMORGID, 3)

       LEFT JOIN PWORG plan_pos
            ON  plan_pos.NUMORGID = p03plan.NUMORGID
            AND plan_pos.ORGTYPE = 5

		LEFT JOIN PWORG ORG ON ORG.NUMORGID=P01.CLIENT

where (p03plan.PLANNED='Y' and p03plan.datefrom<= GETDATE ()) 
	or (p03plan.datefrom <= getdate () and p03plan.dateto is NULL and p03plan.todateestimated <=  getdate ())

Field Specification

Other