18 lines
727 B
MySQL
18 lines
727 B
MySQL
|
|
CREATE OR REPLACE PROCEDURE public."Hr_S_DevelopmentPlanSync"(
|
|||
|
|
p_PlanId uuid
|
|||
|
|
)
|
|||
|
|
LANGUAGE plpgsql
|
|||
|
|
AS $$
|
|||
|
|
BEGIN
|
|||
|
|
-- 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 "Hr_T_DevelopmentPlan" dp
|
|||
|
|
SET "Status" = 'Completed', "Progress" = 100
|
|||
|
|
WHERE dp."Id" = p_PlanId AND dp."IsDeleted" = FALSE AND dp."Status" <> 'Cancelled'
|
|||
|
|
AND (dp."Status" = 'Completed' OR EXISTS (
|
|||
|
|
SELECT 1 FROM "Hr_T_TrainingParticipant" tp
|
|||
|
|
WHERE tp."TrainingId" = dp."TrainingId" AND tp."UserId" = dp."EmployeeId"
|
|||
|
|
AND tp."AttendanceStatus" = 'Attended' AND tp."IsDeleted" = FALSE));
|
|||
|
|
END
|
|||
|
|
$$;
|