Subversion Repositories delphiutils

Rev

Rev 80 | Rev 83 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 81
1
unit ZeiterfassungMain;
1
unit ZeiterfassungMain;
2
 
2
 
3
interface
3
interface
4
 
4
 
5
uses
5
uses
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
6
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7
  Dialogs, DB, ADODB, Grids, Wwdbigrd, Wwdbgrid, ExtCtrls, DBCtrls, StdCtrls;
7
  Dialogs, DB, ADODB, Grids, Wwdbigrd, Wwdbgrid, ExtCtrls, DBCtrls, StdCtrls;
8
 
8
 
9
type
9
type
10
  TForm1 = class(TForm)
10
  TForm1 = class(TForm)
11
    ADOConnection1: TADOConnection;
11
    ADOConnection1: TADOConnection;
12
    wwDBGrid1: TwwDBGrid;
12
    wwDBGrid1: TwwDBGrid;
13
    ADOTable1: TADOTable;
13
    ADOTable1: TADOTable;
14
    DataSource1: TDataSource;
14
    DataSource1: TDataSource;
15
    ADOTable1TAG: TWideStringField;
15
    ADOTable1TAG: TWideStringField;
16
    ADOTable1KOMMEN: TWideStringField;
16
    ADOTable1KOMMEN: TWideStringField;
17
    ADOTable1PAUSE_START: TWideStringField;
17
    ADOTable1PAUSE_START: TWideStringField;
18
    ADOTable1PAUSE_ENDE: TWideStringField;
18
    ADOTable1PAUSE_ENDE: TWideStringField;
19
    ADOTable1GEHEN: TWideStringField;
19
    ADOTable1GEHEN: TWideStringField;
20
    ADOTable1SONSTIGER_ABZUG: TWideStringField;
20
    ADOTable1SONSTIGER_ABZUG: TWideStringField;
21
    ADOTable1ZUHAUSE: TWideStringField;
21
    ADOTable1ZUHAUSE: TWideStringField;
22
    ADOTable1BERSTUNDEN_SALDO: TIntegerField;
22
    ADOTable1BERSTUNDEN_SALDO: TIntegerField;
23
    ADOTable1BERSTUNDEN: TIntegerField;
23
    ADOTable1BERSTUNDEN: TIntegerField;
24
    ADOTable1FREIER_TAG: TBooleanField;
24
    ADOTable1FREIER_TAG: TBooleanField;
25
    Panel1: TPanel;
25
    Panel1: TPanel;
26
    Button1: TButton;
26
    Button1: TButton;
27
    DBNavigator1: TDBNavigator;
27
    DBNavigator1: TDBNavigator;
28
    ADOTable1WOCHENTAG: TStringField;
28
    ADOTable1WOCHENTAG: TStringField;
29
    ADOTable1USERNAME: TStringField;
29
    ADOTable1USERNAME: TStringField;
30
    ComboBox1: TComboBox;
30
    ComboBox1: TComboBox;
31
    Label1: TLabel;
31
    Label1: TLabel;
32
    Label2: TLabel;
32
    Label2: TLabel;
33
    ADOTable1BEMERKUNG: TStringField;
33
    ADOTable1BEMERKUNG: TStringField;
34
    procedure ADOTable1NewRecord(DataSet: TDataSet);
34
    procedure ADOTable1NewRecord(DataSet: TDataSet);
35
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
35
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
36
    procedure ADOTable1BeforePost(DataSet: TDataSet);
36
    procedure ADOTable1BeforePost(DataSet: TDataSet);
37
    procedure ADOTable1BERSTUNDEN_SALDOGetText(Sender: TField; var Text: string;
37
    procedure ADOTable1BERSTUNDEN_SALDOGetText(Sender: TField; var Text: string;
38
      DisplayText: Boolean);
38
      DisplayText: Boolean);
39
    procedure ADOTable1BERSTUNDENGetText(Sender: TField; var Text: string;
39
    procedure ADOTable1BERSTUNDENGetText(Sender: TField; var Text: string;
40
      DisplayText: Boolean);
40
      DisplayText: Boolean);
41
    procedure wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
41
    procedure wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
42
      State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush);
42
      State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush);
43
    procedure ADOTable1AfterPost(DataSet: TDataSet);
43
    procedure ADOTable1AfterPost(DataSet: TDataSet);
44
    procedure Button1Click(Sender: TObject);
44
    procedure Button1Click(Sender: TObject);
45
    procedure ADOTable1TAGChange(Sender: TField);
45
    procedure ADOTable1TAGChange(Sender: TField);
46
    procedure ADOTable1SONSTIGER_ABZUGSetText(Sender: TField;
46
    procedure ADOTable1SONSTIGER_ABZUGSetText(Sender: TField;
47
      const Text: string);
47
      const Text: string);
48
    procedure ADOTable1ZUHAUSESetText(Sender: TField; const Text: string);
48
    procedure ADOTable1ZUHAUSESetText(Sender: TField; const Text: string);
49
    procedure ADOTable1GEHENSetText(Sender: TField; const Text: string);
49
    procedure ADOTable1GEHENSetText(Sender: TField; const Text: string);
50
    procedure ADOTable1PAUSE_ENDESetText(Sender: TField; const Text: string);
50
    procedure ADOTable1PAUSE_ENDESetText(Sender: TField; const Text: string);
51
    procedure ADOTable1PAUSE_STARTSetText(Sender: TField; const Text: string);
51
    procedure ADOTable1PAUSE_STARTSetText(Sender: TField; const Text: string);
52
    procedure ADOTable1KOMMENSetText(Sender: TField; const Text: string);
52
    procedure ADOTable1KOMMENSetText(Sender: TField; const Text: string);
53
    procedure FormShow(Sender: TObject);
53
    procedure FormShow(Sender: TObject);
54
    procedure ADOTable1WOCHENTAGGetText(Sender: TField; var Text: string;
54
    procedure ADOTable1WOCHENTAGGetText(Sender: TField; var Text: string;
55
      DisplayText: Boolean);
55
      DisplayText: Boolean);
56
    procedure ComboBox1Change(Sender: TObject);
56
    procedure ComboBox1Change(Sender: TObject);
57
    procedure ADOTable1TAGSetText(Sender: TField; const Text: string);
57
    procedure ADOTable1TAGSetText(Sender: TField; const Text: string);
58
    procedure ADOTable1AfterDelete(DataSet: TDataSet);
58
    procedure ADOTable1AfterDelete(DataSet: TDataSet);
59
    procedure ADOTable1TAGGetText(Sender: TField; var Text: string;
59
    procedure ADOTable1TAGGetText(Sender: TField; var Text: string;
60
      DisplayText: Boolean);
60
      DisplayText: Boolean);
61
    procedure ADOTable1KOMMENGetText(Sender: TField; var Text: string;
61
    procedure ADOTable1KOMMENGetText(Sender: TField; var Text: string;
62
      DisplayText: Boolean);
62
      DisplayText: Boolean);
63
    procedure ADOTable1PAUSE_STARTGetText(Sender: TField; var Text: string;
63
    procedure ADOTable1PAUSE_STARTGetText(Sender: TField; var Text: string;
64
      DisplayText: Boolean);
64
      DisplayText: Boolean);
65
    procedure ADOTable1PAUSE_ENDEGetText(Sender: TField; var Text: string;
65
    procedure ADOTable1PAUSE_ENDEGetText(Sender: TField; var Text: string;
66
      DisplayText: Boolean);
66
      DisplayText: Boolean);
67
    procedure ADOTable1GEHENGetText(Sender: TField; var Text: string;
67
    procedure ADOTable1GEHENGetText(Sender: TField; var Text: string;
68
      DisplayText: Boolean);
68
      DisplayText: Boolean);
69
    procedure ADOTable1SONSTIGER_ABZUGGetText(Sender: TField; var Text: string;
69
    procedure ADOTable1SONSTIGER_ABZUGGetText(Sender: TField; var Text: string;
70
      DisplayText: Boolean);
70
      DisplayText: Boolean);
71
    procedure ADOTable1ZUHAUSEGetText(Sender: TField; var Text: string;
71
    procedure ADOTable1ZUHAUSEGetText(Sender: TField; var Text: string;
72
      DisplayText: Boolean);
72
      DisplayText: Boolean);
-
 
73
    procedure ADOTable1BeforeScroll(DataSet: TDataSet);
73
  private
74
  private
74
    function GueltigeZeile: boolean;
75
    function GueltigeZeile: boolean;
75
  protected
76
  protected
76
    procedure ReorgDataSet;
77
    procedure ReorgDataSet;
77
    procedure ReorgAll;
78
    procedure ReorgAll;
78
    function RegelArbeitszeit: integer;
79
    function RegelArbeitszeit: integer;
79
  end;
80
  end;
80
 
81
 
81
var
82
var
82
  Form1: TForm1;
83
  Form1: TForm1;
83
 
84
 
84
implementation
85
implementation
85
 
86
 
86
{$R *.dfm}
87
{$R *.dfm}
87
 
88
 
88
// TODO: Trennstriche zwischen Wochen oder zwischen Urlauben
89
// TODO: Trennstriche zwischen Wochen oder zwischen Urlauben
89
// IDEE: Wochenend-Multiplikator
90
// IDEE: Wochenend-Multiplikator
90
// IDEE: Manche Tage nicht mitrechnen
91
// IDEE: Manche Tage nicht mitrechnen
91
 
92
 
92
uses
93
uses
93
  DateUtils, StrUtils, IniFiles;
94
  DateUtils, StrUtils, IniFiles;
94
 
95
 
95
{$REGION 'Hilfsfunktionen'}
96
{$REGION 'Hilfsfunktionen'}
96
 
97
 
97
function SQL_Escape(const s: string): string;
98
function SQL_Escape(const s: string): string;
98
begin
99
begin
99
  result := StringReplace(s, '''', '\''', [rfReplaceAll]);
100
  result := StringReplace(s, '''', '\''', [rfReplaceAll]);
100
end;
101
end;
101
 
102
 
102
function IstLeer(f: TField): boolean;
103
function IstLeer(f: TField): boolean;
103
begin
104
begin
104
  result := f.IsNull or (f.AsString = '') or (f.AsString = '00:00:00');
105
  result := f.IsNull or (f.AsString = '') or (f.AsString = '00:00:00');
105
end;
106
end;
106
 
107
 
107
function Minuten(f: TField): integer;
108
function Minuten(f: TField): integer;
108
begin
109
begin
109
  if IstLeer(f) then
110
  if IstLeer(f) then
110
  begin
111
  begin
111
    result := 0;
112
    result := 0;
112
  end
113
  end
113
  else
114
  else
114
  begin
115
  begin
115
    result := MinuteOfTheDay(f.AsDateTime);
116
    result := MinuteOfTheDay(f.AsDateTime);
116
  end;
117
  end;
117
end;
118
end;
118
 
119
 
119
function MinutenZuHF_Int(min: integer): string;
120
function MinutenZuHF_Int(min: integer): string;
120
var
121
var
121
  d: integer;
122
  d: integer;
122
begin
123
begin
123
  d := min;
124
  d := min;
124
  if d < 0 then
125
  if d < 0 then
125
  begin
126
  begin
126
    result := '-';
127
    result := '-';
127
    d := -d;
128
    d := -d;
128
  end
129
  end
129
  else
130
  else
130
  begin
131
  begin
131
    result := '';
132
    result := '';
132
  end;
133
  end;
133
  result := result + Format('%.2d:%.2d', [d div 60, d mod 60]);
134
  result := result + Format('%.2d:%.2d', [d div 60, d mod 60]);
134
end;
135
end;
135
 
136
 
136
function MinutenZuHF(f: TField): string;
137
function MinutenZuHF(f: TField): string;
137
begin
138
begin
138
  if IstLeer(f) then
139
  if IstLeer(f) then
139
  begin
140
  begin
140
    result := '';
141
    result := '';
141
  end
142
  end
142
  else
143
  else
143
  begin
144
  begin
144
    result := MinutenZuHF_Int(f.AsInteger);
145
    result := MinutenZuHF_Int(f.AsInteger);
145
  end;
146
  end;
146
end;
147
end;
147
 
148
 
148
function EchtesDatum(f: TField): TDate;
149
function EchtesDatum(f: TField): TDate;
149
begin
150
begin
150
  if Copy(f.AsString, 5, 1) = '-' then
151
  if Copy(f.AsString, 5, 1) = '-' then
151
  begin
152
  begin
152
    result := EncodeDate(
153
    result := EncodeDate(
153
    StrtoInt(Copy(f.AsString, 1, 4)),
154
    StrtoInt(Copy(f.AsString, 1, 4)),
154
    StrtoInt(Copy(f.AsString, 6, 2)),
155
    StrtoInt(Copy(f.AsString, 6, 2)),
155
    StrtoInt(Copy(f.AsString, 9, 2))
156
    StrtoInt(Copy(f.AsString, 9, 2))
156
    );
157
    );
157
  end
158
  end
158
  else
159
  else
159
    result := StrToDate(f.AsString);
160
    result := StrToDate(f.AsString);
160
end;
161
end;
161
 
162
 
162
function WUserName: String;
163
function WUserName: String;
163
var
164
var
164
  nSize: DWord;
165
  nSize: DWord;
165
begin
166
begin
166
  nSize := 1024;
167
  nSize := 1024;
167
  SetLength(Result, nSize);
168
  SetLength(Result, nSize);
168
  if GetUserName(PChar(Result), nSize) then
169
  if GetUserName(PChar(Result), nSize) then
169
    SetLength(Result, nSize-1)
170
    SetLength(Result, nSize-1)
170
  else
171
  else
171
    RaiseLastOSError;
172
    RaiseLastOSError;
172
end;
173
end;
173
 
174
 
174
{$ENDREGION}
175
{$ENDREGION}
175
 
176
 
176
function TForm1.RegelArbeitszeit: integer;
177
function TForm1.RegelArbeitszeit: integer;
177
var
178
var
178
  test: TADOQuery;
179
  test: TADOQuery;
179
begin
180
begin
180
  test := TADOQuery.Create(nil);
181
  test := TADOQuery.Create(nil);
181
  try
182
  try
182
    test.Connection := ADOConnection1;
183
    test.Connection := ADOConnection1;
183
    test.Close;
184
    test.Close;
184
    test.SQL.Text := 'select MINUTEN from REGELARBEITSZEIT where USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
185
    test.SQL.Text := 'select MINUTEN from REGELARBEITSZEIT where USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
185
    test.Open;
186
    test.Open;
186
    if test.RecordCount = 0 then
187
    if test.RecordCount = 0 then
187
    begin
188
    begin
188
      result := 8 * 60;
189
      result := 8 * 60;
189
    end
190
    end
190
    else
191
    else
191
    begin
192
    begin
192
      result := test.FieldByName('MINUTEN').AsInteger;
193
      result := test.FieldByName('MINUTEN').AsInteger;
193
    end;
194
    end;
194
  finally
195
  finally
195
    test.Free;
196
    test.Free;
196
  end;
197
  end;
197
end;
198
end;
198
 
199
 
199
procedure TForm1.ReorgAll;
200
procedure TForm1.ReorgAll;
200
var
201
var
201
  saldo: integer;
202
  saldo: integer;
202
  baks: string;
203
  baks: string;
203
  bakEv: TDataSetNotifyEvent;
204
  bakEv: TDataSetNotifyEvent;
204
  dead: boolean;
205
  dead: boolean;
205
begin
206
begin
206
  if ADOTable1TAG.IsNull then
207
  if ADOTable1TAG.IsNull then
207
  begin
208
  begin
208
    baks := '';
209
    baks := '';
209
  end
210
  end
210
  else
211
  else
211
  begin
212
  begin
212
    if Copy(ADOTable1TAG.AsString, 5, 1) = '-' then
213
    if Copy(ADOTable1TAG.AsString, 5, 1) = '-' then
213
      baks := ADOTable1TAG.AsString
214
      baks := ADOTable1TAG.AsString
214
    else
215
    else
215
      DateTimeToString(baks, 'YYYY-MM-DD', ADOTable1TAG.AsDateTime);
216
      DateTimeToString(baks, 'YYYY-MM-DD', ADOTable1TAG.AsDateTime);
216
  end;
217
  end;
217
  ADOTable1.Requery();
218
  ADOTable1.Requery();
218
 
219
 
219
  bakEv := ADOTable1.AfterPost;
220
  bakEv := ADOTable1.AfterPost;
220
  ADOTable1.AfterPost := nil;
221
  ADOTable1.AfterPost := nil;
221
  ADOTable1.DisableControls;
222
  ADOTable1.DisableControls;
222
  try
223
  try
223
    ADOTable1.First;
224
    ADOTable1.First;
224
    saldo := 0;
225
    saldo := 0;
225
    dead := false;
226
    dead := false;
226
    while not ADOTable1.Eof do
227
    while not ADOTable1.Eof do
227
    begin
228
    begin
228
      ADOTable1.Edit;
229
      ADOTable1.Edit;
229
      if not dead then ReorgDataSet;
230
      if not dead then ReorgDataSet;
230
      dead := dead or ADOTable1BERSTUNDEN.IsNull;
231
      dead := dead or ADOTable1BERSTUNDEN.IsNull;
231
      if dead then
232
      if dead then
232
      begin
233
      begin
233
        ADOTable1BERSTUNDEN_SALDO.Clear;
234
        ADOTable1BERSTUNDEN_SALDO.Clear;
234
      end
235
      end
235
      else
236
      else
236
      begin
237
      begin
237
        saldo := saldo + ADOTable1BERSTUNDEN.AsInteger;
238
        saldo := saldo + ADOTable1BERSTUNDEN.AsInteger;
238
        ADOTable1BERSTUNDEN_SALDO.AsInteger := saldo;
239
        ADOTable1BERSTUNDEN_SALDO.AsInteger := saldo;
239
        saldo := ADOTable1BERSTUNDEN_SALDO.AsInteger;
240
        saldo := ADOTable1BERSTUNDEN_SALDO.AsInteger;
240
      end;
241
      end;
241
      ADOTable1.Post;
242
      ADOTable1.Post;
242
      ADOTable1.Next;
243
      ADOTable1.Next;
243
    end;
244
    end;
244
  finally
245
  finally
245
    if baks <> '' then ADOTable1.Locate('USERNAME;TAG', VarArrayOf([WUserName, baks]), []);
246
    if baks <> '' then ADOTable1.Locate('USERNAME;TAG', VarArrayOf([WUserName, baks]), []);
246
    ADOTable1.AfterPost := bakEv;
247
    ADOTable1.AfterPost := bakEv;
247
    ADOTable1.EnableControls;
248
    ADOTable1.EnableControls;
248
  end;
249
  end;
249
end;
250
end;
250
 
251
 
251
procedure TForm1.ADOTable1AfterDelete(DataSet: TDataSet);
252
procedure TForm1.ADOTable1AfterDelete(DataSet: TDataSet);
252
begin
253
begin
253
  ReorgAll;
254
  ReorgAll;
254
end;
255
end;
255
 
256
 
256
procedure TForm1.ADOTable1AfterPost(DataSet: TDataSet);
257
procedure TForm1.ADOTable1AfterPost(DataSet: TDataSet);
257
begin
258
begin
258
  ReorgAll;
259
  ReorgAll;
259
end;
260
end;
260
 
261
 
261
function TForm1.GueltigeZeile: boolean;
262
function TForm1.GueltigeZeile: boolean;
262
begin
263
begin
263
  result := false;
264
  result := false;
264
 
265
 
265
  if IstLeer(ADOTable1KOMMEN) <> IstLeer(ADOTable1GEHEN) then exit;
266
  if IstLeer(ADOTable1KOMMEN) <> IstLeer(ADOTable1GEHEN) then exit;
266
  if IstLeer(ADOTable1PAUSE_START) <> IstLeer(ADOTable1PAUSE_ENDE) then exit;
267
  if IstLeer(ADOTable1PAUSE_START) <> IstLeer(ADOTable1PAUSE_ENDE) then exit;
267
  if not IstLeer(ADOTable1PAUSE_START) and (ADOTable1PAUSE_START.AsDateTime < ADOTable1KOMMEN.AsDateTime) then exit;
268
  if not IstLeer(ADOTable1PAUSE_START) and (ADOTable1PAUSE_START.AsDateTime < ADOTable1KOMMEN.AsDateTime) then exit;
268
  if not IstLeer(ADOTable1PAUSE_ENDE) and (ADOTable1PAUSE_ENDE.AsDateTime < ADOTable1PAUSE_START.AsDateTime) then exit;
269
  if not IstLeer(ADOTable1PAUSE_ENDE) and (ADOTable1PAUSE_ENDE.AsDateTime < ADOTable1PAUSE_START.AsDateTime) then exit;
269
  if not IstLeer(ADOTable1GEHEN) and (ADOTable1GEHEN.AsDateTime < ADOTable1KOMMEN.AsDateTime) then exit;
270
  if not IstLeer(ADOTable1GEHEN) and (ADOTable1GEHEN.AsDateTime < ADOTable1KOMMEN.AsDateTime) then exit;
270
  if not IstLeer(ADOTable1GEHEN) and not IstLeer(ADOTable1PAUSE_START) and (ADOTable1GEHEN.AsDateTime < ADOTable1PAUSE_START.AsDateTime) then exit;
271
  if not IstLeer(ADOTable1GEHEN) and not IstLeer(ADOTable1PAUSE_START) and (ADOTable1GEHEN.AsDateTime < ADOTable1PAUSE_START.AsDateTime) then exit;
271
  if not IstLeer(ADOTable1GEHEN) and not IstLeer(ADOTable1PAUSE_ENDE) and (ADOTable1GEHEN.AsDateTime < ADOTable1PAUSE_ENDE.AsDateTime) then exit;
272
  if not IstLeer(ADOTable1GEHEN) and not IstLeer(ADOTable1PAUSE_ENDE) and (ADOTable1GEHEN.AsDateTime < ADOTable1PAUSE_ENDE.AsDateTime) then exit;
272
 
273
 
273
  result := true;
274
  result := true;
274
end;
275
end;
275
 
276
 
276
procedure TForm1.ReorgDataSet;
277
procedure TForm1.ReorgDataSet;
277
var
278
var
278
  m: integer;
279
  m: integer;
279
begin
280
begin
280
  if GueltigeZeile then
281
  if GueltigeZeile then
281
  begin
282
  begin
282
    m :=   (Minuten(ADOTable1GEHEN) - Minuten(ADOTable1KOMMEN))
283
    m :=   (Minuten(ADOTable1GEHEN) - Minuten(ADOTable1KOMMEN))
283
         - (Minuten(ADOTable1PAUSE_ENDE) - Minuten(ADOTable1PAUSE_START))
284
         - (Minuten(ADOTable1PAUSE_ENDE) - Minuten(ADOTable1PAUSE_START))
284
         - Minuten(ADOTable1SONSTIGER_ABZUG)
285
         - Minuten(ADOTable1SONSTIGER_ABZUG)
285
         + Minuten(ADOTable1ZUHAUSE);
286
         + Minuten(ADOTable1ZUHAUSE);
286
 
287
 
287
    if not ADOTable1FREIER_TAG.AsBoolean then
288
    if not ADOTable1FREIER_TAG.AsBoolean then
288
    begin
289
    begin
289
      m := m - RegelArbeitszeit;
290
      m := m - RegelArbeitszeit;
290
    end;
291
    end;
291
 
292
 
292
    ADOTable1BERSTUNDEN.AsInteger := m;
293
    ADOTable1BERSTUNDEN.AsInteger := m;
293
  end
294
  end
294
  else
295
  else
295
  begin
296
  begin
296
    ADOTable1BERSTUNDEN.Clear;
297
    ADOTable1BERSTUNDEN.Clear;
297
  end;
298
  end;
298
end;
299
end;
299
 
300
 
300
procedure TForm1.ADOTable1BeforePost(DataSet: TDataSet);
301
procedure TForm1.ADOTable1BeforePost(DataSet: TDataSet);
301
begin
302
begin
302
  if (ADOTable1.State = dsInsert) and ADOTable1TAG.IsNull then
303
  if (ADOTable1.State = dsInsert) and ADOTable1TAG.IsNull then
303
  begin
304
  begin
304
    AdoTable1.Cancel;
305
    AdoTable1.Cancel;
305
    Abort;
306
    Abort;
306
  end;
307
  end;
307
 
308
 
308
  ReorgDataSet;
309
  ReorgDataSet;
309
end;
310
end;
310
 
311
 
-
 
312
procedure TForm1.ADOTable1BeforeScroll(DataSet: TDataSet);
-
 
313
begin
-
 
314
  if (DataSet.State = dsInsert) and (not ADOTable1TAG.IsNull) then Dataset.Post;
-
 
315
end;
-
 
316
 
311
procedure TForm1.ADOTable1BERSTUNDENGetText(Sender: TField; var Text: string;
317
procedure TForm1.ADOTable1BERSTUNDENGetText(Sender: TField; var Text: string;
312
  DisplayText: Boolean);
318
  DisplayText: Boolean);
313
begin
319
begin
314
  Text := MinutenZuHF(ADOTable1BERSTUNDEN);
320
  Text := MinutenZuHF(ADOTable1BERSTUNDEN);
315
end;
321
end;
316
 
322
 
317
procedure TForm1.ADOTable1BERSTUNDEN_SALDOGetText(Sender: TField;
323
procedure TForm1.ADOTable1BERSTUNDEN_SALDOGetText(Sender: TField;
318
  var Text: string; DisplayText: Boolean);
324
  var Text: string; DisplayText: Boolean);
319
begin
325
begin
320
  Text := MinutenZuHF(ADOTable1BERSTUNDEN_SALDO);
326
  Text := MinutenZuHF(ADOTable1BERSTUNDEN_SALDO);
321
end;
327
end;
322
 
328
 
323
procedure TForm1.ADOTable1GEHENGetText(Sender: TField; var Text: string;
329
procedure TForm1.ADOTable1GEHENGetText(Sender: TField; var Text: string;
324
  DisplayText: Boolean);
330
  DisplayText: Boolean);
325
begin
331
begin
326
  Text := Copy(Sender.AsString, 1, 5);
332
  Text := Copy(Sender.AsString, 1, 5);
327
end;
333
end;
328
 
334
 
329
procedure TForm1.ADOTable1GEHENSetText(Sender: TField; const Text: string);
335
procedure TForm1.ADOTable1GEHENSetText(Sender: TField; const Text: string);
330
begin
336
begin
331
  if Text = '' then
337
  if Text = '' then
332
  begin
338
  begin
333
    ADOTable1GEHEN.Clear;
339
    ADOTable1GEHEN.Clear;
334
  end
340
  end
335
  else
341
  else
336
  begin
342
  begin
337
    if Pos(':', Text) = 0 then
343
    if Pos(':', Text) = 0 then
338
      ADOTable1GEHEN.AsString := Text + ':00'
344
      ADOTable1GEHEN.AsString := Text + ':00'
339
    else
345
    else
340
      ADOTable1GEHEN.AsString := Text;
346
      ADOTable1GEHEN.AsString := Text;
341
  end;
347
  end;
342
end;
348
end;
343
 
349
 
344
procedure TForm1.ADOTable1KOMMENGetText(Sender: TField; var Text: string;
350
procedure TForm1.ADOTable1KOMMENGetText(Sender: TField; var Text: string;
345
  DisplayText: Boolean);
351
  DisplayText: Boolean);
346
begin
352
begin
347
  Text := Copy(Sender.AsString, 1, 5);
353
  Text := Copy(Sender.AsString, 1, 5);
348
end;
354
end;
349
 
355
 
350
procedure TForm1.ADOTable1KOMMENSetText(Sender: TField; const Text: string);
356
procedure TForm1.ADOTable1KOMMENSetText(Sender: TField; const Text: string);
351
begin
357
begin
352
  if Text = '' then
358
  if Text = '' then
353
  begin
359
  begin
354
    ADOTable1KOMMEN.Clear;
360
    ADOTable1KOMMEN.Clear;
355
  end
361
  end
356
  else
362
  else
357
  begin
363
  begin
358
    if Pos(':', Text) = 0 then
364
    if Pos(':', Text) = 0 then
359
      ADOTable1KOMMEN.AsString := Text + ':00'
365
      ADOTable1KOMMEN.AsString := Text + ':00'
360
    else
366
    else
361
      ADOTable1KOMMEN.AsString := Text;
367
      ADOTable1KOMMEN.AsString := Text;
362
  end;
368
  end;
363
end;
369
end;
364
 
370
 
365
procedure TForm1.ADOTable1NewRecord(DataSet: TDataSet);
371
procedure TForm1.ADOTable1NewRecord(DataSet: TDataSet);
366
var
372
var
367
  test: TADOQuery;
373
  test: TADOQuery;
368
begin
374
begin
369
  ADOTable1FREIER_TAG.AsBoolean := false;
375
  ADOTable1FREIER_TAG.AsBoolean := false;
370
  ADOTable1USERNAME.AsString := WUserName;
376
  ADOTable1USERNAME.AsString := WUserName;
371
  test := TADOQuery.Create(nil);
377
  test := TADOQuery.Create(nil);
372
  try
378
  try
373
    test.Connection := ADOConnection1;
379
    test.Connection := ADOConnection1;
374
    test.Close;
380
    test.Close;
375
    test.SQL.Text := 'select * from TAGE where TAG = ''' + DateToStr(Date) + ''' and USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
381
    test.SQL.Text := 'select * from TAGE where TAG = ''' + DateToStr(Date) + ''' and USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
376
    test.Open;
382
    test.Open;
377
    if test.RecordCount = 0 then
383
    if test.RecordCount = 0 then
378
    begin
384
    begin
-
 
385
 
379
      ADOTable1TAG.AsDateTime := Date;
386
      ADOTable1TAG.AsDateTime := Date;
380
      ADOTable1KOMMEN.AsString := TimeToStr(Time);
387
      ADOTable1KOMMEN.AsString := TimeToStr(Time);
381
      ADOTable1FREIER_TAG.AsBoolean := (DayOfWeek(Date) = 1{Sunday}) or
388
      ADOTable1FREIER_TAG.AsBoolean := (DayOfWeek(Date) = 1{Sunday}) or
382
                                       (DayOfWeek(Date) = 7{Saturday});
389
                                       (DayOfWeek(Date) = 7{Saturday});
383
    end;
390
    end;
384
  finally
391
  finally
385
    test.Free;
392
    test.Free;
386
  end;
393
  end;
387
 
394
 
388
  wwDBGrid1.SelectedField := ADOTable1TAG;
395
  wwDBGrid1.SelectedField := ADOTable1TAG;
389
end;
396
end;
390
 
397
 
391
procedure TForm1.ADOTable1PAUSE_ENDEGetText(Sender: TField; var Text: string;
398
procedure TForm1.ADOTable1PAUSE_ENDEGetText(Sender: TField; var Text: string;
392
  DisplayText: Boolean);
399
  DisplayText: Boolean);
393
begin
400
begin
394
  Text := Copy(Sender.AsString, 1, 5);
401
  Text := Copy(Sender.AsString, 1, 5);
395
end;
402
end;
396
 
403
 
397
procedure TForm1.ADOTable1PAUSE_ENDESetText(Sender: TField; const Text: string);
404
procedure TForm1.ADOTable1PAUSE_ENDESetText(Sender: TField; const Text: string);
398
begin
405
begin
399
  if Text = '' then
406
  if Text = '' then
400
  begin
407
  begin
401
    ADOTable1PAUSE_ENDE.Clear;
408
    ADOTable1PAUSE_ENDE.Clear;
402
  end
409
  end
403
  else
410
  else
404
  begin
411
  begin
405
    if Pos(':', Text) = 0 then
412
    if Pos(':', Text) = 0 then
406
      ADOTable1PAUSE_ENDE.AsString := Text + ':00'
413
      ADOTable1PAUSE_ENDE.AsString := Text + ':00'
407
    else
414
    else
408
      ADOTable1PAUSE_ENDE.AsString := Text;
415
      ADOTable1PAUSE_ENDE.AsString := Text;
409
  end;
416
  end;
410
end;
417
end;
411
 
418
 
412
procedure TForm1.ADOTable1PAUSE_STARTGetText(Sender: TField; var Text: string;
419
procedure TForm1.ADOTable1PAUSE_STARTGetText(Sender: TField; var Text: string;
413
  DisplayText: Boolean);
420
  DisplayText: Boolean);
414
begin
421
begin
415
  Text := Copy(Sender.AsString, 1, 5);
422
  Text := Copy(Sender.AsString, 1, 5);
416
end;
423
end;
417
 
424
 
418
procedure TForm1.ADOTable1PAUSE_STARTSetText(Sender: TField;
425
procedure TForm1.ADOTable1PAUSE_STARTSetText(Sender: TField;
419
  const Text: string);
426
  const Text: string);
420
begin
427
begin
421
  if Text = '' then
428
  if Text = '' then
422
  begin
429
  begin
423
    ADOTable1PAUSE_START.Clear;
430
    ADOTable1PAUSE_START.Clear;
424
  end
431
  end
425
  else
432
  else
426
  begin
433
  begin
427
    if Pos(':', Text) = 0 then
434
    if Pos(':', Text) = 0 then
428
      ADOTable1PAUSE_START.AsString := Text + ':00'
435
      ADOTable1PAUSE_START.AsString := Text + ':00'
429
    else
436
    else
430
      ADOTable1PAUSE_START.AsString := Text;
437
      ADOTable1PAUSE_START.AsString := Text;
431
  end;
438
  end;
432
end;
439
end;
433
 
440
 
434
procedure TForm1.ADOTable1SONSTIGER_ABZUGGetText(Sender: TField;
441
procedure TForm1.ADOTable1SONSTIGER_ABZUGGetText(Sender: TField;
435
  var Text: string; DisplayText: Boolean);
442
  var Text: string; DisplayText: Boolean);
436
begin
443
begin
437
  Text := Copy(Sender.AsString, 1, 5);
444
  Text := Copy(Sender.AsString, 1, 5);
438
end;
445
end;
439
 
446
 
440
procedure TForm1.ADOTable1SONSTIGER_ABZUGSetText(Sender: TField;
447
procedure TForm1.ADOTable1SONSTIGER_ABZUGSetText(Sender: TField;
441
  const Text: string);
448
  const Text: string);
442
begin
449
begin
443
  if Text = '' then
450
  if Text = '' then
444
  begin
451
  begin
445
    ADOTable1SONSTIGER_ABZUG.Clear;
452
    ADOTable1SONSTIGER_ABZUG.Clear;
446
  end
453
  end
447
  else
454
  else
448
  begin
455
  begin
449
    if Pos(':', Text) = 0 then
456
    if Pos(':', Text) = 0 then
450
      ADOTable1SONSTIGER_ABZUG.AsString := Text + ':00'
457
      ADOTable1SONSTIGER_ABZUG.AsString := Text + ':00'
451
    else
458
    else
452
      ADOTable1SONSTIGER_ABZUG.AsString := Text;
459
      ADOTable1SONSTIGER_ABZUG.AsString := Text;
453
  end;
460
  end;
454
end;
461
end;
455
 
462
 
456
procedure TForm1.ADOTable1TAGChange(Sender: TField);
463
procedure TForm1.ADOTable1TAGChange(Sender: TField);
457
begin
464
begin
458
  ADOTable1FREIER_TAG.AsBoolean := (DayOfWeek(ADOTable1TAG.AsDateTime) = 1{Sunday}) or
465
  ADOTable1FREIER_TAG.AsBoolean := (DayOfWeek(ADOTable1TAG.AsDateTime) = 1{Sunday}) or
459
                                   (DayOfWeek(ADOTable1TAG.AsDateTime) = 7{Saturday});
466
                                   (DayOfWeek(ADOTable1TAG.AsDateTime) = 7{Saturday});
460
  // TODO: "Wochentag" Feld aktualisieren
467
  // TODO: "Wochentag" Feld aktualisieren
461
end;
468
end;
462
 
469
 
463
procedure TForm1.ADOTable1TAGGetText(Sender: TField; var Text: string;
470
procedure TForm1.ADOTable1TAGGetText(Sender: TField; var Text: string;
464
  DisplayText: Boolean);
471
  DisplayText: Boolean);
465
begin
472
begin
466
  if IstLeer(Sender) then
473
  if IstLeer(Sender) then
467
    Text := Sender.AsString
474
    Text := Sender.AsString
468
  else
475
  else
469
    Text := DateToStr(EchtesDatum(Sender));
476
    Text := DateToStr(EchtesDatum(Sender));
470
end;
477
end;
471
 
478
 
472
procedure TForm1.ADOTable1TAGSetText(Sender: TField; const Text: string);
479
procedure TForm1.ADOTable1TAGSetText(Sender: TField; const Text: string);
473
var
480
var
474
  i, punktCount: integer;
481
  i, punktCount: integer;
475
begin
482
begin
476
  punktCount := 0;
483
  punktCount := 0;
477
  for i := 1 to Length(Text) do
484
  for i := 1 to Length(Text) do
478
  begin
485
  begin
479
    if Text[i] = '.' then inc(punktCount);
486
    if Text[i] = '.' then inc(punktCount);
480
  end;
487
  end;
481
 
488
 
482
  if punktCount = 1 then
489
  if punktCount = 1 then
483
  begin
490
  begin
484
    ADOTable1TAG.AsString := Text + '.' + IntToStr(CurrentYear);
491
    ADOTable1TAG.AsString := Text + '.' + IntToStr(CurrentYear);
485
  end
492
  end
486
  else if (PunktCount = 2) and EndsStr('.',Text) then
493
  else if (PunktCount = 2) and EndsStr('.',Text) then
487
  begin
494
  begin
488
    ADOTable1TAG.AsString := Text + IntToStr(CurrentYear);
495
    ADOTable1TAG.AsString := Text + IntToStr(CurrentYear);
489
  end
496
  end
490
  else
497
  else
491
  begin
498
  begin
492
    ADOTable1TAG.AsString := Text;
499
    ADOTable1TAG.AsString := Text;
493
  end;
500
  end;
494
end;
501
end;
495
 
502
 
496
procedure TForm1.ADOTable1WOCHENTAGGetText(Sender: TField; var Text: string;
503
procedure TForm1.ADOTable1WOCHENTAGGetText(Sender: TField; var Text: string;
497
  DisplayText: Boolean);
504
  DisplayText: Boolean);
498
begin
505
begin
499
  try
506
  try
500
    if ADOTable1TAG.AsString <> '' then
507
    if ADOTable1TAG.AsString <> '' then
501
      Text := ShortDayNames[DayOfWeek(EchtesDatum(ADOTable1TAG))]
508
      Text := ShortDayNames[DayOfWeek(EchtesDatum(ADOTable1TAG))]
502
    else
509
    else
503
      Text := '';
510
      Text := '';
504
  except
511
  except
505
    Text := '??';
512
    Text := '??';
506
  end;
513
  end;
507
end;
514
end;
508
 
515
 
509
procedure TForm1.ADOTable1ZUHAUSEGetText(Sender: TField; var Text: string;
516
procedure TForm1.ADOTable1ZUHAUSEGetText(Sender: TField; var Text: string;
510
  DisplayText: Boolean);
517
  DisplayText: Boolean);
511
begin
518
begin
512
  Text := Copy(Sender.AsString, 1, 5);
519
  Text := Copy(Sender.AsString, 1, 5);
513
end;
520
end;
514
 
521
 
515
procedure TForm1.ADOTable1ZUHAUSESetText(Sender: TField; const Text: string);
522
procedure TForm1.ADOTable1ZUHAUSESetText(Sender: TField; const Text: string);
516
begin
523
begin
517
  if Text = '' then
524
  if Text = '' then
518
  begin
525
  begin
519
    ADOTable1ZUHAUSE.Clear;
526
    ADOTable1ZUHAUSE.Clear;
520
  end
527
  end
521
  else
528
  else
522
  begin
529
  begin
523
    if Pos(':', Text) = 0 then
530
    if Pos(':', Text) = 0 then
524
      ADOTable1ZUHAUSE.AsString := Text + ':00'
531
      ADOTable1ZUHAUSE.AsString := Text + ':00'
525
    else
532
    else
526
      ADOTable1ZUHAUSE.AsString := Text;
533
      ADOTable1ZUHAUSE.AsString := Text;
527
  end;
534
  end;
528
end;
535
end;
529
 
536
 
530
procedure TForm1.Button1Click(Sender: TObject);
537
procedure TForm1.Button1Click(Sender: TObject);
531
begin
538
begin
532
  ReorgAll;
539
  ReorgAll;
533
end;
540
end;
534
 
541
 
535
procedure TForm1.ComboBox1Change(Sender: TObject);
542
procedure TForm1.ComboBox1Change(Sender: TObject);
536
begin
543
begin
537
  Label2.Caption := MinutenZuHF_Int(RegelArbeitszeit) + ' Std.';
544
  Label2.Caption := MinutenZuHF_Int(RegelArbeitszeit) + ' Std.';
538
 
545
 
539
  ADOTable1.DisableControls;
546
  ADOTable1.DisableControls;
540
 
547
 
541
  ADOTable1.Active := false;
548
  ADOTable1.Active := false;
542
  ADOTable1.ReadOnly := false;
549
  ADOTable1.ReadOnly := false;
543
  ADOTable1.Filter := 'USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
550
  ADOTable1.Filter := 'USERNAME = ''' + SQL_Escape(ComboBox1.Text) + '''';
544
  ADOTable1.Filtered := true;
551
  ADOTable1.Filtered := true;
545
  ADOTable1.Active := true;
552
  ADOTable1.Active := true;
546
 
553
 
547
  ReorgAll;
554
  ReorgAll;
548
 
555
 
549
  ADOTable1.Active := false;
556
  ADOTable1.Active := false;
550
  ADOTable1.ReadOnly := ComboBox1.Text <> WUserName;
557
  ADOTable1.ReadOnly := ComboBox1.Text <> WUserName;
551
  ADOTable1.Active := true;
558
  ADOTable1.Active := true;
552
 
559
 
553
  ADOTable1.Last;
560
  ADOTable1.Last;
554
  Button1.Enabled := not ADOTable1.ReadOnly;
561
  Button1.Enabled := not ADOTable1.ReadOnly;
555
 
562
 
556
  ADOTable1.EnableControls;
563
  ADOTable1.EnableControls;
557
end;
564
end;
558
 
565
 
559
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
566
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
560
begin
567
begin
561
  if ADOTable1.State in [dsEdit, dsInsert] then
568
  if ADOTable1.State in [dsEdit, dsInsert] then
562
  begin
569
  begin
563
    try
570
    try
564
      ADOTable1.Post;
571
      ADOTable1.Post;
565
    except
572
    except
566
      on E: EAbort do
573
      on E: EAbort do
567
      begin
574
      begin
568
        exit;
575
        exit;
569
      end;
576
      end;
570
    end;
577
    end;
571
  end;
578
  end;
572
end;
579
end;
573
 
580
 
574
procedure TForm1.FormShow(Sender: TObject);
581
procedure TForm1.FormShow(Sender: TObject);
575
var
582
var
576
  test: TADOQuery;
583
  test: TADOQuery;
577
  ini: TMemIniFile;
584
  ini: TMemIniFile;
578
resourcestring
585
resourcestring
579
  DefaultConnectionString = 'Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Zeiterfassung;' +
586
  DefaultConnectionString = 'Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Zeiterfassung;' +
580
                            'Data Source=SHS\FiVe,49007;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MARSCHALL;Use Encryption for Data=False;Tag with column collation when possible=False;';
587
                            'Data Source=SHS\FiVe,49007;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MARSCHALL;Use Encryption for Data=False;Tag with column collation when possible=False;';
581
begin
588
begin
582
  ini := TMemIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + ChangeFileExt(ExtractFileName(ParamStr(0)), '.ini'));
589
  ini := TMemIniFile.Create(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + ChangeFileExt(ExtractFileName(ParamStr(0)), '.ini'));
583
  try
590
  try
584
    ADOConnection1.ConnectionString := ini.ReadString('Connection', 'ConnectionString', DefaultConnectionString);
591
    ADOConnection1.ConnectionString := ini.ReadString('Connection', 'ConnectionString', DefaultConnectionString);
585
  finally
592
  finally
586
    ini.Free;
593
    ini.Free;
587
  end;
594
  end;
588
  ADOConnection1.Connected := true;
595
  ADOConnection1.Connected := true;
589
 
596
 
590
  {$REGION 'Username Combobox füllen'}
597
  {$REGION 'Username Combobox füllen'}
591
  test := TADOQuery.Create(nil);
598
  test := TADOQuery.Create(nil);
592
  try
599
  try
593
    test.Connection := ADOConnection1;
600
    test.Connection := ADOConnection1;
594
    test.Close;
601
    test.Close;
595
    test.SQL.Text := 'select distinct USERNAME from TAGE';
602
    test.SQL.Text := 'select distinct USERNAME from TAGE';
596
    test.Open;
603
    test.Open;
597
    ComboBox1.Items.Clear;
604
    ComboBox1.Items.Clear;
598
    while not test.EOF do
605
    while not test.EOF do
599
    begin
606
    begin
600
      ComboBox1.Items.Add(test.FieldByName('USERNAME').AsString);
607
      ComboBox1.Items.Add(test.FieldByName('USERNAME').AsString);
601
      test.Next;
608
      test.Next;
602
    end;
609
    end;
603
  finally
610
  finally
604
    test.Free;
611
    test.Free;
605
  end;
612
  end;
606
 
613
 
607
  if ComboBox1.Items.IndexOf(WUserName) = -1 then
614
  if ComboBox1.Items.IndexOf(WUserName) = -1 then
608
    ComboBox1.Items.Add(WUserName);
615
    ComboBox1.Items.Add(WUserName);
609
 
616
 
610
  ComboBox1.Sorted := true;
617
  ComboBox1.Sorted := true;
611
 
618
 
612
  ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(WUserName);
619
  ComboBox1.ItemIndex := ComboBox1.Items.IndexOf(WUserName);
613
 
620
 
614
  ComboBox1Change(ComboBox1);
621
  ComboBox1Change(ComboBox1);
615
  {$ENDREGION}
622
  {$ENDREGION}
616
 
623
 
617
  if wwDBGrid1.CanFocus then wwDBGrid1.SetFocus;
624
  if wwDBGrid1.CanFocus then wwDBGrid1.SetFocus;
618
  wwDBGrid1.SelectedField := ADOTable1TAG;
625
  wwDBGrid1.SelectedField := ADOTable1TAG;
619
end;
626
end;
620
 
627
 
621
procedure TForm1.wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
628
procedure TForm1.wwDBGrid1CalcCellColors(Sender: TObject; Field: TField;
622
  State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush);
629
  State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush);
623
begin
630
begin
624
  if Highlight then exit;
631
  if Highlight then exit;
625
 
632
 
626
  if (Field.FieldName = ADOTable1WOCHENTAG.FieldName) or
633
  if (Field.FieldName = ADOTable1WOCHENTAG.FieldName) or
627
     (Field.FieldName = ADOTable1BERSTUNDEN.FieldName) or
634
     (Field.FieldName = ADOTable1BERSTUNDEN.FieldName) or
628
     (Field.FieldName = ADOTable1BERSTUNDEN_SALDO.FieldName) then
635
     (Field.FieldName = ADOTable1BERSTUNDEN_SALDO.FieldName) then
629
  begin
636
  begin
630
    ABrush.Color := clBtnFace;
637
    ABrush.Color := clBtnFace;
631
  end;
638
  end;
632
 
639
 
633
  if (Field.FieldName = ADOTable1BERSTUNDEN.FieldName) then
640
  if (Field.FieldName = ADOTable1BERSTUNDEN.FieldName) then
634
  begin
641
  begin
635
    if ADOTable1BERSTUNDEN.AsInteger < 0 then
642
    if ADOTable1BERSTUNDEN.AsInteger < 0 then
636
    begin
643
    begin
637
      AFont.Color := clRed;
644
      AFont.Color := clRed;
638
    end;
645
    end;
639
  end;
646
  end;
640
 
647
 
641
  if (Field.FieldName = ADOTable1BERSTUNDEN_SALDO.FieldName) then
648
  if (Field.FieldName = ADOTable1BERSTUNDEN_SALDO.FieldName) then
642
  begin
649
  begin
643
    if ADOTable1BERSTUNDEN_SALDO.AsInteger < 0 then
650
    if ADOTable1BERSTUNDEN_SALDO.AsInteger < 0 then
644
    begin
651
    begin
645
      AFont.Color := clRed;
652
      AFont.Color := clRed;
646
    end;
653
    end;
647
  end;
654
  end;
648
end;
655
end;
649
 
656
 
650
end.
657
end.
651
 
658