RFC is the mexican taxpayer is provided by Mexico tax authority (SAT). Following rules apply:
- Valid characters are: 0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZ&$%#@§
- Must be 12 or 13 characters long.
- If the taxpayer is a company, is 12 characters long.
- If the taxpayer is a person, is 13 characters long.
The RFC consists of 3 parts:
- Letters and characters extracted from the name of the taxpayer.
- If the taxpayer is a company, this part is the first 3 characters of the RFC.
- If the taxpayer is a person, this part is the first 4 characters of the RFC.
- The following 6 characters, which represents a valid date in the format YYMMDD. This is the taxpayer's date of registration at SAT
- Last 3 characters: A checksum. I don't have a reliable algorithm to calculate this. The only rule applied here is that the last character must be a number or the letter 'A'.
Requirements ¶
Was developed and tested with Yii 1.1.9.
Usage ¶
Copy satRfc.php to a subfolder of protected (e.g.: protected/extensions/validators) Call it as a regular validator.
class MyModel extends CModel {
//[....]
public function rules()
{
return array(
//[....]
array('rfc', 'ext.validators.satRfcValidator'),
);
}
}
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.