[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 91/151: Improve Performance Acc_Bilan::warnin
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 91/151: Improve Performance Acc_Bilan::warning |
Date: |
Sat, 4 Feb 2017 17:14:30 +0000 (UTC) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 8f0ea5fab5ede3f6109c54d1392a0434258fb3f6
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] 102/151: Improve DOC for Scenario, (continued)
- [Noalyss-commit] [noalyss] 102/151: Improve DOC for Scenario, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 108/151: Noalyss_SQL add function get_pk_value for getting the value of the PK, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 75/151: Scenario pour dév. de comptabilité analytique, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 70/151: sécurité Task #8 - Sécurité protection SQL, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 64/151: Clean code, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 79/151: PDF Operation ajout détail opération pour GrandLivre ANC , export des pièces avec tampon, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 81/151: syntax, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 88/151: remove debug info, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 93/151: Export PDF : check files properly, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 95/151: Problème htmlentities : charset par défaut différent entre version, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 91/151: Improve Performance Acc_Bilan::warning,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 104/151: Improve Noalyss_SQL : add set and get, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 107/151: Add Receipt number to detail operation, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 118/151: correct typo, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 124/151: Test ManageTable ; fix parseXML function, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 129/151: #1380 : Duplication d'opérations, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 138/151: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 134/151: Fix Bug : Predefined operation in Sales , impossible to add new items, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 139/151: ManageTable correct color of HighLigthed row, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 140/151: ManageTable use icon, Dany De Bontridder, 2017/02/04
- [Noalyss-commit] [noalyss] 136/151: Esthetic for duplicate operation & Correct esthetic, Dany De Bontridder, 2017/02/04