procedure TfrmInsSalesInvoice.OnFieldGetText(Sender: TField;
var Text: string; DisplayText: Boolean);
begin
Text := CurrToStr(Sender.AsCurrency * 100) + ' %';
end;
procedure TfrmInsSalesInvoice.OnFieldSetText(Sender: TField;
const Text: string);
var
S, F: string;
C: Currency;
begin
if Pos('%', Text) = 0 then
F := Trim(Text) + ' %'
else
F := Text;
S := Trim(LeftStr(F, Pos('%', F) - 1));
if (S = '') or (not TryStrToCurr(S, C)) then
begin
ShowMessage('Invalid value ' + QuotedStr(F));
Abort;
end
else
begin
TryStrToCurr(S, C);
Sender.AsCurrency := RoundTo(C / 100, -2);
end;