超市倉庫管理系統(tǒng)-程序_第1頁
超市倉庫管理系統(tǒng)-程序_第2頁
超市倉庫管理系統(tǒng)-程序_第3頁
超市倉庫管理系統(tǒng)-程序_第4頁
超市倉庫管理系統(tǒng)-程序_第5頁
已閱讀5頁,還剩71頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

年5月29日超市倉庫管理系統(tǒng)_程序文檔僅供參考超市倉庫管理系統(tǒng)程序如下:#include<stdio.h>#include<stdlib.h>#include<string.h>#include<malloc.h>#include"倉庫管理系統(tǒng).h"#defineN500#defineLENsizeof(structproduct)#defineILENsizeof(structin_product)#defineOLENsizeof(structout_product)#defineQLENsizeof(structquit_product)voidinit(){head=NULL;qhead=NULL;ihead=NULL;ohead=NULL;printf("\t\t★★★★★★★★★★★★★★★★★★★★★★★★★★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★********************★\n");printf("\t\t★**★\n"); printf("\t\t★*♀歡迎進入♀*★\n"); printf("\t\t★**★\n");printf("\t\t★*超市倉庫管理系統(tǒng)*★\n"); printf("\t\t★**★\n"); printf("\t\t★********************★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n");printf("\t\t\t\t1:入庫管理\n");printf("\t\t\t\t2:出庫管理\n");printf("\t\t\t\t3:退貨管理\n");printf("\t\t\t\t4:商品統(tǒng)計\n");printf("\t\t\t\t0:退出系統(tǒng)\n");}voidmenu(){ printf("\t\t\t\t1:添加數(shù)據(jù)\n");printf("\t\t\t\t2:刪除數(shù)據(jù)\n");printf("\t\t\t\t3:修改數(shù)據(jù)\n");printf("\t\t\t\t4:查看數(shù)據(jù)\n");printf("\t\t\t\t其它:退回上一級菜單\n");}voidmenu2(){ printf("\t\t★★★★★★★★★★★★★★★★★★★★★★★★★★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★********************★\n");printf("\t\t★**★\n"); printf("\t\t★*♀歡迎進入♀*★\n"); printf("\t\t★**★\n");printf("\t\t★*超市倉庫管理系統(tǒng)*★\n"); printf("\t\t★**★\n"); printf("\t\t★********************★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★★\n"); printf("\t\t★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n");printf("\t\t\t\t1:入庫管理\n");printf("\t\t\t\t2:出庫管理\n");printf("\t\t\t\t3:退貨管理\n");printf("\t\t\t\t4:商品統(tǒng)計\n");printf("\t\t\t\t0:退出系統(tǒng)\n");printf("\n\t\t\t\t輸入錯誤,請重新輸入!\n");}intRkjl()//入庫信息錄入文件{structin_productp[N],s;inti=0,j,n;FILE*pf,*pf1;pf=fopen("入庫信息記錄.dat","rb+");pf1=fopen("入庫信息記錄.xls","r+");//printf("入庫編號商品編號入庫商品名入庫數(shù)量入庫價格總價\n");for(i=0;fread(&p[i],ILEN,1,pf)!=NULL;i++); //printf("%ld\t%s\t%s\t%d\t%d\t%d\n",p[i].num,p[i].p_num,p[i].name,p[i].amount,p[i].price,p[i].t_price);for(j=0;j<i;j++) for(n=0;n<i-1;n++) if(p[n].num>p[n+1].num)//入庫編號小的先錄入 { s=p[n];p[n]=p[n+1];p[n+1]=s; } rewind(pf); fseek(pf1,56L,0); for(j=0;j<i;j++) { fwrite(&p[j],ILEN,1,pf); fprintf(pf1,"%ld\t%s\t%s\t%d\t%d\t%d\n",p[j].num,p[j].p_num,p[j].name,p[j].amount,p[j].price,p[j].t_price); }fclose(pf);fclose(pf1); return0;}intCkjl()//出庫信息錄入文件{structout_productp[N],s;inti,j,n;FILE*pf,*pf1;pf=fopen("出庫信息記錄.dat","rb+");pf1=fopen("出庫信息記錄.xls","r+");//printf("出庫編號商品編號出庫商品名出庫數(shù)量出庫價格總價\n");for(i=0;fread(&p[i],OLEN,1,pf)!=NULL;i++); //printf("%ld\t%s\t%s\t%d\t%d\t%d\n",p[i].num,p[i].p_num,p[i].name,p[i].amount,p[i].price,p[i].t_price);for(j=0;j<i;j++) for(n=0;n<i-1;n++) if(p[n].num>p[n+1].num)//出庫編號小的先錄入 { s=p[n];p[n]=p[n+1];p[n+1]=s; } rewind(pf); fseek(pf1,56L,0); for(j=0;j<i;j++) { fwrite(&p[j],OLEN,1,pf); fprintf(pf1,"%ld\t%s\t%s\t%d\t%d\t%d\n",p[j].num,p[j].p_num,p[j].name,p[j].amount,p[j].price,p[j].t_price); }fclose(pf);fclose(pf1); return0;}intThjl()//退貨信息錄入文件{structquit_productp[N],s;inti,j,n;FILE*pf,*pf1;pf=fopen("退貨信息記錄.dat","rb+");pf1=fopen("退貨信息記錄.xls","r+");for(i=0;fread(&p[i],QLEN,1,pf)!=NULL;i++); for(j=0;j<i;j++) for(n=0;n<i-1;n++) if(p[n].num>p[n+1].num)//退貨編號小的先錄入 { s=p[n];p[n]=p[n+1];p[n+1]=s; } rewind(pf); fseek(pf1,56L,0); for(j=0;j<i;j++) { fwrite(&p[j],QLEN,1,pf); fprintf(pf1,"%ld\t%s\t%s\t%d\t%d\t%d\n",p[j].num,p[j].p_num,p[j].name,p[j].amount,p[j].price,p[j].t_price); }fclose(pf);fclose(pf1); return0;}intinsert_product()//添加商品數(shù)據(jù)并錄入文件{ structproduct*p1,*p; FILE*pf;if((pf=fopen("商品信息記錄.xls","r"))==NULL) { pf=fopen("商品信息記錄.xls","w"); fprintf(pf,"%s\t%s\t%s\t%s\t%s\t%s\n","商品編號","商品名","型號/規(guī)格","商品數(shù)量","進貨價","銷售價"); fclose(pf); } pf=fopen("商品信息記錄.xls","a+"); p1=(structproduct*)malloc(LEN); p=head; if(p==NULL) {printf("\n下列數(shù)據(jù)將錄入\"商品信息記錄\"文件中!\n"); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n商品名:"); scanf("%s",&p1->name); printf("\n型號/規(guī)格:"); scanf("%s",&p1->spec); printf("\n商品數(shù)量:"); scanf("%d",&p1->amount); printf("\n進貨價:"); scanf("%d",&p1->price); printf("\n銷售價:"); scanf("%d",&p1->s_price); fprintf(pf,"%s\t%s\t%s\t%d\t%d\t%d\n",p1->p_num,p1->name,p1->spec,p1->amount,p1->price,p1->s_price); fclose(pf); head=p1; head->next=NULL; return0; } while(p->next!=NULL)//把指針移到鏈表末端,在鏈表末端插入數(shù)據(jù) p=p->next; p->next=p1; printf("\n下列數(shù)據(jù)將錄入\"商品信息記錄\"文件中!\n"); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n商品名:"); scanf("%s",&p1->name); printf("\n型號/規(guī)格:"); scanf("%s",&p1->spec); printf("\n商品數(shù)量:"); scanf("%d",&p1->amount); printf("\n進貨價:"); scanf("%d",&p1->price); printf("\n銷售價:"); scanf("%d",&p1->s_price); fprintf(pf,"%s\t%s\t%s\t%d\t%d\t%d\n",p1->p_num,p1->name,p1->spec,p1->amount,p1->price,p1->s_price); fclose(pf); p1->next=NULL; return0;}intin_insert()//添加入庫數(shù)據(jù){ structin_product*p1,*p2; intn=0; charc[5]; FILE*pf;system("cls"); pf=fopen("入庫信息記錄.dat","ab+"); p1=p2=(structin_product*)malloc(ILEN); printf("\t\t\t**輸入入庫商品信息**\n");printf("\n下列數(shù)據(jù)將錄入\"入庫信息記錄\"文件中!\n"); printf("\n入庫編號:"); scanf("%ld",&p1->num); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n入庫商品名:"); scanf("%s",&p1->name); printf("\n入庫數(shù)量:"); scanf("%d",&p1->amount); printf("\n入庫價格:"); scanf("%d",&p1->price); p1->t_price=p1->amount*p1->price; printf("\n總價:"); printf("%d\n",p1->t_price); fwrite(p1,ILEN,1,pf); insert_product(); ihead=NULL; while(1) { n=n+1; if(n==1) ihead=p1; elsep2->next=p1; p2=p1; p1=(structin_product*)malloc(ILEN); while(1) { printf("\n退出輸入請按Y/y鍵,任意鍵繼續(xù):"); scanf("%s",c); if(strcmp(c,"y")==0||strcmp(c,"Y")==0) {fclose(pf); p2->next=NULL; return0; } elsebreak; } printf("\n下列數(shù)據(jù)將錄入\"入庫信息記錄\"文件中!\n"); printf("\n入庫編號:"); scanf("%ld",&p1->num); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n入庫商品名:"); scanf("%s",&p1->name); printf("\n入庫數(shù)量:"); scanf("%d",&p1->amount); printf("\n入庫價格:"); scanf("%d",&p1->price); p1->t_price=p1->amount*p1->price; printf("\n總價:"); printf("%d\n",p1->t_price); fwrite(p1,ILEN,1,pf); insert_product(); } fclose(pf); p2->next=NULL; return0;}intin_modify()//修改入庫數(shù)據(jù){ system("cls"); longm_num; FILE*fp,*fp1; inti,j,n; intt=3; structin_productxg[N]; fp=fopen("入庫信息記錄.dat","rb+");fp1=fopen("入庫信息記錄.xls","r+"); printf("入庫編號商品編號入庫商品名入庫數(shù)量入庫價格總價\n");printf("\n"); for(i=0;fread(&xg[i],ILEN,1,fp)!=NULL;i++) { printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", xg[i].num,xg[i].p_num,xg[i].name,xg[i].amount,xg[i].price,xg[i].t_price); printf("\n"); } printf("輸入要修改的商品的入庫編號:");IXG:scanf("%ld",&m_num); j=0; while(j<i) { if(xg[j].num==m_num) { printf("\t\t\t輸入新的入庫商品信息!\n"); printf("\n商品編號:"); scanf("%s",&xg[j].p_num); printf("\n入庫商品名:"); scanf("%s",&xg[j].name); printf("\n入庫數(shù)量:"); scanf("%d",&xg[j].amount); printf("\n入庫價格:"); scanf("%d",&xg[j].price); xg[j].t_price=xg[j].amount*xg[j].price; printf("\n總價:"); printf("%d\n",xg[j].t_price); printf("\t\t\t商品信息修改成功!\n"); printf("入庫編號商品編號入庫商品名入庫數(shù)量入庫價格總價\n"); printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", xg[j].num,xg[j].p_num,xg[j].name,xg[j].amount,xg[j].price,xg[j].t_price); rewind(fp); fseek(fp1,56L,0); for(n=0;n<i;n++) { fwrite(&xg[n],ILEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n",xg[n].num,xg[n].p_num,xg[n].name,xg[n].amount,xg[n].price,xg[n].t_price); } fclose(fp); fclose(fp1); printf("按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該入庫編號,請重新輸入,還有[%d]次機會:",t); gotoIXG;}intin_select()//查詢入庫數(shù)據(jù){ system("cls"); FILE*fp; inti,j; intt=3; longs_num; structin_productcx[N]; if((fp=fopen("入庫信息記錄.dat","rb"))==NULL) { printf("cannotopenfile\n"); exit(0); } printf("\t\t\t\n"); printf("\t\t\t★入庫貨物統(tǒng)計如下★\n"); printf("\t\t\t\n\n"); printf("入庫編號商品編號入庫商品名入庫數(shù)量入庫價格總價\n"); printf("\n"); for(i=0;fread(&cx[i],ILEN,1,fp)!=NULL;i++) { printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", cx[i].num,cx[i].p_num,cx[i].name,cx[i].amount,cx[i].price,cx[i].t_price); printf("\n"); } fclose(fp); printf("輸入要查詢的入庫編號:");ICX:scanf("%ld",&s_num);j=0; while(j<i) { if(cx[j].num==s_num) { printf("\n查詢結果如下:\n\n"); printf("入庫編號商品編號入庫商品名入庫數(shù)量入庫價格總價\n"); printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", cx[j].num,cx[j].p_num,cx[j].name,cx[j].amount,cx[j].price,cx[j].t_price); printf("按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該入庫編號,還有[%d]次機會,請重新輸入:",t); gotoICX; }intin_delete()//刪除入庫數(shù)據(jù),若所要取出的商品數(shù)量小于商品總數(shù)量,則是商品總數(shù)減少 //若取出所有商品數(shù)量,則刪除那一行數(shù)據(jù){ system("cls"); inti,n,j; intt=3; ints;longd_num;structin_productsc[N];FILE*fp,*fp1; fp=fopen("入庫信息記錄.dat","rb+"); for(i=0;fread(&sc[i],ILEN,1,fp)!=NULL;i++); printf("輸入要取出的商品的入庫編號:"); ISC:scanf("%ld",&d_num); printf("\n輸入要取出的商品的數(shù)量:"); scanf("%d",&s); j=0;while(j<i) {if(sc[j].num==d_num) { fp=fopen("入庫信息記錄.dat","wb+"); fp1=fopen("入庫信息記錄.xls","w"); fprintf(fp1,"%s\t%s\t%s\t%s\t%s\t%s\n","入庫編號","商品編號","入庫商品名","入庫數(shù)量","入庫價格","總價"); if((sc[j].amount-s)==0) { for(n=j;n<i-1;n++) sc[n]=sc[n+1]; fseek(fp1,56L,0); for(n=0;n<i-1;n++) { fwrite(&sc[n],ILEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n",sc[n].num,sc[n].p_num,sc[n].name,sc[n].amount,sc[n].price,sc[n].t_price); } } elseif((sc[j].amount-s)>0) { sc[j].amount-=s; fseek(fp1,56L,0); for(n=0;n<i;n++) { fwrite(&sc[n],ILEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n", sc[n].num,sc[n].p_num,sc[n].name,sc[n].amount,sc[n].price,sc[n].t_price); } } else { printf("\n沒有這么多的庫存量!\n"); printf("\n按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } fclose(fp); fclose(fp1);printf("\n☆商品已成功取出!\n\n"); printf("按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該入庫編號,還有[%d]次機會,請重新輸入:",t); gotoISC; return0;} intout_insert()//增加出庫數(shù)據(jù) //刪除了入庫數(shù)據(jù),則把該數(shù)據(jù)信息增加到”輸入出庫商品信息”文件中 { system("cls");structout_product*p1,*p2;intn=0;charc[5];FILE*pf;pf=fopen("出庫信息記錄.dat","ab+"); p1=p2=(structout_product*)malloc(OLEN); printf("\t\t\t**輸入出庫商品信息**\n\n"); printf("下列數(shù)據(jù)將錄入\"出庫信息記錄\"文件中!\n"); printf("\n出庫編號:"); scanf("%ld",&p1->num); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n出庫商品名:"); scanf("%s",&p1->name); printf("\n出庫數(shù)量:"); scanf("%d",&p1->amount); printf("\n出庫價格:"); scanf("%d",&p1->price); p1->t_price=p1->amount*p1->price; printf("\n總價:"); printf("%d\n",p1->t_price); fwrite(p1,OLEN,1,pf); ohead=NULL;while(1) { n=n+1;if(n==1)ohead=p1;elsep2->next=p1;p2=p1;p1=(structout_product*)malloc(OLEN);while(1) { printf("退出輸入請按Y/y鍵,任意鍵繼續(xù):"); scanf("%s",c); if(strcmp(c,"y")==0||strcmp(c,"Y")==0) {fclose(pf); p2->next=NULL; return0; } elsebreak; } printf("\n出庫編號:"); scanf("%ld",&p1->num); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n出庫商品名:"); scanf("%s",&p1->name); printf("\n出庫數(shù)量:"); scanf("%d",&p1->amount); printf("\n出庫價格:"); scanf("%d",&p1->price); p1->t_price=p1->amount*p1->price; printf("\n總價:"); printf("%d\n",p1->t_price); fwrite(p1,OLEN,1,pf);}fclose(pf);p2->next=NULL;return0;}intout_modify() //修改出庫數(shù)據(jù) //相當于更新”出庫信息記錄”中的內容{system("cls"); longm_num;FILE*fp,*fp1;inti,j,n; intt=3;structout_productxg[N]; fp=fopen("出庫信息記錄.dat","rb+");fp1=fopen("出庫信息記錄.xls","r+"); printf("出庫編號商品編號出庫商品名出庫數(shù)量出庫價格總價\n"); printf("\n"); for(i=0;fread(&xg[i],OLEN,1,fp)!=NULL;i++) { printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", xg[i].num,xg[i].p_num,xg[i].name,xg[i].amount,xg[i].price,xg[i].t_price); printf("\n"); } printf("輸入要修改的商品的出庫編號:");OXG:scanf("%ld",&m_num); j=0;while(j<i) {if(xg[j].num==m_num) {printf("\n\t\t\t輸入新的出庫商品信息!\n"); printf("\n商品編號:"); scanf("%s",&xg[j].p_num); printf("\n出庫商品名:"); scanf("%s",&xg[j].name); printf("\n出庫數(shù)量:"); scanf("%d",&xg[j].amount); printf("\n出庫價格:"); scanf("%d",&xg[j].price); xg[j].t_price=xg[j].price*xg[j].amount; printf("\n總價:"); printf("%d\n",xg[j].t_price); printf("\t\t\t商品信息修改成功!\n"); printf("出庫編號商品編號出庫商品名出庫數(shù)量出庫價格總價\n"); printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", xg[j].num,xg[j].p_num,xg[j].name,xg[j].amount,xg[j].price,xg[j].t_price); rewind(fp); fseek(fp1,56L,0); for(n=0;n<i;n++) {fwrite(&xg[n],OLEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n",xg[n].num,xg[n].p_num,xg[n].name,xg[n].amount,xg[n].price,xg[n].t_price); } fclose(fp); fclose(fp1); printf("按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該出庫編號,還有[%d]次機會,請重新輸入:",t); gotoOXG;}intout_select()//查詢出庫數(shù)據(jù){ system("cls"); FILE*fp;inti,j; intt=3;longs_num; structout_productcx[N]; if((fp=fopen("出庫信息記錄.dat","rb"))==NULL) { printf("cannotopenfile\n"); exit(0); } printf("\t\t\t\n"); printf("\t\t\t★出庫貨物統(tǒng)計如下★\n"); printf("\t\t\t\n\n"); printf("出庫編號商品編號出庫商品名出庫數(shù)量出庫價格總價\n"); printf("\n"); for(i=0;fread(&cx[i],OLEN,1,fp)!=NULL;i++) { printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", cx[i].num,cx[i].p_num,cx[i].name,cx[i].amount,cx[i].price,cx[i].t_price); printf("\n"); } fclose(fp); printf("輸入要查詢的出庫編號:");OCX:scanf("%ld",&s_num); j=0; while(j<i) { if(cx[j].num==s_num) { printf("\n查詢結果如下:\n\n"); printf("出庫編號商品編號出庫商品名出庫數(shù)量出庫價格總價\n"); printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", cx[j].num,cx[j].p_num,cx[j].name,cx[j].amount,cx[j].price,cx[j].t_price); printf("按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該出庫編號,還有[%d]次機會,請重新輸入:",t); gotoOCX;}intout_delete()//刪除出庫數(shù)據(jù){ system("cls"); inti,n,j; intt=3;longd_num;structout_productsc[N];FILE*fp,*fp1; fp=fopen("出庫信息記錄.dat","rb+"); for(i=0;fread(&sc[i],OLEN,1,fp)!=NULL;i++); printf("輸入要刪除的商品的出庫編號:");OSC:scanf("%ld",&d_num); j=0;while(j<i) {if(sc[j].num==d_num) {for(n=j;n<i-1;n++) sc[n]=sc[n+1]; fp=fopen("出庫信息記錄.dat","wb+");fp1=fopen("出庫信息記錄.xls","w"); fprintf(fp1,"%s\t%s\t%s\t%s\t%s\t%s\n","出庫編號","商品編號","出庫商品名","出庫數(shù)量","出庫價格","總價"); fseek(fp1,56L,0); for(n=0;n<i-1;n++) {fwrite(&sc[n],ILEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n",sc[n].num,sc[n].p_num,sc[n].name,sc[n].amount,sc[n].price,sc[n].t_price); } fclose(fp); fclose(fp1); printf("刪除成功!\n"); printf("按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該出庫編號,還有[%d]次機會,請重新輸入:",t); gotoOSC;}intquit_insert()//添加退貨數(shù)據(jù){ system("cls");structquit_product*p1,*p2;intn=0;charc[5];FILE*pf;pf=fopen("退貨信息記錄.dat","ab+"); p1=p2=(structquit_product*)malloc(QLEN); printf("\t\t\t**輸入退還貨物信息**\n"); printf("\n下列數(shù)據(jù)將錄入\"退貨信息記錄\"文件之中!\n"); printf("\n退貨編號:"); scanf("%ld",&p1->num); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n退還貨物名:"); scanf("%s",&p1->name); printf("\n退貨數(shù)量:"); scanf("%d",&p1->amount); printf("\n退貨價格:"); scanf("%d",&p1->price); p1->t_price=p1->price*p1->amount; printf("\n總價:"); printf("%d\n",p1->t_price); fwrite(p1,QLEN,1,pf); qhead=NULL;while(1) { n=n+1;if(n==1)qhead=p1;elsep2->next=p1; p2=p1; p1=(structquit_product*)malloc(QLEN);while(1) { printf("退出輸入請按Y/y鍵,任意鍵繼續(xù):"); scanf("%s",c); if(strcmp(c,"y")==0||strcmp(c,"Y")==0) {fclose(pf); p2->next=NULL; return0; } elsebreak; } printf("\n退貨編號:"); scanf("%ld",&p1->num); printf("\n商品編號:"); scanf("%s",&p1->p_num); printf("\n退還貨物名:"); scanf("%s",&p1->name); printf("\n退貨數(shù)量:"); scanf("%d",&p1->amount); printf("\n退貨價格:"); scanf("%d",&p1->price); p1->t_price=p1->price*p1->amount; printf("\n總價:"); printf("%d\n",p1->t_price); fwrite(p1,QLEN,1,pf);}fclose(pf);p2->next=NULL;return0;}intquit_modify()//修改退貨數(shù)據(jù),相當于更新數(shù)據(jù)庫{system("cls"); longm_num;FILE*fp,*fp1;inti,j,n; intt=3;structquit_productxg[N]; fp=fopen("退貨信息記錄.dat","rb+"); fp1=fopen("退貨信息記錄.xls","r+"); printf("退貨編號商品編號退還貨物名退貨數(shù)量退貨價格總價\n");printf("\n"); for(i=0;fread(&xg[i],QLEN,1,fp)!=NULL;i++) { printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", xg[i].num,xg[i].p_num,xg[i].name,xg[i].amount,xg[i].price,xg[i].t_price); printf("\n"); } printf("\n輸入要修改的商品的退貨編號:");QXG:scanf("%ld",&m_num); j=0;while(j<i) {if(xg[j].num==m_num) { printf("\n\t\t\t輸入新的退還貨物信息!\n"); printf("\n商品編號:"); scanf("%s",&xg[j].p_num); printf("\n退還貨物名:"); scanf("%s",&xg[j].name); printf("\n退貨數(shù)量:"); scanf("%d",&xg[j].amount); printf("\n退貨價格:"); scanf("%d",&xg[j].price); xg[j].t_price=xg[j].amount*xg[j].price; printf("\n總價:"); printf("%d\n",xg[j].t_price); printf("\t\t\t商品信息修改成功!\n"); printf("退貨編號商品編號退還貨物名退貨數(shù)量退貨價格總價\n"); printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", xg[j].num,xg[j].p_num,xg[j].name,xg[j].amount,xg[j].price,xg[j].t_price); rewind(fp); fseek(fp1,56L,0); for(n=0;n<i;n++) {fwrite(&xg[n],QLEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n",xg[n].num,xg[n].p_num,xg[n].name,xg[n].amount,xg[n].price,xg[n].t_price); } fclose(fp); fclose(fp1); printf("\n按回車鍵退回上一級菜單"); getchar(); getchar(); return0; }j++; } t--; if(t==0) return0; printf("\n沒有找到該退貨編號,還有[%d]次機會,請重新輸入:",t); gotoQXG;}intquit_select()//查詢退貨數(shù)據(jù){ system("cls"); FILE*fp; inti,j; intt=3; longs_num; structquit_productcx[N]; if((fp=fopen("退貨信息記錄.dat","rb"))==NULL) { printf("找不到文件\n"); exit(0); } printf("\t\t\t\n"); printf("\t\t\t★退還貨物統(tǒng)計如下★\n"); printf("\t\t\t\n\n"); printf("退貨編號商品編號退還貨物名退貨數(shù)量退貨價格總價\n");printf("\n"); for(i=0;fread(&cx[i],QLEN,1,fp)!=NULL;i++) { printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", cx[i].num,cx[i].p_num,cx[i].name,cx[i].amount,cx[i].price,cx[i].t_price); printf("\n"); } fclose(fp); printf("\n輸入要查詢的退貨編號:");QCX:scanf("%ld",&s_num);j=0; while(j<i) { if(cx[j].num==s_num) { printf("\n查詢結果如下:\n\n"); printf("退貨編號商品編號退還貨物名退貨數(shù)量退貨價格總價\n"); printf("%-8ld%-8s%-10s%-8d%-8d%-8d\n", cx[j].num,cx[j].p_num,cx[j].name,cx[j].amount,cx[j].price,cx[j].t_price); printf("\n按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; } t--; if(t==0) return0; printf("\n沒有找到該退貨編號,還有[%d]次機會,請重新輸入:",t); gotoQCX;}intquit_delete()//刪除不需要記錄了的退貨數(shù)據(jù){ system("cls"); inti,n,j; intt=3;longd_num;structquit_productsc[N];FILE*fp,*fp1; fp=fopen("退貨信息記錄.dat","rb+"); for(i=0;fread(&sc[i],QLEN,1,fp)!=NULL;i++); printf("\n\n輸入要刪除的商品的退貨編號:");QSC:scanf("%ld",&d_num); j=0;while(j<i) {if(sc[j].num==d_num) {for(n=j;n<i-1;n++) sc[n]=sc[n+1]; fp=fopen("退貨信息記錄.dat","wb+");fp1=fopen("退貨信息記錄.xls","w"); fprintf(fp1,"%s\t%s\t%s\t%s\t%s\t%s\n","退貨編號","商品編號","退還貨物名","退貨數(shù)量","退貨價格","總價"); fseek(fp1,56L,0); for(n=0;n<i-1;n++) {fwrite(&sc[n],QLEN,1,fp); fprintf(fp1,"%ld\t%s\t%s\t%d\t%d\t%d\n",sc[n].num,sc[n].p_num,sc[n].name,sc[n].amount,sc[n].price,sc[n].t_price); } fclose(fp); fclose(fp1); printf("\n★刪除成功!\n"); printf("\n按回車鍵退回上一級菜單"); getchar(); getchar(); return0; } j++; }t--; if(t==0) return0; printf("\n沒有找到該退貨編號,還有[%d]次機會,請重新輸入:",t); gotoQSC;}inttotal()//商品總的記錄查詢,不刪除任何數(shù)據(jù){ system("cls"); printf("\t\t\t********************\n");printf("\t\t\t**\n"); printf("\t\t\t*商品統(tǒng)計信息*\n"); printf("\t\t\t**\n"); printf("\t\t\t********************\n\n\n"); structproducttj,s;inti=0; //charc; longs_sum=0,p_sum=0; FILE*fp; if((fp=fopen("商品信息記錄.xls","r"))==NULL) { printf("\n\n\t\t\t還沒統(tǒng)計數(shù)據(jù)!\n"); //printf("\n\n按回車鍵退回上一級菜單"); //c=getchar(); //c=getchar(); system("pause"); return0; } printf("商品編號商品名型號/規(guī)格商品數(shù)量進貨價銷售價\n");printf("\n"); fseek(fp,56L,0);while(!feof(fp)) { fscanf(fp,"%s\t%s\t%s\t%d\t%d\t%d\n", &tj.p_num,&,&tj.spec,&tj.amount,&tj.price,&tj.s_price); p_sum+=tj.price*tj.amount; s_sum+=tj.amount; printf("%-8s%-8s%-10s%-8d%-8d%-8d\n", tj.p_num,,tj.spec,tj.amount,tj.price,tj.s_price); printf("\n"); i++; } printf("\n商品種類有:%d(種)\n",i); printf("\n商品總數(shù)為:%ld(件)\n",s_sum); printf("\n商品總進貨價為:%ld(元)\n",p_sum); /*while(1) {printf("\n按任意鍵退回上一級菜單"); scanf("%s",c); if(strcmp(c,"Y")==0||strcmp(c,"y")==0) return0; }*/ //printf("\n按回車鍵退回上一級菜單"); //c=getchar(); //c=getchar(); system("pause"); return0;}intin_case(){ charchoice;choice=getchar(); system("cls"); printf("\t\t\t\t********************\n");printf("\t\t\t\t**\n"); printf("\t\t\t\t*入庫信息管理*\n"); printf("\t\t\t\t**\n"); printf("\t\t\t\t********************\n\n\n");menu(); while(1) { printf("\n\t\t\t\t輸入你的選擇:"); scanf("%c",&choice); switch(choice) { case'1':in_insert();Rkjl();getchar();break; case'2':in_delete();break; case'3':in_modify();break; case'4':in_select();break; default:return0; } /*switch(choice) { case1:in_insert();Rkjl();break; case2:in_delete();break; case3:in_modify();break; case4:in_select();break; default:return0; }*/system("cls"); printf("\t\t\t\t********************\n");printf("\t\t\t\t**\n"); printf("\t\t\t\t*入庫信息管理*\n"); printf("\t\t\t\t**\n"); printf("\t\t\t\t********************\n\n\n"); menu(); }}intout_case(){ charchoice; getchar(); system("cls"); printf("\t\t\t\t********************\n");printf("\t\t\t\t**\n"); printf("\t\t\t\t*出庫信息管理*\n"); printf("\t\t\t\t*

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論