Visual C++ Program for the Implementation of Online Super Market Management System | IT1253 - Software Engineering Laboratory


ABSTRACT:
The aim of our project is to develop a software for implementing “Online Supermarket Management System” using VISUAL C++. The development of this particular project is to perform the formalities / operation in ONLINE SUPERMARKET MANAGEMENT SYSTEM. This project deals with the bill details, items purchased, and maintenance in its process. The customers are instructed in an easy way to feel comfortable with the processing.

REQUIREMENTS ANALYSIS:

SOFTWARE REQUIREMENTS:
    Front End           :     Visual C++ language

    Back End          :     MS Access
    Operating system     :     Windows  XP



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 Online Super Market system involves the following function or process
Online Super Market 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 of the bill.
Delete Module :
In this module the user deletes the detail of the bill.
Display Module :
This module display the detail of the bill.
Exit:
    In this module the user can quit from the project.

NON FUNCTIONAL REQUIREMENTS:
    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>
#define TEST_LEN 50
int main()
{
    int c;
    char ch='y',ca='s';
    SQLINTEGER  Sno,Billno,Amt,Total,Quantity,Grandtotal=0;
    SQLCHAR Itemname[TEST_LEN],BillingDate[TEST_LEN];
    HENV hEnv=NULL;
    HDBC hDBC=NULL;
    HSTMT hStmt=NULL;
    UCHAR szSqlStr[]="insert into super(Billno,BillingDate,Sno,Itemname,Amt,Quantity,Total,Grandtotal) values(?,?,?,?,?,?,?,?)";
    UCHAR szSqlStr1[]="delete * from super where Billno = ?";
    UCHAR szSqlStr2[]="select * from super";
    UCHAR szDSN[SQL_MAX_DSN_LENGTH]="sm";
    UCHAR *szUID=NULL;
    UCHAR *szPasswd=NULL;
    UCHAR szModel1[128], szModel2[128], szModel3[128], szModel4[128], szModel5[128], szModel6[128], szModel7[128], szModel8[128];
    SDWORD cbModel1, cbModel2, cbModel3, cbModel4, cbModel5, cbModel6, cbModel7, cbModel8;
    SDWORD cbtest=SQL_NTS;
    RETCODE retcode;
    do
    {
    printf("=======================================");
    printf("\n     ONLINE SUPERMARKET SYSTEM");
    printf("\n=======================================\n");
    printf("1.Enter the bill details \n2.Delete the bill detail\n3.Display the bill detail\n");
    printf("entr ur option......\n");
    scanf("%d",&c);
    switch(c)
    {
     case 1:
        printf("\n-----------------------------------------");
        printf("\nEnter the details");
        printf("\n-----------------------------------------");
        printf("\nEnter the Billno:\t");
        scanf("%d",&Billno);
        printf("\nEnter the BillingDate:\t");
        scanf("%s",&BillingDate);
        Grandtotal=0;
        do
        {
        printf("\nEnter the Sno:\t");
        scanf("%d",&Sno);
        printf("\nEnter the name:\t");
        scanf("%s",&Itemname);
        printf("\nEnter the Amt:\t");
        scanf("%d",&Amt);
        printf("\nEnter the quan:\t");
        scanf("%d",&Quantity);
        Total=Amt*Quantity;
        Grandtotal=Grandtotal+Total;
        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,&Billno,0,&Billno);
SQLBindParameter(hStmt,2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,BillingDate,0,&cbtest);
SQLBindParameter(hStmt,3,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Sno,0,&Sno);
SQLBindParameter(hStmt,4,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,Itemname,0,&cbtest);
SQLBindParameter(hStmt,5,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Amt,0,&Amt);
SQLBindParameter(hStmt,6,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Quantity,0,&Quantity);
SQLBindParameter(hStmt,7,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Total,0,&Total);
SQLBindParameter(hStmt,8,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Grandtotal,0,&Grandtotal);
            retcode=SQLExecute(hStmt);
            printf("\n\n Detail is inserted..........");
        }
        printf("\nDo u wan to cont (s/n)");
        scanf("%s",&ca);
        }
        while(ca=='s');
        break;
    case 2:
        printf("\nDelete the Patient 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,&Billno,0,&Billno);      
            printf("enter the Billno\n");
            scanf("%d",&Billno);
            retcode=SQLExecute(hStmt);
            printf("\nDetail has been deleted\n\n");
        }
        break;
    case 3:
        printf("\nDisplay the ONLINE SUPERMARKET SYSTEM\n\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);
            SQLBindCol(hStmt,6,SQL_C_CHAR,szModel6,sizeof(szModel6),&cbModel6);
            SQLBindCol(hStmt,7,SQL_C_CHAR,szModel7,sizeof(szModel7),&cbModel7);
            SQLBindCol(hStmt,8,SQL_C_CHAR,szModel8,sizeof(szModel8),&cbModel8);
            retcode=SQLFetch(hStmt);
            printf("Billno\tDate\tSno\tItemname  Amt\tQuantity\tTotal\tGrandtotal\n\n");
            while(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
            {
               printf("%s\t%s\t%s\t%s\t  %s\t%s\t\t%s\t%s\n", szModel1, szModel2, szModel3, szModel4, szModel5, szModel6, szModel7, szModel8);
               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 “ONLINE SUPERMARKET 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 »

Still not found what you are looking for? Try again here.