常用傳票摘要(設定)

wpe5C.jpg (43911 bytes)


原始程式

原始檔-起始
/*---------( FSACP002.C )-------傳票摘要建檔-------*/
#include    "W_FSAC.H"
#define      SX  3             /*左內框                             */
#define      SY  4             /*上內框                             */
#define      SC  76            /*內框寬, 多少行                     */

void Read1Page();
void Write1Page();
void Show1Page();
void Del1Page();
/*================================================================*/
FSACF002_T   ACF002;
char        *Table ="\
┌───────────┬────────────────────────┐\
│摘要編號:---          │摘要:---------------------------------          │\
└───────────┴────────────────────────┘";
/*===========================================================================*/
void main()
{  USetBXYN(Table,SX,SY,SC);
   UShowTable(3,4,78,6,Table,V_TABLE);  NamS=GET_NAME;
   Ugd_Open("Esc:目錄   F10:刪除摘要   PgUp,Dn:存入,前後頁");
   OPEN_ACF002;
   UDrawBox(1,3,80,24,V_BLUE,NO,NO,2);
   Ufk_ReadLast(ACF002K,ACF002.KEY);   Read1Page();
   while(1)
   {  if(Field==1) if(UReadS(BXN(1),ACF002.KEY,"NL",V_SHOW,V_READ)) Read1Page();
      if(Field==2) UReadS(   BXN(2),ACF002.RM,"C",V_SHOW,V_READ);
      switch(RetKey)
      {  case F10   : Del1Page();                                     break;
         case LEFT  :
         case UP    : if(--Field < 1) Field=2;                        break;
         case RIGHT :
         case DOWN  : if(++Field > 2) Field=1;                        break;
         case PGUP  : case PGDN: case C_PGUP: case C_PGDN:
                      L=atol(ACF002.KEY)+1;  Write1Page();
                      if(RetKey==ENTER) break;
                      if(Ufk_PgUD(ACF002K,ACF002.KEY)==OFF)
                          sprintf(ACF002.KEY,"%0*ld",3,L);
                      Read1Page(); Field=2;                          break;
         case ESC   : Write1Page();   Ufk_WriteLast(ACF002K);
                      if(RetKey==ENTER) break; else exit(0);          break;
      }
      if(Modify==ON) USetColor(SX,SY-1,6,V_MODIFY);
   }
}
/*===========================================================================*/
void Read1Page()
{
    if(Ufk_Read(ACF002K,&ACF002,NULL)==OFF)
    {   memset(&ACF002.KEY[0]+sizeof(ACF002.KEY),NULL,sizeof(ACF002)-sizeof(ACF002.KEY));
        UShowS(SX,SY-1,"(新增)",V_CREATE);
    }
    else UShowS(SX,SY-1,"(修改)",V_EDIT);
    Modify=OFF; OffSet=0; Show1Page();  /*讀入時一定要Modify=OFF*/
}
/*===========================================================================*/
void Write1Page()
{
    if(Modify==OFF) return;
    if(ACF002.KEY[0]==NULL){ UWait(ON,"無摘要編號 .Enter 修改"); Field=1; return; }
    Ufk_Write(ACF002K,&ACF002);
}
/*===========================================================================*/
void Show1Page()
{
    UShowSL(BXN(1),ACF002.KEY,V_SHOW);
    UShowSL(BXN(2),ACF002.RM,V_SHOW);
}
/*===========================================================================*/
void Del1Page()
{
    UWait(ON,"若 確 定 要 刪 除 本 筆 資 料 .請 再 按  F10");
    if(RetKey!=F10) return;
    Ufk_Del(ACF002K,&ACF002);
    if(Ufk_PgUD(ACF002K,ACF002.KEY)==OFF) memset(&ACF002,NULL,sizeof(ACF002));
    Read1Page();
}
原始檔-結束

Byron Wey  Oct.21.1998


回首頁C之城