F
fuxin198311
Unregistered / Unconfirmed
GUEST, unregistred user!
我使用了进度条 发现没起到作用 一点按钮进度条就是100%我想达到这样的目的
就是当dbgrideh中有很多条数据 那么就要从第一条开始 并且要记住当前的指针 这样就会很明显的是在那一行了 就一行一行的移动 当完毕后就关掉进度条 代码是这样的
但就是实现不了这样的功能
with adojxc do
begin
close;
sql.Clear ;
sql.Text:='select a.yaoid,a.MONTH,a.LAST_QTY,a.rk_mount,a.sy_mount,a.ck_mount,a.xs_mount,a.cl_mount,b.pm,b.tym,b.cj,b.gg,b.dw,b.jx,b.type1,'+
'(a.rk_mount+sy_mount)-(a.ck_mount+a.xs_mount+cl_mount) as ln_mount,b.type2,b.type3 from jxc_tmp a,yaoid b where a.yaoid=b.yaoid';
open;
prior;
ProgressBar1.min:=0;
ProgressBar1.Max:=adojxc.RecordCount ;
ProgressBar1.step:=1;
while not adojxc.Eof do
begin
ProgressBar1.Position:= ProgressBar1.Position+1;
with adoquery1 do
begin
close;
sql.Clear ;
sql.Text:='insert into jxc_over_cargo_cost(month,yaoid,qty)valuesmonth,:yaoid,:qty)' ;
Parameters.ParamByName('month').Value:=copy(datetimetostr(datetimepicker1.Date),1,7);
Parameters.ParamByName('yaoid').Value:=adojxc.fieldByName('yaoid').AsInteger;
Parameters.ParamByName('qty').Value:=adojxc.fieldByName('last_qty').AsFloat ;
ExecSQL ;
end;
ProgressBar1.stepit;
// ProgressBar1.
label13.Caption:='正在结转药品信息是'+adojxc.fieldByName('yaoid').AsString+'请稍候' ;
// Application.ProcessMessages;
adojxc.Next ;
end;
end;
if speedbutton5.Caption='结转库存' then
begin
with adoquery2 do
begin
close;
sql.Clear ;
sql.Text:='select flg from jxc_over where month='''+copy(datetimetostr(datetimepicker1.Date),1,7)+'''';
open;
end;
if adoquery2.RecordCount=0 then
begin
with adoquery2 do
begin
close;
sql.Clear ;
sql.Text:='insert into jxc_over(month,flg) values month,:flg)';
Parameters.ParamByName('month').Value:=copy(datetimetostr(datetimepicker1.Date),1,7);
Parameters.ParamByName('flg').Value:='Y';
ExecSQL ;
end;
end
else
begin
with adoquery2 do
begin
close;
sql.Clear ;
sql.Text:='update jxc_over set flg=:flg where month='''+copy(datetimetostr(datetimepicker1.Date),1,7)+'''';
Parameters.ParamByName('flg').Value:='Y';
ExecSQL ;
end;
end;
if ProgressBar1.Position=100 then panel1.Visible:=false;
speedbutton5.Caption:='反结库存';
application.MessageBox('恭喜您!库存结转完毕','系统提示',MB_OK);
exit;
end;
就是当dbgrideh中有很多条数据 那么就要从第一条开始 并且要记住当前的指针 这样就会很明显的是在那一行了 就一行一行的移动 当完毕后就关掉进度条 代码是这样的
但就是实现不了这样的功能
with adojxc do
begin
close;
sql.Clear ;
sql.Text:='select a.yaoid,a.MONTH,a.LAST_QTY,a.rk_mount,a.sy_mount,a.ck_mount,a.xs_mount,a.cl_mount,b.pm,b.tym,b.cj,b.gg,b.dw,b.jx,b.type1,'+
'(a.rk_mount+sy_mount)-(a.ck_mount+a.xs_mount+cl_mount) as ln_mount,b.type2,b.type3 from jxc_tmp a,yaoid b where a.yaoid=b.yaoid';
open;
prior;
ProgressBar1.min:=0;
ProgressBar1.Max:=adojxc.RecordCount ;
ProgressBar1.step:=1;
while not adojxc.Eof do
begin
ProgressBar1.Position:= ProgressBar1.Position+1;
with adoquery1 do
begin
close;
sql.Clear ;
sql.Text:='insert into jxc_over_cargo_cost(month,yaoid,qty)valuesmonth,:yaoid,:qty)' ;
Parameters.ParamByName('month').Value:=copy(datetimetostr(datetimepicker1.Date),1,7);
Parameters.ParamByName('yaoid').Value:=adojxc.fieldByName('yaoid').AsInteger;
Parameters.ParamByName('qty').Value:=adojxc.fieldByName('last_qty').AsFloat ;
ExecSQL ;
end;
ProgressBar1.stepit;
// ProgressBar1.
label13.Caption:='正在结转药品信息是'+adojxc.fieldByName('yaoid').AsString+'请稍候' ;
// Application.ProcessMessages;
adojxc.Next ;
end;
end;
if speedbutton5.Caption='结转库存' then
begin
with adoquery2 do
begin
close;
sql.Clear ;
sql.Text:='select flg from jxc_over where month='''+copy(datetimetostr(datetimepicker1.Date),1,7)+'''';
open;
end;
if adoquery2.RecordCount=0 then
begin
with adoquery2 do
begin
close;
sql.Clear ;
sql.Text:='insert into jxc_over(month,flg) values month,:flg)';
Parameters.ParamByName('month').Value:=copy(datetimetostr(datetimepicker1.Date),1,7);
Parameters.ParamByName('flg').Value:='Y';
ExecSQL ;
end;
end
else
begin
with adoquery2 do
begin
close;
sql.Clear ;
sql.Text:='update jxc_over set flg=:flg where month='''+copy(datetimetostr(datetimepicker1.Date),1,7)+'''';
Parameters.ParamByName('flg').Value:='Y';
ExecSQL ;
end;
end;
if ProgressBar1.Position=100 then panel1.Visible:=false;
speedbutton5.Caption:='反结库存';
application.MessageBox('恭喜您!库存结转完毕','系统提示',MB_OK);
exit;
end;