📄 cms608.sqc
字号:
/********************************************************************** 源码文件名称 : cms608.SQC** 所属子系统 : CMS** 当前文件版本 : 4.0.0.0** 作者 : zhour** 版本创建日期 : 2004/09/xx** 功能描述 : 柜员对卡交易登记簿查询** 修改记录 :** 修改人 修改日期 修改日期*********************************************************************/#include "code.h"#include "attrdef.h"#include "sysdef.h"#include "pubcom.h"#include "cmscode.h"#include <stdio.h>#include "cmstxdet.h"#include "pubcurrencyinfo.h"EXEC SQL INCLUDE SQLCA;/********************************************************* 函数名称: cms216008** 功能描述:柜员对卡交易登记簿查询** 输入参数:** acCardNo ---- 卡号** acBeginDate ---- 起始日期** acEndDate ---- 终止日期** iSerSeqNo ---- 交易流水号** acTeller ---- 操作员** acBrc ---- 交易机构码** acTranDevType ---- 业务发生地类型** 输出参数:** ** ** 返回结果: 0: 签约 -1: 失败 1: 未签约** 作 者 : ZhouR** 版本创建日期 : 2004/09/20** 修改记录 :** 修改人 修改日期 修改位置*******************************************************/int cms216008( PUBCOM *pstPubcom ){ /* 定义宿主变量 */ EXEC SQL BEGIN DECLARE SECTION; char acSelStr[CONDITION_LEN + 1]; char acChName[BIT17_LEN + 1]; char acChName2[BIT17_LEN + 1]; EXEC SQL END DECLARE SECTION; /*定义局部变量*/ struct cmstxdet stCmsTxdet; /* 卡交易登记簿 */ struct pubcurrencyinfo stPubCurrencyInfo; /* 卡交易登记簿 */ char acCardNo[BIT23_LEN + 1]; /* 卡号 */ char acBeginDate[DATE_LEN + 1]; /* 起始日期 */ char acEndDate[DATE_LEN + 1]; /* 终止日期 */ char acTeller[TELLER_LEN + 1]; /* 操作员 */ char acBrc[BRC_LEN + 1]; /* 交易机构码 */ char acTranDevType[LINKTYPE_LEN + 1]; /* 业务发生地类型 */ int iSerSeqNo; /* 交易流水号 */ char acFileName[FILENAME_LEN + 1]; /* 文件名称 */ char acTableName[PRDCODE_LEN + 1]; /* 表名称 */ char acWhrStr[CONDITION_LEN + 1]; int iCount = 0; FILE *fp; /* 文件指针 */ strcpy( g_acTrcMsg, "子交易: 柜员对卡交易登记簿查询子交易开始.." ); TRCLOG4; /* 初始化 */ memset( &stCmsTxdet, 0x00, sizeof( struct cmstxdet ) ); memset( acCardNo, 0x00, sizeof( acCardNo ) ); memset( acBeginDate, 0x00, sizeof( acBeginDate ) ); memset( acEndDate, 0x00, sizeof( acEndDate ) ); memset( acTeller, 0x00, sizeof( acTeller ) ); memset( acBrc, 0x00, sizeof( acBrc ) ); memset( acTranDevType, 0x00, sizeof( acTranDevType ) ); memset( acFileName, 0x00, sizeof( acFileName ) ); memset( acTableName, 0x00, sizeof( acTableName ) ); memset( acSelStr, 0x00, sizeof( acSelStr ) ); memset( acWhrStr, 0x00, sizeof( acWhrStr ) ); memset( acChName, 0x00, sizeof( acChName ) ); memset( acChName2, 0x00, sizeof( acChName2 ) ); /* 取数据字典值 */ getstring( "AcctNo", acCardNo ); getstring( "BeginDate1", acBeginDate ); getstring( "EndDate1", acEndDate ); getstring( "Teller1", acTeller ); getint ( "SerSeqNo1", &iSerSeqNo ); getstring( "Brc1", acBrc ); getstring( "TranDevType", acTranDevType ); sprintf( g_acTrcMsg,"CardNo[%s]BeginDate1[%s]EndDate1[%s]Teller1[%s] \ Brc1[%s]TranDevType[%s]SerSeqNo1[%ld]", \ acCardNo,acBeginDate, \ acEndDate,acTeller,acBrc,acTranDevType,iSerSeqNo ); TRCLOG3; /*检查交易机构是否为中心机构,如果是,则申请机构可以为空,否则当申请机构为空时,将交易机构付给申请机构 */ if (!strcmp( pstPubcom->acBrcType, BRCTYPE_SITE)) /* 营业网点 */ { if (strlen(acBrc) == 0) { strcpy( acBrc, pstPubcom->acBrc ); } if (strcmp( pstPubcom->acBrc, acBrc)) { strcpy( g_acRspCode, "CMS214" ); pubCrtRspInfo( ); ERRLOG goto Exit; } } strcpy( acTableName, "cms608" ); sprintf(acFileName, "%s%s%s", acTableName, pstPubcom->acBrc, pstPubcom->acTeller); fp = (FILE *)BeginFile( pstPubcom, acFileName ); if ( fp == NULL ) { strcpy( g_acRspMsg, "DPS902" ); pubCrtRspInfo( ); ERRLOG goto Exit; } /*组织查询字典*/ if( GetInqDict( fp , "216008" ) ) { ERRLOG goto Exit; } /* 组织查询条件 */ strcpy( acSelStr, "select * from cmstxdet where 1=1 " ); if ( strcmp ( acBeginDate, "1899-12-31" ) ) { sprintf( acWhrStr, "and trandate >= '%s'", acBeginDate ); strcat( acSelStr, acWhrStr ); } if ( strcmp ( acEndDate,"1899-12-31") ) { sprintf( acWhrStr, "and trandate <= '%s'", acEndDate ); strcat( acSelStr, acWhrStr ); } if ( strlen(acCardNo) > 0 ) { sprintf( acWhrStr, " and ( cardno1 = %s or cardno2 = %s )", acCardNo, acCardNo ); strcat( acSelStr, acWhrStr ); } if ( strlen(acTeller) > 0 ) { sprintf( acWhrStr, " and teller = %s", acTeller ); strcat( acSelStr, acWhrStr ); } if ( strlen(iSerSeqNo) > 0 ) { sprintf( acWhrStr, " and serseqno = %ld", iSerSeqNo ); strcat( acSelStr, acWhrStr ); } if ( strlen(acBrc) > 0 ) { sprintf( acWhrStr, " and brc = %s", acBrc ); strcat( acSelStr, acWhrStr ); } if ( strlen(acTranDevType) > 0 ) { sprintf( acWhrStr, " and trandevtype = %s", acTranDevType ); strcat( acSelStr, acWhrStr ); } strcat( acSelStr, " order by trandate, serseqno" ); strcpy( g_acTrcMsg, acSelStr ); TRCLOG3 EXEC SQL PREPARE pre1_cur FROM :acSelStr; if ( SQLCODE ) { strcpy( g_acRspCode, "CMS1A7" ); pubCrtRspInfo( SQLCODE ); ERRLOG goto Exit ; } EXEC SQL DECLARE cmstxdet_cur CURSOR FOR pre1_cur; if ( SQLCODE ) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS110" ); pubCrtRspInfo("cmstxdet",SQLCODE ); ERRLOG goto Exit ; } SQLOPENCUR(cmstxdet_cur,"cmstxdet_cur") if ( SQLCODE ) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS111" ); pubCrtRspInfo("cmstxdet",SQLCODE ); ERRLOG goto Exit ; } for ( ; ; ) { EXEC SQL FETCH cmstxdet_cur INTO R_CMSTXDET; if ( SQLCODE == SQLNOTFOUND ) break; sprintf( g_acTrcMsg,"ddddd"); TRCLOG2 if(SQLCODE) { sprintf( g_acTrcMsg,"SQLCODE[%d]", SQLCODE); TRCLOG4 strcpy( g_acRspCode, "CMS112" ); pubCrtRspInfo( "cmstxdet",SQLCODE ); SQLCLOSECUR(cmstxdet_cur,"cmstxdet_cur") ERRLOG goto Exit ; } /* 向结构体中赋值 */ pubVtoSCmstxdet(&stCmsTxdet); /* 取币种信息 */ EXEC SQL SELECT chname INTO :acChName FROM pubcurrencyinfo WHERE ccy = :cmstxdet_ccy; if( SQLCODE && SQLCODE != SQLNOTFOUND ) { strcpy(g_acRspCode,"CMS112"); pubCrtRspInfo("pubcurrencyinfo",SQLCODE); ERRLOG SQLCLOSECUR(cmstxdet_cur,"cmstxdet_cur") goto Exit; } EXEC SQL SELECT chname INTO :acChName2 FROM pubcurrencyinfo WHERE ccy = :cmstxdet_ccy2; if( SQLCODE && SQLCODE != SQLNOTFOUND ) { strcpy(g_acRspCode,"CMS112"); pubCrtRspInfo("pubcurrencyinfo",SQLCODE); ERRLOG SQLCLOSECUR(cmstxdet_cur,"cmstxdet_cur") goto Exit; } /* 拼写文件 */ fprintf( fp, "\"%s\"~%d~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"~%.2lf~\"%s\"~\"%s\"~\"%s\"~%.2lf~%.2lf~%.2lf~%.2lf~%.2lf~%.2lf~%.2lf~\"%s\"~\"%s\"~\"%s\"~\"%s\"~\"%s\"\n", stCmsTxdet.trandate, /* 交易日期 */ stCmsTxdet.serseqno, /* 交易流水号 */ stCmsTxdet.teller, /* 交易柜员 */ stCmsTxdet.brc, /* 交易机构码 */ stCmsTxdet.frnttrandate, /* 前置交易日期 */ stCmsTxdet.frnttime, /* 前置交易时间 */ stCmsTxdet.frntstan, /* 前置交易流水号 */ stCmsTxdet.frntno, /* 前置编号 */ stCmsTxdet.trancode, /* 交易代码 */ stCmsTxdet.ccy, /* 币种 */ acChName, /* 币种名称 */ stCmsTxdet.ccy2, /* 币种 */ acChName2, /* 币种名称 */ stCmsTxdet.trandevtype, /* 业务发生地类型 */ stCmsTxdet.trandevtypecomm, /* 业务发生地类型描述 */ stCmsTxdet.cardno1, /* 卡号1 */ stCmsTxdet.acctno1, /* 帐号1 */ stCmsTxdet.subacct1, /* 款项代码1 */ stCmsTxdet.acctseqno1, /* 卡内帐户序号1 */ stCmsTxdet.cardno2, /* 卡号2 */ stCmsTxdet.acctno2, /* 帐号2 */ stCmsTxdet.subacct2, /* 款项代码2 */ stCmsTxdet.acctseqno2, /* 卡内帐户序号2 */ stCmsTxdet.cardtrantype, /* 卡交易类型 */ stCmsTxdet.cardtrantypecomm, /* 卡交易类型描述 */ stCmsTxdet.trankind, /* 交易种类 */ stCmsTxdet.trankindcomm, /* 交易种类描述 */ stCmsTxdet.tranamt, /* 发生额 */ stCmsTxdet.mid, /* 商户代码 */ stCmsTxdet.devid, /* 设备代码 */ stCmsTxdet.validf, /* 有效标志 */ stCmsTxdet.bankgetfee, /* 银行收取手续费 */ stCmsTxdet.custsharefee, /* 持卡人分担手续费 */ stCmsTxdet.banksharefee, /* 银行分担手续费 */ stCmsTxdet.bankassfee, /* 银行分成手续费 */ stCmsTxdet.bankpayfee, /* 银行支付第三方手续费 */ stCmsTxdet.assfee1, /* 第三方支付银行手续费1 */ stCmsTxdet.assfee2, /* 第三方支付银行手续费2 */ stCmsTxdet.frnttrandate, /* 前置交易日期 */ stCmsTxdet.frnttrancode, /* 前置交易代码 */ stCmsTxdet.frnttrancomm, /* 前置交易代码描述 */ stCmsTxdet.settledate, /* 清算日期 */ stCmsTxdet.devstan ); /* 设备流水号 */ iCount ++; } SQLCLOSECUR(cmstxdet_cur,"cmstxdet_cur") EndFile( fp ); if (iCount == 0) { strcpy( g_acRspCode, "CMS1B7" ); pubCrtRspInfo( "外围交易登记簿"); ERRLOG return FAILED; } /* 出口赋值 */Exit: EndFile( fp ); if( !strcmp( g_acRspCode, RSP_OK ) ) { SetInqFormid(pstPubcom, "216008") ; sprintf( g_acTrcMsg,"柜员对卡交易登记簿查询正常结束"); TRCLOG4 return SUCCESS; } else { sprintf( g_acTrcMsg,"柜员对卡交易登记簿查询失败"); TRCLOG4 return FAILED ; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -