⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 report.h

📁 C++课程设计的作业
💻 H
字号:
//*****************************
//任  务:C++课程设计
//题  目:图书管理系统
//作  者:040630520彭立勋
//题  号:课程设计Final
//用  途:报表模块的头文件
//文件名:Report.h
//最后更新日期:2007.6.10
//*****************************

#ifndef REPORTDEF_H
#define REPORTDEF_H

/*函数声明列表*/
void Screen(Sale &,BookData &);
void Report(Sale &,BookData &);

BookData Dat[1000];

/*实现部分*/
void ReadAllBook()//读入所有数据
{
	for(int i = 0 ; i < NUM ; i++)
		FileWork::ReadFromFile( i+1 ,Dat[i] );
}

void AllList(Sale &T,BookData &S)
{
	int i,j;
	
	CLS;
	for(i=0,j=0;i<NUM;i++)
	{
		if( !Dat[i].IsEmpty())
		{
			Dat[i].BookInfo();
			j++;
		}
		if( j%2 == 0)
		{
			cout<<"\n执行过程中要停止请按'E'";
			if(  toupper( getchar() ) == 'E' )
				Report(T,S);
			CLS;
		}
	}
}

void WhlesaleList(Sale &T,BookData &S)
{
	int i,j;
	float Sum=0;
	
	CLS;
	for(i=0,j=0;i<NUM;i++)
	{
		if( !Dat[i].IsEmpty())
		{
			cout<<TAB<<"ISBN  号: "<<Dat[i].GetISBN()
				<<TAB<<"书    名: "<<Dat[i].GetTitle()
				<<TAB<<"批 发 价: "<<Dat[i].GetWholesale()
				<<endl;
			Sum+=Dat[i].GetWholesale();
			j++;
		}
		if( j%5 == 0)
		{
			cout<<"\n执行过程中要停止请按'E'";
			if(  toupper( getchar() ) == 'E' )
				Report(T,S);
			CLS;
		}
	}
	cout<<TAB<<"总批发价值为 : "<<Sum<<endl;
}

void RetailList(Sale &T,BookData &S)
{
	int i,j;
	float Sum=0;
	
	CLS;
	for(i=0,j=0;i<NUM;i++)
	{
		if( !Dat[i].IsEmpty())
		{
			cout<<TAB<<"ISBN  号: "<<Dat[i].GetISBN()
				<<TAB<<"书    名: "<<Dat[i].GetTitle()
				<<TAB<<"零 售 价: "<<Dat[i].GetRetail()
				<<endl;
			Sum+=Dat[i].GetRetail();
			j++;
		}
		if( j%5 == 0)
		{
			cout<<"\n执行过程中要停止请按'E'";
			if(  toupper( getchar() ) == 'E' )
				Report(T,S);
			CLS;
		}
	}
	cout<<TAB<<"总零售价值为 : "<<Sum<<endl;
}

void QtyList(Sale &T,BookData &S)
{
	int i,j;

	CLS;
	Sort(1,Dat);
	for(i=0,j=0;i<NUM;i++)
	{
		if( !Dat[i].IsEmpty())
		{
			cout<<TAB<<"ISBN  号: "<<Dat[i].GetISBN()
				<<TAB<<"书    名: "<<Dat[i].GetTitle()
				<<TAB<<"库 存 量: "<<Dat[i].GetQty()
				<<endl;
			j++;
		}
		if( j%5 == 0)
		{
			cout<<"\n执行过程中要停止请按'E'";
			if(  toupper( getchar() ) == 'E' )
				Report(T,S);
			CLS;
		}
	}
}

void ValueList(Sale &T,BookData &S)
{
	int i,j;
	
	CLS;
	Sort(2,Dat);//对Dat[i]按Value排序
	for(i=0,j=0;i<NUM;i++)
	{
		if( !Dat[i].IsEmpty())
		{
			cout<<TAB<<"ISBN  号: "<<Dat[i].GetISBN()
				<<TAB<<"书    名: "<<Dat[i].GetTitle()
				<<TAB<<"价 值 额: "<<Dat[i].GetQty()*Dat[i].GetWholesale()
				<<endl;
			j++;
		}
		if( j%5 == 0)
		{
			cout<<"\n执行过程中要停止请按'E'";
			if(  toupper( getchar() ) == 'E' )
				Report(T,S);
			CLS;
		}
	}
}

void DateList(Sale &T,BookData &S)
{
	int i,j;
	
	CLS;
	Sort(3,Dat);//对Dat[i]按Date排序
	for(i=0,j=0;i<NUM;i++)
	{
		if( !Dat[i].IsEmpty())
		{
			cout<<TAB<<"ISBN  号: "<<Dat[i].GetISBN()
				<<TAB<<"书    名: "<<Dat[i].GetTitle()
				<<TAB<<"进书日期: "<<Dat[i].GetDateAdded()
				<<endl;
			j++;
		}
		if( j%5 == 0)
		{
			cout<<"\n执行过程中要停止请按'E'";
			if(  toupper( getchar() ) == 'E' )
				Report(T,S);
			CLS;
		}
	}
}

void Report(Sale &T,BookData &S)
{
	int Command;
	
	ReadAllBook();
	while(true)
	{
		/*操作界面*/
		CLS;
		cout<<TAB<<"\tNUAA图书管理系统"
			<<"\n"<<TAB<<"\t    报表模块\n"
			<<TAB<<"\t 1. 书库列表"
			<<TAB<<"\t 2. 批发价列表"
			<<TAB<<"\t 3. 零售价列表"
			<<TAB<<"\t 4. 按书的数量列表"
			<<TAB<<"\t 5. 按书的价值额列表"
			<<TAB<<"\t 6. 按进书日期列表"
			<<TAB<<"\t 7. 返回到主菜单\n"
			<<endl;
		/*处理操作*/
		cout<<TAB<<"\t输入选择 : ";
		cin>>Command;
		CBUF;
		switch(Command)
		{
				case 1:AllList(T,S);break;
				case 2:WhlesaleList(T,S);break;
				case 3:RetailList(T,S);break;
				case 4:QtyList(T,S);break;
				case 5:ValueList(T,S);break;
				case 6:DateList(T,S);break;
				case 7:Screen(T,S);break;
				default:ERR;break;
		}
	}
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -