プロジェクト

全般

プロフィール

リビジョン 106

山内7年以上前に追加

資材管理、請求管理関連のテーブル作成文を追加

差分を表示:

ProcessManagement.sql
1918 1918
CREATE INDEX VehicleScheduleData_Index3 ON VehicleScheduleData (TargetDay ASC);
1919 1919

  
1920 1920

  
1921
-- 資材管理、請求管理関係のテーブル作成
1921 1922

  
1923
-- 銀行営業日マスタ
1924
drop table if exists bankbusinessdaymaster cascade;
1925

  
1926
create table bankbusinessdaymaster (
1927
  YEARMONTH decimal(6,0) default '0' not null comment '年月'
1928
  , BANKBUSINESSDAY decimal(2,0) default '0' not null comment '銀行営業日'
1929
  , NOTE varchar(120) comment '備考'
1930
  , DELETEFLG decimal(1,0) comment '削除フラグ'
1931
  , ENTRYDATE datetime comment '登録年月日'
1932
  , UPDATEDATE datetime comment '更新年月日'
1933
  , constraint bankbusinessdaymaster_PKC primary key (YEARMONTH,BANKBUSINESSDAY)
1934
) comment '銀行営業日マスタ' ;
1935

  
1936
-- 業者請求データ
1937
drop table if exists billingdata cascade;
1938

  
1939
create table billingdata (
1940
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
1941
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
1942
  , SEQNO decimal(3,0) default '0' not null comment '連番'
1943
  , BILLPRICE decimal(10,0) comment '請求金額'
1944
  , ENTRYDATE datetime comment '登録年月日'
1945
  , UPDATEDATE datetime comment '更新年月日'
1946
  , constraint billingdata_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO)
1947
) comment '業者請求データ' ;
1948

  
1949
-- 業者請求明細データ
1950
drop table if exists billingdatadetail cascade;
1951

  
1952
create table billingdatadetail (
1953
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
1954
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
1955
  , SEQNO decimal(3,0) default '0' not null comment '連番'
1956
  , LINECOUNT decimal(3,0) default '0' not null comment '行番号'
1957
  , CONSTRUCTIONCODE decimal(10,0) comment '工事番号'
1958
  , FIELDNAME varchar(120) comment '現場名'
1959
  , BILLPRICE decimal(10,0) comment '請求金額'
1960
  , HIGHWPRICE decimal(10,0) comment '高速代'
1961
  , HARDWPRICE decimal(10,0) comment '金物代'
1962
  , INDSWASTETAX decimal(10,0) comment '産廃税'
1963
  , NOTE varchar(120) comment '備考'
1964
  , ENTRYDATE datetime comment '登録年月日'
1965
  , UPDATEDATE datetime comment '更新年月日'
1966
  , constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT)
1967
) comment '業者請求明細データ' ;
1968

  
1969
-- 業者請求支払サマリーデータ
1970
drop table if exists billingpaymentsummary cascade;
1971

  
1972
create table billingpaymentsummary (
1973
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
1974
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
1975
  , CHARGEPAYMENTKIND decimal(1,0) default '0' not null comment '請求支払区分'
1976
  , PAYDAY date comment '支払日'
1977
  , BILLPRICESTOTAL decimal(10,0) comment '請求金額小計'
1978
  , CONSUMPTIONTAXRATE decimal(6,3) comment '消費税率'
1979
  , CONSUMPTIONTAXPRICE decimal(10,0) comment '消費税額'
1980
  , HIGHWPRICESTOTAL decimal(10,0) comment '高速代小計'
1981
  , HARDWPRICESTOTAL decimal(10,0) comment '金物代小計'
1982
  , INDSWASTETAXSTOTAL decimal(10,0) comment '産廃税小計'
1983
  , CNSTRPRICERATE decimal(6,3) comment '協力金比率'
1984
  , CNSTRPRICESTOTAL decimal(10,0) comment '協力金小計'
1985
  , BILLINGPRICETOTAL decimal(10,0) comment '請求金額合計'
1986
  , ENTRYDATE datetime comment '登録年月日'
1987
  , UPDATEDATE datetime comment '更新年月日'
1988
  , constraint billingpaymentsummary_PKC primary key (COMPANYCODE,TARGETDATE,CHARGEPAYMENTKIND)
1989
) comment '業者請求支払サマリーデータ' ;
1990

  
1991
-- 工事資材情報
1992
drop table if exists constructionmaterialinfo cascade;
1993

  
1994
create table constructionmaterialinfo (
1995
  CONSTRUCTIONCODE int(10) unsigned default 0 not null comment '工事番号'
1996
  , MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
1997
  , RENTCOUNT smallint(5) unsigned comment '貸出数'
1998
  , REPAYCOUNT smallint(5) unsigned comment '返却数'
1999
  , COMPLETEFLG tinyint(3) unsigned comment '完了フラグ'
2000
  , ENTRYDATE datetime comment '登録日付'
2001
  , UPDATEDATE datetime comment '更新日付'
2002
  , constraint constructionmaterialinfo_PKC primary key (CONSTRUCTIONCODE,MATERIALITEMCODE)
2003
) comment '工事資材情報' ;
2004

  
2005
-- 締日マスタ
2006
drop table if exists deadlinemaster cascade;
2007

  
2008
create table deadlinemaster (
2009
  LABOURKIND decimal(1,0) default '0' not null comment '手間業者区分'
2010
  , DEADLINE decimal(2,0) comment '締日'
2011
  , PAYDAY decimal(2,0) comment '支払日'
2012
  , NOTE varchar(120) comment '備考'
2013
  , DELETEFLG decimal(1,0) comment '削除フラグ'
2014
  , ENTRYDATE datetime comment '登録日付'
2015
  , UPDATEDATE datetime comment '更新日付'
2016
  , constraint deadlinemaster_PKC primary key (LABOURKIND)
2017
) comment '締日マスタ' ;
2018

  
2019
-- 入金確認承認データ
2020
drop table if exists depositapprovalinfo cascade;
2021

  
2022
create table depositapprovalinfo (
2023
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
2024
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
2025
  , TARGETDATE decimal(6,0) not null comment '対象年月'
2026
  , SEQNO decimal(3,0) not null comment '連番'
2027
  , LINECOUNT decimal(3,0) not null comment '行番号'
2028
  , APPROVALNO decimal(3,0) not null comment '承認順序'
2029
  , APPROVALPERSON decimal(8,0) comment '承認者コード'
2030
  , APPROVALPERSONNAME varchar(20) comment '承認者名'
2031
  , APPROVALAUTHORITY decimal(1,0) comment '承認権限区分'
2032
  , APPROVALDATE date comment '承認日付'
2033
  , ENTRYDATE datetime comment '登録日付'
2034
  , UPDATEDATE datetime comment '更新日付'
2035
  , constraint depositapprovalinfo_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO)
2036
) comment '入金確認承認データ' ;
2037

  
2038
-- 入金データ
2039
drop table if exists depositdata cascade;
2040

  
2041
create table depositdata (
2042
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
2043
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
2044
  , TARGETDATE decimal(6,0) not null comment '対象年月'
2045
  , SEQNO decimal(3,0) not null comment '連番'
2046
  , BusinessPeriod decimal(4,0) comment '営業期'
2047
  , DEPOSITDATE date comment '入金日'
2048
  , DepositAmount decimal(12,0) comment '入金金額'
2049
  , DEPOSITAMOUNTCASH decimal(10,0) comment '入金金額(現金)'
2050
  , DEPOSITAMOUNTBILL decimal(10,0) comment '入金金額(手形)'
2051
  , ENTRYDATE datetime comment '登録日付'
2052
  , UPDATEDATE datetime comment '更新日付'
2053
  , constraint depositdata_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO)
2054
) comment '入金データ' ;
2055

  
2056
-- 入金明細データ
2057
drop table if exists depositdatadetail cascade;
2058

  
2059
create table depositdatadetail (
2060
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
2061
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
2062
  , TARGETDATE decimal(6,0) not null comment '対象年月'
2063
  , SEQNO decimal(3,0) not null comment '連番'
2064
  , LINECOUNT decimal(3,0) not null comment '行番号'
2065
  , REQUESTNO decimal(10,0) comment '請求No'
2066
  , ORDERNO decimal(2,0) comment '受付番号'
2067
  , DEPOSITAMOUNT decimal(10,0) comment '入金金額'
2068
  , DISCOUNTAMOUNT decimal(10,0) comment '値引き金額'
2069
  , CNSTRPRICE decimal(10,0) comment '協力金'
2070
  , FEES decimal(10,0) comment '手数料'
2071
  , OTHERADJUSTMENTS decimal(10,0) comment 'その他調整'
2072
  , CARRYAMOUNT decimal(10,0) comment '繰越金額'
2073
  , APPROVALPERSONCODE decimal(8,0) comment '承認担当者コード'
2074
  , APPROVALDATE date comment '担当者承認日付'
2075
  , APPROVALENDFLG decimal(1,0) comment '承認完了フラグ'
2076
  , ENTRYDATE datetime comment '登録日付'
2077
  , UPDATEDATE datetime comment '更新日付'
2078
  , constraint depositdatadetail_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT)
2079
) comment '入金明細データ' ;
2080

  
2081
-- 請求書データ
2082
drop table if exists invoicedata cascade;
2083

  
2084
create table invoicedata (
2085
  INVOICENO decimal(9,0) not null comment '請求書No'
2086
  , ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
2087
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
2088
  , REQUESTMONTH decimal(6,0) not null comment '請求月'
2089
  , SEQNO decimal(2,0) not null comment '連番'
2090
  , CRETATEDATE date not null comment '作成日'
2091
  , REQUESTDATE date not null comment '請求日'
2092
  , REQUESTNAME varchar(120) comment '請求先名'
2093
  , TOTALAMOUNT decimal(10,0) comment '税込み合計金額'
2094
  , TAXAMOUNT decimal(10,0) comment '消費税金額'
2095
  , COMMENT1 varchar(60) comment 'コメント1'
2096
  , COMMENT2 varchar(60) comment 'コメント2'
2097
  , COMMENT3 varchar(60) not null comment 'コメント3'
2098
  , COMMENT4 varchar(60) not null comment 'コメント4'
2099
  , COMMENT5 varchar(60) not null comment 'コメント5'
2100
  , COMPLETEFLG decimal(1,0) default '0' not null comment '完了フラグ'
2101
  , ENTRYDATE datetime not null comment '登録年月日'
2102
  , UPDATEDATE datetime not null comment '更新年月日'
2103
  , constraint invoicedata_PKC primary key (INVOICENO)
2104
) comment '請求書データ' ;
2105

  
2106
alter table invoicedata add unique ORDERERSDIVISION (ORDERERSDIVISION,ORDERERSCODE,REQUESTMONTH,SEQNO) ;
2107

  
2108
-- 資材情報
2109
drop table if exists materialinfo cascade;
2110

  
2111
create table materialinfo (
2112
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
2113
  , MATERIALCOUNT smallint(5) unsigned comment '資材数'
2114
  , RENTCOUNT smallint(5) unsigned comment '貸出可能数'
2115
  , DELETEFLG smallint(5) unsigned comment '削除フラグ'
2116
  , ENTRYDATE datetime comment '登録日付'
2117
  , UPDATEDATE datetime comment '更新日付'
2118
  , constraint materialinfo_PKC primary key (MATERIALITEMCODE)
2119
) comment '資材情報' ;
2120

  
2121
-- 資材品目マスタ
2122
drop table if exists materialitemmaster cascade;
2123

  
2124
create table materialitemmaster (
2125
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
2126
  , MATERIALKINDCODE smallint(5) unsigned comment '資材種類コード'
2127
  , MATERIALITEMNAME varchar(40) comment '資材品目名称'
2128
  , DISPLAYORDER smallint(5) unsigned comment '表示順'
2129
  , DELETEFLG tinyint(3) unsigned comment '削除フラグ'
2130
  , ENTRYDATE datetime comment '登録日付'
2131
  , UPDATEDATE datetime comment '更新日付'
2132
  , VERSIONNO decimal(8,0) not null default 0 comment 'バージョン番号'
2133
  , constraint materialitemmaster_PKC primary key (MATERIALITEMCODE)
2134
) comment '資材品目マスタ' ;
2135

  
2136
-- 資材種類マスタ
2137
drop table if exists materialkindmaster cascade;
2138

  
2139
create table materialkindmaster (
2140
  MATERIALKINDCODE smallint(5) unsigned default 0 not null comment '資材種類コード'
2141
  , MATERIALKINDNAME varchar(40) comment '資材種類名称'
2142
  , DISPLAYORDER smallint(5) unsigned comment '表示順'
2143
  , DELETEFLG tinyint(3) unsigned comment '削除フラグ'
2144
  , ENTRYDATE datetime comment '登録日付'
2145
  , UPDATEDATE datetime comment '更新日付'
2146
  , constraint materialkindmaster_PKC primary key (MATERIALKINDCODE)
2147
) comment '資材種類マスタ' ;
2148

  
2149
-- 資材履歴情報
2150
drop table if exists materialrecordinfo cascade;
2151

  
2152
create table materialrecordinfo (
2153
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
2154
  , PROCESSDATE date default '0000-00-00' not null comment '処理年月日'
2155
  , SEQNO smallint(5) unsigned default 0 not null comment '連番'
2156
  , RECKIND tinyint(3) unsigned comment 'レコード区分'
2157
  , CONSTRUCTIONCODE int(10) unsigned comment '工事番号'
2158
  , PERSONCODE int(10) unsigned comment '担当者コード'
2159
  , MATERIALCOUNT smallint(5) unsigned comment '資材数'
2160
  , REPAYPLANDATE date comment '返却予定年月日'
2161
  , COMMENTTEXT varchar(80) comment 'コメント'
2162
  , ENTRYDATE datetime comment '登録日付'
2163
  , UPDATEDATE datetime comment '更新日付'
2164
  , constraint materialrecordinfo_PKC primary key (MATERIALITEMCODE,PROCESSDATE,SEQNO)
2165
) comment '資材履歴情報' ;
2166

  
2167
-- 支払承認情報データ
2168
drop table if exists paymentapprovalinfo cascade;
2169

  
2170
create table paymentapprovalinfo (
2171
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
2172
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
2173
  , SEQNO decimal(3,0) default '0' not null comment '連番'
2174
  , LINECOUNT decimal(3,0) default '0' not null comment '行番号'
2175
  , APPROVALNO decimal(3,0) default '0' not null comment '承認順序'
2176
  , APPROVALPERSON decimal(8,0) comment '承認者コード'
2177
  , APPROVALPERSONNAME varchar(20) comment '承認者名'
2178
  , APPROVALAUTHORITY decimal(1,0) comment '承認権限区分'
2179
  , APPROVALDATE date comment '承認日付'
2180
  , ENTRYDATE datetime comment '登録日付'
2181
  , UPDATEDATE datetime comment '更新日付'
2182
  , constraint paymentapprovalinfo_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO)
2183
) comment '支払承認情報データ' ;
2184

  
2185
-- 支払明細データ
2186
drop table if exists paymentdatadetail cascade;
2187

  
2188
create table paymentdatadetail (
2189
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
2190
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
2191
  , SEQNO decimal(3,0) default '0' not null comment '連番'
2192
  , LINECOUNT decimal(3,0) default '0' not null comment '行番号'
2193
  , BILLPRICE decimal(10,0) comment '請求金額'
2194
  , DISCOUNTPRICE decimal(10,0) comment '値引き金額'
2195
  , OFFSETPRICE decimal(10,0) comment '相殺金額'
2196
  , NEXTCOPRICE decimal(10,0) comment '次回繰越'
2197
  , HIGHWPRICE decimal(10,0) comment '高速代'
2198
  , HARDWPRICE decimal(10,0) comment '金物代'
2199
  , INDSWASTETAX decimal(10,0) comment '産廃税'
2200
  , CNSTRPRICE decimal(10,0) comment '協力金'
2201
  , CNSTRPRICEEXIST decimal(1,0) comment '協力金有無'
2202
  , APPROVALPERSONCODE decimal(8,0) comment '承認担当者コード'
2203
  , APPROVALDATE date comment '担当者承認日付'
2204
  , APPROVALENDFLG decimal(1,0) comment '承認完了フラグ'
2205
  , ENTRYDATE datetime comment '登録日付'
2206
  , UPDATEDATE datetime comment '更新日付'
2207
  , constraint paymentdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT)
2208
) comment '支払明細データ' ;
2209

  
2210
-- 請求データ
2211
drop table if exists requestdata cascade;
2212

  
2213
create table requestdata (
2214
  REQUESTNO decimal(9,0) not null comment '請求No'
2215
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '本工事番号'
2216
  , CONSTRUCTIONNAME varchar(120) not null comment '工事件名'
2217
  , CONTRACTAMOUNT decimal(10,0) not null comment '請負金額'
2218
  , PAIDAMOUNT decimal(10,0) not null comment '請求済金額'
2219
  , REQUESTAMOUNT0 decimal(10,0) not null comment '請求金額0'
2220
  , REQUESTAMOUNT1 decimal(10,0) not null comment '請求金額1'
2221
  , REQUESTAMOUNT2 decimal(10,0) comment '請求金額2'
2222
  , REQUESTAMOUNT3 decimal(10,0) comment '請求金額3'
2223
  , REQUESTAMOUNT4 decimal(10,0) comment '請求金額4'
2224
  , REQUESTAMOUNT5 decimal(10,0) comment '請求金額5'
2225
  , REQUESTAMOUNT6 decimal(10,0) comment '請求金額6'
2226
  , UNCLAIMEDAMOUNT decimal(10,0) not null comment '請求残金額'
2227
  , UNPAIDAMOUNT decimal(10,0) not null comment '未入金金額'
2228
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
2229
  , NOTE varchar(120) not null comment '備考'
2230
  , ENTRYDATE datetime not null comment '登録年月日'
2231
  , UPDATEDATE datetime not null comment '更新年月日'
2232
  , constraint requestdata_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE)
2233
) comment '請求データ' ;
2234

  
2235
-- 請求データ明細
2236
drop table if exists requestdatadetail cascade;
2237

  
2238
create table requestdatadetail (
2239
  REQUESTNO decimal(9,0) not null comment '請求No'
2240
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '本工事番号'
2241
  , CONSTRUCTIONCODE decimal(10,0) not null comment '工事番号'
2242
  , CONSTRUCTIONKIND decimal(1,0) not null comment '工事区分'
2243
  , REQUESTAMOUNT decimal(10,0) not null comment '請求金額'
2244
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
2245
  , ENTRYDATE datetime not null comment '登録年月日'
2246
  , UPDATEDATE datetime not null comment '更新年月日'
2247
  , constraint requestdatadetail_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE,CONSTRUCTIONCODE,CONSTRUCTIONKIND)
2248
) comment '請求データ明細' ;
2249

  
2250
-- 請求ヘッダ
2251
drop table if exists requesthead cascade;
2252

  
2253
create table requesthead (
2254
  REQUESTNO decimal(9,0) not null comment '請求No'
2255
  , REQCONSTRUCTIONCODE decimal(10,0) not null comment '請求工事番号'
2256
  , ORDERNO decimal(2,0) not null comment '受付番号'
2257
  , REQUESTMONTH decimal(6,0) not null comment '請求月'
2258
  , ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
2259
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
2260
  , ORDERERSNAME varchar(120) not null comment '発注者先名'
2261
  , REQCONSTRUCTIONNAME varchar(120) not null comment '請求工事件名'
2262
  , REQUESTTOTALAMOUNT decimal(10,0) not null comment '請求金額合計'
2263
  , REQUESTAMOUNT decimal(10,0) not null comment '請求金額'
2264
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
2265
  , UNPAIDAMOUNT decimal(10,0) comment '未入金'
2266
  , NOTE varchar(120) comment '備考'
2267
  , ASSIGNEDFLG decimal(1,0) comment '割当済フラグ'
2268
  , INVOICENO decimal(9,0) not null comment '請求書No'
2269
  , ENTRYDATE datetime not null comment '登録年月日'
2270
  , UPDATEDATE datetime not null comment '更新年月日'
2271
  , constraint requesthead_PKC primary key (REQUESTNO)
2272
) comment '請求ヘッダ' ;
2273

  
2274
alter table requesthead add unique REQCONSTRUCTIONCODE (REQCONSTRUCTIONCODE,ORDERNO) ;
2275

  
2276

  

他の形式にエクスポート: Unified diff