Ajoute gestion du calcul sur prix TTC

This commit is contained in:
Rodolphe Quiedeville 2006-12-15 12:02:19 +00:00
parent f202e5b7a1
commit fba788844d

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
@ -240,7 +240,7 @@ if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes
{ {
$fac = new Facture($db); $fac = new Facture($db);
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
$fac->deleteline($_GET['rowid']); $fac->deleteline($_GET['rowid'], $user);
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
{ {
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
@ -630,14 +630,19 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
} }
} }
$price_base_type = 'HT';
// Ecrase $pu par celui du produit // Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit // Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit // Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit
if ($_POST['idprod']) if ($_POST['idprod'])
{ {
$prod = new Product($db, $_POST['idprod']); $prod = new Product($db, $_POST['idprod']);
$prod->fetch($_POST['idprod']); $prod->fetch($_POST['idprod']);
$price_base_type = $prod->price_base_type;
// multiprix // multiprix
if ($conf->global->PRODUIT_MULTIPRICES == 1) if ($conf->global->PRODUIT_MULTIPRICES == 1)
{ {
@ -646,6 +651,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
else else
{ {
$pu = $prod->price; $pu = $prod->price;
$pu_ttc = $prod->price_ttc;
} }
// La description de la ligne est celle saisie ou // La description de la ligne est celle saisie ou
@ -676,7 +682,11 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') &&
$_POST['idprod'], $_POST['idprod'],
$_POST['remise_percent'], $_POST['remise_percent'],
$date_start, $date_start,
$date_end $date_end,
0,
'',
'',
$price_base_type, $pu_ttc
); );
} }
@ -727,7 +737,7 @@ if ($_GET['action'] == 'deleteline' && $user->rights->facture->creer && ! $conf-
{ {
$fac = new Facture($db,'',$_GET['facid']); $fac = new Facture($db,'',$_GET['facid']);
$fac->fetch($_GET['facid']); $fac->fetch($_GET['facid']);
$result = $fac->deleteline($_GET['rowid']); $result = $fac->deleteline($_GET['rowid'], $user);
if ($result > 0) if ($result > 0)
{ {
if ($_REQUEST['lang_id']) if ($_REQUEST['lang_id'])
@ -3004,8 +3014,7 @@ else
print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$_GET['search_montant_ttc'].'">'; print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$_GET['search_montant_ttc'].'">';
print '</td><td class="liste_titre" colspan="2" align="right">'; print '</td><td class="liste_titre" colspan="2" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">';
print '</td>'; print "</td></tr>\n";
print '</tr>';
if ($num > 0) if ($num > 0)
{ {
@ -3026,7 +3035,7 @@ else
print $facturestatic->getNomUrl(1); print $facturestatic->getNomUrl(1);
print $objp->increment; print $objp->increment;
if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans('Late')); if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans('Late'));
print '</td>'; print "</td>\n";
if ($objp->df > 0 ) if ($objp->df > 0 )
{ {
@ -3051,9 +3060,7 @@ else
// Affiche statut de la facture // Affiche statut de la facture
print '<td align="right" nowrap="nowrap">'; print '<td align="right" nowrap="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am); print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
print '</td>'; print "</td></tr>\n";
print '</tr>';
$total+=$objp->total; $total+=$objp->total;
$total_ttc+=$objp->total_ttc; $total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am; $totalrecu+=$objp->am;