Advertisement
filhotecmail

Metodo1

Jul 12th, 2018
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.35 KB | None | 0 0
  1. function TVendaClass.CancelaItensdaVenda(const codebar: string): Boolean;
  2.  var Th: TThread;
  3.  begin
  4.   try
  5.      TDtmConexao.FDMasterPdv.ExecSQL(
  6.      ' DELETE FROM ITENS_VENDA where ITENS_CODBARRAS = '+codebar+' and VENDA_NUMERO = '+Vendas.FNumerodaVenda.ToString );
  7.      TDtmConexao.FDMasterPdv.Commit;
  8.   finally
  9.     Th := TThread.CreateAnonymousThread( procedure
  10.      begin
  11.      try
  12.         FDatasetItensdaVenda.Refresh;
  13.         FRichVenda.Clear;
  14.         FTVendaop.MontaDadosNoRich(FRichVenda);
  15.         FDatasetItensdaVenda.First;
  16.  
  17.        while not FDatasetItensdaVenda.Eof do
  18.        begin
  19.         GerarLog( Datetostr(Now)+' - '+TimeTostr(now)+' Log.: RETIRADO DA VENDA NRO.: '+ Vendas.FNumerodaVenda.ToString +' O PRODUTO  '+ FDatasetItensdaVenda.FieldByName('ITENS_DESCPRODUTO').AsString);
  20.         FDatasetItensdaVenda.Edit;
  21.         FDatasetItensdaVenda.FieldByName('ITENS_POSICAOITEN').AsInteger := FDatasetItensdaVenda.RecNo;
  22.         FDatasetItensdaVenda.Post;
  23.         FTVendaop.AppendProdtoRitchCancelbyCode( FDatasetItensdaVenda );
  24.         FDatasetItensdaVenda.Next;
  25.        end;
  26.        AfterRefreshDatasetItensdavenda;
  27.      except
  28.       on E: Exception do
  29.        GerarLog( Datetostr(Now)+' - '+TimeTostr(now)+' Log.: ERRO NO PROCESSO RETIRA ITENS DA VENDA [ I ] '+ e.Message);
  30.      end;
  31.     end);
  32.     Th.Start;
  33.  
  34.   end;
  35.    Result:= True;
  36.  
  37. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement