[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 40/151: Improve Performance Acc_Bilan::warnin
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 40/151: Improve Performance Acc_Bilan::warning |
Date: |
Sat, 4 Feb 2017 17:14:26 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9208db32d3eda4b303ef99690db108a0cf0b8aa8
Author: Dany De Bontridder <address@hidden>
Date: Sun Dec 4 01:27:39 2016 +0100
Improve Performance Acc_Bilan::warning
---
include/class/class_acc_bilan.php | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/include/class/class_acc_bilan.php
b/include/class/class_acc_bilan.php
index 65e070b..86a41bf 100644
--- a/include/class/class_acc_bilan.php
+++ b/include/class/class_acc_bilan.php
@@ -94,11 +94,24 @@ class Acc_Bilan
*/
private function warning($p_message,$p_type,$p_deb)
{
- $sql="select distinct pcm_val,pcm_lib
- from tmp_pcmn where exists (select pcm_val from jrnx where
pcm_val=j_poste and
-
".sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per')."
- ) and pcm_type='$p_type'";
-
+ $sql="select
+ pcm_val,
+ pcm_lib,
+ sum(amount_deb) as amount_debit,
+ sum(amount_cred) as amount_credit
+ from
+ tmp_pcmn
+ join (select
+ j_poste,
+ case when j_debit='t' then j_montant else 0 end as
amount_deb,
+ case when j_debit='f' then j_montant else 0 end as
amount_cred
+ from jrnx
+ where
".sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per') ."
+
+ ) as m on (j_poste=pcm_val)
+ where
+ pcm_type = '$p_type'
+ group by pcm_val,pcm_lib";
$res=$this->db->exec_sql($sql);
if ( Database::num_row($res) ==0 )
return;
@@ -114,9 +127,7 @@ class Acc_Bilan
$line=Database::fetch_array($res,$i);
/* set the periode filter */
$obj->id=$line['pcm_val'];
-
- $solde=$obj->get_solde_detail($sql);
- $solde_signed=bcsub($solde['debit'],$solde['credit']);
+ $solde_signed=bcsub($line['amount_debit'],$line['amount_credit']);
if (
($solde_signed < 0 && $p_deb == 'D' ) ||
@@ -124,8 +135,8 @@ class Acc_Bilan
)
{
$ret.= '<li>
'.HtmlInput::history_account($line['pcm_val'],'Anomalie pour le compte
'.$line['pcm_val'].' '.h($line['pcm_lib']).
- " D: ".$solde['debit'].
- " C: ".$solde['credit']." diff ".$solde['solde']);
+ " D: ".$line['amount_debit'].
+ " C: ".$line['amount_credit']." diff
".(abs($solde_signed)));
$count++;
}
- [Noalyss-commit] [noalyss] 42/151: Export PDF : check files properly, (continued)
- [Noalyss-commit] [noalyss] 42/151: Export PDF : check files properly, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 41/151: Fix config.inc.php : add carriage return, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 38/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 32/151: Performance : improve VERIF, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 27/151: Scenario test pour PDF_Operation Task #9 - PDF_Operation : ajout des options, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 46/151: update of the config.inc.example file, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 36/151: Performance : improve VERIF , Improve Accounting check, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 39/151: Improve Acc_Bilan::warning, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 37/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 43/151: Fix problem of accentuated char, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 40/151: Improve Performance Acc_Bilan::warning,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 34/151: Performance : improve VERIF , Affiche uniquement journaux incorrects, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 35/151: Performance : improve VERIF , Totaux Actif/Passif, Charge/Produit, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 51/151: Improve Doc, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 44/151: Problème htmlentities : charset par défaut différent entre version, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 50/151: Deprecated HtmlInput::make_object must be replace by json_encode, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 48/151: Improve Sorttable, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 54/151: Merge branch 'br_6916', Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 53/151: Improve DOC for Scenario, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 56/151: IText add htmlentities to protect, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 22/151: Export en PDF d'operation, Dany De Bontridder, 2017/02/04