tanu1

download tanu1

of 64

Transcript of tanu1

  • 7/27/2019 tanu1

    1/64

    ON

    EMPLOYEE COMMUNICATION

    SYSTEM

    OF

    SURAJ ELECTRONICSSURAJ ELECTRONICS

    AMBALA CANTTAMBALA CANTT

    FOR Partial fulfilment of

    B.Com III (Computer Application)

    Session 2007-08

    Guided By : Submitted By :

    Mr.SHYAM RAHEJA TanuJhambLECTURAR OF COMPUTER SCIENCE Roll No.

    Mrs. NEELAM(H.O.D OF COMPUTER DEPARTMENT)

    G.M.N College ,Ambala Cantt

  • 7/27/2019 tanu1

    2/64

    ACKNOWLEDGEMENT

    With grace of God, I have completed my project and during the course ofdevelopment of this Project Report I become thankful to many people, who

    helped me and gave their valuable suggestions and guidance to prepare the

    project report.

    I own my heartiest thanks to Mr. Shyam raheja(Lecturar of the

    department), G.M.N College, Ambala Cantt. For critical review of the

    report and supervision.

    My grateful thanks to Dr. R.R.Malik Principal, G.M.N College, Ambala

    Ciantt. for providing me all the infrastructure for completing this project

    report.

    I am very much thankful to staff of the Suraj Electronics. for their full co-

    operation in providing me information at the routine working of the office.

    Tanu Jhamb

  • 7/27/2019 tanu1

    3/64

    CERTIFICATE

    It is here by certify that the project report titled EMPLOYEE

    COMMUNICATION SYSTEM of Suraj Electronics. CO has been

    completed under my supervision byTanu Jhamb, student of B.Com. III

    (Computer Application) of G.M.N College, Ambala Cantt. Roll

    No. session 2007-08.

    The work done in project is result of the candidates own effort and reportmaintained is satisfied as per required.

    Mr. Shym raheja Mrs. Neelam

    Lecturer,Dept of Comp. Science HOD.,Deptt. of Comp. Sc. & App.

    G.M.N College G.M.N. College,

    Ambala Cantt Ambala Cantt.

  • 7/27/2019 tanu1

    4/64

    COMPANY PROFILE

    SURAJ ELECTRONICS is the authorized

    distributor of various types of LG, SANSUI, TEXLA, DISH TV,

    TATA SKY.. The firm is situated at RAI MRKET , Ambala Cantt

    and own by Mr. Suraj Prakash and have invested capital about of

    50 Lacs. The firm has employed about 30 workers in the

    workshop and 5 salesmen , 1Cashier , 1 Accountant. The firm

    keeps the records of its daily transactions in various Registers ,

    Bill books and Receipts Books. From these Registers, Bill books

    and Receipts books and payroll registers for accounting

    purpose in the famous tally package.

    The firm is getting all the payroll and financial Reports

    like payslips, employees details, Ledger , Cash Book Trial Balance

    Trading Accounts , Profit and loss Accounts , Balance Sheet etc.

    which are fulfilling the firm's requirement for own purpose and

    fillings of returns to the Government department like Income Tax but

    presently the firm is facing the problem with the introduction of

    COMMUNICATION SYSTEM. They want it as a separate package for

    easy accessing of the data .

  • 7/27/2019 tanu1

    5/64

    INTRODUCTION TO LANGUAGE

    The Language Selection is a major activity for project development.

    The language provide the means of communication between the

    computer hardware and user. The entire development depends upon

    the type of the language which is chosen. Although there are a no of

    programming languages like a Basic, Foxpro, Pascal, Fortran, Visual

    Basic, C, C++ , Java etc. Each language is developed for a specific

    purpose and according to needs. I have chosen C language for my

    project work which is rich in input-output, functions and files.

    C language was developed by Dennis Ritchie at Bell and T Labs.

    USA in 1972. C Language is a middle level language having the

    feature of both Low level and High level language. C Language

    provide the facility of basic data type like int, float, char, double etc.

    Besides these data type C also provide the facility of user defined

    data-types like structure, array, strings. C also have the provision for

    files, pointers, graphics etc. In C a program in written using a various

    statement. A statement is written according to rules. Co provide the

  • 7/27/2019 tanu1

    6/64

    facility for input, output, loop construct, conditional execution of

    statement, functions etc. Thus providing all the features of a good

    language .

    In my project I use files to handle the records of employee

    communication and store them for later assessing. So I have gone

    through all these concept and I find C language will solve my

    problem of software development for Amar Electronics.

  • 7/27/2019 tanu1

    7/64

    INTRODUCTION TO PROJECT

    Communication is the backbone for a civilized modern society.

    Communication is a way of expressing the requirements, messages,

    information, emotions, interests or desire etc. In the olden days, Pigeons

    were used to convey the message. Then the Telephone, Post and telegrams,

    FAX were invented. Now is the age of Personal Computer using internet,

    LAN, Wan and Mobiles Phones.

    No economy or business, trade, commerce can be conducted on a large scale

    without efficient communication system.. Due to this reason every

    organization has spent lakhs of Rupees on their communication System. In

    commincation these are main things:-

    Sender : A sender is a person who want to send/convey a message. He is the

    originator.

    Receiver : A receiver is also a person who receive the message. A receiver

    have the utility of the message. A receiver works or take decision according

    to the message.

    Medium : It is the way of sending the message chosen by the sender to

    send the message to the receiver.

    Secrecy : Every sender & receiver wants that the messages should be kept

    secret . The only person to whom message is sent, only that person receive

    not any other persons.

    Keeping these things in mind I have developed the project for HIMGIRI

    REG. CO. There are a thousand of employees working in theco. in various

  • 7/27/2019 tanu1

    8/64

    department. Every employee have to send a no. of messages to other

    employee daily for the smooth and efficient conducting of there working. I

    have developed the employee communication system through which every

    employee can send a no. of messages to any employee in the Company.

    There will be a central computer on which the software will be loaded. Any

    employee by entering his/her name and password can send or receive the

    message. The software is developed in C. The software have the following

    modules:

    Employee Details

    Inbox

    Outbox

    Reports

    Exit

    The details of each module is as follows :

    Employee Details : Through this option the detail of every employee is

    entered and stored in the database. The name of employee, department in

    which working, designation and password every employee is stored. The

    password of every employee should be different. A employee knows his

    password and he never tells his password to anyone. The main options of

    Employees Details are as follows :-

    1 Add : This option allows to enter the employee details regarding name,

    department, designation and password etc.

    2 View : This option allow to view the employees details. The employee

    name is chosen and password is entered. The department and designation

    will appear on the screen.

  • 7/27/2019 tanu1

    9/64

    3 Edit : This option allow to make modification in employee details. This

    option is helpful when some wrong information is entered that is corrected

    by this option.

    4 .Delete : This option allow to delete the details of employee.

    Inbox : This is the option which show the messages received by the

    employee. Through this option the employee entered his password is able to

    view the messages received by him. The sender name, date, date, time will

    also appear along with the message.

    Outbox : This is the option from where a employee can send the message to

    any another employee. The employee (Sender) entered his password after

    that the receiver name will be chosen. The message is entered by the

    employee, after that the message can be sent.

    Reports: A number of report can be generated. The main reports are :

    Employee List : This report will show the list of employee working in the

    company. The name of employee, department, designation of every

    employee will appear.

    For all this working I have develop program and database File. In the

    database file, the data about employees and messages are stored. The detail

    of database file is given in the database design part of the project report.

  • 7/27/2019 tanu1

    10/64

    DATABASE FILE

    The project require the following data file

    1. Employee

    2. Message

    Structure for File : Employee

    No. Field Name Type Width Dec.

    1. Empname Character 30

    2. Department Character 30

    3. Designation Character 30

    4. Password Character 10

    Structure for Message

    No. Field Name Type Width Dec.

    1. Mfrom Character 30

    2. Mto Character 30

    3. Date Date 8

    4. Time Character 10

    5. Message Character 100

  • 7/27/2019 tanu1

    11/64

    FEASIBILTY STUDY

    During the course of completion of this projectwork the complete analysis of the

    proposed system was done. In the analyzing task a complete analysis of the propsed

    system was taken.The following feasibility analysis was carried during the course of this

    project work on EMPLOYEE COMMUNICATION SYSTEM.

    TECHNICAL FEASIBILITY

    OPERATIONAL FEASIBILITY

    ECONOMIC FEASIBILITY

    ECONOMIC FEASIBILITY

    The cost involved the designing and implementation of proposed system is

    as follows:

    1. Analysis and Design cost: The cost of analysis and designing can be

    worked out by calculating the number of human days spend on

    analysis and designing of the project and then multiplying the number

    of days with the cost of human day.

    2. Programming cost: This cost is also calculated by calculating the

    number of human days spends on the coding of the project and then

    multiplying the number of days with the cost of human day.

  • 7/27/2019 tanu1

    12/64

    3. Stationary and Miscellaneous expenses: The cost of computer

    stationary is less than the cost of other not computer based stationary.

    TECHNICAL FEASIBILITY

    The existing hardware and software facilities support the proposed system.

    Computer and storage media are available and the software can be

    developed. Basic technical requirements of the system and all aspects that

    the existing system facilities.

    Hardware: There is need of Pentium machines with windows 2000 server

    and printer for reports.

    Manpower: There is a need of accountant expert in computer for

    implementing this system.

    OPERATIONAL FEASIBILITY

    The present system is operationally feasible, as it has become easy to have

    details regarding which user has logged on the system and time of logon,

    and what information is transferred.

    The above details regarding the feasibility study show that the design of

    proposed system is very effective.

  • 7/27/2019 tanu1

    13/64

    BENEFITS OF PROJECT

    The followings are the benefits from the project:

    All the reports are timely generated and accurate.

    There is no computational error in the reports.

    High Morale of the customers while dealing in the firm.

    Fast retrieval and searching of data.

    No Paper work and calculations are required.

    Neat and clean accounts and bills.

  • 7/27/2019 tanu1

    14/64

    LIMITATION OF THE PROJECT

    In developing the project, every care has been taken but still the

    following are limitation :-

    There is no provision for backup of data from system failures.

    The output depends upon the accuracy of data input by the operator.

    No system integeration with other sub system like payroll it is only a

    stand alone system.

  • 7/27/2019 tanu1

    15/64

    CONCLUSION

    After working through this project I can concluded that communication

    process in vital for any organization. If the information and messages are

    passed properly in the organization, the success is sure. Due to this reason

    the co has expanded its business throughout the India and abroad.

    The messages records are well kept on the Personal Computer. The system

    will provide maximum facilities and comfort to employee. This

    computerised approach of message, the flow of messages are fast. Record

    maintenance is easy because all records are stored in separate file. Data can

    easily be secured. Standard can be fixed. Addition, deletion & modification

    can be easily performed with computerized system. Hence I can say that the

    system is perfect for modern age of communication.

  • 7/27/2019 tanu1

    16/64

    FURHTER SCOPE OF THE PROJECT

    Communication is endless. It require anywhere and anytime. The project

    developed by me, can be expanded in many ways. Some of these ways are as

    follows :-

    1. The daily attendance of employees can be marked.

    2. The proper backup and recovery procedure can be provided.

    3. The performance of employee can be monitored.

    4. The system can be attached with other system like payroll, personal

    recruitment system.

    5. The messages can be transfer through Internet.

  • 7/27/2019 tanu1

    17/64

    Source Code

    #include"conio.h"#include "stdarg.h"#include "stdio.h"/*-----------------------------------------*//* TO SHOW MAIN MENU *//*-----------------------------------------*/void emp();void mon();void repo();void add();void find();void view();void delete();void menu();void addmon();void viewmon();void deletemon();void findmon();

    void slip();void dareg();void pfreg();void line(){int i;printf("\n");for(i=1;i

  • 7/27/2019 tanu1

    18/64

    printf("\n");}

    void main(){clrscr();printf("\n\n\n");printf("\n ");printf("\n ");printf("\n ");printf("\n

    ");printf("\n ");printf("\n ");printf("\n ");printf("\n ");printf("\n

    ");printf("\n ");gotoxy(35,17);printf("on:");gotoxy(28,18);printf("Computerised Employees CommunicationSystem");gotoxy(35,19);getche();menu();}void menu(){int ch;while (1)

  • 7/27/2019 tanu1

    19/64

    {clrscr();line();gotoxy(35,7);printf("Main Menu");gotoxy(35,9);printf("*********");gotoxy(30,11);printf("1. Employee Details");gotoxy(30,13);printf("2. Messages Details");gotoxy(30,15);printf("3. Reports");gotoxy(30,17);

    printf("4. Exit");gotoxy(30,19);printf("Enter your choice 1 to 4 : ");gotoxy(0,24);line();gotoxy(60,19);scanf("%d",&ch);if (ch>4){printf("\n\t\t\tWrong Choice ");

    getche();continue;}switch(ch){case 1:emp();break;case 2:mon();break;case 3:repo();break;case 4:exit(1);

  • 7/27/2019 tanu1

    20/64

    }

    }}/*----------------------------------------------------*//* FUNCTION TO DISPLAY EMPLOYEE MENU*//*-----------------------------------------------------*/void emp(){

    int ch;while(1){clrscr();line();gotoxy(35,5);printf("Employee Menu");gotoxy(35,7);printf("**************");gotoxy(35,9);

    printf("1. Add");

    gotoxy(35,11);printf("2. View");gotoxy(35,13);printf("3. Delete");gotoxy(35,15);printf("4. Find");gotoxy(35,17);printf("5. Exit");gotoxy(35,20);printf("Enter your choice 1 to 5 : ");line();gotoxy(65,20);scanf("%d",&ch);if(ch>5)

  • 7/27/2019 tanu1

    21/64

    {printf("\n\t\t\t\tWrong Choice ");getche();continue;}switch(ch){case 1:add();break;case 2:view();break;case 3:

    delete();break;case 4:find();break;case 5:menu();}}}

    /*FUNCTION TO ADD DATA TO EMPLOYEE FILE*/

    void add(){struct emp{char empname[30],dept[30],des[30],pass[30];

    };int i;char w='y';FILE *ab;struct emp e;ab=fopen("empl.dat","rb+");if (ab==NULL)

  • 7/27/2019 tanu1

    22/64

    ab=fopen("empl.dat","wb+");fseek(ab,0,SEEK_END);while((w=='Y')||(w=='y')){clrscr();line();linee();fflush(stdin);gotoxy(10,5);printf("A D D I T I O N O F N E W E M P L O Y EE ");gotoxy(10,10);printf("Enter Emp. Name : ");gets(e.empname);

    fflush(stdin);gotoxy(10,12);printf("Enter Dept. : ");gets(e.dept);fflush(stdin);gotoxy(10,14);printf("Enter Designation : ");gets(e.des);fflush(stdin);gotoxy(10,16);

    printf("Enter Password : ");i=0;while((e.pass[i]=getch())!='\r')i++;fflush(stdin);gotoxy(10,18);fwrite(&e,sizeof(e),1,ab);printf("DO YOU WANT Y/N : ");w=getch();}fclose(ab);}

    /*FUNTION TO VIEW EMPLOYEE DATA FROM EMPLOYEEFILE*/

  • 7/27/2019 tanu1

    23/64

    void view(){struct emp{char empname[30],dept[30],des[30],pass[30];

    };struct emp e;FILE *ab;int c=1;ab=fopen("empl.dat","rb+");while(fread(&e,sizeof(e),1,ab)==1){clrscr();

    line();linee();gotoxy(10,5);printf("V I E W I N G O F E M P L O Y E E ");gotoxy(30,7);printf("Record No : %d",c);c=c+1;gotoxy(10,10);printf("Enter Emp. Name : ");printf("%s",e.empname);

    fflush(stdin);gotoxy(10,12);printf("Enter Dept. : ");printf("%s",e.dept);fflush(stdin);gotoxy(10,14);printf("Enter Designation : ");printf("%s",e.des);fflush(stdin);gotoxy(10,16);/*printf("Enter Password : %s",e.pass);*/

    getche();}fclose(ab);clrscr();

  • 7/27/2019 tanu1

    24/64

    }

    /*FUNCTION TO DELETE EMPLOYEE*/

    void delete(){struct emp{char empname[30],dept[30],des[30],pass[30];};struct emp e;FILE *ab,*cd;int f=0;

    char w;char fname[30];;ab=fopen("empl.dat","rb+");cd=fopen("tem.dat","wb+");clrscr();line();linee();gotoxy(10,5);printf("D E L T E I N G O F E M P L O Y E E ");gotoxy(30,7);

    printf("Enter Emp Name to Delete : ");fflush(stdin);gets(fname);fflush(stdin);while(fread(&e,sizeof(e),1,ab)==1){if(strcmp(e.empname,fname)==0){f=1;gotoxy(10,10);gotoxy(10,10);printf("Enter Emp. Name : ");printf("%s",e.empname);fflush(stdin);gotoxy(10,12);printf("Enter Dept. : ");

  • 7/27/2019 tanu1

    25/64

    printf("%s",e.dept);fflush(stdin);gotoxy(10,14);printf("Enter Designation : ");printf("%s",e.des);fflush(stdin);gotoxy(10,16);/*printf("Enter Password : %s",e.pass);*/

    gotoxy(10,18);printf("Do You want to delete Y/N : ");w= getche();if((w=='N')||(w=='n'))fwrite(&e,sizeof(e),1,cd);

    elseprintf("\n\t\t\t Data Deleted");}elsefwrite(&e,sizeof(e),1,cd);}if (f==0){gotoxy(15,15);printf("Employee Name Not found");

    }getche();fclose(ab);fclose(cd);remove("empl.dat");rename("tem.dat","empl.dat");

    clrscr();}

    /*FUNCTION TO FIND EMPLOYEE*/

    void find(){

  • 7/27/2019 tanu1

    26/64

    struct emp{char empname[30],dept[30],des[30],pass[30];};struct emp e;FILE *ab;int f=0;char fname[30];;ab=fopen("empl.dat","rb+");clrscr();line();linee();gotoxy(10,5);printf("S E A R C H I N G O F E M P L O Y E E

    ");gotoxy(30,7);printf("Enter Emp Name to search : ");fflush(stdin);gets(fname);fflush(stdin);while(fread(&e,sizeof(e),1,ab)==1){if(strcmp(e.empname,fname)==0){

    f=1;gotoxy(10,10);printf("Enter Emp. Name : ");printf("%s",e.empname);fflush(stdin);gotoxy(10,12);printf("Enter Dept. : ");printf("%s",e.dept);fflush(stdin);gotoxy(10,14);printf("Enter Designation : ");printf("%s",e.des);fflush(stdin);gotoxy(10,16);/*printf("Enter Password : %s",e.pass);*/

  • 7/27/2019 tanu1

    27/64

    getche();}}if (f==0){gotoxy(15,15);printf("Employee Name Not found");}getche();fclose(ab);clrscr();}

    /*----------------------------------------------------*//* FUNCTION TO DISPLAY MESSAGE MENU*//*-----------------------------------------------------*/void mon()

    {int ch;while(1){clrscr();line();gotoxy(35,5);printf("Employee Message Menu");gotoxy(35,7);printf("************************");gotoxy(35,9);printf("1. Add New Message");

    gotoxy(35,11);printf("2. View Message");gotoxy(35,13);

  • 7/27/2019 tanu1

    28/64

    printf("3. Delete Message");gotoxy(35,15);printf("4. Exit");gotoxy(35,20);printf("Enter your choice 1 to 4 : ");line();gotoxy(65,20);scanf("%d",&ch);if(ch>5){printf("\n\t\t\t\tWrong Choice ");getche();continue;}

    switch(ch){case 1:addmon();break;case 2:viewmon();break;case 3:deletemon();

    break;case 4:menu();}}}

    /*FUNCTION TO ADD DATA TO FILE*/

    void addmon(){struct mon{char fempname[30];char temp[30];char mess[50];

  • 7/27/2019 tanu1

    29/64

    };char w='y';FILE *ab;struct mon e;ab=fopen("mont.dat","rb+");if (ab==NULL)ab=fopen("mont.dat","wb+");fseek(ab,0,SEEK_END);while((w=='Y')||(w=='y')){clrscr();line();linee();fflush(stdin);

    gotoxy(10,5);printf("A D D I T I O N O F M E S S A G D A T A");gotoxy(10,7);printf("Message From (Name) : ");gets(e.fempname);fflush(stdin);gotoxy(10,9);printf("Message To (Name) : ");gets(e.temp);

    fflush(stdin);gotoxy(10,11);

    printf("Enter Message : ");gets(e.mess);fwrite(&e,sizeof(e),1,ab);printf("\n\t\t\t\DO YOU WANT AGAIN Y/N : ");w=getch();}fclose(ab);}/*FUNCTION TO VIEW DATA */

    void viewmon(){struct mon

  • 7/27/2019 tanu1

    30/64

    {char fempname[30];char temp[30];char mess[50];

    };FILE *ab;struct mon e;ab=fopen("mont.dat","rb+");while(fread(&e,sizeof(e),1,ab)==1){clrscr();line();linee();

    fflush(stdin);gotoxy(10,5);printf("V I E W I N G O F M E S S A G E D A T A");gotoxy(10,7);printf("Message From : ");printf("%s",e.fempname);fflush(stdin);gotoxy(10,9);printf("Message To : ");

    printf("%s",e.temp);getch();}fclose(ab);}

    /*FUNCTION TO DELETE DATA */

    void deletemon(){struct mon{char fempname[30];char temp[30];char mess[50];

  • 7/27/2019 tanu1

    31/64

    };FILE *ab,*cd;char dname[30];int f=0;char w;struct mon e;ab=fopen("mont.dat","rb+");cd=fopen("temp.dat","wb+");clrscr();line();linee();fflush(stdin);gotoxy(10,5);printf("D E L E T I N G O F M E S S A G E D A

    T A ");gotoxy(10,7);printf("Emp. Name : ");gets(dname);fflush(stdin);while(fread(&e,sizeof(e),1,ab)==1){if (strcmp(e.fempname,dname)==0){clrscr();

    line();linee();fflush(stdin);gotoxy(10,5);printf("D E L E T I N G O F M E S S A G E D AT A ");gotoxy(10,7);gotoxy(10,7);printf("Message From : ");printf("%s",e.fempname);fflush(stdin);gotoxy(10,9);printf("Message To : ");printf("%s",e.temp);

    f=1;

  • 7/27/2019 tanu1

    32/64

    printf("\nt\t\tDo you want to delete it Y/n : ");w=getche();if((w=='n')||(w=='n'))fwrite(&e,sizeof(e),1,cd);elseprintf("\n\t\t\tData Deleted");}else

    fwrite(&e,sizeof(e),1,cd);}if(f==0){printf("\n\t\t\t\tName not found");

    getch();}fclose(ab);fclose(cd);remove("mont.dat");rename("temp.dat","mont.dat");}

    void findmon(){}

    /*----------------------------------------------------*//* FUNCTION TO DISPLAY REPORT MENU*//*-----------------------------------------------------*/void repo()

  • 7/27/2019 tanu1

    33/64

    {int ch;while(1){clrscr();line();gotoxy(35,5);printf("Report Menu");gotoxy(35,7);printf("************");gotoxy(35,9);printf("1. INBOX");

    gotoxy(35,11);

    printf("2. EMPLOYEE LIST");gotoxy(35,13);printf("3. Exit");gotoxy(35,20);printf("Enter your choice 1 to 3 : ");line();gotoxy(65,20);scanf("%d",&ch);if(ch>3){

    printf("\n\t\t\t\tWrong Choice ");getche();continue;}switch(ch){case 1:slip();break;case 2:dareg();break;case 3:menu();}}

  • 7/27/2019 tanu1

    34/64

    }

    /*FUNCTION TO VIEW MESSAGE*/

    void slip(){struct mon{char fempname[30];char temp[30];char mess[50];

    };

    FILE *ab;char dname[30];int f=0;char w;struct mon e;ab=fopen("mont.dat","rb+");clrscr();line();linee();fflush(stdin);

    gotoxy(10,5);printf("I N B O X M E S S A G E D A T A ");gotoxy(10,7);printf("Emp. Name : ");gets(dname);fflush(stdin);while(fread(&e,sizeof(e),1,ab)==1){if (strcmp(e.fempname,dname)==0){clrscr();line();linee();fflush(stdin);gotoxy(10,5);

  • 7/27/2019 tanu1

    35/64

    printf("I N B O X O F M E S S A G E D A T A");gotoxy(10,7);gotoxy(10,7);printf("Message From : ");printf("%s",e.fempname);fflush(stdin);gotoxy(10,9);printf("Message To : ");printf("%s",e.temp);gotoxy(10,11);printf("Message : ");printf("%s",e.mess);

    f=1;getche();}}if(f==0){printf("\n\t\t\t\tName not found");getch();}fclose(ab);

    }

    /*FUNCTION TO VIEW EMPLOYEE LIST*/

    void dareg(){struct emp{char empname[30],dept[30],des[30],pass[30];};struct emp e;FILE *ab;char fname[30];;ab=fopen("empl.dat","rb+");

  • 7/27/2019 tanu1

    36/64

    clrscr();line();printf("\n L I S T O F E M P L O Y E E");line();while(fread(&e,sizeof(e),1,ab)==1){printf("\n%-20s%-20s%-20s",e.empname,e.dept,e.des);}line();getche();fclose(ab);}

    #include"conio.h"

    #include "stdarg.h"

    #include "stdio.h"

    /*-----------------------------------------*/

    /* TO SHOW MAIN MENU */

    /*-----------------------------------------*/

    void emp();

    void mon();

    void repo();

    void add();

    void find();

    void view();

    void delete();

    void menu();

    void addmon();

    void viewmon();

    void deletemon();

  • 7/27/2019 tanu1

    37/64

    void findmon();

    void slip();

    void dareg();

    void pfreg();void line()

    {

    int i;

    printf("\n");

    for(i=1;i

  • 7/27/2019 tanu1

    38/64

    gotoxy(28,18);

    printf("Computerised Employees Communication

    System");

    gotoxy(35,19);getche();

    menu();

    }

    void menu()

    {

    int ch;

    while (1)

    {

    clrscr();

    line();

    gotoxy(35,7);

    printf("Main Menu");

    gotoxy(35,9);

    printf("*********");

    gotoxy(30,11);

    printf("1. Employee Details");

    gotoxy(30,13);

    printf("2. Messages Details");

    gotoxy(30,15);

    printf("3. Reports");

    gotoxy(30,17);

    printf("4. Exit");

    gotoxy(30,19);

  • 7/27/2019 tanu1

    39/64

    printf("Enter your choice 1 to 4 : ");

    gotoxy(0,24);

    line();

    gotoxy(60,19);scanf("%d",&ch);

    if (ch>4)

    {

    printf("\n\t\t\tWrong Choice ");

    getche();

    continue;

    }

    switch(ch)

    {

    case 1:

    emp();

    break;

    case 2:

    mon();

    break;

    case 3:

    repo();

    break;

    case 4:

    exit(1);

    }

    }

  • 7/27/2019 tanu1

    40/64

    }

    /

    *--------------------------------------------------

    --*//* FUNCTION TO DISPLAY EMPLOYEE MENU

    */

    /

    *--------------------------------------------------

    ---*/

    void emp()

    {

    int ch;

    while(1)

    {

    clrscr();

    line();

    gotoxy(35,5);

    printf("Employee Menu");

    gotoxy(35,7);

    printf("**************");

    gotoxy(35,9);

    printf("1. Add");

    gotoxy(35,11);

    printf("2. View");

    gotoxy(35,13);

    printf("3. Delete");

  • 7/27/2019 tanu1

    41/64

    gotoxy(35,15);

    printf("4. Find");

    gotoxy(35,17);

    printf("5. Exit");gotoxy(35,20);

    printf("Enter your choice 1 to 5 : ");

    line();

    gotoxy(65,20);

    scanf("%d",&ch);

    if(ch>5)

    {

    printf("\n\t\t\t\tWrong Choice ");

    getche();

    continue;

    }

    switch(ch)

    {

    case 1:

    add();

    break;

    case 2:

    view();

    break;

    case 3:

    delete();

    break;

    case 4:

  • 7/27/2019 tanu1

    42/64

    find();

    break;

    case 5:

    menu();}

    }

    }

    /*FUNCTION TO ADD DATA TO EMPLOYEE FILE*/

    void add()

    {

    struct emp

    {

    char empname[30],dept[30],des[30],pass[30];

    };

    int i;

    char w='y';

    FILE *ab;

    struct emp e;

    ab=fopen("empl.dat","rb+");

    if (ab==NULL)

    ab=fopen("empl.dat","wb+");

    fseek(ab,0,SEEK_END);

    while((w=='Y')||(w=='y'))

    {

  • 7/27/2019 tanu1

    43/64

    clrscr();

    line();

    linee();

    fflush(stdin);gotoxy(10,5);

    printf("A D D I T I O N O F N E W E M P L O Y E

    E ");

    gotoxy(10,10);

    printf("Enter Emp. Name : ");

    gets(e.empname);

    fflush(stdin);

    gotoxy(10,12);

    printf("Enter Dept. : ");

    gets(e.dept);

    fflush(stdin);

    gotoxy(10,14);

    printf("Enter Designation : ");

    gets(e.des);

    fflush(stdin);

    gotoxy(10,16);

    printf("Enter Password : ");

    i=0;

    while((e.pass[i]=getch())!='\r')

    i++;

    fflush(stdin);

    gotoxy(10,18);

    fwrite(&e,sizeof(e),1,ab);

  • 7/27/2019 tanu1

    44/64

    printf("DO YOU WANT Y/N : ");

    w=getch();

    }

    fclose(ab);}

    /*FUNTION TO VIEW EMPLOYEE DATA FROM EMPLOYEE

    FILE*/

    void view()

    {

    struct emp

    {

    char empname[30],dept[30],des[30],pass[30];

    };

    struct emp e;

    FILE *ab;

    int c=1;

    ab=fopen("empl.dat","rb+");

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    clrscr();

    line();

    linee();

    gotoxy(10,5);

    printf("V I E W I N G O F E M P L O Y E E ");

  • 7/27/2019 tanu1

    45/64

    gotoxy(30,7);

    printf("Record No : %d",c);

    c=c+1;

    gotoxy(10,10);printf("Enter Emp. Name : ");

    printf("%s",e.empname);

    fflush(stdin);

    gotoxy(10,12);

    printf("Enter Dept. : ");

    printf("%s",e.dept);

    fflush(stdin);

    gotoxy(10,14);

    printf("Enter Designation : ");

    printf("%s",e.des);

    fflush(stdin);

    gotoxy(10,16);

    /*printf("Enter Password : %s",e.pass);*/

    getche();

    }

    fclose(ab);

    clrscr();

    }

    /*FUNCTION TO DELETE EMPLOYEE*/

  • 7/27/2019 tanu1

    46/64

    void delete()

    {

    struct emp

    {char empname[30],dept[30],des[30],pass[30];

    };

    struct emp e;

    FILE *ab,*cd;

    int f=0;

    char w;

    char fname[30];;

    ab=fopen("empl.dat","rb+");

    cd=fopen("tem.dat","wb+");

    clrscr();

    line();

    linee();

    gotoxy(10,5);

    printf("D E L T E I N G O F E M P L O Y E E ");

    gotoxy(30,7);

    printf("Enter Emp Name to Delete : ");

    fflush(stdin);

    gets(fname);

    fflush(stdin);

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    if(strcmp(e.empname,fname)==0)

    {

  • 7/27/2019 tanu1

    47/64

    f=1;

    gotoxy(10,10);

    gotoxy(10,10);

    printf("Enter Emp. Name : ");printf("%s",e.empname);

    fflush(stdin);

    gotoxy(10,12);

    printf("Enter Dept. : ");

    printf("%s",e.dept);

    fflush(stdin);

    gotoxy(10,14);

    printf("Enter Designation : ");

    printf("%s",e.des);

    fflush(stdin);

    gotoxy(10,16);

    /*printf("Enter Password : %s",e.pass);*/

    gotoxy(10,18);

    printf("Do You want to delete Y/N : ");

    w= getche();

    if((w=='N')||(w=='n'))

    fwrite(&e,sizeof(e),1,cd);

    else

    printf("\n\t\t\t Data Deleted");

    }

    else

    fwrite(&e,sizeof(e),1,cd);

  • 7/27/2019 tanu1

    48/64

  • 7/27/2019 tanu1

    49/64

    int f=0;

    char fname[30];;

    ab=fopen("empl.dat","rb+");

    clrscr();line();

    linee();

    gotoxy(10,5);

    printf("S E A R C H I N G O F E M P L O Y E E

    ");

    gotoxy(30,7);

    printf("Enter Emp Name to search : ");

    fflush(stdin);

    gets(fname);

    fflush(stdin);

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    if(strcmp(e.empname,fname)==0)

    {

    f=1;

    gotoxy(10,10);

    printf("Enter Emp. Name : ");

    printf("%s",e.empname);

    fflush(stdin);

    gotoxy(10,12);

    printf("Enter Dept. : ");

    printf("%s",e.dept);

    fflush(stdin);

  • 7/27/2019 tanu1

    50/64

    gotoxy(10,14);

    printf("Enter Designation : ");

    printf("%s",e.des);

    fflush(stdin);gotoxy(10,16);

    /*printf("Enter Password : %s",e.pass);*/

    getche();

    }

    }

    if (f==0)

    {

    gotoxy(15,15);

    printf("Employee Name Not found");

    }

    getche();

    fclose(ab);

    clrscr();

    }

    /

    *--------------------------------------------------

    --*/

    /* FUNCTION TO DISPLAY MESSAGE MENU

    */

  • 7/27/2019 tanu1

    51/64

    /

    *--------------------------------------------------

    ---*/

    void mon(){

    int ch;

    while(1)

    {

    clrscr();

    line();

    gotoxy(35,5);

    printf("Employee Message Menu");

    gotoxy(35,7);

    printf("************************");

    gotoxy(35,9);

    printf("1. Add New Message");

    gotoxy(35,11);

    printf("2. View Message");

    gotoxy(35,13);

    printf("3. Delete Message");

    gotoxy(35,15);

    printf("4. Exit");

    gotoxy(35,20);

    printf("Enter your choice 1 to 4 : ");

    line();

    gotoxy(65,20);

  • 7/27/2019 tanu1

    52/64

    scanf("%d",&ch);

    if(ch>5)

    {

    printf("\n\t\t\t\tWrong Choice ");getche();

    continue;

    }

    switch(ch)

    {

    case 1:

    addmon();

    break;

    case 2:

    viewmon();

    break;

    case 3:

    deletemon();

    break;

    case 4:

    menu();

    }

    }

    }

    /*FUNCTION TO ADD DATA TO FILE*/

    void addmon()

  • 7/27/2019 tanu1

    53/64

    {

    struct mon

    {

    char fempname[30];char temp[30];

    char mess[50];

    };

    char w='y';

    FILE *ab;

    struct mon e;

    ab=fopen("mont.dat","rb+");

    if (ab==NULL)

    ab=fopen("mont.dat","wb+");

    fseek(ab,0,SEEK_END);

    while((w=='Y')||(w=='y'))

    {

    clrscr();

    line();

    linee();

    fflush(stdin);

    gotoxy(10,5);

    printf("A D D I T I O N O F M E S S A G D A T A

    ");

    gotoxy(10,7);

    printf("Message From (Name) : ");

    gets(e.fempname);

    fflush(stdin);

  • 7/27/2019 tanu1

    54/64

    gotoxy(10,9);

    printf("Message To (Name) : ");

    gets(e.temp);

    fflush(stdin);gotoxy(10,11);

    printf("Enter Message : ");

    gets(e.mess);

    fwrite(&e,sizeof(e),1,ab);

    printf("\n\t\t\t\DO YOU WANT AGAIN Y/N : ");

    w=getch();

    }

    fclose(ab);

    }

    /*FUNCTION TO VIEW DATA */

    void viewmon()

    {

    struct mon

    {

    char fempname[30];

    char temp[30];

    char mess[50];

    };

    FILE *ab;

    struct mon e;

  • 7/27/2019 tanu1

    55/64

    ab=fopen("mont.dat","rb+");

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    clrscr();line();

    linee();

    fflush(stdin);

    gotoxy(10,5);

    printf("V I E W I N G O F M E S S A G E D A T A

    ");

    gotoxy(10,7);

    printf("Message From : ");

    printf("%s",e.fempname);

    fflush(stdin);

    gotoxy(10,9);

    printf("Message To : ");

    printf("%s",e.temp);

    getch();

    }

    fclose(ab);

    }

    /*FUNCTION TO DELETE DATA */

    void deletemon()

    {

    struct mon

  • 7/27/2019 tanu1

    56/64

    {

    char fempname[30];

    char temp[30];

    char mess[50];

    };

    FILE *ab,*cd;

    char dname[30];

    int f=0;

    char w;

    struct mon e;

    ab=fopen("mont.dat","rb+");

    cd=fopen("temp.dat","wb+");

    clrscr();

    line();

    linee();

    fflush(stdin);

    gotoxy(10,5);

    printf("D E L E T I N G O F M E S S A G E D A

    T A ");

    gotoxy(10,7);

    printf("Emp. Name : ");

    gets(dname);

    fflush(stdin);

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    if (strcmp(e.fempname,dname)==0)

  • 7/27/2019 tanu1

    57/64

    {

    clrscr();

    line();

    linee();fflush(stdin);

    gotoxy(10,5);

    printf("D E L E T I N G O F M E S S A G E D A

    T A ");

    gotoxy(10,7);

    gotoxy(10,7);

    printf("Message From : ");

    printf("%s",e.fempname);

    fflush(stdin);

    gotoxy(10,9);

    printf("Message To : ");

    printf("%s",e.temp);

    f=1;

    printf("\nt\t\tDo you want to delete it Y/n : ");

    w=getche();

    if((w=='n')||(w=='n'))

    fwrite(&e,sizeof(e),1,cd);

    else

    printf("\n\t\t\tData Deleted");

    }

    else

  • 7/27/2019 tanu1

    58/64

    fwrite(&e,sizeof(e),1,cd);

    }

    if(f==0)

    {printf("\n\t\t\t\tName not found");

    getch();

    }

    fclose(ab);

    fclose(cd);

    remove("mont.dat");

    rename("temp.dat","mont.dat");

    }

    void findmon()

    {

    }

    /

    *--------------------------------------------------

    --*/

    /* FUNCTION TO DISPLAY REPORT MENU

    */

  • 7/27/2019 tanu1

    59/64

    /

    *--------------------------------------------------

    ---*/

    void repo(){

    int ch;

    while(1)

    {

    clrscr();

    line();

    gotoxy(35,5);

    printf("Report Menu");

    gotoxy(35,7);

    printf("************");

    gotoxy(35,9);

    printf("1. INBOX");

    gotoxy(35,11);

    printf("2. EMPLOYEE LIST");

    gotoxy(35,13);

    printf("3. Exit");

    gotoxy(35,20);

    printf("Enter your choice 1 to 3 : ");

    line();

    gotoxy(65,20);

    scanf("%d",&ch);

    if(ch>3)

  • 7/27/2019 tanu1

    60/64

    {

    printf("\n\t\t\t\tWrong Choice ");

    getche();

    continue;}

    switch(ch)

    {

    case 1:

    slip();

    break;

    case 2:

    dareg();

    break;

    case 3:

    menu();

    }

    }

    }

    /*FUNCTION TO VIEW MESSAGE*/

    void slip()

    {

    struct mon

    {

    char fempname[30];

  • 7/27/2019 tanu1

    61/64

    char temp[30];

    char mess[50];

    };FILE *ab;

    char dname[30];

    int f=0;

    char w;

    struct mon e;

    ab=fopen("mont.dat","rb+");

    clrscr();

    line();

    linee();

    fflush(stdin);

    gotoxy(10,5);

    printf("I N B O X M E S S A G E D A T A ");

    gotoxy(10,7);

    printf("Emp. Name : ");

    gets(dname);

    fflush(stdin);

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    if (strcmp(e.fempname,dname)==0)

    {

    clrscr();

    line();

    linee();

  • 7/27/2019 tanu1

    62/64

    fflush(stdin);

    gotoxy(10,5);

    printf("I N B O X O F M E S S A G E D A T A

    ");gotoxy(10,7);

    gotoxy(10,7);

    printf("Message From : ");

    printf("%s",e.fempname);

    fflush(stdin);

    gotoxy(10,9);

    printf("Message To : ");

    printf("%s",e.temp);

    gotoxy(10,11);

    printf("Message : ");

    printf("%s",e.mess);

    f=1;

    getche();

    }

    }

    if(f==0)

    {

    printf("\n\t\t\t\tName not found");

    getch();

    }

    fclose(ab);

    }

  • 7/27/2019 tanu1

    63/64

    /*FUNCTION TO VIEW EMPLOYEE LIST*/

    void dareg()

    {

    struct emp

    {

    char empname[30],dept[30],des[30],pass[30];

    };

    struct emp e;

    FILE *ab;

    char fname[30];;

    ab=fopen("empl.dat","rb+");

    clrscr();

    line();

    printf("\n L I S T O F E M P L O Y E E

    ");

    line();

    while(fread(&e,sizeof(e),1,ab)==1)

    {

    printf("\n%-20s%-20s%-20s",e.empname,e.dept,e.des);

    }

    line();

    getche();

    fclose(ab);

  • 7/27/2019 tanu1

    64/64

    }