プロジェクト

全般

プロフィール

統計
| リビジョン:

h-you / branches / ddl / ProcessManagement.sql @ 263

履歴 | 表示 | アノテート | ダウンロード (115 KB)

1
-- Project Name : noname
2
-- Date/Time    : 2017/07/20 9:53:08
3
-- Author       : Horiuchi
4
-- RDBMS Type   : MySQL
5
-- Application  : A5:SQL Mk-2
6

    
7
-- 担当者行動予定データ
8
drop table if exists actionscheduledata cascade;
9

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

    
22
create index ActionScheduleData_Index1
23
  on actionscheduledata(TargetYear);
24

    
25
create index ActionScheduleData_Index2
26
  on actionscheduledata(TargetMonth);
27

    
28
create index ActionScheduleData_Index3
29
  on actionscheduledata(TargetDay);
30

    
31
-- 承認経路マスタ
32
drop table if exists approvalmaster cascade;
33

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

    
46
-- 出勤日報データ
47
drop table if exists attendancedailydata cascade;
48

    
49
create table attendancedailydata (
50
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
51
  , AttendanceDate date not null comment '日報作成日'
52
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
53
  , ActionResult varchar(30) not null comment '行動実績'
54
  , OvertimeHours decimal(4,1) not null comment '残業時間'
55
  , WorkingComment varchar(120) comment 'コメント'
56
  , EntryDate datetime not null comment '登録日付'
57
  , UpdateDate datetime not null comment '更新日付'
58
  , constraint attendancedailydata_PKC primary key (PersonCode,AttendanceDate,SeqNo)
59
) comment '出勤日報データ' ;
60

    
61
create index AttendDaily_Index1
62
  on attendancedailydata(ActionResult);
63

    
64
create index AttendDaily_Index2
65
  on attendancedailydata(AttendanceDate);
66

    
67
-- 出勤管理データ
68
drop table if exists attendancedata cascade;
69

    
70
create table attendancedata (
71
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
72
  , AttendanceMonth date not null comment '出勤管理年月'
73
  , LastDays decimal(2,0) unsigned not null comment '当月最終日'
74
  , AttendDayCount decimal(2,0) unsigned not null comment '出勤日数'
75
  , TotalOverTimes decimal(4,1) not null comment '残業時間数'
76
  , OrderDate date not null comment '申請日'
77
  , OrderNo decimal(2,0) unsigned not null comment '申請受付番号'
78
  , EntryDate datetime not null comment '登録日付'
79
  , UpdateDate datetime not null comment '更新日付'
80
  , constraint attendancedata_PKC primary key (PersonCode,AttendanceMonth)
81
) comment '出勤管理データ' ;
82

    
83
-- 銀行営業日マスタ
84
drop table if exists bankbusinessdaymaster cascade;
85

    
86
create table bankbusinessdaymaster (
87
  YEARMONTH decimal(6,0) default '0' not null comment '年月'
88
  , BANKBUSINESSDAY decimal(2,0) default '0' not null comment '銀行営業日'
89
  , NOTE varchar(120) comment '備考'
90
  , DELETEFLG decimal(1,0) comment '削除フラグ'
91
  , ENTRYDATE datetime comment '登録年月日'
92
  , UPDATEDATE datetime comment '更新年月日'
93
  , constraint bankbusinessdaymaster_PKC primary key (YEARMONTH,BANKBUSINESSDAY)
94
) comment '銀行営業日マスタ' ;
95

    
96
-- 業者請求データ
97
drop table if exists billingdata cascade;
98

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

    
109
-- 業者請求明細データ
110
drop table if exists billingdatadetail cascade;
111

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

    
129
-- 業者請求支払サマリーデータ
130
drop table if exists billingpaymentsummary cascade;
131

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

    
151
-- 工事詳細台帳データ【退避用】
152
drop table if exists bk_constructionledger cascade;
153

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

    
178
-- 工事詳細台帳明細データ【退避用】
179
drop table if exists bk_constructionledgerdetail cascade;
180

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

    
211
-- 工事詳細台帳実行データ【退避用】
212
drop table if exists bk_constructionledgerexcute cascade;
213

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

    
226
-- 積算見積データ【退避用】
227
drop table if exists bk_estimatedata cascade;
228

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

    
246
-- 積算見積ページデータ【退避用】
247
drop table if exists bk_estimatedatabody cascade;
248

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

    
265
-- 積算見積データ明細【退避用】
266
drop table if exists bk_estimatedatadetail cascade;
267

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

    
292
-- 法人格マスタ
293
drop table if exists businesstypemaster cascade;
294

    
295
create table businesstypemaster (
296
  BusinessTypeCode decimal(5,0) unsigned not null comment '法人格コード'
297
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
298
  , BusinessTypeName varchar(100) not null comment '業種名'
299
  , EntryDate datetime not null comment '登録日付'
300
  , UpdateDate datetime not null comment '更新日付'
301
  , constraint businesstypemaster_PKC primary key (BusinessTypeCode)
302
) comment '法人格マスタ' ;
303

    
304
create index BusinessTypeMaster_Index1
305
  on businesstypemaster(DisplayOrder);
306

    
307
-- 共通費大項目マスタ
308
drop table if exists commoncostlarge cascade;
309

    
310
create table commoncostlarge (
311
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
312
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
313
  , LargeName varchar(50) not null comment '大項目名称'
314
  , CommentText varchar(120) comment '説明書き'
315
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
316
  , EntryDate datetime not null comment '登録日付'
317
  , UpdateDate datetime not null comment '更新日付'
318
  , constraint commoncostlarge_PKC primary key (LargeCode)
319
) comment '共通費大項目マスタ' ;
320

    
321
-- 共通費工種関連マスタ
322
drop table if exists commoncostlinkms cascade;
323

    
324
create table commoncostlinkms (
325
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
326
  , MiddleCode decimal(5,0) unsigned not null comment '中項目キー'
327
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
328
  , EntryDate datetime comment '登録日付'
329
  , UpdateDate datetime comment '更新日付'
330
  , constraint commoncostlinkms_PKC primary key (LargeCode,MiddleCode,ItemCode)
331
) comment '共通費工種関連マスタ' ;
332

    
333
-- 共通費中項目マスタ
334
drop table if exists commoncostmiddle cascade;
335

    
336
create table commoncostmiddle (
337
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
338
  , MiddleCode decimal(5,0) unsigned not null comment '中項目キー'
339
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
340
  , MiddleName varchar(50) not null comment '中項目名称'
341
  , CommentText varchar(120) comment '説明書き'
342
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
343
  , EntryDate datetime not null comment '登録日付'
344
  , UpdateDate datetime not null comment '更新日付'
345
  , constraint commoncostmiddle_PKC primary key (LargeCode,MiddleCode)
346
) comment '共通費中項目マスタ' ;
347

    
348
-- 共通費中項目キーマスタ
349
drop table if exists commoncostmiddlesearchword cascade;
350

    
351
create table commoncostmiddlesearchword (
352
  LargeCode decimal(5,0) unsigned not null comment '大項目キー'
353
  , MiddleCode decimal(5,0) unsigned not null comment '中項目キー'
354
  , SeqNo decimal(5,0) unsigned not null comment '順序'
355
  , SearchWord varchar(50) not null comment '検索項目'
356
  , EntryDate datetime not null comment '登録日付'
357
  , UpdateDate datetime not null comment '更新日付'
358
  , constraint commoncostmiddlesearchword_PKC primary key (LargeCode,MiddleCode,SeqNo)
359
) comment '共通費中項目キーマスタ' ;
360

    
361
-- 構成工種関連マスタ
362
drop table if exists componentlinkmaster cascade;
363

    
364
create table componentlinkmaster (
365
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
366
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
367
  , DisplayOrder decimal(5,0) unsigned comment '表示順'
368
  , EntryDate datetime not null comment '登録日付'
369
  , UpdateDate datetime not null comment '更新日付'
370
  , constraint componentlinkmaster_PKC primary key (ComponentCode,ItemCode)
371
) comment '構成工種関連マスタ' ;
372

    
373
create index ComponentLinkMaster_Index1
374
  on componentlinkmaster(ComponentCode);
375

    
376
create index ComponentLinkMaster_Index2
377
  on componentlinkmaster(ItemCode);
378

    
379
-- 構成マスタ
380
drop table if exists componentmaster cascade;
381

    
382
create table componentmaster (
383
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
384
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
385
  , ComponentName varchar(120) not null comment '構成名称'
386
  , SubItemsFlg decimal(1,0) comment '下位項目フラグ'
387
  , DirectInputFlg decimal(1,0) comment '直接入力フラグ'
388
  , MyExpensesFlg decimal(1,0) comment '自社経費フラグ'
389
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
390
  , EntryDate datetime not null comment '登録日付'
391
  , UpdateDate datetime not null comment '更新日付'
392
  , constraint componentmaster_PKC primary key (ComponentCode)
393
) comment '構成マスタ' ;
394

    
395
create index ComponentMaster_Index1
396
  on componentmaster(DisplayOrder);
397

    
398
-- 構成工事種別関連マスタ
399
drop table if exists componenttotypemaster cascade;
400

    
401
create table componenttotypemaster (
402
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
403
  , TypeCode decimal(5,0) unsigned not null comment '工事種別コード'
404
  , Dummy decimal(1,0) not null comment 'ダミー項目'
405
  , EntryDate datetime not null comment '登録日付'
406
  , UpdateDate datetime not null comment '更新日付'
407
  , constraint componenttotypemaster_PKC primary key (ComponentCode,TypeCode)
408
) comment '構成工事種別関連マスタ' ;
409

    
410
create index ComponentToTypeMaster_Index1
411
  on componenttotypemaster(ComponentCode);
412

    
413
create index ComponentToTypeMaster_Index2
414
  on componenttotypemaster(TypeCode);
415

    
416
-- 工事基本情報
417
drop table if exists constructionbaseinfo cascade;
418

    
419
create table constructionbaseinfo (
420
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
421
  , TyingFlg decimal(1,0) not null comment '紐付データフラグ'
422
  , JoinFlg decimal(1,0) not null comment '結合契約工事フラグ'
423
  , ConstructionYear smallint(5) unsigned not null comment '工事年度'
424
  , ConstructionPeriod smallint(5) unsigned not null comment '工事期数'
425
  , RequestedDate date comment '依頼受け日'
426
  , EstimatesSubmitDeadline date comment '見積提出期限'
427
  , EstimatesSubmittedDate date comment '見積提出日'
428
  , ProvisionalOrderDate date comment '仮受注日'
429
  , OrderDate date comment '受注日'
430
  , OrderStartingDate date comment '開始予定日'
431
  , OrderCompletionDate date comment '完了予定日'
432
  , PreparationStartDate date comment '施工準備開始日'
433
  , ConstructionStartingDate date comment '施工開始日'
434
  , ConstructionCompletionDate date comment '施工完了日'
435
  , NonOrderDate date comment '非受注日'
436
  , OrdersDecisionPrice decimal(12,0) not null comment '税抜受注決定金額'
437
  , OrdersDecisionPriceInTax decimal(12,0) not null comment '税込受注決定金額'
438
  , SalesPersonCode decimal(8,0) comment '営業担当者名'
439
  , ConstructionPersonCode decimal(8,0) not null comment '工事担当者'
440
  , ConstrSubPersonCode decimal(8,0) not null comment '工事副担当者'
441
  , ConstructionInstructor decimal(8,0) not null comment '工事指導員'
442
  , TransferConstruction decimal(8,0) not null comment '工事移管先コード'
443
  , TransferConstructionDate date comment '工事移管日'
444
  , OrderersDivision decimal(5,0) not null comment '発注者区分'
445
  , OrderersCode decimal(5,0) unsigned not null comment '発注者コード'
446
  , EstimatesExpirationDate date comment '見積有効期限'
447
  , ConstructionPeriodStart date comment '契約工期開始日'
448
  , ConstructionPeriodEnd date comment '契約工期完了'
449
  , ConstructionPeriodStart2 date comment '契約工期開始(延長時)'
450
  , ConstructionPeriodEnd2 date comment '契約工期完了(延長時)'
451
  , StartDate date comment '工事開始日'
452
  , EndDate date comment '工事終了日'
453
  , PurchaseOrderMailingDate date comment '注文書郵送日'
454
  , PurchaseOrderReturnDate date comment '注文書返送日'
455
  , PurchaseOrderReturnCheckDate date comment '注文書返送確認日'
456
  , ConsumptionTaxFlg decimal(1,0) not null comment '消費税フラグ'
457
  , PrimeContractorFlg decimal(1,0) not null comment '元請フラグ'
458
  , SalesCostFlg decimal(1,0) not null comment '営業経費発生フラグ'
459
  , ConstructionStatusFlg decimal(2,0) not null comment '工事状態フラグ'
460
  , ConstructionType decimal(5,0) not null comment '工事種別コード'
461
  , EstimateType decimal(1,0) not null comment '見積種別'
462
  , BillingStartDate date not null comment '請求準備開始日'
463
  , BillingDate date not null comment '請求日'
464
  , BillingSplitFlg decimal(1,0) not null comment '請求回数フラグ'
465
  , BillingSendDate date comment '請求書郵送/手渡し日'
466
  , LedgerComplateDate date not null comment '工事詳細台帳入力完了日付'
467
  , EntryDate datetime not null comment '登録日付'
468
  , UpdateDate datetime not null comment '更新日付'
469
  , constraint constructionbaseinfo_PKC primary key (ConstructionCode)
470
) comment '工事基本情報' ;
471

    
472
create index BaseInfo_Index1
473
  on constructionbaseinfo(ConstructionStatusFlg);
474

    
475
create index BaseInfo_Index2
476
  on constructionbaseinfo(EstimateType);
477

    
478
create index BaseInfo_Index3
479
  on constructionbaseinfo(SalesPersonCode);
480

    
481
create index BaseInfo_Index4
482
  on constructionbaseinfo(ConstructionPersonCode);
483

    
484
create index BaseInfo_Index5
485
  on constructionbaseinfo(ConstructionInstructor);
486

    
487
create index BaseInfo_Index6
488
  on constructionbaseinfo(ConstructionPeriod);
489

    
490
-- 工事基本情報明細
491
drop table if exists constructionbaseinfodetail cascade;
492

    
493
create table constructionbaseinfodetail (
494
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
495
  , DetailNo decimal(2,0) not null comment '明細番号'
496
  , DetailString varchar(120) comment '明細内容'
497
  , EntryDate datetime not null comment '登録日付'
498
  , UpdateDate datetime not null comment '更新日付'
499
  , constraint constructionbaseinfodetail_PKC primary key (ConstructionCode,DetailNo)
500
) comment '工事基本情報明細' ;
501

    
502
create index BaseInfoDetail_Idx1
503
  on constructionbaseinfodetail(ConstructionCode);
504

    
505
create index BaseInfoDetail_Idx2
506
  on constructionbaseinfodetail(DetailNo);
507

    
508
-- 工事施工予算データ
509
drop table if exists constructionbudget cascade;
510

    
511
create table constructionbudget (
512
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
513
  , CreatorCode decimal(8,0) not null comment '作成者コード'
514
  , CreatorName varchar(60) comment '作成者名'
515
  , CreatorCosts decimal(11,0) not null comment '作成者給与'
516
  , AssistantCode decimal(8,0) not null comment '副担当者コード'
517
  , AssistantName varchar(60) comment '副担当者名'
518
  , AssistantCosts decimal(11,0) not null comment '副担当者給与'
519
  , InstructorCode decimal(8,0) not null comment '工事指導員コード'
520
  , InstructorName varchar(60) comment '工事指導員名'
521
  , InstructorCosts decimal(11,0) not null comment '工事指導員給与'
522
  , CreateDate date not null comment '作成日'
523
  , ConstructionTimes decimal(5,2) not null comment '工期(単位・月)'
524
  , ConstructionStart date not null comment '契約工期開始'
525
  , ConstructionEnd date not null comment '契約工期完了'
526
  , InstructorTimes decimal(5,2) not null comment '指導員稼働月数'
527
  , SalaryFlg decimal(1,0) not null comment '給与振分区分'
528
  , SalaryDays decimal(4,0) not null comment '振分日数'
529
  , A_SalaryFlg decimal(1,0) not null comment '副担当者給与振分区分'
530
  , A_SalaryDays decimal(4,0) not null comment '副担当者振分日数'
531
  , I_SalaryFlg decimal(1,0) not null comment '指導員給与振分区分'
532
  , I_SalaryDays decimal(4,0) not null comment '指導員振分日数'
533
  , EntryDate datetime not null comment '登録日付'
534
  , UpdateDate datetime not null comment '更新日付'
535
  , constraint constructionbudget_PKC primary key (ConstructionCode)
536
) comment '工事施工予算データ' ;
537

    
538
-- 工事施工予算データ明細
539
drop table if exists constructionbudgetdetail cascade;
540

    
541
create table constructionbudgetdetail (
542
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
543
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
544
  , LineCount decimal(3,0) unsigned not null comment '行番号'
545
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
546
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
547
  , FirstString varchar(120) comment '項目名称'
548
  , SecondString varchar(120) comment '工事内容'
549
  , CompanyType decimal(1,0) not null comment '協力会社コードタイプ'
550
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
551
  , CompanyName varchar(120) comment '協力会社名称'
552
  , EstimatePrice decimal(12,0) not null comment '積算時見積金額'
553
  , NegotiationPrice decimal(12,0) not null comment '積算時交渉金額'
554
  , OrderDesiredAmount decimal(12,0) not null comment '発注希望金額'
555
  , ExecutionAmount decimal(12,0) not null comment '実行金額'
556
  , AmountConfigRate decimal(5,2) not null comment '金額構成率'
557
  , NegotiateFlg decimal(1,0) not null comment '協力業者交渉フラグ'
558
  , EntryDate datetime not null comment '登録日付'
559
  , UpdateDate datetime not null comment '更新日付'
560
  , constraint constructionbudgetdetail_PKC primary key (ConstructionCode,GroupCount,LineCount)
561
) comment '工事施工予算データ明細' ;
562

    
563
-- 工種マスタ
564
drop table if exists constructionitemmaster cascade;
565

    
566
create table constructionitemmaster (
567
  ItemCode decimal(5,0) unsigned not null comment '工種キー'
568
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
569
  , ItemName varchar(120) not null comment '工種名称'
570
  , SubItemsFlg decimal(1,0) comment '下位項目フラグ'
571
  , MyExpensesFlg decimal(1,0) not null comment '自社経費フラグ'
572
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
573
  , EntryDate datetime not null comment '登録日付'
574
  , UpdateDate datetime not null comment '更新日付'
575
  , constraint constructionitemmaster_PKC primary key (ItemCode)
576
) comment '工種マスタ' ;
577

    
578
-- 工事詳細台帳データ
579
drop table if exists constructionledger cascade;
580

    
581
create table constructionledger (
582
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
583
  , ConstructionPeriod decimal(4,0) unsigned not null comment '事業期'
584
  , CreatorCode decimal(8,0) comment '作成者コード'
585
  , CreatorName varchar(60) comment '作成者名'
586
  , CreateDate date not null comment '作成日'
587
  , ConstructionTimes decimal(5,2) not null comment '工期(単位・月)'
588
  , ConstructionStart date not null comment '契約工期開始'
589
  , ConstructionEnd date not null comment '契約工期完了'
590
  , OrdersDecisionPrice decimal(14,0) not null comment '税抜受注決定金額'
591
  , CompanyExpenses decimal(10,0) not null comment '会社経費合計'
592
  , DepartmentExpenses decimal(10,0) not null comment '部署経費合計'
593
  , SalesExpenses decimal(10,0) not null comment '営業経費合計'
594
  , TotalPayment decimal(10,0) not null comment '総支払額'
595
  , GrossProfit decimal(10,0) not null comment '粗利'
596
  , Allowance decimal(10,0) not null comment '給与'
597
  , NetProfit decimal(10,0) not null comment '純利益'
598
  , ComplateFlg decimal(1,0) not null comment '入力完了フラグ'
599
  , IntegrationFlg decimal(1,0) not null comment '受注金額積算フラグ'
600
  , EntryDate datetime not null comment '登録日付'
601
  , UpdateDate datetime not null comment '更新日付'
602
  , constraint constructionledger_PKC primary key (ConstructionCode)
603
) comment '工事詳細台帳データ' ;
604

    
605
-- 工事詳細台帳明細データ
606
drop table if exists constructionledgerdetail cascade;
607

    
608
create table constructionledgerdetail (
609
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
610
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
611
  , LineCount decimal(3,0) unsigned not null comment '行番号'
612
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
613
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
614
  , FirstString varchar(120) comment '項目名称'
615
  , SecondString varchar(120) comment '工事内容'
616
  , CompanyType decimal(1,0) not null comment '協力会社コードタイプ'
617
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
618
  , CompanyName varchar(120) comment '協力会社名称'
619
  , EstimatePrice decimal(12,0) not null comment '予算(見積)金額'
620
  , ExecutionAmount decimal(12,0) not null comment '実行金額'
621
  , AmountConfigRate decimal(5,2) not null comment '金額構成率'
622
  , PaymentBurden decimal(12,0) not null comment '支払補填額'
623
  , FixDataFlg decimal(1,0) not null comment '固定データフラグ'
624
  , IndependentFlg decimal(1,0) not null comment '独立データフラグ'
625
  , FluctuationFlg decimal(1,0) not null comment '増減データフラグ'
626
  , SalaryFlg decimal(1,0) not null comment '給与振分区分'
627
  , SalaryDays decimal(4,0) not null comment '給与振分日数'
628
  , OperatingFlg decimal(1,0) not null comment '担当中フラグ'
629
  , SourceCode decimal(10,0) unsigned not null comment '元工事番号'
630
  , JoinTitleFlg decimal(1,0) not null comment '工事名称タイトル'
631
  , SalaryOnRegist decimal(12,0) not null comment '登録時月額給与'
632
  , PurchaseOrderFlg decimal(2,0) not null comment '注文書発行フラグ'
633
  , EntryDate datetime not null comment '登録日付'
634
  , UpdateDate datetime not null comment '更新日付'
635
  , constraint constructionledgerdetail_PKC primary key (ConstructionCode,GroupCount,LineCount)
636
) comment '工事詳細台帳明細データ' ;
637

    
638
create index LedgerDetail_Index01
639
  on constructionledgerdetail(ConstructionCode);
640

    
641
create index LedgerDetail_Index02
642
  on constructionledgerdetail(GroupCount);
643

    
644
create index LedgerDetail_Index03
645
  on constructionledgerdetail(SourceCode);
646

    
647
-- 工事詳細台帳実行データ
648
drop table if exists constructionledgerexcute cascade;
649

    
650
create table constructionledgerexcute (
651
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
652
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
653
  , LineCount decimal(3,0) unsigned not null comment '行番号'
654
  , ColumnCount decimal(3,0) not null comment '列番号'
655
  , PaymentAmount decimal(12,0) not null comment '支払金額'
656
  , TargetMonth date not null comment '対象年月'
657
  , EntryDate datetime not null comment '登録日付'
658
  , UpdateDate datetime not null comment '更新日付'
659
  , constraint constructionledgerexcute_PKC primary key (ConstructionCode,GroupCount,LineCount,ColumnCount)
660
) comment '工事詳細台帳実行データ' ;
661

    
662
create index LedgerExcute_Index1
663
  on constructionledgerexcute(ConstructionCode,TargetMonth,GroupCount,LineCount);
664

    
665
-- 工事リンク情報
666
drop table if exists constructionlink cascade;
667

    
668
create table constructionlink (
669
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
670
  , FluctuationCode decimal(10,0) not null comment '子工事番号'
671
  , LinkType decimal(1,0) not null comment 'リンク種別'
672
  , EntryDate datetime not null comment '登録日付'
673
  , UpdateDate datetime not null comment '更新日付'
674
  , constraint constructionlink_PKC primary key (ConstructionCode,FluctuationCode)
675
) comment '工事リンク情報' ;
676

    
677
create index ConstructionLink_Index1
678
  on constructionlink(ConstructionCode);
679

    
680
create index ConstructionLink_Index2
681
  on constructionlink(FluctuationCode);
682

    
683
create index ConstructionLink_Index3
684
  on constructionlink(LinkType);
685

    
686
-- 工事資材情報
687
drop table if exists constructionmaterialinfo cascade;
688

    
689
create table constructionmaterialinfo (
690
  CONSTRUCTIONCODE int(10) unsigned default 0 not null comment '工事番号'
691
  , MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
692
  , RENTCOUNT smallint(5) unsigned comment '貸出数'
693
  , REPAYCOUNT smallint(5) unsigned comment '返却数'
694
  , COMPLETEFLG tinyint(3) unsigned comment '完了フラグ'
695
  , ENTRYDATE datetime comment '登録日付'
696
  , UPDATEDATE datetime comment '更新日付'
697
  , constraint constructionmaterialinfo_PKC primary key (CONSTRUCTIONCODE,MATERIALITEMCODE)
698
) comment '工事資材情報' ;
699

    
700
-- 案件進捗日付データ
701
drop table if exists constructionprogressdate cascade;
702

    
703
create table constructionprogressdate (
704
  ConstructionCode decimal(10,0) not null comment '工事番号'
705
  , ConstructionStatusFlg decimal(2,0) not null comment '設定工事状態'
706
  , PreviousStatusFlg decimal(2,0) comment '変更前状態'
707
  , ChangeDate datetime not null comment '設定日付'
708
  , ChangePersonCode decimal(8,0) not null comment '設定担当者'
709
  , EntryDate datetime not null comment '登録日付'
710
  , UpdateDate datetime not null comment '更新日付'
711
  , constraint constructionprogressdate_PKC primary key (ConstructionCode,ConstructionStatusFlg)
712
) comment '案件進捗日付データ' ;
713

    
714
-- 作業マスタ
715
drop table if exists constructionspecmaster cascade;
716

    
717
create table constructionspecmaster (
718
  ItemCode decimal(5,0) unsigned not null comment '工種キー'
719
  , SpecCode decimal(5,0) unsigned not null comment '作業キー'
720
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
721
  , ItemName varchar(120) comment '作業名称'
722
  , SpecName varchar(120) comment '作業名称'
723
  , UnitName varchar(30) comment '単位名称'
724
  , UnitPrice decimal(9,2) not null comment '単価'
725
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
726
  , EntryDate datetime not null comment '登録日付'
727
  , UpdateDate datetime not null comment '更新日付'
728
  , constraint constructionspecmaster_PKC primary key (ItemCode,SpecCode)
729
) comment '作業マスタ' ;
730

    
731
create index ConstructionSpecMaster_Index1
732
  on constructionspecmaster(DisplayOrder);
733

    
734
-- 作業単価マスタ
735
drop table if exists constructionspecunitprice cascade;
736

    
737
create table constructionspecunitprice (
738
  ComponentCode decimal(5,0) unsigned not null comment '構成キー'
739
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
740
  , SpecCode decimal(5,0) unsigned not null comment '作業キー'
741
  , ConstructionTypeCode mediumint(8) unsigned not null comment '工事種別コード'
742
  , UnitPrice decimal(9,2) not null comment '単価'
743
  , EntryDate datetime not null comment '登録日付'
744
  , UpdateDate datetime not null comment '更新日付'
745
  , constraint constructionspecunitprice_PKC primary key (ComponentCode,ItemCode,SpecCode,ConstructionTypeCode)
746
) comment '作業単価マスタ' ;
747

    
748
-- 工事種別マスタ
749
drop table if exists constructiontypemaster cascade;
750

    
751
create table constructiontypemaster (
752
  TypeCode decimal(5,0) unsigned not null comment '工事種別コード'
753
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
754
  , NameString varchar(100) not null comment '名称'
755
  , PublicFlg decimal(1,0) not null comment '工事種別フラグ'
756
  , SecRank decimal(1,0) not null comment '保護区分ランク'
757
  , ExpensesLink decimal(1,0) not null comment '経費使用区分'
758
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
759
  , EntryDate datetime not null comment '登録日付'
760
  , UpdateDate datetime not null comment '更新日付'
761
  , constraint constructiontypemaster_PKC primary key (TypeCode)
762
) comment '工事種別マスタ' ;
763

    
764
-- 担当者毎経費データ
765
drop table if exists costdataofperson cascade;
766

    
767
create table costdataofperson (
768
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
769
  , ActionDate date not null comment '対象日付'
770
  , DataType decimal(1,0) not null comment 'データ区分'
771
  , DataAddCount decimal(5,0) unsigned not null comment 'データ追加番号'
772
  , TargetMonth varchar(7) not null comment '対象年月'
773
  , ConstructionCode decimal(10,0) unsigned comment '工事コード'
774
  , SuppliersCode decimal(5,0) unsigned not null comment '支払先コード'
775
  , SuppliersName varchar(120) comment '支払先名称'
776
  , PaymentContent varchar(60) comment '支払内容'
777
  , PaymentType decimal(1,0) not null comment '支払方法フラグ'
778
  , EntryPrice decimal(12,0) not null comment '金額(税抜)'
779
  , EntryPriceInTax decimal(12,0) not null comment '金額(税込)'
780
  , SlipNumber varchar(12) comment '伝票番号'
781
  , ComplateFlg decimal(1,0) not null comment '引込済みフラグ'
782
  , ApprovalFlg decimal(1,0) not null comment '承認フラグ'
783
  , EntryDate datetime not null comment '登録日付'
784
  , UpdateDate datetime not null comment '更新日付'
785
  , constraint costdataofperson_PKC primary key (PersonCode,ActionDate,DataType,DataAddCount)
786
) comment '担当者毎経費データ' ;
787

    
788
create index CostDataOfPerson_Index1
789
  on costdataofperson(TargetMonth);
790

    
791
create index CostDataOfPerson_Index2
792
  on costdataofperson(ConstructionCode);
793

    
794
-- 発注者登録申請データ
795
drop table if exists costomerregist cascade;
796

    
797
create table costomerregist (
798
  PersonCode decimal(8,0) unsigned not null comment '申請者番号'
799
  , CreateDate date not null comment '作成日'
800
  , SeqNo decimal(2,0) not null comment 'キー連番'
801
  , DataMode decimal(1,0) not null comment 'データ区分'
802
  , SourceCotegory decimal(5,0) unsigned not null comment '発注者区分'
803
  , SourceCode decimal(5,0) unsigned not null comment '発注者コード'
804
  , PetitionPeriod decimal(4,0) unsigned not null comment '事業期'
805
  , OrderFlg decimal(1,0) not null comment '法人団体・個人フラグ'
806
  , CorporateStatusName varchar(100) comment '法人格名称'
807
  , CorporateStatusPoint decimal(1,0) comment '法人格名称位置'
808
  , OrderersName1 varchar(60) not null comment '発注者名1'
809
  , OrderersName2 varchar(60) comment '発注者名2'
810
  , DepartmentName varchar(60) comment '部署名'
811
  , ChargePersonName varchar(60) comment '担当者名'
812
  , ZipCode varchar(8) comment '郵便番号'
813
  , Address1 varchar(60) comment '住所1'
814
  , Address2 varchar(60) comment '住所2'
815
  , Address3 varchar(60) comment '住所3'
816
  , PhoneNumber varchar(13) comment '電話番号'
817
  , FaxNumber varchar(13) comment 'FAX番号'
818
  , MailAddress varchar(257) comment 'メールアドレス'
819
  , Note varchar(300) comment '備考'
820
  , OrderCotegory decimal(5,0) unsigned not null comment '発注者区分'
821
  , OrderDate date not null comment '申請日'
822
  , OrderNo decimal(2,0) unsigned not null comment '申請受付番号'
823
  , EntryDate datetime not null comment '登録日付'
824
  , UpdateDate datetime not null comment '更新日付'
825
  , constraint costomerregist_PKC primary key (PersonCode,CreateDate,SeqNo)
826
) comment '発注者登録申請データ' ;
827

    
828
create index CostomerRegist_Index1
829
  on costomerregist(PetitionPeriod);
830

    
831
-- 日報データ
832
drop table if exists dailydataconstruction cascade;
833

    
834
create table dailydataconstruction (
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
  , constraint dailydataconstruction_PKC primary key (PersonCode,DailyDataDate,ConstructionCode)
842
) comment '日報データ' ;
843

    
844
create index DailyDataConstruction_Index1
845
  on dailydataconstruction(PersonCode);
846

    
847
create index DailyDataConstruction_Index2
848
  on dailydataconstruction(DailyDataDate);
849

    
850
create index DailyDataConstruction_Index3
851
  on dailydataconstruction(ConstructionCode);
852

    
853
-- 日報データ (明細)
854
drop table if exists dailydatadetail cascade;
855

    
856
create table dailydatadetail (
857
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
858
  , DailyDataDate date not null comment '日報作成日'
859
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
860
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
861
  , JobCategoryCode decimal(5,0) not null comment '職種キー'
862
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
863
  , TodayHeadCount decimal(4,1) not null comment '当日人員数'
864
  , TotalHeadCount decimal(5,1) not null comment '累計人員数'
865
  , TodayWork varchar(100) comment '当日作業内容'
866
  , NextdayWork varchar(100) comment '翌日作業内容'
867
  , NextdayHeadCount decimal(4,1) not null comment '翌日人員数'
868
  , EntryDate datetime not null comment '登録日付'
869
  , UpdateDate datetime not null comment '更新日付'
870
  , constraint dailydatadetail_PKC primary key (PersonCode,DailyDataDate,ConstructionCode,SeqNo)
871
) comment '日報データ (明細)' ;
872

    
873
create index DailyDataDetail_Index
874
  on dailydatadetail(PersonCode,DailyDataDate,ConstructionCode);
875

    
876
-- 日報データ (現場巡回)
877
drop table if exists dailydatafield cascade;
878

    
879
create table dailydatafield (
880
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
881
  , DailyDataDate date not null comment '日報作成日'
882
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
883
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
884
  , PatrolTime datetime not null comment '巡回時間'
885
  , ContentsText varchar(200) comment '内容'
886
  , EntryDate datetime not null comment '登録日付'
887
  , UpdateDate datetime not null comment '更新日付'
888
  , constraint dailydatafield_PKC primary key (PersonCode,DailyDataDate,ConstructionCode,SeqNo)
889
) comment '日報データ (現場巡回)' ;
890

    
891
create index DailyDataField_Index
892
  on dailydatafield(PersonCode,DailyDataDate,ConstructionCode);
893

    
894
-- 日報データ (資材)
895
drop table if exists dailydatamaterials cascade;
896

    
897
create table dailydatamaterials (
898
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
899
  , DailyDataDate date not null comment '日報作成日'
900
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
901
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
902
  , Materials varchar(100) comment '資材名'
903
  , Quantity varchar(100) comment '数量'
904
  , Production varchar(100) comment '制作会社'
905
  , Delivery varchar(100) comment '納入業者'
906
  , QualityControl varchar(100) comment '品質管理事項'
907
  , EntryDate datetime not null comment '登録日付'
908
  , UpdateDate datetime not null comment '更新日付'
909
  , constraint dailydatamaterials_PKC primary key (PersonCode,DailyDataDate,ConstructionCode,SeqNo)
910
) comment '日報データ (資材)' ;
911

    
912
create index DailyDataMaterials_Index
913
  on dailydatamaterials(PersonCode,DailyDataDate,ConstructionCode);
914

    
915
-- 日報データ (協力業者指示)
916
drop table if exists dailydatasubcontractors cascade;
917

    
918
create table dailydatasubcontractors (
919
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
920
  , DailyDataDate date not null comment '日報作成日'
921
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
922
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
923
  , Attendee varchar(100) comment '出席者'
924
  , ContentsText varchar(200) comment '内容'
925
  , EntryDate datetime not null comment '登録日付'
926
  , UpdateDate datetime not null comment '更新日付'
927
  , constraint dailydatasubcontractors_PKC primary key (PersonCode,DailyDataDate,ConstructionCode,SeqNo)
928
) comment '日報データ (協力業者指示)' ;
929

    
930
create index DailyDataSubcontractors_Index
931
  on dailydatasubcontractors(PersonCode,DailyDataDate,ConstructionCode);
932

    
933
-- 日報データ (車両)
934
drop table if exists dailydatavehicles cascade;
935

    
936
create table dailydatavehicles (
937
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
938
  , DailyDataDate date not null comment '日報作成日'
939
  , ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
940
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
941
  , Model varchar(100) comment '機種'
942
  , Performance varchar(100) comment '性能'
943
  , Owner varchar(100) comment '所有会社'
944
  , Driver varchar(100) comment '当日運転者'
945
  , StartWorkingTime datetime not null comment '作業時間開始'
946
  , EndWorkingTime datetime not null comment '作業時間終了'
947
  , EntryDate datetime not null comment '登録日付'
948
  , UpdateDate datetime not null comment '更新日付'
949
  , constraint dailydatavehicles_PKC primary key (PersonCode,DailyDataDate,ConstructionCode,SeqNo)
950
) comment '日報データ (車両)' ;
951

    
952
create index DailyDataVehicles_Index
953
  on dailydatavehicles(PersonCode,DailyDataDate,ConstructionCode);
954

    
955
-- 日マスタ
956
drop table if exists daymaster cascade;
957

    
958
create table daymaster (
959
  days smallint(6) not null comment ''
960
) comment '日マスタ' ;
961

    
962
create index day_Index1
963
  on daymaster(days);
964

    
965
-- 締日マスタ
966
drop table if exists deadlinemaster cascade;
967

    
968
create table deadlinemaster (
969
  LABOURKIND decimal(1,0) default '0' not null comment '手間業者区分'
970
  , DEADLINE decimal(2,0) comment '締日'
971
  , PAYDAY decimal(2,0) comment '支払日'
972
  , NOTE varchar(120) comment '備考'
973
  , DELETEFLG decimal(1,0) comment '削除フラグ'
974
  , ENTRYDATE datetime comment '登録日付'
975
  , UPDATEDATE datetime comment '更新日付'
976
  , constraint deadlinemaster_PKC primary key (LABOURKIND)
977
) comment '締日マスタ' ;
978

    
979
-- 部署経費率マスタ
980
drop table if exists departmentexpensesmaster cascade;
981

    
982
create table departmentexpensesmaster (
983
  DepartmentCode decimal(5,0) unsigned not null comment '部署コード'
984
  , ExpensesPeriod smallint(6) not null comment '事業期'
985
  , NameCode decimal(5,0) unsigned not null comment '経費名称コード'
986
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
987
  , ExpensesRaito decimal(4,2) not null comment '経費率'
988
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
989
  , EntryDate datetime not null comment '登録日付'
990
  , UpdateDate datetime not null comment '更新日付'
991
  , constraint departmentexpensesmaster_PKC primary key (DepartmentCode,ExpensesPeriod,NameCode)
992
) comment '部署経費率マスタ' ;
993

    
994
-- 部署マスタ
995
drop table if exists departmentmaster cascade;
996

    
997
create table departmentmaster (
998
  DepartmentCode decimal(5,0) unsigned not null comment '部署コード'
999
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
1000
  , DepartmentString varchar(100) not null comment '部署名'
1001
  , ActionScheduleFlg decimal(1,0) not null comment '行動予定表示フラグ'
1002
  , StaffAssignFlg decimal(1,0) not null comment '人員配置表示フラグ'
1003
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
1004
  , EntryDate datetime not null comment '登録日付'
1005
  , UpdateDate datetime not null comment '更新日付'
1006
  , constraint departmentmaster_PKC primary key (DepartmentCode)
1007
) comment '部署マスタ' ;
1008

    
1009
create index DepartmentMaster_index1
1010
  on departmentmaster(DisplayOrder);
1011

    
1012
-- 入金確認承認データ
1013
drop table if exists depositapprovalinfo cascade;
1014

    
1015
create table depositapprovalinfo (
1016
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
1017
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
1018
  , TARGETDATE decimal(6,0) not null comment '対象年月'
1019
  , SEQNO decimal(3,0) not null comment '連番'
1020
  , LINECOUNT decimal(3,0) not null comment '行番号'
1021
  , APPROVALNO decimal(3,0) not null comment '承認順序'
1022
  , APPROVALPERSON decimal(8,0) comment '承認者コード'
1023
  , APPROVALPERSONNAME varchar(20) comment '承認者名'
1024
  , APPROVALAUTHORITY decimal(1,0) comment '承認権限区分'
1025
  , APPROVALDATE date comment '承認日付'
1026
  , ENTRYDATE datetime comment '登録日付'
1027
  , UPDATEDATE datetime comment '更新日付'
1028
  , constraint depositapprovalinfo_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO)
1029
) comment '入金確認承認データ' ;
1030

    
1031
-- 入金データ
1032
drop table if exists depositdata cascade;
1033

    
1034
create table depositdata (
1035
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
1036
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
1037
  , TARGETDATE decimal(6,0) not null comment '対象年月'
1038
  , SEQNO decimal(3,0) not null comment '連番'
1039
  , BUSINESSPERIOD decimal(4,0) comment '営業期'
1040
  , DEPOSITDATE date comment '入金日'
1041
  , DEPOSITAMOUNT decimal(12,0) comment '入金金額'
1042
  , DEPOSITAMOUNTCASH decimal(10,0) comment '入金金額(現金)'
1043
  , DEPOSITAMOUNTBILL decimal(10,0) comment '入金金額(手形)'
1044
  , DEPOSITPERSONCODE decimal(8,0) not null comment '入金担当者コード'
1045
  , NOTE varchar(120) comment '備考'
1046
  , ENTRYDATE datetime comment '登録日付'
1047
  , UPDATEDATE datetime comment '更新日付'
1048
  , constraint depositdata_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO)
1049
) comment '入金データ' ;
1050

    
1051
-- 入金明細データ
1052
drop table if exists depositdatadetail cascade;
1053

    
1054
create table depositdatadetail (
1055
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
1056
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
1057
  , TARGETDATE decimal(6,0) not null comment '対象年月'
1058
  , REQUESTNO decimal(10,0) not null comment '請求No'
1059
  , ORDERNO decimal(2,0) comment '受付番号'
1060
  , DEPOSITAMOUNT decimal(10,0) comment '入金金額'
1061
  , DISCOUNTAMOUNT decimal(10,0) comment '値引き金額'
1062
  , CNSTRPRICE decimal(10,0) comment '協力金'
1063
  , FEES decimal(10,0) comment '手数料'
1064
  , OTHERADJUSTMENTS decimal(10,0) comment 'その他'
1065
  , DIFFERENCEAMOUNT decimal(10,0) comment '差分'
1066
  , CONFIRMATIONPERSONCODE decimal(8,0) comment '確認担当者コード'
1067
  , CONFIRMATIONDATE date comment '担当者確認日付'
1068
  , CONFIRMATIONENDFLG decimal(1,0) comment '確認完了フラグ'
1069
  , NOTE varchar(120) comment '備考'
1070
  , ENTRYDATE datetime comment '登録日付'
1071
  , UPDATEDATE datetime comment '更新日付'
1072
  , constraint depositdatadetail_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,REQUESTNO)
1073
) comment '入金明細データ' ;
1074

    
1075
-- 区分マスタ
1076
drop table if exists divisionmaster cascade;
1077

    
1078
create table divisionmaster (
1079
  DivisionCode decimal(5,0) unsigned not null comment '区分コード'
1080
  , NameCode decimal(5,0) unsigned not null comment '名称コード'
1081
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
1082
  , NameString varchar(100) not null comment '名称'
1083
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
1084
  , EntryDate datetime not null comment '登録日付'
1085
  , UpdateDate datetime not null comment '更新日付'
1086
  , constraint divisionmaster_PKC primary key (DivisionCode,NameCode)
1087
) comment '区分マスタ' ;
1088

    
1089
-- 積算予算書データ
1090
drop table if exists estimatebudget cascade;
1091

    
1092
create table estimatebudget (
1093
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1094
  , ConstructionTime decimal(5,2) unsigned not null comment '工期'
1095
  , IntegratedCode decimal(8,0) not null comment '積算者'
1096
  , DataCreateDate datetime not null comment 'データ引込日'
1097
  , RetValue1 decimal(12,0) not null comment '予定価格'
1098
  , RetValue2 decimal(12,0) not null comment '直接工事費'
1099
  , RetValue3 decimal(12,0) not null comment '積み上げ共通仮設費'
1100
  , RetValue4 decimal(12,0) not null comment '積み上げ現場管理費'
1101
  , RetPercent decimal(5,2) not null comment '一般管理費率'
1102
  , EntryDate datetime not null comment '登録日付'
1103
  , UpdateDate datetime not null comment '更新日付'
1104
  , constraint estimatebudget_PKC primary key (ConstructionCode)
1105
) comment '積算予算書データ' ;
1106

    
1107
-- 積算予算内訳データ明細
1108
drop table if exists estimatebudgetdetail cascade;
1109

    
1110
create table estimatebudgetdetail (
1111
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1112
  , GroupCount decimal(2,0) unsigned not null comment 'グループ番号'
1113
  , LineCount decimal(3,0) unsigned not null comment '行番号'
1114
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
1115
  , ItemCode decimal(5,0) unsigned comment '工種キー'
1116
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
1117
  , FirstString varchar(120) comment '大項目名称'
1118
  , SecondString varchar(120) comment '工種名称・協力会社名'
1119
  , Content varchar(120) comment '内容'
1120
  , EstimatePrice decimal(12,0) not null comment '見積時金額'
1121
  , NegotiationPrice decimal(12,0) not null comment '交渉時金額'
1122
  , Notes varchar(120) comment '注意事項'
1123
  , EntryDate datetime not null comment '登録日付'
1124
  , UpdateDate datetime not null comment '更新日付'
1125
  , constraint estimatebudgetdetail_PKC primary key (ConstructionCode,GroupCount,LineCount)
1126
) comment '積算予算内訳データ明細' ;
1127

    
1128
-- 積算見積データ
1129
drop table if exists estimatedata cascade;
1130

    
1131
create table estimatedata (
1132
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1133
  , LineCount decimal(3,0) unsigned not null comment '行番号'
1134
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
1135
  , FixedItemCode varchar(1) comment '固定項目キー'
1136
  , ItemName varchar(120) comment '作業名称'
1137
  , SpecName varchar(120) comment '作業/品質・形状・寸法'
1138
  , PriceValue decimal(14,0) not null comment '金額'
1139
  , note varchar(60) comment '備考'
1140
  , MyExpensesFlg decimal(1,0) not null comment '自社経費フラグ'
1141
  , InputFlg decimal(1,0) not null comment '入力フラグ'
1142
  , EntryDate datetime not null comment '登録日付'
1143
  , UpdateDate datetime not null comment '更新日付'
1144
  , constraint estimatedata_PKC primary key (ConstructionCode,LineCount)
1145
) comment '積算見積データ' ;
1146

    
1147
create index EstimateData_Index1
1148
  on estimatedata(ConstructionCode,FixedItemCode);
1149

    
1150
-- 積算見積ページデータ
1151
drop table if exists estimatedatabody cascade;
1152

    
1153
create table estimatedatabody (
1154
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1155
  , PageCount decimal(4,0) unsigned not null comment 'ページ番号'
1156
  , Category decimal(1,0) not null comment 'ページ区分'
1157
  , UnionComponentCode decimal(5,0) unsigned not null comment '所属構成キー'
1158
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
1159
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
1160
  , SelectComponent decimal(5,0) unsigned not null comment '選択構成キー'
1161
  , PageTitle varchar(120) not null comment 'ページ表示名'
1162
  , DetailLineCount decimal(3,0) unsigned not null comment '明細行番号'
1163
  , EntryDate datetime not null comment '登録日付'
1164
  , UpdateDate datetime not null comment '更新日付'
1165
  , constraint estimatedatabody_PKC primary key (ConstructionCode,PageCount)
1166
) comment '積算見積ページデータ' ;
1167

    
1168
create index EstimateDataBody_Index1
1169
  on estimatedatabody(ConstructionCode,ComponentCode,ItemCode);
1170

    
1171
-- 積算見積データ明細
1172
drop table if exists estimatedatadetail cascade;
1173

    
1174
create table estimatedatadetail (
1175
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1176
  , PageCount decimal(4,0) unsigned not null comment 'ページ番号'
1177
  , LineCount decimal(3,0) unsigned not null comment '行番号'
1178
  , DataType decimal(1,0) not null comment 'データ種別'
1179
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
1180
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
1181
  , SpecCode decimal(5,0) unsigned not null comment '作業キー'
1182
  , ItemName varchar(120) comment '作業名称'
1183
  , SpecName varchar(120) comment '作業/品質・形状・寸法'
1184
  , Unitcount decimal(8,2) not null comment '数量'
1185
  , UnitName varchar(30) comment '単位名称'
1186
  , UnitPrice decimal(9,2) not null comment '単価'
1187
  , LineTotal decimal(12,0) not null comment '金額'
1188
  , note varchar(60) comment '備考'
1189
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
1190
  , MyExpensesFlg decimal(1,0) not null comment '自社経費フラグ'
1191
  , InputFlg decimal(1,0) comment '入力フラグ'
1192
  , EntryDate datetime not null comment '登録日付'
1193
  , UpdateDate datetime not null comment '更新日付'
1194
  , constraint estimatedatadetail_PKC primary key (ConstructionCode,PageCount,LineCount)
1195
) comment '積算見積データ明細' ;
1196

    
1197
create index EstimateDataDetail_Index1
1198
  on estimatedatadetail(ConstructionCode,PageCount);
1199

    
1200
-- 経費率マスタ
1201
drop table if exists expensesmaster cascade;
1202

    
1203
create table expensesmaster (
1204
  DivisionCode smallint(6) not null comment '工事種別コード'
1205
  , NameCode smallint(6) not null comment '経費名称コード'
1206
  , DisplayOrder smallint(6) not null comment '表示順'
1207
  , ExpensesRatio decimal(4,2) not null comment '経費率'
1208
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
1209
  , EntryDate datetime not null comment '登録日付'
1210
  , UpdateDate datetime not null comment '更新日付'
1211
  , constraint expensesmaster_PKC primary key (DivisionCode,NameCode)
1212
) comment '経費率マスタ' ;
1213

    
1214
-- 会社休日マスタ
1215
drop table if exists holidaycalendermaster cascade;
1216

    
1217
create table holidaycalendermaster (
1218
  Holiday date not null comment '休日'
1219
  , BusinessYear smallint(5) unsigned not null comment '営業年度'
1220
  , TargetMonth tinyint(3) unsigned not null comment '該当月'
1221
  , TargetDay tinyint(3) unsigned not null comment '該当日'
1222
  , constraint holidaycalendermaster_PKC primary key (Holiday)
1223
) comment '会社休日マスタ' ;
1224

    
1225
create index HolidayCalender_Index1
1226
  on holidaycalendermaster(BusinessYear);
1227

    
1228
create index HolidayCalenderMaster_Index2
1229
  on holidaycalendermaster(TargetMonth);
1230

    
1231
create index HolidayCalenderMaster_Index3
1232
  on holidaycalendermaster(TargetDay);
1233

    
1234
-- 入力時検索履歴
1235
drop table if exists inputsearchlogdata cascade;
1236

    
1237
create table inputsearchlogdata (
1238
  ConstructionCode decimal(10,0) not null comment '工事コード'
1239
  , UsedProcessNo decimal(4,0) not null comment '使用機能番号'
1240
  , DisplayOrder decimal(4,0) unsigned not null comment '表示順'
1241
  , DataType decimal(1,0) not null comment 'データ種別'
1242
  , InputCode decimal(10,0) comment '入力コード'
1243
  , constraint inputsearchlogdata_PKC primary key (ConstructionCode,UsedProcessNo,DisplayOrder)
1244
) comment '入力時検索履歴' ;
1245

    
1246
create index InputSearchLogData_Index1
1247
  on inputsearchlogdata(ConstructionCode,UsedProcessNo,InputCode);
1248

    
1249
-- 請求書データ
1250
drop table if exists invoicedata cascade;
1251

    
1252
create table invoicedata (
1253
  INVOICENO decimal(9,0) not null comment '請求書No'
1254
  , ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
1255
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
1256
  , REQUESTMONTH decimal(6,0) not null comment '請求月'
1257
  , SEQNO decimal(2,0) not null comment '連番'
1258
  , CRETATEDATE date not null comment '作成日'
1259
  , REQUESTDATE date not null comment '請求日'
1260
  , REQUESTNAME varchar(120) comment '請求先名'
1261
  , TOTALAMOUNT decimal(10,0) comment '税込み合計金額'
1262
  , TAXAMOUNT decimal(10,0) comment '消費税金額'
1263
  , COMMENT1 varchar(60) comment 'コメント1'
1264
  , COMMENT2 varchar(60) comment 'コメント2'
1265
  , COMMENT3 varchar(60) not null comment 'コメント3'
1266
  , COMMENT4 varchar(60) not null comment 'コメント4'
1267
  , COMMENT5 varchar(60) not null comment 'コメント5'
1268
  , COMPLETEFLG decimal(1,0) default '0' not null comment '完了フラグ'
1269
  , ENTRYDATE datetime not null comment '登録年月日'
1270
  , UPDATEDATE datetime not null comment '更新年月日'
1271
  , constraint invoicedata_PKC primary key (INVOICENO)
1272
) comment '請求書データ' ;
1273

    
1274
alter table invoicedata add unique ORDERERSDIVISION (ORDERERSDIVISION,ORDERERSCODE,REQUESTMONTH,SEQNO) ;
1275

    
1276
-- 資材情報
1277
drop table if exists materialinfo cascade;
1278

    
1279
create table materialinfo (
1280
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
1281
  , MATERIALCOUNT smallint(5) unsigned comment '資材数'
1282
  , RENTCOUNT smallint(5) unsigned comment '貸出可能数'
1283
  , DELETEFLG smallint(5) unsigned comment '削除フラグ'
1284
  , ENTRYDATE datetime comment '登録日付'
1285
  , UPDATEDATE datetime comment '更新日付'
1286
  , constraint materialinfo_PKC primary key (MATERIALITEMCODE)
1287
) comment '資材情報' ;
1288

    
1289
-- 資材品目マスタ
1290
drop table if exists materialitemmaster cascade;
1291

    
1292
create table materialitemmaster (
1293
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
1294
  , MATERIALKINDCODE smallint(5) unsigned comment '資材種類コード'
1295
  , MATERIALITEMNAME varchar(40) comment '資材品目名称'
1296
  , DISPLAYORDER smallint(5) unsigned comment '表示順'
1297
  , DELETEFLG tinyint(3) unsigned comment '削除フラグ'
1298
  , ENTRYDATE datetime comment '登録日付'
1299
  , UPDATEDATE datetime comment '更新日付'
1300
  , VERSIONNO decimal(8,0) default '0' not null comment 'バージョン番号'
1301
  , constraint materialitemmaster_PKC primary key (MATERIALITEMCODE)
1302
) comment '資材品目マスタ' ;
1303

    
1304
-- 資材種類マスタ
1305
drop table if exists materialkindmaster cascade;
1306

    
1307
create table materialkindmaster (
1308
  MATERIALKINDCODE smallint(5) unsigned default 0 not null comment '資材種類コード'
1309
  , MATERIALKINDNAME varchar(40) comment '資材種類名称'
1310
  , DISPLAYORDER smallint(5) unsigned comment '表示順'
1311
  , DELETEFLG tinyint(3) unsigned comment '削除フラグ'
1312
  , ENTRYDATE datetime comment '登録日付'
1313
  , UPDATEDATE datetime comment '更新日付'
1314
  , constraint materialkindmaster_PKC primary key (MATERIALKINDCODE)
1315
) comment '資材種類マスタ' ;
1316

    
1317
-- 資材履歴情報
1318
drop table if exists materialrecordinfo cascade;
1319

    
1320
create table materialrecordinfo (
1321
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '資材品目コード'
1322
  , PROCESSDATE date default '0000-00-00' not null comment '処理年月日'
1323
  , SEQNO smallint(5) unsigned default 0 not null comment '連番'
1324
  , RECKIND tinyint(3) unsigned comment 'レコード区分'
1325
  , CONSTRUCTIONCODE int(10) unsigned comment '工事番号'
1326
  , PERSONCODE int(10) unsigned comment '担当者コード'
1327
  , MATERIALCOUNT smallint(5) unsigned comment '資材数'
1328
  , REPAYPLANDATE date comment '返却予定年月日'
1329
  , COMMENTTEXT varchar(80) comment 'コメント'
1330
  , ENTRYDATE datetime comment '登録日付'
1331
  , UPDATEDATE datetime comment '更新日付'
1332
  , constraint materialrecordinfo_PKC primary key (MATERIALITEMCODE,PROCESSDATE,SEQNO)
1333
) comment '資材履歴情報' ;
1334

    
1335
-- 掲示板メッセージ
1336
drop table if exists messageboarddata cascade;
1337

    
1338
create table messageboarddata (
1339
  RecordNumber decimal(6,0) unsigned not null comment 'レコード番号'
1340
  , BranchNumber decimal(3,0) unsigned not null comment 'レコード枝番'
1341
  , FromCode decimal(8,0) unsigned not null comment '書込み者コード'
1342
  , FromName varchar(60) not null comment '書込み者'
1343
  , MessageTitile varchar(100) comment '伝言タイトル'
1344
  , MessageContent varchar(1333) not null comment '伝言内容'
1345
  , LinkType decimal(2,0) not null comment 'リンク動作タイプ'
1346
  , LinkMessage varchar(200) comment 'リンク文字列'
1347
  , LinkCode varchar(30) comment 'リンクキー'
1348
  , WritingDate datetime not null comment '書込み日時'
1349
  , PersonCode decimal(8,0) not null comment '書込み担当者コード'
1350
  , ShareFlag decimal(2,0) not null comment '管理者対象フラグ'
1351
  , MessageColor varchar(8) comment '文字色'
1352
  , BackColor varchar(8) comment 'バックカラー'
1353
  , MessageFlag decimal(1,0) not null comment 'メッセージフラグ'
1354
  , EntryDate datetime not null comment '登録日付'
1355
  , UpdateDate datetime not null comment '更新日付'
1356
  , constraint messageboarddata_PKC primary key (RecordNumber,BranchNumber)
1357
) comment '掲示板メッセージ' ;
1358

    
1359
create index MessageBoardData_Index1
1360
  on messageboarddata(WritingDate);
1361

    
1362
create index MessageBoardData_Index2
1363
  on messageboarddata(MessageFlag);
1364

    
1365
-- 掲示板対象者テーブル
1366
drop table if exists messageboardterget cascade;
1367

    
1368
create table messageboardterget (
1369
  RecordNumber decimal(6,0) unsigned not null comment 'レコード番号'
1370
  , BranchNumber decimal(3,0) unsigned not null comment 'レコード枝番'
1371
  , SeqNum decimal(3,0) unsigned not null comment '順番'
1372
  , ToCode decimal(8,0) not null comment '対象者コード'
1373
  , ToName varchar(60) not null comment '対象者'
1374
  , EntryDate datetime not null comment '登録日付'
1375
  , UpdateDate datetime not null comment '更新日付'
1376
  , constraint messageboardterget_PKC primary key (RecordNumber,BranchNumber,SeqNum)
1377
) comment '掲示板対象者テーブル' ;
1378

    
1379
create index MessageBoardTerget_Index1
1380
  on messageboardterget(RecordNumber,BranchNumber);
1381

    
1382
-- 掲示板メッセージ閲覧履歴
1383
drop table if exists messagebrowsinghistory cascade;
1384

    
1385
create table messagebrowsinghistory (
1386
  RecordNumber decimal(6,0) unsigned not null comment 'レコード番号'
1387
  , BranchNumber decimal(3,0) unsigned not null comment 'レコード枝番'
1388
  , SeqNum decimal(3,0) unsigned not null comment '順番'
1389
  , BrowsingCode decimal(8,0) not null comment '閲覧者コード'
1390
  , BrowsingDate datetime not null comment '閲覧日付'
1391
  , EntryDate datetime not null comment '登録日付'
1392
  , UpdateDate datetime not null comment '更新日付'
1393
  , constraint messagebrowsinghistory_PKC primary key (RecordNumber,BranchNumber,SeqNum)
1394
) comment '掲示板メッセージ閲覧履歴' ;
1395

    
1396
-- 月マスタ
1397
drop table if exists monthmaster cascade;
1398

    
1399
create table monthmaster (
1400
  month smallint(6) not null comment ''
1401
) comment '月マスタ' ;
1402

    
1403
create index month_Index1
1404
  on monthmaster(month);
1405

    
1406
-- 発注者マスタ
1407
drop table if exists orderersmaster cascade;
1408

    
1409
create table orderersmaster (
1410
  OrderCotegory decimal(5,0) unsigned not null comment '発注者区分'
1411
  , OrderersCode decimal(5,0) unsigned not null comment '発注者コード'
1412
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
1413
  , OrderFlg decimal(1,0) not null comment '法人団体・個人フラグ'
1414
  , CorporateStatusName varchar(100) comment '法人格名称'
1415
  , CorporateStatusPoint decimal(1,0) comment '法人格名称位置'
1416
  , OrderersName1 varchar(60) not null comment '発注者名1'
1417
  , OrderersName2 varchar(60) comment '発注者名2'
1418
  , DepartmentName varchar(60) comment '部署名'
1419
  , ChargePersonName varchar(60) comment '担当者名'
1420
  , ZipCode varchar(8) comment '郵便番号'
1421
  , Address1 varchar(60) comment '住所1'
1422
  , Address2 varchar(60) comment '住所2'
1423
  , Address3 varchar(60) comment '住所3'
1424
  , PhoneNumber varchar(13) comment '電話番号'
1425
  , FaxNumber varchar(13) comment 'FAX番号'
1426
  , MailAddress varchar(257) comment 'メールアドレス'
1427
  , Note varchar(300) comment '備考'
1428
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
1429
  , EntryDate datetime not null comment '登録日付'
1430
  , UpdateDate datetime not null comment '更新日付'
1431
  , constraint orderersmaster_PKC primary key (OrderCotegory,OrderersCode)
1432
) comment '発注者マスタ' ;
1433

    
1434
-- 受注金額データ
1435
drop table if exists orderspricedata cascade;
1436

    
1437
create table orderspricedata (
1438
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1439
  , ChangeNo decimal(3,0) unsigned not null comment '変更番号'
1440
  , ChangeDate date not null comment '変更日'
1441
  , ChangePersonCode decimal(8,0) unsigned not null comment '変更者コード'
1442
  , ChangePersonName varchar(60) comment '変更者名'
1443
  , BeforeValue decimal(14,0) not null comment '変更前税抜受注金額'
1444
  , BeforeValueInTax decimal(14,0) not null comment '変更前税込受注金額'
1445
  , AfterValue decimal(14,0) not null comment '変更後税抜受注金額'
1446
  , AfterValueInTax decimal(14,0) not null comment '変更後税込受注金額'
1447
  , ChangeComment varchar(200) comment '変更理由'
1448
  , EntryDate datetime not null comment '登録日付'
1449
  , UpdateDate datetime not null comment '更新日付'
1450
  , constraint orderspricedata_PKC primary key (ConstructionCode,ChangeNo)
1451
) comment '受注金額データ' ;
1452

    
1453
-- 支払承認情報データ
1454
drop table if exists paymentapprovalinfo cascade;
1455

    
1456
create table paymentapprovalinfo (
1457
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
1458
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
1459
  , SEQNO decimal(3,0) default '0' not null comment '連番'
1460
  , LINECOUNT decimal(3,0) default '0' not null comment '行番号'
1461
  , APPROVALNO decimal(3,0) default '0' not null comment '承認順序'
1462
  , APPROVALPERSON decimal(8,0) comment '承認者コード'
1463
  , APPROVALPERSONNAME varchar(20) comment '承認者名'
1464
  , APPROVALAUTHORITY decimal(1,0) comment '承認権限区分'
1465
  , APPROVALDATE date comment '承認日付'
1466
  , ENTRYDATE datetime comment '登録日付'
1467
  , UPDATEDATE datetime comment '更新日付'
1468
  , constraint paymentapprovalinfo_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO)
1469
) comment '支払承認情報データ' ;
1470

    
1471
-- 支払明細データ
1472
drop table if exists paymentdatadetail cascade;
1473

    
1474
create table paymentdatadetail (
1475
  COMPANYCODE decimal(8,0) default '0' not null comment '協力会社コード'
1476
  , TARGETDATE decimal(6,0) default '0' not null comment '対象年月'
1477
  , SEQNO decimal(3,0) default '0' not null comment '連番'
1478
  , LINECOUNT decimal(3,0) default '0' not null comment '行番号'
1479
  , BILLPRICE decimal(10,0) comment '請求金額'
1480
  , DISCOUNTPRICE decimal(10,0) comment '値引き金額'
1481
  , OFFSETPRICE decimal(10,0) comment '相殺金額'
1482
  , NEXTCOPRICE decimal(10,0) comment '次回繰越'
1483
  , HIGHWPRICE decimal(10,0) comment '高速代'
1484
  , HARDWPRICE decimal(10,0) comment '金物代'
1485
  , INDSWASTETAX decimal(10,0) comment '産廃税'
1486
  , CNSTRPRICE decimal(10,0) comment '協力金'
1487
  , CNSTRPRICEEXIST decimal(1,0) comment '協力金有無'
1488
  , APPROVALPERSONCODE decimal(8,0) comment '承認担当者コード'
1489
  , APPROVALDATE date comment '担当者承認日付'
1490
  , APPROVALENDFLG decimal(1,0) comment '承認完了フラグ'
1491
  , ENTRYDATE datetime comment '登録日付'
1492
  , UPDATEDATE datetime comment '更新日付'
1493
  , constraint paymentdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT)
1494
) comment '支払明細データ' ;
1495

    
1496
-- 担当者承認データ
1497
drop table if exists personapproval cascade;
1498

    
1499
create table personapproval (
1500
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
1501
  , ApprovalCode decimal(3,0) unsigned not null comment '承認機能番号'
1502
  , OrderDate date not null comment '受付日'
1503
  , OrderNo decimal(2,0) unsigned not null comment '受付番号'
1504
  , SeqNo decimal(2,0) not null comment '枝番'
1505
  , PersonCodeApproval decimal(8,0) unsigned not null comment '申請・承認者コード'
1506
  , PetitionApprovalDate datetime not null comment '申請・承認日付'
1507
  , ApprovalLimitDates datetime not null comment '承認希望日'
1508
  , ApprovalStatus decimal(1,0) not null comment '承認状態'
1509
  , InputComment varchar(300) comment 'コメント'
1510
  , EntryDate datetime not null comment '登録日付'
1511
  , UpdateDate datetime not null comment '更新日付'
1512
  , constraint personapproval_PKC primary key (PersonCode,ApprovalCode,OrderDate,OrderNo,SeqNo)
1513
) comment '担当者承認データ' ;
1514

    
1515
-- 担当者承認コメントデータ
1516
drop table if exists personapprovalcomment cascade;
1517

    
1518
create table personapprovalcomment (
1519
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
1520
  , ApprovalCode decimal(3,0) unsigned not null comment '承認機能番号'
1521
  , OrderDate date not null comment '受付日'
1522
  , OrderNo decimal(2,0) unsigned not null comment '受付番号'
1523
  , CommentNo decimal(2,0) not null comment 'コメント番号'
1524
  , ParentNo decimal(2,0) not null comment '親コメント番号'
1525
  , ApproValComment varchar(300) comment '指示・連絡コメント'
1526
  , EntryDate datetime not null comment '登録日付'
1527
  , UpdateDate datetime not null comment '更新日付'
1528
  , constraint personapprovalcomment_PKC primary key (PersonCode,ApprovalCode,OrderDate,OrderNo,CommentNo)
1529
) comment '担当者承認コメントデータ' ;
1530

    
1531
-- 担当者対象部署マスタ
1532
drop table if exists persondepartmentmaster cascade;
1533

    
1534
create table persondepartmentmaster (
1535
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
1536
  , DepartmentCode decimal(5,0) unsigned not null comment '部署コード'
1537
  , AffiliationFlg decimal(1,0) not null comment '所属フラグ'
1538
  , EntryDate datetime not null comment '登録日付'
1539
  , UpdateDate datetime not null comment '更新日付'
1540
  , constraint persondepartmentmaster_PKC primary key (PersonCode,DepartmentCode)
1541
) comment '担当者対象部署マスタ' ;
1542

    
1543
create index PersonDepartmentMaster_Index1
1544
  on persondepartmentmaster(PersonCode);
1545

    
1546
create index PersonDepartmentMaster_Index2
1547
  on persondepartmentmaster(DepartmentCode);
1548

    
1549
-- 担当者マスタ
1550
drop table if exists personinchargemaster cascade;
1551

    
1552
create table personinchargemaster (
1553
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
1554
  , DisplayOrder decimal(8,0) unsigned not null comment '表示順'
1555
  , PersonName varchar(60) not null comment '担当者名'
1556
  , StartDate date not null comment '使用開始年月日'
1557
  , EndDate date comment '使用終了年月日'
1558
  , PassWord varchar(16) comment 'パスワード'
1559
  , SecurityManagement decimal(1,0) not null comment '機密区分'
1560
  , SecCode decimal(2,0) unsigned not null comment '保護区分番号'
1561
  , MsgBackColor varchar(8) comment 'メッセージ背景色'
1562
  , DisplayString varchar(20) comment '表示・印刷名称'
1563
  , DepartmentCode decimal(5,0) unsigned comment '部署コード'
1564
  , MonthlySalary decimal(11,0) not null comment '月給金額'
1565
  , YearSalary decimal(12,0) not null comment '年俸金額'
1566
  , Qualification varchar(120) comment '資格入力欄'
1567
  , SealPrintName varchar(5) comment '印鑑表示名'
1568
  , EmployeeClassFlg decimal(1,0) not null comment '社員区分'
1569
  , LedgerFlg decimal(1,0) not null comment '台帳計算対象フラグ'
1570
  , CommutingDistance decimal(5,2) not null comment '通勤距離'
1571
  , CommuteCosts decimal(5,0) not null comment '通勤交通費'
1572
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
1573
  , EntryDate datetime not null comment '登録日付'
1574
  , UpdateDate datetime not null comment '更新日付'
1575
  , constraint personinchargemaster_PKC primary key (PersonCode)
1576
) comment '担当者マスタ' ;
1577

    
1578
create index PersonInChargeMaster_Index1
1579
  on personinchargemaster(StartDate);
1580

    
1581
create index PersonInChargeMaster_Index2
1582
  on personinchargemaster(DepartmentCode);
1583

    
1584
-- 担当者給与マスタ
1585
drop table if exists personsalarymaster cascade;
1586

    
1587
create table personsalarymaster (
1588
  PersonCode decimal(8,0) unsigned not null comment '担当者コード'
1589
  , StartDate date not null comment '使用開始年月日'
1590
  , MonthlySalary decimal(11,0) not null comment '月給金額'
1591
  , YearSalary decimal(12,0) not null comment '年俸金額'
1592
  , EntryDate datetime not null comment '登録日付'
1593
  , UpdateDate datetime not null comment '更新日付'
1594
  , constraint personsalarymaster_PKC primary key (PersonCode,StartDate)
1595
) comment '担当者給与マスタ' ;
1596

    
1597
create index PersonSalaryMaster_Index1
1598
  on personsalarymaster(PersonCode);
1599

    
1600
create index PersonSalaryMaster_Index2
1601
  on personsalarymaster(StartDate);
1602

    
1603
-- 指示事項データ
1604
drop table if exists pointingoutcomment cascade;
1605

    
1606
create table pointingoutcomment (
1607
  ConstructionCode decimal(10,0) not null comment '工事コード'
1608
  , ProcessNo smallint(6) not null comment '処理番号(画面番号)'
1609
  , SeqNo smallint(6) not null comment '順序'
1610
  , PageCount smallint(6) not null comment 'ページ番号'
1611
  , PersonCode decimal(8,0) not null comment '記入者コード'
1612
  , DrowColor varchar(8) comment '描画色'
1613
  , CommentMessage varchar(1000) comment 'メッセージ'
1614
  , StartPointX smallint(6) not null comment '指摘項目位置X'
1615
  , StartPointY smallint(6) not null comment '指摘項目位置Y'
1616
  , CurrentPointX smallint(6) not null comment '初期位置X'
1617
  , CurrentPointY smallint(6) not null comment '初期位置Y'
1618
  , CurrentWidth smallint(6) not null comment '表示サイズWidth'
1619
  , CurrentHeight smallint(6) not null comment '表示サイズHeigth'
1620
  , EntryDate datetime not null comment '登録日付'
1621
  , UpdateDate datetime not null comment '更新日付'
1622
  , constraint pointingoutcomment_PKC primary key (ConstructionCode,ProcessNo,SeqNo)
1623
) comment '指示事項データ' ;
1624

    
1625
-- 発注者打ち合わせ議事録データ
1626
drop table if exists proceedingsdata cascade;
1627

    
1628
create table proceedingsdata (
1629
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1630
  , ProceedingsDataDate date not null comment '議事録作成日'
1631
  , StartMeetingTime decimal(4,0) unsigned not null comment '会議時間開始'
1632
  , EndMeetingTime decimal(4,0) unsigned not null comment '会議時間終了'
1633
  , CreatorCode decimal(8,0) not null comment '作成者コード'
1634
  , PalceFlag decimal(1,0) not null comment '現地フラグ'
1635
  , MeetingPalce varchar(120) comment '打合せ場所'
1636
  , EntryDate datetime not null comment '登録日付'
1637
  , UpdateDate datetime not null comment '更新日付'
1638
  , constraint proceedingsdata_PKC primary key (ConstructionCode,ProceedingsDataDate,StartMeetingTime)
1639
) comment '発注者打ち合わせ議事録データ' ;
1640

    
1641
-- 発注者打ち合わせ議事録データ(出席者)
1642
drop table if exists proceedingsdataattend cascade;
1643

    
1644
create table proceedingsdataattend (
1645
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1646
  , ProceedingsDataDate date not null comment '議事録作成日'
1647
  , StartMeetingTime decimal(4,0) unsigned not null comment '会議時間開始'
1648
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
1649
  , Department varchar(20) comment '出席者所属'
1650
  , AttendName varchar(10) comment '出席者氏名'
1651
  , EntryDate datetime not null comment '登録日付'
1652
  , UpdateDate datetime not null comment '更新日付'
1653
  , constraint proceedingsdataattend_PKC primary key (ConstructionCode,ProceedingsDataDate,StartMeetingTime,SeqNo)
1654
) comment '発注者打ち合わせ議事録データ(出席者)' ;
1655

    
1656
-- 発注者打ち合わせ議事録データ(出席者)
1657
drop table if exists proceedingsdataattendee cascade;
1658

    
1659
create table proceedingsdataattendee (
1660
  PersonCode decimal(8,0) not null comment '作成者コード'
1661
  , ProceedingsDataDate date not null comment '議事録作成日'
1662
  , ConstructionCode int(11) not null comment '工事番号'
1663
  , SeqNo smallint(6) not null comment 'データ行番号'
1664
  , Department varchar(100) comment '出席者所属'
1665
  , AttendeeName varchar(100) comment '出席者氏名'
1666
  , EntryDate datetime not null comment '登録年月日'
1667
  , UpdateDate datetime not null comment '更新年月日'
1668
  , constraint proceedingsdataattendee_PKC primary key (PersonCode,ProceedingsDataDate,ConstructionCode,SeqNo)
1669
) comment '発注者打ち合わせ議事録データ(出席者)' ;
1670

    
1671
-- 発注者打ち合わせ議事録データ(明細)
1672
drop table if exists proceedingsdatadetail cascade;
1673

    
1674
create table proceedingsdatadetail (
1675
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1676
  , ProceedingsDataDate date not null comment '議事録作成日'
1677
  , StartMeetingTime decimal(4,0) unsigned not null comment '会議時間開始'
1678
  , SeqNo decimal(3,0) unsigned not null comment '明細行番号'
1679
  , TitleNo varchar(5) comment '議題番号'
1680
  , Title varchar(20) comment '議題'
1681
  , ContentsText varchar(50) comment '内容'
1682
  , EntryDate datetime not null comment '登録日付'
1683
  , UpdateDate datetime not null comment '更新日付'
1684
  , constraint proceedingsdatadetail_PKC primary key (ConstructionCode,ProceedingsDataDate,StartMeetingTime,SeqNo)
1685
) comment '発注者打ち合わせ議事録データ(明細)' ;
1686

    
1687
-- 承認データ
1688
drop table if exists processapproval cascade;
1689

    
1690
create table processapproval (
1691
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1692
  , ApprovalCode decimal(3,0) unsigned not null comment '承認機能番号'
1693
  , OrderNo decimal(2,0) unsigned not null comment '受付番号'
1694
  , SeqNo decimal(2,0) not null comment '枝番'
1695
  , PersonCode decimal(8,0) unsigned not null comment '申請・承認者コード'
1696
  , PetitionApprovalDate datetime not null comment '申請・承認日付'
1697
  , ApprovalLimitDates datetime not null comment '承認希望日'
1698
  , ApprovalStatus decimal(1,0) not null comment '承認状態'
1699
  , InputComment varchar(300) comment 'コメント'
1700
  , EntryDate datetime not null comment '登録日付'
1701
  , UpdateDate datetime not null comment '更新日付'
1702
  , constraint processapproval_PKC primary key (ConstructionCode,ApprovalCode,OrderNo,SeqNo)
1703
) comment '承認データ' ;
1704

    
1705
-- 承認コメントデータ
1706
drop table if exists processapprovalcomment cascade;
1707

    
1708
create table processapprovalcomment (
1709
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1710
  , ApprovalCode decimal(3,0) unsigned not null comment '承認機能番号'
1711
  , OrderNo decimal(2,0) unsigned not null comment '受付番号'
1712
  , CommentNo decimal(2,0) not null comment 'コメント番号'
1713
  , ParentNo decimal(2,0) not null comment '親コメント番号'
1714
  , ApproValComment varchar(300) comment '指示・連絡コメント'
1715
  , EntryDate datetime not null comment '登録日付'
1716
  , UpdateDate datetime not null comment '更新日付'
1717
  , constraint processapprovalcomment_PKC primary key (ConstructionCode,ApprovalCode,OrderNo,CommentNo)
1718
) comment '承認コメントデータ' ;
1719

    
1720
-- 承認明細データ
1721
drop table if exists processapprovaldetail cascade;
1722

    
1723
create table processapprovaldetail (
1724
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1725
  , ApprovalCode decimal(3,0) unsigned not null comment '承認機能番号'
1726
  , OrderNo decimal(2,0) unsigned not null comment '受付番号'
1727
  , SerialNo decimal(2,0) unsigned not null comment '枝番'
1728
  , LinkCode decimal(10,0) not null comment 'リンク情報'
1729
  , EntryDate datetime not null comment '登録日付'
1730
  , UpdateDate datetime not null comment '更新日付'
1731
  , constraint processapprovaldetail_PKC primary key (ConstructionCode,ApprovalCode,OrderNo,SerialNo)
1732
) comment '承認明細データ' ;
1733

    
1734
-- 起動対象マスタ
1735
drop table if exists processexcutemaster cascade;
1736

    
1737
create table processexcutemaster (
1738
  SecCode decimal(2,0) unsigned not null comment '保護区分番号'
1739
  , ExecCode decimal(4,0) unsigned not null comment '起動処理番号'
1740
  , EditFlg decimal(1,0) not null comment '編集フラグ'
1741
  , EntryDate datetime not null comment '登録日付'
1742
  , UpdateDate datetime not null comment '更新日付'
1743
  , constraint processexcutemaster_PKC primary key (SecCode,ExecCode)
1744
) comment '起動対象マスタ' ;
1745

    
1746
create index ProcessExcuteMaster_Index1
1747
  on processexcutemaster(SecCode);
1748

    
1749
create index ProcessExcuteMaster_Index2
1750
  on processexcutemaster(ExecCode);
1751

    
1752
-- 注文書データ
1753
drop table if exists purchaseorder cascade;
1754

    
1755
create table purchaseorder (
1756
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1757
  , SeqNo decimal(3,0) unsigned not null comment '注文書枝番'
1758
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
1759
  , CreateDate date comment '作成日付'
1760
  , OrderPrice decimal(12,0) not null comment '発注金額'
1761
  , LastRowStringDate date not null comment '最終行表示日付'
1762
  , OrderSheetType decimal(1,0) not null comment '簡易・本式フラグ'
1763
  , PaymentTerms decimal(1,0) not null comment '支払い条件'
1764
  , CashRatio decimal(4,1) not null comment '現金割合(%)'
1765
  , BillPeriod decimal(4,0) not null comment '手形期間'
1766
  , PrePayments decimal(1,0) not null comment '前金払'
1767
  , PrePaymentsDays decimal(3,0) not null comment '前金払日数'
1768
  , PrePaymentsPrice decimal(12,0) not null comment '前金払金額'
1769
  , PartialPayment decimal(1,0) not null comment '部分払'
1770
  , PartialPaymentMounth decimal(2,0) unsigned not null comment '部分払締切月'
1771
  , PartialPaymentDay1 decimal(2,0) unsigned not null comment '部分払締切日'
1772
  , PartialPaymentDay2 decimal(2,0) unsigned not null comment '部分払支払日'
1773
  , PartialPaymentPrice decimal(12,0) not null comment '部分払金額'
1774
  , CompletionPayment decimal(1,0) not null comment '引渡し時の支払'
1775
  , CompletionPaymentDays decimal(3,0) unsigned not null comment '引渡し時の支払日数'
1776
  , CompletionPaymentPrice decimal(12,0) not null comment '引渡し時の支払金額'
1777
  , LeadEngineerCode decimal(8,0) comment '主任技術者コード'
1778
  , LeadEngineerName varchar(60) comment 'LeadEngineerName'
1779
  , SafetyOfficerCode decimal(8,0) comment '安全管理者コード'
1780
  , SafetyOfficerName varchar(60) comment '安全管理者名'
1781
  , WorkersCount decimal(3,0) unsigned comment '作業員数'
1782
  , PrintoutDate date not null comment '印刷年月日'
1783
  , EntryDate datetime not null comment '登録日付'
1784
  , UpdateDate datetime not null comment '更新日付'
1785
  , constraint purchaseorder_PKC primary key (ConstructionCode,SeqNo)
1786
) comment '注文書データ' ;
1787

    
1788
-- 注文書日付データ
1789
drop table if exists purchaseorderdate cascade;
1790

    
1791
create table purchaseorderdate (
1792
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1793
  , SeqNo decimal(3,0) unsigned not null comment '注文書枝番'
1794
  , CompanyCode decimal(8,0) not null comment '協力会社コード'
1795
  , SendDate date not null comment '注文書郵送日'
1796
  , ReturnDate date not null comment '注文書返送日'
1797
  , ReturnCheckDate date not null comment '注文書返送確認日'
1798
  , EntryDate datetime not null comment '登録日付'
1799
  , UpdateDate datetime not null comment '更新日付'
1800
  , constraint purchaseorderdate_PKC primary key (ConstructionCode,SeqNo)
1801
) comment '注文書日付データ' ;
1802

    
1803
-- 注文書明細データ
1804
drop table if exists purchaseorderdetail cascade;
1805

    
1806
create table purchaseorderdetail (
1807
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1808
  , SeqNo decimal(3,0) unsigned not null comment '注文書枝番'
1809
  , GroupCount decimal(1,0) not null comment 'グループ番号'
1810
  , LineCount decimal(3,0) unsigned not null comment '行番号'
1811
  , ComponentCode decimal(5,0) unsigned not null comment '構成キー'
1812
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
1813
  , FirstString varchar(120) comment '工種・品名'
1814
  , SecondString varchar(120) comment '内容内訳'
1815
  , UnitCount decimal(8,2) not null comment '数量'
1816
  , UnitName varchar(30) comment '単位'
1817
  , UnitPrice decimal(10,0) not null comment '単価'
1818
  , OrdersLinePrice decimal(12,0) comment '金額'
1819
  , SourceCode decimal(10,0) unsigned not null comment '予算作成時工事番号'
1820
  , SourceLineCnt decimal(3,0) unsigned not null comment '注文書作成時台帳行番号'
1821
  , EntryDate datetime not null comment '登録日付'
1822
  , UpdateDate datetime not null comment '更新日付'
1823
  , constraint purchaseorderdetail_PKC primary key (ConstructionCode,SeqNo,GroupCount,LineCount)
1824
) comment '注文書明細データ' ;
1825

    
1826
create index POrderDetail_Index1
1827
  on purchaseorderdetail(SourceCode);
1828

    
1829
-- 請求データ
1830
drop table if exists requestdata cascade;
1831

    
1832
create table requestdata (
1833
  REQUESTNO decimal(9,0) not null comment '請求No'
1834
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '本工事番号'
1835
  , CONSTRUCTIONNAME varchar(120) not null comment '工事件名'
1836
  , CONTRACTAMOUNT decimal(10,0) not null comment '請負金額'
1837
  , PAIDAMOUNT decimal(10,0) not null comment '請求済金額'
1838
  , REQUESTAMOUNT0 decimal(10,0) not null comment '請求金額0'
1839
  , REQUESTAMOUNT1 decimal(10,0) not null comment '請求金額1'
1840
  , REQUESTAMOUNT2 decimal(10,0) comment '請求金額2'
1841
  , REQUESTAMOUNT3 decimal(10,0) comment '請求金額3'
1842
  , REQUESTAMOUNT4 decimal(10,0) comment '請求金額4'
1843
  , REQUESTAMOUNT5 decimal(10,0) comment '請求金額5'
1844
  , REQUESTAMOUNT6 decimal(10,0) comment '請求金額6'
1845
  , UNCLAIMEDAMOUNT decimal(10,0) not null comment '請求残金額'
1846
  , UNPAIDAMOUNT decimal(10,0) not null comment '未入金金額'
1847
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
1848
  , NOTE varchar(120) not null comment '備考'
1849
  , ENTRYDATE datetime not null comment '登録年月日'
1850
  , UPDATEDATE datetime not null comment '更新年月日'
1851
  , constraint requestdata_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE)
1852
) comment '請求データ' ;
1853

    
1854
-- 請求データ明細
1855
drop table if exists requestdatadetail cascade;
1856

    
1857
create table requestdatadetail (
1858
  REQUESTNO decimal(9,0) not null comment '請求No'
1859
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '本工事番号'
1860
  , CONSTRUCTIONCODE decimal(10,0) not null comment '工事番号'
1861
  , CONSTRUCTIONKIND decimal(1,0) not null comment '工事区分'
1862
  , REQUESTAMOUNT decimal(10,0) not null comment '請求金額'
1863
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
1864
  , ENTRYDATE datetime not null comment '登録年月日'
1865
  , UPDATEDATE datetime not null comment '更新年月日'
1866
  , constraint requestdatadetail_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE,CONSTRUCTIONCODE,CONSTRUCTIONKIND)
1867
) comment '請求データ明細' ;
1868

    
1869
-- 請求ヘッダ
1870
drop table if exists requesthead cascade;
1871

    
1872
create table requesthead (
1873
  REQUESTNO decimal(9,0) not null comment '請求No'
1874
  , REQCONSTRUCTIONCODE decimal(10,0) not null comment '請求工事番号'
1875
  , ORDERNO decimal(2,0) not null comment '受付番号'
1876
  , REQUESTMONTH decimal(6,0) not null comment '請求月'
1877
  , ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
1878
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
1879
  , ORDERERSNAME varchar(120) not null comment '発注者先名'
1880
  , REQCONSTRUCTIONNAME varchar(120) not null comment '請求工事件名'
1881
  , REQUESTTOTALAMOUNT decimal(10,0) not null comment '請求金額合計'
1882
  , REQUESTAMOUNT decimal(10,0) not null comment '請求金額'
1883
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
1884
  , UNPAIDAMOUNT decimal(10,0) comment '未入金'
1885
  , NOTE varchar(120) comment '備考'
1886
  , ASSIGNEDFLG decimal(1,0) comment '割当済フラグ'
1887
  , INVOICENO decimal(9,0) not null comment '請求書No'
1888
  , ENTRYDATE datetime not null comment '登録年月日'
1889
  , UPDATEDATE datetime not null comment '更新年月日'
1890
  , constraint requesthead_PKC primary key (REQUESTNO)
1891
) comment '請求ヘッダ' ;
1892

    
1893
alter table requesthead add unique REQCONSTRUCTIONCODE (REQCONSTRUCTIONCODE,ORDERNO) ;
1894

    
1895
-- 請求書日付データ
1896
drop table if exists requestorderdate cascade;
1897

    
1898
create table requestorderdate (
1899
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1900
  , InvoiceNo decimal(9,0) not null comment '請求書No'
1901
  , SendDate date not null comment '請求書発給郵送日'
1902
  , EntryDate datetime not null comment '登録日付'
1903
  , UpdateDate datetime not null comment '更新日付'
1904
  , constraint requestorderdate_PKC primary key (ConstructionCode,InvoiceNo)
1905
) comment '請求書日付データ' ;
1906

    
1907
-- 売上グラフデータ
1908
drop table if exists salesgraphdata cascade;
1909

    
1910
create table salesgraphdata (
1911
  GraphDataCode decimal(8,0) not null comment 'グラフデータコード'
1912
  , ConstructionPeriod decimal(4,0) unsigned not null comment '事業期'
1913
  , SalesDataDays date not null comment '売上年月'
1914
  , DisplayOrder decimal(8,0) unsigned not null comment '表示順'
1915
  , DataName varchar(100) not null comment 'データ表示名称'
1916
  , SalesAmount decimal(10,0) not null comment '売上データ'
1917
  , AdministrativeExpense decimal(10,0) not null comment '販管・部署経費'
1918
  , GrossProfit decimal(10,0) not null comment '粗利益'
1919
  , NetIncome decimal(10,0) not null comment '純利益(損益)'
1920
  , EntryDate datetime not null comment '登録日付'
1921
  , UpdateDate datetime not null comment '更新日付'
1922
  , constraint salesgraphdata_PKC primary key (GraphDataCode,ConstructionPeriod,SalesDataDays)
1923
) comment '売上グラフデータ' ;
1924

    
1925
create index SalesGraphData_Idx1
1926
  on salesgraphdata(DisplayOrder);
1927

    
1928
create index SalesGraphData_idx2
1929
  on salesgraphdata(ConstructionPeriod);
1930

    
1931
-- 保護区分マスタ
1932
drop table if exists securitymaster cascade;
1933

    
1934
create table securitymaster (
1935
  SecCode decimal(2,0) unsigned not null comment '保護区分番号'
1936
  , DisplayOrder decimal(2,0) not null comment '表示順'
1937
  , SecName varchar(60) not null comment '保護区分名称'
1938
  , SecRank decimal(1,0) not null comment '保護区分ランク'
1939
  , SecRange decimal(1,0) not null comment '保護区分範囲'
1940
  , GeneralAffairs decimal(1,0) not null comment '総務業務フラグ'
1941
  , SelectBackColor varchar(8) not null comment '選択背景色'
1942
  , EntryDate datetime not null comment '登録日付'
1943
  , UpdateDate datetime not null comment '更新日付'
1944
  , constraint securitymaster_PKC primary key (SecCode)
1945
) comment '保護区分マスタ' ;
1946

    
1947
create index SecurityMaster_Index1
1948
  on securitymaster(DisplayOrder);
1949

    
1950
create index SecurityMaster_Index2
1951
  on securitymaster(SecRank);
1952

    
1953
create index SecurityMaster_Index3
1954
  on securitymaster(SecRange);
1955

    
1956
-- 安全パトロールデータ
1957
drop table if exists sfpdata cascade;
1958

    
1959
create table sfpdata (
1960
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1961
  , DataCount decimal(2,0) unsigned not null comment 'パトロール回数'
1962
  , RequestDate datetime not null comment 'パトロール要請日時'
1963
  , PersonCode decimal(8,0) unsigned not null comment '申請者コード'
1964
  , StringValue varchar(300) comment 'コメント'
1965
  , OrderNo decimal(2,0) unsigned not null comment '申請受付番号'
1966
  , EntryDate datetime not null comment '登録日付'
1967
  , UpdateDate datetime not null comment '更新日付'
1968
  , constraint sfpdata_PKC primary key (ConstructionCode,DataCount)
1969
) comment '安全パトロールデータ' ;
1970

    
1971
create index SFPData_Index1
1972
  on sfpdata(RequestDate);
1973

    
1974
-- 安全パトロール明細データ
1975
drop table if exists sfpdatadetail cascade;
1976

    
1977
create table sfpdatadetail (
1978
  ConstructionCode decimal(10,0) unsigned not null comment '工事コード'
1979
  , DataCount decimal(2,0) unsigned not null comment 'パトロール回数'
1980
  , SeqNo decimal(2,0) unsigned not null comment 'データ枝番'
1981
  , CompanyCode decimal(8,0) unsigned not null comment '協力会社コード'
1982
  , EntryDate datetime not null comment '登録日付'
1983
  , UpdateDate datetime not null comment '更新日付'
1984
  , constraint sfpdatadetail_PKC primary key (ConstructionCode,DataCount,SeqNo)
1985
) comment '安全パトロール明細データ' ;
1986

    
1987
-- 協力業者施工工種登録申請データ
1988
drop table if exists subconstrjobitemregist cascade;
1989

    
1990
create table subconstrjobitemregist (
1991
  PersonCode decimal(8,0) unsigned not null comment '申請者番号'
1992
  , CreateDate date not null comment '作成日'
1993
  , SeqNo decimal(2,0) unsigned not null comment '申請連番'
1994
  , DisplayOrder decimal(8,0) unsigned not null comment '表示順'
1995
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
1996
  , EntryDate datetime not null comment '登録日付'
1997
  , UpdateDate datetime not null comment '更新日付'
1998
  , constraint subconstrjobitemregist_PKC primary key (PersonCode,CreateDate,SeqNo,DisplayOrder)
1999
) comment '協力業者施工工種登録申請データ' ;
2000

    
2001
-- 協力業者職種リンク登録申請データ
2002
drop table if exists subconstrjoblinkregist cascade;
2003

    
2004
create table subconstrjoblinkregist (
2005
  PersonCode decimal(8,0) unsigned not null comment '申請者番号'
2006
  , CreateDate date not null comment '作成日'
2007
  , SeqNo decimal(2,0) unsigned not null comment '申請連番'
2008
  , DisplayOrder decimal(8,0) unsigned not null comment '表示順'
2009
  , JobCategoryCode decimal(5,0) not null comment '職種キー'
2010
  , EntryDate datetime not null comment '登録日付'
2011
  , UpdateDate datetime not null comment '更新日付'
2012
  , constraint subconstrjoblinkregist_PKC primary key (PersonCode,CreateDate,SeqNo,DisplayOrder)
2013
) comment '協力業者職種リンク登録申請データ' ;
2014

    
2015
-- 協力業者登録申請データ
2016
drop table if exists subconstrregist cascade;
2017

    
2018
create table subconstrregist (
2019
  PersonCode decimal(8,0) unsigned not null comment '申請者番号'
2020
  , CreateDate date not null comment '作成日'
2021
  , SeqNo decimal(2,0) unsigned not null comment '申請連番'
2022
  , DataMode decimal(1,0) comment 'データ区分'
2023
  , SourceCode decimal(8,0) not null comment '協力会社コード'
2024
  , PetitionPeriod decimal(4,0) unsigned not null comment '申請年度'
2025
  , CorporateStatusName varchar(40) comment '法人格名称'
2026
  , CorporateStatusPoint decimal(1,0) not null comment '法人格名称位置'
2027
  , CompanyName varchar(100) not null comment '協力会社名'
2028
  , CEOPositionName varchar(60) comment '代表者役職名'
2029
  , CEOName varchar(60) comment '代表者氏名'
2030
  , ContactPersonName varchar(60) comment '担当者氏名'
2031
  , ZipCode varchar(8) comment '郵便番号'
2032
  , Address1 varchar(60) comment '住所1'
2033
  , Address2 varchar(60) comment '住所2'
2034
  , Address3 varchar(60) comment '住所3'
2035
  , CellPhoneNumber varchar(13) comment '携帯電話番号'
2036
  , MailAddress varchar(257) comment 'メールアドレス'
2037
  , PhoneNumber varchar(13) comment '電話番号'
2038
  , FaxNumber varchar(13) comment 'FAX番号'
2039
  , JapaneseSyllabary varchar(2) comment '50音読み'
2040
  , StartDate date not null comment '取引開始年月日'
2041
  , Note varchar(300) comment '備考'
2042
  , labourKind decimal(1,0) not null comment '支払い通常・手間区分'
2043
  , OrderDate date comment '申請日'
2044
  , OrderNo decimal(2,0) unsigned not null comment '申請受付番号'
2045
  , EntryDate datetime not null comment '登録日付'
2046
  , UpdateDate datetime not null comment '更新日付'
2047
  , constraint subconstrregist_PKC primary key (PersonCode,CreateDate,SeqNo)
2048
) comment '協力業者登録申請データ' ;
2049

    
2050
-- 協力会社工種マスタ
2051
drop table if exists subcontractoritemmaster cascade;
2052

    
2053
create table subcontractoritemmaster (
2054
  ItemCode decimal(5,0) unsigned not null comment '工種キー'
2055
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2056
  , ItemName varchar(120) not null comment '工種名称'
2057
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
2058
  , EntryDate datetime not null comment '登録日付'
2059
  , UpdateDate datetime not null comment '更新日付'
2060
  , constraint subcontractoritemmaster_PKC primary key (ItemCode)
2061
) comment '協力会社工種マスタ' ;
2062

    
2063
-- 協力会社職種マスタ
2064
drop table if exists subcontractorjobcategory cascade;
2065

    
2066
create table subcontractorjobcategory (
2067
  JobCategoryCode decimal(5,0) not null comment '職種キー'
2068
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2069
  , JobCategoryName varchar(120) not null comment '職種名称'
2070
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
2071
  , EntryDate datetime not null comment '登録日付'
2072
  , UpdateDate datetime not null comment '更新日付'
2073
  , constraint subcontractorjobcategory_PKC primary key (JobCategoryCode)
2074
) comment '協力会社職種マスタ' ;
2075

    
2076
-- 協力会社施工工種データ
2077
drop table if exists subcontractorjobitem cascade;
2078

    
2079
create table subcontractorjobitem (
2080
  CompanyCode decimal(8,0) not null comment '協力会社コード'
2081
  , ItemCode decimal(5,0) unsigned not null comment '工種キー'
2082
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2083
  , EntryDate datetime not null comment '登録日付'
2084
  , UpdateDate datetime not null comment '更新日付'
2085
  , constraint subcontractorjobitem_PKC primary key (CompanyCode,ItemCode)
2086
) comment '協力会社施工工種データ' ;
2087

    
2088
create index SubContractorJobItem_Index1
2089
  on subcontractorjobitem(CompanyCode);
2090

    
2091
create index SubContractorJobItem_Index2
2092
  on subcontractorjobitem(ItemCode);
2093

    
2094
-- 協力会社職種リンクマスタ
2095
drop table if exists subcontractorjoblink cascade;
2096

    
2097
create table subcontractorjoblink (
2098
  CompanyCode decimal(8,0) not null comment '協力会社コード'
2099
  , JobCategoryCode decimal(5,0) not null comment '職種キー'
2100
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2101
  , EntryDate datetime not null comment '登録日付'
2102
  , UpdateDate datetime not null comment '更新日付'
2103
  , constraint subcontractorjoblink_PKC primary key (CompanyCode,JobCategoryCode)
2104
) comment '協力会社職種リンクマスタ' ;
2105

    
2106
create index SubContractorJobLink_Index1
2107
  on subcontractorjoblink(CompanyCode);
2108

    
2109
create index SubContractorJobLink_Index2
2110
  on subcontractorjoblink(JobCategoryCode);
2111

    
2112
-- 協力会社マスタ
2113
drop table if exists subcontractormaster cascade;
2114

    
2115
create table subcontractormaster (
2116
  CompanyCode decimal(8,0) not null comment '協力会社コード'
2117
  , DisplayOrder decimal(8,0) unsigned not null comment '表示順'
2118
  , CorporateStatusName varchar(40) comment '法人格名称'
2119
  , CorporateStatusPoint decimal(1,0) not null comment '法人格名称位置'
2120
  , CompanyName varchar(100) not null comment '協力会社名'
2121
  , CEOPositionName varchar(60) comment '代表者役職名'
2122
  , CEOName varchar(60) comment '代表者氏名'
2123
  , ContactPersonName varchar(60) comment '担当者氏名'
2124
  , ZipCode varchar(8) comment '郵便番号'
2125
  , Address1 varchar(60) comment '住所1'
2126
  , Address2 varchar(60) comment '住所2'
2127
  , Address3 varchar(60) comment '住所3'
2128
  , CellPhoneNumber varchar(13) comment '携帯電話番号'
2129
  , MailAddress varchar(257) comment 'メールアドレス'
2130
  , PhoneNumber varchar(13) comment '電話番号'
2131
  , FaxNumber varchar(13) comment 'FAX番号'
2132
  , JapaneseSyllabary varchar(2) comment '50音読み'
2133
  , StartDate date not null comment '取引開始年月日'
2134
  , Note varchar(300) comment '備考'
2135
  , labourKind decimal(1,0) not null comment '支払い通常・手間区分'
2136
  , DeleteFlg decimal(1,0) default '0' not null comment '削除フラグ'
2137
  , EntryDate datetime not null comment '登録日付'
2138
  , UpdateDate datetime not null comment '更新日付'
2139
  , constraint subcontractormaster_PKC primary key (CompanyCode)
2140
) comment '協力会社マスタ' ;
2141

    
2142
create index SubContractorMaster_Index1
2143
  on subcontractormaster(JapaneseSyllabary);
2144

    
2145
-- 仕入先マスタ
2146
drop table if exists suppliersmaster cascade;
2147

    
2148
create table suppliersmaster (
2149
  SuppliersCode decimal(5,0) unsigned not null comment '仕入先コード'
2150
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2151
  , SuppliersName1 varchar(60) not null comment '仕入先名1'
2152
  , SuppliersName2 varchar(60) comment '仕入先名2'
2153
  , ZipCode varchar(8) comment '郵便番号'
2154
  , Address1 varchar(60) comment '住所1'
2155
  , Address2 varchar(60) comment '住所2'
2156
  , Address3 varchar(60) comment '住所3'
2157
  , PhoneNumber varchar(13) comment '電話番号'
2158
  , FaxNumber varchar(13) comment 'FAX番号'
2159
  , Note varchar(300) comment '備考'
2160
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
2161
  , EntryDate datetime not null comment '登録日付'
2162
  , UpdateDate datetime not null comment '更新日付'
2163
  , constraint suppliersmaster_PKC primary key (SuppliersCode)
2164
) comment '仕入先マスタ' ;
2165

    
2166
-- システム起動確認データ
2167
drop table if exists systemexecute cascade;
2168

    
2169
create table systemexecute (
2170
  PrimaryCode tinyint(4) not null comment 'キー項目'
2171
  , TargetDate date not null comment '起動日付'
2172
  , SystemVersion int(11) not null comment '本体・環境バージョン'
2173
  , UpDateCopyVersion int(11) not null comment 'コピーバージョン'
2174
  , EntryDate datetime not null comment '登録日付'
2175
  , UpdateDate datetime not null comment '更新日付'
2176
  , constraint systemexecute_PKC primary key (PrimaryCode)
2177
) comment 'システム起動確認データ' ;
2178

    
2179
-- 管理マスタ
2180
drop table if exists systemmaster cascade;
2181

    
2182
create table systemmaster (
2183
  SystemCode decimal(3,0) unsigned not null comment '会社コード'
2184
  , CompanyName1 varchar(60) not null comment '会社名1'
2185
  , CompanyName2 varchar(60) comment '会社名2'
2186
  , CEOName varchar(60) not null comment '代表者氏名'
2187
  , CEOPositionName varchar(60) comment '代表者役職名'
2188
  , ZipCode varchar(8) not null comment '郵便番号'
2189
  , Address1 varchar(60) not null comment '住所1'
2190
  , Address2 varchar(60) comment '住所2'
2191
  , Address3 varchar(60) comment '住所3'
2192
  , PhoneNumber varchar(13) not null comment '電話番号'
2193
  , FaxNumber varchar(13) comment 'FAX番号'
2194
  , HomePageURL varchar(120) comment 'ホームページURL'
2195
  , ConstructionExpenses decimal(4,2) not null comment '工事部経費'
2196
  , OfficeExpenses decimal(4,2) not null comment '事務所経費'
2197
  , OperatingExpenses decimal(4,2) not null comment '営業経費'
2198
  , ConsumptionTax decimal(4,2) not null comment '消費税'
2199
  , CooperationRate decimal(4,2) not null comment '協力金比率'
2200
  , StatutoryWelfareRate decimal(4,2) not null comment '法定福利費比率'
2201
  , FuelPrice decimal(5,2) not null comment '燃料キロ単価'
2202
  , AreaDistance decimal(5,2) not null comment '資材置場移動距離'
2203
  , ExcelSavePath varchar(120) comment 'Excel保存パス'
2204
  , BusinessPeriod smallint(6) not null comment '現在営業期数'
2205
  , ConstructionYear smallint(6) not null comment '現在工事年度'
2206
  , BusinessBeginningDate varchar(5) not null comment '営業期期首日'
2207
  , ConstructionBeginningDate varchar(5) not null comment '工事年度期首日'
2208
  , ConstructionNoBase decimal(1,0) not null comment '工事番号基準値'
2209
  , SloganString1 varchar(100) comment '標語1'
2210
  , SloganString2 varchar(100) comment '標語2'
2211
  , SloganString3 varchar(100) comment '標語3'
2212
  , EntryDate datetime not null comment '登録日付'
2213
  , UpdateDate datetime not null comment '更新日付'
2214
  , constraint systemmaster_PKC primary key (SystemCode)
2215
) comment '管理マスタ' ;
2216

    
2217
-- 期限マスタ
2218
drop table if exists termmaster cascade;
2219

    
2220
create table termmaster (
2221
  ConstructionStatusFlg decimal(2,0) not null comment '工事状態フラグ'
2222
  , FieldNo decimal(2,0) not null comment 'チェック対象フィールド番号'
2223
  , SeqNo decimal(2,0) not null comment '枝番'
2224
  , DisplayOrder decimal(2,0) not null comment '表示順'
2225
  , CheckSchdule decimal(1,0) not null comment 'チェックタイミング'
2226
  , TermDays decimal(3,0) not null comment '経過日'
2227
  , SendTitile varchar(100) comment 'タイトル'
2228
  , SendMessage varchar(100) comment 'メッセージ'
2229
  , BackColor varchar(8) comment '背景色'
2230
  , ForeColor varchar(8) comment '文字色'
2231
  , EntryDate datetime not null comment '登録日付'
2232
  , UpdateDate datetime not null comment '更新日付'
2233
  , constraint termmaster_PKC primary key (ConstructionStatusFlg,FieldNo,SeqNo)
2234
) comment '期限マスタ' ;
2235

    
2236
create index TermMaster_Index1
2237
  on termmaster(DisplayOrder);
2238

    
2239
-- 出勤交通費データ
2240
drop table if exists tranceportdailydata cascade;
2241

    
2242
create table tranceportdailydata (
2243
  PersonCode decimal(8,0) unsigned not null comment '作成者コード'
2244
  , AttendanceDate date not null comment '日報作成日'
2245
  , StartDistance decimal(7,1) not null comment '当日出発キロ数'
2246
  , ComplateDistance decimal(7,1) not null comment '当日終了キロ数'
2247
  , TotalDistance decimal(6,1) not null comment '当日合計キロ数'
2248
  , OfficeGoFlg decimal(1,0) not null comment '事務所出勤フラグ'
2249
  , OfficeOutFlg decimal(1,0) not null comment '事務所帰宅フラグ'
2250
  , TrancePayGoFlg decimal(1,0) not null comment '有料通勤出勤フラグ'
2251
  , TrancePayOutFlg decimal(1,0) not null comment '有料通勤帰宅フラグ'
2252
  , WareHouseFlg decimal(1,0) not null comment '資材置場フラグ'
2253
  , EntryDate datetime not null comment '登録日付'
2254
  , UpdateDate datetime not null comment '更新日付'
2255
  , constraint tranceportdailydata_PKC primary key (PersonCode,AttendanceDate)
2256
) comment '出勤交通費データ' ;
2257

    
2258
create index TranceportDailyData_Index1
2259
  on tranceportdailydata(AttendanceDate);
2260

    
2261
-- 工事種別経費率マスタ
2262
drop table if exists typeexpensesmaster cascade;
2263

    
2264
create table typeexpensesmaster (
2265
  TypeCode decimal(5,0) unsigned not null comment '工事種別コード'
2266
  , ExpensesPeriod smallint(6) not null comment '事業期'
2267
  , NameCode decimal(5,0) unsigned not null comment '経費名称コード'
2268
  , ExpensesRaito decimal(4,2) not null comment '経費率'
2269
  , DeleteFlg decimal(1,0) not null comment '削除フラグ'
2270
  , EntryDate datetime not null comment '登録日付'
2271
  , UpdateDate datetime not null comment '更新日付'
2272
  , constraint typeexpensesmaster_PKC primary key (TypeCode,ExpensesPeriod,NameCode)
2273
) comment '工事種別経費率マスタ' ;
2274

    
2275
-- 単位マスタ
2276
drop table if exists unitmaster cascade;
2277

    
2278
create table unitmaster (
2279
  UnitKey decimal(5,0) unsigned not null comment '単位キー'
2280
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2281
  , UnitName varchar(30) not null comment '単位名称'
2282
  , EntryDate datetime not null comment '登録日付'
2283
  , UpdateDate datetime not null comment '更新日付'
2284
  , constraint unitmaster_PKC primary key (UnitKey)
2285
) comment '単位マスタ' ;
2286

    
2287
create index UnitMaster_Index1
2288
  on unitmaster(DisplayOrder);
2289

    
2290
-- 車両マスタ
2291
drop table if exists vehiclemaster cascade;
2292

    
2293
create table vehiclemaster (
2294
  VehicleCode decimal(5,0) unsigned not null comment '車両コード'
2295
  , DisplayOrder decimal(5,0) unsigned not null comment '表示順'
2296
  , VehicleName varchar(100) not null comment '車両名称'
2297
  , RegistrationNumber varchar(30) comment '登録番号'
2298
  , IdentificationNumber varchar(30) comment '車体番号'
2299
  , ModelCode varchar(30) comment '型式'
2300
  , DepartmentCode decimal(5,0) unsigned not null comment '管理部署'
2301
  , VehicleScheduleFlg decimal(1,0) not null comment '車両予約表示フラグ'
2302
  , PurchaseDate date comment '購入日'
2303
  , PurchaseName varchar(30) comment '購入先'
2304
  , PurchaseContactPersons varchar(30) comment '購入先担当者'
2305
  , PurchasePhone varchar(13) comment '購入先電話番号'
2306
  , LeaseDate date comment 'リース開始日'
2307
  , LeaseDestination varchar(30) comment 'リース先'
2308
  , LeaseContactPersons varchar(30) comment 'リース先担当者'
2309
  , LeasePhone varchar(13) comment 'リース先電話番号'
2310
  , InsuranceCompany varchar(30) comment '任意保険会社'
2311
  , InsuranceContactPersons varchar(30) comment '任意保険会社担当者'
2312
  , InsurancePhone varchar(13) comment '任意保険会社電話番号'
2313
  , Note varchar(300) comment '備考'
2314
  , EntryDate datetime comment '登録日付'
2315
  , UpdateDate datetime comment '更新日付'
2316
  , constraint vehiclemaster_PKC primary key (VehicleCode)
2317
) comment '車両マスタ' ;
2318

    
2319
-- 車両記録データ
2320
drop table if exists vehiclerecorddata cascade;
2321

    
2322
create table vehiclerecorddata (
2323
  VehicleCode decimal(5,0) unsigned not null comment '車両コード'
2324
  , DivisionCode decimal(2,0) unsigned not null comment 'データ区分'
2325
  , SeqNo decimal(2,0) not null comment '枝番'
2326
  , RecordDate date comment '実地日'
2327
  , Mileage mediumint(9) comment '走行距離'
2328
  , Content varchar(100) comment '内容'
2329
  , PaymentCost decimal(10,0) comment '費用'
2330
  , EntryDate datetime not null comment '登録日付'
2331
  , UpdateDate datetime not null comment '更新日付'
2332
  , constraint vehiclerecorddata_PKC primary key (VehicleCode,DivisionCode,SeqNo)
2333
) comment '車両記録データ' ;
2334

    
2335
-- 車両予約データ
2336
drop table if exists vehiclescheduledata cascade;
2337

    
2338
create table vehiclescheduledata (
2339
  TargetDate date not null comment '対象日'
2340
  , VehicleCode decimal(5,0) unsigned not null comment '車両コード'
2341
  , MorningAfternoon decimal(1,0) not null comment '午前・午後'
2342
  , PersonCode decimal(8,0) unsigned not null comment '担当者コード'
2343
  , TargetYear year(4) not null comment '該当年'
2344
  , TargetMonth tinyint(3) unsigned not null comment '該当月'
2345
  , TargetDay year(4) not null comment '該当日'
2346
  , EntryDate datetime not null comment '登録日付'
2347
  , UpdateDate datetime not null comment '更新日付'
2348
  , constraint vehiclescheduledata_PKC primary key (TargetDate,VehicleCode,MorningAfternoon)
2349
) comment '車両予約データ' ;
2350

    
2351
create index VehicleScheduleData_Index1
2352
  on vehiclescheduledata(TargetYear);
2353

    
2354
create index VehicleScheduleData_Index2
2355
  on vehiclescheduledata(TargetMonth);
2356

    
2357
create index VehicleScheduleData_Index3
2358
  on vehiclescheduledata(TargetDay);
2359

    
2360
-- 年マスタ
2361
drop table if exists yearmaster cascade;
2362

    
2363
create table yearmaster (
2364
  years smallint(6) not null comment ''
2365
) comment '年マスタ' ;
2366

    
2367
create index year_Index1
2368
  on yearmaster(years);