Главная | Обратная связь | Поможем написать вашу работу!
МегаЛекции

Create Procedure clearprotocol




AS

BEGIN

EXIT;

END^

CREATE PROCEDURE DELETEDIRECTOR (

FIO VARCHAR(20))

AS

BEGIN

EXIT;

END^

CREATE PROCEDURE DELETEDOC (

NUM INTEGER)

AS

BEGIN

EXIT;

END^

CREATE PROCEDURE DELETEPODRAZD (

 NOMER INTEGER)

AS

BEGIN

 EXIT;

END^

CREATE PROCEDURE DELETEPROVERKA (

NPROVERKI INTEGER)

AS

BEGIN

EXIT;

END^

CREATE PROCEDURE DELETERABOTNIK (

NUM INTEGER)

AS

BEGIN

EXIT;

END^

CREATE PROCEDURE EDITPROVERKI (

OPISANIE VARCHAR(1000),

NPROV INTEGER,

VID VARCHAR(15),

NAZVPODR VARCHAR(70),

FIO VARCHAR(20),

DATA DATE)

AS

BEGIN

EXIT;

END^

CREATE PROCEDURE NEW_PROCEDURE (

NAZV VARCHAR(70),

LOGIN VARCHAR(20),

FIO VARCHAR(20))

AS

BEGIN

EXIT;

END^

CREATE PROCEDURE UPDATEDOCUMENT (

IZMEN VARCHAR(30),

TEMA VARCHAR(30),

NUM INTEGER)

AS

BEGIN

EXIT;

END^

SET TERM; ^/****************************************************************/

/**** Tables ****/

/************************************************************/

CREATE TABLE ARHIVDOC (

 NDOC INTEGER NOT NULL,

 NKLASS VARCHAR(7) NOT NULL,

 NAIMENDOC VARCHAR(70) NOT NULL,

 VIDDOC VARCHAR(15) NOT NULL,

 DATAPRINYATIYA DATE NOT NULL,

 DATADELETE DATE NOT NULL,

 TEMATIKA VARCHAR(30),

 IZMENENIYA VARCHAR(30)

);

CREATE TABLE DIRECTOR (

FIO VARCHAR(20) NOT NULL,

LOGIN VARCHAR(20) NOT NULL,

DATAVSTUPLENIYA DATE NOT NULL

);

CREATE TABLE DOCUMENT (

NDOC INTEGER NOT NULL,

NKLASS VARCHAR(7) NOT NULL,

NAIMENDOC VARCHAR(70) NOT NULL,

VIDDOC VARCHAR(15) NOT NULL,

DATAPRINYATIYA DATE NOT NULL,

DATAIZMEN DATE,

STATUS VARCHAR(10),

TEMATIKA VARCHAR(30),

IZMENENIYA VARCHAR(30)

);

CREATE TABLE PODRAZD (

 NPODR INTEGER NOT NULL,

 FIOPODR VARCHAR(20) NOT NULL,

 NAZVANIE VARCHAR(70) NOT NULL

);

CREATE TABLE PROTOCOL (

NUMBER INTEGER NOT NULL,

DATA DATE NOT NULL,

NRAB INTEGER,

NDOC INTEGER,

VREMYA TIME NOT NULL

);

CREATE TABLE PROVERKI (

NPROVERKI INTEGER NOT NULL,

DATA DATE NOT NULL,

FIO VARCHAR(20) NOT NULL,

NPODR INTEGER NOT NULL,

VID VARCHAR(15),

OPISANIE VARCHAR(1000)

);

CREATE TABLE RABOTNIK (

NUMBER INTEGER NOT NULL,

FIO VARCHAR(20) NOT NULL,

LOGIN VARCHAR(20) NOT NULL,

NPODR INTEGER NOT NULL);/**************************************************************/

/**** Unique Constraints ****/

/*********************************************************/

ALTER TABLE DOCUMENT ADD CONSTRAINT UNQ_DOCUMENT UNIQUE (NKLASS, NAIMENDOC);

ALTER TABLE RABOTNIK ADD CONSTRAINT UNQ_RAB UNIQUE (LOGIN);

/************************************************************/

/**** Primary Keys ****/

/************************************************************/

ALTER TABLE ARHIVDOC ADD CONSTRAINT PK_ARHIVDOC PRIMARY KEY (NDOC);

ALTER TABLE DIRECTOR ADD CONSTRAINT PK_DIRECTOR PRIMARY KEY (FIO);

ALTER TABLE DOCUMENT ADD CONSTRAINT PK_DOCUMENT PRIMARY KEY (NDOC);

ALTER TABLE PODRAZD ADD CONSTRAINT PK_PODRAZD PRIMARY KEY (NPODR);

ALTER TABLE PROTOCOL ADD CONSTRAINT PK_PROTOCOL PRIMARY KEY (NUMBER);

ALTER TABLE PROVERKI ADD CONSTRAINT PK_PROVERKI PRIMARY KEY (NPROVERKI);

ALTER TABLE RABOTNIK ADD CONSTRAINT PK_RABOTNIK PRIMARY KEY (NUMBER);

/************************************************************/

/**** Foreign Keys ****/

/************************************************************/

 

ALTER TABLE PROTOCOL ADD CONSTRAINT FK_PROTOCOL_DOC FOREIGN KEY (NDOC) REFERENCES DOCUMENT (NDOC) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE PROTOCOL ADD CONSTRAINT FK_PROTOCOL_RAB FOREIGN KEY (NRAB) REFERENCES RABOTNIK (NUMBER) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE PROVERKI ADD CONSTRAINT FK_PROV_DIR FOREIGN KEY (FIO) REFERENCES DIRECTOR (FIO) ON DELETE NO ACTION ON UPDATE CASCADE;

ALTER TABLE PROVERKI ADD CONSTRAINT FK_PROV_PODRAZD FOREIGN KEY (NPODR) REFERENCES PODRAZD (NPODR) ON DELETE NO ACTION ON UPDATE CASCADE;

ALTER TABLE RABOTNIK ADD CONSTRAINT FK_RAB_PODR FOREIGN KEY (NPODR) REFERENCES PODRAZD (NPODR) ON DELETE NO ACTION ON UPDATE CASCADE;

/************************************************************/

/**** Triggers ****/

/************************************************************/

SET TERM ^;

/* Trigger: BI_ARHIV */

CREATE TRIGGER BI_ARHIV FOR ARHIVDOC

ACTIVE BEFORE INSERT POSITION 0

AS

begin

/* Trigger text */

NEW.ndoc= GEN_ID(arhivn,1);

end

^

/* Trigger: BI_DOCUMRNT */

CREATE TRIGGER BI_DOCUMRNT FOR DOCUMENT

ACTIVE BEFORE INSERT POSITION 0

AS

begin

/* Trigger text */

NEW.ndoc= GEN_ID(docn,1);

end

^

/* Trigger: BI_PODRAZD */

CREATE TRIGGER BI_PODRAZD FOR PODRAZD

ACTIVE BEFORE INSERT POSITION 0

AS

begin

/* Trigger text */

 NEW.npodr= GEN_ID(podrazdn,1);

end

^

/* Trigger: BI_PROTOCOL */

CREATE TRIGGER BI_PROTOCOL FOR PROTOCOL

ACTIVE BEFORE INSERT POSITION 0

AS

begin

 /* Trigger text */

 NEW.number= GEN_ID(protocoln,1);

end

^

/* Trigger: BI_PROVERKI */

CREATE TRIGGER BI_PROVERKI FOR PROVERKI

ACTIVE BEFORE INSERT POSITION 0

AS

begin

 /* Trigger text */

 NEW.nproverki= GEN_ID(proverkin,1);

end

^

/* Trigger: BI_RABOTNIK */

CREATE TRIGGER BI_RABOTNIK FOR RABOTNIK

ACTIVE BEFORE INSERT POSITION 0

AS

begin

 /* Trigger text */

 NEW.number= GEN_ID(rabn,1);

end

^

SET TERM; ^

/***********************************************************/

/**** Stored Procedures ****/

/***********************************************************/

SET TERM ^;

ALTER PROCEDURE ADD_DOCUMENT (

NKLASS VARCHAR(7),

TEMA VARCHAR(30),

DATA DATE,

VID VARCHAR(15),

NAME VARCHAR(70))

AS

begin

/* Procedure Text */

 insert into document(nklass,naimendoc,viddoc,dataprinyatiya,tematika)

 values (:nklass,:name,:vid,:data,:tema);

end

^

ALTER PROCEDURE ADDDIRECTOR (

 DATA DATE,

 LOGIN VARCHAR(20),

 FAMILY VARCHAR(20))

AS

begin

insert into director(FIO,LOGIN,DATAVSTUPLENIYA)

values (:family,:login,:data);

/* Procedure Text */ /*$$IBE$$

suspend;

$$IBE$$*/

end

^

ALTER PROCEDURE ADDPODRAZDELENIE (

NAZV VARCHAR(70),

FIO VARCHAR(20))

AS

begin

insert INTO podrazd(FIOPODR,NAZVANIE)

VALUES (:fio,:nazv);

end

^

ALTER PROCEDURE ADDPROTOCOL (

NUMDOC INTEGER)

AS

DECLARE VARIABLE NRAB INTEGER;

DECLARE VARIABLE USE VARCHAR(20);

DECLARE VARIABLE VREMYA TIME;

DECLARE VARIABLE DATA DATE;

begin

/* Procedure Text */

use = user;

data = 'TODAY';

vremya = 'NOW';

select NUMBER

FROM rabotnik

WHERE LOGIN =: use

INTO:NRAB;

INSERT INTO protocol(DATA,VREMYA,NRAB,NDOC)

VALUES (:DATA,:VREMYA,:NRAB,:numdoc);

end

^

ALTER PROCEDURE ADDPROVERKI (

NAZVPODR VARCHAR(70),

FIO VARCHAR(20),

OPISANIE VARCHAR(1000),

VID VARCHAR(15),

DATA DATE)

AS

DECLARE VARIABLE PODR INTEGER;

begin

SELECT NPODR

FROM podrazd WHERE NAZVANIE=:NAZVPODR

INTO PODR;

INSERT INTO PROVERKI(DATA, FIO, NPODR,VID,OPISANIE)

VALUES (:DATA,:FIO,:PODR,:VID,:OPISANIE);

end

^

ALTER PROCEDURE CLEARARHIV

AS

begin

/* Procedure Text */

delete from arhivdoc;

end

^

ALTER PROCEDURE CLEARPROTOCOL

AS

begin

/* Procedure Text */

delete from protocol;

end

^

ALTER PROCEDURE DELETEDIRECTOR (

FIO VARCHAR(20))

AS

begin

/* Procedure Text */

DELETE FROM director

where FIO=:fio;

end

^

ALTER PROCEDURE DELETEDOC (

NUM INTEGER)

AS

DECLARE VARIABLE IZMENENIYA VARCHAR(30) CHARACTER SET WIN1251;

DECLARE VARIABLE TEMATIKA VARCHAR(30) CHARACTER SET WIN1251;

DECLARE VARIABLE DATA DATE;

DECLARE VARIABLE VIDDOC VARCHAR(15) CHARACTER SET WIN1251;

DECLARE VARIABLE NAIMENDOC VARCHAR(70) CHARACTER SET WIN1251;

DECLARE VARIABLE NKLASS VARCHAR(7) CHARACTER SET WIN1251;

begin

/* Procedure Text */

select nklass,naimendoc,viddoc,dataprinyatiya,tematika,izmeneniya

from document

where ndoc =:num

into:nklass,:naimendoc,:viddoc,:data,:tematika,:izmeneniya;

delete from document

where ndoc =:num;

 insert into arhivdoc(nklass,naimendoc,viddoc,dataprinyatiya,datadelete,tematika,izmeneniya)

values(:nklass,:naimendoc,:viddoc,:data,'TODAY',:tematika,:izmeneniya);

end

^

ALTER PROCEDURE DELETEPODRAZD (

NOMER INTEGER)

AS

begin

DELETE from podrazd

WHERE NPODR=:nomer;

end

^

ALTER PROCEDURE DELETEPROVERKA (

NPROVERKI INTEGER)

AS

begin

/* Procedure Text */

delete FROM proverki

where NPROVERKI=:nproverki;

end

^

ALTER PROCEDURE DELETERABOTNIK (

NUM INTEGER)

AS

begin

DELETE FROM RABOTNIK

WHERE NUMBER =:NUM;

/* Procedure Text */

WHEN ANY do exception NODELETE;

end

^

ALTER PROCEDURE EDITPROVERKI (

OPISANIE VARCHAR(1000),

NPROV INTEGER,

VID VARCHAR(15),

NAZVPODR VARCHAR(70),

FIO VARCHAR(20),

DATA DATE)

AS

DECLARE VARIABLE PODR INTEGER;

begin

SELECT NPODR

FROM podrazd WHERE NAZVANIE=:NAZVPODR

INTO PODR;

UPDATE PROVERKI

SET DATA=:DATA, FIO=:FIO, NPODR=:PODR,VID=:VID,OPISANIE=:OPISANIE

WHERE NPROVERKI =:NPROV;

 

/* Procedure Text */

end

^

ALTER PROCEDURE NEW_PROCEDURE (

NAZV VARCHAR(70),

LOGIN VARCHAR(20),

FIO VARCHAR(20))

AS

DECLARE VARIABLE NUM INTEGER;

begin

/* Procedure Text */

select NPODR

FROM PODRAZD

WHERE NAZVANIE =:nazv

INTO NUM;

insert INTO RABOTNIK(FIO,LOGIN,NPODR)

VALUES (:fio,:login,:NUM);

end

^

ALTER PROCEDURE UPDATEDOCUMENT (

IZMEN VARCHAR(30),

TEMA VARCHAR(30),

NUM INTEGER)

AS

begin

/* Procedure Text */

UPDATE document

set DATAIZMEN = 'TODAY', STATUS='изменен',TEMATIKA=:TEMA,IZMENENIYA=:izmen

WHERE NDOC=:NUM;

end

^

SET TERM; ^

Клиентская часть

unit Unit1;

interface

uses

Windows,RzLabel,RzCommon,Unit3,Unit4, DBCtrls, StdCtrls, Controls, Mask,

Grids, DBGrids, ComCtrls,

Classes, Messages, SysUtils, Variants, Graphics, Forms,

Dialogs,Unit2,Unit5,Unit6,Unit7, ExtCtrls, QuickRpt;

type

TForm1 = class(TForm)

PageControl1: TPageControl;

TabSheet1: TTabSheet;

TabSheet2: TTabSheet;

TabSheet3: TTabSheet;

TabSheet4: TTabSheet;

TabSheet5: TTabSheet;

TabSheet6: TTabSheet;

TabSheet7: TTabSheet;

DBGrid1: TDBGrid;

Edit1: TEdit;

Button1: TButton;

Edit2: TEdit;

Button2: TButton;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

DBEdit1: TDBEdit;

MaskEdit1: TMaskEdit;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

DBGrid2: TDBGrid;

MaskEdit2: TMaskEdit;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

ComboBox3: TComboBox;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

Label13: TLabel;

Label14: TLabel;

Label15: TLabel;

Label16: TLabel;

Label17: TLabel;

Button3: TButton;

DBEdit3: TDBEdit;

Label18: TLabel;

Button5: TButton;

DBGrid3: TDBGrid;

Edit3: TEdit;

Edit4: TEdit;

Label19: TLabel;

Label20: TLabel;

Label21: TLabel;

Button6: TButton;

DBEdit4: TDBEdit;

Label22: TLabel;

Button7: TButton;

Memo1: TMemo;

DBMemo1: TDBMemo;

Label23: TLabel;

Label24: TLabel;

Label25: TLabel;

Label26: TLabel;

Edit5: TEdit;

Edit6: TEdit;

ComboBox4: TComboBox;

Label27: TLabel;

Label28: TLabel;

Label29: TLabel;

Label30: TLabel;

Label31: TLabel;

Button4: TButton;

DBEdit2: TDBEdit;

Button8: TButton;

DBGrid4: TDBGrid;

DBGrid5: TDBGrid;

Button9: TButton;

Button10: TButton;

Button11: TButton;

Button12: TButton;

DBMemo2: TDBMemo;

Label32: TLabel;

DBEdit5: TDBEdit;

DBGrid6: TDBGrid;

Label33: TLabel;

Button13: TButton;

TabSheet8: TTabSheet;

DBGrid7: TDBGrid;

Button14: TButton;

Panel1: TPanel;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

Button15: TButton;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure MaskEdit2Change(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Edit5Change(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure Button9Click(Sender: TObject);

procedure Button11Click(Sender: TObject);

procedure Button10Click(Sender: TObject);

procedure Button12Click(Sender: TObject);

procedure Button13Click(Sender: TObject);

rocedure Button14Click(Sender: TObject);

procedure Button15Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var

s1: String;

s2: String;

s3: TDateTime;

begin

s1:= Edit1.Text;

s2:=AnsiUpperCase(Edit2.Text);

//s3:= StrToDateTime(MaskEdit1.Text);

if((s1='') or (s2='') or (s3=NULL))then

begin

ShowMessage('Проверьте заполнение всех полей');

exit;

end;

s3:= StrToDateTime(MaskEdit1.Text);

try

DM.DobavlenieIBSP.Prepare;

DM.DobavlenieIBSP.ParamByName('FAMILY').AsString:=s1;

DM.DobavlenieIBSP.ParamByName('LOGIN').AsString:=s2;

DM.DobavlenieIBSP.ParamByName('DATA').AsDateTime:=s3;

DM.DobavlenieIBSP.ExecProc;

DM.IBTransaction1.Commit;

DM.IBQuery1.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction1.Rollback;

end;

end;

procedure TForm1.FormCreate(Sender: TObject);

begin

MaskEdit1.Text:='xx.xx.xx';

Edit1.Text:='';

Edit2.Text:='';

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

try

DM.UdalenieDirIBSP.Prepare;

DM.UdalenieDirIBSP.ParamByName('FIO').AsString:=DBEdit1.Text;

DM.UdalenieDirIBSP.ExecProc;

DM.IBTransaction1.Commit;

DM.IBQuery1.Active:= true;

except

ShowMessage('Ошибка при удалении!!!');

DM.IBTransaction1.Rollback;

end;

end;

procedure TForm1.Button6Click(Sender: TObject);

begin

if((Edit3.Text='') or (Edit4.Text=''))then

begin

ShowMessage('Проверьте заполнение всех полей');

exit;

end;

try

DM.AddPodrIBSP.Prepare;

DM.AddPodrIBSP.ParamByName('NAZV').AsString:=Edit4.Text;

DM.AddPodrIBSP.ParamByName('FIO').AsString:=Edit3.Text;

DM.AddPodrIBSP.ExecProc;

DM.IBTransaction3.Commit;

DM.IBQuery3.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction3.Rollback;

end;

end;

procedure TForm1.Button7Click(Sender: TObject);

begin

try

DM.DeletePodrIBSP.Prepare;

DM.DeletePodrIBSP.ParamByName('Nomer').AsInteger:=StrToInt(DBEdit4.Text);

DM.DeletePodrIBSP.ExecProc;

DM.IBTransaction3.Commit;

DM.IBQuery3.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction3.Rollback;

end;

end;

procedure TForm1.MaskEdit2Change(Sender: TObject);

begin

//---фамилия проверяющего для таблицы "Проверки"------

Combobox1.Clear;

DM.IBQuery1.Last;

Combobox1.Items.add(DM.IBQuery1.FieldValues['FIO']);

//-----------------------------------------------------

 

//---проверяемое подразделение для таблицы "Проверки"------

Combobox2.Clear;

DM.IBQuery3.first;

while not DM.IBQuery3.Eof do

begin

Combobox2.Items.add(DM.IBQuery3.FieldValues['NAZVANIE']);

DM.IBQuery3.Next;

end;

//-----------------------------------------------------

//-----------------

Combobox3.Clear;

Combobox3.Items.Add('значительное');

Combobox3.Items.Add('незначительное');

//---------------

//DBRichEdit1.Field.Assign(DBRichEdit1.Lines);

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

if ((Combobox1.Text='')or(Combobox2.Text='')) then

begin

ShowMessage('Заполните обязательные для заполнения поля!!!');

exit;

end;

try

DM.InsertProverIBSP.Prepare;

DM.InsertProverIBSP.ParamByName('NAZVPODR').AsString:=Combobox2.Text;

DM.InsertProverIBSP.ParamByName('FIO').AsString:=Combobox1.Text;

DM.InsertProverIBSP.ParamByName('VID').AsString:=Combobox3.Text;

DM.InsertProverIBSP.ParamByName('DATA').AsDateTime:=StrToDateTime(MaskEdit2.Text);

DM.InsertProverIBSP.ParamByName('OPISANIE').AsString:=Memo1.Text;

DM.InsertProverIBSP.ExecProc;

DM.IBTransaction2.Commit;

DM.IBQuery2.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction2.Rollback;

end;

end;

procedure TForm1.Button5Click(Sender: TObject);

begin

try

if (DBEdit3.Text='') then

begin

 ShowMessage('В таблице отсутствуют записи!!!');

 exit;

end;

DM.DeleteProvIBSP.Prepare;

DM.DeleteProvIBSP.ParamByName('NPROVERKI').AsInteger:=StrToInt(DBEdit3.Text);

DM.DeleteProvIBSP.ExecProc;

DM.IBTransaction2.Commit;

DM.IBQuery2.Active:= true;

except

ShowMessage('Ошибка при удалении!!!');

DM.IBTransaction2.Rollback;

end;

end;

 

procedure TForm1.Edit5Change(Sender: TObject);

begin

//--подразделение к которому работник приписан для таблицы "Работники"---

Combobox4.Clear;

DM.IBQuery3.first;

while not DM.IBQuery3.Eof do

begin

Combobox4.Items.add(DM.IBQuery3.FieldValues['NAZVANIE']);

DM.IBQuery3.Next;

end;

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

if ((Edit5.Text='')or(Edit6.Text='')or(Combobox4.Text='')) then

begin

ShowMessage('Необходимо заполнить все поля!!!');

exit;

end;

try

DM.InsertRabotnikIBSP.Prepare;

DM.InsertRabotnikIBSP.ParamByName('NAZV').AsString:=Combobox4.Text;

DM.InsertRabotnikIBSP.ParamByName('FIO').AsString:=Edit5.Text;

DM.InsertRabotnikIBSP.ParamByName('LOGIN').AsString:=Edit6.Text;

DM.InsertRabotnikIBSP.ExecProc;

DM.IBTransaction4.Commit;

DM.RabotnikIBT.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction4.Rollback;

end;

end;

procedure TForm1.Button8Click(Sender: TObject);

begin

try

if (DBEdit2.Text='') then

begin

ShowMessage('В таблице отсутствуют записи!!!');

exit;

end;

DM.DeleteRabotnikIBSP.Prepare;

DM.DeleteRabotnikIBSP.ParamByName('NUM').AsInteger:=StrToInt(DBEdit2.Text);

DM.DeleteRabotnikIBSP.ExecProc;

DM.IBTransaction4.Commit;

DM.RabotnikIBT.Active:= true;

except

ShowMessage('Ошибка при удалении!!!');

DM.IBTransaction4.Rollback;

end;

end;

 

procedure TForm1.Button9Click(Sender: TObject);

begin

Form3.Show;

end;

procedure TForm1.Button11Click(Sender: TObject);

begin

Form3.Show;

end;

procedure TForm1.Button10Click(Sender: TObject);

begin

Form4.Show;

end;

procedure TForm1.Button12Click(Sender: TObject);

begin

Form5.Show;

end;

procedure TForm1.Button13Click(Sender: TObject);

begin

try

DM.ClearArhivIBSP.Prepare;

DM.ClearArhivIBSP.ExecProc;

DM.IBTransaction5.Commit;

DM.IBQuery6.Active:= true;

DM.IBQuery5.Active:= true;

DM.IBQuery7.Active:= true;

except

ShowMessage('Ошибка при удалении!!!');

DM.IBTransaction5.Rollback;

end;

end;

procedure TForm1.Button14Click(Sender: TObject);

begin

try

DM.ClearProtocolIBSP.Prepare;

DM.ClearProtocolIBSP.ExecProc;

DM.IBTransaction5.Commit;

DM.IBQuery7.Active:= true;

DM.IBQuery5.Active:= true;

except

ShowMessage('Ошибка при удалении!!!');

DM.IBTransaction5.Rollback;

end;

end;

procedure TForm1.Button15Click(Sender: TObject);

begin

if (RadioButton1.Checked) then Form6.QuickRep1.Preview;

if (RadioButton2.Checked) then Form7.QuickRep1.Preview;

end;

end.

procedure TForm3.Button1Click(Sender: TObject);

var

FileViewer: TRzURLLabel;

FileName: String;

begin

//создаем объект для просмотра файлов

FileViewer:=TRzURLLabel.Create(Form3);

FileName:= DBEdit1.Text;

FileViewer.URL:= FileName;

if FileExists(FileName) then

begin

FileViewer.Click;

end

else

begin

ShowMessage('Такого файла не существует или он не помещен в нужный каталог (см. инструкцию)');

exit;

end;

//------ ПРОТОКОЛ РАБОТЫ--------------------------------------

try

DM.ProtocolIBSP.Prepare;

DM.ProtocolIBSP.ParamByName('NUMDOC').AsInteger:=StrToInt(DBEdit2.Text);

DM.ProtocolIBSP.ExecProc;

DM.IBTransaction5.Commit;

DM.IBQuery7.Active:= true;

DM.IBQuery6.Active:= true;

DM.IBQuery5.Active:= true;

except

ShowMessage('Ошибка!!!');

DM.IBTransaction5.Rollback;

end;

//------------------------------------------------------------------

end;

procedure TForm3.Button2Click(Sender: TObject);

begin

if ((Memo1.Text='')) then

begin

ShowMessage('Необходимо заполнить поле "Характер изменений"!!!');

exit;

end;

try

DM.UpdateDocIBSP.Prepare;

DM.UpdateDocIBSP.ParamByName('NUM').AsInteger:=StrToInt(DBEdit2.Text);

DM.UpdateDocIBSP.ParamByName('TEMA').AsString:=DBEdit5.Text;

DM.UpdateDocIBSP.ParamByName('IZMEN').AsString:=Memo1.Text;

DM.UpdateDocIBSP.ExecProc;

DM.IBTransaction5.Commit;

DM.IBQuery5.Active:= true;

except

ShowMessage('Ошибка при обновлении!!!');

DM.IBTransaction5.Rollback;

end;

end;

end.

procedure TForm4.Button1Click(Sender: TObject);

var

s: String;

begin

SaveDialog1.Execute;

Edit1.Text:= SaveDialog1.FileName;

Combobox1.Clear;

Combobox1.Items.Add('внутренний');

Combobox1.Items.Add('нормативный');

end;

procedure TForm4.Button2Click(Sender: TObject);

begin

if ((Edit1.Text='')) then

begin

ShowMessage('Необходимо выбрать документ!!!');

exit;

end;

if ((Combobox1.Text='')or(Edit3.Text='')) then

begin

ShowMessage('Заполните обязательные для заполнения поля!!!');

exit;

end;

try

DM.InsertDocIBSP.Prepare;

DM.InsertDocIBSP.ParamByName('NKLASS').AsString:=Edit3.Text;

DM.InsertDocIBSP.ParamByName('TEMA').AsString:=Edit2.Text;

DM.InsertDocIBSP.ParamByName('VID').AsString:=Combobox1.Text;

DM.InsertDocIBSP.ParamByName('DATA').AsDateTime:=StrToDateTime(MaskEdit2.Text);

DM.InsertDocIBSP.ParamByName('NAME').AsString:=Edit1.Text;

DM.InsertDocIBSP.ExecProc;

DM.IBTransaction5.Commit;

DM.IBQuery5.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction5.Rollback;

end;

end;

procedure TForm5.Button1Click(Sender: TObject);

begin

try

DM.DeleteDocIBSP.Prepare;

DM.DeleteDocIBSP.ParamByName('NUM').AsInteger:=StrToInt(DBEdit2.Text);

DM.DeleteDocIBSP.ExecProc;

DM.IBTransaction5.Commit;

DM.IBQuery5.Active:= true;

DM.IBQuery6.Active:= true;

DM.IBQuery7.Active:= true;

except

ShowMessage('Ошибка при добавлении!!!');

DM.IBTransaction5.Rollback;

end;

end;


Список используемой литературы

1) Коннолли Т., Бегг К., Страчан А. Базы данных: проектирование, реализация сопровождение. Теория и практика: Уч пос.–М.: Издательский дом «Вильямс», 2000.

2) Дейт К. Введение в системы баз данных. – СПб: Издательский дом «Вильямс», 1999.

3) Фаронов В.В. Delphi7 и разработка приложений баз данных.– М.: «НОЛИДЖ», 2003.


[1] СМК – система менеджмента качества

Поделиться:





Воспользуйтесь поиском по сайту:



©2015 - 2024 megalektsii.ru Все авторские права принадлежат авторам лекционных материалов. Обратная связь с нами...