?? yearinit.sql
字號:
/* ============================================================ */
/* Index: index_of_paymode2 */
/* ============================================================ */
create index index_of_paymode2 on Retail (PayMode)
go
/* ============================================================ */
/* Index: index_of_dept2 */
/* ============================================================ */
create index index_of_dept2 on Retail (DeptNo)
go
/* ============================================================ */
/* Index: index_of_posno2 */
/* ============================================================ */
create index index_of_posno2 on Retail (POSNO)
go
/* ============================================================ */
/* Table: PosRetail */
/* ============================================================ */
create table PosRetail
(
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(),
Points Numeric(12,3) null ,
BatchNo TBATCH null ,
ID INT IDENTITY not null,
UD1 VARCHAR(5) null ,
UD2 VARCHAR(5) null ,
UD3 TUDF null ,
UD4 TUDF null ,
constraint PK_POSRETAIL primary key (ID)
)
go
/* ============================================================ */
/* Index: index_of_spdm22 */
/* ============================================================ */
create index index_of_spdm22 on PosRetail (GoodsNo)
go
/* ============================================================ */
/* Table: ChecksFlow */
/* ============================================================ */
create table ChecksFlow
(
GoodsNO TGOODS null ,
PosNo CHAR(4) null ,
GoodsShelf VARCHAR(8) null ,
Operator TSTAFF null ,
InputDate TDATE null
default getdate(),
RetailPrice TPRICE null ,
Qty TQTY null ,
ReceiptNo CHAR(12) null ,
id Int Identity not null,
constraint PK_CHECKSFLOW primary key (id)
)
go
/* ============================================================ */
/* Table: InvoiceFlow */
/* ============================================================ */
create table InvoiceFlow
(
Root CHAR(12) null ,
CurrentNO CHAR(12) null ,
ReceiptNO char(12) null ,
InputDate TDATE null
default getdate(),
Casher TSTAFF null ,
PosNo CHAR(4) null ,
InvoiceType CHAR(1) null ,
InvoiceCopy INT null ,
RetailCount INT null ,
Amt TAMT null ,
POINTS NUMERIC(12,2) null ,
ID INT Identity not null,
constraint PK_INVOICEFLOW primary key (ID)
)
go
/* ============================================================ */
/* Table: RootFlow */
/* ============================================================ */
create table RootFlow
(
RootDate TDATE null ,
RootNo char(12) null ,
StartNo char(12) null ,
EndNo char(12) null ,
StartTime char(17) null ,
EndTime char(17) null ,
PosNo char(4) null ,
Casher TSTAFF null ,
RootCopy integer null ,
ValidCopy integer null ,
RetailCopy integer null ,
Adjustcopy integer null ,
InvalidCopy Integer null ,
ValidAmt TAmt null ,
RetailAmt TAmt null ,
AdjustAmt TAmt null ,
InvalidAmt TAmt null ,
Id Int Identity not null,
constraint PK_ROOTFLOW primary key (Id)
)
go
/* ============================================================ */
/* Table: DayStock */
/* ============================================================ */
create table DayStock
(
Date char(8) not null,
DeptNo TDEPT not null,
GoodsNo TGOODS not null,
CurQty TQTY null ,
RetailPrice TPRICE null ,
CurAmt TAMT null ,
constraint PK_DAYSTOCK primary key (Date, DeptNo, GoodsNo)
)
go
/* ============================================================ */
/* Table: Reqreturn */
/* ============================================================ */
create table Reqreturn
(
ReceiptNO TReceipt null ,
GoodsNo TGoods null ,
OrderQty TQty null ,
Qty TQty null ,
ReturnText Varchar(50) null ,
ReturnDate TDate null ,
ReturnFlag char(1) null
default '1'
)
go
/* ============================================================ */
/* Table: PriceChange */
/* ============================================================ */
create table PriceChange
(
GoodsNo TGoods null ,
VendorNo TVendor null ,
OldPrice TPrice null ,
NewPrice TPrice null ,
ModifyDate TDate null
)
go
/* ============================================================ */
/* Index: index_of_pricechange_goodsno */
/* ============================================================ */
create index index_of_pricechange_goodsno on PriceChange (GoodsNo)
go
/* ============================================================ */
/* Index: index_of_pricechange_vendor */
/* ============================================================ */
create index index_of_pricechange_vendor on PriceChange (VendorNo)
go
/* ============================================================ */
/* Index: index_of_pricechange_date */
/* ============================================================ */
create index index_of_pricechange_date on PriceChange (ModifyDate)
go
/* ============================================================ */
/* Table: CasherReport */
/* ============================================================ */
create table CasherReport
(
Casher TStaff not null,
RetailDate Tdate not null,
PayMode TPayMode not null,
Amt TAmt null ,
DisAmt TAmt null ,
constraint PK_CASHERREPORT primary key (Casher, RetailDate, PayMode)
)
go
/* ============================================================ */
/* Table: hRetail */
/* ============================================================ */
create table hRetail
(
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_HRETAIL primary key (ID)
)
go
/* ============================================================ */
/* Index: index_of_spdm23 */
/* ============================================================ */
create index index_of_spdm23 on hRetail (GoodsNo)
go
/* ============================================================ */
/* Index: index_of_casher22 */
/* ============================================================ */
create index index_of_casher22 on hRetail (Casher)
go
/* ============================================================ */
/* Index: index_of_saleman22 */
/* ============================================================ */
create index index_of_saleman22 on hRetail (Saleman)
go
/* ============================================================ */
/* Index: index_of_inputdate22 */
/* ============================================================ */
create index index_of_inputdate22 on hRetail (InputDate)
go
/* ============================================================ */
/* Index: index_of_paymode22 */
/* ============================================================ */
create index index_of_paymode22 on hRetail (PayMode)
go
/* ============================================================ */
/* Index: index_of_dept22 */
/* ============================================================ */
create index index_of_dept22 on hRetail (DeptNo)
go
/* ============================================================ */
/* Index: index_of_posno22 */
/* ============================================================ */
create index index_of_posno22 on hRetail (POSNO)
go
/*供貨商進貨_結算_銷售關聯表*/
if (select count(*) from sysobjects where name= 'import_to_check') > 0
drop table import_to_check
go
create table Import_To_Check
(
VendorNo Tvendor not null, /*供貨商代碼*/
ImportNo TRECEIPT not null, /*進貨流水*/
ImportDate datetime not null,/*進貨日期*/
GoodsNo TGoods not null,/*商品代碼*/
NTaxPrice numeric(12,4) null,/*無稅進價*/
TaxPrice numeric(12,4) null, /*含稅進價*/
RetailPrice numeric(12,2) null, /*零售單價*/
ImportQty TQty null, /*進貨數量*/
ExportQty TQty null, /*退貨數量*/
CheckDate datetime null,/*結算日期*/
RetailQty TQty null, /*銷售數量*/
CheckQty TQty null, /*結算數量*/
CheckAmt TAMT null, /*結算金額*/
NoCheckQty TQty null,/*未結算數量*/
NoCheckAmt TAmt null,/*未結算金額*/
ID integer Identity not null primary key )
go
create index idx_import_to_check_goodsno on import_to_check(goodsno)
go
create index idx_import_to_check_vendorno on import_to_check(vendorno)
go
/*供貨商應付帳款表*/
if (select count(*) from sysobjects where name= 'payable') > 0
drop table payable
go
create table Payable
(
BusinessDate datetime not null,/*業務日期*/
VendorNo TVendor not null,/*供貨商代碼*/
BusinessType varchar(12) null,/*業務類型*/
Remark varchar(30) null,/*摘要*/
InvoiceNo TInvoice null,/*原始單據號碼*/
AddAmt TAmt null,/*增加金額*/
SubAmt TAmt null,/*減少金額*/
BalanceAmt TAmt null,/*結存金額*/
ID Integer Identity not null primary key
)
go
create index idx_payable_vendorno on Payable(vendorno)
go
/*進貨結算流水*/
if (select count(*) from sysobjects where name= 'ImportCheck') > 0
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -