?? inq_afe.c
字號:
#include <graphics.h>
#include <bio.inc>
#include <menu.inc>
#include <key.inc>
#include "feedef.h"
#define BK_CLR 7
#define CHR_CLR 0
#define HEAD_CLR 0
/* function : print the detailed information for the authcds from the input one
* to the end
* called by : statistic()
* date : 1993.12.11
*/
void process_afee_all(UC opflg2)
{
UI i;
UC flag;
AUTHCD_STRUCT *authcd;
if(check_prn() == FALSE) /* not ready */
return;
flag = load_authcd_tbl(0);
if(flag == 0) /* charge.pho does not exist */
{
message(AUTHCD_FILE_ERR);
return;
}
ANewlen = authcd_tbl_len();
authcd = Auth_cd_top;
message_disp(8,"正在打印, 請稍候...");
for(i=0;i<ANewlen;i++)
{
if(inv_aone(authcd, MULTY, opflg2) == FALSE)
{
message_end();
unload_authcd_tbl();
return;
}
authcd++;
}
message_end();
unload_authcd_tbl();
return;
}
/* function : print the detailed information for the authcds from the input one
* to the end
* called by : statistic()
* date : 1993.12.11
*/
void process_afee_part(UC opflg1, UC opflg2)
{
UI i, idx;
UI lenth;
UC flag;
UL auth_cd;
AUTHCD_STRUCT *authcd;
if(opflg1 == PRINT)
{
if(check_prn() == FALSE) /* not ready */
return;
}
flag = inp_phid_num(&auth_cd, &lenth, opflg1, AUTH_CD);
if(flag == 1)
return;
flag = load_authcd_tbl(0);
if(flag == FALSE) /* charge.pho does not exist */
{
message(AUTHCD_FILE_ERR);
return;
}
ANewlen = authcd_tbl_len();
i = 0;
authcd = Auth_cd_top;
while(authcd->auth_code != auth_cd)
{
i++;
authcd++;
}
idx = i;
if( (idx+lenth) >= ANewlen )
idx = ANewlen;
else
idx += lenth;
if(opflg1 == PRINT)
message_disp(8,"正在打印, 請稍候...");
for(; i<idx; i++)
{
if(opflg1 == INQUIRE)
{
if(inq_apart_fee(authcd, AUTH_FEE) == FALSE) break;
}
else
{
if(inv_aone(authcd, MULTY, opflg2) == FALSE)
{
message_end();
unload_authcd_tbl();
return;
}
}
authcd++;
}
if(opflg1 == PRINT)
message_end();
unload_authcd_tbl();
return;
}
/* function :
* called by : statistic()
* date : 1993.10.11
*/
void process_afee_one(UC opflg1, UC opflg2)
{
UC flag;
UL auth_cd;
USERS_STRUCT nil={0, "", 0};
AUTHCD_STRUCT *authcd;
if( opflg1 == PRINT)
{
if(check_prn() == FALSE) /* not ready */
return;
}
flag = input_auth_cd(&auth_cd, opflg1);
if(flag == 2)
return;
else if(flag == FALSE) /* the authcd no does not exist */
{
message(AUTHCD_NOT_EXIST);
return;
}
flag = load_authcd_tbl(0);
if(flag == FALSE) /* charge.pho does not exist */
{
message(AUTHCD_FILE_ERR);
return;
}
ANewlen = authcd_tbl_len();
authcd = binary_authcd(auth_cd);
if(authcd == NULL)
{
message(AUTHCD_NOT_EXIST);
unload_authcd_tbl();
return;
}
if(opflg1 == INQUIRE)
{
if(inq_apart_fee(authcd, AUTH_FEE) == TRUE)
inquire_one_record(auth_cd, nil, ACCOUNT, AUTH_CD);
}
else
{
message_disp(8,"正在打印, 請稍候...");
if( inv_aone(authcd, SINGLE, opflg2) == FALSE )
{
message_end();
unload_authcd_tbl();
return;
}
message_end();
}
unload_authcd_tbl();
return;
}
/* function : inquire
* called by :
* date : 1993.10.18
*/
UC inq_apart_fee(AUTHCD_STRUCT *authcd, UC opflg)
{
FILE *fp;
UI input;
UNIT_STRUCT cur_unit;
TABLE_STRUCT tfee_tbl1 = { 28, 115, 35, 35, 3, 5,
{80, 135, 135, 135, 96},
GREEN
};
TABLE_STRUCT tfee_tbl2 = { 28, 261, 35, 35, 1, 7,
{80, 81, 80, 81, 80, 81, 96},
GREEN
};
TABLE_STRUCT tfee_tbl3 = { 28, 335, 35, 35, 1, 4,
{162, 162, 162, 96},
GREEN
};
fp = fopen(TotTimeFileName,"rb");
if(fp == NULL)
{
message(TFEE_FILE_ERR);
return(FALSE);
}
fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
fclose(fp);
clr_DialWin(2);
disp_tfee_head(opflg); /* display table head */
draw_table(&tfee_tbl1); /* draw the table frame */
disp_afee_detl1(authcd);
draw_table(&tfee_tbl2); /* draw the table frame */
disp_afee_detl2(authcd);
draw_table(&tfee_tbl3); /* draw the table frame */
disp_afee_detl3(authcd);
message_disp(8,"Enter 繼續 Esc 終止");
while(1)
{
input=get_key1();
get_current(&cur_unit);
switch(input)
{
case ESC: /* QUIT */
recover_screen(2);
message_end();
return(FALSE);
case ENTER: /* CONTINUE */
recover_screen(2);
message_end();
return(TRUE);
default:
sound_bell();
break;
}
}/* END OF WHILE */
}
/* function : display the detail for the total fee table
* called by : inq_total_fee()
* date : 1993.9.22
*/
void disp_afee_detl1(AUTHCD_STRUCT *authcd)
{
char *traned;
UI i, j;
UI x, y;
UL th, tm, ttm, tcu;
double tch;
UNIT_STRUCT cer_unit;
outf(450, 78+16, BK_CLR, HEAD_CLR, "授權人名: %-s", authcd->auth_usr_nam);
for(i=0; i<3; i++)
{
for(j=1; j<5; j++)
{
cer_unit.unit_x = i;
cer_unit.unit_y = j;
get_certain(&cer_unit);
x = cer_unit.dot_sx+27;
y = cer_unit.dot_sy+9;
switch(j)
{
case 1:
if(i == 0 )
{
traned=fdigt_tran((double)(authcd->intern_charge)/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
}
else if(i == 1)
{
if(authcd->intern_time % 60 != 0)
tm = (authcd->intern_time/60 + 1) % 60;
else
tm = (authcd->intern_time/60) % 60;
th = (authcd->intern_time/60 +1) / 60;
traned=ldigt_tran(th);
outf(x, y, BK_CLR, CHR_CLR, "%-sh%2um", traned, tm);
}
else
{
traned=ldigt_tran( (UL)authcd->intern_count);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
}
break;
case 2:
if(i == 0 )
{
traned=fdigt_tran((double)(authcd->nation_charge)/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
}
else if(i == 1)
{
if(authcd->nation_time % 60 != 0)
tm = (authcd->nation_time/60 + 1) % 60;
else
tm = (authcd->nation_time/60) % 60;
th = (authcd->nation_time/60 + 1) / 60;
traned=ldigt_tran(th);
outf(x, y, BK_CLR, CHR_CLR, "%-sh%2um", traned, tm);
}
else
{
traned=ldigt_tran( (UL)authcd->nation_count);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
}
break;
case 3:
if(i == 0 )
{
traned=fdigt_tran((double)(authcd->local_charge)/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
}
else if(i == 1)
{
if(authcd->local_time % 60 != 0)
tm = (authcd->local_time/60 + 1) % 60;
else
tm = (authcd->local_time/60) % 60;
th = (authcd->local_time/60 + 1) / 60;
traned=ldigt_tran(th);
outf(x, y, BK_CLR, CHR_CLR, "%-sh%2um", traned, tm);
}
else
{
traned=ldigt_tran( (UL)authcd->local_count);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
}
break;
case 4:
if(i == 0 )
{
tch = ((double)(authcd->intern_charge + authcd->nation_charge +\
authcd->local_charge))/100;
traned=fdigt_tran(tch);
outf(x-19, y, BK_CLR, CHR_CLR, "%-s", traned);
}
else if(i == 1)
{
ttm = authcd->intern_time + authcd->nation_time +\
authcd->local_time;
if(ttm % 60 != 0)
tm = (ttm/60 + 1) % 60;
else
tm = (ttm/60) % 60;
th = (ttm/60 + 1) / 60;
traned=ldigt_tran(th);
outf(x-19, y, BK_CLR, CHR_CLR, "%-sh%2um", traned, tm);
}
else
{
tcu = (UL)authcd->intern_count + (UL)authcd->nation_count +\
(UL)authcd->local_count;
traned=ldigt_tran( tcu);
outf(x-19, y, BK_CLR, CHR_CLR, "%-s", traned);
}
break;
default:
break;
} /* END SWITCH */
}
}
return;
}
/* function : display the detail for the total fee table
* called by : inq_total_fee()
* date : 1993.9.22
*/
void disp_afee_detl2(AUTHCD_STRUCT *authcd)
{
char *traned;
UI i, j;
UI x, y;
double tch;
UNIT_STRUCT cer_unit;
i=0;
for(j=0; j<7; j++)
{
cer_unit.unit_x = i;
cer_unit.unit_y = j;
get_certain(&cer_unit);
x = cer_unit.dot_sx+8;
y = cer_unit.dot_sy+9;
switch(j)
{
case 0:
traned=fdigt_tran((double)(authcd->month_lease)/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
break;
case 5:
traned=fdigt_tran((double)(authcd->addfee)/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
break;
case 6:
tch = authcd->month_lease;
tch += authcd->addfee;
traned=fdigt_tran(tch/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
break;
default:
break;
} /* END SWITCH */
}
return;
}
/* function : display the detail for the total fee table
* called by : inq_total_fee()
* date : 1993.9.22
*/
void disp_afee_detl3(AUTHCD_STRUCT *authcd)
{
char *traned;
UI i, j;
UI x, y;
double tch;
UNIT_STRUCT cer_unit;
i=0;
for(j=0; j<4; j++)
{
cer_unit.unit_x = i;
cer_unit.unit_y = j;
get_certain(&cer_unit);
x = cer_unit.dot_sx+8;
y = cer_unit.dot_sy+9;
switch(j)
{
case 0:
outf(77, y, BK_CLR, CHR_CLR, "人民幣元");
break;
case 1:
outf(x,y,BK_CLR,CHR_CLR,"%-4u年%-2u月%-2u日%-2u時",\
Ps_time.year, Ps_time.month,\
Ps_time.day, Ps_time.hour);
break;
case 2:
outf(x,y,BK_CLR,CHR_CLR,"%-4u年%-2u月%-2u日%-2u時",\
Pe_time.year, Pe_time.month,\
Pe_time.day, Pe_time.hour);
break;
case 3:
tch = authcd->intern_charge + authcd->nation_charge +\
authcd->local_charge;
tch += authcd->month_lease;
tch += authcd->addfee;
traned=fdigt_tran(tch/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
break;
default:
break;
} /* END SWITCH */
}
return;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -