# C/AL and functions

Hi to all!

I’m new to this forum and in NAV system

I need to know what I have to study and what I’m supposed to know for creating a program in C/AL that can calculate “Tax Code”.

I’ll explain: tax code is an italian trick that contains personal data. It’s structured in this way:

I have to insert Surname, Name, Date of birth, Gender, Country of birth, City of Birth.

From surname I have to take three consonants and so from name

Example: if I am Rossi Marco, I should have RSS MRC

From Date of birth i need first the last two numbers

Example: if I was born in 18 April 1983 I should have 83

Then, I need the month. Each month is equivalent to a letter; for example, April is equivalent to the letter D

Then I need the day and the gender. If I’m male I should have the day (eg. 18) , if I’m female I need to add 40 to the day (eg. 18+40 = 58)

If I was born in a foreign country I have the letter Z and the code of the country. If I was born in Italy I have to find my city of birth and put the correspondant code.

Eg. If I was born in Rome I have the code H501, if I was born in Andorra I have the code Z 101.

Eventually I have to put the control code that is obtained in this way:

I take even characters. Each character is equivalent to a numeric code. I have to sum them.

Then I consider odd character. Themselves are equivalent to a numeric code and I have to sum them.

I have to sum them and then divide them to 26.

The result has to be converted in an litteral code.

eg sum1=55 sum2=80 , sum1+sum2= 135

135/26 = 5,19 = 5

In a table I see that 5= L

In the end my tax code is represented in this way:

Surname ROSSI

Name MARCO

Date of Birth 18 April 1983

Gender M

Country of birth: ITALY

City ROME

TAX CODE: RSS MRC 83 D 13 H501 F

Someone could help me?

Thanks

Luciana

I’ll give you some functions to look at, but this is not how you should start off your post. What have you already tried? Where have you looked for information?

You’ll want to use some of these functions: COPYSTR, FORMAT, DATE2DMY. Don’t forget to validate your inputs into the function to make sure that they are correctly formatted and have values.

Hi,

I’m not looking for a solution ready for use, but I would only know what kind of reading I have just to do.

Now, I own Navision Development I / C-Side Introduction for Microsoft Training, but I couldn’t understand what is necessary and what not

Someone gave me the tax code as an exercise for learning in development…

I just don’t know where I should start.

Post Scriptum: I apologize for my bad english.

Your english is fine. As long as you are looking to learn and not for someone to do the work for you that is great. What you need to read depends entirely on your development background.

I only have a 4.0 development book handy, but you should essentially read the whole thing. I mean this doesn’t require tables and forms so you could skip those for now, but those are the most important part of NAV.

Hi,

thanks. So my question is : can that guide (Navision Dev I ver 4.0) give me enough knowledge so I would be able to create the Tax Code program? Or I need anything else (eg. Dev II manual)?

My development background is about a little knowledge of C, Matlab, VHDL.

Regards,

Luciana

Wealth on Knowledge Here: http://msdn.microsoft.com/en-us/library/dd301160.aspx

So what will you learn from asking ready to go objects, basically asking the community to do the development for you?

Absolutely not! As I wrote before, I wanted to know if the Nav Development I Guide can give enough informations and knowledge to create and execute the Tax Code program.I never asked for someone who could make that program instead of me.

That’s all.

@ other users

thanks a lot for giving me useful information and reference links. I appreciate.

Luciana