begin
dt1:=Formatdatetime('YYYYMMDD', Now);
with dm.workrecord_Query do
dm.workrecord_Query.Close;
dm.workrecord_Query.SQL.Clear;
dm.workrecord_Query.SQL.Add('select max(workrecordid) as maxno from workrecord where workrecordid like '''+dt1+'''');
dm.workrecord_Query.open;
if dm.workrecord_Query.fieldbyname('maxno').asstring ='' then
begin
delete(dt1,1,1);
qt2:='2'+dt1+'001';
end
else
begin
qt1:=dm.workrecord_Query.FieldByName('maxno').asstring;
delete(qt1,1,1);
qn1:=strtoint(qt1)+1;
qt2:=inttostr(qn1);
insert('2',qt2,1);
end;
record_RzEdit.Text:=qt2;
dt1:=Formatdatetime('YYYYMMDD', Now);
with dm.workrecord_Query do
dm.workrecord_Query.Close;
dm.workrecord_Query.SQL.Clear;
dm.workrecord_Query.SQL.Add('select max(workrecordid) as maxno from workrecord where workrecordid like '''+dt1+'''');
dm.workrecord_Query.open;
if dm.workrecord_Query.fieldbyname('maxno').asstring ='' then
begin
delete(dt1,1,1);
qt2:='2'+dt1+'001';
end
else
begin
qt1:=dm.workrecord_Query.FieldByName('maxno').asstring;
delete(qt1,1,1);
qn1:=strtoint(qt1)+1;
qt2:=inttostr(qn1);
insert('2',qt2,1);
end;
record_RzEdit.Text:=qt2;
解决方案 »
- 一个函数在程序里执行的时候返回值不稳定,高手进,内详
- 如何把Fastreport(ver:2.5x)报表按预览时的方式完全导出到Excel中,速度要快!!
- 再提问?---如何在预览时可以看到报表的另一半?
- 如何使listView控件的项在失去焦点之后,仍然保持选中状态?
- 比较简单的问题,不过我有点糊涂,谁指点一下
- shape3为什么不动?
- delphi中能否动态在远程SQL SERVER2000上创建新的数据库,如何实现?谢谢
- 文件判断
- CreateOleObject 链接Word报错,无法连接。
- 今天真的不高兴来给大家加分了(人人有分)
- 求语音坐席的完整方案,重酬!
- CSDN坛子今天十周年了!发帖祝贺
dd Displays the day as a number with a leading zero (01-31).
ddd Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.
dddd Displays the day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.
ddddd Displays the date using the format given by the ShortDateFormat global variable.
dddddd Displays the date using the format given by the LongDateFormat global variable.
e (Windows only) Displays the year in the current period/era as a number without a leading zero (Japanese, Korean and Taiwanese locales only).
ee (Windows only) Displays the year in the current period/era as a number with a leading zero (Japanese, Korean and Taiwanese locales only).
g (Windows only) Displays the period/era as an abbreviation (Japanese and Taiwanese locales only).
gg (Windows only) Displays the period/era as a full name. (Japanese and Taiwanese locales only).
m Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
mm Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.
mmm Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.
mmmm Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.
yy Displays the year as a two-digit number (00-99).
yyyy Displays the year as a four-digit number (0000-9999).
h Displays the hour without a leading zero (0-23).
hh Displays the hour with a leading zero (00-23).
n Displays the minute without a leading zero (0-59).
nn Displays the minute with a leading zero (00-59).
dt1:=Formatdatetime('YYYYMMDD', Now); //哪有这样写的改成TimeNow:=FormatDateTime('yyyy-mm-dd hh:nn:ss', Now());
t1:=inttostr(month);
tnum:=month;
if tnum<10 then begin //判断月份是否为个位数,加0补齐两位数
t1:='0'+t1;
end;
t2:=inttostr(year);
with dm.macidqhQuery1 do begin
close;
sql.Clear;
sql.Add('select * from T_macidqh order by bdh asc');
open;
if dm.macidqhQuery1.IsEmpty then
t:=t2+t1+'0001' //如记录为空,记录从1开始
else
Last;
t:=dm.macidqhQuery1 .Fields[0].AsString;
t3:=copy(t,5,2); //在NO中取两位数为月份
if t1<>t3 then //判断月份,相同则累计,不同则重新计
t:=t2+t1+'0001'
else
t:=inttostr(strtoint(t)+1);
end;