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

📄 cmsb32.sqc

📁 一整套完整的银行卡系统源代码
💻 SQC
字号:
/******************************************************************** **   源码文件名称 : cmsB32.SQC **   所属子系统   : CMS  **   当前文件版本 : 4.0.0.0 **   作者         : Feng **   版本创建日期 : 2004/09/21 **   功能描述     : 银联中心清算手续费分配子交易 **   修改记录     : **   修改人       修改日期     修改日期*********************************************************************/#include "code.h"#include "attrdef.h"#include "sysdef.h"#include "pubcom.h"#include "cmscode.h"#include "cmstxdet.h"#include "cmsupayfeereg.h"#include "pubcurrencyinfo.h"EXEC SQL INCLUDE SQLCA;int cmsClsAgentFeeAssign( PUBCOM *pstPubcom ){	/*定义局部变量*/	struct	cmsupayfeereg	stCmsFeeReg;		/* 网点待分配手续费表*/	int		iRtn;								/* 函数返回值	*/	char	acBrc[ BRC_LEN + 1 ];				/* 交易机构		*/	char	acTranDevType[ CHANNELID_LEN + 1 ];	/* 交易渠道		*/	char	acTranKind[ TRANTYPE_LEN + 1 ];		/* 交易种类		*/	char	acTranDevTypeComm[ 70 + 1 ];	/* 交易渠道描述	*/	char	acTranKindComm[ 70 + 1 ];		/* 交易种类描述	*/	char	acCcy[ CCY_LEN + 1 ];				/* 交易币种		*/	double	dAmount1;							/* 借方发生额	*/	double	dAmount2;							/* 贷方发生额	*/	double	dFee;								/* 手续费		*/	long	lNum;								/* 记录数		*/	int		iBegin=0;							/* 初始标志		*/	EXEC SQL	BEGIN DECLARE SECTION;	char	acSettleDate[ DATE_LEN + 1 ];		/* 清算日期		*/	short	id_Amount1;	short	id_Amount2;	short	id_Fee;	short	id_Num;	EXEC SQL	END DECLARE SECTION;	strcpy( g_acRspCode,  RSP_OK );	strcpy( g_acTrcMsg, "子交易: 银联中心清算手续费分配预处理" );	TRCLOG4	/* 初始化 */	memset( acSettleDate,		0x00,	sizeof( acSettleDate ) );	memset( &stCmsFeeReg,	0x00, sizeof( struct cmsupayfeereg ) );	memset( acBrc,			0x00,	sizeof( acBrc ) );	memset( acCcy,			0x00,	sizeof( acCcy ) );	memset( acTranDevType,	0x00,	sizeof( acTranDevType ) );	memset( acTranKind,		0x00,	sizeof( acTranKind ) );	dAmount1 = 0.0;	dAmount2 = 0.0;	dFee = 0.0;	lNum = 0;	id_Amount1 = id_Amount2 = id_Fee = 0;	/* 取数据字典值 */	getstring( "QueryDate",		acSettleDate			);	sprintf( g_acTrcMsg,  "SettleDate=[%s]", acSettleDate );	TRCLOG3	/* 从cmstxdet和cmstxdethis中手续费分配入帐交易 */	EXEC SQL DECLARE pos_1 CURSOR FOR			SELECT  brc, ccy, trandevtype, trankind, tranamt, amt2,					bankassfee, trandevtypecomm, trankindcomm			FROM	cmstxdet			WHERE	settledate = :acSettleDate			AND		cardtrantype ='01'			AND		validf = '0' 		 UNION ALL			SELECT  brc, ccy, trandevtype, trankind, tranamt, amt2,					bankassfee, trandevtypecomm, trankindcomm			FROM	cmstxdethis			WHERE	settledate = :acSettleDate			AND		cardtrantype ='01'			AND		validf = '0' 			ORDER BY ccy,brc,trandevtype,trankind;	SQLOPENCUR(pos_1,"pos_1")	if ( SQLCODE )	{		strcpy( g_acRspCode, "PUB400" );		sprintf( g_acRspMsg, "手续费分配入帐交易[%ld]", SQLCODE );		ERRLOG		goto Exit;	}	while ( 1 )	{		pubInitCmstxdet();		EXEC SQL	FETCH	pos_1					INTO	:cmstxdet_brc, :cmstxdet_ccy, 							:cmstxdet_trandevtype, :cmstxdet_trankind,							:cmstxdet_tranamt:id_Amount1,							:cmstxdet_amt2:id_Amount2,							:cmstxdet_bankassfee:id_Fee,							:cmstxdet_trandevtypecomm,							:cmstxdet_trankindcomm;		sprintf( g_acTrcMsg,  "SQLCODE=[%d]", SQLCODE  );		TRCLOG3		if ( SQLCODE && SQLCODE != SQLNOTFOUND )		{			strcpy( g_acRspCode, "PUB400" );			sprintf( g_acRspMsg, "手续费分配入帐交易[%ld]", SQLCODE );			ERRLOG			goto Exit;		}		else if ( SQLCODE == SQLNOTFOUND )		{			strcpy( cmstxdet_brc,	"END" );		}				if ( id_Amount1 < 0 )	cmstxdet_tranamt =0.0;		if ( id_Amount2 < 0 )	cmstxdet_amt2 =0.0;		if ( id_Fee < 0 )		cmstxdet_bankassfee =0.0;		strpack( cmstxdet_trankindcomm );		strpack( cmstxdet_trandevtypecomm );		strpack( cmstxdet_trankind );		strpack( cmstxdet_trandevtype );		strpack( cmstxdet_brc );		strpack( cmstxdet_ccy );		sprintf( g_acTrcMsg,  "acBrc=[%s]", cmstxdet_brc  );		TRCLOG3		if ( strcmp( cmstxdet_ccy, acCcy ) 				|| strcmp( cmstxdet_brc, acBrc )				|| strcmp( cmstxdet_trandevtype, acTranDevType ) 				|| strcmp( cmstxdet_trankind, acTranKind ) )		{			if ( strcmp( cmstxdet_ccy, acCcy ) 				&& strcmp( cmstxdet_brc, "END" ) )			{				/* 获取币种信息 */				pubInitPubcurrencyinfo( );				strcpy( pubcurrencyinfo_ccy, 	cmstxdet_ccy );				EXEC SQL	SELECT	chname 							INTO	:pubcurrencyinfo_chname							FROM	pubcurrencyinfo							WHERE	ccy = :pubcurrencyinfo_ccy;				if ( SQLCODE )				{					strcpy( g_acRspCode, "PUB400" );					sprintf(g_acRspMsg,"统计卡余额交易,获取币种[%ld]",SQLCODE);					ERRLOG					goto Exit;				}				strpack( pubcurrencyinfo_chname );			}			if ( iBegin == 0 )			{				strcpy( acCcy,			cmstxdet_ccy			);				strcpy( acBrc,			cmstxdet_brc			);				strcpy( acTranDevType,	cmstxdet_trandevtype	);				strcpy( acTranKind,		cmstxdet_trankind		);				strcpy( acTranDevTypeComm,	cmstxdet_trandevtypecomm);				strcpy( acTranKindComm,		cmstxdet_trankindcomm	);				iBegin = 1 ;			}			else			{				memset( &stCmsFeeReg,	0x00, sizeof( struct cmsupayfeereg ) );				strcpy( stCmsFeeReg.brc,		acBrc			);				strcpy( stCmsFeeReg.ccy,		acCcy			);				strcpy( stCmsFeeReg.ccycomm,	pubcurrencyinfo_chname	);				strcpy( stCmsFeeReg.trandevtypecomm,acTranDevTypeComm);				strcpy( stCmsFeeReg.trankindcomm,	acTranKindComm	);				strcpy( stCmsFeeReg.trandevtype,acTranDevType	);				strcpy( stCmsFeeReg.trankind,	acTranKind		);				strcpy( stCmsFeeReg.settledate,	acSettleDate	);				if ( dAmount1 < 0.005 )					stCmsFeeReg.amt = dAmount2;				else					stCmsFeeReg.amt = dAmount1;				stCmsFeeReg.cnt = lNum;				stCmsFeeReg.fee = dFee;				stCmsFeeReg.validf[ BIT1_LEN ] = '0'; /* 未入帐 */				if ( stCmsFeeReg.amt > 0.005						|| stCmsFeeReg.fee > 0.005						|| stCmsFeeReg.cnt > 0 )				{					if ( pubInstCmsupayfeereg( &stCmsFeeReg ) )					{						ERRLOG						goto Exit;					}				}				strcpy( acCcy,			cmstxdet_ccy			);				strcpy( acBrc,			cmstxdet_brc			);				strcpy( acTranDevType,	cmstxdet_trandevtype	);				strcpy( acTranKind,		cmstxdet_trankind		);				strcpy( acTranDevTypeComm,	cmstxdet_trandevtypecomm);				strcpy( acTranKindComm,		cmstxdet_trankindcomm	);				dAmount1 = 0.0;				dAmount2 = 0.0;				dFee = 0.0;				lNum = 0;			}			if ( !strcmp( cmstxdet_brc, "END" ) )				break;		}		dAmount1 += cmstxdet_tranamt;		dAmount2 += cmstxdet_amt2;		dFee += cmstxdet_bankassfee;		lNum ++;	}		/* 子交易出口 */ 	Exit:	SQLCLOSECUR(pos_1,"pos_1")	strcpy( g_acTrcMsg, "子交易: 银联中心清算手续费分配结束.." );	TRCLOG4	if( !strcmp( g_acRspCode, RSP_OK ) )		return SUCCESS;	else		return FAILED ;}

⌨️ 快捷键说明

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