sozsoft-platform/configs/seeds/sql/object/Hr_S_DevelopmentPlanSync.sql
2026-10-05 15:58:59 +03:00

18 lines
No EOL
710 B
Transact-SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE OR ALTER PROCEDURE [dbo].[Hr_S_DevelopmentPlanSync]
@PlanId uniqueidentifier
AS
BEGIN
SET NOCOUNT ON;
-- Eğitim aksiyonu, çalışan o eğitime "Katıldı" olarak işlendiyse kendiliğinden tamamlanır;
-- tamamlanan aksiyonun ilerlemesi her zaman %100'dür.
UPDATE dp
SET Status = N'Completed', Progress = 100
FROM Hr_T_DevelopmentPlan dp
WHERE dp.Id = @PlanId AND dp.IsDeleted = 0 AND dp.Status <> N'Cancelled'
AND (dp.Status = N'Completed' OR EXISTS (
SELECT 1 FROM Hr_T_TrainingParticipant tp
WHERE tp.TrainingId = dp.TrainingId AND tp.UserId = dp.EmployeeId
AND tp.AttendanceStatus = N'Attended' AND tp.IsDeleted = 0));
END
GO