Fix: TVA Non Perçue Récupérable

This commit is contained in:
eldy 2011-10-09 17:37:47 +02:00
parent b1ea85c504
commit 351807ee9a
7 changed files with 14 additions and 10 deletions

View File

@ -72,16 +72,16 @@
<td align="right">
<?php
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 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" 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>
</tr>
<?php if ($conf->service->enabled && $dateSelector) {?>
<?php if ($conf->service->enabled && $dateSelector) { ?>
<tr <?php echo $bcnd[$var]; ?>>
<td colspan="9">
<?php

View File

@ -205,7 +205,7 @@ NoSupplierBillsUnpaid=Aucune facture fournisseur impayée
SupplierBillsToPay=Factures fournisseurs à payer
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
NonPercuRecuperable=Non perçue récupérable
NonPercuRecuperable=Non perçue réc.
SetConditions=Définir conditions de règlement
SetMode=Définir mode de règlement
SetDate= Définir date

View File

@ -2830,7 +2830,7 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow
* @param info_bits Miscellanous information on vat
* @return string Chaine avec montant formate (19,6 ou 19,6% ou 8.5% *)
*/
function vatrate($rate,$addpercent=false,$info_bits=0)
function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
{
// Test for compatibility
if (preg_match('/%/',$rate))
@ -2845,7 +2845,7 @@ function vatrate($rate,$addpercent=false,$info_bits=0)
}
$ret=price($rate,0,'',0,0).($addpercent?'%':'');
if ($info_bits & 1) $ret.=' '.MAIN_LABEL_MENTION_NPR;
if ($info_bits & 1) $ret.=' '.($usestarfornpr?'*':MAIN_LABEL_MENTION_NPR);
return $ret;
}

View File

@ -894,7 +894,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
}
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);
}
}

View File

@ -208,6 +208,7 @@ class Product extends CommonObject
$this->price_min_ttc=price2num($this->price_min_ttc);
$this->price_min=price2num($this->price_min);
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->tva_npr)) $this->tva_npr = 0;
//Local taxes
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
@ -420,6 +421,7 @@ class Product extends CommonObject
$this->volume = price2num($this->volume);
$this->volume_units = trim($this->volume_units);
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->tva_npr)) $this->tva_npr = 0;
//Local taxes
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
@ -435,6 +437,7 @@ class Product extends CommonObject
$sql.= " SET label = '" . $this->db->escape($this->libelle) ."'";
$sql.= ",ref = '" . $this->ref ."'";
$sql.= ",tva_tx = " . $this->tva_tx;
$sql.= ",recuperableonly = " . $this->tva_npr;
//Local taxes
$sql.= ",localtax1_tx = " . $this->localtax1_tx;

View File

@ -148,7 +148,8 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
else $product->price = $_POST["price"];
if ($product->price_base_type == 'TTC') $product->price_min_ttc = $_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.
$product->localtax1_tx = get_localtax($product->tva_tx,1);

View File

@ -241,7 +241,7 @@ if ($conf->global->PRODUIT_MULTIPRICES)
else
{
// 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
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
@ -317,7 +317,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
// VAT
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>';
// Price base