• R/O
  • SSH
  • HTTPS

cico: Commit


Commit MetaInfo

Revisión20 (tree)
Tiempo2020-03-12 04:32:58
Autorderekwildstar

Log Message

Recriado o procedure ObterSaldoGlobal para corrigir o erro que calculava errado o saldo global quando, em um dado momento, uma pessoa ficava com mais de 24h de saldo acumulado

Cambiar Resumen

Diferencia incremental

--- trunk/client/src/cico/UDAMOPrincipal.pas (revision 19)
+++ trunk/client/src/cico/UDAMOPrincipal.pas (revision 20)
@@ -96,34 +96,43 @@
9696
9797 procedure TDAMOPrincipal.ObterSaldoGlobal;
9898 var
99- Ano: Word;
100- Mes: Byte;
99+ SaldoGlobal: SmallInt;
101100 begin
102101 FORMPrincipal.PNBBSaldoGlobal.Font.Color := clWhite;
103102
104- Ano := FDTASaldos.ParamByName('ano').AsWord;
105- Mes := FDTASaldos.ParamByName('mes').AsByte;
106- try
107- FDTASaldos.ParamByName('mes').Clear;
108- FDTASaldos.ParamByName('ano').Clear;
109- FDTASaldos.Refresh;
103+ with TFDQuery.Create(nil) do
104+ try
105+ Connection := FDCO;
106+ SQL.Text := 'select sum(saldo) from saldos group by ano,mes';
107+ Open;
110108
111- if (FDTASaldos.RecordCount > 0) and (not FDTASaldosSaldoMensal.IsNull) then
112- begin
113- if FDTASaldosSaldoMensal.AsInteger > 0 then
114- FORMPrincipal.PNBBSaldoGlobal.Font.Color := clLime
115- else if FDTASaldosSaldoMensal.AsInteger < 0 then
116- FORMPrincipal.PNBBSaldoGlobal.Font.Color := clRed;
109+ if RecordCount > 0 then
110+ begin
111+ SaldoGlobal := 0;
117112
118- FORMPrincipal.PNBBSaldoGlobal.Caption := FormatarHorasMinutos(FDTASaldosSaldoMensal.AsInteger);
119- end
120- else
121- FORMPrincipal.PNBBSaldoGlobal.Caption := ' 00:00';
122- finally
123- FDTASaldos.ParamByName('ano').AsWord := Ano;
124- FDTASaldos.ParamByName('mes').AsByte := Mes;
125- FDTASaldos.Refresh;
126- end;
113+ while not Eof do
114+ begin
115+ SaldoGlobal := SaldoGlobal + Fields[0].AsInteger;
116+
117+ if SaldoGlobal > 1440 then // 24:00
118+ SaldoGlobal := 1440;
119+
120+ Next;
121+ end;
122+
123+ if SaldoGlobal > 0 then
124+ FORMPrincipal.PNBBSaldoGlobal.Font.Color := clLime
125+ else if SaldoGlobal < 0 then
126+ FORMPrincipal.PNBBSaldoGlobal.Font.Color := clRed;
127+
128+ FORMPrincipal.PNBBSaldoGlobal.Caption := FormatarHorasMinutos(SaldoGlobal);
129+ end
130+ else
131+ FORMPrincipal.PNBBSaldoGlobal.Caption := ' 00:00';
132+ finally
133+ Close;
134+ Free;
135+ end;
127136 end;
128137
129138 procedure TDAMOPrincipal.ObterSaldoMensal;
Show on old repository browser