diff --git a/include/balance.php b/include/balance.php
index dfef9c883..48ca444ce 100644
--- a/include/balance.php
+++ b/include/balance.php
@@ -72,14 +72,14 @@ $w->table=1;
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->label="Depuis";
if ( isset ($_POST['from_periode']) )
$w->selected=$_POST['from_periode'];
echo $w->IOValue('from_periode',$periode_start);
$w->label=" jusqu'à ";
-$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
if ( isset ($_POST['to_periode']) )
$w->selected=$_POST['to_periode'];
diff --git a/include/bank.inc.php b/include/bank.inc.php
index e54ea796d..3b55a1007 100644
--- a/include/bank.inc.php
+++ b/include/bank.inc.php
@@ -87,12 +87,17 @@ echo ShowMenuJrnUser($_SESSION['g_dossier'],'FIN',0,'
';
+
echo "";
+ // Filter the saldo
+ // on the current year
+ $filter_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$User->getExercice()."')";
+
// for each account
for ( $i = 0; $i < pg_NumRows($ResAccount);$i++) {
// get the saldo
$l=pg_fetch_array($ResAccount,$i);
- $m=GetSolde($cn,$l['pcm_val']);
+ $m=GetSolde($cn,$l['pcm_val'],$filter_year);
// print the result if the saldo is not equal to 0
if ( $m != 0.0 ) {
echo "";
@@ -144,24 +149,26 @@ if ( $sub_action == "list")
$w=new widget("select");
+ // filter on the current year
+ $filter_year=" where p_exercice='".$User->getExercice()."'";
- $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id",1);
+ $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end",1);
// User is already set User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
echo 'Période '.$w->IOValue("p_periode",$periode_start);
- $qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
- echo JS_SEARCH_CARD;
- $w=new widget('js_search_only');
- $w->name='qcode';
- $w->value=$qcode;
- $w->label='';
- $w->extra='4';
- $sp= new widget("span");
- echo $sp->IOValue("qcode_label",$qcode)." ";
- echo $w->IOValue();
-echo $w->Submit('gl_submit','Rechercher');
+ $qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
+ echo JS_SEARCH_CARD;
+ $w=new widget('js_search_only');
+ $w->name='qcode';
+ $w->value=$qcode;
+ $w->label='';
+ $w->extra='4';
+ $sp= new widget("span");
+ echo $sp->IOValue("qcode_label",$qcode)."";
+ echo $w->IOValue();
+ echo $w->Submit('gl_submit','Rechercher');
echo '';
echo $retour;
// Show list of sell
@@ -191,7 +198,7 @@ echo $w->Submit('gl_submit','Rechercher');
$l=" and jr_grpt_id in (select j_grpt from jrnx where j_qcode='$qcode') ";
}
- list($max_line,$list)=ListJrn($cn,0,"where jrn_def_type='FIN' and jr_tech_per=$current $l "
+ list($max_line,$list)=ListJrn($cn,0,"where jrn_def_type='FIN' $filter_per $l "
,null,$offset,0);
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
diff --git a/include/constant.php b/include/constant.php
index 8ddbd67c4..dad60a322 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -26,7 +26,7 @@
define ("phpcompta_password","dany");
define ("domaine","");
-define ("DEBUG","false");
+define ("DEBUG","true");
// securite correspond a la table
// action
diff --git a/include/depense.inc.php b/include/depense.inc.php
index 07af90570..73eb8daf7 100644
--- a/include/depense.inc.php
+++ b/include/depense.inc.php
@@ -114,7 +114,7 @@ if ( $sub_action == "list")
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
- $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id",1);
+ $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end",1);
// User is already set User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
diff --git a/include/facture.inc.php b/include/facture.inc.php
index 395d906d9..fe22f803b 100644
--- a/include/facture.inc.php
+++ b/include/facture.inc.php
@@ -117,7 +117,7 @@ if ( $sub_action == "list")
$filter_year=" where p_exercice='".$User->getExercice()."'";
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') ".
- " from parm_periode $filter_year order by p_id",1);
+ " from parm_periode $filter_year order by p_start,p_end",1);
// User is already set User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
diff --git a/include/impress_bilan.php b/include/impress_bilan.php
index a877630ef..a79c3cc68 100644
--- a/include/impress_bilan.php
+++ b/include/impress_bilan.php
@@ -46,11 +46,11 @@ print '';
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->label="Depuis";
print $w->IOValue('from_periode',$periode_start);
$w->label=" jusqu'à ";
-$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
print $w->IOValue('to_periode',$periode_end);
print " ";
echo ' ';
diff --git a/include/impress_fiche.php b/include/impress_fiche.php
index 804ce8b0e..06072442e 100644
--- a/include/impress_fiche.php
+++ b/include/impress_fiche.php
@@ -61,11 +61,11 @@ if ( isset ($_REQUEST['fd_id'])) {
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
- $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+ $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->selected=(isset($_POST['from_periode']))?$_POST['from_periode']:"";
print "Depuis ".$w->IOValue('from_periode',$periode_start);
- $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+ $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->selected=(isset($_POST['to_periode']))?$_POST['to_periode']:"";
print " Jusque ".$w->IOValue('to_periode',$periode_end);
diff --git a/include/impress_jrn.php b/include/impress_jrn.php
index af156e557..e38e30988 100644
--- a/include/impress_jrn.php
+++ b/include/impress_jrn.php
@@ -208,11 +208,11 @@ print ' | ';
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->label="Depuis";
print $w->IOValue('from_periode',$periode_start);
$w->label=" jusqu'à ";
-$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
print $w->IOValue('to_periode',$periode_end);
print "
";
$centralise=new widget("checkbox");
diff --git a/include/impress_poste.php b/include/impress_poste.php
index ffe942f3e..e1674ce6b 100644
--- a/include/impress_poste.php
+++ b/include/impress_poste.php
@@ -166,11 +166,11 @@ print '
';
$select=new widget("select");
$select->table=1;
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$select->label="Depuis";
print $select->IOValue('from_periode',$periode_start);
$select->label=" jusqu'à ";
-$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
print $select->IOValue('to_periode',$periode_end);
print "
";
print "| ";
diff --git a/include/impress_rapport.php b/include/impress_rapport.php
index be1552c04..224d8d3ed 100644
--- a/include/impress_rapport.php
+++ b/include/impress_rapport.php
@@ -141,11 +141,11 @@ print ' |
';
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$w->label="Depuis";
print $w->IOValue('from_periode',$periode_start);
$w->label=" jusqu'à ";
-$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
print $w->IOValue('to_periode',$periode_end);
print "
";
$aStep=array(
diff --git a/include/poste.php b/include/poste.php
index 50d40cbe7..dbb2334bf 100644
--- a/include/poste.php
+++ b/include/poste.php
@@ -119,6 +119,7 @@ function GetSolde($p_cn,$p_account,$p_cond="") {
from jrnx join tmp_pcmn on j_poste=pcm_val
where
j_poste=$p_account
+ $p_cond
) as m group by j_poste ");
$Max=pg_NumRows($Res);
if ($Max==0) return 0;
diff --git a/include/user_action_ach.php b/include/user_action_ach.php
index 612605fd6..28d3a17d3 100644
--- a/include/user_action_ach.php
+++ b/include/user_action_ach.php
@@ -163,7 +163,7 @@ $w->name="p_periode";
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
diff --git a/include/user_action_fin.php b/include/user_action_fin.php
index eef879dba..375d691b2 100644
--- a/include/user_action_fin.php
+++ b/include/user_action_fin.php
@@ -180,7 +180,7 @@ $w=new widget("select");
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
diff --git a/include/user_action_gl.php b/include/user_action_gl.php
index d35a23c99..1a9041188 100644
--- a/include/user_action_gl.php
+++ b/include/user_action_gl.php
@@ -49,9 +49,10 @@ $hid->value="voir_jrn";
echo $hid->IOValue();
$w=new widget("select");
+// filter on the current year
+$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
-$User=new cl_user($cn);
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
echo 'Période '.$w->IOValue("p_periode",$periode_start).$w->Submit('gl_submit','Valider');
diff --git a/include/user_action_ods.php b/include/user_action_ods.php
index bb93aa4f7..f8b2da64a 100644
--- a/include/user_action_ods.php
+++ b/include/user_action_ods.php
@@ -175,7 +175,7 @@ $w=new widget("select");
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
$User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;
diff --git a/include/user_action_ven.php b/include/user_action_ven.php
index d777a6e46..4347d8b6d 100644
--- a/include/user_action_ven.php
+++ b/include/user_action_ven.php
@@ -169,7 +169,7 @@ $w=new widget("select");
// filter on the current year
$filter_year=" where p_exercice='".$User->getExercice()."'";
-$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
+$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end");
// User is already set User=new cl_user($cn);
$current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
$w->selected=$current;