📄 inq_tfe.c
字号:
case 1:
outf(x,y,BK_CLR,CHR_CLR,"%-4u年%-2u月%-2u日%-2u时",\
Ts_time.year, Ts_time.month,\
Ts_time.day, Ts_time.hour);
break;
case 2:
outf(x,y,BK_CLR,CHR_CLR,"%-4u年%-2u月%-2u日%-2u时",\
Te_time.year, Te_time.month,\
Te_time.day, Te_time.hour);
break;
case 3:
tch = Statsfee.intern_charge + Statsfee.nation_charge +\
Statsfee.local_charge;
tch += Statsfee.month_lease;
for(k=0; k<5; k++)
tch += Statsfee.addfee[k];
traned=fdigt_tran(tch/100);
outf(x, y, BK_CLR, CHR_CLR, "%-s", traned);
break;
default:
break;
} /* END SWITCH */
}
return;
}
/* function: change the floating point to character for commercial use
* called by: tfee_disp_tbl
* caller: none
* date: 1994.12.5
*/
char *fdigt_tran(double betran)
{
char *tbuf;
char traned[20];
int i, sign, dec, ndig=11;
if( betran == 0 )
{
traned[0]=0x30;
traned[1]=0x00;
return traned;
}
tbuf = fcvt(betran, ndig, &dec, &sign);
if(dec <= 3)
{
for(i=0; i<dec; i++)
traned[i] = tbuf[i];
traned[i] = 0x2e;
traned[i+1] = tbuf[i];
traned[i+2] = tbuf[i+1];
traned[i+3] = 0x00;
}
else if(dec <=6)
{
for(i=0; i<dec-3; i++)
traned[i] = tbuf[i];
traned[i] = 0x2c;
for(; i<dec; i++)
traned[i+1] = tbuf[i];
traned[i+1] = 0x2e;
traned[i+2] = tbuf[i];
traned[i+3] = tbuf[i+1];
traned[i+4] = 0x00;
}
else if(dec <=9)
{
for(i=0; i<dec-6; i++)
traned[i] = tbuf[i];
traned[i] = 0x2c;
for(; i<dec-3; i++)
traned[i+1] = tbuf[i];
traned[i+1] = 0x2c;
for(; i<dec; i++)
traned[i+2] = tbuf[i];
traned[i+2] = 0x2e;
traned[i+3] = tbuf[i];
traned[i+4] = tbuf[i+1];
traned[i+5] = 0x00;
}
else
return NULL;
return traned;
}
/* function: change the long integer to character for commercial use
* called by: tfee_disp_tbl
* caller: none
* date: 1994.12.5
*/
char *ldigt_tran(UL betran)
{
char tbuf[15];
char traned[20];
int i, len;
if( betran == 0 )
{
traned[0]=0x30;
traned[1]=0x00;
return traned;
}
ltoa(betran, tbuf, 10);
len = strlen(tbuf);
if(len <= 3)
{
for(i=0; i<len; i++)
traned[i] = tbuf[i];
traned[i] = 0x00;
}
else if(len <= 6)
{
for(i=0; i<len-3; i++)
traned[i] = tbuf[i];
traned[i] = 0x2c;
for(; i<len; i++)
traned[i+1] = tbuf[i];
traned[i+1] = 0x00;
}
else if(len <=9)
{
for(i=0; i<len-6; i++)
traned[i] = tbuf[i];
traned[i] = 0x2c;
for(; i<len-3; i++)
traned[i+1] = tbuf[i];
traned[i+1] = 0x2c;
for(; i<len; i++)
traned[i+2] = tbuf[i];
traned[i+2] = 0x00;
}
else if(len <=12)
{
for(i=0; i<len-9; i++)
traned[i] = tbuf[i];
traned[i] = 0x2c;
for(; i<len-6; i++)
traned[i+1] = tbuf[i];
traned[i+1] = 0x2c;
for(; i<len-3; i++)
traned[i+2] = tbuf[i];
traned[i+2] = 0x2c;
for(; i<len-3; i++)
traned[i+3] = tbuf[i];
traned[i+3] = 0x00;
}
else
return NULL;
return traned;
}
/* function: print the total fee in some period
* called by: inq_total_fee() and statsrics()
* caller: none
* date: 1994.12.5
*/
void prt_total_fee(void)
{
FILE *fp;
UI k;
UL th[4], tm[4], ttm, tcu;
double tch;
struct date now;
UC *head = " 话 费 汇 总 报 表";
if(check_prn() == FALSE) /* not ready */
return;
fp = fopen("gfsdata\\totfee.dat","rb");
if(fp == NULL)
{
message(TFEE_FILE_ERR);
return;
}
fread(&Statsfee, sizeof(FE_STAT_STRUCT), 1, fp);
fclose(fp);
fp = fopen(TotTimeFileName,"rb");
if(fp == NULL)
{
message(TFEE_FILE_ERR);
return;
}
fread(&Ts_time, sizeof(TIME_STRUCT), 1, fp);
fread(&Te_time, sizeof(TIME_STRUCT), 1, fp);
fclose(fp);
message_disp(8,"正在打印,请稍候..."); /* printing */
if(prnfd("\n%s\n\n", head)==FALSE)
{
message_end();
return;
}
if(print_invtbl1() == FALSE)
{
message_end();
return;
}
if(print_invdtl1() == FALSE)
{
message_end();
return;
}
if(print_invtbl2() == FALSE)
{
message_end();
return;
}
tch = (double)(Statsfee.intern_charge + Statsfee.nation_charge +\
Statsfee.local_charge)/100;
if( prnf("┃ 话 费 │ %9.2f │ %9.2f │ %9.2f │ %9.2f┃\n",\
(double)(Statsfee.intern_charge)/100, (double)(Statsfee.nation_charge)/100,\
(double)(Statsfee.local_charge)/100,\
tch)==FALSE)
{
message_end();
return;
}
if(print_invtbl2() == FALSE)
{
message_end();
return;
}
ttm = Statsfee.intern_time;
if( ttm%60 != 0 )
tm[0] = (ttm/60 + 1) % 60;
else
tm[0] = (ttm/60) % 60;
th[0] = (ttm/60 + 1) / 60;
ttm = Statsfee.nation_time;
if( ttm%60 != 0 )
tm[1] = (ttm/60 + 1) % 60;
else
tm[1] = (ttm/60) % 60;
th[1] = (ttm/60 + 1) / 60;
ttm = Statsfee.local_time;
if( ttm%60 != 0 )
tm[2] = (ttm/60 + 1) % 60;
else
tm[2] = (ttm/60) % 60;
th[2] = (ttm/60 + 1) / 60;
ttm = Statsfee.intern_time + Statsfee.nation_time + Statsfee.local_time;
if( ttm%60 != 0 )
tm[3] = (ttm/60 + 1) % 60;
else
tm[3] = (ttm/60) % 60;
th[3] = (ttm/60 + 1) / 60;
if(prnf("┃ 时 长 │ %6lu时%2u分 │%6lu时%2u分 │ %6lu时%2u分 │%6lu时%2u分┃\n",\
th[0],(UI)tm[0],th[1],(UI)tm[1],th[2],(UI)tm[2],th[3],(UI)tm[3])==FALSE)
{
message_end();
return;
}
if(print_invtbl2() == FALSE)
{
message_end();
return;
}
tcu = Statsfee.intern_count + Statsfee.nation_count +\
Statsfee.local_count;
if(prnf("┃ 次 数 │ %10lu │ %10lu │ %10lu │ %10lu┃\n",\
Statsfee.intern_count, Statsfee.nation_count,\
Statsfee.local_count,\
tcu)==FALSE)
{
message_end();
return;
}
if(print_invtbl3() == FALSE)
{
message_end();
return;
}
if(print_invdtl2() == FALSE)
{
message_end();
return;
}
if(print_invtbl4() == FALSE)
{
message_end();
return;
}
tch = (double)(Statsfee.month_lease)/100+\
(double)(Statsfee.addfee[0])/100+\
(double)(Statsfee.addfee[1])/100+\
(double)(Statsfee.addfee[2])/100+\
(double)(Statsfee.addfee[3])/100+\
(double)(Statsfee.addfee[4])/100;
if(prnf("┃ %8.2f │%8.2f│%8.2f│%8.2f│%8.2f│ %8.2f │ %9.2f┃\n",\
(double)(Statsfee.month_lease)/100,\
(double)(Statsfee.addfee[0])/100,\
(double)(Statsfee.addfee[1])/100,\
(double)(Statsfee.addfee[2])/100,\
(double)(Statsfee.addfee[3])/100,\
(double)(Statsfee.addfee[4])/100,tch) == FALSE)
{
message_end();
return;
}
if(print_invtbl5() == FALSE)
{
message_end();
return;
}
if(print_invdtl4() == FALSE)
{
message_end();
return;
}
if(print_invtbl6() == FALSE)
{
message_end();
return;
}
tch = (double)Statsfee.intern_charge + (double)Statsfee.nation_charge +\
(double)Statsfee.local_charge;
tch += (double)Statsfee.month_lease;
for(k=0; k<5; k++)
tch += (double)Statsfee.addfee[k];
if(prnf("┃ 人 民 币 元 │%-4u年%2u月%2u日%2u时│%-4u年%2u月%2u日%2u时 │ %9.2f┃\n",\
Ts_time.year, Ts_time.month,\
Ts_time.day, Ts_time.hour,\
Te_time.year, Te_time.month,\
Te_time.day, Te_time.hour, tch/100\
)==FALSE)
{
message_end();
return;
}
if(print_invtbl7() == FALSE)
{
message_end();
return;
}
getdate(&now);
if(prnf(" 制表时间:%-4u年%-2u月%-2u日\n",now.da_year, now.da_mon, now.da_day ) == FALSE)
return;
/* new page */
if(new_page() == FALSE)
return;
message_end();
return;
}
/*
话 费 汇 总 报 表
┏━━━━━┯━━━━━━━━┯━━━━━━━┯━━━━━━━━┳━━━━━━┓
┃ 项 目 │ 国 际 长 途 │ 国 内 长 途 │ 市 话 ┃ 合 计 ┃
┠─────┼────────┼───────┼────────╂──────┨
┃ 话 费 │ %-9.2f │ %-9.2f │ %-9.2f ┃%-9.2f ┃
┠─────┼────────┼───────┼────────╂──────┨
┃ 时 长 │ %-6luh%2um │ %-6luh%2um │ %-6luh%2um ┃%-6luh%2um ┃
┠─────┼────────┼───────┼────────╂──────┨
┃ 次 数 │ %-10lu │ %-10lu │ %-10lu ┃%-10lu ┃
┠─────┼────┬───┴┬────┬─┴──┬─────╂──────┨
┃ 月 租 费 │新业务费│人工长途│维 修 费│其 它 费│ 附 加 费 ┃ 合 计 ┃
┠─────┼────┼────┼────┼────┼─────╂──────┨
┃%-8.2f │%-7.2f│%-7.2f│%-7.2f│%-7.2f│%-8.2f ┃%-9.2f ┃
┠─────┴────┼────┴────┼────┴─────╂──────┨
┃ 单 位 │ 起 始 时 间 │ 终 止 时 间 ┃ 总 费 ┃
┠──────────┼─────────┼──────────╂──────┨
┃ 人 民 币 元 │%-4u年%2u月%2u日%2u时│%-4u年%2u月%2u日%2u时 ┃%-9.2f ┃
┗━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━┻━━━━━━┛
话 费 汇 总 报 表
┏━━━━━┯━━━━━━━━┯━━━━━━━┯━━━━━━━━┳━━━━━━┓
┃ 项 目 │ 国 际 长 途 │ 国 内 长 途 │ 市 话 ┃ 合 计 ┃
┠─────┼────────┼───────┼────────╂──────┨
┃ 话 费 │ 000000.00 │ 000000.00 │ 000000.00 ┃ 0000000.00 ┃
┠─────┼────────┼───────┼────────╂──────┨
┃ 时 长 │ 000000h00m │ 000000h00m │ 000000h00m ┃000000时00秒┃
┠─────┼────────┼───────┼────────╂──────┨
┃ 次 数 │ 000000000 │ 000000000 │ 000000000 ┃ 0000000000 ┃
┠─────┼────┬───┴┬────┬─┴──┬─────╂──────┨
┃ 月 租 费 │新业务费│人工长途│维 修 费│其 它 费│ 附 加 费 ┃ 合 计 ┃
┠─────┼────┼────┼────┼────┼─────╂──────┨
┃000000.00 │00000.00│00000.00│00000.00│00000.00│000000.00 ┃ 0000000.00 ┃
┠─────┴────┼────┴────┼────┴─────╂──────┨
┃ 单 位 │ 起 始 时 间 │ 终 止 时 间 ┃ 总 费 ┃
┠──────────┼─────────┼──────────╂──────┨
┃ 人 民 币 元 │0000--00--00--00--│ 0000--00--00--00-- ┃00000000.00 ┃
┗━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━┻━━━━━━┛
用 户 话 费 收 据
分机号码: 0123456
┏━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┓
┃ 项 目 │ 国际长途 │ 国内长途 │ 市内电话 │ 服务费 │ 合 计 ┃
┠────┼─────┼─────┼─────┼─────┼─────┨
┃ 话 费 │01234.67元│01234.67元│01234.67元│01234.67元│01234.67元┃
┠────┼─────┼─────┼─────┼─────┼─────┨
┃ 时 长 │0123时01分│0123时01分│0123时01分│ │0123时01分┃
┠────┼─────┼─────┼─────┼─────┼─────┨
┃ 次 数 │0123456789│0123456789│0123456789│ │0123456789┃
┗━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┛
结算时段: 0123年01月01日01时至0123年01月01日01时 制单: 0123年01月01日
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -