📄 proc2.0202
字号:
#include <stdio.h>#include <ctype.h>#include <time.h>#include "def/dlmsg.h"#include <stdlib.h>$include sqlca;$include sqlda;$include sqltypes;EXEC SQL begin declare section;$include "def/stru.h";$include "/usr/hcdl/online/def/inout.h";EXEC SQL end declare section;proc98(msg) /* print jjdzd */DL_MSG *msg;{ $ double zje; $ char dm[5],mc[21],jjdh[5]; $ short mdy[3]; $ long jkrq; char xtzh[4],year[5],month[3],old_xt[2],new_xt[2],old_mc[21],new_mc[21]; char ym[7]; double zd_zje,dd_zje,tot_zje; long zd_bs,dd_bs,tot_bs,len; FILE *fp; int isfirstxt; strcpy(ym,msg->passwd2); memcpy(year,ym,4); year[4]='\0'; memcpy(month,ym+4,2); month[2]='\0'; sprintf(sndname,"/usr/hcdl/dlmg/server/report/jjdzd.prt"); fp=fopen(sndname,"w"); if(fp==NULL) { memcpy(msg->rc,PATR_ERR,2); fclose(fp); return (0); } /*选择交警队号*/ $declare jjdh_cursor cursor for select dm,mc into $dm,$mc from jjdmb order by dm; $open jjdh_cursor; if(SQLCODE!=0) { $close jjdh_cursor; $free jjdh_cursor; memcpy(msg->rc,PATR_CXERR,2); return(0); } $declare jjmx_cursor scroll cursor for select jkrq,jjdh,zje into $jkrq,$jjdh,$zje from jjfkb; $open jjmx_cursor; if(SQLCODE!=0) { $close jjdh_cursor; $free jjdh_cursor; $close jjmx_cursor; $free jjmx_cursor; memcpy(msg->rc,PATR_CXERR,2); return(0); } fprintf(fp," %s年%s月代收交通违章罚款对帐单\n",year,month); fprintf(fp,"===========================================================\n"); fprintf(fp,"%30s %8s\n","本月笔数","本月余额"); isfirstxt=1; tot_zje=0; tot_bs=0; strcpy(old_mc,"\0"); strcpy(new_mc,"\0"); while(1) { $ fetch next jjdh_cursor; if(SQLCODE<0) { $close jjdh_cursor; $free jjdh_cursor; fclose(fp); memcpy(msg->rc,PATR_CXERR,2); return(0); } if(SQLCODE==SQLNOTFOUND) { break; } strncpy(xtzh,dm+2,2); if(!strncmp(xtzh,"00",2)) { strcpy(old_mc,new_mc); strcpy(new_mc,mc); if(isfirstxt) { strncpy(new_xt,dm,2); dd_bs=0; dd_zje=0; isfirstxt=0; } else { /*trim the trail space*/ len=strlen(old_mc)-1; while((len>=0)&&(old_mc[len--]==' ')); len+=2; old_mc[len]='\0'; strcat(old_mc,"合计:"); fprintf(fp,"%20s %4d %14.2f\n",old_mc,dd_bs,dd_zje); strncpy(new_xt,dm,2); dd_bs=0; dd_zje=0; }; continue; } zd_zje=0; zd_bs=0; $fetch first jjmx_cursor; if(SQLCODE!=0) { $close jjdh_cursor; $free jjdh_cursor; $close jjmx_cursor; $free jjmx_cursor; memcpy(msg->rc,PATR_CXERR,2); fclose(fp); return(0); } rjulmdy(jkrq,mdy); if(!strncmp(dm,jjdh,4)&&(atoi(year)==mdy[2])&&(atoi(month)==mdy[0])) { zd_zje=zd_zje+zje; zd_bs=zd_bs+1; } while(1) { $ fetch next jjmx_cursor; if(SQLCODE<0) { $close jjdh_cursor; $free jjdh_cursor; $close jjmx_cursor; $free jjmx_cursor; fclose(fp); return(0); } if(SQLCODE==SQLNOTFOUND) { break; } rjulmdy(jkrq,mdy); if(!strncmp(dm,jjdh,4)&&(atoi(year)==mdy[2])&&(atoi(month)==mdy[0])) { zd_zje=zd_zje+zje; zd_bs=zd_bs+1; } }/*end while*/ fprintf(fp,"%20.10s %4d %14.2f\n",mc,zd_bs,zd_zje); dd_bs=dd_bs+zd_bs; dd_zje=dd_zje+zd_zje; tot_bs=tot_bs+zd_bs; tot_zje=tot_zje+zd_zje; } /*trim the tail space*/ len=strlen(new_mc)-1; while((len>=0)&&(new_mc[len--]==' ')); len+=2; new_mc[len]='\0'; strcat(new_mc,"合计:"); fprintf(fp,"%-20s %4d %14.2f\n",new_mc,dd_bs,dd_zje); fprintf(fp,"%-20s %4d %14.2f\n","本月代收合计:",tot_bs,tot_zje); fprintf(fp,"-----------------------------------------------------------\n"); fclose(fp); $close jjdh_cursor; $free jjdh_cursor; $close jjmx_cursor; $free jjmx_cursor; memcpy(msg->rc,PATR_OK,2); return(3);}proc97(msg) /* print yswdwybb */DL_MSG *msg;{ $ double bysrlj,byzclj,qmjy,qcjy,bysr,byzc; $ char sfdwzh[9],sfdwmc[11],ym[7]; char xtzh[4],year[5],month[3],old_xt[2],new_xt[2],old_dwmc[11],new_dwmc[11]; double old_qcjy,old_bysr,old_bysrlj,old_byzc,old_byzclj,old_qmjy; double new_qcjy,new_bysr,new_bysrlj,new_byzc,new_byzclj,new_qmjy; FILE *fp; int isfirstxt; strcpy(ym,msg->passwd2); memcpy(year,ym,4); year[4]='\0'; memcpy(month,ym+4,2); month[2]='\0'; sprintf(sndname,"/usr/hcdl/dlmg/server/report/yswdwyb.prt"); fp=fopen(sndname,"w"); if(fp==NULL) { memcpy(msg->rc,PATR_ERR,2); fclose(fp); return (0); } /*检查本月是否已结帐*/ $declare ny_curso cursor for select sfdwzh into $sfdwzh from sfjydb where ym=$ym; $open ny_curso; if(SQLCODE!=0) { $close ny_curso; $free ny_curso; memcpy(msg->rc,PATR_CXERR,2); return(0); } $fetch ny_curso; if(SQLCODE!=0) { $close ny_curso; $free ny_curso; memcpy(msg->rc,PATR_CXERR,2); return(0); } $close ny_curso; $free ny_curso; /*选择系统*/ $declare xt_curso cursor for select sfdwzh,sfdwmc,qcjy into $sfdwzh,$sfdwmc,$qcjy from sfjzhb order by sfdwzh; $open xt_curso; if(SQLCODE!=0) { memcpy(msg->rc,PATR_CXERR,2); $close xt_curso; $free xt_curso; return(0); } fprintf(fp," %s年%s月市单位预算外资金收支情况表\n",year,month); fprintf(fp," ====================================\n"); fprintf(fp,"编报单位:南昌市预算外资金管理中心 单位:元\n"); fprintf(fp,"┌─────┬─────┬───────┬───────────────┬───────────────┬───────┐\n"); fprintf(fp,"│ │ │ │ 收入 │ 支出 │ │
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -