📄 house_tran.ec
字号:
/* 住房基金转存 */#include </u/ebcsav/include/sav.h>$include sqlca;$include sqlda;void addspace();void mess();char y_n();char readdv();char readst();char readch();long ac_num();double get_inte();void prt_inum();void prt_dnum();void addspacef();void prtf_inum();void prtf_dnum();void delay();short num_time();#include </u/ebcsav/include/begin>short ti,i,n,p;double x;long k;unsigned char c;char st[36];FILE *pf;$ char s_num[2],nam[9],cu_type[2],te[2];$ long a_num,cr_num,ope_date,b_num;$ double amoun,inte,bala;$ short cred_type,u;$ long cred_num,i_date,l_mon;$ char ope_num[2],s_type[2],sta[2],r_type[2];move(0,29);$ database saving;printw("住 房 基 金 转 存");ope_num[0]=op_num;ope_num[1]='\0';s_num[0]=op.num&0x7f;s_num[1]='\0';r_type[0]=9;r_type[1]='\0';cred_type=3;s_type[0]=cred_type;s_type[1]='\0';cu_type[0]='R';cu_type[1]='\0';$ declare blot scroll cursor for select blot_num from r_blot;while(1) { move(3,10); addstr("单位编号: "); move(3,24); c=readdv(&x,3); if(c==10) u=x; move(3,24); prt_inum(u,3); pf=fopen("/u/ebcsav/data/tran_sec.dat","r"); fseek(pf,(u-1)*24,0); fread(st,24,1,pf); st[24]='\0'; if(feof(pf)||st[0]=='\0') { move(20,20); mess((short)40); mess((short)3); getch(); break; } fclose(pf); move(5,10); addstr("单位名称: "); move(5,48); addstr(st); strcpy(st,"/u/ebcsav/data/tran001.dat"); st[19]=u/100+48; st[20]=(u%100)/10+48; st[21]=(u%10)+48; pf=fopen(st,"r+"); ope_date=year*10000+month*100+day; fseek(pf,0,0); fread(&k,4,1,pf); fread(&amoun,8,1,pf); move(7,10); addstr("基金总额: "); move(9,10); addstr("上次转存时间: "); move(7,48); prt_dnum(amoun,16); move(9,48); printw("%4d年%2d月%2d日",k/10000,(k%10000)/100,k%100); move(20,20); if(k==ope_date) { printw("本日已做过转存, "); mess((short)3); getch(); break; } move(11,10); addstr("本次转存月份(年月): "); readdv(&x,6); l_mon=x; move(11,30); addspace(6); move(11,48); printw("%4d年%2d月",l_mon/100,l_mon%100); move(20,20); mess((short)33); c=y_n('Y','N','N'); move(20,20); addspace(42); p=1; if(c=='N')break; else if(c=='Y') { fseek(pf,12,0); $ begin work; p=0; while(1) { fread(&a_num,4,1,pf); fread(&amoun,8,1,pf); if(feof(pf))break; if(a_num==0) continue; $ select name,term,balance,cre_num,inte_date,status,interest into $nam,$te,$bala,$cr_num,$i_date,$sta,$inte from r_dated where sec_num=$s_num and acc_num=$a_num; if(sqlca.sqlcode!=0) { move(20,20); mess((short)19); prt_inum(a_num,9); p=1; break; } if(sta[0]=='E') { move(20,20); mess((short)24); prt_inum(a_num,9); p=1; break; } if(ope_date!=i_date) { k=((toupper(cu_type[0])-64)*10000+200); inte=inte+get_inte(k,i_date,bala,&x); i_date=ope_date; } bala+=amoun; $ update r_dated set balance=$bala,interest=$inte,inte_date=$ope_date, last_month=$l_mon where sec_num=$s_num and acc_num=$a_num; if(sqlca.sqlerrd[2]!=1) { addstr("写"); mess((short)14); printw("(%d), ",sqlca.sqlcode); p=1; break; } else { move(20,20); addspace(50); move(20,20); for(n=0;n<5;n++) { $ insert into r_blot values (0,$ope_num,$s_num,$a_num,$nam,$s_type, $cu_type,$te,$cr_num,"T",$amoun,$bala,$inte); if(sqlca.sqlcode!=-271) break; printw("*"); refresh(); delay(5l); } if(sqlca.sqlcode==-271) { mess((short)73); p=1; break; } else if(sqlca.sqlcode!=0) { addstr("写"); mess((short)16); printw("(%d), ",sqlca.sqlcode); p=1; break; } else { $ open blot; $ fetch last blot into $b_num; $ close blot; $ insert into r_dated_sch values ($s_num,$a_num,$ope_date,$b_num, $nam,$cu_type,$amoun,$bala,$inte,$r_type); if(sqlca.sqlcode!=0) { addstr("写"); mess((short)18); printw("(%d), ",sqlca.sqlcode); p=1; break; } move(20,20); addspace(50); move(20,20); mess((short)41); } } } } if(p==1) { $ rollback work; } else { $ commit work; fseek(pf,0,0); fwrite(&ope_date,4,1,pf); } fclose(pf); mess((short)3); getch(); break; }$ close database;endwin();#include </u/ebcsav/include/end>double get_inte(k,dat,amount,maint)long k,dat;double amount,*maint;{$double rat,dat1,bl;$long k1;$int y,m,sy,sm,sd,wy,wm,wd;char c3;double ll1,ll2,ll3;double lx=0,am,lx1=0,lx2=0,lx3=0,lx4=0;short year,month,day;long tzbz,yy,mm,mm1,dd,zx,t1,t2,t3,t4,dat2,dat3,dat4,ts,ts1,m1,m2,m3,yer,da2;long i,j,lz[3]={360,1080,1800},dq[6]={90,180,360,720,1080,1800}, de[5]={30,90,180,270,360}, tz[16]={15,30,60,90,120,150,180,210,240,270,300,330,360,720,1080,0};num_date(&year,&month,&day);yy=dat/10000;/*t1=amount;amount=t1;*/mm=(dat%10000)/100;dd=dat%100;t1=k/100;if(day>=dd)ts=(year-yy)*360+(month-mm)*30+day-dd;else { if(month==1){yer=year-1; mm1=12; } else{ mm1=month-1; yer=year; } m1=yer%400; m2=yer%100; m3=yer%4; if(mm1==1||mm1==3||mm1==5||mm1==7||mm1==8||mm1==10||mm1==12) da2=31; else if(mm1!=2) da2=30; else if(m1==0||m2!=0&&m3==0) da2=29; else da2=28; ts=(yer-yy)*360+(mm1-mm)*30+da2+day-dd; }tzbz=0;if(t1==1807){ if(ts<tz[0]) { tzbz=1; k=180200; } else { i=0; do{ i++; }while(ts>=tz[i]&&i<15); k=t1*100+i; } }t1=k/10000;t2=k%10000;t3=t2/100;t4=t2%100*30;if(t1>32&&t1!=50){ t1-=32; t3=3; k-=320000; }if(t1==50){ t1=18; t3=8; k-=320000; }k1=k;$ declare read1 scroll cursor for select ll,rq into $rat,$dat1 from inter_rate where syh=$k1; if(sqlca.sqlcode!=0) { move(21,20); addstr("申请"); mess((short)9); printw("(%d), ",sqlca.sqlcode); mess((short)3); getch();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -