📄 cmsb39.sqc
字号:
/******************************************************************** ** 源码文件名称 : cmsB39.SQC ** 函数名称 : cms21B039 ** 所属子系统 : CMS ** 当前文件版本 : 1.0.0.0 ** 作 者 : ZhangQJ ** 版本创建日期 : 2005/08/11 ** 功能描述 : 中间业务(单笔)取消交易清单 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "sysdefine.h"#include <stdio.h>#include "pubcom.h"#include "funcapi.h"#include "pubmemocode.h"#include "code.h"#include "attrdef.h"#include "cmscode.h"#include "cmstxdethis.h"#include "cmsmerchantinfo.h"#include "pubbranchinfo.h"#include "errlog.h"EXEC SQL INCLUDE sqlca;char *RptFormatAmt(double amt, char *pstr);#define OVERPAGE 53 /* 满页行数 */ #define OVERLINE 5 /* 换行行数 */ #define LIMIT 50#define NEEDPRTBRCMAX 200 /*需要打印的机构列表最大值*/ struct CMSNEEDPRTBRCLIST { int iSeqNo; /* 序号 */ char acBasSeqNo[BIT8_LEN +1]; /* 中间业务流水号 */ char acSerSeqNo[BIT8_LEN +1]; /* 帐务主机流水号 */ char acTranName[30 +1]; /* 交易名称 */ double dBrcTranAmt; /* 交易金额 */ char acOp[BIT8_LEN+ 1 ]; /* 操作员 */ char acAuthOp[BIT8_LEN+ 1 ]; /* 授权操作员 */ int iBrcTranNum;};int iTotalClassNum=0;double dTotalClassAmt=0.00;int iTotalNum=0;double dTotalAmt=0.00;char acAmt[31];char acDevName[21];int iDetailSeq=0;#define PRTHEAD \ PRTHEAD0 \ PRTHEAD_FORTAIL \#define PRTHEAD0 \ prtline( fp,"title1:%s", acBankname); \ iLineCount++; \ prtline( fp,"title2:"); \ iLineCount++; \ prtline( fp, "title3:%s|%s|%d", \ pstPubcom->acBrc, pstPubcom->acTranDate, iPage ); \ iLineCount++; \ #define PRTHEAD_FORTAIL \ prtline( fp, "head1:" ); \ iLineCount++; \ prtline( fp, "head2:" ); \ iLineCount++; \ prtline( fp, "body0:" ); \ iLineCount++; \ iLine ++ ; \#define PRTBODY \ if( iLine % OVERPAGE == 0 ) \ { \ PRTFOOT \ PRTHEAD \ } \ strpack(cmstxdethis_devid); \ strpack(cmstxdethis_cardno1); \ strpack(cmstxdethis_cardno2); \ cmstxdethis_cardno1[22]=0x00; \ cmstxdethis_cardno2[22]=0x00; \ cmstxdethis_devid[10]=0x00; \ prtline( fp,"body1:%4d|%-10s|%-10s|%-10s|%-8ld|%17s|%10s|%-10s", \ iDetailSeq,cmstxdethis_trandate, cmstxdethis_brc,\ cmstxdethis_frntstan, \ cmstxdethis_serseqno, acTranName, \ RptFormatAmt(cmstxdethis_tranamt,acAmt), \ cmstxdethis_teller); \ iLineCount++; \ iLine ++ ; \ if( iLine % OVERPAGE == 0 || (iLine+1) % OVERPAGE == 0 ) \ { \ PRTFOOT \ PRTHEAD \ } \#define PRTBODYLINE \ prtline( fp, "body0:" ); \ iLineCount++; \ iLine ++ ; \#define PRTBODYLINE_B \ prtline( fp, "body9:" ); \ iLineCount++; \ iLine ++ ; \#define PRTONECLASSSTA \ /*判断如果剩余的纸不够,重新开始一页*/ \ if( (OVERPAGE - iLine % OVERPAGE) < 3 ) \ { \ PRTFOOT \ PRTHEAD \ } else if ( iLine != 1) { \ prtline( fp, "body2:" ); \ iLineCount++; \ iLine ++ ; \ } \ iDetailSeq=1; \ prtline( fp, "body3:%s|%d|%17s|", \ pastNPB->acNeedPrtBrc,pastNPB->iBrcTranNum, \ RptFormatAmt( pastNPB->dBrcTranAmt,acAmt)); \ iLineCount++; \ iLine ++ ; \ if( iLine % OVERPAGE == 0 ) \ { \ PRTFOOT \ PRTHEAD \ } \ #define PRTFIVECLASSSTA \ /*判断如果剩余的纸不够,重新开始一页*/ \ if( (OVERPAGE - iLine % OVERPAGE) < 3 ) \ { \ PRTFOOT \ PRTHEAD \ } else if ( iLine != 1 ) { \ prtline( fp, "body5:" ); \ iLineCount++; \ iLine ++ ; \ } \ prtline( fp, "body6:%d|%17s|", \ iTotalClassNum, RptFormatAmt(dTotalClassAmt,acAmt)); \ iLineCount++; \ iLine ++ ; \ if( iLine % OVERPAGE == 0 ) \ { \ PRTFOOT \ PRTHEAD \ } \#define PRTTOTALSTA \ prtline( fp, "bodyk:" ); \ iLineCount++; \ iLine ++ ; \ prtline( fp, "bodym:%d|%17s", \ iTotalNum, RptFormatAmt(dTotalAmt,acAmt)); \ iLineCount++; \ iLine ++ ; \#define PRTFOOT \ prtline( fp, "tail1:" ); \ iLineCount++; \ prtline( fp, "bottm:%s", \ pstPubcom->acTeller ); \ iLineCount++; \ prtline( fp, "next:%s",pstPubcom->acTranDate ); \ iLineCount++; \ iPage ++ ; iLine = 0 ; \/*程序入口*/int cms21B039(pstPubcom)struct pubcom *pstPubcom;{EXEC SQL BEGIN DECLARE SECTION; char acBeginDate[DATE_LEN + 1 ]; /* 起始日期 */ char acEndDate[DATE_LEN + 1 ]; /* 终止日期 */ char acDevId[DEVID_LEN + 1 ]; /* 设备代码 */ char acDevType[ 2 + 1 ]; /* 设备类型 */ char acWhrStr[ 1024 ];EXEC SQL END DECLARE SECTION; char acBankname[ 41 ]; char acBuffer[9]; FILE *fp,*fmtfp; /* 文件指针 */ char acSelStr[ 301 ]; char acWhrTmp[ 512 ]; int iLineCount = 0 ; int i, iPage, iLine, iBrcSeq, iRet; char acFileName[ 101 ]; char acFmtFile[ 101 ]; struct pubmemocode stPubMemocode; /*摘要码定义表*/ int iHaveFlag; /*有效交易记录标志0无 1有*/ int iLineFlag; /*打印行线 0body1 1bodyb*/ char acBrc1[10]; /*交易机构码 */ char acIssueBrc[10]; /*发卡机构码 */ char acCardNo[33]; /*卡号 */ char acDevTranType[3]; /*交易统计类型 */ char acTranName[81]; /*交易名称 */ char acTemp[10]; struct cmstxdethis stCmsTxdetHis; /* 外围交易登记簿历史表 */ struct pubbranchinfo stPubBranchInfo; /* 机构信息表 */ struct CMSNEEDPRTBRCLIST astNeedPrtBrc[ NEEDPRTBRCMAX ],*pastNeedPrtBrc,*pastNPB,*pastTmp; memset( acBrc1, 0x00, sizeof( acBrc1 )); memset( acDevId, 0x00, sizeof( acDevId )); memset( acDevType, 0x00, sizeof( acDevType )); memset( acBeginDate, 0x00, sizeof( acBeginDate )); memset( acEndDate, 0x00, sizeof( acEndDate )); memset( acBuffer, 0x00, sizeof( acBuffer ) ); memset( acSelStr, 0x00, sizeof( acSelStr ) ); memset( acWhrStr, 0x00, sizeof( acWhrStr ) ); memset( &stCmsTxdetHis, 0x00, sizeof( struct cmstxdethis )); memset( acBankname, 0x00, sizeof( acBankname ) ); if ( pubGetBaseInfo("BANKNAME", acBankname ) ) FUNCERR_PRO /* 取数据字典 */ getstring( "BeginDate1", acBeginDate ); getstring( "EndDate1", acEndDate); sprintf( g_acTrcMsg,"明细打印,支行号[%s], 起始日期[%s], \ 终止日期[%s]", pstPubcom->acBrc, acBeginDate, acEndDate ); TRCLOG4 /* 仅能查询往日的 */ if(strcmp(pstPubcom->acTranDate, acBeginDate) == 0 || \ strcmp(pstPubcom->acTranDate, acEndDate) == 0) { strcpy( g_acRspCode, "CMS124" ); /* pubCrtRspInfo( ); */ strcpy( g_acRspMsg, "仅能查询往日的取消交易清单!" ); ERRLOG return FAILED ; } fp = (FILE *)BeginFile( pstPubcom, NULL ); if ( fp == NULL ) { strcpy( g_acRspCode, "DPS902" ); pubCrtRspInfo( ); ERRLOG return FAILED ; } strcpy(g_acTrcMsg, "open fmt"); TRCLOG4 sprintf( acFmtFile, "%s/fmt/cmsB39.fmt", getenv("HOME") ); sprintf( g_acFmtFile, acFmtFile ); if( ( fmtfp=fopen(acFmtFile, "r") ) == NULL ) { strcpy( g_acTrcMsg, acFmtFile ); TRCLOG2 ERRLOG goto Exit; } strcpy(g_acTrcMsg, "head sql111"); TRCLOG4 iLine = 0 ; iPage = 1 ; /*打印报表头*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -