現 金 往 來 表

wpe36.jpg (75959 bytes)

範圍選擇
wpe37.jpg (4976 bytes)

左右捲頁
wpe38.jpg (9947 bytes)

重新查詢
wpe39.jpg (9361 bytes)


原始程式

原始檔-起始
/*---------( FSACR066.C )---------*/
#include    "W_FSAC.H"
#define SX  20            /*左內框                             */
#define SY  10            /*上內框                             */
#define SC  32            /*內框寬, 多少行                     */
/*-----------------------------------------------------------------*/
#define PrHEAD  UPrint("#%I 年 %I 月份                                                                                   第 %I- 頁  ",Sday.Y,Sday.M,P0); \
                UPrint("============================================================================================================");                  \
                UPrint("傳票日期 科目號     科  目  名  稱           摘      要             收入金額    支出金額    結存金額  傳票號");                  \
                UPrint("-------- ------- -------------------- -------------------------- ----------- ----------- -----------  ------");
#define PrSTYLEO       "@M------ %S----- %S------------------ %S------------------------             %F,-------- %F,--------  %S----"
#define PrSTYLEI       "@M------ %S----- %S------------------ %S------------------------ %F,--------             %F,--------  %S----"
#define PrPASS  UPrint("                                                                           (上期結存) %F,-----------        ",Sum[2]);
#define PrSPILT
#define PrNULL
#define PrSUMUP
#define PrSUM
#define PrNEXT
#define PrEND   UPrint("============================================================================================================"); \
                UPrint("                                                          (合計) %F,-------- %F,--------",Sum[0],Sum[1]);
#define PrDATAO ACF011.YM,ACF011.AC,ACF001.ACN,ACF011.RM,ACF011.AMT,Sum[2],ACF011.KEY
#define PrDATAI ACF011.YM,ACF011.AC,ACF001.ACN,ACF011.RM,ACF011.AMT,Sum[2],ACF011.KEY
/*-----------------------------------------------------------------*/
void ShowLast();
void ShowHead();
void ShowData();
/*================================================================*/
FSACF001_T   ACF001;
FSACF011_T   ACF011;
double       Sum[10];
DATE         LastYM;
char        *Table="\
                                \
          現 金 往 來 帳        \
 ============================== \
   月份: -----                  \
                                \
 資料輸出裝置:--------         \
                                ";
/*===========================================================================*/
void main()
{  USetBXYN(Table,SX,SY,SC);
    OPEN_ACF001;   OPEN_ACF011;    NamS=GET_NAME;
    while(1)
    {
        #include <RPT1.H>
        if(Field==1) UReadM(BXN(1),&Sday,0,V_WUSR,V_READ);
        #include <RPT2.H>  /*條件設定完畢*/
       /*------------------------------------------------------------------*/
        if((Sa=ChkYM(Sday,ON))==0) continue;    Sm=Sday.Y*12+Sday.M;   /*Sa=1..24, Sm=年*12+月*/
        Ugd_Open("檔 案 處 理 中 請 稍 候 ....."); /* Sort  FSACF011 */
        Sp=Usp_Open();
        READ1(ACF011)
        {   if(p->YM.Y != Sday.Y || p->YM.M != Sday.M) continue;
            if(p->KI == '3' && strcmp(p->AC,"1101   ")) continue;  /*轉帳&非現金,3轉帳需為現金科目 */
            if(p->KI != '3' && strcmp(p->AC,"1101   ")==0){ continue;}/*非轉帳,此為補現金分錄,不用顯示*/
            USprint(BufS,"%M----%S----",p->YM,p->KEY);
            Usp_InsIp(Sp,BufS,L);
        }
        READ2
        Ugd_Close();
       /*------------------------------------------------------------------*/
        Ugd_Open("列印中           Ctr_F7:結束列印");
        LastYM.D=0;
        while(RetKey!=ESC)
        {   if(Usp_GetIp(Sp,&L)==OFF) break;
            lseek(ACF011K->ffd,L*sizeof(ACF011),SEEK_SET);
            read(ACF011K->ffd,&ACF011,sizeof(ACF011));
            ACF011.KEY[6]=NULL;
            if(K0==0){ K0=1; ShowHead(); LastYM.D=0; }
            ShowData();
            if(Psf=='S' && K0>=21){ UWait(OFF,"Esc:重新選擇      任一鍵繼續"); UCls(); K0=0; }
            if(Psf=='P' && K0>=K1){ fprintf(Stream,"%c",12); K0=0; }
        }
        ShowLast(); Usp_Close(Sp); LineReturn(ON);
    }
}
/*===========================================================================*/
void ShowHead()
{  FSACF001_T   F001;

#ifdef   HP-5L          /*1998/8/27*/
   LockItemHead(2,"~I",NamS,"~Z2W1L12G2X20");
#else
   LockItemHead(2,"~IZ2L12G2",NamS,"~Z1");
#endif
   PrHEAD                                      /*列印標頭*/
   if(P0==1)
   {  if(Ufk_Read(ACF001K,&F001,"1101   ")==OFF) memset(&F001,NULL,sizeof(F001));
      for(I=0; I<Sa; I++)
         Sum[2] += F001.AMT[0][I]-F001.AMT[1][I];
      PrPASS;              /*上期結存*/
   }
}
/*===========================================================================*/
void ShowData()
{
   if(Ufk_Read(ACF001K,&ACF001,ACF011.AC)==OFF) memset(&ACF001,NULL,sizeof(ACF001));
   if(UHowDate(LastYM) == UHowDate(ACF011.YM)) ACF011.YM.D=0;
   else LastYM = ACF011.YM;
   if((ACF011.KI!='3' && ACF011.DC=='D') || (ACF011.KI=='3' && ACF011.DC=='C'))
   {  Sum[1] += ACF011.AMT;   Sum[2] -= ACF011.AMT;
      PrSPILT;  UPrint(PrSTYLEO,PrDATAO);       /*支出,先印分隔線,再印一列資料*/
   }
   else
   {  Sum[0] += ACF011.AMT;   Sum[2] += ACF011.AMT;
      PrSPILT;  UPrint(PrSTYLEI,PrDATAI);       /*收入,先印分隔線,再印一列資料*/
   }
}
/*===========================================================================*/
void ShowLast()
{
   PrEND;                                         /*畫最底線*/
   memset(Sum,NULL,sizeof(Sum));
}
原始檔-結束

Byron Wey  Oct.21.1998


回首頁C之城