Fix: TVA Non Perçue Récupérable
This commit is contained in:
parent
cfcccbdfa0
commit
c43c2734fb
1
dev/.gitignore
vendored
Normal file
1
dev/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/spec
|
||||||
@ -2800,7 +2800,7 @@ class Form
|
|||||||
* @param societe_vendeuse Objet societe vendeuse
|
* @param societe_vendeuse Objet societe vendeuse
|
||||||
* @param societe_acheteuse Objet societe acheteuse
|
* @param societe_acheteuse Objet societe acheteuse
|
||||||
* @param idprod Id product
|
* @param idprod Id product
|
||||||
* @param info_bits Miscellaneous information on line
|
* @param info_bits Miscellaneous information on line (1 for NPR)
|
||||||
* @param type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined)
|
* @param type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined)
|
||||||
* Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle.
|
* Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle.
|
||||||
* Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
* Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
||||||
|
|||||||
@ -64,16 +64,16 @@
|
|||||||
<td align="right">
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||||
else echo $html->load_tva('np_tva_tx', -1, $seller, $buyer);
|
else echo $html->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td align="right"><input type="text" size="5" name="np_price"></td>
|
<td align="right"><input type="text" size="5" name="np_price" value="<?php echo (isset($_POST["np_price"])?$_POST["np_price"]:''); ?>"></td>
|
||||||
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
||||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
||||||
<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php if ($conf->service->enabled && $dateSelector) {?>
|
<?php if ($conf->service->enabled && $dateSelector) { ?>
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
<td colspan="9">
|
<td colspan="9">
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -121,7 +121,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to build pdf onto disk
|
* Function to build pdf onto disk
|
||||||
*
|
*
|
||||||
* @param int $object Id of object to generate
|
* @param int $object Id of object to generate
|
||||||
* @param object $outputlangs Lang output object
|
* @param object $outputlangs Lang output object
|
||||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
|
|||||||
@ -204,7 +204,7 @@ NoSupplierBillsUnpaid=Aucune facture fournisseur impayée
|
|||||||
SupplierBillsToPay=Factures fournisseurs à payer
|
SupplierBillsToPay=Factures fournisseurs à payer
|
||||||
CustomerBillsUnpaid=Factures clients impayées
|
CustomerBillsUnpaid=Factures clients impayées
|
||||||
DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres
|
DispenseMontantLettres=Les factures rédigées par procédés mécanographiques sont dispensées de l'arrêté en lettres
|
||||||
NonPercuRecuperable=Non perçue récupérable
|
NonPercuRecuperable=Non perçue réc.
|
||||||
SetConditions=Définir conditions de règlement
|
SetConditions=Définir conditions de règlement
|
||||||
SetMode=Définir mode de règlement
|
SetMode=Définir mode de règlement
|
||||||
SetDate= Définir date
|
SetDate= Définir date
|
||||||
|
|||||||
@ -2886,15 +2886,16 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction qui retourne un taux de tva formate pour visualisation
|
* Return a string with VAT rate label formated for view output
|
||||||
* Utilisee dans les pdf et les pages html
|
* Used into pdf and HTML pages
|
||||||
*
|
*
|
||||||
* @param float $rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
|
* @param float $rate Rate value to format (19.6 19,6 19.6% 19,6%,...)
|
||||||
* @param boolean $addpercent Add a percent % sign in output
|
* @param boolean $addpercent Add a percent % sign in output
|
||||||
* @param int $info_bits Miscellanous information on vat
|
* @param int $info_bits Miscellanous information on vat (0=Default, 1=French NPR vat)
|
||||||
* @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *)
|
* @param int $usestarfornpr 1=Use '*' for NPR vat rate intead of MAIN_LABEL_MENTION_NPR
|
||||||
|
* @return string String with formated amounts (19,6 or 19,6% or 8.5% NPR or 8.5% *)
|
||||||
*/
|
*/
|
||||||
function vatrate($rate,$addpercent=false,$info_bits=0)
|
function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
|
||||||
{
|
{
|
||||||
// Test for compatibility
|
// Test for compatibility
|
||||||
if (preg_match('/%/',$rate))
|
if (preg_match('/%/',$rate))
|
||||||
@ -2902,14 +2903,14 @@ function vatrate($rate,$addpercent=false,$info_bits=0)
|
|||||||
$rate=str_replace('%','',$rate);
|
$rate=str_replace('%','',$rate);
|
||||||
$addpercent=true;
|
$addpercent=true;
|
||||||
}
|
}
|
||||||
if (preg_match('/\*/',$rate) || preg_match('/'.MAIN_LABEL_MENTION_NPR.'/i',$rate))
|
if (preg_match('/\*/',$rate) || preg_match('/'.constant('MAIN_LABEL_MENTION_NPR').'/i',$rate))
|
||||||
{
|
{
|
||||||
$rate=str_replace('*','',$rate);
|
$rate=str_replace('*','',$rate);
|
||||||
$info_bits |= 1;
|
$info_bits |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret=price($rate,0,'',0,0).($addpercent?'%':'');
|
$ret=price($rate,0,'',0,0).($addpercent?'%':'');
|
||||||
if ($info_bits & 1) $ret.=' '.MAIN_LABEL_MENTION_NPR;
|
if ($info_bits & 1) $ret.=' '.($usestarfornpr?'*':constant('MAIN_LABEL_MENTION_NPR'));
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3205,10 +3206,11 @@ function get_product_localtax_for_country($idprod, $local, $countrycode)
|
|||||||
* Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par defaut=TVA du produit vendu. Fin de regle
|
* Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par defaut=TVA du produit vendu. Fin de regle
|
||||||
* Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise avec num TVA) intra alors TVA par defaut=0. Fin de regle
|
* Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise avec num TVA) intra alors TVA par defaut=0. Fin de regle
|
||||||
* Sinon TVA proposee par defaut=0. Fin de regle.
|
* Sinon TVA proposee par defaut=0. Fin de regle.
|
||||||
* @param societe_vendeuse Objet societe vendeuse
|
*
|
||||||
* @param societe_acheteuse Objet societe acheteuse
|
* @param Societe $societe_vendeuse Objet societe vendeuse
|
||||||
* @param idprod Id product
|
* @param Societe $societe_acheteuse Objet societe acheteuse
|
||||||
* @return float Taux de tva a appliquer, -1 si ne peut etre determine
|
* @param int $idprod Id product
|
||||||
|
* @return float Taux de tva a appliquer, -1 si ne peut etre determine
|
||||||
*/
|
*/
|
||||||
function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
||||||
{
|
{
|
||||||
@ -3282,16 +3284,11 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction qui renvoie si tva doit etre tva percue recuperable
|
* Fonction qui renvoie si tva doit etre tva percue recuperable
|
||||||
* Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle.
|
*
|
||||||
* Si le (pays vendeur = pays acheteur) alors TVA par defaut=TVA du produit vendu. Fin de regle.
|
* @param Societe $societe_vendeuse Objet societe vendeuse
|
||||||
* Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par defaut=0 (La TVA doit etre paye par acheteur au centre d'impots de son pays et non au vendeur). Fin de regle.
|
* @param Societe $societe_acheteuse Objet societe acheteuse
|
||||||
* Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par defaut=TVA du produit vendu. Fin de regle
|
* @param int $idprod Id product
|
||||||
* Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise avec num TVA) intra alors TVA par defaut=0. Fin de regle
|
* @return float 0 or 1
|
||||||
* Sinon TVA proposee par defaut=0. Fin de regle.
|
|
||||||
* @param societe_vendeuse Objet societe vendeuse
|
|
||||||
* @param societe_acheteuse Objet societe acheteuse
|
|
||||||
* @param idprod Id product
|
|
||||||
* @return float 0 or 1
|
|
||||||
*/
|
*/
|
||||||
function get_default_npr($societe_vendeuse, $societe_acheteuse, $idprod)
|
function get_default_npr($societe_vendeuse, $societe_acheteuse, $idprod)
|
||||||
{
|
{
|
||||||
@ -3301,11 +3298,11 @@ function get_default_npr($societe_vendeuse, $societe_acheteuse, $idprod)
|
|||||||
/**
|
/**
|
||||||
* Function that return localtax of a product line (according to seller, buyer and product vat rate)
|
* Function that return localtax of a product line (according to seller, buyer and product vat rate)
|
||||||
*
|
*
|
||||||
* @param societe_vendeuse Objet societe vendeuse
|
* @param Societe $societe_vendeuse Objet societe vendeuse
|
||||||
* @param societe_acheteuse Objet societe acheteuse
|
* @param Societe $societe_acheteuse Objet societe acheteuse
|
||||||
* @param local Localtax to process (1 or 2)
|
* @param int $local Localtax to process (1 or 2)
|
||||||
* @param idprod Id product
|
* @param int $idprod Id product
|
||||||
* @return float Taux de localtax appliquer, -1 si ne peut etre determine
|
* @return float Taux de localtax appliquer, -1 si ne peut etre determine
|
||||||
*/
|
*/
|
||||||
function get_default_localtax($societe_vendeuse, $societe_acheteuse, $local, $idprod=0)
|
function get_default_localtax($societe_vendeuse, $societe_acheteuse, $local, $idprod=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -963,7 +963,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0,$hookmanager=
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits);
|
if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,27 +48,27 @@ class Product extends CommonObject
|
|||||||
var $libelle; // TODO deprecated
|
var $libelle; // TODO deprecated
|
||||||
var $label;
|
var $label;
|
||||||
var $description;
|
var $description;
|
||||||
//! Prix de vente
|
//! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit)
|
||||||
var $price; // Price without tax
|
var $type;
|
||||||
|
//! Selling price
|
||||||
|
var $price; // Price net
|
||||||
var $price_ttc; // Price with tax
|
var $price_ttc; // Price with tax
|
||||||
var $price_min;
|
var $price_min; // Minimum price net
|
||||||
var $price_min_ttc;
|
var $price_min_ttc; // Minimum price with tax
|
||||||
//! Base de prix (ttc ou ht)
|
//! Base price ('TTC' for price including tax or 'HT' for net price)
|
||||||
var $price_base_type;
|
var $price_base_type;
|
||||||
//! Tableau des prix multiples
|
//! Arrays for multiprices
|
||||||
var $multiprices=array();
|
var $multiprices=array();
|
||||||
var $multiprices_ttc=array();
|
var $multiprices_ttc=array();
|
||||||
var $multiprices_base_type=array();
|
var $multiprices_base_type=array();
|
||||||
var $multiprices_tva_tx=array();
|
var $multiprices_tva_tx=array();
|
||||||
//! Taux de TVA
|
//! Default VAT rate of product
|
||||||
var $tva_tx;
|
var $tva_tx;
|
||||||
//! French VAT NPR
|
//! French VAT NPR (0 or 1)
|
||||||
var $tva_npr=0;
|
var $tva_npr=0;
|
||||||
//! Spanish local taxes
|
//! Spanish local taxes
|
||||||
var $localtax1_tx;
|
var $localtax1_tx;
|
||||||
var $localtax2_tx;
|
var $localtax2_tx;
|
||||||
//! Type 0 for regular product, 1 for service (Advanced feature: 2 for assembly kit, 3 for stock kit)
|
|
||||||
var $type;
|
|
||||||
|
|
||||||
//! Stock
|
//! Stock
|
||||||
var $stock_reel;
|
var $stock_reel;
|
||||||
@ -207,6 +207,7 @@ class Product extends CommonObject
|
|||||||
$this->price_min_ttc=price2num($this->price_min_ttc);
|
$this->price_min_ttc=price2num($this->price_min_ttc);
|
||||||
$this->price_min=price2num($this->price_min);
|
$this->price_min=price2num($this->price_min);
|
||||||
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
||||||
|
if (empty($this->tva_npr)) $this->tva_npr = 0;
|
||||||
//Local taxes
|
//Local taxes
|
||||||
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
||||||
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
||||||
@ -403,7 +404,7 @@ class Product extends CommonObject
|
|||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if (! $this->libelle) $this->libelle = 'LIBELLE MANQUANT';
|
if (! $this->libelle) $this->libelle = 'MISSING LABEL';
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->ref = dol_string_nospecial(trim($this->ref));
|
$this->ref = dol_string_nospecial(trim($this->ref));
|
||||||
@ -419,6 +420,7 @@ class Product extends CommonObject
|
|||||||
$this->volume = price2num($this->volume);
|
$this->volume = price2num($this->volume);
|
||||||
$this->volume_units = trim($this->volume_units);
|
$this->volume_units = trim($this->volume_units);
|
||||||
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
||||||
|
if (empty($this->tva_npr)) $this->tva_npr = 0;
|
||||||
//Local taxes
|
//Local taxes
|
||||||
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
||||||
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
||||||
@ -433,6 +435,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " SET label = '" . $this->db->escape($this->libelle) ."'";
|
$sql.= " SET label = '" . $this->db->escape($this->libelle) ."'";
|
||||||
$sql.= ",ref = '" . $this->ref ."'";
|
$sql.= ",ref = '" . $this->ref ."'";
|
||||||
$sql.= ",tva_tx = " . $this->tva_tx;
|
$sql.= ",tva_tx = " . $this->tva_tx;
|
||||||
|
$sql.= ",recuperableonly = " . $this->tva_npr;
|
||||||
|
|
||||||
//Local taxes
|
//Local taxes
|
||||||
$sql.= ",localtax1_tx = " . $this->localtax1_tx;
|
$sql.= ",localtax1_tx = " . $this->localtax1_tx;
|
||||||
|
|||||||
@ -158,7 +158,8 @@ if (empty($reshook))
|
|||||||
else $product->price = $_POST["price"];
|
else $product->price = $_POST["price"];
|
||||||
if ($product->price_base_type == 'TTC') $product->price_min_ttc = $_POST["price_min"];
|
if ($product->price_base_type == 'TTC') $product->price_min_ttc = $_POST["price_min"];
|
||||||
else $product->price_min = $_POST["price_min"];
|
else $product->price_min = $_POST["price_min"];
|
||||||
$product->tva_tx = $_POST["tva_tx"];
|
$product->tva_tx = str_replace('*','',$_POST['tva_tx']);
|
||||||
|
$product->tva_npr = preg_match('/\*/',$_POST['tva_tx'])?1:0;
|
||||||
|
|
||||||
// local taxes.
|
// local taxes.
|
||||||
$product->localtax1_tx = get_localtax($product->tva_tx,1);
|
$product->localtax1_tx = get_localtax($product->tva_tx,1);
|
||||||
|
|||||||
@ -240,7 +240,7 @@ if ($conf->global->PRODUIT_MULTIPRICES)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TVA
|
// TVA
|
||||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>';
|
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx.($product->tva_npr?'*':''),true).'</td></tr>';
|
||||||
|
|
||||||
// Price
|
// Price
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
|
||||||
@ -316,7 +316,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
|
|||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
|
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
|
||||||
print $html->load_tva("tva_tx",$product->tva_tx,$mysoc,'',$product->id);
|
print $html->load_tva("tva_tx",$product->tva_tx,$mysoc,'',$product->id,$product->tva_npr);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Price base
|
// Price base
|
||||||
@ -357,10 +357,12 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
|
||||||
|
print '<center><br><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||||
|
|
||||||
|
print '<br></form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user