Fix: la remise tait applique sur la ligne et sur le total HT
This commit is contained in:
parent
b93201b062
commit
d42eb37672
@ -544,12 +544,16 @@ class Commande
|
||||
$remise = 0;
|
||||
$price = round(ereg_replace(',','.',$pu), 2);
|
||||
$subprice = $price;
|
||||
|
||||
// appliquait la remise 2 fois : sur la ligne et le HT
|
||||
|
||||
/*
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
|
||||
*/
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)';
|
||||
|
||||
if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
|
||||
@ -600,12 +604,16 @@ class Commande
|
||||
$remise = 0;
|
||||
$price = round(ereg_replace(',','.',$pu), 2);
|
||||
$subprice = $price;
|
||||
|
||||
// appliquait la remise 2 fois : sur la ligne et le HT
|
||||
|
||||
/*
|
||||
if (trim(strlen($remise_percent)) > 0)
|
||||
{
|
||||
$remise = round(($pu * $remise_percent / 100), 2);
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
|
||||
*/
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)';
|
||||
$sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "','$fk_product',".price2num($price).", '$qty', '$txtva', $remise_percent,'".price2num($subprice)."','".price2num( $remise)."') ;";
|
||||
|
||||
|
||||
@ -2033,7 +2033,17 @@ else
|
||||
* Propales rattachées
|
||||
*/
|
||||
$sql = 'SELECT '.$db->pdate('p.datep').' as dp, p.price, p.ref, p.rowid as propalid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propal as p, '.MAIN_DB_PREFIX.'fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = '.$fac->id;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propal as p';
|
||||
if (!$conf->commande->enabled)
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."fa_pr as fp";
|
||||
$sql .= " WHERE fp.fk_propal = p.rowid AND fp.fk_facture = ".$fac->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."co_pr as cp, ".MAIN_DB_PREFIX."co_fa as cf";
|
||||
$sql .= " WHERE cf.fk_facture = ".$fac->id." AND cf.fk_commande = cp.fk_commande AND cp.fk_propal = p.rowid";
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -2094,7 +2104,7 @@ else
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('RefCdeClientShort').'</td>';
|
||||
print '<td>'.$langs->trans('RefCdeClientShort').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AmountHT').'</td>';
|
||||
print '</tr>';
|
||||
@ -2105,7 +2115,7 @@ else
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowOrder'), 'order').' '.$objp->ref."</a></td>\n";
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->date_commande).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print "</tr>\n";
|
||||
@ -2114,8 +2124,8 @@ else
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="left">'.$langs->trans('TotalHT').'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total).'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user