SET SESSION FOREIGN_KEY_CHECKS=0;

/* Drop Indexes */

DROP INDEX ActionScheduleData_Index1 ON ActionScheduleData;
DROP INDEX ActionScheduleData_Index2 ON ActionScheduleData;
DROP INDEX ActionScheduleData_Index3 ON ActionScheduleData;
DROP INDEX AttendDaily_Index1 ON AttendanceDailyData;
DROP INDEX AttendDaily_Index2 ON AttendanceDailyData;
DROP INDEX BusinessTypeMaster_Index1 ON BusinessTypeMaster;
DROP INDEX ComponentLinkMaster_Index1 ON ComponentLinkMaster;
DROP INDEX ComponentLinkMaster_Index2 ON ComponentLinkMaster;
DROP INDEX ComponentMaster_Index1 ON ComponentMaster;
DROP INDEX ComponentToTypeMaster_Index1 ON ComponentToTypeMaster;
DROP INDEX ComponentToTypeMaster_Index2 ON ComponentToTypeMaster;
DROP INDEX BaseInfo_Index1 ON ConstructionBaseInfo;
DROP INDEX BaseInfo_Index2 ON ConstructionBaseInfo;
DROP INDEX BaseInfo_Index3 ON ConstructionBaseInfo;
DROP INDEX BaseInfo_Index4 ON ConstructionBaseInfo;
DROP INDEX BaseInfo_Index5 ON ConstructionBaseInfo;
DROP INDEX BaseInfoDetail_Idx1 ON ConstructionBaseInfoDetail;
DROP INDEX BaseInfoDetail_Idx2 ON ConstructionBaseInfoDetail;
DROP INDEX LedgerDetail_Index01 ON ConstructionLedgerDetail;
DROP INDEX LedgerDetail_Index02 ON ConstructionLedgerDetail;
DROP INDEX LedgerDetail_Index03 ON ConstructionLedgerDetail;
DROP INDEX LedgerExcute_Index1 ON ConstructionLedgerExcute;
DROP INDEX ConstructionLink_Index1 ON ConstructionLink;
DROP INDEX ConstructionLink_Index2 ON ConstructionLink;
DROP INDEX ConstructionLink_Index3 ON ConstructionLink;
DROP INDEX ConstructionSpecMaster_Index1 ON ConstructionSpecMaster;
DROP INDEX CostDataOfPerson_Index1 ON CostDataOfPerson;
DROP INDEX CostDataOfPerson_Index2 ON CostDataOfPerson;
DROP INDEX CostomerRegist_Index1 ON CostomerRegist;
DROP INDEX DailyDataConstruction_Index1 ON DailyDataConstruction;
DROP INDEX DailyDataConstruction_Index2 ON DailyDataConstruction;
DROP INDEX DailyDataConstruction_Index3 ON DailyDataConstruction;
DROP INDEX DailyDataDetail_Index ON DailyDataDetail;
DROP INDEX DailyDataField_Index ON DailyDataField;
DROP INDEX DailyDataMaterials_Index ON DailyDataMaterials;
DROP INDEX DailyDataSubcontractors_Index ON DailyDataSubcontractors;
DROP INDEX DailyDataVehicles_Index ON DailyDataVehicles;
DROP INDEX DepartmentMaster_index1 ON DepartmentMaster;
DROP INDEX EstimateData_Index1 ON EstimateData;
DROP INDEX EstimateDataBody_Index1 ON EstimateDataBody;
DROP INDEX EstimateDataDetail_Index1 ON EstimateDataDetail;
DROP INDEX HolidayCalender_Index1 ON HolidayCalenderMaster;
DROP INDEX HolidayCalenderMaster_Index2 ON HolidayCalenderMaster;
DROP INDEX HolidayCalenderMaster_Index3 ON HolidayCalenderMaster;
DROP INDEX InputSearchLogData_Index1 ON InputSearchLogData;
DROP INDEX MessageBoardData_Index1 ON MessageBoardData;
DROP INDEX MessageBoardData_Index2 ON MessageBoardData;
DROP INDEX MessageBoardTerget_Index1 ON MessageBoardTerget;
DROP INDEX PersonDepartmentMaster_Index1 ON PersonDepartmentMaster;
DROP INDEX PersonDepartmentMaster_Index2 ON PersonDepartmentMaster;
DROP INDEX PersonInChargeMaster_Index1 ON PersonInChargeMaster;
DROP INDEX PersonInChargeMaster_Index2 ON PersonInChargeMaster;
DROP INDEX PersonSalaryMaster_Index1 ON PersonSalaryMaster;
DROP INDEX PersonSalaryMaster_Index2 ON PersonSalaryMaster;
DROP INDEX ProcessExcuteMaster_Index1 ON ProcessExcuteMaster;
DROP INDEX ProcessExcuteMaster_Index2 ON ProcessExcuteMaster;
DROP INDEX POrderDetail_Index1 ON PurchaseOrderDetail;
DROP INDEX SalesGraphData_Idx1 ON SalesGraphData;
DROP INDEX SalesGraphData_idx2 ON SalesGraphData;
DROP INDEX SecurityMaster_Index1 ON SecurityMaster;
DROP INDEX SecurityMaster_Index2 ON SecurityMaster;
DROP INDEX SecurityMaster_Index3 ON SecurityMaster;
DROP INDEX SubContractorJobItem_Index1 ON SubContractorJobItem;
DROP INDEX SubContractorJobItem_Index2 ON SubContractorJobItem;
DROP INDEX SubContractorJobLink_Index1 ON SubContractorJobLink;
DROP INDEX SubContractorJobLink_Index2 ON SubContractorJobLink;
DROP INDEX SubContractorMaster_Index1 ON SubContractorMaster;
DROP INDEX TermMaster_Index1 ON TermMaster;
DROP INDEX TranceportDailyData_Index1 ON TranceportDailyData;
DROP INDEX UnitMaster_Index1 ON UnitMaster;
DROP INDEX VehicleScheduleData_Index1 ON VehicleScheduleData;
DROP INDEX VehicleScheduleData_Index2 ON VehicleScheduleData;
DROP INDEX VehicleScheduleData_Index3 ON VehicleScheduleData;



/* Drop Tables */

DROP TABLE IF EXISTS ActionScheduleData;
DROP TABLE IF EXISTS ApprovalMaster;
DROP TABLE IF EXISTS AttendanceDailyData;
DROP TABLE IF EXISTS AttendanceData;
DROP TABLE IF EXISTS BK_ConstructionLedger;
DROP TABLE IF EXISTS BK_ConstructionLedgerDetail;
DROP TABLE IF EXISTS BK_ConstructionLedgerExcute;
DROP TABLE IF EXISTS BK_EstimateData;
DROP TABLE IF EXISTS BK_EstimateDataBody;
DROP TABLE IF EXISTS BK_EstimateDataDetail;
DROP TABLE IF EXISTS BusinessTypeMaster;
DROP TABLE IF EXISTS CommonCostLarge;
DROP TABLE IF EXISTS CommonCostLinkMS;
DROP TABLE IF EXISTS CommonCostMiddle;
DROP TABLE IF EXISTS CommonCostMiddleSearchWord;
DROP TABLE IF EXISTS ComponentLinkMaster;
DROP TABLE IF EXISTS ComponentMaster;
DROP TABLE IF EXISTS ComponentToTypeMaster;
DROP TABLE IF EXISTS ConstructionBaseInfo;
DROP TABLE IF EXISTS ConstructionBaseInfoDetail;
DROP TABLE IF EXISTS ConstructionBudget;
DROP TABLE IF EXISTS ConstructionBudgetDetail;
DROP TABLE IF EXISTS ConstructionItemMaster;
DROP TABLE IF EXISTS ConstructionLedger;
DROP TABLE IF EXISTS ConstructionLedgerDetail;
DROP TABLE IF EXISTS ConstructionLedgerExcute;
DROP TABLE IF EXISTS ConstructionLink;
DROP TABLE IF EXISTS ConstructionProgressDate;
DROP TABLE IF EXISTS ConstructionSpecMaster;
DROP TABLE IF EXISTS ConstructionSpecUnitPrice;
DROP TABLE IF EXISTS ConstructionTypeMaster;
DROP TABLE IF EXISTS CostDataOfPerson;
DROP TABLE IF EXISTS CostomerRegist;
DROP TABLE IF EXISTS DailyDataConstruction;
DROP TABLE IF EXISTS DailyDataDetail;
DROP TABLE IF EXISTS DailyDataField;
DROP TABLE IF EXISTS DailyDataMaterials;
DROP TABLE IF EXISTS DailyDataSubcontractors;
DROP TABLE IF EXISTS DailyDataVehicles;
DROP TABLE IF EXISTS DayMaster;
DROP TABLE IF EXISTS DepartmentExpensesMaster;
DROP TABLE IF EXISTS DepartmentMaster;
DROP TABLE IF EXISTS DivisionMaster;
DROP TABLE IF EXISTS EstimateBudget;
DROP TABLE IF EXISTS EstimateBudgetDetail;
DROP TABLE IF EXISTS EstimateData;
DROP TABLE IF EXISTS EstimateDataBody;
DROP TABLE IF EXISTS EstimateDataDetail;
DROP TABLE IF EXISTS HolidayCalenderMaster;
DROP TABLE IF EXISTS InputSearchLogData;
DROP TABLE IF EXISTS MessageBoardData;
DROP TABLE IF EXISTS MessageBoardTerget;
DROP TABLE IF EXISTS MessageBrowsingHistory;
DROP TABLE IF EXISTS MonthMaster;
DROP TABLE IF EXISTS OrderersMaster;
DROP TABLE IF EXISTS OrdersPriceData;
DROP TABLE IF EXISTS PersonApproval;
DROP TABLE IF EXISTS PersonApprovalComment;
DROP TABLE IF EXISTS PersonDepartmentMaster;
DROP TABLE IF EXISTS PersonInChargeMaster;
DROP TABLE IF EXISTS PersonSalaryMaster;
DROP TABLE IF EXISTS ProceedingsData;
DROP TABLE IF EXISTS ProceedingsDataAttend;
DROP TABLE IF EXISTS ProceedingsDataDetail;
DROP TABLE IF EXISTS ProcessApproval;
DROP TABLE IF EXISTS ProcessApprovalComment;
DROP TABLE IF EXISTS ProcessApprovalDetail;
DROP TABLE IF EXISTS ProcessExcuteMaster;
DROP TABLE IF EXISTS PurchaseOrder;
DROP TABLE IF EXISTS PurchaseOrderDetail;
DROP TABLE IF EXISTS SalesGraphData;
DROP TABLE IF EXISTS SecurityMaster;
DROP TABLE IF EXISTS SubConstrJobItemRegist;
DROP TABLE IF EXISTS SubConstrJobLinkRegist;
DROP TABLE IF EXISTS SubConstrRegist;
DROP TABLE IF EXISTS SubContractorItemMaster;
DROP TABLE IF EXISTS SubContractorJobCategory;
DROP TABLE IF EXISTS SubContractorJobItem;
DROP TABLE IF EXISTS SubContractorJobLink;
DROP TABLE IF EXISTS SubContractorMaster;
DROP TABLE IF EXISTS SuppliersMaster;
DROP TABLE IF EXISTS SystemExecute;
DROP TABLE IF EXISTS SystemMaster;
DROP TABLE IF EXISTS TermMaster;
DROP TABLE IF EXISTS TranceportDailyData;
DROP TABLE IF EXISTS TypeExpensesMaster;
DROP TABLE IF EXISTS UnitMaster;
DROP TABLE IF EXISTS VehicleMaster;
DROP TABLE IF EXISTS VehicleRecordData;
DROP TABLE IF EXISTS VehicleScheduleData;
DROP TABLE IF EXISTS YearMaster;




/* Create Tables */

-- 担当者行動予定データ
CREATE TABLE ActionScheduleData
(
	TargetDate date NOT NULL COMMENT '対象日',
	PersonCode decimal(8,0) NOT NULL COMMENT '担当者コード',
	ActionSchedule varchar(30) COMMENT '行動予定',
	TargetYear year(4) NOT NULL COMMENT '該当年',
	TargetMonth year(2) NOT NULL COMMENT '該当月',
	TargetDay year(2) NOT NULL COMMENT '該当日',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (TargetDate, PersonCode)
) COMMENT = '担当者行動予定データ';


-- 承認経路マスタ
CREATE TABLE ApprovalMaster
(
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
	DepartmentCode decimal(5,0) unsigned NOT NULL COMMENT '部署コード',
	SeqNo decimal(2) NOT NULL COMMENT '枝番',
	DisplayOrder decimal(2) NOT NULL COMMENT '表示順',
	ApprovalPerson decimal(8) unsigned NOT NULL COMMENT '承認者コード',
	ApprovalAuthority decimal(1) NOT NULL COMMENT '承認権限区分',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ApprovalCode, DepartmentCode, SeqNo)
) COMMENT = '承認経路マスタ';


-- 出勤日報データ
CREATE TABLE AttendanceDailyData
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	AttendanceDate date NOT NULL COMMENT '日報作成日',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	ActionResult varchar(30) NOT NULL COMMENT '行動実績',
	OvertimeHours decimal(4,1) NOT NULL COMMENT '残業時間',
	WorkingComment varchar(120) COMMENT 'コメント',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, AttendanceDate, SeqNo)
) COMMENT = '出勤日報データ';


-- 出勤管理データ
CREATE TABLE AttendanceData
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	AttendanceMonth date NOT NULL COMMENT '出勤管理年月',
	LastDays decimal(2) unsigned NOT NULL COMMENT '当月最終日',
	AttendDayCount decimal(2) unsigned NOT NULL COMMENT '出勤日数',
	TotalOverTimes decimal(4,1) NOT NULL COMMENT '残業時間数',
	OrderDate date NOT NULL COMMENT '申請日',
	OrderNo decimal(2) unsigned NOT NULL COMMENT '申請受付番号',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, AttendanceMonth)
) COMMENT = '出勤管理データ';


-- 工事詳細台帳データ【退避用】
CREATE TABLE BK_ConstructionLedger
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ConstructionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
	CreatorCode decimal(8,0) COMMENT '作成者コード',
	CreatorName varchar(60) COMMENT '作成者名',
	CreateDate date NOT NULL COMMENT '作成日',
	ConstructionTimes decimal(5,2) NOT NULL COMMENT '工期（単位・月）',
	ConstructionStart date NOT NULL COMMENT '契約工期開始',
	ConstructionEnd date NOT NULL COMMENT '契約工期完了',
	OrdersDecisionPrice decimal(14,0) NOT NULL COMMENT '税抜受注決定金額',
	CompanyExpenses decimal(10,0) NOT NULL COMMENT '会社経費合計',
	DepartmentExpenses decimal(10,0) NOT NULL COMMENT '部署経費合計',
	SalesExpenses decimal(10,0) NOT NULL COMMENT '営業経費合計',
	TotalPayment decimal(10,0) NOT NULL COMMENT '総支払額',
	GrossProfit decimal(10,0) NOT NULL COMMENT '粗利',
	Allowance decimal(10,0) NOT NULL COMMENT '給与',
	NetProfit decimal(10,0) NOT NULL COMMENT '純利益',
	ComplateFlg decimal(1) NOT NULL COMMENT '入力完了フラグ',
	IntegrationFlg decimal(1) NOT NULL COMMENT '受注金額積算フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode)
) COMMENT = '工事詳細台帳データ【退避用】';


-- 工事詳細台帳明細データ【退避用】
CREATE TABLE BK_ConstructionLedgerDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
	LineCount decimal(5) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	FirstString varchar(120) COMMENT '項目名称',
	SecondString varchar(120) COMMENT '工事内容',
	CompanyType decimal(1) NOT NULL COMMENT '協力会社コードタイプ',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	CompanyName varchar(120) COMMENT '協力会社名称',
	EstimatePrice decimal(12,0) NOT NULL COMMENT '予算（見積）金額',
	ExecutionAmount decimal(12,0) NOT NULL COMMENT '実行金額',
	AmountConfigRate decimal(5,2) NOT NULL COMMENT '金額構成率',
	PaymentBurden decimal(12,0) NOT NULL COMMENT '支払補填額',
	FixDataFlg decimal(1) NOT NULL COMMENT '固定データフラグ',
	IndependentFlg decimal(1) NOT NULL COMMENT '独立データフラグ',
	FluctuationFlg decimal(1) NOT NULL COMMENT '増減データフラグ',
	SalaryFlg decimal(1) NOT NULL COMMENT '給与振分区分',
	SalaryDays decimal(4) NOT NULL COMMENT '給与振分日数',
	OperatingFlg decimal(1) NOT NULL COMMENT '担当中フラグ',
	SourceCode decimal(10) unsigned NOT NULL COMMENT '元工事番号',
	JoinTitleFlg decimal(1) NOT NULL COMMENT '工事名称タイトル',
	SalaryOnRegist decimal(12,0) NOT NULL COMMENT '登録時月額給与',
	PurchaseOrderFlg decimal(2) NOT NULL COMMENT '注文書発行フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
) COMMENT = '工事詳細台帳明細データ【退避用】';


-- 工事詳細台帳実行データ【退避用】
CREATE TABLE BK_ConstructionLedgerExcute
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
	LineCount decimal(5) unsigned NOT NULL COMMENT '行番号',
	ColumnCount decimal(3) NOT NULL COMMENT '列番号',
	PaymentAmount decimal(12,0) NOT NULL COMMENT '支払金額',
	TargetMonth date NOT NULL COMMENT '対象年月',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount, ColumnCount)
) COMMENT = '工事詳細台帳実行データ【退避用】';


-- 積算見積データ【退避用】
CREATE TABLE BK_EstimateData
(
	SaveDate datetime NOT NULL COMMENT '退避日付',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	FixedItemCode varchar(1) COMMENT '固定項目キー',
	ItemName varchar(120) COMMENT '作業名称',
	SpecName varchar(120) COMMENT '作業／品質・形状・寸法',
	PriceValue decimal(14,0) NOT NULL COMMENT '金額',
	note varchar(60) COMMENT '備考',
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
	InputFlg decimal(1) NOT NULL COMMENT '入力フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SaveDate, ConstructionCode, LineCount)
) COMMENT = '積算見積データ【退避用】';


-- 積算見積ページデータ【退避用】
CREATE TABLE BK_EstimateDataBody
(
	SaveDate datetime NOT NULL COMMENT '退避日付',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	PageCount decimal(4) unsigned NOT NULL COMMENT 'ページ番号',
	Category decimal(1) NOT NULL COMMENT 'ページ区分',
	UnionComponentCode decimal(5) unsigned NOT NULL COMMENT '所属構成キー',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	SelectComponent decimal(5) unsigned NOT NULL COMMENT '選択構成キー',
	PageTitle varchar(120) NOT NULL COMMENT 'ページ表示名',
	DetailLineCount decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SaveDate, ConstructionCode, PageCount)
) COMMENT = '積算見積ページデータ【退避用】';


-- 積算見積データ明細【退避用】
CREATE TABLE BK_EstimateDataDetail
(
	SaveDate datetime NOT NULL COMMENT '退避日付',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	PageCount decimal(4) unsigned NOT NULL COMMENT 'ページ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	DataType decimal(1) NOT NULL COMMENT 'データ種別',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
	ItemName varchar(120) COMMENT '作業名称',
	SpecName varchar(120) COMMENT '作業／品質・形状・寸法',
	Unitcount decimal(8,2) NOT NULL COMMENT '数量',
	UnitName varchar(30) COMMENT '単位名称',
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
	LineTotal decimal(12,0) NOT NULL COMMENT '金額',
	note varchar(60) COMMENT '備考',
	CompanyCode decimal(8) NOT NULL COMMENT '協力会社コード',
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
	InputFlg decimal(1) COMMENT '入力フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SaveDate, ConstructionCode, PageCount, LineCount)
) COMMENT = '積算見積データ明細【退避用】';


-- 法人格マスタ
CREATE TABLE BusinessTypeMaster
(
	BusinessTypeCode decimal(5,0) unsigned NOT NULL COMMENT '法人格コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	BusinessTypeName varchar(100) DEFAULT '' NOT NULL COMMENT '業種名',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (BusinessTypeCode)
) COMMENT = '法人格マスタ';


-- 共通費大項目マスタ
CREATE TABLE CommonCostLarge
(
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	LargeName varchar(50) DEFAULT '' NOT NULL COMMENT '大項目名称',
	CommentText varchar(120) COMMENT '説明書き',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (LargeCode)
) COMMENT = '共通費大項目マスタ';


-- 共通費工種関連マスタ
CREATE TABLE CommonCostLinkMS
(
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
	MiddleCode decimal(5,0) unsigned NOT NULL COMMENT '中項目キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	EntryDate datetime COMMENT '登録日付',
	UpdateDate datetime COMMENT '更新日付',
	PRIMARY KEY (LargeCode, MiddleCode, ItemCode)
) COMMENT = '共通費工種関連マスタ';


-- 共通費中項目マスタ
CREATE TABLE CommonCostMiddle
(
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
	MiddleCode decimal(5,0) unsigned NOT NULL COMMENT '中項目キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	MiddleName varchar(50) DEFAULT '' NOT NULL COMMENT '中項目名称',
	CommentText varchar(120) COMMENT '説明書き',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (LargeCode, MiddleCode)
) COMMENT = '共通費中項目マスタ';


-- 共通費中項目キーマスタ
CREATE TABLE CommonCostMiddleSearchWord
(
	LargeCode decimal(5,0) unsigned NOT NULL COMMENT '大項目キー',
	MiddleCode decimal(5,0) unsigned NOT NULL COMMENT '中項目キー',
	SeqNo decimal(5) unsigned NOT NULL COMMENT '順序',
	SearchWord varchar(50) DEFAULT '' NOT NULL COMMENT '検索項目',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (LargeCode, MiddleCode, SeqNo)
) COMMENT = '共通費中項目キーマスタ';


-- 構成工種関連マスタ
CREATE TABLE ComponentLinkMaster
(
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	DisplayOrder decimal(5) unsigned COMMENT '表示順',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ComponentCode, ItemCode)
) COMMENT = '構成工種関連マスタ';


-- 構成マスタ
CREATE TABLE ComponentMaster
(
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	ComponentName varchar(120) DEFAULT '' NOT NULL COMMENT '構成名称',
	SubItemsFlg decimal(1) COMMENT '下位項目フラグ',
	DirectInputFlg decimal(1) COMMENT '直接入力フラグ',
	MyExpensesFlg decimal(1) COMMENT '自社経費フラグ',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ComponentCode)
) COMMENT = '構成マスタ';


-- 構成工事種別関連マスタ
CREATE TABLE ComponentToTypeMaster
(
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	TypeCode decimal(5,0) unsigned NOT NULL COMMENT '工事種別コード',
	Dummy decimal(1) NOT NULL COMMENT 'ダミー項目',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ComponentCode, TypeCode)
) COMMENT = '構成工事種別関連マスタ';


-- 工事基本情報
CREATE TABLE ConstructionBaseInfo
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	TyingFlg decimal(1) NOT NULL COMMENT '紐付データフラグ',
	JoinFlg decimal(1) NOT NULL COMMENT '結合契約工事フラグ',
	ConstructionYear smallint unsigned NOT NULL COMMENT '工事年度',
	ConstructionPeriod smallint unsigned NOT NULL COMMENT '工事期数',
	RequestedDate date COMMENT '依頼受け日',
	EstimatesSubmitDeadline date COMMENT '見積提出期限',
	EstimatesSubmittedDate date COMMENT '見積提出日',
	ProvisionalOrderDate date COMMENT '仮受注日',
	OrderDate date COMMENT '受注日',
	OrderStartingDate date COMMENT '開始予定日',
	OrderCompletionDate date COMMENT '完了予定日',
	PreparationStartDate date COMMENT '施工準備開始日',
	ConstructionStartingDate date COMMENT '施工開始日',
	ConstructionCompletionDate date COMMENT '施工完了日',
	NonOrderDate date COMMENT '非受注日',
	OrdersDecisionPrice decimal(12,0) NOT NULL COMMENT '税抜受注決定金額',
	OrdersDecisionPriceInTax decimal(12,0) NOT NULL COMMENT '税込受注決定金額',
	SalesPersonCode decimal(8,0) COMMENT '営業担当者名',
	ConstructionPersonCode decimal(8,0) NOT NULL COMMENT '工事担当者',
	ConstrSubPersonCode decimal(8,0) NOT NULL COMMENT '工事副担当者',
	ConstructionInstructor decimal(8,0) NOT NULL COMMENT '工事指導員',
	TransferConstruction decimal(8,0) NOT NULL COMMENT '工事移管先コード',
	TransferConstructionDate date COMMENT '工事移管日',
	OrderersDivision decimal(5) NOT NULL COMMENT '発注者区分',
	OrderersCode decimal(5,0) unsigned NOT NULL COMMENT '発注者コード',
	EstimatesExpirationDate date COMMENT '見積有効期限',
	ConstructionPeriodStart date COMMENT '契約工期開始日',
	ConstructionPeriodEnd date COMMENT '契約工期完了',
	ConstructionPeriodStart2 date COMMENT '契約工期開始（延長時）',
	ConstructionPeriodEnd2 date COMMENT '契約工期完了（延長時）',
	StartDate date COMMENT '工事開始日',
	EndDate date COMMENT '工事終了日',
	PurchaseOrderMailingDate date COMMENT '注文書郵送日',
	PurchaseOrderReturnDate date COMMENT '注文書返送日',
	PurchaseOrderReturnCheckDate date COMMENT '注文書返送確認日',
	ConsumptionTaxFlg decimal(1) NOT NULL COMMENT '消費税フラグ',
	PrimeContractorFlg decimal(1) NOT NULL COMMENT '元請フラグ',
	SalesCostFlg decimal(1) NOT NULL COMMENT '営業経費発生フラグ',
	ConstructionStatusFlg decimal(2,0) NOT NULL COMMENT '工事状態フラグ',
	ConstructionType decimal(5) NOT NULL COMMENT '工事種別コード',
	EstimateType decimal(1) NOT NULL COMMENT '見積種別',
	BillingStartDate date NOT NULL COMMENT '請求準備開始日',
	BillingDate date NOT NULL COMMENT '請求日',
	BillingSplitFlg decimal(1) NOT NULL COMMENT '請求回数フラグ',
	BillingSendDate date COMMENT '請求書郵送/手渡し日',
	LedgerComplateDate date NOT NULL COMMENT '工事詳細台帳入力完了日付',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode)
) COMMENT = '工事基本情報';


-- 工事基本情報明細
CREATE TABLE ConstructionBaseInfoDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	DetailNo decimal(2) NOT NULL COMMENT '明細番号',
	DetailString varchar(120) COMMENT '明細内容',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, DetailNo)
) COMMENT = '工事基本情報明細';


-- 工事施工予算データ
CREATE TABLE ConstructionBudget
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	CreatorCode decimal(8,0) NOT NULL COMMENT '作成者コード',
	CreatorName varchar(60) COMMENT '作成者名',
	CreatorCosts decimal(11,0) NOT NULL COMMENT '作成者給与',
	AssistantCode decimal(8,0) NOT NULL COMMENT '副担当者コード',
	AssistantName varchar(60) COMMENT '副担当者名',
	AssistantCosts decimal(11,0) NOT NULL COMMENT '副担当者給与',
	InstructorCode decimal(8,0) NOT NULL COMMENT '工事指導員コード',
	InstructorName varchar(60) COMMENT '工事指導員名',
	InstructorCosts decimal(11,0) NOT NULL COMMENT '工事指導員給与',
	CreateDate date NOT NULL COMMENT '作成日',
	ConstructionTimes decimal(5,2) NOT NULL COMMENT '工期（単位・月）',
	ConstructionStart date NOT NULL COMMENT '契約工期開始',
	ConstructionEnd date NOT NULL COMMENT '契約工期完了',
	InstructorTimes decimal(5,2) NOT NULL COMMENT '指導員稼働月数',
	SalaryFlg decimal(1) NOT NULL COMMENT '給与振分区分',
	SalaryDays decimal(4) NOT NULL COMMENT '振分日数',
	A_SalaryFlg decimal(1) NOT NULL COMMENT '副担当者給与振分区分',
	A_SalaryDays decimal(4) NOT NULL COMMENT '副担当者振分日数',
	I_SalaryFlg decimal(1) NOT NULL COMMENT '指導員給与振分区分',
	I_SalaryDays decimal(4) NOT NULL COMMENT '指導員振分日数',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode)
) COMMENT = '工事施工予算データ';


-- 工事施工予算データ明細
CREATE TABLE ConstructionBudgetDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	FirstString varchar(120) COMMENT '項目名称',
	SecondString varchar(120) COMMENT '工事内容',
	CompanyType decimal(1) NOT NULL COMMENT '協力会社コードタイプ',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	CompanyName varchar(120) COMMENT '協力会社名称',
	EstimatePrice decimal(12,0) NOT NULL COMMENT '積算時見積金額',
	NegotiationPrice decimal(12,0) NOT NULL COMMENT '積算時交渉金額',
	OrderDesiredAmount decimal(12,0) NOT NULL COMMENT '発注希望金額',
	ExecutionAmount decimal(12,0) NOT NULL COMMENT '実行金額',
	AmountConfigRate decimal(5,2) NOT NULL COMMENT '金額構成率',
	NegotiateFlg decimal(1) NOT NULL COMMENT '協力業者交渉フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
) COMMENT = '工事施工予算データ明細';


-- 工種マスタ
CREATE TABLE ConstructionItemMaster
(
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	ItemName varchar(120) DEFAULT '' NOT NULL COMMENT '工種名称',
	SubItemsFlg decimal(1) COMMENT '下位項目フラグ',
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ItemCode)
) COMMENT = '工種マスタ';


-- 工事詳細台帳データ
CREATE TABLE ConstructionLedger
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ConstructionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
	CreatorCode decimal(8,0) COMMENT '作成者コード',
	CreatorName varchar(60) COMMENT '作成者名',
	CreateDate date NOT NULL COMMENT '作成日',
	ConstructionTimes decimal(5,2) NOT NULL COMMENT '工期（単位・月）',
	ConstructionStart date NOT NULL COMMENT '契約工期開始',
	ConstructionEnd date NOT NULL COMMENT '契約工期完了',
	OrdersDecisionPrice decimal(14,0) NOT NULL COMMENT '税抜受注決定金額',
	CompanyExpenses decimal(10,0) NOT NULL COMMENT '会社経費合計',
	DepartmentExpenses decimal(10,0) NOT NULL COMMENT '部署経費合計',
	SalesExpenses decimal(10,0) NOT NULL COMMENT '営業経費合計',
	TotalPayment decimal(10,0) NOT NULL COMMENT '総支払額',
	GrossProfit decimal(10,0) NOT NULL COMMENT '粗利',
	Allowance decimal(10,0) NOT NULL COMMENT '給与',
	NetProfit decimal(10,0) NOT NULL COMMENT '純利益',
	ComplateFlg decimal(1) NOT NULL COMMENT '入力完了フラグ',
	IntegrationFlg decimal(1) NOT NULL COMMENT '受注金額積算フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode)
) COMMENT = '工事詳細台帳データ';


-- 工事詳細台帳明細データ
CREATE TABLE ConstructionLedgerDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	FirstString varchar(120) COMMENT '項目名称',
	SecondString varchar(120) COMMENT '工事内容',
	CompanyType decimal(1) NOT NULL COMMENT '協力会社コードタイプ',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	CompanyName varchar(120) COMMENT '協力会社名称',
	EstimatePrice decimal(12,0) NOT NULL COMMENT '予算（見積）金額',
	ExecutionAmount decimal(12,0) NOT NULL COMMENT '実行金額',
	AmountConfigRate decimal(5,2) NOT NULL COMMENT '金額構成率',
	PaymentBurden decimal(12,0) NOT NULL COMMENT '支払補填額',
	FixDataFlg decimal(1) NOT NULL COMMENT '固定データフラグ',
	IndependentFlg decimal(1) NOT NULL COMMENT '独立データフラグ',
	FluctuationFlg decimal(1) NOT NULL COMMENT '増減データフラグ',
	SalaryFlg decimal(1) NOT NULL COMMENT '給与振分区分',
	SalaryDays decimal(4) NOT NULL COMMENT '給与振分日数',
	OperatingFlg decimal(1) NOT NULL COMMENT '担当中フラグ',
	SourceCode decimal(10) unsigned NOT NULL COMMENT '元工事番号',
	JoinTitleFlg decimal(1) NOT NULL COMMENT '工事名称タイトル',
	SalaryOnRegist decimal(12,0) NOT NULL COMMENT '登録時月額給与',
	PurchaseOrderFlg decimal(2) NOT NULL COMMENT '注文書発行フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
) COMMENT = '工事詳細台帳明細データ';


-- 工事詳細台帳実行データ
CREATE TABLE ConstructionLedgerExcute
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ColumnCount decimal(3) NOT NULL COMMENT '列番号',
	PaymentAmount decimal(12,0) NOT NULL COMMENT '支払金額',
	TargetMonth date NOT NULL COMMENT '対象年月',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount, ColumnCount)
) COMMENT = '工事詳細台帳実行データ';


-- 工事リンク情報
CREATE TABLE ConstructionLink
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	FluctuationCode decimal(10,0) NOT NULL COMMENT '子工事番号',
	LinkType decimal(1) NOT NULL COMMENT 'リンク種別',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, FluctuationCode)
) COMMENT = '工事リンク情報';


-- 案件進捗日付データ
CREATE TABLE ConstructionProgressDate
(
	ConstructionCode decimal(10,0) NOT NULL COMMENT '工事番号',
	ConstructionStatusFlg decimal(2,0) NOT NULL COMMENT '設定工事状態',
	PreviousStatusFlg decimal(2,0) COMMENT '変更前状態',
	ChangeDate datetime NOT NULL COMMENT '設定日付',
	ChangePersonCode decimal(8,0) NOT NULL COMMENT '設定担当者',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ConstructionStatusFlg)
) COMMENT = '案件進捗日付データ';


-- 作業マスタ
CREATE TABLE ConstructionSpecMaster
(
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	ItemName varchar(120) DEFAULT '' COMMENT '作業名称',
	SpecName varchar(120) COMMENT '作業名称',
	UnitName varchar(30) COMMENT '単位名称',
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ItemCode, SpecCode)
) COMMENT = '作業マスタ';


-- 作業単価マスタ
CREATE TABLE ConstructionSpecUnitPrice
(
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
	ConstructionTypeCode mediumint unsigned NOT NULL COMMENT '工事種別コード',
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ComponentCode, ItemCode, SpecCode, ConstructionTypeCode)
) COMMENT = '作業単価マスタ';


-- 工事種別マスタ
CREATE TABLE ConstructionTypeMaster
(
	TypeCode decimal(5,0) unsigned NOT NULL COMMENT '工事種別コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	NameString varchar(100) DEFAULT '' NOT NULL COMMENT '名称',
	PublicFlg decimal(1) NOT NULL COMMENT '工事種別フラグ',
	SecRank decimal(1) NOT NULL COMMENT '保護区分ランク',
	ExpensesLink decimal(1) NOT NULL COMMENT '経費使用区分',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (TypeCode)
) COMMENT = '工事種別マスタ';


-- 担当者毎経費データ
CREATE TABLE CostDataOfPerson
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	ActionDate date NOT NULL COMMENT '対象日付',
	DataType decimal(1) NOT NULL COMMENT 'データ区分',
	DataAddCount decimal(5) unsigned NOT NULL COMMENT 'データ追加番号',
	TargetMonth varchar(7) NOT NULL COMMENT '対象年月',
	ConstructionCode decimal(10,0) unsigned COMMENT '工事コード',
	SuppliersCode decimal(5) unsigned NOT NULL COMMENT '支払先コード',
	SuppliersName varchar(120) COMMENT '支払先名称',
	PaymentContent varchar(60) COMMENT '支払内容',
	PaymentType decimal(1) NOT NULL COMMENT '支払方法フラグ',
	EntryPrice decimal(12,0) NOT NULL COMMENT '金額（税抜）',
	EntryPriceInTax decimal(12,0) NOT NULL COMMENT '金額（税込）',
	SlipNumber varchar(12) COMMENT '伝票番号',
	ComplateFlg decimal(1) NOT NULL COMMENT '引込済みフラグ',
	ApprovalFlg decimal(1) NOT NULL COMMENT '承認フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, ActionDate, DataType, DataAddCount)
) COMMENT = '担当者毎経費データ';


-- 発注者登録申請データ
CREATE TABLE CostomerRegist
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '申請者番号',
	CreateDate date NOT NULL COMMENT '作成日',
	SeqNo decimal(2) NOT NULL COMMENT 'キー連番',
	DataMode decimal(1) NOT NULL COMMENT 'データ区分',
	SourceCotegory decimal(5) unsigned NOT NULL COMMENT '発注者区分',
	SourceCode decimal(5) unsigned NOT NULL COMMENT '発注者コード',
	PetitionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
	OrderFlg decimal(1) NOT NULL COMMENT '法人団体・個人フラグ',
	CorporateStatusName varchar(100) COMMENT '法人格名称',
	CorporateStatusPoint decimal(1) COMMENT '法人格名称位置',
	OrderersName1 varchar(60) DEFAULT '' NOT NULL COMMENT '発注者名1',
	OrderersName2 varchar(60) COMMENT '発注者名２',
	DepartmentName varchar(60) COMMENT '部署名',
	ChargePersonName varchar(60) COMMENT '担当者名',
	ZipCode varchar(8) COMMENT '郵便番号',
	Address1 varchar(60) COMMENT '住所１',
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
	Address3 varchar(60) COMMENT '住所3',
	PhoneNumber varchar(13) DEFAULT '' COMMENT '電話番号',
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
	MailAddress varchar(257) COMMENT 'メールアドレス',
	Note varchar(300) DEFAULT '' COMMENT '備考',
	OrderCotegory decimal(5,0) unsigned NOT NULL COMMENT '発注者区分',
	OrderDate date NOT NULL COMMENT '申請日',
	OrderNo decimal(2) unsigned NOT NULL COMMENT '申請受付番号',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, CreateDate, SeqNo)
) COMMENT = '発注者登録申請データ';


-- 日報データ
CREATE TABLE DailyDataConstruction
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	DailyDataDate date NOT NULL COMMENT '日報作成日',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	Weather varchar(60) COMMENT '天気',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode)
) COMMENT = '日報データ';


-- 日報データ (明細)
CREATE TABLE DailyDataDetail
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	DailyDataDate date NOT NULL COMMENT '日報作成日',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	JobCategoryCode decimal(5,0) NOT NULL COMMENT '職種キー',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	TodayHeadCount decimal(4,1) NOT NULL COMMENT '当日人員数',
	TotalHeadCount decimal(5,1) NOT NULL COMMENT '累計人員数',
	TodayWork varchar(100) COMMENT '当日作業内容',
	NextdayWork varchar(100) COMMENT '翌日作業内容',
	NextdayHeadCount decimal(4,1) NOT NULL COMMENT '翌日人員数',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
) COMMENT = '日報データ (明細)';


-- 日報データ (現場巡回)
CREATE TABLE DailyDataField
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	DailyDataDate date NOT NULL COMMENT '日報作成日',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	PatrolTime datetime NOT NULL COMMENT '巡回時間',
	ContentsText varchar(200) COMMENT '内容',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
) COMMENT = '日報データ (現場巡回)';


-- 日報データ (資材)
CREATE TABLE DailyDataMaterials
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	DailyDataDate date NOT NULL COMMENT '日報作成日',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	Materials varchar(100) COMMENT '資材名',
	Quantity varchar(100) COMMENT '数量',
	Production varchar(100) COMMENT '制作会社',
	Delivery varchar(100) COMMENT '納入業者',
	QualityControl varchar(100) COMMENT '品質管理事項',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
) COMMENT = '日報データ (資材)';


-- 日報データ (協力業者指示)
CREATE TABLE DailyDataSubcontractors
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	DailyDataDate date NOT NULL COMMENT '日報作成日',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	Attendee varchar(100) COMMENT '出席者',
	ContentsText varchar(200) COMMENT '内容',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
) COMMENT = '日報データ (協力業者指示)';


-- 日報データ (車両)
CREATE TABLE DailyDataVehicles
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	DailyDataDate date NOT NULL COMMENT '日報作成日',
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	Model varchar(100) COMMENT '機種',
	Performance varchar(100) COMMENT '性能',
	Owner varchar(100) COMMENT '所有会社',
	Driver varchar(100) COMMENT '当日運転者',
	StartWorkingTime datetime NOT NULL COMMENT '作業時間開始',
	EndWorkingTime datetime NOT NULL COMMENT '作業時間終了',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DailyDataDate, ConstructionCode, SeqNo)
) COMMENT = '日報データ (車両)';


-- 日マスタ
CREATE TABLE DayMaster
(
	days smallint NOT NULL COMMENT '日'
) COMMENT = '日マスタ';


-- 部署経費率マスタ
CREATE TABLE DepartmentExpensesMaster
(
	DepartmentCode decimal(5,0) unsigned NOT NULL COMMENT '部署コード',
	ExpensesPeriod smallint NOT NULL COMMENT '事業期',
	NameCode decimal(5,0) unsigned NOT NULL COMMENT '経費名称コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	ExpensesRaito decimal(4,2) NOT NULL COMMENT '経費率',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (DepartmentCode, ExpensesPeriod, NameCode)
) COMMENT = '部署経費率マスタ';


-- 部署マスタ
CREATE TABLE DepartmentMaster
(
	DepartmentCode decimal(5,0) unsigned NOT NULL COMMENT '部署コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	DepartmentString varchar(100) DEFAULT '' NOT NULL COMMENT '部署名',
	ActionScheduleFlg decimal(1) NOT NULL COMMENT '行動予定表示フラグ',
	StaffAssignFlg decimal(1) NOT NULL COMMENT '人員配置表示フラグ',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (DepartmentCode)
) COMMENT = '部署マスタ';


-- 区分マスタ
CREATE TABLE DivisionMaster
(
	DivisionCode decimal(5,0) unsigned NOT NULL COMMENT '区分コード',
	NameCode decimal(5,0) unsigned NOT NULL COMMENT '名称コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	NameString varchar(100) DEFAULT '' NOT NULL COMMENT '名称',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (DivisionCode, NameCode)
) COMMENT = '区分マスタ';


-- 積算予算書データ
CREATE TABLE EstimateBudget
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ConstructionTime decimal(5,2) unsigned NOT NULL COMMENT '工期',
	IntegratedCode decimal(8) NOT NULL COMMENT '積算者',
	DataCreateDate datetime NOT NULL COMMENT 'データ引込日',
	RetValue1 decimal(12,0) NOT NULL COMMENT '予定価格',
	RetValue2 decimal(12,0) NOT NULL COMMENT '直接工事費',
	RetValue3 decimal(12,0) NOT NULL COMMENT '積み上げ共通仮設費',
	RetValue4 decimal(12,0) NOT NULL COMMENT '積み上げ現場管理費',
	RetPercent decimal(5,2) NOT NULL COMMENT '一般管理費率',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode)
) COMMENT = '積算予算書データ';


-- 積算予算内訳データ明細
CREATE TABLE EstimateBudgetDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	GroupCount decimal(2,0) unsigned NOT NULL COMMENT 'グループ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned COMMENT '工種キー',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	FirstString varchar(120) COMMENT '大項目名称',
	SecondString varchar(120) COMMENT '工種名称・協力会社名',
	Content varchar(120) COMMENT '内容',
	EstimatePrice decimal(12,0) NOT NULL COMMENT '見積時金額',
	NegotiationPrice decimal(12,0) NOT NULL COMMENT '交渉時金額',
	Notes varchar(120) COMMENT '注意事項',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, GroupCount, LineCount)
) COMMENT = '積算予算内訳データ明細';


-- 積算見積データ
CREATE TABLE EstimateData
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	FixedItemCode varchar(1) COMMENT '固定項目キー',
	ItemName varchar(120) COMMENT '作業名称',
	SpecName varchar(120) COMMENT '作業／品質・形状・寸法',
	PriceValue decimal(14,0) NOT NULL COMMENT '金額',
	note varchar(60) COMMENT '備考',
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
	InputFlg decimal(1) NOT NULL COMMENT '入力フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, LineCount)
) COMMENT = '積算見積データ';


-- 積算見積ページデータ
CREATE TABLE EstimateDataBody
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	PageCount decimal(4) unsigned NOT NULL COMMENT 'ページ番号',
	Category decimal(1) NOT NULL COMMENT 'ページ区分',
	UnionComponentCode decimal(5) unsigned NOT NULL COMMENT '所属構成キー',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	SelectComponent decimal(5) unsigned NOT NULL COMMENT '選択構成キー',
	PageTitle varchar(120) NOT NULL COMMENT 'ページ表示名',
	DetailLineCount decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, PageCount)
) COMMENT = '積算見積ページデータ';


-- 積算見積データ明細
CREATE TABLE EstimateDataDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	PageCount decimal(4) unsigned NOT NULL COMMENT 'ページ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	DataType decimal(1) NOT NULL COMMENT 'データ種別',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	SpecCode decimal(5,0) unsigned NOT NULL COMMENT '作業キー',
	ItemName varchar(120) COMMENT '作業名称',
	SpecName varchar(120) COMMENT '作業／品質・形状・寸法',
	Unitcount decimal(8,2) NOT NULL COMMENT '数量',
	UnitName varchar(30) COMMENT '単位名称',
	UnitPrice decimal(9,2) NOT NULL COMMENT '単価',
	LineTotal decimal(12,0) NOT NULL COMMENT '金額',
	note varchar(60) COMMENT '備考',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	MyExpensesFlg decimal(1) NOT NULL COMMENT '自社経費フラグ',
	InputFlg decimal(1) COMMENT '入力フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, PageCount, LineCount)
) COMMENT = '積算見積データ明細';


-- 会社休日マスタ
CREATE TABLE HolidayCalenderMaster
(
	Holiday date NOT NULL COMMENT '休日',
	BusinessYear smallint unsigned NOT NULL COMMENT '営業年度',
	TargetMonth tinyint unsigned NOT NULL COMMENT '該当月',
	TargetDay tinyint unsigned NOT NULL COMMENT '該当日',
	PRIMARY KEY (Holiday)
) COMMENT = '会社休日マスタ';


-- 入力時検索履歴
CREATE TABLE InputSearchLogData
(
	ConstructionCode decimal(10,0) NOT NULL COMMENT '工事コード',
	UsedProcessNo decimal(4,0) NOT NULL COMMENT '使用機能番号',
	DisplayOrder decimal(4) unsigned NOT NULL COMMENT '表示順',
	DataType decimal(1) NOT NULL COMMENT 'データ種別',
	InputCode decimal(10) COMMENT '入力コード',
	PRIMARY KEY (ConstructionCode, UsedProcessNo, DisplayOrder)
) COMMENT = '入力時検索履歴';


-- 掲示板メッセージ
CREATE TABLE MessageBoardData
(
	RecordNumber decimal(6) unsigned NOT NULL COMMENT 'レコード番号',
	BranchNumber decimal(3) unsigned NOT NULL COMMENT 'レコード枝番',
	FromCode decimal(8) unsigned NOT NULL COMMENT '書込み者コード',
	FromName varchar(60) NOT NULL COMMENT '書込み者',
	MessageTitile varchar(100) COMMENT '伝言タイトル',
	MessageContent varchar(1333) NOT NULL COMMENT '伝言内容',
	LinkType decimal(2) NOT NULL COMMENT 'リンク動作タイプ',
	LinkMessage varchar(200) COMMENT 'リンク文字列',
	LinkCode varchar(30) COMMENT 'リンクキー',
	WritingDate datetime NOT NULL COMMENT '書込み日時',
	PersonCode decimal(8,0) NOT NULL COMMENT '書込み担当者コード',
	ShareFlag decimal(2) NOT NULL COMMENT '管理者対象フラグ',
	MessageColor varchar(8) COMMENT '文字色',
	BackColor varchar(8) COMMENT 'バックカラー',
	MessageFlag decimal(1) NOT NULL COMMENT 'メッセージフラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (RecordNumber, BranchNumber)
) COMMENT = '掲示板メッセージ';


-- 掲示板対象者テーブル
CREATE TABLE MessageBoardTerget
(
	RecordNumber decimal(6) unsigned NOT NULL COMMENT 'レコード番号',
	BranchNumber decimal(3) unsigned NOT NULL COMMENT 'レコード枝番',
	SeqNum decimal(3) unsigned NOT NULL COMMENT '順番',
	ToCode decimal(8) NOT NULL COMMENT '対象者コード',
	ToName varchar(60) NOT NULL COMMENT '対象者',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (RecordNumber, BranchNumber, SeqNum)
) COMMENT = '掲示板対象者テーブル';


-- 掲示板メッセージ閲覧履歴
CREATE TABLE MessageBrowsingHistory
(
	RecordNumber decimal(6) unsigned NOT NULL COMMENT 'レコード番号',
	BranchNumber decimal(3) unsigned NOT NULL COMMENT 'レコード枝番',
	SeqNum decimal(3) unsigned NOT NULL COMMENT '順番',
	BrowsingCode decimal(8) NOT NULL COMMENT '閲覧者コード',
	BrowsingDate datetime NOT NULL COMMENT '閲覧日付',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (RecordNumber, BranchNumber, SeqNum)
) COMMENT = '掲示板メッセージ閲覧履歴';


-- 月マスタ
CREATE TABLE MonthMaster
(
	month smallint NOT NULL COMMENT '月'
) COMMENT = '月マスタ';


-- 発注者マスタ
CREATE TABLE OrderersMaster
(
	OrderCotegory decimal(5,0) unsigned NOT NULL COMMENT '発注者区分',
	OrderersCode decimal(5,0) unsigned NOT NULL COMMENT '発注者コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	OrderFlg decimal(1) NOT NULL COMMENT '法人団体・個人フラグ',
	CorporateStatusName varchar(100) COMMENT '法人格名称',
	CorporateStatusPoint decimal(1) COMMENT '法人格名称位置',
	OrderersName1 varchar(60) DEFAULT '' NOT NULL COMMENT '発注者名1',
	OrderersName2 varchar(60) COMMENT '発注者名２',
	DepartmentName varchar(60) COMMENT '部署名',
	ChargePersonName varchar(60) COMMENT '担当者名',
	ZipCode varchar(8) COMMENT '郵便番号',
	Address1 varchar(60) COMMENT '住所１',
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
	Address3 varchar(60) COMMENT '住所3',
	PhoneNumber varchar(13) DEFAULT '' COMMENT '電話番号',
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
	MailAddress varchar(257) COMMENT 'メールアドレス',
	Note varchar(300) DEFAULT '' COMMENT '備考',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (OrderCotegory, OrderersCode)
) COMMENT = '発注者マスタ';


-- 受注金額データ
CREATE TABLE OrdersPriceData
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ChangeNo decimal(3) unsigned NOT NULL COMMENT '変更番号',
	ChangeDate date NOT NULL COMMENT '変更日',
	ChangePersonCode decimal(8) unsigned NOT NULL COMMENT '変更者コード',
	ChangePersonName varchar(60) COMMENT '変更者名',
	BeforeValue decimal(14,0) NOT NULL COMMENT '変更前税抜受注金額',
	BeforeValueInTax decimal(14,0) NOT NULL COMMENT '変更前税込受注金額',
	AfterValue decimal(14,0) NOT NULL COMMENT '変更後税抜受注金額',
	AfterValueInTax decimal(14,0) NOT NULL COMMENT '変更後税込受注金額',
	ChangeComment varchar(200) COMMENT '変更理由',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ChangeNo)
) COMMENT = '受注金額データ';


-- 担当者承認データ
CREATE TABLE PersonApproval
(
	PersonCode decimal(8) unsigned NOT NULL COMMENT '担当者コード',
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
	OrderDate date NOT NULL COMMENT '受付日',
	OrderNo decimal(2,0) unsigned NOT NULL COMMENT '受付番号',
	SeqNo decimal(2) NOT NULL COMMENT '枝番',
	PersonCodeApproval decimal(8) unsigned NOT NULL COMMENT '申請・承認者コード',
	PetitionApprovalDate datetime NOT NULL COMMENT '申請・承認日付',
	ApprovalLimitDates datetime NOT NULL COMMENT '承認希望日',
	ApprovalStatus decimal(1) NOT NULL COMMENT '承認状態',
	InputComment varchar(300) COMMENT 'コメント',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, ApprovalCode, OrderDate, OrderNo, SeqNo)
) COMMENT = '担当者承認データ';


-- 担当者承認コメントデータ
CREATE TABLE PersonApprovalComment
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
	OrderDate date NOT NULL COMMENT '受付日',
	OrderNo decimal(2,0) unsigned NOT NULL COMMENT '受付番号',
	CommentNo decimal(2) NOT NULL COMMENT 'コメント番号',
	ParentNo decimal(2) NOT NULL COMMENT '親コメント番号',
	ApproValComment varchar(300) COMMENT '指示・連絡コメント',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, ApprovalCode, OrderDate, OrderNo, CommentNo)
) COMMENT = '担当者承認コメントデータ';


-- 担当者対象部署マスタ
CREATE TABLE PersonDepartmentMaster
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	DepartmentCode decimal(5,0) unsigned NOT NULL COMMENT '部署コード',
	AffiliationFlg decimal(1) NOT NULL COMMENT '所属フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, DepartmentCode)
) COMMENT = '担当者対象部署マスタ';


-- 担当者マスタ
CREATE TABLE PersonInChargeMaster
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	DisplayOrder decimal(8) unsigned NOT NULL COMMENT '表示順',
	PersonName varchar(60) DEFAULT '' NOT NULL COMMENT '担当者名',
	StartDate date NOT NULL COMMENT '使用開始年月日',
	EndDate date COMMENT '使用終了年月日',
	PassWord varchar(16) COMMENT 'パスワード',
	SecurityManagement decimal(1) NOT NULL COMMENT '機密区分',
	SecCode decimal(2,0) unsigned NOT NULL COMMENT '保護区分番号',
	MsgBackColor varchar(8) COMMENT 'メッセージ背景色',
	DisplayString varchar(20) COMMENT '表示・印刷名称',
	DepartmentCode decimal(5,0) unsigned COMMENT '部署コード',
	MonthlySalary decimal(11,0) NOT NULL COMMENT '月給金額',
	YearSalary decimal(12,0) NOT NULL COMMENT '年俸金額',
	Qualification varchar(120) COMMENT '資格入力欄',
	SealPrintName varchar(5) COMMENT '印鑑表示名',
	EmployeeClassFlg decimal(1) NOT NULL COMMENT '社員区分',
	LedgerFlg decimal(1) NOT NULL COMMENT '台帳計算対象フラグ',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode)
) COMMENT = '担当者マスタ';


-- 担当者給与マスタ
CREATE TABLE PersonSalaryMaster
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	StartDate date NOT NULL COMMENT '使用開始年月日',
	MonthlySalary decimal(11,0) NOT NULL COMMENT '月給金額',
	YearSalary decimal(12,0) NOT NULL COMMENT '年俸金額',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, StartDate)
) COMMENT = '担当者給与マスタ';


-- 発注者打ち合わせ議事録データ
CREATE TABLE ProceedingsData
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ProceedingsDataDate date NOT NULL COMMENT '議事録作成日',
	StartMeetingTime decimal(4) unsigned NOT NULL COMMENT '会議時間開始',
	EndMeetingTime decimal(4) unsigned NOT NULL COMMENT '会議時間終了',
	CreatorCode decimal(8,0) NOT NULL COMMENT '作成者コード',
	PalceFlag decimal(1) NOT NULL COMMENT '現地フラグ',
	MeetingPalce varchar(120) COMMENT '打合せ場所',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ProceedingsDataDate, StartMeetingTime)
) COMMENT = '発注者打ち合わせ議事録データ';


-- 発注者打ち合わせ議事録データ（出席者）
CREATE TABLE ProceedingsDataAttend
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ProceedingsDataDate date NOT NULL COMMENT '議事録作成日',
	StartMeetingTime decimal(4) unsigned NOT NULL COMMENT '会議時間開始',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	Department varchar(20) COMMENT '出席者所属',
	AttendName varchar(10) COMMENT '出席者氏名',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ProceedingsDataDate, StartMeetingTime, SeqNo)
) COMMENT = '発注者打ち合わせ議事録データ（出席者）';


-- 発注者打ち合わせ議事録データ（明細）
CREATE TABLE ProceedingsDataDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ProceedingsDataDate date NOT NULL COMMENT '議事録作成日',
	StartMeetingTime decimal(4) unsigned NOT NULL COMMENT '会議時間開始',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '明細行番号',
	TitleNo varchar(5) COMMENT '議題番号',
	Title varchar(20) COMMENT '議題',
	ContentsText varchar(50) COMMENT '内容',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ProceedingsDataDate, StartMeetingTime, SeqNo)
) COMMENT = '発注者打ち合わせ議事録データ（明細）';


-- 承認データ
CREATE TABLE ProcessApproval
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
	OrderNo decimal(2,0) unsigned NOT NULL COMMENT '受付番号',
	SeqNo decimal(2) NOT NULL COMMENT '枝番',
	PersonCode decimal(8) unsigned NOT NULL COMMENT '申請・承認者コード',
	PetitionApprovalDate datetime NOT NULL COMMENT '申請・承認日付',
	ApprovalLimitDates datetime NOT NULL COMMENT '承認希望日',
	ApprovalStatus decimal(1) NOT NULL COMMENT '承認状態',
	InputComment varchar(300) COMMENT 'コメント',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ApprovalCode, OrderNo, SeqNo)
) COMMENT = '承認データ';


-- 承認コメントデータ
CREATE TABLE ProcessApprovalComment
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
	OrderNo decimal(2,0) unsigned NOT NULL COMMENT '受付番号',
	CommentNo decimal(2) NOT NULL COMMENT 'コメント番号',
	ParentNo decimal(2) NOT NULL COMMENT '親コメント番号',
	ApproValComment varchar(300) COMMENT '指示・連絡コメント',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ApprovalCode, OrderNo, CommentNo)
) COMMENT = '承認コメントデータ';


-- 承認明細データ
CREATE TABLE ProcessApprovalDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	ApprovalCode decimal(3,0) unsigned NOT NULL COMMENT '承認機能番号',
	OrderNo decimal(2,0) unsigned NOT NULL COMMENT '受付番号',
	SerialNo decimal(2) unsigned NOT NULL COMMENT '枝番',
	LinkCode decimal(10) NOT NULL COMMENT 'リンク情報',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, ApprovalCode, OrderNo, SerialNo)
) COMMENT = '承認明細データ';


-- 起動対象マスタ
CREATE TABLE ProcessExcuteMaster
(
	SecCode decimal(2,0) unsigned NOT NULL COMMENT '保護区分番号',
	ExecCode decimal(4,0) unsigned NOT NULL COMMENT '起動処理番号',
	EditFlg decimal(1) NOT NULL COMMENT '編集フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SecCode, ExecCode)
) COMMENT = '起動対象マスタ';


-- 注文書データ
CREATE TABLE PurchaseOrder
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '注文書枝番',
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	CreateDate date COMMENT '作成日付',
	OrderPrice decimal(12,0) NOT NULL COMMENT '発注金額',
	LastRowStringDate date NOT NULL COMMENT '最終行表示日付',
	OrderSheetType decimal(1) NOT NULL COMMENT '簡易・本式フラグ',
	PaymentTerms decimal(1) NOT NULL COMMENT '支払い条件',
	CashRatio decimal(4,1) NOT NULL COMMENT '現金割合（％）',
	BillPeriod decimal(4) NOT NULL COMMENT '手形期間',
	PrePayments decimal(1) NOT NULL COMMENT '前金払',
	PrePaymentsDays decimal(3,0) NOT NULL COMMENT '前金払日数',
	PrePaymentsPrice decimal(12,0) NOT NULL COMMENT '前金払金額',
	PartialPayment decimal(1) NOT NULL COMMENT '部分払',
	PartialPaymentMounth decimal(2) unsigned NOT NULL COMMENT '部分払締切月',
	PartialPaymentDay1 decimal(2) unsigned NOT NULL COMMENT '部分払締切日',
	PartialPaymentDay2 decimal(2) unsigned NOT NULL COMMENT '部分払支払日',
	PartialPaymentPrice decimal(12,0) NOT NULL COMMENT '部分払金額',
	CompletionPayment decimal(1) NOT NULL COMMENT '引渡し時の支払',
	CompletionPaymentDays decimal(3) unsigned NOT NULL COMMENT '引渡し時の支払日数',
	CompletionPaymentPrice decimal(12,0) NOT NULL COMMENT '引渡し時の支払金額',
	LeadEngineerCode decimal(8,0) COMMENT '主任技術者コード',
	LeadEngineerName varchar(60) COMMENT 'LeadEngineerName',
	SafetyOfficerCode decimal(8) COMMENT '安全管理者コード',
	SafetyOfficerName varchar(60) COMMENT '安全管理者名',
	WorkersCount decimal(3) unsigned COMMENT '作業員数',
	PrintoutDate date NOT NULL COMMENT '印刷年月日',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, SeqNo)
) COMMENT = '注文書データ';


-- 注文書明細データ
CREATE TABLE PurchaseOrderDetail
(
	ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '工事コード',
	SeqNo decimal(3) unsigned NOT NULL COMMENT '注文書枝番',
	GroupCount decimal(1) NOT NULL COMMENT 'グループ番号',
	LineCount decimal(3) unsigned NOT NULL COMMENT '行番号',
	ComponentCode decimal(5,0) unsigned NOT NULL COMMENT '構成キー',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	FirstString varchar(120) COMMENT '工種・品名',
	SecondString varchar(120) COMMENT '内容内訳',
	UnitCount decimal(8,2) NOT NULL COMMENT '数量',
	UnitName varchar(30) COMMENT '単位',
	UnitPrice decimal(10,0) NOT NULL COMMENT '単価',
	OrdersLinePrice decimal(12,0) COMMENT '金額',
	SourceCode decimal(10) unsigned NOT NULL COMMENT '予算作成時工事番号',
	SourceLineCnt decimal(3) unsigned NOT NULL COMMENT '注文書作成時台帳行番号',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionCode, SeqNo, GroupCount, LineCount)
) COMMENT = '注文書明細データ';


-- 売上グラフデータ
CREATE TABLE SalesGraphData
(
	GraphDataCode decimal(8) NOT NULL COMMENT 'グラフデータコード',
	ConstructionPeriod decimal(4) unsigned NOT NULL COMMENT '事業期',
	SalesDataDays date NOT NULL COMMENT '売上年月',
	DisplayOrder decimal(8) unsigned NOT NULL COMMENT '表示順',
	DataName varchar(100) NOT NULL COMMENT 'データ表示名称',
	SalesAmount decimal(10,0) NOT NULL COMMENT '売上データ',
	AdministrativeExpense decimal(10,0) NOT NULL COMMENT '販管・部署経費',
	GrossProfit decimal(10,0) NOT NULL COMMENT '粗利益',
	NetIncome decimal(10,0) NOT NULL COMMENT '純利益(損益)',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (GraphDataCode, ConstructionPeriod, SalesDataDays)
) COMMENT = '売上グラフデータ';


-- 保護区分マスタ
CREATE TABLE SecurityMaster
(
	SecCode decimal(2,0) unsigned NOT NULL COMMENT '保護区分番号',
	DisplayOrder decimal(2) NOT NULL COMMENT '表示順',
	SecName varchar(60) NOT NULL COMMENT '保護区分名称',
	SecRank decimal(1) NOT NULL COMMENT '保護区分ランク',
	SecRange decimal(1) NOT NULL COMMENT '保護区分範囲',
	GeneralAffairs decimal(1) NOT NULL COMMENT '総務業務フラグ',
	SelectBackColor varchar(8) NOT NULL COMMENT '選択背景色',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SecCode)
) COMMENT = '保護区分マスタ';


-- 協力業者施工工種登録申請データ
CREATE TABLE SubConstrJobItemRegist
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '申請者番号',
	CreateDate date NOT NULL COMMENT '作成日',
	SeqNo decimal(2) unsigned NOT NULL COMMENT '申請連番',
	DisplayOrder decimal(8) unsigned NOT NULL COMMENT '表示順',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, CreateDate, SeqNo, DisplayOrder)
) COMMENT = '協力業者施工工種登録申請データ';


-- 協力業者職種リンク登録申請データ
CREATE TABLE SubConstrJobLinkRegist
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '申請者番号',
	CreateDate date NOT NULL COMMENT '作成日',
	SeqNo decimal(2) unsigned NOT NULL COMMENT '申請連番',
	DisplayOrder decimal(8) unsigned NOT NULL COMMENT '表示順',
	JobCategoryCode decimal(5,0) NOT NULL COMMENT '職種キー',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, CreateDate, SeqNo, DisplayOrder)
) COMMENT = '協力業者職種リンク登録申請データ';


-- 協力業者登録申請データ
CREATE TABLE SubConstrRegist
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '申請者番号',
	CreateDate date NOT NULL COMMENT '作成日',
	SeqNo decimal(2) unsigned NOT NULL COMMENT '申請連番',
	DataMode decimal(1) COMMENT 'データ区分',
	SourceCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	PetitionPeriod decimal(4) unsigned NOT NULL COMMENT '申請年度',
	CorporateStatusName varchar(40) DEFAULT '' COMMENT '法人格名称',
	CorporateStatusPoint decimal(1) NOT NULL COMMENT '法人格名称位置',
	CompanyName varchar(100) DEFAULT '' NOT NULL COMMENT '協力会社名',
	CEOPositionName varchar(60) DEFAULT '' COMMENT '代表者役職名',
	CEOName varchar(60) DEFAULT '' COMMENT '代表者氏名',
	ContactPersonName varchar(60) COMMENT '担当者氏名',
	ZipCode varchar(8) COMMENT '郵便番号',
	Address1 varchar(60) COMMENT '住所１',
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
	Address3 varchar(60) COMMENT '住所3',
	CellPhoneNumber varchar(13) COMMENT '携帯電話番号',
	MailAddress varchar(257) COMMENT 'メールアドレス',
	PhoneNumber varchar(13) DEFAULT '' COMMENT '電話番号',
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
	JapaneseSyllabary varchar(2) COMMENT '50音読み',
	StartDate date NOT NULL COMMENT '取引開始年月日',
	Note varchar(300) DEFAULT '' COMMENT '備考',
	labourKind decimal(1) NOT NULL COMMENT '支払い通常・手間区分',
	OrderDate date COMMENT '申請日',
	OrderNo decimal(2) unsigned NOT NULL COMMENT '申請受付番号',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, CreateDate, SeqNo)
) COMMENT = '協力業者登録申請データ';


-- 協力会社工種マスタ
CREATE TABLE SubContractorItemMaster
(
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	ItemName varchar(120) DEFAULT '' NOT NULL COMMENT '工種名称',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ItemCode)
) COMMENT = '協力会社工種マスタ';


-- 協力会社職種マスタ
CREATE TABLE SubContractorJobCategory
(
	JobCategoryCode decimal(5,0) NOT NULL COMMENT '職種キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	JobCategoryName varchar(120) DEFAULT '' NOT NULL COMMENT '職種名称',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (JobCategoryCode)
) COMMENT = '協力会社職種マスタ';


-- 協力会社施工工種データ
CREATE TABLE SubContractorJobItem
(
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	ItemCode decimal(5,0) unsigned NOT NULL COMMENT '工種キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (CompanyCode, ItemCode)
) COMMENT = '協力会社施工工種データ';


-- 協力会社職種リンクマスタ
CREATE TABLE SubContractorJobLink
(
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	JobCategoryCode decimal(5,0) NOT NULL COMMENT '職種キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (CompanyCode, JobCategoryCode)
) COMMENT = '協力会社職種リンクマスタ';


-- 協力会社マスタ
CREATE TABLE SubContractorMaster
(
	CompanyCode decimal(8,0) NOT NULL COMMENT '協力会社コード',
	DisplayOrder decimal(8) unsigned NOT NULL COMMENT '表示順',
	CorporateStatusName varchar(40) DEFAULT '' COMMENT '法人格名称',
	CorporateStatusPoint decimal(1) NOT NULL COMMENT '法人格名称位置',
	CompanyName varchar(100) DEFAULT '' NOT NULL COMMENT '協力会社名',
	CEOPositionName varchar(60) DEFAULT '' COMMENT '代表者役職名',
	CEOName varchar(60) DEFAULT '' COMMENT '代表者氏名',
	ContactPersonName varchar(60) COMMENT '担当者氏名',
	ZipCode varchar(8) COMMENT '郵便番号',
	Address1 varchar(60) COMMENT '住所１',
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
	Address3 varchar(60) COMMENT '住所3',
	CellPhoneNumber varchar(13) COMMENT '携帯電話番号',
	MailAddress varchar(257) COMMENT 'メールアドレス',
	PhoneNumber varchar(13) DEFAULT '' COMMENT '電話番号',
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
	JapaneseSyllabary varchar(2) COMMENT '50音読み',
	StartDate date NOT NULL COMMENT '取引開始年月日',
	Note varchar(300) DEFAULT '' COMMENT '備考',
	labourKind decimal(1) NOT NULL COMMENT '支払い通常・手間区分',
	DeleteFlg decimal(1) DEFAULT 0 NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (CompanyCode)
) COMMENT = '協力会社マスタ';


-- 仕入先マスタ
CREATE TABLE SuppliersMaster
(
	SuppliersCode decimal(5,0) unsigned NOT NULL COMMENT '仕入先コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	SuppliersName1 varchar(60) DEFAULT '' NOT NULL COMMENT '仕入先名1',
	SuppliersName2 varchar(60) COMMENT '仕入先名２',
	ZipCode varchar(8) COMMENT '郵便番号',
	Address1 varchar(60) COMMENT '住所１',
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
	Address3 varchar(60) COMMENT '住所3',
	PhoneNumber varchar(13) DEFAULT '' COMMENT '電話番号',
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
	Note varchar(300) DEFAULT '' COMMENT '備考',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SuppliersCode)
) COMMENT = '仕入先マスタ';


-- システム起動確認データ
CREATE TABLE SystemExecute
(
	PrimaryCode tinyint NOT NULL COMMENT 'キー項目',
	TargetDate date NOT NULL COMMENT '起動日付',
	SystemVersion int NOT NULL COMMENT '本体・環境バージョン',
	UpDateCopyVersion int NOT NULL COMMENT 'コピーバージョン',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PrimaryCode)
) COMMENT = 'システム起動確認データ';


-- 管理マスタ
CREATE TABLE SystemMaster
(
	SystemCode decimal(3,0) unsigned NOT NULL COMMENT '会社コード',
	CompanyName1 varchar(60) DEFAULT '' NOT NULL COMMENT '会社名１',
	CompanyName2 varchar(60) DEFAULT '' COMMENT '会社名２',
	CEOName varchar(60) DEFAULT '' NOT NULL COMMENT '代表者氏名',
	CEOPositionName varchar(60) DEFAULT '' COMMENT '代表者役職名',
	ZipCode varchar(8) NOT NULL COMMENT '郵便番号',
	Address1 varchar(60) NOT NULL COMMENT '住所１',
	Address2 varchar(60) DEFAULT '' COMMENT '住所2',
	Address3 varchar(60) COMMENT '住所3',
	PhoneNumber varchar(13) DEFAULT '' NOT NULL COMMENT '電話番号',
	FaxNumber varchar(13) DEFAULT '' COMMENT 'FAX番号',
	ConstructionExpenses decimal(4,2) NOT NULL COMMENT '工事部経費',
	OfficeExpenses decimal(4,2) NOT NULL COMMENT '事務所経費',
	OperatingExpenses decimal(4,2) NOT NULL COMMENT '営業経費',
	ConsumptionTax decimal(4,2) NOT NULL COMMENT '消費税',
	CooperationRate decimal(4,2) NOT NULL COMMENT '協力金比率',
	ExcelSavePath varchar(120) COMMENT 'Excel保存パス',
	BusinessPeriod smallint NOT NULL COMMENT '現在営業期数',
	ConstructionYear smallint NOT NULL COMMENT '現在工事年度',
	BusinessBeginningDate varchar(5) NOT NULL COMMENT '営業期期首日',
	ConstructionBeginningDate varchar(5) NOT NULL COMMENT '工事年度期首日',
	ConstructionNoBase decimal(1) NOT NULL COMMENT '工事番号基準値',
	SloganString1 varchar(100) COMMENT '標語1',
	SloganString2 varchar(100) COMMENT '標語2',
	SloganString3 varchar(100) COMMENT '標語3',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (SystemCode)
) COMMENT = '管理マスタ';


-- 期限マスタ
CREATE TABLE TermMaster
(
	ConstructionStatusFlg decimal(2,0) NOT NULL COMMENT '工事状態フラグ',
	FieldNo decimal(2) NOT NULL COMMENT 'チェック対象フィールド番号',
	SeqNo decimal(2) NOT NULL COMMENT '枝番',
	DisplayOrder decimal(2) NOT NULL COMMENT '表示順',
	CheckSchdule decimal(1) NOT NULL COMMENT 'チェックタイミング',
	TermDays decimal(3) NOT NULL COMMENT '経過日',
	SendTitile varchar(100) COMMENT 'タイトル',
	SendMessage varchar(100) COMMENT 'メッセージ',
	BackColor varchar(8) COMMENT '背景色',
	ForeColor varchar(8) COMMENT '文字色',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (ConstructionStatusFlg, FieldNo, SeqNo)
) COMMENT = '期限マスタ';


-- 出勤交通費データ
CREATE TABLE TranceportDailyData
(
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '作成者コード',
	AttendanceDate date NOT NULL COMMENT '日報作成日',
	StartDistance decimal(7,1) NOT NULL COMMENT '当日出発キロ数',
	ComplateDistance decimal(7,1) NOT NULL COMMENT '当日終了キロ数',
	TotalDistance decimal(6,1) NOT NULL COMMENT '当日合計キロ数',
	OfficeGoFlg decimal(1) NOT NULL COMMENT '事務所出勤フラグ',
	OfficeOutFlg decimal(1) NOT NULL COMMENT '事務所帰宅フラグ',
	TrancePayGoFlg decimal(1) NOT NULL COMMENT '有料通勤出勤フラグ',
	TrancePayOutFlg decimal(1) NOT NULL COMMENT '有料通勤帰宅フラグ',
	WareHouseFlg decimal(1) NOT NULL COMMENT '資材置場フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (PersonCode, AttendanceDate)
) COMMENT = '出勤交通費データ';


-- 工事種別経費率マスタ
CREATE TABLE TypeExpensesMaster
(
	TypeCode decimal(5,0) unsigned NOT NULL COMMENT '工事種別コード',
	ExpensesPeriod smallint NOT NULL COMMENT '事業期',
	NameCode decimal(5,0) unsigned NOT NULL COMMENT '経費名称コード',
	ExpensesRaito decimal(4,2) NOT NULL COMMENT '経費率',
	DeleteFlg decimal(1) NOT NULL COMMENT '削除フラグ',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (TypeCode, ExpensesPeriod, NameCode)
) COMMENT = '工事種別経費率マスタ';


-- 単位マスタ
CREATE TABLE UnitMaster
(
	UnitKey decimal(5,0) unsigned NOT NULL COMMENT '単位キー',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	UnitName varchar(30) NOT NULL COMMENT '単位名称',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (UnitKey)
) COMMENT = '単位マスタ';


-- 車両マスタ
CREATE TABLE VehicleMaster
(
	VehicleCode decimal(5,0) unsigned NOT NULL COMMENT '車両コード',
	DisplayOrder decimal(5) unsigned NOT NULL COMMENT '表示順',
	VehicleName varchar(100) NOT NULL COMMENT '車両名称',
	RegistrationNumber varchar(30) COMMENT '登録番号',
	IdentificationNumber varchar(30) COMMENT '車体番号',
	ModelCode varchar(30) COMMENT '型式',
	DepartmentCode decimal(5) unsigned NOT NULL COMMENT '管理部署',
	VehicleScheduleFlg decimal(1) NOT NULL COMMENT '車両予約表示フラグ',
	PurchaseDate date COMMENT '購入日',
	PurchaseName varchar(30) COMMENT '購入先',
	PurchaseContactPersons varchar(30) COMMENT '購入先担当者',
	PurchasePhone varchar(13) COMMENT '購入先電話番号',
	LeaseDate date COMMENT 'リース開始日',
	LeaseDestination varchar(30) COMMENT 'リース先',
	LeaseContactPersons varchar(30) COMMENT 'リース先担当者',
	LeasePhone varchar(13) COMMENT 'リース先電話番号',
	InsuranceCompany varchar(30) COMMENT '任意保険会社',
	InsuranceContactPersons varchar(30) COMMENT '任意保険会社担当者',
	InsurancePhone varchar(13) COMMENT '任意保険会社電話番号',
	Note varchar(300) COMMENT '備考',
	EntryDate datetime COMMENT '登録日付',
	UpdateDate datetime COMMENT '更新日付',
	PRIMARY KEY (VehicleCode)
) COMMENT = '車両マスタ';


-- 車両記録データ
CREATE TABLE VehicleRecordData
(
	VehicleCode decimal(5,0) unsigned NOT NULL COMMENT '車両コード',
	DivisionCode decimal(2,0) unsigned NOT NULL COMMENT 'データ区分',
	SeqNo decimal(2) NOT NULL COMMENT '枝番',
	RecordDate date COMMENT '実地日',
	Mileage mediumint COMMENT '走行距離',
	Content varchar(100) COMMENT '内容',
	PaymentCost decimal(10,0) COMMENT '費用',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (VehicleCode, DivisionCode, SeqNo)
) COMMENT = '車両記録データ';


-- 車両予約データ
CREATE TABLE VehicleScheduleData
(
	TargetDate date NOT NULL COMMENT '対象日',
	VehicleCode decimal(5,0) unsigned NOT NULL COMMENT '車両コード',
	MorningAfternoon decimal(1) NOT NULL COMMENT '午前・午後',
	PersonCode decimal(8,0) unsigned NOT NULL COMMENT '担当者コード',
	TargetYear year(4) NOT NULL COMMENT '該当年',
	TargetMonth tinyint unsigned NOT NULL COMMENT '該当月',
	TargetDay year(2) NOT NULL COMMENT '該当日',
	EntryDate datetime NOT NULL COMMENT '登録日付',
	UpdateDate datetime NOT NULL COMMENT '更新日付',
	PRIMARY KEY (TargetDate, VehicleCode, MorningAfternoon)
) COMMENT = '車両予約データ';


-- 年マスタ
CREATE TABLE YearMaster
(
	years smallint NOT NULL COMMENT '年'
) COMMENT = '年マスタ';



/* Create Indexes */

CREATE INDEX ActionScheduleData_Index1 ON ActionScheduleData (TargetYear ASC);
CREATE INDEX ActionScheduleData_Index2 ON ActionScheduleData (TargetMonth ASC);
CREATE INDEX ActionScheduleData_Index3 ON ActionScheduleData (TargetDay ASC);
CREATE INDEX AttendDaily_Index1 ON AttendanceDailyData (ActionResult ASC);
CREATE INDEX AttendDaily_Index2 ON AttendanceDailyData (AttendanceDate ASC);
CREATE INDEX BusinessTypeMaster_Index1 ON BusinessTypeMaster (DisplayOrder ASC);
CREATE INDEX ComponentLinkMaster_Index1 ON ComponentLinkMaster (ComponentCode ASC);
CREATE INDEX ComponentLinkMaster_Index2 ON ComponentLinkMaster (ItemCode ASC);
CREATE INDEX ComponentMaster_Index1 ON ComponentMaster (DisplayOrder ASC);
CREATE INDEX ComponentToTypeMaster_Index1 ON ComponentToTypeMaster (ComponentCode ASC);
CREATE INDEX ComponentToTypeMaster_Index2 ON ComponentToTypeMaster (TypeCode ASC);
CREATE INDEX BaseInfo_Index1 ON ConstructionBaseInfo (ConstructionStatusFlg ASC);
CREATE INDEX BaseInfo_Index2 ON ConstructionBaseInfo (EstimateType ASC);
CREATE INDEX BaseInfo_Index3 ON ConstructionBaseInfo (SalesPersonCode ASC);
CREATE INDEX BaseInfo_Index4 ON ConstructionBaseInfo (ConstructionPersonCode ASC);
CREATE INDEX BaseInfo_Index5 ON ConstructionBaseInfo (ConstructionInstructor ASC);
CREATE INDEX BaseInfoDetail_Idx1 ON ConstructionBaseInfoDetail (ConstructionCode ASC);
CREATE INDEX BaseInfoDetail_Idx2 ON ConstructionBaseInfoDetail (DetailNo ASC);
CREATE INDEX LedgerDetail_Index01 ON ConstructionLedgerDetail (ConstructionCode ASC);
CREATE INDEX LedgerDetail_Index02 ON ConstructionLedgerDetail (GroupCount ASC);
CREATE INDEX LedgerDetail_Index03 ON ConstructionLedgerDetail (SourceCode ASC);
CREATE INDEX LedgerExcute_Index1 ON ConstructionLedgerExcute (ConstructionCode ASC, TargetMonth ASC, GroupCount ASC, LineCount ASC);
CREATE INDEX ConstructionLink_Index1 ON ConstructionLink (ConstructionCode ASC);
CREATE INDEX ConstructionLink_Index2 ON ConstructionLink (FluctuationCode ASC);
CREATE INDEX ConstructionLink_Index3 ON ConstructionLink (LinkType ASC);
CREATE INDEX ConstructionSpecMaster_Index1 ON ConstructionSpecMaster (DisplayOrder ASC);
CREATE INDEX CostDataOfPerson_Index1 ON CostDataOfPerson (TargetMonth ASC);
CREATE INDEX CostDataOfPerson_Index2 ON CostDataOfPerson (ConstructionCode ASC);
CREATE INDEX CostomerRegist_Index1 ON CostomerRegist (PetitionPeriod ASC);
CREATE INDEX DailyDataConstruction_Index1 ON DailyDataConstruction (PersonCode ASC);
CREATE INDEX DailyDataConstruction_Index2 ON DailyDataConstruction (DailyDataDate ASC);
CREATE INDEX DailyDataConstruction_Index3 ON DailyDataConstruction (ConstructionCode ASC);
CREATE INDEX DailyDataDetail_Index ON DailyDataDetail (PersonCode ASC, DailyDataDate ASC, ConstructionCode ASC);
CREATE INDEX DailyDataField_Index ON DailyDataField (PersonCode ASC, DailyDataDate ASC, ConstructionCode ASC);
CREATE INDEX DailyDataMaterials_Index ON DailyDataMaterials (PersonCode ASC, DailyDataDate ASC, ConstructionCode ASC);
CREATE INDEX DailyDataSubcontractors_Index ON DailyDataSubcontractors (PersonCode ASC, DailyDataDate ASC, ConstructionCode ASC);
CREATE INDEX DailyDataVehicles_Index ON DailyDataVehicles (PersonCode ASC, DailyDataDate ASC, ConstructionCode ASC);
CREATE INDEX DepartmentMaster_index1 ON DepartmentMaster (DisplayOrder ASC);
CREATE INDEX EstimateData_Index1 ON EstimateData (ConstructionCode ASC, FixedItemCode ASC);
CREATE INDEX EstimateDataBody_Index1 ON EstimateDataBody (ConstructionCode ASC, ComponentCode ASC, ItemCode ASC);
CREATE INDEX EstimateDataDetail_Index1 ON EstimateDataDetail (ConstructionCode ASC, PageCount ASC);
CREATE INDEX HolidayCalender_Index1 ON HolidayCalenderMaster (BusinessYear ASC);
CREATE INDEX HolidayCalenderMaster_Index2 ON HolidayCalenderMaster (TargetMonth ASC);
CREATE INDEX HolidayCalenderMaster_Index3 ON HolidayCalenderMaster (TargetDay ASC);
CREATE INDEX InputSearchLogData_Index1 ON InputSearchLogData (ConstructionCode ASC, UsedProcessNo ASC, InputCode ASC);
CREATE INDEX MessageBoardData_Index1 ON MessageBoardData (WritingDate ASC);
CREATE INDEX MessageBoardData_Index2 ON MessageBoardData (MessageFlag ASC);
CREATE INDEX MessageBoardTerget_Index1 ON MessageBoardTerget (RecordNumber ASC, BranchNumber ASC);
CREATE INDEX PersonDepartmentMaster_Index1 ON PersonDepartmentMaster (PersonCode ASC);
CREATE INDEX PersonDepartmentMaster_Index2 ON PersonDepartmentMaster (DepartmentCode ASC);
CREATE INDEX PersonInChargeMaster_Index1 ON PersonInChargeMaster (StartDate ASC);
CREATE INDEX PersonInChargeMaster_Index2 ON PersonInChargeMaster (DepartmentCode ASC);
CREATE INDEX PersonSalaryMaster_Index1 ON PersonSalaryMaster (PersonCode ASC);
CREATE INDEX PersonSalaryMaster_Index2 ON PersonSalaryMaster (StartDate ASC);
CREATE INDEX ProcessExcuteMaster_Index1 ON ProcessExcuteMaster (SecCode ASC);
CREATE INDEX ProcessExcuteMaster_Index2 ON ProcessExcuteMaster (ExecCode ASC);
CREATE INDEX POrderDetail_Index1 ON PurchaseOrderDetail (SourceCode ASC);
CREATE INDEX SalesGraphData_Idx1 ON SalesGraphData (DisplayOrder ASC);
CREATE INDEX SalesGraphData_idx2 ON SalesGraphData (ConstructionPeriod ASC);
CREATE INDEX SecurityMaster_Index1 ON SecurityMaster (DisplayOrder ASC);
CREATE INDEX SecurityMaster_Index2 ON SecurityMaster (SecRank ASC);
CREATE INDEX SecurityMaster_Index3 ON SecurityMaster (SecRange ASC);
CREATE INDEX SubContractorJobItem_Index1 ON SubContractorJobItem (CompanyCode ASC);
CREATE INDEX SubContractorJobItem_Index2 ON SubContractorJobItem (ItemCode ASC);
CREATE INDEX SubContractorJobLink_Index1 ON SubContractorJobLink (CompanyCode ASC);
CREATE INDEX SubContractorJobLink_Index2 ON SubContractorJobLink (JobCategoryCode ASC);
CREATE INDEX SubContractorMaster_Index1 ON SubContractorMaster (JapaneseSyllabary ASC);
CREATE INDEX TermMaster_Index1 ON TermMaster (DisplayOrder ASC);
CREATE INDEX TranceportDailyData_Index1 ON TranceportDailyData (AttendanceDate ASC);
CREATE INDEX UnitMaster_Index1 ON UnitMaster (DisplayOrder ASC);
CREATE INDEX VehicleScheduleData_Index1 ON VehicleScheduleData (TargetYear ASC);
CREATE INDEX VehicleScheduleData_Index2 ON VehicleScheduleData (TargetMonth ASC);
CREATE INDEX VehicleScheduleData_Index3 ON VehicleScheduleData (TargetDay ASC);


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

create table depositdata (
  ORDERERSDIVISION decimal(5,0) not null comment '発注者区分'
  , ORDERERSCODE decimal(5,0) not null comment '発注者コード'
  , TARGETDATE decimal(6,0) not null comment '対象年月'
  , SEQNO decimal(3,0) not null comment '連番'
  , BusinessPeriod decimal(4,0) comment '営業期'
  , DEPOSITDATE date comment '入金日'
  , DepositAmount decimal(12,0) comment '入金金額'
  , DEPOSITAMOUNTCASH decimal(10,0) comment '入金金額（現金）'
  , DEPOSITAMOUNTBILL decimal(10,0) comment '入金金額（手形）'
  , ENTRYDATE datetime comment '登録日付'
  , UPDATEDATE datetime comment '更新日付'
  , constraint depositdata_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO)
) comment '入金データ' ;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

create table requestdata (
  REQUESTNO decimal(9,0) not null comment '請求No'
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '本工事番号'
  , CONSTRUCTIONNAME varchar(120) not null comment '工事件名'
  , CONTRACTAMOUNT decimal(10,0) not null comment '請負金額'
  , PAIDAMOUNT decimal(10,0) not null comment '請求済金額'
  , REQUESTAMOUNT0 decimal(10,0) not null comment '請求金額０'
  , REQUESTAMOUNT1 decimal(10,0) not null comment '請求金額１'
  , REQUESTAMOUNT2 decimal(10,0) comment '請求金額２'
  , REQUESTAMOUNT3 decimal(10,0) comment '請求金額３'
  , REQUESTAMOUNT4 decimal(10,0) comment '請求金額４'
  , REQUESTAMOUNT5 decimal(10,0) comment '請求金額５'
  , REQUESTAMOUNT6 decimal(10,0) comment '請求金額６'
  , UNCLAIMEDAMOUNT decimal(10,0) not null comment '請求残金額'
  , UNPAIDAMOUNT decimal(10,0) not null comment '未入金金額'
  , TAXAMOUNT decimal(10,0) not null comment '消費税'
  , NOTE varchar(120) not null comment '備考'
  , ENTRYDATE datetime not null comment '登録年月日'
  , UPDATEDATE datetime not null comment '更新年月日'
  , constraint requestdata_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE)
) comment '請求データ' ;

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

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

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

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

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


-- データ投入
-- 銀行営業日マスタ
LOCK TABLES `bankbusinessdaymaster` WRITE;
/*!40000 ALTER TABLE `bankbusinessdaymaster` DISABLE KEYS */;
INSERT INTO `bankbusinessdaymaster` VALUES (201611,2,NULL,0,NULL,NULL),(201611,4,NULL,0,NULL,NULL),(201611,7,NULL,0,NULL,NULL),(201611,8,NULL,0,NULL,NULL),(201611,9,NULL,0,NULL,NULL),(201611,10,NULL,0,NULL,NULL),(201611,11,NULL,0,NULL,NULL),(201611,14,NULL,0,NULL,NULL),(201611,15,NULL,0,NULL,NULL),(201611,16,NULL,0,NULL,NULL),(201611,17,NULL,0,NULL,NULL),(201611,18,NULL,0,NULL,NULL),(201611,21,NULL,0,NULL,NULL),(201611,22,NULL,0,NULL,NULL),(201611,24,NULL,0,NULL,NULL),(201611,25,NULL,0,NULL,NULL),(201611,28,NULL,0,NULL,NULL),(201611,29,NULL,0,NULL,NULL),(201611,30,NULL,0,NULL,NULL),(201612,1,NULL,0,NULL,NULL),(201612,2,NULL,0,NULL,NULL),(201612,5,NULL,0,NULL,NULL),(201612,6,NULL,0,NULL,NULL),(201612,7,NULL,0,NULL,NULL),(201612,8,NULL,0,NULL,NULL),(201612,9,NULL,0,NULL,NULL),(201612,12,NULL,0,NULL,NULL),(201612,13,NULL,0,NULL,NULL),(201612,14,NULL,0,NULL,NULL),(201612,15,NULL,0,NULL,NULL),(201612,16,NULL,0,NULL,NULL),(201612,19,NULL,0,NULL,NULL),(201612,20,NULL,0,NULL,NULL),(201612,21,NULL,0,NULL,NULL),(201612,22,NULL,0,NULL,NULL),(201612,26,NULL,0,NULL,NULL),(201612,27,NULL,0,NULL,NULL),(201612,28,NULL,0,NULL,NULL),(201612,29,NULL,0,NULL,NULL),(201612,30,NULL,0,NULL,NULL),(201701,4,NULL,0,NULL,NULL),(201701,5,NULL,0,NULL,NULL),(201701,6,NULL,0,NULL,NULL),(201701,10,NULL,0,NULL,NULL),(201701,11,NULL,0,NULL,NULL),(201701,12,NULL,0,NULL,NULL),(201701,13,NULL,0,NULL,NULL),(201701,16,NULL,0,NULL,NULL),(201701,17,NULL,0,NULL,NULL),(201701,18,NULL,0,NULL,NULL),(201701,19,NULL,0,NULL,NULL),(201701,20,NULL,0,NULL,NULL),(201701,23,NULL,0,NULL,NULL),(201701,24,NULL,0,NULL,NULL),(201701,25,NULL,0,NULL,NULL),(201701,26,NULL,0,NULL,NULL),(201701,27,NULL,0,NULL,NULL),(201701,30,NULL,0,NULL,NULL),(201701,31,NULL,0,NULL,NULL),(201702,1,NULL,0,NULL,NULL),(201702,2,NULL,0,NULL,NULL),(201702,3,NULL,0,NULL,NULL),(201702,6,NULL,0,NULL,NULL),(201702,7,NULL,0,NULL,NULL),(201702,8,NULL,0,NULL,NULL),(201702,9,NULL,0,NULL,NULL),(201702,10,NULL,0,NULL,NULL),(201702,13,NULL,0,NULL,NULL),(201702,14,NULL,0,NULL,NULL),(201702,15,NULL,0,NULL,NULL),(201702,16,NULL,0,NULL,NULL),(201702,17,NULL,0,NULL,NULL),(201702,20,NULL,0,NULL,NULL),(201702,21,NULL,0,NULL,NULL),(201702,22,NULL,0,NULL,NULL),(201702,23,NULL,0,NULL,NULL),(201702,24,NULL,0,NULL,NULL),(201702,27,NULL,0,NULL,NULL),(201702,28,NULL,0,NULL,NULL),(201703,1,NULL,0,NULL,NULL),(201703,2,NULL,0,NULL,NULL),(201703,3,NULL,0,NULL,NULL),(201703,6,NULL,0,NULL,NULL),(201703,7,NULL,0,NULL,NULL),(201703,8,NULL,0,NULL,NULL),(201703,9,NULL,0,NULL,NULL),(201703,10,NULL,0,NULL,NULL),(201703,13,NULL,0,NULL,NULL),(201703,14,NULL,0,NULL,NULL),(201703,15,NULL,0,NULL,NULL),(201703,16,NULL,0,NULL,NULL),(201703,17,NULL,0,NULL,NULL),(201703,21,NULL,0,NULL,NULL),(201703,22,NULL,0,NULL,NULL),(201703,23,NULL,0,NULL,NULL),(201703,24,NULL,0,NULL,NULL),(201703,27,NULL,0,NULL,NULL),(201703,28,NULL,0,NULL,NULL),(201703,29,NULL,0,NULL,NULL),(201703,30,NULL,0,NULL,NULL),(201703,31,NULL,0,NULL,NULL),(201704,3,NULL,0,NULL,NULL),(201704,4,NULL,0,NULL,NULL),(201704,5,NULL,0,NULL,NULL),(201704,6,NULL,0,NULL,NULL),(201704,7,NULL,0,NULL,NULL),(201704,10,NULL,0,NULL,NULL),(201704,11,NULL,0,NULL,NULL),(201704,12,NULL,0,NULL,NULL),(201704,13,NULL,0,NULL,NULL),(201704,14,NULL,0,NULL,NULL),(201704,17,NULL,0,NULL,NULL),(201704,18,NULL,0,NULL,NULL),(201704,19,NULL,0,NULL,NULL),(201704,20,NULL,0,NULL,NULL),(201704,21,NULL,0,NULL,NULL),(201704,24,NULL,0,NULL,NULL),(201704,25,NULL,0,NULL,NULL),(201704,26,NULL,0,NULL,NULL),(201704,27,NULL,0,NULL,NULL),(201704,28,NULL,0,NULL,NULL),(201705,1,NULL,0,NULL,NULL),(201705,2,NULL,0,NULL,NULL),(201705,8,NULL,0,NULL,NULL),(201705,9,NULL,0,NULL,NULL),(201705,10,NULL,0,NULL,NULL),(201705,11,NULL,0,NULL,NULL),(201705,12,NULL,0,NULL,NULL),(201705,15,NULL,0,NULL,NULL),(201705,16,NULL,0,NULL,NULL),(201705,17,NULL,0,NULL,NULL),(201705,18,NULL,0,NULL,NULL),(201705,19,NULL,0,NULL,NULL),(201705,22,NULL,0,NULL,NULL),(201705,23,NULL,0,NULL,NULL),(201705,24,NULL,0,NULL,NULL),(201705,25,NULL,0,NULL,NULL),(201705,26,NULL,0,NULL,NULL),(201705,29,NULL,0,NULL,NULL),(201705,30,NULL,0,NULL,NULL),(201705,31,NULL,0,NULL,NULL),(201706,1,NULL,0,NULL,NULL),(201706,2,NULL,0,NULL,NULL),(201706,5,NULL,0,NULL,NULL),(201706,6,NULL,0,NULL,NULL),(201706,7,NULL,0,NULL,NULL),(201706,8,NULL,0,NULL,NULL),(201706,9,NULL,0,NULL,NULL),(201706,12,NULL,0,NULL,NULL),(201706,13,NULL,0,NULL,NULL),(201706,14,NULL,0,NULL,NULL),(201706,15,NULL,0,NULL,NULL),(201706,16,NULL,0,NULL,NULL),(201706,19,NULL,0,NULL,NULL),(201706,20,NULL,0,NULL,NULL),(201706,21,NULL,0,NULL,NULL),(201706,22,NULL,0,NULL,NULL),(201706,23,NULL,0,NULL,NULL),(201706,26,NULL,0,NULL,NULL),(201706,27,NULL,0,NULL,NULL),(201706,28,NULL,0,NULL,NULL),(201706,29,NULL,0,NULL,NULL),(201706,30,NULL,0,NULL,NULL),(201707,3,NULL,0,NULL,NULL),(201707,4,NULL,0,NULL,NULL),(201707,5,NULL,0,NULL,NULL),(201707,6,NULL,0,NULL,NULL),(201707,7,NULL,0,NULL,NULL),(201707,10,NULL,0,NULL,NULL),(201707,11,NULL,0,NULL,NULL),(201707,12,NULL,0,NULL,NULL),(201707,13,NULL,0,NULL,NULL),(201707,14,NULL,0,NULL,NULL),(201707,18,NULL,0,NULL,NULL),(201707,19,NULL,0,NULL,NULL),(201707,20,NULL,0,NULL,NULL),(201707,21,NULL,0,NULL,NULL),(201707,24,NULL,0,NULL,NULL),(201707,25,NULL,0,NULL,NULL),(201707,26,NULL,0,NULL,NULL),(201707,27,NULL,0,NULL,NULL),(201707,28,NULL,0,NULL,NULL),(201707,31,NULL,0,NULL,NULL),(201708,1,NULL,0,NULL,NULL),(201708,2,NULL,0,NULL,NULL),(201708,3,NULL,0,NULL,NULL),(201708,4,NULL,0,NULL,NULL),(201708,7,NULL,0,NULL,NULL),(201708,8,NULL,0,NULL,NULL),(201708,9,NULL,0,NULL,NULL),(201708,10,NULL,0,NULL,NULL),(201708,14,NULL,0,NULL,NULL),(201708,15,NULL,0,NULL,NULL),(201708,16,NULL,0,NULL,NULL),(201708,17,NULL,0,NULL,NULL),(201708,18,NULL,0,NULL,NULL),(201708,21,NULL,0,NULL,NULL),(201708,22,NULL,0,NULL,NULL),(201708,23,NULL,0,NULL,NULL),(201708,24,NULL,0,NULL,NULL),(201708,25,NULL,0,NULL,NULL),(201708,28,NULL,0,NULL,NULL),(201708,29,NULL,0,NULL,NULL),(201708,30,NULL,0,NULL,NULL),(201708,31,NULL,0,NULL,NULL),(201709,1,NULL,0,NULL,NULL),(201709,4,NULL,0,NULL,NULL),(201709,5,NULL,0,NULL,NULL),(201709,6,NULL,0,NULL,NULL),(201709,7,NULL,0,NULL,NULL),(201709,8,NULL,0,NULL,NULL),(201709,11,NULL,0,NULL,NULL),(201709,12,NULL,0,NULL,NULL),(201709,13,NULL,0,NULL,NULL),(201709,14,NULL,0,NULL,NULL),(201709,15,NULL,0,NULL,NULL),(201709,19,NULL,0,NULL,NULL),(201709,20,NULL,0,NULL,NULL),(201709,21,NULL,0,NULL,NULL),(201709,22,NULL,0,NULL,NULL),(201709,25,NULL,0,NULL,NULL),(201709,26,NULL,0,NULL,NULL),(201709,27,NULL,0,NULL,NULL),(201709,28,NULL,0,NULL,NULL),(201709,29,NULL,0,NULL,NULL),(201710,2,NULL,0,NULL,NULL),(201710,3,NULL,0,NULL,NULL),(201710,4,NULL,0,NULL,NULL),(201710,5,NULL,0,NULL,NULL),(201710,6,NULL,0,NULL,NULL),(201710,10,NULL,0,NULL,NULL),(201710,11,NULL,0,NULL,NULL),(201710,12,NULL,0,NULL,NULL),(201710,13,NULL,0,NULL,NULL),(201710,16,NULL,0,NULL,NULL),(201710,17,NULL,0,NULL,NULL),(201710,18,NULL,0,NULL,NULL),(201710,19,NULL,0,NULL,NULL),(201710,20,NULL,0,NULL,NULL),(201710,23,NULL,0,NULL,NULL),(201710,24,NULL,0,NULL,NULL),(201710,25,NULL,0,NULL,NULL),(201710,26,NULL,0,NULL,NULL),(201710,27,NULL,0,NULL,NULL),(201710,30,NULL,0,NULL,NULL),(201710,31,NULL,0,NULL,NULL),(201711,1,NULL,0,NULL,NULL),(201711,2,NULL,0,NULL,NULL),(201711,6,NULL,0,NULL,NULL),(201711,7,NULL,0,NULL,NULL),(201711,8,NULL,0,NULL,NULL),(201711,9,NULL,0,NULL,NULL),(201711,10,NULL,0,NULL,NULL),(201711,13,NULL,0,NULL,NULL),(201711,14,NULL,0,NULL,NULL),(201711,15,NULL,0,NULL,NULL),(201711,16,NULL,0,NULL,NULL),(201711,17,NULL,0,NULL,NULL),(201711,20,NULL,0,NULL,NULL),(201711,21,NULL,0,NULL,NULL),(201711,22,NULL,0,NULL,NULL),(201711,24,NULL,0,NULL,NULL),(201711,27,NULL,0,NULL,NULL),(201711,28,NULL,0,NULL,NULL),(201711,29,NULL,0,NULL,NULL),(201711,30,NULL,0,NULL,NULL),(201712,1,NULL,0,NULL,NULL),(201712,4,NULL,0,NULL,NULL),(201712,5,NULL,0,NULL,NULL),(201712,6,NULL,0,NULL,NULL),(201712,7,NULL,0,NULL,NULL),(201712,8,NULL,0,NULL,NULL),(201712,11,NULL,0,NULL,NULL),(201712,12,NULL,0,NULL,NULL),(201712,13,NULL,0,NULL,NULL),(201712,14,NULL,0,NULL,NULL),(201712,15,NULL,0,NULL,NULL),(201712,18,NULL,0,NULL,NULL),(201712,19,NULL,0,NULL,NULL),(201712,20,NULL,0,NULL,NULL),(201712,21,NULL,0,NULL,NULL),(201712,22,NULL,0,NULL,NULL),(201712,25,NULL,0,NULL,NULL),(201712,26,NULL,0,NULL,NULL),(201712,27,NULL,0,NULL,NULL),(201712,28,NULL,0,NULL,NULL),(201712,29,NULL,0,NULL,NULL);
/*!40000 ALTER TABLE `bankbusinessdaymaster` ENABLE KEYS */;
UNLOCK TABLES;

-- 締日マスタ
LOCK TABLES `deadlinemaster` WRITE;
/*!40000 ALTER TABLE `deadlinemaster` DISABLE KEYS */;
INSERT INTO `deadlinemaster` VALUES (0,18,31,NULL,0,NULL,NULL),(1,8,10,NULL,0,NULL,NULL);
/*!40000 ALTER TABLE `deadlinemaster` ENABLE KEYS */;
UNLOCK TABLES;

