".htmlentities($msg[103], ENT_QUOTES, $charset)." |
".htmlentities($msg[acquisition_tva_taux], ENT_QUOTES, $charset)." |
".htmlentities($msg[acquisition_num_cp_compta], ENT_QUOTES, $charset)." |
";
$q = tva_achats::listTva();
$res = mysql_query($q, $dbh);
$nbr = mysql_num_rows($res);
$parity=1;
for($i=0;$i<$nbr;$i++) {
$row=mysql_fetch_object($res);
if ($parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$parity += 1;
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./admin.php?categ=acquisition&sub=tva&action=modif&id=$row->id_tva';\" ";
print "".htmlentities($row->libelle, ENT_QUOTES, $charset)." | ".$row->taux_tva."% | ".$row->num_cp_compta." | ";
print "
";
}
print "
";
}
function show_tva_form($id=0) {
global $msg, $charset;
global $tva_form;
global $ptab;
$tva_form = str_replace('!!id!!', $id, $tva_form);
if(!$id) {
$tva_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_ajout_tva],ENT_QUOTES,$charset), $tva_form);
$tva_form = str_replace('!!libelle!!', '', $tva_form);
$tva_form = str_replace('!!taux_tva!!', '', $tva_form);
$tva_form = str_replace('!!cp_compta!!', '', $tva_form);
} else {
$tva = new tva_achats($id);
$tva_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_modif_tva],ENT_QUOTES, $charset), $tva_form);
$tva_form = str_replace('!!libelle!!', htmlentities($tva->libelle, ENT_QUOTES, $charset), $tva_form);
$tva_form = str_replace('!!taux_tva!!', $tva->taux_tva, $tva_form);
$tva_form = str_replace('!!cp_compta!!', $tva->num_cp_compta, $tva_form);
$ptab = str_replace('!!id!!', $id, $ptab);
$ptab = str_replace('!!libelle_suppr!!', addslashes($tva->libelle), $ptab);
$tva_form = str_replace('', $ptab, $tva_form);
}
print confirmation_delete("./admin.php?categ=acquisition&sub=tva&action=del&id=");
print $tva_form;
}
$tva_form = "
";
$ptab = "";
?>
0 ) {
error_form_message($libelle.$msg["acquisition_tva_already_used"]);
break;
}
//Vérification du format du taux de tva
$taux_tva = str_replace(',','.',$taux_tva);
if ($taux_tva < 0.00 || $taux_tva >99.99) {
error_form_message($libelle.$msg["acquisition_tva_error"]);
break;
}
$tva = new tva_achats($id);
$tva->libelle = $libelle;
$tva->taux_tva = $taux_tva;
$tva->num_cp_compta = $cp_compta;
$tva->save();
show_list_tva();
break;
case 'del':
if($id) {
$total1 = tva_achats::hasTypesProduits($id);
$total2 = tva_achats::hasFrais($id);
if (($total1+$total2)==0) {
tva_achats::delete($id);
show_list_tva();
} else {
$msg_suppr_err = $msg[acquisition_tva_used] ;
if ($total1) $msg_suppr_err .= "
- ".$msg[acquisition_tva_used_type] ;
if ($total2) $msg_suppr_err .= "
- ".$msg[acquisition_tva_used_frais] ;
error_message($msg[321], $msg_suppr_err, 1, 'admin.php?categ=acquisition&sub=tva');
}
} else {
show_list_tva();
}
break;
default:
show_list_tva();
break;
}
?>