invoicing system mini project in c++

 

“Invoicing System”





1.   Introduction

·      Invoicing System is basically designed for a Grocery Shop.

·      This project is totally built at administrative end and thus only the administrator is guaranteed the access.

·       As the name “Invoicing” suggests billing , this system makes billing easier . It manages all the information of Products , Customer , Schemes , Stock , Billing and Receipt .

·      It  allows  us  to access  details  as  well  as  the  history  of  Products , Customers  and  Bills .

·       It does stock management efficiently .

·      This system also provides us another facility i.e, Lucky Draw .It helps us to conduct an unbiased Lucky Draw by giving us an automated result of Lucky Draw .

·       In this project , we will illustrate our system by providing C++ language

·      This project uses the concept of file handling . It allows  admin to access bill history of customer .

 2.   Problem Statement

·      Nowadays , billing is done either manually or using barcode readers which is highly time consuming .

 

·      In order to overcome these disadvantages , the billing process has to be automated.

3.  Objective

·     To reduce the manual work required for managing Bills , Stock ,       Product details , Customer details , Customer and bill history 

.

·     To provide an  unbiased  Lucky Draw

·     To .build  a  system  that  saves  time  and  a  single  platform  where  all  the data and history  can  be  easily accessed  .

·     To  build  a  platform which  is  user  friendly  and  easy  to  use .

Control Flow Diagram:



Modules:

·      Product Details

This module helps us manage all the Product Details . In this module , we can View all the product details , Add new products and its details , Update product details , Delete(Remove) product , Search specific product details .

 

·      Customer Details

This module helps us manage of all Customer Details . We can view(view all customer details as well as individual customer details) and add customer details . We can also access individual customer details .

 

·      Stock Management

In this module , we can keep record of stock of products . We can view , update and search the stock .  

 

·      Schemes

In this modules , we can see all the schemes provided on products .

 

·      Bill

In this module , we can make the bill of products shopped . We can also keep record of bills .We can view bill history according to date or customer name.

 

·      Lucky Draw

This module helps us conduct the lucky draw and gives the unbiased result of the lucky draw .

Algorithm:


Step 1 : Start

Step 2 : Display Welcome Content

Step 3 : Administrator login

Step 4 : Display Main Menu

Step 5 : Select option  from 1 to 7

Step 6 : If option 1 ( Product Details)

  1) Menu for Product Details

  2) Select option from 1 to 6

  3) If option 1 ( View Products)

           a) Display All Product Detail

    4) If option 2 ( Add Product)

           a) Input new product and its information

  5) If option 3 ( Update Product)

           a) Input the name of required product

               Update Product and its information

  6) If option 4 ( Delete Product)

            a) Input the name of required product

                Delete the required product and its information

  7) If option 5 ( Search Product)

             a) Input the name of required product

                 Search Information of required Product

  8) If option 6 ( Exit)

              a) Go Back to Main Menu

Step 7 : If option 2 ( Customer Details)

1)   Menu for Customer Details

2)   Select option from 1 to 3

3)    If option 1 ( Add Customer)

a)    Input New Customer and its information

            

                  4) If option 2 ( View Customer Details)

1. Menu for viewing customer details

2. If option 1( View customer information by id)

     a) Display specific customer details according to id

3. If option 2( View all customer information)

     a) Display all customer Details

                   5) If option 3 ( Exit)

    a) Go Back to Main Menu

                Step 8 : If Option 3 ( Stock Management)

                    1) Menu for Stock Management

                    2) Select option from 1 to 4

     a) If option 1 ( View Product Stock)

         Display the stock of all Products

     b) If option 2 ( Update Product stock)

         Input the name of required product

         Update the stock of required products

     c) If option 3 ( Search)

          Search the stock of required product

          Display the search results

     d) If option 4 ( Exit)

          Go Back to Main Menu       

                Step 9 : If option 4 ( Schemes)

                           1) Menu for Schemes

                           2) Select option from ( 1 to 11)

                           3) According to the choose option. the schemes will be displayed

                           4) If option 11, then Go back to Main Menu.

                 Step 10 : If Option 4 ( Bill)

                           1) Menu for Bill

                           2) Select option from ( 1 to 4)

                           3) If option 1 ( Bill)

                           a) Create Bill for Customer

                            b) The number of shopped items are reduced from stock

                           4) If option 2 ( Search Bill By Date)

                           a) Input the required date, history of all bills created on that day      will be displayed

                           5) If option 3 ( Search bill by customer name)

                           a) Input the customer name whose bill history is required and the bill history will be dispayed

                           6) If option 4 ( Exit)

                           a) Go back to Main Menu

           Step 11 : If option 5 ( Lucky Draw)

                        1) Display the instructions for Lucky Draw

                        2) Input the number of participants

                        3) Display winner

                        4) Go Back to Main Menu

            Step 12 : If Option 6 ( Exit)

                        1) Thank You

                        2) Exit from Program

             Step 13 : END

PROGRAM:

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <windows.h>
#include <sstream>
#include <iomanip>
#include <bits/stdc++.h>
#include "datevalidate.cpp"
#include "stockvalidate.cpp"
using namespace std;
string s1,s2,s3,p1,p2,p3,p4,p5,measure;
int i=1,choice,sprice;
string p_name,p_name2,cdate;
int discount;
string dd,mm,yyyy;
float cus_amt,return_amt,net_amt,total_amt,price;
string date,custname;
char ans;
int x=0,neww,quantity;

void delete_line(const char *file_name, int n)
{
    ifstream is(file_name);
    ofstream ofs;
    ofs.open("temp.txt", ofstream::out);
    char c;
    int line_no =1;
    while (is.get(c))
    {
        if (c == '\n')
        line_no++;

        if (line_no != n)
            ofs << c;
    }
ofs<<endl<<s1<<","<<neww<<"."<<s3;
    ofs.close();
    is.close();
    system("pause");
    remove(file_name);
    rename("temp.txt", file_name);
}

void Delete_entry()
{
string input;
ifstream fin;

int i=1;
int n;
string data;
string name;
string head;
fin.open("stock.txt");
getline(fin,head,'\n');
while(fin.peek()!=EOF){
getline(fin>>ws,name,',');
getline(fin>>ws,data,'.');
getline(fin>>ws,measure,'\n');
i=i+1;
if(name.compare(p_name2)==0){n=i;
s1=name;
s2=data;
s3=measure;}
}

fin.close();
 stringstream convert(s2);
        neww = 0;
        convert >> neww;
neww = neww-quantity;
    delete_line("stock.txt", n);
}

void bill()
{ total_amt = 0;
    ofstream billin;
    billin.open("bill.txt",ios::app);
     if(!billin.is_open())
  {
     cout << "\n\n\n\n \t\t\t\t\tERROR : File is not Open" << '\n';
  }

    dateread();
    date = Udate;
    cout<<"\nEnter Customer Name : ";
    getline(cin>>ws,custname);
    transform(custname.begin(), custname.end(), custname.begin(), ::tolower);
    cout<<endl;
    billin<<endl<<date<<endl;
    billin<<custname<<endl;
    billin
       <<left
       <<setw(5)
       <<"   \t "
       <<left
       <<setw(25)
       <<"Product Name"
       <<left
       <<setw(19)
       <<"Quantity"
       <<left
       <<setw(25)
       <<"Selling Price"
       <<left
       <<setw(20)
       <<"Discount"
       <<left
       <<setw(10)
       <<"Net amount"
       << "\n";

        do
        {
            pavailable();
            p_name2=p_name3;
            stockavailable();
            p_name2=p_name3;
            cout<<"Enter the quantity of Product : ";
            cin>>quantity;

            ifstream in("avantika.txt",ios::in);
            if(!in.is_open())
            {
                cout<<"Error : File not open"<<endl;
            }
            string p_gst,p_sellingprice,p_mrp,p_discount;

            while(in.peek()!=EOF)
            {
                getline(in>>ws,p_name,',');
                getline(in>>ws,p_mrp,',');
                getline(in>>ws,p_gst,',');
                getline(in>>ws,p_sellingprice,',');
                getline(in>>ws,p_discount,'\n');

                if(p_name.compare(p_name2)==0)
                {
                  p1=p_name;
                  p2=p_mrp;
                  p3=p_gst;
                  p4=p_sellingprice;
                  p5=p_discount;

                  stringstream convert(p4);
                   sprice=0;
                  convert>>sprice;

                        stringstream change(p5);
                        discount=0;
                        change>>discount;
                }
            }
            cout<<"Selling Price                 : "<<sprice;
            cout<<"\nDiscount(in %)                : "<<discount;

            int dis=discount;
            long long sellingprice2;
            sellingprice2 = sprice * quantity;
            double afterdisc;

           if(dis != 0){
            price = sellingprice2 -(sellingprice2*dis/100);}
            if(dis == 0){price = sellingprice2;
            }
           total_amt=total_amt+price;
           cout<<("\n");
    billin
       <<left
       <<setw(0)
       <<"  "
       <<left
       <<setw(27)
       <<p_name2
       <<left
       <<setw(20)
       <<quantity
       <<left
       <<setw(24)
       <<sprice
       <<left
       <<setw(20)
       <<discount
       <<left
       <<setw(20)
       <<price
       << "\n";

        Delete_entry();

            cout<<"\n\nDo you want to add another product ?(y/n) ";
            cin>>ans;
        }while(ans=='y' || ans=='Y');

    billin<<"@"<<endl;
    billin<<"Total : "<<total_amt<<",";

    billin.close();
    string chdate,chname,chdata,chtotal,chblank;
    ifstream recentf("bill.txt",ios::binary);
    while(recentf.peek()!=EOF){
    getline(recentf,chdate,'\n');
    getline(recentf,chname,'\n');
    getline(recentf,chblank,'P');
    getline(recentf>>ws,chdata,'@');
    getline(recentf,chtotal,','); }
    cout<<endl<<"P"<<chdata<<endl;
    cout<<chtotal<<endl;
    recentf.close();
}

void showbill(){
    ifstream billout("bill.txt",ios::app);
    if(!billout.is_open()) std::cout << "ERROR: File Open" << "\n";
    string famount;
    string prod;
    int countter = 0;
    string fcustname;

            dateread();
            cdate = Udate;
           while(billout.peek()!=EOF){
           getline(billout>>ws,date,'\n');
           getline(billout>>ws,fcustname,'\n');
           getline(billout>>ws,prod,'@');
           getline(billout>>ws,famount,',');

           if(cdate.compare(date)==0){
               countter = countter +1;
                cout<<countter<<") ";
                cout<<" Customer name: "<<fcustname<<endl;
            cout<<prod<<endl;
             cout<<famount<<" Rs"<<endl<<endl;}
           }
           billout.close();
}
void showbillbyname(){
    ifstream billbyname("bill.txt",ios::app);
    if(!billbyname.is_open()) std::cout << "ERROR: File Open" << '\n';
    string famount;
    string prod;
    string searchname;
    int countter = 0;
    string fcustname;
           cout<<"Enter name : ";
           getline(cin>>ws,searchname);
           transform(searchname.begin(), searchname.end(), searchname.begin(), ::tolower); //converting into lowercase
           while(billbyname.peek()!=EOF){
           getline(billbyname>>ws,date,'\n');
           getline(billbyname>>ws,fcustname,'\n');
           getline(billbyname>>ws,prod,'@');
           getline(billbyname>>ws,famount,',');

           if(searchname.compare(fcustname)==0){
               countter = countter +1;
                cout<<endl<<countter<<") ";
                cout<<"Date : "<<date<<endl;

            cout<<endl<<prod<<endl;
             cout<<famount<<" Rs"<<endl<<endl;}
           }
           billbyname.close();
}







  Input and Output:



 

                         Now, the user has to login

                         Input – Username and password , then press any key to proceed



Now, we can see the main menu .

                        Input – Any no. from 1 to 7 according to choice of user.

                        After the user inputs the choice , accordingly the output is displayed .



When the user inputs option 1 in main menu , then he enters the another menu through which we can                   handle the product details and perform the required operations

                           Input – Any no. between 1 to 6 , accordingly the operation is carried out .


















 

 


Post a Comment

Previous Post Next Post