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

📄 yearinit.sql

📁 这是用PB6开发的一个POS管理系统
💻 SQL
📖 第 1 页 / 共 5 页
字号:
           where  id = object_id('AllocDetail')
            and   type = 'U')
   drop table AllocDetail
go

if exists (select 1
            from  sysobjects
           where  id = object_id('Alloc')
            and   type = 'U')
   drop table Alloc
go

if exists (select 1
            from  sysobjects
           where  id = object_id('ImportDetail')
            and   type = 'U')
   drop table ImportDetail
go

if exists (select 1
            from  sysobjects
           where  id = object_id('Import')
            and   type = 'U')
   drop table Import
go

/* ============================================================ */
/*   Table: Import                                              */
/* ============================================================ */
create table Import
(
    ImportNo           TRECEIPT              not null,
    OrderNo            TRECEIPT              null    ,
    InputDate          TDATE                 null    
        default GETDATE(),
    AuditDate          TDATE                 null    
        default getdate(),
    DeptNO             TDEPT                 null    ,
    InputDept          TDEPT                 not null,
    Employee           TSTAFF                null    ,
    VendorNo           TVENDOR               null    ,
    InvoiceNo          TINVOICE              null    ,
    InvoiceDate        TDATE                 null    ,
    NTaxAmt            TAMT                  null    ,
    Amt                TAMT                  null    ,
    PayMode            TPAYMODE              null    ,
    Operator           TSTAFF                null    ,
    AuditFlag          char(1)               not null
        default '0',
    AuditOperator      TSTAFF                null    ,
    ReceiveDate        TDATE                 not null
        default getdate(),
    BusinessFlag       char(1)               not null,
    ReceiptFlag        char(1)               not null,
    Remark             TMEMO                 null    ,
    constraint PK_IMPORT primary key (ImportNo)
)
go

/* ============================================================ */
/*   Table: ImportDetail                                        */
/* ============================================================ */
create table ImportDetail
(
    ImportNo           TRECEIPT              null    ,
    GoodsNo            TGOODS                not null,
    Qty                TQTY                  not null,
    AuditQty           TQTY                  null    ,
    NTaxPrice          TPRICE                not null,
    TaxPrice           TPRICE                not null,
    RetailPrice        TPRICE                null    ,
    Amt                TAMT                  not null,
    NTaxAmt            TAMT                  not null,
    ValidDate          TDATE                 null    ,
    OrgImportNo        TRECEIPT              null    ,
    BatchNo            TBATCH                null    ,
    UD1                TUDF                  null    ,
    UD2                TUDF                  null    ,
    ID                 INT IDENTITY          not null,
    constraint PK_IMPORTDETAIL primary key (ID)
)
go

/* ============================================================ */
/*   Table: Alloc                                               */
/* ============================================================ */
create table Alloc
(
    AllocNo            TRECEIPT              not null,
    InputDate          TDATE                 null    
        default GETDATE(),
    AllocDate          TDATE                 null    ,
    AuditDate          TDATE                 null    
        default getdate(),
    ReceiptNo          TINVOICE              null    ,
    Operator           TSTAFF                null    ,
    Employee           TSTAFF                null    ,
    DestDept           TDEPT                 null    ,
    SrcDept            TDEPT                 not null,
    InputDept          TDEPT                 not null,
    Cost               TAMT                  null    ,
    NTaxAmt            TAMT                  not null,
    Amt                TAMT                  null    ,
    AuditFlag          char(1)               not null
        default '0',
    AuditOperator      TSTAFF                null    ,
    ReceiveDate        TDATE                 not null
        default getdate(),
    BusinessFlag       Char(1)               not null,
    ReceiptFlag        char(1)               not null
        default '0',
    Remark             TMEMO                 null    ,
    constraint PK_ALLOC primary key (AllocNo)
)
go

/* ============================================================ */
/*   Index: index_of_alloc_date                                 */
/* ============================================================ */
create index index_of_alloc_date on Alloc (InputDate)
go

/* ============================================================ */
/*   Index: index_of_alloc_operator                             */
/* ============================================================ */
create index index_of_alloc_operator on Alloc (Operator)
go

/* ============================================================ */
/*   Index: index_of_alloc_destdept                             */
/* ============================================================ */
create index index_of_alloc_destdept on Alloc (DestDept)
go

/* ============================================================ */
/*   Table: AllocDetail                                         */
/* ============================================================ */
create table AllocDetail
(
    AllocNo            TRECEIPT              not null,
    GoodsNo            TGOODS                null    ,
    Qty                TQTY                  not null,
    AuditQty           TQTY                  null    ,
    CostPrice          TPRICE                null    ,
    Price              TPRICE                not null,
    NTaxPrice          TPRICE                not null,
    RetailPrice        TPRICE                null    ,
    Amt                TAMT                  not null,
    NTaxAmt            TAMT                  not null,
    ValidDate          TDATE                 null    ,
    VendorNo           TVENDOR               null    ,
    OrgAllocNo         TRECEIPT              null    ,
    BatchNo            TBATCH                null    ,
    ReqNo              TRECEIPT              null    ,
    ID                 INT IDENTITY          not null,
    constraint PK_ALLOCDETAIL primary key (ID)
)
go

/* ============================================================ */
/*   Index: index_of_allocdetail_goods                          */
/* ============================================================ */
create index index_of_allocdetail_goods on AllocDetail (GoodsNo)
go

/* ============================================================ */
/*   Index: index_of_allocdetail_allocno                        */
/* ============================================================ */
create index index_of_allocdetail_allocno on AllocDetail (AllocNo)
go

/* ============================================================ */
/*   Table: LossDetail                                          */
/* ============================================================ */
create table LossDetail
(
    LossNo             TRECEIPT              not null,
    GoodsNo            TGOODS                not null,
    LossType           CHAR(1)               null    ,
    Qty                TQTY                  not null,
    AuditQty           TQTY                  null    ,
    CostPrice          TPRICE                null    ,
    RetailPrice        TPRICE                null    ,
    BatchNo            TBATCH                null    ,
    OrgLossNo          TRECEIPT              null    ,
    ID                 INT IDENTITY          not null,
    constraint PK_LOSSDETAIL primary key (ID)
)
go

/* ============================================================ */
/*   Index: index_of_lossno                                     */
/* ============================================================ */
create index index_of_lossno on LossDetail (LossNo)
go

/* ============================================================ */
/*   Index: index_of_lossdetail_goodsno                         */
/* ============================================================ */
create index index_of_lossdetail_goodsno on LossDetail (GoodsNo)
go

/* ============================================================ */
/*   Table: Sale                                                */
/* ============================================================ */
create table Sale
(
    SaleNo             TRECEIPT              not null,
    DeptNo             TDEPT                 not null,
    InputDate          TDATE                 not null
        default GETDATE(),
    ReceiveDate        TDATE                 not null
        default getdate(),
    AuditDate          TDATE                 null    
        default getdate(),
    CustNo             TVENDOR               null    ,
    ReceiptNo          TINVOICE              null    ,
    Employee           TSTAFF                null    ,
    Operator           TSTAFF                null    ,
    Cost               TAMT                  null    ,
    NTaxAmt            TAMT                  not null,
    Amt                TAMT                  null    ,
    PayMode            TPAYMODE              null    ,
    AuditFlag          char(1)               not null
        default '0',
    AuditOperator      TSTAFF                null    ,
    BusinessFlag       char(1)               not null
        default '0',
    Remark             TMEMO                 null    ,
    constraint PK_SALE primary key (SaleNo)
)
go

/* ============================================================ */
/*   Index: index_of_sale_inputdate                             */
/* ============================================================ */
create index index_of_sale_inputdate on Sale (InputDate)
go

/* ============================================================ */
/*   Index: index_of_sale_operator                              */
/* ============================================================ */
create index index_of_sale_operator on Sale (Operator)
go

/* ============================================================ */
/*   Index: index_of_sale_custno                                */
/* ============================================================ */
create index index_of_sale_custno on Sale (CustNo)
go

/* ============================================================ */
/*   Table: Loss                                                */
/* ============================================================ */
create table Loss
(
    LossNo             TRECEIPT              not null,
    InputDate          TDATE                 null    
        default GETDATE(),
    LossDate           TDATE                 null    ,
    AuditDate          TDATE                 null    
        default getdate(),
    DeptNO             TDEPT                 not null,
    ReceiptNo          TINVOICE              null    ,
    Operator           TSTAFF                null    ,
    Employee           TSTAFF                null    ,
    Amt                TAMT                  not null,
    AuditFlag          char(1)               not null
        default '0',
    AuditOperator      TSTAFF                null    ,
    ReceiveDate        TDATE                 not null
        default getdate(),
    BusinessFlag       Char(1)               not null,
    Remark             TMEMO                 null    ,
    constraint PK_LOSS primary key (LossNo)
)
go

/* ============================================================ */
/*   Index: index_of_loss_date                                  */
/* ============================================================ */
create index index_of_loss_date on Loss (InputDate)
go

/* ============================================================ */
/*   Index: index_of_loss_operator                              */
/* ============================================================ */
create index index_of_loss_operator on Loss (Operator)
go

/* ============================================================ */
/*   Table: SaleDetail                                          */
/* ============================================================ */
create table SaleDetail
(
    SaleNo             TRECEIPT              not null,
    GoodsNo            TGOODS                not null,
    NTaxPrice          TPRICE                not null,
    Price              TPRICE                not null,
    RetailPrice        TPRICE                null    ,
    Qty                TQTY                  not null,
    AuditQty           TQTY                  null    ,
    NTaxAmt            TAMT                  null    ,
    Amt                TAMT                  not null,
    CostPrice          TPRICE                null    ,
    OrgSaleNo          TRECEIPT              null    ,
    BatchNo            TBATCH                null    ,
    ID                 INT IDENTITY          not null,
    constraint PK_SALEDETAIL primary key (ID)
)
go

/* ============================================================ */
/*   Index: index_of_saledetail_goodsno                         */
/* ============================================================ */
create index index_of_saledetail_goodsno on SaleDetail (GoodsNo)
go

/* ============================================================ */
/*   Index: index_of_saledetail_saleno                          */
/* ============================================================ */
create index index_of_saledetail_saleno on SaleDetail (SaleNo)
go

/* ============================================================ */
/*   Table: Adjust                                              */
/* ============================================================ */
create table Adjust
(
    AdjustNo           TRECEIPT              not null,
    InputDate          TDATE                 null    
        default getdate(),

⌨️ 快捷键说明

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