?? mon_add.c
字號:
#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," 根據(jù)右上方彈出提示窗口提示操作");
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, "月附加費(fèi)設(shè)定"); /* No. */
outf(20, 103, BK_CLR, HEAD_CLR, "序號"); /* No. */
outf(70, 103, BK_CLR, HEAD_CLR, "分機(jī)號"); /* phone No */
outf(140, 103, BK_CLR, HEAD_CLR, "月租費(fèi)"); /* month lease */
outf(202, 103, BK_CLR, HEAD_CLR, "新業(yè)務(wù)費(fèi)"); /* new service */
outf(270, 103, BK_CLR, HEAD_CLR, "人工長話"); /* manly long */
outf(340, 103, BK_CLR, HEAD_CLR, " 維修費(fèi)"); /* reparing */
outf(410, 103, BK_CLR, HEAD_CLR, " 其它費(fèi)"); /* 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 分機(jī)號定位");
outf(490, 182, 11, 0, "F7 頁定位");
outf(490, 202, 11, 0, "F9 復(fù)制前一欄");
outf(490, 222, 11, 0, "←↓→↑ 移動(dòng)");
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 = "最多只能有這么多分機(jī)號碼!";
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," 輸入數(shù)字 Enter 確認(rèn)"); /*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 */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -