⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inq_fee.c

📁 BC3.1编译,小交换机计费系统.使用Dos做出如此好的界面,少有.
💻 C
📖 第 1 页 / 共 2 页
字号:
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <string.h>

#include <bio.inc>
#include <key.inc>
#include <menu.inc>
#include "feedef.h"

/* function  :
 * called by :
 * date      : 1993.12.11
 */
void inq_fee_all(void)
{
    UI   i, key;
    UI   position=0;
    FILE          *fp;
    PHONE_STRUCT  *phone;
    TABLE_STRUCT   phnfee_tbl = { 3, 97, 40, 18, 16, 10,
                                {40, 72, 64, 76, 44, 64, 64, 60, 64, 76},
				GREEN
			       };

    load_phone_tbl();

    fp = fopen(TotTimeFileName,"rb");
    if(fp == NULL)
    {
	message(TFEE_FILE_ERR);
        unload_phone_tbl();
	return;
    }
    fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
    fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
    fclose(fp);

    clr_DialWin(2);
    disp_inqfee_head(PHONE_FEE);
    draw_table(&phnfee_tbl);

    Newlen = phone_tbl_len();
    phone  = Phone_top;

    message_disp(8,"Enter 继续    Esc 终止");        /* press any key */

    for(i=0; i<Newlen; i++)
    {
	disp_a_phnfee(phone, position, i);
	position++;
	if( position >= 16 )
	{
            while(1)
            {
	        key = get_key1();
	        if(key == ESC)
	        {
	            fclose(fp);
                    unload_phone_tbl();
	            recover_screen(2);
	            message_end();
	            return;
	        }
	        else if(key == ENTER)
	        {
	            brush_tbl(10, 16, 7);
	            position = 0;
                    break;
	        }
            }
	}
	phone++;
    }

    key = get_key1();
    unload_phone_tbl();
    recover_screen(2);
    message_end();
    return;
}

/* function  :
 * called by :
 * date      : 1993.12.11
 */
void inq_afee_all(void)
{
    UI   i, key;
    UC   flag;
    UI   position=0;
    FILE          *fp;
    AUTHCD_STRUCT *authcd;
    TABLE_STRUCT ausfee_tbl = { 0, 97, 40, 18, 16, 10,
                                {42, 106, 66, 42, 66, 42, 66, 58, 66, 75},
				GREEN
			       };

    flag = load_authcd_tbl(0);
    if(flag == 0)                 /* charge.aus does not exist */
    {
       message(AUTHCD_FILE_ERR);
       return;
    }

    fp = fopen(TotTimeFileName,"rb");
    if(fp == NULL)
    {
	message(TFEE_FILE_ERR);
        unload_authcd_tbl();
	return;
    }
    fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
    fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
    fclose(fp);

    clr_DialWin(2);
    disp_inqfee_head(AUTH_FEE);
    draw_table(&ausfee_tbl);

    ANewlen = authcd_tbl_len();
    authcd  = Auth_cd_top;

    message_disp(8,"Enter 继续    Esc 终止");        /* press any key */

    for(i=0; i<ANewlen; i++)
    {
	disp_a_ausfee(authcd, position, i);

	position++;
	if( position >= 16 )
	{
            while(1)
            {
	        key = get_key1();
	        if(key == ESC)
	        {
                    unload_authcd_tbl();
	            recover_screen(2);
	            message_end();
	            return;
	        }
	        else if(key == ENTER)
	        {
	            brush_tbl(10, 16, 7);
	            position = 0;
                    break;
	        }
            }
	}
	authcd++;
    }

    key = get_key1();
    unload_authcd_tbl();
    recover_screen(2);
    message_end();
    return;
}



/* function  :
 * called by :
 * date      : 1993.12.11
 */
void inq_ufee_all(void)
{
    UI   position=0;
    FILE *fp, *fpu;
    UI   pnum=0, i, key;
    USERS_STRUCT user;
    PHONE_STRUCT phone = {"",0, 0,0,{0,0,0,0,0},0,0,0,0,0,0,0,0,0,0,0,0,0,{0,0,0,0,0}};
    TABLE_STRUCT usrfee_tbl = { 0, 97, 40, 18, 16, 11,
                                {38, 71, 39, 63, 71, 39, 63, 55, 55, 63, 71},
				GREEN
			       };

    load_phone_tbl();

    fp = fopen(TotTimeFileName,"rb");
    if(fp == NULL)
    {
	message(TFEE_FILE_ERR);
        unload_phone_tbl();
	return;
    }
    fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
    fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
    fclose(fp);

    clr_DialWin(2);
    disp_inqfee_head(DEPT_FEE);
    draw_table(&usrfee_tbl);

    fpu = fopen("gfsdata\\dept.dat","rb");
    if(fpu == NULL)
    {
	unload_phone_tbl();
	message(USER_FILE_ERR);
        recover_screen(2);
	return;
    }

    message_disp(8,"Enter 继续    Esc 终止");        /* press any key */

    pnum = 0;
    i = 0;
    while(fread(&user,sizeof(USERS_STRUCT),1,fpu) == 1)
    {
        clr_ufc(&phone, 0);
        cal_usr_fee(pnum, &user, &phone);

	disp_a_usrfee(&phone, user, position, i);

	position++;
	if( position >= 16 )
	{
            while(1)
            {
	        key = get_key1();
	        if(key == ESC)
	        {
	            fclose(fpu);
                    unload_phone_tbl();
	            recover_screen(2);
	            message_end();
	            return;
	        }
	        else if(key == ENTER)
	        {
	            brush_tbl(10, 16, 7);
	            position = 0;
                    break;
	        }
            }
	}

        i++;
	pnum += user.phones;
    }

    key = get_key1();
    fclose(fpu);
    unload_phone_tbl();
    message_end();
    recover_screen(2);
    return;
}

/* function  :
 * called by :
 * date      : 1993.12.11
 */
void inq_fee_part(void)
{
    UI   i, idx, key;
    UC   flag;
    UI   position=0;
    UI   lenth;
    UC   phoneno[10];
    UL   phone_no;
    FILE          *fp;
    PHONE_STRUCT  *phone;
    TABLE_STRUCT phnfee_tbl = { 3, 97, 40, 18, 16, 10,
                                {40, 72, 64, 76, 44, 64, 64, 60, 64, 76},
				GREEN
			       };

    flag = inp_phid_num(&phone_no, &lenth, INQUIRE, PHONE_NO);
    if(flag == 1)
	return;

    load_phone_tbl();

    fp = fopen(TotTimeFileName,"rb");
    if(fp == NULL)
    {
	message(TFEE_FILE_ERR);
        unload_phone_tbl();
	return;
    }
    fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
    fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
    fclose(fp);

    clr_DialWin(2);
    disp_inqfee_head(PHONE_FEE);
    draw_table(&phnfee_tbl);

    i = 0;
    Newlen = phone_tbl_len();
    phone  = Phone_top;

    ltoa(phone_no,phoneno,10);
    while(strcmp(phone->phone_no,phoneno) != 0)
    {
	i++;
	phone++;
    }

    idx = i;
    if( (idx+lenth) >= Newlen )
	 idx = Newlen;
    else
	 idx += lenth;

    message_disp(8,"Enter 继续    Esc 终止");        /* press any key */

    for(; i<idx; i++)
    {
	disp_a_phnfee(phone, position, i);

	position++;
	if( position >= 16 || (i == (idx-1) ) )
	{
            while(1)
            {
	        key = get_key1();
	        if(key == ESC)
	        {
	            fclose(fp);
                    unload_phone_tbl();
	            recover_screen(2);
	            message_end();
	            return;
	        }
	        else if(key == ENTER)
	        {
	            brush_tbl(10, 16, 7);
	            position = 0;
                    break;
	        }
            }
	}
	phone++;
    }

    unload_phone_tbl();
    recover_screen(2);
    message_end();
    return;
}

/* function  :
 * called by :
 * date      : 1993.12.11
 */
void inq_afee_part(void)
{
    UI   i, idx, key;
    UC   flag;
    UI   position=0;
    UI   lenth;
    UL   auth_cd;
    FILE          *fp;
    AUTHCD_STRUCT *authcd;
    TABLE_STRUCT ausfee_tbl = { 0, 97, 40, 18, 16, 10,
                                {42, 106, 66, 42, 66, 42, 66, 58, 66, 75},
				GREEN
			       };

    flag = inp_phid_num(&auth_cd, &lenth, INQUIRE, AUTH_CD);
    if(flag == 1)
	return;

    flag = load_authcd_tbl(0);
    if(flag == FALSE)                 /* charge.pho does not exist */
    {
       message(AUTHCD_FILE_ERR);
       return;
    }

    fp = fopen(TotTimeFileName,"rb");
    if(fp == NULL)
    {
	message(TFEE_FILE_ERR);
        unload_authcd_tbl();
	return;
    }
    fread(&Ps_time, sizeof(TIME_STRUCT), 1, fp);
    fread(&Pe_time, sizeof(TIME_STRUCT), 1, fp);
    fclose(fp);

    clr_DialWin(2);
    disp_inqfee_head(AUTH_FEE);
    draw_table(&ausfee_tbl);

    i = 0;
    ANewlen = authcd_tbl_len();
    authcd  = Auth_cd_top;

    while(authcd->auth_code != auth_cd)
    {
	i++;
	authcd++;
    }

    idx = i;
    if( (idx+lenth) >= ANewlen )
	 idx = ANewlen;
    else
	 idx += lenth;

    message_disp(8,"Enter 继续    Esc 终止");        /* press any key */

    for(; i<idx; i++)
    {
	disp_a_ausfee(authcd, position, i);

	position++;
	if( position >= 16 || (i == (idx-1) ) )
	{
            while(1)
            {
	        key = get_key1();
	        if(key == ESC)
	        {
	            fclose(fp);
                    unload_authcd_tbl();
	            recover_screen(2);
	            message_end();
	            return;
	        }
	        else if(key == ENTER)
	        {
	            brush_tbl(10, 16, 7);
	            position = 0;
                    break;
	        }
            }
	}
	authcd++;
    }

    fclose(fp);
    unload_authcd_tbl();
    recover_screen(2);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -