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

output.h 输出可视化表格函数

void outputcsv_all(){
FILE *fp_save;
char part[20],model[20],mfts[20],name[20];
fp_save=fopen("../visible_table/purchase_visible.csv","w");
read(1);
plink p=head;
fprintf(fp_save,"时间,配件名称,型号,制造商,单价,总数,总价,供应商\n");
//fprintf(fp_save,"月,日,时,分,配件名称,型号,制造商,单价,总数,总价,供应商,是否删除\n");
while(p!=NULL){
fprintf(fp_save,"2019.");
if(p->time.month<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d.",p->time.month);
if(p->time.day<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d ",p->time.day);
if(p->time.hour<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d:",p->time.hour);
if(p->time.minute<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%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);
fprintf(fp_save,"%s,%s,%s,%.2f,%d,%.2f,%s\n",part,model,mfts,p->unit,p->num,p->total,name);
p=p->next;
}
fclose(fp_save);
fp_save=fopen("../visible_table/wholesale_visible.csv","w");
read(2);
p=head;
fprintf(fp_save,"时间,配件名称,型号,制造商,单价,总数,总价,客户\n");
//fprintf(fp_save,"月,日,时,分,配件名称,型号,制造商,单价,总数,总价,供应商,是否删除\n");
while(p!=NULL){
fprintf(fp_save,"2019.");
if(p->time.month<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d.",p->time.month);
if(p->time.day<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d ",p->time.day);
if(p->time.hour<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d:",p->time.hour);
if(p->time.minute<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%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);
fprintf(fp_save,"%s,%s,%s,%.2f,%d,%.2f,%s\n",part,model,mfts,p->unit,p->num,p->total,name);
p=p->next;
}
fclose(fp_save);
fp_save=fopen("../visible_table/retail_visible.csv","w");
read(3);
p=head;
fprintf(fp_save,"时间,配件名称,型号,制造商,单价,总数,总价,顾客\n");
//fprintf(fp_save,"月,日,时,分,配件名称,型号,制造商,单价,总数,总价,供应商,是否删除\n");
while(p!=NULL){
fprintf(fp_save,"2019.");
if(p->time.month<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d.",p->time.month);
if(p->time.day<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d ",p->time.day);
if(p->time.hour<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%d:",p->time.hour);
if(p->time.minute<=9)
fprintf(fp_save,"0");
fprintf(fp_save,"%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);
fprintf(fp_save,"%s,%s,%s,%.2f,%d,%.2f,%s\n",part,model,mfts,p->unit,p->num,p->total,name);
p=p->next;
}
fclose(fp_save);
}

点赞

发表评论