//四舍五入函数
function frmBS1.RoundIt(work: double): double;
begin //Round .5 up always.
//Currency fields are stored with 4 decimals, so need to be rounded to 2 decimals when multiplying by exchange rates, etc.
//example: frmBS1.RoundIt(amount * rate * 100)/100;
if work >0 then
begin
if Int(work + 0.5) > Int(work) then
result := Int(work) + 1
else
result := Int(work);
end
else
begin
if Int(work - 0.5) < Int(work) then
result := Int(work) - 1
else
result := Int(work);
end;
end;