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

📄 work_init.ec

📁 这是一个使用 informix esql/c 技术开发的银行程序的部分代码。
💻 EC
字号:
/*   work_init   */#include </u/ebcsav/include/sav.h>$include sqlca;$include sqlda;void addspace();void mess();char y_n();#include </u/ebcsav/include/begin>struct operator opt;short i,j,l=2,flag=0,flag1=0,p=0;long d;char c;char s[7],st[21];$ short opt_num,cred_type,sum,t;$ long cred_num;$ char ope_num[2];$ double amound,amounc,t_bala;$ long uro,urc,t_ur,voud,vouc,urh,uruh,t_urh,urf,uruf,t_urf;$ char sav[2],te[2],cu_type[2];short n=-1;FILE *pf,*pf1;sum=0;t=-1;sav[1]='\0';cu_type[1]='\0';te[1]='\0';move(0,30);standout();printw("  初始化处理  ");standend();move(15,20);standout();printw("  是否确认要初始化(Y/N)?    ");standend();c=y_n('Y','Y','N');if(c=='N') return;move(20,20);printw("系统正在初始化,请等待 ...");refresh();$ database saving;$ begin work;$ declare read_cred scroll cursor for select * into $ope_num,   $cred_type,$cred_num from credential;if(sqlca.sqlcode!=0)  {    move(20,20);    addstr("申请");    mess(9);    printw("(%d), ",sqlca.sqlcode);    mess(3);    getch();    p=1;  }$ open read_cred;if(sqlca.sqlcode!=0)  {    move(20,20);    addstr("打开");    mess(9);    printw("(%d), ",sqlca.sqlcode);    mess(3);    getch();    p=1;  }while(1)  {    $ fetch read_cred;    if(sqlca.sqlcode!=0) flag1=1;    opt_num=ope_num[0];    ope_num[0]=n;    if(flag!=0&&(opt_num!=n||cred_type!=t||sqlca.sqlcode!=0))      {            $ update cred_count set cre_count=$sum where op_num=$ope_num and cre_type=$t;            if(sqlca.sqlerrd[2]!=1)             {               move(23,20);               addstr("关闭");               mess(9);               printw("(%d), ",sqlca.sqlerrd[2]);               mess(3);               getch();               p=1;             }            sum=0;      }    flag=1;    if(flag1==1)break;    if((cred_num/100000000)==0) sum++;    t=cred_type;    n=opt_num;  }$ close read_cred;if(sqlca.sqlcode!=0)  {    move(23,20);    addstr("关闭");    mess(9);    printw("(%d), ",sqlca.sqlcode);    mess(3);    getch();    p=1;  }$ delete from credential where cre_num>100000000;$ drop table  r_blot;$ drop table  f_blot;$ delete from open_acc;$ delete from subs_cred;$ delete from hang;$ delete from change_acc;    $ create table r_blot      (        blot_num serial(1),        op_num char(1),        sec_num char(1),        acc_num integer,        name char(8),        sav_type char(1),        cur_type char(1),        term char(1),        cre_num integer,        status char(1),        amount float,        balance float,        interest float      );    if(sqlca.sqlcode!=0)      {        printf("** 错误 %d :建立人民币流水帐表出错 **",          sqlca.sqlcode);        getch();        p=1;      }    $ create unique index r_blot_idx      on r_blot (blot_num);    if(sqlca.sqlcode!=0)      {        printf("** 错误 %d :建立人民币流水帐表索引出错 **",          sqlca.sqlcode);        getch();        p=1;      }    $ create table f_blot      (        blot_num serial(1),        op_num char(1),        sec_num char(1),        acc_num integer,        name char(8),        sav_type char(1),        cur_type char(1),        term char(1),        cre_num integer,        status char(1),        amount float,        balance float,        interest float      );    if(sqlca.sqlcode!=0)      {        printf("** 错误 %d :建立外币流水帐表出错 **",          sqlca.sqlcode);        getch();        p=1;      }    $ create unique index f_blot_idx      on f_blot (blot_num);    if(sqlca.sqlcode!=0)      {        printf("** 错误 %d :建立外币流水帐表索引出错 **",          sqlca.sqlcode);        getch();        p=1;      }$ declare blot scroll cursor for select sav_type,term,debi_amoun,cred_amoun,  today_bala,open_user,canc_user,today_user,debi_vouch,cred_vouch,hang_up,  lift_hang,today_hang,freeze,unfreeze,today_free into $sav,$te,$amound,  $amounc,$t_bala,$uro,$urc,$t_ur,$voud,$vouc,$urh,$uruh,$t_urh,$urf,$uruf,  $t_urf from r_dai;$ open blot;if(sqlca.sqlcode!=0)      {        printf("** 错误 %d :open r_blot error **",          sqlca.sqlcode);        getch();        p=1;      }while(sqlca.sqlcode==0){ $ fetch blot; if(sqlca.sqlcode!=0) break; if(t_bala<0.01&&amound<0.01&&amounc<0.01&&t_urh==0&&t_urf==0)continue; if(sav[0]==2||sav[0]==5||sav[0]==7) $ update r_month set debi_amoun=debi_amoun+$amound,        cred_amoun=cred_amoun+$amounc,today_bala=$t_bala,        open_user=open_user+$uro,canc_user=canc_user+$urc,        today_user=$t_ur,debi_vouch=debi_vouch+$voud,        cred_vouch=cred_vouch+$vouc,hang_up=hang_up+$urh,        lift_hang=lift_hang+$uruh,today_hang=$t_urh,        freeze=freeze+$urf,unfreeze=unfreeze+$uruf,        today_free=$t_urf where sav_type=$sav; else $ update r_month set debi_amoun=debi_amoun+$amound,        cred_amoun=cred_amoun+$amounc,today_bala=$t_bala,        open_user=open_user+$uro,canc_user=canc_user+$urc,        today_user=$t_ur,debi_vouch=debi_vouch+$voud,        cred_vouch=cred_vouch+$vouc,hang_up=hang_up+$urh,        lift_hang=lift_hang+$uruh,today_hang=$t_urh,        freeze=freeze+$urf,unfreeze=unfreeze+$uruf,        today_free=$t_urf where sav_type=$sav and term=$te; if(sqlca.sqlerrd[2]!=1)      {        printf("** 错误 %d :update r_month error **",          sqlca.sqlerrd[2]);        getch();        p=1;      } if(sav[0]==2||sav[0]==5||sav[0]==7) $ update r_dai set debi_amoun=0,cred_amoun=0,yest_bala=$t_bala,today_bala=0,        open_user=0,canc_user=0,yest_user=$t_ur,today_user=0,debi_vouch=0,        cred_vouch=0,hang_up=0,lift_hang=0,yest_hang=$t_urh,today_hang=0,        freeze=0,unfreeze=0,yest_free=$t_urf,today_free=0 where sav_type=$sav; else $ update r_dai set debi_amoun=0,cred_amoun=0,yest_bala=$t_bala,today_bala=0,        open_user=0,canc_user=0,yest_user=$t_ur,today_user=0,debi_vouch=0,        cred_vouch=0,hang_up=0,lift_hang=0,yest_hang=$t_urh,today_hang=0,        freeze=0,unfreeze=0,yest_free=$t_urf,today_free=0        where sav_type=$sav and term=$te; if(sqlca.sqlerrd[2]!=1)      {        printf("** 错误 %d :update r_dai error **",          sqlca.sqlerrd[2]);        getch();        p=1;      }}$ close blot;$ declare blot1 scroll cursor for select sav_type,cur_type,term,debi_amoun,  cred_amoun,  today_bala,open_user,canc_user,today_user,debi_vouch,cred_vouch,hang_up,  lift_hang,today_hang,freeze,unfreeze,today_free into $sav,$cu_type,$te,  $amound,  $amounc,$t_bala,$uro,$urc,$t_ur,$voud,$vouc,$urh,$uruh,$t_urh,$urf,$uruf,  $t_urf from f_dai;$ open blot1;if(sqlca.sqlcode!=0)      {        printf("** 错误 %d :open f_blot error **",          sqlca.sqlcode);        getch();        p=1;      }while(sqlca.sqlcode==0){ $ fetch blot1; if(sqlca.sqlcode!=0) break; if(t_bala<0.01&&amound<0.01&&amounc<0.01&&t_urh==0&&t_urf==0)continue; if(sav[0]==12) $ update f_month set debi_amoun=debi_amoun+$amound,        cred_amoun=cred_amoun+$amounc,today_bala=$t_bala,        open_user=open_user+$uro,canc_user=canc_user+$urc,        today_user=$t_ur,debi_vouch=debi_vouch+$voud,        cred_vouch=cred_vouch+$vouc,hang_up=hang_up+$urh,        lift_hang=lift_hang+$uruh,today_hang=$t_urh,        freeze=freeze+$urf,unfreeze=unfreeze+$uruf,        today_free=$t_urf where sav_type=$sav and cur_type=$cu_type; else $ update f_month set debi_amoun=debi_amoun+$amound,        cred_amoun=cred_amoun+$amounc,today_bala=$t_bala,        open_user=open_user+$uro,canc_user=canc_user+$urc,        today_user=$t_ur,debi_vouch=debi_vouch+$voud,        cred_vouch=cred_vouch+$vouc,hang_up=hang_up+$urh,        lift_hang=lift_hang+$uruh,today_hang=$t_urh,        freeze=freeze+$urf,unfreeze=unfreeze+$uruf,        today_free=$t_urf where sav_type=$sav and term=$te and         cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1)      {        printf("** 错误 %d :update f_month error **",          sqlca.sqlerrd[2]);        getch();        p=1;      } if(sav[0]==12) $ update f_dai set debi_amoun=0,cred_amoun=0,yest_bala=$t_bala,today_bala=0,        open_user=0,canc_user=0,yest_user=$t_ur,today_user=0,debi_vouch=0,        cred_vouch=0,hang_up=0,lift_hang=0,yest_hang=$t_urh,today_hang=0,        freeze=0,unfreeze=0,yest_free=$t_urf,today_free=0 where sav_type=$sav        and cur_type=$cu_type; else $ update f_dai set debi_amoun=0,cred_amoun=0,yest_bala=$t_bala,today_bala=0,        open_user=0,canc_user=0,yest_user=$t_ur,today_user=0,debi_vouch=0,        cred_vouch=0,hang_up=0,lift_hang=0,yest_hang=$t_urh,today_hang=0,        freeze=0,unfreeze=0,yest_free=$t_urf,today_free=0        where sav_type=$sav and term=$te and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1)      {        printf("** 错误 %d :update f_dai error **",          sqlca.sqlerrd[2]);        getch();        p=1;      }}$ close blot1;if(p==1)  {    $ rollback work;  }else  {    $ commit work;    pf=fopen("/u/ebcsav/data/init_date.dat","w");    d=year*10000+month*100+day;    fwrite(&d,4,1,pf);    fclose(pf);    move(20,20);    addspace(40);    move(20,20);    addstr("初始化已完成,任意键返回");    getch();  }$close database;#include </u/ebcsav/include/end>#include </u/ebcsav/include/mess>#include </u/ebcsav/include/addspace>#include </u/ebcsav/include/y_n>

⌨️ 快捷键说明

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