[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 05/27: Possibilité d'utiliser la comptabilit
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 05/27: Possibilité d'utiliser la comptabilité analytique en mode linéaire (non croisée) Task #1020 - Comptabilité analytique : utilisation non croisée des plans |
Date: |
Thu, 02 Oct 2014 14:23:08 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 54c7ec9ea02bfb789aca139e6bd7d9fd860582c7
Author: Dany De Bontridder <address@hidden>
Date: Sun Sep 14 23:46:15 2014 +0200
Possibilité d'utiliser la comptabilité analytique en mode linéaire (non
croisée)
Task #1020 - Comptabilité analytique : utilisation non croisée des plans
---
include/class_anc_operation.php | 98 +++++++++++++++++++++++++++++++-------
1 files changed, 80 insertions(+), 18 deletions(-)
diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php
index 44bfda2..1d0cadf 100644
--- a/include/class_anc_operation.php
+++ b/include/class_anc_operation.php
@@ -315,35 +315,97 @@ class Anc_Operation
*/
function get_by_jid($p_jid)
{
- $sql="select distinct oa_id,
- po_id,
- oa_amount,
- oa_description,
- oa_debit,
- j_id,
- oa_group,
- oa_date,
- pa_id,
- oa_row,
- oa_positive
- from operation_analytique join poste_analytique using (po_id)
- where
- j_id=$p_jid order by j_id,oa_row,pa_id";
- $ret=$this->db->exec_sql($sql);
- $res=Database::fetch_all($ret);
- if ( $res== false) return null;
+ $array=array();
+ $a_plan=$this->db->get_array('select pa_id from plan_analytique order
by pa_id');
+ $res=array();
+ /*
+ * For one oa_row
+ */
+ $a_rowcount=$this->db->get_array("select distinct oa_row "
+ ." from operation_analytique where j_id=$1 order by oa_row",
array($p_jid));
+
+ for ($i=0; $i<count($a_rowcount); $i++)
+ {
+ /*
+ * Get one row as template for filling the missing
+ */
+ $a_existing=$this->db->get_array('
+ select distinct oa_id,
+ po_id,
+ oa_amount,
+ oa_description,
+ oa_debit,
+ j_id,
+ oa_group,
+ oa_date,
+ pa_id,
+ oa_row,
+ oa_positive
+ from operation_analytique join poste_analytique using
(po_id)
+ where
+ j_id=$1 and oa_row = $2
+ order by j_id,oa_row',
+ array($p_jid, $a_rowcount[$i]['oa_row']));
+
+ // the first row we found will be the template
+ $template=$a_existing[0];
+ /*
+ * For each plan
+ */
+ for ($j=0; $j<count($a_plan); $j++)
+ {
+ /*
+ * Fetch the row with this pa_id, oa_row, max : 1 row
+ */
+ $a_fetch=$this->db->get_array('
+ select distinct oa_id,
+ po_id,
+ oa_amount,
+ oa_description,
+ oa_debit,
+ j_id,
+ oa_group,
+ oa_date,
+ pa_id,
+ oa_row,
+ oa_positive
+ from operation_analytique join poste_analytique using
(po_id)
+ where
+ j_id=$1 and oa_row = $2 and pa_id=$3', array($p_jid,
+ $a_rowcount[$i]['oa_row'],
+ $a_plan[$j]['pa_id']
+ )
+ );
+ if (count($a_fetch)==0)
+ {
+ $a_fetch=$template;
+ $a_fetch['pa_id']=$a_plan[$j]['pa_id'];
+ $a_fetch['po_id']=-1;
+ $a_fetch['oa_id']='';
+ $res[]=$a_fetch;
+ }
+ else
+ if (count($a_fetch)==1)
+ {
+ $res[]=$a_fetch[0];
+ }
+ }
+ }
foreach ($res as $row)
{
$a=new Anc_Operation($this->db);
- foreach ( $row as $attr=>$value )
+ foreach ($row as $attr=> $value)
{
$a->$attr=$row[$attr];
}
$array[]=clone $a;
}
+
+
return $array;
}
+
/*!\brief modify an op from modify_op.php
*
*/
- [Noalyss-commit] [noalyss] branch master updated (59e76cb -> 5864835), Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 04/27: Documentation, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 05/27: Possibilité d'utiliser la comptabilité analytique en mode linéaire (non croisée) Task #1020 - Comptabilité analytique : utilisation non croisée des plans,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 10/27: Distribution key ; bug cosmetique, rappel des valeurs incorrectes, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 07/27: Javascript script : posY, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 08/27: Add new keys, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 12/27: Add documentation add_row_key Task #1021 - Comptabilité analytique : clef de répartition : bouton ajout, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 06/27: Possibilité d'utiliser la comptabilité analytique en mode linéaire (non croisée) Task #1020 - Comptabilité analytique : utilisation non croisée des plans, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 11/27: Distribution key ; bouton ajout ligne Task #1021 - Comptabilité analytique : clef de répartition : bouton ajout, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 02/27: Ajout des clef de répartition pour la comptabilité analytique, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 09/27: Distribution key : add button new, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 17/27: remove debug info, Dany De Bontridder, 2014/10/02
- [Noalyss-commit] [noalyss] 03/27: Database::make_array ajoute un paramètre dans le cas où le SQL admet une condition, Dany De Bontridder, 2014/10/02