Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TAplicacargaUsuarios.AplicacargaUsuarios(Gauge: TGauge);
- var DatasetServer,DatasetLocal: TFDQuery;
- sComandoSql: string; iNumInserts: Integer; wait: TFDGUIxWaitCursor; FWaitCounter: Integer; dlg:TFDGUIxAsyncExecuteDialog;
- begin
- wait := TFDGUIxWaitCursor.Create(nil);
- wait.ScreenCursor:= gcrAppWait;
- dlg:= TFDGUIxAsyncExecuteDialog.Create(nil);
- DatasetServer:= TFDQuery.Create(nil);
- DatasetServer.Connection := TDtmConexao.FDServidorConexao;
- DatasetServer.SQL.Text := 'select ID, DATA, HORA, USUARIO, SYST_NOME, SYST_NOMEUSER, PDV_PODEACESSAR, SYST_SITUACAO, PDV_USERPDVTIPO, '+
- 'PDV_PODEEMIRZ, PDV_PODEABRIRCAIXA, PDV_PODEEMITLX, PDV_PODETROCO, PDV_PODESANGRIA, PDV_PODEFECHARSIST, '+
- 'PDV_PODEFECHARCAIXA, PDV_PODEOPERAR, PDV_CODACESSO, MOD_ACESSOSISTGER, MOD_ACESSOCADPROD, MOD_ACESSOCADCLI, '+
- 'MOD_ACESSOCADFORNE, FOTO, PASSWORD_CEANCOD, PASSWORD_SENHA, PDV_PODEDESCONTO, PDV_DESCPERCENT, PDV_PODEESTORNAR, '+
- 'PODEABRIRGAVETA, PODE_ABRFECHARCAIXA, PODE_PESQUISARVENDASPDV, PODE_CANCELARVENDA, PODE_CANCELARITENVENDA '+
- ',( select Count(id) from usersys WHERE SYST_SITUACAO = ''ATIVO'' ) as RecordCount '+
- 'from USERSYS where SYST_SITUACAO = ''ATIVO'' order by ID asc ';
- DatasetServer.Open;
- DatasetServer.FieldByName('ID').Required:= False;
- iNumInserts := DatasetServer.FieldByName('REcordCount').AsInteger;
- Gauge.MaxValue := iNumInserts;
- Gauge.Visible := True;
- DatasetLocal:= TFDquery.Create(nil);
- DatasetLocal.Connection := TDtmConexao.FDMasterPdv;
- DatasetLocal.SQL.Text := 'Delete from USUARIOS';
- DatasetLocal.ExecSQL;
- DatasetLocal.SQL.Clear;
- DatasetLocal.SQL.Text :=
- 'update or insert into USUARIOS (IDUSUARIO, USER_SITUACAO, USERPDV_TIPO, USERPDV_PODEEMIRZ, USERPDV_PODEABRIRCAIXA, '+
- 'USERPDV_PODEEMITLX, USERPDV_PODETROCO, USERPDV_PODESANGRIA, USERPDV_PODEFECHARSIST, '+
- 'USERPDV_PODEFECHARCAIXA, USERPDV_PODEOPERAR, USERPDV_CODACESSO, USERPDV_NOME, '+
- 'USERPDV_NOMEUSER, PASSWORD_SENHA, PDV_PODEDESCONTO, PDV_DESCPERCENT, PDV_PODEESTORNAR, '+
- 'PODEABRIRGAVETA, PODE_ABRFECHARCAIXA, PODE_PESQUISARVENDASPDV, PODE_CANCELARVENDA, '+
- 'PODE_CANCELARITENVENDA) '+
- 'values (:IDUSUARIO, :USER_SITUACAO, :USERPDV_TIPO, :USERPDV_PODEEMIRZ, :USERPDV_PODEABRIRCAIXA, :USERPDV_PODEEMITLX, '+
- ':USERPDV_PODETROCO, :USERPDV_PODESANGRIA, :USERPDV_PODEFECHARSIST, :USERPDV_PODEFECHARCAIXA, '+
- ':USERPDV_PODEOPERAR, :USERPDV_CODACESSO, :USERPDV_NOME, :USERPDV_NOMEUSER, :PASSWORD_SENHA, :PDV_PODEDESCONTO, '+
- ':PDV_DESCPERCENT, :PDV_PODEESTORNAR, :PODEABRIRGAVETA, :PODE_ABRFECHARCAIXA, :PODE_PESQUISARVENDASPDV, '+
- ':PODE_CANCELARVENDA, :PODE_CANCELARITENVENDA) '+
- 'matching (IDUSUARIO) ';
- Datasetserver.DisableControls;
- DatasetServer.First;
- DatasetLocal.Params.ArraySize := iNumInserts;
- SistemaClass.RichVenda.Lines.Add(stringofchar('.',80));
- SistemaClass.RichVenda.Lines.Add('Iniciando carga de usuarios do sistema');
- while not Datasetserver.Eof do
- begin
- DatasetLocal.Params[0].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('ID').AsInteger;
- DatasetLocal.Params[1].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('SYST_SITUACAO').AsString;
- DatasetLocal.Params[2].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_USERPDVTIPO').AsString;
- DatasetLocal.Params[3].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEEMIRZ').AsString;
- DatasetLocal.Params[4].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEABRIRCAIXA').AsString;
- DatasetLocal.Params[5].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEEMITLX').AsString;
- DatasetLocal.Params[6].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODETROCO').AsString;
- DatasetLocal.Params[7].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODESANGRIA').AsString.ToInteger;
- DatasetLocal.Params[8].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEFECHARSIST').AsString;
- DatasetLocal.Params[9].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEFECHARCAIXA').AsString;
- DatasetLocal.Params[10].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEOPERAR').AsString;
- DatasetLocal.Params[11].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_CODACESSO').AsString;
- DatasetLocal.Params[12].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('SYST_NOME').AsString;
- DatasetLocal.Params[13].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('SYST_NOMEUSER').AsString;
- DatasetLocal.Params[14].AsStrings[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PASSWORD_SENHA').AsString;
- DatasetLocal.Params[15].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_PODEDESCONTO').AsInteger;
- DatasetLocal.Params[16].AsCurrencys[Datasetserver.RecNo-1] := Datasetserver.FieldByName('PDV_DESCPERCENT').AsCurrency;
- DatasetLocal.Params[17].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('pdv_podeestornar').AsInteger;
- DatasetLocal.Params[18].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('podeabrirgaveta').AsInteger;
- DatasetLocal.Params[19].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('pode_abrfecharcaixa').AsInteger;
- DatasetLocal.Params[20].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('pode_pesquisarvendaspdv').AsInteger;
- DatasetLocal.Params[21].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('pode_cancelarvenda').AsInteger;
- DatasetLocal.Params[22].AsIntegers[Datasetserver.RecNo-1] := Datasetserver.FieldByName('pode_cancelaritenvenda').AsInteger;
- Gauge.Progress := Datasetserver.RecNo;
- SistemaClass.RichVenda.Lines.Add( '... ' +Datasetserver.FieldByName('SYST_NOMEUSER').asstring);
- Datasetserver.Next;
- end;
- Gauge.Progress := 0;
- Gauge.Visible:= False;
- DatasetLocal.ResourceOptions.CmdExecMode := amCancelDialog;
- dlg.Provider := 'Forms';
- dlg.Caption := 'Leopard Report PDV- Frente de caixa';
- dlg.Prompt := 'Carga de tabelas...aguarde';
- if iNumInserts > 0 then
- begin
- try
- DatasetLocal.Execute(iNumInserts, 0);
- finally
- DatasetLocal.DisposeOf;
- Datasetserver.DisposeOf;
- end;
- end;
- dlg.DisposeOf;
- wait.DisposeOf;
- end;
- { TAplicacargaVendedores }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement