Смекни!
smekni.com

Автоматизация продажи и учета лекарственных средств (стр. 4 из 4)

var Accept: Boolean);

begin

Accept:=Dataset['Name_lek'] = Edit1.text;

end;

procedure TForm1.CheckBox1Click(Sender: TObject);

begin

Table1.Filtered:=CheckBox1.Checked;

Table1.Filtered:=true;

end;

procedure TForm1.FormCreate(Sender: TObject);

begin

Application.OnHint := ShowHint;

end;

procedure TForm1.ShowHint(Sender: TObject);

begin

StatusBar1.Panels[0].text := Application.Hint;

end;

procedure TForm1.N4Click(Sender: TObject);

begin

Form5.show;

end;

procedure TForm1.Button6Click(Sender: TObject);

begin

Table1.Filtered:=False;

end;

end.

unit Unit2;

interface

uses

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

Grids, DBGrids, Db, DBTables, StdCtrls, ExtCtrls, ComCtrls, Buttons,

Mask, DBCtrls;

type

TForm2 = class(TForm)

GroupBox1: TGroupBox;

DataSource1: TDataSource;

Table1: TTable;

DBGrid1: TDBGrid;

GroupBox2: TGroupBox;

DBGrid2: TDBGrid;

DataSource2: TDataSource;

Table2: TTable;

GroupBox3: TGroupBox;

Button5: TButton;

Button6: TButton;

Button7: TButton;

Button8: TButton;

Label1: TLabel;

Label2: TLabel;

GroupBox4: TGroupBox;

Panel1: TPanel;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

Button9: TButton;

StatusBar1: TStatusBar;

GroupBox5: TGroupBox;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button9Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure OnActivate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

implementation

uses Unit1, Unit3;

{$R *.DFM}

procedure TForm2.Button1Click(Sender: TObject);

begin

If table1.State = dsBrowse then

table1.insert;

end;

procedure TForm2.Button2Click(Sender: TObject);

begin

If table1.State = dsBrowse then

table1.edit;

end;

procedure TForm2.Button3Click(Sender: TObject);

begin

If table1.State = dsBrowse then

If Messagedlg('',mtconfirmation,[mbYes,mbNo],0)=mrYes then

table1.delete;

end;

procedure TForm2.Button4Click(Sender: TObject);

begin

If table1.State in [dsInsert,dsEdit]then

table1.post;

end;

procedure TForm2.Button9Click(Sender: TObject);

begin

If table1.State in [dsInsert,dsEdit]then

table1.Cancel;

end;

procedure TForm2.Button5Click(Sender: TObject);

begin

If table2.State = dsBrowse then

table2.insert;

end;

procedure TForm2.Button6Click(Sender: TObject);

begin

If table2.State = dsBrowse then

If Messagedlg('',mtconfirmation,[mbYes,mbNo],0)=mrYes then

table2.delete;

end;

procedure TForm2.Button8Click(Sender: TObject);

begin

If table2.State = dsBrowse then

table2.edit;

end;

procedure TForm2.Button7Click(Sender: TObject);

begin

If table2.State in [dsInsert,dsEdit]then

table2.post;

end;

procedure TForm2.BitBtn1Click(Sender: TObject);

begin

Form1.show;

Form2.hide;

end;

procedure TForm2.BitBtn2Click(Sender: TObject);

begin

Form3.show;

Form2.hide;

end;


procedure TForm2.OnActivate(Sender: TObject);

begin

DBGrid2.Columns.Items[1].PickList.Clear;

with Table1 do begin

first;

While not eof do Begin

DBGrid2.columns.Items[1].Picklist.add(FieldByName('Kod_pred').value);

next;

end;

end;

end;

end.

unit Unit3;

interface

uses

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

StdCtrls, ExtCtrls, Db, DBTables, Grids, DBGrids, ComCtrls, Buttons,

Mask, DBCtrls;

type

TForm3 = class(TForm)

GroupBox1: TGroupBox;

DBGrid1: TDBGrid;

DataSource1: TDataSource;

Table1: TTable;

Label1: TLabel;

Label2: TLabel;

GroupBox2: TGroupBox;

Panel1: TPanel;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Button4: TButton;

GroupBox3: TGroupBox;

DBGrid2: TDBGrid;

DataSource2: TDataSource;

Table2: TTable;

GroupBox4: TGroupBox;

Button5: TButton;

Button6: TButton;

Button7: TButton;

Button8: TButton;

StatusBar1: TStatusBar;

GroupBox5: TGroupBox;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

DBEdit7: TDBEdit;

DBEdit8: TDBEdit;

DBEdit9: TDBEdit;

DBEdit10: TDBEdit;

DBEdit11: TDBEdit;

procedure Button1Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Button7Click(Sender: TObject);

procedure Button8Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure OnActivate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

uses Unit1, Unit2;

{$R *.DFM}

procedure TForm3.Button1Click(Sender: TObject);

begin

If table2.State = dsBrowse then

table2.insert;

end;

procedure TForm3.Button4Click(Sender: TObject);

begin

If table2.State in [dsInsert,dsEdit]then

table2.post;

end;

procedure TForm3.Button3Click(Sender: TObject);

begin

If table2.State = dsBrowse then

table2.edit;

end;

procedure TForm3.Button2Click(Sender: TObject);

begin

If table2.State = dsBrowse then

If Messagedlg('',mtconfirmation,[mbYes,mbNo],0)=mrYes then

table2.delete;

end;

procedure TForm3.Button5Click(Sender: TObject);

begin

If table1.State = dsBrowse then

table1.insert;

end;

procedure TForm3.Button6Click(Sender: TObject);

begin

If table1.State = dsBrowse then

If Messagedlg('',mtconfirmation,[mbYes,mbNo],0)=mrYes then

table1.delete;

end;

procedure TForm3.Button7Click(Sender: TObject);

begin

If table1.State = dsBrowse then

table1.edit;

end;

procedure TForm3.Button8Click(Sender: TObject);

begin

If table1.State in [dsInsert,dsEdit]then

table1.post;

end;

procedure TForm3.BitBtn1Click(Sender: TObject);

begin

Form1.show;

Form3.hide;

end;

procedure TForm3.BitBtn2Click(Sender: TObject);

begin

Form2.show;

Form3.hide;

end;

procedure TForm3.OnActivate(Sender: TObject);

begin

DBGrid2.Columns.Items[3].PickList.Clear;

with Form1.Table1 do begin

first;

While not eof do Begin

DBGrid2.columns.Items[3].Picklist.add(FieldbyName('Kod_lek').value);

next;

end;

end;

DBGrid2.Columns.Items[1].PickList.Clear;

with Form2.Table2 do begin

first;

While not eof do Begin

DBGrid2.columns.Items[1].Picklist.add(FieldbyName('Nom_naklad').value);

next;

end;

end;

DBGrid2.Columns.Items[2].PickList.Clear;

with Form2.Table1 do begin

first;

While not eof do Begin

DBGrid2.columns.Items[2].Picklist.add(FieldbyName('Kod_pred').value);

next;

end;

end;

DBGrid1.Columns.Items[1].PickList.Clear;

with Form1.Table1 do begin

first;

While not eof do Begin

DBGrid1.columns.Items[1].Picklist.add(FieldbyName('Kod_lek').value);

next;

end;

end;

end;

end.

unit Unit4;

interface

uses

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

StdCtrls, Db, DBTables, Grids, DBGrids, ExtCtrls;

type

TForm4 = class(TForm)

GroupBox1: TGroupBox;

DBGrid1: TDBGrid;

DataSource1: TDataSource;

Button1: TButton;

Query1: TQuery;

Edit1: TEdit;

Button3: TButton;

RadioGroup1: TRadioGroup;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Query1FilterRecord(DataSet: TDataSet; var Accept: Boolean);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

pole :shortstring;

implementation

{$R *.DFM}

procedure TForm4.Button1Click(Sender: TObject);

begin

Query1.Filtered:=false;

Query1.Active:=true;

end;

procedure TForm4.Button2Click(Sender: TObject);

begin

Query1.Active:=false;

end;

procedure TForm4.Button3Click(Sender: TObject);

begin

Query1.Filtered:=false;

Case Radiogroup1.itemindex of

0:pole:='Name_lek';

1:pole:='Kolvo_p_lek'

end;

Query1.Filtered:=true;

end;

procedure TForm4.Query1FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

begin

Accept:=Dataset[pole]=edit1.text;

end;

end.

unit Unit5;

interface

uses

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

StdCtrls, ExtCtrls, Buttons;

type

TForm5 = class(TForm)

Image1: TImage;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

BitBtn1: TBitBtn;

Label6: TLabel;

procedure Button1Click(Sender: TObject);

procedure BitBtn1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form5: TForm5;

implementation

{$R *.DFM}

procedure TForm5.Button1Click(Sender: TObject);

begin

Form5.close;

end;

procedure TForm5.BitBtn1Click(Sender: TObject);

begin

Form5.Close;

end;

end.