Payroll Management System In C++ With Source Code
The Payroll Management System In C++ is developed in C++ programming language, This Payroll Management System C++ is easy to understand the flow and also easy to manage the step by step process of this Project With Source Code.
A Payroll Management System C++ Project features: CRUD Operation for the employee’s record, also includes a search for their information and displaying the list of all employee’s record and also includes a printable employee pay slip.
This Payroll Management System In C++ Documentation also includes a downloadable Payroll Management System C++ Source Code for free, just find the downloadable source code below and click to start downloading.
Watch the video here to see the full running Payroll Management System In C++ with Source Code.
To start creating a Payroll Management System In C++, make sure that you have code blocks or any platform of C/C++ language installed in your computer.
Steps on how to create a Payroll Management System In C++ With Source Code
Payroll Management System In C++ With Source Code
- Step 1: Create a new project.
First open the code blocks IDE and click “create a new project“.
- Step 2: Choose console application.
Second click the “console application” and after that click “next“.
- Step 3: Choose C++ language.
Third choose “C++ language” and click “next“.
- Step 4: Name Your Project.
Fourth name the project you’ve created and click “next” after that click “finish“.
- Step 5: The actual code.
You are free to copy the given source code below or download the downloadable source code given.
The Code Given Below Is For The Log In Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
void login() { char UserName[30],Password[30],ch;int i=0; gotoXY(20,10); printf("Enter UserName : "); cin>>UserName; gotoXY(20,12); cout<<"Enter Password : "; while(1) { ch = getch(); if(ch==13) break; if(ch==32||ch==9) continue; else { cout<<"*"; Password[i]=ch; i++; } } Password[i] = '\0'; if(strcmp(UserName,"admin")==0 && strcmp(Password,"password")==0) { system("cls"); loginFrame1(); gotoXY(27,10); cout<<"Login Success!!!"; gotoXY(21,12); cout<<"Will be redirected in 3 Seconds..."; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b2"; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b1"; gotoXY(56,12); Cdelay(1000); } else { system("cls"); loginFrame1(); gotoXY(27,10); printf("Access Denied!!!\a"); gotoXY(21,12); cout<<"Will be redirected in 3 Seconds..."; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b2"; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b1"; gotoXY(56,12); Cdelay(1000); system("cls"); loginFrame1(); login(); } } |
In this module which is the login module of the system.
The Code Given Below Is For The Insert Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
void insert() { borderNoDelay(); int i=num; int sal,PF,TAX,HRA,MealA,MedicalA,TransportA,LoanBal,LoanDeb,h,DA; char loan; num+=1; gotoXY(28,4); printf("Insert New Record"); gotoXY(10,6); cout<<"Name : "; //cin.getline(emp[i].name,sizeof(emp[i].name)); cin>>emp[i].name; gotoXY(10,8); cout<<"Code : "; cin>>emp[i].code; gotoXY(10,10); cout<<"Designation : "; cin>>emp[i].designation; gotoXY(10,12); cout<<"Years of Experience : "; cin>>emp[i].exp; gotoXY(10,14); cout<<"Age : "; cin>>emp[i].age; gotoXY(10,16); cout<<"Enter Working Hours : "; cin>>h; sal = h*300; emp[i].workingHours = h; do { gotoXY(10,18); cout<<"Any Loan (Y/N) ?: \b \b"; loan=getche(); if(loan=='Y'|| loan == 'y' || loan =='n' || loan == 'N') break; }while(1); if(loan=='y'|| loan=='Y') { gotoXY(10,20); cout<<"Enter Loan Balance : "; cin>>LoanBal; } else { LoanBal=0; } gotoXY(14,22); cout<<"Recorded Succesfully...!!!"; TAX = 0.04 * sal; DA = 1.20 * sal; PF = 0.12 * sal; HRA = sal * 0.27; MealA = 300; MedicalA = 300; TransportA = 300; LoanDeb = sal * 0.09; if(LoanDeb > LoanBal) { LoanBal = 0; LoanDeb = LoanBal; } emp[i].salary = sal; emp[i].DA = DA; emp[i].tax=TAX; emp[i].PF = PF; emp[i].HRA = HRA; emp[i].MealAllowance = MealA; emp[i].MedicalAllowance = MedicalA; emp[i].TransportAllowance = TransportA; emp[i].LoanBalance = LoanBal-LoanDeb; emp[i].AnyLoan = loan; emp[i].LoanDebit = LoanDeb; emp[i].grosspay = (sal+MealA+MedicalA+TransportA+HRA+DA)-(PF+TAX+LoanDeb) ; getch(); } |
In this module which is adding the record of the employees.
The Code Given Below Is For The Main Menu Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
void menu() { //system("cls"); borderNoDelay(); //gotoXY(0,0); //cout<<"Number of Records Avaliable : "<<num; gotoXY(16,4); printf("***** Payroll Management System 1.0 ***** "); gotoXY(12,6); cout<<"Press i ----> Insert New Record."; gotoXY(12,8); cout<<"Press e ----> Edit a Record."; gotoXY(12,10); cout<<"Press d ----> Delete a Record."; gotoXY(12,12); cout<<"Press s ----> Search a Record."; gotoXY(12,14); cout<<"Press l ----> List The Employee Table."; gotoXY(12,16); cout<<"Press p ----> Print Employee PaySlip."; gotoXY(12,18); cout<<"Press q ----> Quit Program."; gotoXY(16,22); cout<<"Select Your Option ====> "; } |
In this module which is the main menu of the system.
The Code Given Below Is For The Delete Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
void deletes() { for(int i=0;i<num;i++) { tempemp[i]=emp[i]; } //system("cls"); borderNoDelay(); int code; int check=-1; gotoXY(28,4); printf("Delete a Record"); gotoXY(10,6); cout<<"Enter the JobCode To Delete That Record :"; cin>>code; int i,j; for(i=0;i<=num-1;i++) { if(emp[i].code==code) { check=i; } } if(check!=-1) { for(i=0,j=0;i<=num-1;i++,j++) { if(i==check) { i++; } emp[j]=tempemp[i]; } num--; } } |
In this module which is the delete module of the system.
The Code Given Below Is For The Search Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
void search() { //system("cls"); borderNoDelay(); int jobcode; bool found = false; gotoXY(10,4); cout<<"You can Search only through the Jobcode of an Employee"; gotoXY(10,6); cout<<"Enter Code Of the Employee : "; cin>>jobcode; for(int i=0;i<=num-1;i++) { if(emp[i].code==jobcode) { gotoXY(6,8); cout<<"Name\tCode\tDesignation\tYears(EXP)\tAge\tSalary "<<endl; gotoXY(6,9); cout<<"------------------------------------------------------------------"<<endl; gotoXY(6,11); cout<<emp[i].name; gotoXY(19,11); cout<<emp[i].code; gotoXY(26,11); cout<<emp[i].designation; gotoXY(47,11); cout<<emp[i].exp; gotoXY(58,11); cout<<emp[i].age; gotoXY(66,11); cout<<emp[i].grosspay; found = true; } //else // } if(!found) { gotoXY(26,11); cout<<"No records Found...!!!\a"; } getch(); } |
In this module which is the search module of the system.
The Code Given Below Is For The Edit/Modify Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
void editmenu() { //system("cls"); borderNoDelay(); gotoXY(28,4); printf("Edit An Entry"); gotoXY(10,6); cout<<"What Do You Want To edit"; gotoXY(12,8); cout<<"n ---------> Name "; gotoXY(12,9); cout<<"c ---------> Code "; gotoXY(12,10); cout<<"d ---------> Designation"; gotoXY(12,11); cout<<"e ---------> Experience "; gotoXY(12,12); cout<<"a ---------> Age"; gotoXY(12,13); cout<<"s ---------> Salary"; gotoXY(12,14); cout<<"q ---------> QUIT"; gotoXY(10,16); cout<<"Enter Choice ---->>> "; } void editname(int i) { gotoXY(10,18); cout<<"Enter New Name-----> "; cin>>emp[i].name; } void editcode(int i) { gotoXY(10,18); cout<<"Enter New Job Code-----> "; cin>>emp[i].code; } void editdes(int i) { gotoXY(10,18); cout<<"enter new designation-----> "; cin>>emp[i].designation; } void editexp(int i) { gotoXY(10,18); cout<<"Enter new Years of Experience"; cin>>emp[i].exp; } void editage(int i) { gotoXY(10,18); cout<<"Enter new Age "; cin>>emp[i].age; } void editsalary(int i) { int sal,PF,TAX,HRA,MealA,MedicalA,TransportA,LoanBal=emp[i].LoanBalance,LoanDeb,DA; char loan; gotoXY(10,18); cout<<"Enter new Salary "; cin>>sal; DA = 1.20 * sal; TAX = 0.04 * sal; PF = 0.12 * sal; HRA = 4000; MealA = 300; MedicalA = 300; TransportA = 300; LoanDeb = sal * 0.09; if(LoanDeb > LoanBal) { LoanBal = 0; LoanDeb = LoanBal; } emp[i].salary = sal; emp[i].tax=TAX; emp[i].PF = PF; emp[i].HRA = HRA; emp[i].MealAllowance = MealA; emp[i].MedicalAllowance = MedicalA; emp[i].TransportAllowance = TransportA; emp[i].LoanBalance = LoanBal; emp[i].AnyLoan = loan; emp[i].LoanDebit = LoanDeb; emp[i].grosspay = (sal+MealA+MedicalA+TransportA+HRA+DA)-(PF+TAX+LoanDeb) ; } void edit() { //system("cls"); borderNoDelay(); int jobcode; gotoXY(28,4); printf("Edit a Record"); int i; char option; gotoXY(10,6); cout<<"Enter the jobcode To Edit : "; cin>>jobcode; editmenu(); for(i=0;i<=num-1;i++) { if(emp[i].code==jobcode) { while((option=cin.get())!='q') { switch(option) { case 'n': editname(i); break; case 'c': editcode(i); break; case 'd': editdes(i); break; case 'e': editexp(i); break; case 'a': editage(i); break; case 's': editsalary(i); break; } editmenu(); } } } } |
In this module which is the modifying module of the system.
The Code Give Below Is For Display Pay Slip Module
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
void displayPayslip() { system("cls"); borderNoDelay(); gotoXY(10,4); int code,i; cout<<"Enter Employee Job Code :"; cin>>code; for(i=0;i<=num-1;i++) { if(emp[i].code==code) { gotoXY(12,6); cout<<"Name : "<<emp[i].name; gotoXY(45,6); cout<<"Working Hours : "<<emp[i].workingHours<<" Hrs"; gotoXY(6,8); cout<<"Earnings :-"; gotoXY(8,10); cout<<"Basic Pay : "<<emp[i].salary<<endl; gotoXY(8,12); cout<<"HRA(27% of Basic): "<<emp[i].HRA<<endl; gotoXY(8,14); cout<<"DA (120% of Basic):"<<emp[i].DA; gotoXY(8,16); cout<<"Meal Allowance : "<<emp[i].MealAllowance<<endl; gotoXY(8,18); cout<<"Medical Alowance : "<<emp[i].MedicalAllowance<<endl; gotoXY(8,20); cout<<"Transport Allowance : "<<emp[i].TransportAllowance<<endl; gotoXY(40,8); cout<<"Deductions :- "<<endl<<endl; gotoXY(42,10); cout<<"PF : "<<emp[i].PF<<endl; gotoXY(42,12); cout<<"Tax : "<<emp[i].tax<<endl; gotoXY(42,14); int l = emp[i].AnyLoan; char l2 = toupper(l); cout<<"Loan Status : "<<l2<<endl; gotoXY(42,16); cout<<"Loan Debit This Month : "<<emp[i].LoanDebit<<endl; gotoXY(42,18); cout<<"Loan Balance : "<<emp[i].LoanBalance<<endl; gotoXY(32,22); cout<<"Total Gross Pay : "<<emp[i].grosspay; } } getch(); } |
In this module which is the display pay slip module of the system.
Complete Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
#include<stdio.h> #include<iostream> #include<stdlib.h> #include<string.h> #include<conio.h> #include<windows.h> #include<time.h> #include<iomanip> #include<ctype.h> #define max 50 using namespace std; int num=0; void gotoXY(int,int); void Cdelay(int); void border(int, int,int, int); void borderNoDelay(int, int,int, int); void loginFrame(int, int, int, int); void intro(); void login(); void menu(); void insert(); void edit(); void editmenu(); void editname(int); void editcode(int); void editdes(int); void editexp(int); void editage(int); void editsalary(int); void list(); void deletes(); void search(); void setWindowSize(int,int); void saverecords(); void getrecords(); bool isFilePresent(); void displayPayslip(); class employee { public: char name[20]; int code; char designation[20]; int exp; int age; int salary; char AnyLoan; int HRA; int PF; int tax; int MealAllowance; int TransportAllowance; int MedicalAllowance; int LoanBalance; int LoanDebit; int grosspay; int workingHours; int DA; }; employee emp[max],tempemp[max]; void getrecords() { FILE *fp; fp = fopen("Records.txt","r"); int c=0; if(fp!=NULL) { while(feof(fp)==0) { fscanf(fp,"%s\t%d\t%s\t%d\t%d\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",&emp[c].name,&emp[c].code,&emp[c].designation,&emp[c].exp,&emp[c].age,&emp[c].salary,&emp[c].AnyLoan,&emp[c].HRA,&emp[c].PF,&emp[c].tax,&emp[c].MealAllowance,&emp[c].TransportAllowance,&emp[c].MedicalAllowance,&emp[c].LoanBalance,&emp[c].LoanDebit,&emp[c].grosspay,&emp[c].workingHours,&emp[c].DA); c++; } num=c; } fclose(fp); } void saverecords() { if(num==0) { system("del Records.txt"); } else { FILE *fp; fp = fopen("Records.txt","w"); for(int i=0;i<num;i++) { fprintf(fp,"%s\t%d\t%s\t%d\t%d\t%d\t%c\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",emp[i].name,emp[i].code,emp[i].designation,emp[i].exp,emp[i].age,emp[i].salary,emp[i].AnyLoan,emp[i].HRA,emp[i].PF,emp[i].tax,emp[i].MealAllowance,emp[i].TransportAllowance,emp[i].MedicalAllowance,emp[i].LoanBalance,emp[i].LoanDebit,emp[i].grosspay,emp[i].workingHours,emp[i].DA); } fclose(fp); } } void Cdelay(int msec) { long goal = msec + (clock()); while (goal > (clock())); } bool isFilePresent() { FILE *fp; fp = fopen("Records.txt","r"); if(fp==NULL) return false; else return true; } void loginFrame1(int xLenS = 18, int yLenS = 8, int xLenE = 55, int yLenE = 15) { system("cls"); gotoXY(xLenS,yLenS);printf("%c",201); gotoXY(xLenS,yLenE);printf("%c",200); for(int i=xLenS+1;i<=xLenE-1;i++) //Top and Bottom Border line { //Cdelay(0); gotoXY(i,yLenS); printf("%c",205); //puts(style); gotoXY(i,yLenE); //puts(style); printf("%c",205); } gotoXY(xLenE,yLenS);printf("%c",187); gotoXY(xLenE,yLenE);printf("%c",188); for(int i=yLenS+1;i<=yLenE-1;i++) //Left and Right Border Line { //Cdelay(20); gotoXY(xLenS, i); printf("%c",186); //puts(style); gotoXY(xLenE, i); printf("%c",186); //puts(style); } printf("\n\n"); } void login() { char UserName[30],Password[30],ch;int i=0; gotoXY(20,10); printf("Enter UserName : "); cin>>UserName; gotoXY(20,12); cout<<"Enter Password : "; while(1) { ch = getch(); if(ch==13) break; if(ch==32||ch==9) continue; else { cout<<"*"; Password[i]=ch; i++; } } Password[i] = '\0'; if(strcmp(UserName,"admin")==0 && strcmp(Password,"password")==0) { system("cls"); loginFrame1(); gotoXY(27,10); cout<<"Login Success!!!"; gotoXY(21,12); cout<<"Will be redirected in 3 Seconds..."; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b2"; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b1"; gotoXY(56,12); Cdelay(1000); } else { system("cls"); loginFrame1(); gotoXY(27,10); printf("Access Denied!!!\a"); gotoXY(21,12); cout<<"Will be redirected in 3 Seconds..."; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b2"; gotoXY(56,12); Cdelay(1000); gotoXY(44,12); cout<<"\b \b1"; gotoXY(56,12); Cdelay(1000); system("cls"); loginFrame1(); login(); } } void setWindowSize(int width=670,int height=445) { //HWND console = GetConsoleWindow(); RECT r; // GetWindowRect(console, &r); // MoveWindow(console, r.left, r.top, width, height, TRUE); } void gotoXY(int X, int Y) { COORD coordinates; coordinates.X = X; coordinates.Y = Y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coordinates); } void borderNoDelay(int xLenS = 2, int yLenS = 2,int xLenE = 76, int yLenE = 24 ) { system("cls"); gotoXY(xLenS,yLenS);printf("%c",201); gotoXY(xLenS,yLenE);printf("%c",200); for(int i=xLenS+1;i<=xLenE-1;i++) //Top and Bottom Border line { gotoXY(i,yLenS); printf("%c",205); gotoXY(i,yLenE); printf("%c",205); } gotoXY(xLenE,yLenS);printf("%c",187); gotoXY(xLenE,yLenE);printf("%c",188); for(int i=yLenS+1;i<=yLenE-1;i++) //Left and Right Border Line { gotoXY(xLenS, i); printf("%c",186); gotoXY(xLenE, i); printf("%c",186); } printf("\n\n"); } void border(int xLenS = 2, int yLenS = 2,int xLenE = 76, int yLenE = 22 ) { system("cls"); gotoXY(xLenS,yLenS);printf("%c",201); gotoXY(xLenS,yLenE);printf("%c",200); for(int i=xLenS+1;i<=xLenE-1;i++) //Top and Bottom Border line { Cdelay(15); gotoXY(i,yLenS); printf("%c",205); //puts(style); gotoXY(i,yLenE); //puts(style); printf("%c",205); } gotoXY(xLenE,yLenS);printf("%c",187); gotoXY(xLenE,yLenE);printf("%c",188); for(int i=yLenS+1;i<=yLenE-1;i++) //Left and Right Border Line { Cdelay(15); gotoXY(xLenS, i); printf("%c",186); //puts(style); gotoXY(xLenE, i); printf("%c",186); //puts(style); } printf("\n\n"); } void loginFrame(int xLenS = 18, int yLenS = 8, int xLenE = 55, int yLenE = 15) { border(xLenS,yLenS,xLenE,yLenE); } void insert() { borderNoDelay(); int i=num; int sal,PF,TAX,HRA,MealA,MedicalA,TransportA,LoanBal,LoanDeb,h,DA; char loan; num+=1; gotoXY(28,4); printf("Insert New Record"); gotoXY(10,6); cout<<"Name : "; //cin.getline(emp[i].name,sizeof(emp[i].name)); cin>>emp[i].name; gotoXY(10,8); cout<<"Code : "; cin>>emp[i].code; gotoXY(10,10); cout<<"Designation : "; cin>>emp[i].designation; gotoXY(10,12); cout<<"Years of Experience : "; cin>>emp[i].exp; gotoXY(10,14); cout<<"Age : "; cin>>emp[i].age; gotoXY(10,16); cout<<"Enter Working Hours : "; cin>>h; sal = h*300; emp[i].workingHours = h; do { gotoXY(10,18); cout<<"Any Loan (Y/N) ?: \b \b"; loan=getche(); if(loan=='Y'|| loan == 'y' || loan =='n' || loan == 'N') break; }while(1); if(loan=='y'|| loan=='Y') { gotoXY(10,20); cout<<"Enter Loan Balance : "; cin>>LoanBal; } else { LoanBal=0; } gotoXY(14,22); cout<<"Recorded Succesfully...!!!"; TAX = 0.04 * sal; DA = 1.20 * sal; PF = 0.12 * sal; HRA = sal * 0.27; MealA = 300; MedicalA = 300; TransportA = 300; LoanDeb = sal * 0.09; if(LoanDeb > LoanBal) { LoanBal = 0; LoanDeb = LoanBal; } emp[i].salary = sal; emp[i].DA = DA; emp[i].tax=TAX; emp[i].PF = PF; emp[i].HRA = HRA; emp[i].MealAllowance = MealA; emp[i].MedicalAllowance = MedicalA; emp[i].TransportAllowance = TransportA; emp[i].LoanBalance = LoanBal-LoanDeb; emp[i].AnyLoan = loan; emp[i].LoanDebit = LoanDeb; emp[i].grosspay = (sal+MealA+MedicalA+TransportA+HRA+DA)-(PF+TAX+LoanDeb) ; getch(); } void intro() { gotoXY(27,4); printf("PAYROLL MANAGEMENT SYSTEM"); gotoXY(24,20);printf("Press Any key to continue..."); getch(); } void list() { //system("cls"); borderNoDelay(); gotoXY(20,4); printf(" ******** List of the Employees ********"); gotoXY(6,6); cout<<"Name\tCode\tDesignation\tYears(EXP)\tAge\tSalary "<<endl; gotoXY(6,7); cout<<"------------------------------------------------------------------"<<endl; for(int i=0,j=8;i<=num-1;i++,j++) { gotoXY(6,j); cout<<emp[i].name; gotoXY(19,j); cout<<emp[i].code; gotoXY(26,j); cout<<emp[i].designation; gotoXY(47,j); cout<<emp[i].exp; gotoXY(58,j); cout<<emp[i].age; gotoXY(66,j); cout<<emp[i].grosspay; } getch(); } void loading() { system("cls"); gotoXY(55,20); printf("Loading..."); gotoXY(50,22); for(int i = 0; i<20; i++) { Cdelay(200); printf("%c",254); } } void menu() { //system("cls"); borderNoDelay(); //gotoXY(0,0); //cout<<"Number of Records Avaliable : "<<num; gotoXY(16,4); printf("***** Payroll Management System 1.0 ***** "); gotoXY(12,6); cout<<"Press i ----> Insert New Record."; gotoXY(12,8); cout<<"Press e ----> Edit a Record."; gotoXY(12,10); cout<<"Press d ----> Delete a Record."; gotoXY(12,12); cout<<"Press s ----> Search a Record."; gotoXY(12,14); cout<<"Press l ----> List The Employee Table."; gotoXY(12,16); cout<<"Press p ----> Print Employee PaySlip."; gotoXY(12,18); cout<<"Press q ----> Quit Program."; gotoXY(16,22); cout<<"Select Your Option ====> "; } void deletes() { for(int i=0;i<num;i++) { tempemp[i]=emp[i]; } //system("cls"); borderNoDelay(); int code; int check=-1; gotoXY(28,4); printf("Delete a Record"); gotoXY(10,6); cout<<"Enter the JobCode To Delete That Record :"; cin>>code; int i,j; for(i=0;i<=num-1;i++) { if(emp[i].code==code) { check=i; } } if(check!=-1) { for(i=0,j=0;i<=num-1;i++,j++) { if(i==check) { i++; } emp[j]=tempemp[i]; } num--; } } void search() { //system("cls"); borderNoDelay(); int jobcode; bool found = false; gotoXY(10,4); cout<<"You can Search only through the Jobcode of an Employee"; gotoXY(10,6); cout<<"Enter Code Of the Employee : "; cin>>jobcode; for(int i=0;i<=num-1;i++) { if(emp[i].code==jobcode) { gotoXY(6,8); cout<<"Name\tCode\tDesignation\tYears(EXP)\tAge\tSalary "<<endl; gotoXY(6,9); cout<<"------------------------------------------------------------------"<<endl; gotoXY(6,11); cout<<emp[i].name; gotoXY(19,11); cout<<emp[i].code; gotoXY(26,11); cout<<emp[i].designation; gotoXY(47,11); cout<<emp[i].exp; gotoXY(58,11); cout<<emp[i].age; gotoXY(66,11); cout<<emp[i].grosspay; found = true; } //else // } if(!found) { gotoXY(26,11); cout<<"No records Found...!!!\a"; } getch(); } void editmenu() { //system("cls"); borderNoDelay(); gotoXY(28,4); printf("Edit An Entry"); gotoXY(10,6); cout<<"What Do You Want To edit"; gotoXY(12,8); cout<<"n ---------> Name "; gotoXY(12,9); cout<<"c ---------> Code "; gotoXY(12,10); cout<<"d ---------> Designation"; gotoXY(12,11); cout<<"e ---------> Experience "; gotoXY(12,12); cout<<"a ---------> Age"; gotoXY(12,13); cout<<"s ---------> Salary"; gotoXY(12,14); cout<<"q ---------> QUIT"; gotoXY(10,16); cout<<"Enter Choice ---->>> "; } void editname(int i) { gotoXY(10,18); cout<<"Enter New Name-----> "; cin>>emp[i].name; } void editcode(int i) { gotoXY(10,18); cout<<"Enter New Job Code-----> "; cin>>emp[i].code; } void editdes(int i) { gotoXY(10,18); cout<<"enter new designation-----> "; cin>>emp[i].designation; } void editexp(int i) { gotoXY(10,18); cout<<"Enter new Years of Experience"; cin>>emp[i].exp; } void editage(int i) { gotoXY(10,18); cout<<"Enter new Age "; cin>>emp[i].age; } void editsalary(int i) { int sal,PF,TAX,HRA,MealA,MedicalA,TransportA,LoanBal=emp[i].LoanBalance,LoanDeb,DA; char loan; gotoXY(10,18); cout<<"Enter new Salary "; cin>>sal; DA = 1.20 * sal; TAX = 0.04 * sal; PF = 0.12 * sal; HRA = 4000; MealA = 300; MedicalA = 300; TransportA = 300; LoanDeb = sal * 0.09; if(LoanDeb > LoanBal) { LoanBal = 0; LoanDeb = LoanBal; } emp[i].salary = sal; emp[i].tax=TAX; emp[i].PF = PF; emp[i].HRA = HRA; emp[i].MealAllowance = MealA; emp[i].MedicalAllowance = MedicalA; emp[i].TransportAllowance = TransportA; emp[i].LoanBalance = LoanBal; emp[i].AnyLoan = loan; emp[i].LoanDebit = LoanDeb; emp[i].grosspay = (sal+MealA+MedicalA+TransportA+HRA+DA)-(PF+TAX+LoanDeb) ; } void edit() { //system("cls"); borderNoDelay(); int jobcode; gotoXY(28,4); printf("Edit a Record"); int i; char option; gotoXY(10,6); cout<<"Enter the jobcode To Edit : "; cin>>jobcode; editmenu(); for(i=0;i<=num-1;i++) { if(emp[i].code==jobcode) { while((option=cin.get())!='q') { switch(option) { case 'n': editname(i); break; case 'c': editcode(i); break; case 'd': editdes(i); break; case 'e': editexp(i); break; case 'a': editage(i); break; case 's': editsalary(i); break; } editmenu(); } } } } void displayPayslip() { system("cls"); borderNoDelay(); gotoXY(10,4); int code,i; cout<<"Enter Employee Job Code :"; cin>>code; for(i=0;i<=num-1;i++) { if(emp[i].code==code) { gotoXY(12,6); cout<<"Name : "<<emp[i].name; gotoXY(45,6); cout<<"Working Hours : "<<emp[i].workingHours<<" Hrs"; gotoXY(6,8); cout<<"Earnings :-"; gotoXY(8,10); cout<<"Basic Pay : "<<emp[i].salary<<endl; gotoXY(8,12); cout<<"HRA(27% of Basic): "<<emp[i].HRA<<endl; gotoXY(8,14); cout<<"DA (120% of Basic):"<<emp[i].DA; gotoXY(8,16); cout<<"Meal Allowance : "<<emp[i].MealAllowance<<endl; gotoXY(8,18); cout<<"Medical Alowance : "<<emp[i].MedicalAllowance<<endl; gotoXY(8,20); cout<<"Transport Allowance : "<<emp[i].TransportAllowance<<endl; gotoXY(40,8); cout<<"Deductions :- "<<endl<<endl; gotoXY(42,10); cout<<"PF : "<<emp[i].PF<<endl; gotoXY(42,12); cout<<"Tax : "<<emp[i].tax<<endl; gotoXY(42,14); int l = emp[i].AnyLoan; char l2 = toupper(l); cout<<"Loan Status : "<<l2<<endl; gotoXY(42,16); cout<<"Loan Debit This Month : "<<emp[i].LoanDebit<<endl; gotoXY(42,18); cout<<"Loan Balance : "<<emp[i].LoanBalance<<endl; gotoXY(32,22); cout<<"Total Gross Pay : "<<emp[i].grosspay; } } getch(); } int main() { setWindowSize(); border(); intro(); loading(); loginFrame(); login(); menu(); getrecords(); char option; if(emp[0].code==0 && isFilePresent()) num--; while(1) { option=getch(); switch(option) { case 'l': list(); break; case 'i': insert(); break; case 'd': deletes(); break; case 'e': edit(); break; case 's': search(); break; case 'p': displayPayslip(); break; case 'q': saverecords(); exit(0); } menu(); } return 0; } |
Run Quick Virus Scan for secure Download
Run Quick Scan for secure DownloadDownloadable Source Code
Summary
The whole project is designed in ‘C++’ language and different variables and strings have been used for the development of this project. This mini project is easy to operate and understand by the users.
This simple project can enhance the knowledge of the beginners or the students to develop their skills in programming, also this project is easy to understand the module and their variables.
Related Articles
- Number System Conversion Project in C with Source Code
- Prison Management System Project in C with Source Code
- Department Store Management System Project in C with Source Code
- Best C Projects with Source Code for Beginners Free Download 2020
- Bank Management System in C with Source Code
- School Billing System in C with Source Code
- Hotel Management System Project In C With Source Code
- Employee Management System In C With Source Code
- Mini Project for Phonebook in C with Source Code
- Calendar In C Programming With Source Code
- Student Record System in C with Source Code
- Library Management System In C With Source Code
- Simple Hospital Management System In C With Source Code
Inquiries
If you have any questions or suggestions about Payroll Management System In C++ , please feel free to leave a comment below.