Professional Documents
Culture Documents
Invoice Report 1
Invoice Report 1
Invoice list is the list where you can send an invoice, debit memo, credit memo
together to a payer on a particular date.
Invoice list is basically used as report card for the customer that what he buys and
how much does it cost and at what time?
C++ program; An invoice contains a list of goods purchased in a store. One element
of the list is a pair of goods - amount. To create an Invoice modeling class with fields:
- list of purchased goods - associative array (map) with key object Stock and value its
price.
In this project I have created invoice list where I have used switch cases as a key
product e.g.; soaps, electronic accessories, biscuits, snacks etc. with this cases
function is used to call respective data and within that there are options on the basis
of key products after that it asks for the quantity of the product to be bought.
After all this upper process, it uses <ctime> library to make sure at what time
something is bought with the customer name and then calculates the bill with the data
given above.
#include <iostream>
#include<string>
#include <ctime>
#include<fstream>
using namespace std;
void bill(double total){
cout<<"Enter your name for billing please ";
string name;
cin>>name;
cout<<"******************************\n";
cout << "order placed at time ^<^ " << dt <<endl;
cout<<"******************************\n";
cout<<"dear "<<name<<",";
cout<<"\n******************************\n";
ofstream MyFile("selling record.txt");
cout<<"your total are = "<<total;
MyFile<<"your total are = "<<total;
print: cout<<"\nEnter your amount = ";
int amount;
cin>>amount;
if (amount>=total){
cout<<"******************************\n";
cout<<"Your return is = "<<amount-total;
MyFile<<"Your return is = "<<amount-total;
}
else {cout<<"\n you can't leave the store unless you clear your bill \n";
goto print;
}
}
bill(price*quantity);
void soap(){
cout<<"options for soaps are\n";
string soap[]={"life_bouy", "Lux","Dettol", "dove","safe_guard"};
int soap_cost[]={160,135,215,365,110};
for(int i=0;i<5;i++){
cout<<i<<" "<<soap[i]<<endl;
}
cout<<"Enter number accordingly for buying soaps ";
int item_number;
cin>>item_number;
double price;
int quantity;
switch(item_number){
case 0: price=160; cout<<"you entered life_bouy and its price is "<<price;
cout<<"\nEnter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 1: price=135; cout<<"you entered lux and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 2: price=215; cout<<"you entered dettol and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 3: price=365; cout<<"you entered dove and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 4: price=110; cout<<"you entered safe_guard and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
}
}
void biscuits(){
cout<<"options for biscuits are\n";
string biscuits[]={"sooper", "Peanut_pista","gluco", "party","zera_plus"};
for(int i=0;i<5;i++){
cout<<i<<" "<<biscuits[i]<<endl;
}
cout<<"Enter number accordingly for buying biscuits ";
int item_number;
cin>>item_number;
double price;
int quantity;
switch(item_number){
case 0: price=40; cout<<"you entered sooper and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 1: price=50; cout<<"you entered Peanut_pista and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 2: price=40; cout<<"you entered gluco and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 3: price=30; cout<<"you entered party and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 4: price=15; cout<<"you entered zera_plus and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
}
}
void snacks(){
cout<<"options for snacks are\n";
string snacks[]={"lays", "kurleez","lays_wavy", "pop_corn","oreos"};
int snacks_cost[]={50,30,100,75,15};
for(int i=0;i<5;i++){
cout<<i<<" "<<snacks[i]<<endl;
}
cout<<"Enter number accordingly for buying snacks ";
int item_number;
cin>>item_number;
double price;
int quantity;
switch(item_number){
case 0: price=50; cout<<"you entered lays and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 1: price=30; cout<<"you entered kurleez and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 2: price=100; cout<<"you entered lays_wavy and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 3: price=75; cout<<"you entered pop_corn and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 4: price=75; cout<<"you entered oreos and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
}
}
void drinks(){
cout<<"options for drinks are\n";
string drinks[]={"pepsi", "coca-cola","7up", "pakola","marinda"};
int snacks_cost[]={60,60,60,60,60};
for(int i=0;i<5;i++){
cout<<i<<" "<<drinks[i]<<endl;
}
cout<<"Enter number accordingly for buying drinks ";
int item_number;
cin>>item_number;
double price;
int quantity;
switch(item_number){
case 0: price=60; cout<<"you entered pepsi and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 1: price=60; cout<<"you entered coca-cola and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 2: price=60; cout<<"you entered 7up and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 3: price=60; cout<<"you entered pakola and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 4: price=60; cout<<"you entered marinda and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
}
}
void chocholate(){
cout<<"options for chocholate are\n";
string chocolate[]={"dairy_milk", "mars","cadbury", "kit_kat","bublee"};
int chocholate_cost[]={810,169,240,1815,749};
for(int i=0;i<5;i++){
cout<<i<<" "<<chocolate[i]<<endl;
}
cout<<"Enter number accordingly for buying drinks ";
int item_number;
cin>>item_number;
double price;
int quantity;
switch(item_number){
case 0: price=810; cout<<"you entered dairy mik and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 1: price=169; cout<<"you entered mars and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 2: price=240; cout<<"you entered cadbury and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 3: price=1815; cout<<"you entered kit_kat and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 4: price=749; cout<<"you entered bublee and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
}
}
void electronic(){
cout<<"options for electronic accessories are\n";
string electronic[]={"head_phone", "ear_buds","charger",
"adapoter","screen_guard"};
int electronic_cost[]={590,1599,500,950,100};
for(int i=0;i<5;i++){
cout<<i<<" "<<electronic[i]<<endl;
}
cout<<"Enter number accordingly for buying electronic accessories ";
int item_number;
cin>>item_number;
double price;
int quantity;
switch(item_number){
case 0: price=590; cout<<"you entered head_phone and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 1: price=1599; cout<<"you entered ear_buds and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 2: price=500; cout<<"you entered charger and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 3: price=950; cout<<"you entered adapoter and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
case 4: price=100; cout<<"you entered screen_guard and its price is "<<price;
cout<<"\n Enter quantity please = ";
cin>>quantity;
total(price,quantity);
break;
}
}
switch(ch){
/*functions used for easiness of code which directly takes the
user to the particular function from his desired input*/
case 1: soap();
break;
case 2: biscuits();
break;
case 3: snacks();
break;
case 4: drinks();
break;
case 5: chocholate();
break;
case 6: electronic();
break;
default:cout<<"Invalid option. Please enter correct option ";
goto print;
break;
return 0;
}}