Check-in [63ccfa869a]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bugfixes in handling lunch times.
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1: 63ccfa869a4ae068b67ab8200a9b6c6e4caf3476
User & Date: tinus 2015-05-08 08:52:19
Original Comment: Bufixes in handling lunch times.
Context
2015-05-08
08:52
Bugfixes in handling lunch times. Leaf check-in: 63ccfa869a user: tinus tags: trunk
2014-12-04
09:39
Calculate totals when adjusting times. Check for date change on update; fetch new times when that happens. New executable included. check-in: 99b04e4d68 user: tinus tags: trunk
Changes

Changes to src/F_Main.pas.

537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
end{TfrmMain.tmrFetchTimesTimer};

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmMain.tmrUpdateProgressTimer(Sender: TObject);
begin
  try
    try
      if DateOf(FStopTime) < Date then
        FetchHoursOnline;
      FormResize(Self);
    finally
      Self.Invalidate;
    end;
  except
    on E: Exception do begin







|







537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
end{TfrmMain.tmrFetchTimesTimer};

{ ------------------------------------------------------------------------------------------------ }
procedure TfrmMain.tmrUpdateProgressTimer(Sender: TObject);
begin
  try
    try
      if DateOf(FStartTime) < Date then
        FetchHoursOnline;
      FormResize(Self);
    finally
      Self.Invalidate;
    end;
  except
    on E: Exception do begin

Changes to src/F_Times.pas.

96
97
98
99
100
101
102


103
104
105
106
107
108
109
...
141
142
143
144
145
146
147

148
149
150
var
  Lunch, Work: TTime;
begin
  Lunch := TimeOf(dtpLunchStop.Time) - TimeOf(dtpLunchStart.Time);
  if Lunch < 0 then
    Lunch := 0;
  lblTimeLunched.Caption := FormatDateTime('HH:mm', Lunch);



  Work := TimeOf(dtpStop.Time) - TimeOf(dtpStart.Time) - Lunch;
  if Work >= 0 then begin
    lblTimeWorked.Caption := FormatDateTime('HH:mm', Work);
  end else begin
    lblTimeWorked.Caption := '-' + FormatDateTime('HH:mm', -Work);
  end;
................................................................................
  dtpStop.Enabled := chkAdjustTimes.Checked;
  lblStop.Enabled := chkAdjustTimes.Checked;

  dtpLunchStart.Enabled := chkAdjustLunch.Checked;
  lblLunchStart.Enabled := chkAdjustLunch.Checked;
  dtpLunchStop.Enabled := chkAdjustLunch.Checked;
  lblLunchStop.Enabled := chkAdjustLunch.Checked;

end;

end.







>
>







 







>



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
...
143
144
145
146
147
148
149
150
151
152
153
var
  Lunch, Work: TTime;
begin
  Lunch := TimeOf(dtpLunchStop.Time) - TimeOf(dtpLunchStart.Time);
  if Lunch < 0 then
    Lunch := 0;
  lblTimeLunched.Caption := FormatDateTime('HH:mm', Lunch);
  if not chkAdjustLunch.Checked then
    Lunch := 0;

  Work := TimeOf(dtpStop.Time) - TimeOf(dtpStart.Time) - Lunch;
  if Work >= 0 then begin
    lblTimeWorked.Caption := FormatDateTime('HH:mm', Work);
  end else begin
    lblTimeWorked.Caption := '-' + FormatDateTime('HH:mm', -Work);
  end;
................................................................................
  dtpStop.Enabled := chkAdjustTimes.Checked;
  lblStop.Enabled := chkAdjustTimes.Checked;

  dtpLunchStart.Enabled := chkAdjustLunch.Checked;
  lblLunchStart.Enabled := chkAdjustLunch.Checked;
  dtpLunchStop.Enabled := chkAdjustLunch.Checked;
  lblLunchStop.Enabled := chkAdjustLunch.Checked;
  lblTimeLunched.Enabled := chkAdjustLunch.Checked;
end;

end.