From ac086129ceaf6f3ff790c6fedf1e4e07ca4337a0 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 20 Jan 2012 18:23:20 +0000 Subject: [PATCH] Bug anc : order date + filter date --- include/class_anc_grandlivre.php | 25 ++++++++++++++++++++----- include/class_anc_operation.php | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/class_anc_grandlivre.php b/include/class_anc_grandlivre.php index 527cc09f5..793278040 100644 --- a/include/class_anc_grandlivre.php +++ b/include/class_anc_grandlivre.php @@ -28,6 +28,22 @@ require_once 'class_impress.php'; class Anc_GrandLivre extends Anc_Print { + function set_sql_filter() + { + $sql=""; + $and=" and "; + if ( $this->from != "" ) + { + $sql.="$and oa_date >= to_date('".$this->from."','DD.MM.YYYY')"; + } + if ( $this->to != "" ) + { + $sql.=" $and oa_date <= to_date('".$this->to."','DD.MM.YYYY')"; + } + + return $sql; + + } /*! * \brief load the data from the database * @@ -62,9 +78,8 @@ class Anc_GrandLivre extends Anc_Print from operation_analytique as B join poste_analytique using(po_id) left join jrnx using (j_id) left join jrn on (j_grpt=jr_grpt_id) - where $pa_id_cond oa_amount <> 0.0 $cond_poste - order by po_name,oa_date ,qcode,j_poste"); - + where $pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date + order by po_name,to_date(oa_date,'DD.MM.YYYY') ,qcode,j_poste"); return $array; } @@ -92,8 +107,8 @@ class Anc_GrandLivre extends Anc_Print from operation_analytique as B join poste_analytique using(po_id) left join jrnx using (j_id) left join jrn on (j_grpt=jr_grpt_id) - where $pa_id_cond oa_amount <> 0.0 $cond_poste - order by po_name,oa_date ,qcode,j_poste"); + where $pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date + order by po_name,to_date(oa_date,'DD.MM.YYYY') ,qcode,j_poste"); return $array; diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php index d9bfae3d6..1c5046dc1 100644 --- a/include/class_anc_operation.php +++ b/include/class_anc_operation.php @@ -154,7 +154,7 @@ class Anc_Operation left join jrnx using (j_id) left join jrn on (j_grpt=jr_grpt_id) where $pa_id_cond oa_amount <> 0.0 $cond $cond_poste - order by oa_date ,oa_group,oa_debit desc,oa_id"; + order by jr_date,oa_group,oa_debit desc,oa_id"; $RetSql=$this->db->exec_sql($sql);