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

📄 proc2.0521

📁 在IBM RS6000小型机上AIX操作系统下INFORMIX数据库C源代码有通讯和管理程序
💻 0521
字号:
#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],str1[300],str2[100];  $ 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);      }  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);}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 + -