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

📄 1.stock_table.sql

📁 学习PB入门的好帮手,附件中包含以下文件夹
💻 SQL
📖 第 1 页 / 共 2 页
字号:

create default d_金额
    as 0
go


sp_bindefault d_金额, 金额
go


/*==============================================================*/
/* Domain: 开户行                                                  */
/*==============================================================*/
execute sp_addtype 开户行, 'nvarchar(30)'
go


/*==============================================================*/
/* Domain: 类型                                                   */
/*==============================================================*/
execute sp_addtype 类型, 'char(1)'
go


/*==============================================================*/
/* Domain: 联系方式                                                 */
/*==============================================================*/
execute sp_addtype 联系方式, 'nvarchar(40)'
go


/*==============================================================*/
/* Domain: 联系人                                                  */
/*==============================================================*/
execute sp_addtype 联系人, 'nvarchar(30)'
go


/*==============================================================*/
/* Domain: 是否                                                   */
/*==============================================================*/
execute sp_addtype 是否, 'bit'
go


/*==============================================================*/
/* Domain: 数量                                                   */
/*==============================================================*/
execute sp_addtype 数量, 'numeric(12,4)'
go


create default d_数量
    as 0
go


sp_bindefault d_数量, 数量
go


/*==============================================================*/
/* Domain: 网址                                                   */
/*==============================================================*/
execute sp_addtype 网址, 'nvarchar(30)'
go


/*==============================================================*/
/* Domain: 姓名                                                   */
/*==============================================================*/
execute sp_addtype 姓名, 'varchar(30)'
go


/*==============================================================*/
/* Domain: 姓名id                                                 */
/*==============================================================*/
execute sp_addtype 姓名id, 'char(36)'
go


/*==============================================================*/
/* Table: f_accredit                                            */
/*==============================================================*/
create table f_accredit (
   c_loginuserid        char(36)             not null,
   c_plistid            char(3)              not null,
   constraint pk_f_accredit primary key  (c_loginuserid, c_plistid)
)
go



/*==============================================================*/
/* Table: f_client                                              */
/*==============================================================*/
create table f_client (
   c_clientid           rowid                not null,
   c_clientsortid       char(30)             null,
   c_clientcode         编码                   null,
   c_clientname         nvarchar(40)         null,
   c_descshort          varchar(30)          null,
   c_clientphone        联系方式                 null,
   c_clientlinkman      姓名                   null,
   c_clientaddress      地址                   null,
   c_clientwww          网址                   null,
   c_clientemail        email                null,
   c_manager            姓名                   null,
   c_tel1               varchar(20)          null,
   c_bank               开户行                  null,
   c_clientaccounts     char(30)             null,
   i_credit             金额                   null,
   i_balance            金额                   null,
   c_memo               备注                   null,
   constraint pk_f_client primary key  (c_clientid)
)
go


/*==============================================================*/
/* Table: f_corpaccredit                                        */
/*==============================================================*/
create table f_corpaccredit (
   c_loginuserid        char(36)             not null,
   c_corporationid      编码                   not null,
   constraint pk_f_corpaccredit primary key  (c_loginuserid, c_corporationid)
)
go


/*==============================================================*/
/* Table: f_corporation                                         */
/*==============================================================*/
create table f_corporation (
   c_corporationid      公司id                 not null,
   c_corporationname    nvarchar(40)         null,
   c_descshort          varchar(30)          null,
   c_phone              联系方式                 null,
   c_linkman            姓名                   null,
   c_address            地址                   null,
   c_www                网址                   null,
   c_email              email                null,
   c_manager            姓名                   null,
   c_tel1               varchar(20)          null,
   c_bank               开户行                  null,
   c_accounts           char(30)             null,
   c_memo               备注                   null,
   c_corporationtype    char(1)              null,
   constraint pk_f_corporation primary key  (c_corporationid)
)
go


create table f_desktopchild (
   i_desktopcode        int                  not null,
   i_desktopchildcode   int                  not null,
   c_desktopchild       nvarchar(40)         null,
   c_picpath            nvarchar(40)         null,
   constraint pk_f_desktopchild primary key  (i_desktopcode, i_desktopchildcode)
)
go


/*==============================================================*/
/* Table: f_desktopmain                                         */
/*==============================================================*/
create table f_desktopmain (
   i_desktopcode        int                  not null,
   c_desktopmain        nvarchar(40)         null,
   constraint pk_f_desktopmain primary key  (i_desktopcode)
)
go


/*==============================================================*/
/* Table: f_inv_detail                                          */
/*==============================================================*/
create table dbo.f_inv_detail (
   c_corporationid      公司id                 not null,
   i_year               smallint             not null,
   i_month              tinyint              not null,
   c_part               货品id                 not null,
   c_prloc              仓库id                 not null,
   i_beginqty           数量                   null,
   i_beginamt           金额                   null,
   i_inqty              数量                   null,
   i_inamt              金额                   null,
   i_outqty             数量                   null,
   i_outamt             金额                   null,
   i_avgcost            金额                   null,
   i_stiqty             数量                   null,
   i_stiamt             金额                   null,
   i_stoqty             数量                   null,
   i_stoamt             金额                   null,
   i_maoqty             数量                   null,
   i_maoamt             金额                   null,
   i_maiqty             数量                   null,
   i_maiamt             金额                   null,
   i_shpqty             数量                   null,
   i_shpamt             金额                   null,
   i_rtnqty             数量                   null,
   i_rtnamt             金额                   null,
   i_csuqty             数量                   null,
   i_csuamt             金额                   null,
   i_cloqty             数量                   null,
   i_cloamt             金额                   null,
   c_memo               备注                   null,
   constraint pk_f_inv_detail primary key clustered (c_corporationid, i_year, i_month, c_part, c_prloc)
)
go


/*==============================================================*/
/* Table: f_inv_zz                                              */
/*==============================================================*/
create table dbo.f_inv_zz (
   c_corporationid      char(30)             not null,
   i_year               smallint             not null,
   i_month              tinyint              not null,
   i_beginamt           金额                   null,
   i_inamt              金额                   null,
   i_outamt             金额                   null,
   i_stiamt             金额                   null,
   i_stoamt             金额                   null,
   i_maoamt             金额                   null,
   i_maiamt             金额                   null,
   i_shpamt             金额                   null,
   i_rtnamt             金额                   null,
   i_cloamt             金额                   null,
   i_csuamt             金额                   null,
   c_createuser         姓名id                 null,
   d_createdate         datetime             null,
   c_modifyuser         姓名id                 null,
   d_checkdate          datetime             null,
   c_status             char(2)              null default 'NA',
   c_yuejie             char(1)              null,
   c_memo               备注                   null,
   constraint pk_f_inv_zz primary key clustered (c_corporationid, i_year, i_month)
)
go


/*==============================================================*/
/* Table: f_invtx_detail                                        */
/*==============================================================*/
create table dbo.f_invtx_detail (
   c_id                 rowid                not null,
   c_corporationid      公司id                 null,
   c_txcode             char(3)              null,
   c_docno              单据id                 null,
   i_docseq             smallint             not null,
   d_docdate            datetime             null,
   c_part               货品id                 null,
   c_refno              单据id                 null,
   i_refseq             单据序号                 null,
   c_vendor             厂商id                 null,
   c_dept               部门id                 null,
   c_fromprloc          仓库id                 null,
   c_toprloc            仓库id                 null,
   c_uom                nvarchar(10)         null,
   i_orgqty             数量                   null,
   i_price              金额                   null,
   i_acramt             金额                   null,
   i_cost_price         金额                   null,
   i_cost_acramt        金额                   null,
   c_emplno             姓名                   null,
   c_checkman           char(36)             null,
   d_checkdate          datetime             null,
   c_status             char(2)              null default 'NA',
   c_ifin               char(1)              null,
   c_memo               备注                   null,
   c_creater            char(36)             null,
   constraint pk_f_invtx_detail primary key clustered (c_id, i_docseq)
)
go


/*==============================================================*/
/* Table: f_loginuser                                           */
/*==============================================================*/
create table f_loginuser (
   c_loginuserid        rowid                not null,
   c_loginusername      nvarchar(30)         null,
   c_pwd                编码                   null default '888',
   i_admin              是否                   null default 0,
   i_go                 是否                   null default 0,
   constraint pk_f_loginuser primary key  (c_loginuserid)
)
go


/*==============================================================*/
/* Table: f_part                                                */
/*==============================================================*/
create table dbo.f_part (
   c_part               货品id                 not null,
   c_description        nvarchar(60)         null,
   c_specification      nvarchar(60)         null,
   c_type               编码                   null,
   c_uom                nvarchar(10)         null,
   c_purchaser          姓名                   null,
   c_vendor             char(36)             null,
   i_orgprice           金额                   null,
   d_createdate         datetime             null,
   d_modifydate         datetime             null,
   c_memo               备注                   null,
   constraint pk_f_part primary key clustered (c_part)
)
go


/*==============================================================*/
/* Table: f_parttype                                            */
/*==============================================================*/
create table f_parttype (
   c_type               规则编码                 not null,
   c_typecode           编码                   null,
   c_description        nvarchar(60)         null,
   c_memo               备注                   null,
   constraint pk_f_parttype primary key  (c_type)
)
go


/*==============================================================*/
/* Table: f_plist                                               */
/*==============================================================*/
create table f_plist (
   c_plistid            char(3)              not null,
   c_plistname          nvarchar(40)         null,
   constraint pk_f_plist primary key  (c_plistid)
)
go


/*==============================================================*/
/* Table: f_storeage                                            */
/*==============================================================*/
create table dbo.f_storeage (
   c_prloc              规则编码                 not null,
   c_prloccode          编码                   null,
   c_description        nvarchar(60)         null,
   c_memo               备注                   null,
   constraint pk_f_storeage primary key clustered (c_prloc)
)
go


/*==============================================================*/
/* Table: f_storepart                                           */
/*==============================================================*/
create table dbo.f_storepart (
   c_corporationid      公司id                 not null,
   c_prloc              仓库id                 not null,
   c_part               货品id                 not null,
   c_uom                varchar(10)          null,
   i_startqty           数量                   null,
   i_startmoney         金额                   null,
   i_onhand             数量                   null,
   i_onhandmoney        金额                   null,
   d_createdate         datetime             null,
   d_modifydate         datetime             null,
   constraint pk_f_storepart primary key clustered (c_corporationid, c_part, c_prloc)
)
go


/*==============================================================*/
/* Table: f_vendor                                              */
/*==============================================================*/
create table f_vendor (
   c_vendorid           rowid                not null,
   c_vendorsortid       char(30)             null,
   c_vendorcode         编码                   null,
   c_vendorname         nvarchar(40)         null,
   c_descshort          varchar(30)          null,
   c_taxno              char(30)             null,
   c_vendorphone        联系方式                 null,
   c_vendorlinkman      姓名                   null,
   c_vendoraddress      地址                   null,
   c_vendorwww          网址                   null,
   c_vendoremail        email                null,
   c_tel                varchar(20)          null,
   c_fax                varchar(20)          null,
   c_rank               varchar(20)          null,
   c_manager            姓名                   null,
   c_tel1               varchar(20)          null,
   c_openbank           开户行                  null,
   c_vendoraccounts     char(30)             null,
   i_balance            金额                   null,
   m_bsnamt             金额                   null,
   d_createdate         datetime             null,
   d_modifydate         datetime             null,
   c_memo               备注                   null,
   constraint pk_f_vendor primary key  (c_vendorid)
)
go


⌨️ 快捷键说明

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