Add new print system and CSV for journaux
This commit is contained in:
parent
0a6e9a074a
commit
326cba1c14
14 changed files with 1128 additions and 2148 deletions
2153
doc/function.txt
2153
doc/function.txt
File diff suppressed because it is too large
Load diff
81
html/jrn_csv.php
Normal file
81
html/jrn_csv.php
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
header('Content-type: application/csv');
|
||||
|
||||
include_once ("ac_common.php");
|
||||
|
||||
include_once ("postgres.php");
|
||||
|
||||
include("class_jrn.php");
|
||||
$l_Db=sprintf("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
|
||||
|
||||
include ('class_user.php');
|
||||
$User=new cl_user($cn);
|
||||
$User->Check();
|
||||
if ( $g_UserProperty['use_admin'] == 0 ) {
|
||||
if (CheckAction($g_dossier,$g_user,IMP) == 0 ){
|
||||
/* Cannot Access */
|
||||
NoAccess();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$p_cent=( isset ( $_POST['cent']) )?'on':'off';
|
||||
|
||||
$Jrn=new jrn($cn,$_POST['jrn_id']);
|
||||
$Jrn->GetName();
|
||||
$Jrn->GetRow( $_POST['from_periode'],
|
||||
$_POST['to_periode'],
|
||||
$p_cent);
|
||||
|
||||
|
||||
foreach ( $Jrn->row as $op ) {
|
||||
$rep="";
|
||||
|
||||
if ( $op['j_id'] != $rep) {
|
||||
$rep= $op['j_id'];
|
||||
// should clean description : remove <b><i> tag and '; char
|
||||
// should clean poste : remove <b><i> tag and '; char
|
||||
|
||||
echo
|
||||
"'".$op['internal']."';".
|
||||
"'".$op['j_date']."';".
|
||||
"'".$op['poste']."';".
|
||||
"'".$op['description']."';".
|
||||
"'".$op['cred_montant']."';".
|
||||
"'".$op['deb_montant']."\n";
|
||||
|
||||
} else {
|
||||
echo
|
||||
"'".$op['internal']."';".
|
||||
"'".$op['j_date']."';".
|
||||
"'".$op['poste']."';".
|
||||
"'".$op['description']."';".
|
||||
"'".$op['cred_montant']."';".
|
||||
"'".$op['deb_montant']."\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
exit;
|
||||
?>
|
||||
153
html/jrn_pdf.php
Normal file
153
html/jrn_pdf.php
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
// $Revision$
|
||||
|
||||
if ( ! isset($g_dossier) ) {
|
||||
echo "INVALID G_DOSSIER UNKNOWN !!! ";
|
||||
exit();
|
||||
}
|
||||
|
||||
include_once("jrn.php");
|
||||
include_once("ac_common.php");
|
||||
include_once("postgres.php");
|
||||
include_once("class.ezpdf.php");
|
||||
include_once("impress_inc.php");
|
||||
include_once("preference.php");
|
||||
include_once("class_jrn.php");
|
||||
echo_debug(__FILE__,__LINE__,"imp pdf journaux");
|
||||
$l_Db=sprintf("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
$l_type="JRN";
|
||||
$centr=" Non centralisé";
|
||||
$l_centr=0;
|
||||
if ($_POST['central'] == 'on' ) {
|
||||
$centr=" centralisé ";
|
||||
$l_centr=1;
|
||||
}
|
||||
$Jrn=new jrn($cn,$_POST['jrn_id']);
|
||||
|
||||
$Jrn->GetName();
|
||||
$ret="";
|
||||
$pdf=& new Cezpdf("A4");
|
||||
$pdf->selectFont('./addon/fonts/Helvetica.afm');
|
||||
|
||||
// filter : 0 for Grand Livre otherwise 1
|
||||
$filter=( $Jrn->id == 0)?0:1;
|
||||
|
||||
$offset=0;$limit=25;$step=25;
|
||||
$rap_deb=0;$rap_cred=0;
|
||||
while (1) {
|
||||
$a=0;
|
||||
list ($a_jrn,$tot_deb,$tot_cred)=$Jrn->GetRow($_POST['from_periode'],
|
||||
$_POST['to_periode'],
|
||||
$_POST['central'],
|
||||
$limit,$offset);
|
||||
echo_debug(__FILE__,__LINE__,"Total debit $tot_deb,credit $tot_cred");
|
||||
|
||||
if ( $a_jrn==null) break;
|
||||
$offset+=$step;
|
||||
// foreach ($a_jrn as $key=>$element) {
|
||||
// echo_debug(__FILE__,__LINE__,"$key => $element");
|
||||
// foreach ($element as $c1=>$c2)
|
||||
// echo_debug(__FILE__,__LINE__,"Array is $c1 => $c2");
|
||||
// }
|
||||
$first_id=$a_jrn[0]['j_id'];
|
||||
$Exercice=GetExercice($cn,$a_jrn[0]['periode']);
|
||||
|
||||
|
||||
list($rap_deb,$rap_cred)=GetRappel($cn,$first_id,$Jrn->id,$Exercice,FIRST,
|
||||
$filter,
|
||||
$l_centr
|
||||
);
|
||||
echo_debug(__FILE__,__LINE__,"MONTANT $rap_deb,$rap_cred");
|
||||
echo_debug(__FILE__,__LINE__," list($rap_deb,$rap_cred)=GetRappel($cn,$first_id,".$Jrn->id.",$Exercice,FIRST)");
|
||||
$pdf->ezText($Jrn->name,30);
|
||||
|
||||
if ( $l_centr == 1 ) {
|
||||
// si centralisé montre les montants de rappel
|
||||
$str_debit=sprintf( "report Débit % 10.2f",$rap_deb);
|
||||
$str_credit=sprintf("report Crédit % 10.2f",$rap_cred);
|
||||
$pdf->ezText($str_debit,12,array('justification'=>'right'));
|
||||
$pdf->ezText($str_credit,12,array('justification'=>'right'));
|
||||
}
|
||||
|
||||
$pdf->ezTable($a_jrn,
|
||||
array ('internal'=>'Opération',
|
||||
'j_date' => 'Date',
|
||||
'poste'=>'Poste',
|
||||
'description' => 'Description',
|
||||
'deb_montant'=> 'Débit',
|
||||
'cred_montant'=>'Crédit')," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('deb_montant'=> array('justification'=>'right'),
|
||||
'cred_montant'=> array('justification'=>'right'))));
|
||||
$a=1;
|
||||
// Total Page
|
||||
$apage=array(array('deb'=>sprintf("%8.2f",$tot_deb),'cred'=>$tot_cred));
|
||||
foreach ($apage as $key=>$element) echo_debug(__FILE__,__LINE__,"apage $key => $element");
|
||||
$pdf->ezTable($apage,
|
||||
array (
|
||||
'deb'=> 'Total Débit',
|
||||
'cred'=>'Total Crédit')," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>200,
|
||||
'xPos'=>'right','xOrientation'=>'left',
|
||||
'cols'=>array('deb'=> array('justification'=>'right'),
|
||||
'cred'=> array('justification'=>'right'))));
|
||||
|
||||
$count=count($a_jrn)-1;
|
||||
$last_id=$a_jrn[$count]['j_id'];
|
||||
$Exercice=GetExercice($cn,$a_jrn[$count]['periode']);
|
||||
if ( $l_centr == 1) {
|
||||
// Montant de rappel si centralisé
|
||||
list($rap_deb,$rap_cred)=GetRappel($cn,$last_id,$Jrn->id,$Exercice,LAST,$filter,$l_centr);
|
||||
$str_debit=sprintf( "à reporter Débit % 10.2f",$rap_deb);
|
||||
$str_credit=sprintf("à reporter Crédit % 10.2f",$rap_cred);
|
||||
$pdf->ezText($str_debit,12,array('justification'=>'right'));
|
||||
$pdf->ezText($str_credit,12,array('justification'=>'right'));
|
||||
}
|
||||
//New page
|
||||
$pdf->ezNewPage();
|
||||
}
|
||||
if ( $a == 1 ) {
|
||||
$apage=array('deb'=>$tot_deb,'cred'=>$tot_cred);
|
||||
$pdf->ezTable($apage,
|
||||
array (
|
||||
'deb'=> 'Total Débit',
|
||||
'cred'=>'Total Crédit')," ",
|
||||
array('shaded'=>0,'showHeadings'=>1,'width'=>500,
|
||||
'cols'=>array('deb'=> array('justification'=>'right'),
|
||||
'cred'=> array('justification'=>'right'))));
|
||||
$count=count($a_jrn)-1;
|
||||
$last_id=$a_jrn[$count]['j_id'];
|
||||
$Exercice=GetExercice($cn,$a_jrn[$count]['periode']);
|
||||
|
||||
list($rap_deb,$rap_cred)=GetRappel($cn,$last_id,$Jrn->id,$Exercice,LAST,$filter,$l_centr);
|
||||
$str_debit=sprintf( "à reporter Débit % 10.2f",$rap_deb);
|
||||
$str_credit=sprintf("à reporter Crédit % 10.2f",$rap_cred);
|
||||
$pdf->ezText($str_debit,12,array('justification'=>'right'));
|
||||
$pdf->ezText($str_credit,12,array('justification'=>'right'));
|
||||
|
||||
}
|
||||
$pdf->ezStream();
|
||||
|
||||
?>
|
||||
|
|
@ -26,7 +26,14 @@ if ( ! isset ( $g_dossier ) ) {
|
|||
}
|
||||
include_once ("postgres.php");
|
||||
/* Admin. Dossier */
|
||||
CheckUser();
|
||||
$l_Db=sprintf("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
|
||||
|
||||
include ('class_user.php');
|
||||
$User=new cl_user($cn);
|
||||
$User->Check();
|
||||
|
||||
include ("check_priv.php");
|
||||
include_once ("top_menu_compta.php");
|
||||
ShowMenuCompta($g_dossier,$g_UserProperty);
|
||||
|
|
@ -38,6 +45,7 @@ echo "<DIV class=\"u_subtmenu\">";
|
|||
|
||||
$p_array=array(array ("user_impress.php?type=jrn","Journaux"),
|
||||
array("user_impress.php?type=poste","Poste"),
|
||||
array("user_impress.php?type=fiche","Fiche"),
|
||||
array("user_impress.php?type=form","Formulaire")
|
||||
);
|
||||
$default=( isset ($_GET['type']))?"user_impress.php?type=".$_GET['type']:"";
|
||||
|
|
@ -56,8 +64,6 @@ if ( $g_UserProperty['use_admin'] == 0 ) {
|
|||
}
|
||||
}
|
||||
|
||||
$l_Db=sprintf("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
// something is choosen
|
||||
$default=( isset ($_GET['type']))?$_GET['type']:"";
|
||||
switch ($default) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ if ( ! isset ( $g_dossier ) ) {
|
|||
include_once ("postgres.php");
|
||||
include_once ("check_priv.php");
|
||||
/* Admin. Dossier */
|
||||
CheckUser();
|
||||
|
||||
|
||||
if ( isset( $_GET['p_jrn'] )) {
|
||||
session_register("g_jrn");
|
||||
$g_jrn=$_GET['p_jrn'];
|
||||
|
|
@ -43,6 +44,9 @@ if ( isset ($_GET['JRN_TYPE'] ) ) {
|
|||
|
||||
$l_Db=sprintf("dossier%d",$g_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
include ('class_user.php');
|
||||
$User=new cl_user($cn);
|
||||
$User->Check();
|
||||
|
||||
ShowMenuCompta($g_dossier,$g_UserProperty);
|
||||
|
||||
|
|
@ -99,13 +103,6 @@ if ( isset ($_GET['JRN_TYPE'] ) ) {
|
|||
|
||||
// if a journal is selected show the journal's menu
|
||||
if ( $g_jrn != -1 ) {
|
||||
// $p_array=array(array("user_jrn.php?JRN_TYPE=VEN" ,"Entrée"),
|
||||
// array("user_jrn.php?JRN_TYPE=ACH","Dépense"),
|
||||
// array("user_jrn.php?JRN_TYPE=FIN","Financier"),
|
||||
// array("user_jrn.php?JRN_TYPE=OD","Op. Diverses"),
|
||||
// array("impress.php","Impression"),
|
||||
// array("","Recherche")
|
||||
// );
|
||||
$result=ShowJrn( "user_jrn.php?JRN_TYPE=".$jrn_type);
|
||||
// Get the jrn_type_id
|
||||
include_once('jrn.php');
|
||||
|
|
|
|||
|
|
@ -318,5 +318,38 @@ function echo_warning($p_string)
|
|||
{
|
||||
echo '<H2 class="info">'.$p_string."</H2>";
|
||||
}
|
||||
/* function make_array($cn,$sql)
|
||||
**************************************************
|
||||
* Purpose : make a array with the sql
|
||||
*
|
||||
* parm :
|
||||
* - $cn dbatabase connection
|
||||
* - $sql related sql
|
||||
* gen :
|
||||
* - none
|
||||
* return: a double array [value,label]
|
||||
*/
|
||||
function make_array($p_cn,$p_sql,$p_null=0) {
|
||||
|
||||
$a=pg_exec($p_cn,$p_sql);
|
||||
$max=pg_NumRows($a);
|
||||
if ( $max==0) return null;
|
||||
for ($i=0;$i<$max;$i++) {
|
||||
$row=pg_fetch_row($a);
|
||||
$r[$i]['value']=$row[0];
|
||||
$r[$i]['label']=$row[1];
|
||||
}
|
||||
// add a blank item ?
|
||||
if ( $p_null == 1 ) {
|
||||
for ($i=$max;$i!=0;$i--) {
|
||||
$r[$i]['value']= $r[$i-1]['value'];
|
||||
$r[$i]['label']= $r[$i-1]['label'];
|
||||
}
|
||||
$r[0]['value']=-1;
|
||||
$r[0]['label']=" ";
|
||||
} // if ( $p_null == 1 )
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
217
include/class_jrn.php
Normal file
217
include/class_jrn.php
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
class jrn {
|
||||
var $id;
|
||||
var $name;
|
||||
var $db;
|
||||
var $row;
|
||||
function jrn ($p_cn,$p_id){
|
||||
$this->id=$p_id;
|
||||
$this->db=$p_cn;
|
||||
$this->row=null;
|
||||
}
|
||||
function GetName() {
|
||||
if ( $this->id==0 ) {
|
||||
$this->name=" Grand Livre ";
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
$Res=ExecSql($this->db,"select jrn_def_name from ".
|
||||
" jrn_def where jrn_def_id=".
|
||||
$this->id);
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0) return null;
|
||||
$ret=pg_fetch_array($Res,0);
|
||||
$this->name=$ret['jrn_def_name'];
|
||||
return $ret['jrn_def_name'];
|
||||
}
|
||||
|
||||
/* function GetDataJrnPdf
|
||||
* Purpose : Get The data for the pdf printing
|
||||
*
|
||||
* parm :
|
||||
* - connection
|
||||
* - array
|
||||
* - p_limit starting line
|
||||
* - p_offset number of lines
|
||||
*
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - Array with the asked data
|
||||
*
|
||||
*/
|
||||
function GetRow($p_from,$p_to,$cent='off',$p_limit=-1,$p_offset=-1) {
|
||||
|
||||
echo_debug(__FILE__,__LINE__,"GetRow");
|
||||
|
||||
if ( $p_from == $p_to )
|
||||
$periode=" jr_tech_per = $p_from ";
|
||||
else
|
||||
$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
|
||||
if ( $this->id != 0 ) {
|
||||
|
||||
if ( $cent='off' ) {
|
||||
// Journaux non centralisés
|
||||
$Res=ExecSql($this->db,"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
|
||||
jr_internal,
|
||||
case j_debit when 't' then j_montant::text else ' ' end as deb_montant,
|
||||
case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,
|
||||
j_debit as debit,j_poste as poste,jr_montant , ".
|
||||
"pcm_lib as description,j_grpt as grp,jr_comment ,
|
||||
jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on ".
|
||||
"jr_grpt_id=j_grpt ".
|
||||
" left join tmp_pcmn on pcm_val=j_poste ".
|
||||
" where j_jrn_def=".$this->id.
|
||||
" and ".$periode." order by j_date::date asc,jr_internal,j_debit desc ".
|
||||
$cond_limite);
|
||||
}else {
|
||||
// Journaux centralisés
|
||||
|
||||
$Sql="select c_id as j_id,
|
||||
c_j_id,
|
||||
to_char (c_date,'DD.MM.YYYY') as j_date ,
|
||||
c_internal as jr_internal,
|
||||
case c_debit when 't' then c_montant::text else ' ' end as deb_montant,
|
||||
case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,
|
||||
c_debit as j_debit,
|
||||
c_poste as poste,
|
||||
pcm_lib as description,
|
||||
jr_comment,
|
||||
jr_montant,
|
||||
c_grp as grp,
|
||||
c_comment as comment,
|
||||
c_rapt as oc,
|
||||
c_periode as periode
|
||||
from centralized left join jrn on ".
|
||||
"jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where ".
|
||||
" c_jrn_def=".$this->id." and ".
|
||||
$periode." order by c_id ";
|
||||
$Res=ExecSql($this->db,$Sql.$cond_limite);
|
||||
|
||||
}
|
||||
} else {
|
||||
// Grand Livre
|
||||
if ( $cent == 'off') {
|
||||
// Non centralisé
|
||||
$Res=ExecSql($this->db,"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
|
||||
jr_internal,
|
||||
case j_debit when 't' then j_montant::text else ' ' end as deb_montant,
|
||||
case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,
|
||||
j_debit as debit,j_poste as poste,".
|
||||
"pcm_lib as description,j_grpt as grp,jr_comment as jr_comment,
|
||||
jr_montant,
|
||||
jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on ".
|
||||
"jr_grpt_id=j_grpt left join tmp_pcmn on pcm_val=j_poste where ".
|
||||
" ".$periode." order by j_date::date,j_grpt,j_debit desc ".
|
||||
$cond_limite);
|
||||
|
||||
} else {
|
||||
// Centralisé
|
||||
$Sql="select c_id as j_id,
|
||||
c_j_id,
|
||||
to_char (c_date,'DD.MM.YYYY') as j_date ,
|
||||
c_internal as jr_internal,
|
||||
case c_debit when 't' then c_montant::text else ' ' end as deb_montant,
|
||||
case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,
|
||||
c_debit as j_debit,
|
||||
c_poste as poste,
|
||||
pcm_lib as description,
|
||||
jr_comment,
|
||||
jr_montant,
|
||||
c_grp as grp,
|
||||
c_comment as comment,
|
||||
c_rapt as oc,
|
||||
c_periode as periode
|
||||
from centralized left join jrn on ".
|
||||
"jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where ".
|
||||
$periode." order by c_id ";
|
||||
$Res=ExecSql($this->db,$Sql.$cond_limite);
|
||||
} // Grand Livre
|
||||
}
|
||||
|
||||
|
||||
$array=array();
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0) return null;
|
||||
$case="";
|
||||
$tot_deb=0;
|
||||
$tot_cred=0;
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$line=pg_fetch_array($Res,$i);
|
||||
$mont_deb=($line['deb_montant']!=0)?sprintf("% 8.2f",$line['deb_montant']):"";
|
||||
$mont_cred=($line['cred_montant']!=0)?sprintf("% 8.2f",$line['cred_montant']):"";
|
||||
$jr_montant=($line['jr_montant']!=0)?sprintf("% 8.2f",$line['jr_montant']):"";
|
||||
$tot_deb+=$line['deb_montant'];
|
||||
$tot_cred+=$line['cred_montant'];
|
||||
echo_debug(__FILE__,__LINE__," GetRow : mont_Deb ".$mont_deb);
|
||||
echo_debug(__FILE__,__LINE__," GetRow : mont_cred ".$mont_cred);
|
||||
|
||||
if ( $case != $line['grp'] ) {
|
||||
$case=$line['grp'];
|
||||
$array[]=array (
|
||||
'j_id'=>$line['j_id'],
|
||||
'j_date' => $line['j_date'],
|
||||
'internal'=>$line['jr_internal'],
|
||||
'deb_montant'=>'',
|
||||
'cred_montant'=>'<b><i>'.$jr_montant.'</i></b>',
|
||||
'description'=>'<b><i>'.$line['jr_comment'].'</i></b>',
|
||||
'poste' => $line['oc'],
|
||||
'periode' =>$line['periode'] );
|
||||
|
||||
$array[]=array (
|
||||
'j_id'=>$line['j_id'],
|
||||
'j_date' => '',
|
||||
'internal'=>'',
|
||||
'deb_montant'=>$mont_deb,
|
||||
'cred_montant'=>$mont_cred,
|
||||
'description'=>$line['description'],
|
||||
'poste' => $line['poste'],
|
||||
'periode' => $line['periode']
|
||||
);
|
||||
|
||||
}else {
|
||||
$array[]=array (
|
||||
'j_id'=>$line['j_id'],
|
||||
'j_date' => '',
|
||||
'internal'=>'',
|
||||
'deb_montant'=>$mont_deb,
|
||||
'cred_montant'=>$mont_cred,
|
||||
'description'=>$line['description'],
|
||||
'poste' => $line['poste'],
|
||||
'periode' => $line['periode']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
echo_debug(__FILE__,__LINE__,"Total debit $tot_deb,credit $tot_cred");
|
||||
$this->row=$array;
|
||||
$a=array($array,$tot_deb,$tot_cred);
|
||||
return $a;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
117
include/class_operation.php
Normal file
117
include/class_operation.php
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// If print is asked
|
||||
// First time in html
|
||||
// after in pdf or cvs
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( isset( $_POST['bt_html'] ) ) {
|
||||
include("jrn.php");
|
||||
$p_cent=( isset ( $_POST['cent']) )?'on':'off';
|
||||
// $POST=from_periode, to_periode, jrn_id, cent
|
||||
echo_debug(__FILE__,__LINE__," jrn sql = $sql");
|
||||
$Jrn=new jrn($cn,$_POST['jrn_id']);
|
||||
$Jrn->GetName();
|
||||
$Jrn->GetRow( $_POST['from_periode'],
|
||||
$_POST['to_periode'],
|
||||
$p_cent);
|
||||
foreach ($Jrn->row as $op) {
|
||||
$a=new operation ($cn,$op);
|
||||
$a->cent=$p_cent;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Show the jrn and date
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
include_once('form_input.php');
|
||||
include_once("postgres.php");
|
||||
include_once("class_widget.php");
|
||||
if ( $User->Admin() ==0) {
|
||||
$ret=make_array($cn,"select jrn_def_id,jrn_def_name
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
|
||||
join user_sec_jrn on uj_jrn_id=jrn_def_id
|
||||
where
|
||||
uj_login='$User->id'
|
||||
and uj_priv !='X'
|
||||
");
|
||||
} else {
|
||||
$ret=make_array("select jrn_def_id,jrn_def_name
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
|
||||
|
||||
}
|
||||
|
||||
// include_once("check_priv.php");
|
||||
// printf ('<TR><TD class="cell"><a class="mtitle"
|
||||
// href="user_impress.php?type=jrn&action=print&p_id=%d">%s</a></TD></TR>',$l_line['jrn_def_id'],$l_line['jrn_def_name']);
|
||||
|
||||
// Count the forbidden journaux
|
||||
$NoPriv=CountSql($cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
|
||||
jrn_deb_max_line,jrn_cred_max_line
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
|
||||
join user_sec_jrn on uj_jrn_id=jrn_def_id
|
||||
where
|
||||
uj_login='$User->id'
|
||||
and uj_priv ='X'
|
||||
");
|
||||
// Pour voir tout les journal ?
|
||||
if ( $NoPriv == 0 ) {
|
||||
$a=count($ret);
|
||||
$all=array('value'=>0,'label'=>'All');
|
||||
$ret[$a]=$all;
|
||||
}
|
||||
if ( count($ret) < 1 )
|
||||
NoAccess();
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Form
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<FORM ACTION="?type=jrn" METHOD="POST">';
|
||||
echo '<TABLE><TR>';
|
||||
$w=new widget("select");
|
||||
$w->table=1;
|
||||
$w->label="Choississez le journal";
|
||||
print $w->IOValue("jrn_id",$ret);
|
||||
print '</TR>';
|
||||
print '<TR>';
|
||||
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
|
||||
$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 order by p_id");
|
||||
print $w->IOValue('to_periode',$periode_end);
|
||||
print "</TR><TR>";
|
||||
$centralise=new widget("checkbox");
|
||||
$centralise->label="Depuis les journaux centralisés";
|
||||
$centralise->table=1;
|
||||
print $centralise->IOValue('cent');
|
||||
|
||||
print "</TR>";
|
||||
echo '</TABLE>';
|
||||
print $w->Submit('bt_html','Impression');
|
||||
|
||||
echo '</FORM>';
|
||||
echo '</div>';
|
||||
?>
|
||||
115
include/class_user.php
Normal file
115
include/class_user.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* Class user
|
||||
**************************************************
|
||||
* Purpose :
|
||||
* Data & function about connected users
|
||||
*/
|
||||
|
||||
class cl_user {
|
||||
var $id;
|
||||
var $pass;
|
||||
var $db;
|
||||
var $admin;
|
||||
var $valid;
|
||||
|
||||
function cl_user ($p_cn){
|
||||
$this->id=$_SESSION['g_user'];
|
||||
$this->pass=$_SESSION['g_pass'];
|
||||
$this->valid=(isset ($_SESSION['isValid']))?1:0;
|
||||
$this->db=$p_cn;
|
||||
}
|
||||
/*++
|
||||
* function : CheckUser
|
||||
* Parameter : none
|
||||
* return : not use
|
||||
* Description :
|
||||
* Check if user is active and exists in the
|
||||
* repository
|
||||
* Automatically redirect
|
||||
*
|
||||
++*/
|
||||
function Check()
|
||||
{
|
||||
|
||||
$res=0;
|
||||
$pass5=md5($this->pass);
|
||||
if ( $this->valid == 1 ) { return; }
|
||||
$cn=DbConnect("account_repository");
|
||||
if ( $cn != false ) {
|
||||
$sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass
|
||||
from ac_users
|
||||
where ac_users.use_login='$this->id'
|
||||
and ac_users.use_active=1
|
||||
and ac_users.use_pass='$pass5'";
|
||||
echo_debug(__FILE__,__LINE__,"Sql = $sql");
|
||||
$ret=pg_exec($cn,$sql);
|
||||
$res=pg_NumRows($ret);
|
||||
echo_debug(__FILE__,__LINE__,"Number of found rows : $res");
|
||||
}
|
||||
|
||||
if ( $res == 0 ) {
|
||||
echo '<META HTTP-EQUIV="REFRESH" content="4;url=index.html">';
|
||||
echo "<BR><BR><BR><BR><BR><BR>";
|
||||
echo "<P ALIGN=center><BLINK>
|
||||
<FONT size=+12 COLOR=RED>
|
||||
Invalid user <BR> or<BR> Invalid password
|
||||
</FONT></BLINK></P></BODY></HTML>";
|
||||
session_unset();
|
||||
|
||||
exit -1;
|
||||
} else {
|
||||
$this->valid=1;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
function getJrn() {
|
||||
}
|
||||
/* function CheckAdmin
|
||||
**************************************************
|
||||
* Purpose : Check if an user is an admin
|
||||
*
|
||||
* parm :
|
||||
* - none
|
||||
* gen :
|
||||
* - none
|
||||
* return: 1 for yes 0 for no
|
||||
*/
|
||||
function Admin() {
|
||||
$res=0;
|
||||
|
||||
if ( $this->id != 'phpcompta') {
|
||||
$pass5=md5($this->pass);
|
||||
$sql="select use_id from ac_users where use_login='$this->id'
|
||||
and use_active=1 and use_admin=1 and use_pass='$pass5'";
|
||||
|
||||
$cn=DbConnect();
|
||||
|
||||
$this->admin=CountSql($cn,$sql);
|
||||
} else $this->admin=1;
|
||||
|
||||
return $this->admin;
|
||||
}
|
||||
}
|
||||
?>
|
||||
206
include/class_widget.php
Normal file
206
include/class_widget.php
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/*+++
|
||||
function widget
|
||||
purpose create the widget
|
||||
parameters p_type the type of the widget
|
||||
p_name name of widget
|
||||
value widget's value
|
||||
readonly true or false
|
||||
+++*/
|
||||
class widget {
|
||||
var $type;
|
||||
var $name;
|
||||
var $value;
|
||||
var $readonly;
|
||||
var $size;
|
||||
var $selected;
|
||||
var $table;
|
||||
var $label;
|
||||
function widget($p_type="") {
|
||||
$this->type=$p_type;
|
||||
$this->readonly=false;
|
||||
$this->size=20;
|
||||
$this->width=50;
|
||||
$this->heigh=20;
|
||||
$this->value="";
|
||||
$this->selected="";
|
||||
$this->table=0;
|
||||
$this->label="";
|
||||
}
|
||||
function SetReadOnly($p_read) {
|
||||
$this->readonly=$p_read;
|
||||
}
|
||||
/*+++
|
||||
function IOValue($p_name,$p_value="",$p_label="") {
|
||||
purpose : create the INPUT tag
|
||||
parameters: $p_name is the INPUT NAME
|
||||
$p_value is the INPUT VALUE or an array for select
|
||||
$p_label is the label of the INPUT
|
||||
return : string containing the tag
|
||||
+++*/
|
||||
function IOValue($p_name,$p_value=null,$p_label="") {
|
||||
// echo __FILE__."p_value $p_value";
|
||||
$this->name=$p_name;
|
||||
$this->value=($p_value===null)?"":$p_value;
|
||||
$this->label=($p_label == "")?$this->label:$p_label;
|
||||
//echo "this->value =".$this->value;
|
||||
// Input text type
|
||||
if (strtoupper($this->type)=="TEXT") {
|
||||
if ( $this->readonly==false) {
|
||||
$r="<INPUT TYPE=\"TEXT\" NAME=\"$p_name\" VALUE=\"$p_value\" SIZE=\"$this->size\">";} else {
|
||||
$r=$this->value;
|
||||
}
|
||||
if ($this->table==1) {
|
||||
if ( $this->label != "") {
|
||||
$r="<TD>".$this->label."</TD><TD>".$r."</TD>";
|
||||
}else {
|
||||
$r="<TD>".$r."</TD>";
|
||||
}
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
// Hidden field
|
||||
if (strtoupper($this->type)=="HIDDEN") {
|
||||
$r='<INPUT TYPE="HIDDEN" name="'.$this->name.'" value="'.$this->value.'">';
|
||||
if ( $this->readonly==true) return "";
|
||||
return $r;
|
||||
}
|
||||
// Select value
|
||||
if ( strtoupper($this->type) == "SELECT") {
|
||||
if ($this->readonly==false ){
|
||||
//echo "<b>Selected <b>".$this->selected;
|
||||
$r="<SELECT NAME=\"$this->name\">";
|
||||
for ( $i=0;$i<sizeof($this->value);$i++) {
|
||||
$checked=($this->selected==$this->value[$i]['value'])?"SELECTED":"";
|
||||
$r.='<OPTION VALUE="'.$this->value[$i]['value'].'" '.$checked.'>';
|
||||
$r.=$this->value[$i]['label'];
|
||||
}
|
||||
$r.="</SELECT>";
|
||||
} else {
|
||||
echo_debug(__FILE__,__LINE__,"this->selected = ".$this->selected);
|
||||
for ( $i=0;$i<sizeof($this->value);$i++) {
|
||||
echo_debug(__FILE__,__LINE__,"check for ".$this->value[$i]['value']);
|
||||
if ($this->selected==$this->value[$i]['value'] ) {
|
||||
$r=$this->value[$i]['label'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $this->table==1) {
|
||||
$r="<TD> $r </TD>";
|
||||
if ( $this->label != "") $r="<TD> $this->label</TD>".$r;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
// Password
|
||||
if (strtoupper($this->type)=="PASSWORD") {
|
||||
if ( $this->readonly==true) return "";
|
||||
$r='<input type="password" name="'.$this->name;
|
||||
$r.='">';
|
||||
if ($this->table==1) {
|
||||
$r="<TD> $this->label </TD><TD> $r </TD>";
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
// Checkbox
|
||||
if (strtoupper($this->type)=="CHECKBOX") {
|
||||
if ( $this->readonly == true) {
|
||||
$check=( $this->selected==true )?"Yes":"no";
|
||||
$r=$check;
|
||||
} else {
|
||||
$check=( $this->selected==true )?"checked":"unchecked";
|
||||
$r='<input type="CHECKBOX" name="'.$this->name.'"';
|
||||
$r.=" $check";
|
||||
$r.='>';
|
||||
}
|
||||
if ($this->table==1) {
|
||||
$r="<TD> $this->label </TD><TD> $r </TD>";
|
||||
} else {
|
||||
$r=$r." $this->label";
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//radio
|
||||
if (strtoupper($this->type)=="RADIO") {
|
||||
if ( $this->readonly == true) {
|
||||
$check=( $this->selected==true || $this->selected=='t' )?"Yes":"no";
|
||||
$r=$check;
|
||||
} else {
|
||||
$check=( $this->selected==true||$this->selected=='t' )?"checked":"unchecked";
|
||||
$r='<input type="RADIO" name="'.$this->name.'"';
|
||||
$r.=" VALUE=\"$this->value\"";
|
||||
$r.=" $check";
|
||||
$r.='>';
|
||||
}
|
||||
if ($this->table==1) {
|
||||
$r="<TD> $this->label </TD><TD> $r </TD>";
|
||||
} else {
|
||||
$r=$this->label.$r;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//textarea
|
||||
if (strtoupper($this->type)=="TEXTAREA") {
|
||||
if ( $this->readonly == false ) {
|
||||
$r='<TEXTAREA name="'.$this->name.'"';
|
||||
$r.=" rows=\"$this->heigh\" ";
|
||||
$r.=" cols=\"$this->width\" ";
|
||||
$r.='>';
|
||||
$r.=$this->value;
|
||||
|
||||
$r.="</TEXTAREA>";
|
||||
} else {
|
||||
$r='<p>';
|
||||
$r.=$this->value;
|
||||
$r.='</p>';
|
||||
}
|
||||
if ($this->table==1) {
|
||||
$r="<TD> $this->label </TD><TD> $r </TD>";
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
//file
|
||||
if (strtoupper($this->type)=="FILE") {
|
||||
if ( $this->readonly == false ) {
|
||||
$r='<INPUT TYPE="file" name="'.$this->name.'" >';
|
||||
|
||||
}
|
||||
if ( $this->table==1) $r="<TD>$this->label</TD><TD>$r</TD>";
|
||||
return $r;
|
||||
}
|
||||
|
||||
} //end function
|
||||
function debug() {
|
||||
echo "Type ".$this->type."<br>";
|
||||
echo "name ".$this->name."<br>";
|
||||
echo "value". $this->value."<br>";
|
||||
$readonly=($this->readonly==false)?"false":"true";
|
||||
echo "read only".$readonly."<br>";
|
||||
}
|
||||
function Submit ($p_name,$p_value) {
|
||||
return '<INPUT TYPE="SUBMIT" NAME="'.$p_name.'" VALUE="'.$p_value.'">';
|
||||
}
|
||||
}
|
||||
|
|
@ -71,6 +71,23 @@ function InputType($p_label,$p_type,$p_name,$p_value,$p_viewonly=false,$p_list=n
|
|||
$r.="</SELECT></TD>";
|
||||
return $r;
|
||||
}
|
||||
// Input type == select
|
||||
if ( strtolower($p_type)=="select" ) {
|
||||
$r="<TD> $p_label</TD><TD>";
|
||||
$r.=sprintf('<SELECT NAME="%s">',$p_name);
|
||||
foreach ($p_list as $item) {
|
||||
$selected="";
|
||||
if ( $p_value == $item[0] ) {
|
||||
$selected="SELECTED";
|
||||
}
|
||||
$r.=sprintf('<OPTION VALUE="%s" %s>%s',
|
||||
$item[0],
|
||||
$selected,
|
||||
$item[1]);
|
||||
}
|
||||
$r.="</SELECT></TD>";
|
||||
return $r;
|
||||
}
|
||||
// Input type == select2
|
||||
if ( strtolower($p_type)=="select2" ) {
|
||||
$r="<TD> $p_label</TD><TD>";
|
||||
|
|
|
|||
|
|
@ -18,3 +18,156 @@
|
|||
*/
|
||||
/* $Revision$ */
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
include_once("class_widget.php");
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// If print is asked
|
||||
// First time in html
|
||||
// after in pdf or cvs
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
if ( isset( $_POST['bt_html'] ) ) {
|
||||
include("class_jrn.php");
|
||||
$p_cent=( isset ( $_POST['cent']) )?'on':'off';
|
||||
// $POST=from_periode, to_periode, jrn_id, cent
|
||||
|
||||
$Jrn=new jrn($cn,$_POST['jrn_id']);
|
||||
$Jrn->GetName();
|
||||
$Jrn->GetRow( $_POST['from_periode'],
|
||||
$_POST['to_periode'],
|
||||
$p_cent);
|
||||
|
||||
$rep="";
|
||||
$submit=new widget();
|
||||
$hid=new widget("hidden");
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<h2 class="info">'.$Jrn->name.'</h2>';
|
||||
echo "<table>";
|
||||
echo '<TR>';
|
||||
echo '<TD><form method="GET" ACTION="user_impress.php">'.
|
||||
$submit->Submit('bt_other',"Autre journal").
|
||||
$hid->IOValue("type","jrn")."</form></TD>";
|
||||
|
||||
echo '<TD><form method="POST" ACTION="jrn_pdf.php">'.
|
||||
$submit->Submit('bt_pdf',"Export PDF").
|
||||
$hid->IOValue("type","jrn").
|
||||
$hid->IOValue("central",$p_cent).
|
||||
$hid->IOValue("jrn_id",$Jrn->id).
|
||||
$hid->IOValue("from_periode",$_POST['from_periode']).
|
||||
$hid->IOValue("to_periode",$_POST['to_periode']);
|
||||
|
||||
echo "</form></TD>";
|
||||
echo '<TD><form method="POST" ACTION="jrn_csv.php">'.
|
||||
$submit->Submit('bt_csv',"Export CSV").
|
||||
$hid->IOValue("type","jrn").
|
||||
$hid->IOValue("central",$p_cent).
|
||||
$hid->IOValue("jrn_id",$Jrn->id).
|
||||
$hid->IOValue("from_periode",$_POST['from_periode']).
|
||||
$hid->IOValue("to_periode",$_POST['to_periode']);
|
||||
|
||||
echo "</form></TD>";
|
||||
|
||||
echo "</TR>";
|
||||
|
||||
echo "</table>";
|
||||
|
||||
echo "<TABLE>";
|
||||
foreach ( $Jrn->row as $op ) {
|
||||
if ( $op['j_id'] != $rep) {
|
||||
$rep= $op['j_id'];
|
||||
|
||||
echo "<TR>".
|
||||
"<TD>".$op['internal']."</TD>".
|
||||
"<TD>".$op['j_date']."</TD>".
|
||||
"<TD>".$op['poste']."</TD>".
|
||||
"<TD>".$op['description']."</TD>".
|
||||
"<TD>".$op['cred_montant']."</TD>".
|
||||
"<TD>".$op['deb_montant']."</TD>".
|
||||
"</TR>";
|
||||
} else {
|
||||
echo "<TR>".
|
||||
"<TD>".$op['internal']."</TD>".
|
||||
"<TD>".$op['j_date']."</TD>".
|
||||
"<TD>".$op['poste']."</TD>".
|
||||
"<TD>".$op['description']."</TD>".
|
||||
"<TD>".$op['cred_montant']."</TD>".
|
||||
"<TD>".$op['deb_montant']."</TD>".
|
||||
"</TR>";
|
||||
}
|
||||
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
exit;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Show the jrn and date
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
include_once('form_input.php');
|
||||
include_once("postgres.php");
|
||||
|
||||
if ( $User->Admin() ==0) {
|
||||
$ret=make_array($cn,"select jrn_def_id,jrn_def_name
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
|
||||
join user_sec_jrn on uj_jrn_id=jrn_def_id
|
||||
where
|
||||
uj_login='$User->id'
|
||||
and uj_priv !='X'
|
||||
");
|
||||
} else {
|
||||
$ret=make_array($cn,"select jrn_def_id,jrn_def_name
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
|
||||
|
||||
}
|
||||
|
||||
// include_once("check_priv.php");
|
||||
// printf ('<TR><TD class="cell"><a class="mtitle"
|
||||
// href="user_impress.php?type=jrn&action=print&p_id=%d">%s</a></TD></TR>',$l_line['jrn_def_id'],$l_line['jrn_def_name']);
|
||||
|
||||
// Count the forbidden journaux
|
||||
$NoPriv=CountSql($cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
|
||||
jrn_deb_max_line,jrn_cred_max_line
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
|
||||
join user_sec_jrn on uj_jrn_id=jrn_def_id
|
||||
where
|
||||
uj_login='$User->id'
|
||||
and uj_priv ='X'
|
||||
");
|
||||
// Pour voir tout les journal ?
|
||||
if ( $NoPriv == 0 ) {
|
||||
$a=count($ret);
|
||||
$all=array('value'=>0,'label'=>'All');
|
||||
$ret[$a]=$all;
|
||||
}
|
||||
if ( count($ret) < 1 )
|
||||
NoAccess();
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Form
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
echo '<div class="u_redcontent">';
|
||||
echo '<FORM ACTION="?type=jrn" METHOD="POST">';
|
||||
echo '<TABLE><TR>';
|
||||
$w=new widget("select");
|
||||
$w->table=1;
|
||||
$w->label="Choississez le journal";
|
||||
print $w->IOValue("jrn_id",$ret);
|
||||
print '</TR>';
|
||||
print '<TR>';
|
||||
$periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
|
||||
$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 order by p_id");
|
||||
print $w->IOValue('to_periode',$periode_end);
|
||||
print "</TR><TR>";
|
||||
$centralise=new widget("checkbox");
|
||||
$centralise->label="Depuis les journaux centralisés";
|
||||
$centralise->table=1;
|
||||
print $centralise->IOValue('cent');
|
||||
|
||||
print "</TR>";
|
||||
echo '</TABLE>';
|
||||
print $w->Submit('bt_html','Impression');
|
||||
|
||||
echo '</FORM>';
|
||||
echo '</div>';
|
||||
?>
|
||||
|
|
@ -1031,6 +1031,4 @@ function GetDataJrnJrId ($p_cn,$p_jr_id) {
|
|||
}
|
||||
return $ret_array;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -435,9 +435,7 @@ function ShowJrn($p_menu="")
|
|||
$p_array=array(array("user_jrn.php?JRN_TYPE=VEN" ,"Entrée"),
|
||||
array("user_jrn.php?JRN_TYPE=ACH","Dépense"),
|
||||
array("user_jrn.php?JRN_TYPE=FIN","Financier"),
|
||||
array("user_jrn.php?JRN_TYPE=OD","Op. Diverses"),
|
||||
array("user_impress.php","Impression"),
|
||||
array("user_search.php","Recherche")
|
||||
array("user_jrn.php?JRN_TYPE=OD","Op. Diverses")
|
||||
);
|
||||
$result=ShowItem($p_array,'H',"cell","mtitle",$p_menu);
|
||||
return $result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue