0% found this document useful (0 votes)
5 views48 pages

Payroll Management System in C++

This document describes a project to develop a management system to generate a payroll for the Santa María supermarket company using C++. The system will allow for the entry, modification, consultation, and display of information related to the payroll. The project follows the waterfall development model and applies concepts of structured and object-oriented programming learned in class. The system will streamline the processes related to payroll for the company's users.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views48 pages

Payroll Management System in C++

This document describes a project to develop a management system to generate a payroll for the Santa María supermarket company using C++. The system will allow for the entry, modification, consultation, and display of information related to the payroll. The project follows the waterfall development model and applies concepts of structured and object-oriented programming learned in class. The system will streamline the processes related to payroll for the company's users.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chimborazo Polytechnic School

OCTOBER 2016 - MARCH 2017 SEMESTER

PROJECT REPORT

IDENTIFICATION
Faculty: Computer Science and Electronics

Career: Systems Engineering

Subject: Structured Programming

Semester: According to 'B'

Teacher: Ing. Blanca Hidalgo

Members: Guamán Romero Lourdes María (6256)


Minina Anastasia (6229)
Jumbo Cando Leidy Lucia(6286)

Date: January 24, 2017

Reviewed
Rating
Table of contents

1. Theme ...................................................................................................................... 3
2. Objectives ...............................................................................................................3
General Objective
.................................................................................................... 3
Specific objectives .......................................................................................... 3
3. Description of the problem ........................................................................... 3
4. Scope ...................................................................................................................4
5. Justification or proposed solution ................................................. 5
6. Theoretical Framework .................................................................................................... 6
7. Project Design .....................................................................................19
8. Coding in C++ .................................................................................... 20
Graphic Mode....................................................................................................... 20
General Code .................................................................................................. 23
9. Main program screen .......................................................... 46
10. Conclusions ........................................................................................ 47
11. Recommendations ............................................................................. 47
12. Bibliography ............................................................................................ 48

2
1. TOPIC: Payroll for the Santa María supermarket company.

2. OBJECTIVES

a. General objective
Develop a management system that allows generating a role of
Payments for the Santa María supermarket company using
the C++ language.

b. Specific objectives
Analyze each of the requirements required by the
user.
Design a global structure for the functioning of the
program, specify what each one of its should do
parts and how they will relate.
Develop and implement the necessary algorithms for the
compliance with the requirements of the user based on
what was learned in class.

Check that the program works correctly and that


meets the requirements.

3. DESCRIPTION OF THE PROBLEM

Currently, the advancement of technology has caused certain


companies seek a way or means to stay updated either
as a method of innovation or as a strategy to be able to reduce
the time in their daily tasks, for this certain aspects are being developed
programs that make it easier for them to improve their daily work, such as for example

a payroll, this involves many calculations and data entry,


which over time can be lost or misplaced by doing
thus difficult the location of certain information.

3
At the Santa María supermarket company, generate a payroll.
includes a lot of paperwork and time, so the people in charge of
this procedure requests that their work be made a little easier.
While conducting certain research about the functioning of this
a greater problem has been detected in the payment role in the company
which this research topic has focused on.

4. SCOPE

This project will contribute to an entity or company to improve its

functioning regarding the area that manages payroll, since of


this way it will be possible to access certain information efficiently
which was previously very difficult to find, either due to lack of time
or a lot of paperwork.

It has focused on a company that distributes and markets products.


for the home, in which the purpose is to create a program that facilitates
the management that is carried out month by month, such as a payroll role in

this project will allow:

enter data into the registry


Make inquiries
Get a general list
Modify
Delete records
Show the total to pay
It will provide assistance to the user and

Exit

Accelerating the manipulation and modification of data in this way.


This program will not be online, that is, it is not accessible through
internet will not allow obtaining printed information either.

4
5. JUSTIFICATION OR PROPOSAL OF SOLUTION

With the implementation of this project, knowledge will be captured.


theoretical and practical knowledge obtained in class, in the same way it will be obtained

certain experience with which knowledge will be gained


necessary for good performance in our field and to be competitive
in everything we do later.

The present project will focus on the creation of a program that


allow the user to enter, modify, inquire, etc. Different
information regarding a payment role, being the main ones
beneficiaries the users who fill it out, reducing from a
significantly the time it takes to fill and store this
information.

To carry out this project, the steps of the model will be followed.
waterfall for software development, in the same way the
necessary information about payment role management and finally
the knowledge and skills that each of us possess will be applied
we

5
THEORETICAL FRAMEWORK

Borland C++

Figure 1. Borland C++ logo

C++ is a programming language designed in the mid-


1980 by Bjarne Stroustrup. The intention of its creation was to extend
to the successful programming language C with mechanisms that allow the
manipulation of objects. In this sense, from the point of view of the
Object-oriented languages, C++ is a hybrid language.
Subsequently, generic programming facilities were added, which
it joined the other two paradigms that were already accepted
(structured programming and object-oriented programming). By
it is commonly said that C++ is a programming language
multiparadigm.
Currently, there is a standard called ISO C++, which has been
most modern compiler manufacturers have adhered.
There are also some interpreters, such as ROOT.
A particularity of C++ is the possibility of redefining operators.
(operator overloading), and to be able to create new types that
they behave like fundamental types.
The name C++ was proposed by Rick Mascitti in the year 1983, when
the language was used for the first time outside of a laboratory

6
scientific. Previously, the name 'C with classes' had been used. In C++, the

"C++" means "increment of C" and refers to the fact that C++ is
an extension of C.

What is a programming language?

Aprogramming languageIt is an artificial language that can be used


to define or prepare instructions that will then be executed by the
PC.

The language used by theprocessorit is called machine language.


It is about data as it arrives at the processor, which consists of a
series of 0 and 1 (binary data).

Machine language, therefore, is not understandable for beings


humans, which is why intermediate languages have been developed
understandable for man. The code written in this type of language
is transformed into machine code so that the processor can
process it.

Therefore, a programming language has several advantages:

it is much easier to understand than a machine language:

allows greater portability, meaning it can adapt easily


to run on different types of equipment.

What is an algorithm?

An algorithm can be defined as a sequence of instructions that


they represent a solution model for a certain type of problems.
Or as a set of instructions that are executed in order
lead to obtaining the solution to a problem. Therefore, we can
to say that it is a finite and ordered set of steps that allows us to
solve a problem.
Algorithms are independent of programming languages.
each problem the algorithm can be written and then executed in a

7
language of different programming. The algorithm is the infrastructure of
any solution, written later in any programming language.

PARTS OF AN ALGORITHM

Every algorithm must have the following parts:

Data input, are the necessary data that the algorithm


needs to be executed.
Process is the sequence of steps to execute the algorithm.
Output results are the data obtained after the
execution of the algorithm.

Figure 2. Parts of an algorithm.

TECHNIQUES OF REPRESENTATION

For the representation of an algorithm, before being converted to


programming language, some methods are used
written, graphic, or mathematical representation. The most methods
known are:

Free diagramming (Flow charts).


Nassi-Shneiderman diagrams.
Pseudocode.
Natural language (Spanish, English, etc.).
Fundamental characteristics of the algorithm

8
Thealgorithmit's finished: The algorithm that we will develop
it must necessarily have a certain set of
instructions.
The algorithm is precise: The algorithm is constituted by a
set of instructions that will be executed step by step.
The algorithm is defined: The algorithm followed two or more times
shows similar results.

Sentences

The if statement

Allows a previously predetermined action by the


programmer, which will be fulfilled if the condition has a logical value
true (according to the truth table it is 1) or logical false value
(according to the truth table, it is 0).

Its syntax:
if (expression) {

sentence_1;

else /* Optional */

Switch:

It is a multiple selection statement in C. It is used to choose


a path among several alternative paths of execution
program.

Its syntax is:

switch (variable) {

case 1:

9
sequence of sentences;

break;

default:

sequence of statements;

break;

While

This loop structure allows the programmer to specify


the times an action is repeated while a condition is
keep true.

Figure 3. while loop


Its syntax is:

while (condition)

Instruction block

};

Do while

10
It is about repeating the body of the loop (group of statements),
until the condition becomes false (null value), or rather,
we are going to execute the group of statements while the condition
if true (non-null value), then, at a minimum always
we will execute the loop body at least once.

Its syntax is:


do{

Operation block;

} while (digit <= n);

For loop
A for loop is an iterative control structure that allows us to
execute a block of instructions repeatedly
knowing in advance a starting value, a step size and
a final value for the cycle.

Registers in C++

Figure 4. Example of registration.

A record, in programming, is a structured data type.


formed by the union of several elements under the same
structure. These elements can be either elementary data

11
(integer, real, character), or other data structures. To each
one of those elements is called field.

Files in C++

Set of related information, treated as a unit of


structured memory storage for
facilitate the search for individual data.
A file is composed of homogeneous records that contain
information organized in fields.
Field is the smallest unit of processing with its own meaning.

In a high-level language, the file is not handled directly by


not by the program itself, but by the Operating System. This makes it easier for the

portable programs.

BASIC DEFINITIONS

Basically, they refer to individual testimonies.


related to facts, whether they are characteristics of certain objects
study or particular conditions of given situations.

Record: It is the complete set of related data belonging


to an entrance.

File: In computational terms, it is a collection of data that


it has a name and is stored on storage devices
secondary, which can be magnetic, optical, electronic, etc.

File opening
Before writing or reading data from a file, it is necessary to open it. When opening

the file establishes communication between the program and the system
operation on how to access it. It is necessary for the program to

12
provide the operating system with the full name of the file and the
intention of use (reading or writing data), then areas are defined
communication between them.

Classification of files by content type

Figure 5. Classification of files by content

Text files
They are those that can contain any kind of data and in such a way
so that they are "understandable" for the people. The data in a file of
text is stored using ASCII code, in which each character is
represented by a simple byte.
Binary files
This type of files store numerical data with its
binary representation. They can be files that contain instructions
in machine language ready to be executed.

File classification by access type

Figure 6. Classification of files by access type.

Sequential files
As its name suggests, in this type of files the records are
they are recorded in sequence or consecutively and must be accessed from that

13
in the same way, that is, as new records are inserted,
these are stored at the end of the last stored record;
Direct files (relative, direct access or random access)
Unlike sequential files, in direct files it is not
it is necessary to go through it completely to access a record in
In particular, if the internal pointer of the file cannot be placed
directly in the desired register, allowing for greater
speed of access.

FUNCTIONS:
Functionfopen:

Syntax:

FILE *fopen(char *name, char *mode);

This function is used to open and create files on disk. The return value is a
pointer to a structureFILE.

Figure 7. Functions to open a file

Functionfclose:

Syntax:

int fclose(FILE *file);

14
It is important to close the open files before leaving the
fffapplication. This function serves for that.

Functionfwrite:

Syntax:

size_t fwrite(void *pointer, size_t size, size_t num_records, FILE


*file);

This function is also designed to work with length records.


constant and even shape with fread. It is able to write to a file.
one or several records of the same length stored from a
determined memory address.

Reading records using fread()


The fread function allows you to "load" all the fields of a record into a
file, that is, it reads a record and copies it into RAM. This
the function has the same arguments as the fwrite function.
Reference points of the fseek() function
The last argument of the fseek function is known as the position of
reference or the mode and refers to where the counting will begin from
bytes determined by the physical address

15
Figure 8. Function fseek
Functionftell:

Syntax:

long int ftell(FILE *file);

The ftell function is used to find out the current position of the cursor.
reading/writing a file.

GRAPHICAL MODE

Figure 9. Example of graphical mode


The functions performed by graphics in C is to allow for generating
drawings and presentations of the programs in general (that is, the way
how they appear to the user.

To create graphics in C++, we need to set the system in mode


graph. To do this, we must include the library in our program
graphics GRAPHICS.H

#include<graphics.h>

To initialize the graphics mode, the function initgraph() is used and to


stop the function closegraph () .

16
Most used functions:
rectangle (int X1, int Y1, int X2, int Y2);
Draw a rectangle without fill on the screen marked by the
points (X1, Y1) and (X2, Y2), where X1 is the leftmost edge of
rectangle, Y1 is the upper end, X2 is the right end and
Y2 the lower end of the rectangle.

• circle (int X, int Y, int radius);


Draw a circle (whose radius size is given by the variable
radio) on the screen centered at the points (X, Y). circle (100, 100,
10);

(int X1, int Y1, int X2, int Y2);


Draw a straight line starting at the points X1, Y1; ending at
X2, Y2 line (100, 200, 300, 400);

• ellipse (int X, int Y, int stangle, int endangle, int xradius, int
yradius);
Draw an ellipse centered at the points X, Y. stangle and endangle
they indicate the initial and final angle of the elliptical arc to be drawn.

AVAILABLE COLORS

17
Figure 10. Colors in graphic mode
Set text size and style

To indicate the format of the text that will appear on screen during the
In graphic mode, the settextstyle function is used:
settextstyle(int font, int direction, int charsize);

The value of Font is a constant that indicates the font to be used.

The available constants are:


DEFAULT_FONT
TRIPLEX_FONT
SMALL_FONT
SANS_SERIF_FONT
GOTHIC_FONT

Direction is a constant that indicates the orientation of the text, it can be


HORIZ_DIR (the text is displayed horizontally from left to right)
VERT_DIR (the text is displayed vertically from bottom to top)
up).
Charsize corresponds to an integer that indicates the size of
the source. The values range from zero onwards, increasing the size
from the letter. The format for drawing text is established below.
settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 4);

Once the format of the text is indicated, we can display it on the screen.

a legend through the outtextxy() function:


outtextxy(int x, int y, char *textstring);

The values of x and y establish the coordinates where the text


It will be drawn. Textstring refers to the string of characters that
will be displayed on screen.

18
outtextxy (100,200,"This is graphic mode");
7. PROJECT DESIGN
The program features a start screen, where you will be asked for the
username and password, for access to the main menu.
The main menu will display a screen that will contain the
following options:
Enter data into the registry
Consult a record
List
Modify a record
Delete a record
Show total to pay
Help and instructions of the program
Leave
The following submenu is found in the option to consult a record,
with the following options:
Consultation by ID number
Consult by last name
Inquiry by department
Back to main menu

19
8. CODING IN C++
8.1. GRAPHICAL MODE

# include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
#include <stdlib.h>
main()
{

int gd = DETECT, gm, x, y, color, angle = 0, i = 0; // Initializes local variables


struct arccoordstype a, b;
initgraph(&gd, &gm, "C:\TC\BGI"); // Initializes graphic variables
delay(2000);
while(angle<=360) /* Controls the circles that appear */
{
setcolor(15);
outtextxy(0,0,"0.....___________...___________._____...0."); //marco
0.....___________...___________._____...0.
setcolor(BLACK);
arc(getmaxx()/2,getmaxy()/2,angle,angle+2,200); /* Draws an arc */
setcolor(RED);
getarccoords(&a); /* coordinates */
circle([Link],[Link],5); /* Draw a circle */
settextstyle(7,0,3); /* Text style */
setcolor(RED); /* text color */
outtextxy(190,150,"FINAL PROJECT"); /* To put a text */
arc(getmaxx()/2,getmaxy()/2,angle,angle+2,200);
getarccoords(&a);
setcolor(GREEN);
circle([Link], [Link], 10);
angle = angle + 5;
setcolor(3);
settextstyle(2,0,5);
CHIMBORAZO POLYTECHNIC HIGH SCHOOL
settextstyle(2,0,5);
SCHOOL OF ENGINEERING IN SYSTEMS
delay(50);
}
setbkcolor (0); /* Assigns a color to the screen */
cleardevice(); /* Clears the screen */
setcolor(1);
settextstyle(4,0,0); /* Text style */
rectangle(5,20,626,450); /* Draws a rectangle for the frame */

20
setcolor(3);
settextstyle(7,0,2); /* Text style */
outtextxy(300,120," MEMBERS: "); /* To put text */
setcolor(15);
settextstyle(2,0,5);
LOURDES GUAMAN
settextstyle(4,0,0);
setcolor(15);
settextstyle(2,0,5);
LEIDY JUMBO
setcolor(15);
set text style(2,0,5);
ANASTASIA MININA
setcolor(1);
rectangle(25,45,605,430);
settextstyle(4,0,0);
rectangle(50,65,580,410);
setcolor(3);
settextstyle(7,0,2);
PARALLEL:
settextstyle(4,0,0);
setcolor(15);
settextstyle(2,0,5);
2° 'B' SYSTEMS
settextstyle(4,0,0);
setcolor(3);
settextstyle(7,0,2);
THEME:
settextstyle(4,0,0);
setcolor(15);
settextstyle(2,0,5);
PAYROLL
settextstyle(4,0,0);
int angles=0;
while(angles<=360)
{
setcolor(BLACK); /*Assign a color */
arc(getmaxx()/4.5,getmaxy()/3.1,angles,angles+1,55); /* Arc of circles with different
dimensions */
setcolor(13);
getarccoords(&a); /* Coordinates */
circle([Link],[Link],8); /*Draws a circle*/
arc(getmaxx()/4.5,getmaxy()/3.1,angles,angles+1,39);
setcolor(5);
getarccoords(&a);
circle([Link],[Link],8);
arc(getmaxx()/4.5,getmaxy()/3.1,angles,angles+2,31);
setcolor(12);

21
getarccoords(&a);
circle([Link],[Link],8);
arc(getmaxx()/4.5,getmaxy()/3.1,angles,angles+2,19);
setcolor(4);
getarccoords(&a);
circle([Link],[Link],8);
arc(getmaxx()/4.5,getmaxy()/3.1,angles,angles+1,9);
setcolor(6);
getarccoords(&a);
circle([Link], [Link], 8);
arc(getmaxx()/4.5,getmaxy()/3.1,angles,angles+1,70);
getarccoords(&a);
setcolor(3);
circle([Link], [Link], 8);
angles = angles + 5;
delay(50);
}
int angless=0;
while(angless<=360)
{
setcolor(BLACK); /*Assigns a color */
arc(getmaxx()/4.5,getmaxy()/1.45,angless,angless+3,55); // Arc with different dimensions
setcolor(15);
getarccoords(&a); /* Coordinates */
circle([Link],[Link],4); /* Draw a circle */
arc(getmaxx()/4.5,getmaxy()/1.45,angless,angless+3,40);
setcolor(1);
getarccoords(&a);
circle([Link], [Link], 4);
arc(getmaxx()/4.5,getmaxy()/1.45,angless,angless+3,17);
setcolor(15);
getarccoords(&a);
circle([Link], [Link], 4);
arc(getmaxx()/4.5,getmaxy()/1.45,angless,angless+3,5);
setcolor(1);
getarccoords(&a);
circle([Link], [Link], 6);
settextstyle(7,0,3);
arc(getmaxx()/4.5,getmaxy()/1.45,angless,angless+3,70);
setcolor(1);
getarccoords(&a);
circle([Link],[Link],4);
angless = angless + 5;
delay(50);
}
getch(); /* Wait a moment */
closegraph(); /* Closes */
}

22
8.2. GENERAL CODE

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <conio.h>
#include <iostream.h>
#include <windows.h>
#include <fstream>
#include <iostream>
#include <string>
#include <iomanip>
#include <cstring>
#include <stdlib.h>
manager
santa maria
#define S cout<<
#define L 100

bool validate_id(char number[])


{
int i=0, sw=0,j;
j = strlen(number);
if (j==10)
{
while (i<j && sw==0)
{
if (isdigit(number[i])!=0)
{
i++;
}
else
{
sw=1;
}
}
}
else
sw=1;
return sw;
}

bool validate_numbers(char number[])


{
int i=0, sw=0,j;
j = strlen(number);

23
while (i < j && sw == 0)
{
if (isdigit(number[i]) != 0)
{
i++;
}
else
{
sw=1;
}
}

return sw;
}

bool validate_salary(char line[])


{
int i=0, sw=0,j;
j=strlen(line);
while (i < j && sw == 0)
{
if (line[i] != '.')
{
if (isdigit(linea[i]) != 0)
{
i++;
}
else
{
sw=1;
}
}
else
i++;
}

return sw;

bool validate_letters(char line[])


{
int i=0, sw=0,j;
j=strlen(line);
while (i<j && sw==0)
{
if (linea[i] != ' ')

24
{
if (isalpha(linea[i])!=0)
{
i++;
}
else
{
sw=1;
}
}
else
i++;
}

return sw;

bool validate_insurance(char line[])


{
int i=0, sw=0,j;
j=strlen(line);
if (j!=1)
sw=1;
if (toupper(linea[0])!='S' && toupper(linea[0])!='N')
1

return sw;
}

struct cargo_ocupa
{
char cargo[L];
int num_hours;
};

struct record_type
{
char num_ced[L];
char name[L];
char surname[L];
char depar[L];
cargo_occupies occupation;
int c_fam;
int h_ext;
float salary;
char insurance;

25
};
Record
FILE *alias;

Line text color with windows.h that will allow writing the color in a single line

void t(int n)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), n);
}
Emulated gotoxy with windows.h that will allow you to write on the line you want without doing a
Clear Screen.
void g(int x, int y)
{
HANDLE coss = GetStdHandle(STD_OUTPUT_HANDLE);
COORD Pcoss;
Pcoss.X = x;
Pcoss.Y = y;
SetConsoleCursorPosition(coss, Pcoss);
}

Colored coordinates for special cases


Example
gt(3,4,white);

where 3 is the spacing ' '


where the 4 is the line
*/
void gt(int x, int y, int n)
{
g(x,y)
}

void Limit(int lim)


{
int i, j=1, w;
Loading, please wait.
t(1);

for (i= 1; i<78 ; i++)


{
Sleep(5);
g(1,1); printf("%c",201);
g(78,1); printf("%c",187);
g(i,1); printf("%c",205);
g(i,lim); printf("%c",205);

if(i%2==0)

26
{
if(j<lim)
{
j++;
g(1,j); printf("%c",186);
g(78,j); printf("%c",186);
}
}
g(78,lim); printf("%c",188);
g(1,lim); printf("%c",200);
}

g(1,1); printf("%c",201);
g(78,1); printf("%c",187);
g(78,lim); printf("%c",188);
g(1,lim); printf("%c",200);
gt(28,23,3); printf(" ");

void square(int ci, int cf, int fi, int ff)


{
int o;
t(3);

for(o=ci; o<=cf; o++)


{
gotoxy(o,fi); S"ßß";
gotoxy(o,ff); S"ßß";
}

for(o=fi; o<=ff; o++)


{
gotoxy(ci,o);S"ÛÛ";
gotoxy(cf,o);S"ÛÛ";
}

gotoxy(ci, fi); S"Û";


gotoxy(cf,fi); S"ÛÛ";
gotoxy(ci,ff); S"ßß";
gotoxy(cf, ff); S"ßß";
}

void REGISTER_EMPLOYEE(void)
{
int num_ced;
char line[L];

27
char hours[L];
bool isNumeric(string);

frame(18,62,3,5);
Limit(22);
gotoxy(23,4);
textcolor(5);
<<< PERSONAL REGISTRATION RECORDS >>>
alias=fopen("[Link]","rb+");
if(alias==NULL)
alias=fopen("[Link]","wb");
do
{
gotoxy (23,9);
cprintf(" ");
gotoxy(4,9);
textcolor(8);
printf("ID number (10 digits): "); gets(line);
} while (validate_id(line)!=0);

fread(&Record,sizeof(Record),1,alias);

while(!feof(alias))
{
if(strcmp(Registro.num_ced,linea)==0)
{
gotoxy(20,11);
textcolor(3);
Duplicate record!
gotoxy(20,12);
Press any key to continue . . .
fclose(alias);
getch();
return;
}

fread(&Record,sizeof(Record),1,alias);

strcpy(Registro.num_ced,linea);
do
{
gotoxy(13,10);cprintf(" ") ");
gotoxy(4,10); cprintf("Name (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

28
do
{
gotoxy(15,11);cprintf(" ") ");
gotoxy(4,11); cprintf("Last name (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

do
{
gotoxy(36,12);cprintf(" ") ");
gotoxy(4,12);cprintf("Department (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

do
{
gotoxy(22,13);cprintf(" ") ");
gotoxy(4,13);cprintf("Position (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

do
{
gotoxy(32,14);cprintf(" ") ");
gotoxy(4,14); cprintf("Daily hours (Number 1-24): ");
gets(line); [Link].num_hours = atoi(line);
}while(validate_numbers(line)!=0 || ([Link].num_hours<1 ||
[Link].hours_num > 24);

do
{
gotoxy(27,15);cprintf(" ");
gotoxy(4,15); cprintf("Extra hours (number): "); gets(linea);
}while (validate_numbers(line)!=0);
Registro.h_ext=atoi(line);

do
{
gotoxy(21,16);cprintf(" ") ");
gotoxy(4,16); cprintf("Salary (number and points): "); gets(linea);
}while(validate_salary(line)!=0);
atof(linea);

do
{
gotoxy(32,17);cprintf(" ") ");
gotoxy(4,17); cprintf("Family dependents (number): "); gets(linea);
}while(validate_numbers(line)!=0);
Registro.c_fam=atoi(line);

29
do
{
gotoxy(18,18);cprintf(" ") ");
gotoxy(4,18); cprintf("Sure (Y/N): "); gets(line);
}while(validate_insurance(line)!=0);
linea[0];

fwrite(&Record, sizeof(Record), 1, alias);


fclose(alias);
gotoxy(34,20); textcolor(3); cprintf("Employee registered!");
gotoxy(34,21); textcolor(3); cprintf("Press any key to continue . . . ");
getch();
return;
}

void CONSULTATION_ID(void)
{
char num_ced[L];
Limit(22);
frame(18,62,3,5);
gotoxy(28,4);
textcolor(5);
<<< QUERY BY ID >>>
alias=fopen("[Link]","rb");

if(alias==NULL)
{
g(18,8); printf("File not found!");
g(18,9); printf("Press any key to continue . . .");
getch();
return;
}
gotoxy(18,6);
textcolor(8);
printf("Number of ID to consult: ");cin >> num_ced;
fread(&Record, sizeof(Record), 1, alias);

while(!feof(alias))
{
if(strcmp(Registro.num_ced, num_ced)==0 )
{
g(3,7); ID card printf("Name");g(23,7);
printf("Last Name");g(33,7); printf("Department");g(44,7); printf("Position");g(54,7); printf("H.");
[Link] Suel CF
Print 'Seg.';

30
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßßßßß");
t(8);
g(3,9);cout<<Registro.num_ced;g(14,9);cout<<[Link];g(23,9);
cout<<[Link];g(33,9);cout<<[Link];g(44,9);
cout << [Link]; g(54,9); cout << [Link].num_hours;
g(59,9); cout << Registro.h_ext; g(64, 9); cout << [Link]; g(70,9);
cout<<Registro.c_fam; g(74,9); cout<<[Link];
fclose(alias);
t(3);
g(20,11); printf("Press any key to continue . . .");
getch();
return;
}

fread(&Record,sizeof(Record),1,alias);
}
fclose(alias);
g(18,8); printf("Record not found!");
g(18,9); printf("Press any key to continue . . .");
getch();
return;
}

void CONSULTA_LASTNAME(void)
{
int comparison, n;
char last_name[L];
Limit(22);
frame(18,62,3,5);
gotoxy(28,4);
textcolor(5);
<<< QUERY BY LAST NAME >>>
alias=fopen("[Link]","rb");

if(alias==NULL)
{
g(18,8); printf("File not found!");
Press any key to continue . . .
getch();
return;
}
gotoxy(18,6);
textcolor(8);
Last name to inquire:
n = strlen(last_name);

31
g(3,7); printf("Cedula");g(14,7); printf("Nombre");g(23,7); printf("Apellido");g(33,7);
Depart. Cargo H.
[Link] Suel CF Seg.
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßßßßß");
fread(&Record,sizeof(Record),1,alias);
int f=9;
while(!feof(alias))
{
strncmpi(lastName, [Link], n);
t(8);

if(comparacion==0)
{
g(3,f); cout << Registro.num_ced; g(14, f);
cout << [Link]; g(23, f); cout << [Link]; g(33, f);
cout << [Link];g(44, f); cout << [Link]; g(54, f);
cout << [Link].num_horas;
g(59,f); cout<<Registro.h_ext;g(64,f); cout<<[Link];g(70,f);
cout<<Registro.c_fam; g(74,f); cout<<[Link];
f++;
}

fread(&Record, sizeof(Record), 1, alias);


}

fclose(alias);
t(3);
g(3,f);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßßßßß");
g(18,20); printf("Press any key to continue . . .");
getch();
return;
}

void DEPARTMENT_QUERY(void)
{
int comparison, n;
char depar[L];
Limit(22);
frame(18,62,3,5);
gotoxy(25,4);
textcolor(5);
<<< CONSULTATION BY DEPARTMENT >>>
alias=fopen("[Link]","rb");

32
if(alias==NULL)
{
g(18,8); printf("File not found!");
g(18,9); printf("Press any key to continue . . .");
getch();
return;
}
gotoxy(18,6);
textcolor(8);
printf("Department to consult: ");cin >> depar;
n=strlen(depar);
g(3,7); Print ID card; g(14,7); printf("Name");g(23,7); print("Last Name");g(33,7);
Depart. Cargo H.
[Link] Suel CF Seg.
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
fread(&Record,sizeof(Record),1,alias);

int f=9;
while(!feof(alias))
{
comparison = strncmpi(depar, [Link], n);
t(8);

if(comparison==0)
{
g(3,f); cout<<Registro.num_ced;g(14,f); cout<<[Link];g(23,f);
cout << [Link]; g(33, f); cout << [Link];g(44,f);
cout << [Link]; g(54,f); cout << [Link].num_hours;
g(59,f); cout<<Registro.h_ext;g(64,f); cout<<[Link];g(70,f);
cout << Registro.c_fam; g(74,f); cout << [Link];
f++;
}

fread(&Record, sizeof(Record), 1, alias);


}

fclose(alias);
t(3);
g(3,f);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
Press any key to continue . . .
getch();
return;
}

33
void LISTADO(void)
{
Limit(22);
frame(18,62,3,5);
gotoxy(30,4);
textcolor(5);
<<< GENERAL LIST >>>
alias=fopen("[Link]","rb");

if(alias==NULL)
{
g(18,8); printf("File not found!");
Press any key to continue . . .
getch();
return;
}

g(3,7); Print ID printf("Name");g(23,7); printf("Surname");g(33,7);


Depart. Cargo H.
[Link] Suel CF Seg.
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
fread(&Record, sizeof(Record), 1, alias);
int f=9;
while(!feof(alias))
{

t(8);

g(3,f); cout<<Registro.num_ced;g(14,f); cout<<[Link];g(23,f);


cout << [Link]; g(33, f); cout << [Link];g(44, f);
cout << [Link]; g(54,f); cout << [Link].num_hours;
g(59,f); cout<<Registro.h_ext;g(64,f); cout<<[Link]<<"$"; g(70,f);
cout << Registro.c_fam; g(74,f); cout << [Link];
f++;

fread(&Record, sizeof(Record), 1, alias);


}

fclose(alias);
t(3);
g(3,f);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
g(18,20); printf("Press any key to continue . . .");

34
getch();
return;
}
void MODIFICATION(void)
{
char num_ced[L];

char line[L];
char hours[L];
bool repeat = true;
bool isNumeric(string);
Limit(30);
square(18,62,3,5)

textcolor(5);
cprintf("<<< RECORDS MODIFICATION >>>");
alias=fopen("[Link]","rb+");

if(alias==NULL)
{
g(18,8); printf("File not found!");
Press any key to continue...
getch();
return;
}

gotoxy(20,9);
textcolor(8);
printf("ID number: ");cin >> num_ced;
fread(&Record,sizeof(Record),1,alias);

while(!feof(alias))
{
if(strcmp(Registro.num_ced, num_ced) == 0)
{

g(3,7); ID card printf("Name");g(23,7);


printf("Last Name");g(33,7); printf("Department");g(44,7); printf("Position");g(54,7); printf("H.");
[Link] Suel CF
Seg.
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");

t(8);
g(3,9);cout<<Registro.num_ced;g(14,9);cout<<[Link];g(23,9);
cout << [Link]; g(33,9); cout << [Link]; g(44,9);
cout << [Link]; g(54,9); cout << [Link].num_hours;

35
g(59,9); cout<<Registro.h_ext;g(64,9); cout << [Link]; g(70,9);
cout<<Registro.c_fam; g(74,9); cout<<[Link];
t(3);
g(3,10);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
gotoxy(4,13); textcolor(3); cprintf("Modify your record: ");
textcolor(8);

do
{
gotoxy(13,15);
cprintf(" ");
gotoxy(4,15); cprintf("Name (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

do
{
gotoxy(15,16);cprintf(" ");
gotoxy(4,16); cprintf("Last name (letters and spaces): "); gets([Link]);
} while (validate_letters(Record.last_name) != 0);

do
{
gotoxy(36,17);cprintf(" ") );gotoxy(4,17);
printf("Department (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

do
{
gotoxy(22,18);cprintf( ");
gotoxy(4,18);cprintf("Position (letters and spaces): "); gets([Link]);
} while (validate_letters([Link]) != 0);

do
{
gotoxy(32,19);cprintf(" ") ");
gotoxy(4,19); cprintf("Hours ")daily (Number 1-24): ");
gets(line); [Link].num_hours = atoi(line);
}while(validate_numbers(line)!=0 || ([Link].num_hours<1 ||
[Link].num_hours>24);

do
{
gotoxy(27,20);cprintf(" " ) ");

36
gotoxy(4,20); cprintf("Overtime (number): "); gets(linea);
} while (validate_numbers(line)!=0);
Registro.h_ext = atoi(line);
do
{
gotoxy(21,21);cprintf( ");
gotoxy(4,16); cprintf("Salary (number and points): "); gets(linea);
} while(validate_salary(line)!=0);
[Link] = atof(line);

do
{
gotoxy(32,22);cprintf(" ") ");
gotoXY(4,22); cprintf("Family burdens (number): "); gets(line);
} while(validate_numbers(line)!=0);
Registro.c_fam=atoi(line);

do
{
");
gotoxy(4,23); cprintf("Sure (Y/N): "); gets(line);
} while(validate_insurance(line)!=0);
linea[0];

fseek(alias, ftell(alias) - (sizeof(Registro)), SEEK_SET);


fwrite(&Record, sizeof(Record), 1, alias);
fclose(alias);
gotoxy(34,25); textcolor(3); cprintf("Record modified!");
gotoxy(34,26); textcolor(3); cprintf("Press any key to continue . . . ");
getch();
return;
}
fread(&Record, sizeof(Record), 1, alias);
}

g(18,10); printf("No record found!");


g(18,11); printf("Press any key to continue . . .");
fclose(alias);
getch();
return;
}

void DELETE1(char n[], char &op)


{
char line[100];
Limit(22);

37
frame(18,62,3,5);
gotoxy(28,4);
textcolor(5);
cprintf("<<< RECORD DELETION >>>");
alias=fopen("[Link]","rb");
if(alias==NULL)
{
g(18,8); printf("File not found!");
Press any key to continue . . .
getch();
return;
}
gotoxy(18,6);
textcolor(8);
printf("ID number to delete: ");cin >> n;
fread(&Record, sizeof(Record), 1, alias);

while(!feof(alias))
{
if(strcmp(Registro.num_ced, n)==0 )
{
g(3,7); Print ID card; g(14,7); printf("Name");g(23,7);
printf("Last Name");g(33,7); printf("Department");g(44,7); printf("Position");g(54,7); printf("H.");
[Link] Suel CF
print("Seg.");
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
t(8);
g(3,9); cout<<[Link];g(14,9); cout<<[Link];g(23,9);
cout<<[Link];g(33,9); cout << [Link]; g(44,9);
cout << [Link]; g(54,9); cout << [Link].num_hours;
g(59,9); cout<<Registro.h_ext;g(64,9); cout<<[Link];g(70,9);
cout<<Registro.c_fam; g(74,9); cout<<[Link];
fclose(alias);
t(3);
do{
g(48,11);printf(" Do you want to delete this record?
gets(line);
} while (validate_insurance(line)!=0);
op=linea[0];

return;
}

fread(&Record,sizeof(Record),1,alias);
}
fclose(alias);

38
g(18,8); printf("Record not found!");
g(18,9); printf("Press any key to continue . . .");
getch();
return;
}

void DELETE2(char n[], char &op)


{
FILE *temporal;
fopen("[Link]", "rb");
temporal=fopen("[Link]","wb");

fread(&Record, sizeof(Record), 1, alias);

while(!feof(alias))
{
if(strcmp(Registro.num_ced, n) != 0)
{
fwrite(&Record, sizeof(Record), 1, temporary);
}

fread(&Record, sizeof(Record), 1, alias);

close all();
remove("[Link]");
rename("[Link]","[Link]");
gotoxy(34,20); textcolor(3); cprintf("Record deleted!");
gotoxy(34,21); textcolor(3); cprintf("Press any key to continue . . . ");
getch();
op=='n';

return;
}

void TOTAL_TO_PAY(void)
{
float n, load, Sum, Total, insurance=0;
Limit(22);
square(18,62,3,5);
gotoxy(30,4);
textcolor(5);
<<< PAYROLL >>>
alias=fopen("[Link]","rb");

39
if(alias==NULL)
{
g(18,8); printf("File not found!");
Press any key to continue . . .
getch();
return;
}

g(3,7); printf("ID Card");


g(14,7); printf("Last Name");
g(24,7); printf("[Link]");
g(31,7); printf("[Link]");
g(38,7); printf("Salary");
g(46,7); printf("Iess");
g(53,7); printf("INGR.");
g(61,7); printf("EGR.");
g(69,7); printf("TOTAL");
g(3,8);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßß");
fread(&Record, sizeof(Record), 1, alias);
int f=9;
while(!feof(alias))
{

t(8);
n = (((([Link] / 20) / [Link].num_hours) * 0.75) * Record.h_ext);

if ([Link]<277.16)
load=10.84*Record.c_fam;
if ([Link] >= 277.17 && [Link] < 404.61)
6.65 * Registro.c_fam
if ([Link] >= 404.61)
2.10 * Registro.c_fam;
if (toupper([Link])=='S')
insurance=[Link]*0.17;
else
0

g(3, f); cout << Registro.num_ced;


g(14,f); cout<<[Link];
g(24,f); printf("%.2f",n);printf("$");
g(31,f); printf("%.2f", carga); printf("$");
g(38,f); printf("%.2f", [Link]); printf("$");
g(46,f); printf("%.2f", insurance); printf("$");
g(53,f); printf("%.2f",n+carga+[Link]);printf("$");
g(61,f); printf("%.2f",insurance);printf("$");
(n + charge + [Link] - insurance);

40
g(69,f); printf("%.2f",Total);printf("$");
Sum = Sum + Total;

f++;

fread(&Record, sizeof(Record), 1, alias);


}

fclose(alias);
t(3);
g(3,f);
ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
ßßßßßßßßßß");
g(18,20); printf("Press any key to continue . . .");
getch();
return;
}

void help()
{
ifstream F;
[Link]("[Link]");
string line;
getline(F,linea);
while (![Link]())
{
cout << line << endl;
getline(F,linea);
}
getch();
return ;
}

void main()
{
int op, op1, t;
char n[L];
char option='n';
char user[L + 1];
char password[L + 1];
char input = 0;
int i = 0;
char character;
int current_length;
char line[L];

do

41
{
system("cls");
frame(22,58,3,5);
box(14,66,6,21);
Limit(22);

gotoxy(30,4); textcolor(5); cprintf("<<< USER LOGIN >>>");


textcolor(8);
gotoxy(20,10); cprintf("User: "); gets(user);
gotoxy(20,11); cprintf("Password: ");

i = 0;
character = getch();
while (i < L && character != 13)
{
if (character != 8)
{
password[i] = character;
i++;
printf('*');
}
else
{
current_length = strlen(password);
if (current_longitude > 0)
{
printf("\b \b");
password[actual_length - 1] = '\0';
i--;
}
}
character = getch();
}
password[i] = '\0';

if (strcmp(user, USER) == 0 && strcmp(password, PASS) == 0)


{
ingresa = 1;
}
else
{
Goto position (30,17); text color(3); display text('Incorrect password and/or username!');
getch();
}
} while (input == 0 );

system ("cls");
while (op!=8)

42
{

box(22,58,3,5);
frame(14,66,6,21)
Limit(22);

gotoxy(30,4); textcolor(11); cprintf("<<< MAIN MENU >>>");


textcolor(8);
gotoxy(20,9); cprintf("<<< 1.- ENTER DATA INTO THE RECORD >>>");
gotoxy(20,10); cprintf("<<< 2.- CONSULT A RECORD >>>");
gotoxy(20,11); cprintf("<<< 3.- LISTING >>>");
gotoxy(20,12); cprintf("<<< 4.- MODIFY A RECORD >>>");
gotoxy(20,13); cprintf("<<< 5.- DELETE A RECORD >>>");
gotoxy(20,14); cprintf("<<< 6.- SHOW TOTAL TO PAY >>>");
gotoxy(20,15); cprintf("<<< 7.- HELP AND PROGRAM INSTRUCTIONS >>>");
gotoxy(20,16); cprintf("<<< 8.- EXIT >>>");
textcolor(11);
gotoxy (62,18);cprintf(" ");
gotoxy(34,18); cprintf("SELECT AN OPTION . . . "); gets(linea); op=atoi(linea);

switch (op)
{
case 1:
system("cls");
REGISTER_EMPLOYEE();
system("cls");
break;

case 2:
op1=9 ;
while (op1!=4)
{
system("cls");
square(22,58,3,5);
frame(14,66,6,18);
Limit(22);
textcolor(11);
gotoxy(30,4); cprintf("<<< QUERY MENU >>>");
textcolor(8);
gotoxy(20,9); cprintf("<<< 1.- CONSULTATION BY ID NUMBER >>>");
gotoxy(20,10); cprintf("<<< 2.- CONSULTATION BY LAST NAME >>>");
gotoxy(20,11); cprintf("<<< 3.- CONSULTATION BY DEPARTMENT >>>");
gotoxy(20,12); cprintf("<<< 4.- RETURN TO MAIN MENU >>>");
textcolor(11);
gotoxy(34,14); cprintf("SELECT AN OPTION . . . "); gets(linea);
op1=atoi(line);

43
switch (op1)
{
case 1:
system("cls");
CHECK_ID();
system("cls");
break;
case 2:
system("cls");
CONSULT_LAST_NAME();
system("cls");
break;

case 3:
system("cls");
DEPARTMENT_QUERY();
system("cls");
break;

case 4:
system("cls");
break;
default
system("cls");
Limit(22);
g(18,8); printf("Invalid option");
g(18,9); printf("Press any key to return . . .");
getch();
system("cls");
}
}
break;

case 3:
system("cls");
LISTING();
system("cls");
break;
case 4:
system("cls");
MODIFICATION();
system("cls");
break;
case 5:
system("cls");
DELETE1(n,option);
if (toupper(option) == 'S')
DELETE2(n,option);

44
system("cls");
break;
case 6:
system("cls");
TOTAL_TO_PAY();
System("cls");
break;
case 7:
system("cls");
help();

break;
case 8:
system("cls");
Limit(22);
Until next time :)
g(18,9); printf("Press any key to close the program . . .");
break;

default
system("cls");
Limit(22);
g(18,8); printf("Invalid option");
Press any key to return . . .
getch();
system("cls");
}
}
getch();
}

45
9. MAIN SCREENS OF THE PROGRAM

Figure 11. User login screen

Figure 12. Main menu screen.

46
Figure 13. Listing option screen

10. CONCLUSIONS

It was achieved that the information management system has a good


operation in the established entity.
The more organized the information is, the faster, the more
Effective and efficient will be access to this.

The application of this system helps to maintain control over


the income and expenses of a worker, is a great
advantage because it facilitates storage and handling
from the entered data.
The detailed control of the was provided in a very feasible way.
entered information.

11. RECOMMENDATIONS
A proper analysis of each component must be done to
a good operation and take advantage of all the benefits
necessary that comes with the implemented program.

47
When running the program it must be done in a
proper way to avoid any type of error.

The correct information must be entered in order to have some


good results.

It is suggested that if something from the program is not understood

execute you can turn to the help that will be found in the
main menu.

12. BIBLIOGRAPHY

[Link]
The provided text is a URL and cannot be translated.
c_4493.html
[Link]
DF
Unable to translate URL content directly. Please provide text for translation.
The provided text is a URL, and there is no text to translate.
Unable to access external content.
Unable to access the specified URL.
Unable to access the content of the provided URL.
The provided text is a URL and cannot be translated.
ivos/Notes/Basic_Concepts.PDF
[Link]

48

You might also like