procedure TfrmPrincipal.btnGerarLoteClick(Sender: TObject);
var
x,idLote : integer;
listaArquivos:boolean;
begin
Screen.cursor:=crAppStart;
btnGerarLote.Enabled:=false;
Randomize;
if (CheckBox1.Checked) then
idLote:=Random(999)
else
idLote:=StrToInt(EditIDLote.text);
case rdgOpcoesLote.ItemIndex of
0 : listaArquivos:=true;
1 : listaArquivos:=false;
end;
x:=GerarLote(idLote,EditPathNFeLote.Text,listaArquivos);
if (x=1) then
EditStatus.Text:='Lote gerado com sucesso!'
else
if (x=-1) then
EditStatus.Text:='Erro desconhecido'
else
if (x=0) then
EditStatus.Text:='Operação cancelada'
else
if (x=2) then
EditStatus.Text:='Não existe(m) arquivo(s) assinado(s)!';
EditIDLote.Text:=IntToStr(idLote);
btnGerarLote.Enabled:=true;
btnGerarLote.SetFocus;
Screen.cursor:=crDefault;
end;