應付票據(簽收單)

wpe2B.jpg (60649 bytes)

範圍選擇
wpe2C.jpg (4975 bytes)


原始程式

原始檔-起始
/*---------( FSACRC72.C )--------*/
#include    "W_FSAC.H"
#define SX  20            /*左內框                             */
#define SY  10            /*上內框                             */
#define SC  34            /*內框寬, 多少行                     */

#define      CNO    2
#define      RNO    7

void ShowData();
void ShowLast();
/*================================================================*/
FSACF001_T   ACF001;
FSACF011_T   ACF011;
unchar       Buf[CNO][RNO][6][32];
double       Sum;
int          Count;
int          Cnow,Rnow;
char        *Table="\
                                  \
          應付票據(簽收單)        \
 ================================ \
 傳票日期: -------- 到: --------  \
                                  \
 資料輸出裝置:--------           \
                                  ";
/*===========================================================================*/
void main()
{   USetBXYN(Table,SX,SY,SC);
    OPEN_ACF001;  OPEN_ACF011;
    ACF001Tx();   NamS=GET_NAME;
    while(1)
    {
        #include <RPT1.H>
        if(Field==1) UReadM(BXN(1),&Sday,0,V_WUSR,V_READ);
        if(Field==2) UReadM(BXN(2),&Eday,0,V_WUSR,V_READ);
        #include <RPT2.H>  /*條件設定完畢*/
       /*------------------------------------------------------------------*/
        if((Sa=ChkYM(Sday,ON))==0) continue;    Sm=Sday.Y*12+Sday.M;
        Ugd_Open("檔 案 處 理 中 請 稍 候 .....");
        Sp=Usp_Open();
        READ1(ACF011)
        {   if(memcmp(p->AC,"2141",4)!=0) continue;
            if(p->DC=='D') continue;
            if(UMidDate(Sday,p->YM,Eday)==OFF) continue;
/*          if(p->AC[4]<=SPACE) continue;   */
            USprint(BufS,"%S-%S-----",&p->RM[8],p->RM);
            Usp_InsIp(Sp,BufS,L);
        }
        READ2
        Ugd_Close();
       /*------------------------------------------------------------------*/
        Ugd_Open("列印中           Ctr_F7:結束列印");
        while(RetKey!=ESC)
        {   if(Usp_GetIp(Sp,&L)==OFF) break;
            lseek(ACF011K->ffd,L*sizeof(ACF011),SEEK_SET);
            read(ACF011K->ffd,&ACF011,sizeof(ACF011));
            Utx_GetS(Tx,Skey,ACF011.AC,8);
            USprint(BufS,"1102%S-",&ACF011.RM[8]);
            Utx_GetS(Tx,Ekey,BufS,8);
            USprint(Buf[Cnow][Rnow][0],"科目: %S------------------ ",Skey);
            USprint(Buf[Cnow][Rnow][1],"摘要: %S-------------------",&ACF011.RM[12]);
            USprint(Buf[Cnow][Rnow][2],"金額: %F,$<-------         ",ACF011.AMT);
            USprint(Buf[Cnow][Rnow][3],"帳號: %S------------------ ",Ekey);
            USprint(Buf[Cnow][Rnow][4],"支票: %S-----   傳票:%S----",ACF011.RM,ACF011.KEY);
            Sum+=ACF011.AMT;  Count++;
            if(++Rnow>=RNO)
            {   Rnow=0;
                if(++Cnow>=CNO) ShowData();
            }
        }
        if(Buf[0][0][0][0]>SPACE) ShowData();
        Usp_Close(Sp); LineReturn(OFF);
    }
}
/*===========================================================================*/
void ShowHead()
{
#ifdef   HP-5L          /*1998/8/27*/
      LockItemHead(0,"~I",NamS,"~Z2W1G2L12X16");
#else
      LockItemHead(0,"~IZ2G2L12X1","","~Z1");
#endif
      sprintf(TmpS,"%02d.%02d",Sday.Y,Sday.M);
      UPrint("#傳票自:%M------ 至:%M------                                                                                           ",Sday,Eday);   if(Psf=='V')
      UPrint("  ------------------------------------------------------       ------------------------------------------------------  ");
}
/*===========================================================================*/
void ShowData()
{  int    j;

      UPrint("┌──────────────┬────────────┐   ┌──────────────┬────────────┐");
   for(I=0; I<RNO; I++)
   {  if(Buf[0][I][0][0]<=SPACE) continue;
      if(I!=0)
      UPrint("├──────────────┼────────────┤   ├──────────────┼────────────┤");
      UPrint("│%S------------------------- │                        │   │%S--------------------------│                        │",Buf[0][I][0],Buf[1][I][0]);
      UPrint("│%S------------------------- │                        │   │%S--------------------------│                        │",Buf[0][I][1],Buf[1][I][1]);
      if(Psf=='P')
      {
#ifdef   HP-5L          /*1998/8/27*/
         UPrint("~Z3;│~W2X10;%S----------------~W1X12;  ~X16; │                        │   │~W2X10;%S----------------~W1X12;  ~X16; │                        │~Z2",Buf[0][I][2],Buf[1][I][2]);
#else
         UPrint("~Z2X12;│%S----------------│~X1;                        │~X12;  │%S----------------│~X1;                        │~Z1;",Buf[0][I][2],Buf[1][I][2]);
#endif
      }
      else UPrint("│%S----------------          │                        │   │%S----------------          │                        │",Buf[0][I][2],Buf[1][I][2]);
      UPrint("│%S------------------------- │                        │   │%S--------------------------│                        │",Buf[0][I][3],Buf[1][I][3]);
      UPrint("│%S------------------------- │                        │   │%S--------------------------│                        │",Buf[0][I][4],Buf[1][I][4]);
   }
      UPrint("└──────────────┴────────────┘   └──────────────┴────────────┘");
   Cnow=Rnow=0;
   if(Buf[1][RNO-1][0][0]==NULL) ShowLast();
   if(Psf=='P'){ fprintf(Stream,"%c",12); K0=0; }
   memset(Buf,NULL,sizeof(Buf));
}
/*===========================================================================*/
void ShowLast()
{
    K0=1; UPrint("  ");
    UPrint("  合計: %f,-----------           共 %I-- 張   ",Sum,Count);
    Sum=0f; Count=0;
}
原始檔-結束

Byron Wey  Oct.21.1998


回首頁C之城