Début ajout gestion du HT et TTC avec l'option multiprix

This commit is contained in:
Regis Houssin 2006-12-19 17:42:47 +00:00
parent 6392c1f93e
commit a585f33dc9
2 changed files with 36 additions and 20 deletions

View File

@ -77,6 +77,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
$product->ref = $_POST["ref"]; $product->ref = $_POST["ref"];
$product->libelle = $_POST["libelle"]; $product->libelle = $_POST["libelle"];
$product->price = $_POST["price"]; $product->price = $_POST["price"];
$product->price_base_type = $_POST["price_base_type"];
$product->tva_tx = $_POST["tva_tx"]; $product->tva_tx = $_POST["tva_tx"];
$product->type = $_POST["type"]; $product->type = $_POST["type"];
$product->status = $_POST["statut"]; $product->status = $_POST["statut"];
@ -94,11 +95,18 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{ {
if($_POST["price_".$i]) if($_POST["price_".$i])
$product->multiprices["$i"]=ereg_replace(" ","",$_POST["price_".$i]); {
$price = ereg_replace(" ","", $_POST["price_".$i]);
$price = ereg_replace(",",".", $price);
$product->multiprices["$i"] = $price;
$product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
}
else else
{
$product->multiprices["$i"] = ""; $product->multiprices["$i"] = "";
} }
} }
}
if ( $value != $current_lang ) $e_product = $product; if ( $value != $current_lang ) $e_product = $product;
@ -444,16 +452,25 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
if($conf->global->PRODUIT_MULTIPRICES == 1) if($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td><td><input name="price" size="10" value="'.$product->price.'"></td></tr>'; print '<tr><td>'.$langs->trans("SellingPrice").' 1</td>';
print '<td><input name="price" size="10" value="'.$product->price.'">';
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
print '</td></tr>';
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{ {
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td><td><input name="price_'.$i.'" size="10" value="'.$product->multiprices["$i"].'"></td></tr>'; print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>';
print '<td><input name="price_'.$i.'" size="10" value="'.$product->multiprices["$i"].'">';
print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
print '</td></tr>';
} }
} }
// PRIX // PRIX
else else
{ {
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td><input name="price" size="10" value="'.$product->price.'"></td></tr>'; print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
print '<td><input name="price" size="10" value="'.$product->price.'">';
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
print '</td></tr>';
} }
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'; print '<tr><td>'.$langs->trans("VATRate").'</td><td>';

View File

@ -69,7 +69,6 @@ if ($_POST["action"] == 'update_price' &&
{ {
$price = ereg_replace(" ","", $_POST["price_".$i]); $price = ereg_replace(" ","", $_POST["price_".$i]);
$price = ereg_replace(",",".", $price); $price = ereg_replace(",",".", $price);
//$product->SetSellprice($_POST["price_".$i], $_POST["price_base_type_".$i], $i);
$product->multiprices["$i"] = $price; $product->multiprices["$i"] = $price;
$product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; $product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
} }