".htmlentities($msg[103], ENT_QUOTES, $charset)." |
".htmlentities($msg[acquisition_frais_montant], ENT_QUOTES, $charset)." |
";
$res = frais::listFrais();
$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=frais&action=modif&id=$row->id_frais';\" ";
print "".htmlentities($row->libelle, ENT_QUOTES, $charset)." | ".htmlentities($row->montant, ENT_QUOTES, $charset)." ".$pmb_gestion_devise." | ";
print "
";
}
print "
";
}
function show_frais_form($id=0) {
global $dbh, $msg;
global $charset;
global $frais_form;
global $ptab;
global $acquisition_gestion_tva;
$frais_form = str_replace('!!id!!', $id, $frais_form);
if(!$id) {
$frais_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_ajout_frais],ENT_QUOTES,$charset), $frais_form);
$frais_form = str_replace('!!libelle!!', '', $frais_form);
$frais_form = str_replace('!!condition!!', '', $frais_form);
$frais_form = str_replace('!!montant!!', '', $frais_form);
$frais_form = str_replace('!!cp_compta!!', '', $frais_form);
} else {
$frais = new frais($id);
$frais_form = str_replace('!!form_title!!', htmlentities($msg[acquisition_modif_frais],ENT_QUOTES,$charset), $frais_form);
$frais_form = str_replace('!!libelle!!', htmlentities($frais->libelle,ENT_QUOTES,$charset), $frais_form);
$frais_form = str_replace('!!condition!!', htmlentities($frais->condition_frais,ENT_QUOTES,$charset), $frais_form);
$frais_form = str_replace('!!montant!!', $frais->montant, $frais_form);
$frais_form = str_replace('!!cp_compta!!', $frais->num_cp_compta, $frais_form);
$ptab = str_replace('!!id!!', $id, $ptab);
$ptab = str_replace('!!libelle_suppr!!', addslashes($frais->libelle), $ptab);
$frais_form = str_replace('', $ptab, $frais_form);
}
if ($acquisition_gestion_tva) {
$form_tva = "";
$frais_form = str_replace('!!tva_achat!!', $form_tva, $frais_form);
}
print confirmation_delete("./admin.php?categ=acquisition&sub=frais&action=del&id=");
print $frais_form;
}
$frais_form = "
";
$ptab = "";
?>
0 ) {
error_form_message($libelle.$msg["acquisition_frais_already_used"]);
break;
}
//Vérification du format du montant
$montant = str_replace(',','.',$montant);
if (!is_numeric($montant) || $montant < 0.00 || $montant >999999.99 ) {
error_form_message($libelle.$msg["acquisition_frais_error"]);
break;
}
$frais = new frais($id);
$frais->libelle = $libelle;
$frais->condition_frais = $condition;
$frais->montant = $montant;
$frais->num_cp_compta = $cp_compta;
$frais->num_tva_achat = $tva_achat;
$frais->save();
show_list_frais();
break;
case 'del':
if($id) {
$total1 = frais::hasFournisseurs($id);
if ($total1==0) {
frais::delete($id);
} else {
$msg_suppr_err = $msg[acquisition_frais_used] ;
if ($total1) $msg_suppr_err .= "
- ".$msg[acquisition_frais_used_fou] ;
error_message($msg[321], $msg_suppr_err, 1, 'admin.php?categ=acquisition&sub=frais');
}
} else {
show_list_frais();
}
break;
default:
show_list_frais();
break;
}
?>