餘 額 累 計 表
範圍選擇 |
科目查詢 |
重新查詢 |
原始程式
原始檔-起始 /*---------( FSACR064.C )-------*/ #include "W_FSAC.H" #define SX 20 /*左內框 */ #define SY 10 /*上內框 */ #define SC 36 /*內框寬, 多少行 */ void ShowLast(); void ShowHead(); void ShowData(); /*================================================================*/ FSACF001_T ACF001; double Dsum,Csum,Rest; char *Table="\ \ 會計科目餘額累計表 \ ================================== \ 月份: ----- \ 科目: 自 ---- -------------------- \ 至 ---- -------------------- \ \ 資料輸出裝置:-------- \ "; /*===========================================================================*/ void main() { USetBXYN(Table,SX,SY,SC); OPEN_ACF001; GetSysY(); while(1) { #define USER_GD Ugd_Open("F4:科目查詢 F7:開始列印 Ctr_F7:結束列印"); #include <RPT1.H> if(Field==1) UReadM(BXN(1),&Sday,0,V_WUSR,V_READ); if(Field==2){ UReadS(BXN(2),BufS,"NL",V_WUSR,V_READ); sprintf(Skey,"%s ",BufS); if(Ufk_Read(ACF001K,&ACF001,Skey)==OFF) UClsField(BXN(3),V_WUSR); else UShowSL(BXN(3),ACF001.ACN,V_WUSR); } if(Field==3){ UReadS(BXN(4),BufS,"NL",V_WUSR,V_READ); sprintf(Ekey,"%s ",BufS); if(Ufk_Read(ACF001K,&ACF001,Ekey)==OFF) UClsField(BXN(5),V_WUSR); else UShowSL(BXN(5),ACF001.ACN,V_WUSR); } if(RetKey==F4){ ACF001Tx(); Utx_View(Tx," 科 目 查 詢 "); } #include <RPT2.H> /*條件設定完畢*/ /*------------------------------------------------------------------*/ if((Sa=ChkYM(Sday,ON))==0) continue; Sm=Sday.Y*12+Sday.M; Ugd_Open("列印中 Ctr_F7:結束列印"); lseek(ACF001K->kfd,0L,SEEK_SET); while(RetKey!=ESC && RetKey) { if(Ufk_SeqRead(ACF001K,&ACF001,Skey,Ekey) != ON) continue; if(ACF001.KEY[0]=='Z') continue; ShowData(); if(Psf=='S' && K0>=22){ UWait(OFF,"Esc:重新選擇 任一鍵繼續"); UCls(); K0=0; } if(Psf=='P' && K0>=55){ fprintf(Stream,"%c",12); K0=0; } } ShowLast(); LineReturn(ON); } } /*===========================================================================*/ void ShowHead() { #ifdef HP-5L /*1998/8/27*/ LockItemHead(0,"~I",NamS,"~Z2L8G2X10"); #else LockItemHead(0,"~IZ2L8G2",NamS,"~Z1"); #endif UPrint("#%I年%I月 列印:%M------ 第 %I 頁 ",Sday.Y,Sday.M,Day,P0); UPrint("=========================================================================="); UPrint("科目號 科 目 名 稱 本月借方合計 本月貸方合計 D/C 累計餘額"); UPrint("------- -------------------- ------------- ------------- --- -------------"); } /*===========================================================================*/ void ShowData() { double d=0,c=0; for(I=0; I<=Sa; I++) { d+=ACF001.AMT[0][I]; c+=ACF001.AMT[1][I]; } (d >= c) ? (strcpy(TmpS,"借")) : (strcpy(TmpS,"貸")); if(d==c) return; UPrint("@S----- %S------------------ %F,---------- %F,---------- %S %F,----------",ACF001.KEY,ACF001.ACN,d,c,TmpS,fabs(d-c)); if(ACF001.KEY[4]<=SPACE) return; Dsum+=d; Csum+=c; } /*===========================================================================*/ void ShowLast() { (Dsum >= Csum) ? (strcpy(TmpS,"借")) : (strcpy(TmpS,"貸")); UPrint("=========================================================================="); UPrint(" (不含總分類帳) %F,----------- %F,---------- %S %F,----------",Dsum,Csum,TmpS,fabs(Dsum-Csum)); Dsum=Csum=0; } 原始檔-結束
Byron Wey Oct.21.1998