Hello,
Alors le logiciel en question était radiX (
http://radix.tarmed.info/). Il s'agit d'un logiciel de gestion pour médecin qui gère la LAMAL !!!
Voici ci dessous la partie de code qui s'occupe du n° de BVR.
J'espère que ça pourra aider. Je ne me suis pas encore plongé dans la structure de Dolibarr pour du dév, mais je suis prêt à donner un coup de main pour y ajouter du BVR et aussi (cf un autre post) qqch pour gérer une activité de garage (infos de véhicules)
++
greg
//Numéro de contrôle BVR
function getNoControle($noatraiter){
$report = 0;
$cpt = strlen($noatraiter);
for($i = 0; $i < $cpt; $i++){
$report = substr($this->lignereport($report), substr($noatraiter, $i, 1), 1);
//print "<BR>I : $i - CH : " . substr($noatraiter, $i, 1) . " - R : $report<BR>";
}
return (10 - $report) % 10;
}
//Ligne de report pour calcul BVR
function ligneReport($report){
$etalon = ('09468271350946827135');
$lignereport = substr($etalon, $report, 10);
return $lignereport;
}
function getMonNumRef(){
$emed = new ensTableBrioche("medecins", "id = $this->nummed", "*", 0, $this->idsession);
$temed = $emed->getTableau();
//montant
$med = $temed[0];
$chaine = '01' . sprintf("%010s", $this->montant * 100);
$chaine .= $this->getNoControle($chaine);
$tab[0] = $chaine;
//num réf
if(strlen($med->prefbvr) <= 6){
$chaine = sprintf("%0-6s", $med->prefbvr) . sprintf("%07s", $this->nofact);
$chaine .= '0000' . sprintf("%09s", $this->nopat);
$chaine .= $this->getNoControle($chaine);
}
else { //préfixe bvr long (par exemple Raiffeisen)
$chaine = sprintf("%0-13s", $med->prefbvr) . "1" . sprintf("%07s", $this->nofact);
$chaine .= $this->hacheNoPat();
$chaine .= $this->getNoControle($chaine);
}
//print "<pre>a" . $chaine . "b</pre>";
$tab[1] = $chaine;
//ccp
$tab[2] = $med->ccpbvr;
return $tab;
}
function hacheNoPat(){
return sprintf("%05.5s", hexdec(substr(md5($this->nopat), 0, 5)));
}
function controleHachage($hachage){
$h2 = $this->hacheNoPat();
if ($h2 == $hachage) return true;
return false;
}