Опис організаційно-економічної сутності задачі

Автор работы: Пользователь скрыл имя, 21 Декабря 2015 в 03:18, курсовая работа

Описание работы

Актуальність обраної теми полягає у тому, що автоматизація нарахування дивідендів дозволяє зменшити ризик помилки та час на розрахування дивідендів для кожного акціонера, а також вирішує проблему звітності, оскільки потрібну інформацію для звіту можна отримати в потрібному вигляді, у формі таблиці, в самих СКБД. Зберігання усіх даних у базі спрощує пошук потрібної інформації для співробітників підприємства, оскільки кожен співробітник, за потреби, може отримати потрібні йому дані, не виходячи зі свого кабінету, що економить час та прискорює роботу підприємства.

Файлы: 1 файл

Курсовая.docx

— 732.07 Кб (Скачать файл)

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_country")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код страны:")

'  CREATE INDEX XPKCountry/3

Set ERwinTableDef = ERwinDatabase.TableDefs("Country/3")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKCountry/3")

Set ERwinField = ERwinIndex.CreateField("id_country")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE TABLE Currency/6

Set ERwinTableDef = ERwinDatabase.CreateTableDef("Currency/6")

Set ERwinField = ERwinTableDef.CreateField("id_cur", DB_LONG)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Currency", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

ERwinDatabase.TableDefs.Append ERwinTableDef

Set ERwinField = ERwinTableDef.Fields("id_cur")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код валюты:")

Set ERwinField = ERwinTableDef.Fields("Currency")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Валюта:")

'  CREATE INDEX XPKCurrency/6

Set ERwinTableDef = ERwinDatabase.TableDefs("Currency/6")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKCurrency/6")

Set ERwinField = ERwinIndex.CreateField("id_cur")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE TABLE Emission/10

Set ERwinTableDef = ERwinDatabase.CreateTableDef("Emission/10")

Set ERwinField = ERwinTableDef.CreateField("Date", DB_DATETIME)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Sharers", DB_LONG)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("id_act", DB_LONG)

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("Emission/10")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKEmission/10")

Set ERwinField = ERwinIndex.CreateField("Date")

ERwinIndex.Fields.Append ERwinField

Set ERwinField = ERwinIndex.CreateField("id_act")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE TABLE Region/2

Set ERwinTableDef = ERwinDatabase.CreateTableDef("Region/2")

Set ERwinField = ERwinTableDef.CreateField("Region", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("id_region", DB_LONG)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("id_country", DB_LONG)

ERwinTableDef.Fields.Append ERwinField

ERwinDatabase.TableDefs.Append ERwinTableDef

Set ERwinField = ERwinTableDef.Fields("Region")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Регион:")

Set ERwinField = ERwinTableDef.Fields("id_region")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код региона:")

Set ERwinField = ERwinTableDef.Fields("id_country")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код страны:")

'  CREATE INDEX XPKRegion/2

Set ERwinTableDef = ERwinDatabase.TableDefs("Region/2")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKRegion/2")

Set ERwinField = ERwinIndex.CreateField("id_region")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE TABLE Shar/8

Set ERwinTableDef = ERwinDatabase.CreateTableDef("Shar/8")

Set ERwinField = ERwinTableDef.CreateField("id_act", DB_LONG)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Id_sharer", DB_LONG)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("numb_shar", DB_LONG)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Date", DB_DATETIME)

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_sharer")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Код акционера:")

Set ERwinField = ERwinTableDef.Fields("numb_shar")

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/8")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKShar/8")

Set ERwinField = ERwinIndex.CreateField("id_act")

ERwinIndex.Fields.Append ERwinField

Set ERwinField = ERwinIndex.CreateField("Id_sharer")

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("sharer/1")

Set ERwinField = ERwinTableDef.CreateField("Id_sharer", DB_LONG)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Surname", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Name", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Midlename", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Telephone", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("id_city", DB_LONG)

ERwinTableDef.Fields.Append ERwinField

ERwinDatabase.TableDefs.Append ERwinTableDef

Set ERwinField = ERwinTableDef.Fields("Id_sharer")

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("Midlename")

Call SetFieldProp(ERwinField, "Caption", DB_TEXT , "Отчество:")

Set ERwinField = ERwinTableDef.Fields("Telephone")

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("sharer/1")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKsharer/1")

Set ERwinField = ERwinIndex.CreateField("Id_sharer")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE TABLE Shares/7

Set ERwinTableDef = ERwinDatabase.CreateTableDef("Shares/7")

Set ERwinField = ERwinTableDef.CreateField("id_act", DB_LONG)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Type_of_sharer", DB_TEXT, 20)

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Procent", DB_LONG)

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_sharer")

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("Shares/7")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKShares/7")

Set ERwinField = ERwinIndex.CreateField("id_act")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE TABLE Use/9

Set ERwinTableDef = ERwinDatabase.CreateTableDef("Use/9")

Set ERwinField = ERwinTableDef.CreateField("id_use", DB_TEXT, 18)

ERwinField.Required = True

ERwinTableDef.Fields.Append ERwinField

Set ERwinField = ERwinTableDef.CreateField("Use", DB_TEXT, 20)

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/9")

Set ERwinIndex = ERwinTableDef.CreateIndex("XPKUse/9")

Set ERwinField = ERwinIndex.CreateField("id_use")

ERwinIndex.Fields.Append ERwinField

ERwinIndex.Primary = True

ERwinTableDef.Indexes.Append ERwinIndex

'  CREATE RELATIONSHIP R/12

Set ERwinRelation = ERwinDatabase.CreateRelation("R/12", "Region/2", "City/5")

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("R/13", "Currency/6", "Company/4")

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("R/18", "Use/9", "Company/4")

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("R/19", "Shares/7", "Emission/10")

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("R/10", "Country/3", "Region/2")

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("R/15", "Shares/7", "Shar/8")

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("R/16", "sharer/1", "Shar/8")

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("R/11", "City/5", "sharer/1")

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

Информация о работе Опис організаційно-економічної сутності задачі