1
|
USE [Bintang_Prod]
|
2
|
GO
|
3
|
/****** Object: StoredProcedure [dbo].[empnewhiring] Script Date: 11/18/2021 2:26:43 PM ******/
|
4
|
SET ANSI_NULLS ON
|
5
|
GO
|
6
|
SET QUOTED_IDENTIFIER ON
|
7
|
GO
|
8
|
ALTER proc [dbo].[empnewhiring] as
|
9
|
|
10
|
begin
|
11
|
|
12
|
|
13
|
|
14
|
DECLARE @now VARCHAR(8) = dbo.fn_formatdatetime(GETDATE(), 'yyyymmdd')
|
15
|
--set @now='20211122'
|
16
|
DECLARE @mail VARCHAR(MAX)=(SELECT val1 FROM base_cust_parameter WHERE param ='BASE_CUST_PUSH_MAIL_HIRING' )
|
17
|
|
18
|
|
19
|
SELECT DISTINCT md01.full_name,md01.nick_name,objo.[description] + ' - ' + obcs.[description] as [description] , obj.[description] + ' - ' + obcs.[description] as [description] ,(dbo.fn_formatdatetime(GETDATE(), 'dd mmmm yyyy')) as tanggal ,
|
20
|
--md12.comm_description,
|
21
|
'employee@asuransibintang.com' as comm_description,
|
22
|
|
23
|
dbo.fn_formatdatetime(md01.birth_date,'dd/mmmm/yyyy'),md12a.comm_description FROM hr_md_emp_md0001 md01
|
24
|
LEFT JOIN hr_md_emp_md0002 md02 on md01.emp_id = md02.emp_id and md02.end_date='99991231'
|
25
|
and md02.start_date = @now
|
26
|
and md02.movement_type='01'
|
27
|
LEFT JOIN hr_md_emp_md0002 md022 on md022.end_date='99991231' and md022.employee_status='01'
|
28
|
LEFT JOIN hr_md_emp_md0012 md12 ON md022.emp_id = md12.emp_id
|
29
|
and md12.comm_type='04'
|
30
|
|
31
|
LEFT JOIN hr_md_emp_md0012 md12a ON md02.emp_id = md12a.emp_id
|
32
|
and md12a.comm_type='04'
|
33
|
LEFT JOIN base_cust_ref_emp_office offs on md02.employee_office = offs.emp_subarea
|
34
|
LEFT JOIN hr_md_orm_object obj on md02.position = obj.object and obj.class='P'
|
35
|
and obj.end_date='99991231'
|
36
|
LEFT JOIN hr_md_orm_object objo on md02.organization = objo.object and objo.class='O'
|
37
|
and objo.end_date='99991231'
|
38
|
LEFT JOIN hr_md_orm_object obcs on md02.costcenter = obcs.object and obcs.class='CC'
|
39
|
and obcs.end_date='99991231'
|
40
|
|
41
|
|
42
|
|
43
|
|
44
|
|
45
|
WHERE md02.start_date = @now
|
46
|
and md02.movement_type='01'
|
47
|
and md12.comm_description IS NOT NULL
|
48
|
end
|