プロジェクト

全般

プロフィール

リビジョン 198

堀内7年以上前に追加

CreateTableをA5MK2版へ変更
テーブル変更SQL追加

差分を表示:

branches/ddl/20170614_SQL.txt
1
-- ????????f?[?^
2
drop table if exists depositdatadetail cascade;
3

  
4
create table depositdatadetail (
5
  ORDERERSDIVISION decimal(5,0) not null comment '???????'
6
  , ORDERERSCODE decimal(5,0) not null comment '??????R?[?h'
7
  , TARGETDATE decimal(6,0) not null comment '???N??'
8
  , REQUESTNO decimal(10,0) not null comment '????No'
9
  , ORDERNO decimal(2,0) comment '??t???'
10
  , DEPOSITAMOUNT decimal(10,0) comment '???????z'
11
  , DISCOUNTAMOUNT decimal(10,0) comment '?l???????z'
12
  , CNSTRPRICE decimal(10,0) comment '?????'
13
  , FEES decimal(10,0) comment '????'
14
  , OTHERADJUSTMENTS decimal(10,0) comment '?????'
15
  , DIFFERENCEAMOUNT decimal(10,0) comment '????'
16
  , CONFIRMATIONPERSONCODE decimal(8,0) comment '?m?F?S????R?[?h'
17
  , CONFIRMATIONDATE date comment '?S????m?F???t'
18
  , CONFIRMATIONENDFLG decimal(1,0) comment '?m?F?????t???O'
19
  , NOTE varchar(120) comment '???l'
20
  , ENTRYDATE datetime comment '?o?^???t'
21
  , UPDATEDATE datetime comment '?X?V???t'
22
  , constraint depositdatadetail_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,REQUESTNO)
23
) comment '????????f?[?^' ;
24

  
25
DROP TABLE IF EXISTS RequestOrderDate;
26
-- ?????????t?f?[?^
27
CREATE TABLE RequestOrderDate
28
(
29
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '?H???R?[?h',
30
	RequestNo decimal(9,0) NOT NULL COMMENT '????No',
31
	SendDate date NOT NULL COMMENT '???????????X????',
32
	EntryDate datetime NOT NULL COMMENT '?o?^???t',
33
	UpdateDate datetime NOT NULL COMMENT '?X?V???t'
34
) COMMENT = '?????????t?f?[?^';
35

  
36

  
branches/ddl/ProcessManagement.sql
1
SET SESSION FOREIGN_KEY_CHECKS=0;
1
-- Project Name : noname
2
-- Date/Time    : 2017/06/14 16:16:18
3
-- Author       : Horiuchi
4
-- RDBMS Type   : MySQL
5
-- Application  : A5:SQL Mk-2
2 6

  
3
/* Drop Indexes */
7
-- 担当者行動予定データ
8
drop index ActionScheduleData_Index1 on actionscheduledata;
9
drop index ActionScheduleData_Index2 on actionscheduledata;
10
drop index ActionScheduleData_Index3 on actionscheduledata;
4 11

  
5
DROP INDEX ActionScheduleData_Index1 ON ActionScheduleData;
6
DROP INDEX ActionScheduleData_Index2 ON ActionScheduleData;
7
DROP INDEX ActionScheduleData_Index3 ON ActionScheduleData;
8
DROP INDEX AttendDaily_Index1 ON AttendanceDailyData;
9
DROP INDEX AttendDaily_Index2 ON AttendanceDailyData;
10
DROP INDEX BusinessTypeMaster_Index1 ON BusinessTypeMaster;
11
DROP INDEX ComponentLinkMaster_Index1 ON ComponentLinkMaster;
12
DROP INDEX ComponentLinkMaster_Index2 ON ComponentLinkMaster;
13
DROP INDEX ComponentMaster_Index1 ON ComponentMaster;
14
DROP INDEX ComponentToTypeMaster_Index1 ON ComponentToTypeMaster;
15
DROP INDEX ComponentToTypeMaster_Index2 ON ComponentToTypeMaster;
16
DROP INDEX BaseInfo_Index1 ON ConstructionBaseInfo;
17
DROP INDEX BaseInfo_Index2 ON ConstructionBaseInfo;
18
DROP INDEX BaseInfo_Index3 ON ConstructionBaseInfo;
19
DROP INDEX BaseInfo_Index4 ON ConstructionBaseInfo;
20
DROP INDEX BaseInfo_Index5 ON ConstructionBaseInfo;
21
DROP INDEX BaseInfoDetail_Idx1 ON ConstructionBaseInfoDetail;
22
DROP INDEX BaseInfoDetail_Idx2 ON ConstructionBaseInfoDetail;
23
DROP INDEX LedgerDetail_Index01 ON ConstructionLedgerDetail;
24
DROP INDEX LedgerDetail_Index02 ON ConstructionLedgerDetail;
25
DROP INDEX LedgerDetail_Index03 ON ConstructionLedgerDetail;
26
DROP INDEX LedgerExcute_Index1 ON ConstructionLedgerExcute;
27
DROP INDEX ConstructionLink_Index1 ON ConstructionLink;
28
DROP INDEX ConstructionLink_Index2 ON ConstructionLink;
29
DROP INDEX ConstructionLink_Index3 ON ConstructionLink;
30
DROP INDEX ConstructionSpecMaster_Index1 ON ConstructionSpecMaster;
31
DROP INDEX CostDataOfPerson_Index1 ON CostDataOfPerson;
32
DROP INDEX CostDataOfPerson_Index2 ON CostDataOfPerson;
33
DROP INDEX CostomerRegist_Index1 ON CostomerRegist;
34
DROP INDEX DailyDataConstruction_Index1 ON DailyDataConstruction;
35
DROP INDEX DailyDataConstruction_Index2 ON DailyDataConstruction;
36
DROP INDEX DailyDataConstruction_Index3 ON DailyDataConstruction;
37
DROP INDEX DailyDataDetail_Index ON DailyDataDetail;
38
DROP INDEX DailyDataField_Index ON DailyDataField;
39
DROP INDEX DailyDataMaterials_Index ON DailyDataMaterials;
40
DROP INDEX DailyDataSubcontractors_Index ON DailyDataSubcontractors;
41
DROP INDEX DailyDataVehicles_Index ON DailyDataVehicles;
42
DROP INDEX DepartmentMaster_index1 ON DepartmentMaster;
43
DROP INDEX EstimateData_Index1 ON EstimateData;
44
DROP INDEX EstimateDataBody_Index1 ON EstimateDataBody;
45
DROP INDEX EstimateDataDetail_Index1 ON EstimateDataDetail;
46
DROP INDEX HolidayCalender_Index1 ON HolidayCalenderMaster;
47
DROP INDEX HolidayCalenderMaster_Index2 ON HolidayCalenderMaster;
48
DROP INDEX HolidayCalenderMaster_Index3 ON HolidayCalenderMaster;
49
DROP INDEX InputSearchLogData_Index1 ON InputSearchLogData;
50
DROP INDEX MessageBoardData_Index1 ON MessageBoardData;
51
DROP INDEX MessageBoardData_Index2 ON MessageBoardData;
52
DROP INDEX MessageBoardTerget_Index1 ON MessageBoardTerget;
53
DROP INDEX PersonDepartmentMaster_Index1 ON PersonDepartmentMaster;
54
DROP INDEX PersonDepartmentMaster_Index2 ON PersonDepartmentMaster;
55
DROP INDEX PersonInChargeMaster_Index1 ON PersonInChargeMaster;
56
DROP INDEX PersonInChargeMaster_Index2 ON PersonInChargeMaster;
57
DROP INDEX PersonSalaryMaster_Index1 ON PersonSalaryMaster;
58
DROP INDEX PersonSalaryMaster_Index2 ON PersonSalaryMaster;
59
DROP INDEX ProcessExcuteMaster_Index1 ON ProcessExcuteMaster;
60
DROP INDEX ProcessExcuteMaster_Index2 ON ProcessExcuteMaster;
61
DROP INDEX POrderDetail_Index1 ON PurchaseOrderDetail;
62
DROP INDEX SalesGraphData_Idx1 ON SalesGraphData;
63
DROP INDEX SalesGraphData_idx2 ON SalesGraphData;
64
DROP INDEX SecurityMaster_Index1 ON SecurityMaster;
65
DROP INDEX SecurityMaster_Index2 ON SecurityMaster;
66
DROP INDEX SecurityMaster_Index3 ON SecurityMaster;
67
DROP INDEX SubContractorJobItem_Index1 ON SubContractorJobItem;
68
DROP INDEX SubContractorJobItem_Index2 ON SubContractorJobItem;
69
DROP INDEX SubContractorJobLink_Index1 ON SubContractorJobLink;
70
DROP INDEX SubContractorJobLink_Index2 ON SubContractorJobLink;
71
DROP INDEX SubContractorMaster_Index1 ON SubContractorMaster;
72
DROP INDEX TermMaster_Index1 ON TermMaster;
73
DROP INDEX TranceportDailyData_Index1 ON TranceportDailyData;
74
DROP INDEX UnitMaster_Index1 ON UnitMaster;
75
DROP INDEX VehicleScheduleData_Index1 ON VehicleScheduleData;
76
DROP INDEX VehicleScheduleData_Index2 ON VehicleScheduleData;
77
DROP INDEX VehicleScheduleData_Index3 ON VehicleScheduleData;
12
drop table if exists actionscheduledata cascade;
78 13

  
14
create table actionscheduledata (
15
  TargetDate date not null comment '対象日'
16
  , PersonCode decimal(8,0) not null comment '担当者コード'
17
  , ActionSchedule varchar(30) comment '行動予定'
18
  , TargetYear year(4) not null comment '該当年'
19
  , TargetMonth year(4) not null comment '該当月'
20
  , TargetDay year(4) not null comment '該当日'
21
  , EntryDate datetime not null comment '登録日付'
22
  , UpdateDate datetime not null comment '更新日付'
23
  , constraint actionscheduledata_PKC primary key (TargetDate,PersonCode)
24
) comment '担当者行動予定データ' ;
79 25

  
26
create index ActionScheduleData_Index1
27
  on actionscheduledata(TargetYear);
80 28

  
81
/* Drop Tables */
29
create index ActionScheduleData_Index2
30
  on actionscheduledata(TargetMonth);
82 31

  
83
DROP TABLE IF EXISTS ActionScheduleData;
84
DROP TABLE IF EXISTS ApprovalMaster;
85
DROP TABLE IF EXISTS AttendanceDailyData;
86
DROP TABLE IF EXISTS AttendanceData;
87
DROP TABLE IF EXISTS BK_ConstructionLedger;
88
DROP TABLE IF EXISTS BK_ConstructionLedgerDetail;
89
DROP TABLE IF EXISTS BK_ConstructionLedgerExcute;
90
DROP TABLE IF EXISTS BK_EstimateData;
91
DROP TABLE IF EXISTS BK_EstimateDataBody;
92
DROP TABLE IF EXISTS BK_EstimateDataDetail;
93
DROP TABLE IF EXISTS BusinessTypeMaster;
94
DROP TABLE IF EXISTS CommonCostLarge;
95
DROP TABLE IF EXISTS CommonCostLinkMS;
96
DROP TABLE IF EXISTS CommonCostMiddle;
97
DROP TABLE IF EXISTS CommonCostMiddleSearchWord;
98
DROP TABLE IF EXISTS ComponentLinkMaster;
99
DROP TABLE IF EXISTS ComponentMaster;
100
DROP TABLE IF EXISTS ComponentToTypeMaster;
101
DROP TABLE IF EXISTS ConstructionBaseInfo;
102
DROP TABLE IF EXISTS ConstructionBaseInfoDetail;
103
DROP TABLE IF EXISTS ConstructionBudget;
104
DROP TABLE IF EXISTS ConstructionBudgetDetail;
105
DROP TABLE IF EXISTS ConstructionItemMaster;
106
DROP TABLE IF EXISTS ConstructionLedger;
107
DROP TABLE IF EXISTS ConstructionLedgerDetail;
108
DROP TABLE IF EXISTS ConstructionLedgerExcute;
109
DROP TABLE IF EXISTS ConstructionLink;
110
DROP TABLE IF EXISTS ConstructionProgressDate;
111
DROP TABLE IF EXISTS ConstructionSpecMaster;
112
DROP TABLE IF EXISTS ConstructionSpecUnitPrice;
113
DROP TABLE IF EXISTS ConstructionTypeMaster;
114
DROP TABLE IF EXISTS CostDataOfPerson;
115
DROP TABLE IF EXISTS CostomerRegist;
116
DROP TABLE IF EXISTS DailyDataConstruction;
117
DROP TABLE IF EXISTS DailyDataDetail;
118
DROP TABLE IF EXISTS DailyDataField;
119
DROP TABLE IF EXISTS DailyDataMaterials;
120
DROP TABLE IF EXISTS DailyDataSubcontractors;
121
DROP TABLE IF EXISTS DailyDataVehicles;
122
DROP TABLE IF EXISTS DayMaster;
123
DROP TABLE IF EXISTS DepartmentExpensesMaster;
124
DROP TABLE IF EXISTS DepartmentMaster;
125
DROP TABLE IF EXISTS DivisionMaster;
126
DROP TABLE IF EXISTS EstimateBudget;
127
DROP TABLE IF EXISTS EstimateBudgetDetail;
128
DROP TABLE IF EXISTS EstimateData;
129
DROP TABLE IF EXISTS EstimateDataBody;
130
DROP TABLE IF EXISTS EstimateDataDetail;
131
DROP TABLE IF EXISTS HolidayCalenderMaster;
132
DROP TABLE IF EXISTS InputSearchLogData;
133
DROP TABLE IF EXISTS MessageBoardData;
134
DROP TABLE IF EXISTS MessageBoardTerget;
135
DROP TABLE IF EXISTS MessageBrowsingHistory;
136
DROP TABLE IF EXISTS MonthMaster;
137
DROP TABLE IF EXISTS OrderersMaster;
138
DROP TABLE IF EXISTS OrdersPriceData;
139
DROP TABLE IF EXISTS PersonApproval;
140
DROP TABLE IF EXISTS PersonApprovalComment;
141
DROP TABLE IF EXISTS PersonDepartmentMaster;
142
DROP TABLE IF EXISTS PersonInChargeMaster;
143
DROP TABLE IF EXISTS PersonSalaryMaster;
144
DROP TABLE IF EXISTS ProceedingsData;
145
DROP TABLE IF EXISTS ProceedingsDataAttend;
146
DROP TABLE IF EXISTS ProceedingsDataDetail;
147
DROP TABLE IF EXISTS ProcessApproval;
148
DROP TABLE IF EXISTS ProcessApprovalComment;
149
DROP TABLE IF EXISTS ProcessApprovalDetail;
150
DROP TABLE IF EXISTS ProcessExcuteMaster;
151
DROP TABLE IF EXISTS PurchaseOrder;
152
DROP TABLE IF EXISTS PurchaseOrderDetail;
153
DROP TABLE IF EXISTS SalesGraphData;
154
DROP TABLE IF EXISTS SecurityMaster;
155
DROP TABLE IF EXISTS SubConstrJobItemRegist;
156
DROP TABLE IF EXISTS SubConstrJobLinkRegist;
157
DROP TABLE IF EXISTS SubConstrRegist;
158
DROP TABLE IF EXISTS SubContractorItemMaster;
159
DROP TABLE IF EXISTS SubContractorJobCategory;
160
DROP TABLE IF EXISTS SubContractorJobItem;
161
DROP TABLE IF EXISTS SubContractorJobLink;
162
DROP TABLE IF EXISTS SubContractorMaster;
163
DROP TABLE IF EXISTS SuppliersMaster;
164
DROP TABLE IF EXISTS SystemExecute;
165
DROP TABLE IF EXISTS SystemMaster;
166
DROP TABLE IF EXISTS TermMaster;
167
DROP TABLE IF EXISTS TranceportDailyData;
168
DROP TABLE IF EXISTS TypeExpensesMaster;
169
DROP TABLE IF EXISTS UnitMaster;
170
DROP TABLE IF EXISTS VehicleMaster;
171
DROP TABLE IF EXISTS VehicleRecordData;
172
DROP TABLE IF EXISTS VehicleScheduleData;
173
DROP TABLE IF EXISTS YearMaster;
32
create index ActionScheduleData_Index3
33
  on actionscheduledata(TargetDay);
174 34

  
35
-- 承認経路マスタ
36
drop table if exists approvalmaster cascade;
175 37

  
38
create table approvalmaster (
39
  ApprovalCode decimal(3,0) unsigned not null comment '承認機能番号'
40
  , DepartmentCode decimal(5,0) unsigned not null comment '部署コード'
41
  , SeqNo decimal(2,0) not null comment '枝番'
42
  , DisplayOrder decimal(2,0) not null comment '表示順'
43
  , ApprovalPerson decimal(8,0) unsigned not null comment '承認者コード'
44
  , ApprovalAuthority decimal(1,0) not null comment '承認権限区分'
45
  , EntryDate datetime not null comment '登録日付'
46
  , UpdateDate datetime not null comment '更新日付'
47
  , constraint approvalmaster_PKC primary key (ApprovalCode,DepartmentCode,SeqNo)
48
) comment '承認経路マスタ' ;
176 49

  
50
-- 出勤日報データ
51
drop index AttendDaily_Index1 on attendancedailydata;
52
drop index AttendDaily_Index2 on attendancedailydata;
177 53

  
178
/* Create Tables */
54
drop table if exists attendancedailydata cascade;
179 55

  
180
-- 担当者行動予定データ
181
CREATE TABLE ActionScheduleData
182
(
183
	TargetDate date NOT NULL COMMENT '対象日',
184
	PersonCode decimal(8,0) NOT NULL COMMENT '担当者コード',
185
	ActionSchedule varchar(30) COMMENT '行動予定',
186
	TargetYear year(4) NOT NULL COMMENT '該当年',
187
	TargetMonth year(2) NOT NULL COMMENT '該当月',
188
	TargetDay year(2) NOT NULL COMMENT '該当日',
189
	EntryDate datetime NOT NULL COMMENT '登録日付',
190
	UpdateDate datetime NOT NULL COMMENT '更新日付',
191
	PRIMARY KEY (TargetDate, PersonCode)
192
) COMMENT = '担当者行動予定データ';
56
create table attendancedailydata (
57
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
58
  , AttendanceDate date not null comment '日報作成日'
59
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
60
  , ActionResult varchar(30) not null comment '行動実績'
61
  , OvertimeHours decimal(4,1) not null comment '残業時間'
62
  , WorkingComment varchar(120) comment 'コメント'
63
  , EntryDate datetime not null comment '登録日付'
64
  , UpdateDate datetime not null comment '更新日付'
65
  , constraint attendancedailydata_PKC primary key (PersonCode,AttendanceDate,SeqNo)
66
) comment '出勤日報データ' ;
193 67

  
68
create index AttendDaily_Index1
69
  on attendancedailydata(ActionResult);
194 70

  
195
-- 承認経路マスタ
196
CREATE TABLE ApprovalMaster
197
(
198
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
199
	DepartmentCode decimal(5,0) unsigned NOT NULL COMMENT '部署コード',
200
	SeqNo decimal(2) NOT NULL COMMENT '枝番',
201
	DisplayOrder decimal(2) NOT NULL COMMENT '表示順',
202
	ApprovalPerson decimal(8) unsigned NOT NULL COMMENT '承認者コード',
203
	ApprovalAuthority decimal(1) NOT NULL COMMENT '承認権限区分',
204
	EntryDate datetime NOT NULL COMMENT '登録日付',
205
	UpdateDate datetime NOT NULL COMMENT '更新日付',
206
	PRIMARY KEY (ApprovalCode, DepartmentCode, SeqNo)
207
) COMMENT = '承認経路マスタ';
71
create index AttendDaily_Index2
72
  on attendancedailydata(AttendanceDate);
208 73

  
74
-- 出勤管理データ
75
drop table if exists attendancedata cascade;
209 76

  
210
-- 出勤日報データ
211
CREATE TABLE AttendanceDailyData
212
(
213
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
214
	AttendanceDate date NOT NULL COMMENT '日報作成日',
215
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
216
	ActionResult varchar(30) NOT NULL COMMENT '行動実績',
217
	OvertimeHours decimal(4,1) NOT NULL COMMENT '残業時間',
218
	WorkingComment varchar(120) COMMENT 'コメント',
219
	EntryDate datetime NOT NULL COMMENT '登録日付',
220
	UpdateDate datetime NOT NULL COMMENT '更新日付',
221
	PRIMARY KEY (PersonCode, AttendanceDate, SeqNo)
222
) COMMENT = '出勤日報データ';
77
create table attendancedata (
78
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
79
  , AttendanceMonth date not null comment '出勤管理年月'
80
  , LastDays decimal(2,0) unsigned not null comment '当月最終日'
81
  , AttendDayCount decimal(2,0) unsigned not null comment '出勤日数'
82
  , TotalOverTimes decimal(4,1) not null comment '残業時間数'
83
  , OrderDate date not null comment '申請日'
84
  , OrderNo decimal(2,0) unsigned not null comment '申請受付番号'
85
  , EntryDate datetime not null comment '登録日付'
86
  , UpdateDate datetime not null comment '更新日付'
87
  , constraint attendancedata_PKC primary key (PersonCode,AttendanceMonth)
88
) comment '出勤管理データ' ;
223 89

  
90
-- 銀行営業日マスタ
91
drop table if exists bankbusinessdaymaster cascade;
224 92

  
225
-- 出勤管理データ
226
CREATE TABLE AttendanceData
227
(
228
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
229
	AttendanceMonth date NOT NULL COMMENT '出勤管理年月',
230
	LastDays decimal(2) unsigned NOT NULL COMMENT '当月最終日',
231
	AttendDayCount decimal(2) unsigned NOT NULL COMMENT '出勤日数',
232
	TotalOverTimes decimal(4,1) NOT NULL COMMENT '残業時間数',
233
	OrderDate date NOT NULL COMMENT '申請日',
234
	OrderNo decimal(2) unsigned NOT NULL COMMENT '申請受付番号',
235
	EntryDate datetime NOT NULL COMMENT '登録日付',
236
	UpdateDate datetime NOT NULL COMMENT '更新日付',
237
	PRIMARY KEY (PersonCode, AttendanceMonth)
238
) COMMENT = '出勤管理データ';
93
create table bankbusinessdaymaster (
94
  YEARMONTH decimal(6,0) default '0' not null comment '年月'
95
  , BANKBUSINESSDAY decimal(2,0) default '0' not null comment '銀行営業日'
96
  , NOTE varchar(120) comment '備考'
97
  , DELETEFLG decimal(1,0) comment '削除フラグ'
98
  , ENTRYDATE datetime comment '登録年月日'
99
  , UPDATEDATE datetime comment '更新年月日'
100
  , constraint bankbusinessdaymaster_PKC primary key (YEARMONTH,BANKBUSINESSDAY)
101
) comment '銀行営業日マスタ' ;
239 102

  
103
-- 業者請求データ
104
drop table if exists billingdata cascade;
240 105

  
106
create table billingdata (
107
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
108
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
109
  , SEQNO decimal(3,0) default '0' not null comment '連番'
110
  , BILLPRICE decimal(10,0) comment '請求金額'
111
  , ENTRYDATE datetime comment '登録年月日'
112
  , UPDATEDATE datetime comment '更新年月日'
113
  , constraint billingdata_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO)
114
) comment '業者請求データ' ;
115

  
116
-- 業者請求明細データ
117
drop table if exists billingdatadetail cascade;
118

  
119
create table billingdatadetail (
120
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
121
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
122
  , SEQNO decimal(3,0) default '0' not null comment '連番'
123
  , LINECOUNT decimal(3,0) default '0' not null comment '行番号'
124
  , CONSTRUCTIONCODE decimal(10,0) comment '工事番号'
125
  , FIELDNAME varchar(120) comment '現場名'
126
  , BILLPRICE decimal(10,0) comment '請求金額'
127
  , HIGHWPRICE decimal(10,0) comment '高速代'
128
  , HARDWPRICE decimal(10,0) comment '金物代'
129
  , INDSWASTETAX decimal(10,0) comment '産廃税'
130
  , NOTE varchar(120) comment '備考'
131
  , ENTRYDATE datetime comment '登録年月日'
132
  , UPDATEDATE datetime comment '更新年月日'
133
  , constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT)
134
) comment '業者請求明細データ' ;
135

  
136
-- 業者請求支払サマリーデータ
137
drop table if exists billingpaymentsummary cascade;
138

  
139
create table billingpaymentsummary (
140
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
141
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
142
  , CHARGEPAYMENTKIND decimal(1,0) default '0' not null comment '請求支払区分'
143
  , PAYDAY date comment '支払日'
144
  , BILLPRICESTOTAL decimal(10,0) comment '請求金額小計'
145
  , CONSUMPTIONTAXRATE decimal(6,3) comment '消費税率'
146
  , CONSUMPTIONTAXPRICE decimal(10,0) comment '消費税額'
147
  , HIGHWPRICESTOTAL decimal(10,0) comment '高速代小計'
148
  , HARDWPRICESTOTAL decimal(10,0) comment '金物代小計'
149
  , INDSWASTETAXSTOTAL decimal(10,0) comment '産廃税小計'
150
  , CNSTRPRICERATE decimal(6,3) comment '協力金比率'
151
  , CNSTRPRICESTOTAL decimal(10,0) comment '協力金小計'
152
  , BILLINGPRICETOTAL decimal(10,0) comment '請求金額合計'
153
  , ENTRYDATE datetime comment '登録年月日'
154
  , UPDATEDATE datetime comment '更新年月日'
155
  , constraint billingpaymentsummary_PKC primary key (COMPANYCODE,TARGETDATE,CHARGEPAYMENTKIND)
156
) comment '業者請求支払サマリーデータ' ;
157

  
241 158
-- 工事詳細台帳データ【退避用】
242
CREATE TABLE BK_ConstructionLedger
243
(
244
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
245
	ConstructionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
246
	CreatorCode decimal(8,0) COMMENT '作成者コード',
247
	CreatorName varchar(60) COMMENT '作成者名',
248
	CreateDate date NOT NULL COMMENT '作成日',
249
	ConstructionTimes decimal(5,2) NOT NULL COMMENT '工期(単位・月)',
250
	ConstructionStart date NOT NULL COMMENT '契約工期開始',
251
	ConstructionEnd date NOT NULL COMMENT '契約工期完了',
252
	OrdersDecisionPrice decimal(14,0) NOT NULL COMMENT '税抜受注決定金額',
253
	CompanyExpenses decimal(10,0) NOT NULL COMMENT '会社経費合計',
254
	DepartmentExpenses decimal(10,0) NOT NULL COMMENT '部署経費合計',
255
	SalesExpenses decimal(10,0) NOT NULL COMMENT '営業経費合計',
256
	TotalPayment decimal(10,0) NOT NULL COMMENT '総支払額',
257
	GrossProfit decimal(10,0) NOT NULL COMMENT '粗利',
258
	Allowance decimal(10,0) NOT NULL COMMENT '給与',
259
	NetProfit decimal(10,0) NOT NULL COMMENT '純利益',
260
	ComplateFlg decimal(1) NOT NULL COMMENT '入力完了フラグ',
261
	IntegrationFlg decimal(1) NOT NULL COMMENT '受注金額積算フラグ',
262
	EntryDate datetime NOT NULL COMMENT '登録日付',
263
	UpdateDate datetime NOT NULL COMMENT '更新日付',
264
	PRIMARY KEY (ConstructionCode)
265
) COMMENT = '工事詳細台帳データ【退避用】';
159
drop table if exists bk_constructionledger cascade;
266 160

  
161
create table bk_constructionledger (
162
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
163
  , ConstructionPeriod decimal(4,0) unsigned not null comment '事業期'
164
  , CreatorCode decimal(8,0) comment '作成者コード'
165
  , CreatorName varchar(60) comment '作成者名'
166
  , CreateDate date not null comment '作成日'
167
  , ConstructionTimes decimal(5,2) not null comment '工期(単位・月)'
168
  , ConstructionStart date not null comment '契約工期開始'
169
  , ConstructionEnd date not null comment '契約工期完了'
170
  , OrdersDecisionPrice decimal(14,0) not null comment '税抜受注決定金額'
171
  , CompanyExpenses decimal(10,0) not null comment '会社経費合計'
172
  , DepartmentExpenses decimal(10,0) not null comment '部署経費合計'
173
  , SalesExpenses decimal(10,0) not null comment '営業経費合計'
174
  , TotalPayment decimal(10,0) not null comment '総支払額'
175
  , GrossProfit decimal(10,0) not null comment '粗利'
176
  , Allowance decimal(10,0) not null comment '給与'
177
  , NetProfit decimal(10,0) not null comment '純利益'
178
  , ComplateFlg decimal(1,0) not null comment '入力完了フラグ'
179
  , IntegrationFlg decimal(1,0) not null comment '受注金額積算フラグ'
180
  , EntryDate datetime not null comment '登録日付'
181
  , UpdateDate datetime not null comment '更新日付'
182
  , constraint bk_constructionledger_PKC primary key (ConstructionCode)
183
) comment '工事詳細台帳データ【退避用】' ;
267 184

  
268 185
-- 工事詳細台帳明細データ【退避用】
269
CREATE TABLE BK_ConstructionLedgerDetail
270
(
271
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
272
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
273
	LineCount decimal(5) unsigned NOT NULL COMMENT '行番号',
274
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
275
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
276
	FirstString varchar(120) COMMENT '項目名称',
277
	SecondString varchar(120) COMMENT '工事内容',
278
	CompanyType decimal(1) NOT NULL COMMENT '協力会社コードタイプ',
279
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
280
	CompanyName varchar(120) COMMENT '協力会社名称',
281
	EstimatePrice decimal(12,0) NOT NULL COMMENT '予算(見積)金額',
282
	ExecutionAmount decimal(12,0) NOT NULL COMMENT '実行金額',
283
	AmountConfigRate decimal(5,2) NOT NULL COMMENT '金額構成率',
284
	PaymentBurden decimal(12,0) NOT NULL COMMENT '支払補填額',
285
	FixDataFlg decimal(1) NOT NULL COMMENT '固定データフラグ',
286
	IndependentFlg decimal(1) NOT NULL COMMENT '独立データフラグ',
287
	FluctuationFlg decimal(1) NOT NULL COMMENT '増減データフラグ',
288
	SalaryFlg decimal(1) NOT NULL COMMENT '給与振分区分',
289
	SalaryDays decimal(4) NOT NULL COMMENT '給与振分日数',
290
	OperatingFlg decimal(1) NOT NULL COMMENT '担当中フラグ',
291
	SourceCode decimal(10) unsigned NOT NULL COMMENT '元工事番号',
292
	JoinTitleFlg decimal(1) NOT NULL COMMENT '工事名称タイトル',
293
	SalaryOnRegist decimal(12,0) NOT NULL COMMENT '登録時月額給与',
294
	PurchaseOrderFlg decimal(2) NOT NULL COMMENT '注文書発行フラグ',
295
	EntryDate datetime NOT NULL COMMENT '登録日付',
296
	UpdateDate datetime NOT NULL COMMENT '更新日付',
297
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
298
) COMMENT = '工事詳細台帳明細データ【退避用】';
186
drop table if exists bk_constructionledgerdetail cascade;
299 187

  
188
create table bk_constructionledgerdetail (
189
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
190
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
191
  , LineCount decimal(5,0) unsigned not null comment '行番号'
192
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
193
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
194
  , FirstString varchar(120) comment '項目名称'
195
  , SecondString varchar(120) comment '工事内容'
196
  , CompanyType decimal(1,0) not null comment '協力会社コードタイプ'
197
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
198
  , CompanyName varchar(120) comment '協力会社名称'
199
  , EstimatePrice decimal(12,0) not null comment '予算(見積)金額'
200
  , ExecutionAmount decimal(12,0) not null comment '実行金額'
201
  , AmountConfigRate decimal(5,2) not null comment '金額構成率'
202
  , PaymentBurden decimal(12,0) not null comment '支払補填額'
203
  , FixDataFlg decimal(1,0) not null comment '固定データフラグ'
204
  , IndependentFlg decimal(1,0) not null comment '独立データフラグ'
205
  , FluctuationFlg decimal(1,0) not null comment '増減データフラグ'
206
  , SalaryFlg decimal(1,0) not null comment '給与振分区分'
207
  , SalaryDays decimal(4,0) not null comment '給与振分日数'
208
  , OperatingFlg decimal(1,0) not null comment '担当中フラグ'
209
  , SourceCode decimal(10,0) unsigned not null comment '元工事番号'
210
  , JoinTitleFlg decimal(1,0) not null comment '工事名称タイトル'
211
  , SalaryOnRegist decimal(12,0) not null comment '登録時月額給与'
212
  , PurchaseOrderFlg decimal(2,0) not null comment '注文書発行フラグ'
213
  , EntryDate datetime not null comment '登録日付'
214
  , UpdateDate datetime not null comment '更新日付'
215
  , constraint bk_constructionledgerdetail_PKC primary key (ConstructionCode,GroupCount,LineCount)
216
) comment '工事詳細台帳明細データ【退避用】' ;
300 217

  
301 218
-- 工事詳細台帳実行データ【退避用】
302
CREATE TABLE BK_ConstructionLedgerExcute
303
(
304
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
305
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
306
	LineCount decimal(5) unsigned NOT NULL COMMENT '行番号',
307
	ColumnCount decimal(3) NOT NULL COMMENT '列番号',
308
	PaymentAmount decimal(12,0) NOT NULL COMMENT '支払金額',
309
	TargetMonth date NOT NULL COMMENT '対象年月',
310
	EntryDate datetime NOT NULL COMMENT '登録日付',
311
	UpdateDate datetime NOT NULL COMMENT '更新日付',
312
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount, ColumnCount)
313
) COMMENT = '工事詳細台帳実行データ【退避用】';
219
drop table if exists bk_constructionledgerexcute cascade;
314 220

  
221
create table bk_constructionledgerexcute (
222
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
223
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
224
  , LineCount decimal(5,0) unsigned not null comment '行番号'
225
  , ColumnCount decimal(3,0) not null comment '列番号'
226
  , PaymentAmount decimal(12,0) not null comment '支払金額'
227
  , TargetMonth date not null comment '対象年月'
228
  , EntryDate datetime not null comment '登録日付'
229
  , UpdateDate datetime not null comment '更新日付'
230
  , constraint bk_constructionledgerexcute_PKC primary key (ConstructionCode,GroupCount,LineCount,ColumnCount)
231
) comment '工事詳細台帳実行データ【退避用】' ;
315 232

  
316 233
-- 積算見積データ【退避用】
317
CREATE TABLE BK_EstimateData
318
(
319
	SaveDate datetime NOT NULL COMMENT '退避日付',
320
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
321
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
322
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
323
	FixedItemCode varchar(1) COMMENT '固定項目キー',
324
	ItemName varchar(120) COMMENT '作業名称',
325
	SpecName varchar(120) COMMENT '作業/品質・形状・寸法',
326
	PriceValue decimal(14,0) NOT NULL COMMENT '金額',
327
	note varchar(60) COMMENT '備考',
328
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
329
	InputFlg decimal(1) NOT NULL COMMENT '入力フラグ',
330
	EntryDate datetime NOT NULL COMMENT '登録日付',
331
	UpdateDate datetime NOT NULL COMMENT '更新日付',
332
	PRIMARY KEY (SaveDate, ConstructionCode, LineCount)
333
) COMMENT = '積算見積データ【退避用】';
234
drop table if exists bk_estimatedata cascade;
334 235

  
236
create table bk_estimatedata (
237
  SaveDate datetime not null comment '退避日付'
238
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
239
  , LineCount decimal(3,0) unsigned not null comment '行番号'
240
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
241
  , FixedItemCode varchar(1) comment '固定項目キー'
242
  , ItemName varchar(120) comment '作業名称'
243
  , SpecName varchar(120) comment '作業/品質・形状・寸法'
244
  , PriceValue decimal(14,0) not null comment '金額'
245
  , note varchar(60) comment '備考'
246
  , MyExpensesFlg decimal(1,0) not null comment '自社経費フラグ'
247
  , InputFlg decimal(1,0) not null comment '入力フラグ'
248
  , EntryDate datetime not null comment '登録日付'
249
  , UpdateDate datetime not null comment '更新日付'
250
  , constraint bk_estimatedata_PKC primary key (SaveDate,ConstructionCode,LineCount)
251
) comment '積算見積データ【退避用】' ;
335 252

  
336 253
-- 積算見積ページデータ【退避用】
337
CREATE TABLE BK_EstimateDataBody
338
(
339
	SaveDate datetime NOT NULL COMMENT '退避日付',
340
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
341
	PageCount decimal(4) unsigned NOT NULL COMMENT 'ページ番号',
342
	Category decimal(1) NOT NULL COMMENT 'ページ区分',
343
	UnionComponentCode decimal(5) unsigned NOT NULL COMMENT '所属構成キー',
344
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
345
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
346
	SelectComponent decimal(5) unsigned NOT NULL COMMENT '選択構成キー',
347
	PageTitle varchar(120) NOT NULL COMMENT 'ページ表示名',
348
	DetailLineCount decimal(3) unsigned NOT NULL COMMENT '明細行番号',
349
	EntryDate datetime NOT NULL COMMENT '登録日付',
350
	UpdateDate datetime NOT NULL COMMENT '更新日付',
351
	PRIMARY KEY (SaveDate, ConstructionCode, PageCount)
352
) COMMENT = '積算見積ページデータ【退避用】';
254
drop table if exists bk_estimatedatabody cascade;
353 255

  
256
create table bk_estimatedatabody (
257
  SaveDate datetime not null comment '退避日付'
258
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
259
  , PageCount decimal(4,0) unsigned not null comment 'ページ番号'
260
  , Category decimal(1,0) not null comment 'ページ区分'
261
  , UnionComponentCode decimal(5,0) unsigned not null comment '所属構成キー'
262
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
263
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
264
  , SelectComponent decimal(5,0) unsigned not null comment '選択構成キー'
265
  , PageTitle varchar(120) not null comment 'ページ表示名'
266
  , DetailLineCount decimal(3,0) unsigned not null comment '明細行番号'
267
  , EntryDate datetime not null comment '登録日付'
268
  , UpdateDate datetime not null comment '更新日付'
269
  , constraint bk_estimatedatabody_PKC primary key (SaveDate,ConstructionCode,PageCount)
270
) comment '積算見積ページデータ【退避用】' ;
354 271

  
355 272
-- 積算見積データ明細【退避用】
356
CREATE TABLE BK_EstimateDataDetail
357
(
358
	SaveDate datetime NOT NULL COMMENT '退避日付',
359
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
360
	PageCount decimal(4) unsigned NOT NULL COMMENT 'ページ番号',
361
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
362
	DataType decimal(1) NOT NULL COMMENT 'データ種別',
363
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
364
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
365
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
366
	ItemName varchar(120) COMMENT '作業名称',
367
	SpecName varchar(120) COMMENT '作業/品質・形状・寸法',
368
	Unitcount decimal(8,2) NOT NULL COMMENT '数量',
369
	UnitName varchar(30) COMMENT '単位名称',
370
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
371
	LineTotal decimal(12,0) NOT NULL COMMENT '金額',
372
	note varchar(60) COMMENT '備考',
373
	CompanyCode decimal(8) NOT NULL COMMENT '協力会社コード',
374
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
375
	InputFlg decimal(1) COMMENT '入力フラグ',
376
	EntryDate datetime NOT NULL COMMENT '登録日付',
377
	UpdateDate datetime NOT NULL COMMENT '更新日付',
378
	PRIMARY KEY (SaveDate, ConstructionCode, PageCount, LineCount)
379
) COMMENT = '積算見積データ明細【退避用】';
273
drop table if exists bk_estimatedatadetail cascade;
380 274

  
275
create table bk_estimatedatadetail (
276
  SaveDate datetime not null comment '退避日付'
277
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
278
  , PageCount decimal(4,0) unsigned not null comment 'ページ番号'
279
  , LineCount decimal(3,0) unsigned not null comment '行番号'
280
  , DataType decimal(1,0) not null comment 'データ種別'
281
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
282
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
283
  , SpecCode decimal(5,0) unsigned not null comment '作業キー'
284
  , ItemName varchar(120) comment '作業名称'
285
  , SpecName varchar(120) comment '作業/品質・形状・寸法'
286
  , Unitcount decimal(8,2) not null comment '数量'
287
  , UnitName varchar(30) comment '単位名称'
288
  , UnitPrice decimal(9,2) not null comment '単価'
289
  , LineTotal decimal(12,0) not null comment '金額'
290
  , note varchar(60) comment '備考'
291
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
292
  , MyExpensesFlg decimal(1,0) not null comment '自社経費フラグ'
293
  , InputFlg decimal(1,0) comment '入力フラグ'
294
  , EntryDate datetime not null comment '登録日付'
295
  , UpdateDate datetime not null comment '更新日付'
296
  , constraint bk_estimatedatadetail_PKC primary key (SaveDate,ConstructionCode,PageCount,LineCount)
297
) comment '積算見積データ明細【退避用】' ;
381 298

  
382 299
-- 法人格マスタ
383
CREATE TABLE BusinessTypeMaster
384
(
385
	BusinessTypeCode decimal(5,0) unsigned NOT NULL COMMENT '法人格コード',
386
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
387
	BusinessTypeName varchar(100) DEFAULT '' NOT NULL COMMENT '業種名',
388
	EntryDate datetime NOT NULL COMMENT '登録日付',
389
	UpdateDate datetime NOT NULL COMMENT '更新日付',
390
	PRIMARY KEY (BusinessTypeCode)
391
) COMMENT = '法人格マスタ';
300
drop index BusinessTypeMaster_Index1 on businesstypemaster;
392 301

  
302
drop table if exists businesstypemaster cascade;
393 303

  
304
create table businesstypemaster (
305
  BusinessTypeCode decimal(5,0) unsigned not null comment '法人格コード'
306
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
307
  , BusinessTypeName varchar(100) not null comment '業種名'
308
  , EntryDate datetime not null comment '登録日付'
309
  , UpdateDate datetime not null comment '更新日付'
310
  , constraint businesstypemaster_PKC primary key (BusinessTypeCode)
311
) comment '法人格マスタ' ;
312

  
313
create index BusinessTypeMaster_Index1
314
  on businesstypemaster(DisplayOrder);
315

  
394 316
-- 共通費大項目マスタ
395
CREATE TABLE CommonCostLarge
396
(
397
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
398
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
399
	LargeName varchar(50) DEFAULT '' NOT NULL COMMENT '大項目名称',
400
	CommentText varchar(120) COMMENT '説明書き',
401
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
402
	EntryDate datetime NOT NULL COMMENT '登録日付',
403
	UpdateDate datetime NOT NULL COMMENT '更新日付',
404
	PRIMARY KEY (LargeCode)
405
) COMMENT = '共通費大項目マスタ';
317
drop table if exists commoncostlarge cascade;
406 318

  
319
create table commoncostlarge (
320
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
321
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
322
  , LargeName varchar(50) not null comment '大項目名称'
323
  , CommentText varchar(120) comment '説明書き'
324
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
325
  , EntryDate datetime not null comment '登録日付'
326
  , UpdateDate datetime not null comment '更新日付'
327
  , constraint commoncostlarge_PKC primary key (LargeCode)
328
) comment '共通費大項目マスタ' ;
407 329

  
408 330
-- 共通費工種関連マスタ
409
CREATE TABLE CommonCostLinkMS
410
(
411
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
412
	MiddleCode decimal(5,0) unsigned NOT NULL COMMENT '中項目キー',
413
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
414
	EntryDate datetime COMMENT '登録日付',
415
	UpdateDate datetime COMMENT '更新日付',
416
	PRIMARY KEY (LargeCode, MiddleCode, ItemCode)
417
) COMMENT = '共通費工種関連マスタ';
331
drop table if exists commoncostlinkms cascade;
418 332

  
333
create table commoncostlinkms (
334
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
335
  , MiddleCode decimal(5,0) unsigned not null comment '中項目キー'
336
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
337
  , EntryDate datetime comment '登録日付'
338
  , UpdateDate datetime comment '更新日付'
339
  , constraint commoncostlinkms_PKC primary key (LargeCode,MiddleCode,ItemCode)
340
) comment '共通費工種関連マスタ' ;
419 341

  
420 342
-- 共通費中項目マスタ
421
CREATE TABLE CommonCostMiddle
422
(
423
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
424
	MiddleCode decimal(5,0) unsigned NOT NULL COMMENT '中項目キー',
425
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
426
	MiddleName varchar(50) DEFAULT '' NOT NULL COMMENT '中項目名称',
427
	CommentText varchar(120) COMMENT '説明書き',
428
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
429
	EntryDate datetime NOT NULL COMMENT '登録日付',
430
	UpdateDate datetime NOT NULL COMMENT '更新日付',
431
	PRIMARY KEY (LargeCode, MiddleCode)
432
) COMMENT = '共通費中項目マスタ';
343
drop table if exists commoncostmiddle cascade;
433 344

  
345
create table commoncostmiddle (
346
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
347
  , MiddleCode decimal(5,0) unsigned not null comment '中項目キー'
348
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
349
  , MiddleName varchar(50) not null comment '中項目名称'
350
  , CommentText varchar(120) comment '説明書き'
351
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
352
  , EntryDate datetime not null comment '登録日付'
353
  , UpdateDate datetime not null comment '更新日付'
354
  , constraint commoncostmiddle_PKC primary key (LargeCode,MiddleCode)
355
) comment '共通費中項目マスタ' ;
434 356

  
435 357
-- 共通費中項目キーマスタ
436
CREATE TABLE CommonCostMiddleSearchWord
437
(
438
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
439
	MiddleCode decimal(5,0) unsigned NOT NULL COMMENT '中項目キー',
440
	SeqNo decimal(5) unsigned NOT NULL COMMENT '順序',
441
	SearchWord varchar(50) DEFAULT '' NOT NULL COMMENT '検索項目',
442
	EntryDate datetime NOT NULL COMMENT '登録日付',
443
	UpdateDate datetime NOT NULL COMMENT '更新日付',
444
	PRIMARY KEY (LargeCode, MiddleCode, SeqNo)
445
) COMMENT = '共通費中項目キーマスタ';
358
drop table if exists commoncostmiddlesearchword cascade;
446 359

  
360
create table commoncostmiddlesearchword (
361
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
362
  , MiddleCode decimal(5,0) unsigned not null comment '中項目キー'
363
  , SeqNo decimal(5,0) unsigned not null comment '順序'
364
  , SearchWord varchar(50) not null comment '検索項目'
365
  , EntryDate datetime not null comment '登録日付'
366
  , UpdateDate datetime not null comment '更新日付'
367
  , constraint commoncostmiddlesearchword_PKC primary key (LargeCode,MiddleCode,SeqNo)
368
) comment '共通費中項目キーマスタ' ;
447 369

  
448 370
-- 構成工種関連マスタ
449
CREATE TABLE ComponentLinkMaster
450
(
451
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
452
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
453
	DisplayOrder decimal(5) unsigned COMMENT '表示順',
454
	EntryDate datetime NOT NULL COMMENT '登録日付',
455
	UpdateDate datetime NOT NULL COMMENT '更新日付',
456
	PRIMARY KEY (ComponentCode, ItemCode)
457
) COMMENT = '構成工種関連マスタ';
371
drop index ComponentLinkMaster_Index1 on componentlinkmaster;
372
drop index ComponentLinkMaster_Index2 on componentlinkmaster;
458 373

  
374
drop table if exists componentlinkmaster cascade;
459 375

  
460
-- 構成マスタ
461
CREATE TABLE ComponentMaster
462
(
463
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
464
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
465
	ComponentName varchar(120) DEFAULT '' NOT NULL COMMENT '構成名称',
466
	SubItemsFlg decimal(1) COMMENT '下位項目フラグ',
467
	DirectInputFlg decimal(1) COMMENT '直接入力フラグ',
468
	MyExpensesFlg decimal(1) COMMENT '自社経費フラグ',
469
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
470
	EntryDate datetime NOT NULL COMMENT '登録日付',
471
	UpdateDate datetime NOT NULL COMMENT '更新日付',
472
	PRIMARY KEY (ComponentCode)
473
) COMMENT = '構成マスタ';
376
create table componentlinkmaster (
377
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
378
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
379
  , DisplayOrder decimal(5,0) unsigned comment '表示順'
380
  , EntryDate datetime not null comment '登録日付'
381
  , UpdateDate datetime not null comment '更新日付'
382
  , constraint componentlinkmaster_PKC primary key (ComponentCode,ItemCode)
383
) comment '構成工種関連マスタ' ;
474 384

  
385
create index ComponentLinkMaster_Index1
386
  on componentlinkmaster(ComponentCode);
475 387

  
476
-- 構成工事種別関連マスタ
477
CREATE TABLE ComponentToTypeMaster
478
(
479
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
480
	TypeCode decimal(5,0) unsigned NOT NULL COMMENT '工事種別コード',
481
	Dummy decimal(1) NOT NULL COMMENT 'ダミー項目',
482
	EntryDate datetime NOT NULL COMMENT '登録日付',
483
	UpdateDate datetime NOT NULL COMMENT '更新日付',
484
	PRIMARY KEY (ComponentCode, TypeCode)
485
) COMMENT = '構成工事種別関連マスタ';
388
create index ComponentLinkMaster_Index2
389
  on componentlinkmaster(ItemCode);
486 390

  
391
-- 構成マスタ
392
drop index ComponentMaster_Index1 on componentmaster;
487 393

  
488
-- 工事基本情報
489
CREATE TABLE ConstructionBaseInfo
490
(
491
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
492
	TyingFlg decimal(1) NOT NULL COMMENT '紐付データフラグ',
493
	JoinFlg decimal(1) NOT NULL COMMENT '結合契約工事フラグ',
494
	ConstructionYear smallint unsigned NOT NULL COMMENT '工事年度',
495
	ConstructionPeriod smallint unsigned NOT NULL COMMENT '工事期数',
496
	RequestedDate date COMMENT '依頼受け日',
497
	EstimatesSubmitDeadline date COMMENT '見積提出期限',
498
	EstimatesSubmittedDate date COMMENT '見積提出日',
499
	ProvisionalOrderDate date COMMENT '仮受注日',
500
	OrderDate date COMMENT '受注日',
501
	OrderStartingDate date COMMENT '開始予定日',
502
	OrderCompletionDate date COMMENT '完了予定日',
503
	PreparationStartDate date COMMENT '施工準備開始日',
504
	ConstructionStartingDate date COMMENT '施工開始日',
505
	ConstructionCompletionDate date COMMENT '施工完了日',
506
	NonOrderDate date COMMENT '非受注日',
507
	OrdersDecisionPrice decimal(12,0) NOT NULL COMMENT '税抜受注決定金額',
508
	OrdersDecisionPriceInTax decimal(12,0) NOT NULL COMMENT '税込受注決定金額',
509
	SalesPersonCode decimal(8,0) COMMENT '営業担当者名',
510
	ConstructionPersonCode decimal(8,0) NOT NULL COMMENT '工事担当者',
511
	ConstrSubPersonCode decimal(8,0) NOT NULL COMMENT '工事副担当者',
512
	ConstructionInstructor decimal(8,0) NOT NULL COMMENT '工事指導員',
513
	TransferConstruction decimal(8,0) NOT NULL COMMENT '工事移管先コード',
514
	TransferConstructionDate date COMMENT '工事移管日',
515
	OrderersDivision decimal(5) NOT NULL COMMENT '発注者区分',
516
	OrderersCode decimal(5,0) unsigned NOT NULL COMMENT '発注者コード',
517
	EstimatesExpirationDate date COMMENT '見積有効期限',
518
	ConstructionPeriodStart date COMMENT '契約工期開始日',
519
	ConstructionPeriodEnd date COMMENT '契約工期完了',
520
	ConstructionPeriodStart2 date COMMENT '契約工期開始(延長時)',
521
	ConstructionPeriodEnd2 date COMMENT '契約工期完了(延長時)',
522
	StartDate date COMMENT '工事開始日',
523
	EndDate date COMMENT '工事終了日',
524
	PurchaseOrderMailingDate date COMMENT '注文書郵送日',
525
	PurchaseOrderReturnDate date COMMENT '注文書返送日',
526
	PurchaseOrderReturnCheckDate date COMMENT '注文書返送確認日',
527
	ConsumptionTaxFlg decimal(1) NOT NULL COMMENT '消費税フラグ',
528
	PrimeContractorFlg decimal(1) NOT NULL COMMENT '元請フラグ',
529
	SalesCostFlg decimal(1) NOT NULL COMMENT '営業経費発生フラグ',
530
	ConstructionStatusFlg decimal(2,0) NOT NULL COMMENT '工事状態フラグ',
531
	ConstructionType decimal(5) NOT NULL COMMENT '工事種別コード',
532
	EstimateType decimal(1) NOT NULL COMMENT '見積種別',
533
	BillingStartDate date NOT NULL COMMENT '請求準備開始日',
534
	BillingDate date NOT NULL COMMENT '請求日',
535
	BillingSplitFlg decimal(1) NOT NULL COMMENT '請求回数フラグ',
536
	BillingSendDate date COMMENT '請求書郵送/手渡し日',
537
	LedgerComplateDate date NOT NULL COMMENT '工事詳細台帳入力完了日付',
538
	EntryDate datetime NOT NULL COMMENT '登録日付',
539
	UpdateDate datetime NOT NULL COMMENT '更新日付',
540
	PRIMARY KEY (ConstructionCode)
541
) COMMENT = '工事基本情報';
394
drop table if exists componentmaster cascade;
542 395

  
396
create table componentmaster (
397
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
398
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
399
  , ComponentName varchar(120) not null comment '構成名称'
400
  , SubItemsFlg decimal(1,0) comment '下位項目フラグ'
401
  , DirectInputFlg decimal(1,0) comment '直接入力フラグ'
402
  , MyExpensesFlg decimal(1,0) comment '自社経費フラグ'
403
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
404
  , EntryDate datetime not null comment '登録日付'
405
  , UpdateDate datetime not null comment '更新日付'
406
  , constraint componentmaster_PKC primary key (ComponentCode)
407
) comment '構成マスタ' ;
543 408

  
544
-- 工事基本情報明細
545
CREATE TABLE ConstructionBaseInfoDetail
546
(
547
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
548
	DetailNo decimal(2) NOT NULL COMMENT '明細番号',
549
	DetailString varchar(120) COMMENT '明細内容',
550
	EntryDate datetime NOT NULL COMMENT '登録日付',
551
	UpdateDate datetime NOT NULL COMMENT '更新日付',
552
	PRIMARY KEY (ConstructionCode, DetailNo)
553
) COMMENT = '工事基本情報明細';
409
create index ComponentMaster_Index1
410
  on componentmaster(DisplayOrder);
554 411

  
412
-- 構成工事種別関連マスタ
413
drop index ComponentToTypeMaster_Index1 on componenttotypemaster;
414
drop index ComponentToTypeMaster_Index2 on componenttotypemaster;
555 415

  
556
-- 工事施工予算データ
557
CREATE TABLE ConstructionBudget
558
(
559
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
560
	CreatorCode decimal(8,0) NOT NULL COMMENT '作成者コード',
561
	CreatorName varchar(60) COMMENT '作成者名',
562
	CreatorCosts decimal(11,0) NOT NULL COMMENT '作成者給与',
563
	AssistantCode decimal(8,0) NOT NULL COMMENT '副担当者コード',
564
	AssistantName varchar(60) COMMENT '副担当者名',
565
	AssistantCosts decimal(11,0) NOT NULL COMMENT '副担当者給与',
566
	InstructorCode decimal(8,0) NOT NULL COMMENT '工事指導員コード',
567
	InstructorName varchar(60) COMMENT '工事指導員名',
568
	InstructorCosts decimal(11,0) NOT NULL COMMENT '工事指導員給与',
569
	CreateDate date NOT NULL COMMENT '作成日',
570
	ConstructionTimes decimal(5,2) NOT NULL COMMENT '工期(単位・月)',
571
	ConstructionStart date NOT NULL COMMENT '契約工期開始',
572
	ConstructionEnd date NOT NULL COMMENT '契約工期完了',
573
	InstructorTimes decimal(5,2) NOT NULL COMMENT '指導員稼働月数',
574
	SalaryFlg decimal(1) NOT NULL COMMENT '給与振分区分',
575
	SalaryDays decimal(4) NOT NULL COMMENT '振分日数',
576
	A_SalaryFlg decimal(1) NOT NULL COMMENT '副担当者給与振分区分',
577
	A_SalaryDays decimal(4) NOT NULL COMMENT '副担当者振分日数',
578
	I_SalaryFlg decimal(1) NOT NULL COMMENT '指導員給与振分区分',
579
	I_SalaryDays decimal(4) NOT NULL COMMENT '指導員振分日数',
580
	EntryDate datetime NOT NULL COMMENT '登録日付',
581
	UpdateDate datetime NOT NULL COMMENT '更新日付',
582
	PRIMARY KEY (ConstructionCode)
583
) COMMENT = '工事施工予算データ';
416
drop table if exists componenttotypemaster cascade;
584 417

  
418
create table componenttotypemaster (
419
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
420
  , TypeCode decimal(5,0) unsigned not null comment '工事種別コード'
421
  , Dummy decimal(1,0) not null comment 'ダミー項目'
422
  , EntryDate datetime not null comment '登録日付'
423
  , UpdateDate datetime not null comment '更新日付'
424
  , constraint componenttotypemaster_PKC primary key (ComponentCode,TypeCode)
425
) comment '構成工事種別関連マスタ' ;
585 426

  
586
-- 工事施工予算データ明細
587
CREATE TABLE ConstructionBudgetDetail
588
(
589
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
590
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
591
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
592
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
593
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
594
	FirstString varchar(120) COMMENT '項目名称',
595
	SecondString varchar(120) COMMENT '工事内容',
596
	CompanyType decimal(1) NOT NULL COMMENT '協力会社コードタイプ',
597
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
598
	CompanyName varchar(120) COMMENT '協力会社名称',
599
	EstimatePrice decimal(12,0) NOT NULL COMMENT '積算時見積金額',
600
	NegotiationPrice decimal(12,0) NOT NULL COMMENT '積算時交渉金額',
601
	OrderDesiredAmount decimal(12,0) NOT NULL COMMENT '発注希望金額',
602
	ExecutionAmount decimal(12,0) NOT NULL COMMENT '実行金額',
603
	AmountConfigRate decimal(5,2) NOT NULL COMMENT '金額構成率',
604
	NegotiateFlg decimal(1) NOT NULL COMMENT '協力業者交渉フラグ',
605
	EntryDate datetime NOT NULL COMMENT '登録日付',
606
	UpdateDate datetime NOT NULL COMMENT '更新日付',
607
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
608
) COMMENT = '工事施工予算データ明細';
427
create index ComponentToTypeMaster_Index1
428
  on componenttotypemaster(ComponentCode);
609 429

  
430
create index ComponentToTypeMaster_Index2
431
  on componenttotypemaster(TypeCode);
610 432

  
611
-- 工種マスタ
612
CREATE TABLE ConstructionItemMaster
613
(
614
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
615
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
616
	ItemName varchar(120) DEFAULT '' NOT NULL COMMENT '工種名称',
617
	SubItemsFlg decimal(1) COMMENT '下位項目フラグ',
618
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
619
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
620
	EntryDate datetime NOT NULL COMMENT '登録日付',
621
	UpdateDate datetime NOT NULL COMMENT '更新日付',
622
	PRIMARY KEY (ItemCode)
623
) COMMENT = '工種マスタ';
433
-- 工事基本情報
434
drop index BaseInfo_Index1 on constructionbaseinfo;
435
drop index BaseInfo_Index2 on constructionbaseinfo;
436
drop index BaseInfo_Index3 on constructionbaseinfo;
437
drop index BaseInfo_Index4 on constructionbaseinfo;
438
drop index BaseInfo_Index5 on constructionbaseinfo;
439
drop index BaseInfo_Index6 on constructionbaseinfo;
624 440

  
441
drop table if exists constructionbaseinfo cascade;
625 442

  
626
-- 工事詳細台帳データ
627
CREATE TABLE ConstructionLedger
628
(
629
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
630
	ConstructionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
631
	CreatorCode decimal(8,0) COMMENT '作成者コード',
632
	CreatorName varchar(60) COMMENT '作成者名',
633
	CreateDate date NOT NULL COMMENT '作成日',
634
	ConstructionTimes decimal(5,2) NOT NULL COMMENT '工期(単位・月)',
635
	ConstructionStart date NOT NULL COMMENT '契約工期開始',
636
	ConstructionEnd date NOT NULL COMMENT '契約工期完了',
637
	OrdersDecisionPrice decimal(14,0) NOT NULL COMMENT '税抜受注決定金額',
638
	CompanyExpenses decimal(10,0) NOT NULL COMMENT '会社経費合計',
639
	DepartmentExpenses decimal(10,0) NOT NULL COMMENT '部署経費合計',
640
	SalesExpenses decimal(10,0) NOT NULL COMMENT '営業経費合計',
641
	TotalPayment decimal(10,0) NOT NULL COMMENT '総支払額',
642
	GrossProfit decimal(10,0) NOT NULL COMMENT '粗利',
643
	Allowance decimal(10,0) NOT NULL COMMENT '給与',
644
	NetProfit decimal(10,0) NOT NULL COMMENT '純利益',
645
	ComplateFlg decimal(1) NOT NULL COMMENT '入力完了フラグ',
646
	IntegrationFlg decimal(1) NOT NULL COMMENT '受注金額積算フラグ',
647
	EntryDate datetime NOT NULL COMMENT '登録日付',
648
	UpdateDate datetime NOT NULL COMMENT '更新日付',
649
	PRIMARY KEY (ConstructionCode)
650
) COMMENT = '工事詳細台帳データ';
443
create table constructionbaseinfo (
444
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
445
  , TyingFlg decimal(1,0) not null comment '紐付データフラグ'
446
  , JoinFlg decimal(1,0) not null comment '結合契約工事フラグ'
447
  , ConstructionYear smallint(5) unsigned not null comment '工事年度'
448
  , ConstructionPeriod smallint(5) unsigned not null comment '工事期数'
449
  , RequestedDate date comment '依頼受け日'
450
  , EstimatesSubmitDeadline date comment '見積提出期限'
451
  , EstimatesSubmittedDate date comment '見積提出日'
452
  , ProvisionalOrderDate date comment '仮受注日'
453
  , OrderDate date comment '受注日'
454
  , OrderStartingDate date comment '開始予定日'
455
  , OrderCompletionDate date comment '完了予定日'
456
  , PreparationStartDate date comment '施工準備開始日'
457
  , ConstructionStartingDate date comment '施工開始日'
458
  , ConstructionCompletionDate date comment '施工完了日'
459
  , NonOrderDate date comment '非受注日'
460
  , OrdersDecisionPrice decimal(12,0) not null comment '税抜受注決定金額'
461
  , OrdersDecisionPriceInTax decimal(12,0) not null comment '税込受注決定金額'
462
  , SalesPersonCode decimal(8,0) comment '営業担当者名'
463
  , ConstructionPersonCode decimal(8,0) not null comment '工事担当者'
464
  , ConstrSubPersonCode decimal(8,0) not null comment '工事副担当者'
465
  , ConstructionInstructor decimal(8,0) not null comment '工事指導員'
466
  , TransferConstruction decimal(8,0) not null comment '工事移管先コード'
467
  , TransferConstructionDate date comment '工事移管日'
468
  , OrderersDivision decimal(5,0) not null comment '発注者区分'
469
  , OrderersCode decimal(5,0) unsigned not null comment '発注者コード'
470
  , EstimatesExpirationDate date comment '見積有効期限'
471
  , ConstructionPeriodStart date comment '契約工期開始日'
472
  , ConstructionPeriodEnd date comment '契約工期完了'
473
  , ConstructionPeriodStart2 date comment '契約工期開始(延長時)'
474
  , ConstructionPeriodEnd2 date comment '契約工期完了(延長時)'
475
  , StartDate date comment '工事開始日'
476
  , EndDate date comment '工事終了日'
477
  , PurchaseOrderMailingDate date comment '注文書郵送日'
478
  , PurchaseOrderReturnDate date comment '注文書返送日'
479
  , PurchaseOrderReturnCheckDate date comment '注文書返送確認日'
480
  , ConsumptionTaxFlg decimal(1,0) not null comment '消費税フラグ'
481
  , PrimeContractorFlg decimal(1,0) not null comment '元請フラグ'
482
  , SalesCostFlg decimal(1,0) not null comment '営業経費発生フラグ'
483
  , ConstructionStatusFlg decimal(2,0) not null comment '工事状態フラグ'
484
  , ConstructionType decimal(5,0) not null comment '工事種別コード'
485
  , EstimateType decimal(1,0) not null comment '見積種別'
486
  , BillingStartDate date not null comment '請求準備開始日'
487
  , BillingDate date not null comment '請求日'
488
  , BillingSplitFlg decimal(1,0) not null comment '請求回数フラグ'
489
  , BillingSendDate date comment '請求書郵送/手渡し日'
490
  , LedgerComplateDate date not null comment '工事詳細台帳入力完了日付'
491
  , EntryDate datetime not null comment '登録日付'
492
  , UpdateDate datetime not null comment '更新日付'
493
  , constraint constructionbaseinfo_PKC primary key (ConstructionCode)
494
) comment '工事基本情報' ;
651 495

  
496
create index BaseInfo_Index1
497
  on constructionbaseinfo(ConstructionStatusFlg);
652 498

  
653
-- 工事詳細台帳明細データ
654
CREATE TABLE ConstructionLedgerDetail
655
(
656
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
657
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
658
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
659
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
660
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
661
	FirstString varchar(120) COMMENT '項目名称',
662
	SecondString varchar(120) COMMENT '工事内容',
663
	CompanyType decimal(1) NOT NULL COMMENT '協力会社コードタイプ',
664
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
665
	CompanyName varchar(120) COMMENT '協力会社名称',
666
	EstimatePrice decimal(12,0) NOT NULL COMMENT '予算(見積)金額',
667
	ExecutionAmount decimal(12,0) NOT NULL COMMENT '実行金額',
668
	AmountConfigRate decimal(5,2) NOT NULL COMMENT '金額構成率',
669
	PaymentBurden decimal(12,0) NOT NULL COMMENT '支払補填額',
670
	FixDataFlg decimal(1) NOT NULL COMMENT '固定データフラグ',
671
	IndependentFlg decimal(1) NOT NULL COMMENT '独立データフラグ',
672
	FluctuationFlg decimal(1) NOT NULL COMMENT '増減データフラグ',
673
	SalaryFlg decimal(1) NOT NULL COMMENT '給与振分区分',
674
	SalaryDays decimal(4) NOT NULL COMMENT '給与振分日数',
675
	OperatingFlg decimal(1) NOT NULL COMMENT '担当中フラグ',
676
	SourceCode decimal(10) unsigned NOT NULL COMMENT '元工事番号',
677
	JoinTitleFlg decimal(1) NOT NULL COMMENT '工事名称タイトル',
678
	SalaryOnRegist decimal(12,0) NOT NULL COMMENT '登録時月額給与',
679
	PurchaseOrderFlg decimal(2) NOT NULL COMMENT '注文書発行フラグ',
680
	EntryDate datetime NOT NULL COMMENT '登録日付',
681
	UpdateDate datetime NOT NULL COMMENT '更新日付',
682
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
683
) COMMENT = '工事詳細台帳明細データ';
499
create index BaseInfo_Index2
500
  on constructionbaseinfo(EstimateType);
684 501

  
502
create index BaseInfo_Index3
503
  on constructionbaseinfo(SalesPersonCode);
685 504

  
686
-- 工事詳細台帳実行データ
687
CREATE TABLE ConstructionLedgerExcute
688
(
689
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
690
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
691
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
692
	ColumnCount decimal(3) NOT NULL COMMENT '列番号',
693
	PaymentAmount decimal(12,0) NOT NULL COMMENT '支払金額',
694
	TargetMonth date NOT NULL COMMENT '対象年月',
695
	EntryDate datetime NOT NULL COMMENT '登録日付',
696
	UpdateDate datetime NOT NULL COMMENT '更新日付',
697
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount, ColumnCount)
698
) COMMENT = '工事詳細台帳実行データ';
505
create index BaseInfo_Index4
506
  on constructionbaseinfo(ConstructionPersonCode);
699 507

  
508
create index BaseInfo_Index5
509
  on constructionbaseinfo(ConstructionInstructor);
700 510

  
701
-- 工事リンク情報
702
CREATE TABLE ConstructionLink
703
(
704
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
705
	FluctuationCode decimal(10,0) NOT NULL COMMENT '子工事番号',
706
	LinkType decimal(1) NOT NULL COMMENT 'リンク種別',
707
	EntryDate datetime NOT NULL COMMENT '登録日付',
708
	UpdateDate datetime NOT NULL COMMENT '更新日付',
709
	PRIMARY KEY (ConstructionCode, FluctuationCode)
710
) COMMENT = '工事リンク情報';
511
create index BaseInfo_Index6
512
  on constructionbaseinfo(ConstructionPeriod);
711 513

  
514
-- 工事基本情報明細
515
drop index BaseInfoDetail_Idx1 on constructionbaseinfodetail;
516
drop index BaseInfoDetail_Idx2 on constructionbaseinfodetail;
712 517

  
713
-- 案件進捗日付データ
714
CREATE TABLE ConstructionProgressDate
715
(
716
	ConstructionCode decimal(10,0) NOT NULL COMMENT '工事番号',
717
	ConstructionStatusFlg decimal(2,0) NOT NULL COMMENT '設定工事状態',
718
	PreviousStatusFlg decimal(2,0) COMMENT '変更前状態',
719
	ChangeDate datetime NOT NULL COMMENT '設定日付',
720
	ChangePersonCode decimal(8,0) NOT NULL COMMENT '設定担当者',
721
	EntryDate datetime NOT NULL COMMENT '登録日付',
722
	UpdateDate datetime NOT NULL COMMENT '更新日付',
723
	PRIMARY KEY (ConstructionCode, ConstructionStatusFlg)
724
) COMMENT = '案件進捗日付データ';
518
drop table if exists constructionbaseinfodetail cascade;
725 519

  
520
create table constructionbaseinfodetail (
521
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
522
  , DetailNo decimal(2,0) not null comment '明細番号'
523
  , DetailString varchar(120) comment '明細内容'
524
  , EntryDate datetime not null comment '登録日付'
525
  , UpdateDate datetime not null comment '更新日付'
526
  , constraint constructionbaseinfodetail_PKC primary key (ConstructionCode,DetailNo)
527
) comment '工事基本情報明細' ;
726 528

  
727
-- 作業マスタ
728
CREATE TABLE ConstructionSpecMaster
729
(
730
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
731
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
732
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
733
	ItemName varchar(120) DEFAULT '' COMMENT '作業名称',
734
	SpecName varchar(120) COMMENT '作業名称',
735
	UnitName varchar(30) COMMENT '単位名称',
736
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
737
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
738
	EntryDate datetime NOT NULL COMMENT '登録日付',
739
	UpdateDate datetime NOT NULL COMMENT '更新日付',
740
	PRIMARY KEY (ItemCode, SpecCode)
741
) COMMENT = '作業マスタ';
529
create index BaseInfoDetail_Idx1
530
  on constructionbaseinfodetail(ConstructionCode);
742 531

  
532
create index BaseInfoDetail_Idx2
533
  on constructionbaseinfodetail(DetailNo);
743 534

  
744
-- 作業単価マスタ
745
CREATE TABLE ConstructionSpecUnitPrice
746
(
747
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
748
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
749
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
750
	ConstructionTypeCode mediumint unsigned NOT NULL COMMENT '工事種別コード',
751
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
752
	EntryDate datetime NOT NULL COMMENT '登録日付',
753
	UpdateDate datetime NOT NULL COMMENT '更新日付',
754
	PRIMARY KEY (ComponentCode, ItemCode, SpecCode, ConstructionTypeCode)
755
) COMMENT = '作業単価マスタ';
535
-- 工事施工予算データ
536
drop table if exists constructionbudget cascade;
756 537

  
538
create table constructionbudget (
539
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
540
  , CreatorCode decimal(8,0) not null comment '作成者コード'
541
  , CreatorName varchar(60) comment '作成者名'
542
  , CreatorCosts decimal(11,0) not null comment '作成者給与'
543
  , AssistantCode decimal(8,0) not null comment '副担当者コード'
544
  , AssistantName varchar(60) comment '副担当者名'
545
  , AssistantCosts decimal(11,0) not null comment '副担当者給与'
546
  , InstructorCode decimal(8,0) not null comment '工事指導員コード'
547
  , InstructorName varchar(60) comment '工事指導員名'
548
  , InstructorCosts decimal(11,0) not null comment '工事指導員給与'
549
  , CreateDate date not null comment '作成日'
550
  , ConstructionTimes decimal(5,2) not null comment '工期(単位・月)'
551
  , ConstructionStart date not null comment '契約工期開始'
552
  , ConstructionEnd date not null comment '契約工期完了'
553
  , InstructorTimes decimal(5,2) not null comment '指導員稼働月数'
554
  , SalaryFlg decimal(1,0) not null comment '給与振分区分'
555
  , SalaryDays decimal(4,0) not null comment '振分日数'
556
  , A_SalaryFlg decimal(1,0) not null comment '副担当者給与振分区分'
557
  , A_SalaryDays decimal(4,0) not null comment '副担当者振分日数'
558
  , I_SalaryFlg decimal(1,0) not null comment '指導員給与振分区分'
559
  , I_SalaryDays decimal(4,0) not null comment '指導員振分日数'
560
  , EntryDate datetime not null comment '登録日付'
561
  , UpdateDate datetime not null comment '更新日付'
562
  , constraint constructionbudget_PKC primary key (ConstructionCode)
563
) comment '工事施工予算データ' ;
757 564

  
758
-- 工事種別マスタ
759
CREATE TABLE ConstructionTypeMaster
760
(
761
	TypeCode decimal(5,0) unsigned NOT NULL COMMENT '工事種別コード',
762
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
763
	NameString varchar(100) DEFAULT '' NOT NULL COMMENT '名称',
764
	PublicFlg decimal(1) NOT NULL COMMENT '工事種別フラグ',
765
	SecRank decimal(1) NOT NULL COMMENT '保護区分ランク',
766
	ExpensesLink decimal(1) NOT NULL COMMENT '経費使用区分',
767
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
768
	EntryDate datetime NOT NULL COMMENT '登録日付',
769
	UpdateDate datetime NOT NULL COMMENT '更新日付',
770
	PRIMARY KEY (TypeCode)
771
) COMMENT = '工事種別マスタ';
565
-- 工事施工予算データ明細
566
drop table if exists constructionbudgetdetail cascade;
772 567

  
568
create table constructionbudgetdetail (
569
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
570
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
571
  , LineCount decimal(3,0) unsigned not null comment '行番号'
572
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
573
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
574
  , FirstString varchar(120) comment '項目名称'
575
  , SecondString varchar(120) comment '工事内容'
576
  , CompanyType decimal(1,0) not null comment '協力会社コードタイプ'
577
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
578
  , CompanyName varchar(120) comment '協力会社名称'
579
  , EstimatePrice decimal(12,0) not null comment '積算時見積金額'
580
  , NegotiationPrice decimal(12,0) not null comment '積算時交渉金額'
581
  , OrderDesiredAmount decimal(12,0) not null comment '発注希望金額'
582
  , ExecutionAmount decimal(12,0) not null comment '実行金額'
583
  , AmountConfigRate decimal(5,2) not null comment '金額構成率'
584
  , NegotiateFlg decimal(1,0) not null comment '協力業者交渉フラグ'
585
  , EntryDate datetime not null comment '登録日付'
586
  , UpdateDate datetime not null comment '更新日付'
587
  , constraint constructionbudgetdetail_PKC primary key (ConstructionCode,GroupCount,LineCount)
588
) comment '工事施工予算データ明細' ;
773 589

  
774
-- 担当者毎経費データ
775
CREATE TABLE CostDataOfPerson
776
(
777
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
778
	ActionDate date NOT NULL COMMENT '対象日付',
779
	DataType decimal(1) NOT NULL COMMENT 'データ区分',
780
	DataAddCount decimal(5) unsigned NOT NULL COMMENT 'データ追加番号',
781
	TargetMonth varchar(7) NOT NULL COMMENT '対象年月',
782
	ConstructionCode decimal(10,0) unsigned COMMENT '工事コード',
783
	SuppliersCode decimal(5) unsigned NOT NULL COMMENT '支払先コード',
784
	SuppliersName varchar(120) COMMENT '支払先名称',
785
	PaymentContent varchar(60) COMMENT '支払内容',
786
	PaymentType decimal(1) NOT NULL COMMENT '支払方法フラグ',
787
	EntryPrice decimal(12,0) NOT NULL COMMENT '金額(税抜)',
788
	EntryPriceInTax decimal(12,0) NOT NULL COMMENT '金額(税込)',
789
	SlipNumber varchar(12) COMMENT '伝票番号',
790
	ComplateFlg decimal(1) NOT NULL COMMENT '引込済みフラグ',
791
	ApprovalFlg decimal(1) NOT NULL COMMENT '承認フラグ',
792
	EntryDate datetime NOT NULL COMMENT '登録日付',
793
	UpdateDate datetime NOT NULL COMMENT '更新日付',
794
	PRIMARY KEY (PersonCode, ActionDate, DataType, DataAddCount)
795
) COMMENT = '担当者毎経費データ';
590
-- 工種マスタ
591
drop table if exists constructionitemmaster cascade;
796 592

  
593
create table constructionitemmaster (
594
  ItemCode decimal(5,0) unsigned not null comment '工種キー'
595
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
596
  , ItemName varchar(120) not null comment '工種名称'
597
  , SubItemsFlg decimal(1,0) comment '下位項目フラグ'
598
  , MyExpensesFlg decimal(1,0) not null comment '自社経費フラグ'
599
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
600
  , EntryDate datetime not null comment '登録日付'
601
  , UpdateDate datetime not null comment '更新日付'
602
  , constraint constructionitemmaster_PKC primary key (ItemCode)
603
) comment '工種マスタ' ;
797 604

  
798
-- 発注者登録申請データ
799
CREATE TABLE CostomerRegist
800
(
801
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '申請者番号',
802
	CreateDate date NOT NULL COMMENT '作成日',
803
	SeqNo decimal(2) NOT NULL COMMENT 'キー連番',
804
	DataMode decimal(1) NOT NULL COMMENT 'データ区分',
805
	SourceCotegory decimal(5) unsigned NOT NULL COMMENT '発注者区分',
806
	SourceCode decimal(5) unsigned NOT NULL COMMENT '発注者コード',
807
	PetitionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
808
	OrderFlg decimal(1) NOT NULL COMMENT '法人団体・個人フラグ',
809
	CorporateStatusName varchar(100) COMMENT '法人格名称',
810
	CorporateStatusPoint decimal(1) COMMENT '法人格名称位置',
811
	OrderersName1 varchar(60) DEFAULT '' NOT NULL COMMENT '発注者名1',
812
	OrderersName2 varchar(60) COMMENT '発注者名2',
813
	DepartmentName varchar(60) COMMENT '部署名',
814
	ChargePersonName varchar(60) COMMENT '担当者名',
815
	ZipCode varchar(8) COMMENT '郵便番号',
816
	Address1 varchar(60) COMMENT '住所1',
817
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
818
	Address3 varchar(60) COMMENT '住所3',
819
	PhoneNumber varchar(13) DEFAULT '' COMMENT '電話番号',
820
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
821
	MailAddress varchar(257) COMMENT 'メールアドレス',
822
	Note varchar(300) DEFAULT '' COMMENT '備考',
823
	OrderCotegory decimal(5,0) unsigned NOT NULL COMMENT '発注者区分',
824
	OrderDate date NOT NULL COMMENT '申請日',
825
	OrderNo decimal(2) unsigned NOT NULL COMMENT '申請受付番号',
826
	EntryDate datetime NOT NULL COMMENT '登録日付',
827
	UpdateDate datetime NOT NULL COMMENT '更新日付',
828
	PRIMARY KEY (PersonCode, CreateDate, SeqNo)
829
) COMMENT = '発注者登録申請データ';
605
-- 工事詳細台帳データ
606
drop table if exists constructionledger cascade;
830 607

  
608
create table constructionledger (
609
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
610
  , ConstructionPeriod decimal(4,0) unsigned not null comment '事業期'
611
  , CreatorCode decimal(8,0) comment '作成者コード'
612
  , CreatorName varchar(60) comment '作成者名'
613
  , CreateDate date not null comment '作成日'
614
  , ConstructionTimes decimal(5,2) not null comment '工期(単位・月)'
615
  , ConstructionStart date not null comment '契約工期開始'
616
  , ConstructionEnd date not null comment '契約工期完了'
617
  , OrdersDecisionPrice decimal(14,0) not null comment '税抜受注決定金額'
618
  , CompanyExpenses decimal(10,0) not null comment '会社経費合計'
619
  , DepartmentExpenses decimal(10,0) not null comment '部署経費合計'
620
  , SalesExpenses decimal(10,0) not null comment '営業経費合計'
621
  , TotalPayment decimal(10,0) not null comment '総支払額'
622
  , GrossProfit decimal(10,0) not null comment '粗利'
623
  , Allowance decimal(10,0) not null comment '給与'
624
  , NetProfit decimal(10,0) not null comment '純利益'
625
  , ComplateFlg decimal(1,0) not null comment '入力完了フラグ'
626
  , IntegrationFlg decimal(1,0) not null comment '受注金額積算フラグ'
627
  , EntryDate datetime not null comment '登録日付'
628
  , UpdateDate datetime not null comment '更新日付'
629
  , constraint constructionledger_PKC primary key (ConstructionCode)
630
) comment '工事詳細台帳データ' ;
831 631

  
832
-- 日報データ
833
CREATE TABLE DailyDataConstruction
834
(
835
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
836
	DailyDataDate date NOT NULL COMMENT '日報作成日',
837
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
838
	Weather varchar(60) COMMENT '天気',
839
	EntryDate datetime NOT NULL COMMENT '登録日付',
840
	UpdateDate datetime NOT NULL COMMENT '更新日付',
841
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode)
842
) COMMENT = '日報データ';
632
-- 工事詳細台帳明細データ
633
drop index LedgerDetail_Index01 on constructionledgerdetail;
634
drop index LedgerDetail_Index02 on constructionledgerdetail;
635
drop index LedgerDetail_Index03 on constructionledgerdetail;
843 636

  
637
drop table if exists constructionledgerdetail cascade;
844 638

  
845
-- 日報データ (明細)
846
CREATE TABLE DailyDataDetail
847
(
848
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
849
	DailyDataDate date NOT NULL COMMENT '日報作成日',
850
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
851
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
852
	JobCategoryCode decimal(5,0) NOT NULL COMMENT '職種キー',
853
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
854
	TodayHeadCount decimal(4,1) NOT NULL COMMENT '当日人員数',
855
	TotalHeadCount decimal(5,1) NOT NULL COMMENT '累計人員数',
856
	TodayWork varchar(100) COMMENT '当日作業内容',
857
	NextdayWork varchar(100) COMMENT '翌日作業内容',
858
	NextdayHeadCount decimal(4,1) NOT NULL COMMENT '翌日人員数',
859
	EntryDate datetime NOT NULL COMMENT '登録日付',
860
	UpdateDate datetime NOT NULL COMMENT '更新日付',
861
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
862
) COMMENT = '日報データ (明細)';
639
create table constructionledgerdetail (
640
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
641
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
642
  , LineCount decimal(3,0) unsigned not null comment '行番号'
643
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
644
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
645
  , FirstString varchar(120) comment '項目名称'
646
  , SecondString varchar(120) comment '工事内容'
647
  , CompanyType decimal(1,0) not null comment '協力会社コードタイプ'
648
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
649
  , CompanyName varchar(120) comment '協力会社名称'
650
  , EstimatePrice decimal(12,0) not null comment '予算(見積)金額'
651
  , ExecutionAmount decimal(12,0) not null comment '実行金額'
652
  , AmountConfigRate decimal(5,2) not null comment '金額構成率'
653
  , PaymentBurden decimal(12,0) not null comment '支払補填額'
654
  , FixDataFlg decimal(1,0) not null comment '固定データフラグ'
655
  , IndependentFlg decimal(1,0) not null comment '独立データフラグ'
656
  , FluctuationFlg decimal(1,0) not null comment '増減データフラグ'
657
  , SalaryFlg decimal(1,0) not null comment '給与振分区分'
658
  , SalaryDays decimal(4,0) not null comment '給与振分日数'
659
  , OperatingFlg decimal(1,0) not null comment '担当中フラグ'
660
  , SourceCode decimal(10,0) unsigned not null comment '元工事番号'
661
  , JoinTitleFlg decimal(1,0) not null comment '工事名称タイトル'
662
  , SalaryOnRegist decimal(12,0) not null comment '登録時月額給与'
663
  , PurchaseOrderFlg decimal(2,0) not null comment '注文書発行フラグ'
664
  , EntryDate datetime not null comment '登録日付'
665
  , UpdateDate datetime not null comment '更新日付'
666
  , constraint constructionledgerdetail_PKC primary key (ConstructionCode,GroupCount,LineCount)
667
) comment '工事詳細台帳明細データ' ;
863 668

  
669
create index LedgerDetail_Index01
670
  on constructionledgerdetail(ConstructionCode);
864 671

  
865
-- 日報データ (現場巡回)
866
CREATE TABLE DailyDataField
867
(
868
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
869
	DailyDataDate date NOT NULL COMMENT '日報作成日',
870
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
871
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
872
	PatrolTime datetime NOT NULL COMMENT '巡回時間',
873
	ContentsText varchar(200) COMMENT '内容',
874
	EntryDate datetime NOT NULL COMMENT '登録日付',
875
	UpdateDate datetime NOT NULL COMMENT '更新日付',
876
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
877
) COMMENT = '日報データ (現場巡回)';
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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