📄 yearinit.sql
字号:
drop table ImportCheck
go
create table ImportCheck
(
CheckNO TRECEIPT not null primary key, /*结算流水*/
InputDate datetime not null,/*录入日期*/
VendorNo TVendor not null,/*供货商代码*/
CheckType char(1) null,/*结算类型*/
CheckMan TStaff null,/*结算人*/
CheckDate datetime null,/*结算日期*/
InvoiceNo TINVOICE null,/*发票号码*/
CheckAmt TAmt null,/*结算金额*/
PrepayAmt TAmt null,/*预付金额*/
DisAmt TAmt null,/*让利金额*/
Operator TStaff null,/*操作员*/
remark TMEMO null /*备注*/
)
go
create unique index idx_importcheck_checkno on ImportCheck(CheckNo)
go
create index idx_importcheck_vendorno on ImportCheck(VendorNo)
go
/*进货结算单据明细表*/
if (select count(*) from sysobjects where name= 'ImportCheckByReceipt') > 0
drop table ImportCheckByReceipt
go
create table ImportCheckByReceipt
(
CheckNo TRECEIPT not null, /*结算流水*/
ImportNo TRECEIPT null,/*进货流水*/
ImportDate DateTime null ,/*进货日期*/
VendorNo TVendor null,/*供货商代码*/
PrepayAmt TAmt null,/*预付金额*/
NTaxAmt TAmt null,/*无税金额*/
TaxAmt TAmt null, /*含税金额*/
ID int identity
)
go
create index idx_importcheckbyreceipt_checkno on ImportCheckByReceipt(CheckNo)
go
/*进货结算单品明细表*/
if (select count(*) from sysobjects where name= 'ImportCheckByGoods') > 0
drop table ImportCheckByGoods
go
create table ImportCheckByGoods
(
CheckNO TReceipt not null,/*结算流水*/
ImportDate Datetime null ,/*进货日期*/
ImportNo TReceipt not null,/*对应进货_销售关联库中的进货流水*/
GoodsNo TGoods not null,/*商品代码*/
NTaxPrice numeric(12,4) null,/*无税进价*/
TaxPrice numeric(12,4) null,/*含税进价*/
CheckQty TQty null,/*结算数量*/
CheckAmt TAmt null/*结算金额*/
)
go
create index idx_importcheckbygoods_checkno on ImportCheckByGoods(CheckNo)
go
/*进货结算金额明细表*/
if (select count(*) from sysobjects where name= 'ImportCheckByAmt') > 0
drop table ImportCheckByAmt
go
create table ImportCheckByAmt
(
CheckNo TReceipt not null,/*结算流水*/
PayableAmt TAmt null,/*应付金额*/
PayingAmt TAmt null,/*结算金额*/
BalanceAmt Tamt null/*结存应付金额*/
)
go
create index idx_importcheckbyamt_checkno on ImportCheckByGoods(CheckNo)
go
/* ============================================================ */
/* Table: GoodsSale */
/* ============================================================ */
create table GoodsSale
(
GoodsNO TGoods not null,
SaleDate Tdate not null,
Amt TAmt null ,
NTaxAmt TAmt null ,
CostAmt TAmt null ,
Qty TQty null ,
constraint PK_GOODSALe primary key (GoodsNO, SaleDate)
)
go
/* ============================================================ */
/* Index: index_of_date22322 */
/* ============================================================ */
create index index_of_date22322 on GoodsSale (SaleDate)
go
/* ============================================================ */
/* Table: CustSaleStat */
/* ============================================================ */
create table CustSaleStat
(
CustNo TVendor not null,
SaleDate Tdate not null,
Amt TAmt null ,
NTaxAmt TAmt null ,
Qty TQty null ,
constraint PK_custsalestat primary key (CustNo, SaleDate)
)
go
/* ============================================================ */
/* Index: index_of_date23 */
/* ============================================================ */
create index index_of_date23 on CustSaleStat (SaleDate)
go
/* ============================================================ */
/* Index: index_of_vendor23 */
/* ============================================================ */
create index index_of_vendor23 on CustSaleStat (CustNo)
go
/* ============================================================ */
/* Table: RetailStat */
/* ============================================================ */
create table RetailStat
(
deptno TDept not null,
GroupNo TGroup not null,
ClassNO TClass not null,
TaxRatio numeric(5,3) not null,
RetailMode char(1) not null,
RetailDate Tdate not null,
Amt TAmt null ,
CostAmt TAmt null ,
DisAmt TAmt null ,
Qty TQty null
)
go
/* ============================================================ */
/* Index: index_of_date */
/* ============================================================ */
create index index_of_date on RetailStat (RetailDate)
go
/* ============================================================ */
/* Index: index_of_group */
/* ============================================================ */
create index index_of_group on RetailStat (GroupNo)
go
/* ============================================================ */
/* Index: index_of_class */
/* ============================================================ */
create index index_of_class on RetailStat (ClassNO)
go
/* ============================================================ */
/* Table: VendorRetailStat */
/* ============================================================ */
create table VendorRetailStat
(
VendorNO TVendor not null,
RetailDate Tdate not null,
TaxRatio numeric(5,3) not null,
RetailMode char(1) not null,
Amt TAmt null ,
CostAmt TAmt null ,
DisAmt TAmt null ,
Qty TQty null
)
go
/* ============================================================ */
/* Index: index_of_date */
/* ============================================================ */
create index index_of_date on VendorRetailStat (RetailDate)
go
/* ============================================================ */
/* Index: index_of_vendor */
/* ============================================================ */
create index index_of_vendor on VendorRetailStat (VendorNO)
go
/* ============================================================ */
/* Table: CategoryRetailStat */
/* ============================================================ */
create table CategoryRetailStat
(
CategoryNo varchar(8) not null,
RetailDate Tdate not null,
RetailMode char(1) null ,
TaxRatio numeric(5,3) null ,
Amt TAmt null ,
CostAmt TAmt not null,
DisAmt TAmt null ,
Qty TQty null
)
go
/* ============================================================ */
/* Index: index_of_retaildate */
/* ============================================================ */
create index index_of_retaildate on CategoryRetailStat (RetailDate)
go
/* ============================================================ */
/* Index: index_of_category */
/* ============================================================ */
create index index_of_category on CategoryRetailStat (CategoryNo)
go
/* ============================================================ */
/* Table: VendorImportStat */
/* ============================================================ */
create table VendorImportStat
(
VendorNO TVendor not null,
ImportDate Tdate not null,
Amt TAmt null ,
NTaxAmt TAmt null ,
Qty TQty null ,
constraint PK_RetailSum primary key (VendorNO, ImportDate)
)
go
/* ============================================================ */
/* Index: index_of_date2 */
/* ============================================================ */
create index index_of_date2 on VendorImportStat (ImportDate)
go
/* ============================================================ */
/* Index: index_of_vendor2 */
/* ============================================================ */
create index index_of_vendor2 on VendorImportStat (VendorNO)
go
/* ============================================================ */
/* Table: NewGoodsRetail */
/* ============================================================ */
create table NewGoodsRetail
(
GoodsNo TGoods not null,
RetailDate Tdate not null,
Amt TAmt null ,
CostAmt TAmt null ,
DisAmt TAmt null ,
Qty TQty null ,
constraint PK_NewGoodsRetail primary key (GoodsNo, RetailDate)
)
go
/* ============================================================ */
/* Index: index_of_date3 */
/* ============================================================ */
create index index_of_date3 on NewGoodsRetail (RetailDate)
go
/* ============================================================ */
/* Index: index_of_vendor3 */
/* ============================================================ */
create index index_of_vendor3 on NewGoodsRetail (GoodsNo)
go
/* ============================================================ */
/* Table: ImportantGoodsRetail */
/* ============================================================ */
create table ImportantGoodsRetail
(
GoodsNo TGoods not null,
RetailDate Tdate not null,
Amt TAmt null ,
CostAmt TAmt null ,
DisAmt TAmt null ,
Qty TQty null ,
constraint PK_ImportantGoodsRetail primary key (GoodsNo, RetailDate)
)
go
/* ============================================================ */
/* Index: index_of_date32 */
/* ============================================================ */
create index index_of_date32 on ImportantGoodsRetail (RetailDate)
go
/* ============================================================ */
/* Index: index_of_vendor32 */
/* ============================================================ */
create index index_of_vendor32 on ImportantGoodsRetail (GoodsNo)
go
/* ============================================================ */
/* Table: ImportStat */
/* ============================================================ */
create table ImportStat
(
DeptNo Tdept not null,
GroupNo TGroup not null,
ClassNo TClass not null,
ImportDate Tdate not null,
Amt TAmt null ,
NTaxAmt TAmt null ,
Qty TQty null ,
constraint PK_importstat primary key (DeptNo, GroupNo, ClassNo, ImportDate)
)
go
/* ============================================================ */
/* Index: index_of_date22 */
/* ============================================================ */
create index index_of_date22 on ImportStat (ImportDate)
go
/* ============================================================ */
/* Index: index_of_vendor22 */
/* ============================================================ */
create index index_of_vendor22 on ImportStat (GroupNo)
go
/* ============================================================ */
/* Table: CategoryImportStat */
/* ==========
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -