📄 settle.ec
字号:
n=1; break; } for(i=0;i<n;i++) { amound=0.0; amounc=0.0; voud=0; vouc=0; switch(l) { case 11: te1[0]=teu[i]; $ select sum(amount),count(*) into $balat,$ur from f_fix where sec_num=$se and (cur_type=$cu_type or cur_type=$c_type) and term=$te1 and status!="E" and status!="B"; break; case 12: te1[0]=0; $ select sum(amount),count(*) into $balat,$ur from f_demand where sec_num=$se and cur_type=$cu_type and status!="E" and status!="B"; break; } if(ur==0) balat=0.0; if(sqlca.sqlcode!=0) { move(20,20); printw("select错(%d), ",sqlca.sqlcode); getch(); } for(j=0;j<5;j++) { st1[0]=ss[j]; if(sav[0]==12) $ select sum(amount),count(*) into $amoun,$vou from f_blot where sec_num=$se and sav_type=$sav and status=$st1 and cur_type=$cu_type and cre_num>0; else $ select sum(amount),count(*) into $amoun,$vou from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and status=$st1 and cur_type=$cu_type and cre_num>0; if(sqlca.sqlcode!=0) { move(20,20); printw("select错(%d), ",sqlca.sqlcode); getch(); } if(vou==0)amoun=0.0; amounc+=amoun; vouc+=vou; } for(j=0;j<3;j++) { st1[0]=st[j]; if(sav[0]==12) $ select sum(amount),count(*) into $amoun,$vou from f_blot where sec_num=$se and sav_type=$sav and status=$st1 and cur_type=$cu_type and cre_num>0; else $ select sum(amount),count(*) into $amoun,$vou from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and status=$st1 and cur_type=$cu_type and cre_num>0; if(sqlca.sqlcode!=0) { move(20,20); printw("select错(%d), ",sqlca.sqlcode); getch(); } if(vou==0)amoun=0.0; amound+=amoun; voud+=vou; } if(sav[0]==12) { $ select count(*) into $uro from f_blot where sec_num=$se and sav_type=$sav and ( status="O"or status="R") and cur_type=$cu_type and cre_num>0; $ select count(*) into $urc from f_blot where sec_num=$se and sav_type=$sav and ( status="E"or status="P") and cur_type=$cu_type and cre_num>0; } else { $ select count(*) into $uro from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and ( status="O"or status="R") and cur_type=$cu_type and cre_num>0; $ select count(*) into $urc from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and ( status="E"or status="P") and cur_type=$cu_type and cre_num>0; } if(sav[0]==12) { $ select count(*) into $urh from f_blot where sec_num=$se and sav_type=$sav and status="H" and cur_type=$cu_type and cre_num>0; $ select count(*) into $uruh from f_blot where sec_num=$se and sav_type=$sav and status="L" and cur_type=$cu_type and cre_num>0; $ select count(*) into $urf from f_blot where sec_num=$se and sav_type=$sav and status="F" and cur_type=$cu_type and cre_num>0; $ select count(*) into $uruf from f_blot where sec_num=$se and sav_type=$sav and status="U" and cur_type=$cu_type and cre_num>0; } else { $ select count(*) into $urh from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and status="H" and cur_type=$cu_type and cre_num>0; $ select count(*) into $uruh from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and status="L" and cur_type=$cu_type and cre_num>0; $ select count(*) into $urf from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and status="F" and cur_type=$cu_type and cre_num>0; $ select count(*) into $uruf from f_blot where sec_num=$se and sav_type=$sav and term=$te1 and status="U" and cur_type=$cu_type and cre_num>0; } if(sav[0]==12) $ select yest_hang,yest_free,yest_chan into $y_urh,$y_urf,$y_ch from f_dai where sav_type=$sav and cur_type=$cu_type; else $ select yest_hang,yest_free,yest_chan into $y_urh,$y_urf,$y_ch from f_dai where sav_type=$sav and term=$te1 and cur_type=$cu_type; t_urh=y_urh+urh-uruh; t_urf=y_urf+urf-uruf; if(sav[0]==12) $ update f_dai set debi_amoun=$amound,cred_amoun=$amounc,today_bala=$balat, open_user=$uro,canc_user=$urc,today_user=$ur,debi_vouch=$voud, cred_vouch=$vouc,hang_up=$urh,lift_hang=$uruh,today_hang=$t_urh, freeze=$urf,unfreeze=$uruf,today_free=$t_urf where sav_type=$sav and cur_type=$cu_type; else $ update f_dai set debi_amoun=$amound,cred_amoun=$amounc,today_bala=$balat, open_user=$uro,canc_user=$urc,today_user=$ur,debi_vouch=$voud, cred_vouch=$vouc,hang_up=$urh,lift_hang=$uruh,today_hang=$t_urh, freeze=$urf,unfreeze=$uruf,today_free=$t_urf where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("3333333update错(%d), ",sqlca.sqlcode); getch(); p=1; } amoundx+=amound; amouncx+=amounc; balatx+=balat; voudx+=voud; voucx+=vouc; urx+=ur; urox+=uro; urcx+=urc; t_urhx+=t_urh; t_urfx+=t_urf; urhz+=urh; urfz+=urf; uruhz+=uruh; urufz+=uruf; } amoundz+=amoundx; amouncz+=amouncx; balatz+=balatx; voudz+=voudx; voucz+=voucx; urz+=urx; uroz+=urox; urcz+=urcx; t_urhz+=t_urhx; t_urfz+=t_urfx; if(sav[0]==12)continue; te1[0]=100; $ update f_dai set debi_amoun=$amoundx,cred_amoun=$amouncx,today_bala=$balatx, open_user=$urox,canc_user=$urcx,today_user=$urx,debi_vouch=$voudx, cred_vouch=$voucx,today_hang=$t_urhx,today_free=$t_urfx where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("4444444update错(%d), ",sqlca.sqlcode); getch(); p=1; } }te1[0]=100;sav[0]=100;$ update f_dai set debi_amoun=$amoundz,cred_amoun=$amouncz,today_bala=$balatz, open_user=$uroz,canc_user=$urcz,today_user=$urz,debi_vouch=$voudz, cred_vouch=$voucz,hang_up=$urhz,lift_hang=$uruhz,today_hang=$t_urhz, freeze=$urfz,unfreeze=$urufz,today_free=$t_urfz where sav_type=$sav and term=$te1 and cur_type=$cu_type;if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("update错(%d), ",sqlca.sqlcode); getch(); p=1; }}amoundx=amouncx=0.0;for(h=0;h<3;h++){ cu_type[0]=cu[h]; /*计算利息*/ te1[0]=1; d_intex=t_intex=0.0; for(l=11;l<13;l++) { sav[0]=101; $ select yest_bala into $y_inte from f_dai where sav_type=$sav and term=$te1 and cur_type=$cu_type; sav[0]=l; inte=0.0; $ select sum(interest),count(*) into $inte,$vou from f_blot where sec_num=$se and sav_type=$sav and ( status="E" or status="P" ) and cur_type=$cu_type and cre_num>0; if(vou==0)inte=0.0; t_inte=y_inte-inte; sav[0]=101; $ update f_dai set debi_amoun=$inte,today_bala=$t_inte where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("7777777update inte mx错(%d), ",sqlca.sqlcode); getch(); p=1; } d_intex+=inte; t_intex+=t_inte; te1[0]+=3; } sav[0]=101; te1[0]=100; $ update f_dai set debi_amoun=$d_intex,today_bala=$t_intex where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("update inte mx错(%d), ",sqlca.sqlcode); getch(); p=1; } /*统计买入外汇*/ sav[0]=102; te1[0]=100; $ select yest_bala into $y_balat from f_dai where sav_type=$sav and term=$te1 and cur_type=$cu_type; sav[0]=103; te1[0]=100; $ select yest_bala into $y_balax from f_dai where sav_type=$sav and term=$te1 and cur_type=$cu_type; $ select sum(amount),sum(balance),count(*) into $amounc,$amound,$vou from f_blot where sec_num=$se and cur_type=$cu_type and status="X" and cre_num>0; if(vou==0)amounc=amound=0.0; balat=y_balat+amounc; balatx=y_balax-amound; sav[0]=102; te1[0]=100; $ update f_dai set cred_amoun=$amounc,today_bala=$balat where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("8888888update waihui错(%d), ",sqlca.sqlcode); getch(); p=1; } sav[0]=103; te1[0]=100; $ update f_dai set debi_amoun=$amound,today_bala=$balatx where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("update waihui错(%d), ",sqlca.sqlcode); getch(); p=1; }te1[0]=100;sav[0]=100;$ select debi_amoun,cred_amoun,today_bala into $amoundx,$amouncx,$balatz from f_dai where sav_type=$sav and term=$te1 and cur_type=$cu_type;balatx=0-balatz-t_intex;amoundx+=d_intex;sav[0]=111;$ update f_dai set debi_amoun=$amouncx,cred_amoun=$amoundx,today_bala=$balatx where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("9999999update cash错(%d), ",sqlca.sqlcode); getch(); p=1; } /*统计总计*/ te1[0]=100; tef1[0]=102; tef2[0]=103; tef3[0]=11; sav[0]=120; amoundz=amouncz=balatz=0.0; uroz=urcz=urz=voudz=voucz=urhz=uruhz=t_urhz=urfz=urufz=t_urfz=0; $ declare blot1 scroll cursor for select 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 $amoundx,$amouncx,$balatx,$urox, $urcx,$urx,$voudx,$voucx,$urhx,$uruhx,$t_urhx,$urfx,$urufx,$t_urfx from f_dai where term=$te1 and sav_type!=$tef1 and sav_type!=$tef2 and sav_type!=$tef3 and cur_type=$cu_type and sav_type!=$sav; if(sqlca.sqlcode!=0) { move(20,20); printw("declare 错(%d), ",sqlca.sqlcode); getch(); p=1; } $ open blot1; while(sqlca.sqlcode==0) { $ fetch blot1; if(sqlca.sqlcode!=0)continue; amoundz+=amoundx; amouncz+=amouncx; if(balatx<0) continue; else balatz+=balatx; uroz+=urox; urcz+=urcx; urz+=urx; voudz+=voudx; voucz+=voucx; urhz+=urhx; uruhz+=uruhx; t_urhz+=t_urhx; urfz+=urfx; urufz+=urufx; t_urfz+=t_urfx; } te1[0]=100; sav[0]=120; $ close blot1;$ update f_dai set debi_amoun=$amoundz,cred_amoun=$amouncz,today_bala=$balatz, open_user=$uroz,canc_user=$urcz,today_user=$urz,debi_vouch=$voudz, cred_vouch=$voucz,hang_up=$urhz,lift_hang=$uruhz,today_hang=$t_urhz, freeze=$urfz,unfreeze=$urufz,today_free=$t_urfz where sav_type=$sav and term=$te1 and cur_type=$cu_type; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("update zongji错(%d), ",sqlca.sqlcode); getch(); p=1; } amoundx+=amound; amouncx+=balatx;}sav[0]=110;te1[0]=100;/*$ update f_dai set cred_amoun=$amoundx,today_bala=$amouncx where sav_type=$sav and term=$te1 and cur_type="R"; if(sqlca.sqlerrd[2]!=1) { move(20,20); printw("update RMB zongji错(%d), ",sqlca.sqlerrd[2]); getch(); p=1; }*/if(p==1) { $ rollback work; }else { $ commit work; }$ declare blot_r scroll cursor for select sav_type,yest_bala,debi_amoun, cred_amoun,today_bala into $sav,$y_balax,$amoundx,$amouncx,$balatx from r_dai; if(sqlca.sqlcode!=0) { move(20,20); printw("declare 错(%d), ",sqlca.sqlcode); getch(); }$ open blot_r;$ fetch blot_r;while(sqlca.sqlcode==0){ if(sav[0]==120) { $ fetch blot_r; continue; } if(fabs(y_balax+amouncx-amoundx-balatx)>0.005) { move(16,20); addspace(50); move(16,20); printw("人民币 不平 差额=%13.2f",y_balax+amouncx-amoundx-balatx); switch(sav[0]) { case 1: move(16,28); printw("定期"); break; case 2: move(16,28); printw("活期"); break; case 3: move(16,28); printw("零整"); break; case 6: move(16,28); printw("大额"); break; case 7: move(16,28); printw("通知"); break; case 100: move(16,28); printw("合计"); break; case 111: move(16,28); printw("现金"); break; } getch(); } $ fetch blot_r;}$ close blot_r;$ declare blot_f scroll cursor for select sav_type,cur_type,yest_bala, debi_amoun,cred_amoun,today_bala into $sav,$cu_type,$y_balax,$amoundx, $amouncx,$balatx from f_dai where cur_type="U" or cur_type="J" or cur_type="H"; if(sqlca.sqlcode!=0) { move(20,20); printw("declare 错(%d), ",sqlca.sqlcode); getch(); }$ open blot_f;$ fetch blot_f;while(sqlca.sqlcode==0){ if(sav[0]==120) { $ fetch blot_f; continue; } if(fabs(y_balax+amouncx-amoundx-balatx)>0.005) { move(16,20); addspace(50); move(16,20); printw(" 不平 差额=%13.2f",y_balax+amouncx-amoundx-balatx); switch(toupper(cu_type[0])) { case 'U': move(16,20); printw("美元"); break; case 'J': move(16,20); printw("日元"); break; case 'H': move(16,20); printw("港元"); break; } switch(sav[0]) { case 11: move(16,28); printw("定期"); break; case 12: move(16,28); printw("活期"); break; case 100: move(16,28); printw("合计"); break; case 111: move(16,28); printw("现金"); break; } getch(); } $ fetch blot_f;}$ close blot_f;$ close database;move(14,30);addspace(35);move(14,25);printw("统 计 完 成 , 按 任 意 键 返 回");refresh();getch();#include </u/ebcsav/include/end>#include </u/ebcsav/include/type_op>#include </u/ebcsav/include/edit_op>#include </u/ebcsav/include/addspace>#include </u/ebcsav/include/y_n>#include </u/ebcsav/include/readch>#include </u/ebcsav/include/readdv>#include </u/ebcsav/include/readst>#include </u/ebcsav/include/mess>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -