Странно у меня вот такой скрипт:
procedure Form1_TableGrid1_OnAfterSort (Sender: string; ACol: Integer);
begin
if Acol=0 then
begin
Form1.TableGrid1.dbCustomOrderBy := 'dataout, record_count';
Form1.TableGrid1.dbUpdate;
end;
end;
procedure frmApplication_OnShow (Sender: string; Action: string);
begin
if Action='Newrecord' then
begin
frmApplication.DateTimePicker2.Text := FormatDateTime('dd.mm.yyyy', now);
frmApplication.EditCounter2.Text := SQLExecute ('SELECT IFNUL(MAX(record_count), 0)+1 FROM Application WHERE dataout='+FormatDateTime('dd.mm.yyyy', now));
end;
end;
procedure Form1_TableGrid1_OnChange (Sender: string);
var
i,c: integer;
k,q: integer;
s: string;
begin
Form1.TableGrid1.BeginUpdate;
q := Form1.TableGrid1.Columns.Count-1;
c := Form1.TableGrid1.RowCount - 1;
for i := 0 to c do
begin
if Form1.TableGrid1.Cells[7,i] = 'УТВЕРЖДЕНИЕ' then
begin
s := Form1.TableGrid1.Cells[4,i];
if ValidDate(s) then
if (StrToDate(s) + 4) < now then
for k := 0 to q do
Form1.TableGrid1.Cell[k,i].Color := clRed;
end;
if Form1.TableGrid1.Cells[7,i] = 'ПОЛУЧЕНИЕ КП' then
begin
s := Form1.TableGrid1.Cells[15,i];
if ValidDate(s) then
if (StrToDate(s) + 3) < now then
for k := 0 to q do
Form1.TableGrid1.Cell[k,i].Color := clyellow;
end;
end;
Form1.TableGrid1.EndUpdate;
end;
begin
end.