程设小组作业——计算机配件的进货/销售管理系统

print_information_deleted.h 整体打印(已删除)

//////////////////////////////////////////////////
 /*
     查询已删除记录 
 */
 void print_information_deleted(int type,plink head){
     plink p;
     p=head;
     int No;
     int i=1;
     char part[20],model[20],mfts[20],name[20],judge;
     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("               |No.|Time_|Part|Model|Mfts|Unit|Num|Total|Name|\n");
     while(p->next!=NULL)
     {
         if(p->judge_delete==1)
         {
             printf("               |  %2d | %2d,",i,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);
             i++;
         }
         p=p->next;
     }
     if(p->judge_delete==1)
     {
         printf("               |  %2d | %2d,",i,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");
 recovery:
     getchar();
     printf("\n                Do you want to recovery record?(Y/N):");
     scanf("%c",&judge);
     if(judge=='Y'||judge=='y')
     {
         printf("                please input which imform you want to modify:");
         scanf("%d",&No);
         plink previous=inquire_information_code_deleted(head,No);
         printf("                the information will be recovered,do you confirm?(Y/N):");
         getchar();
         scanf("%c",&judge);
         if(judge=='Y'||judge=='y')
         {
             previous->judge_delete=0;
             printf("                Complete!");
             save(type);
         }
         else
         {
             goto recovery;
         }
     }
 }

点赞

发表评论