·| p ¬ì ¥Ø «Ø ÀÉ
¬ì¥Ø¬d¸ß |
¾lÃB¬d¸ß |
¬ì¥Ø°Ñ¦Ò |
ì©lµ{¦¡
ì©lÀɡа_©l /*---------( FSACP001.C )--------*/ #include "W_FSAC.H" #define SX 1 /*¥ª¤º®Ø */ #define SY 3 /*¤W¤º®Ø */ #define SC 80 /*¤º®Ø¼e, ¦h¤Ö¦æ */ void Field06(); void Show1Page(); char *ChainDc(); void Read1Page(); void Write1Page(); void Del1Page(); void BuitF001Ndx(); void RestHelp(); void F001Help(); /*================================================================*/ FSACF001_T ACF001,F001A,F001B; int Sw=OFF; char *Table ="\ ùÝùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùß\ ùø ¬ì¥Ø½s¸¹:------- ¦WºÙ:-------------------- ɶU§O:---- ùø\ ùò¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢s¢s¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢wùô\ ùø ¦~/¤ë ɤèª÷ÃB ¶U¤èª÷ÃB¢x¢x ¦~/¤ë ɤèª÷ÃB ¶U¤èª÷ÃBùø\ ùø ----- -------------- --------------¢x¢x ----- -------------- --------------ùø\ ùø µ²Âà -------------- --------------¢x¢x ùø\ ùø ¢x¢x ùø\ ùãùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùíùíùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùå"; void main() { USetBXYN(Table,SX,SY,SC); NamS=GET_NAME; UShowTable(1,3,80,9,Table,V_TABLE); for(I=1; I<=12; I++) { UShowSL(1,I+9,80,&Table[6*80],V_TABLE); sprintf(BufS,"%02d.%02d",SysY,I); UShowSL(BX[4],I+9,BN[4],BufS,V_TABLE); sprintf(BufS,"%02d.%02d",SysY+1,I); UShowSL(BX[7],I+9,BN[7],BufS,V_TABLE); } UShowSL(1,22,80,&Table[7*80],V_TABLE); Ugd_Open("F3:§ï¾lÃB F4:¬d¬ì¥Ø F5:¬d¾lÃB F6:¬ì¥Ø°Ñ¦Òªí F8:«Ø¯Á¤Þ F10:§R°£ PgDn:¦s¤J"); OPEN_ACF001; fpNDX=fopen(NDXDISK,"r+b"); if(fpNDX==NULL) BuitF001Ndx(); ACF001Tx(); Ufk_ReadLast(ACF001K,ACF001.KEY); Read1Page(); while(1) { switch(Field) { case 1: if(UReadS(BXN( 1),ACF001.KEY,"NL",V_SHOW,V_READ)) Read1Page(); break; case 2: UReadS(BXN( 2),ACF001.ACN,"C0",V_SHOW,V_READ); break; case 3: UReadTog(BXN( 3),&ACF001.DC,V_TOG,"DC","É","¶U"); UShowSL(BXN(3),ChainDc(),V_SHOW); break; case 4: UReadD(BXN(10),&ACF001.AMT[0][0],",",V_SHOW,V_READ); break; case 5: UReadD(BXN(11),&ACF001.AMT[1][0],",",V_SHOW,V_READ); break; default: Field06(); break; } switch(RetKey) { case F3 : Sw=ON; break; case F4 : if(Utx_Pick(Tx,ACF001.KEY,0,0,0," ¬ì ¥Ø ¬d ¸ß ",V_SHOW)) Read1Page(); break; case F5 : RestHelp(); break; case F6 : F001Help(); break; case F8 : fclose(fpNDX); BuitF001Ndx(); break; case F10 : Del1Page(); break; case LEFT : case UP : if(--Field<1) Field=53; break; case RIGHT : case DOWN : if(++Field>53) Field=1; break; case PGUP : case PGDN: case C_PGUP: case C_PGDN: Write1Page(); if(RetKey==ENTER) break; Ufk_PgUD(ACF001K,ACF001.KEY); Read1Page(); Field=1; break; case ESC : Write1Page(); Ufk_WriteLast(ACF001K); if(RetKey==ENTER) break; else exit(0); break; } if(Modify==ON) USetColor(SX,SY-1,6,V_MODIFY); } } /*===========================================================================*/ void Field06() { int x,y,r,a,fi=Field-6; if(Sw==OFF) return; r=fi%2; a=fi/2+1; if(fi<=23) { if(r==0) x=BX[5]; else x=BX[6]; y=10+fi/2; } else { if(r==0) x=BX[8]; else x=BX[9]; y=fi/2-2; } UReadD(x,y,14,&ACF001.AMT[r][a],",",V_SHOW,V_READ); } /*===========================================================================*/ void Show1Page() { double Dsum,Csum; UShowSL(BXN( 1),ACF001.KEY,V_SHOW); UShowSL(BXN( 2),ACF001.ACN,V_SHOW); UShowSL(BXN( 3),ChainDc(),V_SHOW); UShowD( BXN(10),ACF001.AMT[0][0],",",V_SHOW); UShowD( BXN(11),ACF001.AMT[1][0],",",V_SHOW); for(I=1; I<=12; I++) { UShowD(BX[5],I+9,BN[5],ACF001.AMT[0][I],",",V_SHOW); UShowD(BX[6],I+9,BN[6],ACF001.AMT[1][I],",",V_SHOW); } for(I=13; I<=24; I++) { UShowD(BX[8],I-3,BN[8],ACF001.AMT[0][I],",",V_SHOW); UShowD(BX[9],I-3,BN[9],ACF001.AMT[1][I],",",V_SHOW); } } /*===========================================================================*/ char *ChainDc() { switch(ACF001.DC) { case 'D': return " É "; case 'C': return " ¶U "; default : return " "; } } /*===========================================================================*/ void Read1Page() { if(Ufk_Read(ACF001K,&ACF001,NULL)==OFF) { memset(&ACF001.KEY[0]+sizeof(ACF001.KEY),NULL,sizeof(ACF001)-sizeof(ACF001.KEY)); UShowS(SX,SY-1,"(·s¼W)",V_CREATE); } else UShowS(SX,SY-1,"(קï)",V_EDIT); if(ACF001.KEY[0]<=SPACE) UClsField(21,4,8,V_SHOW); else if(ACF001.KEY[0]<='3' || ACF001.KEY[0]=='Z') UShowS(21,4,"(¹ê¬ì¥Ø)",V_SHOW); else UShowS(21,4,"(µê¬ì¥Ø)",V_SHOW); memcpy(&F001A,&ACF001,sizeof(ACF001)); /* update Á`¬ì¥Ø¥Î */ Sw=Modify=OFF; OffSet=0; Show1Page(); /*Ū¤J®É¤@©wnModify=OFF*/ } /*===========================================================================*/ void Write1Page() { if(Modify==OFF) return; if(ACF001.KEY[0]==NULL){ UWait(ON,"µL¬ì¥Ø½s¸¹ ¡DEnter קï"); Field=1; return; } if((L=Ufk_Write(ACF001K,&ACF001)) >= 0L) { sprintf(BufS,"%-7s %-s",ACF001.KEY,ACF001.ACN); fseek(fpNDX,L*NDXL,SEEK_SET); fwrite(BufS,NDXL,1,fpNDX); Utx_Del(Tx,BufS); Utx_Ins(Tx,BufS); } if(F001A.KEY[4]>SPACE) /* 쥻°O¿ý¸ê®Æ */ { memset(&F001A.KEY[4],SPACE,3); F001A.KEY[7]=NULL; if(Ufk_Read(ACF001K,&F001B,F001A.KEY)==OFF) UFatal("¦¹©ú²Ó¬ì¥Ø¨S¦³Á`¬ì¥Ø"); for(I=0;I<25;I++) { F001B.AMT[0][I]-=F001A.AMT[0][I]; F001B.AMT[0][I]+=ACF001.AMT[0][I]; F001B.AMT[1][I]-=F001A.AMT[1][I]; F001B.AMT[1][I]+=ACF001.AMT[1][I]; } Ufk_Write(ACF001K,&F001B); } } /*===========================================================================*/ void Del1Page() { double Amt[2]; UWait(ON,"Y ½T ©w n §R °£ ¥» µ§ ¸ê ®Æ ¡D½Ð ¦A «ö F10"); if(RetKey!=F10) return; Amt[0]=ACF001.AMT[0][0]; Amt[1]=ACF001.AMT[1][0]; /*µ²Âàª÷ÃB*/ if(Ufk_Del(ACF001K,&ACF001)==ON) { fseek(fpNDX,ACF001K->kip*NDXL,SEEK_SET); /*1997/3/8*/ fputc(NULL,fpNDX); Utx_Del(Tx,ACF001.KEY); if(ACF001.KEY[4]>SPACE) /*Y¬°Á`±b¬ì¥Ø«hbreak*/ { memset(&ACF001.KEY[4],SPACE,3); /*±N©ú²Ó§ï¬°Á`±b*/ if(Ufk_Read(ACF001K,&ACF001,ACF001.KEY)==ON) { ACF001.AMT[0][0] -= Amt[0]; ACF001.AMT[1][0] -= Amt[1]; Ufk_Write(ACF001K,&ACF001); } } } if(Ufk_PgUD(ACF001K,ACF001.KEY)==OFF) memset(&ACF001,NULL,sizeof(ACF001)); Read1Page(); } /*===========================================================================*/ void BuitF001Ndx() { FSACF001_T F001; Ugd_Open("« «Ø ¯Á ¤Þ ÀÉ ¤¤, ½Ð µy «J....."); lseek(ACF001K->ffd,0L,SEEK_SET); fclose(fpNDX); fpNDX=fopen(NDXDISK,"w+b"); while(1) { if(read(ACF001K->ffd,&F001,sizeof(F001)) < 1) break; sprintf(BufS,"%-7s %-s",F001.KEY,F001.ACN); fwrite(BufS,NDXL,1,fpNDX); } HasRead=OFF; ACF001Tx(); /*OFF,¤~¯à««Ø¯Á¤Þ*/ Ugd_Close(); } /*===========================================================================*/ void RestHelp() { double amt,sum=0f,t; char s[12]; int j,yy=SysY,mm,A=0,B=1; TEXT *tx; tx=Utx_Open(11,4,76,23,40,8,OFF); UGetS(64,4,15,BufS); Utx_AddHead(tx,"%S----- %S------------------ %S----------------- ",ACF001.KEY,ACF001.ACN,BufS); Utx_AddHead(tx,"--------------------------------------------------------------"); Utx_AddHead(tx,"¦~/¤ë ·í¤ëÉ¤è ·í¤ë¶U¤è ·í¤ë¾lÃB ²Öp¾lÃB"); Utx_AddHead(tx,"===== ============= ============= ============= =============="); if(ACF001.DC=='C'){ A=1; B=0; } for(mm=I=0; I<25; I++,mm++) { if(I==13) { yy++; mm=1; if(ACF001.KEY[0]>='4' && ACF001.KEY[0]<='8') sum=0f; /*µê¬ì¥Ø²ÖpÂk0*/ Utx_Add(tx,"¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w"); } amt=ACF001.AMT[A][I]-ACF001.AMT[B][I]; sum+=amt; if(ACF001.AMT[0][I]==0f && ACF001.AMT[1][I]==0f) t=0f; else t=sum; if (mm==0) strcpy(s," µ²Âà"); else sprintf(s,"%02d.%02d",yy,mm); Utx_Add(tx,"%S--- %f,---------- %f,---------- %f,---------- %f,-----------",s,ACF001.AMT[0][I],ACF001.AMT[1][I],amt,t); if(mm!=0 && mm%4==0 && mm!=12) Utx_Add(tx,"--------------------------------------------------------------"); } Utx_View(tx," ¾l ÃB ¬d ¸ß "); Utx_Close(tx); } /*===========================================================================*/ void F001Help() { static TEXT *AcnTx; static int HasRead=OFF; /*ÀRºA¥u¦³¦¹¨ç¦¡¤º¥i°Ñ¦Ò*/ if(HasRead==OFF) AcnTx=Utx_SetMemo(33,4,76,23,80,"AC-CREAT"); if(Utx_Pick(AcnTx,TmpS,0,0,0," ¬ì¥Ø°Ñ¦Òªí ",V_SHOW)==OFF) return; Write1Page(); HasRead=ON; TmpS[7]=NULL; if(Ufk_Search(ACF001K,TmpS)) { memcpy(ACF001.KEY,TmpS,7); /*¤w¦s¦b,Ū¦³ªº*/ Read1Page(); } else { memset(&ACF001,NULL,sizeof(ACF001)); memcpy(ACF001.KEY,TmpS,7); /*¤£¦s¦b,«þ¨©¬ì¥Ø,¤Î¦WºÙ*/ memcpy(ACF001.ACN,&TmpS[8],20); if(memcmp("É",&TmpS[37],2)==0) ACF001.DC='D'; else if(memcmp("¶U",&TmpS[37],2)==0) ACF001.DC='C'; Show1Page(); Field=2; UShowS(SX,SY-1,"(·s¼W)",V_CREATE); } } ì©lÀɡе²§ô
Byron Wey¡@¡@Oct.21.1998