-
Notifications
You must be signed in to change notification settings - Fork 0
/
InWordBangla
65 lines (55 loc) · 1.79 KB
/
InWordBangla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Initialize variables
numbervar RmVal := 0;
stringvar InWords := "";
numbervar Amt := {Production_IndProductionCost.GrandTotal}; // Example amount
//Check If Amount is Greater than 0
If Amt > 0 Then (
numbervar pAmt := 0;
// Round Amt to the nearest whole number
Amt := Round(Amt, 0);
// Convert amount in crores
If Amt >= 10000000 Then (
RmVal := Truncate(Amt / 10000000);
If RmVal > 0 Then (
InWords := InWords + " " + NumberToBangla(RmVal) + " কোটি";
Amt := Amt - RmVal * 10000000;
)
);
// Convert amount in lakhs
If Amt >= 100000 Then (
RmVal := Truncate(Amt / 100000);
If RmVal > 0 Then (
InWords := InWords + " " + NumberToBangla(RmVal) + " লাখ";
Amt := Amt - RmVal * 100000;
)
);
// Convert amount in thousands
If Amt >= 1000 Then (
RmVal := Truncate(Amt / 1000);
If RmVal > 0 Then (
InWords := InWords + " " + NumberToBangla(RmVal) + " হাজার";
Amt := Amt - RmVal * 1000;
)
);
// Convert amount in hundreds
If Amt >= 100 Then (
RmVal := Truncate(Amt / 100);
If RmVal > 0 Then (
InWords := InWords + " " + NumberToBangla(RmVal) + " শত";
Amt := Amt - RmVal * 100;
)
);
// Convert remaining amount (less than hundred)
If Amt > 0 Then (
InWords := InWords + " " + NumberToBangla(Amt);
);
// Handle fractional part
pAmt := (Amt - Truncate(Amt)) * 100;
If pAmt > 0 Then (
InWords := InWords + " এবং " + NumberToBangla(pAmt) + " পয়সা মাত্র।"
) Else (
InWords := InWords + " টাকা মাত্র।"
);
);
// Return the final result
InWords