diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 5d82fb4d628..49ba20b019f 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -55,7 +55,8 @@ if ($_POST["action"] == 'update_price' &&
{
$newprice='';
$newpricebase='';
-
+ $newvat='';
+
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{
if($_POST["price_".$i])
@@ -65,11 +66,13 @@ if ($_POST["action"] == 'update_price' &&
{
$newprice=price2num($_POST["price_".$i],'MU');
$newpricebase=$_POST["multiprices_base_type_".$i];
+ $newvat=$_POST["tva_tx_".$i];
}
else
{
$product->multiprices["$i"] = price2num($_POST["price_".$i],'MU');
$product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
+ $product->multiprices_vat_rate["$i"] = $_POST["tva_tx_".$i];
}
}
else
@@ -77,6 +80,7 @@ if ($_POST["action"] == 'update_price' &&
$product->multiprices["$i"] = "";
$product->multiprices_ttc["$i"] = "";
$product->multiprices_base_type["$i"] = "";
+ $product->multiprices_vat_rate["$i"] = "";
}
}
}
@@ -84,9 +88,10 @@ if ($_POST["action"] == 'update_price' &&
{
$newprice=price2num($_POST["price"],'MU');
$newpricebase=$_POST["price_base_type"];
+ $newvat=$_POST["tva_tx"];
}
- if ($product->update_price($product->id, $newprice, $newpricebase, $user) > 0)
+ if ($product->update_price($product->id, $newprice, $newpricebase, $user, $newvat) > 0)
{
$_GET["action"] = '';
$mesg = $langs->trans("RecordSaved");
@@ -170,6 +175,9 @@ else
}
}
+// TVA
+print '
| '.$langs->trans("VATRate").' | '.vatrate($product->tva_tx,true).' |
';
+
// Statut
print '| '.$langs->trans("Status").' | ';
print $product->getLibStatut(2);
@@ -214,6 +222,8 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
print '';
print '';
print '';
+
+ // Price
print '| ';
$text=$langs->trans('SellingPrice');
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
@@ -230,6 +240,11 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
print ' | ';
+ // VAT
+ print '| '.$langs->trans("VATRate").' | ';
+ print $html->select_tva("tva_tx",$product->tva_tx,$mysoc,'');
+ print ' | ';
+
print '| ';
print ' | ';
print ' ';
@@ -258,7 +273,13 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
}
print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
- print ' |
';
+ print '';
+
+ // VAT
+ print ''.$langs->trans("VATRate").' | ';
+ print $html->select_tva("tva_tx_".$i,$product->multiprices_tva_tx["$i"],$mysoc,'');
+ print ' | ';
+
print '| ';
print ' |
';
print '';
@@ -272,22 +293,22 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
// Liste des evolutions du prix
if($conf->global->PRODUIT_MULTIPRICES)
{
- $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type,";
+ $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,";
$sql.= " p.price_level,";
$sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."product_price as p, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE fk_product = ".$product->id;
$sql.= " AND p.fk_user_author = u.rowid ";
- $sql.= " ORDER BY p.price_level ASC, p.date_price DESC ";
+ $sql.= " ORDER BY p.price_level ASC, p.date_price DESC";
}
else
{
- $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type,";
+ $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx,";
$sql.= " ".$db->pdate("p.date_price")." as dp, u.rowid as user_id, u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."product_price as p, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE fk_product = ".$product->id;
$sql.= " AND p.fk_user_author = u.rowid";
- $sql.= " ORDER BY p.date_price DESC ";
+ $sql.= " ORDER BY p.date_price DESC";
}
//$sql .= $db->plimit();
@@ -322,10 +343,11 @@ if ($result)
print ''.$langs->trans("MultiPriceLevelsName").' | ';
}
+ print ''.$langs->trans("PriceBase").' | ';
+ print ''.$langs->trans("VAT").' | ';
print ''.$langs->trans("HT").' | ';
print ''.$langs->trans("TTC").' | ';
- print ''.$langs->trans("PriceBase").' | ';
- print ''.$langs->trans("ChangedBy").' | ';
+ print ''.$langs->trans("ChangedBy").' | ';
print '';
$var=True;
@@ -344,12 +366,13 @@ if ($result)
print "".$objp->price_level." | ";
}
+ print ''.$langs->trans($objp->price_base_type)." | ";
+ print ''.vatrate($objp->tva_tx)." | ";
print ''.price($objp->price)." | ";
print ''.price($objp->price_ttc)." | ";
- print ''.$langs->trans($objp->price_base_type)." | ";
// User
- print ''.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.' | ';
+ print ''.img_object($langs->trans("ShowUser"),'user').' '.$objp->login.' | ';
print "\n";
$i++;
}