unit Unit24;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DBGridEh, DBGridEhGrouping, ToolCtrlsEh,
  DBGridEhToolCtrls, DynVarsEh, Data.DB, Data.Win.ADODB, DBCtrlsEh, EhLibVCL,
  GridsEh, DBAxisGridsEh, Vcl.StdCtrls, Vcl.Mask, DBLookupEh, Vcl.Buttons,
  Vcl.ExtCtrls;

type
  TfMainStockMoveEdit = class(TForm)
    Panel1: TPanel;
    bbOk: TBitBtn;
    bbCancel: TBitBtn;
    GroupBox1: TGroupBox;
    DBLookupComboboxEh1: TDBLookupComboboxEh;
    GroupBox2: TGroupBox;
    DBGridEh1: TDBGridEh;
    GroupBox3: TGroupBox;
    DBEditEh2: TDBEditEh;
    DBEditEh3: TDBEditEh;
    DBEditEh4: TDBEditEh;
    dsStockMove: TDataSource;
    qStockMove: TADOQuery;
    qStockMoveid: TAutoIncField;
    qStockMovestock_id: TIntegerField;
    qStockMovevalue_id: TIntegerField;
    qStockMovequantity: TIntegerField;
    qStockMovebuyPrice: TFloatField;
    qStockMoveprice: TFloatField;
    qStockMovemoveIn: TSmallintField;
    qStockMovename: TWideStringField;
    qStockMovevendor: TWideStringField;
    dsValue: TDataSource;
    qResidues: TADOQuery;
    dsResidues: TDataSource;
    DBEditEh1: TDBEditEh;
    qStockMovemove_in: TWideStringField;
    qResiduesid: TAutoIncField;
    qResiduesdeviceType_id: TIntegerField;
    qResiduesvendor: TWideStringField;
    qResiduesname: TWideStringField;
    qResiduesisFolder: TSmallintField;
    qResiduesquantityIn: TFMTBCDField;
    qResiduesquantityOut: TFMTBCDField;
    qResiduestotal: TFMTBCDField;
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure DBLookupComboboxEh1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fMainStockMoveEdit: TfMainStockMoveEdit;

implementation

{$R *.dfm}

uses Unit2;

procedure TfMainStockMoveEdit.DBLookupComboboxEh1Change(Sender: TObject);
begin
  qStockMove.Close;
  qStockMove.Parameters[0].Value := DM.tValueid.Value;
  qStockMove.Open;
  qResidues.Close;
  qResidues.Parameters[0].Value := DM.tValueid.Value;
  qResidues.Open;
end;

procedure TfMainStockMoveEdit.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  DM.tValue.Close;
end;

procedure TfMainStockMoveEdit.FormShow(Sender: TObject);
begin
  DM.tValue.Open;
end;

end.
