Fix: Supplier price displayed on document lines didnt take discount

Conflicts:
	htdocs/fourn/ajax/getSupplierPrices.php
This commit is contained in:
Christophe Battarel 2013-09-15 12:04:46 +02:00 committed by simnandez
parent 59783cf556
commit d9d90f1088
2 changed files with 11 additions and 8 deletions

View File

@ -127,6 +127,7 @@ Fix: Edit propal line was losing product supplier price id
Fix: Delete linked element to supplier invoice when deleted
Fix: [ bug #1061 ] Bad info shipped products
Fix: [ bug #1062 ] Documents lost in propals and contracts validating
Fix: Supplier price displayed on document lines didnt take discount
Qual: Add travis-ci integration

View File

@ -48,7 +48,7 @@ if (! empty($idprod))
{
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
$sql.= " pfp.ref_fourn,";
$sql.= " pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice, pfp.charges, pfp.unitcharges,";
$sql.= " pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice, pfp.charges, pfp.unitcharges,";
$sql.= " s.nom";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
@ -72,13 +72,15 @@ if (! empty($idprod))
{
$objp = $db->fetch_object($result);
$price = $objp->fprice * (1 - $objp->remise_percent / 100);
$unitprice = $objp->unitprice * (1 - $objp->remise_percent / 100);
$title = $objp->nom.' - '.$objp->ref_fourn.' - ';
if ($objp->quantity == 1)
{
$title.= price($objp->fprice,0,$langs,0,0,-1,$conf->currency)."/";
$price = $objp->fprice;
$title.= price($price);
$title.= $langs->getCurrencySymbol($conf->currency)."/";
}
$title.= $objp->quantity.' ';
@ -94,18 +96,18 @@ if (! empty($idprod))
if ($objp->quantity > 1)
{
$title.=" - ";
$title.= price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit");
$title.= price($unitprice).$langs->getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$price = $objp->unitprice;
$price = $unitprice;
}
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
$title.=" + ";
$title.= price($objp->unitcharges,0,$langs,0,0,-1,$conf->currency);
$title.= price($objp->unitcharges).$langs->getCurrencySymbol($conf->currency);
$price += $objp->unitcharges;
}
if ($objp->duration) $label .= " - ".$objp->duration;
$label = price($price,0,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit");
$label = price($price).$langs->getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
$i++;