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