mise en fonction de la slection du HT et du TTC

This commit is contained in:
Regis Houssin 2006-12-19 10:58:33 +00:00
parent e322a9fabd
commit 16811c9cdb
2 changed files with 31 additions and 2 deletions

View File

@ -1110,6 +1110,34 @@ class Form
print '</select>';
}
/**
* \brief Selection HT ou TTC
* \param selected Id présélectionné
* \param htmlname Nom de la zone select
*/
function select_PriceBaseType($selected='',$htmlname='price_base_type')
{
global $langs;
print '<select class="flat" name="'.$htmlname.'">';
$options = array(
'HT'=>$langs->trans("HT"),
'TTC'=>$langs->trans("TTC")
);
foreach($options as $id => $value)
{
if ($selected == $id)
{
print '<option value="'.$id.'" selected="true">'.$value;
}
else
{
print '<option value="'.$id.'">'.$value;
}
print '</option>';
}
print '</select>';
}
/**
* \brief Retourne la liste des modes de paiements possibles
* \param selected Id du mode de paiement présélectionné

View File

@ -45,6 +45,8 @@ accessforbidden();
$types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service");
$html = new Form($db);
/*
* Actions
*/
@ -193,13 +195,12 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
if ($product->price_base_type == 'TTC')
{
print '<td><input name="price" size="10" value="'.price($product->price_ttc).'">';
print '<select class="flat" name="price_base_type"><option value="HT">HT</option><option value="TTC" SELECTED>TTC</option></select>';
}
else
{
print '<td><input name="price" size="10" value="'.price($product->price).'">';
print '<select class="flat" name="price_base_type"><option value="HT" SELECTED>HT</option><option value="TTC">TTC</option></select>';
}
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
print '</td></tr>';
}
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;';