📄 cms665.sqc
字号:
/******************************************************************** ** 源码文件名称 : cms665.SQC ** 函数名称 : cms216065 ** 所属子系统 : CMS ** 当前文件版本 : 1.0.0.0 ** 作 者 : xuliang ** 版本创建日期 : 2004/01/04 ** 功能描述 : 打印卡作废销毁登记簿 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "sysdefine.h"#include <stdio.h>#include "pubcom.h"#include "funcapi.h"#include "code.h"#include "attrdef.h"#include "cmscode.h"#include "cmscardcancelt.h"#include "errlog.h"EXEC SQL INCLUDE sqlca;#define OVERPAGE 45 /* 满页行数 */ #define OVERLINE 5 /* 换行行数 */ #define LIMIT 50struct prtdata{ char acCardNo[CARDNO_LEN +1]; /* 卡号 */ char acFlag[BIT6_LEN + 1]; /* 作废销毁标志 */ char acCancelBrc[BRC_LEN + 1]; /* 作废机构码 */ char acCancelTeller[TNAME_LEN + 1]; /* 作废柜员 */ char acCancelDate[DATE_LEN + 1]; /* 作废日期 */ char acDestroyBrc[BRC_LEN + 1]; /* 销毁机构码 */ char acDestroyTeller[TNAME_LEN + 1]; /* 销毁柜员 */ char acDestroyDate[TNAME_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", \ stPrtdata.acCardNo, stPrtdata.acFlag, \ stPrtdata.acCancelBrc, \ stPrtdata.acCancelTeller, stPrtdata.acCancelDate, \ stPrtdata.acDestroyBrc, \ stPrtdata.acDestroyTeller, stPrtdata.acDestroyDate ); \ 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 cms216065(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 acFlag[BIT2_LEN + 1 ]; /* 作废销毁标志 */ char acCancelBrc[BRC_LEN + 1 ]; /* 作废机构码 */ char acDestroyBrc[BRC_LEN + 1]; /* 销毁机构码 */ char acWhrStr[ 512 ]; EXEC SQL END DECLARE SECTION; char acBankname[ 41 ]; char acBuffer[512]; FILE *fp,*fmtfp; /* 文件指针 */ char acSelStr[ 301 ]; 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 acTableName[PRDCODE_LEN + 1]; /* 表名称 */ char acFileName[FILENAME_LEN + 1]; /* 文件名称 */ char acFmtFile[ 101 ]; char acPrtData[ 4096 ]; struct prtdata stPrtdata; struct cmscardcancelt stCmscardcancelt; /* 卡作废销毁登记簿 */ memset( acBuffer, 0x00, sizeof( acBuffer ) ); memset( caBrc, 0x00, sizeof( caBrc ) ); memset( acFlag, 0x00, sizeof( acFlag ) ); memset( acBeginDate, 0x00, sizeof( acBeginDate )); memset( acEndDate, 0x00, sizeof( acEndDate ) ); 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( acCancelBrc, 0x00, sizeof( acCancelBrc ) ); memset( acDestroyBrc, 0x00, sizeof( acDestroyBrc ) ); memset( acFileName, 0x00, sizeof( acFileName ) ); memset( acTableName, 0x00, sizeof( acTableName ) ); memset( &stCmscardcancelt, 0x00, sizeof( struct cmscardcancelt ) ); memset( acBankname, 0x00, sizeof(acBankname)); if ( pubGetBaseInfo("BANKNAME", acBankname ) ) FUNCERR_PRO /* 取数据字典 */ getstring( "Brc1", caBrc ); getstring( "BeginDate1", acBeginDate ); getstring( "EndDate1", acEndDate ); getstring( "Flag", acFlag ); sprintf( g_acTrcMsg,"[%s][%s]BeginDate[%s]EndDate[%s]acFlag[%s]", pstPubcom->acBrc,pstPubcom->acBrcType,acBeginDate,acEndDate,acFlag ); 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; } } strcpy( g_acTrcMsg, "zhouran1" ); TRCLOG4 fp = (FILE *)BeginFile( pstPubcom, NULL ); if ( fp == NULL ) { ERRLOG return FAILED ; } sprintf( acFmtFile, "%s/fmt/cms665.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 ; if ( strlen ( acFlag ) > 0 ) { sprintf( acWhrStr, " select * from cmscardcancelt where 1=1"); if ( acFlag[0] == '0' ) { if ( strlen ( caBrc ) > 0 ) { sprintf( acWhrStr+strlen(acWhrStr), " and cancelbrc = '%s'", caBrc ); } if ( strcmp ( acBeginDate, INITDATE ) ) { sprintf( acWhrStr+strlen(acWhrStr), " and canceldate >= '%s'", acBeginDate ); } if ( strcmp ( acEndDate, INITDATE ) ) { sprintf( acWhrStr+strlen(acWhrStr), " and canceldate <= '%s'", acEndDate ); } } if ( acFlag[0] == '1' ) { if ( strlen ( caBrc ) > 0 ) { sprintf( acWhrStr+strlen(acWhrStr), " and destroybrc = '%s'", caBrc ); } if ( strcmp ( acBeginDate, INITDATE ) ) { sprintf( acWhrStr+strlen(acWhrStr), " and destroydate >= '%s'", acBeginDate ); } if ( strcmp ( acEndDate, INITDATE ) ) { sprintf( acWhrStr+strlen(acWhrStr), " and destroydate <= '%s'", acEndDate ); } } sprintf( acWhrStr+strlen(acWhrStr), " and flag = '%s'" , acFlag); sprintf( acWhrStr+strlen(acWhrStr), " ORDER BY cancelbrc,destroybrc, cardno DESC" ); strcpy( g_acTrcMsg, acWhrStr ); TRCLOG4 } else { sprintf( acWhrStr1, "select * from cmscardcancelt where 1=1"); if ( strlen ( caBrc ) > 0 ) { sprintf( acWhrStr1, "%s and (cancelbrc = '%s' or destroybrc = '%s')" , acWhrStr1, caBrc, caBrc); } if ( strcmp ( acBeginDate, INITDATE ) ) { sprintf( acWhrStr2, " canceldate >= '%s'", acBeginDate ); sprintf( acWhrStr3, " destroydate >= '%s'", acBeginDate ); } if ( strcmp ( acEndDate, INITDATE ) ) { sprintf( acWhrStr4, " canceldate <= '%s'", acEndDate ); sprintf( acWhrStr5, " destroydate <= '%s'", acEndDate ); } sprintf( acWhrStr6, " ORDER BY cancelbrc, destroybrc, cardno DESC" ); if (( strcmp ( acBeginDate, INITDATE ) ) && ( !strcmp ( acEndDate, INITDATE ) )) { sprintf( acWhrStr, "%s and ( %s or %s ) %s",acWhrStr1,acWhrStr2,acWhrStr3,acWhrStr6 ); } if (( !strcmp ( acBeginDate, INITDATE ) ) && ( strcmp ( acEndDate, INITDATE ) )) { sprintf( acWhrStr, "%s and ( %s or %s ) %s",acWhrStr1,acWhrStr4,acWhrStr5,acWhrStr6); } if (( strcmp ( acBeginDate, INITDATE ) ) && ( strcmp ( acEndDate, INITDATE ) )) { sprintf( acWhrStr, "%s and (( %s and %s ) or ( %s and %s )) %s",acWhrStr1, acWhrStr2,acWhrStr4,acWhrStr3,acWhrStr5,acWhrStr6 ); } if (( !strcmp ( acBeginDate, INITDATE ) ) && ( !strcmp ( acEndDate, INITDATE ) )) { sprintf( acWhrStr, "%s %s",acWhrStr1,acWhrStr6 ); } strcpy( g_acTrcMsg, acWhrStr ); TRCLOG4 } strcpy( acTableName, "cms665" ); 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 cardcancelt_cur CURSOR FOR pre_1; if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS110" ); pubCrtRspInfo("cmscardcancelt",SQLCODE ); ERRLOG goto Exit ; } SQLOPENCUR(cardcancelt_cur,"cardcancelt_cur") if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo("cmscardcancelt",SQLCODE ); ERRLOG goto Exit ; } for( ; ; ) { memset( acBuffer, 0x00, sizeof( acBuffer ) ); memset( &stPrtdata, 0x00, sizeof( struct prtdata ) ); pubInitCmspcdreg(); EXEC SQL FETCH cardcancelt_cur into R_CMSCARDCANCELT; 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( "cmscardcancelt",SQLCODE ); ERRLOG SQLCLOSECUR(cardcancelt_cur,"cardcancelt_cur") goto Exit ; } sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 /* 转换作废销毁标志 */ strcpy ( acFlag, cmscardcancelt_flag ); TransMemo( "0006" , acFlag , acBuffer); sprintf( g_acTrcMsg,"SQLCODE[%s]", acBuffer ); TRCLOG4 strpack ( cmscardcancelt_destroyteller ); strpack ( cmscardcancelt_destroydate ); strcpy ( stPrtdata.acCardNo, cmscardcancelt_cardno ); strcpy ( stPrtdata.acFlag, acBuffer ); strcpy ( stPrtdata.acCancelBrc, cmscardcancelt_cancelbrc ); strcpy ( stPrtdata.acCancelTeller, cmscardcancelt_cancelteller ); strcpy ( stPrtdata.acCancelDate, cmscardcancelt_canceldate ); strcpy ( stPrtdata.acDestroyBrc, cmscardcancelt_destroybrc ); strcpy ( stPrtdata.acDestroyTeller, cmscardcancelt_destroyteller ); strcpy ( stPrtdata.acDestroyDate, cmscardcancelt_destroydate ); if( iLine == 0 ) { PRTHEAD } PRTBODY if( iLine % OVERPAGE == 0 ) { PRTFOOT } sprintf( g_acTrcMsg, "%s|%s|%s|%s|%s|%s|%s|%s", \ stPrtdata.acCardNo, stPrtdata.acFlag, \ stPrtdata.acCancelBrc, \ stPrtdata.acCancelTeller, stPrtdata.acCancelDate, \ stPrtdata.acDestroyBrc, \ stPrtdata.acDestroyTeller, stPrtdata.acDestroyDate ); \ TRCLOG4 } SQLCLOSECUR(cardcancelt_cur,"cardcancelt_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 + -