Click here to Skip to main content
15,896,153 members

Comments by Mohd Arif Khan (Top 48 by date)

Mohd Arif Khan 17-Dec-13 0:29am View    
hii,Tadit
after doing this the same problem its happening like A->B->C->D->E respectively these are child in alphabetical order when E registered the money earned by D is suppose 5000. and and C gets 2000 so the new amount for C is 7000 at this level it's ok, when B's amount just become 13000 to 21000, m not not how it's value get so much. and after this no level value is modifying.
Mohd Arif Khan 16-Dec-13 5:56am View    
have a look to the flow but it could not update the 3rd level and one more thing on 2nd level it's updating the value by awkward way
Mohd Arif Khan 16-Dec-13 5:53am View    
declare @nextparent varchar(20)
declare @money decimal(18,0)
if(@bookingamt<=25000)
set @money=1000
else
set @money=2000

insert into tbl_level(Parentid,childid,rewardpoint,earnedmoney,noofchild) values(@parentkey,@CusId,1,convert(decimal,(@BookingAmt/10)),1)
if exists (select 1 from tbl_level where childid=@parentkey)
begin

select @nextParent=parentid from tbl_level where childid=@parentkey

update tbl_level set earnedmoney+=@money where parentid=(select Parentid from tbl_level where Childid=@parentkey)

if exists (select 1 from tbl_level where childid=@nextParent)
begin
select @nextParent=childid from tbl_level where childid=@nextParent

update tbl_level set earnedmoney= earnedmoney+@money where parentid=(select Parentid from tbl_level where Childid=@nextParent)
end
if exists (select 1 from tbl_level where childid=@nextParent)
begin
select @nextParent=childid from tbl_level where childid=@nextParent

update tbl_level set earnedmoney= earnedmoney+@money where parentid=(select Parentid from tbl_level where Childid=@nextParent)
end
if exists (select 1 from tbl_level where childid=@nextParent)
begin
select @nextParent=childid from tbl_level where childid=@nextParent

update tbl_level set earnedmoney= earnedmoney+@money where parentid=(select Parentid from tbl_level where Childid=@nextParent)
end
if exists (select 1 from tbl_level where childid=@nextParent)
begin
select @nextParent=childid from tbl_level where childid=@nextParent

update tbl_level set earnedmoney= earnedmoney+@money where parentid=(select Parentid from tbl_level where Childid=@nextParent)
end
end
Mohd Arif Khan 16-Dec-13 5:51am View    
i understand and did the same brother but it's not going to update the upper level.
Mohd Arif Khan 16-Dec-13 5:06am View    
hello Tadit, i'hv applied it but it's just updating upto one level