⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mon_add.c

📁 BC3.1编译,小交换机计费系统.使用Dos做出如此好的界面,少有.
💻 C
📖 第 1 页 / 共 2 页
字号:
#include <string.h>
#include <ctype.h>
#include <mem.h>
#include <alloc.h>
#include <graphics.h>

#include <bio.inc>
#include <menu.inc>
#include <key.inc>
#include <g_id.inc>

#include "feedef.h"

#define BK_CLR    7
#define CHR_CLR   0
#define HEAD_CLR  0
#define ITBL_CLR  5

/* function  : input the month_lease, new service, manly long call,
 *             repairing, and other fee
 * calls     :
 * called by : set_data() (set_data.c)
 * output    : input the fees and save to charge.pho
 * date      : 1993.9.22
 */
void set_month_add(void)
{
    UI pg;
    TABLE_STRUCT rate_tbl = {10,99,20,18,16,7,{48,70,68,68,68,68,68,68},ITBL_CLR};
    PHONE_STRUCT *tbl;

    clr_DialWin(2);

    set_finger_color(Dsp_clr.fng_clr);
    draw_table(&rate_tbl);        /* draw the table frame */
    disp_fee_head();              /* display table head   */
    disp_fee_help();              /* display the help information */

    load_phone_tbl();

    Newlen = phone_tbl_len();
    Count  = 1;
    tbl = Phone_top;

    disp_fee_tbl(tbl,Count);

    if(!(Newlen%16) && Newlen)
	 pg = Newlen/16;
    else
	 pg = (UI)(Newlen/16)+1;
    outf(542,397,11,14,"%2u",pg);

    locate_finger(0,2);
    message_disp(8," 根据右上方弹出提示窗口提示操作");

    input_fee_data();

    unload_phone_tbl();
    message_end();
}

/* function  : display the head Hanzi for the fee table
 * called by : set_mon_add()
 * date      : 1993.9.22
 */
void disp_fee_head(void)
{
	 outf(180,  80, BK_CLR, HEAD_CLR, "月附加费设定");     /* No.         */
	 outf(20,  103, BK_CLR, HEAD_CLR, "序号");     /* No.         */
	 outf(70,  103, BK_CLR, HEAD_CLR, "分机号");   /* phone No    */
	 outf(140, 103, BK_CLR, HEAD_CLR, "月租费");   /* month lease */
	 outf(202, 103, BK_CLR, HEAD_CLR, "新业务费"); /* new service */
	 outf(270, 103, BK_CLR, HEAD_CLR, "人工长话"); /* manly long  */
	 outf(340, 103, BK_CLR, HEAD_CLR, " 维修费");  /* reparing    */
	 outf(410, 103, BK_CLR, HEAD_CLR, " 其它费");  /* others      */

	 return;
}

/* function  : display the help information for input
 * called by : set_mon_add()
 * date      : 1993.9.22
 */
void disp_fee_help(void)
{
    hz16_disp(500,103,"单位: 元",HEAD_CLR);
    /*** PROMPT: ***/
    draw_back1(480, 122, 625, 357, 11);
    outf(490, 142, 11, 0, "F2   存盘");
    outf(490, 162, 11, 0, "F6   分机号定位");
    outf(490, 182, 11, 0, "F7   页定位");
    outf(490, 202, 11, 0, "F9   复制前一栏");
    outf(490, 222, 11, 0, "←↓→↑ 移动");
    outf(490, 242, 11, 0, "PgUp  向前翻页");
    outf(490, 262, 11, 0, "PgDn  向后翻页");
    outf(490, 282, 11, 0, "Enter 输入");
    outf(490, 322, 11, 0, "Esc   退出");

    /*** PAGE No. AND TOTAL PAGE ***/
    draw_back1(498, 365, 607, 427, 11);
    outf(518, 377, 11, 14, "第");
    outf(575, 377, 11, 14, "页");
    outf(518, 397, 11, 14, "共");
    outf(575, 397, 11, 14, "页");
}


/* function  : display a page of fee table
 * called by : set_mon_add(), pgup_fee_tbl(), pgdn_fee_tbl()
 * input     : tbl -- the first item of this page
 *             num -- the xu-hao of the first item of this page
 * date      : 1993.9.22
 */
void disp_fee_tbl(PHONE_STRUCT *tbl, UI num)
{
    UI i, j;
    UI x, y;
    UI pg;
    UNIT_STRUCT cer_unit;

    for(i=0; i<16; i++)        /* DISPLAY No. IN THE TABLE */
    {
	 if(num+i > MAX_USERS)
	     break;

	 outf(20, i*19+123, BK_CLR, HEAD_CLR, "%3u", num+i);
    }

    pg = (UI)(num/16)+1;    /* DISPLAY THIS PAGE No. */
    setfillstyle(1,11);
    bar(534, 393, 575, 377);
    outf(542, 377, 11, 14, "%2u", pg);

    /***** Display a page of the rate table. *****/
    for(i = 0; i < 16; i++)
    {
	 if(!strlen(tbl->phone_no) || (num+i > MAX_USERS))
	     break;
	 for(j = 1; j < 7; j++)
	 {
	      cer_unit.unit_x = i;
	      cer_unit.unit_y = j;
	      get_certain(&cer_unit);
	      x = cer_unit.dot_sx;
	      y = cer_unit.dot_sy+1;

	      switch(j)
	      {
		   case 1:    /* telephone no */
		       if(!strcmp(tbl->phone_no,""))
			   break;

		       outf(x+6,y,BK_CLR,CHR_CLR,"%-s",tbl->phone_no);
		       break;

		   case 2:    /* month lease */
		       outf(x+2,y,BK_CLR,CHR_CLR,"%7.2f",((double)tbl->month_lease)/100);
		       break;
		   case 3:    /* new service fee */
			outf(x+2,y,BK_CLR,CHR_CLR,"%7.2f",((double)tbl->addfee[0])/100);
			break;
		   case 4:    /* manly long call fee */
			outf(x+2,y,BK_CLR,CHR_CLR,"%7.2f",((double)tbl->addfee[1])/100);
			break;
		   case 5:    /* reparing fee */
			outf(x+2,y,BK_CLR,CHR_CLR,"%7.2f",((double)tbl->addfee[2])/100);
			break;
		   case 6:    /* other fee    */
			outf(x+2,y,BK_CLR,CHR_CLR,"%7.2f",((double)tbl->addfee[3])/100);
			break;
	      }    /* END SWITCH */
	 }         /* END FOR2   */

	 tbl++;
    }    /* END FOR1 */

    return;
}

/* function  : do as input keys
 * called by : set_month_add()
 * date      : 1993.9.23
 */
void input_fee_data(void)
{
    UI input;
    UC *title = "注意:";
    UC *warn = "最多只能有这么多分机号码!";
    UC result;
    UNIT_STRUCT cur_unit;


    while(1)
    {
	input=get_key1();

	get_current(&cur_unit);

	switch(input)
	{
	    case ESC:   /* QUIT */
		 result=select_1in3();
		 switch(result)
		 {
		     case 1:     /* DON'T QUIT */
			 break;

		     case 2:     /* SAVE AND QUIT */
			 save_fee_tbl();
			 recover_screen(2);
			 return;

		     case 3:     /* QUIT AND DON'T SAVE */
			 recover_screen(2);
			 return;
		 }
		 break;

	    case UP:    /* GO TO THE LAST ROW */
		move_finger(0,1);
		break;

	    case DOWN:  /* GO TO THE NEXT ROW */
		 if(Count+cur_unit.unit_x == MAX_USERS)
		 {
	              warn_mesg(title, warn);
		      break;
		 }

		 if((Count+cur_unit.unit_x) < Newlen)
		     move_finger(1,1);
		 else
		     sound_bell();
		 break;

	    case LEFT:       /* go to the left colomn */
		 if(cur_unit.unit_y > 2)
		     move_finger(2,1);
		 else
		     sound_bell();
		 break;

	    case RIGHT:      /* go to the right column */
		 if( strlen(Phone_top[Count+cur_unit.unit_x-1].phone_no) )
		     move_finger(3,1);
		 else
		     sound_bell();
		 break;

	    case PAGEUP:
		 pgup_fee_tbl();
		 break;

	    case PAGEDOWN:
		 pgdn_fee_tbl();
		 break;

	    case F2:    /* SAVE THE fee TABLE */
		 save_fee_tbl();
		 break;

	    case F6:    /* locate according to the phone No input */
		 loc_fee_tbl();
		 break;

	    case F7:    /* PAGE No. LOCATE */
		 loc_fee_page();
		 break;

	    case F9:    /* COPY the last item */
		 copy_last_afee();
		 break;

	    case ENTER:
		 modi_fee_tbl();    /* MODIFY THE fee TABLE */
		 break;

	    default:
		 sound_bell();
		 break;
	}/* END OF SWITCH */
    }/* END OF WHILE */
}

/* function  : modify the fee table
 * called by : input_fee_data()
 * date      : 1993.9.23
 */
void modi_fee_tbl(void)
{
    UI xs, ye;
    UI result;
    UI back_in=4;
    UL lease, add;
    UC cur_y;
    UNIT_STRUCT cur_unit;

    hide_finger();

    message_disp(8," 输入数字   Enter 确认");      /*number*/
    get_current(&cur_unit);
    xs = cur_unit.dot_sx;
    ye = cur_unit.dot_sy;

    switch(cur_unit.unit_y)
    {
	case 2:    /* month lease */
	    set_get_color(0, 10, 10, BK_CLR, CHR_CLR);
	    result = get_money(xs, ye+1, 17, 57, back_in, 4, &lease, 0x0);

	    /***** IF NOT "Esc", RECORD THE RATE INPUTTED. *****/
	    if(result)
		Phone_top[Count+cur_unit.unit_x-1].month_lease = lease;

	    move_finger(3,1);
	    break;

	case 3:    /* new service fee */
	case 4:    /* manly long call */
	case 5:    /* reparing fee    */
	case 6:    /* other fee       */
	    cur_y = cur_unit.unit_y;
	    set_get_color(0, 10, 10, BK_CLR, CHR_CLR);
            result = get_money(xs, ye+1, 17, 57, back_in, 4, &add, 0x0);

	    /***** IF NOT "Esc", RECORD THE RATE INPUTTED. *****/
	    if(result)
		Phone_top[Count+cur_unit.unit_x-1].addfee[cur_y-3] = add;

	    if(cur_y != 6)        /* not the most right one */
		move_finger(3,1);
	    else if( (Count+cur_unit.unit_x) < Newlen )/* not the last one */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -