| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 788 人关注过本帖
标题:手机销售系统(上)
取消只看楼主 加入收藏
xs_cctv
Rank: 1
来 自:湖南
等 级:新手上路
帖 子:21
专家分:0
注 册:2008-8-19
结帖率:100%
收藏
 问题点数:0 回复次数:0 
手机销售系统(上)
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
struct tuihuo//退货结构体
{
    char name[8];
    char pp[10];
    char xh[14];
    int num;
    int year;
    int month;
    int day;
}tui[1000]={"刘嘉玲","西门子","V8",2,2006,9,13,
"王语焉","摩托罗拉","MotoE808",1,2006,4,23,
"许志安","高科","V8",1,2006,1,12,
"杨过","VK","VK300",1,2005,12,31,
"李莫愁","三星","Up2u",1,2004,9,28};

struct sjkc//库存结构体
{
    char pp[10];//品牌
    char xh[14];//型号
    int jg;//进价
    int sj;//售价
    int num;//数量
    int sum;//进价总额
    int lr;//利润
    int cs;//出售数量
    int x;//序号
}kc[10000]={"诺基亚","Nokia3310",900,1340,40,36000,0,0,0,
"三星","Sun890",1129,1699,50,56450,0,0,0,
"西门子","V8",1600,2100,51,96000,4500,9,0,
"诺基亚","Nokia7260",1000,1400,40,40000,0,0,0,
"摩托罗拉","MotoE808",1300,1500,30,39000,0,0,0,
"VK","VK300",1400,1600,40,56000,0,0,0,
"三星","Up2u",1400,1900,30,52000,0,0,0,
"高科","V8",400,900,40,16000,0,0,0,
"康佳","C869",800,1200,20,16000,0,0,0,
"LG","LG3210",700,1100,40,28000,400,1,0};

struct users//用户结构体
{
    char username[20];
    char userpassword[7];
}user[100]={"t01","123456","Administrator","123456","唐亚军","123456","唐鑫","123456"};

struct customerInfo//客户信息结构体
{
    char namme[10];//姓名
    char phone[15];//电话
    char Idcard[10];//保修卡号
    char pp[10];//品牌
    char xh[14];//型号
    int bxq;//保修期
    int wxcs;//维修次数
    int year;//年
    int month;//月
    int day;//日
}customer[10000]={"李莫愁","13174740054","A1001","LG","LG3210",12,3,2004,9,29,
"李逍遥","13265489632","A1002","西门子","V8",12,1,2006,5,29,
"刘嘉玲","13052358523","A1003","西门子","V8",12,1,2006,5,29,
"王语焉","13105231253","A1004","西门子","V8",12,1,2006,5,29,
"杨过","13354689523","A1005","诺基亚","Nokia3310",12,0,2006,9,23};

int unum=4,z=5;//unum为计算用户数量的计数器,z为计算退货数量的计数器
int w=5;//记录客户数量的计数器
int k=11;//手机库存数量

void bz();//帮助文档
void manageuser();//用户管理
void selectuser();//用户查询
void aduser();//添加用户
void alteruser();//修改用户
void deleteuser();//删除用户
void image();//验证后载入动画
void srkc(int);//接收手机库存
void sc();//输出所有手机信息
void cx();//库存查询模块
void cxcx();//销售查询
void logo();//进入软件的LOGO
void cs();//销售
void xg();//修改手机品牌
void cr();//添加手机信息
void px();//对手机信息排序
void ck();//排序中的查看模块
void shanchu();//库存删除模块
void shfw();//返修模块
void kcxx();//插入库存信息管理模块
void kcgl();//库存管理模块
void bxxx();//保修信息
void bxcz();//保修查找模块
void bxxg();//保修修改模块
void wxsc();//保修删除模块
void bxfx();//保修返修模块
void rjsz();//软件设置模块
void scsz();//色彩设置模块
void zjkc();//增加库存量
void hfcp();//恢复磁盘模块

void main()//主函数
{
    char ch,username[20],userpassword[7];
    int g,count=0,j,u=0,gn,i;
    system("title 启鸣手机销售系统 - 启鸣小组开发");
    system("color 17");
    logo();
    ch=getchar();
    fflush(stdin);
    system("cls");
    u=0;
    do
    {
        system("date/t");
        system("time/t");
        printf("\t\t\t         用户登陆");
        printf("\n\n\t\t\t============================");
        printf("\n\n\n\t\t\t     请输入用户名:");
        fflush(stdin);
        gets(username);
        printf("\n\t\t\t     请输入密码:");
        fflush(stdin);
        for(i=0;i<6;i++)
        {
            userpassword[i]=getch();
            printf("*");
        }
        userpassword[6]='\0';
        for(j=0;j<unum;j++)
        {
            if((strcmp(user[j].username,username)==0)&&(strcmp(user[j].userpassword,userpassword)==0))
                break;
        }
        if(j<unum)
        {
            image();
            do
            {
                system("cls");
                system("date/t");
                system("time/t");
                printf("\n\n\n\t\t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓");
                printf("\n\t\t◆                                          ◆");
                printf("\n\t\t◆            手机销售管理系统              ◆");
                printf("\n\t\t◆                                          ◆");
                printf("\n\t\t◆               1.用户管理                 ◆");
                printf("\n\t\t◆               2.库存管理                 ◆");
                printf("\n\t\t◆               3.营业管理                 ◆");
                printf("\n\t\t◆               4.售后服务                 ◆");
                printf("\n\t\t◆               5.软件设置                 ◆");
                printf("\n\t\t◆               6.帮助文档                 ◆");
                printf("\n\t\t◆               0.返回到登陆页面           ◆");
                printf("\n\t\t◆                                          ◆");
                printf("\n\t\t〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓\n");
                printf("\t\t\t\t请选择:");
                scanf("%d",&g);
                switch(g)
                {
                case 1:
                    system("cls");
                    u=0;
                    do
                    {
                        
                        printf("\n\n\t\t\t        管理员登陆");
                        printf("\n\t\t\t============================");
                        printf("\n\n\n\t\t\t请输入管理员用户名:");
                        fflush(stdin);
                        gets(username);
                        printf("\n\t\t\t请输入管理员密码:");
                        fflush(stdin);
                        for(i=0;i<6;i++)
                        {
                            userpassword[i]=getch();
                            printf("*");
                        }
                        userpassword[6]='\0';
                        for(j=0;j<unum;j++)
                        {
                            if((strcmp("Administrator",username)==0)&&(strcmp(userpassword,"123456")==0))
                            {
                                image();
                                break;
                            }
                        }
                        if(j<unum)
                        {        
                            system("cls");
                            manageuser();
                            break;
                        }
                        else
                        {
                            u++;                    
                            if(u==3)
                            {
                                system("cls");
                                system("date/t");
                                system("time/t");
                                printf("\n\n\n\t\t\t输入错误超过三次,达到重试上限!");
                                fflush(stdin);
                                gn=getchar();
                                break;
                            }
                            system("cls");
                            printf("\n\n\n\t\t\t    用户名或密码有误!");
                            printf("\n\n\t\t\t    是否继续登陆?   (y/n)");
                            fflush(stdin);
                            ch=getchar();
                            fflush(stdin);
                            if(ch=='N'||ch=='n')
                                break;
                            else
                                system("cls");
                        }
                    }while(ch=='y'||ch=='Y');
                    break;
                case 2:
                    kcgl();
                    break;
                case 3:
                    cs();
                    break;
                case 4:
                    shfw();
                    break;
                case 5:
                    rjsz();
                    break;
                case 6:
                    bz();
                    break;
                case 0:
                    system("cls");
                    break;
                default:
                    printf("\n\t\t\t输入错误,没有这个选项,请重新选择!\n");
                    fflush(stdin);
                    ch=getchar();
                    system("cls");
                    break;            
                }
                if(g==0)
                {
                    printf("\n\n\n\n\t\t\t真的要退出到登陆页面吗?(y/n)");
                    fflush(stdin);
                    ch=getchar();
                    fflush(stdin);
                    if(ch=='y'||ch=='Y')
                    {
                        system("cls");
                        break;
                    }
                }
                fflush(stdin);
            }while(1);
        }
        else
        {
            u++;                    
            if(u==3)
            {
                system("cls");
                system("date/t");
                system("time/t");
                printf("\n\n\n\t\t\t输入错误超过三次,达到重试上限!");
                fflush(stdin);
                gn=getchar();
                break;
            }
            system("cls");
            system("date/t");
            system("time/t");
            printf("\n\t\t\t    用户名或密码有误!");
            printf("\n\n\t\t\t    是否继续登陆?  (y/n)");
            fflush(stdin);
            ch=getchar();
            fflush(stdin);
            if(ch=='N'||ch=='n')
                break;
            else
                system("cls");
        }
    }while(1);
    system("cls");
    logo();
    printf("\n\n\t\t\t程序已退出,请按任意键关闭窗口。");
    printf("\n\t\t\t");
}

void selectuser()// 查询用户信息
{
    int num;
    system("cls");
    system("date/t");
    system("time/t");
    printf("\t\t\t    以下是所有用户信息\n");
    printf("\n================================================================================");
    printf("\n\n\t\t\t  用户名\t    密码\n");
    printf("\n\t\t   ------------------------------------");
    for(num=0;num<unum;num++)
    {
        printf("\n\t\t   %13s   %13s",user[num].username,user[num].userpassword);
        printf("\n\t\t   ------------------------------------");
    }
    printf("\n\n");
}

void aduser()//添加用户
{
    int i;
    char ch;
    
    system("cls");
    system("date/t");
    system("time/t");
    do
    {
        printf("\n\n\t\t\t用户名:");
        fflush(stdin);
        gets(user[unum].username);
        for(i=0;i<unum;i++)
        {
            if(strcmp(user[unum].username,user[i].username)==0)
                break;
        }
        if(i<unum)
        {
            system("cls");
            system("date/t");
            system("time/t");
            printf("\n\t\t\t用户名已存在!!");
            ch='Y';
        }
        else
        {
            do
            {
                printf("\n\t\t\t密码:");
                fflush(stdin);
                for(i=0;i<6;i++)
                {
                    user[unum].userpassword[i]=getch();
                    printf("*");
                }
                user[unum].userpassword[6]='\0';
                
                if(strlen(user[unum].userpassword)<6)
                {
                    system("cls");
                    system("date/t");
                    system("time/t");
                    printf("\n\t\t\t只能是6位密码\n\n");
                }
                else
                {
                    unum++;
                    printf("\n\n\t\t\t添加用户成功!!");
                    printf("\n\n\n\t\t\t是否还要添加用户? <y or n>");
                    fflush(stdin);
                    scanf("%c",&ch);
                    system("cls");
                    system("date/t");
                    system("time/t");
                    break;
                }
            }while(1);
        }
    }while(ch=='y'||ch=='Y');
}

void alteruser()//修改用户密码
{
    int num,i;
    struct users f1,f2,f3;
    system("cls");
    system("date/t");
    system("time/t");
    do
    {
        printf("\n\t\t\t请输入用户名:");
        fflush(stdin);
        gets(f1.username);
        for(num=0;num<unum;num++)
        {
            if(strcmp(f1.username,user[num].username)==0)
            {
                    break;
            }
        }
        if(num<unum)
        {
                do
                {
                    do
                    {
                        printf("\n\n\t\t\t请输入新的密码:");
                        fflush(stdin);
                        for(i=0;i<6;i++)
                        {
                            f2.userpassword[i]=getch();
                            printf("*");
                        }
                        f2.userpassword[6]='\0';
                        if(strlen(f2.userpassword)!=6)
                        {
                            system("cls");
                            system("date/t");
                            system("time/t");
                            printf("\n\t\t\t只能是六位密码!!");
                        }
                        else
                        {
                            break;
                        }
                    }while(1);

                    printf("\n\n\t\t\t请再输入一次:");
                    for(i=0;i<6;i++)
                    {
                        f3.userpassword[i]=getch();
                        printf("*");
                    }
                    f3.userpassword[6]='\0';
                    fflush(stdin);
                    if(strcmp(f2.userpassword,f3.userpassword)==0)
                    {
                        strcpy(user[num].userpassword,f2.userpassword);
                        printf("\n\n\t\t\t修改成功!!\n");
                    }
                    else
                    {
                        system("cls");
                        system("date/t");
                        system("time/t");
                        printf("\n\t\t\t两次输入不相同,请重新输入\n");
                    }
                }while(strcmp(f2.userpassword,f3.userpassword)!=0);
        }
        else
        {
            system("cls");
            system("date/t");
            system("time/t");
            printf("\n\t\t\t您输入的用户名不存在.");
            break;
        }        
    }while(strcmp(f1.username,user[num].username)!=0);
}

void deleteuser()//删除用户
{
    char ch;
    int num,num1;
    struct users f1;
    do
    {
        system("cls");
        system("date/t");
        system("time/t");
        printf("\n\n\n\t\t\t请输入要删除的用户名:");
        fflush(stdin);
        gets(f1.username);
        
        
        for(num=0;num<unum;num++)
        {
            if(strcmp(f1.username,user[num].username)==0)
            {
                break;
            }
        }
        
        if(num<unum)
        {
            printf("\n\n\n\n\n\t\t\t真的要删除吗?(y/n):");
            fflush(stdin);
            ch=getchar();
            fflush(stdin);
            if(ch=='y'||ch=='Y')
            {
                system("cls");
                for(num1=num;num1<unum;num1++)
                {
                    user[num1]=user[num1+1];
                }
                unum--;
                printf("\n\n\n\n\t\t\t删除成功!!\n");
            }
            else
            {
                printf("\n\n\n\n\t\t\t请按车键回到用户管理");
                fflush(stdin);
                scanf("%c",&ch);
                break;
            }
        }
        else
        {
            printf("\n\n\n\n\t\t\t   没有这个用户!!!\n");
        }
        printf("\n\n\t\t\t是否要继续删除?(y/n):");
        fflush(stdin);
        ch=getchar();
        fflush(stdin);
    }while(ch=='y'||ch=='Y');
}
void manageuser()//用户管理
{
    char ch;
    int choice;
    do
    {
        system("date/t");
        system("time/t");
        printf("\n\n\t\t★★★★★★★★★★★★★★★★★★★★★★★");
        printf("\n\t\t★                                          ★");
        printf("\n\t\t★           请选择功能:                   ★");
        printf("\n\t\t★                                          ★");
        printf("\n\t\t★               1.查询用户                 ★");
        printf("\n\t\t★               2.添加用户                 ★");
        printf("\n\t\t★               3.修改密码                 ★");
        printf("\n\t\t★               4.删除用户                 ★");
        printf("\n\t\t★               0.返回主菜单               ★");
        printf("\n\t\t★                                          ★");
        printf("\n\t\t★★★★★★★★★★★★★★★★★★★★★★★\n");
        printf("\t\t\t请选择:   ");
        scanf("%d",&choice);
        switch(choice)
        {
        case 1:
            selectuser();
            fflush(stdin);
            ch=getchar();
            fflush(stdin);
            system("cls");
            break;
        case 2:
            aduser();
            ch=getchar();
            fflush(stdin);
            system("cls");
            break;
        case 3:
            alteruser();
            ch=getchar();
            fflush(stdin);
            system("cls");
            break;
        case 4:
            deleteuser();
            ch=getchar();
            fflush(stdin);
            system("cls");
            break;
        case 0:
            system("cls");
            break;
        default:
            printf("\n\n\t\t\t没有这个选项,请重新选择.");
            break;
        }
        if(choice==0)
        {
            printf("\n\n\n\n\n\t\t\t真的要返回主界面吗?<y or n>");
            fflush(stdin);
            scanf("%c",&ch);
            if(ch=='y'||ch=='Y')
                break;
        }
    }while(1);
}

void logo()//小组LOGO
{
    system("date/t");
    system("time/t");
    printf("\n\t\t            〓 启鸣手机销售系统 〓");
    printf("\n\n\n\n\t\t  ==========================================");
    printf("\n\t\t  ||                                      ||");
    printf("\n\t\t  ||    开发环境:Windows 2000操作平台    ||");
    printf("\n\t\t  ||    开发工具:Microsoft Visual C++    ||");
    printf("\n\t\t  ||                                      ||");
    printf("\n\t\t  ||           TSingHua IT                ||");
    printf("\n\t\t  ||                                      ||");
    printf("\n\t\t  ||    组长:                            ||");
    printf("\n\t\t  ||    组员:                            ||");
    printf("\n\t\t  ||                                      ||");
    printf("\n\t\t  ==========================================");
}

void cx()//查询功能
{
    int a,i,q,x;
    char c[20],ch,gn;
    do
    {
        system("cls");
        system("date/t");
        system("time/t");
        printf("\n\n\t\t→→→→→→→→→→→→→→→→→→→→→→↓");
        printf("\n\t\t↑                                          ↓");
        printf("\n\t\t↑    请选择功能:                          ↓");
        printf("\n\t\t↑                                          ↓");
        printf("\n\t\t↑               1.按品牌查询               ↓");
        printf("\n\t\t↑               2.按型号查询               ↓");
        printf("\n\t\t↑               3.按进价查询               ↓");
        printf("\n\t\t↑               4.按售价查询               ↓");
        printf("\n\t\t↑               5.按数量查询               ↓");
        printf("\n\t\t↑               0.返回上一级目录           ↓");
        printf("\n\t\t↑                                          ↓");
        printf("\n\t\t↑←←←←←←←←←←←←←←←←←←←←←←\n");
        fflush(stdin);
        printf("\t\t\t\t请选择:");
        scanf("%d",&a);
        switch(a)
        {
        case 1:
            do
            {
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\n\t\t\t请输入要查询的手机品牌:");
                gets(c);
                fflush(stdin);                
                system("cls");
                system("date/t");
                system("time/t");
                printf("\t\t       以下是按您输入的型号查找到的信息\n");
                printf("\n\n================================================================================");
                printf("      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                for(i=0;i<k-1;i++)
                {
                    if(strcmp(c,kc[i].pp)==0)
                        printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);
                }
                gn=getchar();
                fflush(stdin);
                printf("\n\n\t\t\t是否要继续查询?(y/n)");
                ch=getchar();
                fflush(stdin);
            }while(ch=='y'||ch=='Y');
            break;
        case 2:
            do
            {    
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\n\n\n\t\t\t请输入要查询的手机型号:");
                gets(c);
                fflush(stdin);    
                system("cls");
                system("date/t");
                system("time/t");
                printf("\t\t       以下是按您输入的型号查找到的信息\n");
                printf("\n\n================================================================================");
                printf("      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                for(i=0;i<k-1;i++)
                {
                    if(strcmp(c,kc[i].xh)==0)
                        printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);
                }
                gn=getchar();
                fflush(stdin);
                printf("\n\n\t\t\t是否要继续查询?(y/n)");
                ch=getchar();
                fflush(stdin);
            }while(ch=='y'||ch=='Y');
            break;
        case 3:
            do
            {
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\n\t\t\t请输入要查询的最低进价:");
                fflush(stdin);
                scanf("%d",&x);
                printf("\n\n\n\t\t\t请输入要查询的最高进价:");
                scanf("%d",&q);
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\t           以下是您要查询的进价在%d-%d之间的数据\n",x,q);
                printf("\n\n================================================================================");
                printf("      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                for(i=0;i<k-1;i++)
                {
                    if(kc[i].jg<=q&&kc[i].jg>=x)
                    {
                        printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);    
                    }
                }
                gn=getchar();
                fflush(stdin);
                printf("\n\n\t\t\t是否要继续查询?(y/n)");
                ch=getchar();
                fflush(stdin);
            }while(ch=='y'||ch=='Y');
            break;
        case 4:
            do
            {
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\n\t\t\t请输入要查询的最低售价:");
                fflush(stdin);
                scanf("%d",&x);
                printf("\n\n\n\t\t\t请输入要查询的最高售价:");
                scanf("%d",&q);
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\t           以下是您要查询售价在%d-%d之间的数据\n",x,q);
                printf("\n\n================================================================================");
                printf("      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                for(i=0;i<k-1;i++)
                {
                    if(kc[i].sj<=q&&kc[i].sj>=x)
                    {
                        printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);    
                    }
                }
                gn=getchar();
                fflush(stdin);
                printf("\n\n\t\t\t是否要继续查询?(y/n)");
                ch=getchar();
                fflush(stdin);
            }while(ch=='y'||ch=='Y');
            break;
        case 5:
            do
            {
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\n\t\t\t请输入最小库存量:");
                fflush(stdin);
                scanf("%d",&x);
                printf("\n\n\n\t\t\t请输入最大库存量:");
                scanf("%d",&q);
                system("cls");
                system("date/t");
                system("time/t");
                fflush(stdin);
                printf("\t          以下是您要查询的库存数量在%d-%d之间的数据\n",x,q);
                printf("\n\n================================================================================");
                printf("      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                for(i=0;i<k-1;i++)
                {
                    if(kc[i].num<=q&&kc[i].num>=x)
                    {
                        printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);    
                    }
                }
                gn=getchar();
                fflush(stdin);
                printf("\n\n\t\t\t是否要继续查询?(y/n)");
                ch=getchar();
                fflush(stdin);
            }while(ch=='y'||ch=='Y');
            break;
        case 0:
            break;
        default:
            printf("\n\t\t\t输入错误,请重新选择");
            fflush(stdin);
            gn=getchar();
            fflush(stdin);
            break;
        }
        if(a==0)
            break;
    }while(1);
}

void srkc(int i)//手机库存接收
{
    system("cls");
    system("date/t");
    system("time/t");
    fflush(stdin);
    printf("\t\t\t第%d条手机库存信息",i+1);
    printf("\n\n\n\t\t\t品牌(限10个英文字符):");
    gets(kc[i].pp);
    fflush(stdin);
    printf("\n\t\t\t型号(限14个英文字符):");
    gets(kc[i].xh);
    fflush(stdin);
    printf("\n\t\t\t进价:");
    fflush(stdin);
    scanf("%d",&kc[i].jg);
    printf("\n\t\t\t售价:");
    fflush(stdin);
    scanf("%d",&kc[i].sj);
    printf("\n\t\t\t数量:");
    fflush(stdin);
    scanf("%d",&kc[i].num);
    kc[i].sum=kc[i].jg*kc[i].num;
    kc[i].lr=0;
    kc[i].cs=0;
}

void sc()//输出所有手机信息
{
    int i;
    char ch;
    system("cls");
    system("date/t");
    system("time/t");
    printf("\t\t\t以下是库存里所有手机的信息\n\n");
    printf("\t  ============================================================");
    printf("\n\n      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
    for(i=0;i<k-1;i++)
    {
        printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);
    }
    fflush(stdin);
    ch=getchar();
    fflush(stdin);
}

void cs()//出售模块
{
    int i,num,choice;
    char ch,xh[14],gn;
    int p,x,y;
    do
    {
        system("cls");
        system("date/t");
        system("time/t");
        printf("\n\n\t\t→→→→→→→→→→→→→→→→→→→→→→↓");
        printf("\n\t\t↑                                          ↓");
        printf("\n\t\t↑        请选择功能:                      ↓");
        printf("\n\t\t↑                                          ↓");
        printf("\n\t\t↑              1.销售                      ↓");
        printf("\n\t\t↑              2.退货                      ↓");
        printf("\n\t\t↑              3.营业业绩                  ↓");
        printf("\n\t\t↑              4.退货记录                  ↓");
        printf("\n\t\t↑              0.返回上一级目录            ↓");
        printf("\n\t\t↑                                          ↓");
        printf("\n\t\t↑←←←←←←←←←←←←←←←←←←←←←←\n");
        printf("\t\t\t\t请选择:");
        fflush(stdin);
        scanf("%d",&choice);
        switch(choice)
        {
        case 1://销售
            do
            {
                fflush(stdin);
                system("cls");
                system("date/t");
                system("time/t");
                printf("\n\n\n\t\t\t购买手机的型号:");
                gets(xh);
                fflush(stdin);
                do
                {
                    system("cls");
                    system("date/t");
                    system("time/t");
                    printf("\n\n\t\t\t以下是符合要求的信息");
                    printf("\n\n 序号      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                    p=0;
                    for(i=0;i<k;i++)
                    {
                        if(strcmp(xh,kc[i].xh)==0)
                        {    
                            p++;
                            kc[i].x=p;
                            printf("%5d %9s %12s %8d %6d %7d %11d %11d\n",kc[i].x,kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);
                        }

                    }
                    if(p==0)
                    {
                        system("cls");
                        system("date/t");
                        system("time/t");
                        printf("\n\n\n\t\t\t库存中没有这款手机!");
                        fflush(stdin);
                        gn=getchar();
                        break;
                    }
                    printf("\n\n\t\t\t请选择要购买的序号:");
                    fflush(stdin);
                    scanf("%d",&x);
                    for(i=0;i<k-1;i++)
                    {
                        if(kc[i].x==x&&x!=0)
                        {
                            y=i;
                            break;
                        }
                    }
                    if(i<k-1&&x!=0)
                    {

                        do
                        {        
                            system("cls");
                            system("date/t");
                            system("time/t");
                            printf("\n\n\t\t\t购买数量:");
                            fflush(stdin);
                            scanf("%d",&num);
                            if(num>kc[y].num)
                            {
                                printf("\n\n\t\t\t货源不足!");
                                fflush(stdin);
                                gn=getchar();
                            }
                            else
                            {
                                break;
                            }
                        }while(1);
                        printf("\n\t\t\t客户姓名:");
                        fflush(stdin);
                        gets(customer[w].namme);
                        do
                        {
                            printf("\n\t\t\t客户联系电话:");
                            fflush(stdin);
                            gets(customer[w].phone);
                            if(strlen(customer[w].phone)>11)
                            {
                                system("cls");
                                system("date/t");
                                printf("\n\n\n\t\t\t输入有误,电话号码不可超过11位.");
                                fflush(stdin);
                                gn=getchar();
                                system("cls");
                                system("date/t");
                            }
                            else
                                break;
                        }while(1);
                        do
                        {
                            printf("\n\t\t\t保修卡号码:");
                            fflush(stdin);
                            gets(customer[w].Idcard);
                            for(i=0;i<w;i++)
                            {
                                if(strcmp(customer[w].Idcard,customer[i].Idcard)==0)
                                {
                                    break;
                                }
                            }
                            if(i<w)
                            {
                                system("cls");
                                system("date/t");
                                system("time/t");
                                printf("\n\n\t\t\t此卡号已经存在!!");
                                fflush(stdin);
                                gn=getchar();
                            }
                            else
                                break;
                        }while(1);
                        printf("\n\t\t\t保修期(月):");
                        fflush(stdin);
                        scanf("%d",&customer[w].bxq);
                        do
                        {
                            system("cls");
                            system("date/t");
                            system("time/t");
                            printf("\n\t\t\t购买日期(yy mm dd):");
                            fflush(stdin);
                            scanf("%d%d%d",&customer[w].year,&customer[w].month,&customer[w].day);
                            if(customer[w].year<2000||customer[w].year>9999)
                            {
                                system("cls");
                                system("date/t");
                                system("time/t");
                                printf("\n\n\n\t\t\t日期输入有误!");
                                fflush(stdin);
                                gn=getchar();
                            }
                            else if(customer[w].month<1||customer[w].month>12)
                            {
                                system("cls");
                                system("date/t");
                                system("time/t");
                                printf("\n\n\n\t\t\t日期输入有误!");
                                fflush(stdin);
                                gn=getchar();
                            }
                            else if(customer[w].day>31||customer[w].day<1)
                            {
                                system("cls");
                                system("date/t");
                                system("time/t");
                                printf("\n\n\n\t\t\t日期输入有误!");
                                fflush(stdin);
                                gn=getchar();
                            }
                            else
                                break;
                        }while(1);
                        strcpy(customer[w].pp,kc[y].pp);
                        strcpy(customer[w].xh,kc[y].xh);
                        kc[y].cs+=num;
                        kc[y].num-=num;
                        kc[y].lr+=(num*kc[y].sj-kc[y].jg*num);
                        w++;
                        system("cls");
                        system("date/t");
                        system("time/t");
                        printf("\t\t\t     销售成功!");
                        printf("\n\n\t\t\t以下是此次的销售情况\n");
                        printf("\t  ============================================================");
                        printf("\n\n\t          品牌         型号          售价\t  数量\n");
                        printf("\t    %10s %12s %13d %12d\n",kc[y].pp,kc[y].xh,kc[y].sj,num);
                        fflush(stdin);
                        gn=getchar();
                        break;
                    }
                    else
                    {
                        printf("\n\n\n\t\t\t     没有这个序号!\n");
                        fflush(stdin);
                        ch=getchar();
                        fflush(stdin);
                        system("cls");
                        break;
                    }
                }while(1);
                system("cls");
                system("date/t");
                system("time/t");
                printf("\n\n\n\t\t\t是否要继续销售?(y/n)");
                ch=getchar();
                fflush(stdin);
            }while(ch=='y'||ch=='Y');
            break;
        case 2://退货
            do
            {
                system("cls");
                system("date/t");
                system("time/t");
                printf("\n\t\t\t请输入你要退货的手机型号:");
                fflush(stdin);
                gets(xh);
                fflush(stdin);                
                do
                {
                    p=0;
                    system("cls");
                    system("date/t");
                    system("time/t");
                    printf("\n\n\t\t\t以下是符合要求的信息");
                    printf("\n\n 序号      品牌         型号     进价\t售价\t数量\t进价总额\t盈利\n");
                    for(i=0;i<k;i++)
                    {
                        if(strcmp(xh,kc[i].xh)==0)
                        {    
                            p++;
                            kc[i].x=p;
                            printf("%5d %9s %12s %8d %6d %7d %11d %11d\n",kc[i].x,kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].sum,kc[i].lr);
                        }
                    }
                    if(p==0)
                    {
                        system("cls");
                        system("date/t");
                        system("time/t");
                        printf("\n\n\n\t\t\t库存中没有这款手机!");
                        fflush(stdin);
                        gn=getchar();
                        break;
                    }                
                    printf("\n\n\t\t\t请选择要退货的序号:");
                    fflush(stdin);
                    scanf("%d",&x);
                    for(i=0;i<k-1;i++)
                    {
                        if(kc[i].x==x)
                        {
                            break;
                        }
                    }                    
                    if(i>=k-1)
                    {
                        system("cls");
                        system("date/t");
                        system("time/t");
                        printf("\n\n\n\t\t\t     没有这个序号!\n");
                        fflush(stdin);
                        ch=getchar();
                        fflush(stdin);
                        system("cls");
                        break;
                    }
                    else
                    {
                        if(kc[i].cs<=0)
                        {
                            system("cls");
                            system("date/t");
                            system("time/t");
                            printf("\n\n\n\t\t\t目前没有售出过此种手机.");
                            fflush(stdin);
                            gn=getchar();
                            break;
                        }    
                        if(i<k-1)
                        {
                            system("cls");
                            system("date/t");
                            system("time/t");
                            printf("\n\n\t\t\t退货数量:");
                            fflush(stdin);
                            scanf("%d",&tui[z].num);
                            fflush(stdin);
                            do
                            {
                                printf("\n\n\t\t\t退货日期(yy mm dd):");
                                fflush(stdin);
                                scanf("%d%d%d",&tui[z].year,&tui[z].month,&tui[z].day);
                                if(tui[z].year<2000||tui[z].year>9999)
                                {
                                    system("cls");
                                    system("date/t");
                                    system("time/t");
                                    printf("\n\n\n\t\t\t年份输入有误!");
                                }
                                else if(tui[z].month<1||tui[z].month>12)
                                {
                                    system("cls");
                                    system("date/t");
                                    system("time/t");
                                    printf("\n\n\n\t\t\t月份输入有误!");
                                }
                                else if(tui[z].month==2&&tui[z].day>28)
                                {
                                    system("cls");
                                    system("date/t");
                                    system("time/t");
                                    printf("\n\n\n\t\t\t日期输入有误!");
                                }
                                else
                                    break;
                            }while(1);
                            printf("\n\n\t\t\t客户姓名:");
                            fflush(stdin);
                            gets(tui[z].name);
                            strcpy(tui[z].xh,kc[i].xh);
                            strcpy(tui[z].pp,kc[i].pp);
                            kc[i].num+=tui[z].num;
                            kc[i].cs-=tui[z].num;
                            kc[i].lr=kc[i].lr-(tui[z].num*kc[i].sj-tui[z].num*kc[i].jg);
                            z++;
                            break;
                        }

                    }
                }while(1);
                printf("\n\n\t\t\t是否还需要退货?(y/n):");
                gn=getchar();
                if(gn=='n'||gn=='N')
                    break;
            }while(gn=='Y'||gn=='y');
            break;
        case 3://营业业绩
            system("cls");
            system("date/t");
            system("time/t");
            printf("\t\t\t以下是目前的销售情况\n");
            printf("\t  ============================================================");
            printf("\n\n      品牌         型号     进价\t售价\t数量\t  销售量\t盈利\n");
            for(i=0;i<k-1;i++)
            {
                printf("%10s %12s %8d %11d %7d %11d %11d\n",kc[i].pp,kc[i].xh,kc[i].jg,kc[i].sj,kc[i].num,kc[i].cs,kc[i].lr);
            }
            fflush(stdin);
            gn=getchar();
            fflush(stdin);
            break;
        case 4://退货记录
            system("cls");
            system("date/t");
            system("time/t");
            printf("\t\t\t以下是目前的退货记录\n");
            printf("\t  ============================================================");
            printf("\n\n\t  品牌         型号         日期\t   客户\t        退货量\n");
            for(i=0;i<z;i++)
            {
                printf("%    14s %12s      %4d/%2d/%2d %11s %14d\n",tui[i].pp,tui[i].xh,tui[i].year,tui[i].month,tui[i].day,tui[i].name,tui[i].num);
            }
            fflush(stdin);
            gn=getchar();
            fflush(stdin);
            break;
        case 0:
            break;
        }
        if(choice==0)
            break;
    }while(1);
}
搜索更多相关主题的帖子: 手机 系统 销售 
2008-09-18 19:58
快速回复:手机销售系统(上)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028753 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved