Visual C++ Program for the Implementation of Leave(Holiday) Management System | IT1253 - Software Engineering Laboratory

ABSTRACT:
         This project on “Leave management system” was developed mainly for checking the leave period &leave balance of a employee.
         On intent is to create a leave record. We use 3 functions each independent from each other.
         This function will get the input from the user & the respective leave period &leave balance  which  are maintained.

REQUIREMENT ANALYSIS:

SOFTWARE REQUIREMENTS:
    Front End   :    ‘C++’ language.
    Back End   :     File Management System (using Dat files)
    Operating system:    Any Operating System (Window or Linux)

HARDWARE REQUIREMENTS:

    Processor     :     3.06 GHZ operating speed.
    Hard Disk    :      80GB Capacity.
    RAM           :       256MB
    Monitor       :       CRT 17’
    Mouse         :       OPTICAL
    Keyboard    :       Alphanumeric keys.
     The specified hardware requirements are the minimum requirements that are needed to implement in the project.

FUNCTIONAL REQUIREMENTS:
    As mentioned in the requirements, the Leave Management system in Theatre involves the following function or process
Leave Management system consists of four modules. They are
    Module 1: Insert Module
    Module 2: Delete Module
    Module 3: Display Module
    Module 4: Exit
  Insert Module: 
    In this module the user enters the detail about leave.
  Delete Module:
    In this module the user deletes the leave details.
  Display Module:
    In this module the leave details are displayed.
  Exit:
    In this module the user can quit from the project.

NON FUNCTIONAL REQUIREMENT:
    It is reliable software. Whenever the user wants to retrieve any information from the database, it returns with the correct information. Provided, the information stored is a correct one. The cost of maintenance of the software is very low. The size of the software is less. This means, it is a portable one. If any request is given, the time taken for the response is low. This makes the software more efficient.

SOURCE CODE:
#include<windows.h>                 
#include<sqlext.h>
#include<stdio.h>
#include<string.h>
#define TEST_LEN 50
int main()

{
    int c;
    char ch='y';
    SQLINTEGER IDno,Phoneno,Leaveperiod,Leavebal;
    SQLCHAR Name[TEST_LEN+1];
    HENV hEnv=NULL;
    HDBC hDBC=NULL;
    HSTMT hStmt=NULL;
    UCHAR szSqlStr[]="insert into leave(IDno,Name,Phoneno,Leaveperiod,Leavebal) values(?,?,?,?,?)";
    UCHAR szSqlStr1[]="delete * from leave where IDno = ?";
    UCHAR szSqlStr2[]="select * from leave";
    UCHAR szDSN[SQL_MAX_DSN_LENGTH]="leavemanage";
    UCHAR *szUID=NULL;
    UCHAR *szPasswd=NULL;
    UCHAR szModel1[128];
    UCHAR szModel2[128];
    UCHAR szModel3[128];
    UCHAR szModel4[128];
    UCHAR szModel5[128];
    SDWORD cbModel1;
    SDWORD cbModel2;
    SDWORD cbModel3;
    SDWORD cbModel4;
    SDWORD cbModel5;
    SDWORD cbtest=SQL_NTS;
    RETCODE retcode;
    do
    {
    printf("=======================================");
    printf("\n   LEAVE MANAGEMENT SYSTEM");
    printf("\n=======================================\n");
    printf("1.Enter the leave detail \n2.Delete the leave detail\n3.Display the leave detail\n\n");
    printf("Enter ur option......\n");
    scanf("%d",&c);
    switch(c)
    {
    case 1:
        printf("\n-----------------------------------------");
        printf("\nEnter the details");
        printf("\n-----------------------------------------");
        printf("\nEnter the ID No:\t");
        scanf("%d",&IDno);
        printf("\nEnter the Name:\t");
        scanf("%s",&Name);
        printf("\nEnter the Phoneno:\t");
        scanf("%d",&Phoneno);
        printf("\nEnter the Leaveperiod:\t");
        scanf("%d",&Leaveperiod);
        printf("\nEnter the Leavebal:\t");
        scanf("%d",&Leavebal);   
        printf("\n-----------------------------------------");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr,sizeof(szSqlStr));
SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&IDno,0,&IDno);   
SQLBindParameter(hStmt,2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,Name,0,&cbtest);
SQLBindParameter(hStmt,3,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Phoneno,0,&Phoneno);
SQLBindParameter(hStmt,4,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Leaveperiod,0,&Leaveperiod);
SQLBindParameter(hStmt,5,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Leavebal,0,&Leavebal);
             retcode=SQLExecute(hStmt);
            printf("\n\n Detail is inserted.......... \n\n");
        }
        break;
    case 2:
        printf("\nDelete the detail\n");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr1,sizeof(szSqlStr1));
SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&IDno,0,&IDno);
            printf("\nEnter the ID No\n");
            scanf("%d",&IDno);
            retcode=SQLExecute(hStmt);
            printf("detail has been deleted\n\n");
        }
        break;
    case 3:
        printf("\nDisplay the detail\n");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr2,sizeof(szSqlStr2));
            retcode=SQLExecute(hStmt);
            SQLBindCol(hStmt,1,SQL_C_CHAR,szModel1,sizeof(szModel1),&cbModel1);
            SQLBindCol(hStmt,2,SQL_C_CHAR,szModel2,sizeof(szModel2),&cbModel2);
            SQLBindCol(hStmt,3,SQL_C_CHAR,szModel3,sizeof(szModel3),&cbModel3);
            SQLBindCol(hStmt,4,SQL_C_CHAR,szModel4,sizeof(szModel4),&cbModel4);
            SQLBindCol(hStmt,5,SQL_C_CHAR,szModel5,sizeof(szModel5),&cbModel5);
            retcode=SQLFetch(hStmt);
            printf("\n\tID No\tName\tPhoneno\tLeave Period\tLeave Bal\n\n");
            while(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
            {
               printf("\t%s\t%s\t%s\t%s\t%s\n",szModel1,szModel2,szModel3,szModel4,szModel5);
               retcode=SQLFetch(hStmt);
             }
        }
        break;  
        }
   flushall();
   printf("\nDo u wan to cont (y/n)");
   scanf("%s",&ch);
  }
  while(ch=='y');
  return 0;
}

OUTPUT:

INSERTION:
 DISPLAY:
DELETION:
DISPLAY:


CONCLUSION:
             The  project we have done here is “LEAVE MANAGEMENT SYSTEM” using C language.
In this project we have designed a software to implement the customer details that any user can perform
it in a simple and a better way. This way of format helps us to have clear database.
Previous
Next Post »

If you still didn't find what you're looking for, you can search this website below: