⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yearinit.sql

📁 这是用PB6开发的一个POS管理系统
💻 SQL
📖 第 1 页 / 共 5 页
字号:
    ReceiveDate        TDATE                 not null
        default getdate(),
    AuditDate          TDATE                 null    
        default getdate(),
    InputDept          TDEPT                 not null,
    Operator           TSTAFF                null    ,
    ReceiptNo          TINVOICE              null    ,
    Employee           TSTAFF                null    ,
    AuditFlag          char(1)               not null
        default '0',
    AuditOperator      TSTAFF                null    ,
    BusinessFlag       char(1)               not null,
    Remark             TMEMO                 null    ,
    constraint PK_ADJUST primary key (AdjustNo)
)
go

/* ============================================================ */
/*   Index: index_of_adjust_inputdate                           */
/* ============================================================ */
create index index_of_adjust_inputdate on Adjust (InputDate)
go

/* ============================================================ */
/*   Index: index_of_adjust_operator                            */
/* ============================================================ */
create index index_of_adjust_operator on Adjust (Operator)
go

/* ============================================================ */
/*   Table: AdjustDetail                                        */
/* ============================================================ */
create table AdjustDetail
(
    ID                 INT IDENTITY          not null,
    AdjustNo           TRECEIPT              not null,
    GoodsNo            TGOODS                not null,
    DeptNO             TDEPT                 null    ,
    StartDate          TDATE                 null    ,
    EndDate            TDATE                 null    ,
    ORetailPrice       TPRICE                null    ,
    NRetailPrice       TPRICE                null    ,
    OMemberPrice       TPRICE                null    ,
    NMemberPrice       TPRICE                null    ,
    OSpecialFlag       char(1)               null    ,
    NSpecialFlag       char(1)               null    ,
    AllDepart          char(1)               null    ,
    constraint PK_TJLSMX primary key (ID)
)
go

/* ============================================================ */
/*   Index: index_of_adjustdetail_goodsno                       */
/* ============================================================ */
create index index_of_adjustdetail_goodsno on AdjustDetail (GoodsNo)
go

/* ============================================================ */
/*   Index: index_of_adjustdetail_adjustno                      */
/* ============================================================ */
create index index_of_adjustdetail_adjustno on AdjustDetail (AdjustNo)
go

/* ============================================================ */
/*   Index: index_of_adjustdetail_startdate                     */
/* ============================================================ */
create index index_of_adjustdetail_startdate on AdjustDetail (StartDate)
go

/* ============================================================ */
/*   Table: Tally                                               */
/* ============================================================ */
create table Tally
(
    DeptNo             TDEPT                 not null,
    TallyDate          TDATE                 null    ,
    BusinessDate       TDATE                 not null,
    Staff              TSTAFF                null    ,
    Flag               CHAR(1)               null    
)
go

/* ============================================================ */
/*   Table: DeptRetail                                          */
/* ============================================================ */
create table DeptRetail
(
    DeptNo             TDEPT                 not null,
    RetailDate         TDATE                 not null,
    GoodsNo            TGOODS                not null,
    Qty                TQTY                  null    ,
    Amt                TAMT                  null    ,
    DisAmt             TAMT                  null    ,
    CostAmt            TAMT                  null    ,
    constraint PK_DEPTRETAIL primary key (DeptNo, RetailDate, GoodsNo)
)
go

/* ============================================================ */
/*   Table: CheckLog                                            */
/* ============================================================ */
create table CheckLog
(
    DeptNo             TDEPT                 not null,
    GroupNo            TGROUP                not null,
    StartDate          TDATE                 not null
        default getdate(),
    EndDate            TDATE                 null    ,
    CheckWay           char(1)               not null,
    constraint PK_CHECKLOG primary key (DeptNo, GroupNo, StartDate)
)
go

/* ============================================================ */
/*   Table: DeptStock                                           */
/* ============================================================ */
create table DeptStock
(
    year               int                   not null,
    Month              int                   not null,
    GoodsNo            TGOODS                not null,
    DeptNO             TDEPT                 not null,
    RetailPrice        TPRICE                null    ,
    InitQty            TQTY                  null    ,
    InitRetailPrice    TPRICE                null    ,
    InitCostPrice      TPRICE                null    ,
    InitCostAmt        TAMT                  null    ,
    LastCostPrice      TPRICE                null    ,
    CurQty             TQTY                  null    ,
    CurCostPrice       TAMT                  null    ,
    CurCostAmt         TAMT                  null    ,
    ImportQty          TQTY                  null    ,
    ImportAmt          TAMT                  null    ,
    ImportRetailAmt    TAMT                  null    ,
    AllocInQty         TQTY                  null    ,
    AllocInAmt         TAMT                  null    ,
    AllocInRetailAmt   TAMT                  null    ,
    AllocOutQty        TQTY                  null    ,
    AllocOutAmt        TAMT                  null    ,
    AllocOutRetailAmt  TAMT                  null    ,
    AllocOutCost       TAMT                  null    ,
    RetailQty          TQTY                  null    ,
    RetailAmt          TAMT                  null    ,
    RetailCost         TAMT                  null    ,
    RetailDisAmt       TAMT                  null    ,
    AdjustAmt          TAMT                  null    ,
    AdjustCost         TAMT                  null    ,
    SaleQty            TQTY                  null    ,
    SaleAmt            TAMT                  null    ,
    SaleCost           TAMT                  null    ,
    SaleDisAmt         TAMT                  null    ,
    LossQty            TQTY                  null    ,
    LossAmt            TAMT                  null    ,
    LossRetailAmt      TAMT                  null    ,
    CheckQty           TQTY                  null    ,
    CheckAmt           TAMT                  null    ,
    CheckRetailAmt     TAMT                  null    ,
    ModifyDate         TDate                 not null
        default getdate(),
    constraint PK_DEPTSTOCK primary key (year, Month, GoodsNo, DeptNO)
)
go

/* ============================================================ */
/*   Table: TotalStock                                          */
/* ============================================================ */
create table TotalStock
(
    Year               Int                   not null,
    Month              Int                   not null,
    GoodsNo            TGOODS                not null,
    RetailPrice        TPRICE                null    ,
    InitQty            TQTY                  null    ,
    InitRetailPrice    TPRICE                null    ,
    InitCostPrice      TPRICE                null    ,
    InitCostAmt        TAMT                  null    ,
    LastCostPrice      TPRICE                null    ,
    CurQty             TQTY                  null    ,
    CurCostPrice       TAMT                  null    ,
    CurCostAmt         TAMT                  null    ,
    ImportQty          TQTY                  null    ,
    ImportAmt          TAMT                  null    ,
    ImportRetailAmt    TAMT                  null    ,
    AllocInQty         TQTY                  null    ,
    AllocInAmt         TAMT                  null    ,
    AllocInRetailAmt   TAMT                  null    ,
    AllocOutQty        TQTY                  null    ,
    AllocOutAmt        TAMT                  null    ,
    AllocOutRetailAmt  TAMT                  null    ,
    AllocOutCost       TAMT                  null    ,
    RetailQty          TQTY                  null    ,
    RetailAmt          TAMT                  null    ,
    RetailCost         TAMT                  null    ,
    RetailDisAmt       TAMT                  null    ,
    AdjustAmt          TAMT                  null    ,
    AdjustCost         TAMT                  null    ,
    SaleQty            TQTY                  null    ,
    SaleAmt            TAMT                  null    ,
    SaleCost           TAMT                  null    ,
    SaleDisAmt         TAMT                  null    ,
    LossQty            TQTY                  null    ,
    LossAmt            TAMT                  null    ,
    LossRetailAmt      TAMT                  null    ,
    CheckQty           TQTY                  null    ,
    CheckAmt           TAMT                  null    ,
    CheckRetailAmt     TAMT                  null    ,
    constraint PK_TOTALSTOCK primary key (Year, Month, GoodsNo)
)
go

/* ============================================================ */
/*   Table: checksBackup                                        */
/* ============================================================ */
create table checksBackup
(
    EndDate            TDATE                 not null,
    DeptNo             TDEPT                 not null,
    GoodsNo            TGOODS                not null,
    AcctQty            TQTY                  null    ,
    RealQty            TQTY                  null    ,
    AcctAmt            TAMT                  null    ,
    RealAmt            TAMT                  null    ,
    RetailPrice        TAMT                  null    ,
    Operator           TSTAFF                null    
        default '00000',
    CostPrice          TPrice                null    ,
    constraint PK_verify primary key (EndDate, DeptNo, GoodsNo)
)
go

/* ============================================================ */
/*   Table: DayReport                                           */
/* ============================================================ */
create table DayReport
(
    DeptNo             TDEPT                 not null,
    GroupNo            TGROUP                not null,
    BusinessDate       CHAR(8)               not null,
    InitAmt            TAMT                  null    ,
    NinitAmt           TAMT                  null    ,
    InitRetailAmt      TAMT                  null    ,
    CurAmt             TAMT                  null    ,
    NCurAmt            TAMT                  null    ,
    CurRetailAmt       TAMT                  null    ,
    RetailAmt          TAMT                  null    ,
    RetailCost         TAMT                  null    ,
    NRetailCost        TAMT                  null    ,
    RetailDisAmt       TAMT                  null    ,
    ImportAmt          TAMT                  null    ,
    NimportAmt         TAMT                  null    ,
    ImportRetailAmt    TAMT                  null    ,
    SaleAmt            TAMT                  null    ,
    SaleCost           TAMT                  null    ,
    NSaleCost          TAMT                  null    ,
    SaleDisAmt         TAMT                  null    ,
    SaleRetailAmt      TAMT                  null    ,
    AllocInAmt         TAMT                  null    ,
    NAllocInAmt        TAMT                  null,
    AllocInRetailAmt   TAMT                  null    ,
    AllocoutAmt        TAMT                  null    ,
    AllocOutCost       TAMT                  null    ,
    NAllocOutCost      TAMT                  null    ,
    AllocOutRetailAmt  TAMT                  null    ,
    LossAmt            TAMT                  null    ,
    NLossAmt           TAMT                  null    ,
    LossRetailAmt      TAMT                  null    ,
    CheckAmt           TAMT                  null    ,
    NCheckAmt          TAMT                  null    ,
    CheckRetailAmt     TAMT                  null    ,
    AdjustAmt          TAMT                  null    ,
    AdjustCost         TAMT                  null    ,
    NAdjustCost        TAMT                  null    ,
    constraint PK_DAYREPORT primary key (DeptNo, GroupNo, BusinessDate)
)
go

/* ============================================================ */
/*   Table: Retail                                              */
/* ============================================================ */
create table Retail
(
    GoodsNo            TGOODS                not null,
    DeptNo             TDEPT                 not null,
    Saleman            TSTAFF                null    ,
    Casher             TSTAFF                null    ,
    POSNO              CHAR(4)               null    ,
    InvoiceNO          TInvoice              null    ,
    ReceiptNo          CHAR(12)              not null,
    BusinessFlag       CHAR(1)               not null,
    PayMode            TPAYMODE              null    ,
    CustNo             VARCHAR(16)           null    ,
    Qty                TQTY                  not null,
    Amt                TAMT                  not null,
    Discount           TDISCOUNT             null    ,
    RetailPrice        TPRICE                null    ,
    CostPrice          TPRICE                null    ,
    DisAmt             TAMT                  null    ,
    InputDate          TDATE                 null    
        default getdate(),
    BatchNo            TBATCH                null    ,
    ID                 INT IDENTITY          not null,
    UD1                VARCHAR(5)            null    ,
    UD2                VARCHAR(5)            null    ,
    UD3                TUDF                  null    ,
    UD4                TUDF                  null    ,
    constraint PK_RETAIL primary key (ID)
)
go

/* ============================================================ */
/*   Index: index_of_spdm2                                      */
/* ============================================================ */
create index index_of_spdm2 on Retail (GoodsNo)
go

/* ============================================================ */
/*   Index: index_of_casher2                                    */
/* ============================================================ */
create index index_of_casher2 on Retail (Casher)
go

/* ============================================================ */
/*   Index: index_of_saleman2                                   */
/* ============================================================ */
create index index_of_saleman2 on Retail (Saleman)
go

/* ============================================================ */
/*   Index: index_of_inputdate2                                 */
/* ============================================================ */
create index index_of_inputdate2 on Retail (InputDate)
go

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -