📄 cms654.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms654.SQC ** 函数名称 : cms216054 ** 所属子系统 : CMS ** 当前文件版本 : 1.0.0.0 ** 作 者 : zhouran ** 版本创建日期 : 2004/12/30 ** 功能描述 : 锁卡登记簿查询打印 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "sysdefine.h"#include <stdio.h>#include "pubcom.h"#include "funcapi.h"#include "code.h"#include "attrdef.h"#include "cmscode.h"#include <fcntl.h>#include "ciscustomerinfo.h"#include "cmscardinfo.h"#include "cmslockm.h"#include "errlog.h"#include "pubinq.h"EXEC SQL INCLUDE sqlca;#define OVERPAGE 45 /* 满页行数 */ #define OVERLINE 5 /* 换行行数 */ #define LIMIT 50struct prtdata{ char acCardNo[CARDNO_LEN +1]; /* 卡号 */ char acCustomName[BIT31_LEN + 1]; /* 户名 */ char acLockDate[DATE_LEN + 1]; /* 锁卡日期 */ char acCnclDate[DATE_LEN + 1]; /* 解锁日期 */ char acCnclTeller[BIT11_LEN + 1]; /* 解锁操作员 */ char acCnclBrc[BRC_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|%d", \ pstPubcom->acBrc, 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|%s", \ stPrtdata.acCardNo, stPrtdata.acCustomName, \ stPrtdata.acLockDate, \ stPrtdata.acCnclDate, stPrtdata.acCnclTeller, \ stPrtdata.acCnclBrc ); \ 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 cms216054(pstPubcom)struct pubcom *pstPubcom;{ EXEC SQL BEGIN DECLARE SECTION; char caBrc[BRC_LEN +1];/* 机构代码 */ char acBeginDate[DATE_LEN + 1 ]; /* 起始锁卡日期 */ char acEndDate[DATE_LEN + 1 ]; /* 终止锁卡日期 */ char acWhrStr[ 512 ]; EXEC SQL END DECLARE SECTION; char acBankname[ 41 ]; char acCardNo[CARDNO_LEN + 1]; /* 卡号 */ FILE *fp,*fmtfp; /* 文件指针 */ int iRtn; char acSelStr[ 301 ]; int iLineCount = 0 ; int i, iPage, iLine ; char acTableName[PRDCODE_LEN + 1]; /* 表名称 */ char acFileName[FILENAME_LEN + 1]; /* 文件名称 */ BASESUBACCTINFO stDpsAccInfo; /* 静态表 */ char acFmtFile[ 101 ]; char acPrtData[ 4096 ]; struct prtdata stPrtdata; struct cmslockm stCmsLockm; /* 帐户移入移出登记簿 */ struct cmscardinfo stCmsCardInfo; /* 卡片信息表 */ struct ciscustomerinfo stCisCustomerInfo; /* 客户公用基本信息文件 */ memset( acSelStr, 0x00, sizeof( acSelStr ) ); memset( caBrc, 0x00, sizeof( caBrc )); memset( acWhrStr, 0x00, sizeof( acWhrStr ) ); memset( acBeginDate, 0x00, sizeof( acBeginDate )); memset( acCardNo, 0x00, sizeof( acCardNo ) ); memset( acEndDate, 0x00, sizeof( acEndDate ) ); memset( acFileName, 0x00, sizeof( acFileName ) ); memset( acTableName, 0x00, sizeof( acTableName ) ); memset( &stCmsLockm, 0x00, sizeof( struct cmslockm ) ); memset( &stCisCustomerInfo, 0x00, sizeof( struct ciscustomerinfo ) ); memset( &stCmsCardInfo,0x00, sizeof( struct cmscardinfo ) ); memset( &stDpsAccInfo, 0x00, sizeof( BASESUBACCTINFO ) ); memset( acBankname, 0x00, sizeof(acBankname)); if ( pubGetBaseInfo("BANKNAME", acBankname ) ) FUNCERR_PRO /* 取数据字典 */ getstring( "Brc1", caBrc ); getstring( "BeginDate1", acBeginDate ); getstring( "EndDate1", acEndDate ); sprintf( g_acTrcMsg,"BeginDate[%s]EndDate[%s]", 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 ) { ERRLOG return FAILED ; } sprintf( acFmtFile, "%s/fmt/cms654.fmt", getenv("HOME") ); sprintf( g_acFmtFile, acFmtFile ); if( ( fmtfp=fopen( acFmtFile,"r" ) ) == NULL ) { strcpy( g_acTrcMsg, acFmtFile ); TRCLOG4 strcpy( g_acRspCode, "CMS1B0" ); sprintf( g_acRspMsg, "打开格式文件[%s]错", acFmtFile ); ERRLOG goto Exit; } iLine = 0 ; iPage = 1 ; sprintf( acWhrStr, " select * from cmslockm "); strcat( acWhrStr, " where 1=1"); if ( strlen ( caBrc ) > 0 ) { sprintf( acWhrStr+strlen(acWhrStr), " and issuebrc = '%s'", caBrc ); } if ( strcmp ( acBeginDate, INITDATE ) ) { sprintf( acWhrStr+strlen(acWhrStr), " and cncldate >= '%s'", acBeginDate ); } if ( strcmp ( acEndDate, INITDATE ) ) { sprintf( acWhrStr+strlen(acWhrStr), " and cncldate <= '%s'", acEndDate ); } sprintf( acWhrStr+strlen(acWhrStr), " ORDER BY cncldate, cardno DESC" ); strcpy( g_acTrcMsg, acWhrStr ); TRCLOG4 strcpy( acTableName, "cms654" ); 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 actiom_cur CURSOR FOR pre_1; if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS110" ); pubCrtRspInfo("cmslockm",SQLCODE ); ERRLOG goto Exit ; } SQLOPENCUR(actiom_cur,"actiom_cur") if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo("cmslockm",SQLCODE ); ERRLOG goto Exit ; } for( ; ; ) { memset( &stPrtdata, 0x00, sizeof( struct prtdata ) ); pubInitCmspcdreg(); EXEC SQL FETCH actiom_cur into R_CMSLOCKM; if( SQLCODE == SQLNOTFOUND ) break ; sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS112" ); pubCrtRspInfo( "cmslockm",SQLCODE ); ERRLOG SQLCLOSECUR(actiom_cur,"actiom_cur") goto Exit ; } sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy ( acCardNo, cmslockm_cardno ); /* 从卡片信息表获取纪录 */ if( cmsApiGetCmsCardInfo( acCardNo, &stCmsCardInfo ) ) { sprintf(g_acRspCode,"999996"); pubCrtRspInfo( "cmscardinfo", SQLCODE ); ERRLOG SQLCLOSECUR(actiom_cur,"actiom_cur") goto Exit; } strcpy( g_acTrcMsg, "stCmsCardInfo" ); TRCLOG3; /* 按客户账号和款项代码获取账户信息 DPS API */ memset( &stDpsAccInfo, 0x00, sizeof( BASESUBACCTINFO ) ); iRtn = InqBaseSubAcct( pstPubcom, stCmsCardInfo.acctno, stCmsCardInfo.subacct, "", "1100000000000000", "0","0", &stDpsAccInfo); if (iRtn) { strcpy( g_acRspCode, RSP_OK ); } strpack ( stDpsAccInfo.acCustomName ); strcpy ( stPrtdata.acCardNo, cmslockm_cardno ); strncpy( stPrtdata.acCustomName,stDpsAccInfo.acCustomName, 30 ); strcpy ( stPrtdata.acLockDate, cmslockm_lockdate ); strcpy ( stPrtdata.acCnclDate, cmslockm_cncldate ); strcpy ( stPrtdata.acCnclTeller,cmslockm_cnclteller ); strcpy ( stPrtdata.acCnclBrc, cmslockm_cnclbrc ); sprintf( g_acTrcMsg, "[%s],[%s],[%s],[%s],[%s]",stPrtdata.acCardNo, stPrtdata.acCustomName, stPrtdata.acCnclDate,stPrtdata.acCnclTeller,stPrtdata.acCnclBrc); TRCLOG4 if( iLine == 0 ) { PRTHEAD } PRTBODY if( iLine % OVERPAGE == 0 ) { PRTFOOT } sprintf( g_acTrcMsg, "%s|%s|%s|%s|%s", \ stPrtdata.acCardNo, stPrtdata.acCustomName, \ stPrtdata.acCnclDate, stPrtdata.acCnclTeller, \ stPrtdata.acCnclBrc ); \ TRCLOG4 } SQLCLOSECUR(actiom_cur,"actiom_cur") if( iLine < OVERPAGE && iLine != 0 ) { PRTFOOT } if( iLineCount == 0 ) { strcpy( g_acRspCode, "CMS113" ); sprintf( g_acRspMsg, "无满足条件的纪录!" ); ERRLOG goto Exit ; }Exit: fclose( fmtfp ); fclose( fp ); if( !strcmp( g_acRspCode, RSP_OK ) ) { SetInqFormid(pstPubcom, "") ; return SUCCESS; } else return FAILED ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -