Fix: le taux de tva n'était pas récupéré
This commit is contained in:
parent
cd7b6927e4
commit
b677f9e714
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.fr>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.fr>
|
||||||
|
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@cap-networks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -246,31 +247,32 @@ if ($_GET['action'] == 'add_ligne')
|
|||||||
|
|
||||||
if ($_POST['idprod'])
|
if ($_POST['idprod'])
|
||||||
{
|
{
|
||||||
$nv_prod = new Product($db);
|
$nv_prod = new Product($db);
|
||||||
$nv_prod->fetch($_POST['idprod']);
|
$nv_prod->fetch($_POST['idprod']);
|
||||||
|
|
||||||
// cas spécial pour lequel on a les meme référence que le fournisseur
|
// cas spécial pour lequel on a les meme référence que le fournisseur
|
||||||
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
|
||||||
$label = $nv_prod->libelle;
|
$label = $nv_prod->libelle;
|
||||||
|
|
||||||
$result=$nv_prod->get_buyprice($_POST['socid'], $_POST['qty']);
|
$result=$nv_prod->get_buyprice($_POST['socid'], $_POST['qty']);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$societe='';
|
$societe='';
|
||||||
if ($_POST['socid'])
|
if ($_POST['socid'])
|
||||||
{
|
{
|
||||||
$societe=new Societe($db);
|
$societe=new Societe($db);
|
||||||
$societe->fetch($_POST['socid']);
|
$societe->fetch($_POST['socid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tvatx=get_default_tva($societe,$mysoc,$nv_prod->tva_tx);
|
$tvatx=get_default_tva($societe,$mysoc,$nv_prod->tva_tx);
|
||||||
$facfou->addline($label, $nv_prod->fourn_pu, $tvatx, $_POST['qty'], $_POST['idprod']);
|
|
||||||
}
|
$facfou->addline($label, $nv_prod->fourn_pu, $tvatx, $_POST['qty'], $_POST['idprod']);
|
||||||
if ($result == -1)
|
}
|
||||||
{
|
if ($result == -1)
|
||||||
// Quantité insuffisante
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
// Quantité insuffisante
|
||||||
}
|
$mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -788,8 +790,8 @@ else
|
|||||||
{
|
{
|
||||||
print '<form name="addligne_predef" action="fiche.php?facid='.$fac->id.'&action=add_ligne" method="post">';
|
print '<form name="addligne_predef" action="fiche.php?facid='.$fac->id.'&action=add_ligne" method="post">';
|
||||||
print '<input type="hidden" name="socid" value="'. $fac->socid .'">';
|
print '<input type="hidden" name="socid" value="'. $fac->socid .'">';
|
||||||
print '<input type="hidden" name="facid" value="'.$fac->id.'">';
|
print '<input type="hidden" name="facid" value="'.$fac->id.'">';
|
||||||
print '<input type="hidden" name="socid" value="'.$fac->socid.'">';
|
print '<input type="hidden" name="socid" value="'.$fac->socid.'">';
|
||||||
$var=! $var;
|
$var=! $var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
|
|||||||
@ -1912,7 +1912,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
|||||||
if (! is_numeric($societe_vendeuse->tva_assuj) && $societe_vendeuse->tva_assuj=='franchise') return 0;
|
if (! is_numeric($societe_vendeuse->tva_assuj) && $societe_vendeuse->tva_assuj=='franchise') return 0;
|
||||||
|
|
||||||
// Si le (pays vendeur = pays acheteur) alors la TVA par défaut=TVA du produit vendu. Fin de règle.
|
// Si le (pays vendeur = pays acheteur) alors la TVA par défaut=TVA du produit vendu. Fin de règle.
|
||||||
if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && $societe_acheteuse->tva_assuj == 1)
|
if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && $societe_vendeuse->tva_assuj == 1)
|
||||||
{
|
{
|
||||||
return $taux_produit;
|
return $taux_produit;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user