credit_rpt_tool.c

来自「在SCO UNIX制定界面程序 可根据文件配制菜单,而不必修改源程序,非常方便」· C语言 代码 · 共 1,130 行 · 第 1/3 页

C
1,130
字号
	fprintf(fp, "BTS-702%44s清算日期: %s-%s\n", " ", s_logic_date1 , e_logic_date1 );
	get_bank_name(G_bankid, "00", bank_name);
	getdatef(cre_date, "/");
	gettimef(cre_time, ":");
	fprintf(fp, "%-5.5s%-58s%s %s\n", G_bankid, bank_name, cre_date, cre_time);
	fprintf(fp, "--------------------------------------------------------------------------------------------\n" );

	fprintf(fp, "%-10s %14s %8s %14s %8s %14s %8s\n", "网点号", "贷记金额", "贷记笔数", "借记金额", "借记笔数", "总金额", "总笔数");

	fprintf(fp, "--------------------------------------------------------------------------------------------\n" );

}

void FileDetail_wd_hz ( WD_RPT_ITEM *w_r_item )
{
	if ( wd_hz_fp == NULL ) return ;
	
	fp = wd_hz_fp;

	fprintf(fp, "%-15.15s %14.2lf %8d %14.2lf %8d %14.2lf %8d\n", w_r_item->m_id, w_r_item->credit_amt, w_r_item->credit_num, w_r_item->debit_amt, w_r_item->debit_num, w_r_item->credit_amt-w_r_item->debit_amt, w_r_item->credit_num+w_r_item->debit_num );

}

void FileTail_wd_hz ( WD_RPT_TOTAL *wd_rpt_total )
{
	if ( wd_hz_fp == NULL ) return ;
	
	fp = wd_hz_fp;

	fprintf(fp, "--------------------------------------------------------------------------------------------\n" );
	if (wd_rpt_total->credit_num + wd_rpt_total->debit_num)
		fprintf(fp, "%-10s %14.2lf %8d %14.2lf %8d %14.2lf %8d \n", "合  计", wd_rpt_total->credit_amt, wd_rpt_total->credit_num, wd_rpt_total->debit_amt, wd_rpt_total->debit_num, wd_rpt_total->credit_amt-wd_rpt_total->debit_amt , wd_rpt_total->credit_num+wd_rpt_total->debit_num);
	
	fprintf ( fp , "\n\n\n" );
}


void FileHead_bank_up_hz ()
{
	if ( cre_bank_up_hz_fp == NULL ) {
		cre_bank_up_hz_fp = fopen ( file1 , "w+" );
		
		if ( cre_bank_up_hz_fp == NULL ) 
			return ;
	}
	
	fp = cre_bank_up_hz_fp;

	fprintf(fp, "%38s中国银行BTS系统信用卡\n", " ");
	fprintf(fp, "%38s全辖清算上报汇总报表\n", " ");
	str2date(logic_date1, logic_date, "/");
	fprintf(fp, "BTS-600%72s清算日期: %s\n", " ", logic_date1);
	get_bank_name(G_bankid, "00", bank_name);
	getdatef(cre_date, "/");
	gettimef(cre_time, ":");
	fprintf(fp, "%-5.5s%-75s%s %s\n", G_bankid, bank_name, cre_date, cre_time);
	fprintf(fp, "-------------------------------------------------------------------------------------------------------------\n");

	fprintf(fp, "%-8s %-20s %14s %8s %14s %8s %14s %6s\n",
	"联行行号", "联行名称", "贷记金额", "贷记笔数", "借记金额", "借记笔数", "轧差金额", "笔数");

	fprintf(fp, "-------------------------------------------------------------------------------------------------------------\n");

}

void FileDetail_bank_up_hz ( BANK_RPT_ITEM *b_r_item )
{
	if ( cre_bank_up_hz_fp == NULL ) return ;
	
	fp = cre_bank_up_hz_fp;

	fprintf(fp, "%-8.8s %-20.20s %14.2lf %8d %14.2lf %8d %14.2lf %6d\n", b_r_item->bank_id, b_r_item->bank_name, b_r_item->up_credit_amt, b_r_item->up_credit_num, b_r_item->up_debit_amt, b_r_item->up_debit_num, b_r_item->up_credit_amt-b_r_item->up_debit_amt , b_r_item->up_credit_num+b_r_item->up_debit_num);

}

void FileTail_bank_up_hz ( BANK_RPT_TOTAL *bank_rpt_total )
{
	if ( cre_bank_up_hz_fp == NULL ) return ;
	
	fp = cre_bank_up_hz_fp;

	fprintf(fp, "-------------------------------------------------------------------------------------------------------------\n");
	if (bank_rpt_total->up_credit_num + bank_rpt_total->up_debit_num) fprintf(fp, "%-8.8s %-20s %14.2lf %8d %14.2lf %8d %14.2lf %6d\n", "总    计", " ", bank_rpt_total->up_credit_amt, bank_rpt_total->up_credit_num, bank_rpt_total->up_debit_amt, bank_rpt_total->up_debit_num, bank_rpt_total->up_credit_amt-bank_rpt_total->up_debit_amt, bank_rpt_total->up_credit_num+bank_rpt_total->up_debit_num);

}

void FileHead_bank_down_hz ()
{
	if ( cre_bank_down_hz_fp == NULL ) {
		cre_bank_down_hz_fp = fopen ( file2 , "w+" );
		
		if ( cre_bank_down_hz_fp == NULL ) 
			return ;
	}
	
	fp = cre_bank_down_hz_fp;

	fprintf(fp, "%38s中国银行BTS系统信用卡\n", " ");
	fprintf(fp, "%38s全辖清算下划汇总报表\n", " ");
	str2date(logic_date1, logic_date, "/");
	fprintf(fp, "BTS-602%72s清算日期: %s\n", " ", logic_date1);
	get_bank_name(G_bankid, "00", bank_name);
	getdatef(cre_date, "/");
	gettimef(cre_time, ":");
	fprintf(fp, "%-5.5s%-75s%s %s\n", G_bankid, bank_name, cre_date, cre_time);
	fprintf(fp, "-------------------------------------------------------------------------------------------------------------\n");

	fprintf(fp, "%-8s %-20s %14s %8s %14s %8s %14s %6s\n",
	"联行行号", "联行名称", "贷记金额", "贷记笔数", "借记金额", "借记笔数", "轧差金额", "笔数");

	fprintf(fp, "-------------------------------------------------------------------------------------------------------------\n");

}

void FileDetail_bank_down_hz ( BANK_RPT_ITEM *b_r_item )
{
	if ( cre_bank_down_hz_fp == NULL ) return ;
	
	fp = cre_bank_down_hz_fp;

	fprintf(fp, "%-8.8s %-20.20s %14.2lf %8d %14.2lf %8d %14.2lf %6d\n", b_r_item->bank_id, b_r_item->bank_name, b_r_item->down_credit_amt, b_r_item->down_credit_num, b_r_item->down_debit_amt, b_r_item->down_debit_num, b_r_item->down_credit_amt-b_r_item->down_debit_amt , b_r_item->down_credit_num+b_r_item->down_debit_num);

}

void FileTail_bank_down_hz ( BANK_RPT_TOTAL *bank_rpt_total )
{
	if ( cre_bank_down_hz_fp == NULL ) return ;
	
	fp = cre_bank_down_hz_fp;

	fprintf(fp, "-------------------------------------------------------------------------------------------------------------\n");
	if (bank_rpt_total->down_credit_num + bank_rpt_total->down_debit_num) fprintf(fp, "%-8.8s %-20s %14.2lf %8d %14.2lf %8d %14.2lf %6d\n", "总    计", " ", bank_rpt_total->down_credit_amt, bank_rpt_total->down_credit_num, bank_rpt_total->down_debit_amt, bank_rpt_total->down_debit_num, bank_rpt_total->down_credit_amt-bank_rpt_total->down_debit_amt, bank_rpt_total->down_credit_num+bank_rpt_total->down_debit_num);

}

void FileHead_bank_in_fee ()
{
	if ( cre_bank_in_fee_fp == NULL ) {
		cre_bank_in_fee_fp = fopen ( file3 , "w+" );
		
		if ( cre_bank_in_fee_fp == NULL ) 
			return ;
	}
	
	fp = cre_bank_in_fee_fp;

	fprintf(fp, "%14s中国银行BTS系统信用卡\n", " ");
	fprintf(fp, "%14s全辖清算应收手续费报表\n", " ");
	str2date(logic_date1, logic_date, "/");
	fprintf(fp, "BTS-604%24s清算日期: %s\n", " ", logic_date1);
	get_bank_name(G_bankid, "00", bank_name);
	getdatef(cre_date, "/");
	gettimef(cre_time, ":");
	fprintf(fp, "%-5.5s%-27.27s%s %s\n", G_bankid, bank_name, cre_date, cre_time);
	fprintf(fp, "---------------------------------------------------\n");

	fprintf(fp, "%-8s %-20s %14s %6s\n", "联行行号", "联行名称", "金额", "笔数");

	fprintf(fp, "---------------------------------------------------\n");
}

void FileDetail_bank_in_fee ( BANK_RPT_ITEM *b_r_item )
{
	if ( cre_bank_in_fee_fp == NULL ) return ;
	
	fp = cre_bank_in_fee_fp;

	fprintf(fp, "%-8.8s %-20.20s %14.2lf %6d\n", b_r_item->bank_id, b_r_item->bank_name, b_r_item->in_fee_amt , b_r_item->in_fee_num );

}

void FileTail_bank_in_fee ( BANK_RPT_TOTAL *b_r_total )
{
	if ( cre_bank_in_fee_fp == NULL ) return ;
	
	fp = cre_bank_in_fee_fp;

	fprintf(fp, "---------------------------------------------------\n");
	if (b_r_total->in_fee_num) fprintf(fp, "%-8.8s %-20s %14.2lf %6d\n", "总    计", " ", b_r_total->in_fee_amt , b_r_total->in_fee_num );

}

void FileHead_bank_out_fee ()
{
	if ( cre_bank_out_fee_fp == NULL ) {
		cre_bank_out_fee_fp = fopen ( file4 , "w+" );
		
		if ( cre_bank_out_fee_fp == NULL ) 
			return ;
	}
	
	fp = cre_bank_out_fee_fp;

	fprintf(fp, "%14s中国银行BTS系统信用卡\n", " ");
	fprintf(fp, "%14s全辖清算应付手续费报表\n", " ");
	str2date(logic_date1, logic_date, "/");
	fprintf(fp, "BTS-605%24s清算日期: %s\n", " ", logic_date1);
	get_bank_name(G_bankid, "00", bank_name);
	getdatef(cre_date, "/");
	gettimef(cre_time, ":");
	fprintf(fp, "%-5.5s%-27.27s%s %s\n", G_bankid, bank_name, cre_date, cre_time);
	fprintf(fp, "---------------------------------------------------\n");

	fprintf(fp, "%-8s %-20s %14s %6s\n", "联行行号", "联行名称", "金额", "笔数");

	fprintf(fp, "---------------------------------------------------\n");
}

void FileDetail_bank_out_fee ( BANK_RPT_ITEM *b_r_item )
{
	if ( cre_bank_out_fee_fp == NULL ) return ;
	
	fp = cre_bank_out_fee_fp;

	fprintf(fp, "%-8.8s %-20.20s %14.2lf %6d\n", b_r_item->bank_id, b_r_item->bank_name, b_r_item->out_fee_amt , b_r_item->out_fee_num );

}

void FileTail_bank_out_fee ( BANK_RPT_TOTAL *b_r_total )
{
	if ( cre_bank_out_fee_fp == NULL ) return ;
	
	fp = cre_bank_out_fee_fp;

	fprintf(fp, "---------------------------------------------------\n");
	if (b_r_total->out_fee_num) fprintf(fp, "%-8.8s %-20s %14.2lf %6d\n", "总    计", " ", b_r_total->out_fee_amt , b_r_total->out_fee_num );

}

void close_all_file ()
{
	if ( wd_mx_fp != NULL ) {
		fclose ( wd_mx_fp );
		wd_mx_fp = NULL;
	}

	if ( cre_bank_up_mx_fp != NULL ) {
		fclose ( cre_bank_up_mx_fp );
		cre_bank_up_mx_fp = NULL;
	}

	if ( cre_bank_down_mx_fp != NULL ) {
		fclose ( cre_bank_down_mx_fp );
		cre_bank_down_mx_fp = NULL;
	}

	if ( mer_total_fp != NULL ) {
		fclose ( mer_total_fp );
		mer_total_fp = NULL;
	}

	if ( wd_hz_fp != NULL ) {
		fclose ( wd_hz_fp );
		wd_hz_fp = NULL;
	}

	if ( cre_bank_up_hz_fp != NULL ) {
		fclose ( cre_bank_up_hz_fp );
		cre_bank_up_hz_fp = NULL;
	}

	if ( cre_bank_down_hz_fp != NULL ) {
		fclose ( cre_bank_down_hz_fp );
		cre_bank_down_hz_fp = NULL;
	}
	
	if ( cre_bank_in_fee_fp != NULL ) {
		fclose ( cre_bank_in_fee_fp );
		cre_bank_in_fee_fp = NULL;
	}

	if ( cre_bank_out_fee_fp != NULL ) {
		fclose ( cre_bank_out_fee_fp );
		cre_bank_out_fee_fp = NULL;
	}

	if ( mer_bhz_fp != NULL ) {
		fclose ( mer_bhz_fp );
		mer_bhz_fp = NULL;
	}
	
	if ( mer_bc_mx_fp != NULL ) {
		fclose ( mer_bc_mx_fp );
		mer_bc_mx_fp = NULL;
	}
	
	if ( edc_bc_mx_fp != NULL ) {
		fclose ( edc_bc_mx_fp );
		edc_bc_mx_fp = NULL;
	}
	
	if ( edc_bhz_fp != NULL ) {
		fclose ( edc_bhz_fp );
		edc_bhz_fp = NULL;
	}
}

void free_all ()
{
TER_RPT_ITEM	*p, *p1;
CARD_ITEM	*c , *c1;
int	i;

	if ( mer_rpt_item != NULL ) {
		for ( i=0 ; i < mer_rpt_cnt ; i++ ) {
			p = mer_rpt_item[i].ter_ptr;

			while ( p != NULL ) {
				c = p->card_item ;
				
				while ( c != NULL ) {
					c1 = c ;
					c = c->next;
					free ( c1 );
				}

				p1 = p;
				p = p->next;
				free ( p1 );
			}
			
			c = mer_rpt_item[i].card_item;

			while ( c != NULL ) {
				c1 = c ;
				c = c->next;
				free ( c1 );
			}
		}
		
		free ( mer_rpt_item );
		mer_rpt_item = NULL;
	}
	
	if ( wd_rpt_item != NULL ) {
		free ( wd_rpt_item );
		wd_rpt_item = NULL;
	}
	
	if ( bank_rpt_item != NULL ) {
		free ( bank_rpt_item );
		bank_rpt_item = NULL;
	}
}

void init_all ()
{
	bank_rpt_item = NULL;
	bank_rpt_cnt = 0;
	memset(&bank_rpt_total, 0, sizeof(BANK_RPT_TOTAL));

	mer_rpt_item = NULL;
	mer_rpt_cnt = 0;
	memset(&mer_rpt_total, 0, sizeof(MER_RPT_TOTAL));

	wd_rpt_item = NULL;
	wd_rpt_cnt = 0;
	memset(&wd_rpt_total, 0, sizeof(WD_RPT_TOTAL));

	line = 0;

	wd_mx_fp=NULL;
	cre_bank_up_mx_fp=NULL;
	cre_bank_down_mx_fp=NULL;
	mer_total_fp=NULL;
	wd_hz_fp=NULL;
	cre_bank_up_hz_fp=NULL;
	cre_bank_down_hz_fp=NULL;
	cre_bank_in_fee_fp=NULL;
	cre_bank_out_fee_fp=NULL;
	mer_bc_mx_fp=NULL;
	mer_bhz_fp=NULL;
	edc_bc_mx_fp=NULL;
	edc_bhz_fp = NULL;
}

⌨️ 快捷键说明

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