Thursday, May 27, 2010

SALARY REPORT OF A FIRM

Buzz It
create table employ(empno varchar2(5),name varchar2(10),basic number(10),da
number(7),gross number(8),pf number(8),net number(8),annual number(10),tax
number(13));
insert into employ values('E101','Hasna',899563,null,null,null,null,null, null);
insert into employ values('E102','Thennal',895476,null,null,null,null,null, null);
insert into employ values('E103','Sithara',756243,null,null,null,null,null, null);
insert into employ values('E104','Sruthi',985243,null,null,null,null,null, null);
insert into employ values('E105','Meher',951543,null,null,null,null,null, null);
declare
cursor c1 is
select * from employ order by empno;
vsal c1%rowtype;
basic number;
da number;
gross number;
pf number;
net number;
annual number;
tax number;
begin
dbms_output.put_line('date:'||sysdate);
dbms_output.put_line('THE ABC PRPIVATE LIMITED');
dbms_output.put_line('SALARIES REPORT FOR THE YEAR 2010');
dbms_output.put_line('EMPNO NAME BASIC DA GROSS PF NETSAL
ANNUALSAL TAX');
dbms_output.put_line('--------------------------');
OPEN C1;
loop
fetch c1 into vsal;
exit when c1%notfound;
vsal.da:=vsal.basic*0.4;
vsal.gross:=vsal.basic+vsal.da;
vsal.pf:=vsal.basic;
vsal.net:=vsal.gross-vsal.pf;
vsal.annual:=vsal.net*12;
if(vsal.annual<=100000) then
vsal.tax:=0;
else if(vsal.annual<=150000) then
vsal.tax:=(vsal.annual-100000)*0.1;
else if(vsal.annual<=250000) then
vsal.tax:=5000+(vsal.annual-150000)*0.2;
else
vsal.tax:=25000+(vsal.annual-100000)*0.3;
end if;
end if;
end if;
update employ set
da=vsal.da,gross=vsal.gross,pf=vsal.pf,net=vsal.net,annual=vsal.annual,tax=vsal.tax
where empno=vsal.empno;
dbms_output.put_line('vsal.empno,vsal.name,vsal.basic,vsal.da,vsal.gross,vsal.pf,vs
al.net ,vsal.annual,vsal.tax');
end loop;
close c1;
dbms_output.put_line('---------------');
dbms_output.put_line('tax');
end;
/

OUTPUT

----- ---------- --------- --------- --------- --------- --------- --------- ------------------ -----------------
EMPNO NAME BASIC DA GROSS PF NET ANNUAL TAX
----- ---------- --------- --------- --------- --------- --------- --------- ------------------ ------------
E101 Hasna 899563 359825 1259388 899563 359825 4317900 1290370
E102 Thennal 895476 358190 1253666 895476 358190 4298280 1284484
E103 Sithara 756243 302497 1058740 756243 302497 3629964 1083989
E104 Sruthi 985243 394097 1379340 985243 394097 4729164 1413749
E105 Meher 951543 380617 1332160 951543 380617 4567404 1365221
---- ---------- --------- --------- --------- --------- --------- --------- ------------------ -----------------

0 comments:

Post a Comment