?? cal_fee.c
字號:
}
}
if(flag == 0)
{
time1->year = time2->year;
time1->month = time2->month;
time1->day = time2->day;
time1->hour = time2->hour;
}
return;
}
/* function : calculate the total dialing fee for all the phone
* called by : statistics()
* date : 1993.10.9
*/
void clr_one_rcd(UL phone_no, UC isauthcd)
{
UI i;
UC phone[10], flag;
FILE *acc_fp;
struct time tt;
struct date dd;
ACC_STRUCT acc;
getdate(&dd);
gettime(&tt);
acc.seral_no.year = (UC) (dd.da_year-1900);
acc.seral_no.month = (UC) dd.da_mon;
acc.seral_no.day = (UC) dd.da_day;
acc.seral_no.hour = tt.ti_hour;
acc.seral_no.min = tt.ti_min;
acc.seral_no.sec = tt.ti_sec;
acc.flag = FEE_ACC;
acc.phone_no = phone_no;
acc.intern_time = Account.intern_time;
acc.intern_charge = Account.intern_charge;
acc.intern_count = Account.intern_count;
acc.nation_time = Account.nation_time ;
acc.nation_charge = Account.nation_charge;
acc.nation_count = Account.nation_count;
acc.local_time = Account.local_time;
acc.local_charge = Account.local_charge;
acc.local_count = Account.local_count;
acc.month_lease = Account.month_lease;
for(i=0; i<5; i++)
acc.addfee[i] = Account.addfee[i];
message_disp(8,"正在對結算話單作已結標記, 請稍候..."); /* calculating, please wait... */
stamp_rcd(IDD, phone_no, isauthcd);
stamp_rcd(DDD, phone_no, isauthcd);
stamp_rcd(LDD, phone_no, isauthcd);
message_end();
message_disp(8,"正在記流水帳, 請稍候..."); /* calculating, please wait... */
acc_fp = fopen("gfsdata\\feeacc.dat", "ab");
fwrite(&acc, sizeof(ACC_STRUCT), 1, acc_fp);
fclose(acc_fp);
message_end();
message_disp(8,"正在清理押金記錄, 請稍候..."); /* calculating, please wait... */
flag = load_cash_tbl(PHONE_CASH);
if(flag != 1) /* cash.dat does not exist */
Cashflg[PHONE_CASH] = 0;
else
Cash_len[PHONE_CASH] = cash_tbl_len(PHONE_CASH);
/* handle cash in pledge */
if(Cashflg[PHONE_CASH])
{
ltoa(phone_no, phone, 10);
temp_cash = binary_cash(phone, PHONE_CASH);
if( (temp_cash != NULL) && (temp_cash->flag ==CASH_ON) \
&& (temp_list.auth_code == 0xaaaaaa) )
{
temp_cash->cash = 0;
temp_cash->limit = 0;
temp_cash->flag = CASH_OFF;
}
save_cash_tbl(PHONE_CASH);
unload_cash_tbl(PHONE_CASH);
}
message_end();
return;
}
void acount_one(UC isauthcd)
{
UL phone_no;
UC flag, ret_val;
UI key;
USERS_STRUCT nil = {0, "", 0};
PHONE_STRUCT phone;
PHONE_STRUCT *phonep;
AUTHCD_STRUCT *authcd;
UC phoneno[9];
flag = take_all_record();
if(flag != 1) return;
if(isauthcd == AUTH_CD)
{
flag = input_auth_cd(&phone_no, 5);
if(flag == 2)
return;
else if(flag == FALSE) /* the user no does not exist */
{
message(AUTHCD_NOT_EXIST);
return;
}
flag = load_authcd_tbl(0);
if(flag != TRUE)
Authflg = OFF;
else {
Authflg = ON;
authcd = binary_authcd(phone_no); /* locate the phone No */
}
}
else
{
flag = input_phone_no(&phone_no, 5);
if(flag == 2)
return;
else if(flag == FALSE) /* the phone no does not exist */
{
message(NO_NOT_EXIST);
return;
}
ltoa(phone_no, phoneno, 10);
load_phone_tbl();
Newlen = phone_tbl_len();
phonep = binary_search(phoneno);
}
cal_one_fee(phone_no, isauthcd);
if( (Account.local_charge+ Account.nation_charge+\
Account.intern_charge ) == 0)
{
message(NULL_ACCOUNT_ERR);
if(Authflg == ON && isauthcd == AUTH_CD)
{
authcd->auth_class = UNUSED_AUTH;
authcd->auth_set_flag = 1;
save_authcd_tbl(NOFRESH, 1);
unload_authcd_tbl();
}
if(isauthcd == PHONE_FEE)
{
phonep->class = 1;
phonep->set_flag = 1;
save_phone_tbl(NOFRESH, 1);
unload_phone_tbl();
}
return;
}
phone.intern_time = Account.intern_time;
phone.intern_charge = Account.intern_charge;
phone.intern_count = (UI)Account.intern_count;
phone.nation_time = Account.nation_time;
phone.nation_charge = Account.nation_charge;
phone.nation_count = (UI)Account.nation_count;
phone.local_time = Account.local_time;
phone.local_charge = Account.local_charge;
phone.local_count = (UI)Account.local_count;
phone.addfee[4] = Account.addfee[4];
message_disp(8,"Enter 繼續 Esc 終止"); /* press any key */
clr_DialWin(2);
htl_dsp_one(&phone, phone_no, isauthcd);
while(1)
{
key = get_key1();
if(key == ESC)
{
recover_screen(2);
message_end();
if(Authflg == ON && isauthcd == AUTH_CD)
unload_authcd_tbl();
if(isauthcd == PHONE_FEE)
unload_phone_tbl();
return;
}
else if(key == ENTER)
break;
}
recover_screen(2);
message_end();
inquire_one_record(phone_no, nil, ACCOUNT, isauthcd);
ret_val = select_1in2(11);
if( ret_val == 1 )
{
message_disp(8,"正在打印, 請稍候...");
if( htl_inv_one(&phone, phone_no, isauthcd, MULTY) == FALSE )
{
message_end();
if(Authflg == ON && isauthcd == AUTH_CD)
unload_authcd_tbl();
if(isauthcd == PHONE_FEE)
unload_phone_tbl();
return;
}
// print_one_record(phone_no, nil, ACCOUNT, isauthcd);
message_end();
}
message_disp(8,"正在打印, 請稍候...");
ret_val = select_1in2(4);
if( ret_val == 2 )
print_one_record(phone_no, nil, ACCOUNT, isauthcd);
message_end();
ret_val = select_1in2(5);
if( ret_val == 1 )
clr_one_rcd(phone_no, isauthcd);
if(Authflg == ON && isauthcd == AUTH_CD)
{
if( ret_val == 1)
{
authcd->auth_class = UNUSED_AUTH;
authcd->auth_set_flag = 1;
save_authcd_tbl(NOFRESH, 1);
}
unload_authcd_tbl();
}
if(isauthcd == PHONE_FEE)
{
if(ret_val == 1) /* success */
{
phonep->class = 1;
phonep->set_flag = 1;
save_phone_tbl(NOFRESH, 1);
}
unload_phone_tbl();
}
return;
}
void stamp_rcd(UC mode, UL phone_no, UC isauthcd)
{
FILE *fps, *fpd1, *fpd2;
if(mode == IDD)
fps = fopen("idd.dbf","rb");
else if(mode == DDD)
fps = fopen("ddd.dbf","rb");
else
fps = fopen("ldd.dbf","rb");
if(fps != NULL)
{
if(mode == IDD)
{
fpd1 = fopen("idd.del","wb");
fpd2 = fopen("idd.hst","ab");
}
else if(mode == DDD)
{
fpd1 = fopen("ddd.del","wb");
fpd2 = fopen("ddd.hst","ab");
}
else
{
fpd1 = fopen("ldd.del","wb");
fpd2 = fopen("ldd.hst","ab");
}
while(fread(&temp_list, sizeof(RECORD_STRUCT), 1, fps) == 1)
{
if( ( (isauthcd == PHONE_NO) && (temp_list.auth_code != 0xaaaaaa) ) ||\
( (isauthcd == AUTH_CD) && (temp_list.auth_code == 0xaaaaaa) ) )
{
fwrite(&temp_list, sizeof(RECORD_STRUCT), 1, fpd1);
continue;
}
if( (isauthcd == PHONE_NO) && (temp_list.caller2 != phone_no) )
{
fwrite(&temp_list, sizeof(RECORD_STRUCT), 1, fpd1);
continue;
}
if( (isauthcd == AUTH_CD) && (temp_list.auth_code != phone_no) )
{
fwrite(&temp_list, sizeof(RECORD_STRUCT), 1, fpd1);
continue;
}
if(temp_list.flag == FALSE)
{
fwrite(&temp_list, sizeof(RECORD_STRUCT), 1, fpd2);
continue;
}
temp_list.flag = FALSE;
fwrite(&temp_list, sizeof(RECORD_STRUCT), 1, fpd2);
}
fclose(fps);
fclose(fpd1);
fclose(fpd2);
if(mode == IDD)
{
fcopy("idd.del","idd.dbf"); /* .del to .dat */
fcopy("idd.del","idd.tmp"); /* .del to .tmp */
remove("idd.del");
}
else if(mode == DDD)
{
fcopy("ddd.del","ddd.dbf"); /* .del to .dat */
fcopy("ddd.del","ddd.tmp"); /* .del to .tmp */
remove("ddd.del");
}
else
{
fcopy("ldd.del","ldd.dbf"); /* .del to .dat */
fcopy("ldd.del","ldd.tmp"); /* .del to .tmp */
remove("ldd.del");
}
}
}
/* function : to Check if the call is local one or information one
* called by : cal_total_fee()
* date : 1996.03.9
*/
UC IsSpecialCall(UC *callee, UI len, UC mode)
{
SPECIAL_CALL *tbl;
UI i;
UC flag;
UC CalleeAsc[11];
flag = 0;
tbl = Call_top[mode];
for(i=0; i<10; i++)
CalleeAsc[i] = callee[i]+'0';
for(i=0; i<len; i++)
{
if(strncmp(CalleeAsc, tbl->phone_no, strlen(tbl->phone_no))==0)
{
flag = 1;
break;
}
tbl++;
}
return flag;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -