diff --git a/include/class_periode.php b/include/class_periode.php index 4e7f030eb..615dcbe9d 100644 --- a/include/class_periode.php +++ b/include/class_periode.php @@ -116,6 +116,38 @@ class Periode return 1; return 0; } + function reopen() + { + if ( $this->jrn_def_id == 0 ) + { + $this->cn->exec_sql("update parm_periode set p_closed='f',p_central='f' where p_id=$1", + array($_GET['p_per'])); + + $this->cn->exec_sql("update jrn_periode set status='OP' ". + " where p_id = ".$this->p_id); + + return; + } + else + { + $this->cn->exec_sql("update jrn_periode set status='OP' ". + " where jrn_def_id=".$this->jrn_def_id." and ". + " p_id = ".$this->p_id); + /* if all ledgers have this periode open then synchro with + the table parm_periode + */ + $nJrn=$this->cn->count_sql( "select * from jrn_periode where ". + " p_id=".$this->p_id); + $nJrnPeriode=$this->cn->count_sql( "select * from jrn_periode where ". + " p_id=".$this->p_id." and status='OP'"); + + if ( $nJrnPeriode==$nJrn) + $this->cn->exec_sql("update parm_periode set p_closed=false where p_id=".$this->p_id); + return; + } + + } + function close() { if ( $this->jrn_def_id == 0 ) @@ -188,7 +220,13 @@ class Periode for ($i=0;$i<$Max;$i++) { $l_line=Database::fetch_array($Res,$i); - echo '