Розробка гнучкої системи автоматизації обліку імунобіологічних препаратів

Види інформаційних систем. Програмна реалізація гнучкої системи для автоматизованої реєстрації та обліку руху імунобіологічних препаратів в середовищі Delphi 6.0 з використанням технології доступу до баз даних ADO. Розрахунок витрат на розробку програми.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык украинский
Дата добавления 25.10.2012
Размер файла 3,2 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

Дана програма була створена за допомогою саме цієї мови програмування, що дозволило зробити зручний інтерфейс і автоматизувати виконання дій.

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

Система візуального програмування Delphi користується великою популярністю серед широкого круга користувачів: від програмістів, що починають, до досвідчених розробників, складних додатків, що займаються створенням і великих інформаційних систем.

СПИСОК ЛІТЕРАТУРИ

1. Бобровский С. Delphi 5 - СПб.: Питер, 2000

2. Гаевский А. Разработка программных приложений на Delphi 6 - М.: Киев, 2000.

3. Галисеев, Г.В. Программирование в среде Delphi 8 for.NET. Самоучитель. :- М.: Издательский дом "Вильяме", 2004.

4. Глинский Я.Н., Анохин В.Е., Ряжская В.А. Turbo Pascal 7.0 и Delphi. Учебное пособие. СПб.: ДиаСофтЮП, 2003. - 208 с.

5. Гофман В., Хомоненко А. Delphi 6. CПб.: БХВ-Петербург, 2004.

6. Грибачев К. Г. Delphi и Model Driven Architecture. Разработка приложений баз данных. - СПб.. Питер, 2004.

7. Грибачев К. Тонкие базы данных и инструменты для их разработки в Delphi и C++Builder. - КомпьютерПресс, 2003, №7, 8.

8. Дарахвелидзе П. Г., Марков Е. П. Delphi - среда визуального программирования. СПб.: BHV- Санкт-Петербург, 1999.-352с.

9. Елманова Н., Трепалин С., Тенцер А. Delphi 6 и технология COM. - CПб.: Питер, 2002. - 640 с.

10. Калверт Ч. Delphi 5. Энциклопедия пользователя. СПб.: ДиаСофтЮП, 2003.

11. Климова Л. М. "Delphi 7. Самоучитель. М.: ИД КУДИЦ-ОБРАЗ, 2005. - 480с.

12. Корняков В.Н. Программирование документов и приложений MS Office в Delphi. - CПб.: БХВ-Петербург, 2005. - 496 с.

13. Коцюбинский А.О., Грошев С.В. Язык программирования Delphi 5 - М.: "Издательство Триумф", 1999

14. Леонтьев В. Delphi 5 - М.: Москва "Олма-Пресс", 1999

15. Мадрел Тео. Разработка пользовательского интерфейса/ Пер. с англ.- М.:ДМК,2001.

16. Матросов А. В. и др. MS Office ХР: разработка приложений / Матросов А. В., Новиков Ф. А., Усаров Г. Е., Харитонова И. А. / Под ред. Ф. А. Новикова. - СПб.: БХВ-Петербург, 2003.

17. Немнюгин С.А. Программирование - CПб.: Питер, 2000.

18. Озеров В. Delphi. Советы программистов (2-е издание). - СПб.: Символ- Плюс, 2002.

19. Пономарев В. Самоучитель Delphi 7. CПб.: БХВ-Петербург, 2005.

20. Ревнич Ю. В. Нестандартные приемы программирования на Delphi. - СПб.: БХВ-Петербург, 2005.

21. Ремизов Н. Delphi - CПб.: Питер, 2000

22. Симонович С.В., Евсеев Г.А. Занимательное программирование: Delphi. - М.: АСТ-ПРЕСС Кнрга, 2001. - 368 с.

23. Фараонов В. Система программирования Delphi. CПб.: БХВ-Петербург, 2005.

24. Ханекамп Д.. Вилькен П. Программирование под Windows/ Пер. с нем. -М.: ЭКОМ, 1996.

25. Хомоненко А.Д Delphi 7. CПб.: БХВ-Петербург, 2005.-1216с. :ил.

26. http://www.dclphikingdom.info

27. http://www.delphiworld.narod.ru

28. http://www.delphirus.com.ru

ДОДАТОК

Вихідний текст модулів системи

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Menus, ComCtrls, ExtCtrls, ImgList,u_data_modul,registry;

type

Tmain = class(TForm)

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N6: TMenuItem;

N7: TMenuItem;

N3: TMenuItem;

N8: TMenuItem;

N9: TMenuItem;

N10: TMenuItem;

N4: TMenuItem;

N11: TMenuItem;

N13: TMenuItem;

ImageList1: TImageList;

N5: TMenuItem;

N12: TMenuItem;

N14: TMenuItem;

N15: TMenuItem;

N16: TMenuItem;

N17: TMenuItem;

N18: TMenuItem;

N19: TMenuItem;

N20: TMenuItem;

N21: TMenuItem;

N22: TMenuItem;

OpenDialog1: TOpenDialog;

SaveDialog1: TSaveDialog;

N23: TMenuItem;

procedure N3Click(Sender: TObject);

procedure N4Click(Sender: TObject);

procedure N7Click(Sender: TObject);

procedure N8Click(Sender: TObject);

procedure N9Click(Sender: TObject);

procedure N10Click(Sender: TObject);

procedure N2Click(Sender: TObject);

procedure N12Click(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure N13Click(Sender: TObject);

procedure N14Click(Sender: TObject);

procedure N15Click(Sender: TObject);

procedure N21Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure FormShow(Sender: TObject);

procedure N17Click(Sender: TObject);

procedure N23Click(Sender: TObject);

procedure N19Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

main: Tmain;

implementation

uses u_sp_type, u_pasp_pr, u_sp_c, u_sp_type_ob, U_sp_ob, u_sp_dil, u_oblik,

u_zalishki, u_spisati, U_password, U_users;

{$R *.dfm}

procedure Tmain.N3Click(Sender: TObject);

begin

sp_c.Panel1.Visible:=false;

sp_c.ShowModal

end;

procedure Tmain.N4Click(Sender: TObject);

begin

pasp_pr.ShowModal

end;

procedure Tmain.N7Click(Sender: TObject);

begin

sp_type.Panel1.Visible:=false;

sp_type.ShowModal

end;

procedure Tmain.N8Click(Sender: TObject);

begin

sp_type_ob.Panel1.Visible:=false;

sp_type_ob.ShowModal;

end;

procedure Tmain.N9Click(Sender: TObject);

begin

sp_ob.BitBtn1.Enabled:=false;

sp_ob.ShowModal;

end;

procedure Tmain.N10Click(Sender: TObject);

begin

sp_dil.Panel1.Visible:=false;

sp_dil.ShowModal;

end;

procedure Tmain.N2Click(Sender: TObject);

begin

oblik.ShowModal

end;

procedure Tmain.N12Click(Sender: TObject);

begin

if opendialog1.Execute then

basename:=OpenDialog1.FileName;

DataModule2.ADOConnection1.Connected:=false;

DataModule2.ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;'+'Data Source='+basename+';Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database="";';

DataModule2.ADOConnection1.ConnectionString:=DataModule2.ADOConnection1.ConnectionString+'Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;';

DataModule2.ADOConnection1.ConnectionString:=DataModule2.ADOConnection1.ConnectionString+'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;';

DataModule2.ADOConnection1.ConnectionString:=DataModule2.ADOConnection1.ConnectionString+'Jet OLEDB:Don''t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';

DataModule2.ADOConnection1.Connected:=true;

DataModule2.ADOTable1.Active:=true;

DataModule2.ADOTable2.Active:=true;

DataModule2.ADOTable3.Active:=true;

DataModule2.ADOTable4.Active:=true;

DataModule2.ADOTable5.Active:=true;

DataModule2.ADOTable6.Active:=true;

DataModule2.ADOTable7.Active:=true;

DataModule2.ADOQuery1.Active:=true;

DataModule2.ADOQuery2.Active:=true;

DataModule2.ADOQuery3.Active:=true;

DataModule2.ADOQuery4.Active:=true;

DataModule2.ADOQuery5.Active:=true;

DataModule2.ADOQuery6.Active:=true;

DataModule2.ADOQuery7.Active:=true;

end;

procedure Tmain.N13Click(Sender: TObject);

begin

zalishki.ShowModal

end;

procedure Tmain.N14Click(Sender: TObject);

begin

basename:=extractfilepath(application.ExeName)+'\baza.mdb';

with SaveDialog1 do

if Execute then

CopyFile(pchar(basename),pchar(filename),false);

end;

procedure Tmain.N15Click(Sender: TObject);

begin

close

end;

procedure Tmain.N21Click(Sender: TObject);

begin

spisati.ShowModal;

end;

procedure Tmain.FormClose(Sender: TObject; var Action: TCloseAction);

begin

reg:=tregistry.Create(key_write);

try

reg.RootKey:=HKEY_CURRENT_USER;

if reg.OpenKey('\software\vak\path',true)

then

reg.writeString('text',basename);

finally

reg.Free;

end;

end;

procedure Tmain.FormShow(Sender: TObject);

begin

password.ShowModal;

end;

procedure Tmain.N17Click(Sender: TObject);

begin

users.ShowModal;

end;

procedure Tmain.N23Click(Sender: TObject);

begin

password.ShowModal;

end;

procedure Tmain.N19Click(Sender: TObject);

begin

winhelp(main.Handle, 'help.hlp', HELP_CONTEXT, 1);

end;

end.

unit u_data_modul;

interface

uses

SysUtils, Classes, DB, ADODB,Messages,Windows,registry;

type

TDataModule2 = class(TDataModule)

ADOConnection1: TADOConnection;

ADOTable1: TADOTable;

ADOTable2: TADOTable;

ADOTable1kod_type_pr: TAutoIncField;

ADOTable1naz_type: TWideStringField;

ADOTable1n_inf: TWideStringField;

ADOTable2kod_pr: TAutoIncField;

ADOTable2kod_type_pr: TIntegerField;

ADOTable2seria: TWideStringField;

ADOTable2kontr_n: TIntegerField;

ADOTable2vol_d: TIntegerField;

ADOTable2vimir_d: TBooleanField;

ADOTable2kol_d: TIntegerField;

ADOTable2note: TWideStringField;

ADOTable2kod_vir: TIntegerField;

DataSource1: TDataSource;

DataSource2: TDataSource;

ADOTable3: TADOTable;

DataSource3: TDataSource;

ADOTable3kod_c: TAutoIncField;

ADOTable3country: TWideStringField;

ADOQuery1: TADOQuery;

ADOQuery1seria: TWideStringField;

ADOQuery1kontr_n: TIntegerField;

ADOQuery1vol_d: TIntegerField;

ADOQuery1vimir_d: TBooleanField;

ADOQuery1kol_d: TIntegerField;

ADOQuery1date_vip: TDateTimeField;

ADOQuery1termin_pr: TDateTimeField;

ADOQuery1country: TWideStringField;

DataSource4: TDataSource;

ADOQuery1note: TWideStringField;

ADOQuery1kod_type_pr: TIntegerField;

ADOQuery1kod_pr: TAutoIncField;

ADOQuery2: TADOQuery;

ADOQuery2naz_type: TWideStringField;

ADOTable4: TADOTable;

DataSource5: TDataSource;

ADOTable4kod_type_ob: TAutoIncField;

ADOTable4type_obj: TWideStringField;

ADOTable5: TADOTable;

ADOTable5kod_ob: TAutoIncField;

ADOTable5kod_type_obj: TIntegerField;

ADOTable5nazva: TWideStringField;

ADOTable5adresa: TWideStringField;

DataSource6: TDataSource;

ADOQuery3: TADOQuery;

ADOTable6: TADOTable;

ADOTable6kod_dil: TAutoIncField;

ADOTable6prizv_lik: TWideStringField;

DataSource7: TDataSource;

ADOTable6nomer: TIntegerField;

ADOTable5kod_dil: TIntegerField;

ADOTable5pib_k: TWideStringField;

ADOTable5tel: TWideStringField;

DataSource8: TDataSource;

ADOQuery3nazva: TWideStringField;

ADOQuery3adresa: TWideStringField;

ADOQuery3nomer: TIntegerField;

ADOQuery3kod_ob: TAutoIncField;

ADOQuery3kod_type_obj: TIntegerField;

ADOQuery3kod_dil: TIntegerField;

ADOQuery4: TADOQuery;

ADOQuery4type_obj: TWideStringField;

ADOTable7: TADOTable;

ADOTable7kod_z: TAutoIncField;

ADOTable7date_v: TDateTimeField;

ADOTable7priznak: TBooleanField;

ADOTable7kod_ob: TIntegerField;

ADOTable7kilkist: TIntegerField;

ADOTable7lpu: TBooleanField;

ADOTable7spisano: TBooleanField;

DataSource9: TDataSource;

ADOTable7kod_pr: TIntegerField;

ADOQuery5: TADOQuery;

DataSource10: TDataSource;

ADOQuery3pib_k: TWideStringField;

ADOQuery3tel: TWideStringField;

ADOQuery6: TADOQuery;

ADOQuery5seria: TWideStringField;

ADOQuery5termin_pr: TDateTimeField;

ADOQuery5date_v: TDateTimeField;

ADOQuery5priznak: TBooleanField;

ADOQuery5kilkist: TIntegerField;

ADOQuery5k_pr: TFloatField;

ADOQuery5k_ras_ob: TFloatField;

ADOQuery5lpu: TBooleanField;

ADOQuery5spisano: TBooleanField;

ADOQuery5kod_pr: TIntegerField;

ADOQuery5k_spis: TFloatField;

ADOQuery5k_lpu: TFloatField;

ADOQuery5kod_z: TAutoIncField;

ADOTable2zalishok: TIntegerField;

ADOTable2date_vip: TDateTimeField;

ADOTable2termin_pr: TDateTimeField;

ADOQuery6seria: TWideStringField;

ADOQuery6kontr_n: TIntegerField;

ADOQuery6naz_type: TWideStringField;

ADOQuery6n_inf: TWideStringField;

DataSource11: TDataSource;

ADOQuery6zalishok: TIntegerField;

ADOQuery7: TADOQuery;

ADOQuery7seria: TWideStringField;

ADOQuery7kontr_n: TIntegerField;

ADOQuery7date_vip: TDateTimeField;

ADOQuery7termin_pr: TDateTimeField;

ADOQuery7zalishok: TIntegerField;

ADOQuery7naz_type: TWideStringField;

ADOQuery7n_inf: TWideStringField;

DataSource12: TDataSource;

ADOQuery7kod_pr: TAutoIncField;

procedure DataModuleCreate(Sender: TObject);

procedure ADOQuery1AfterScroll(DataSet: TDataSet);

procedure ADOQuery3AfterScroll(DataSet: TDataSet);

procedure ADOQuery5CalcFields(DataSet: TDataSet);

private

{ Private declarations }

public

{ Public declarations }

end;

var

DataModule2: TDataModule2;

basename,n_pr,n_ob:ansistring;

reg:tregistry;

implementation

uses u_pasp_pr, U_sp_ob, u_oblik;

{$R *.dfm}

procedure TDataModule2.DataModuleCreate(Sender: TObject);

begin

reg:=tregistry.Create(key_read);

try

reg.RootKey:=HKEY_CURRENT_USER;

if reg.OpenKey('\software\vak\path',false)

then

basename:=reg.ReadString('text');

ADOConnection1.Connected:=false;

ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;'+'Data Source='+basename+';Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database="";';

ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+'Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;';

ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;';

ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+'Jet OLEDB:Don''t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';

ADOConnection1.Connected:=true;

except

basename:='.\baza.mdb';

ADOConnection1.Connected:=false;

ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;'+'Data Source='+basename+';Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database="";';

ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+'Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;';

ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+'Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;';

ADOConnection1.ConnectionString:=ADOConnection1.ConnectionString+'Jet OLEDB:Don''t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False';

ADOConnection1.Connected:=true;

end;

reg.Free;

ADOTable1.Active:=true;

ADOTable2.Active:=true;

ADOTable3.Active:=true;

ADOTable4.Active:=true;

ADOTable5.Active:=true;

ADOTable6.Active:=true;

ADOTable7.Active:=true;

ADOQuery1.Active:=true;

ADOQuery2.Active:=true;

ADOQuery3.Active:=true;

ADOQuery4.Active:=true;

ADOQuery5.Active:=true;

ADOQuery6.Active:=true;

ADOQuery7.Active:=true;

ADOTable3.Sort:='country';

end;

procedure TDataModule2.ADOQuery1AfterScroll(DataSet: TDataSet);

begin

ADOTable1.Locate('kod_type_pr',ADOquery1kod_type_pr.AsInteger,[]);

n_pr:=ADOTable1naz_type.AsString;

pasp_pr.Label1.Caption:='Вид препарату - '+n_pr;

end;

procedure TDataModule2.ADOQuery3AfterScroll(DataSet: TDataSet);

begin

ADOTable4.Locate('kod_type_ob',ADOquery3kod_type_obj.AsInteger,[]);

n_ob:=ADOTable4type_obj.AsString;

sp_ob.Label3.Caption:='Тип об''єкту - '+n_ob;

end;

procedure TDataModule2.ADOQuery5CalcFields(DataSet: TDataSet);

begin

if not ADOQuery5priznak.AsBoolean then

ADOQuery5k_pr.AsFloat:=ADOQuery5kilkist.AsFloat

else if ADOQuery5lpu.AsBoolean then

ADOQuery5k_lpu.AsFloat:=ADOQuery5kilkist.AsFloat else

if ADOQuery5spisano.asboolean then

ADOQuery5k_spis.AsFloat:=ADOQuery5kilkist.AsFloat else

ADOQuery5k_ras_ob.AsFloat:=ADOQuery5kilkist.AsFloat;

end;

end.

unit u_oblik;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, DBGrids, ComCtrls,comobj;

type

Toblik = class(TForm)

Panel1: TPanel;

BitBtn1: TBitBtn;

DBGrid1: TDBGrid;

BitBtn3: TBitBtn;

BitBtn2: TBitBtn;

SpeedButton1: TSpeedButton;

Panel2: TPanel;

Label1: TLabel;

DateTimePicker1: TDateTimePicker;

DateTimePicker2: TDateTimePicker;

SpeedButton2: TSpeedButton;

Label2: TLabel;

Label3: TLabel;

procedure BitBtn1Click(Sender: TObject);

procedure DBGrid1DblClick(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

oblik: Toblik;

w,table,myrange:variant;

implementation

uses U_oblik_vvod, u_data_modul, u_pasp_pr;

{$R *.dfm}

procedure Toblik.BitBtn1Click(Sender: TObject);

begin

datamodule2.ADOTable7.Insert;

oblik_vvod.SpeedButton1.Enabled:=false;

oblik_vvod.RadioGroup2.Enabled:=false;

oblik_vvod.RadioGroup1.ItemIndex:=-1;

oblik_vvod.RadioGroup2.ItemIndex:=-1;

oblik_vvod.SpeedButton2.Enabled:=false;

oblik_vvod.DBEdit1.Enabled:=false;

oblik_vvod.Caption:='Додавання запису';

oblik_vvod.Edit1.Text:='';

oblik_vvod.Edit2.Text:='';

oblik_vvod.DateTimePicker1.Date:=date;

oblik_vvod.RadioGroup1.Enabled:=true;

oblik_vvod.ShowModal;

end;

procedure Toblik.DBGrid1DblClick(Sender: TObject);

begin

oblik_vvod.Edit1.Text:='';

DataModule2.ADOTable7.Locate('kod_z', DataModule2.adoquery5kod_z.asinteger,[]);

DataModule2.ADOTable7.Edit;

oblik_vvod.DateTimePicker1.Date:=DataModule2.ADOQuery5date_v.AsDateTime;

if not DataModule2.ADOQuery5priznak.AsBoolean then

begin

oblik_vvod.RadioGroup1.ItemIndex:=0;

oblik_vvod.Edit1.Enabled:=true;

end

else

begin

oblik_vvod.RadioGroup2.Enabled:=true;

oblik_vvod.RadioGroup1.ItemIndex:=1;

if DataModule2.ADOQuery5lpu.AsBoolean then

oblik_vvod.RadioGroup2.ItemIndex:=1

else if DataModule2.ADOQuery5spisano.AsBoolean then

oblik_vvod.RadioGroup2.ItemIndex:=2 else

begin

oblik_vvod.RadioGroup2.ItemIndex:=0;

DataModule2.ADOTable5.Locate('kod_ob',DataModule2.ADOTable7kod_ob.AsInteger,[]);

oblik_vvod.Edit1.Text:=DataModule2.ADOTable5nazva.AsString;

end;

end;

DataModule2.ADOQuery1.Locate('kod_pr',DataModule2.ADOQuery5kod_pr.AsInteger,[]);

oblik_vvod.Edit2.Text:=pasp_pr.label1.Caption+ ' серії '+ DataModule2.ADOQuery1seria.AsString;

oblik_vvod.Caption:='Редагування запису';

oblik_vvod.ShowModal;

end;

procedure Toblik.BitBtn3Click(Sender: TObject);

begin

DataModule2.ADOTable7.Locate('kod_z', DataModule2.adoquery5kod_z.asinteger,[]);

DataModule2.ADOTable7.Delete;

DataModule2.ADOQuery5.Close;

DataModule2.ADOQuery5.Open;

end;

procedure Toblik.SpeedButton1Click(Sender: TObject);

begin

Panel2.Visible:= SpeedButton1.Down;

SpeedButton2.Down:= SpeedButton1.Down;

SpeedButton2Click(sender);

end;

procedure Toblik.SpeedButton2Click(Sender: TObject);

begin

if SpeedButton2.Down then

begin

DataModule2.ADOQuery5.Filter:='date_v>='+''''+datetostr(DateTimePicker1.date)+''''+' and ' +'date_v<='+''''+DATETOSTR(DateTimePicker2.date)+'''';

DataModule2.ADOQuery5.Filtered:=true;

end else DataModule2.ADOQuery5.Filtered:=false;

end;

procedure Toblik.BitBtn2Click(Sender: TObject);

const

wdalignPageNumberRight=1;

var i,j,k:integer;

mypagenumber:variant;

mypagenumbers:variant;

mysection:variant;

s:string;

begin

w:=createoleobject('word.application');

w.documents.add;

w.activewindow.activepane.view.zoom.percentage:=100;

mysection:=w.activedocument.range.sections.item(1);

mypagenumbers:=mysection.headers.item(1).pagenumbers;

mypagenumber:=mysection.headers.item(1).pagenumbers.add(pagenumberalignment:=wdalignPageNumberRight,firstpage:=true);

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

myrange.paragraphformat.alignment:=1;

myrange.select;

w.selection.font.bold:=1;

w.selection.font.underline:=1;

w.activedocument.range.insertafter('Журнал обліку та використання імунобіологічних препаратів');

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

if SpeedButton2.Down then

begin

DataModule2.ADOQuery5.Filter:='date_v>='+''''+datetostr(DateTimePicker1.date)+''''+' and ' +'date_v<='+''''+DATETOSTR(DateTimePicker2.date)+'''';

DataModule2.ADOQuery5.Filtered:=true;

end else DataModule2.ADOQuery5.Filtered:=false;

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

w.activedocument.tables.add(range:=myrange,numrows:=1,numcolumns:=7);

table:=w.activedocument.tables.item(j+1);

table.AutoFormat(Format:=20,

ApplyBorders:=true,

ApplyShading:=false,

ApplyFont:=false,

ApplyColor:=false,

ApplyHeadingRows:= false,

ApplyLastRow:=false,

ApplyFirstColumn:= false,

ApplyLastColumn:=false,

AutoFit:=false);

table.rows.item(1).range.paragraphformat.alignment:=1;

table.rows.item(1).shading.backgroundpatterncolorindex:=16;

table.rows.item(1).select;

w.selection.font.bold:=1;

w.selection.font.underline:=0;

table.Columns.Item(1).select;

for i:=1 to table.columns.count do //формування заголовків

case i of

1: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Дата';

end;

2: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Серія';

end;

3: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Термін пр.';

end;

4: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Отримано';

end;

5: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Видано на об.';

end;

6: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Використ. в ЛПУ';

end;

7: begin

table.columns.item(i).width:=70;

table.cell(1,i).range.text:='Списано';

end;

end;

table.rows.add;

table.rows.item(2).shading.backgroundpatterncolorindex:=0;

table.rows.item(2).select;

table.rows.item(2).range.paragraphformat.alignment:=3;

w.selection.font.bold:=0;

k:=2;

with DataModule2 do

while not ADOQuery5.eof do

begin

table.cell(ADOQuery5.recno+1,1).range.text:=datetostr(ADOQuery5date_v.asdatetime);

table.cell(ADOQuery5.recno+1,2).range.text:=adoquery5seria.asstring;

table.cell(ADOQuery5.recno+1,3).range.text:=datetostr(adoquery5termin_pr.asdatetime);;

table.cell(ADOQuery5.recno+1,4).range.text:=adoquery5k_pr.asfloat;

table.cell(ADOQuery5.recno+1,5).range.text:=adoquery5k_ras_ob.asfloat;

table.cell(ADOQuery5.recno+1,6).range.text:=adoquery5k_lpu.asfloat;

table.cell(ADOQuery5.recno+1,7).range.text:=adoquery5k_spis.asfloat;;

k:=k+1;

ADOQuery5.next;

table.rows.add;

end;

table.rows.item(k).delete;

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

w.visible:=true;

end;

end.

unit U_oblik_vvod;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ComCtrls, StdCtrls, Buttons, ExtCtrls, Mask, DBCtrls,u_data_modul;

type

Toblik_vvod = class(TForm)

Label1: TLabel;

Panel1: TPanel;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

DateTimePicker1: TDateTimePicker;

RadioGroup1: TRadioGroup;

Label2: TLabel;

SpeedButton1: TSpeedButton;

Edit1: TEdit;

Label3: TLabel;

DBEdit1: TDBEdit;

RadioGroup2: TRadioGroup;

Label4: TLabel;

SpeedButton2: TSpeedButton;

Edit2: TEdit;

procedure FormCreate(Sender: TObject);

procedure RadioGroup1Click(Sender: TObject);

procedure RadioGroup2Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Edit2KeyPress(Sender: TObject; var Key: Char);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

private

{ Private declarations }

public

{ Public declarations }

end;

var

oblik_vvod: Toblik_vvod;

implementation

uses U_sp_ob, u_pasp_pr;

{$R *.dfm}

procedure Toblik_vvod.FormCreate(Sender: TObject);

begin

DateTimePicker1.Date:=date;

end;

procedure Toblik_vvod.RadioGroup1Click(Sender: TObject);

begin

RadioGroup2.ItemIndex:=-1;

DBEdit1.Enabled:=true;

SpeedButton2.Enabled:=true;

if RadioGroup1.ItemIndex=1 then

RadioGroup2.Enabled:=true else

begin

RadioGroup2.Enabled:=false ;

SpeedButton1.Enabled:=false;

Edit1.Text:='';

DataModule2.ADOTable7kod_ob.AsInteger:=0;

end;

end;

procedure Toblik_vvod.RadioGroup2Click(Sender: TObject);

begin

if RadioGroup2.ItemIndex=0 then

begin

SpeedButton1.Enabled:=true;

Edit1.Enabled:=true;

end

else

begin

Edit1.Text:='';

SpeedButton1.Enabled:=false;

Edit1.Enabled:=false;

end;

end;

procedure Toblik_vvod.BitBtn1Click(Sender: TObject);

begin

if (DataModule2.ADOTable7kod_pr.AsInteger=0) or (DataModule2.ADOTable7kilkist.AsFloat=0)

or ((RadioGroup2.ItemIndex=-1) and (RadioGroup1.ItemIndex=1))

then exit;

DataModule2.ADOTable7date_v.AsDateTime:=datetimepicker1.date;

if RadioGroup1.ItemIndex=0 then

DataModule2.ADOTable7priznak.AsBoolean:=false

else DataModule2.ADOTable7priznak.AsBoolean:=true;

if RadioGroup2.ItemIndex=0 then

begin

DataModule2.ADOTable7lpu.AsBoolean:=false;

DataModule2.ADOTable7spisano.AsBoolean:=false

end else if RadioGroup2.ItemIndex=1 then

begin

DataModule2.ADOTable7lpu.AsBoolean:=true;

DataModule2.ADOTable7spisano.AsBoolean:=false;

end else

begin

DataModule2.ADOTable7lpu.AsBoolean:=false;

DataModule2.ADOTable7spisano.AsBoolean:=true;

end;

DataModule2.ADOTable7.Post;

DataModule2.ADOQuery5.Close;

DataModule2.ADOQuery5.Open;

if not DataModule2.ADOTable7priznak.AsBoolean then

begin DataModule2.ADOTable2.Edit;

if RadioGroup1.ItemIndex=0 then

DataModule2.ADOTable2zalishok.AsFloat:= DataModule2.ADOTable2zalishok.AsFloat+DataModule2.ADOTable7kilkist.AsFloat

else

DataModule2.ADOTable2zalishok.AsFloat:= DataModule2.ADOTable2zalishok.AsFloat-DataModule2.ADOTable7kilkist.AsFloat;

DataModule2.ADOTable2.Post;

end

else begin

DataModule2.ADOTable2.Edit;

DataModule2.ADOTable2zalishok.AsFloat:= DataModule2.ADOTable2zalishok.AsFloat-DataModule2.ADOTable7kilkist.AsFloat;

if DataModule2.ADOTable2zalishok.AsFloat<0 then begin

showmessage('Препарат '+Edit2.Text+' у потрібній кількості відсутній!');

exit end

else DataModule2.ADOTable2.Post;

end;

DataModule2.ADOQuery7.Close;

DataModule2.ADOQuery7.Open;

close;

end;

procedure Toblik_vvod.BitBtn2Click(Sender: TObject);

begin

close

end;

procedure Toblik_vvod.SpeedButton1Click(Sender: TObject);

begin

sp_ob.BitBtn1.Enabled:=true;

sp_ob.ShowModal;

end;

procedure Toblik_vvod.SpeedButton2Click(Sender: TObject);

begin

pasp_pr.BitBtn4.Enabled:=true;

pasp_pr.ShowModal;

end;

procedure Toblik_vvod.FormClose(Sender: TObject; var Action: TCloseAction);

begin

RadioGroup2.Enabled:=false;

Edit1.Enabled:=false;

end;

procedure Toblik_vvod.Edit2KeyPress(Sender: TObject; var Key: Char);

begin

key:=#0

end;

procedure Toblik_vvod.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

key:=#0

end;

end.

unit u_pasp_pr;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, Grids, DBGrids, StdCtrls, Buttons, comobj;

type

Tpasp_pr = class(TForm)

DBGrid1: TDBGrid;

Panel1: TPanel;

BitBtn1: TBitBtn;

Panel2: TPanel;

BitBtn2: TBitBtn;

Label1: TLabel;

BitBtn3: TBitBtn;

Label2: TLabel;

ComboBox1: TComboBox;

CheckBox1: TCheckBox;

BitBtn4: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

procedure DBGrid1DblClick(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure FormShow(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

procedure CheckBox1Click(Sender: TObject);

procedure BitBtn4Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

pasp_pr: Tpasp_pr;

w,table,myrange:variant;

implementation

uses u_pasp_pr_vvod, u_data_modul, U_oblik_vvod;

{$R *.dfm}

procedure Tpasp_pr.BitBtn1Click(Sender: TObject);

begin

datamodule2.ADOTable2.Insert;

pasp_pr_vvod.Caption:='Додавання запису';

pasp_pr_vvod.Edit1.Text:='';

pasp_pr_vvod.Edit2.Text:='';

pasp_pr_vvod.ShowModal;

end;

procedure Tpasp_pr.DBGrid1DblClick(Sender: TObject);

begin

with DataModule2 do

begin

ADOTable2.Locate('kod_pr',ADOQuery1kod_pr.AsInteger,[]);

ADOTable2.Edit;

end;

with pasp_pr_vvod do

begin

Caption:='Редагування запису';

Edit1.Text:=DataModule2.ADOQuery1country.AsString;

Edit2.Text:=n_pr;

DateTimePicker1.Date:=DataModule2.ADOQuery1date_vip.AsDateTime;

DateTimePicker2.Date:=DataModule2.ADOQuery1termin_pr.AsDateTime;

ShowModal;

end;

end;

procedure Tpasp_pr.BitBtn3Click(Sender: TObject);

begin

with DataModule2 do

begin

ADOTable2.Delete;

ADOQuery1.Close;

ADOQuery1.Open;

end;

end;

procedure Tpasp_pr.FormShow(Sender: TObject);

begin

ComboBox1.Items.Clear;

DataModule2.ADOQuery2.First;

while not DataModule2.ADOQuery2.Eof do

begin

ComboBox1.Items.Add(DataModule2.ADOQuery2naz_type.AsString);

DataModule2.ADOQuery2.Next;

end;

end;

procedure Tpasp_pr.ComboBox1Change(Sender: TObject);

begin

with DataModule2 do

begin

ADOQuery1.Close;

ADOQuery1.SQL.Clear;

ADOQuery1.SQL.Add('select p.kod_pr,p.kod_type_pr,p.seria, p.kontr_n, p.vol_d, p.vimir_d, p.kol_d, p.date_vip, p.termin_pr,c.country, p.note from pasport_pr p left join sp_country c on c.kod_c=p.kod_vir where p.kod_type_pr=(select kod_type_pr from sp_type_pr where naz_type='+''''+ComboBox1.Text+''''+')');

ADOQuery1.Open;

end;

CheckBox1.Checked:=False;

end;

procedure Tpasp_pr.CheckBox1Click(Sender: TObject);

begin

if CheckBox1.Checked then

with DataModule2 do

begin

ADOQuery1.Close;

ADOQuery1.SQL.Clear;

ADOQuery1.SQL.Add('select p.kod_pr,p.kod_type_pr,p.seria, p.kontr_n, p.vol_d, p.vimir_d, p.kol_d, p.date_vip, p.termin_pr,c.country, p.note from pasport_pr p left join sp_country c on c.kod_c=p.kod_vir');

ADOQuery1.Open;

end

else ComboBox1Change(Sender);

end;

procedure Tpasp_pr.BitBtn4Click(Sender: TObject);

begin

DataModule2.ADOTable7kod_pr.AsInteger:= DataModule2.ADOQuery1kod_pr.AsInteger;

oblik_vvod.Edit2.Text:=label1.Caption+ ' серії '+ DataModule2.ADOQuery1seria.AsString;

close;

end;

procedure Tpasp_pr.BitBtn2Click(Sender: TObject);

const

wdalignPageNumberRight=1;

var i,j,k:integer;

mypagenumber:variant;

mypagenumbers:variant;

mysection:variant;

s:string;

begin

w:=createoleobject('word.application');

w.documents.add;

w.activewindow.activepane.view.zoom.percentage:=100;

mysection:=w.activedocument.range.sections.item(1);

mypagenumbers:=mysection.headers.item(1).pagenumbers;

mypagenumber:=mysection.headers.item(1).pagenumbers.add(pagenumberalignment:=wdalignPageNumberRight,firstpage:=true);

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

myrange.paragraphformat.alignment:=1;

myrange.select;

w.selection.font.bold:=1;

w.selection.font.underline:=1;

w.activedocument.range.insertafter('Паспортні дані препаратів');

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

if CheckBox1.Checked then

k:=ComboBox1.Items.Count-1 else begin k:=0;

s:=combobox1.text;

end;

for j:=0 to k do

begin

with DataModule2 do

begin

ADOQuery1.Close;

ADOQuery1.SQL.Clear;

if CheckBox1.Checked then

s:=ComboBox1.Items[j];

ADOQuery1.SQL.Add('select p.kod_pr,p.kod_type_pr,p.seria, p.kontr_n, p.vol_d, p.vimir_d, p.kol_d, p.date_vip, p.termin_pr,c.country, p.note from pasport_pr p left join sp_country c on c.kod_c=p.kod_vir where p.kod_type_pr=(select kod_type_pr from sp_type_pr where naz_type='+''''+s+''''+')');

ADOQuery1.Open;

end;

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

myrange.paragraphformat.alignment:=1;

myrange.select;

w.selection.font.underline:=0;

w.selection.font.bold:=1;

w.activedocument.range.insertafter(s);

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

w.activedocument.tables.add(range:=myrange,numrows:=1,numcolumns:=7);

table:=w.activedocument.tables.item(j+1);

table.AutoFormat(Format:=20,

ApplyBorders:=true,

ApplyShading:=false,

ApplyFont:=false,

ApplyColor:=false,

ApplyHeadingRows:= false,

ApplyLastRow:=false,

ApplyFirstColumn:= false,

ApplyLastColumn:=false,

AutoFit:=false);

table.rows.item(1).range.paragraphformat.alignment:=1;

table.rows.item(1).shading.backgroundpatterncolorindex:=16;

table.rows.item(1).select;

w.selection.font.bold:=1;

table.Columns.Item(1).select;

for i:=1 to table.columns.count do //формування заголовків

case i of

1: begin

table.columns.item(i).width:=45;

table.cell(1,i).range.text:='№п/п';

end;

2: begin

table.columns.item(i).width:=55;

table.cell(1,i).range.text:='Серія';

end;

3: begin

table.columns.item(i).width:=50;

table.cell(1,i).range.text:='Контр.№';

end;

4: begin

table.columns.item(i).width:=50;

table.cell(1,i).range.text:='Фасув.';

end;

5: begin

table.columns.item(i).width:=100;

table.cell(1,i).range.text:='Країна-виробн.';

end;

6: begin

table.columns.item(i).width:=100;

table.cell(1,i).range.text:='Дата випуску';

end;

7: begin

table.columns.item(i).width:=100;

table.cell(1,i).range.text:='Термін збер.';

end;

end;

table.rows.add;

table.rows.item(2).shading.backgroundpatterncolorindex:=0;

table.rows.item(2).select;

table.rows.item(2).range.paragraphformat.alignment:=3;

w.selection.font.bold:=0;

k:=2;

with DataModule2 do

while not ADOQuery1.eof do

begin

table.cell(ADOQuery1.recno+1,1).range.text:=inttostr(k-1);

table.cell(ADOQuery1.recno+1,2).range.text:=adoquery1seria.asstring;

table.cell(ADOQuery1.recno+1,3).range.text:=adoquery1kontr_n.asinteger;

table.cell(ADOQuery1.recno+1,4).range.text:=adoquery1kol_d.asfloat;

table.cell(ADOQuery1.recno+1,5).range.text:=adoquery1country.asstring;

table.cell(ADOQuery1.recno+1,6).range.text:=datetostr(adoquery1date_vip.asdatetime);

table.cell(ADOQuery1.recno+1,7).range.text:=datetostr(adoquery1termin_pr.asdatetime);

k:=k+1;

ADOQuery1.next;

table.rows.add;

end;

table.rows.item(k).delete;

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

end;

w.visible:=true;

checkbox1.checked:=true;

CheckBox1Click(Sender);

end;

end.

unit u_pasp_pr_vvod;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, u_data_modul, StdCtrls, Mask, DBCtrls, ExtCtrls, Buttons,

ComCtrls;

type

Tpasp_pr_vvod = class(TForm)

DBEdit1: TDBEdit;

Panel1: TPanel;

Label1: TLabel;

Label2: TLabel;

DBEdit2: TDBEdit;

Label3: TLabel;

DBEdit3: TDBEdit;

Label4: TLabel;

ComboBox1: TComboBox;

Label5: TLabel;

Label6: TLabel;

DBEdit4: TDBEdit;

Label7: TLabel;

SpeedButton1: TSpeedButton;

Label8: TLabel;

Label9: TLabel;

DateTimePicker1: TDateTimePicker;

DateTimePicker2: TDateTimePicker;

Label10: TLabel;

DBEdit5: TDBEdit;

Label11: TLabel;

BitBtn1: TBitBtn;

Edit1: TEdit;

Label12: TLabel;

BitBtn2: TBitBtn;

SpeedButton2: TSpeedButton;

Edit2: TEdit;

procedure SpeedButton1Click(Sender: TObject);

procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);

procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);

procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);

procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure SpeedButton2Click(Sender: TObject);

procedure Edit2KeyPress(Sender: TObject; var Key: Char);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

private

{ Private declarations }

public

{ Public declarations }

end;

var

pasp_pr_vvod: Tpasp_pr_vvod;

f:boolean;

implementation

uses u_sp_c, DB, u_sp_type;

{$R *.dfm}

procedure Tpasp_pr_vvod.SpeedButton1Click(Sender: TObject);

begin

sp_c.Panel1.Visible:=true;

sp_c.ShowModal

end;

procedure Tpasp_pr_vvod.DBEdit1KeyPress(Sender: TObject; var Key: Char);

begin

if Key=#13 then DBEdit2.SetFocus

end;

procedure Tpasp_pr_vvod.DBEdit2KeyPress(Sender: TObject; var Key: Char);

begin

if Key=#13 then DBEdit3.SetFocus

end;

procedure Tpasp_pr_vvod.DBEdit3KeyPress(Sender: TObject; var Key: Char);

begin

if Key=#13 then

begin ComboBox1.DroppedDown:=true; ComboBox1.SetFocus; end;

end;

procedure Tpasp_pr_vvod.ComboBox1KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then DBEdit4.SetFocus

end;

procedure Tpasp_pr_vvod.DBEdit4KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then SpeedButton1Click(Sender);

end;

procedure Tpasp_pr_vvod.BitBtn1Click(Sender: TObject);

begin

DataModule2.ADOTable2date_vip.AsDateTime:=datetimepicker1.date;

DataModule2.ADOTable2termin_pr.AsDateTime:=DateTimePicker2.Date;

if ComboBox1.ItemIndex=0 then

DataModule2.ADOTable2vimir_d.AsBoolean:=true

else DataModule2.ADOTable2vimir_d.AsBoolean:=false;

DataModule2.ADOTable2kod_vir.AsInteger:=DataModule2.adotable3kod_c.AsInteger;

DataModule2.ADOTable2.Post;

DataModule2.ADOQuery1.Close;

DataModule2.ADOQuery1.Open;

close;

end;

procedure Tpasp_pr_vvod.BitBtn2Click(Sender: TObject);

begin

close

end;

procedure Tpasp_pr_vvod.SpeedButton2Click(Sender: TObject);

begin

f:=true;

sp_type.Panel1.Visible:=true;

sp_type.ShowModal;

end;

procedure Tpasp_pr_vvod.Edit2KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then key:=#0;

end;

procedure Tpasp_pr_vvod.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then key:=#0;

end;

end.

unit U_password;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons,registry;

type

Tpassword = class(TForm)

ComboBox1: TComboBox;

Label2: TLabel;

Label1: TLabel;

Edit1: TEdit;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure Edit1KeyPress(Sender: TObject; var Key: Char);

procedure FormShow(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

password: Tpassword;

reg:tregistry;

fl:boolean;

log,pas:array[1..20] of string;

implementation

uses Unit1;

{$R *.dfm}

procedure Tpassword.BitBtn1Click(Sender: TObject);

var s:string;

i:integer;

begin

fl:=false;

for i:=1 to 20 do

begin

if (Edit1.Text=pas[i]) and (ComboBox1.Text=log[i])

then

fl:=true;

end;

if fl then close

else begin

s:=Application.Title;

Application.Title:='Помилка реєстрації';

ShowMessage('Ім''я користувача або пароль введено невірно!');

Application.Title:=s;

Edit1.Text:='';

Edit1.SetFocus;

end;

end;

procedure Tpassword.FormCreate(Sender: TObject);

var i:integer;

begin

reg:=tregistry.Create(key_read);

reg.RootKey:=HKEY_CURRENT_USER;

for i:=1 to 20 do

begin

try

if reg.OpenKey('\software\vak\password',false)

then

if i=1 then begin log[1]:='admin'; ComboBox1.Items.Add(log[1]);

end else log[i]:=reg.ReadString('log'+inttostr(i));

pas[i]:=reg.ReadString('pas'+inttostr(i));

if (log[i]<>'') and (i>1) then ComboBox1.Items.Add(log[i]);

except

showmessage('');

if i=1 then begin

pas[1]:='1';

ComboBox1.Items.Add('admin');

end;

end;

end;

if pas[1]='' then pas[1]:='1';

combobox1.ItemIndex:=0;

end;

procedure Tpassword.FormClose(Sender: TObject; var Action: TCloseAction);

begin

if not fl then main.Close

else

if ComboBox1.Text='admin' then main.N17.Enabled:=true

else main.N17.Enabled:=false;

end;

procedure Tpassword.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

if key=#13 then bitbtn1click(sender);

end;

procedure Tpassword.FormShow(Sender: TObject);

begin

Edit1.Text:=''; Edit1.SetFocus

end;

end.

unit u_sp_c;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, u_data_modul, Grids, DBGrids, ExtCtrls, DBCtrls, StdCtrls,

Buttons;

type

Tsp_c = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

Panel1: TPanel;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

sp_c: Tsp_c;

implementation

uses u_pasp_pr_vvod;

{$R *.dfm}

procedure Tsp_c.BitBtn1Click(Sender: TObject);

begin

pasp_pr_vvod.Edit1.Text:=DataModule2.ADOTable3country.AsString;

close;

end;

end.

unit u_sp_dil;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, u_data_modul, Grids, DBGrids, StdCtrls, Buttons, ExtCtrls,

DBCtrls;

type

Tsp_dil = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

Panel1: TPanel;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

sp_dil: Tsp_dil;

implementation

uses u_vvod_OB;

{$R *.dfm}

procedure Tsp_dil.BitBtn1Click(Sender: TObject);

begin

DataModule2.ADOTable5kod_dil.AsInteger:=DataModule2.ADOTable6kod_dil.AsInteger;

vvod_ob.Edit2.Text:=inttostr(DataModule2.ADOTable6nomer.AsInteger);

Close

end;

end.

unit U_sp_ob;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids,u_data_modul, StdCtrls,comobj,

Buttons;

type

Tsp_ob = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

Panel1: TPanel;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

BitBtn3: TBitBtn;

BitBtn4: TBitBtn;

Panel3: TPanel;

Panel2: TPanel;

GroupBox1: TGroupBox;

Label1: TLabel;

ComboBox1: TComboBox;

CheckBox1: TCheckBox;

Label3: TLabel;

SpeedButton1: TSpeedButton;

procedure BitBtn2Click(Sender: TObject);

procedure DBGrid1DblClick(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure ComboBox1Change(Sender: TObject);

procedure FormShow(Sender: TObject);

procedure CheckBox1Click(Sender: TObject);

procedure SpeedButton1Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn4Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

sp_ob: Tsp_ob;

w,table,myrange:variant;

implementation

uses u_sp_type_ob, u_vvod_OB, U_oblik_vvod;

{$R *.dfm}

procedure Tsp_ob.BitBtn2Click(Sender: TObject);

begin

DataModule2.adotable5.Insert;

vvod_ob.Edit1.Text:='';

vvod_ob.Edit2.Text:='';

vvod_ob.Caption:='Додавання запису';

vvod_ob.ShowModal

end;

procedure Tsp_ob.DBGrid1DblClick(Sender: TObject);

begin

with DataModule2 do

begin

ADOTable5.Locate('kod_ob',ADOQuery3kod_ob.AsInteger,[]);

ADOTable5.Edit;

end;

with vvod_ob do

begin

Caption:='Редагування запису';

DataModule2.ADOTable6.Locate('kod_dil',DataModule2.adoquery3kod_dil.asinteger,[]);

DataModule2.ADOTable4.Locate('kod_type_ob',DataModule2.adoquery3kod_type_obj.asinteger,[]);

Edit1.Text:=DataModule2.ADOTable4type_obj.AsString;

Edit2.Text:=inttostr(DataModule2.ADOTable6nomer.AsInteger);

ShowModal;

end;

end;

procedure Tsp_ob.BitBtn3Click(Sender: TObject);

begin

with DataModule2 do

begin

ADOTable5.Locate('kod_ob',ADOQuery3kod_ob.AsInteger,[]);

ADOTable5.Delete;

adoquery3.Close;

adoquery3.Open;

end;

end;

procedure Tsp_ob.ComboBox1Change(Sender: TObject);

begin

with DataModule2 do

begin

ADOQuery3.Close;

ADOQuery3.SQL.Clear;

ADOQuery3.SQL.Add('select o.pib_k, o.tel,o.kod_type_obj,o.kod_dil,o.kod_ob,o.nazva, o.adresa, d.nomer from objects o left join sp_dil d on d.kod_dil=o.kod_dil where o.kod_type_obj=(select kod_type_ob from sp_type_ob where type_obj='+''''+ComboBox1.Text+''''+')');

ADOQuery3.Open;

end;

CheckBox1.Checked:=false;

end;

procedure Tsp_ob.FormShow(Sender: TObject);

begin

ComboBox1.Items.Clear;

with DataModule2 do

begin

ADOQuery4.Close;

ADOQuery4.Open;

while not ADOQuery4.Eof do

begin

sp_ob.ComboBox1.Items.Add(ADOQuery4type_obj.AsString);

ADOQuery4.Next;

end;

end;

end;

procedure Tsp_ob.CheckBox1Click(Sender: TObject);

begin

if CheckBox1.Checked then

with DataModule2 do

begin

ADOQuery3.Close;

ADOQuery3.SQL.Clear;

ADOQuery3.SQL.Add('select o.pib_k, o.tel,o.kod_type_obj,o.kod_dil,o.kod_ob,o.nazva, o.adresa, d.nomer from objects o left join sp_dil d on d.kod_dil=o.kod_dil');

ADOQuery3.Open;

end

else ComboBox1Change(Sender);

end;

procedure Tsp_ob.SpeedButton1Click(Sender: TObject);

begin

CheckBox1.Checked:=true;

Panel2.Visible:=SpeedButton1.Down;

CheckBox1Click(sender);

end;

procedure Tsp_ob.BitBtn1Click(Sender: TObject);

begin

DataModule2.ADOTable7kod_ob.AsInteger:=DataModule2.ADOQuery3kod_ob.AsInteger;

oblik_vvod.Edit1.Text:=DataModule2.ADOQuery3nazva.AsString;

close;

end;

procedure Tsp_ob.BitBtn4Click(Sender: TObject);

const

wdalignPageNumberRight=1;

var i,j,k:integer;

s:string;

mypagenumber:variant;

mypagenumbers:variant;

mysection:variant;

begin

w:=createoleobject('word.application');

w.documents.add;

w.activewindow.activepane.view.zoom.percentage:=100;

mysection:=w.activedocument.range.sections.item(1);

mypagenumbers:=mysection.headers.item(1).pagenumbers;

mypagenumber:=mysection.headers.item(1).pagenumbers.add(pagenumberalignment:=wdalignPageNumberRight,firstpage:=true);

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

myrange.paragraphformat.alignment:=1;

myrange.select;

w.selection.font.bold:=1;

w.selection.font.underline:=1;

w.activedocument.range.insertafter('Перелік об''єктів');

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

if CheckBox1.Checked then

k:=ComboBox1.Items.Count-1 else begin k:=0;

s:=combobox1.text; end;

for j:=0 to k do

begin

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

myrange.paragraphformat.alignment:=1;

myrange.select;

w.selection.font.underline:=0;

w.selection.font.bold:=1;

if checkbox1.checked then

w.activedocument.range.insertafter(ComboBox1.Items[j]) else

w.activedocument.range.insertafter(s);

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

with DataModule2 do

begin

ADOQuery3.Close;

ADOQuery3.SQL.Clear;

if CheckBox1.Checked then

s:=ComboBox1.Items[j];

ADOQuery3.SQL.Add('select o.pib_k, o.tel,o.kod_type_obj,o.kod_dil,o.kod_ob,o.nazva, o.adresa, d.nomer from objects o left join sp_dil d on d.kod_dil=o.kod_dil where o.kod_type_obj=(select kod_type_ob from sp_type_ob where type_obj='+''''+s+''''+')');

ADOQuery3.Open;

ADOQuery3.first;

end;

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

w.activedocument.tables.add(range:=myrange,numrows:=1,numcolumns:=5);

table:=w.activedocument.tables.item(j+1);

table.AutoFormat(Format:=20,

ApplyBorders:=true,

ApplyShading:=false,

ApplyFont:=false,

ApplyColor:=false,

ApplyHeadingRows:= false,

ApplyLastRow:=false,

ApplyFirstColumn:= false,

ApplyLastColumn:=false,

AutoFit:=false);

table.rows.item(1).range.paragraphformat.alignment:=1;

table.rows.item(1).shading.backgroundpatterncolorindex:=16;

table.rows.item(1).select;

w.selection.font.bold:=1;

table.Columns.Item(1).select;

for i:=1 to table.columns.count do //формування заголовків

case i of

1: begin

table.columns.item(i).width:=120;

table.cell(1,i).range.text:='Назва';

end;

2: begin

table.columns.item(i).width:=50;

table.cell(1,i).range.text:='№діл.';

end;

3: begin

table.columns.item(i).width:=100;

table.cell(1,i).range.text:='Адреса';

end;

4: begin

table.columns.item(i).width:=100;

table.cell(1,i).range.text:='ПІП керівника';

end;

5: begin

table.columns.item(i).width:=80;

table.cell(1,i).range.text:='Телефон';

end;

end;

table.rows.add;

table.rows.item(2).shading.backgroundpatterncolorindex:=0;

table.rows.item(2).select;

table.rows.item(2).range.paragraphformat.alignment:=3;

w.selection.font.bold:=0;

k:=2;

with DataModule2 do

while not ADOQuery3.eof do

begin

table.cell(ADOQuery3.recno+1,1).range.text:=adoquery3nazva.asstring;

table.cell(ADOQuery3.recno+1,2).range.text:=adoquery3nomer.asinteger;

table.cell(ADOQuery3.recno+1,3).range.text:=adoquery3adresa.asstring;

table.cell(ADOQuery3.recno+1,4).range.text:=adoquery3pib_k.asstring;

table.cell(ADOQuery3.recno+1,5).range.text:=adoquery3tel.asstring;

k:=k+1;

ADOQuery3.next;

table.rows.add;

end;

table.rows.item(k).delete;

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

end;

w.visible:=true;

checkbox1.checked:=true;

CheckBox1Click(Sender);

end;

end.

unit u_sp_type;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Grids, DBGrids,u_data_modul,u_pasp_pr_vvod, ExtCtrls, DBCtrls,

StdCtrls, Buttons;

type

Tsp_type = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

Panel1: TPanel;

BitBtn1: TBitBtn;

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

sp_type: Tsp_type;

implementation

{$R *.dfm}

procedure Tsp_type.FormClose(Sender: TObject; var Action: TCloseAction);

begin

if f then begin

DataModule2.ADOTable2kod_type_pr.AsInteger:=DataModule2.ADOTable1kod_type_pr.AsInteger;

pasp_pr_vvod.Edit2.Text:=DataModule2.ADOTable1naz_type.AsString;

end;

f:=false;

end;

procedure Tsp_type.BitBtn1Click(Sender: TObject);

begin

close

end;

end.

unit u_sp_type_ob;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids,u_data_modul, StdCtrls,

Buttons;

type

Tsp_type_ob = class(TForm)

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

Panel1: TPanel;

BitBtn1: TBitBtn;

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

sp_type_ob: Tsp_type_ob;

implementation

uses u_vvod_OB;

{$R *.dfm}

procedure Tsp_type_ob.BitBtn1Click(Sender: TObject);

begin

DataModule2.ADOTable5kod_type_obj.AsInteger:=DataModule2.ADOTable4kod_type_ob.AsInteger;

vvod_ob.Edit1.Text:=DataModule2.ADOTable4type_obj.AsString;

close;

end;

end.

unit u_spisati;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs,u_data_modul, ExtCtrls, Grids, DBGrids, StdCtrls, Buttons,comobj;

type

Tspisati = class(TForm)

DBGrid1: TDBGrid;

Panel1: TPanel;

BitBtn3: TBitBtn;

BitBtn2: TBitBtn;

procedure FormShow(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

spisati: Tspisati;

w,table,myrange:variant;

implementation

uses U_oblik_vvod, DB;

{$R *.dfm}

procedure Tspisati.FormShow(Sender: TObject);

var s:string;

begin

with DataModule2 do

begin

s:=datetostr(date);

ADOQuery7.Close; ADOQuery7.Open;

ADOQuery7.Filter:='termin_pr<='+''''+s+'''';

ADOQuery7.Filtered:=true;

end;

end;

procedure Tspisati.BitBtn3Click(Sender: TObject);

begin

datamodule2.ADOTable7.Insert;

datamodule2.ADOTable7kod_pr.AsInteger:=datamodule2.ADOQuery7kod_pr.AsInteger;

DataModule2.ADOTable7kilkist.AsFloat:=datamodule2.ADOQuery7zalishok.AsFloat;

with oblik_vvod do

begin

RadioGroup1.Enabled:=false;

RadioGroup2.ItemIndex:=2;

RadioGroup2.Enabled:=false;

Edit2.Text:='Вид препарату '+ DataModule2.ADOQuery7naz_type.AsString+' серії '+DataModule2.ADOQuery7seria.AsString ;

dbEdit1.Text:=inttostr(DataModule2.ADOQuery7zalishok.AsInteger);

Caption:='Списання препарату';

end;

oblik_vvod.ShowModal

end;

procedure Tspisati.BitBtn2Click(Sender: TObject);

const

wdalignPageNumberRight=1;

var i,j,k:integer;

mypagenumber:variant;

mypagenumbers:variant;

mysection:variant;

s:string;

begin

w:=createoleobject('word.application');

w.documents.add;

w.activewindow.activepane.view.zoom.percentage:=100;

mysection:=w.activedocument.range.sections.item(1);

mypagenumbers:=mysection.headers.item(1).pagenumbers;

mypagenumber:=mysection.headers.item(1).pagenumbers.add(pagenumberalignment:=wdalignPageNumberRight,firstpage:=true);

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

myrange.paragraphformat.alignment:=1;

myrange.select;

w.selection.font.bold:=1;

w.selection.font.underline:=1;

w.activedocument.range.insertafter('Перелік препаратів, що підлягає списанню на '+datetostr(date));

w.activedocument.range.insertafter(#13);

w.activedocument.range.insertafter(#13);

myrange:=w.activedocument.range(w.activedocument.range.end-1,w.activedocument.range.end-1);

w.activedocument.tables.add(range:=myrange,numrows:=1,numcolumns:=5);

table:=w.activedocument.tables.item(1);

table.AutoFormat(Format:=20,

ApplyBorders:=true,

ApplyShading:=false,

ApplyFont:=false,

ApplyColor:=false,

ApplyHeadingRows:= false,

ApplyLastRow:=false,

ApplyFirstColumn:= false,

ApplyLastColumn:=false,

AutoFit:=false);

table.rows.item(1).range.paragraphformat.alignment:=1;

table.rows.item(1).shading.backgroundpatterncolorindex:=16;

table.rows.item(1).select;

w.selection.font.bold:=1;

w.selection.font.underline:=0;

table.Columns.Item(1).select;

for i:=1 to table.columns.count do //формування заголовків

case i of

1: begin

table.columns.item(i).width:=90;

table.cell(1,i).range.text:='Серія';


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.