CREATE TABLE [dbo].[tbl_stud_attendance](
[acd_yr] [varchar](15) NULL,
[std] [varchar](10) NULL,
[sec] [varchar](10) NULL,
[rollno] [int] NULL,
[cmonth] [varchar](20) NULL,
[d1] [decimal](18, 2) NULL,
[d2] [decimal](18, 2) NULL,
[d3] [decimal](18, 2) NULL,
[d4] [decimal](18, 2) NULL,
[d5] [decimal](18, 2) NULL,
[d6] [decimal](18, 2) NULL,
[d7] [decimal](18, 2) NULL,
[d8] [decimal](18, 2) NULL,
[d9] [decimal](18, 2) NULL,
[d10] [decimal](18, 2) NULL,
[d11] [decimal](18, 2) NULL,
[d12] [decimal](18, 2) NULL,
[d13] [decimal](18, 2) NULL,
[d14] [decimal](18, 2) NULL,
[d15] [decimal](18, 2) NULL,
[d16] [decimal](18, 2) NULL,
[d17] [decimal](18, 2) NULL,
[d18] [decimal](18, 2) NULL,
[d19] [decimal](18, 2) NULL,
[d20] [decimal](18, 2) NULL,
[d21] [decimal](18, 2) NULL,
[d22] [decimal](18, 2) NULL,
[d23] [decimal](18, 2) NULL,
[d24] [decimal](18, 2) NULL,
[d25] [decimal](18, 2) NULL,
[d26] [decimal](18, 2) NULL,
[d27] [decimal](18, 2) NULL,
[d28] [decimal](18, 2) NULL,
[d29] [decimal](18, 2) NULL,
[d30] [decimal](18, 2) NULL,
[d31] [decimal](18, 2) NULL,
[no_of_work] [decimal](18, 2) NULL,
[present] [decimal](18, 2) NULL,
[absent] [decimal](18, 2) NULL,
[session] [varchar](10) NULL,
[upd] [int] NULL
) ON [PRIMARY]
GO
Procedure:
create proc [dbo].[sp_stud_attendance](@acd_yr varchar(15),@std varchar(10),@sec varchar(10),@rollno int=null,@cmonth varchar(20)=null,@cdays int=null,@status decimal(18,2)=null,@session varchar(10)=null,@chk int)
as
declare @no_of_work decimal(18,2),@present decimal(18,2),@absent decimal(18,2)
declare @d decimal(18,2),@ses varchar(10),@count decimal(18,2)
begin
if(@chk=1)
begin
select r.rollno rno,t.fname name from tbl_rollno_gen as r,tbl_student as t where r.acd_yr=@acd_yr and r.std=@std and r.sec=@sec and r.adm_no=t.admno and t.active=1
end
if(@chk=2)
begin
-- test not exist here
IF NOT EXISTS (SELECT * FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
BEGIN
INSERT INTO tbl_stud_attendance VALUES(@acd_yr,@std,@sec,@rollno,@cmonth,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,null,0)
END
--////// ***** checking *********//
set @count=(select 'd'= sum(case @cdays
when 1 then d1 when 2 then d2 when 3 then d3 when 4 then d4 when 5 then d5 when 6 then d6 when 7 then d7 when 8 then d8 when 9 then d9 when 10 then d10
when 11 then d11 when 12 then d12 when 13 then d13 when 14 then d14 when 15 then d15 when 16 then d16 when 17 then d17 when 18 then d18 when 19 then d19 when 20 then d20
when 21 then d21 when 22 then d22 when 23 then d23 when 24 then d24 when 25 then d25 when 26 then d26 when 27 then d27 when 28 then d28 when 29 then d29 when 30 then d30
when 31 then d31 END) from tbl_stud_attendance where acd_yr=@acd_yr and std=@std and sec=@sec and cmonth=@cmonth)
if(@count=0 and @session='AM')
begin
UPDATE tbl_stud_attendance SET session=NULL,upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and cmonth=@cmonth
end
else if(@count=0 and @session='PM')
begin
UPDATE tbl_stud_attendance SET session='AM',upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and cmonth=@cmonth
end
-- day 1 --
if(@cdays=1)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d1=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d1=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d1 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d1=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d1=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d1=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d1=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0.5
END
end
end
end
-- day 2 --
if(@cdays=2)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d2=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d2=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d2 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d2=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d2=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d2=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d2=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0.5
END
end
end
end
-- day 3 --
if(@cdays=3)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d3=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d3=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d3 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d3=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d3=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d3=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d3=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0.5
END
end
end
end
-- day 4 --
if(@cdays=4)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d4=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d4=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d4 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d4=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d4=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d4=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d4=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0.5
END
end
end
end
-- day 5 --
if(@cdays=5)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d5=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d5=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d5 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d5=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d5=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d5=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d5=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0.5
END
end
end
end
-- day 6 --
if(@cdays=6)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d6=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d6=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d6 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d6=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d6=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d6=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d6=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0.5
END
end
end
end
-- day 7 --
if(@cdays=7)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d7=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d7=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d7 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d7=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d7=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d7=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d7=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0.5
END
end
end
end
-- day 8 --
if(@cdays=8)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d8=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d8=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d8 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d8=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d8=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d8=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d8=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0.5
END
end
end
end
-- day 9 --
if(@cdays=9)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d9=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d9=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d9 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d9=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d9=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d9=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d9=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0.5
END
end
end
end
-- day 10 --
if(@cdays=10)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d10=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d10=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d10 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d10=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d10=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d10=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d10=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0.5
END
end
end
end
-- day 11 --
if(@cdays=11)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d11=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d11=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d11 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d11=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d11=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d11=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d11=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0.5
END
end
end
end
-- day 12 --
if(@cdays=12)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d12=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d12=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d12 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d12=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d12=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d12=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d12=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0.5
END
end
end
end
-- day 13 --
if(@cdays=13)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d13=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d13=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d13 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d13=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d13=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d13=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d13=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0.5
END
end
end
end
-- day 14 --
if(@cdays=14)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d14=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d14=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d14 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d14=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d14=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d14=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d14=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0.5
END
end
end
end
-- day 15 --
if(@cdays=15)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d15=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d15=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d15 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d15=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d15=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d15=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d15=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0.5
END
end
end
end
-- day 16 --
if(@cdays=16)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d16=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d16=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d16 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d16=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d16=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d16=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d16=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0.5
END
end
end
end
-- day 17 --
if(@cdays=17)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d17=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d17=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d17 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d17=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d17=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d17=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d17=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0.5
END
end
end
end
-- day 18 --
if(@cdays=18)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d18=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d18=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d18 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d18=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d18=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d18=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d18=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0.5
END
end
end
end
-- day 19 --
if(@cdays=19)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d19=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d19=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d19 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d19=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d19=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d19=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d19=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0.5
END
end
end
end
-- day 20 --
if(@cdays=20)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d20=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d20=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d20 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d20=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d20=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d20=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d20=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0.5
END
end
end
end
-- day 21 --
if(@cdays=21)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d21=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d21=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d21 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d21=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d21=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d21=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d21=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0.5
END
end
end
end
-- day 22 --
if(@cdays=22)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d22=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d22=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d22 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d22=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d22=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d22=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d22=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0.5
END
end
end
end
-- day 23 --
if(@cdays=23)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d23=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d23=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d23 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d23=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d23=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d23=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d23=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0.5
END
end
end
end
-- day 24 --
if(@cdays=24)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d24=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d24=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d24 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d24=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d24=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d24=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d24=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0.5
END
end
end
end
-- day 25 --
if(@cdays=25)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d25=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d25=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d25 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d25=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d25=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d25=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d25=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0.5
END
end
end
end
-- day 26 --
if(@cdays=26)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d26=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d26=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d26 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d26=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d26=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d26=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d26=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0.5
END
end
end
end
-- day 27 --
if(@cdays=27)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d27=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d27=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d27 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d27=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d27=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d27=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d27=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0.5
END
end
end
end
-- day 28 --
if(@cdays=28)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d28=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d28=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d28 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d28=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d28=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d28=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d28=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0.5
END
end
end
end
-- day 29 --
if(@cdays=29)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d29=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d29=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d29 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d29=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d29=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d29=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d29=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0.5
END
end
end
end
-- day 30 --
if(@cdays=30)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d30=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d30=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d30 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d30=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d30=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d30=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d30=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0.5
END
end
end
end
-- day 31 --
if(@cdays=31)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses is NULL)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d31=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d31=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0
END
end
else if(@ses = 'AM' and @session='PM')
begin
update tbl_stud_attendance set upd=0 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @d=(SELECT d31 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@ses)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d31=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0.5
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d31=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0
END
END
else if(@d=0.5)
begin
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d31=1,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=1
END
ELSE IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d31=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0.5
END
end
end
end
end
if(@chk=3)
begin
select COUNT(distinct session) from tbl_stud_attendance where acd_yr=@acd_yr AND std=@std and sec=@sec and cmonth=@cmonth and session=@session
--select COUNT( distinct session) from tbl_stud_attendance where acd_yr='2012-2013' AND std='LKG' and sec='A' and cmonth='JUN' and session='PM'
end
if(@chk=4)
begin
if((select upd from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)=0)
begin
update tbl_stud_attendance set upd=1 WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session
-- day 1 --
if(@cdays=1)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d1 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d1=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d1=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d1 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d1=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d1=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d1=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d1=0.5
END
end
end
end
-- day 2 --
if(@cdays=2)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d2 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d2=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d2=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d2 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d2=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d2=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d2=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d2=0.5
END
end
end
end
-- day 3 --
if(@cdays=3)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d3 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d3=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d3=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d3 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d3=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d3=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d3=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d3=0.5
END
end
end
end
-- day 4 --
if(@cdays=4)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d4 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d4=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d4=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d4 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d4=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d4=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d4=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d4=0.5
END
end
end
end
-- day 5 --
if(@cdays=5)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d5 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d5=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d5=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d5 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d5=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d5=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d5=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d5=0.5
END
end
end
end
-- day 6 --
if(@cdays=6)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d6 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d6=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d6=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d6 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d6=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d6=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d6=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d6=0.5
END
end
end
end
-- day 7 --
if(@cdays=7)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d7 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d7=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d7=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d7 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d7=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d7=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d7=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d7=0.5
END
end
end
end
-- day 8 --
if(@cdays=8)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d8 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d8=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d8=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d8 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d8=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d8=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d8=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d8=0.5
END
end
end
end
-- day 9 --
if(@cdays=9)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d9 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d9=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d9=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d9 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d9=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d9=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d9=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d9=0.5
END
end
end
end
-- day 10 --
if(@cdays=10)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d10 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d10=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d10=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d10 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d10=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d10=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d10=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d10=0.5
END
end
end
end
-- day 11 --
if(@cdays=11)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d11 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d11=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d11=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d11 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d11=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d11=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d11=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d11=0.5
END
end
end
end
-- day 12 --
if(@cdays=12)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d12 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d12=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d12=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d12 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d12=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d12=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d12=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d12=0.5
END
end
end
end
-- day 13 --
if(@cdays=13)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d13 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d13=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d13=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d13 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d13=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d13=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d13=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d13=0.5
END
end
end
end
-- day 14 --
if(@cdays=14)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d14 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d14=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d14=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d14 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d14=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d14=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d14=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d14=0.5
END
end
end
end
-- day 15 --
if(@cdays=15)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d15 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d15=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d15=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d15 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d15=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d15=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d15=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d15=0.5
END
end
end
end
-- day 16 --
if(@cdays=16)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d16 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d16=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d16=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d16 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d16=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d16=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d16=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d16=0.5
END
end
end
end
-- day 17 --
if(@cdays=17)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d17 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d17=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d17=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d17 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d17=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d17=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d17=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d17=0.5
END
end
end
end
-- day 18 --
if(@cdays=18)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d18 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d18=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d18=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d18 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d18=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d18=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d18=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d18=0.5
END
end
end
end
-- day 19 --
if(@cdays=19)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d19 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d19=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d19=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d19 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d19=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d19=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d19=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d19=0.5
END
end
end
end
-- day 20 --
if(@cdays=20)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d20 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d20=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d20=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d20 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d20=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d20=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d20=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d20=0.5
END
end
end
end
-- day 21 --
if(@cdays=21)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d21 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d21=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d21=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d21 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d21=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d21=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d21=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d21=0.5
END
end
end
end
-- day 22 --
if(@cdays=22)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d22 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d22=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d22=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d22 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d22=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d22=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d22=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d22=0.5
END
end
end
end
-- day 23 --
if(@cdays=23)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d23 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d23=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d23=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d23 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d23=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d23=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d23=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d23=0.5
END
end
end
end
-- day 24 --
if(@cdays=24)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d24 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d24=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d24=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d24 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d24=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d24=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d24=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d24=0.5
END
end
end
end
-- day 25 --
if(@cdays=25)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d25 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d25=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d25=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d25 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d25=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d25=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d25=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d25=0.5
END
end
end
end
-- day 26 --
if(@cdays=26)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d26 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d26=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d26=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d26 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d26=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d26=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d26=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d26=0.5
END
end
end
end
-- day 27 --
if(@cdays=27)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d27 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d27=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d27=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d27 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d27=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d27=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d27=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d27=0.5
END
end
end
end
-- day 28 --
if(@cdays=28)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d28 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d28=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d28=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d28 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d28=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d28=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d28=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d28=0.5
END
end
end
end
-- day 29 --
if(@cdays=29)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d29 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d29=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d29=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d29 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d29=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d29=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d29=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d29=0.5
END
end
end
end
-- day 30 --
if(@cdays=30)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d30 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d30=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d30=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d30 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d30=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d30=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d30=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d30=0.5
END
end
end
end
-- day 31 --
if(@cdays=31)
begin
set @ses=(select session from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
if(@ses = 'AM' and @session='AM')
begin
SET @d=(SELECT d31 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d31=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0.5
END
END
else if(@d=0.5)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d31=@status,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0
END
end
end
if(@ses = 'PM' and @session='PM')
begin
SET @d=(SELECT d31 from tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and session=@session)
if(@d=0)
BEGIN
IF(@status=0.5)
BEGIN
UPDATE tbl_stud_attendance SET d31=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=0.5+@present ,absent=@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0.5
END
END
else if(@d=0.5)
BEGIN
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d31=0,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0
END
END
else if(@d=1)
begin
IF(@status=0)
BEGIN
UPDATE tbl_stud_attendance SET d31=0.5,session=@session WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth
SET @no_of_work=(SELECT no_of_work FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @present =(SELECT present FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)-0.5
SET @absent=(SELECT absent FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth)
UPDATE tbl_stud_attendance SET no_of_work=0.5+@no_of_work,present=@present ,absent=0.5+@absent WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and rollno=@rollno and cmonth=@cmonth and d31=0.5
END
end
end
end
select '0'
end
else
begin
select '1'
end
end
if(@chk=5)
begin
select p.emobile as fmob from tbl_rollno_gen as r,dbo.tbl_stuemergency as p,tbl_student as t where r.acd_yr=@acd_yr and r.std=@std and r.sec=@sec and r.rollno=@rollno and r.acd_yr=t.acayear and r.adm_no=t.admno and t.admno=p.admno
end
if(@chk=6)
begin
IF EXISTS (SELECT * FROM tbl_stud_attendance WHERE acd_yr=@acd_yr AND std=@std and sec=@sec and cmonth=@cmonth)
BEGIN
set @count=(select 'd'= sum(case @cdays
when 1 then d1 when 2 then d2 when 3 then d3 when 4 then d4 when 5 then d5 when 6 then d6 when 7 then d7 when 8 then d8 when 9 then d9 when 10 then d10
when 11 then d11 when 12 then d12 when 13 then d13 when 14 then d14 when 15 then d15 when 16 then d16 when 17 then d17 when 18 then d18 when 19 then d19 when 20 then d20
when 21 then d21 when 22 then d22 when 23 then d23 when 24 then d24 when 25 then d25 when 26 then d26 when 27 then d27 when 28 then d28 when 29 then d29 when 30 then d30
when 31 then d31 END) from tbl_stud_attendance where acd_yr=@acd_yr and std=@std and sec=@sec and cmonth=@cmonth)
if(@session='AM')
begin
select '0'
end
else if(@session='PM')
begin
if((@count=0) and (((select distinct session from tbl_stud_attendance where acd_yr=@acd_yr and std=@std and sec=@sec and cmonth=@cmonth)='PM') or ((select distinct session from tbl_stud_attendance where acd_yr=@acd_yr and std=@std and sec=@sec and cmonth=@cmonth)='AM')))
select '1'
else
select '0'
end
end
else
begin
if(@session='AM')
select '0'
else if(@session='PM')
select '1'
end
end
end