noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 10/11: Task #1064 - VEN si autoliquidation mo


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 10/11: Task #1064 - VEN si autoliquidation montant incorrect remove commented code
Date: Wed, 03 Dec 2014 22:39:32 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 58cb73e17b7bf630894ff1963b42453109f4956e
Author: Dany De Bontridder <address@hidden>
Date:   Wed Dec 3 22:53:54 2014 +0100

    Task #1064 - VEN si autoliquidation montant incorrect
    remove commented code
---
 html/compute.php                      |    3 ++-
 include/class_acc_ledger_purchase.php |    4 ++--
 include/class_acc_ledger_sold.php     |    7 ++++---
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/html/compute.php b/html/compute.php
index 1ad8c2e..d49d484 100644
--- a/html/compute.php
+++ b/html/compute.php
@@ -73,7 +73,8 @@ if ( $t != -1 && isNumber($t) == 1 )
 {
     $total->set_parameter('amount_vat_rate',$tva_rate->get_parameter('rate'));
     $total->compute_vat();
-    $tvac=bcadd($total->get_parameter('amount_vat'),$amount);
+    if ($tva_rate->get_parameter('both_side')== 1) 
$total->set_parameter('amount_vat', 0);
+    $tvac=($tva_rate->get_parameter('rate') == 0 || 
$tva_rate->get_parameter('both_side')== 1) ? $amount : 
bcadd($total->get_parameter('amount_vat'),$amount);
     header("Content-type: text/html; charset: utf8",true);
     echo 
'{"ctl":"'.$n.'","htva":"'.$amount.'","tva":"'.$total->get_parameter('amount_vat').'","tvac":"'.$tvac.'"}';
 }
diff --git a/include/class_acc_ledger_purchase.php 
b/include/class_acc_ledger_purchase.php
index c796ea6..bff7555 100644
--- a/include/class_acc_ledger_purchase.php
+++ b/include/class_acc_ledger_purchase.php
@@ -569,7 +569,7 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                 if ( $g_parameter->MY_TVA_USE=='Y')
                 {
                     
$acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate'));
-                    if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0)
+                    if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0 || 
${'e_march'.$i.'_tva_amount'} == 0)
                     {
                         $acc_amount->compute_vat();
 
@@ -1489,7 +1489,7 @@ class  Acc_Ledger_Purchase extends Acc_Ledger
                    same */
                bcscale(2);
                 $css_void_tva=($both_side == 
1)?'style="text-decoration:line-through"':'';
-                if ( bcsub($tva_item,$tva_computed) != 0)
+                if ( bcsub($tva_item,$tva_computed) != 0 && ! ($tva_item == 0 
&& $both_side == 1))
                 {
 
                                         $r.='<td style="background-color:red" 
class="num" '.$css_void_tva.'>';
diff --git a/include/class_acc_ledger_sold.php 
b/include/class_acc_ledger_sold.php
index f7263a0..b40bc03 100644
--- a/include/class_acc_ledger_sold.php
+++ b/include/class_acc_ledger_sold.php
@@ -315,7 +315,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
                     $oTva->set_parameter("id", $idx_tva);
                     $oTva->load();
                     /* if empty then we need to compute it */
-                    if (trim($tva_item) == '') {
+                    if (trim($tva_item) == '' || ${'e_march'.$i.'_tva_amount'} 
== 0) {
                         /* retrieve tva */
                         $l = new Acc_Tva($this->db, $idx_tva);
                         $l->load();
@@ -753,14 +753,15 @@ class Acc_Ledger_Sold extends Acc_Ledger {
             $r.='<td class="num">';
             $r.=nbm(${"e_quant" . $i});
             $r.='</td>';
+            $both_side=0;
             if ($g_parameter->MY_TVA_USE == 'Y') {
                 $r.='<td class="num">';
                 $r.=$oTva->get_parameter('label');
                 $r.='</td>';
-
+                $both_side=$oTva->get_parameter("both_side");
                 /* warning if tva_computed and given are not the
                   same */
-                if (bcsub($tva_item, $tva_computed) != 0) {
+                if (bcsub($tva_item, $tva_computed) != 0 && ! ($tva_item == 0 
&& $both_side == 1)) {
                     $r.='<td style="background-color:red" class="num">';
                     $r.=HtmlInput::infobulle(28);
                     $r.='<a href="#" class="error" style="display:inline" 
title="' . _("Attention Différence entre TVA calculée et donnée") . '">'



reply via email to

[Prev in Thread] Current Thread [Next in Thread]