payroll management system in c++

Payroll Management System 


 /*
 $*$*$*$*$*$*$*$*$*$*$*$*$*$*$$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$

Program Title : PayRoll Mangement Software
Programmer    :ess dee

 $*$*$*$*$*$*$*$*$*$*$*$*$*$*$$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$
 */

 #include<iostream.h>
 #include<string.h>
 #include<fstream.h>
 #include<conio.h>
 #include<dos.h>
 #include<process.h>


 int password(char pass[20])
 {
if(strcmp(pass,"galaxy")==0)
return 1;
else
return 0;
 }


 struct roll
{
char na[20],des[20];
int co;
float sal,tax,hra,gr,da,np;
}oll;
 fstream pay;
 char c;
 int l;
 char choice;
 void start()
 {
clrscr();
gotoxy(7,8);
delay(300);
cout<<"**************       PAYROLL MANAGEMENT SYSTEM       ******************";
gotoxy(7,10);
delay(300);
cout<<"****************       APPLICATION SOFTWARE        ********************";
gotoxy(7,12);
delay(300);
cout<<"******************         DEVELOPED BY          **********************";
gotoxy(7,14);
delay(300);
cout<<"********************          Ess              ************************";
gotoxy(7,16);
delay(300);
cout<<"**********************         AND           **************************";
gotoxy(7,18);
delay(300);
cout<<"************************         Dee      ****************************";
gotoxy(7,19);
delay(300);
gotoxy(25,50) ;
cout<<"PRESS ANY KEY TO CONTINUE......";
getch();
 }
 void main()
 {
clrscr();
textcolor(14);
textbackground(1);
char pass[20];
int i=0;
gotoxy(30,25);
cout<<"ENTER PASSWORD : ";
do
{
pass[i]=getch();
cout<<"*";
i++;
} while(pass[i-1]!=13);
pass[i-1]='\0';
int pass_return=password(pass);
clrscr();
gotoxy(30,25);
cout<<"LOADING ";
for(int g=0;g<8;g++)
{
delay(300);
cout<<".";
}
clrscr();
if(pass_return==0)
{
gotoxy(30,25);
cout<<"PASSWORD NOT MATCHED";
getch();
exit(0);
}
else
{
gotoxy(30,25);
cout<<"PASSWORD MATCHED" ;
getch();
}
clrscr();
gotoxy(34,8);
delay(300);
cout<<" W E L C O M E ";
gotoxy(39,12);
delay(300);
cout<<" T O ";
gotoxy(15,16);
delay(300);
cout<<" P A Y R O L L    M A N A G E M E N T   S O F T W A R E ";
gotoxy(25,50);
delay(300);
cout<<" Press any key to continue....... ";
getch();
start();
do
{
clrscr();
gotoxy(10,17);
cout<<"\n\t\t\t\t    *MENU*";

cout<<"\n\n\t\t\t 1.REPORT ";

cout<<"\n\n\t\t\t 2.PAY SLIP ";

cout<<"\n\n\t\t\t 3.ADD ";

cout<<"\n\n\t\t\t 4.EXIT ";

cout<<"\n\n\t\t\t ENTER YOUR CHOICE(1,2,3,4):";
cin>>choice;
switch(choice)
{
case'1':
clrscr();
gotoxy(30,3);
cout<<" EMPLOYEE DETAILS ";
gotoxy(3,5);
cout<<"CODE";
gotoxy(10,5);
cout<<"NAME";
gotoxy(20,5);
cout<<"POST";
gotoxy(30,5);
cout<<"BASIC";
gotoxy(40,5);
cout<<"GROSS PAY";
gotoxy(52,5);
cout<<"DEDUCTION";
gotoxy(67,5);
cout<<"NET PAY";
endl;
int k=7;
pay.open("oll.dat",ios::in);
if(!pay)
{
cout<<"\n\nFile Not Found...\nProgram Terminated!";
delay(1000);
exit(0);
}
pay.seekg(0);
while(!pay.eof())
{
pay.read((char*)&oll,sizeof(oll));
if(!pay.eof())
{
gotoxy(3,k);
cout<<oll.co;
gotoxy(10,k);
cout<<oll.na;
gotoxy(20,k);
cout<<oll.des;
gotoxy(30,k);
cout<<oll.sal;
gotoxy(42,k);
cout<<oll.gr;
gotoxy(52,k);
cout<<oll.tax;
gotoxy(67,k);
cout<<oll.np;
k=k+2;
}
}
getch();
pay.close();
clrscr();
break;

case'2':
clrscr();
int eno,flag=0;
gotoxy(10,15);
cout<<"\t    Enter employee number to be searched :";
cin>>eno;
pay.open("oll.dat",ios::in);
if(!pay)
{
cout<<"\n\nFile Not Found...\nProgram Terminated!";
delay(1000);
exit(0);
}
pay.seekg(0);
while(!pay.eof())
{
pay.read((char*)&oll,sizeof(oll));
if(!pay.eof())
{
if(oll.co==eno)

   {
   endl;
   endl;
   cout<<"\n\t\t  *********************************************";
   cout<<"\n\t\t               STATE BANK OF INDIA             ";
   cout<<"\n\t\t  *********************************************";
   cout<<"\n\t\t  EMPLOYEE CODE                :"<<oll.co;
   cout<<"\n\t\t  NAME OF EMPLOYEE             :"<<oll.na;
   cout<<"\n\t\t  EMPLOYEE DESIGNATION         :"<<oll.des;
   cout<<"\n\t\t  BASIC SALARY                 :"<<oll.sal;
   cout<<"\n\t\t  DEARNESS ALLOWANCE           :"<<oll.da;
   cout<<"\n\t\t  HOUSE RENT ALLOWANCE         :"<<oll.hra;
   cout<<"\n\t\t  GROSS PAY                    :"<<oll.gr;
   cout<<"\n\t\t  TAX                          :"<<oll.tax;
   cout<<"\n\t\t  NET PAY                      :"<<oll.np;
   cout<<"\n\t\t  *********************************************";
   flag=1;
   getch();
   break;
   }
}
}
if(flag==0)
{
clrscr();
gotoxy(30,20) ;
cout<<"No such employee";
getch();
}
clrscr();
pay.close();
break;
case'3':
char ch;
pay.open("oll.dat",ios::in|ios::out|ios::app);
if(!pay)
{
cout<<"\n\nFile Not Found...\nProgram Terminated!";
delay(1000);
exit(0);
}
do
{
clrscr();
cout<<"\n\n\n\t NAME : ";
cin>>oll.na;
cout<<"\n\n\t EMPLOYEE CODE : ";
cin>>oll.co;
cout<<"\n\n\t EMPLOYEE DESIGNATION : ";
int ch;
cout<<"\n\n\t 1.SUBSTAFF";
cout<<"\n\t 2.CLERK";
cout<<"\n\t 3.MANAGER";
cout<<"\n\n\t ENTER YOUR CHOICE (1/2/3) : ";
cin>>ch;
switch(ch)
{
case 1:
oll.sal=1000;
oll.hra=100;
oll.da=oll.sal*1.10;
oll.tax=2*(oll.sal)/100.0;
strcpy(oll.des,"SUBSTAFF");
break;

case 2:
oll.sal=2000;
oll.hra=200;
oll.da=200;
oll.tax=10*(oll.sal)/100.0;
strcpy(oll.des,"CLERK");
break;

case 3:
oll.sal=14000;
oll.hra=400;
oll.da=400;
oll.tax=20*(oll.sal)/100.0;
strcpy(oll.des,"MANAGER");
break;

default:cout<<"\n * INPUT IS INVALID * ";
break;
}
oll.gr=oll.sal+oll.hra+oll.da;
oll.np=oll.gr-oll.tax;
pay.write((char*)&oll,sizeof(oll));
cout<<"\n\n\t TO CONTINUE ADDING DATA(Y/N):";
cin>>c;
}
while((c=='Y')||(c=='y'));
pay.close();
break;
case '4':
exit(0);
}
 }
 while(choice!=4);
 }



Post a Comment

9 Comments

  1. Hey that is the program I have been looking for since my high school time. Thank you Ess Dee for this code. I can't thank you more for this payroll program. However, I would like to have it in php format. Nevermind, I'll convert it into the same line by line.

    Regards,
    Jimmie
    Payroll Providers Guelph

    ReplyDelete
    Replies
    1. You are welcome jimmie .. :) keep visiting my blog regularly for more projects like this .. Have a nice day .. :)

      Delete
    2. dont forget to follow my blog .. :)

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This code was very difficult to understand.....!!!
    Payroll Processing Services

    ReplyDelete
  4. Once they are ready to make payroll, they will be responsible for any of the wage issue to the preservation of society, aloes database payroll and ensure that company employees pay their history and their access to tax information at will. payroll and hr services for small business

    ReplyDelete
  5. tanq 4 it
    but i need the same code using classes and objects

    ReplyDelete