95
begin
with form1.Adqqery6 do
begin
close;
sql.Clear;
sql.Add('select max(code) from tabel');
open;
end;
code:=1+form1.Adqqery6Expr1000.AsInteger;
decodedate(datetimepicker1.date,year1,mon1,dt1);
if mon1<10 then m1:='0'+inttostr(mon1) else m1:=inttostr(mon1);
if dt1<10 then d1:='0'+inttostr(dt1) else d1:=inttostr(dt1);
day1:=inttostr(year1)+'/'+m1+'/'+d1;
decodedate(datetimepicker2.date,year1,mon1,dt1);
if mon1<10 then m1:='0'+inttostr(mon1) else m1:=inttostr(mon1);
if dt1<10 then d1:='0'+inttostr(dt1) else d1:=inttostr(dt1);
day2:=inttostr(year1)+'/'+m1+'/'+d1;
with form1.Adqqery5 do
begin
close;
sql.Clear;
sql.Add('delete from tabel where (day>=#'+day1+'#) and
(day<=#'+day2+'#) and (code_sotr='+form1.Adqqery4code_sotr.AsString+')');
execsql;
close;
sql.Clear;
sql.Add('select * from tabel');
open;
end;
datetimepicker3.Date:=datetimepicker1.Date;
while datetimepicker3.Date<=datetimepicker2.Date do
begin
if checkbox1.Checked=true then
begin
if (dayofweek(datetimepicker3.Date)>1) and
(dayofweek(datetimepicker3.Date)<7) then
form1.Adqqery5.AppendRecord([form1.Adqqery4code_sotr.AsInteger,datetime
picker3.Date,form1.Adqqery1code.AsInteger,code]);
end
else
form1.Adqqery5.AppendRecord([form1.Adqqery4code_sotr.AsInteger,datetime
picker3.Date,form1.Adqqery1code.AsInteger,code]);
code:=code+1;