⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proc2.ec

📁 在IBM RS6000小型机上AIX操作系统下INFORMIX数据库C源代码有通讯和管理程序
💻 EC
📖 第 1 页 / 共 5 页
字号:
#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";$include "/usr/hcdl/online/def/dbvalue.h";EXEC SQL end declare section;proc98(msg)  /* print jjdzd */DL_MSG *msg;{  $ double zje;  $ char dm[5],mc[21],jjdh[5],str1[500],str2[600];  $ short mdy[3];  $ long jkrq;  $ shzh_file shbsc_msg,old_shbsc_msg;  $ jjfk_file jjfk_msg;  int no_bsc;  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 shbsc_cur cursor for select * from shzhb order by bsc,sh;   $open shbsc_cur;  if(sqlca.sqlcode!=0){		memcpy(msg->rc,PATR_CXERR,2);                fclose(fp);		return(0);		}  $fetch shbsc_cur into $shbsc_msg;  if(sqlca.sqlcode==100){			memcpy(msg->rc,PATR_ERR,2);			$close shbsc_cur;			fclose(fp);			return(0);			}  if(sqlca.sqlcode!=0){			memcpy(msg->rc,PATR_ERR,2);			$close shbsc_cur;                        fclose(fp);			return(0);			}    no_bsc=1;  while(1)/*processing bsc one by one*/  {  old_shbsc_msg=shbsc_msg;  sprintf(str1," select *  from jjfkb where sh=\"%s\" ",shbsc_msg.sh);   while(strcmp(shbsc_msg.bsc,old_shbsc_msg.bsc)==0)  {   $fetch shbsc_cur into $shbsc_msg;   if(sqlca.sqlcode==100){       if(no_bsc==1)        {         fclose(fp);         $close jjdh_cursor;         $free jjdh_cursor;         $close jjmx_cursor;         $free jjmx_cursor;         $close shbsc_cur;         $free shbsc_cur;         memcpy(msg->rc,PATR_OK,2);         return(3);        }      else       {        no_bsc=1;        break;       }			}   if(sqlca.sqlcode!=0){			memcpy(msg->rc,PATR_ERR,2);			$close shbsc_cur;                        fclose(fp);			return(0);			}  if(strcmp(shbsc_msg.bsc,old_shbsc_msg.bsc)==0)     {      sprintf(str2," or sh=\"%s\" ",shbsc_msg.sh);      strcat(str1,str2);      no_bsc=0;     }  else   {    strcat(str1,";");    break;   }  }  /*选择交警队号*/  $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);      }  $prepare s_1 from $str1;  $declare jjmx_cursor scroll cursor for  s_1 ;  $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);      }      $fetch first jjmx_cursor into $jjfk_msg;      if(SQLCODE==SQLNOTFOUND)         continue;      if(SQLCODE!=0)            {            $close jjdh_cursor;            $free jjdh_cursor;            $close jjmx_cursor;            $free jjmx_cursor;            $close shbsc_cur;            $free  shbsc_cur;            memcpy(msg->rc,PATR_CXERR,2);            fclose(fp);            return(0);           }  fprintf(fp,"                   %s年%s月代收交通违章罚款对帐单\n",year,month);  fprintf(fp,"                            (%s)\n",old_shbsc_msg.bscm);  fprintf(fp,"===========================================================\n");  fprintf(fp,"%30s    %8s\n","本月笔数","本月余额");    isfirstxt=1;  zd_zje=0;  zd_bs=0;  dd_zje=0;  dd_bs=0;  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 into $jjfk_msg;      if(SQLCODE==SQLNOTFOUND)         break;      if(SQLCODE!=0)            {            $close jjdh_cursor;            $free jjdh_cursor;            $close jjmx_cursor;            $free jjmx_cursor;            $close shbsc_cur;            $free  shbsc_cur;            memcpy(msg->rc,PATR_CXERR,2);            fclose(fp);            return(0);           }      strcpy(jjdh,jjfk_msg.jjdh);      rstrdate(jjfk_msg.jkrq,&jkrq);      zje=atof(jjfk_msg.zje);      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 into $jjfk_msg;         strcpy(jjdh,jjfk_msg.jjdh);         rstrdate(jjfk_msg.jkrq,&jkrq);         zje=atof(jjfk_msg.zje);         if(SQLCODE<0)            {            $close jjdh_cursor;            $free jjdh_cursor;            $close jjmx_cursor;            $free jjmx_cursor;            fclose(fp);            $close shbsc_cur;            $free  shbsc_cur;            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"); fprintf(fp,"\n\n"); }/*end while bsc*/ fclose(fp); $close jjdh_cursor; $free jjdh_cursor; $close jjmx_cursor; $free jjmx_cursor; $close shbsc_cur; $free shbsc_cur; memcpy(msg->rc,PATR_OK,2); return(3);}proc73(msg) /* print wtdwb*/ DL_MSG *msg;{        $struct st_wtdwb p_wtdwb;	FILE *fp;	int k,i,j;        $ char c_date[9],c_time[7];        get_time(c_date,c_time);	sprintf(sndname,"/usr/hcdl/dlmg/server/report/zzqd.prt");		fp=fopen(sndname,"w");	if (fp==NULL) {		memcpy(msg->rc,PATR_ERR,2);			return(0);	}	$declare l_cur cursor for select dwdm,dwmc,skzje,ljwjzje,                ljyjzje,plskje,plfkje 		from wtdwb;	$open l_cur;		if(sqlca.sqlcode!=0) {			memcpy(msg->rc,PATR_CXERR,2);				return(0);		}        fprintf(fp,"\n\n");        fprintf(fp,"	            代理中心委托单位轧帐清单\n");        fprintf(fp,"操作员号:%s                                                         日期:%s %s\n",msg->teller,c_date,c_time);                        fprintf(fp,"=================================================================================\n");        fprintf(fp," 单位代码           单位名称         联机收入     批量收入     总收入     支出金额\n");                        fprintf(fp,"---------------------------------------------------------------------------------\n");        i=0;        while(1) {  	   $fetch l_cur           into $p_wtdwb.dwdm,$p_wtdwb.dwmc,$p_wtdwb.skzje,                $p_wtdwb.ljwjzje,                $p_wtdwb.ljyjzje,$p_wtdwb.plskje,$p_wtdwb.plfkje; 		if(sqlca.sqlcode==100) { 	                memcpy(msg->rc,PATR_OK,2);                        $close l_cur;                        fprintf(fp,"----------------------------------------------------------------------------------\n");                /*        fprintf(fp,"\f");*/                        fclose(fp);	                return(3);                     };		if(sqlca.sqlcode!=0) {			memcpy(msg->rc,PATR_CXNO,2);				return(0);                     };		fprintf(fp," %6s %20s %10.2f %12.2f %12.2f %12.2f  \n",                 p_wtdwb.dwdm,p_wtdwb.dwmc,p_wtdwb.ljwjzje+p_wtdwb.ljyjzje,                 p_wtdwb.plskje,p_wtdwb.skzje,p_wtdwb.plfkje);                 i++;                if (i >50){                   fprintf(fp,"-------------------------------------------------------------------------------------------\n");                   i=0;                /*   fprintf(fp,"\f");*/                   fprintf(fp,"\n\n");                   fprintf(fp,"	            代理中心委托单位轧帐清单\n");                   fprintf(fp,"=======================================================================================\n");                   fprintf(fp," 单位代码           单位名称         联机收入     批量收入     总收入     支出金额\n");                   fprintf(fp,"---------------------------------------------------------------------------------------\n");                   };	}}proc72(msg)   /*print cxszzb*/ DL_MSG *msg;{	FILE *fp;	$char p_sh[5],p_sm[21],c_date[9],c_time[7]; 	$long int p_rec,shjs;	$float p_je;	int i,j;        get_time(c_date,c_time);	sprintf(sndname,"/usr/hcdl/dlmg/server/report/zzqd1.prt");		fp=fopen(sndname,"w");	if (fp==NULL) {                puts("open files err !!");		memcpy(msg->rc,PATR_ERR,2);			return(0);	}	$select count(*) into $shjs from shzhb ;	$declare sh_cur1 cursor for select sh,sm		from shzhb order by sh;	$open sh_cur1;		if(sqlca.sqlcode!=0) {                puts("select err1 !!");			memcpy(msg->rc,PATR_CXERR,2);				return(0);		}	fprintf(fp,"\n");	fprintf(fp,"	            代理中心储蓄所轧帐清单\n");	fprintf(fp,"\n\n");        fprintf(fp,"操作员号:%s                                     日期:%s\n",msg->teller,c_date);	fprintf(fp,"=====================================================================\n");	fprintf(fp," 所  号        笔数        金额       \n");	fprintf(fp,"---------------------------------------------------------------------\n");			for(j=0;j<shjs;j++){		$fetch sh_cur1		into $p_sh,$p_sm;	        $select count(*),sum(je) into                $p_rec,$p_je 		from cxszzb where (not zt3="8") and sh=$p_sh;                if(p_rec==0)                 p_je=0;                i=0;		fprintf(fp,"  %4s       %ld     %12.2f\n",p_sh,p_rec,p_je);                i++;                 /*满66行换页*/                if (i >50){		   fprintf(fp,"--------------------------------------------------------------\n");                   i=0;	           fprintf(fp,"\n");	           fprintf(fp,"	            代理中心储蓄所轧帐清单\n");	           fprintf(fp,"\n\n");	           fprintf(fp,"=====================================================================\n");                   fprintf(fp,"操作员号:%s                                     日期:%s\n",msg->teller,c_date);	           fprintf(fp," 所  号        笔数        金额       \n");	           fprintf(fp,"---------------------------------------------------------------------\n");	           }	            }	    fprintf(fp,"---------------------------------------------------------------------\n");            $close sh_cur1;	    fclose(fp);	    memcpy(msg->rc,PATR_OK,2);	    return(3);  };proc71(msg)  /* print 储蓄所流水表 */DL_MSG *msg;{        $struct st_ljlsb p_ljlsb;	FILE *fp;	$char p_sh[5],p_sm[21],p_jzbz[2],p_rq[11]; 	$char ymd[11]; 	$long int p_rec,ymd2,date,shjs;	$float p_je;	$char str[30],str1[50],str2[50],str3[9],ymd3[11];	int k,i,j;	char tellero[3];	strmove(ymd,msg->passwd1,10);	sprintf(sndname,"/usr/hcdl/dlmg/server/report/lsqd.prt");		fp=fopen(sndname,"w");	if (fp==NULL) {                puts("open files err !!");		memcpy(msg->rc,PATR_ERR,2);			return(0);	}	$select count(*) into $shjs from shzhb ;	$declare sh_cur cursor for select sh,sm		from shzhb ;	$open sh_cur;		if(sqlca.sqlcode!=0) {                puts("select err1 !!");			memcpy(msg->rc,PATR_CXERR,2);				return(0);		}	for(j=0;j<shjs;j++){		$fetch sh_cur		into $p_sh,$p_sm;	$declare ls_cur cursor for select *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -