Автор работы: Пользователь скрыл имя, 21 Декабря 2015 в 03:18, курсовая работа
Актуальність обраної теми полягає у тому, що автоматизація нарахування дивідендів дозволяє зменшити ризик помилки та час на розрахування дивідендів для кожного акціонера, а також вирішує проблему звітності, оскільки потрібну інформацію для звіту можна отримати в потрібному вигляді, у формі таблиці, в самих СКБД. Зберігання усіх даних у базі спрощує пошук потрібної інформації для співробітників підприємства, оскільки кожен співробітник, за потреби, може отримати потрібні йому дані, не виходячи зі свого кабінету, що економить час та прискорює роботу підприємства.
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("Country"
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Страна:")
Set ERwinField = ERwinTableDef.Fields("id_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код страны:")
' CREATE INDEX XPKCountry/3
Set ERwinTableDef = ERwinDatabase.TableDefs("
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Currency/6
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("id_cur")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код валюты:")
Set ERwinField = ERwinTableDef.Fields("
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Валюта:")
' CREATE INDEX XPKCurrency/6
Set ERwinTableDef = ERwinDatabase.TableDefs("
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Emission/10
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("Date")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Дата:")
Set ERwinField = ERwinTableDef.Fields("Sharers"
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Количество акций:")
Set ERwinField = ERwinTableDef.Fields("id_act")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код акций:")
' CREATE INDEX XPKEmission/10
Set ERwinTableDef = ERwinDatabase.TableDefs("
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("Date")
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Region/2
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("Region")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Регион:")
Set ERwinField = ERwinTableDef.Fields("id_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код региона:")
Set ERwinField = ERwinTableDef.Fields("id_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код страны:")
' CREATE INDEX XPKRegion/2
Set ERwinTableDef = ERwinDatabase.TableDefs("
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Shar/8
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("Id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("id_act")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код акций:")
Set ERwinField = ERwinTableDef.Fields("Id_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код акционера:")
Set ERwinField = ERwinTableDef.Fields("numb_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Количество акций:")
Set ERwinField = ERwinTableDef.Fields("Date")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Дата:")
' CREATE INDEX XPKShar/8
Set ERwinTableDef = ERwinDatabase.TableDefs("Shar/
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("Id_
ERwinIndex.Fields.Append ERwinField
Set ERwinField = ERwinIndex.CreateField("Date")
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE sharer/1
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("Id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("Id_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код акционера:")
Set ERwinField = ERwinTableDef.Fields("Surname"
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Фамилия:")
Set ERwinField = ERwinTableDef.Fields("Name")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Имя:")
Set ERwinField = ERwinTableDef.Fields("
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Отчество:")
Set ERwinField = ERwinTableDef.Fields("
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Телефон:")
Set ERwinField = ERwinTableDef.Fields("id_city"
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код города:")
' CREATE INDEX XPKsharer/1
Set ERwinTableDef = ERwinDatabase.TableDefs("
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("Id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Shares/7
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("id_act")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код акций:")
Set ERwinField = ERwinTableDef.Fields("Type_of_
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Вид акций:")
Set ERwinField = ERwinTableDef.Fields("Procent"
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Процент налогооблажения:")
' CREATE INDEX XPKShares/7
Set ERwinTableDef = ERwinDatabase.TableDefs("
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE TABLE Use/9
Set ERwinTableDef = ERwinDatabase.CreateTableDef("
Set ERwinField = ERwinTableDef.CreateField("id_
ERwinField.Required = True
ERwinTableDef.Fields.Append ERwinField
Set ERwinField = ERwinTableDef.CreateField("
ERwinTableDef.Fields.Append ERwinField
ERwinDatabase.TableDefs.Append ERwinTableDef
Set ERwinField = ERwinTableDef.Fields("id_use")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код назначения:")
Set ERwinField = ERwinTableDef.Fields("Use")
Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Назначение:")
' CREATE INDEX XPKUse/9
Set ERwinTableDef = ERwinDatabase.TableDefs("Use/
Set ERwinIndex = ERwinTableDef.CreateIndex("
Set ERwinField = ERwinIndex.CreateField("id_
ERwinIndex.Fields.Append ERwinField
ERwinIndex.Primary = True
ERwinTableDef.Indexes.Append ERwinIndex
' CREATE RELATIONSHIP R/12
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_region" )
ERwinField.ForeignName = id_region
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/13
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_cur" )
ERwinField.ForeignName = id_cur
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/18
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_use" )
ERwinField.ForeignName = id_use
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/19
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_act" )
ERwinField.ForeignName = id_act
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/10
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_country" )
ERwinField.ForeignName = id_country
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/15
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_act" )
ERwinField.ForeignName = id_act
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/16
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "Id_sharer" )
ERwinField.ForeignName = Id_sharer
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
' CREATE RELATIONSHIP R/11
Set ERwinRelation = ERwinDatabase.CreateRelation("
Set ERwinField = ERwinRelation.CreateField( "id_city" )
ERwinField.ForeignName = id_city
ERwinRelation.Fields.Append ERwinField
ERwinDatabase.Relations.Append ERwinRelation
ERwinDatabase.Close
ERwinWorkspace.Close
Лістинг В.2. Код, згенерований програмою Erwin для створення таблиць за фізичною моделью в СКБД MySQL
CREATE TABLE City_5
(
id_city INTEGER NOT NULL,
city VARCHAR(20) NULL,
id_region INTEGER NULL
);
ALTER TABLE City_5
ADD PRIMARY KEY (id_city);
CREATE TABLE Company_4
(
Date DATE NULL,
Count_div INTEGER NULL,
Number INTEGER NOT NULL,
id_cur INTEGER NULL,
id_use CHAR(18) NULL
);
ALTER TABLE Company_4
ADD PRIMARY KEY (Number);
CREATE TABLE Country_3
(
Country VARCHAR(20) NULL,
id_country INTEGER NOT NULL
);
ALTER TABLE Country_3
ADD PRIMARY KEY (id_country);
CREATE TABLE Currency_6
(
id_cur INTEGER NOT NULL,
Currency VARCHAR(20) NULL
);
ALTER TABLE Currency_6
ADD PRIMARY KEY (id_cur);
CREATE TABLE Emission_10
(
Date DATE NOT NULL,
Sharers INTEGER NULL,
id_act INTEGER NOT NULL
);
ALTER TABLE Emission_10
ADD PRIMARY KEY (Date,id_act);
CREATE TABLE Region_2
(
Region VARCHAR(20) NULL,
id_region INTEGER NOT NULL,
id_country INTEGER NULL
);
ALTER TABLE Region_2
ADD PRIMARY KEY (id_region);
CREATE TABLE Shar_8
(
id_act INTEGER NOT NULL,
Id_sharer INTEGER NOT NULL,
numb_shar INTEGER NULL,
Date DATE NOT NULL
);
ALTER TABLE Shar_8
ADD PRIMARY KEY (id_act,Id_sharer,Date);
CREATE TABLE sharer_1
(
Id_sharer INTEGER NOT NULL,
Surname VARCHAR(20) NULL,
Name VARCHAR(20) NULL,
Midlename VARCHAR(20) NULL,
Telephone VARCHAR(20) NULL,
id_city INTEGER NULL
);
ALTER TABLE sharer_1
ADD PRIMARY KEY (Id_sharer);
CREATE TABLE Shares_7
(
id_act INTEGER NOT NULL,
Type_of_sharer VARCHAR(20) NULL,
Procent INTEGER NULL
);
ALTER TABLE Shares_7
ADD PRIMARY KEY (id_act);
CREATE TABLE Use_9
(
id_use CHAR(18) NOT NULL,
Use VARCHAR(20) NULL
);
ALTER TABLE Use_9
ADD PRIMARY KEY (id_use);
ALTER TABLE City_5
ADD FOREIGN KEY R_12 (id_region) REFERENCES Region_2 (id_region);
ALTER TABLE Company_4
ADD FOREIGN KEY R_13 (id_cur) REFERENCES Currency_6 (id_cur);
ALTER TABLE Company_4
ADD FOREIGN KEY R_18 (id_use) REFERENCES Use_9 (id_use);
ALTER TABLE Emission_10
ADD FOREIGN KEY R_19 (id_act) REFERENCES Shares_7 (id_act);
ALTER TABLE Region_2
ADD FOREIGN KEY R_10 (id_country) REFERENCES Country_3 (id_country);
ALTER TABLE Shar_8
ADD FOREIGN KEY R_15 (id_act) REFERENCES Shares_7 (id_act);
ALTER TABLE Shar_8
ADD FOREIGN KEY R_16 (Id_sharer) REFERENCES sharer_1 (Id_sharer);
ALTER TABLE sharer_1
ADD FOREIGN KEY R_11 (id_city) REFERENCES City_5 (id_city);
Код, згенерований програмою Erwin для створення таблиць за фізичною моделью в СКБД SQL Server:
CREATE TABLE City_5
(
id_city integer NOT NULL ,
city varchar(20) NULL ,
id_region integer NULL
)
go
ALTER TABLE City_5
ADD CONSTRAINT XPKCity_5 PRIMARY KEY NONCLUSTERED (id_city ASC)
go
CREATE TABLE Company_4
(
Date datetime NULL ,
Count_div integer NULL ,
Number integer NOT NULL ,
id_cur integer NULL ,
id_use char(18) NULL
)
go
ALTER TABLE Company_4
ADD CONSTRAINT XPKCompany_4 PRIMARY KEY NONCLUSTERED (Number ASC)
go
CREATE TABLE Country_3
(
Country varchar(20) NULL ,
id_country integer NOT NULL
)
go
ALTER TABLE Country_3
ADD CONSTRAINT XPKCountry_3 PRIMARY KEY NONCLUSTERED (id_country ASC)
go
CREATE TABLE Currency_6
(
id_cur integer NOT NULL ,
Currency varchar(20) NULL
)
go
ALTER TABLE Currency_6
ADD CONSTRAINT XPKCurrency_6 PRIMARY KEY NONCLUSTERED (id_cur ASC)
go
CREATE TABLE Emission_10
(
Date datetime NOT NULL ,
Sharers integer NULL ,
id_act integer NOT NULL
)
go
ALTER TABLE Emission_10
ADD CONSTRAINT XPKEmission_10 PRIMARY KEY NONCLUSTERED (Date ASC,id_act ASC)
go
CREATE TABLE Region_2
(
Region varchar(20) NULL ,
id_region integer NOT NULL ,
id_country integer NULL
)
go
ALTER TABLE Region_2
ADD CONSTRAINT XPKRegion_2 PRIMARY KEY NONCLUSTERED (id_region ASC)
go
CREATE TABLE Shar_8
(
id_act integer NOT NULL ,
Id_sharer integer NOT NULL ,
numb_shar integer NULL ,
Date datetime NOT NULL
)
go
ALTER TABLE Shar_8
ADD CONSTRAINT XPKShar_8 PRIMARY KEY NONCLUSTERED (id_act ASC,Id_sharer ASC,Date ASC)
go
CREATE TABLE sharer_1
(
Id_sharer integer NOT NULL ,
Surname varchar(20) NULL ,
Name varchar(20) NULL ,
Midlename varchar(20) NULL ,
Telephone varchar(20) NULL ,
id_city integer NULL
)
go
ALTER TABLE sharer_1
ADD CONSTRAINT XPKsharer_1 PRIMARY KEY NONCLUSTERED (Id_sharer ASC)
go
CREATE TABLE Shares_7
(
id_act integer NOT NULL ,
Type_of_sharer varchar(20) NULL ,
Procent integer NULL
)
go
ALTER TABLE Shares_7
ADD CONSTRAINT XPKShares_7 PRIMARY KEY NONCLUSTERED (id_act ASC)
go
CREATE TABLE Use_9
(
id_use char(18) NOT NULL ,
Use varchar(20) NULL
)
go
ALTER TABLE Use_9
ADD CONSTRAINT XPKUse_9 PRIMARY KEY NONCLUSTERED (id_use ASC)
go
ALTER TABLE City_5
ADD CONSTRAINT R_12 FOREIGN KEY (id_region) REFERENCES Region_2(id_region)
ON DELETE NO ACTION
ON UPDATE NO ACTION
go
ALTER TABLE Company_4
ADD CONSTRAINT R_13 FOREIGN KEY (id_cur) REFERENCES Currency_6(id_cur)
ON DELETE NO ACTION
ON UPDATE NO ACTION
go
ALTER TABLE Company_4
ADD CONSTRAINT R_18 FOREIGN KEY (id_use) REFERENCES Use_9(id_use)
ON DELETE NO ACTION
ON UPDATE NO ACTION
go
ALTER TABLE Emission_10
ADD CONSTRAINT R_19 FOREIGN KEY (id_act) REFERENCES Shares_7(id_act)
ON DELETE NO ACTION
Информация о работе Опис організаційно-економічної сутності задачі