📄 hand_fix2.ec
字号:
/* fix_open */#include </u/ebcsav/include/sav.h>$include sqlca;$include sqlda;void addspace();void addspacef();double get_rate();void mess();char y_n();char readdv();char readst();char readch();long ac_num();void prt_inum();void prt_dnum();void prtf_inum();void prtf_dnum();void prtf_upper();short num_time();#include </u/ebcsav/include/begin>short n=1,flag,ti,year1,month1;double x,sum3=0.0,sum6=0.0,sum12=0.0,sum24=0.0,sum36=0.0,sum60=0.0;long k,count3=0,count6=0,count12=0,count24=0,count36=0,count60=0;unsigned char c;char st[30];FILE *pf,*pf1;short od1,od2,od3,id1,id2,id3,t;char c1,c2,c3;$ char s_num[2],nam[9],ter[2],cu_type[2],addres[25],statu[2],s_type[2];$ long a_num,pas,cr_num,ope_date,int_date,las_date,b_num;$ double amoun,interes,maint_v;$ short cred_type;$ long cred_num;$ char ope_num[2];move(0,25);$ database saving;printw("整 存 整 取 储 蓄 移 植");s_num[0]=op.num&0x7f;s_num[1]='\0';nam[0]='\0';s_type[1]='\0';cu_type[0]=((op.type&1)==1)?'R':'U';cu_type[0]='R';cu_type[1]='\0';ter[0]='1';ter[1]='\0';amoun=0.0;addres[0]='\0';statu[1]='\0';pas=0;maint_v=0.0;pf=fopen("/u/ebcsav/tmp/fix_acc.txt","r");pf1=fopen("/u/ebcsav/tmp/fix_add.txt","r");$ begin work;flag=0;while(1) { move(23,16); standout(); mess((short)1); standend(); amoun=0.0; move(3,10); addstr("帐 号: "); move(4,10); addstr("姓 名: "); move(5,10); addstr("密 码: "); move(6,10); addstr("币 种: "); move(6,48); addstr("人民币"); move(7,10); addstr("期 限: "); move(8,10); addstr("金 额: "); move(9,10); addstr("地 址: "); move(10,10); addstr("凭 证 号: "); move(11,10); addstr("开户日期: "); move(12,10); addstr("起息日期: "); move(13,10); addstr("利 率: ");/* move(13,10); addstr("是否自动转存(Y/N)? ");*/ fscanf(pf,"%*2s%7ld%*c%c%*c%c%*c%c%*c%2hd%*c%2hd%*c%2hd%*c%2hd%*c%2hd%*c%2hd%*8s%2hd%*4s%12lf%*10s%8s%*4s%ld%*s\n", &a_num,&c1,&c2,&c3,&od1,&od2,&od3,&id1,&id2,&id3,&t,&amoun,nam,&pas); if(feof(pf)) { move(20,20); addspace(40); move(20,20); addstr("移植完成! "); mess((short)3); getch(); break; } if(c1=='C')continue; c3='Y'; while(1) { fscanf(pf1,"%c%*3s%7ld%*3s%7ld%22s\n",&c2,&k,&cr_num,addres); /*if(a_num==1900982) { move(15,30); printw("k=%d ",k); getch(); }*//* if(a_num>537) { printw("\n---%c %d %d",c2,k,cr_num); getch(); }*/ if(feof(pf1)) { move(20,20); addspace(40); move(20,20); printw("凭证号错! (帐号: %d)",a_num); mess((short)3); c3='N'; getch(); break; } if(c2=='F'&&k==a_num) break; } if(c3=='N') break; if(c1=='C'||c1=='K') continue; else if(c1=='L') statu[0]='H'; else if(c1=='F') statu[0]='F'; else if(c1=='A') statu[0]='A'; else { move(20,20); addspace(40); move(20,20); printw("标志错! (帐号: %d)",a_num); mess((short)4); getch(); continue; } if(t==1) { ter[0]=3; count3++; sum3+=amoun; } else if(t==2) { ter[0]=6; count6++; sum6+=amoun; } else if(t==3) { ter[0]=12; count12++; sum12+=amoun; } else if(t==4) { ter[0]=24; count24++; sum24+=amoun; } else if(t==5) { ter[0]=36; count36++; sum36+=amoun; } else if(t==7) { ter[0]=60; count60++; sum60+=amoun; } else { move(20,20); addspace(40); move(20,20); printw("存期错! (帐号: %d)",a_num); mess((short)4); getch(); continue; } ope_date=19000000+od1*10000+od2*100+od3; int_date=19000000+id1*10000+id2*100+id3; move(3,48); prt_inum((long)s_num[0],2); addstr("-"); prt_inum(a_num,9); move(4,48); printw("%-8s",nam); move(5,48); printw("%7d",pas); move(7,48); if(ter[0]<12) printw("%1d个月 ",ter[0]); else printw("%1d年 ",ter[0]/12); move(8,48); prt_dnum(amoun,13); move(9,48); printw("%-24s",addres); move(10,48); prt_inum(cr_num,7); move(11,48); printw("%4d年%2d月%2d日",ope_date/10000,ope_date%10000/100,ope_date%100); move(12,48); printw("%4d年%2d月%2d日",int_date/10000,int_date%10000/100,int_date%100); cred_type=1; k=(toupper(cu_type[0])-64)*10000+cred_type*100+ter[0]; interes=get_rate(k,int_date); move(13,48); printw("%10.6f",interes); las_date=year*10000+month*100+day; refresh(); ope_num[0]=op_num; ope_num[1]='\0'; s_type[0]=cred_type; cred_num=cr_num; move(20,20); move(20,20); $ insert into r_fix values ($s_num,$a_num,$nam,$pas,$cu_type,$ter,$amoun, $addres,$cr_num,$ope_date,$int_date,$statu, $las_date,$interes,$maint_v); if(sqlca.sqlcode!=0) { addstr("写"); mess((short)14); printw("(%d), ",sqlca.sqlcode); flag=1; } move(2,0); clrtobot(); block(1,0,22,80); } if(flag==0) { $ commit work; } else { $ rollback work; }fclose(pf);fclose(pf1);move(2,0);clrtobot();block(1,0,22,80);move(5,20);printw("三月期 %4d户 总额: %16.2f",count3,sum3);move(7,20);printw("半年期 %4d户 总额: %16.2f",count6,sum6);move(9,20);printw("一年期 %4d户 总额: %16.2f",count12,sum12);move(11,20);printw("二年期 %4d户 总额: %16.2f",count24,sum24);move(13,20);printw("三年期 %4d户 总额: %16.2f",count36,sum36);move(15,20);printw("五年期 %4d户 总额: %16.2f",count60,sum60);getch();$ close database;#include </u/ebcsav/include/end>double get_rate(k,dat)long k,dat;{$double rat;$long k1,dat1;double ll2;int dat2;long tz[16]={15,30,60,90,120,150,180,210,240,270,300,330,360,720,1080,0};short year,month,day;long i,yy,mm,mm1,dd,t1,ts,m1,m2,m3,yer,da2;num_date(&year,&month,&day);yy=dat/10000;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; }if(t1==1807){ if(ts<15)k=180200; else { i=0; do{ i++; }while(ts>=tz[i]&&i<15); k=t1*100+i; } }k1=k;$ declare read3 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(); return; } $ open read3; if(sqlca.sqlcode !=0) { printw("** %d 错误 1: 打开利率表出错 **",sqlca.sqlcode); getch(); return; }$fetch first read3;dat2=0;do{ if(dat1<=dat&&dat1>=dat2) { dat2=dat1; ll2=rat; } $fetch next read3; }while(sqlca.sqlcode!=SQLNOTFOUND);$close read3;return(ll2);}#include </u/ebcsav/include/mess>#include </u/ebcsav/include/addspace>#include </u/ebcsav/include/addspacef>#include </u/ebcsav/include/y_n>#include </u/ebcsav/include/prt_inum>#include </u/ebcsav/include/prt_dnum>#include </u/ebcsav/include/prtf_inum>#include </u/ebcsav/include/prtf_dnum>#include </u/ebcsav/include/prtf_upper>#include </u/ebcsav/include/num_time>#include </u/ebcsav/include/readch>#include </u/ebcsav/include/readdv>#include </u/ebcsav/include/readst>#include </u/ebcsav/include/ac_num>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -