📄 cmsb14.sqc
字号:
/******************************************************************** ** 源码文件名称 : cmsB14.SQC ** 函数名称 : cms21B014 ** 所属子系统 : CMS ** 当前文件版本 : 1.0.0.0 ** 作 者 : XuZy ** 版本创建日期 : 2004/10/14 ** 功能描述 : 打印本行POS商户对账单 ** 修改记录 : ** 修改人 修改日期 修改日期*********************************************************************/#include "sysdefine.h"#include <stdio.h>#include "pubcom.h"#include "funcapi.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;#define OVERPAGE 26 /* 满页行数 */ #define OVERLINE 5 /* 换行行数 */ #define LIMIT 50struct prtdata{ char acBer[BIT9_LEN +1]; /* 行号 */ char acDevId[BIT16_LEN +1]; /* 支行名称 */ char acDevStan[BIT10_LEN +1]; /* 设备流水号 */ char acCardNo[CARDNO_LEN +1]; /* 卡号 */ char acTranAmt[TXAMT_LEN + 1]; /* 交易金额 */ char acFrntTime[BIT7_LEN +1]; /* 交易时间 */ char acBankGetFee[TXAMT_LEN +1]; /* 商户回佣 */ char acEarningAmt[TXAMT_LEN +1]; /* 收入金额 */ char acTranKindComm[BIT7_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, "title1:%s|%s", \ acTmpMid, acMctName); \ iLineCount++; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "title2:%s|%s|%s|%s|%s|%s|%s|%s|%s", \ acYear, acMonth, acDate, \ acYear1, acMonth1, acDate1, \ acPage); \ iLineCount++; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "head:" ); \ iLineCount++;#define PRTBODY \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body:" ); \ iLineCount++; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body0:%s|%s|%s|%s|%s|%s|%s|%s|%s", \ stPrtdata.acBer, stPrtdata.acDevId, \ stPrtdata.acDevStan, stPrtdata.acCardNo, \ stPrtdata.acTranAmt, stPrtdata.acBankGetFee, \ stPrtdata.acEarningAmt, stPrtdata.acFrntTime, \ stPrtdata.acTranKindComm ); \ iLineCount++; \ iLine ++ ; \ iNum ++ ; \#define PRTTRANTOT \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body1:" ); \ iLineCount++; \ iLine ++ ; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body2:%s|%s|%s", \ acTAmt,acTAmt1,acTAmt2); \ iLineCount++; \ iLine ++ ; \#define PRTPOSTRANTOT \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body3:" ); \ iLineCount++; \ iLine ++ ; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body4:%s|%s|%s", \ acPAmt,acPAmt1,acPAmt2); \ iLineCount++; \ iLine ++ ; \#define PRTMIDTRANTOT \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body5:" ); \ iLineCount++; \ iLine ++ ; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "body6:%s|%s|%s", \ acPAmt,acPAmt1,acPAmt2); \ iLineCount++; \ iLine ++ ; \ #define PRTFOOT \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "tail1:" ); \ iLineCount++; \ memset( acPrtData, 0x00, sizeof( acPrtData ) ); \ prtline( fp, "bottm:%s|%s|%s|%s", \ pstPubcom->acTeller,acYear3,acMonth3,acDate3); \ iLineCount++; \ iPage ++ ; iLine = 0 ; int cms21B014(pstPubcom)struct pubcom *pstPubcom;{ EXEC SQL BEGIN DECLARE SECTION; char acBeginDate[DATE_LEN + 1 ]; /* 起始日期 */ char acEndDate[DATE_LEN + 1 ]; /* 终止日期 */ char acMctName[70 + 1 ]; /* 商户名称 */ char acSelStr[ 512 ]; EXEC SQL END DECLARE SECTION; double dTAmt = 0.0; /* 交易金额小计 */ double dTAmt1 = 0.0; /* 交易应付商户小计 */ double dTAmt2 = 0.0; /* 交易应付商户小计 */ double dPAmt = 0.0; /* POS交易金额小计 */ double dPAmt1 = 0.0; /* POS交易应付商户小计*/ double dPAmt2 = 0.0; /* POS交易应付商户小计*/ double dMAmt = 0.0; /* 商户交易金额合计 */ double dMAmt1 = 0.0; /* 商户应付商户合计 */ double dMAmt2 = 0.0; /* 商户应付商户合计 */ double dTmpAmt = 0.0; char acTmpMid[BIT16_LEN +1]; /* 商户代码 */ char acTmpDevId[BIT16_LEN +1]; /* 设备代号 */ char acTmpTranCode[TRANCODE_LEN +1]; /* 交易代码 */ char acBankname[ 41 ]; char acBuffer[14]; char acYear[BIT5_LEN + 1]; char acMonth[BIT3_LEN + 1]; char acDate[BIT3_LEN + 1]; char acYear1[BIT5_LEN + 1]; char acMonth1[BIT3_LEN + 1]; char acDate1[BIT3_LEN + 1]; char acYear3[BIT5_LEN + 1]; char acMonth3[BIT3_LEN + 1]; char acDate3[BIT3_LEN + 1]; char acMid[BIT16_LEN + 1]; char acTAmt[TXAMT_LEN +1]; char acTAmt1[TXAMT_LEN +1]; char acTAmt2[TXAMT_LEN +1]; char acPAmt[TXAMT_LEN +1]; char acPAmt1[TXAMT_LEN +1]; char acPAmt2[TXAMT_LEN +1]; char acMAmt[TXAMT_LEN +1]; char acMAmt1[TXAMT_LEN +1]; char acMAmt2[TXAMT_LEN +1]; char acPage[BIT6_LEN +1]; FILE *fp,*fmtfp; /* 文件指针 */ int iLineCount = 0 ; int i, iPage, iLine, iNum, iFlag; char acFileName[ 101 ]; char acFmtFile[ 101 ]; char acPrtData[ 4096 ]; struct prtdata stPrtdata; struct cmstxdethis stCmsTxdetHis; /* 外围交易登记簿历史表 */ memset( acTmpMid, 0x00, sizeof( acTmpMid )); memset( acTmpDevId, 0x00, sizeof( acTmpDevId )); memset( acTmpTranCode, 0x00, sizeof( acTmpTranCode )); memset( acBeginDate, 0x00, sizeof( acBeginDate )); memset( acEndDate, 0x00, sizeof( acEndDate )); memset( acSelStr, 0x00, sizeof( acSelStr ) ); memset( acYear, 0x00, sizeof( acYear ) ); memset( acDate, 0x00, sizeof( acDate ) ); memset( acMonth, 0x00, sizeof( acMonth1 ) ); memset( acYear1, 0x00, sizeof( acYear1 ) ); memset( acDate1, 0x00, sizeof( acDate1 ) ); memset( acMonth1, 0x00, sizeof( acMonth1 ) ); memset( acYear3, 0x00, sizeof( acYear3) ); memset( acDate3, 0x00, sizeof( acDate3) ); memset( acMonth3, 0x00, sizeof( acMonth3) ); memset( acTAmt, 0x00, sizeof( acTAmt) ); memset( acTAmt1, 0x00, sizeof( acTAmt1) ); memset( acTAmt2, 0x00, sizeof( acTAmt2) ); memset( acPAmt, 0x00, sizeof( acPAmt) ); memset( acPAmt1, 0x00, sizeof( acPAmt1) ); memset( acPAmt2, 0x00, sizeof( acPAmt2) ); memset( acMAmt, 0x00, sizeof( acMAmt) ); memset( acMAmt1, 0x00, sizeof( acMAmt1) ); memset( acMAmt2, 0x00, sizeof( acMAmt2) ); memset( &stCmsTxdetHis, 0x00, sizeof( struct cmstxdethis )); memset( &stPrtdata, 0x00, sizeof( struct prtdata )); memset( acBankname, 0x00, sizeof( acBankname ) ); if ( pubGetBaseInfo("BANKNAME", acBankname ) ) FUNCERR_PRO /* 赋打印时间 */ strncpy(acYear3, pstPubcom->acTranDate8, 4); strncpy(acMonth3, pstPubcom->acTranDate8 + 4, 2); strncpy(acDate3, pstPubcom->acTranDate8 + 6, 4); sprintf( g_acTrcMsg,"acMonth3[%s]acDate3",acMonth3, acDate3 ); TRCLOG4 /*检查交易机构是否为中心机构,如果不是,不能做此交易 */ if ((strcmp( pstPubcom->acBrcType, BRCTYPE_CRDCENTER)) && (strcmp( pstPubcom->acBrcType, BRCTYPE_CLSCENTER))) { strcpy( g_acRspCode, "CMS214" ); pubCrtRspInfo( ); ERRLOG goto Exit; } fp = (FILE *)BeginFile( pstPubcom, NULL ); if ( fp == NULL ) { strcpy( g_acRspCode, "DPS902" ); pubCrtRspInfo( ); ERRLOG return FAILED ; } sprintf( acFmtFile, "%s/fmt/cmsB14.fmt", getenv("HOME") ); sprintf( g_acFmtFile, acFmtFile ); if( ( fmtfp=fopen(acFmtFile,"r") ) == NULL ) { strcpy( g_acTrcMsg, acFmtFile ); TRCLOG4 sprintf( g_acRspMsg, "打开格式文件[%s]错", acFmtFile ); ERRLOG goto Exit ; } iLine = 0 ; iFlag = 0 ; iPage = 1 ; iNum = 1 ; /* 取数据字典 */ getstring( "Mid", acMid ); getstring( "BeginDate1", acBeginDate ); getstring( "EndDate1", acEndDate ); strpack( acMid ); sprintf( g_acTrcMsg,"Mid[%s]BeginDate1[%s]EndDate1[%s]", acMid, acBeginDate, acEndDate ); TRCLOG4 sprintf( acSelStr, "select * from cmstxdethis where 1=1 and validf='0' "); if ( strlen ( acMid ) > 0) { sprintf( acSelStr + strlen(acSelStr), " and mid = '%s'", acMid ); } if ( strcmp ( acBeginDate, INITDATE ) ) { sprintf( acSelStr + strlen(acSelStr), " and trandate >= '%s'", acBeginDate ); } if ( strcmp ( acEndDate, INITDATE ) ) { sprintf( acSelStr + strlen(acSelStr), " and trandate <= '%s'", acEndDate ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -