Invoicing management system, just learn C + +

Source: Internet
Author: User
Tags class manager

Do you have anything to add to the comments?

#include <iostream>

#include <string>
using namespace Std;
int g=0;//Define global variables//Total number of existing goods
int S=0;//staff Number of employees
Double t=0;//Total turnover
Create the first Class (cargo)
Class goods
{
Public
String id;//
String name;//Name
Double price;//Price
int num;//Number
}goods[10000];//Defining arrays
Class staff//second category (staff)
{
Public
String ID;
String name;
Double sale;//turnover
}STAFF[1000];
Class Manager
{
Public
virtual void Show ()//virtual function
{
cout<< "Show method for managing base classes" <<endl;
}
};
Class Salemanager:public manager//derived from one of the classes
{
Public
String Salemenu;
Salemanager ()
{
Salemenu= "---sales management---\n1. Sales \n2. Sales refund \n3. New Salesperson Information 4. Sales statistics \n0. Return to main Menu \ n Please enter your choice:";
}
void Show ()
{
int n,i,j;
Do
{
cout<<salemenu;
cin>>n;
if (n==1)
{
int num,d=1;
String A, B;
cout<< "Please enter the sales employee number:";
cin>>b;
for (i=1;i<=s;i++)
if (b==staff[i].id)
{
D=0;
Break
}
if (d)
{
cout<< "Employees who do not have this number. "<<endl;
System ("pause");
Break
}
d=1;
cout<< "Please enter the number of the sales product:" <<endl;
cin>>a;
for (j=1;j<=g;j++)
if (a==goods[j].id)
{
D=0;
Break
}
if (d)
{
cout<< "There are no items for this number. "<<endl;
System ("pause");
Break
}
cout<< "Please enter sales:" <<endl;
cin>>num;
if (num>goods[i].num)
cout<< "not so much stock. "<<endl;
Else
{
Calculation of staff[i].sale+=num*goods[j].price;//turnover
Goods[j].num-=num;
T+=num*goods[j].price;
}
}
else if (n==2)
{
int num,d=1;
String A, B;
cout<< "Please enter the employee number of the refund:";
cin>>b;
for (i=1;i<=s;i++)
if (b==staff[i].id)
{
D=0;
Break
}
if (d)
{
cout<< "Employees who do not have this number. "<<endl;
System ("pause");
Break
}
d=1;
cout<< "Please enter the number of the refund item:" <<endl;
cin>>a;
for (j=1;j<=g;j++)
if (a==goods[j].id)
{
D=0;
Break
}
if (d)
{
cout<< "There are no items for this number. "<<endl;
System ("pause");
Break
}
cout<< "Please enter the amount of refund:" <<endl;
cin>>num;
Staff[i].sale-=num*goods[j].price;
Goods[j].num+=num;
T-=num*goods[j].price;
}
else if (n==3)
{
s++;
cout<< "Please enter the new employee number:";
cin>>staff[s].id;
cout<< "Please enter the name of the new employee:";
cin>>staff[s].name;
cout<< "Please enter new employee turnover:";
cin>>staff[s].sale;
}
else if (n==4)
{
int i;
cout<< "number \ t name \ t Sales" <<endl;
for (i=1;i<=s;i++)
cout<<staff[i].id<< "\ t" <<staff[i].name<< "\ T" <<staff[i].sale<<endl;
}
}
while (n);
}
};
Class Savemanager:public Manager
{
Public
String Savemenu;
Savemanager ()
{
Savemenu= "---inventory management---\n1. Check inventory \n0. Return to the main menu \ n Please enter your choice:";
}
void Show ()
{
int n,i;
Do
{
cout<<savemenu;
cin>>n;
if (n==1)
{
cout<< "No. \ t name \ t unit price \ t Stock" <<endl;
for (i=1;i<=g;i++)
cout<<goods[i].id<< "\ t" <<goods[i].name<< "\ T" <<goods[i].price<< "\ T" << goods[i].num<<endl;
}
}
while (n);
}
};
Class Buymanager:public Manager
{
Public
String Buymenu;
Buymanager ()
{
Buymenu= "---procurement management---\n1. Buy the original item \n2. Buy a new item \n0. Return to the main menu \ n Please enter your choice:";
}
void Show ()
{
int n,i;
Do
{
cout<<buymenu;
cin>>n;
if (n==1)
{
int num,d=1;
Double p;
String A;
cout<< "Please enter the number of goods to buy:";
cin>>a;
for (i=1;i<=g;i++)
if (a==goods[i].id)
{
D=0;
Break
}
if (d)
{
cout<< "There are no goods of that number. "<<endl;
System ("pause");
Break
}
cout<< "Please enter the purchase price:";
cin>>p;
cout<< "Please enter buy quantity:";
cin>>num;
Goods[i].num+=num;
T-=num*p;
}
else if (n==2)
{
g++;
cout<< "Please enter the new cargo number:";
cin>>goods[g].id;
cout<< "Please enter the new cargo name:";
cin>>goods[g].name;
cout<< "Please enter the price of new goods:";
cin>>goods[g].price;
cout<< "Please enter the quantity of new goods:";
cin>>goods[g].num;
T-=goods[g].num*goods[g].price;
}
}
while (n);
}
};
Class Moneymanager:public Manager
{
Public
String Moneymenu;
Moneymanager ()
{
Moneymenu= "---financial management---\n1. Query turnover \n0. Return to main Menu \ n Please enter your choice:";
}
void Show ()
{
int n;
Do
{
cout<<moneymenu;
cin>>n;
if (n==1) cout<< "turnover:" <<T<<endl;
}
while (n);
}
};
Class Form
{
Public
int n;
String Strword;
form (String str)
{
STRWORD=STR;
}
void input ()
{
Do
{
System ("CLS");
cout<<strword;
cin>>n;

if (n==1)
{
Salemanager m;
Addfun (&AMP;M);
}
else if (n==2)
{
Savemanager m;
Addfun (&AMP;M);
}
else if (n==3)
{
Buymanager m;
Addfun (&AMP;M);
}
else if (n==4)
{
Moneymanager m;
Addfun (&AMP;M);
}
}while (n);
}
Add a Feature object to a menu class object
void Addfun (Manager *m)
{
M->show ();
}
};
void Main ()
{
String Menu,salemenu,savemenu,buymenu,moneymenu;
menu= "= = Invoicing ===\n";
menu+= "1. Sales management \ n";
menu+= "2. Inventory management \ n";
menu+= "3. Procurement management \ n";
menu+= "4. Financial management \n0. exit \ n Please enter your choice:";
Form f (menu);
F.input ();
}



Invoicing management system, just learn C + +

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.