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

📄 cmsb23.sqc

📁 一整套完整的银行卡系统源代码
💻 SQC
字号:
/******************************************************************** **   源码文件名称 : cmsB23.SQC **   函数名称 	   : cms21B023 **   所属子系统   : CMS  **   当前文件版本 : 1.0.0.0 **   作        者 : ZhouR  **   版本创建日期 : 2004/10/14 **   功能描述     : 商户资金与手续费表打印 **   修改记录     : **   修改人       修改日期     修改日期*********************************************************************/#include    "sysdefine.h"#include    <stdio.h>#include	"pubcom.h"#include	"funcapi.h"#include    "code.h"#include    "attrdef.h"#include    "cmscode.h"#include	"cmstxdethis.h"#include 	"errlog.h"EXEC SQL INCLUDE sqlca;#define 	OVERPAGE	45       /* 满页行数 */ #define 	OVERLINE	5        /* 换行行数 */ #define		LIMIT		50struct	prtdata{	char	acBeginDate[DATE_LEN +1];           /* 起始帐务日期 */	char	acEndDate[DATE_LEN +1];             /* 终止帐务日期 */	char	acMid[MID_LEN +1];					/* 商户代码	*/	char	acNumber[BIT9_LEN + 1];		 		/* 笔数		*/	char	acTranAmt[TXAMT_LEN + 1];		 	/* 交易额	*/	char	acBankGetFee[TXAMT_LEN + 1];		/* 手续费	*/	char	acPayAmt[TXAMT_LEN + 1];			/* 应划款	*/};#define 	PRTLINE												\	if( prtline( fp, acFmtFile,acPrtData ) ) 					\	FUNCERR_PRO													\	iLineCount++;#define		PRTHEAD 											\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp,"title:%s", acBankname);						\	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "title0:%s|%s|%s|%d",							\		 pstPubcom->acBrc, acBeginDate, acEndDate, iPage );	    \	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "head:"	);									\	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "body:"	);									\	iLineCount++;#define		PRTBODY												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "body0:%s|%s|%s|%s|%s",				 		\			stPrtdata.acMid,  		stPrtdata.acNumber,			\			stPrtdata.acTranAmt,	stPrtdata.acBankGetFee,		\			stPrtdata.acPayAmt );								\	iLineCount++;												\	iLine	++ ;	#define		PRTFOOT												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "tail1:" );									\	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "bottm:%s", 									\			 pstPubcom->acTeller );								\	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "next:%s",pstPubcom->acTranDate );				\	iLineCount++;												\	iPage	++ ;	iLine	=	0 ;	int cms21B023(pstPubcom)struct          pubcom          *pstPubcom;{	EXEC SQL BEGIN DECLARE SECTION;	char	acWhrStr7[ 512 ];	char    acBeginDate[DATE_LEN + 1 ];         /* 起始日期 */ 	char    acEndDate[DATE_LEN + 1 ];           /* 终止日期 */ 	char    acMid[MID_LEN + 1 ];          		/* 商户代码 */	char    caMid[MID_LEN + 1 ];          		/* 商户代码 */	char    caBrc[BRC_LEN + 1 ];          		/* 机构码 */	long	Number = 0;		 					/* 笔数		*/	short   Number_ID;	double	TranAmt = 0.0;		 				/* 交易额	*/	short   TranAmt_ID;	double	BankGetFee = 0.0;					/* 手续费	*/	short   BankGetFee_ID;	EXEC SQL END   DECLARE SECTION;	long	acNumber = 0;		 				/* 笔数		*/	double	acTranAmt = 0.0;		 			/* 交易额	*/	double	acBankGetFee = 0.0;					/* 手续费	*/	double	acPayAmt = 0.0;						/* 应划款	*/	char	acBankname[ 41 ];	char    acBuffer[9];	FILE	*fp,*fmtfp;							/* 文件指针	*/ 	char	acSelStr[ 301 ];	char	acWhrStr[ 512 ];	char	acWhrStr1[ 512 ];	char	acWhrStr2[ 512 ];	char	acWhrStr3[ 512 ];	char	acWhrStr4[ 512 ];	char	acWhrStr5[ 512 ];	char	acWhrStr6[ 512 ];	int		iLineCount	=	0 ;	int		i, iPage, iLine ;	char	acFileName[ 101 ];	char	acFmtFile[ 101 ];	char	acPrtData[ 4096 ];	struct	prtdata	stPrtdata;	struct  cmstxdethis      stCmsTxdetHis;     	/* 外围交易登记簿历史表 */	memset( acMid,   		0x00, sizeof( acMid ));	memset( caBrc,   		0x00, sizeof( caBrc ));	memset( acBeginDate,   	0x00, sizeof( acBeginDate ));	memset( acBuffer, 	   	0x00, sizeof( acBuffer )   );	memset( acSelStr, 	   	0x00, sizeof( acSelStr )   );	memset( acWhrStr, 	   	0x00, sizeof( acWhrStr )   );	memset( acWhrStr1, 	   	0x00, sizeof( acWhrStr1 )  );	memset( acWhrStr2, 	   	0x00, sizeof( acWhrStr2 )  );	memset( acWhrStr3, 	   	0x00, sizeof( acWhrStr3 )  );	memset( acWhrStr4, 	   	0x00, sizeof( acWhrStr4 )  );	memset( acWhrStr5, 	   	0x00, sizeof( acWhrStr5 )  );	memset( acWhrStr6, 	   	0x00, sizeof( acWhrStr6 )  );	memset( acWhrStr7, 	   	0x00, sizeof( acWhrStr7 )  );	memset( &stCmsTxdetHis, 0x00, sizeof( struct cmstxdethis ));	memset( acBankname,    	0x00, sizeof( acBankname ) );	if ( pubGetBaseInfo("BANKNAME", acBankname ) )		FUNCERR_PRO	/* 取数据字典 */  	getstring( "Mid", 			acMid );	getstring( "BeginDate1", 	acBeginDate );	getstring( "EndDate1", 		acEndDate	);     	sprintf( g_acTrcMsg,"Mid[%s]BeginDate1[%s]EndDate1[%s]", 						acMid,acBeginDate,acEndDate );  	TRCLOG4    /*检查交易机构是否为中心机构,如果是,则申请机构可以为空,否则当申请机构为空时,将交易机构付给申请机构 */	if (!strcmp( pstPubcom->acBrcType, BRCTYPE_SITE)) /* 营业网点 */	{		if (strlen(caBrc) == 0)		{			strcpy( caBrc, pstPubcom->acBrc );			}		if (strcmp( pstPubcom->acBrc, caBrc))		{        	strcpy( g_acRspCode, "CMS214" );			pubCrtRspInfo( );			ERRLOG			goto Exit;		}	}	fp = (FILE *)BeginFile( pstPubcom, NULL );	if ( fp == NULL )	{		strcpy( g_acRspCode, "DPS902" );		pubCrtRspInfo( );		ERRLOG		return FAILED ;	}	sprintf( acFmtFile, "%s/fmt/cmsB23.fmt", getenv("HOME") );	sprintf( g_acFmtFile, acFmtFile );          	if( ( fmtfp=fopen(acFmtFile,"r") ) == NULL )	{                                           		strcpy( g_acTrcMsg, acFmtFile );        		TRCLOG2                                 		ERRLOG		goto Exit;	}	iLine	=	0 ;			iPage	=	1 ;	sprintf( acWhrStr1, "select mid,count(*),sum(tranamt),sum(bankgetfee) from cmstxdethis where 1=1");	if ( strlen ( caBrc ) )	{		sprintf( acWhrStr2, " and brc = '%s'",  caBrc );	}	if ( strlen ( acMid ) )	{		sprintf( acWhrStr3, " and mid = '%s'",  acMid );	}	if ( strcmp ( acBeginDate, INITDATE ) )	{		sprintf( acWhrStr4, " and trandate >= '%s'", acBeginDate );	}	if ( strcmp ( acEndDate, INITDATE ) )	{		sprintf( acWhrStr5, " and trandate <= '%s'", acEndDate );	}	sprintf( acWhrStr6, " and trandevtype='14' GROUP BY mid ORDER BY mid  WITH UR" );	sprintf( acWhrStr7, "%s%s%s%s%s%s", 			acWhrStr1,acWhrStr2,acWhrStr3,acWhrStr4,acWhrStr5,acWhrStr6 ); 	strcpy( g_acTrcMsg, acWhrStr7 ); TRCLOG4                        	sprintf( g_acTrcMsg,"BeginDate1[%s]EndDate1[%s]", 						stPrtdata.acBeginDate,stPrtdata.acEndDate );  	TRCLOG4	EXEC SQL PREPARE pre_1 FROM :acWhrStr7;	if ( SQLCODE )                      	{                                   		strcpy( g_acRspCode, "CMS1A7" );		pubCrtRspInfo( SQLCODE );       		ERRLOG                          		goto Exit;	}                                   	EXEC SQL    DECLARE gls_l_cur CURSOR FOR pre_1;	if(SQLCODE)	{		sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE);  		TRCLOG4        strcpy( g_acRspCode, "CMS110" );        pubCrtRspInfo("cmstxdethis",SQLCODE );		ERRLOG		goto Exit ;	}	SQLOPENCUR(gls_l_cur,"gls_l_cur")	if(SQLCODE)	{		sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE);  		TRCLOG4        strcpy( g_acRspCode, "CMS111" );        pubCrtRspInfo("cmstxdethis",SQLCODE );		ERRLOG		goto Exit ;	}	for( ; ; )	{		memset( &stPrtdata,	0x00,	sizeof( struct prtdata ) );		Number = 0;		TranAmt = 0.0;		BankGetFee = 0.0;		pubInitCmstxdethis();		EXEC SQL FETCH gls_l_cur into :cmstxdethis_mid,:Number:Number_ID,:TranAmt:TranAmt_ID,:BankGetFee:BankGetFee_ID;		if( SQLCODE == SQLNOTFOUND )	break ;		if(SQLCODE)		{			sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE);  			TRCLOG4            strcpy( g_acRspCode, "CMS112" );            pubCrtRspInfo("cmstxdethis",SQLCODE );			ERRLOG			goto Exit ;		}		acNumber = Number;		acTranAmt = TranAmt;		acBankGetFee = BankGetFee;		acPayAmt = acTranAmt - acBankGetFee;	if ( strcmp ( acBeginDate, INITDATE ) )	{		strcpy( stPrtdata.acBeginDate, acBeginDate );		}	if ( strcmp ( acEndDate, INITDATE ) )	{		strcpy( stPrtdata.acEndDate, acEndDate );		}		strcpy ( stPrtdata.acMid, 			cmstxdethis_mid  );		sprintf ( stPrtdata.acNumber,		"%ld", 	 acNumber 	);		sprintf ( stPrtdata.acTranAmt,		"%.2lf", acTranAmt 	);		sprintf ( stPrtdata.acBankGetFee,	"%.2lf", acBankGetFee  	);		sprintf ( stPrtdata.acPayAmt,		"%.2lf", acPayAmt  	);		sprintf(  g_acTrcMsg, "acBrc[%s],acCardNo[%s],acTranDate[%s],acTermTime[%s],acPayAmt[%s]", 				stPrtdata.acMid,stPrtdata.acNumber,stPrtdata.acTranAmt,stPrtdata.acBankGetFee,stPrtdata.acPayAmt);		TRCLOG4				if( iLine	==	0 ) { PRTHEAD }				PRTBODY				if( iLine % OVERPAGE == 0 )			{ PRTFOOT }	}		if( iLine < OVERPAGE && iLine != 0 )	{ PRTFOOT }	if( iLineCount == 0 )	{		strcpy( g_acRspCode, "999998" );		sprintf( g_acRspMsg, "无满足条件的纪录!" );		ERRLOG		goto	Exit ;	}	Exit:	fclose( fmtfp );	fclose( fp );	SQLCLOSECUR(gls_l_cur,"gls_l_cur")	if( !strcmp( g_acRspCode, RSP_OK ) )	{		SetInqFormid(pstPubcom, "") ;		return SUCCESS; 	}	else 		return FAILED ;}

⌨️ 快捷键说明

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