SHARE
TWEET

Untitled

a guest May 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. begin
  2.   if ((self.FormaOperacao in [SaiServAbertura, SaiServFechamento, SaiServMovimento]) and
  3.       (TdmVenSaidas(Fcontrol1.DataCenter).cdsParamGeraisE_VEN_CONTROLE_VEICULOS.AsString = 'S') and (Fcontrol1.Estado = EsInsert)) then
  4.   begin
  5.     vPlaca := TMensagem.ConfirmarComEntrada('Informe a placa:').Replace('-', '').Replace(' ', '').ToUpper();
  6.  
  7.     try
  8.       vSQLPesq := TFSQLDataSet.Create(self);
  9.       vSQLPesq.SQLConnection := dmDDB.SQLConection;
  10.       vSQLPesq.CommandText := 'select CLIENTE, PLACA from CAD_VEICULOS where EMPRESA = :EMPRESA and Replace(PLACA, ''-'', '''') = :PLACA';
  11.       vSQLPesq.ParamByName('EMPRESA').AsInteger := dmDDB.Empresa_Logada;
  12.       vSQLPesq.ParamByName('PLACA').AsString := vPlaca;
  13.       vSQLPesq.Open;
  14.  
  15.       if not vSQLPesq.IsEmpty then begin
  16.         if not vSQLPesq.FieldByName('CLIENTE').IsNull then
  17.           TdmVenSaidas(Fcontrol1.DataCenter).cdsCadastroCLIENTE.AsInteger := vSQLPesq.FieldByName('CLIENTE').AsInteger;
  18.         TdmVenSaidas(Fcontrol1.DataCenter).cdsCadastroPLACA.AsString := vSQLPesq.FieldByName('PLACA').AsString;
  19.       end
  20.       else if (vPlaca <> '') then
  21.         if (TMensagem.Confirmar('Veculo no encontrado. Gostaria de cadastrar um novo com esta placa?' + sLineBreak + 'Deseja continuar?',
  22.             moSim) = moSim) then begin
  23.           vForm := TfrmCadVeiculos(NewForm(TfrmCadVeiculos, TdmCadVeiculos, self, 20, TMenuItem(Sender)));
  24.           TdmCadVeiculos(vForm.Fcontrol1.DataCenter).cdsCadastroPLACA.AsString := vPlaca;
  25.           vForm.Fcontrol1.Estado := EsInsert;
  26.         end;
  27.     finally
  28.       FreeAndNil(vSQLPesq)
  29.     end;
  30.   end;
  31.  
  32.   setBotaoImprimir;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top