---
# System prepended metadata

title: Resignation System New Project
tags: [ResignReader-CenterDirector/EVP, ResignRoles]

---

---
title: 'Resignation System New Project'
disqus: hackmd
---

PRD-Resign Reader-Center Director/EVP in Resignation System, EIP
===

## Table of Contents

[TOC]

# Project Overview
| Item | Content | 
| ------| ------|
| Project Name | New Resign Role: Resign Reader-Center Director/EVP|
| System | [EIP]  Resignation System |
| Phase |   Phase 2  Optimization |
| Requester| Human Resource Division|
| Project Owner| Project Management Dept., IS Center|
|Developers| AIT Dept., IS Center|
| Issue date| 2024.05|

## Functional Map


## Requests

1. Create a new role named **Resign Reader-Center Director/EVP**
    * It contains **Center Directors** of all Centers and their **approval superior officers, EVP**.
    * Sysem auto-generate and update user list of role every day according to company's policy and sign-off process.
2. Data Privilege 
    * Only view the applications of resigners who were and who are within the Center Directors or EVP's current approval privileges.
        * Can view all of the **unclosed** and **closed** applications.
        * Can view all 6 kinds of resignation types.
        * Can view the canceled applications.
        * Can view the history data.
    * Only view the **unclosed application** if the application is or was signed by the role but it isn't or wasn't within current approval rights.
3. Functions and pages Privilege 
    * Can access **Resign Inquiry** page.
    * Cannot access **Leave Without Pay** page. 
    * Can view all columns of data table.
    * Cannot view the button of **Add application**, **Setting** or **Activate Unpaid leave letter**.
    * Can view the whole **Seach Bar** and **Check Detail** buttons. 
    * Can view all tabs and buttons except for **Contact data** when it is not the application form of the role it self.
    * Only view **Form Status** tab and **Checklist** button when it comes to the application form of the role it self.
7. have special rights on **Resign Interview Record** page.
8. Detail please refer to User stories.


User story
---

```gherkin
Feature: Resign Inquiry Page

As a Resign Reader-Center Director/EVP,
I want to see the link of Resign Inquiry Page on EIP,
so that I can access to it not just via mail.
```
```gherkin
Feature: Data Privilege
 
As a Resign Reader-Center Director/EVP,
I want to see all applications of my subordinate and pre-approval department,
so that I can review all data as I can.
```
```gherkin
Feature: Search bar on Resign Inquiry Page

As a Resign Reader-Center Director/EVP,
I want to see the link of Resign Inquiry Page on EIP,
so that I can access to it not just via mail.
```

  Scenario: User enter Resign Iquiry
    Given I'm a logged-in Center Director/EVP
    When I go to Resign Inquiry page
    Then "search bar", "data table" and "checkDetail" should show up
    And data includes my subordinates & departments
    And I can see all table columns and cells



# Data


Definition of Center Director and EVP
--

Based on the latest announcement regarding to staff adjustment  or organization adjustment.

Anyone who is 授權, 預審.

| Item | Content | 
| ------| ------|
| Center Director | Head of Centers (本部正主管) <br> * Excludes deputies of centers.| 
|EVP | ==Approval superior officers== of center directors who approve applications prior to the chairman / general manager.|   

Data Resource 
--
AOA02.FLOW

:::info
EIP update user and role list every day.
:::
## Step 1. Find out who the CenterDirector and EVP are

### 1-1. Find Center Directors
> Heads of all Centers --> Boss in v.RPA_DEPT_BOSS & unitlevel = '3' (本部)
> 
```sql
SELECT BOSS_NO AS CenterDirector_No,
       BOSS_CNAME AS CenterDirector
FROM   RPA_DEPT_BOSS rdb
WHERE  UNITLEVEL ='3'
```

### 1-2. Find EVP
> * The person who approves prior to Chairman but after Center Directors.
> * Cannot judge by Job Title. Not always be 執行副總.
> * Find it from **Direct_boss_v** or **XXAC_EIP_ROLE**.
```sql
SELECT dbv.BOSS AS EVP,
       dbv.BOSS_NAME AS EVP_NAME
  FROM DIRECT_BOSS_V dbv
 WHERE dbv.EMP_NO IN (SELECT rdb.BOSS_NO FROM RPA_DEPT_BOSS rdb WHERE UNITLEVEL = '3')
GROUP BY dbv.BOSS,
         dbv.BOSS_NAME
```

## Step 2. Find out Center Directors' ==subordinates==


```mermaid
graph TD;
XXAC_EIP_ROLE-->古中平;
古中平-->Employees;
Employees-->海外中心的人;
Employees-->Head_Of_Other_Dept;
古中平-->Departments;
Departments-->A8_研發本部;
Departments-->AH_研發一處;
Departments-->AH_研發二處;
Departments-->AH_電動動力本部_預審;
AH_電動動力本部_預審-->AH_電動動力本部_授權;
AH_電動動力本部_授權-->AH_DQ課;
AH_電動動力本部_授權-->AH_;
```

### 2-1. Find Center Directors' subordinate employees

Case 1: Emilly -> Irene -> Thomas
![image](https://hackmd.io/_uploads/BJOFuQ4N0.png)

Case 2: 林泰岑

![image](https://hackmd.io/_uploads/r1jDt7440.png)


> * Some of them are not in the Center which CenterDirector is in charge of.
> * Some of them are in overseas departments.
> * 不能用古忠平的 ROLID 去 DIRECT_BOSS_V 找 Dept_Cname。下屬吳維廷不應該在電動動力本部的層級，可能一人課室問題？
> * 另外，直屬有海外中心-東莞109356、910130，但古忠平不是海外中心的主管，要用 EMP_ID 才找得到。所以要從「人」開始找。(XXAC_EIP_ROLE)


### 2-2. Find Center Directors' subordinate departments

:::info
這是警告區塊
:::

## Step 3. Find out EVP's ==subordinates==
> Since EVP is the superior to Center Directors, EVP's privilege includes Center Directors' all subordinates too.
> Other employees (e.g.張羽坊)
### 3-1. Find out EVP's subordinate employees

* Center Directors
* Other places


### 3-2. Find EVP's subordinates departments

* Department: ID but get child DEPID.
```sql
SELECT EVP, EVP_NAME, EMP_NO, EMP_CNAME
FROM (
     SELECT dbv.BOSS AS EVP, dbv.BOSS_NAME AS EVP_NAME
     FROM DIRECT_BOSS_V dbv
     WHERE dbv.EMP_NO IN (SELECT rdb.BOSS_NO FROM RPA_DEPT_BOSS rdb WHERE UNITLEVEL='3')
     GROUP BY dbv.BOSS, dbv.BOSS_NAME) E
    LEFT JOIN (SELECT BOSS, EMP_No, EMP_CNAME FROM DIRECT_BOSS_V dbv)dbv ON E.EVP=dbv.BOSS
WHERE dbv.EMP_NO NOT IN ('106001')
GROUP BY EVP, EVP_NAME, EMP_NO, EMP_CNAME
ORDER BY EVP, EVP_NAME, EMP_NO, EMP_CNAME
```

XXAC_EIP_ROLE
Keep find the child-DEPID and get all ID.

## Data Table of role and their subordinates

簽過的人要留著，而且可能是海外中心的人，他們的部門代碼不在此表。
簽過的部門若不在現行權限範疇，e.g. 部門已死、部門調去其他本部，該如何處置？

==2 cases: ROLID / DEPID which we can trust?==

| CenterEVP | Subordinate | 
| --------- | -----------|
|   109015  | DEP17181514775373398 |

Once the department ID is expired (END DATE != 2099/12/31), it is out of our scope.

| Resigner ID | DEPID / ROLID | 
| --------- | --------------|
|111125|DEP17181514775373398|


###### tags: `ResignRoles` `ResignReader-CenterDirector/EVP`
