📄 cms650.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms650.SQC ** 函数名称 : cms216050 ** 所属子系统 : 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 "cmspcdreg.h"#include "errlog.h"EXEC SQL INCLUDE sqlca;#define OVERPAGE 45 /* 满页行数 */ #define OVERLINE 5 /* 换行行数 */ #define LIMIT 50struct prtdata{ char acAplyDate[DATE_LEN +1]; /* 申请日期 */ char acAplyBrc[BRC_LEN + 1]; /* 申请机构 */ char acCardKind[CARDKIND_LEN + 1]; /* 卡片种类 */ char acAplyFlg[FLAG1_LEN + 1]; /* 申请标志 */ char acAplyNum[BIT9_LEN + 1]; /* 申请数量 */ char acSCardNo[CARDNO_LEN + 1]; /* 起始卡号 */ char acECardNo[CARDNO_LEN + 1]; /* 终止卡号 */ char acVouKind[VOUKIND_LEN + 1]; /* 凭证种类 */ char acSVouNo[BIT11_LEN + 1]; /* 起始凭证号 */ char acCustName[FUNC_NAME_LEN + 1]; /* 姓名/单位名称 */ char acProcessFlg[FLAG1_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|%s|%s|%s", \ stPrtdata.acAplyDate, stPrtdata.acAplyBrc, \ stPrtdata.acCardKind, stPrtdata.acAplyFlg, \ stPrtdata.acAplyNum, stPrtdata.acSCardNo, \ stPrtdata.acVouKind, stPrtdata.acSVouNo, \ stPrtdata.acProcessFlg); \ 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 cms216050(pstPubcom)struct pubcom *pstPubcom;{ EXEC SQL BEGIN DECLARE SECTION; char acBeginDate[DATE_LEN + 1 ]; /* 起始日期 */ char acEndDate[DATE_LEN + 1 ]; /* 终止日期 */ char acAplyBrc[ BRC_LEN + 1 ]; /* 申请机构 */ char acWhrStr[CONDITION_LEN + 1]; EXEC SQL END DECLARE SECTION; char acAplyFlg[FLAG1_LEN + 1]; /* 申请标志 */ char acBankname[ 41 ]; char acBuffer[21]; FILE *fp,*fmtfp; /* 文件指针 */ char acSelStr[ 301 ]; char acWhrStr1[CONDITION_LEN + 1]; char acWhrStr2[CONDITION_LEN + 1]; char acWhrStr3[CONDITION_LEN + 1]; char acWhrStr4[CONDITION_LEN + 1]; char acWhrStr5[CONDITION_LEN + 1]; char acWhrStr6[CONDITION_LEN + 1]; char acStr1[ 141 ]; int iLineCount = 0 ; int i, iPage, iLine ; char acFileName[ 101 ]; char acFmtFile[ 101 ]; char acPrtData[ 4096 ]; struct prtdata stPrtdata; struct cmspcdreg stCmspcdreg; /* 预制卡申请登记表 */ memset( acBuffer, 0x00, sizeof( acBuffer ) ); memset( acBeginDate, 0x00, sizeof( acBeginDate )); memset( acAplyBrc, 0x00, sizeof( acAplyBrc ) ); memset( acEndDate, 0x00, sizeof( acEndDate ) ); memset( acAplyFlg, 0x00, sizeof( acAplyFlg ) ); 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( acStr1, 0x00, sizeof( acStr1 ) ); memset( &stCmspcdreg, 0x00, sizeof( struct cmspcdreg )); memset( acBankname, 0x00, sizeof( acBankname )); if ( pubGetBaseInfo("BANKNAME", acBankname ) ) FUNCERR_PRO /* 取数据字典 */ getstring( "BeginDate1", acBeginDate ); getstring( "EndDate1", acEndDate ); sprintf( g_acTrcMsg,"BeginDate1[%s]EndDate1[%s]", acBeginDate,acEndDate ); TRCLOG4 /*检查交易机构是否为中心机构,如果是,则申请机构可以为空,否则当申请机构为空时,将交易机构付给申请机构 */ if (!strcmp( pstPubcom->acBrcType, BRCTYPE_SITE)) /* 营业网点 */ { if (strlen(acAplyBrc) == 0) { strcpy( acAplyBrc, pstPubcom->acBrc ); } if (strcmp( pstPubcom->acBrc, acAplyBrc)) { strcpy( g_acRspCode, "CMS214" ); pubCrtRspInfo( ); ERRLOG goto Exit; } } fp = (FILE *)BeginFile( pstPubcom, NULL ); if ( fp == NULL ) { ERRLOG return FAILED ; } sprintf( acFmtFile, "%s/fmt/cms650.fmt", getenv("HOME") ); sprintf( g_acFmtFile, acFmtFile ); if( ( fmtfp=fopen( acFmtFile,"r" ) ) == NULL ) { strcpy( g_acTrcMsg, acFmtFile ); TRCLOG2 strcpy( g_acRspCode, "CMS1B0" ); sprintf( g_acRspMsg, "打开格式文件[%s]错", acFmtFile ); ERRLOG goto Exit; } iLine = 0 ; iPage = 1 ; sprintf( acWhrStr1, " select * from cmspcdreg"); sprintf( acWhrStr2, " where 1=1"); if ( strcmp ( acBeginDate, INITDATE ) ) { sprintf( acWhrStr3, " and aplydate >= '%s'", acBeginDate ); } if ( strcmp ( acEndDate, INITDATE ) ) { sprintf( acWhrStr4, " and aplydate <= '%s'", acEndDate ); strcpy( g_acTrcMsg, acWhrStr4 ); TRCLOG4 } if ( strlen ( acAplyBrc ) > 0 ) { sprintf( acWhrStr5, " and aplybrc = '%s'", acAplyBrc ); strcpy( g_acTrcMsg, acWhrStr5 ); TRCLOG4 } sprintf( acWhrStr6, " ORDER BY aplydate,serseqno DESC" ); sprintf( acWhrStr, "%s%s%s%s%s%s",acWhrStr1,acWhrStr2,acWhrStr3,acWhrStr4,acWhrStr5,acWhrStr6 ); strcpy( g_acTrcMsg, acWhrStr ); TRCLOG4 EXEC SQL PREPARE pre_1 FROM :acWhrStr; if ( SQLCODE ) { strcpy( g_acRspCode, "CMS1A7" ); pubCrtRspInfo( SQLCODE ); ERRLOG goto Exit ; } EXEC SQL DECLARE reg_cur CURSOR FOR pre_1; if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS110" ); pubCrtRspInfo("cmspcdreg", SQLCODE ); ERRLOG goto Exit ; } SQLOPENCUR(reg_cur,"reg_cur") if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo("cmspcdreg", SQLCODE ); ERRLOG goto Exit ; } for( ; ; ) { memset( &stPrtdata, 0x00, sizeof( struct prtdata ) ); pubInitCmspcdreg(); EXEC SQL FETCH reg_cur into R_CMSPCDREG; 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("cmspcdreg", SQLCODE ); ERRLOG SQLCLOSECUR(reg_cur,"reg_cur") goto Exit ; } sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 /* 转换申请标志 */ strcpy ( acAplyFlg, cmspcdreg_aplyflg ); switch ( acAplyFlg[ BIT1_LEN ] ) { case PREAPLY: strcpy( acBuffer , "预制卡申请" ); break; case HOLDCARDAPLY: strcpy( acBuffer , "非记名卡保号换卡申请" ); break; case NAMEHOLDCARDAPLY: strcpy( acBuffer , "记名卡保号换卡申请" ); break; case NAMECHGCARDAPLY: strcpy( acBuffer , "正常换卡申请" ); break; case NAMELOSTCARDAPLY: strcpy( acBuffer , "挂失补卡申请" ); break; case NAMECARDAPLY: strcpy( acBuffer , "记名卡申请" ); break; default: acBuffer[ BIT1_LEN ] = acAplyFlg[ BIT1_LEN ]; break; } sprintf( g_acTrcMsg,"SQLCODE[%s]", cmspcdreg_custname); TRCLOG4 strpack ( cmspcdreg_custname ); strpack ( cmspcdreg_svouno ); strcpy ( stPrtdata.acAplyDate, cmspcdreg_aplydate ); strcpy ( stPrtdata.acAplyBrc, cmspcdreg_aplybrc ); strcpy ( stPrtdata.acCardKind, cmspcdreg_cardkind ); strcpy ( stPrtdata.acAplyFlg, cmspcdreg_aplyflg ); strcpy ( stPrtdata.acSCardNo, cmspcdreg_scardno ); strcpy ( stPrtdata.acECardNo, cmspcdreg_ecardno ); sprintf( stPrtdata.acAplyNum, "%d", cmspcdreg_aplynum); strcpy ( stPrtdata.acVouKind, cmspcdreg_voukind ); strncpy( stPrtdata.acSVouNo, cmspcdreg_svouno, 10 ); strncpy( stPrtdata.acCustName, cmspcdreg_custname, 30 ); strcpy ( stPrtdata.acProcessFlg,cmspcdreg_processflg ); sprintf( g_acTrcMsg, "acAplyDate[%s],acAplyBrc[%s],acCardKind[%s],acAplyFlg[%s]," "acSCardNo[%s],acAplyNum[%s],acVouKind[%s],acSVouNo[%s],acCustName[%s]", stPrtdata.acAplyDate, stPrtdata.acAplyBrc, stPrtdata.acCardKind, stPrtdata.acAplyFlg, stPrtdata.acSCardNo, stPrtdata.acAplyNum, stPrtdata.acVouKind, stPrtdata.acSVouNo, stPrtdata.acCustName ); TRCLOG4 if( iLine == 0 ) { PRTHEAD } PRTBODY if( iLine % OVERPAGE == 0 ) { PRTFOOT } sprintf( g_acTrcMsg, "%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s",\ stPrtdata.acAplyDate, stPrtdata.acAplyBrc, \ stPrtdata.acCardKind, stPrtdata.acAplyFlg, \ stPrtdata.acAplyNum, stPrtdata.acSCardNo, \ stPrtdata.acECardNo, stPrtdata.acVouKind, \ stPrtdata.acSVouNo, stPrtdata.acCustName, \ stPrtdata.acProcessFlg); \ TRCLOG4 } SQLCLOSECUR(reg_cur,"reg_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 + -