Fórum Loop Repetindo varios itens #292658
22/08/2005
0
valeu galera!
while not QryIncidencia.Eof do
begin
if QryIncidenciaCOD_VENDEDOR.value= QryFuncionariosCod_VENDEDOR.Value then
{Query1COD_COLABORADOR.VALUE}
begin
if QryIncidenciaTIPO.Value=´¬´then
begin
QryLancamento.Insert;
QryLancamentoHistorico.Value:=QryIncidenciaDESCRICAO.Value;
QryLancamentoValor.Value:=QryIncidenciaValor.Value * QryFuncionariosSalario_REGISTRO.Value div 100;
QryLancamentoTipo.Value:=QryIncidenciaNatureza.Value;
QryLancamentoCodFunc.Value:=QryFuncionariosCod_Vendedor.Value;
QryLancamentoDATA.Value:=Date;
QryLancamento.post;
end
else
if QryIncidenciaTIPO.VALUE=´V´ then
BEGIN
QryLancamento.Insert;
QryLancamentoDATA.Value:=Date;
QryLancamentoValor.Value:=QryIncidenciaValor.Value;
QryLancamentoTipo.Value:=QryIncidenciaNatureza.Value;
QryLancamentoCodFunc.Value:=QryFuncionariosCod_Vendedor.Value;
QryLancamentoHistorico.Value:=QryIncidenciaDESCRICAO.Value;
QryLancamento.Post;
end
else
QryLancamento.Open;
QryLancamento.Insert;
QryLancamentoDATA.Value:=Date;
QryLancamentoHistorico.Value:=´VALOR SALARIO´;
QryLancamentoValor.Value:=QryFuncionariosVALOR_SALARIO.Value;
QryLancamentoTipo.Value:=QryIncidenciaNatureza.Value;
QryLancamentoCodFunc.Value:=QryFuncionariosCod_Vendedor.Value;
QryLancamento.Post;
QryLancamento.Insert;
QryLancamentoHistorico.Value:=´SALARIO FAMILIA´;
QryLancamentoDATA.Value:=Date;
QryLancamentoValor.Value:=QryFuncionariosVALOR_SALARIO_FAMILIA.Value * QryFuncionariosQuant_Sal_Familia.Value;
QryLancamentoTipo.Value:=QryIncidenciaNatureza.Value;
QryLancamentoCodFunc.Value:=QryFuncionariosCod_Vendedor.Value;
{if QryLancamentoTIPO.Value=´E´ then
begin
QryLancamento.Open;
QryLancamento.Insert;
Total_prov:=Total_prov+QryLancamentoValor.Value;
QryLancamentoTotal_prov.value:=Total_prov;
QryLancamento.Post;
end
else
begin
QryLancamento.Open;
QryLancamento.Insert;
if QryLancamentoTIPO.Value=´S´then
begin
Total_inc:=Total_inc+QryLancamentoValor.Value;
QryLancamentoTotal_inc.Value:=Total_inc;}
QryLancamento.post;
QryIncidencia.Next;
QryLancamento.APPLYUPDATES;
end;
end;L3gion4rio
Curtir tópico
+ 0Posts
22/08/2005
Michael
Neste bloco:
else QryLancamento.Open; QryLancamento.Insert; QryLancamentoDATA.Value:=Date; QryLancamentoHistorico.Value:=´VALOR SALARIO´; QryLancamentoValor.Value:=QryFuncionariosVALOR_SALARIO.Value; QryLancamentoTipo.Value:=QryIncidenciaNatureza.Value; QryLancamentoCodFunc.Value:=QryFuncionariosCod_Vendedor.Value; QryLancamento.Post; QryLancamento.Insert; QryLancamentoHistorico.Value:=´SALARIO FAMILIA´; QryLancamentoDATA.Value:=Date; QryLancamentoValor.Value:=QryFuncionariosVALOR_SALARIO_FAMILIA.Value * QryFuncionariosQuant_Sal_Familia.Value; QryLancamentoTipo.Value:=QryIncidenciaNatureza.Value; QryLancamentoCodFunc.Value:=QryFuncionariosCod_Vendedor.Value;
Os comandos após o [b:0b2dd2e364]else [/b:0b2dd2e364]não está entre um par [b:0b2dd2e364]begin-end[/b:0b2dd2e364]. Ou seja, apenas a primeira linha após ele será executada condicionalmente. As outros serão executadas sempre, em cada passada do loop.
Verifique também todos os outros [b:0b2dd2e364]begins-ends[/b:0b2dd2e364], pois acho que vc copiou o código de forma incorreta para cá.
[]´s
Gostei + 0
22/08/2005
Rjun
while (not qryIncidencia.Eof) do begin if (qryIncidencia.FieldByName(´COD_VENDEDOR´).Value = qryFuncionarios.FieldByName(´Cod_VENDEDOR´).Value) then begin if qryIncidencia.FieldByName(´TIPO´).Value = ´¬´ then begin qryLancamento.Insert; qryLancamento.FieldByName(´Historico´).Value := qryIncidenciaDESCRICAO.Value; qryLancamento.FieldByName(´Valor´).Value := qryIncidenciaValor.Value * qryFuncionariosSalario_REGISTRO.Value div 100; qryLancamento.FieldByName(´Tipo´).Value := qryIncidenciaNatureza.Value; qryLancamento.FieldByName(´CodFunc´).Value := qryFuncionariosCod_Vendedor.Value; qryLancamento.FieldByName(´DATA´).Value := Date; qryLancamento.Post; end else if (qryIncidencia.FieldByName(´TIPO´).VALUE = ´V´) then begin qryLancamento.Insert; qryLancamento.FieldByName(´DATA´).Value := Date; qryLancamento.FieldByName(´Valor´).Value := QryIncidenciaValor.Value; qryLancamento.FieldByName(´Tipo´).Value := QryIncidenciaNatureza.Value; qryLancamento.FieldByName(´CodFunc´).Value := QryFuncionariosCod_Vendedor.Value; qryLancamento.FieldByName(´Historico´).Value := QryIncidenciaDESCRICAO.Value; qryLancamento.Post; end else begin qryLancamento.Open; qryLancamento.Insert; qryLancamento.FieldByName(´DATA´).Value := Date; qryLancamento.FieldByName(´Historico´).Value := ´VALOR SALARIO´; qryLancamento.FieldByName(´Valor´).Value := qryFuncionariosVALOR_SALARIO.Value; qryLancamento.FieldByName(´Tipo´).Value := qryIncidenciaNatureza.Value; qryLancamento.FieldByName(´CodFunc´).Value := qryFuncionariosCod_Vendedor.Value; qryLancamento.Post; qryLancamento.Insert; qryLancamento.FieldByName(´Historico´).Value := ´SALARIO FAMILIA´; qryLancamento.FieldByName(´DATA´).Value := Date; qryLancamento.FieldByName(´Valor´).Value := qryFuncionariosVALOR_SALARIO_FAMILIA.Value * qryFuncionariosQuant_Sal_Familia.Value; qryLancamento.FieldByName(´Tipo´).Value := qryIncidenciaNatureza.Value; qryLancamento.FieldByName(´CodFunc´).Value := qryFuncionariosCod_Vendedor.Value; qryLancamento.Post; end; qryIncidencia.Next; qryLancamento.ApplyUpdates; end; end;
Gostei + 0
22/08/2005
L3gion4rio
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)