alguma solucao p/ before print no QR ???

22/09/2004

0

boa tarde,

segue o codigo no qual estou enfrentando um probleminha ou problemao....pode-se observar onde esta em negrito que caso condicoes forem aceitas atualizo o subtotal e o total da ativ. agricola, o problema esta ai, onde, quando visualizo tudo bem os valores estao corretos mas quando imprimo o QR duplica meus valores, ou seja, imagino q este executa esta procedure duas vezes....qual seria a solucao p/ evitar esta duplicacao ???

procedure TFRelatorio_AtividadeCorretivoCl.QRSubDetail1BeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
var aux,aux2,aux3,aux4:double;
begin
  if (DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´] * DSCloreto.DataSet[´FXSAIA_TALHAO´]+
  (DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´] * DSCloreto.DataSet[´FXSULCO_TALHAO´]/2))/10>=100 then
    begin
      if(DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´] >= DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´]) then
        begin
          if((DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´]-DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´])<=
          (DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´]*0.3)) then
            begin
              aux:=0;
              aux2:=strtofloat(QRSubTotal1.Caption);
              aux3:=strtofloat(QRTotal.Caption);
              aux4:=int((DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´] * DSCloreto.DataSet[´FXSAIA_TALHAO´] +
              (DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´] * DSCloreto.DataSet[´FXSULCO_TALHAO´] / 2)) / 10) * DSCloreto.DataSet[´MTLINEAR_TALHAO´]  * 2 / 1000 / 1000;
              //subtotal
              QRSubTotal1.Caption:=format(´¬.2f´,[(aux4/2)+aux2]);
              //total
              QRTotal.Caption:=format(´¬.2f´,[(aux4/2)+aux3]);[/b]            end
          else
            aux:=-1;
        end
      else
        begin
          if((DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´]-DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´])<=
          (DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´]*0.3)) then
            begin
              aux:=0;
              aux2:=strtofloat(QRSubTotal1.Caption);
              aux3:=strtofloat(QRTotal.Caption);
              aux4:=int((DSCloreto.DataSet[´FXSAIACLORETO_BALQUIMICO´] * DSCloreto.DataSet[´FXSAIA_TALHAO´] +
              (DSCloreto.DataSet[´FXSULCOCLORETO_BALQUIMICO´] * DSCloreto.DataSet[´FXSULCO_TALHAO´] / 2)) / 10) * DSCloreto.DataSet[´MTLINEAR_TALHAO´]  * 2 / 1000 / 1000;
              //subtotal
              QRSubTotal1.Caption:=format(´¬.2f´,[(aux4/2)+aux2]);
              //total
              QRTotal.Caption:=format(´¬.2f´,[(aux4/2)+aux3]);[/b]
            end
          else
            aux:=-1;
        end;
    end
  else
    aux:=-1;
PrintBand:=aux = 0;
end;



Maikiperin

Maikiperin

Responder

Posts

22/09/2004

Djjunior

no afterprint da banda que vai exibir os valores zere os contadores.

o problema ocorre pq qdo vc dá um preview o qr gera seu relatório, portando vc vai calculando tudo, mas, quando vc manda imprimir o qr gera o relatório todo denovo :twisted: portanto passa por todas as rotinas dinovo e... já viu né total dobrado !


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar