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

📄 cms666.sqc

📁 一整套完整的银行卡系统源代码
💻 SQC
字号:
/******************************************************************** **   源码文件名称 : cms666.SQC **   函数名称 	   : cms216066 **   所属子系统   : CMS  **   当前文件版本 : 1.0.0.0 **   作        者 : Feng **   版本创建日期 : 2005/03/15 **   功能描述     : 卡账户对帐单打印 **   修改记录     : **   修改人       修改日期     修改日期*********************************************************************/#include    "sysdefine.h"#include    <stdio.h>#include	"pubcom.h"#include	"funcapi.h"#include    "code.h"#include 	"errlog.h"#include    "attrdef.h"#include    "cmscode.h"#include	"cmscardinfo.h"#include	"cmschannel.h"#include	"cmsacctm.h"#include	"dpsaccountinfo.h"#include	"dpspersavelist.h"#include	"dpsunitsavelist.h"#include	"dpstermacclist.h"#include	"dpstermaccdyninfo.h"#include	"dpssaveaccdyninfo.h"#include	"dpstermprdinfo.h"#include	"dpssaveprdinfo.h"#include	"dpsacctlink.h"#include	"pubmemocode.h"EXEC SQL INCLUDE sqlca;#define 	OVERPAGE	45       /* 满页行数 */ #define 	OVERLINE	5        /* 换行行数 */ #define		LIMIT		50struct	prtdata{	char    acTranDate[DATE_LEN + 1];		/* 交易日期			*/	char	acCdFlg[ BIT5_LEN + 1 ];		/* 借贷标志			*/	char	acTranAmt[ BIT17_LEN+1];		/* 交易金额			*/	char	acBal[ BIT17_LEN+1];			/* 余额				*/	char    acTranBrc[BRC_LEN + 1];		    /* 交易机构码		*/	char    acChannel[BIT25_LEN + 1];	    /* 交易渠道			*/	char	acCardNo[CARDNO_LEN +1];		/* 卡号				*/	char    acMemoDesc[MEMO_LEN + 1];		/* 摘要				*/};#define 	PRTLINE												\	if( prtline( fp, acFmtFile,acPrtData ) ) 					\	FUNCERR_PRO													\	iLineCount++;#define		PRTHEAD 											\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "title:%s|%s|%s|%s|%d", acBankname, pstPubcom->acBrc, \			pstPubcom->acBrcName, pstPubcom->acTranDate, iPage	 );	\	iLineCount+=3;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "title1:%s|%s|%s", acToAcctNo,acToSubAcct,acCustomName ); \	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "head:"	);									\	iLineCount+=3;#define		PRTBODY												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "body:%s|%s|%s|%s|%s|%s|%s|%s", \			stPrtdata.acTranDate, stPrtdata.acCdFlg, stPrtdata.acTranAmt, \			stPrtdata.acBal, stPrtdata.acTranBrc, stPrtdata.acChannel, \			stPrtdata.acCardNo, stPrtdata.acMemoDesc ); \	iLineCount++; iLine	++ ;  iLineTotal++;	#define		PRTFOOT												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp, "tail1:" );									\	iLineCount++;												\	memset( acPrtData, 0x00, sizeof( acPrtData ) );				\	prtline( fp,"bottm:%s|%d", pstPubcom->acTeller, iLineTotal );\	iLineCount++; iPage	++ ;	iLine	=	0 ;		int cms216066(pstPubcom)struct          pubcom          *pstPubcom;{	EXEC SQL BEGIN DECLARE SECTION;	char	acWhrStr[ 512 ];	EXEC SQL END DECLARE SECTION;	char    acBeginDate[DATE_LEN + 1 ];      	/* 起始日期        */ 	char    acEndDate[DATE_LEN + 1 ];      		/* 终止日期        */ 	char    acToAcctNo[ACCT_LEN + 1 ];      	/* 卡号/账号       */ 	char    acToSubAcct[ACCT_LEN + 1 ];      	/* 款项账号        */ 	char    acAcctNo[ACCT_LEN + 1 ];      		/* 客户账号        */ 	char    acCardFlg[ FLAG_LEN + 1 ];      	/* 卡折标志        */ 	char    acFlag1[ FLAG_LEN + 1 ];			/* 活定标志        */ 	char    acFlag2[ FLAG_LEN + 1 ];			/* 公私标志        */ 	char	acBankname[ 41 ];	char    acTableName[PRDCODE_LEN + 1];        /* 表名称 */	char    acFileName[FILENAME_LEN + 1];        /* 文件名称 */	char    acCustomName[CUSTNAME_LEN + 1];     /* 户名 */	FILE	*fp,*fmtfp;							/* 文件指针	       */ 	char	acSelStr[ 301 ];	int		iLineCount	=	0 ;	int		iLineTotal	=	0 ;	int		i, iPage, iLine ;	char	acFmtFile[ 101 ];	char	acPrtData[ 4096 ];	struct	prtdata	stPrtdata;	struct	dpsacctlink		stDpsAcctLink;	memset( acBeginDate,	0x00, sizeof( acBeginDate ));	memset( acEndDate,		0x00, sizeof( acEndDate )  );  	memset( acSelStr,		0x00, sizeof( acSelStr )   );	memset( acWhrStr,		0x00, sizeof( acWhrStr )   );	memset( acToAcctNo,		0x00, sizeof( acToAcctNo )   );	memset( acToSubAcct,	0x00, sizeof( acToSubAcct )   );	memset( acAcctNo,		0x00, sizeof( acAcctNo )   );	memset( acCardFlg,		0x00, sizeof( acCardFlg )   );    memset( acFileName,		0x00, sizeof( acFileName ) );    memset( acTableName,	0x00, sizeof( acTableName ) );	memset( acFlag1,		0x00, sizeof( acFlag1 )   );	memset( acFlag2,		0x00, sizeof( acFlag2 )   );	memset( acCustomName,	0x00, sizeof( acCustomName )   );	memset( acBankname,		0x00, sizeof(acBankname));	memset( &stDpsAcctLink,	0x00, sizeof(struct dpsacctlink));	if ( pubGetBaseInfo("BANKNAME", acBankname ) )		FUNCERR_PRO	/* 取数据字典 */  	getstring( "BeginDate1", 	acBeginDate );	getstring( "EndDate1", 		acEndDate	);     	getstring( "ToAcctNo", 		acToAcctNo	);     	getstring( "ToSubAcct", 	acToSubAcct	);     	getstring( "AcctNo",		acAcctNo	);     	getstring( "CardFlg",		acCardFlg	);     	getstring( "CustomName",	acCustomName);     	sprintf( g_acTrcMsg, "BeginDate[%s]", acBeginDate );TRCLOG2	sprintf( g_acTrcMsg, "EndDate[%s]", acEndDate );TRCLOG2	sprintf( g_acTrcMsg, "ToAcctNo[%s]", acToAcctNo );TRCLOG2	sprintf( g_acTrcMsg, "ToSubAcct[%s]", acToSubAcct );TRCLOG2	sprintf( g_acTrcMsg, "AcctNo[%s]", acAcctNo );TRCLOG2	sprintf( g_acTrcMsg, "CardFlg[%s]", acCardFlg );TRCLOG2	/* 获取存款帐户关系表 */	strcpy( stDpsAcctLink.acctno,	acAcctNo	);	strcpy( stDpsAcctLink.subacct,	acToSubAcct	);	if ( pubReadDpsacctlink( &stDpsAcctLink ) )	{		ERRLOG		goto Exit;	}	if ( stDpsAcctLink.opnflag[ 0 ] == '0' ) /* 活期 */	{		/* 从活期动态表获取产品代码 */		pubInitDpssaveaccdyninfo();		strcpy( dpssaveaccdyninfo_subacct,	acToSubAcct );		EXEC SQL	SELECT	* INTO R_DPSSAVEACCDYNINFO					FROM	dpssaveaccdyninfo					WHERE	subacct= :dpssaveaccdyninfo_subacct;		if ( SQLCODE )		{			strcpy( g_acRspCode, "999996" );			pubCrtRspInfo( "dpssaveaccdyninfo", SQLCODE );       			ERRLOG			goto Exit;		}		acFlag1[ BIT1_LEN ] = '1'; /* 活期 */		pubInitDpssaveprdinfo();		strcpy( dpssaveprdinfo_prdcode, dpssaveaccdyninfo_prdcode );		EXEC SQL SELECT * INTO R_DPSSAVEPRDINFO 				FROM dpssaveprdinfo				WHERE prdcode = :dpssaveprdinfo_prdcode;		if ( SQLCODE )		{			strcpy( g_acRspCode, "999996" );			pubCrtRspInfo( "dpssaveprdinfo", SQLCODE );       			ERRLOG			goto Exit;		}		/* 储蓄对公 */		acFlag2[ BIT1_LEN ] = dpssaveprdinfo_flowcode[ BIT1_LEN ];	}	else /* 定期 */	{		/* 从定期动态表获取产品代码 */		pubInitDpstermaccdyninfo ();		strcpy( dpstermaccdyninfo_subacct,	acToSubAcct );		EXEC SQL	SELECT	* INTO R_DPSTERMACCDYNINFO					FROM	dpstermaccdyninfo					WHERE	subacct= :dpstermaccdyninfo_subacct;		if ( SQLCODE )		{			strcpy( g_acRspCode, "999996" );			pubCrtRspInfo( "dpstermaccdyninfo", SQLCODE );       			ERRLOG			goto Exit;		}		acFlag1[ BIT1_LEN ] = '2'; /* 定期 */		pubInitDpstermprdinfo();		strcpy( dpstermprdinfo_prdcode, dpstermaccdyninfo_prdcode );		EXEC SQL	SELECT * INTO R_DPSTERMPRDINFO 					FROM dpstermprdinfo					WHERE prdcode = :dpstermprdinfo_prdcode;		if ( SQLCODE )		{			strcpy( g_acRspCode, "999996" );			pubCrtRspInfo( "dpstermprdinfo", SQLCODE );       			ERRLOG			goto Exit;		}		/* 储蓄对公 */		acFlag2[ BIT1_LEN ] = dpstermprdinfo_flowcode[ BIT1_LEN ];	}	fp = (FILE *)BeginFile( pstPubcom, NULL );	if ( fp == NULL )	{		ERRLOG		return FAILED ;	}	sprintf( acFmtFile, "%s/fmt/cms666.fmt", getenv("HOME") );	sprintf( g_acFmtFile, acFmtFile );            	if( ( fmtfp=fopen( acFmtFile,"r" ) ) == NULL )	{                                                     strcpy( g_acRspCode, "CMS1B0" );        sprintf( g_acRspMsg, "打开格式文件[%s]错", acFmtFile );		ERRLOG		goto Exit;	}	iLine	=	0 ;			iPage	=	1 ;	if ( acFlag1[ BIT1_LEN ] == '1' ) /* 活期 */	{		if ( acFlag2[ BIT1_LEN ] == '0' ) /* 储蓄 */		{			sprintf( acWhrStr, " select subacct, acctno, cardno, "						"tranamt, bal, trandate, cdflg, channel, "						"tranbrc, briefcode from  dpspersavelist "						"where subacct='%s' and "						"trandate>='%s' and trandate<='%s' "						"order by subacct,trandate,ptxnseq,ctxnseq",						acToSubAcct, acBeginDate, acEndDate);		}		else if ( acFlag2[ BIT1_LEN ] == '1' )/* 对公 */		{			sprintf( acWhrStr, " select subacct, acctno, cardno, "						"tranamt, bal, trandate, cdflg, channel, "						"tranbrc, briefcode from  dpsunitsavelist "						"where subacct='%s' and "						"trandate>='%s' and trandate<='%s' "						"order by subacct,trandate,ptxnseq,ctxnseq",						acToSubAcct, acBeginDate, acEndDate);		}		else		{			goto Exit1;		}	}	else if ( acFlag1[ BIT1_LEN ] == '2' ) /* 定期 */	{		sprintf( acWhrStr, " select subacct, acctno, cardno, "					"tranamt, bal, trandate, cdflg, channel, "					"tranbrc, briefcode from  dpstermacclist "					"where subacct='%s' and "					"trandate>='%s' and trandate<='%s' "					"order by subacct,trandate,ptxnseq,ctxnseq",					acToSubAcct, acBeginDate, acEndDate);	}	else	{		goto Exit1;	}	strcpy( g_acTrcMsg, acWhrStr );	TRCLOG4                            strcpy( acTableName, "cms666" );    sprintf( acFileName, "%s%s%s", acTableName, pstPubcom->acBrc,pstPubcom->acTeller);	EXEC SQL    PREPARE pre_1 FROM :acWhrStr;	if ( SQLCODE )                      	{                                   		strcpy( g_acRspCode, "CMS1A7" );		pubCrtRspInfo( SQLCODE );       		ERRLOG                          		goto Exit ;	}                                   	EXEC SQL    DECLARE list_cur CURSOR FOR pre_1;	SQLOPENCUR(list_cur,"list_cur")	if(SQLCODE)	{		strcpy( g_acRspCode, "CMS111" );		pubCrtRspInfo("打印对帐单",SQLCODE );		ERRLOG		goto Exit ;	}	while ( TRUE )	{		memset( &stPrtdata,	0x00,	sizeof( struct prtdata ) );		pubInitDpspersavelist();		pubInitPubmemocode();		EXEC SQL FETCH list_cur into	:dpspersavelist_subacct,										:dpspersavelist_acctno,										:dpspersavelist_cardno,										:dpspersavelist_tranamt,										:dpspersavelist_bal,										:dpspersavelist_trandate,										:dpspersavelist_cdflg,										:dpspersavelist_channel,										:dpspersavelist_tranbrc,										:dpspersavelist_briefcode;		if( SQLCODE == SQLNOTFOUND )			    break ;		if(SQLCODE)		{			strcpy( g_acRspCode, "CMS112" );			pubCrtRspInfo( "dpspersavelist", SQLCODE );			ERRLOG			goto Exit ;		}		pubInitPubmemocode();		EXEC SQL SELECT desc INTO :pubmemocode_desc				 FROM pubmemocode				 WHERE memocode = :dpspersavelist_briefcode;		if ( SQLCODE && SQLCODE != SQLNOTFOUND )		{			strcpy( g_acRspCode, "999990" );			pubCrtRspInfo( "pubmemocode", SQLCODE );			ERRLOG			goto Exit ;		}		else if ( SQLCODE == SQLNOTFOUND )			strcpy( pubmemocode_desc, dpspersavelist_briefcode );		strpack( pubmemocode_desc );					strpack ( dpspersavelist_subacct );		strpack ( dpspersavelist_acctno );		strpack ( dpspersavelist_cardno );		strpack ( dpspersavelist_cdflg );		strpack ( dpspersavelist_trandate );		strpack ( dpspersavelist_channel );		strpack ( dpspersavelist_tranbrc );		strpack ( pubmemocode_desc );		strcpy ( stPrtdata.acTranDate,		dpspersavelist_trandate		);		if ( dpspersavelist_cdflg[ BIT1_LEN ] == CDFLAG_C )			strcpy( stPrtdata.acCdFlg, "贷方" );		else if ( dpspersavelist_cdflg[ BIT1_LEN ] == CDFLAG_D )			strcpy( stPrtdata.acCdFlg, "借方" );		strcpy ( stPrtdata.acTranBrc, 	dpspersavelist_tranbrc   );		strcpy ( stPrtdata.acCardNo, 	dpspersavelist_cardno   );		strpack( dpspersavelist_cardno );		strpack( dpspersavelist_channel );		pubInitCmschannel();		EXEC SQL SELECT name INTO :cmschannel_name				 FROM cmschannel				 WHERE trandevtype = :dpspersavelist_channel;		if ( SQLCODE && SQLCODE != SQLNOTFOUND )		{			strcpy( g_acRspCode, "999990" );			pubCrtRspInfo( "cmschannel", SQLCODE );			ERRLOG			goto Exit ;		}		else if ( SQLCODE == SQLNOTFOUND )			strcpy( cmschannel_name,	dpspersavelist_channel );		strpack( cmschannel_name );		strncpy ( stPrtdata.acChannel, 	cmschannel_name, BIT25_LEN    );		strcpy ( stPrtdata.acMemoDesc, 	pubmemocode_desc   );		sprintf( stPrtdata.acTranAmt, "%16.2lf", dpspersavelist_tranamt );		sprintf( stPrtdata.acBal, "%16.2lf", dpspersavelist_bal );		if( iLine	==	0 )			{ PRTHEAD }		PRTBODY		if( iLine % OVERPAGE == 0 )			{ PRTFOOT }		sprintf( g_acTrcMsg, "%s|%s|%s|%s|%s|%s|%s|%s",					stPrtdata.acTranDate, stPrtdata.acCdFlg,stPrtdata.acTranAmt,					stPrtdata.acBal, stPrtdata.acTranBrc, stPrtdata.acChannel,					stPrtdata.acCardNo, stPrtdata.acMemoDesc );   \		TRCLOG4	}	if( iLine < OVERPAGE && iLine != 0 )	{ PRTFOOT }Exit1:	if( iLineCount == 0 )	{		strcpy( g_acRspCode, "CMS113" );		sprintf( g_acRspMsg, "无满足条件的纪录!" );		ERRLOG		goto	Exit ;	}	Exit:	fclose( fmtfp );	fclose( fp );	SQLCLOSECUR(list_cur,"list_cur")	if( !strcmp( g_acRspCode, RSP_OK ) )	{		SetInqFormid(pstPubcom, "") ;		return SUCCESS;    }	else 		return FAILED ;}

⌨️ 快捷键说明

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