Stan patches + fix problem with one day period
This commit is contained in:
parent
f11ceb5a18
commit
43b733503e
5 changed files with 28 additions and 13 deletions
|
|
@ -51,14 +51,20 @@ class Balance {
|
|||
* - $a['solde_cred']
|
||||
*/
|
||||
function GetRow($p_from_periode,$p_to_periode) {
|
||||
// compute periode
|
||||
if ( $p_from_periode==$p_to_periode ) {
|
||||
$per_sql=" j_tech_per = $p_from_periode ";
|
||||
} else {
|
||||
$per_sql = "j_tech_per >= $p_from_periode and j_tech_per <= $p_to_periode ";
|
||||
}
|
||||
|
||||
if ( $p_from_periode == $p_to_periode )
|
||||
{
|
||||
$per_sql=" jr_tech_per = $p_from_periode ";
|
||||
}
|
||||
else
|
||||
{
|
||||
// $per_sql = "p_start >= (select p_start from parm_periode where p_id = $p_from_periode) ".
|
||||
// "and p_end <= (select p_end from parm_periode where p_id = $p_to_periode)";
|
||||
$periode = "jr_tech_per in (select p_id from parm_periode ".
|
||||
" where p_start >= $p_from_periode and p_end <= $p_to_periode) ";
|
||||
|
||||
}
|
||||
|
||||
// if centralized
|
||||
$cent="";
|
||||
|
||||
|
|
@ -69,7 +75,8 @@ class Balance {
|
|||
( select j_poste,
|
||||
case when j_debit='t' then j_montant else 0 end as deb,
|
||||
case when j_debit='f' then j_montant else 0 end as cred
|
||||
from jrnx join tmp_pcmn on j_poste=pcm_val
|
||||
from jrnx join tmp_pcmn on j_poste=pcm_val
|
||||
left join parm_periode on j_tech_per = p_id
|
||||
where
|
||||
$cent
|
||||
$per_sql ) as m group by j_poste order by j_poste::text";
|
||||
|
|
|
|||
|
|
@ -69,7 +69,9 @@ class jrn {
|
|||
if ( $p_from == $p_to )
|
||||
$periode=" jr_tech_per = $p_from ";
|
||||
else
|
||||
$periode = "(jr_tech_per >= $p_from and jr_tech_per <= $p_to) ";
|
||||
$periode = "jr_tech_per in (select p_id from parm_periode where p_start >= $p_from and p_end <= $p_to) ";
|
||||
// $periode = "(jr_tech_per >= $p_from and jr_tech_per <= $p_to) ";
|
||||
|
||||
$cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
|
||||
|
||||
// Grand livre == 0
|
||||
|
|
|
|||
|
|
@ -50,7 +50,10 @@ class poste {
|
|||
if ( $p_from == $p_to )
|
||||
$periode=" jr_tech_per = $p_from ";
|
||||
else
|
||||
$periode = "(jr_tech_per >= $p_from and jr_tech_per <= $p_to) ";
|
||||
$periode = "jr_tech_per in (select p_id from parm_periode ".
|
||||
" where p_start >= $p_from and p_end <= $p_to) ";
|
||||
|
||||
// $periode = "(jr_tech_per >= $p_from and jr_tech_per <= $p_to) ";
|
||||
|
||||
$Res=ExecSql($this->db,"select to_char(j_date,'DD.MM.YYYY') as j_date,".
|
||||
"case when j_debit='t' then j_montant else 0 end as deb_montant,".
|
||||
|
|
|
|||
|
|
@ -282,8 +282,6 @@ function TransferCSV($p_cn, $periode){
|
|||
//remove annoying double-quote
|
||||
$num_compte=str_replace('"','',$num_compte);
|
||||
$code=str_replace('\"','',$code);
|
||||
if ( strlen(trim($num_compte)) == 0 )
|
||||
$num_compte=$val['detail'];
|
||||
|
||||
$r=InsertJrn($p_cn,$date_exec,NULL,$jrn,$detail.$num_compte." ".$code,$montant,$seq,$periode);
|
||||
if ( $r == false ) { Rollback($p_cn); exit(" Error 'import_inc.php' __LINE__");}
|
||||
|
|
|
|||
|
|
@ -736,7 +736,9 @@ function ParseFormula($p_cn,$p_label,$p_formula,$p_start,$p_end,$p_eval=true) {
|
|||
if ( $p_start == $p_end )
|
||||
$cond=" j_tech_per = $p_start ";
|
||||
else
|
||||
$cond = "(j_tech_per >= $p_start and j_tech_per <= $p_end) ";
|
||||
$cond = "jr_tech_per in (select p_id from parm_periode ".
|
||||
" where p_start >= $p_start and p_end <= $p_end) ";
|
||||
// $cond = "(j_tech_per >= $p_start and j_tech_per <= $p_end) ";
|
||||
|
||||
while (ereg("(\[[0-9]*%*\])",$p_formula,$e) == true) {
|
||||
include_once("class_poste.php");
|
||||
|
|
@ -771,7 +773,10 @@ function ParseFormula($p_cn,$p_label,$p_formula,$p_start,$p_end,$p_eval=true) {
|
|||
if ( $from == $p_end )
|
||||
$cond=" j_tech_per = $from ";
|
||||
else
|
||||
$cond = "(j_tech_per >= $from and j_tech_per <= $p_end) ";
|
||||
|
||||
$cond = "jr_tech_per in (select p_id from parm_periode ".
|
||||
" where p_start >= $from and p_end <= $p_to) ";
|
||||
|
||||
}
|
||||
// We remove FROM out of the p_formula
|
||||
$p_formula=substr_replace($p_formula,"",strpos($p_formula,"FROM"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue