商店管理系统.cpp
上传用户:scshmc
上传日期:2022-03-20
资源大小:117k
文件大小:58k
- //mymain.cpp
- #include<iostream>
- #include<conio.h>
- #include<string>
- #include<ctype.h>
- #include<stdio.h>
- #include<time.h>
- #include<iomanip>
- using namespace std;
- template <typename T>
- void addback(T *&p,T *&t) //模板函数
- {
- p->next=t;
- p=t;
- p->next=NULL;
- }
- //////////////////////////////////////////////////////////
- //mygoods
- class ware // 抽象类 商品基本信息
- {
- protected:
- char *warename ; //名称
- int amount; //数量
- char* number; //编号
- char *manufacturer; //厂商信息
- char *describe ; //商品描述
- char * date; //时间
- char *sortname; //类别
- float consultprice; //参考售货价
- public:
- ware (){};
- ware( char *,int , char* , char *, char *, char* , char *) ; //初始化
- virtual ~ware(){delete []warename;delete []number;delete []manufacturer;delete []describe;delete []date;} //虚析构
- char *getwarename(){return (warename+2);} //获取名称
- void setwarename(char *aa){warename=new char[strlen(aa)+1];strcpy(warename,aa);} //重置名称
- int getamount(){return amount;} //获取数量
-
- void setconsultprice(double nnn){consultprice=nnn;} //设置参考售货价
- float getconsultprice(){return consultprice;} //返回参考售货价
- char* getnumber(){return (number+2);} //获取编号
- void setnumber(char*cc){number=new char[strlen(cc)+1];strcpy(number,cc);} //重设编号
- char *getmanfacturer(){return (manufacturer+2);} //获取厂家信息
- void setmanufacturer(char *dd){manufacturer=new char[strlen(dd)+1];strcpy(manufacturer,dd);} //重设厂家信息
- char *getdescribe(){return (describe+2);} //获取商品描述
- void setdescribe(char *ee){describe=new char[strlen(ee)+1];strcpy(describe,ee);} //重设商品描述
- char * getdate(){return (date+2);} //获取时间
- void setdate(char *ff){date=new char[strlen(ff)+1];strcpy(date,ff);} //重设时间
- char *getsortname(){return (sortname+2);} //获取类别
- void setsortname(char *gg){sortname=new char[strlen(gg)+1];strcpy(sortname,gg);}//重设类别
- virtual void setamount(int)=0; //重设数量
- virtual void setprice(double)=0; //纯虚 置价格
- virtual float getprice()=0; // //纯虚 获取价格
- virtual void sethandle(char*)=0; //纯虚 设置经手人
- virtual char *gethandle()=0; //纯虚 返回经手人
- ware *next; //增加指针成员
- };
- ware::ware( char *a,int b, char* c,char *d, char *e, char* f, char *g)
- {
- warename=new char[strlen(a)+1];
- strcpy(warename,a);
- amount=b;
- number=new char[strlen(c)+1];
- strcpy(number,c);
- manufacturer=new char[strlen(d)+1];
- strcpy(manufacturer,d);
- describe=new char[strlen(e)+1];
- strcpy(describe,e);
- date=new char[strlen(f)+1];
- strcpy(date,f);
- sortname=new char[strlen(g)+1];
- strcpy(sortname,g);
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////
- class stocklist:public ware // 具体类 进货单
- {
- protected :
- char *handle;
- char *listname; //单名
- float price;
- public :
- stocklist(){};
- stocklist(char *aa,int bb,char* cc,char *dd,char *ee,char* ff,char *gg,char* hh):ware( aa, bb, cc, dd, ee,ff, gg){listname=new char[strlen(hh)+1];strcpy(listname,hh);}
- ~stocklist(){delete []listname;delete []sortname;delete[]handle;}
- void sethandle(char *id){handle=new char[strlen(id)+1];strcpy(handle,id);} //用id记录经手人
- virtual void setamount(int aaaa) {amount=aaaa;} //重设数量
-
- void setprice(double m){price=m;} //设置进货价格
- float getprice(){return price;} //返回进货 价格
- char *gethandle(){return(handle);} // 返回经手人
-
- };
- ///////////////////////////////////////////////////////////////////////////////////
- class sellgoodslist:public ware // 具体类 售货单
- {
- protected :
- char *handle;
- char *listname; //单名
- float price;
- public :
- sellgoodslist(){};
- sellgoodslist(char *aa,int bb,char* cc,char *dd,char *ee,char* ff,char *gg,char* hh):ware( aa, bb, cc, dd, ee,ff, gg){listname=new char[strlen(hh)+1];strcpy(listname,hh);}
- ~sellgoodslist(){delete []listname;delete []sortname;delete[]handle;}
- void sethandle(char *id){handle=new char[strlen(id)+1];strcpy(handle,id);} //用id记录经手人
- virtual void setamount(int aaaa) {amount=aaaa;} //重设数量
- void setprice(double m){price=m;} //设置参考售价格
- float getprice(){return price;} //返回参考售价格
- char *gethandle(){return(handle);} // 返回经手人
-
- };
- ///////////////////////////////////////////////////
- ///myemployee
- class field //抽象类, 基本信息
- {
- protected:
- char * name; // 姓名
- int sex; //性别 男为1女为0
- char * cardnumber; // 身份编号
- char *individuallike; //个人爱好
- char * birthday; // 个人生日
- int degree; //学位 0为专科1为本科2为硕士3为其他
- char * jointtime; //加入时间
- char *password; //登陆密码初始为身份编号
- public:
- field(){};
- field( char *a,int b, char * c, char *d, char * e,int f, char *g);
- ~field(){delete[]name;delete[]cardnumber;delete[]individuallike;delete[]birthday;delete[]jointtime;delete[]password;}
- char *getname(){return name+2;} //返回姓名
- char *getcardnumber(){return (cardnumber+2);} //返回身份编号
- void setname(char *aa){name=new char[strlen(aa)+1];strcpy(name,aa);} //重设姓名
- void setsex(int bb){sex=bb;} //重设性别
- void setcardnumber(char *cc){cardnumber=new char[strlen(cc)+1];strcpy(cardnumber,cc);} //重设编号
- void setindividuallike(char *dd){individuallike=new char[strlen(dd)+1];strcpy(individuallike,dd);} //重设个人爱好
- void setbirthday(char *ee){birthday=new char[strlen(ee)+1];strcpy(birthday,ee);} //重设生日
- void setdegree(int ff){degree=ff;} //重设学位
- void setjointtime(char *gg){jointtime=new char[strlen(gg)+1];strcpy(jointtime,gg);} //重设加入时间
- char *getpassword(){return(password+2);} //返回密码
- void setpassword(char *aaa){password=new char[strlen(aaa)+1];strcpy(password,aaa);} //重设密码
- virtual void setplace(int )=0; //设置职位
- virtual void printfield() =0; //打印基本信息
- virtual void printpayslip(ware *,ware * )=0; //打印工资单
- virtual float getscale1()=0; //返回 奖金比例
- virtual void setscale(float)=0; //设置 奖金比例
- field *next;
- };
- field::field( char *a,int b,char * c, char *d, char * e,int f, char *g)
- {
- name=new char[strlen(a)+1];
- strcpy(name,a);
- sex=b;
- cardnumber=new char[strlen(c)+1];
- strcpy(cardnumber,c);
- individuallike=new char[strlen(d)+1];
- strcpy(individuallike,d);
- birthday=new char[strlen(e)+1];
- strcpy(birthday,e);
- degree=f;
- jointtime=new char[strlen(g)+1];
- strcpy(jointtime,g);
- password=new char[strlen(c)+1];
- strcpy(password,cardnumber); //登陆密码初始为身份编号
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- class staff:public field //具体类 员工级别
- {
- protected:
- int place; //1为售货员0为仓库管理员 2为经理
-
- public:
- static float scale1; //静态奖金比率
- staff(){};
- staff(char *aa,int bb,char* cc,char *dd,char*ee,int ff,char* gg):field(aa,bb,cc,dd,ee,ff,gg){};
- ~staff(){};
- void setplace(int hh){place=hh;} //设置职位
- void setscale(float oo){scale1=oo;} //设置员工奖金比例
- int getplace(){return place;} //返回职位
- void printfield();
- void printpayslip(ware *firstgoods,ware *sellfirstgoods) ;
- float getscale1(){return scale1;} //虚,返回奖金比例
- };
- float staff::scale1 =0.005;
- void staff::printfield()
- {
-
-
- cout<<setiosflags(ios::left)<<setw(8)<<(name+2);
- if(sex==1)cout<<setw(5)<<"男";
- else cout<<setw(5)<<"女";
- cout<<setw(10)<<(cardnumber+2)<<setw(15)<<(individuallike+2)<<setw(10)<<(birthday+2);
- if(degree==0)cout<<setw(5)<<"专科";
- if(degree==1)cout<<setw(5)<<"本科";
- if(degree==2)cout<<setw(5)<<"硕士";
- if(degree==3)cout<<setw(5)<<"其他";
- cout<<setw(10)<<(jointtime+2);
- if(place==1)cout<<setw(10)<<"售货员"<<endl;
- if(place==0)cout<<setw(10)<<"仓库管理员"<<endl;
- if(place==2)cout<<setw(10)<<"经理"<<endl;
- }
- void staff::printpayslip (ware *firstgoods,ware *sellfirstgoods) //打印工资单的实现版本返回员工工资
- {
- if(this->getplace ()==1)
- {float tatal=0;
- ware *ptr=sellfirstgoods;
- while(ptr!=NULL)
- {if(strcmp(this->getname (),ptr->gethandle ())==0)
- tatal+=((ptr->getamount ())*(ptr->getprice ()));
- ptr=ptr->next ;
- }
- cout<<setiosflags(ios::left)<<setw(10)<<"姓名"<<setw(25)<<"工资单=基本工资+奖金"<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<(name+2)<<setw(6)<<"1000"<<"++"<<tatal*scale1<<"=="<<(1000+tatal*scale1)<<endl;
- }
- if(this->getplace ()==0)
- {float tatal=0;
- ware *ptr=firstgoods;
- while(ptr!=NULL)
- {if(strcmp(this->getname (),ptr->gethandle ())==0)
- tatal=((ptr->getamount ())*(ptr->getprice ()));
- ptr=ptr->next ;
- }
- cout<<setiosflags(ios::left)<<setw(10)<<"姓名"<<setw(25)<<"工资单=基本工资+奖金"<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<(name+2)<<setw(6)<<"1000"<<"++"<<tatal*scale1<<"=="<<(1000+tatal*scale1)<<endl;
- }
-
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- class manager:public staff
- {protected:
- public:
- manager(){};
- manager(char *aaa,int bbb,char* ccc,char *ddd,char* eee,int fff,char* ggg):staff(aaa,bbb,ccc,ddd,eee,fff,ggg){};
- float getscale1(){return scale2;} //虚,返回奖金比例
- void printpayslip(ware *,ware * );
-
- void setscale(float ooo){scale2=ooo;} //设置经理奖金比例
- ~manager(){};
- static float scale2; //静态奖金比率
- };
- float manager::scale2=0.03;
- void manager::printpayslip (ware *firstgoods,ware *sellfirstgoods) //打印工资单的实现版本返回经理工资
- { float tatal=0;
- ware *ptr=firstgoods;
- while(ptr!=NULL)
- {tatal+=((ptr->getamount ())*(ptr->getprice ()));
- }
- ptr=sellfirstgoods;
- while(ptr!=NULL)
- {tatal+=((ptr->getamount ())*(ptr->getprice ()));
- }
- cout<<setiosflags(ios::left)<<setw(10)<<"姓名"<<setw(25)<<"工资单=基本工资+奖金"<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<(name+2)<<setw(35)<<"1000"<<"++"<<tatal*scale2<<"=="<<(1000+tatal*scale2)<<endl;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- void run(); //界面函数
- void landing(char *&mainhandle,field *&firstemployee,int &flag0); //登陆验证 函数
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void addnewemployee(field *&firstemployee,field *&lastemployee) ; //增加员工信息
- void cancelstaff(field *&firstemployee,field *&lastemployee) ; //删除员工信息
- void searchstaff(field *&firstemployee,field *&lastemployee) ; //搜索员工信息
- void chancestaff(field *&firstemployee,field *&lastemployee) ; //修改员工信息
- void scanstaff(field *&firstemployee) ; //浏览员工信息
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void addnewgoods(ware *&firstgoods,ware *&lastgoods); //增加新进商品并生成进货单
- void cancelappointgoods(ware *&firstgoods,ware *&lastgoods); //删除指定商品
- void searchappointgoods(ware *&firstgoods); //搜索指定商品
- void chanceappintgoods(ware *&firstgoods); //修改指定商品
- void scanallgoods(ware *&firstgoods); //浏览所有商品
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void sellappointgoods(ware *&firstgoods,ware *&sellfirstgoods,ware *&selllastgoods);//售出指定商品并生成售货单
- void sellgoodstaxis(ware *&sellfirstgoods); //售出商品排行
- void ownreportcard(ware *&sellfirstgoods); //生成个人销售业绩表
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void allgoodsworth(ware *&firstgoods); //仓库商品总值
- void nowcashearning(ware *&sellfirstgoods); //目前现金收入
- void payoffreport(ware *&firstgoods); //商品盈利报告
- void scanstaffsalary(ware *firstgoods,ware *sellfirstgoods,field *firstemployee); //员工薪水浏览
- void shopfare(ware *&firstgoods,ware *&sellfirstgoods); //公司收支状况
- void chancesalarystandard(field *firstemployee); //修改薪水标准
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- void showfunction(); // 系统功能菜单说明
- void visitpurview(); // 系统访问权限说明
- void systemmemory(); // 系统内存限制
- ///////////////////////////////////////////////
- char*mainhandle;
- char adiminister[20]={' '};
- char password[10]={' '};
- char youranswer[20]={' '};
- int ooooo=0;
- ////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////
- void main()
- {
- int flag0=0;
- ware *firstgoods=NULL;
- ware *lastgoods=NULL;
- ware *sellfirstgoods=NULL;
- ware *selllastgoods=NULL;
- field *firstemployee=NULL;
- field *lastemployee=NULL;
- run();
- AA: landing(mainhandle,firstemployee,flag0);
- A:
- int mainchoice;
- do
- {
- cout<<"主菜单:"<<"n(1) 员工管理(2)仓库管理(3)销售管理(4)财务管理(5)帮助文档(6)注销用户"<<endl;
-
- cin>>mainchoice;
- if(mainchoice!=1&&mainchoice!=2&&mainchoice!=3&&mainchoice!=4&&mainchoice!=5&&mainchoice!=6)
- cout<<"输入错误!请从新输入!"<<endl;
- }while(mainchoice!=1&&mainchoice!=2&&mainchoice!=3&&mainchoice!=4&&mainchoice!=5&&mainchoice!=6);
-
- switch(mainchoice)
- {
- case 1:
- {
- int _10choice;
-
- B: do
- {
- cout<<"请选择操作:"<<"n(1)增加员工信息(2)删除员工信息(3)搜索员工信息n(4)修改员工信息(5)浏览员工信息(6)返回上级"<<endl;
- cin>>_10choice;
- if(_10choice!=1&&_10choice!=2&&_10choice!=3&&_10choice!=4&&_10choice!=5&&_10choice!=6)
- cout<<"输入错误!请从新输入!"<<endl;
- }while(_10choice!=1&&_10choice!=2&&_10choice!=3&&_10choice!=4&&_10choice!=5&&_10choice!=6);
- char _11choice=0;
- switch(_10choice)
- {
-
- case 1:
- {
- do
- {
- addnewemployee(firstemployee,lastemployee); // 增加员工信息
-
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_11choice;
- }while(_11choice=='Y'||_11choice=='y');
-
- goto B;
- }
-
- case 2:
- {
- do
- {
- cancelstaff(firstemployee,lastemployee ); //删除员工信息
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_11choice;
- }while(_11choice=='Y'||_11choice=='y');
-
- goto B;
- }
- case 3:
- {
- do
- {
- searchstaff(firstemployee,lastemployee); //搜索员工信息
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_11choice;
- }while(_11choice=='Y'||_11choice=='y');
-
- goto B;
- }
- case 4:
- {
- do
- {
- chancestaff(firstemployee,lastemployee ); //修改员工信息
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_11choice;
- }while(_11choice=='Y'||_11choice=='y');
-
- goto B;
- }
- case 5:{
- do
- {
- scanstaff(firstemployee ); //浏览员工信息
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_11choice;
- }while(_11choice=='Y'||_11choice=='y');
-
- goto B;
- }
- case 6: goto A; //返回上一级
-
- }
-
- break;
- }
-
- case 2:
- {
- int _20choice;
- C: do
- {cout<<"请选择操作:"<<"n(1)增加新进商品并生成进货单(2)删除指定商品(3)搜索指定商品n(4)修改指定商品(5)浏览所有商品(6)返回上一级"<<endl;
- cin>>_20choice;
- if(_20choice!=1&&_20choice!=2&&_20choice!=3&&_20choice!=4&&_20choice!=5&&_20choice!=6&&_20choice!=7)
- cout<<"输入错误!请从新输入!"<<endl;
- }while(_20choice!=1&&_20choice!=2&&_20choice!=3&&_20choice!=4&&_20choice!=5&&_20choice!=6&&_20choice!=7);
- char _21choice=0;
- switch(_20choice)
- {
-
- case 1:
- {
- do
- {
- addnewgoods(firstgoods,lastgoods) ; //增加新进商品并生成进货单
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_21choice;
- }while(_21choice=='Y'||_21choice=='y');
- goto C;
- }
- case 2:
- {
- do
- {
- cancelappointgoods(firstgoods,lastgoods); //删除指定商品
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_21choice;
- }while(_21choice=='Y'||_21choice=='y');
- goto C;
- }
- case 3:
- {
- do
- {
- searchappointgoods(firstgoods); //搜索指定商品
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_21choice;
- }while(_21choice=='Y'||_21choice=='y');
- goto C;
- }
- case 4:
- {
- do
- {
- chanceappintgoods(firstgoods); //修改指定商品
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_21choice;
- }while(_21choice=='Y'||_21choice=='y');
- goto C;
- }
-
- case 5:
- {
- do
- {
- scanallgoods(firstgoods); //浏览所有商品
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_21choice;
- }while(_21choice=='Y'||_21choice=='y');
- goto C;
- }
- case 6: goto A; //返回上一级
-
- }
- break;
- }
- case 3:
- {
- int _30choice;
- D: do
- {cout<<"请选择操作:"<<"n(1)售出指定商品并生成售货单(2)搜索指定商品(3)售出商品排行n(4)生成个人销售业绩表(5)返回上一级"<<endl;
- cin>>_30choice;
- if(_30choice!=1&&_30choice!=2&&_30choice!=3&&_30choice!=4&&_30choice!=5)
- cout<<"输入错误!请从新输入!"<<endl;
- }while(_30choice!=1&&_30choice!=2&&_30choice!=3&&_30choice!=4&&_30choice!=5);
- char _31choice=0;
- switch(_30choice)
- {
-
- case 1:
- {
- do
- {
- sellappointgoods(firstgoods,sellfirstgoods,selllastgoods); //售出指定商品并生成售货单
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_31choice;
- }while(_31choice=='Y'||_31choice=='y');
- goto D;
- }
- case 2:
- {
- do
- {
- searchappointgoods(firstgoods); //搜索指定商品
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_31choice;
- }while(_31choice=='Y'||_31choice=='y');
- goto D;
- }
-
- case 3:
- {
- do
- {
- sellgoodstaxis(sellfirstgoods); //售出商品排行
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_31choice;
- }while(_31choice=='Y'||_31choice=='y');
- goto D;
- }
- case 4:
- {
- do
- {
- ownreportcard(sellfirstgoods); //生成个人销售业绩表
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_31choice;
- }while(_31choice=='Y'||_31choice=='y');
- goto D;
- }
- case 5:
- goto A; //返回
- }
- break;
- }
- case 4:{
- int _40choice;
- E: do
- {cout<<"请选择操作:"<<"n(1)仓库商品总值(2)目前现金收入(3)商品盈利报告n(4)员工薪水浏览(5)公司收支状况(6)修改薪水标准(7)返回上一级"<<endl;
- cin>>_40choice;
- if(_40choice!=1&&_40choice!=2&&_40choice!=3&&_40choice!=4&&_40choice!=5&&_40choice!=6&&_40choice!=7)
- cout<<"输入错误!请从新输入!"<<endl;
- }while(_40choice!=1&&_40choice!=2&&_40choice!=3&&_40choice!=4&&_40choice!=5&&_40choice!=6&&_40choice!=7);
- char _41choice=0;
- switch(_40choice)
- {
-
- case 1:
- {
- do
- {
- allgoodsworth(firstgoods); //仓库商品总值
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_41choice;
- }while(_41choice=='Y'||_41choice=='y');
- goto E;
- }
- case 2:
- {
- do
- {
- nowcashearning(sellfirstgoods); //目前现金收入
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_41choice;
- }while(_41choice=='Y'||_41choice=='y');
- goto E;
- }
- case 3:
- {
- do
- {
- payoffreport(firstgoods); //商品盈利报告
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_41choice;
- }while(_41choice=='Y'||_41choice=='y');
- goto E;
- }
- case 4:
- {
- do
- {
- scanstaffsalary(firstgoods,sellfirstgoods,firstemployee); //员工薪水浏览
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_41choice;
- }while(_41choice=='Y'||_41choice=='y');
- goto E;
- }
- case 5:
- {
- do
- {
- shopfare(firstgoods,sellfirstgoods); //公司收支状况
- cout<<"如果想继续此项操作,请输入Y!"<<endl;;
- cin>>_41choice;
- }while(_41choice=='Y'||_41choice=='y');
- goto E;
- }
- case 6:
- {
- do
- {
- chancesalarystandard(firstemployee); //修改薪水标准
- cout<<"如果想继续此项操作,请输入Y!"<<endl;
- cin>>_41choice;
- }while(_41choice=='Y'||_41choice=='y');
- goto E;
- }
- case 7: goto A; //返回上一级
-
- }
- break;
- }
-
- case 5:
- {
- int _50choice;
- F: do{
- cout<<"请选择操作:"<<"n(1)系统功能菜单说明(2)系统访问权限说明(3)系统内存限制(4)返回上一级"<<endl;
- cin>>_50choice;
- if(_50choice!=1&&_50choice!=2&&_50choice!=3&&_50choice!=4)
- cout<<"输入错误!请从新输入!"<<endl;
- }while(_50choice!=1&&_50choice!=2&&_50choice!=3&&_50choice!=4);
- switch(_50choice)
- {
- case 1:
- showfunction(); // 系统功能菜单说明
- goto F;
- case 2:
- visitpurview(); // 系统访问权限说明
- goto F;
- case 3:
- systemmemory(); // 系统内存限制
- goto F;
- case 4:
- goto A; //返回上一级
- }
- break;
- }
-
- case 6:
- cout<<"感谢您的使用!"<<endl;
- goto AA; //返回登陆界面
- break;
-
-
- }
- }
- ////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////
- void addnewemployee(field *&firstemployee,field *&lastemployee) //增加员工信息
- {if(strcmp(mainhandle,adiminister))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- if(firstemployee==NULL)
- { ooooo=1;
- field *ptr;
- field *ptr0;
- firstemployee=new manager("gg郭靖",1,"0001","gg爱好篮球,睡觉 ","gg1989.07.21",1,"gg2007.05");
- ptr0=firstemployee;
- ptr0->setplace (2);
- ptr=new manager("gg黄蓉",0,"0002","gg和郭靖在一起","gg1989.07.21",1,"gg2007.05");
- addback(ptr0,ptr);
- ptr0->setplace (2);
- ptr=new staff("gg张三",1,"0003","gg看书,上网","gg1988.01.01",2,"gg2006.06");
- addback(ptr0,ptr);
- ptr0->setplace (1);
- ptr=new staff("gg李四",1,"0004","gg喜欢网球","gg1985.05.06",0,"gg2006.04");
- addback(ptr0,ptr);
- ptr0->setplace (0);
- lastemployee=ptr0;
- lastemployee->next =NULL;
- }
- char *a=new char[20]; //存放姓名
- int b; //存放性别
- char *c=new char[20]; // 存放编号
- char *d=new char[20]; //存放个人爱好
- char *e=new char[40]; //存放个人生日
- int f; //存放学位
- int h; //存放职位
- char *g=new char[20]; //存放进入时间
- field *ptr;
- cout<<"请输入姓名:"<<endl;
- cgets(a);
- do
- {
- cout<<"请输入性别(1代表男0代表女):"<<endl;
- cin>>b;
- if(b!=1&&b!=0)cout<<"输入错误!请重新输入!"<<endl;
- }while(b!=1&&b!=0);
- int flag00=0;
- do{ flag00=0;
- cout<<"请输入编号:"<<endl; //搜索已有链表,链表不能重复
- cgets(c);
- field *ptr=firstemployee;
- while(ptr!=NULL)
- {
- if(strcmp(ptr->getcardnumber (),c+2)==0)
- {cout<<"编号重复,请重新输入!"<<endl;
- flag00=1;
- break;
- }
- ptr=ptr->next ;
- }
- }while(flag00==1);
- cout<<"请输入个人爱好:"<<endl;
- cgets(d);
- cout<<"请输入生日:"<<endl;
- cgets(e);
- do{
- cout<<"请选择学位(0)专科(1)本科(2)硕士(3)其他:"<<endl;
- cin>>f;
- if(f!=0&&f!=1&&f!=2&&f!=3)cout<<"输入错误!请重新输入!"<<endl;
- }while(f!=0&&f!=1&&f!=2&&f!=3);
- do
- {
- cout<<"请输入职位(1为售货员0为仓库管理员 2为经理):"<<endl;
- cin>>h;
- if(h!=0&&h!=1&&h!=2)cout<<"输入错误!请重新输入!"<<endl;
- }while(h!=0&&h!=1&&h!=2);
- cout<<"请输入加入日期:"<<endl;
- cgets(g);
- if(h!=2)
- {
- ptr=new staff(a,b,c,d,e,f,g);
- ptr->setplace (h);
- addback(lastemployee,ptr);
- cout<<"增加成功!"<<endl;
- }
- else
- {
- ptr=new manager(a,b,c,d,e,f,g);
- ptr->setplace (h);
- addback(lastemployee,ptr);
- cout<<"增加成功!"<<endl;
- }
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////
- void cancelstaff(field *&firstemployee,field *&lastemployee) //删除员工信息
- {if(strcmp(mainhandle,adiminister))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- int flag00=0;
- char *a=new char[20];
- cout<<"请输入您想删除的员工的编号:"<<endl;
- cgets(a);
- if(strcmp(firstemployee->getcardnumber (),a+2)==0)
- {flag00=1;
- cout<<"您不能删除他因为他要和黄蓉在一起!"<<endl;
- }
- if(strcmp(firstemployee->next->getcardnumber(),a+2)==0)
- {flag00=1;
- cout<<"您不能删除她因为她要和郭靖在一起!"<<endl;
- }
- field *ptr=firstemployee->next->next;
- field *ptr0=firstemployee->next;
- while(ptr!=NULL)
- {
- if(strcmp(ptr->getcardnumber (),a+2)==0)
- {flag00=1;
- ptr->printfield ();
- char aa;
- cout<<"您确定要删除该名员工的信息吗?确定(Y)取消(N)"<<endl;
- cin>>aa;
- if(aa=='Y'||aa=='y')
- {
- ptr0->next=ptr->next;
- delete ptr;
- cout<<"已经成功删除!"<<endl;
- return;
- }
- else return;
-
- }
- ptr0=ptr;
- ptr=ptr->next ;
- }
- if(flag00==0)cout<<"找不到您输入的编号所对应的员工信息!"<<endl;
- return;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- void searchstaff(field *&firstemployee,field *&lastemployee ) //搜索员工信息
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- cout<<"请输入您想搜索的员工的编号:"<<endl;
- char *a=new char[20];
- cgets(a);
- field *ptr;
- int flag000=0;
- ptr=firstemployee;
- while(ptr!=NULL)
- {if(strcmp(ptr->getcardnumber(),a+2)==0)
- {flag000=1;
- cout<<setw(10)<<"姓名"<<setw(4)<<"性别"<<setw(10)<<"身份编号"<<setw(15)<<"个人爱好"<<setw(10)<<"生日"<<setw(5)<<"学位"<<setw(10)<<"加入时间"<<setw(10)<<"职位"<<endl;
- ptr->printfield();
- return;
- }
- ptr=ptr->next;
- }
- if(flag000==0)cout<<"找不到您输入的编号所对应的员工信息!"<<endl;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////////
- void chancestaff(field *&firstemployee,field *&lastemployee ) //修改员工信息
- {if(strcmp(mainhandle,adiminister))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- cout<<"请输入您想修改的员工的编号:"<<endl;
- char *a=new char[20];
- cgets(a);
- field *ptr=firstemployee;
- int flag000=0;
- while(ptr!=NULL)
- {if(strcmp(ptr->getcardnumber(),a+2)==0)
- {flag000=1;
- cout<<setiosflags(ios::left)<<setw(8)<<"姓名"<<setw(5)<<"性别";
- cout<<setw(10)<<"身份编号"<<setw(15)<<"个人爱好"<<setw(10)<<"生日"<<setw(5)<<"学位"<<setw(10)<<"加入时间"<<setw(10)<<"职位"<<endl;
- ptr->printfield();
- break;
- }
- ptr=ptr->next;
- }
- if(flag000==0)
- {cout<<"找不到您输入的编号所对应的员工信息!"<<endl;
- return;}
- if(flag000==1)
- { int choice_0;
- do{
- cout<<"请选择您想要修改的信息:"<<"n(1)姓名(2)性别(3)编号(4)个人爱好(5)生日n(6)学位(7)职位(8)修改密码(9)取回密码(10)返回上一级"<<endl;
- cin>>choice_0;
- if(choice_0!=1&&choice_0!=1&&choice_0!=2&&choice_0!=3&&choice_0!=4&&choice_0!=5&&choice_0!=6&&choice_0!=7&&choice_0!=8&&choice_0!=9&&choice_0!=10)
- cout<<"输入错误!请重新输入!"<<endl;
- }while(choice_0!=1&&choice_0!=1&&choice_0!=2&&choice_0!=3&&choice_0!=4&&choice_0!=5&&choice_0!=6&&choice_0!=7&&choice_0!=8&&choice_0!=9&&choice_0!=10);
- switch(choice_0)
- {
- case 1:
- {char *aa=new char[25]; //修改姓名
- cout<<"请输入新名字"<<endl;
- cgets(aa);
- ptr->setname (aa);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 2: //修改性别
- { int bb;
- do
- {
- cout<<"请输入性别(1代表男0代表女):";
- cin>>bb;
- if(bb!=1&&bb!=0)cout<<"输入错误!请重新输入!"<<endl;
- }while(bb!=1&&bb!=0);
- ptr->setsex (bb);
- cout<<"修改成功!"<<endl;
- break;
- }
-
- case 3: //修改编号
- { char *cc=new char[20];
- int flag00=0;
- do{
- cout<<"请输入编号:"; //搜索已有链表,链表不能重复
- cgets(cc);
- field *ptr0=firstemployee;
- while(ptr0!=NULL)
- {
- if(strcmp(ptr0->getcardnumber (),cc+2)==0)
- {cout<<"编号重复!请重新输入!"<<endl;
- flag00=1;
- break;
- }
- ptr0=ptr0->next ;
- }
- }while(flag00==1);
- ptr->setcardnumber (cc);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 4: // 修改爱好
- {char *dd=new char[70];
- cout<<"请输入新的个人爱好:";
- cgets(dd);
- ptr->setindividuallike (dd);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 5: //修改生日
- {char *ee=new char[18];
- cout<<"请输入新的生日:";
- cgets(ee);
- ptr->setbirthday (ee);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 6: //修改学位
- {int ff;
- do{
- cout<<"请输入您的选择(0)专科(1)本科(2)硕士(3)其他:";
- cin>>ff;
- if(ff!=0&&ff!=1&&ff!=2&&ff!=3)
- cout<<"输入错误!请重新输入!"<<endl;
- }while(ff!=0&&ff!=1&&ff!=2&&ff!=3);
- ptr->setdegree (ff);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 7: //修改职位
- {int hh;
- do{
- cout<<"请输入您的选择(1)售货员(0)仓库管理员(2)经理:";
- cin>>hh;
- if(hh!=0&&hh!=1&&hh!=2)
- cout<<"输入错误!请重新输入!"<<endl;
- }while(hh!=0&&hh!=1&&hh!=2);
- ptr->setplace (hh);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 8: //修改密码
- {char *ii=new char[20];
- int iii=0;
- do{ iii++;
- if(iii>3)
- {cout<<"输入错误密码三次!必须结束操作!"<<endl;
- return;
- }
- cout<<"请输入您原来的密码:"<<endl;
- cgets(ii);
- if(strcmp(ii+2,ptr->getpassword ())!=0)
- cout<<"您输入的密码不正确!"<<endl;
- }while(strcmp(ii+2,ptr->getpassword ())!=0);
- cout<<"请输入您的新密码!"<<endl;
- char *iiii=new char[20];
- cgets(iiii);
- ptr->setpassword (iiii);
- cout<<"操作结束!"<<endl;
- break;
- }
- case 9: //取回密码
- {
- cout<<"您的密码是:"<<endl;
- cout<<ptr->getpassword()<<endl;
- break;
- }
- case 10:
- return;
- }
- return;
- }
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void scanstaff(field *&firstemployee) //浏览员工信息
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- field *ptr=firstemployee;
- cout<<" 所有的员工的信息如下 "<<endl;
- cout<<setiosflags(ios::left)<<setw(8)<<"姓名"<<setw(5)<<"性别";
- cout<<setw(10)<<"身份编号"<<setw(15)<<"个人爱好"<<setw(10)<<"生日"<<setw(5)<<"学位"<<setw(10)<<"加入时间"<<setw(10)<<"职位"<<endl;
- while(ptr!=NULL)
- {
- ptr->printfield ();
- ptr=ptr->next ;
- }
- cout<<"输出结束!"<<endl;
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- void addnewgoods(ware *&firstgoods,ware *&lastgoods) //增加新进商品并生成进货单
- {
-
-
- char *a=new char[20]; //存放名称
- int b=0; //存放数量
- char *c=new char[20]; //存放编号
- char *d=new char[20]; //存放厂家信息
- char *e=new char[20]; //存放商品信息
- char *f=new char[20]; //存放时间
- char *g=new char[20]; //存放商品类别
- float h; //存放价格
- float nn; //存放售货参考价
- ware *ptr;
- cout<<" 请填写进货单信息!"<<endl;
- cout<<"请输入商品名称:"<<endl;
- cgets(a);
- cout<<"请输入商品数量:"<<endl;
- cin>>b;
- int ff;
- do{
- cout<<"请输入商品编号:"<<endl; //搜索已有链表,编号不能重复
- cgets(c);
- ff=0;
- ware *check=firstgoods;
- while(check!=NULL)
- {if(strcmp(check->getnumber (),c+2)==0)
- {cout<<"编号重复!请重新输入!"<<endl;
- ff=1;
- break;}
- check=check->next ;
- }
- }while(ff==1);
- cout<<"请输入厂家信息:"<<endl;
- cgets(d);
- cout<<"请输入商品信息:"<<endl;
- cgets(e);
- cout<<"请输入进货时间:"<<endl;
- cgets(f);
- cout<<"请输入商品类别:"<<endl;
- cgets(g);
- cout<<"请输入商品进货价格:"<<endl;
- cin>>h;
- cout<<"请输入商品参考销售价格:"<<endl;
- cin>>nn;
- ptr=new stocklist(a,b,c,d,e,f,g,"进货单"); //完善登陆系统后这里应该有一个操作者的身份ID
- ptr->sethandle (mainhandle); ///////////////////////////////////这里加入id
- ptr->setprice (h);
- ptr->setconsultprice (nn);
- if(firstgoods==NULL)
- {firstgoods=ptr;
- lastgoods=firstgoods;
- lastgoods->next =NULL;
- }
- else addback(lastgoods,ptr);
- cout<<"增加成功!"<<endl;
- cout<<" 进货单 "<<endl;
- cout<<"名称"<<ptr->getwarename ()<<endl;
- cout<<"类别"<<ptr->getsortname()<<endl;
- cout<<"编号"<<ptr->getnumber ()<<endl;
- cout<<"价格"<<ptr->getprice()<<endl;
- cout<<"参考销售价"<<ptr->getconsultprice()<<endl;
- cout<<"数量"<<ptr->getamount ()<<endl;
- cout<<"厂家信息"<<ptr->getmanfacturer ()<<endl;
- cout<<"商品描述"<<ptr->getdescribe ()<<endl;
- cout<<"时间"<<ptr->getdate ()<<endl;
- cout<<"经手人"<<ptr->gethandle ()<<endl;
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- void cancelappointgoods(ware *&firstgoods,ware *&lastgoods) //删除指定商品
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- ware *ptr;
- ware *ptr0;
- char *a=new char[20];
- int flag=0;
- ptr=firstgoods;
- ptr0=ptr;
- cout<<"请输入您想删除的商品的编号:"<<endl;
- cgets(a);
- while(ptr!=NULL)
- {
- if(strcmp(a+2,ptr->getnumber())==0)
- {
- flag=1;
- if(ptr==firstgoods)
- {
- firstgoods=ptr->next;
- delete ptr;
- cout<<" 删除成功!"<<endl;
- break;
- }
- if(ptr==lastgoods)
- {
- ptr0->next=NULL;
- delete ptr;
- cout<<"删除成功!"<<endl;
- break;
- }
- ptr0->next=ptr->next;
- delete ptr;
- cout<<" 删除成功!"<<endl;
- break;
-
- }
- ptr0=ptr;
- ptr=ptr->next;
-
- }
- if(flag==0)cout<<"您输入的编号不存在!"<<endl;
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////////////
- void searchappointgoods(ware *&firstgoods) //搜索指定商品
- {
- ware *ptr;
- char *a=new char[20];
- int flag=0;
- ptr=firstgoods;
- cout<<"请输入您想搜索的商品的编号:"<<endl;
- cgets(a);
- while(ptr!=NULL)
- {
- if(strcmp(a+2,ptr->getnumber ())==0)
- {
- flag=1;
- cout<<"在仓库中为您找到如下商品信息!"<<endl;
- cout<<setiosflags(ios::left)<<setw(8)<<"名称"<<setw(6)<<"类别"<<setw(6)<<"编号"<<setw(7)<<"进货价"<<setw(10)<<"参考售价"<<setw(6)<<"数量"<<setw(12)<<"厂家信息"<<setw(12)<<"商品描述"<<setw(6)<<"时间"<<setw(8)<<"经手人"<<endl;
- cout<<setiosflags(ios::left)<<setw(8)<<ptr->getwarename ()<<setw(6)<<ptr->getsortname()<<setw(6)<<ptr->getnumber ()<<setw(7)<<ptr->getprice()<<setw(10)<<ptr->getconsultprice()<<setw(6)<<ptr->getamount ()<<setw(12)<<ptr->getmanfacturer ()<<setw(12)<<ptr->getdescribe ()<<setw(6)<<ptr->getdate ()<<setw(8)<<ptr->gethandle ();
- break;
- }
- ptr=ptr->next ;
- }
- if(flag==0)cout<<" 您要搜索的商品不存在!"<<endl;
- }
- //////////////////////////////////////////////////////////////////////////////////////////
- void chanceappintgoods(ware *&firstgoods) //修改指定商品
- {
- ware *ptr;
- int flag=0;
- char *a=new char[20];
- ptr=firstgoods;
- cout<<"请输入您想修改的商品的编号:"<<endl;
- cgets(a);
- while(ptr!=NULL)
- {
- if(strcmp(a+2,ptr->getnumber ())==0)
- {
- flag=1;
- cout<<"在仓库中为您找到如下商品信息!"<<endl;
- cout<<setiosflags(ios::left)<<setw(8)<<"名称"<<setw(6)<<"类别"<<setw(6)<<"编号"<<setw(6)<<"价格"<<setw(10)<<"参考售格"<<setw(6)<<"数量"<<setw(12)<<"厂家信息"<<setw(12)<<"商品描述"<<setw(6)<<"时间"<<setw(8)<<"经手人"<<endl;
- cout<<setiosflags(ios::left)<<setw(8)<<ptr->getwarename ()<<setw(8)<<ptr->getsortname()<<setw(6)<<ptr->getnumber ()<<setw(6)<<ptr->getprice()<<setw(10)<<ptr->getconsultprice()<<setw(6)<<ptr->getamount ()<<setw(12)<<ptr->getmanfacturer ()<<setw(12)<<ptr->getdescribe ()<<setw(6)<<ptr->getdate ()<<setw(8)<<ptr->gethandle ()<<endl;
- break;
- }
- ptr=ptr->next ;
-
- }
-
- if(flag==0)
- {
- cout<<"您想修改的商品的编号不存在!"<<endl;
- return;
- }
- if(flag==1)
- { int choice_00;
-
- cout<<"请选择您想要修改的信息:n(1)名称(2)类别(3)编号(4)参考售货价价格(5)数量n(6)厂家信息(7)商品描述(8)进货时间(9)返回上一级"<<endl;
- cin>>choice_00;
- if(choice_00!=1&&choice_00!=1&&choice_00!=2&&choice_00!=3&&choice_00!=4&&choice_00!=5&&choice_00!=6&&choice_00!=7&&choice_00!=8&&choice_00!=9)
- { cout<<"输入错误!"<<endl;
- return;
- }
-
- switch(choice_00)
- {
- case 1:
- {char *aa=new char[23]; //修改姓名
- cout<<"请输入新的姓名:"<<endl;
- cgets(aa);
- ptr->setwarename (aa);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 2: //修改类别
- {char *gg=new char[20];
- cout<<"请输入新的类别:"<<endl;
- cgets(gg);
- ptr->setsortname (gg);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 3:
- { /////////////////////// 这段是修改编号
- char *cc=new char[20];
- int flag00=0;
- do{
- cout<<"请输入编号:"<<endl; //搜索已有链表,链表不能重复
- cgets(cc);
- ware *ptr0=firstgoods;
- while(ptr0!=NULL)
- {
- if(strcmp(ptr0->getnumber (),cc+2)==0)
- {cout<<"编号重复!请重新输入!"<<endl;
- flag00=1;
- break;
- } ////这里改变编号时不能重复,先搜索不重复后才允许重设
- ptr0=ptr0->next ;
- }
- }while(flag00==1);
- ptr->setnumber (cc);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 4:
- { float mm; //修改价格
- cout<<"请输入新价格:"<<endl;
- cin>>mm;
- ptr->setconsultprice (mm);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 5:
- { int bb; //修改数量
- cout<<"请输入新的数量:"<<endl;
- cin>>bb;
- ptr->setamount (bb);
- cout<<"修改成功!"<<endl;
- break;}
- case 6:
- {char *dd=new char[50]; //重设厂家信息
- cout<<"请输入新的厂家信息:"<<endl;
- cgets(dd);
- ptr->setmanufacturer (dd);
- cout<<"修改成功!"<<endl;
- break;}
- case 7:
- {char *ee=new char[50]; //重设商品信息
- cout<<"请输入新的商品信息:"<<endl;
- cgets(ee);
- ptr->setdescribe (ee);
- cout<<"修改成功!"<<endl;
- break;
- }
- case 8:
- {char *ff=new char[20]; //重设时间
- cout<<"请输入新的时间:"<<endl;
- cgets(ff);
- ptr->setdate (ff);
- cout<<"修改成功!"<<endl;
- break;}
- case 9:
- return;
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////////////////////////
- void scanallgoods(ware *&firstgoods) //浏览所有商品
- {cout<<"所有商品信息如下:"<<endl;
- cout<<setiosflags(ios::left)<<setw(8)<<"名称"<<setw(6)<<"类别"<<setw(6)<<"编号"<<setw(10)<<"参考售价"<<setw(6)<<"数量"<<setw(12)<<"厂家信息"<<setw(12)<<"商品描述"<<setw(6)<<"时间"<<setw(8)<<"经手人"<<endl;
- ware *ptr=firstgoods;
- if(ptr==NULL)
- {cout<<"目前为空!"<<endl;
- return;
- }
- while(ptr!=NULL)
- {cout<<setiosflags(ios::left)<<setw(8)<<ptr->getwarename ()<<setw(6)<<ptr->getsortname()<<setw(6)<<ptr->getnumber ()<<setw(10)<<ptr->getconsultprice()<<setw(6)<<ptr->getamount ()<<setw(12)<<ptr->getmanfacturer ()<<setw(12)<<ptr->getdescribe ()<<setw(6)<<ptr->getdate ()<<setw(8)<<ptr->gethandle ()<<endl;
- ptr=ptr->next ;
- }
- cout<<"输出完毕!"<<endl;
- }
- //////////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////////////////////
- //售出指定商品并生成售货单
- void sellappointgoods(ware *&firstgoods,ware *&sellfirstgoods,ware *&selllastgoods)
- {
- char *mmm=new char[30];
- int nn;
- int flag0000=0;
- cout<<"请输入您想出售的商品的编号:"<<endl;
- cgets(mmm);
- ware *ptr;
- ptr=firstgoods;
- while(ptr!=NULL)
- {if(strcmp(mmm+2,ptr->getnumber ())==0)
- { flag0000=1;
- cout<<"请输入售出数量:"<<endl;
- cin>>nn;
- ptr->setamount (ptr->getamount ()-nn);
- if(sellfirstgoods==NULL)
- {sellfirstgoods=new sellgoodslist(ptr->getwarename ()-2,nn,ptr->getnumber ()-2,ptr->getmanfacturer ()-2,ptr->getdescribe ()-2,ptr->getdate (),ptr->getsortname ()-2,"售货单");
- sellfirstgoods->sethandle (mainhandle);
- sellfirstgoods->setprice (ptr->getconsultprice ());
- sellfirstgoods->setamount (nn);
- sellfirstgoods->next =NULL;
- selllastgoods=sellfirstgoods;
-
- }
- else{
- ware *ptr0;
- ptr0=new sellgoodslist(ptr->getwarename ()-2,nn,ptr->getnumber ()-2,ptr->getmanfacturer ()-2,ptr->getdescribe ()-2,ptr->getdate ()-2,ptr->getsortname ()-2,"售货单");
- ptr0->sethandle (mainhandle);
- ptr0->setprice (ptr->getconsultprice ());
- ptr0->setamount (nn);
- addback(selllastgoods,ptr0);
- }
- cout<<" 售货单 "<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<"商品名称"<<setw(10)<<"商品编号"<<setw(10)<<"商品数量"<<setw(10)<<"商品单价"<<setw(10)<<"总金额"<<setw(10)<<"经手人"<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<selllastgoods->getwarename ()<<setw(10)<<selllastgoods->getnumber ()<<setw(10)<<selllastgoods->getamount ()<<setw(10)<<selllastgoods->getprice ()<<setw(10)<<((selllastgoods->getamount()) *(selllastgoods->getprice ()))<<setw(10)<<selllastgoods->gethandle ()<<endl;
- return;
- }
- ptr=ptr->next ;
- }
- if(flag0000==0)cout<<"找不到您所输入的编号所对应的商品!"<<endl;
- return;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- void sellgoodstaxis(ware *&sellfirstgoods) //售出商品排行
- {ware *ptr=sellfirstgoods;
- cout<<" 售出商品排行 "<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<"商品名称"<<setw(10)<<"商品编号"<<setw(10)<<"商品数量"<<setw(10)<<"商品单价"<<setw(10)<<"总金额"<<setw(10)<<"经手人"<<endl;
- if(ptr==NULL)
- {cout<<"目前表为空!"<<endl;
- return;
- }
- while(ptr!=NULL)
- { cout<<setiosflags(ios::left)<<setw(10)<<ptr->getwarename ()<<setw(10)<<ptr->getnumber ()<<setw(10)<<ptr->getamount ()<<setw(10)<<ptr->getprice()<<setw(10)<<((ptr->getamount()) *(ptr->getprice ()))<<setw(10)<<ptr->gethandle ()<<endl;
- ptr=ptr->next ;
- }
- cout<<"输出完毕!"<<endl;
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////
- void ownreportcard(ware *&sellfirstgoods) //生成个人销售业绩表
- {ware *ptr=sellfirstgoods;
- if(ptr==NULL)
- {cout<<"列表为空!"<<endl;
- return;
- }
- int flag00=0;
- cout<<setiosflags(ios::left)<<setw(10)<<"商品名称"<<setw(10)<<"商品编号"<<setw(10)<<"商品数量"<<setw(10)<<"商品单价"<<setw(10)<<"总金额"<<setw(10)<<"经手人"<<endl;
- while(ptr!=NULL)
- {if(strcmp(ptr->gethandle (),mainhandle)==0)
- {flag00=1;
- cout<<setiosflags(ios::left)<<setw(10)<<ptr->getwarename ()<<setw(10)<<ptr->getnumber ()<<setw(10)<<ptr->getamount ()<<setw(10)<<ptr->getprice()<<setw(10)<<((ptr->getamount()) *(ptr->getprice ()))<<setw(10)<<ptr->gethandle ()<<endl;
- ptr=ptr->next ;
- }
- if(flag00==0)cout<<"目前记录为空!"<<endl;
- }
- }
- //////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- void showfunction() // 系统功能菜单说明
- {
- cout<<"首先很感谢您的使用.下面是这个商店系统的功能菜单说明:"<<endl;
- cout<<"系统有六大功能模块:";
- cout<<"员工管理模块:实现了五个功能(增加员工信息,删除员工信息,搜索";
- cout<<" 员工信息,修改员工信息,浏览员工信息)"<<endl;
- cout<<" 其中增加员工信息需要填写员工的姓名,性别,身份编号(每个人都有独一"<<endl;
- cout<<" 无二的编号不能重复,如有重复会有提示)个人爱好,生日,学位,加入时"<<endl;
- cout<<" 间和选择职位.第一次增加员工后在列表的前面会加入默认的四位员工信息."<<endl;
- cout<<" 删除员工信息需要输入员工的编号,其中系统默认的前面两位经理不能删除."<<endl;
- cout<<" 搜索员工信息需要输入员工的编号."<<endl;
- cout<<" 修改员工信息需要输入员工的编号,并且可以选择需要修改的项目进行修改.";
- cout<<" 浏览员工的信息将输出列表中的所有信息."<<endl;
- cout<<"仓库管理模块:实现了五个功能(增加新进商品并生成进货单,删除指定商品,搜索指定商 ";
- cout<<" 品,修改指定商品,浏览所有的商品信息."<<endl;
- cout<<" 其中增加商品需要填写商品名称,类别,编号(独一无二),进货价,参考 ";
- cout<<" 售货价,进货数量,商品信息,厂家信息和进货时间,经手人系统会添加."<<endl;
- cout<<" 删除指定商品需要输入商品的编号"<<endl;
- cout<<" 搜索指定商品需要输入商品的编号"<<endl;
- cout<<" 修改指定商品需要输入商品的编号,并且可以选择需要修改的项目进行修改.";
- cout<<" 浏览所有的商品会输出所有的商品信息."<<endl;
- cout<<"销售管理模块:实现了四个功能(售出指定商品并生成售货单,搜索指定商品,售出商品排 ";
- cout<<" 行,生成个人销售业绩表)"<<endl;
- cout<<" 其中售出指定商品并且生成售货单需要输入商品编号和出售数量,系统将会 ";
- cout<<" 输出售货单和添加经手人"<<endl;
- cout<<" 搜索指定商品需要输入商品的编号"<<endl;
- cout<<" 售出商品排行是最近售出的商品的列表."<<endl;
- cout<<" 生成个人销售列表将列出登陆者为经手人的销售记录."<<endl;
- cout<<"财务管理模块:实现了六个功能(仓库商品总值,目前现金收入,商品盈利报告,员工薪水 ";
- cout<<" 浏览,公司收支状况,修改薪水标准)"<<endl;
- cout<<" 这些功能都可以顾名思义,就不用介绍了."<<endl;
- cout<<"帮助文档模块:包括(系统功能菜单说明,系统访问权限说明,系统内存限制)"<<endl;
- cout<<"注销用户模块:登出目前用户,重新登陆.员工登陆密码初始为身份编号,取回密码可在修改 ";
- cout<<" 员工信息一项取回。系统管理员遗忘密码可通过回答密码问题取回 "<<endl;
- cout<<endl;
- }
- void visitpurview() // 系统访问权限说明
- {cout<<"系统的操作权限有三种级别:系统管理员,经理,普通员工."<<endl;
- cout<<"系统管理员:拥有本系统最高的操作权限,可以进行任何操作"<<endl;
- cout<<"经理:除了增加员工信息,修改员工信息,删除员工信息这三项操作外,其他都是允许的"<<endl;
- cout<<"普通员工:不能操作员工管理模块和财务管理模块。"<<endl;
- cout<<endl;
- }
- void systemmemory() // 系统内存限制
- {cout<<"由于篇幅所限,这里就不赘述了,总之在输入员工信息和商品信息时不宜过长!n"<<endl;}
- /////////////////////////////////////////////////////////////////////////
- void allgoodsworth(ware *&firstgoods) //仓库商品总值
- {
- if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- ware *ptr=firstgoods;
- double total=0;
- cout<<setiosflags(ios::left)<<setw(10)<<"商品名称"<<setw(10)<<"库存量"<<setw(10)<<"参考售价"<<setw(10)<<"金额"<<endl;
- while(ptr!=NULL)
- {
- cout<<setiosflags(ios::left)<<setw(10)<<ptr->getwarename ()<<setw(10)<<ptr->getamount ()<<setw(10)<<ptr->getconsultprice ()<<setw(10)<<((ptr->getamount ())*(ptr->getconsultprice ()))<<endl;
- total+=(ptr->getamount ()*ptr->getconsultprice ());
- ptr=ptr->next ;
- }
- cout<<"总金额:"<<" "<<total;
- cout<<"输出完毕!"<<endl;
-
- }
- //////////////////////////////////////////////////////////////////////////////////////////////
- void nowcashearning(ware *&sellfirstgoods) //目前现金收入
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- float total=0;
- ware *ptr=sellfirstgoods;
- cout<<setiosflags(ios::left)<<setw(10)<<"商品名称"<<setw(10)<<"出售量"<<setw(10)<<"售价"<<setw(10)<<"金额"<<endl;
- while(ptr!=NULL)
- {cout<<setiosflags(ios::left)<<setw(10)<<ptr->getwarename ()<<setw(10)<<ptr->getamount ()<<setw(10)<<ptr->getprice ()<<setw(10)<<((ptr->getamount ())*(ptr->getprice ()))<<endl;
- total+=(ptr->getamount ()*ptr->getprice ());
- ptr=ptr->next ;
- }
- cout<<"总金额:"<<" "<<total<<endl;
- cout<<"输出完毕!"<<endl;
- }
- /////////////////////////////////////////////////////////////////////////
- void payoffreport(ware *&firstgoods) //商品盈利报告
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- ware *ptr=firstgoods;
- cout<<"仓库里有如下商品,预计盈利如下:"<<endl;
- cout<<setiosflags(ios::left)<<setw(10)<<"商品名称"<<setw(10)<<"进货价"<<setw(14)<<"参考售价"<<setw(14)<<"预计盈利值"<<endl;
- while(ptr!=NULL)
- {
- cout<<setiosflags(ios::left)<<setw(10)<<ptr->getwarename ();
- cout<<setw(10)<<ptr->getprice ()<<setw(14)<<ptr->getconsultprice ();
-
- cout<<setw(14)<<((ptr->getconsultprice ())-(ptr->getprice ()))<<endl;
- ptr=ptr->next ;
- }
- cout<<"输出完毕!如需修改价格请进入“仓库管理”!"<<endl;
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////
- void scanstaffsalary(ware *firstgoods,ware *sellfirstgoods,field *firstemployee)
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl; //员工薪水浏览
- return;
- }
- field *ptr=firstemployee;
- while(ptr!=NULL)
- {ptr->printpayslip(firstgoods,sellfirstgoods);
- ptr=ptr->next ;
- }
- cout<<"输出完毕!"<<endl;
- }
- //////////////////////////////////////////////////////////////////////////////////////
- void shopfare(ware *&firstgoods,ware *&sellfirstgoods) //公司收支状况
- {if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- ware *ptr=firstgoods;
- float total1=0;
- while(ptr!=NULL)
- { total1+=(ptr->getamount ()*ptr->getprice ());
- ptr=ptr->next ;
- }
- cout<<"公司为库存商品支出:"<<total1;
- ware *ptr000=sellfirstgoods;
- float total2=0;
- while(ptr000!=NULL)
- {total2+=(ptr000->getprice ()*ptr000->getamount ());
- ptr000=ptr000->next ;
- }
- cout<<"n公司售出商品总值:"<<total2;
- cout<<"输出完毕!"<<endl;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////
- void chancesalarystandard(field *firstemployee)//修改薪水标准
- {if(ooooo==0)
- { cout<<"目前员工列表为空!请您先增加员工"<<endl;
- return;
- }
- if((strcmp(mainhandle,adiminister))&&(strcmp(mainhandle,"郭靖"))&&(strcmp(mainhandle,"黄蓉")))
- {cout<<"对不起您没有此项操作的权限!"<<endl;
- return;
- }
- float jj=0;
- cout<<"原来的员工奖金比例:"<<firstemployee->next ->next->getscale1 ()<<endl;
- cout<<"请输入新的员工奖金比例:";
- cin>>jj;
- firstemployee->next ->next ->setscale (jj);
- cout<<"原来的经理奖金比例:"<<firstemployee->getscale1 () <<endl;
- float kk=0;
- cout<<"请输入新经理奖金比例:";
- cin>>kk;
- firstemployee->setscale (kk);
- cout<<"修改成功!"<<endl;
- }
- ///////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////
- //mylanding
- void landing(char *&mainhandle,field *&firstemployee,int &flag0)
- {
- string answer;
- int choice;
- char mima1[10]={' '};
- char mima2[10]={' '};
- if(flag0==0)
- {
- flag0=1;
- cout<<"欢迎光临商店管理系统!"<<endl;
- cout<<"您是第一个使用本系统的人,请先创建系统管理员。系统管理员将拥有本系统最高的权限,可以进行任何操作!"<<endl;
- cout<<"请输入您的帐户名:"<<endl;
- cin>>adiminister;
- do
- {
- cout<<"请输入您的十位密码:"<<endl;
- for(int i=0;i<10;i++ )
- {
- mima1[i]=getch();
- putch('*');
- }
- cout<<endl;
- cout<<"请再次输入您的十位密码:"<<endl;
- for(int j=0;j<10;j++)
- {
- mima2[j]=getch();
- putch('*');
- }
- cout<<endl;
- if(*mima1!=*mima2)cout<<"输入的密码不一致!请从新输入!"<<endl;
- }while(*mima1!=*mima2);
- for(int k=0;k<10;k++)password[k]=mima1[k];
- do
- {
- cout<<"为了保护您的密码安全,请选择问题:"<<"n(1)你的真实姓名(2)您就读的学校(3)您最喜欢的食物是"<<endl;
- cin>>choice;
- if(choice!=1&&choice!=2&&choice!=3)cout<<"输入错误!,请从新输入!"<<endl;
- }while(choice!=1&&choice!=2&&choice!=3);
- cout<<"请输入您问题的答案!"<<endl;
- cin>>youranswer;
- answer.assign (youranswer);
- //cputs(password);///为什么会出现乱码????
- cout<<"创建成功!"<<endl;
- cout<<"您的帐户名是:"<<adiminister<<endl;
- cout<<"您的密码是:";
- for(k=0;k<10;k++)cout<<password[k];
- cout<<"n您的问题的答案是:"<<youranswer;
- cout<<endl;
- mainhandle=new char[strlen(adiminister)+1];
- strcpy(mainhandle,adiminister);
- cout<<"由于您是第一次使用本系统,强烈建议您先浏览帮助信息 "<<endl;
- }
- else
- {
-
- G: cout<<"请输入您的登陆名:"<<endl;
- char checkname[20]={' '};
- char checkpassword[11]={' '};
-
- cin>>checkname;
- if(strcmp(adiminister,checkname)==0)
- {
- cout<<"您是系统管理员,请输入您的密码:"<<endl;
- for(int j=0;j<10;j++)
- {
- checkpassword[j]=getch();
- putch('*');
- }
- cout<<endl;
- if(strcmp(checkpassword,password)!=0)
- { char get;
- cout<<"密码错误!"<<endl;
- cout<<"忘记密码 ?取回系统管理员密码请输入q!"<<endl;
- cin>>get;
- if(get=='q'||get=='Q')
- {char yourcheckanswer[20]={' '};
-
- cout<<"请输入您所选择的问题的答案:";
- cin>>yourcheckanswer;
- if(strcmp(youranswer,yourcheckanswer)==0)
- { cout<<"n您的密码是:";
- for(int k=0;k<10;k++)cout<<password[k];
- cout<<endl;
- }
- else cout<<"对不起,答案错误!"<<endl;
- }
- goto G;
- }
- mainhandle=new char[strlen(adiminister)+1];
- strcpy(mainhandle,adiminister);
- cout<<"登陆成功!"<<endl;
- return;
- }
- else{
- field *ptr;
- ptr=firstemployee;
- int checknumber=0;
- while(ptr!=NULL)
- {
- if(strcmp(ptr->getname (),checkname)==0)
- {
- cout<<"请输入您的密码:"<<endl;
- for(int j=0;j<strlen(ptr->getpassword ());j++)
- {
- checkpassword[j]=getch();
- putch('*');
- }
- cout<<endl;
- if(strcmp(checkpassword,ptr->getpassword())!=0)
- {
- cout<<"密码错误!"<<endl;
- goto G;
- }
- mainhandle=new char[strlen(ptr->getname ())+1];
- strcpy(mainhandle,ptr->getname ());
- cout<<"登陆成功!"<<endl;
- checknumber=1;
- return;
- }
- ptr=ptr->next ;
- }
- if(checknumber==0)
- {cout<<"登陆名不存在!"<<endl;
- goto G;
- }
- }
-
- }
-
- }
- /////////////////////////////////////////////////////
- //myrun.cpp
- void run()
- {
- time_t t;
- t=time(0);
- cout<<"*******************************************************************************"<<endl;
- cout<<"* *"<<endl;
- cout<<"* *"<<endl;
- cout<<"* 这是小型商店管理系统 *"<<endl;
- cout<<"* 可以对职工和货物进行管理 *"<<endl;
- cout<<"* 欢迎使用该小型商店管理系统 *"<<endl;
- cout<<"* *"<<endl;
- cout<<"* *"<<endl;
- cout<<"* *"<<endl;
- cout<<"*作者:郭世清 *"<<endl;
- cout<<"*您登陆的时间:"<<ctime(&t);
- cout<<"*******************************************************************************"<<endl;
-
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////