Dobuts in Reports Printing
Madhan
Member Posts: 96
hi all,
In reports i am converting a total amount field into "words" (printing in words). In that i like to print every first character in captial (uppercase). can anyone help me how to do this
In reports i am converting a total amount field into "words" (printing in words). In that i like to print every first character in captial (uppercase). can anyone help me how to do this
0
Comments
-
Write a function that takes a string as paramater and returns string as paramater.
In that function you loop through the string and if the pervious character is blank then change the current Character to uppercase.
Sorry don' thave the time to write the code. I'll do it later if I've time. Or somebody can put the code if they have' allready done it.0 -
Hi Madhan,
There is a inbuilt report ("Check" with the id -1401), which contains few functions to convert number to text.
Do the following steps to get that:
1. Create global variabes as specified below.
Name
DataType
Subtype--- Length
Check
Report
Check
NumberText---- Text
80
Note: NumberText is a two dimensional array variable.(I mean change the dimension of of this variable to 2.)
2. Write the below code In <Data Item>, Body - OnPreSection():
Check.InitTextVariable;
Check.FormatNoText(NumberText,ABS(total amount),'');
FormatNoText()- function converts your "total amount" to words and save it in "NumberText".
So you can use "NumberText" as source expression to a text box in
<Data Item>, Body.
Hope this will solve your requirement.
Let me know if u need futher clarification.With Regards,
Shilpa Reddy0 -
Copy and save as text file then import in your database.
OBJECT Codeunit 50011 BPTOOLS
{
OBJECT-PROPERTIES
{
Data=15/09/05;
Ora=[ 9.24.07];
Modificato=S?;
Version List=;
}
PROPERTIES
{
OnRun=BEGIN
END;
}
CODE
{
VAR
U@1101310000 : ARRAY [20] OF Text[30];
D@1101310001 : ARRAY [10] OF Text[30];
U0@1101310002 : TextConst 'ITA=ZERO';
U1@1101310003 : TextConst 'ITA=UNO';
U2@1101310004 : TextConst 'ITA=DUE';
U3@1101310005 : TextConst 'ITA=TRE';
U4@1101310006 : TextConst 'ITA=QUATTRO';
U5@1101310007 : TextConst 'ITA=CINQUE';
U6@1101310008 : TextConst 'ITA=SEI';
U7@1101310009 : TextConst 'ITA=SETTE';
U8@1101310010 : TextConst 'ITA=OTTO';
U9@1101310011 : TextConst 'ITA=NOVE';
U10@1101310012 : TextConst 'ITA=DIECI';
U11@1101310013 : TextConst 'ITA=UNDICI';
U12@1101310014 : TextConst 'ITA=DODICI';
U13@1101310015 : TextConst 'ITA=TREDICI';
U14@1101310016 : TextConst 'ITA=QUATTORDICI';
U15@1101310017 : TextConst 'ITA=QUINDICI';
U16@1101310018 : TextConst 'ITA=SEDICI';
U17@1101310019 : TextConst 'ITA=DICIASSETTE';
U18@1101310020 : TextConst 'ITA=DICIOTTO';
U19@1101310021 : TextConst 'ITA=DICIANNOVE';
U20@1101310022 : TextConst 'ITA=VENTI';
D2@1101310023 : TextConst 'ITA=VENT';
D3@1101310024 : TextConst 'ITA=TRENT';
D4@1101310025 : TextConst 'ITA=QUARANT';
D5@1101310026 : TextConst 'ITA=CINQUANT';
D6@1101310027 : TextConst 'ITA=SESSANT';
D7@1101310028 : TextConst 'ITA=SETTANT';
D8@1101310029 : TextConst 'ITA=OTTANT';
D9@1101310030 : TextConst 'ITA=NOVANT';
CENTO@1101310035 : TextConst 'ITA=CENTO';
MILLE@1101310031 : TextConst 'ITA=MILLE';
MILA@1101310032 : TextConst 'ITA=MILA';
UNMILIONE@1101310033 : TextConst 'ITA=UNMILIONE';
MILIONI@1101310034 : TextConst 'ITA=MILIONI';
cfr@1101310036 : ARRAY [9] OF Integer;
PROCEDURE num_to_word@1101310008(N@1101310000 : Integer) WORD : Text[250];
VAR
w21@1101310001 : Text[80];
w3@1101310002 : Text[80];
w54@1101310003 : Text[80];
w6@1101310004 : Text[80];
w87@1101310005 : Text[80];
w9@1101310006 : Text[80];
BEGIN
IF N = 0 THEN EXIT (U0);
LOAD_VECTORS(N);
w21 := CFR21_TO_WORD(cfr[2],cfr[1]);
w3 := CFR3_TO_WORD(cfr[3]);
IF (N > 999) AND (N < 2000) THEN
w54 := MILLE;
IF N > 1999 THEN
IF (cfr[4]<>0) OR (cfr[5]<>0) OR (cfr[6]<>0) THEN
w54 := CFR21_TO_WORD(cfr[5],cfr[4]) + MILA;
w6 := CFR3_TO_WORD(cfr[6]);
IF (N > 999999) AND (N < 2000000) THEN
w87 := UNMILIONE;
IF N > 1999999 THEN
w87 := CFR21_TO_WORD(cfr[8],cfr[7]) + MILIONI;
w9 := CFR3_TO_WORD(cfr[9]);
//************** Debug only ******************//
//MESSAGE(format_integer_thousen(N)) + ' = ' + w9 + w87 + w6 + w54 + w3 + w21);
//************** Debug only ******************//
EXIT(w9 + w87 + w6 + w54 + w3 + w21);
END;
LOCAL PROCEDURE LOAD_VECTORS@1101310000(inpNum@1101310000 : Integer);
VAR
s@1101310001 : Text[30];
ii@1101310002 : Integer;
BEGIN
CLEAR(cfr);
s:=FORMAT(inpNum);
REPEAT
ii+=1;
EVALUATE(cfr[ii],COPYSTR(s, STRLEN(s) - ii + 1,1));
UNTIL ii = STRLEN(s);
U[1]:=U1;
U[2]:=U2;
U[3]:=U3;
U[4]:=U4;
U[5]:=U5;
U[6]:=U6;
U[7]:=U7;
U[8]:=U8;
U[9]:=U9;
U[10]:=U10;
U[11]:=U11;
U[12]:=U12;
U[13]:=U13;
U[14]:=U14;
U[15]:=U15;
U[16]:=U16;
U[17]:=U17;
U[18]:=U18;
U[19]:=U19;
U[20]:=U20;
D[2]:=D2;
D[3]:=D3;
D[4]:=D4;
D[5]:=D5;
D[6]:=D6;
D[7]:=D7;
D[8]:=D8;
D[9]:=D9;
END;
LOCAL PROCEDURE CFR21_TO_WORD@1101310007(cfrDecine@1101310000 : Integer;cfrUnit…@1101310001 : Integer) : Text[250];
VAR
c1@1101310002 : Integer;
c2@1101310003 : Integer;
s@1101310004 : Text[250];
BEGIN
c1:=cfrUnit…; c2:=cfrDecine;
s:='';
IF c1 > 0 THEN
s:=U[c1];
IF c2 > 1 THEN BEGIN
s:=D[c2];
IF (c1<>1) AND (c1<>8) THEN
IF c2 = 2 THEN
s:= s + 'I'
ELSE
s:= s + 'A';
IF c1 > 0 THEN
s:= s + U[c1];
END ELSE IF c2 = 1 THEN
s:= U[10+c1];
EXIT(s);
END;
LOCAL PROCEDURE CFR3_TO_WORD@1101310003(cfrCentinaia@1101310000 : Integer) : Text[250];
VAR
c3@1101310002 : Integer;
s@1101310004 : Text[250];
BEGIN
c3:=cfrCentinaia;
s:='';
IF c3 > 1 THEN
s:=U[c3];
IF c3 > 0 THEN
s:= s+ CENTO;
EXIT(s);
END;
PROCEDURE format_integer_thousen@1101310001(N@1101310000 : Integer) : Text[250];
VAR
dummy@1101310001 : Decimal;
BEGIN
dummy:=N;
EXIT(FORMAT(dummy,0,'<Integer Thousand><Decimals>'));
END;
BEGIN
END.
}
}
byebye.0 -
hi shilpareddy,
Thanx a lot its working fine. But, if have one more doubt that is, if my currency is in dollars or some other, The amount in words is just printing in the rupees and paisa. can u tell me how to do this.0 -
Hi Madhan,
It is defined like that ('Paisa only' or 'Rupee' ) in FormatNoText() function of Check Report.
If you wish to change the text to dollar or something, you can change that in FormatNoText() function of Check Report.With Regards,
Shilpa Reddy0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
