Exemple #1
0
/*
 * 显示主界面
 */
static void show_main_window()
{
	/*
	 * 声明变量username
	 */
	extern char username[];

	clear_win();
	move_to(0, 0);
	printf("┌────────────────────────────────┬─────────────────────────────┐\n");
	printf("│  销售单号:                     │ 收银员:                     │\n");
	printf("├────────────────────────────────┼─────────────────────────────┤\n");
	printf("│  商品条码:                     │ 数  量:                     │\n");
	printf("├────────────────────────────────┴────────┬────────────────────┤\n");
	printf("│  序号 条码 商品名称 单价 折扣 数量 金额 │      提示信息      │\n");
	printf("├─────────────────────────────────────────┤                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│                                         │                    │\n");
	printf("│   第   页 ←上一页→下一页↑上一项↓下一项  │                    │\n");
	printf("├─────────────────────────────────────────┴────────────────────┤\n");
	printf("│   F2删除商品明细  F3结账 F4撤单 F6挂单  F7取单 F8添加        │\n");
	printf("│   F9注销                                 时间:               │\n");
	printf("└──────────────────────────────────────────────────────────────┘\n");

	/*
	 * 显示销售单号
	 */
	move_to(14, 2);
	printf("%05d", cur_sale->sale_num);

	/*
	 * 显示销售员
	 */
	move_to(44, 2);
	printf("%s", username);

	/*
	 * 显示商品列表
	 */
	show_list();

	/*
	 * 显示页码
	 */
	show_page_number();

	/*
	 * 显示错误提示
	 */
	show_error_tips();
}
Exemple #2
0
void far show_log_file()
{
int num_newlines;
int ch;

	if(FP_SEG(mono_ptr) == 0xb800)
	{
		make_win(0,0,79,24);
		clear_win(15);
	}



	fseek(out_ptr,0L,SEEK_SET);

	num_newlines = 0;
	for(ch = getc(out_ptr) ; ch != EOF ; ch = getc(out_ptr))
	{
		putchar(ch);

		if((ch == 13) || (ch == 10))
			num_newlines++;

		if(num_newlines == 19)
		{
			printf("\n%s\n\n",press_enter);
			getch();
			num_newlines = 0;
		}
	}


	fseek(out_ptr,0L,SEEK_END);



	if(FP_SEG(mono_ptr) == 0xb800)
	{
		clear_win(15);
		make_win(10,3,70,20);
	}
}
Exemple #3
0
void far control_window()
{
int i;

	make_win(45,15,64,19);
	clear_win(REVERSE_VIDEO);
	draw_box();

	
	for(i = 0 ; i < 3 ; i++)
		reverse_string(controls[i],win_y_low + 1 + i,win_x_low + 2);


	make_win(10,3,60,17);
}
Exemple #4
0
/*
 * 显示登录界面
 */
void show_login_window()
{
	clear_win();
	move_to(0, 0);

	printf("┌────────────────────────────────────┐\n");
	printf("│           图书销售系统             │\n");
	printf("│           ────────────             │\n");
	printf("│                                    │\n");

	printf("│       ");

	color_on(INVERSE, BLACK, WHITE);
	printf("┌───────────────────┐ ");
	color_off();

	printf("       │\n");
	printf("│       ");
	
	color_on(INVERSE, BLACK, WHITE);
	printf("│ 用户名:          │ ");
	color_off();

	printf("       │\n");
	printf("│       ");
	
	color_on(INVERSE, BLACK, WHITE);
	printf("│ 密  码:          │ ");
	color_off();

	printf("       │\n");
	printf("│       ");
	
	color_on(INVERSE, BLACK, WHITE);
	printf("└───────────────────┘ ");
	color_off();

	printf("       │\n");
	printf("│                                    │\n");
	printf("│                                    │\n");
	printf("│                                    │\n");
	printf("│                                    │\n");
	printf("│  时间:               按TAB键退出   │\n");
	printf("└────────────────────────────────────┘\n");
}
Exemple #5
0
int Login_win()
{
    const char title[] = "中国人民银行现代化支付系统";
    const char opermesg[]="柜员号:";		/* message to be appeared on the screen */
    const char pwdmesg[]= "密码  :";
 
    int row,col;				/* to store the number of rows and *
                                          * the number of colums of the screen */
    char id[USR_LEN + 1];
    char pwd[PASSWORD_LEN + 1];
    char ch;
    int ret(0);

    initscr();				/* start the curses mode */
    getmaxyx(stdscr,row,col);		/* get the number of rows and columns */
 
    WINDOW * loginwin;
    loginwin = main_win();
 
    mvwprintw(loginwin,row/2 - 3,(col-strlen(title))/2,"%s",title);
    mvwprintw(loginwin,row/2,(col-strlen(opermesg))/2 - 2,"%s",opermesg);/* print the message at the center of the screen */
    mvwprintw(loginwin,row/2 + 2,(col-strlen(pwdmesg))/2 - 2,"%s",pwdmesg);/* print the message at the center of the screen */     
 
    wrefresh(loginwin);
    raw();
    noecho();    //当执行wgetch()函数的时候关闭键盘回显
    
    keypad(loginwin,TRUE);
    
    string login_id;

    const char * strSQL = "select pwd,operid from operinfo where operid = '000001' ";

    db2_exec_query(oper , strSQL);

    do
    {
	clear_line(loginwin,row/2,(col-strlen(opermesg))/2 + 6,USR_LEN);
	read_line(loginwin,id,USR_LEN,0);
	 
        ret = check_operid(id);
	 
        if(ret == -2)
        {
            show_msg(loginwin,"Importation is NULL,input again");
            continue;
        }
  	else if(ret == -1)
        {
            show_msg(loginwin,"The format importation is wrong,input 0-9 digit");
            continue;
        }

        login_id.assign(id);

        if( !(oper.operid == login_id) )
        {
            mvwprintw(loginwin,LINES - 2,0,"User ID is not exist,Please press any key to continue");
            wrefresh(loginwin);
            wgetch(loginwin);
            clear_line(loginwin,LINES - 2,0,100);
			
            continue;
        }
        else
            break;
    }while(1);
    
    //refresh();
    int ret1(0);  

    do
    {
        clear_line(loginwin,row/2 + 2,(col-strlen(pwdmesg))/2 + 6,PASSWORD_LEN);
        read_line(loginwin,pwd,PASSWORD_LEN,1);
	wrefresh(loginwin);
        
        //ret1 = check_operpwd(pwd);
	 
        //if(ret1 == -1)
        //{
        //    show_msg(loginwin,"Input Invalid,Please press any key to continue");
        //    continue;
        //}

        GetOperPasswdMd5(pwd);

        mvwprintw(loginwin,LINES - 4, 0, "1 md5: %s ",operpwd.c_str());
        mvwprintw(loginwin,LINES - 5, 0, "2 md5: %s ",oper.pwd);
        
        if( !(oper.pwd == operpwd) )
        {
            clear_line(loginwin,LINES - 2,0,100);
                mvwprintw(loginwin,LINES - 2,0,"User Passwd is invalid,Please press any key to continue");
                    clear_line(loginwin,LINES - 2,0,100);
                        read_line(loginwin,pwd,PASSWORD_LEN,1);
        
            continue;
        }
        else
        {
            break;
        }
    }while(1);
    //clear_line(loginwin,LINES - 2,0,100);
    //mvwprintw(loginwin,LINES - 2, 0, "操作员 %s 签到成功...",id);   

    wrefresh(loginwin);

    destroy_win(loginwin);

    clear_win(stdscr,0,0,24,80);  //多窗口操作清窗口操作
    wrefresh(stdscr);
    endwin();
    return 0;
}