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

📄 proc1.ec

📁 在IBM RS6000小型机上AIX操作系统下INFORMIX数据库C源代码有通讯和管理程序
💻 EC
📖 第 1 页 / 共 2 页
字号:
dwfzh[16]='\0';sprintf(sndname,"/usr/hcdl/dlmg/server/report/yswdwmx.prt");fp=fopen(sndname,"w");if(fp==NULL){	memcpy(msg->rc,PATR_ERR,2);	return(0);	}$select sfdwmc,qcjy into $mc,$qcjy from sfjzhb where sfdwzh=$dwfzh; if(sqlca.sqlcode!=0){	memcpy(msg->rc,PATR_CXERR,2);	return(0);	}$select count(*),sum(sfje) into $count1,$ye from sfjmxlsb          where sfdwzh=$dwfzh and jkrq<$ksrq; if(count1==0)    ye=0;if(sqlca.sqlcode!=0){	memcpy(msg->rc,PATR_CXERR,2);	return(0);	}$declare mx_cursor cursor for select * from sfjmxlsb 		where sfdwzh=$dwfzh and jkrq>=$ksrq and jkrq<=$jsrq                order by jkrq;$open mx_cursor;if(sqlca.sqlcode!=0){	memcpy(msg->rc,PATR_CXERR,2);	return(0);	}fprintf(fp,"\n\n");fprintf(fp,"                                    单位预算外资金收支明细表\n");fprintf(fp,"                                    =========================\n");fprintf(fp,"账号:%s           户名:%s                           期初结转:%s\n",dwfzh,mc,qcjy);fprintf(fp,"┌────┬─────┬─────┬────┬─────┬────────┬────────┬────────┐\n");fprintf(fp,"│  序号  │  日  期  │  凭证号  │  摘要  │  项目号  │    借方发生额  │    贷方发生额  │    余      额  │\n");fprintf(fp,"├────┼─────┼─────┼────┼─────┼────────┼────────┼────────┤\n");i=1;while(1){        $fetch mx_cursor into $sfjls_msg;	if(sqlca.sqlcode==100){		memcpy(msg->rc,PATR_OK,2);		$close mx_cursor;fprintf(fp,"└────┸─────┸─────┸────┸─────┸────────┸────────┸────────┚\n");		fclose(fp);		return(3);		}	if(sqlca.sqlcode!=0){		memcpy(msg->rc,PATR_ERR,2);		$close mx_cursor;		return(0);		}fprintf(fp,"│%6d  │%10s",i,sfjls_msg.jkrq);$select zymc into $zymc                  from zyb                 where $sfjls_msg.zy=zybm;	if(sqlca.sqlcode!=0){		memcpy(msg->rc,PATR_ERR,2);		$close mx_cursor;		return(0);		}fprintf(fp,"│%-10s│%-8.8s│%-10s│",sfjls_msg.pzh,zymc,sfjls_msg.sfxm);if(strcmp(sfjls_msg.sffx,"0")==0)/*收入*/   {    ye=ye+atof(sfjls_msg.sfje);     fprintf(fp,"%-16s│%16s│%16.2f│\n"," ",sfjls_msg.sfje,ye);   }else/*支出*/   {    ye=ye-atof(sfjls_msg.sfje);     fprintf(fp,"%16s│%16s│%16.2f│\n",sfjls_msg.sfje," ",ye);   }	i++;	if(i%50==0){fprintf(fp,"└────┸─────┸─────┸────┸─────┸────────┸────────┸────────┚\n");fprintf(fp,"\n\n");fprintf(fp,"                  单位预算外资金收支明细表\n");fprintf(fp,"                 =========================\n");fprintf(fp,"账号:%s           户名:%s                           期初结转:%s\n",dwfzh,mc,qcjy);fprintf(fp,"┌────┬─────┬─────┬────┬─────┬────────┬────────┬────────┐\n");fprintf(fp,"│  序号  │  日  期  │  凭证号  │  摘要  │  项目号  │    借方发生额  │    贷方发生额  │    余      额  │\n");fprintf(fp,"├────┼─────┼─────┼────┼─────┼────────┼────────┼────────┤\n");                 }     }}proc95(msg)/*流水*/DL_MSG *msg;{FILE *fp;int i;$char ksrq[11];$long rq,rq1;$char dwfzh[9];$char mc[31],qcjy[14],zymc[11],sh[5],wdh[11],errmsg[51],bsc[5];$float ye;memset(ksrq,'\0',11);memcpy(ksrq,msg->passwd2+5,5);memcpy(ksrq+5,"/",1);memcpy(ksrq+6,msg->passwd2,4);sprintf(sndname,"/usr/hcdl/dlmg/server/report/yswdrls.prt");fp=fopen(sndname,"w");if(fp==NULL){	memcpy(msg->rc,PATR_ERR,2);	return(0);	}rtoday(&rq);rstrdate(ksrq,&rq1);if(rq==rq1)    $declare mx_cur cursor for select * from sfjmxb 		where  jkrq=today                order by jkrq;else    $declare mx_curls cursor for select * from sfjmxlsb 		where  jkrq=$ksrq                order by jkrq;if(rq==rq1)  {   $open mx_cur;   if(sqlca.sqlcode!=0){	memcpy(msg->rc,PATR_CXERR,2);	return(0);	}  }else  {   $open mx_curls;   if(sqlca.sqlcode!=0){	memcpy(msg->rc,PATR_CXERR,2);	return(0);	}  }fprintf(fp,"\n\n");fprintf(fp,"                                    单位预算外资金收支明细表\n");fprintf(fp,"                                    =========================\n");fprintf(fp,"┌────┬─────┬───────┬───┬────┬─────┬──────┬────────┬────────────────────┐\n");fprintf(fp,"│  序号  │  日  期  │执收单位代码  │项目  │  摘要  │  凭证号  │  受理网点  │    发生额      │                付款单位名称            │\n");fprintf(fp,"├────┼─────┼───────┼───┼────┼─────┼──────┼────────┼────────────────────┤\n");i=1;while(1){        if(rq==rq1)         {          $fetch mx_cur into $sfjls_msg;	  if(sqlca.sqlcode==100){		memcpy(msg->rc,PATR_OK,2);		$close mx_cur;fprintf(fp,"└────┸─────┸───────┸───┸────┸─────┸──────┸────────┸────────────────────┚\n");		fclose(fp);		return(3);		}	   if(sqlca.sqlcode!=0){		memcpy(msg->rc,PATR_ERR,2);		$close mx_cur;		return(0);		}         }        else         {          $fetch mx_curls into $sfjls_msg;	  if(sqlca.sqlcode==100){		memcpy(msg->rc,PATR_OK,2);		$close mx_curls;fprintf(fp,"└────┸─────┸───────┸───┸────┸─────┸──────┸────────┸────────────────────┚\n");		fclose(fp);		return(3);		}	   if(sqlca.sqlcode!=0){		memcpy(msg->rc,PATR_ERR,2);		$close mx_curls;		return(0);		}         }fprintf(fp,"│%6d  │%10s",i,sfjls_msg.jkrq);$select zymc into $zymc                  from zyb                 where $sfjls_msg.zy=zybm;	if(sqlca.sqlcode!=0){		memcpy(msg->rc,PATR_ERR,2);                if(rq==rq1)		  $close mx_cur;                else		  $close mx_curls;		return(0);		}fprintf(fp,"│%-14.14s│%-5.5s │%-4.4s    ",sfjls_msg.sfdwzh,sfjls_msg.sfxm,zymc);           memcpy(sh+1,sfjls_msg.gyh,3);           sh[0]='0';           sh[4]='\0';           wdh[0]='1';           $select bsc into $bsc                  from shzhb                 where $sh=sh;	   if(sqlca.sqlcode!=0)                {                sprintf(errmsg,"所=%s失败%d\n",sh,sqlca.sqlcode);                puts(errmsg);		memcpy(msg->rc,PATR_CXERR,2);	                if(rq==rq1)                 {	          $close mx_cur;                  $free mx_cur;                 }                else                 {	          $close mx_curls;                  $free mx_curls;                 }                fclose(fp);		return(0);		}                      memcpy(wdh+1,bsc+1,3);           memcpy(wdh+4,sfjls_msg.gyh,3);           wdh[7]='\0';fprintf(fp,"│%10.10s│%-12s│",sfjls_msg.pzh,wdh);if(strcmp(sfjls_msg.sffx,"0")==0)/*收入*/   {    fprintf(fp," %-15s│%-40s│\n",sfjls_msg.sfje,sfjls_msg.fkdwmc);   }else/*支出*/   {    fprintf(fp,"-%-15s│%-40s│\n",sfjls_msg.sfje,sfjls_msg.fkdwmc);   }	i++;	if(i%50==0){fprintf(fp,"└────┸─────┸───────┸───┸────┸─────┸──────┸────────┸────────────────────┚\n");fprintf(fp,"\f");fprintf(fp,"\n\n");fprintf(fp,"                  单位预算外资金收支明细表\n");fprintf(fp,"                 =========================\n");fprintf(fp,"┌────┬─────┬───────┬───┬────┬─────┬──────┬────────┬────────────────────┐\n");fprintf(fp,"│  序号  │  日  期  │执收单位代码  │项目  │  摘要  │  凭证号  │  受理网点  │    发生额      │                付款单位名称            │\n");fprintf(fp,"├────┼─────┼───────┼───┼────┼─────┼──────┼────────┼────────────────────┤\n");                 }     }}proc93(msg)DL_MSG *msg;{$ char jzrq[11];memset(jzrq,'\0',11);memcpy(jzrq,msg->point+5,5);memcpy(jzrq+5,"/",1);memcpy(jzrq+6,msg->point,4);$begin work;$lock table lslsb in exclusive mode;$ delete from lslsb where jkrq<=$jzrq; if(sqlca.sqlcode!=0) {  $ rollback work;  memcpy(msg->rc,PATR_ERR,2);  return(1); }$commit work;memcpy(msg->rc,PATR_OK,2);return(1);}proc99(msg)DL_MSG *msg;{$ char jzrq[11];long date;short mdy[3];char mon[3];FILE *fp;memset(jzrq,'\0',11);memcpy(jzrq,msg->point+5,5);memcpy(mon,msg->point+5,2);mon[2]='\0';memcpy(jzrq+5,"/",1);memcpy(jzrq+6,msg->point,4);if((atoi(mon)==0)||(atoi(mon)>12)) {  memcpy(msg->rc,PATR_ERR,2);  return(1); }rtoday(&date);rjulmdy(date,mdy);if(atoi(mon)==mdy[0]) {  memcpy(msg->rc,PATR_ERR,2);  return(1); }$begin work;$lock table jjfkb in exclusive mode;$ delete from jjfkb where jkrq<=$jzrq;if(sqlca.sqlcode!=0) {  $ rollback work;  memcpy(msg->rc,PATR_ERR,2);  return(1); }$commit work;memcpy(msg->rc,PATR_OK,2);return(1);}proc96(msg)DL_MSG *msg;{$ char rq[7],preym[7];$ double bysr,byzc,bysrlj,byzclj;char year[5],month[3];memset(rq,'\0',7);memset(preym,'\0',7);memset(year,'\0',5);memset(month,'\0',3);memcpy(rq,msg->point,6);memcpy(year,msg->point,4);memcpy(month,msg->point+4,2);if(atoi(month)==1)sprintf(preym,"%4d%2d",atoi(year)-1,12);else sprintf(preym,"%4d%2d",atoi(year),atoi(month));$declare sfjzh_cur cursor for select * from sfjzhb;$open sfjzh_cur;if(sqlca.sqlcode!=0){memcpy(msg->rc,PATR_ERR,2);return(1);}while(1){$fetch sfjzh_cur into $sfjzh_msg; if(sqlca.sqlcode==100)break;if(sqlca.sqlcode!=0){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}if(memcmp(sfjzh_msg.sfdwzh+2,"000000",6)==0)continue;bysr=0;byzc=0;$declare lssfj_cur cursor for select * from lssfjmx;$open lssfj_cur;if(sqlca.sqlcode!=0){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}while(1){	$fetch lssfj_cur into $sfjls_msg;	if(sqlca.sqlcode==100)break;	if(sqlca.sqlcode!=0){	 	$close lssfj_cur;		$close sfjzh_cur;		memcpy(msg->rc,PATR_ERR,2);		return(1);		}	if((memcmp(sfjls_msg.sfdwzh,sfjzh_msg.sfdwzh,8)==0)&&(memcmp(sfjls_msg.jkrq,rq+4,2)==0)&&(memcmp(sfjls_msg.jkrq+6,rq,4))==0){	if(memcmp(sfjls_msg.sffx,"0",1)==0)		bysr+=atof(sfjls_msg.sfje);	else		byzc+=atof(sfjls_msg.sfje);	}}$close lssfj_cur;$free lssfj_cur;memcpy(sfjyd_msg.sfdwzh,sfjzh_msg.sfdwzh,8);memcpy(sfjyd_msg.ym,rq,8);sprintf(sfjyd_msg.bysr,"%13.2f",bysr);sprintf(sfjyd_msg.byzc,"%13.2f",byzc);$select bysrlj,byzclj into $bysrlj,$byzclj from sfjydb	 where ym=$preym and sfdwzh=$sfjzh_msg.sfdwzh;if(sqlca.sqlcode==100){	 bysrlj=0;byzclj=0;	}if((sqlca.sqlcode!=0)&&(sqlca.sqlcode!=100)){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}bysrlj+=bysr;byzclj+=byzc;sprintf(sfjyd_msg.bysrlj,"%13.2f",bysrlj);sprintf(sfjyd_msg.byzclj,"%13.2f",-byzclj);sprintf(sfjyd_msg.qmjy,"%13.2f",atof(sfjzh_msg.qcjy)+bysrlj+byzclj);$insert into sfjydb values($sfjyd_msg);if(sqlca.sqlcode!=0){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}}$close sfjzh_cur;$open sfjzh_cur;if(sqlca.sqlcode!=0){memcpy(msg->rc,PATR_ERR,2);return(1);}while(1){$fetch sfjzh_cur into $sfjzh_msg;if(sqlca.sqlcode==100)break;if(sqlca.sqlcode!=0){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}if(memcmp(sfjzh_msg.sfdwzh+2,"000000",6)!=0)continue;bysr=0;byzc=0;$declare sfjyd_cur cursor for select * from sfjydb	where ym=$rq;$open sfjyd_cur;if(sqlca.sqlcode!=0){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}while(1){	$fetch sfjyd_cur into $sfjyd_msg;	if(sqlca.sqlcode==100)break;	if(sqlca.sqlcode!=0){		$close sfjzh_cur;		$close sfjyd_cur;		memcpy(msg->rc,PATR_ERR,2);		return(1);		}	if((memcmp(sfjyd_msg.sfdwzh,sfjzh_msg.sfdwzh,2)==0)&&(memcmp(sfjyd_msg.ym,rq,6)==0)){		bysr+=atof(sfjyd_msg.bysr);		byzc+=atof(sfjyd_msg.byzc);}}$close sfjyd_cur;$free sfjyd_cur;memcpy(sfjyd_msg.sfdwzh,sfjzh_msg.sfdwzh,8);memcpy(sfjyd_msg.ym,rq,8);sprintf(sfjyd_msg.bysr,"%13.2f",bysr);sprintf(sfjyd_msg.byzc,"%13.2f",byzc);$select bysrlj,byzclj into $bysrlj,$byzclj from sfjydb	 where ym=$preym and sfdwzh=$sfjzh_msg.sfdwzh;if(sqlca.sqlcode==100){	bysrlj=0;	byzclj=0;	}if((sqlca.sqlcode!=0)&&(sqlca.sqlcode!=100)){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);		return(1);	}bysrlj+=bysr;byzclj+=byzc;sprintf(sfjyd_msg.bysrlj,"%13.2f",bysrlj);sprintf(sfjyd_msg.byzclj,"%13.2f",-byzclj);sprintf(sfjyd_msg.qmjy,"%13.2f",atof(sfjzh_msg.qcjy)+bysrlj+byzclj);$insert into sfjydb values($sfjyd_msg);if(sqlca.sqlcode!=0){	$close sfjzh_cur;	memcpy(msg->rc,PATR_ERR,2);	return(1);	}}$close sfjzh_cur;memcpy(msg->rc,PATR_OK,2);return(1);}

⌨️ 快捷键说明

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