unit frmPromoArt;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TfmPromoArt = class(TForm)
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Memo1: TMemo;
    Label2: TLabel;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmPromoArt: TfmPromoArt;

implementation
uses Unit1;

{$R *.dfm}

procedure TfmPromoArt.Button1Click(Sender: TObject);
var MensajeError, MensajeResp, SKU:String;
begin
  if Edit1.Text='' then
  begin
    MessageDlg('El SKU es incorrecto.', mtError, [mbOk], 0);
    Exit;
  end
  else
  begin
    MensajeError:='';
    MensajeResp:='';
    SKU := Edit1.Text;
    Memo1.Lines.Clear;
    if Form1.PromosArtN(MensajeError,MensajeResp,SKU) then
    begin
      Memo1.Lines.Add(MensajeResp);
    end
    else
    begin
      Memo1.Lines.Add(MensajeError);
    end;
  end;
end;

procedure TfmPromoArt.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TfmPromoArt.FormShow(Sender: TObject);
begin
  Edit1.Text := '';
  Memo1.Lines.Clear;
end;

end.
