print_information.h 整体打印(全部信息)
//////////////////////////////////////////////////
/*
整体打印(全部信息)
*/
void print_information(int type,plink head){
plink p;
p=head;
char part[20],model[20],mfts[20],name[20];
printf("Computer accessories purchaseles management system\n\n");
switch(type){
case 1:
printf("Purchase record information\n");
break;
case 2:
printf("Wholesale sales imformation\n");
break;
case 3:
printf("Retail sales imformation\n");
}
printf(" _____________________________________________________________________________ \n");
printf(" |Time_|Part|Model|Mfts|Unit|Num|Total|Name|\n");
while(p->next!=NULL)
{
if(p->judge_delete==0)
{
printf(" | %2d,",p->time.month);
if(p->time.day<=9) printf("0"); printf("%d ",p->time.day);
if(p->time.hour<=9) printf("0"); printf("%d:",p->time.hour);
if(p->time.minute<=9) printf("0"); printf("%d ",p->time.minute);
switch_int_to_name(4,p->part,part);
switch_int_to_name(5,p->model,model);
switch_int_to_name(1,p->mfts,mfts);
switch_int_to_name(1,p->name,name);
printf("|%10s|%11s|%10s|%10.2f|%7d|%11.2f|%10s|\n",part,model,mfts,p->unit,p->num,p->total,name);
}
p=p->next;
}
if(p->judge_delete==0)
{
printf(" | %2d,",p->time.month);
if(p->time.day<=9)//统一格式(若数值小于10,则打印0X) printf("0"); printf("%d ",p->time.day);
if(p->time.hour<=9) printf("0"); printf("%d:",p->time.hour);
if(p->time.minute<=9) printf("0"); printf("%d ",p->time.minute);
switch_int_to_name(4,p->part,part);
switch_int_to_name(5,p->model,model);
switch_int_to_name(1,p->mfts,mfts);
switch_int_to_name(1,p->name,name);
printf("|%10s|%11s|%10s|%10.2f|%7d|%11.2f|%10s|\n",part,model,mfts,p->unit,p->num,p->total,name);
}
printf(" |_|_|__|_|_|||__|\n");
}