[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 30/219: Task #0001443: opérations rapprochée
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 30/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation 1. Correct export CSV 2. Improve code : new function Acc_Reconciliation:get_amount_noautovat |
Date: |
Mon, 18 Dec 2017 13:22:30 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit d3a04efd68bf6faf0e678aaff217d86fb5099c95
Author: Dany De Bontridder <address@hidden>
Date: Thu Aug 31 11:12:33 2017 +0200
Task #0001443: opérations rapprochées : bug quand on utilise des tva avec
autoliquidation
1. Correct export CSV
2. Improve code : new function Acc_Reconciliation:get_amount_noautovat
---
include/class/acc_reconciliation.class.php | 32 ++++++++++++++++++++++++-----
include/template/impress_reconciliation.php | 31 ++++++----------------------
2 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/include/class/acc_reconciliation.class.php
b/include/class/acc_reconciliation.class.php
index 4233d7c..ed5427c 100644
--- a/include/class/acc_reconciliation.class.php
+++ b/include/class/acc_reconciliation.class.php
@@ -515,6 +515,11 @@ j1.j_poste as poste
}
}
$export->write_header($title);
+ //-----------------------------------------
+ //Retrieve amount without autoreversed VAT
+ //-----------------------------------------
+
$amount=$this->get_amount_noautovat($first['jr_id'],$first['jr_montant']);
+
// --------------------------
// Print First
// --------------------------
@@ -525,7 +530,7 @@ j1.j_poste as poste
$export->add($first['jr_pj_number']);
$export->add($first['jrn_def_name']);
$export->add($first['jrn_def_type']);
- $export->add($first['jr_montant'],"number");
+ $export->add($amount,"number");
if (count($a_depend) > 0)
{
// --------------------------------------
@@ -533,20 +538,21 @@ j1.j_poste as poste
// --------------------------------------
$depend = $a_depend[0];
$export->add("<->");
-
+
$amount_dep=$this->get_amount_noautovat($depend['jr_id'],$depend['jr_montant']);
$export->add($depend['jr_date']);
$export->add($depend['jr_internal']);
$export->add($depend['jr_comment']);
$export->add($depend['jr_pj_number']);
$export->add($depend['jrn_def_name']);
$export->add($depend['jrn_def_type']);
- $export->add($depend['jr_montant'],"number");
+ $export->add($amount_dep,"number");
$export->write();
// --------------------------------------
// print other depending operation if any
// --------------------------------------
for ($e = 1; $e < count($a_depend); $e++)
{
+
$amount_dep=$this->get_amount_noautovat($depend['jr_id'],$depend['jr_montant']);
$depend = $a_depend[$e];
$export->add("");
$export->add("");
@@ -563,7 +569,7 @@ j1.j_poste as poste
$export->add($depend['jr_pj_number']);
$export->add($depend['jrn_def_name']);
$export->add($depend['jrn_def_type']);
- $export->add($depend['jr_montant'],"number");
+ $export->add($amount_dep,"number");
$export->write();
}
}
@@ -605,7 +611,23 @@ j1.j_poste as poste
}
return $array;
}
-
+ function get_amount_noautovat($p_jrn_id,$p_default_amount) {
+ $retdb=$this->db->execute("detail_quant",array($p_jrn_id));
+ if ( Database::num_row($retdb) != 0)
+ {
+ // then second_amount takes in account the vat_sided
+ $row=Database::fetch_array($retdb, 0);
+ $total_price=bcadd($row['price'],$row['vat_amount']);
+ $total_price=bcsub($total_price,$row['vat_sided']);
+ $first_amount=$total_price;
+
+ } else {
+ // else take the amount from jrn
+ $first_amount=$p_default_amount;
+ }
+ return $first_amount;
+
+ }
static function test_me()
{
$cn=Dossier::connect();
diff --git a/include/template/impress_reconciliation.php
b/include/template/impress_reconciliation.php
index d6b3f19..d0c7d69 100644
--- a/include/template/impress_reconciliation.php
+++ b/include/template/impress_reconciliation.php
@@ -24,17 +24,8 @@
</tr>
<?php
for ($i=0;$i<count($array);$i++) {
- $tot=$array[$i]['first']['jr_montant'];
-
$retdb=$cn->execute("detail_quant",array($array[$i]['first']['jr_id']));
- if ( Database::num_row($retdb) != 0)
- {
- // then second_amount takes in account the vat_sided
- $row=Database::fetch_array($retdb, 0);
- $total_price=bcadd($row['price'],$row['vat_amount']);
- $total_price=bcsub($total_price,$row['vat_sided']);
- $tot=$total_price;
-
- }
+
$tot=$acc_reconciliation->get_amount_noautovat($array[$i]['first']['jr_id'],$array[$i]['first']['jr_montant']);
+
$r='';
$r.=td($i);
$r.=td(format_date($array[$i]['first']['jr_date']));
@@ -60,20 +51,10 @@ for ($i=0;$i<count($array);$i++) {
$r.=td($array[$i]['depend'][$e]['jr_pj_number']);
$r.=td($array[$i]['depend'][$e]['jr_comment']);
$r.=td(nbm($array[$i]['depend'][$e]['jr_montant']),'style="text-align:right"');
-
$retdb=$cn->execute("detail_quant",array($array[$i]['depend'][$e]['jr_id']));
- // if exist in v_quant_detail
- if ( Database::num_row($retdb) != 0)
- {
- // then second_amount takes in account the vat_sided
- $row=Database::fetch_array($retdb, 0);
- $total_price=bcadd($row['price'],$row['vat_amount']);
- $total_price=bcsub($total_price,$row['vat_sided']);
- $tot2=bcadd($tot2,$total_price);
+
+
$amount_dep=$acc_reconciliation->get_amount_noautovat($array[$i]['depend'][$e]['jr_id'],$array[$i]['depend'][$e]['jr_montant']);
+ $tot2=bcadd($tot2,$amount_dep);
- } else {
- // else take the amount from jrn
-
$tot2=bcadd($tot2,$array[$i]['depend'][$e]['jr_montant']);
- }
if ( $e==$limit)
echo '<tr>'.$r.'</tr>';
else
@@ -81,7 +62,7 @@ for ($i=0;$i<count($array);$i++) {
$ret=$acc_reconciliation->db->execute('detail_quant',array($array[$i]['depend'][$e]['jr_id']));
$acc_reconciliation->show_detail($ret);
}
- echo tr(td(_('Total
')).td(_('operation')).td(nbm($tot)).td(_('operations
dépendantes')).td(nbm($tot2)).td(_('Delta')).td(bcsub($tot,$tot2)),'
class="highlight"');
+ echo tr(td(_('Total
')).td(_('opération')).td(nbm($tot)).td(_('opérations
dépendantes')).td(nbm($tot2)).td(_('Delta')).td(bcsub($tot,$tot2)),'
class="highlight"');
echo tr(td('<hr>',' colspan="6" style="witdh:auto"'));
}
- [Noalyss-commit] [noalyss] 176/219: Change autocomplete and adapt Icard setWidth is false + indicator icon for ICard, (continued)
- [Noalyss-commit] [noalyss] 176/219: Change autocomplete and adapt Icard setWidth is false + indicator icon for ICard, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 202/219: ManageTable.js : change Manage.delete by Manage.remove, because delete is a reserved keyword, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 181/219: Fix ID problem, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 163/219: Code cleaning, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 213/219: Code rewrite : move the function HtmlInput::select_ledger into Acc_Ledger_Search::select_ledger, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 197/219: Task #001381 : enlève , ajout de la nouvelle liste dans la liste, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 183/219: Icon move / fix, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 211/219: Bug : in recherche the ledger choice is transparent, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 162/219: Constant add an exception code for duplicate, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 190/219: Database : get_value throw an error if SQL failed, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 30/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation 1. Correct export CSV 2. Improve code : new function Acc_Reconciliation:get_amount_noautovat,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 133/219: #0001414: LETTRAGE - montants différents non indiqués Les montants différents pour un lettrage sont marqués avec un triangle orange Changement des requêtes SQL , peut avoir un prob. de performance pour gros volume, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 70/219: Task #0001475: VEN / ACH opération prédéfinie , il manque le bouton "Fermer", Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 131/219: Bug : correct catch clause , getMessage is wrong must be replaced by message, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 203/219: Task #0001507: Click sur détail opérations apparaît trop haut Fixed for IE8 : use documentElement.scrollTop, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 191/219: Database : improve message when exec_sql failed, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 185/219: Fix problem with invalid unicode sequence, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 178/219: NEW : add iselect , display a list with options, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 200/219: Task #0001507: Click sur détail opérations apparaît trop haut Use the function window.pageYOffset instead of window.scrollY, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 123/219: Anc ODS : check date is valid and comment not empty, remove debug, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 52/219: task #0001372: Backup - nom du fichier Bug modele.inc.php, Dany De Bontridder, 2017/12/18