Javascript object for managing the italian tax code
Javascript object for managing the italian tax code.
Add the Object file
<script src="./CodiceFiscale.min.js" type="text/javascript"></script>
Use the function to calculate the tax code
var person = new CodiceFiscale({
name: 'Mario',
lastname: 'Rossi',
day: '25',
month: '04',
year: '1945',
isMale: true,
communeName: 'Milano'
});
Use the public function for getting specific taxcode part
person.taxCode(); // RSSMRA45D25F205N
person.lastnameCode(); // RSS
person.nameCode(); // MRA
person.dateCode(); // 45D25
person.yearCode(); // 45
person.monthCode(); // D
person.dayCode(); // 25
person.communeCode(); // F205
person.controlChar(); // N
The control char calculation don't work properly, so the last tax code's char is not always right
The code is freely taken from zingus.altervista.org. This is a refactoring code finally here, on Github.