财务报销管理系统c++实现

花了一个星期左右写了一个财务报销管理系统,进行简单介绍,代码仓库地址:可以git clone,或者打包下载它

GitHub - determination66/Financial-reimbursement-management-system: 财务报销管理系统C++k财务报销管理系统C++. Contribute to determination66/Financial-reimbursement-management-system development by creating an account on GitHub.https://github.com/determination66/Financial-reimbursement-management-system

目录

头文件

admin.h

allfiles.h

aqt.h

identify

managesystem.h

myvector.h

person.h

progress.h

staff.h

源文件

admin.cpp

aqt.cpp

main.cpp

managesystem.cpp

myvector.cpp

person.cpp


实现对密码本中的数据进行验证登录,

 可以进行查询,修改今昔个人信息等等一系列操作,就不赘述了

 对此可以进行操作!等等主要思路就抽象各个类,建立界面用if else if或者switch建立接口调用,逐步封装,并对类的成员函数进行扩展,本存储方式使用stl中的动态数组vector,方便计算和插入数据等操作,并对文件进行交互,最终达成在系统中的操作,在文件中可以被修改,并且可在系统中查询已被修改等等操作。


头文件

admin.h

#pragma once
#include<iostream>
#include<string>
using namespace std;
#include"identify.h"
#include"allfiles.h"
#include"managesystem.h"
#include"progress.h"
#include"aqt.h"

class Admin:public Identify
{
public:

	Admin();

	Admin(string id, string password);

	//抽象函数,操作菜单
	void OperMenu();

    //添加账号
	void AddPerson();

	//查询管理员信息
	void ShowAdminInfo();

	//查询报销人员信息
	void ShowPersonInfo();

	//查询审批人员信息
	void ShowStaffInfo();

	//展示查询信息1的分界面
	void Oper1Menu();

	//展示删除信息3的分页面
	void Oper4Menu();

	//删除人员信息
	void DeletePerson(int type);
};

allfiles.h

#pragma once

//管理员登录密码文件
#define ADMIN_FILE   "管理员信息.txt"

//报销人员信息文件
#define PERSON_FILE  "报销人员信息.txt"

//审批人员信息文件
#define STAFF_FILE   "审批人员信息.txt"

//报销人员进度信息
#define PERSONINFO   "报销人员进度信息.txt"

//审批人额度授权表
#define STAFFAUIN    "审批人额度授权表.txt"

aqt.h

#pragma once
#include<iostream>
#include<vector>
#include<string>
using namespace std;
#include<algorithm>
#include<fstream>
#include"allfiles.h"
#include"aqt.h"

class ArlTable
{
public:
	ArlTable();//构造函数

	int m_key;//编号

	string m_Role;//角色

	int m_Money;//额度

	string m_Num;//工号,用于判断是哪个审批人员

	 //审批人授权额度表
	vector<ArlTable>vAT;

	void InitVAT();//授权额度表

	void ShowInfo();//展示信息

	int GetVATSize();//获取容器的大小

	int GetVATnum();//获取创建时编号信息

	void SaveVAT(vector<ArlTable>p);//存储保存信息

	void AddVAT(string role,int money,string num);//增加授权表信息
};

identify

#pragma once
#include<iostream>
using namespace std;
#include <string>

class Identify
{
public:
	//每个类的抽象函数,操作菜单
	virtual void OperMenu() = 0;

	string m_Id;//用户名

	string m_Password;//密码
};

managesystem.h

#pragma once
#include<iostream>
using namespace std;
#include<string>
#include"allfiles.h"//交互文件
#include"identify.h"//身份类头文件
#include"person.h"//报销人员
#include"staff.h"//工作人员
#include"admin.h"//管理员
#include<fstream>//交互文件



class ManageSystem
{
public:
	ManageSystem();

	//显示主菜单
	void ShowMainMenu();

	//登录界面
	void Login(int type);

	//分页面用于用户选择是否有账号
	void MSOperMenu(int num);
	
	//创建一个账号
	void Create(int num);

};

myvector.h

#pragma once
#include<iostream>
using namespace std;
#include<vector>
#include"allfiles.h"
#include<fstream>
#include"identify.h"
#include"admin.h"
#include"person.h"
#include"staff.h"

class MyVector
{
public:
	//报销人员信息容器
    vector<Person>vPer;

    //工作人员信息容器
    vector<Staff>vSta;

    //管理员信息容器
     vector<Admin>vAdm;

     //初始化容器
     void InitVPer();//报销人员

     void InitVSta();//审批人员

     void InitVAdm();//管理员

     bool IsRepeat(string username, int type);//判断重复与否

     void SaveVPer(vector<Person>p);//存储报销人员信息

     void SaveVSta(vector<Staff>p);//存储审批人员信息

     void SaveVAdm(vector<Admin>p);//存储管理员信息

     int GetRNum();//创建授权信息是获取编号

     void Showid(int type);//展示已有工号
};

person.h

#pragma once
using namespace std;
#include<iostream>
#include<string>
#include"identify.h"
#include"progress.h"
#include"managesystem.h"
#include"aqt.h"

//报销人员的类
class Person:public Identify
{
public:
	Person();//默认构造

	Person(string num,string id, string password,string rname,string phone);//有参构造

	virtual void OperMenu();//重构函数显示菜单

	void Oper1Mune();//展示分菜单1

	void ApplyChart();//申请报表

	void ShowOwnProgress();//查询进展

	void ShowOwnInfo();//查询个人信息

	void ChangeInfo();//修改信息

	int PersonFlag();//返回信息所在Vector的下标

	bool IsProgress();//查询是否有申请的进展

	bool IsPay();

	void CancelChart();//取消报表

	void PayMoney();//最终付款

	string  m_Num;//工号

	string m_RealName;//真实姓名

	string m_PhoneNum;//电话号码
};

progress.h

#pragma once
#include"person.h"
#include<vector>
#include<string>
using namespace std;
#include<algorithm>
#include<fstream>
#include"allfiles.h"
#include<ctime>

class Progress
{
public:
	
	Progress();

	Progress(int pnum, string num, int money, string date, string state, string dealer);//有参构造

	int m_Pnum;//提单编号

	string m_Num;//工号

	int m_Pmoney;//提单金额

	string m_Date;//提单日期

	string m_State;//状态

	string m_Dealer;//处理人

	vector<Progress>vPro;//信息容器

	void InitVector();//初始化信息

	void ShowPro();//展示所有的报销进度

	string GetDate();//获取当前的日期,自己构造

	int GetVproSize();//获取容器的大小

	int GetVpronum();//获取编号信息

	void SaveVProgress(vector<Progress>p);//存储保存信息

	void ShowConInfo();//根据条件查询报表

	//因为单号只有1个或者0个,所以不需要判断
	//bool IsExist(int Pnum );//根据单号是否存在

	bool IsExist(string num);//根据工号判断存在就true
};

staff.h

#pragma once
#include<iostream>
#include<string>
using namespace std;
#include<string>
#include"identify.h"
#include<vector>
#include"managesystem.h"
#include"progress.h"
#include"admin.h"


class Staff :public Identify
{
public:
	Staff();

	Staff(string num,string id,string password,string rname,string phonenum,int role);

	//抽象函数,操作菜单
	virtual void OperMenu();

	void Oper1Menu();	//展示分菜单1的信息

	string  m_Num;//工号

	string m_RealName;//真实姓名

	string m_PhoneNum;//电话号码

	int  m_role;//职责

	string GetRole();//返回职责

	int GetCheckMoney();//返回最大额度授权

	void ShowAdminInfo();//查询管理员信息

	void ShowPersonInfo();//查询报销人员信息

	void ShowStaffInfo();//查询审批人员信息

	void ShowApproval();//展示待审批人员的信息,只展示额度范围内的所有信息

	void AprovePerson();//审批

	bool IsExistAprove();//判断是否存在审批信息

	void ChangeInfo();//修改个人信息

	void ShowOwnInfo();//查询个人信息
};

源文件

admin.cpp

#include"admin.h"
#include"myvector.h"

//默认构造
Admin::Admin() {}

//有参构造
Admin::Admin(string id, string password)
{
	this->m_Id = id;
	this->m_Password = password;
}

//每个类的抽象函数,操作菜单
void Admin::OperMenu()
{
	while(true)
	{ 
		system("cls");
		//展示菜单的信息
		cout << "************************************欢迎管理员登录!************************************" << endl;
		cout << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    1.查询信息                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    2.添加账号                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    3.删除信息                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    0.注    销                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择: " ;
		int choice = 0;
		cin >> choice;
		ManageSystem ms;
		switch (choice)
		{
		case 1://查询信息
			this->Oper1Menu();	
			break;
		case 2://添加账号
			this->AddPerson();
			break;
		case 3:
			this->Oper4Menu();
			break;
		case 0://注销账号,返回到上一级
			system("cls");
			ms.ShowMainMenu();
			break;
		default:	
			cout << "输入有误,请重新输入" << endl;
			//按任意键,清屏重新进入循环输出菜单
			system("pause");
			system("cls");
			break;
		}
	}
}

//展示管理员的信息
void Admin::ShowAdminInfo()
{
	ifstream ifs;
	ifs.open(ADMIN_FILE, ios::in);
	if (!ifs.is_open()) 
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Admin a;
	while (ifs >> a.m_Id && ifs >>a.m_Password)
	{
		cout << "账号为:" << a.m_Id<<" 密码为:"<<a.m_Password << endl;
    }
	ifs.close();
	system("pause");
	system("cls");
}

//展示报销人员信息
void Admin::ShowPersonInfo()
{
	ifstream ifs;
	ifs.open(PERSON_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	cout << "报销人员的所有信息如下:" << endl;
	//工号 账号 密码 姓名 电话
	string num; string id; string password; string rname; string phone;
	while (ifs >>num && ifs >>id && ifs >>password&& ifs >>rname && ifs >>phone)
	{
		cout << "工号为:" <<num << " 账号为:" << id<<" 密码为:"<<password << " 姓名为:" << rname << " 电话为:" << phone << endl;
	}
	ifs.close();
}

//展示审批人员信息
void Admin::ShowStaffInfo()
{
	ifstream ifs;
	ifs.open(STAFF_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Staff s;
	cout << "审批人员的所有信息如下:" << endl;
	while (ifs >> s.m_Num && ifs>> s.m_Id && ifs >>s.m_Password&& ifs >> s.m_RealName&& ifs >>s.m_PhoneNum&&ifs>>s.m_role)
	{
		cout << "工号为:" <<s.m_Num<< " 账号为:" << s.m_Id <<" 密码为:"<<s.m_Password << " 姓名为:" << s.m_RealName << " 电话为:" <<
			s.m_PhoneNum<<	" 职责为:" << s.GetRole() <<" 审批额度为:" << s.GetCheckMoney() << endl;
	}
	ifs.close();
}

//展示分菜单1——查询界面信息
void Admin::Oper1Menu()
{
	while (true)
	{
		system("cls");
		//展示菜单的信息
		cout << "************************************欢迎管理员进入查询界面!************************************" << endl;
		cout << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    1. 管理员信息                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    2.审批人员信息                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    3.报销人员信息                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    4.查询报销进展                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    5.  条件查询                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    0. 返回上一级                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您要查询的的选择: "<<endl;
		int choice = 0;
		cin >> choice;
		Progress p;
		switch (choice)
		{
		case 1://查询管理员信息 
			this->ShowAdminInfo();
			break;
		case 2://查询审批人员信息
			this->ShowStaffInfo();
			system("pause");
			system("cls");
			break;
		case 3://查询报销人员信息
			this->ShowPersonInfo();
			system("pause");
			system("cls");
			break;
		case 4://查询报销进展
			p.ShowPro();
			break;
		case 5://根据条件进行查询
			p.ShowConInfo();
			break;
		case 0://返回上一级  
			this->OperMenu();
			break;
		default://输入错误
			cout << "输入有误,请按任意键继续!" << endl;
			system("pause");
			system("cls");
			break;
		}
	}
}

//添加用户(报销人员 和审批人员)
void Admin::AddPerson()
{
	string filename, username, password;
	ofstream ofs;
	int select = 0;
	while (true)
	{
		//这一部分运行是成功的,在结束后可以试试switch语句
		cout << "1:添加报销人员\t2:添加工作人员:" << endl;
		cout << "3:添加管理员\t0:取消操作:" << endl;
		cout << "请输入添加账号的类型:" << endl;
		cin >> select;//选项
		MyVector v;
		if (select == 1)//添加报销人员
		{
			filename = PERSON_FILE;
			ofs.open(filename, ios::out | ios::app);
			string id;
			v.Showid(1);
			cout << "请输入工号:" << endl;
			cin >> id;//工号
			bool ret = v.IsRepeat(id, 1);
	
			if (!ret)
			{
				cout << "请输入账号:" << endl;
				cin >> username;//账号
				cout << "请输入密码:" << endl;
				cin >> password;//密码

				string name;//姓名
				cout << "请输入姓名:" << endl;
				cin >> name;
				string phone;//电话
				cout << "请输入电话号码:" << endl;
				cin >> phone;
				ofs << id << " " << username << " " << password << " " << name << " " << phone << endl;
				ofs.close();
				cout << "成功添加一名报销人员!" << endl;
				v.InitVPer();
				v.SaveVPer(v.vPer);
			}
			else
			{
				cout << "工号重复,请按任意键继续:" << endl;
			}
			system("pause");
			system("cls");
			return;
		}
		else if (select == 2)//添加工作人员
		{
			filename = STAFF_FILE;
			ofs.open(filename, ios::out | ios::app);
			Staff s;
			v.Showid(2);
			cout << "请输入工号:" << endl;
			cin >> s.m_Num;//工号
			bool ret=v.IsRepeat(s.m_Num,2);
	
			if (!ret)
			{
				cout << "请输入账号:" << endl;
				cin >> s.m_Id;//账号
				cout << "请输入密码:" << endl;
				cin >> s.m_Password;//密码
				cout << "请输入姓名:" << endl;
				cin >> s.m_RealName;
				cout << "请输入电话号码:" << endl;
				cin >> s.m_PhoneNum;
				cout << "1:财务主管\t2:部门主管" << endl;
				cout << "3:财务副主管\t4:部门副主管" << endl;
				cout << "请输入职责对应的编号:(输入其他数字,请重新输入...)" << endl;
				do {
					cin >> s.m_role;
				   } while (s.m_role<1 ||s.m_role>4);
				ofs << s.m_Num << " " << s.m_Id << " " << s.m_Password
					<< " " << s.m_RealName << " " << s.m_PhoneNum << " " <<
					s.m_role << endl;
				ofs.close();
				v.InitVSta();
				v.SaveVSta(v.vSta);
				//在这里添加到信息表中,还要添加到授权表,比较重要
				cout << "成功添加一名审批人员" << endl;
				ArlTable a;
				a.AddVAT(s.GetRole(), s.GetCheckMoney(), s.m_Num);//添加到授权表中
			}
			else
			{
				cout << "工号重复,请按任意键继续:" << endl;
			}

			system("pause");
			system("cls");
			return;
		}
		else if (select == 3)//添加管理员
		{
			filename = ADMIN_FILE;
			ofs.open(filename, ios::out | ios::app);
			v.Showid(3);
			cout << "请输入账号:" << endl;
			cin >> username;
			bool ret = v.IsRepeat(username,3);

			if (!ret) //没有重复
			{
			cout << "请输入密码:" << endl;
			cin >> password;
			ofs << username << " " << password << endl;
			ofs.close();
			cout << "成功添加一名管理员!" << endl;
			//文件没有即使保存,目前还有一个小bug
			v.InitVAdm();
			v.SaveVAdm(v.vAdm);
			}
			else 
			{
				cout << "用户名重复,请按任意键继续:" << endl;
			}
			system("pause");
			system("cls");
			return;
		}
		else if (select == 0)
		{
			system("pause");
			system("cls");
			return;
		}
		else//输入错误
		{
			cout << "输入有误,请按任意键继续!" << endl;
			system("pause");
			system("cls");
			return;
		}
	}
}

//展示删除信息4的分页面
void Admin::Oper4Menu()
{
	while (true)
	{
		system("cls");
		//展示菜单的信息
		cout << "************************************欢迎管理员登录!************************************" << endl;
		cout << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    1.报销人员信息                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    2.审批人员信息                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    0. 返回上一级                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您要删除的选择: " << endl;
		int choice = 0;
		cin >> choice;
		Progress p;
		switch (choice)
		{
		case 1:
			this->DeletePerson(1);
			break;
		case 2:
			this->DeletePerson(2);
			break;
		case 0://返回上一级  
			this->OperMenu();
			break;
		default://输入错误
			cout << "输入有误,请按任意键继续!" << endl;
			system("pause");
			system("cls");
			break;
		}
	}
}

//删除人员信息
void Admin::DeletePerson(int type)
{
	MyVector v;

	if (type == 1)//删除报销人员信息
	{
		this->ShowPersonInfo();
		cout << "请输入您要删除账号的工号:" << endl;
		string num;//选项
		cin >> num;
		//删除报销人员信息
		//然后进行显示信息
			v.InitVPer();
		for (vector<Person>::iterator it = v.vPer.begin(); it != v.vPer.end(); it++)
		{
			if (num == it->m_Num)
			{
				/*cout << "您要删除的报销人员信息为:"<<endl<<"工号" << it->m_Num << " 账号为:" 
					<< it->m_Id << " 密码为:" << it->m_Password<< " 姓名为:" << it->m_RealName 
					<< " 电话为:" << it->m_PhoneNum << endl;*/
				cout << "您确认信息,是否要进行删除  请输入Y/y代表是,N/n代表否" << endl;
				cout << "删除后将会在报销人员信息和进度信息中删除..." << endl;
				string b;//输出选择
				cin >> b;
				if (b == "Y" || b == "y")//那么就开启删除模式,删除该账号信息和进度信息
				{
					v.vPer.erase(it);
					v.SaveVPer(v.vPer);//删除信息
					Progress p;
					p.InitVector();
					for (vector<Progress>::iterator w = p.vPro.begin(); w != p.vPro.end();)
					{
						if (w->m_Num == num)
						{
							w = p.vPro.erase(w);
						}
						else w++;
					}
					p.SaveVProgress(p.vPro);
					cout << "操作完毕,已成功删除!" << endl;
				}
				else if (b == "N" || b == "n")
				{
					cout << "已取消删除" << endl;
				}
				else
				{
					cout << "您的输入有误,已取消删除!" << endl;
				}
				system("pause"); system("cls"); return;
			}
		}
		cout << "未查询到此报销人员!" << endl;
	}
	//删除审批人员信息
	else
	{
		this->ShowStaffInfo();
		cout << "请输入您要删除账号的工号:" << endl;
		string num;//选项
		cin >> num;

        v.InitVSta();
		for (vector<Staff>::iterator it = v.vSta.begin(); it != v.vSta.end(); it++)
		{
			if (num == it->m_Num)//显示信息
			{
				/*Staff s(it->m_Num, it->m_Id, it->m_Password, it->m_RealName, it->m_PhoneNum, it->m_role);
				cout << "您将要删除的信息为:" << endl;
				s.ShowOwnInfo();*/
				cout << "您确认信息,是否要进行删除  请输入Y/y代表是,N/n代表否" << endl;
				cout << "删除后将会在报销人员信息和授权表中删除..." << endl;
				string b;//输出选择
				cin >> b;
				if (b == "Y" || b == "y")//那么就开启删除模式,删除该账号信息和进度信息
				{
					v.vSta.erase(it); v.SaveVSta(v.vSta);
					ArlTable a; a.InitVAT();
					for (vector<ArlTable>::iterator it = a.vAT.begin(); it != a.vAT.end(); )
					{
						if (num == it->m_Num)
						{
							it = a.vAT.erase(it);
						}
						else it++;
					}
					a.SaveVAT(a.vAT);
					cout << "操作完毕!" << endl;
				}
				else if (b == "N" || b == "n")
				{
					cout << "已取消删除!" << endl;
				}
				else
				{
					cout << "您的输入有误,已取消删除!" << endl;
				}
				system("pause"); system("cls"); return;
			}
		}
		cout << "未查询到此审批人员!" << endl;
	}
	system("pause");
	system("cls");
	return;
}

aqt.cpp

#include"aqt.h"
//主要创建一个审批人额度授权的信息用于交互

//默认构造
ArlTable::ArlTable()
{
	this->m_key = 0;
	this->m_Role = "0";
	this->m_Money = 0;
}

//初始化,读取文件内容并且存储到vector容器中
void ArlTable::InitVAT()
{
	this->vAT.clear();
	ifstream ifs;
	ifs.open(STAFFAUIN, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	ArlTable a;
	while (ifs >> a.m_key && ifs >> a.m_Role && ifs >> a.m_Money && ifs >> a.m_Num)
	{
		this->vAT.push_back(a);
	}
	ifs.close();
}

//展示信息
void ArlTable::ShowInfo()
{
	this->InitVAT();
	int i=0;
	cout << "审批人额度授权表如下:" << endl;
	for (vector<ArlTable>::iterator it = this->vAT.begin(); it != this->vAT.end(); it++)
	{
		cout << it->m_key << " " << it->m_Role << " " << it->m_Money <<" " << it->m_Num << endl;
		i++;
	}
	cout << "共计共有" << i << "名审批人员" << endl;
	system("pause");
	system("cls");
}

//根据vector信息,存取到文件中
void ArlTable::SaveVAT(vector<ArlTable>a)
{
	ofstream ofs;
	ofs.open(STAFFAUIN, ios::out);
	for (vector<ArlTable>::iterator it = this->vAT.begin(); it != this->vAT.end(); it++)
	{
		ofs<< it->m_key << " " << it->m_Role << " " << it->m_Money << " "<<it->m_Num << endl;
	}
	ofs.close();
}

//获取容器的大小
int ArlTable::GetVATSize()
{
	this->InitVAT();
	int size = this->vAT.size();
	return size;
}

//获取创建时编号信息
int ArlTable::GetVATnum()
{
	this->InitVAT();
	if (this->vAT.size() == 0)
	{
		return 1;
	}
	int ret = this->vAT.rbegin()->m_key + 1;
	return ret;
}

//添加管理员的时候,同步更新授权表
void ArlTable::AddVAT(string role, int money, string num)
{
	ofstream ofs;
	ofs.open(STAFFAUIN, ios::app);
	int key=this->GetVATnum();
	ofs << key << " " << role << " " << money << " " << num << endl;
	ofs.close();
	cout << "添加到授权表中成功!" << endl;
}

main.cpp

#include<iostream>
using namespace std;
#include"managesystem.h"

int main()
{
	//创建一个财务管理系统的对象并且调用
	ManageSystem ms;
	ms.ShowMainMenu();
	return 0;
}

managesystem.cpp

#include"managesystem.h"//主要调用的cpp
#include"myvector.h"

//初始化一下,如果没有文件就创建,有的话不能动
ManageSystem::ManageSystem()
{
	//ifstream ifs;//创建一个流
	//ifs.open(ADMIN_FILE, ios::in);
	//if (ifs.eof())//文件为空就创建
	//{
	//	ofstream ofs;
	//	ofs.open(ADMIN_FILE, ios_base::out);
	//	ofs << "admin 123" << endl;
	//	ofs << "dcl 123" << endl;
	//	ofs.close();
	//}
	//ifs.close();
	//ifs.open(STAFF_FILE, ios::in);
	//if (ifs.eof())
	//{
	//	ofstream ofs;
	//	ofs.open(ADMIN_FILE, ios_base::out);
	//	ofs.close();
	//}
	//ifs.close();
	//ifs.open(PERSON_FILE, ios::in);
	//if (ifs.eof())
	//{
	//	ofstream ofs;
	//	ofs.open(PERSON_FILE, ios_base::out);
	//	ofs.close();
	//}
	//ifs.close();
	//ifs.open(PERSONINFO, ios::in);
	//if (ifs.eof())
	//{
	//	ofstream ofs;
	//	ofs.open(PERSONINFO, ios_base::out);
	//	ofs.close();
	//}
	//ifs.close();

	//ifs.open(STAFFAUIN, ios::in);
	//if (ifs.eof())
	//{
	//	ofstream ofs;
	//	ofs.open(STAFFAUIN, ios_base::out);
	//	ofs.close();
	//}
	//ifs.close();
}

//显示主菜单
void ManageSystem::ShowMainMenu()
{
	while (true)//循环输出主菜单
	{
		system("cls");
		cout << "*******************************欢迎来到财务报销管理系统!*******************************" << endl;
		cout << endl << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    1.报销人员                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    2.审批人员                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    3.管 理 员                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    0.退    出                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择: ";
		int choice = 0;
		cin >> choice;
		switch (choice)
		{
		case 1://报销人员
			this->MSOperMenu(1);
			break;
		case 2://审批人员
			this->MSOperMenu(2);
			break;
		case 3://管理人员
			ManageSystem::Login(3);
			break;
		case 0://退出
			cout << "欢迎下次再次使用!" << endl;
			exit(0);
		default://输入错误
			cout << "输入有误,请重新输入" << endl;
			system("pause");
			system("cls");
			break;
		}
	}
}

//登录界面
void ManageSystem::Login(int type)
{
	ifstream ifs;
	string Name_File;
	if (type == 1)
	{
		Name_File = PERSON_FILE;
	}
	else if (type == 2)
	{
		Name_File = STAFF_FILE;
	}
	else
	{
		Name_File = ADMIN_FILE;
	}
	ifs.open(Name_File, ios::in);
	if (!(ifs.is_open()))
	{
		cout << "文件打开失败" << endl;
		return;
	}
	//扫描的Num
	string Num; string Fid; string Fpassword;string Fname; string Fphone;
	Identify* person = NULL;//先创建一个父类指针,后面用多态展示界面
	if (type == 1)//普通用户(Person)
	{
		string num;	
		string id;
		string password;
		cout << "请输入你的工号:" << endl;
		cin >> num;
		cout << "请输入你的账号:" << endl;
		cin >> id;
		cout << "请输入你的密码:" << endl;
		cin >> password;
		//每一行扫描,判断和密码本一样就验证成功,否则验证失败
		while (ifs>>Num&&ifs >> Fid && ifs >> Fpassword&&ifs>>Fname&&ifs>>Fphone)
		{
			if (Num==num&&Fid == id && Fpassword == password)
			{
				cout << "报销人员身份验证成功!" << endl;
				system("pause");
				system("cls");
				//cout << Fname << " " << "测试代码!!!" << Fphone;
				person = new Person(num,id, password,Fname,Fphone);
				//进入管理员界面
				person->OperMenu();
				return;
			}
		}
	}
	else if (type == 2)//工作人员(staff)
	{
		string num;
		string id;
		string password;
		cout << "请输入你的工号:" << endl;
		cin >> num;
		cout << "请输入你的账号:" << endl;
		cin >> id;
		cout << "请输入你的密码:" << endl;
		cin >> password;
        int Frole;
		while (ifs >> Num&&ifs >> Fid && ifs >> Fpassword&&ifs>>Fname&&ifs>>Fphone&&ifs>>Frole)
		{
			if (num==Num&&Fid == id && Fpassword == password)
			{
				cout << "审批人员身份验证成功!" << endl;
				system("pause");
				system("cls");
				person = new Staff(num,id, password,Fname,Fphone,Frole);
				//进入下一步
				person->OperMenu();
				return;
			}
		}
	}
	else//管理人员
	{
		string id;
		string password;
		cout << "请输入你的账号:" << endl ;
		cin >> id;
		cout << "请输入你的密码:"<<endl;
		cin >> password;
		while (ifs >> Fid && ifs >> Fpassword)
		{
			//判断输入账号密码是否与密码本的相等
			if (Fid == id && Fpassword == password)
			{
				cout << "管理员身份验证成功!" << endl;
				system("pause");
				system("cls");
				person = new Admin(id, password);
				//进入管理员界面
				person->OperMenu();
				return;
			}
		}
	}
	//身份验证失败
	cout<< "身份验证失败!" << endl;
	system("pause");
	system("cls");
	return;
}

//分页面用于用户选择是否有账号
void ManageSystem::MSOperMenu(int num)
{
	system("cls");
	while (true)
	{
		cout << "*******************************欢迎进入登录界面!*******************************" << endl;
		cout << endl << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                1.已有账号,登录                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                2.没有账号,创建                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                0.返 回 上 一 项                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择: ";
		int choice = 0;
		cin >> choice;
		switch (choice)
		{
		case 1://登录进入菜单
			this->Login(num);
			break;
		case 2://创建账号页面
			this->Create(num);
			break;
		case 0://返回上一页面
			system("cls");
			this->ShowMainMenu();
			break;
		default://输入错误
			cout << "输入有误,请重新输入" << endl;
			system("pause");
			system("cls");
			break;
		}
	}
}

//创建一个账号
void ManageSystem::Create(int num)//num==1报销人员 其他审批人员,输出无权限
{
	string filename;
	if (num == 1)
	{
		filename = PERSON_FILE;
		MyVector v;
		v.Showid(num);
	}
	else
	{
		cout << "审批人员无权限自己创建账号,请向管理员申请..." << endl;
		system("pause");
		system("cls");
		return;
	}

	string Num;
	string id;
	string password1; string password2;
    cout << "请输入您要创建的工号(3位数):" << endl;
	cin >> Num;
	MyVector v;
	bool ret=v.IsRepeat(Num, 1);

	if (ret)
	{
		cout << "工号与原本工号重复!请重新输入..." << endl;
		system("pause");
		system("cls");
		return;
	}

	cout << "请输入您要创建的账号:" << endl;
	cin >> id;
	cout << "请输您的密码:" << endl;
	cin >> password1;
	cout << "请再次确认您的密码:" << endl;
	cin >> password2;
	if (password1 != password2)
	{
		cout << "您两次输入的密码不一致,请按任意键继续..." << endl;
		system("pause");
		system("cls");
		return;
	}
	string realname;//真实姓名
	string phonenum;//电话
	cout << "请输入您的真实姓名:" << endl;
	cin >> realname;
	cout << "请输您的电话号码:" << endl;
	cin >> phonenum;
	ofstream ofs;
	ofs.open(filename, ios::out | ios::app);
	//将信息写入密码本中
	ofs << Num << " " << id << " " << password1 <<
		" " << realname << " " << phonenum << endl;
	cout << "您已成功创建了账号!请按任意键返回登录..." << endl;
	system("pause"); system("cls");
	this->MSOperMenu(1);
}

myvector.cpp

#include"myvector.h"

//初始化容器报销人员
void MyVector::InitVPer()
{
	this->vPer.clear();
	ifstream ifs;
	ifs.open(PERSON_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Person test;
	while (ifs >> test.m_Num && ifs >> test.m_Id && ifs >> test.m_Password && ifs >> test.m_RealName&& ifs >> test.m_PhoneNum)
	{
		this->vPer.push_back(test);
	}
	//cout << "报销人员人数" << this->vPer.size() << endl;
	ifs.close();
}

//审批人员
void MyVector::InitVSta()
{
	//初始化审批人员容器
	this->vSta.clear();
	ifstream ifs;
	ifs.open(STAFF_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Staff test;//工号 账号 密码 真实姓名 电话 职责
	while (ifs >> test.m_Num && ifs >> test.m_Id && ifs >> test.m_Password && ifs >> test.m_RealName && ifs >> test.m_PhoneNum&&ifs>>test.m_role)
	{
		this->vSta.push_back(test);
	}
	ifs.close();
}

//管理员
void MyVector::InitVAdm()
{
	//初始化管理员容器,为添加去重复做铺垫
	//清空容器内部
	this->vAdm.clear();
	ifstream ifs;
	ifs.open(ADMIN_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Admin test;
	while (ifs >> test.m_Id && ifs >> test.m_Password)
	{
		this->vAdm.push_back(test);

	}
	ifs.close();
}

//存储报销人员信息
void MyVector::SaveVPer(vector<Person>p)
{
	ofstream ofs;
	ofs.open(PERSON_FILE, ios::out);
	for (vector<Person>::iterator it = p.begin(); it != p.end(); it++)
	{
		ofs << it->m_Num << " " << it->m_Id << " " << it->m_Password <<
			" " << it->m_RealName << " " << it->m_PhoneNum<< endl;
	}
	ofs.close();
}

//存储审批人员信息
void MyVector::SaveVSta(vector<Staff>p)
{

	ofstream ofs;
	ofs.open(STAFF_FILE, ios::out);
	for (vector<Staff>::iterator it = p.begin(); it != p.end(); it++)
	{
		ofs << it->m_Num << " " << it->m_Id << " " << it->m_Password <<
			" " << it->m_RealName << " " << it->m_PhoneNum <<" "<<it->m_role << endl;
	}

	ofs.close();
}

//存储管理员信息
void MyVector::SaveVAdm(vector<Admin>p)
{
	ofstream ofs;
	ofs.open(ADMIN_FILE, ios::out);
	for (vector<Admin>::iterator it = p.begin(); it != p.end(); it++)
	{
		ofs <<  it->m_Id << " " << it->m_Password << endl;
	}
	ofs.close();
}

//判断工号是否重复,为创建新信息做铺垫
bool MyVector::IsRepeat(string num, int type)//工号 类型
{
	if (type == 1)//报销人员
	{
		this->InitVPer();
		for (vector<Person>::iterator it = this->vPer.begin(); it != this->vPer.end(); it++)
		{
			if (it->m_Num == num)
			{
				return true;//有重复工号
			}
		}
	}
	else if (type == 2)//审批人员
	{
		this->InitVSta();
		for (vector<Staff>::iterator it = this->vSta.begin(); it != this->vSta.end(); it++)
		{
			if (it->m_Num == num)
			{
				return true;//有重复工号
			}
		}
	}
	else 
	{
		this->InitVAdm();
		for (vector<Admin>::iterator it = this->vAdm.begin(); it != this->vAdm.end(); it++)
		{
			if (it->m_Id == num)
				return true;
		}
	}
	return false;
}

//展示已有工号
void MyVector::Showid(int type)
{
	if (type == 1)//报销人员
	{
		this->InitVPer();
		cout << "当前已存在的工号如下:" << endl;
		for (vector<Person>::iterator it=this->vPer.begin();it!=this->vPer.end();it++)
		{
			cout <<it->m_Num << ",";
		}
	}
	else if (type == 2)
	{
		this->InitVSta();
		cout << "当前已存在的工号如下:" << endl;
		for (auto it = this->vSta.begin(); it != this->vSta.end(); it++)
		{
			cout << it->m_Num << ",";
		}
	}
	else
	{
		this->InitVAdm();
		cout << "当前已有的管理员id如下:" << endl;
		for (auto it = this->vAdm.begin(); it != this->vAdm.end(); it++)
		{
			cout << it->m_Id << ",";
		}
	}
}

person.cpp

#include"person.h"
#include"myvector.h"
#include<map>

//默认构造
Person::Person() {}

//工号 账号 密码 真实姓名 电话 有参构造
Person::Person(string num, string id, string password, string rname, string phone)//有参构造
{
	this->m_Num = num;
	this->m_Id = id;
	this->m_Password = password;
	this->m_RealName = rname;
	this->m_PhoneNum = phone;
}

//展示操作界面
void Person::OperMenu() 
{
	while (true)
	{
		//展示菜单的信息
		cout << "************************************欢迎报销人员登录!************************************" << endl;
		cout << endl << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   1.查 询 信  息                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   2.修 改 信  息                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   3.申 请 报  销                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   4.取 消 报  销                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   5.最 终 付  款                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   0.注        销                   |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择:" << endl;
		int choice = 0;
		cin >> choice;
		ManageSystem ms;//后续调用
		switch (choice)
		{
		case 1://查询个人信息
			this->Oper1Mune();
			break;
		case 2://修改信息
			this->ChangeInfo();
			break;
		case 3://申请报表
			this->ApplyChart();
			break;
		case 4://取消申请
			this->CancelChart();
			break;
		case 5://最终付款
			this->PayMoney();
			break;
		case 0:
			ms.ShowMainMenu();
			break;
		default:	cout << "输入有误,请重新输入" << endl;
			//按任意键,清屏重新进入循环输出菜单
			system("pause");
			system("cls");
			break;
		}
	}
}

//展示分菜单1——查询界面
void Person::Oper1Mune()
{
	
	while (true)
	{
		system("cls");
		//展示菜单的信息
		cout << "************************************欢迎报销人员查询!************************************" << endl;
		cout << endl << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   1. 个  人  信  息                |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   2. 个  人  进  度                |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   3. 审 批 授 权 表                |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   4. 条  件  查  询                |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                   0. 返 回 上 一 级                |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择:" << endl;
		int choice = 0;
		cin >> choice;
		ArlTable a;
		Progress p;
		switch (choice)
		{
		case 1://查询个人信息
			this->ShowOwnInfo();
			system("pause");
			system("cls");
			break;
		case 2:// 2. 个  人  进  度
			this->ShowOwnProgress();
			break;
		case 3:
			//上面创建了一个ArlTable类的一个对象 a
			a.ShowInfo();
			break;
		case 4://条件查询
			p.ShowConInfo();
			break;
		case 0:
			system("cls");
			this->OperMenu();
			break;
		default:	cout << "输入有误,请重新输入" << endl;
			//按任意键,清屏重新进入循环输出菜单
			system("pause");
			system("cls");
			break;
		}
	}
}

//申请报表信息,并且交互到文件中
void Person::ApplyChart()
{
	int money = 0;
	cout << "请输入您要提单的金额:" << endl;
	cout << "金额必须>0元,否责请重新输入!!!" << endl;
	do
	{ 
	cin >> money; 
	} while (money <=0);
	
	Progress p;
	//int num=p.GetVproSize();
	//提单编号   工号   提单金额   提单日期   状态  处理人 分别进行赋值
	p.m_Pnum =p.GetVpronum(); p.m_Num = this->m_Num;
	p.m_Pmoney = money; p.m_Date = p.GetDate(); p.m_State = "创建";
	p.m_Dealer = this->m_Num;
	ofstream ofs;
	ofs.open(PERSONINFO, ios::out | ios::app);
	ofs << p.m_Pnum << " " << p.m_Num << " " << p.m_Pmoney << " "
		<< p.m_Date << " " << p.m_State << " " << p.m_Dealer<<endl;
	ofs.close();
	cout << "成功申请!";
	system("pause");
	system("cls");
}

//修改账号信息,只能改账号密码和电话
void Person::ChangeInfo()
{
	//cout << "只能修改账号,密码和电话号码!..." << endl;
	system("cls");
	cout << "************************************欢迎进入修改界面!************************************" << endl;
	cout << endl << endl;
	cout << "\t\t ----------------------------------------------------" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  1. 修  改  账  号                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  2. 修  改  密  码                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  3. 修  改  电  话                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  0. 取  消  操  作                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t ----------------------------------------------------" << endl;
	this->ShowOwnInfo();//展示个人信息
	cout << "请输入您要进行的选择:";
	MyVector v;
	v.InitVPer();
	int j = 0;
	for (vector<Person>::iterator it = v.vPer.begin(); it != v.vPer.end(); it++)
	{
		if (it->m_Num == this->m_Num)
		{
			string choice; //选择
			cin >> choice;
			if (choice == "1")
			{
				string Oripsw;
				cout << "请输入原密码进行身份确认:"; cin >> Oripsw;
				if (Oripsw == this->m_Password)
				{
					string id1, id2;
					cout << "请输入新的账号:"; cin >> id1;
					cout << "请再次确认新账号:"; cin >> id2;
					if (id1 == id2)
					{
						//工号 账号 密码 真实姓名 电话
						this->m_Id = id1;
						v.vPer.erase(v.vPer.begin() + j);
						v.vPer.insert(v.vPer.begin() + j, *this);
						v.SaveVPer(v.vPer);
						cout << "账号修改成功!";
					}
					else
					{
						cout << "两次输入的新账号不一致!" << endl;
					}
				}
				else
				{
					cout << "身份验证失败,无法进行修改!";
				}	
			}
			else if (choice == "2")
			{
				string Oripsw;
				cout << "请输入原密码进行身份确认:"; cin >> Oripsw;
				if (Oripsw == this->m_Password)
				{
					string psw1, psw2;
					cout << "请输入新的密码:"; cin >> psw1;
					cout << "请再次确认新密码:"; cin >> psw2;
					if (psw1 == psw2)
					{
						//工号 账号 密码 真实姓名 电话
						this->m_Password = psw1;//新密码
						v.vPer.erase(v.vPer.begin() + j);
						//把自身属性修改后插入vector容器相应位置中
						v.vPer.insert(v.vPer.begin() + j, *this);
						v.SaveVPer(v.vPer);
						cout << "密码修改成功!" << endl;
					}
					else
					{
						cout << "两次输入的新密码不一致!" << endl;
					}
				}
				else
				{
					cout << "身份验证失败,无法进行修改!";
				}
			}
			else if (choice == "3")
			{
				string phone;
				cout << "请输入您的新电话号码:"; cin >> phone;
					//工号 账号 密码 真实姓名 电话
				    this->m_PhoneNum = phone;
					v.vPer.erase(v.vPer.begin() + j);
					v.vPer.insert(v.vPer.begin() + j, *this);
					v.SaveVPer(v.vPer);
					cout << "电话修改成功!";
			}
			else if (choice == "0");//取消操作
			else
			{
				cout << "输入选项错误!" << endl;
			}
			system("pause");
			system("cls");
			return;
		}
		j++;
	}
}

//查询个人进展
void Person::ShowOwnProgress()
{
	Progress p;
	p.InitVector();
	if (!this->IsProgress())
		cout << "您的记录为空,请按任意键继续..." << endl;
	else
	{
		cout << "您个人申报的信息如下:" << endl;
		int i=0;//用于计算有几条报销信息
		for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
		{
			if (it->m_Num == this->m_Num)
			{
				cout <<"第"<<i << "条:提单编号为:" << it->m_Pnum << " 工号为:" << it->m_Num << " 提单金额为:" << it->m_Pmoney
					<<" 提单日期:"<<it->m_Date << " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				i++;
			}		
		}
		cout << "总计有" << i << "条报销信息" << endl;
	}
	system("pause");
	system("cls");
}

//查询是否有申请的进展
bool Person::IsProgress()
{
	Progress p;
	p.InitVector();
	for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
	{
		if (it->m_Num == this->m_Num)
			return true;
	}
	return false;
}

bool Person::IsPay()
{
	Progress p;
	p.InitVector();
	for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
	{
		if (it->m_Num == this->m_Num&&it->m_State=="财务审批")
			return true;
	}
	return false;
}

//取消报表
void Person::CancelChart()
{
	Progress p;
	p.InitVector();
	if (!this->IsProgress()) {
		cout << "您的记录为空,请按任意键继续..." << endl;
		system("pause");
		system("cls");
		return;
	}
	else
	{
		//记录第几条
		int i = 1; int num = 0;
		map<int, int>m;
		for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
		{
			if (it->m_Num == this->m_Num)
			{
				cout << "第" << i << "条:提单编号为:" << it->m_Pnum << " 工号为:" << it->m_Num << " 提单金额为:" << it->m_Pmoney
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				m.insert(make_pair(i,num));
				i++;	
			}
			num++;
		}
	/*	for (int m1 = 1; m1 < i; m1++)
		{
			cout << "测试代码!" << endl;
			cout << m[m1] << endl;

		}*/
		cout << "您想要取消哪一条,如果您输入0 则取消操作" << endl;
		int choice;//选择
		cin >> choice;
		if (choice > 0 && choice <= i - 1)
		{
			p.vPro.erase(p.vPro.begin() +m[choice]);
			p.SaveVProgress(p.vPro);
			cout << "删除成功!" << endl;
		}
		else if (choice == 0)
			cout<<"取消操作成功!";//取消操作
		else
		{
			cout << "输入错误,请按任意键继续:" << endl;
		}
			system("pause");
			system("cls");
			return;	
	}
}

//最终付款
void Person::PayMoney()
{
	Progress p;
	p.InitVector();
	if (!this->IsPay()) {
		cout << "您的记录为空,请按任意键继续..." << endl;
		system("pause");
		system("cls");
		return;
	}
	else
	{
		int i = 1; int j = 0;
		for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
		{
			if (it->m_Num == this->m_Num && it->m_State == "财务审批")
			{
				cout << "第" << i << "条:提单编号为:" << it->m_Pnum << " 工号为:" << it->m_Num << " 提单金额为:" << it->m_Pmoney
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				cout << "您是否要付款?y/Y(是)\tn/N(不是)..." << endl;
				string c;//判断通过与否
				cin >> c;
				if (c == "y" || c == "Y")
				{
					//cout << "通过,然后改日期,状态(部门审批)和处理人,后保存" << endl;
					//报单编号   提单人	  提单金额	   提单日期	   状态	处理人
					//这一顿操作就是修改信息,我已经麻了,输入错误则不会修改进展
					string state = "付款结束";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);

				}
				else if (c == "n" || c == "N");
				else
				{
					cout << "您输入错误,默认未付款,请先进行下一个的选项..." << endl;
				}
				i++;
				system("pause");
			}
			j++;
		}
	}
	system("cls");
}

//展示个人信息
void Person::ShowOwnInfo()
{
	cout << "您的信息如下:" << endl;
	cout << "工号为:" << this->m_Num << " 账号为:" << this->m_Id
					<< " 姓名为:" << this->m_RealName << " 电话为:" << this->m_PhoneNum << endl;
}
#include"progress.h"

//默认构造
Progress::Progress()
{
	this->m_Pnum=0;//提单编号

	this->m_Num="0";//工号

	this->m_Pmoney=0;//提单金额

	this->m_Date="2022/1/1";//提单日期

	this->m_State="初始";//状态

	this->m_Dealer="000";//处理人
}

//有参构造
Progress::Progress(int pnum, string num, int money, string date, string state, string dealer)
{
	//报单编号   提单人	  提单金额	   提单日期	   状态	处理人
	this->m_Pnum = pnum; this->m_Num = num;
	this->m_Pmoney = money; this->m_Date = date;
	this->m_State = state; this->m_Dealer = dealer;
}

//初始化容器报销人员进度
void Progress::InitVector()
{
	this->vPro.clear();
	ifstream ifs;
	ifs.open(PERSONINFO, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Progress p;
	/*int m_Pnum; 提单编号string m_Num; 工号int m_Pmoney;//提单金额
	string m_Date; 提单日期 string m_State; 状态 int m_Dealer;//处理人*/
	while (ifs >> p.m_Pnum && ifs >> p.m_Num && ifs >>
		p.m_Pmoney && ifs >> p.m_Date && ifs >> p.m_State && ifs >> p.m_Dealer)
	{
		this->vPro.push_back(p);
	}
	ifs.close();
}

//查询进展信息
void Progress::ShowPro()
{
	this->InitVector();
	/*int m_Pnum;//提单编号

	int m_Num;//工号

	int m_Pmoney;//提单金额

	string m_Date;//提单日期

	string m_State;//状态

	int m_Dealer;//处理人
*/
	cout << "所有进展的信息如下:" << endl;
	for (vector<Progress>::iterator it = this->vPro.begin(); it != this->vPro.end(); it++)
	{
		cout << "报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
			" 提单金额为:" << it->m_Pmoney<< " 提单日期为:" << it->m_Date 
			<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
	}
	cout << "共计:" << this->GetVproSize() << "条申请信息" << endl;
	system("pause");
	system("cls");
}

//获取当前日期的函数
string Progress::GetDate()
{
	time_t now = time(&now);
	struct tm ti;
	localtime_s(&ti, &now);
	string ret;
	ret = to_string(ti.tm_year + 1900) + "/" +
		to_string(ti.tm_mon + 1) + "/" + to_string(ti.tm_mday);
	return ret;
}

//获取容器的大小
int Progress::GetVproSize()
{
	this->InitVector();
	int ret=this->vPro.size();
	return ret;
}

//创建时获取编号信息
int Progress::GetVpronum()
{
	this->InitVector();
	if (this->vPro.size() == 0)
	{
		return 20220001;
	}
	int num = this->vPro.rbegin()->m_Pnum + 1;
	return num;
}

//存储保存信息
void Progress::SaveVProgress(vector<Progress>p)
{
	ofstream ofs;
	ofs.open(PERSONINFO, ios::out);
	for (vector<Progress>::iterator it = p.begin(); it != p.end(); it++)
	{
		ofs << it->m_Pnum << " " << it->m_Num << " " << it->m_Pmoney << 
			" " << it->m_Date << " " << it->m_State<<" " << it->m_Dealer << endl;
	}
	ofs.close();
}

//条件查询信息
void Progress::ShowConInfo()
{
	cout << "只能根据提单编号查询或者工号查询!" << endl;
	cout << "1.提单编号查询 2.工号查询 0.取消操作" << endl;
	cout << "请输入您的选择" << endl;
	string choice;
	cin >> choice;
	if (choice == "1")
	{
		cout << "请输入您要查询的提单编号:" << endl;
		int Pnum=0;//提单信息
		cin >> Pnum;
		this->InitVector();

		for (vector<Progress>::iterator it = this->vPro.begin(); it != this->vPro.end(); it++)
		{
			if (it->m_Pnum == Pnum)//查询到了
			{
				cout << "提单编号为:" << it->m_Pnum << " 工号为:" << it->m_Num << " 提单金额为:" << it->m_Pmoney
					<< " 提单状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				system("pause");
				system("cls");
				return;
			}
		}
		cout << "未查询到相关结果!请检查您输入的正确性!" << endl;
		system("pause");
		system("cls");
	}
	else if (choice == "2")
	{
		cout << "请输入您要查询的工号:" << endl;
		string num;
		cin >> num;
		this->InitVector();
		if (!this->IsExist(num))
		{
			cout << "此账号暂时没有报销信息!" << endl;
			system("pause");
			system("cls");
			return;
		}
		int i = 1;
		for (vector<Progress>::iterator it = this->vPro.begin(); it != this->vPro.end(); it++)
		{
			if (it->m_Num == num)//查询到了
			{
				cout<<"第"<<i << "条结果:提单编号为:" << it->m_Pnum << " 工号为:" << it->m_Num << " 提单金额为:" << it->m_Pmoney
					<< " 提单状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				i++;
			}
		}
		system("pause");
		system("cls");
	}
	else if (choice == "0")
	{
		system("cls");
	}
	else
	{
		cout << "您输入的信息有误!" ;
		system("pause");
		system("cls");
	}
}

//根据工号判断进度是否存在
bool Progress::IsExist(string num)
{
	for (vector<Progress>::iterator it = this->vPro.begin(); it != this->vPro.end(); it++)
	{
		if (it->m_Num == num)//查询到了
		{
			return true;
		}
	}
	return false;
}

staff.cpp

#include"staff.h"
#include"myvector.h"

//默认构造
Staff::Staff()
{
	this->m_role = 0;

}

//有参构造
Staff::Staff(string num, string id, string password, string rname, string phonenum, int role)
{
	this->m_Num = num;
	this->m_Id = id;
	this->m_Password = password;
	this->m_RealName = rname;
	this->m_PhoneNum = phonenum;
	this->m_role = role;
}

//每个类的抽象函数,操作菜单
void Staff::OperMenu()
{
	while (true)
	{
		//展示菜单的信息
		cout << "************************************欢迎审批人员登录!************************************" << endl;
		cout << endl << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    1.查询信息                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    2.修改信息                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    3.审批信息                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                    0.注    销                      |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择:" << endl;
		int choice = 0;
		cin >> choice;
		ManageSystem ms;
		switch (choice)
		{
		case 1:
			this->Oper1Menu();
			break;
		case 2://修改信息
			this->ChangeInfo();
			break;
		case 3://审批信息
			this->AprovePerson();
			break;
		case 0://注销
			system("cls");
			ms.ShowMainMenu();
			break;
		default:	
			cout << "输入有误,请重新输入" << endl;
			//按任意键,清屏重新进入循环输出菜单
			system("pause");
			system("cls");
			break;
		}
	}
}

//返回职责
string Staff::GetRole()
{
	switch (this->m_role)
	{
	case 1:
		return "财务主管";
	case 2:
		return "部门主管";
	case 3:
		return "财务副主管";
	case 4:
		return "部门副主管";
	default:
		return "错误";
	}
}

//返回最大额度授权
int Staff::GetCheckMoney()
{
	switch(this->m_role)
	{
	case 1:
		return 100000;
	case 2:
		return 100000;
	case 3:
		return 50000;
	case 4:
		return 50000;
	default:
		return 0;
	}
}

//进入分界面1——查询界面
void Staff::Oper1Menu()
{
	system("cls");
	while (true)
	{
		cout << "************************************欢迎审批人员进入查询界面!************************************" << endl;
		cout << endl << endl;
		//展示分菜单1的信息
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                  1.待 审 批 信 息                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                  2.审  批  人  员                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                  3.管    理    员                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                  4.报  销  人  员                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                  5.个  人  信  息                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t|                  0.返 回 上 一 级                  |" << endl;
		cout << "\t\t|                                                    |" << endl;
		cout << "\t\t ----------------------------------------------------" << endl;
		cout << "请输入您的选择:" << endl;
		int choice = 0;
		cin >> choice;
		switch (choice)
		{
		case 1://查询待审批信息
			this->ShowApproval();
			break;
		case 2://审批人员信息
		this->ShowStaffInfo();
			break;
		case 3://管理员信息
			this->ShowAdminInfo();
			break;
		case 4://报销人员信息
			this->ShowPersonInfo();
			break;
		case 5://查询个人信息
			this->ShowOwnInfo();
			system("pause");
			system("cls");
			break;
		case 0://返回到上一级
			system("cls");
			this->OperMenu();
			break;
		default:
			cout << "输入有误,请重新输入" << endl;
			//按任意键,清屏重新进入循环输出菜单
			system("pause");
			system("cls");
			break;
		}
	}
}

//展示待审批人员的信息,只展示额度范围内的所有信息
void Staff::ShowApproval()
{
	if (!this->IsExistAprove())
	{
		cout << "您当前没有待审批信息!";
		system("pause"); system("cls");
		return;
	}
	Progress p;
	p.InitVector();
	int i=1;//显示条数,展示其中的几条
	for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
	{
		if (it->m_State == "创建")
		{
			if (it->m_Pmoney <= 50000 && this->m_role == 4)//部门副主管审批审批
			{
				cout<<"第"<<i<<"条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				i++;
			}
			else if (it->m_Pmoney>50000&&it->m_Pmoney <= 100000 && this->m_role == 2)//部门主管的待审批信息
			{
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				i++;
			}
		}
		else if (it->m_State == "部门审批")
		{
			if (it->m_Pmoney <= 50000 && this->m_role ==3)//财务副主管审批审批
			{
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				i++;
			}
			else if (it->m_Pmoney > 50000 && it->m_Pmoney <= 100000 && this->m_role == 1)//财务主管的待审批信息
			{
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				i++;
			}
		}
	}
	system("pause");
	system("cls");
}

//审批函数
void Staff::AprovePerson()
{
	if (!this->IsExistAprove())
	{
		cout << "您当前没有待审批信息!";
		system("pause"); system("cls");
		return;
	}
	Progress p;
	p.InitVector();
	int i = 1;//显示条数,展示其中的几条
	int j = 0;//找出下标
	for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
	{
		if (it->m_State == "创建")
		{
			if (it->m_Pmoney <= 50000 && this->m_role == 4)//部门副主管审批审批
			{
				system("cls");
				cout << "************************************欢迎进行审批!************************************" << endl;
				cout << endl << endl;
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << endl;
				cout << "请进行审批,Y/y(通过)N/n(不通过)...,输入P/p先终止返回菜单" << endl;
				string c;//判断通过与否
				cin >> c;
				if (c == "y" || c == "Y")
				{
					//cout << "通过,然后改日期,状态(部门审批)和处理人,后保存" << endl;
					//报单编号   提单人	  提单金额	   提单日期	   状态	处理人
					//这一顿操作就是修改信息,我已经麻了,输入错误则不会修改进展
					string state="部门审批";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "n" || c == "N")
				{
					//cout << "不通过,日期,状态(创建),处理人,保存" << endl;
					string state = "创建";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "p" || c == "P")
				{
					system("cls");
					this->OperMenu();
				}
				else
				{
					cout << "输入错误!"; system("pause");
				}
				i++;
			}
			else if (it->m_Pmoney > 50000 && it->m_Pmoney <= 100000 && this->m_role == 2)//部门主管的待审批信息
			{
				system("cls");
				cout << "************************************欢迎进行审批!************************************" << endl;
				cout << endl << endl;
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << endl;
				cout << "请进行审批,Y/y(通过)N/n(不通过)...,输入P/p先终止返回菜单" << endl;
				string c;
				cin >> c;
				if (c == "y" || c == "Y")
				{
					//cout << "通过,然后改日期,状态(部门审批)和处理人,后保存" << endl;
					string state = "部门审批";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "n" || c == "N")
				{
					//cout << "不通过,日期,状态(创建),处理人,保存" << endl;
					string state = "创建";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "p" || c == "P")
				{
					system("cls");
					this->OperMenu();
				}
				else
				{
					cout << "输入错误!"; system("pause");
				}
				i++;
			}
		}
		else if (it->m_State == "部门审批")
		{
			if (it->m_Pmoney <= 50000 && this->m_role == 3)//财务副主管审批审批
			{
				system("cls");
				cout << "************************************欢迎进行审批!************************************" << endl;
				cout << endl << endl;
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State << " 处理人为:" << it->m_Dealer << endl;
				cout << "请进行审批,Y/y(通过)N/n(不通过)...,输入P/p先终止返回菜单" << endl;
				string c;//选y/n的
				cin >> c;
				if (c == "y" || c == "Y")
				{
					/*cout << "通过,然后改日期,状态(财务审批)和处理人,后保存" << endl;	*/
					string state = "财务审批";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "n" || c == "N")
				{
					//cout << "不通过,日期,状态(创建),处理人,保存" << endl;
					string state = "创建";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "p" || c == "P")
				{
					system("cls");
					this->OperMenu();
				}
				else
				{
					cout << "输入错误!"; system("cls");
				}
				i++;
			}
			else if (it->m_Pmoney > 50000 && it->m_Pmoney <= 100000 && this->m_role == 1)//财务主管的待审批信息
			{
				system("cls");
				cout << "************************************欢迎进行审批!************************************" << endl;
				cout << endl << endl;
				cout << "第" << i << "条: 报销单编号:" << it->m_Pnum << " 工号为:" << it->m_Num <<
					" 提单金额为:" << it->m_Pmoney << " 提单日期为:" << it->m_Date
					<< " 状态为:" << it->m_State<< endl;
				cout << "请进行审批,Y/y(通过)N/n(不通过)...,输入P/p先终止返回菜单" << endl;
				string c;
				cin >> c;
				if (c == "y" || c == "Y")
				{
					//cout << "通过,然后改日期,状态(财务审批)和处理人,后保存" << endl;
					string state = "财务审批";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "n" || c == "N")
				{
					//cout << "不通过,日期,状态(创建),处理人,保存" << endl;
					string state = "创建";
					string date = p.GetDate();
					string dealer = this->m_Num;
					Progress p(it->m_Pnum, it->m_Num, it->m_Pmoney, date, state, dealer);
					p.InitVector();
					p.vPro.erase(p.vPro.begin() + j);
					p.vPro.insert(p.vPro.begin() + j, p);
					p.SaveVProgress(p.vPro);
				}
				else if (c == "p" || c == "P")
				{
					system("cls");
					this->OperMenu();
				}
				else
				{
					cout << "输入错误!"; system("pause");
				}
				i++;
			}
		}
		j++;
	}
	system("pause");
	system("cls");
}

//判断是否存在审批信息
bool Staff::IsExistAprove()
{
	Progress p;
	p.InitVector();
	for (vector<Progress>::iterator it = p.vPro.begin(); it != p.vPro.end(); it++)
	{
		if (it->m_State == "创建")
		{
			if (it->m_Pmoney <= 50000 && this->m_role == 4)//部门副主管审批审批
			{
				return true;
			}
			else if (it->m_Pmoney > 50000 && it->m_Pmoney <= 100000 && this->m_role == 2)
			{
				return true;
			}
		}
		else if (it->m_State == "部门审批")
		{
			if (it->m_Pmoney <= 50000 && this->m_role == 3)
			{
				return true;
			}
			else if (it->m_Pmoney > 50000 && it->m_Pmoney <= 100000 && this->m_role == 1)
			{
				return true;
			}
		}
	}
	return false;
}

//查询管理员信息
void Staff::ShowAdminInfo()
{
	ifstream ifs;
	ifs.open(ADMIN_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Admin a;
	while (ifs >> a.m_Id && ifs >> a.m_Password)
	{
		cout << "账号为:" << a.m_Id <<endl;
	}
	ifs.close();
	system("pause");
	system("cls");
}

//查询报销人员信息
void Staff::ShowPersonInfo()
{
	ifstream ifs;
	ifs.open(PERSON_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	cout << "报销人员的所有信息如下:" << endl;
	//工号 账号 密码 姓名 电话
	string num; string id; string password; string rname; string phone;
	while (ifs >> num && ifs >> id && ifs >> password && ifs >> rname && ifs >> phone)
	{
		cout << "工号为:" << num << " 账号为:" << id << " 密码为:" << password << " 姓名为:" << rname << " 电话为:" << phone << endl;
	}
	ifs.close();
	system("pause");
	system("cls");
}

//查询审批人员信息
void Staff::ShowStaffInfo()
{
	ifstream ifs;
	ifs.open(STAFF_FILE, ios::in);
	if (!ifs.is_open())
	{
		cout << "文件打开失败!" << endl;
		return;
	}
	Staff s;
	cout << "审批人员的所有信息如下:" << endl;
	while (ifs >> s.m_Num && ifs >> s.m_Id && ifs >> s.m_Password && ifs >> s.m_RealName && ifs >> s.m_PhoneNum && ifs >> s.m_role)
	{
		cout << "工号为:" << s.m_Num << " 账号为:" << s.m_Id <<" 姓名为:" << s.m_RealName << " 电话为:" <<
			s.m_PhoneNum << " 职责为:" << s.GetRole()<<" 审批额度为:"<<s.GetCheckMoney() << endl;
	}
	ifs.close();
	system("pause");
	system("cls");
}

//查询个人信息
void Staff::ShowOwnInfo()
{
	cout << "您的信息如下:" << endl;
	cout << "工号为:" << this->m_Num << " 账号为:" << this->m_Id
		<< " 姓名为:" << this->m_RealName << " 电话为:" << this->m_PhoneNum <<" 职责为:"<<this->GetRole() << endl;
}

//修改个人信息
void Staff::ChangeInfo()
{
	//cout << "只能修改账号,密码和电话号码!..." << endl;
	system("cls");
	cout << "************************************欢迎审批人员进入修改界面!************************************" << endl;
	cout << endl << endl;
	cout << "\t\t ----------------------------------------------------" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  1. 修  改  账  号                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  2. 修  改  密  码                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  3. 修  改  电  话                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t|                  0. 取  消  操  作                 |" << endl;
	cout << "\t\t|                                                    |" << endl;
	cout << "\t\t ----------------------------------------------------" << endl;
	this->ShowOwnInfo();//展示个人信息
	cout << "请输入您要进行的选择:";
	MyVector v;
	v.InitVSta();
	int j = 0;
	for (vector<Staff>::iterator it = v.vSta.begin(); it != v.vSta.end(); it++)
	{
		if (it->m_Num == this->m_Num)
		{
			string choice; //选择
			cin >> choice;
			if (choice == "1")
			{
				string Oripsw;
				cout << "请输入原密码进行身份确认:"; cin >> Oripsw;
				if (Oripsw == this->m_Password)
				{
					string id1, id2;
					cout << "请输入新的账号:"; cin >> id1;
					cout << "请再次确认新账号:"; cin >> id2;
					if (id1 == id2)
					{
						//工号 账号 密码 真实姓名 电话
						this->m_Id = id1;
						v.vSta.erase(v.vSta.begin() + j);
						v.vSta.insert(v.vSta.begin() + j, *this);
						v.SaveVSta(v.vSta);
						cout << "账号修改成功!";
					}
					else
					{
						cout << "两次输入的新账号不一致!" << endl;
					}
				}
				else
				{
					cout << "身份验证失败,无法进行修改!";
				}
			}
			else if (choice == "2")
			{
				string Oripsw;
				cout << "请输入原密码进行身份确认:"; cin >> Oripsw;
				if (Oripsw == this->m_Password)
				{
					string psw1, psw2;
					cout << "请输入新的密码:"; cin >> psw1;
					cout << "请再次确认新密码:"; cin >> psw2;
					if (psw1 == psw2)
					{
						//工号 账号 密码 真实姓名 电话
						this->m_Password = psw1;//新密码
						v.vSta.erase(v.vSta.begin() + j);
						//把自身属性修改后插入vector容器相应位置中
						v.vSta.insert(v.vSta.begin() + j, *this);
						v.SaveVSta(v.vSta);
						cout << "密码修改成功!" << endl;
					}
					else
					{
						cout << "两次输入的新密码不一致!" << endl;
					}
				}
				else
				{
					cout << "身份验证失败,无法进行修改!";
				}
			}
			else if (choice == "3")
			{
				string phone;
				cout << "请输入您的新电话号码:"; cin >> phone;
				//工号 账号 密码 真实姓名 电话
				this->m_PhoneNum = phone;
				v.vSta.erase(v.vSta.begin() + j);
				v.vSta.insert(v.vSta.begin() + j, *this);
				v.SaveVSta(v.vSta);
				cout << "电话修改成功!";
			}
			else if (choice == "0");//取消操作
			else
			{
				cout << "输入选项错误!" << endl;
			}
			system("pause");
			system("cls");
			return;
		}
		j++;
	}
}

  • 4
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值