Fast Repor Fatura'da Genel Toplamı HAFLERLE YAZDIRMA Gönderen: barbar0s Tarih: 07 March 2008 19:43:36
Fast Reportda Faturanın gelen toplamı harflerle yazdırmak istiyorum nasıl yapabilirim 150 YTL = YÜZELLİ YTL gibi
Ynt: Fast Repor Fatura'da Genel Toplamı HAFLERLE YAZDIRMA Gönderen: SAHAN33 Tarih: 18 April 2008 15:15:46
sayıyı yazıyla yazan procedureler var. Onu kullanıp metni elde edecek ve fast reportta istenilen herhangi bir memo alana da bu bilgiyi yazdıracaksın..
Ynt: Fast Repor Fatura'da Genel Toplamı HAFLERLE YAZDIRMA Gönderen: SelçuK Tarih: 18 April 2008 22:02:58
function YTLtoYazi(Value: Double; LiraSimge, KurusSimge: string): string;
const
Birler: array[1..10] of string = ('Bir', 'İki', 'Üç', 'Dört', 'Beş', 'Altı', 'Yedi', 'Sekiz', 'Dokuz', '');
Onlar: array[1..10] of string = ('On', 'Yirmi', 'Otuz', 'Kırk', 'Elli', 'Altmış', 'Yetmiş', 'Seksen', 'Doksan', '');
Diger: array[1..11] of string = ('Trilyon', '', '', 'Milyar', '', '', 'Milyon', '', '', 'Bin', '');
var
Deger, Lira, Kurus, Uclu: string;
i: integer;
LiraYok: Boolean;
procedure UcSayi;
var
s1, s2, s3: byte;
begin
s1 := StrtoInt(Copy(Uclu, 1, 1));
s2 := StrtoInt(Copy(Uclu, 2, 1));
s3 := StrtoInt(Copy(Uclu, 3, 1));
if ((i = 10) and (Uclu = '001')) then
begin
s1 := 10;
s2 := 10;
s3 := 10;
end;
if s1 = 0 then s1 := 10;
if s2 = 0 then s2 := 10;
if s3 = 0 then s3 := 10;
if s1 <> 1 then Result := Result + Birler[S1];
if s1 <> 10 then Result := Result + 'Yüz';
Result := Result + Onlar[S2] + Birler[S3];
end;
begin
if Value < 0 then
begin
Deger := 'Eksi ';
Value := Value * -1;
end;
Lira := InttoStr(Trunc(Int(Value)));
Kurus := InttoStr(Trunc(RoundTo(Frac(Value), -2) * 100));
if Lira = '0' then
LiraYok := True
else
LiraYok := False;
if (Lira = '0') and (Kurus = '0') then Result := 'Sıfır';
Lira := RightStr(StringofChar('0', 15) + Lira, 15);
Kurus := RightStr('000' + Kurus, 3);
i := -2;
repeat
inc(i, 3);
Uclu := Copy(Lira, i, 3);
UcSayi;
if ((Uclu <> '000') and (i < 13)) then
Result := Result + Diger[i];
until i >= 12;
if not LiraYok then
Result := Result + ' ' + LiraSimge;
if Kurus <> '000' then
begin
Result := Result + ' ';
Uclu := Kurus;
UcSayi;
Result := Result + ' ' + KurusSimge;
end;
Result := Deger + Result;
end;
Kullanımı:
form1.Caption := YTLtoYazi(StrToFloat(Edit1.Text),'YTL','YKR');