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

📄 change_lar.ec

📁 这是一个使用 informix esql/c 技术开发的银行程序的部分代码。
💻 EC
字号:
/*   change_large   */#include </u/ebcsav/include/sav.h>$include sqlca;$include sqlda;void addspace();void addspacef();void mess();char y_n();char readdv();char readch();char readst();void prt_inum();void prt_dnum();void prtf_inum();void prtf_dnum();void prtf_inte();double get_rate();void delay();short num_time();#include </u/ebcsav/include/begin>long k,key_num,key=4691813,key_date=99971231;short cred_type,i,j,flag,n,ti;double x;unsigned char c;char key_str[13];char ss[11];char stn[7];FILE *pf;$ char s_num[2],nam[9],ter[2],ter1[2],cu_type[2],  addres[25],statu[2],s_type[2],ope_num[2];$ long a_num,pas,cr_num,ope_date,ope_date1,int_date,int_date1,  las_date,las_date1,b_num;$ double amoun,amoun1,interes,maint_v;move(0,26);printw("大 额 储 蓄 帐 户 重 要 修 改");s_num[1]='\0';ope_num[0]=op_num;ope_num[1]='\0';s_type[1]='\0';ter1[1]='\0';pf=fopen("/u/ebcsav/data/sav_sect.dat","r");fseek(pf,(op.num&0x7f)*34-10,0);fread(ss,10,1,pf);fclose(pf);ss[10]='\0';for(i=0;i<7;i++)  if(op.name[i]!='\0')stn[i]=op.name[i]^0xff;  else stn[i]='\0';move(2,0);clrtobot();block(1,0,22,80);if(year*10000+month*100+day>key_date)  {    move(10,20);    addstr("修改程序超过使用期限, ");    mess((short)3);    getch();    endwin();    return;  }move(3,6);addstr("密码:                     ");readst(key_str,12);k=key_num=j=0;for(i=2;i<=11;i++)  {    n=key_str[i]-97;    k+=n;    j=n-j;    key_num=key_num*10+j;  }i=k/26+97;j=(k%26)+97;ti=num_time();key_num+=(key+(year%100)*1000000+month*10000+day*100+ti/100);if((op.num&0x80)!=0) s_num[0]=op.num&0x7f;else  {    move(5,6);    addstr("营业所编号( 按 0 返回):  ");    readdv(&x,2);    s_num[0]=x;    if(s_num[0]==0)      {        endwin();        return;      }  }move(5,6);addstr("营业所编号:               ");prt_inum((long)s_num[0],2);cred_type=6;move(9,6);addstr("帐号( 按 0 返回 ):  ");readdv(&x,9);a_num=x;if(a_num==0)  {    endwin();    return;  }move(9,6);addstr("帐号:                     ");prt_inum(a_num,9);key_num+=a_num;move(11,6);addstr("修改项目(0-返回,1-存期,2-金额,3-开户日,4-起息日,5-最后日: ");readdv(&x,1);n=x;if(n==0)  {    endwin();    return;  }ti=num_time();if((key_num+s_num[0]*10000+cred_type*100+n)!=2100000000||  i!=key_str[0]||j!=key_str[1])  {    move(20,20);    addstr("密码错, ");    mess((short)3);    getch();    endwin();    return;  }$ database saving;$ select * into $s_num,$a_num,$nam,$pas,$cu_type,$ter,$amoun,$addres,  $cr_num,$ope_date,$int_date,$statu,$las_date,$interes,$maint_v   from l_fix where sec_num=$s_num and acc_num=$a_num;if(sqlca.sqlcode!=0)  {    move(20,27);    mess((short)29);    mess((short)3);    getch();    $ close database;    endwin();    return;  }ter1[0]=ter[0];amoun1=amoun;ope_date1=ope_date;int_date1=int_date;las_date1=las_date;move(2,0);clrtobot();block(1,0,22,80);move(3,10);addstr("帐    号: ");move(3,48);prt_inum((long)s_num[0],2);addstr("-");prt_inum(a_num,9);move(4,10);addstr("姓    名: ");move(4,48);addstr(nam);move(5,10);addstr("币    种: ");move(5,48);switch(toupper(cu_type[0]))  {    case 'C':      addstr("加拿大元");      break;    case 'F':      addstr("法国法郎");      break;    case 'H':      addstr("港元    ");      break;    case 'J':      addstr("日元    ");      break;    case 'M':      addstr("德国马克");      break;    case 'P':      addstr("英镑    ");      break;    case 'R':      addstr("人民币  ");      break;    case 'U':      addstr("美元    ");  }move(6,10);addstr("期    限: ");move(6,48);if(ter[0]<12) printw("%2d个月",ter[0]);else printw("%2d年",ter[0]/12);move(7,10);addstr("金    额: ");move(7,48);prt_dnum(amoun,16);move(8,10);addstr("地    址: ");move(8,48);addstr(addres);move(9,10);addstr("凭 证 号: ");move(9,48);prt_inum(cr_num,7);move(10,10);addstr("开户日期: ");move(10,48);printw("%4d年%2d月%2d日",ope_date/10000,(ope_date%10000)/100,ope_date%100);move(11,10);addstr("起息日期: ");move(11,48);printw("%4d年%2d月%2d日",int_date/10000,(int_date%10000)/100,int_date%100);move(12,10);addstr("最后日期: ");move(12,48);printw("%4d年%2d月%2d日",las_date/10000,(las_date%10000)/100,las_date%100);switch(n)  {    case 1:      flag=0;      while(flag==0)        {          move(17,2);          addstr("请选择: A-一个月  C-三个月  F-六个月  I-九个月  1-一年");          move(6,20);          c=readch();          if(isprint(c)) ter1[0]=toupper(c);          move(6,48);          switch(ter1[0])            {              case 'A':              case 'C':              case 'F':              case 'I':                printw("%1d个月    ",ter1[0]-64);                flag=1;                break;              case '1':                printw("%1d年    ",ter1[0]-48);                flag=1;            }        }      move(17,2);      addspace(76);      ter1[0]=(ter1[0]>64)?(ter1[0]-64):(ter1[0]-48)*12;      break;    case 2:      move(7,20);      readdv(&x,11);      amoun1=x;      move(7,20);      addspace(11);      move(7,48);      prt_dnum(amoun1,16);      break;    case 3:      move(10,20);      readdv(&x,8);      ope_date1=x;      move(10,20);      addspace(8);      move(10,48);      printw("%4d年%2d月%2d日",ope_date1/10000,(ope_date1%10000)/100,        ope_date1%100);      break;    case 4:      move(11,20);      readdv(&x,8);      int_date1=x;      move(11,20);      addspace(8);      move(11,48);      printw("%4d年%2d月%2d日",int_date1/10000,(int_date1%10000)/100,        int_date1%100);      break;    case 5:      move(12,20);      readdv(&x,8);      las_date1=x;      move(12,20);      addspace(8);      move(12,48);      printw("%4d年%2d月%2d日",las_date1/10000,(las_date1%10000)/100,        las_date1%100);  }move(20,33);mess((short)33);c=y_n('Y','N','N');move(20,20);addspace(60);if(c=='Y')  {    k=(toupper(cu_type[0])-64)*10000+cred_type*100+ter1[0];    interes=get_rate(k,int_date1);    flag=0;    $ begin work;    $ update l_fix      set term=$ter1,amount=$amoun1,      open_date=$ope_date1,inte_date=$int_date1,last_date=$las_date1,      interest=$interes      where sec_num=$s_num and acc_num=$a_num;    move(20,33);    if(sqlca.sqlerrd[2]!=1)      {        addstr("写");        mess((short)14);        printw("(%d), ",sqlca.sqlerrd[2]);        flag=1;      }    if(flag==0)      {        s_type[0]=cred_type;        for(i=0;i<5;i++)          {            $ insert into r_blot              values              (0,$ope_num,$s_num,$a_num,$nam,$s_type,              $cu_type,$ter,$cr_num,"E",$amoun,0.0,0.0);            if(sqlca.sqlcode!=-271) break;            printw("*");            refresh();            delay(5l);          }        if(sqlca.sqlcode==-271)          {            mess((short)73);            flag=1;          }        else if(sqlca.sqlcode!=0)          {            addstr("写");            mess(16);            printw("(%d), ",sqlca.sqlcode);            flag=1;          }      }    if(flag==0)      {        for(i=0;i<5;i++)          {            $ insert into r_blot              values              (0,$ope_num,$s_num,$a_num,$nam,$s_type,              $cu_type,$ter1,$cr_num,"O",$amoun1,$amoun1,0.0);            if(sqlca.sqlcode!=-271) break;            printw("*");            refresh();            delay(5l);          }        if(sqlca.sqlcode==-271)          {            mess((short)73);            flag=1;          }        else if(sqlca.sqlcode!=0)          {            addstr("写");            mess(16);            printw("(%d), ",sqlca.sqlcode);            flag=1;          }      }    if(flag==0)      {        move(20,20);        addspace(50);        move(20,20);        mess((short)42);        mess((short)4);        getch();        printf("%c[5i%c%c9%c%c%c]%cq\n\n",27,27,'%',1,20,27,28);        addspacef(38);        printf("大额储蓄帐户重要修改通知单\n");        addspacef(38);        printf("==========================\n");        addspacef(14);        printf("%-10s",ss);        addspacef(40);        printf("%4d年%2d月%2d日 %2d时%2d分\n",year,month,day,ti/100,ti%100);        printf("          ─────────────────────────────────────────\n");        addspacef(14);        printf("帐号: ");        prtf_inum((long)s_num[0],2);        printf("-");        prtf_inum(a_num,9);        addspacef(14);        printf("户名: %-8s",nam);        addspacef(12);        printf("凭证号: ");        prtf_inum(cr_num,7);        printf("\n");        addspacef(14);        printf("币种: ");        switch(cu_type[0])          {            case 'C':              printf("加拿大元");              break;            case 'F':              printf("法国法郎");              break;            case 'H':              printf("港元    ");              break;            case 'J':              printf("日元    ");              break;            case 'M':              printf("德国马克");              break;            case 'P':              printf("英镑    ");              break;            case 'R':              printf("人民币  ");              break;            case 'U':              printf("美元    ");          }        addspacef(12);        printf("期限: ");        if(ter[0]<12) printf("%2d个月",ter[0]);        else printf("%2d年",ter[0]/12);        printf("\n\n\n");        addspacef(14);        switch(n)          {            case 1:              printf("原存期:    ");              if(ter[0]<12) printf("%2d个月",ter[0]);              else printf("%2d年",ter[0]/12);              addspacef(10);              printf("改为: ");              if(ter1[0]<12) printf("%2d个月\n",ter[0]);              else printf("%2d年\n",ter1[0]/12);              break;            case 2:              printf("原金额:    ");              prtf_dnum(amoun,13);              addspacef(10);              printf("改为: ");              prtf_dnum(amoun1,13);              printf("\n");              break;            case 3:              printf("原开户日期:");              printf("%4d年%2d月%2d日",ope_date/10000,(ope_date%10000)/100,                ope_date%100);              addspacef(10);              printf("改为: ");              printf("%4d年%2d月%2d日\n",ope_date1/10000,(ope_date1%10000)/100,                ope_date1%100);              break;            case 4:              printf("原起息日期:");              printf("%4d年%2d月%2d日",int_date/10000,(int_date%10000)/100,                int_date%100);              addspacef(10);              printf("改为: ");              printf("%4d年%2d月%2d日\n",int_date1/10000,(int_date1%10000)/100,                int_date1%100);              break;            case 5:              printf("原最后日期:");              printf("%4d年%2d月%2d日",las_date/10000,(las_date%10000)/100,                las_date%100);              addspacef(10);              printf("改为: ");              printf("%4d年%2d月%2d日\n",las_date1/10000,(las_date1%10000)/100,                las_date1%100);          }        printf("          ─────────────────────────────────────────\n");        printf("              负责人:              复核人:            经办人:            操作员:%s\n",stn);        printf("%c%c[4i",12,27);        move(23,20);        addspace(50);        move(23,20);        addstr("修改操作已完成, ");      }    if(flag==0)      {        $ commit work;      }    else      {        $ rollback work;      }    mess((short)3);    getch();  }$ close database;endwin();#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/readdv>#include </u/ebcsav/include/readch>#include </u/ebcsav/include/readst>#include </u/ebcsav/include/num_time>#include </u/ebcsav/include/delay>

⌨️ 快捷键说明

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