?? inq_afe.c
字號:
/* function: print the notified authcd fee
* called by:
* caller:
* date:
*/
UC prt_authcd_fee(AUTHCD_STRUCT *authcd, UI num)
{
UI i;
double total_f, serv_fee = 0;
UC aus_nam_buf[13];
struct date now;
if(check_prn() == FALSE) /* not ready */
return(FALSE);
if( num == 0 )
{
if(print_afehd() == FALSE)
return(FALSE);
if(print_afetbl() == FALSE)
return(FALSE);
if(print_afedtal() == FALSE)
return(FALSE);
}
else if( (num != 0) && ( (num)%Page_len == 0) /*&& Sys_mode.prt_m == LQ1600*/ )
{
getdate(&now);
if(print_afetbl() == FALSE)
return(FALSE);
if(prnf("匯總起止時間:%-4u年%2u月%2u日%2u時~%-4u年%2u月%2u日%2u時 制表時間:%-4u年%2u月%2u日\n",\
Ps_time.year, Ps_time.month, Ps_time.day, Ps_time.hour,\
Pe_time.year, Pe_time.month, Pe_time.day, Pe_time.hour, \
now.da_year, now.da_mon, now.da_day )\
== FALSE)
return(FALSE);
/* new page */
if(new_page() == FALSE)
return(FALSE);
if(print_afehd() == FALSE)
return(FALSE);
if(print_afetbl() == FALSE)
return(FALSE);
if(print_afedtal() == FALSE)
return(FALSE);
}
for(i=0; i<10; i++)
aus_nam_buf[i] = authcd->auth_usr_nam[i];
aus_nam_buf[i] = '\0';
total_f = (double)(authcd->local_charge)/100+\
((double)(authcd->nation_charge)+(double)(authcd->intern_charge))/100+\
(double)(authcd->addfee)/100+\
(double)(authcd->month_lease)/100;
if(prnf("%-4u %-12s %7.2f %4u %8.2f %4u %7.2f %6.2f %7.2f %9.2f\n",\
num, aus_nam_buf, (double)(authcd->local_charge)/100,\
authcd->local_count,\
(double)(authcd->nation_charge+authcd->intern_charge)/100,\
(authcd->nation_count + authcd->intern_count),\
(double)(authcd->addfee)/100,\
(double)(authcd->month_lease)/100,\
serv_fee, total_f) == FALSE)
return(FALSE);
return(TRUE);
}
UC print_afehd(void)
{
UC *head = " 授 權 用 戶 話 費 匯 總 表" ;
if(prnfd("\n%s\n\n", head) == FALSE)
return(FALSE);
return(TRUE);
}
UC print_afetbl(void)
{
if(prnf("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n")\
== FALSE)
return(FALSE);
return(TRUE);
}
UC print_afedtal(void)
{
if(prnf(" 授權用戶 市話 市話 長話 長話 附加 月租 服務\n")\
== FALSE)
return(FALSE);
if(prnf("序號 戶名稱 話費 次數 話費 次數 費 費 費 費用合計\n")\
== FALSE)
return(FALSE);
if(print_afetbl() == FALSE)
return(FALSE);
return(TRUE);
}
/* function : print the detailed information for the authcds from the input one
* to the end
* called by : statistic()
* date : 1993.12.11
*/
void prtafee_part(void)
{
UI i, idx;
UI lenth, j;
UC flag;
UL auth_cd;
double total_f;
FILE *fp;
AUTHCD_STRUCT *authcd;
struct date now;
fp = fopen(TotTimeFileName,"rb");
if(fp == NULL)
{
message(TFEE_FILE_ERR);
return;
}
fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
fclose(fp);
if(check_prn() == FALSE) /* not ready */
return;
flag = inp_phid_num(&auth_cd, &lenth, PRINT, AUTH_CD);
if(flag == 1)
return;
flag = load_authcd_tbl(0);
if(flag == 0) /* charge.pho does not exist */
{
message(AUTHCD_FILE_ERR);
return;
}
message_disp(8,"正在打印,請稍候..."); /* printing, please wait... */
ANewlen = authcd_tbl_len();
i = 0;
authcd = binary_authcd(auth_cd);
idx = i;
if( (idx+lenth) >= ANewlen )
idx = ANewlen;
else
idx += lenth;
j=0;
total_f = 0;
for(; i<idx; i++)
{
if(prt_authcd_fee(authcd, j) == FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
total_f += (double)(authcd->local_charge)/100+\
(double)(authcd->nation_charge+authcd->intern_charge)/100+\
(double)(authcd->addfee)/100+\
(double)(authcd->month_lease)/100;
authcd++;
j++;
}
if( print_total( total_f ) == FALSE )
{
unload_authcd_tbl();
message_end();
return;
}
if(print_afetbl() == FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
getdate(&now);
if(prnf("匯總起止時間:%-4u年%2u月%2u日%2u時~%-4u年%2u月%2u日%2u時 制表時間:%-4u年%2u月%2u日\n",\
Ps_time.year, Ps_time.month, Ps_time.day, Ps_time.hour,\
Pe_time.year, Pe_time.month, Pe_time.day, Pe_time.hour, \
now.da_year, now.da_mon, now.da_day )\
== FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
/* new page */
if(new_page() == FALSE)
{
unload_phone_tbl();
message_end();
return;
}
unload_authcd_tbl();
message_end();
return;
}
/* function : print the detailed information for all authcds
* called by : sta_rpt()
* date : 1993.12.11
*/
void prtafee_all(void)
{
UI i;
UC flag;
double total_f;
FILE *fp;
AUTHCD_STRUCT *authcd;
struct date now;
if(check_prn() == FALSE) /* not ready */
return;
fp = fopen(TotTimeFileName,"rb");
if(fp == NULL)
{
message(TFEE_FILE_ERR);
return;
}
fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
fclose(fp);
flag = load_authcd_tbl(0);
if(flag == 0) /* charge.pho does not exist */
{
message(AUTHCD_FILE_ERR);
return;
}
message_disp(8,"正在打印,請稍候..."); /* printing, please wait... */
ANewlen = authcd_tbl_len();
authcd = Auth_cd_top;
total_f = 0;
for(i=0; i<ANewlen; i++)
{
if(prt_authcd_fee(authcd, i) == FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
total_f += (double)(authcd->local_charge)/100+\
(double)(authcd->nation_charge+authcd->intern_charge)/100+\
(double)(authcd->addfee)/100+\
(double)(authcd->month_lease)/100;
authcd++;
}
if(print_total(total_f) == FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
if(print_afetbl() == FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
getdate(&now);
if(prnf("匯總起止時間:%-4u年%2u月%2u日%2u時~%-4u年%2u月%2u日%2u時 制表時間:%-4u年%2u月%2u日\n",\
Ps_time.year, Ps_time.month, Ps_time.day, Ps_time.hour,\
Pe_time.year, Pe_time.month, Pe_time.day, Pe_time.hour, \
now.da_year, now.da_mon, now.da_day )\
== FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
/* new page */
if(new_page() == FALSE)
{
unload_authcd_tbl();
message_end();
return;
}
unload_authcd_tbl();
message_end();
return;
}
/* function: invoice
* called by:
* caller: none
* date: 1994.12.5
*/
UC inv_aone(AUTHCD_STRUCT *authcd, UC opflg2, UC opflg3)
{
FILE *fp;
double tch;
UL th[4], tm[4], ttm, tcu;
struct date now;
UC *head[2] = {
" 用 戶 話 費 收 據",
" 授 權 戶 話 費 匯 總" };
if(check_prn() == FALSE) /* not ready */
return(FALSE);
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);
if(opflg3 != DETL)
{
if(prnfd("\n%s\n\n", head[0])==FALSE)
return(FALSE);
}
else
{
if(prnfd("\n%s\n\n", head[1])==FALSE)
return(FALSE);
}
if(prnf(" 授權戶名: %-s\n", authcd->auth_usr_nam) == FALSE)
return(FALSE);
if(print_invtbl1() == FALSE)
return(FALSE);
if(print_invdtl1() == FALSE)
return(FALSE);
if(print_invtbl2() == FALSE)
return(FALSE);
tch = (double)(authcd->intern_charge + authcd->nation_charge +\
authcd->local_charge)/100;
if( prnf("┃ 話 費 │ %9.2f │ %9.2f │ %9.2f │ %9.2f┃\n",\
(double)(authcd->intern_charge)/100, (double)(authcd->nation_charge)/100,\
(double)(authcd->local_charge)/100,\
tch)==FALSE)
return(FALSE);
if(print_invtbl2() == FALSE)
return(FALSE);
ttm = authcd->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 = authcd->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 = authcd->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 = authcd->intern_time + authcd->nation_time + authcd->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)
return(FALSE);
if(print_invtbl2() == FALSE)
return(FALSE);
tcu = (UL)(authcd->intern_count + authcd->nation_count +\
authcd->local_count);
if(prnf("┃ 次 數 │ %10u │ %10u │ %10u │ %10lu┃\n",\
authcd->intern_count, authcd->nation_count,\
authcd->local_count, tcu)==FALSE)
return(FALSE);
if(print_invtbl3() == FALSE)
return(FALSE);
if(print_invdtl2() == FALSE)
return(FALSE);
if(print_invtbl4() == FALSE)
return(FALSE);
tch = (double)(authcd->month_lease)/100+\
(double)(authcd->addfee)/100;
if(prnf("┃ %8.2f │ │ │ │ │ %8.2f │ %9.2f┃\n",\
(double)(authcd->month_lease)/100,\
(double)(authcd->addfee)/100,tch) == FALSE)
return(FALSE);
if(print_invtbl5() == FALSE)
return(FALSE);
if(opflg3 != DETL)
{
if(print_invdtl3() == FALSE)
return(FALSE);
}
else
{
if(print_invdtl4() == FALSE)
return(FALSE);
}
if(print_invtbl6() == FALSE)
return(FALSE);
tch = (double)authcd->intern_charge + (double)authcd->nation_charge +\
(double)authcd->local_charge;
tch += (double)authcd->month_lease;
tch += (double)authcd->addfee;
if(prnf("┃ 人 民 幣 元 │%-4u年%2u月%2u日%2u時│%-4u年%2u月%2u日%2u時 │ %9.2f┃\n",\
Ps_time.year, Ps_time.month,\
Ps_time.day, Ps_time.hour,\
Pe_time.year, Pe_time.month,\
Pe_time.day, Pe_time.hour, tch/100\
)==FALSE)
return(FALSE);
if(print_invtbl7() == FALSE)
return(FALSE);
getdate(&now);
if(prnf(" 制表時間:%-4u年%-2u月%-2u日\n",now.da_year, now.da_mon, now.da_day ) == FALSE)
return(FALSE);
if(opflg2 == SINGLE)
{
/* new page */
if(new_page() == FALSE)
return(FALSE);
}
else
{
if(prnf("\n\n\n\n") == FALSE)
return(FALSE);
}
return(TRUE);
}
UC print_total(double total_f)
{
if(prnf(" 費用總計: %9.2f\n", \
total_f) == FALSE)
return FALSE;
else
return TRUE;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -