├── LICENSE ├── README.md ├── payroll-management-system.java └── payrollManagementSystem.cpp /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Abhishek Dinkar Raut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The project has multiple classes and sub-classes with many features within them. Basic operations users can perform via this program project that are based on file handling are adding new employee record, modifying employee record and deleting record, displaying one or all employee’s record. Besides these, payroll management also allows users to print the salary slip for a particular employee. This project is large, complete and we tried our best to make it error-free. The source code is very long – over 1500 lines and developed in Code Blocks compiler. 2 | 3 | # Project uses following c/c++ concept 4 | - Pointers 5 | - Loops 6 | - Functions 7 | - If Else 8 | - Switch 9 | - Classes 10 | - File handling 11 | - C++ Graphics 12 | - Function overriding and overloading 13 | - Composition 14 | 15 | # The Project classes 16 | 1. LINES 17 | * LINE_HOR 18 | * LINE_VER 19 | * BOX 20 | * CLEARUP 21 | * CLEARDOWN 22 | 23 | 1. MENUS 24 | * MAIN_MENU 25 | * EDIT_MENU 26 | * INTRODUCTION 27 | 28 | 1. EMPLOYEE 29 | * NEW_EMPLOYEE 30 | * MODIFICATION 31 | * DELETION 32 | * DISPLAY 33 | * LIST 34 | * SALARY_SLIP 35 | * ADD_RECORD 36 | * MODIFY_RECORD 37 | * DELETE_RECORD 38 | * LASTCODE 39 | * CODEFOUND 40 | * RECORDNO 41 | * FOUND_CODE 42 | * DISPLAY_RECORD 43 | * VALID_DATE 44 | 45 | # Project Operations 46 | Addition of New Employee: 47 | 48 | This feature is under the public functions of class employee. The information handled in this feature are employee code number, name, address, phone number, joining date (day, month and year), designation, grade and loan. 49 | 50 | Modify Employee Record: 51 | 52 | This System in C++ asks for employee code from the user for this function to work. Modifications that can be made are the employee code number itself, joining date (day, month and year), name, address, phone number, designation, grade, house allowance and loan given to the employee. Employee’s grades are categorized as A, B, C, D and E. 53 | 54 | Delete Employee Record: 55 | 56 | Deletion is done of an employee record from Payroll management system project by entering the employee code. A confirmation message is asked stating whether the user really wants to delete the record from the file. 57 | 58 | Print Employee Salary Slip: 59 | 60 | This feature too asks for the employee code; the employee code has been used to unlock or perform operations in many features of this payroll management system project in C++. This function lists all the months of the year, and asks for date, employee name, designation and grade from the user. To print the salary slip, the user further needs to provide information such as number of days worked in the month by the employee and the number of hours worked over time. The slip enlists basic salary, allowance, deductions and net salary of the employee. 61 | 62 | Display Employee Record: 63 | 64 | Providing the employee code number, users can access all the provided information related to a particular employee via this function. The employee record information displayed are the ones provided while adding a new employee record. 65 | 66 | Display List of Employees: 67 | 68 | This feature displays the record of all employees added in file. The records are displayed in a tabular pattern containing information such as code name of the employee, phone number, date of joining, designation, grade and salary. 69 | 70 | # Contribute 71 | 72 | Please feel free to add your own code, fix bugs or improve the docs. 73 | -------------------------------------------------------------------------------- /payroll-management-system.java: -------------------------------------------------------------------------------- 1 | // code written to implement the system in java so as to revise java 2 | // use of Intellij Idea 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /payrollManagementSystem.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | void gotoxy(int x, int y) 17 | { 18 | COORD c = { x, y }; 19 | SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c); 20 | } 21 | 22 | class LINES 23 | { 24 | public: 25 | void LINE_HOR(int, int, int, char); 26 | void LINE_VER(int, int, int, char); 27 | void BOX(int, int, int, int, char); 28 | void CLEARUP(void); 29 | void CLEARDOWN(void); 30 | }; 31 | 32 | class MENU 33 | { 34 | public: 35 | void MAIN_MENU(void); 36 | private: 37 | void EDIT_MENU(void); 38 | void INTRODUCTION(void); 39 | }; 40 | 41 | class EMPLOYEE 42 | { 43 | public: 44 | void NEW_EMPLOYEE(void); 45 | void MODIFICATION(void); 46 | void DELETION(void); 47 | void DISPLAY(void); 48 | void LIST(void); 49 | void SALARY_SLIP(void); 50 | private: 51 | void ADD_RECORD(int, char[], char[], char[], int, int, int, char[], char, char, char, float, float); 52 | void MODIFY_RECORD(int, char[], char[], char[], char[], char, char, char, float, float); 53 | void DELETE_RECORD(int); 54 | int LASTCODE(void); 55 | int CODEFOUND(int); 56 | int RECORDNO(int); 57 | int FOUND_CODE(int); 58 | void DISPLAY_RECORD(int); 59 | int VALID_DATE(int, int, int); 60 | 61 | int code, dd, mm, yy; 62 | char name[26], address[31], phone[10], desig[16]; 63 | char grade, house, convense; 64 | float loan, basic; 65 | }; 66 | 67 | void MENU::MAIN_MENU(void) 68 | { 69 | char ch; 70 | LINES L; 71 | L.CLEARUP(); 72 | while (1) 73 | { 74 | system("cls"); 75 | gotoxy(14, 3); 76 | cout << " Payroll Management System"; 77 | L.BOX(25, 7, 57, 9, 218); 78 | L.BOX(10, 5, 71, 21, 218); 79 | L.BOX(11, 6, 70, 20, 219); 80 | gotoxy(29, 8); 81 | cout << "PAYROLL MANAGEMENT SYSTEM"; 82 | gotoxy(30, 11); 83 | cout << "1: NEW EMPLOYEE"; 84 | gotoxy(30, 12); 85 | cout << "2: DISPLAY EMPLOYEE"; 86 | gotoxy(30, 13); 87 | cout << "3: LIST OF EMPLOYEES"; 88 | gotoxy(30, 14); 89 | cout << "4: SALARY SLIP"; 90 | gotoxy(30, 15); 91 | cout << "5: EDIT"; 92 | gotoxy(30, 16); 93 | cout << "0: QUIT"; 94 | gotoxy(30, 18); 95 | cout << "ENTER YOUR CHOICE: "; 96 | gotoxy(5, 23); 97 | 98 | ch = _getch(); 99 | if (ch == 27 || ch == '0') 100 | break; 101 | else if (ch == '1') 102 | { 103 | EMPLOYEE E; 104 | E.NEW_EMPLOYEE(); 105 | } 106 | else if (ch == '2') 107 | { 108 | EMPLOYEE E; 109 | E.DISPLAY(); 110 | } 111 | else if (ch == '3') 112 | { 113 | EMPLOYEE E; 114 | E.LIST(); 115 | } 116 | else if (ch == '4') 117 | { 118 | EMPLOYEE E; 119 | E.SALARY_SLIP(); 120 | } 121 | else if (ch == '5') 122 | EDIT_MENU(); 123 | } 124 | L.CLEARUP(); 125 | } 126 | 127 | void MENU::EDIT_MENU(void) 128 | { 129 | char ch; 130 | LINES L; 131 | L.CLEARDOWN(); 132 | while (1) 133 | { 134 | system("cls"); 135 | L.BOX(28, 8, 49, 10, 218); 136 | L.BOX(10, 5, 71, 21, 218); 137 | L.BOX(11, 6, 70, 20, 219); 138 | gotoxy(31, 9); 139 | cout << "E D I T M E N U"; 140 | gotoxy(30, 13); 141 | cout << "1: DELETE RECORD"; 142 | gotoxy(30, 14); 143 | cout << "2: MODIFY RECORD"; 144 | gotoxy(30, 15); 145 | cout << "0: EXIT"; 146 | gotoxy(30, 17); 147 | cout << "ENTER YOUR CHOICE: "; 148 | ch = _getch(); 149 | if (ch == 27 || ch == '0') 150 | break; 151 | else if (ch == '1') 152 | { 153 | EMPLOYEE E; 154 | E.DELETION(); 155 | } 156 | else if (ch == '2') 157 | { 158 | EMPLOYEE E; 159 | E.MODIFICATION(); 160 | } 161 | } 162 | L.CLEARDOWN(); 163 | } 164 | 165 | void LINES::LINE_HOR(int column1, int column2, int row, char c) 166 | { 167 | for (column1; column1 <= column2; column1++) 168 | { 169 | gotoxy(column1, row); 170 | cout << c; 171 | } 172 | } 173 | 174 | void LINES::LINE_VER(int row1, int row2, int column, char c) 175 | { 176 | for (row1; row1 <= row2; row1++) 177 | { 178 | gotoxy(column, row1); 179 | cout << c; 180 | } 181 | } 182 | 183 | void LINES::BOX(int column1, int row1, int column2, int row2, char c) 184 | { 185 | char ch = 218; 186 | char c1, c2, c3, c4; 187 | char l1 = 196, l2 = 179; 188 | if (c == ch) 189 | { 190 | c1 = 218; 191 | c2 = 191; 192 | c3 = 192; 193 | c4 = 217; 194 | l1 = 196; 195 | l2 = 179; 196 | } 197 | else 198 | { 199 | c1 = c; 200 | c2 = c; 201 | c3 = c; 202 | c4 = c; 203 | l1 = c; 204 | l2 = c; 205 | } 206 | gotoxy(column1, row1); 207 | cout << c1; 208 | gotoxy(column2, row1); 209 | cout << c2; 210 | gotoxy(column1, row2); 211 | cout << c3; 212 | gotoxy(column2, row2); 213 | cout << c4; 214 | column1++; 215 | column2--; 216 | LINE_HOR(column1, column2, row1, l1); 217 | LINE_HOR(column1, column2, row2, l1); 218 | column1--; 219 | column2++; 220 | row1++; 221 | row2--; 222 | LINE_VER(row1, row2, column1, l2); 223 | LINE_VER(row1, row2, column2, l2); 224 | } 225 | 226 | //THIS FUNCTION CLEAR THE SCREEN LINE BY LINE UPWARD 227 | 228 | void LINES::CLEARUP(void) 229 | { 230 | for (int i = 25; i >= 1; i--) 231 | { 232 | sleep(20); 233 | gotoxy(1, i); 234 | clreol(); 235 | } 236 | } 237 | 238 | void LINES::CLEARDOWN(void) 239 | { 240 | for (int i = 1; i <= 25; i++) 241 | { 242 | delay(20); 243 | gotoxy(1, i); 244 | clreol(); 245 | } 246 | } 247 | 248 | // THIS FUNCTION ADDS THE GIVEN DATA IN THE EMPLOYEE'S FILE 249 | 250 | void EMPLOYEE::ADD_RECORD(int ecode, char ename[26], char eaddress[31], char ephone[10], int d, int m, int y, char edesig[16], char egrade, char ehouse, char econv, float eloan, float ebasic) 251 | { 252 | fstream file; 253 | file.open("EMPLOYEE.DAT"); 254 | code = ecode; 255 | strcpy(name, ename); 256 | strcpy(address, eaddress); 257 | strcpy(phone, ephone); 258 | dd = d; 259 | mm = m; 260 | yy = y; 261 | strcpy(desig, edesig); 262 | grade = egrade; 263 | house = ehouse; 264 | convense = econv; 265 | loan = eloan; 266 | basic = ebasic; 267 | file.write((char *) this, sizeof(EMPLOYEE)); 268 | file.close(); 269 | } 270 | 271 | /* THIS FUNCTION MODIFY THE GIVEN DATA IN THE 272 | EMPLOYEE'S FILE 273 | */ 274 | 275 | void EMPLOYEE::MODIFY_RECORD(int ecode, char ename[26], char eaddress[31], char ephone[10], char edesig[16], char egrade, char ehouse, char econv, float eloan, float ebasic) 276 | { 277 | int recno; 278 | recno = RECORDNO(ecode); 279 | fstream file; 280 | file.open("EMPLOYEE.DAT", ios::out | ios::ate); 281 | strcpy(name, ename); 282 | strcpy(address, eaddress); 283 | strcpy(phone, ephone); 284 | strcpy(desig, edesig); 285 | grade = egrade; 286 | house = ehouse; 287 | convense = econv; 288 | loan = eloan; 289 | basic = ebasic; 290 | int location; 291 | location = (recno - 1) * sizeof(EMPLOYEE); 292 | file.seekp(location); 293 | file.write((char *) this, sizeof(EMPLOYEE)); 294 | file.close(); 295 | } 296 | 297 | /* THIS FUNCTION DELETE THE RECORD IN THE EMPLOYEE FILE 298 | FOR THE GIVEN EMPLOYEE CODE 299 | */ 300 | 301 | void EMPLOYEE::DELETE_RECORD(int ecode) 302 | { 303 | fstream file; 304 | file.open("EMPLOYEE.DAT", ios::in); 305 | fstream temp; 306 | temp.open("temp.dat", ios::out); 307 | file.seekg(0, ios::beg); 308 | while (!file.eof()) 309 | { 310 | file.read((char *) this, sizeof(EMPLOYEE)); 311 | if (file.eof()) 312 | break; 313 | if (code != ecode) 314 | temp.write((char *) this, sizeof(EMPLOYEE)); 315 | } 316 | file.close(); 317 | temp.close(); 318 | file.open("EMPLOYEE.DAT", ios::out); 319 | temp.open("temp.dat", ios::in); 320 | temp.seekg(0, ios::beg); 321 | while (!temp.eof()) 322 | { 323 | temp.read((char *) this, sizeof(EMPLOYEE)); 324 | if (temp.eof()) 325 | break; 326 | file.write((char *) this, sizeof(EMPLOYEE)); 327 | } 328 | file.close(); 329 | temp.close(); 330 | } 331 | 332 | // THIS FUNCTION RETURNS THE LAST EMPLOYEE'S CODE 333 | 334 | int EMPLOYEE::LASTCODE(void) 335 | { 336 | fstream file; 337 | file.open("EMPLOYEE.DAT", ios::in); 338 | file.seekg(0, ios::beg); 339 | int count = 0; 340 | while (file.read((char *) this, sizeof(EMPLOYEE))) 341 | count = code; 342 | file.close(); 343 | return count; 344 | } 345 | 346 | // THIS FUNCTION RETURNS 0 IF THE GIVEN CODE NOT FOUND 347 | 348 | int EMPLOYEE::FOUND_CODE(int ecode) 349 | { 350 | fstream file; 351 | file.open("EMPLOYEE.DAT", ios::in); 352 | file.seekg(0, ios::beg); 353 | int found = 0; 354 | while (file.read((char *) this, sizeof(EMPLOYEE))) 355 | { 356 | if (code == ecode) 357 | { 358 | found = 1; 359 | break; 360 | } 361 | } 362 | file.close(); 363 | return found; 364 | } 365 | 366 | // THIS FUNCTION RETURNS RECORD NO. OF THE GIVEN CODE 367 | 368 | int EMPLOYEE::RECORDNO(int ecode) 369 | { 370 | fstream file; 371 | file.open("EMPLOYEE.DAT", ios::in); 372 | file.seekg(0, ios::beg); 373 | int recno = 0; 374 | while (file.read((char *) this, sizeof(EMPLOYEE))) 375 | { 376 | recno++; 377 | if (code == ecode) 378 | break; 379 | } 380 | file.close(); 381 | return recno; 382 | } 383 | 384 | // THIS FUNCTION DISPLAYS THE LIST OF THE EMPLOYEES 385 | 386 | void EMPLOYEE::LIST(void) 387 | { 388 | system("cls"); 389 | int row = 6, found = 0, flag = 0; 390 | char ch; 391 | gotoxy(31, 2); 392 | cout << "LIST OF EMPLOYEES"; 393 | gotoxy(30, 3); 394 | cout << "~~~~~~~~~~~~~~~~~~~"; 395 | gotoxy(1, 4); 396 | cout << "CODE NAME PHONE DOJ DESIGNATION GRADE SALARY"; 397 | gotoxy(1, 5); 398 | cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 399 | fstream file; 400 | file.open("EMPLOYEE.DAT", ios::in); 401 | file.seekg(0, ios::beg); 402 | while (file.read((char *) this, sizeof(EMPLOYEE))) 403 | { 404 | flag = 0; 405 | delay(20); 406 | found = 1; 407 | gotoxy(2, row); 408 | cout << code; 409 | gotoxy(6, row); 410 | cout << name; 411 | gotoxy(31, row); 412 | cout << phone; 413 | gotoxy(40, row); 414 | cout << dd << "/" << mm << "/" << yy; 415 | gotoxy(52, row); 416 | cout << desig; 417 | gotoxy(69, row); 418 | cout << grade; 419 | if (grade != 'E') 420 | { 421 | gotoxy(74, row); 422 | cout << basic; 423 | } 424 | else 425 | { 426 | gotoxy(76, row); 427 | cout << "-"; 428 | } 429 | if (row == 23) 430 | { 431 | flag = 1; 432 | row = 6; 433 | gotoxy(1, 25); 434 | cout << "Press any key to continue or Press to exit"; 435 | ch = getch(); 436 | if (ch == 27) 437 | break; 438 | system("cls"); 439 | gotoxy(31, 2); 440 | cout << "LIST OF EMPLOYEES"; 441 | gotoxy(30, 3); 442 | cout << "~~~~~~~~~~~~~~~~~~~"; 443 | gotoxy(1, 4); 444 | cout << "CODE NAME PHONE DOJ DESIGNATION GRADE SALARY"; 445 | gotoxy(1, 5); 446 | cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; 447 | } 448 | else 449 | row++; 450 | } 451 | if (!found) 452 | { 453 | gotoxy(5, 10); 454 | cout << "\7Records not found"; 455 | } 456 | if (!flag) 457 | { 458 | gotoxy(1, 25); 459 | cout << "Press any key to continue..."; 460 | getche(); 461 | } 462 | file.close(); 463 | } 464 | 465 | // THIS FUNCTION DISPLAYS THE RECORD OF THE EMPLOYEES 466 | 467 | void EMPLOYEE::DISPLAY_RECORD(int ecode) 468 | { 469 | fstream file; 470 | file.open("EMPLOYEE.DAT", ios::in); 471 | file.seekg(0, ios::beg); 472 | while (file.read((char *) this, sizeof(EMPLOYEE))) 473 | { 474 | if (code == ecode) 475 | { 476 | gotoxy(5, 5); 477 | cout << "Employee Code # " << code; 478 | gotoxy(5, 6); 479 | cout << "~~~~~~~~~~~~~"; 480 | gotoxy(5, 7); 481 | cout << "Name : " << name; 482 | gotoxy(5, 8); 483 | cout << "Address : " << address; 484 | gotoxy(5, 9); 485 | cout << "Phone no. : " << phone; 486 | gotoxy(5, 11); 487 | cout << "JOINING DATE"; 488 | gotoxy(5, 12); 489 | cout << "~~~~~~~~~~~~"; 490 | gotoxy(5, 13); 491 | cout << "Day : " << dd; 492 | gotoxy(5, 14); 493 | cout << "Month : " << mm; 494 | gotoxy(5, 15); 495 | cout << "Year : " << yy; 496 | gotoxy(5, 17); 497 | cout << "Designation : " << desig; 498 | gotoxy(5, 18); 499 | cout << "Grade : " << grade; 500 | if (grade != 'E') 501 | { 502 | gotoxy(5, 19); 503 | cout << "House (y/n) : " << house; 504 | gotoxy(5, 20); 505 | cout << "Convense (y/n) : " << convense; 506 | gotoxy(5, 22); 507 | cout << "Basic Salary : " << basic; 508 | } 509 | gotoxy(5, 21); 510 | cout << "Loan : " << loan; 511 | } 512 | } 513 | file.close(); 514 | } 515 | 516 | // THIS FUNCTION GIVE DATA TO ADD IN THE FILE 517 | 518 | void EMPLOYEE::NEW_EMPLOYEE(void) 519 | { 520 | system("cls"); 521 | char ch, egrade, ehouse = 'N', econv = 'N'; 522 | char ename[26], eaddress[31], ephone[10], edesig[16], t1[10]; 523 | float t2 = 0.0, eloan = 0.0, ebasic = 0.0; 524 | int d, m, y, ecode, valid; 525 | gotoxy(72, 2); 526 | cout << "<0>=EXIT"; 527 | gotoxy(28, 3); 528 | cout << "ADDITION OF NEW EMPLOYEE"; 529 | gotoxy(5, 5); 530 | cout << "Employee Code # "; 531 | gotoxy(5, 6); 532 | cout << "~~~~~~~~~~~~~"; 533 | gotoxy(5, 7); 534 | cout << "Name : "; 535 | gotoxy(5, 8); 536 | cout << "Address : "; 537 | gotoxy(5, 9); 538 | cout << "Phone no. : "; 539 | gotoxy(5, 11); 540 | cout << "JOINING DATE"; 541 | gotoxy(5, 12); 542 | cout << "~~~~~~~~~~~~"; 543 | gotoxy(5, 13); 544 | cout << "Day : "; 545 | gotoxy(5, 14); 546 | cout << "Month : "; 547 | gotoxy(5, 15); 548 | cout << "Year : "; 549 | gotoxy(5, 17); 550 | cout << "Designation : "; 551 | gotoxy(5, 18); 552 | cout << "Grade : "; 553 | gotoxy(5, 21); 554 | cout << "Loan : "; 555 | 556 | ecode = LASTCODE() + 1; 557 | if (ecode == 1) 558 | { 559 | ADD_RECORD(ecode, "null", "null", "null", 0, 0, 0, "null", 'n', 'n', 'n', 0.0, 0.0); 560 | DELETE_RECORD(ecode); 561 | } 562 | gotoxy(21, 5); 563 | cout << ecode; 564 | do 565 | { 566 | valid = 1; 567 | gotoxy(5, 25); 568 | clreol(); 569 | cout << "Enter the name of the Employee"; 570 | gotoxy(20, 7); 571 | clreol(); 572 | gets(ename); 573 | strupr(ename); 574 | if (ename[0] == '0') 575 | return; 576 | if (strlen(ename) < 1 || strlen(ename) > 25) 577 | { 578 | valid = 0; 579 | gotoxy(5, 25); 580 | clreol(); 581 | cout << "\7Enter correctly (Range: 1..25)"; 582 | getch(); 583 | } 584 | } while (!valid); 585 | do 586 | { 587 | valid = 1; 588 | gotoxy(5, 25); 589 | clreol(); 590 | cout << "Enter Address of the Employee"; 591 | gotoxy(20, 8); 592 | clreol(); 593 | gets(eaddress); 594 | strupr(eaddress); 595 | if (eaddress[0] == '0') 596 | return; 597 | if (strlen(eaddress) < 1 || strlen(eaddress) > 30) 598 | { 599 | valid = 0; 600 | gotoxy(5, 25); 601 | clreol(); 602 | cout << "\7Enter correctly (Range: 1..30)"; 603 | getch(); 604 | } 605 | } while (!valid); 606 | do 607 | { 608 | valid = 1; 609 | gotoxy(5, 25); 610 | clreol(); 611 | cout << "Enter Phone no. of the Employee or Press for none"; 612 | gotoxy(20, 9); 613 | clreol(); 614 | gets(ephone); 615 | if (ephone[0] == '0') 616 | return; 617 | if ((strlen(ephone) < 7 && strlen(ephone) > 0) || (strlen(ephone) > 9)) 618 | { 619 | valid = 0; 620 | gotoxy(5, 25); 621 | clreol(); 622 | cout << "\7Enter correctly"; 623 | getch(); 624 | } 625 | } while (!valid); 626 | if (strlen(ephone) == 0) 627 | strcpy(ephone, "-"); 628 | char tday[3], tmonth[3], tyear[5]; 629 | int td; 630 | do 631 | { 632 | valid = 1; 633 | do 634 | { 635 | gotoxy(5, 25); 636 | clreol(); 637 | cout << "ENTER DAY OF JOINING"; 638 | gotoxy(13, 13); 639 | clreol(); 640 | gets(tday); 641 | td = atoi(tday); 642 | d = td; 643 | if (tday[0] == '0') 644 | return; 645 | } while (d == 0); 646 | do 647 | { 648 | gotoxy(5, 25); 649 | clreol(); 650 | cout << "ENTER MONTH OF JOINING"; 651 | gotoxy(13, 14); 652 | clreol(); 653 | gets(tmonth); 654 | td = atoi(tmonth); 655 | m = td; 656 | if (tmonth[0] == '0') 657 | return; 658 | } while (m == 0); 659 | do 660 | { 661 | gotoxy(5, 25); 662 | clreol(); 663 | cout << "ENTER YEAR OF JOINING"; 664 | gotoxy(13, 15); 665 | clreol(); 666 | gets(tyear); 667 | td = atoi(tyear); 668 | y = td; 669 | if (tyear[0] == '0') 670 | return; 671 | } while (y == 0); 672 | if (d>31 || d<1) 673 | valid = 0; 674 | else if (((y % 4) != 0 && m == 2 && d>28) || ((y % 4) == 0 && m == 2 && d>29)) 675 | valid = 0; 676 | else if ((m == 4 || m == 6 || m == 9 || m == 11) && d>30) 677 | valid = 0; 678 | else if (y<1990 || y>2020) 679 | valid = 0; 680 | if (!valid) 681 | { 682 | valid = 0; 683 | gotoxy(5, 25); 684 | clreol(); 685 | cout << "\7Enter correctly"; 686 | getch(); 687 | gotoxy(13, 14); 688 | clreol(); 689 | gotoxy(13, 15); 690 | clreol(); 691 | } 692 | } while (!valid); 693 | do 694 | { 695 | valid = 1; 696 | gotoxy(5, 25); 697 | clreol(); 698 | cout << "Enter Designation of the Employee"; 699 | gotoxy(20, 17); 700 | clreol(); 701 | gets(edesig); 702 | strupr(edesig); 703 | if (edesig[0] == '0') 704 | return; 705 | if (strlen(edesig) < 1 || strlen(edesig) > 15) 706 | { 707 | valid = 0; 708 | gotoxy(5, 25); 709 | clreol(); 710 | cout << "\7Enter correctly (Range: 1..15)"; 711 | getch(); 712 | } 713 | } while (!valid); 714 | do 715 | { 716 | gotoxy(5, 25); 717 | clreol(); 718 | cout << "Enter Grade of the Employee (A,B,C,D,E)"; 719 | gotoxy(20, 18); 720 | clreol(); 721 | egrade = getche(); 722 | egrade = toupper(egrade); 723 | if (egrade == '0') 724 | return; 725 | } while (egrade < 'A' || egrade > 'E'); 726 | if (egrade != 'E') 727 | { 728 | gotoxy(5, 19); 729 | cout << "House (y/n) : "; 730 | gotoxy(5, 20); 731 | cout << "Convense (y/n) : "; 732 | gotoxy(5, 22); 733 | cout << "Basic Salary : "; 734 | do 735 | { 736 | gotoxy(5, 25); 737 | clreol(); 738 | cout << "ENTER IF HOUSE ALLOWANCE IS ALLOTED TO EMPLOYEE OR NOT"; 739 | gotoxy(22, 19); 740 | clreol(); 741 | ehouse = getche(); 742 | ehouse = toupper(ehouse); 743 | if (ehouse == '0') 744 | return; 745 | } while (ehouse != 'Y' && ehouse != 'N'); 746 | do 747 | { 748 | gotoxy(5, 25); 749 | clreol(); 750 | cout << "ENTER IF CONVENCE ALLOWANCE IS ALLOTED TO EMPLOYEE OR NOT"; 751 | gotoxy(22, 20); 752 | clreol(); 753 | econv = getche(); 754 | econv = toupper(econv); 755 | if (econv == '0') 756 | return; 757 | } while (econv != 'Y' && econv != 'N'); 758 | } 759 | do 760 | { 761 | valid = 1; 762 | gotoxy(5, 25); 763 | clreol(); 764 | cout << "ENTER LOAN AMOUNT IF ISSUED"; 765 | gotoxy(22, 21); 766 | clreol(); 767 | gets(t1); 768 | t2 = atof(t1); 769 | eloan = t2; 770 | if (eloan > 50000) 771 | { 772 | valid = 0; 773 | gotoxy(5, 25); 774 | clreol(); 775 | cout << "\7SHOULD NOT GREATER THAN 50000"; 776 | getch(); 777 | } 778 | } while (!valid); 779 | if (egrade != 'E') 780 | { 781 | do 782 | { 783 | valid = 1; 784 | gotoxy(5, 25); 785 | clreol(); 786 | cout << "ENTER BASIC SALARY OF THE EMPLOYEE"; 787 | gotoxy(22, 22); 788 | clreol(); 789 | gets(t1); 790 | t2 = atof(t1); 791 | ebasic = t2; 792 | if (t1[0] == '0') 793 | return; 794 | if (ebasic > 50000) 795 | { 796 | valid = 0; 797 | gotoxy(5, 25); 798 | clreol(); 799 | cout << "\7SHOULD NOT GREATER THAN 50000"; 800 | getch(); 801 | } 802 | } while (!valid); 803 | } 804 | gotoxy(5, 25); 805 | clreol(); 806 | do 807 | { 808 | gotoxy(5, 24); 809 | clreol(); 810 | cout << "Do you want to save (y/n) "; 811 | ch = getche(); 812 | ch = toupper(ch); 813 | if (ch == '0') 814 | return; 815 | } while (ch != 'Y' && ch != 'N'); 816 | if (ch == 'N') 817 | return; 818 | ADD_RECORD(ecode, ename, eaddress, ephone, d, m, y, edesig, egrade, ehouse, econv, eloan, ebasic); 819 | } 820 | 821 | // THIS FUNCTION GIVE CODE FOR THE DISPLAY OF THE RECORD 822 | 823 | void EMPLOYEE::DISPLAY(void) 824 | { 825 | system("cls"); 826 | char t1[10]; 827 | int t2, ecode; 828 | gotoxy(72, 2); 829 | cout << "<0>=EXIT"; 830 | gotoxy(5, 5); 831 | cout << "Enter code of the Employee "; 832 | gets(t1); 833 | t2 = atoi(t1); 834 | ecode = t2; 835 | if (ecode == 0) 836 | return; 837 | system("cls"); 838 | if (!FOUND_CODE(ecode)) 839 | { 840 | gotoxy(5, 5); 841 | cout << "\7Record not found"; 842 | getch(); 843 | return; 844 | } 845 | DISPLAY_RECORD(ecode); 846 | gotoxy(5, 25); 847 | cout << "Press any key to continue..."; 848 | getch(); 849 | } 850 | 851 | /* THIS FUNCTION GIVE DATA FOR THE MODIFICATION OF THE 852 | EMPLOYEE RECORD 853 | */ 854 | 855 | void EMPLOYEE::MODIFICATION(void) 856 | { 857 | system("cls"); 858 | char ch, egrade, ehouse = 'N', econv = 'N'; 859 | char ename[26], eaddress[31], ephone[10], edesig[16], t1[10]; 860 | float t2 = 0.0, eloan = 0.0, ebasic = 0.0; 861 | int ecode, valid; 862 | gotoxy(72, 2); 863 | cout << "<0>=EXIT"; 864 | gotoxy(5, 5); 865 | cout << "Enter code of the Employee "; 866 | gets(t1); 867 | t2 = atoi(t1); 868 | ecode = t2; 869 | if (ecode == 0) 870 | return; 871 | system("cls"); 872 | if (!FOUND_CODE(ecode)) 873 | { 874 | gotoxy(5, 5); 875 | cout << "\7Record not found"; 876 | getch(); 877 | return; 878 | } 879 | gotoxy(72, 2); 880 | cout << "<0>=EXIT"; 881 | gotoxy(22, 3); 882 | cout << "MODIFICATION OF THE EMPLOYEE RECORD"; 883 | DISPLAY_RECORD(ecode); 884 | do 885 | { 886 | gotoxy(5, 24); 887 | clreol(); 888 | cout << "Do you want to modify this record (y/n) "; 889 | ch = getche(); 890 | ch = toupper(ch); 891 | if (ch == '0') 892 | return; 893 | } while (ch != 'Y' && ch != 'N'); 894 | if (ch == 'N') 895 | return; 896 | system("cls"); 897 | fstream file; 898 | file.open("EMPLOYEE.DAT", ios::in); 899 | file.seekg(0, ios::beg); 900 | while (file.read((char *) this, sizeof(EMPLOYEE))) 901 | { 902 | if (code == ecode) 903 | break; 904 | } 905 | file.close(); 906 | gotoxy(5, 5); 907 | cout << "Employee Code # " << ecode; 908 | gotoxy(5, 6); 909 | cout << "~~~~~~~~~~~~~"; 910 | gotoxy(40, 5); 911 | cout << "JOINING DATE : "; 912 | gotoxy(40, 6); 913 | cout << "~~~~~~~~~~~~~~"; 914 | gotoxy(55, 5); 915 | cout << dd << "/" << mm << "/" << yy; 916 | gotoxy(5, 7); 917 | cout << "Name : "; 918 | gotoxy(5, 8); 919 | cout << "Address : "; 920 | gotoxy(5, 9); 921 | cout << "Phone no. : "; 922 | gotoxy(5, 10); 923 | cout << "Designation : "; 924 | gotoxy(5, 11); 925 | cout << "Grade : "; 926 | gotoxy(5, 14); 927 | cout << "Loan : "; 928 | do 929 | { 930 | valid = 1; 931 | gotoxy(5, 25); 932 | clreol(); 933 | cout << "Enter the name of the Employee or FOR NO CHANGE"; 934 | gotoxy(20, 7); 935 | clreol(); 936 | gets(ename); 937 | strupr(ename); 938 | if (ename[0] == '0') 939 | return; 940 | if (strlen(ename) > 25) 941 | { 942 | valid = 0; 943 | gotoxy(5, 25); 944 | clreol(); 945 | cout << "\7Enter correctly (Range: 1..25)"; 946 | getch(); 947 | } 948 | } while (!valid); 949 | if (strlen(ename) == 0) 950 | { 951 | strcpy(ename, name); 952 | gotoxy(20, 7); 953 | cout << ename; 954 | } 955 | do 956 | { 957 | valid = 1; 958 | gotoxy(5, 25); 959 | clreol(); 960 | cout << "Enter Address of the Employee or FOR NO CHANGE"; 961 | gotoxy(20, 8); 962 | clreol(); 963 | gets(eaddress); 964 | strupr(eaddress); 965 | if (eaddress[0] == '0') 966 | return; 967 | if (strlen(eaddress) > 30) 968 | { 969 | valid = 0; 970 | gotoxy(5, 25); 971 | clreol(); 972 | cout << "\7Enter correctly (Range: 1..30)"; 973 | getch(); 974 | } 975 | } while (!valid); 976 | if (strlen(eaddress) == 0) 977 | { 978 | strcpy(eaddress, address); 979 | gotoxy(20, 8); 980 | cout << eaddress; 981 | } 982 | do 983 | { 984 | valid = 1; 985 | gotoxy(5, 25); 986 | clreol(); 987 | cout << "Enter Phone no. of the Employee or or FOR NO CHANGE"; 988 | gotoxy(20, 9); 989 | clreol(); 990 | gets(ephone); 991 | if (ephone[0] == '0') 992 | return; 993 | if ((strlen(ephone) < 7 && strlen(ephone) > 0) || (strlen(ephone) > 9)) 994 | { 995 | valid = 0; 996 | gotoxy(5, 25); 997 | clreol(); 998 | cout << "\7Enter correctly"; 999 | getch(); 1000 | } 1001 | } while (!valid); 1002 | if (strlen(ephone) == 0) 1003 | { 1004 | strcpy(ephone, phone); 1005 | gotoxy(20, 9); 1006 | cout << ephone; 1007 | } 1008 | do 1009 | { 1010 | valid = 1; 1011 | gotoxy(5, 25); 1012 | clreol(); 1013 | cout << "Enter Designation of the Employee or FOR NO CHANGE"; 1014 | gotoxy(20, 10); 1015 | clreol(); 1016 | gets(edesig); 1017 | strupr(edesig); 1018 | if (edesig[0] == '0') 1019 | return; 1020 | if (strlen(edesig) > 15) 1021 | { 1022 | valid = 0; 1023 | gotoxy(5, 25); 1024 | clreol(); 1025 | cout << "\7Enter correctly (Range: 1..15)"; 1026 | getch(); 1027 | } 1028 | } while (!valid); 1029 | if (strlen(edesig) == 0) 1030 | { 1031 | strcpy(edesig, desig); 1032 | gotoxy(20, 10); 1033 | cout << edesig; 1034 | } 1035 | do 1036 | { 1037 | gotoxy(5, 25); 1038 | clreol(); 1039 | cout << "Enter Grade of the Employee (A,B,C,D,E) or FOR NO CHANGE"; 1040 | gotoxy(20, 11); 1041 | clreol(); 1042 | egrade = getche(); 1043 | egrade = toupper(egrade); 1044 | if (egrade == '0') 1045 | return; 1046 | if (egrade == 13) 1047 | { 1048 | egrade = grade; 1049 | gotoxy(20, 11); 1050 | cout << grade; 1051 | } 1052 | } while (egrade < 'A' || egrade > 'E'); 1053 | if (egrade != 'E') 1054 | { 1055 | gotoxy(5, 12); 1056 | cout << "House (y/n) : "; 1057 | gotoxy(5, 13); 1058 | cout << "Convense (y/n) : "; 1059 | gotoxy(5, 15); 1060 | cout << "Basic Salary : "; 1061 | do 1062 | { 1063 | gotoxy(5, 25); 1064 | clreol(); 1065 | cout << "ALLOTED HOUSE ALLOWANCE ? or FOR NO CHANGE"; 1066 | gotoxy(22, 12); 1067 | clreol(); 1068 | ehouse = getche(); 1069 | ehouse = toupper(ehouse); 1070 | if (ehouse == '0') 1071 | return; 1072 | if (ehouse == 13) 1073 | { 1074 | ehouse = house; 1075 | gotoxy(22, 12); 1076 | cout << ehouse; 1077 | } 1078 | } while (ehouse != 'Y' && ehouse != 'N'); 1079 | do 1080 | { 1081 | gotoxy(5, 25); 1082 | clreol(); 1083 | cout << "ALLOTED CONVENCE ALLOWANCE or FOR NO CHANGE"; 1084 | gotoxy(22, 13); 1085 | clreol(); 1086 | econv = getche(); 1087 | econv = toupper(econv); 1088 | if (econv == '0') 1089 | return; 1090 | if (econv == 13) 1091 | { 1092 | econv = convense; 1093 | gotoxy(22, 13); 1094 | cout << econv; 1095 | } 1096 | } while (econv != 'Y' && econv != 'N'); 1097 | } 1098 | do 1099 | { 1100 | valid = 1; 1101 | gotoxy(5, 25); 1102 | clreol(); 1103 | cout << "ENTER LOAN AMOUNT or FOR NO CHANGE"; 1104 | gotoxy(22, 14); 1105 | clreol(); 1106 | gets(t1); 1107 | t2 = atof(t1); 1108 | eloan = t2; 1109 | if (eloan > 50000) 1110 | { 1111 | valid = 0; 1112 | gotoxy(5, 25); 1113 | clreol(); 1114 | cout << "\7SHOULD NOT GREATER THAN 50000"; 1115 | getch(); 1116 | } 1117 | } while (!valid); 1118 | if (strlen(t1) == 0) 1119 | { 1120 | eloan = loan; 1121 | gotoxy(22, 14); 1122 | cout << eloan; 1123 | } 1124 | if (egrade != 'E') 1125 | { 1126 | do 1127 | { 1128 | valid = 1; 1129 | gotoxy(5, 25); 1130 | clreol(); 1131 | cout << "ENTER BASIC SALARY or FOR NO CHANGE"; 1132 | gotoxy(22, 15); 1133 | clreol(); 1134 | gets(t1); 1135 | t2 = atof(t1); 1136 | ebasic = t2; 1137 | if (t1[0] == '0') 1138 | return; 1139 | if (ebasic > 50000) 1140 | { 1141 | valid = 0; 1142 | gotoxy(5, 25); 1143 | clreol(); 1144 | cout << "\7SHOULD NOT GREATER THAN 50000"; 1145 | getch(); 1146 | } 1147 | } while (!valid); 1148 | if (strlen(t1) == 0) 1149 | { 1150 | ebasic = basic; 1151 | gotoxy(22, 15); 1152 | cout << ebasic; 1153 | } 1154 | } 1155 | gotoxy(5, 25); 1156 | clreol(); 1157 | do 1158 | { 1159 | gotoxy(5, 18); 1160 | clreol(); 1161 | cout << "Do you want to save (y/n) "; 1162 | ch = getche(); 1163 | ch = toupper(ch); 1164 | if (ch == '0') 1165 | return; 1166 | } while (ch != 'Y' && ch != 'N'); 1167 | if (ch == 'N') 1168 | return; 1169 | MODIFY_RECORD(ecode, ename, eaddress, ephone, edesig, egrade, ehouse, econv, eloan, ebasic); 1170 | gotoxy(5, 23); 1171 | cout << "\7Record Modified"; 1172 | gotoxy(5, 25); 1173 | cout << "Press any key to continue..."; 1174 | getch(); 1175 | } 1176 | 1177 | /* THIS FUNCTION GIVE CODE NO. FOR THE DELETION OF THE 1178 | EMPLOYEE RECORD */ 1179 | 1180 | void EMPLOYEE::DELETION(void) 1181 | { 1182 | system("cls"); 1183 | char t1[10], ch; 1184 | int t2, ecode; 1185 | gotoxy(72, 2); 1186 | cout << "<0>=EXIT"; 1187 | gotoxy(5, 5); 1188 | cout << "Enter code of the Employee "; 1189 | gets(t1); 1190 | t2 = atoi(t1); 1191 | ecode = t2; 1192 | if (ecode == 0) 1193 | return; 1194 | system("cls"); 1195 | if (!FOUND_CODE(ecode)) 1196 | { 1197 | gotoxy(5, 5); 1198 | cout << "\7Record not found"; 1199 | getch(); 1200 | return; 1201 | } 1202 | gotoxy(72, 2); 1203 | cout << "<0>=EXIT"; 1204 | gotoxy(24, 3); 1205 | cout << "DELETION OF THE EMPLOYEE RECORD"; 1206 | DISPLAY_RECORD(ecode); 1207 | do 1208 | { 1209 | gotoxy(5, 24); 1210 | clreol(); 1211 | cout << "Do you want to delete this record (y/n) "; 1212 | ch = getche(); 1213 | ch = toupper(ch); 1214 | if (ch == '0') 1215 | return; 1216 | } while (ch != 'Y' && ch != 'N'); 1217 | if (ch == 'N') 1218 | return; 1219 | DELETE_RECORD(ecode); 1220 | LINES L; 1221 | L.CLEARDOWN(); 1222 | gotoxy(5, 23); 1223 | cout << "\7Record Deleted"; 1224 | gotoxy(5, 25); 1225 | cout << "Press any key to continue..."; 1226 | getch(); 1227 | } 1228 | 1229 | 1230 | 1231 | // THIS FUNCTION RETURN 0 IF THE GIVEN DATE IS INVALID 1232 | 1233 | 1234 | int EMPLOYEE::VALID_DATE(int d1, int m1, int y1) 1235 | { 1236 | int valid = 1; 1237 | if (d1>31 || d1<1) 1238 | valid = 0; 1239 | else if (((y1 % 4) != 0 && m1 == 2 && d1>28) || ((y1 % 4) == 0 && m1 == 2 && d1>29)) 1240 | valid = 0; 1241 | else if ((m1 == 4 || m1 == 6 || m1 == 9 || m1 == 11) && d1>30) 1242 | valid = 0; 1243 | return valid; 1244 | } 1245 | 1246 | // THIS FUNCTION PRINTS THE SALARY SLIP FOR THE EMPLOYEE 1247 | 1248 | void EMPLOYEE::SALARY_SLIP(void) 1249 | { 1250 | system("cls"); 1251 | char t1[10]; 1252 | int t2, ecode, valid; 1253 | gotoxy(72, 2); 1254 | cout << "<0>=EXIT"; 1255 | gotoxy(5, 5); 1256 | cout << "Enter code of the Employee "; 1257 | gets(t1); 1258 | t2 = atoi(t1); 1259 | ecode = t2; 1260 | if (ecode == 0) 1261 | return; 1262 | system("cls"); 1263 | if (!FOUND_CODE(ecode)) 1264 | { 1265 | gotoxy(5, 5); 1266 | cout << "\7Record not found"; 1267 | getch(); 1268 | return; 1269 | } 1270 | fstream file; 1271 | file.open("EMPLOYEE.DAT", ios::in); 1272 | file.seekg(0, ios::beg); 1273 | while (file.read((char *) this, sizeof(EMPLOYEE))) 1274 | { 1275 | if (code == ecode) 1276 | break; 1277 | } 1278 | file.close(); 1279 | int d1, m1, y1; 1280 | struct date d; 1281 | getdate(&d); 1282 | d1 = d.da_day; 1283 | m1 = d.da_mon; 1284 | y1 = d.da_year; 1285 | char *mon[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "November", "December" }; 1286 | LINES L; 1287 | L.BOX(2, 1, 79, 25, 219); 1288 | gotoxy(31, 2); 1289 | cout << "NADEEM AKHTAR, PGDBA - 200754667"; 1290 | L.LINE_HOR(3, 78, 3, 196); 1291 | gotoxy(34, 4); 1292 | cout << "SALARY SLIP"; 1293 | gotoxy(60, 4); 1294 | cout << "Date: " << d1 << "/" << m1 << "/" << y1; 1295 | gotoxy(34, 5); 1296 | cout << mon[m1 - 1] << ", " << y1; 1297 | L.LINE_HOR(3, 78, 6, 196); 1298 | gotoxy(6, 7); 1299 | cout << "Employee Name : " << name; 1300 | gotoxy(6, 8); 1301 | cout << "Designation : " << desig; 1302 | gotoxy(67, 8); 1303 | cout << "Grade : " << grade; 1304 | L.BOX(6, 9, 75, 22, 218); 1305 | L.LINE_HOR(10, 71, 20, 196); 1306 | int days, hours; 1307 | if (grade == 'E') 1308 | { 1309 | do 1310 | { 1311 | valid = 1; 1312 | gotoxy(10, 21); 1313 | cout << "ENTER NO. OF DAYS WORKED IN THE MONTH "; 1314 | gotoxy(10, 11); 1315 | cout << "No. of Days : "; 1316 | gets(t1); 1317 | t2 = atof(t1); 1318 | days = t2; 1319 | if (!VALID_DATE(days, m1, y1)) 1320 | { 1321 | valid = 0; 1322 | gotoxy(10, 21); 1323 | cout << "\7ENTER CORRECTLY "; 1324 | getch(); 1325 | gotoxy(10, 11); 1326 | cout << " "; 1327 | } 1328 | } while (!valid); 1329 | do 1330 | { 1331 | valid = 1; 1332 | gotoxy(10, 21); 1333 | cout << "ENTER NO. OF HOURS WORKED OVER TIME "; 1334 | gotoxy(10, 13); 1335 | cout << "No. of hours : "; 1336 | gets(t1); 1337 | t2 = atof(t1); 1338 | hours = t2; 1339 | if (hours > 8 || hours < 0) 1340 | { 1341 | valid = 0; 1342 | gotoxy(10, 21); 1343 | cout << "\7ENTER CORRECTLY "; 1344 | getch(); 1345 | gotoxy(10, 13); 1346 | cout << " "; 1347 | } 1348 | } while (!valid); 1349 | gotoxy(10, 21); 1350 | cout << " "; 1351 | gotoxy(10, 11); 1352 | cout << " "; 1353 | gotoxy(10, 13); 1354 | cout << " "; 1355 | } 1356 | gotoxy(10, 10); 1357 | cout << "Basic Salary : $ "; 1358 | gotoxy(10, 12); 1359 | cout << "ALLOWANCE"; 1360 | if (grade != 'E') 1361 | { 1362 | gotoxy(12, 13); 1363 | cout << "HRA : $ "; 1364 | gotoxy(12, 14); 1365 | cout << "CA : $ "; 1366 | gotoxy(12, 15); 1367 | cout << "DA : $ "; 1368 | } 1369 | else 1370 | { 1371 | gotoxy(12, 13); 1372 | cout << "OT : $ "; 1373 | } 1374 | gotoxy(10, 17); 1375 | cout << "DEDUCTIONS"; 1376 | gotoxy(12, 18); 1377 | cout << "LD : $ "; 1378 | if (grade != 'E') 1379 | { 1380 | gotoxy(12, 19); 1381 | cout << "PF : $ "; 1382 | } 1383 | gotoxy(10, 21); 1384 | cout << "NET SALARY : $ "; 1385 | gotoxy(6, 24); 1386 | cout << "CASHIER"; 1387 | gotoxy(68, 24); 1388 | cout << "EMPLOYEE"; 1389 | float HRA = 0.0, CA = 0.0, DA = 0.0, PF = 0.0, LD = 0.0, OT = 0.0, allowance, deduction, netsalary; 1390 | if (grade != 'E') 1391 | { 1392 | if (house == 'Y') 1393 | HRA = (5 * basic) / 100; 1394 | if (convense == 'Y') 1395 | CA = (2 * basic) / 100; 1396 | DA = (5 * basic) / 100; 1397 | PF = (2 * basic) / 100; 1398 | LD = (15 * loan) / 100; 1399 | allowance = HRA + CA + DA; 1400 | deduction = PF + LD; 1401 | } 1402 | else 1403 | { 1404 | basic = days * 30; 1405 | LD = (15 * loan) / 100; 1406 | OT = hours * 10; 1407 | allowance = OT; 1408 | deduction = LD; 1409 | } 1410 | netsalary = (basic + allowance) - deduction; 1411 | gotoxy(36, 10); 1412 | cout << basic; 1413 | if (grade != 'E') 1414 | { 1415 | gotoxy(22, 13); 1416 | cout << HRA; 1417 | gotoxy(22, 14); 1418 | cout << CA; 1419 | gotoxy(22, 15); 1420 | cout << DA; 1421 | gotoxy(22, 19); 1422 | cout << PF; 1423 | } 1424 | else 1425 | { 1426 | gotoxy(22, 13); 1427 | cout << OT; 1428 | } 1429 | gotoxy(22, 18); 1430 | cout << LD; 1431 | gotoxy(33, 15); 1432 | cout << "$ " << allowance; 1433 | gotoxy(33, 19); 1434 | cout << "$ " << deduction; 1435 | gotoxy(36, 21); 1436 | cout << netsalary; 1437 | gotoxy(2, 1); 1438 | getch(); 1439 | } 1440 | 1441 | // MAIN FUNCTION CALLING MAIN MENU 1442 | 1443 | void main(void) 1444 | { 1445 | MENU menu; 1446 | menu.MAIN_MENU(); 1447 | } 1448 | --------------------------------------------------------------------------------