for i:=0 to lan do begin
mainform.warehouse.setkey;
mainform.warehouse.IndexFieldNames:=mainform.warehouse.Fields[p].FieldName;
mainform.warehouse.FindNearest([edit1.text]);
end; end;
end;
end;
procedure TForm3.ComboBox1Change(Sender: TObject);
begin
case combobox1.ItemIndex of
0: p:=0;
1: p:=1;
2: p:=6; end;
end;
procedure TForm3.Button3Click(Sender: TObject);
begin
mainform.Query1.Active:=false;
mainform.Query1.Close;
mainform.Query1.SQL.Clear;
mainform.Query1.SQL.Add('select '+'Код, Наименование, "Датавыпуска", "Кол-во", "Ценазакупки", "Группа" '+'from '+mainform.ComboBox1.Text+' where '+combobox1.Text+'='+edit1.text);
mainform.Query1.Active:=true;
dbedit1.DataField:='Кол-во';
end;
procedure TForm3.BitBtn1Click(Sender: TObject);
var N,RN: integer;
begin
if radiobutton1.Checked=true then begin
N:=strtoint(edit2.Text);
RN:=strtoint(dbedit1.Text);
RN:=RN-N;
memo1.Lines.Add('Выгружено '+edit2.Text+' единиц '+mainform.warehouse.FieldValues['Наименование']);
mainform.memo1.Lines.Add(Timetostr(time)+' Выгружено '+edit2.Text+' единиц '+mainform.warehouse.FieldValues['Наименование']);
end;
if radiobutton2.Checked=true then begin
N:=strtoint(edit2.Text);
RN:=strtoint(dbedit1.Text);
RN:=RN+N;
memo1.Lines.Add('Добавлено '+edit2.Text+' единиц '+mainform.warehouse.FieldValues['Наименование']);
mainform.memo1.Lines.Add(Timetostr(time)+' Добавлено '+edit2.Text+' единиц '+mainform.warehouse.FieldValues['Наименование']);
end;
mainform.Query1.Close;
datasource1.Enabled:=false;
mainform.warehouse.edit;
mainform.warehouse.FieldByName('Кол-во').AsInteger:=RN;
mainform.warehouse.Post;
mainform.Query1.Open;
datasource1.Enabled:=true;
edit2.Text:='';
end;
procedure TForm3.BitBtn2Click(Sender: TObject);
begin
mainform.Query1.Active:=false;
edit1.Clear;
edit2.Clear;
dbedit1.DataField:='';
form3.close;
end;
procedure TForm3.Edit2Change(Sender: TObject);
var N,RN: integer;
begin
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
dbgrid1.DataSource:=datasource1;
mainform.Query1.Active:=false;
mainform.Query1.Close;
mainform.Query1.SQL.Clear;
mainform.Query1.SQL.Add('select '+'Код, Наименование, Группа '+'from '+mainform.ComboBox1.Text+' where '+combobox1.Text+'="'+edit1.text+'"');
mainform.Query1.Active:=true;
dbedit1.DataField:='Кол-во';
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
dbgrid1.DataSource:=mainform.DataSource1;
end;
procedure TForm3.ComboBox2Change(Sender: TObject);
begin
case combobox1.ItemIndex of
0: p:=0;
1: p:=1;
2: p:=6; end;
end;
procedure TForm3.FormDestroy(Sender: TObject);
begin
mainform.Query1.Active:=false;
edit1.Text:='';
edit2.Text:='';
dbedit1.DataField:='';
end;
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
begin
mainform.Query1.Active:=false;
edit1.Text:='';
edit2.Text:='';
dbedit1.DataField:='';
end;
end.
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids, DB, Mask, QuickRpt, QRCtrls, ExtCtrls;
type
TForm4 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label21: TLabel;
Button1: TButton;
ComboBox1: TComboBox;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses Mainunit;
{$R *.dfm}
procedure TForm4.Button1Click(Sender: TObject);
var i: integer;
begin
datasource1.DataSet:=mainform.Query1;
mainform.Query1.close;
mainform.Query1.SQL.Clear;
mainform.Query1.SQL.Add('Select * from '+mainform.ComboBox1.Text+' where Группа="'+combobox1.Text+'"');
mainform.Query1.Open;
mainform.Query1.Active:=true;
end;
procedure TForm4.Button2Click(Sender: TObject);
begin
form4.close;
end;
procedure TForm4.Button3Click(Sender: TObject);
var i:integer;
begin
mainform.warehouse.First;
for i:=1 to mainform.warehouse.recordcount do begin
if mainform.warehouse.FieldByName('Датавыпуска').value='02.03.2004' then
datasource1.DataSet:=mainform.warehouse.Fields.DataSet;
mainform.warehouse.Next;
end;
end;
end.
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm5 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
uses Mainunit;
{$R *.dfm}
end.