Skip to content

Commit

Permalink
Fix: TVA Non Perçue Récupérable
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 9, 2011
1 parent b1ea85c commit 351807e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions htdocs/core/tpl/freeproductline_create.tpl.php
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/fr_FR/bills.lang
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions htdocs/lib/functions.lib.php
Expand Up @@ -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))
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/lib/pdf.lib.php
Expand Up @@ -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);
}
}

Expand Down
3 changes: 3 additions & 0 deletions htdocs/product/class/product.class.php
Expand Up @@ -208,6 +208,7 @@ function create($user,$notrigger=0)
$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;
Expand Down Expand Up @@ -420,6 +421,7 @@ function update($id, $user)
$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;
Expand All @@ -435,6 +437,7 @@ function update($id, $user)
$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;
Expand Down
3 changes: 2 additions & 1 deletion htdocs/product/fiche.php
Expand Up @@ -148,7 +148,8 @@
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);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/product/price.php
Expand Up @@ -241,7 +241,7 @@
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>';
Expand Down Expand Up @@ -317,7 +317,7 @@

// 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
Expand Down

0 comments on commit 351807e

Please sign in to comment.