First release
This commit is contained in:
parent
e18a050c70
commit
56bb9cb69c
14 changed files with 4421 additions and 0 deletions
145
include/ac_common.php
Normal file
145
include/ac_common.php
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
include_once("debug.php");
|
||||
include_once("constant.php");
|
||||
|
||||
function echo_error ($p_log) {
|
||||
$fdebug=fopen("/tmp/wcompta_error.log","a+");
|
||||
if ( $fdebug != false ) {
|
||||
fwrite($fdebug,date("Ymd H:i:s").$p_log."\n");
|
||||
fclose($fdebug);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* function cmpDate
|
||||
* Purpose :
|
||||
* Compare 2 dates
|
||||
* parm :
|
||||
* - date1 date2
|
||||
* gen :
|
||||
* - rien
|
||||
* return:
|
||||
* - == 0 les dates sont identiques
|
||||
* - > 0 date1 > date2
|
||||
* - < 0 date1 < date2
|
||||
*/
|
||||
|
||||
function cmpDate ($p_date,$p_date_oth) {
|
||||
$l_date=isDate($p_date);
|
||||
$l2_date=isDate($p_date_oth);
|
||||
if ($l_date == null || $l2_date == null ) {
|
||||
echo "erreur date";
|
||||
return null;
|
||||
}
|
||||
$l_adate=explode(".",$l_date);
|
||||
$l2_adate=explode(".",$l2_date);
|
||||
$l_mkdate=mktime(0,0,0,$l_adate[1],$l_adate[0],$l_adate[2]);
|
||||
$l2_mkdate=mktime(0,0,0,$l2_adate[1],$l2_adate[0],$l2_adate[2]);
|
||||
// si $p_date > $p_date_oth return > 0
|
||||
return $l_mkdate-$l2_mkdate;
|
||||
}
|
||||
/* function isDate
|
||||
* Purpose : Verifie qu'une date est bien formaté
|
||||
* en d.m.y et est valable
|
||||
* parm :
|
||||
* - $p_date
|
||||
* gen :
|
||||
* - rien
|
||||
* return:
|
||||
* - null si la date est invalide ou malformaté
|
||||
* - $p_date si tout est bon
|
||||
*
|
||||
*/
|
||||
|
||||
function isDate ( $p_date) {
|
||||
if ( strlen (trim($p_date)) == 0 ) return null;
|
||||
if (! ereg ("^[0-9]{1,2}\.[0-9]{1,2}\.20[0-9]{2}",$p_date) ) {
|
||||
|
||||
return null;
|
||||
} else {
|
||||
$l_date=explode(".",$p_date);
|
||||
if ( $l_date[2] > 2020 ) {
|
||||
return null;
|
||||
}
|
||||
if ( checkdate ($l_date[1],$l_date[0],$l_date[2]) == false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}// !ereg
|
||||
return $p_date;
|
||||
}
|
||||
function formatDate($p_date) {
|
||||
if ( isDate($p_date)== null) return "null";
|
||||
return "'".$p_date."'";
|
||||
}
|
||||
function html_page_start($p_first=0,$p_script="")
|
||||
{
|
||||
global $user,$pass,$IsValid;
|
||||
if ($p_first == 1 ) {
|
||||
echo_debug("Start session explicit");
|
||||
session_start();
|
||||
}
|
||||
session_register("user");
|
||||
session_register("pass");
|
||||
session_register("IsValid");
|
||||
|
||||
echo_debug("user = ".$user." pass=".$pass." IsValid = $IsValid");
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 3.2 FINAL//EN">';
|
||||
echo "<HTML>";
|
||||
echo "<HEAD>
|
||||
<TITLE> Gnu Accountancy</TITLE>
|
||||
<LINK REL=\"stylesheet\" type=\"text/css\" href=\"style.css\">
|
||||
</HEAD>";
|
||||
echo "<BODY $p_script>";
|
||||
}
|
||||
function html_page_stop()
|
||||
{
|
||||
echo "</BODY>";
|
||||
echo "</HTML>";
|
||||
}
|
||||
function html_button_logout() {
|
||||
echo "<A class=\"mtitle\" HREF=logout.php> Logout </A>";
|
||||
}
|
||||
function NoAccess() {
|
||||
// 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>
|
||||
You haven't access
|
||||
</FONT></BLINK></P></BODY></HTML>";
|
||||
|
||||
exit -1;
|
||||
}
|
||||
function FormatString($p_string)
|
||||
{
|
||||
if ( !isset ($p_string) ) {
|
||||
echo_error("ac_common.php FormatString p_string empty");
|
||||
return null;
|
||||
}
|
||||
$p_string=trim($p_string);
|
||||
if (strlen($p_string) == 0 ) return null;
|
||||
$p_string=str_replace("'","\'",$p_string);
|
||||
return $p_string;
|
||||
}
|
||||
?>
|
||||
71
include/central_inc.php
Normal file
71
include/central_inc.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?
|
||||
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function Centralise($p_cn,$p_periode) {
|
||||
|
||||
$sql="insert into centralized( c_j_id,
|
||||
c_date ,
|
||||
c_internal,
|
||||
c_montant,
|
||||
c_debit,
|
||||
c_poste,
|
||||
c_description,
|
||||
c_grp,
|
||||
c_comment,
|
||||
c_rapt,
|
||||
c_periode) select j_id,
|
||||
j_date,
|
||||
jr_internal,
|
||||
j_montant,
|
||||
j_debit ,
|
||||
j_poste ,
|
||||
j_text ,
|
||||
j_grpt ,
|
||||
jr_comment,
|
||||
j_rapt,
|
||||
j_tech_per
|
||||
from jrnx left join jrn on jr_grpt_id=j_grpt
|
||||
where j_tech_per =".$p_periode." and j_tech_user not in ( select c_j_id from centralized)
|
||||
order by j_date,j_grpt,j_debit desc ";
|
||||
$Res=StartSql($p_cn);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
if ($Res==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
|
||||
$Res=ExecSql($p_cn,"update jrnx set j_centralized='t' where j_tech_per=".$p_periode);
|
||||
if ($Res==false) { rollback($p_cn); EndSql($p_cn); return ERROR;}
|
||||
Commit($p_cn);
|
||||
EndSql($p_cn);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
?>
|
||||
154
include/check_priv.php
Normal file
154
include/check_priv.php
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* $Revision$ */
|
||||
|
||||
include_once("postgres.php");
|
||||
/* function CheckJrn
|
||||
* Purpose :
|
||||
* Vérifie les acces d'un utilisateur
|
||||
* sur un journal
|
||||
*
|
||||
* parm :
|
||||
* - $p_dossier le dossier
|
||||
* - $p_user le login user
|
||||
* - $p_jrn le journal
|
||||
* gen :
|
||||
* - rien
|
||||
* return:
|
||||
* - 0 pas d'acces
|
||||
* - 1 Lecture
|
||||
* - 2 écriture
|
||||
*
|
||||
*/
|
||||
|
||||
function CheckJrn($p_dossier,$p_user,$p_jrn)
|
||||
{
|
||||
if ( CheckIsAdmin( $p_user) == 1 ) return 2;
|
||||
|
||||
$l_Db=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
// droit spécifique
|
||||
$Res2=ExecSql($cn,"select jrn_def_id,uj_priv from jrn_def left join user_sec_jrn on uj_jrn_id=jrn_def_id
|
||||
where uj_login='$p_user' and jrn_def_id=$p_jrn");
|
||||
|
||||
$PrivJrn=pg_NumRows($Res2);
|
||||
$cn=DbConnect();
|
||||
// droit par défaut
|
||||
$Res=ExecSql($cn," select *
|
||||
from ac_users left join jnt_use_dos using (use_id) left join priv_user on (priv_jnt=jnt_id)
|
||||
where use_login='$p_user' and
|
||||
dos_id=$p_dossier");
|
||||
|
||||
$DefRight=pg_NumRows($Res);
|
||||
echo_debug ("PrivJrn = $PrivJrn DefRight $DefRight");
|
||||
// Si les droits par défaut == 0, alors user n'a pas accès au dossier
|
||||
if ( $DefRight == 0 ) return 0;
|
||||
$Def=pg_fetch_array($Res,0);
|
||||
|
||||
// Si les droits par défaut == NO, alors user n'a pas accès au dossier
|
||||
if ( $Def['priv_priv'] == "NO" ) return 0;
|
||||
|
||||
if ( $Def['priv_priv'] == "W") {
|
||||
// Si droit pas défaut == écriture
|
||||
if ( $PrivJrn == 0 ) {
|
||||
// Pas de droit spécifique sur jrn => droit par défaut = W
|
||||
return 2;
|
||||
}
|
||||
$Priv=pg_fetch_array($Res2,0);
|
||||
|
||||
if ( $Priv['uj_priv'] == "X" ) return 0;
|
||||
if ( $Priv['uj_priv'] == "R" ) return 1;
|
||||
if ( $Priv['uj_priv'] == "W" ) return 2;
|
||||
echo '<H2 class="error"> Undefined right</H2>';
|
||||
echo_debug ("Droit Journal $Priv[uj_priv]");
|
||||
return 0;
|
||||
}
|
||||
if ( $Def['priv_priv'] == "R") {
|
||||
// Si droit pas défaut == Lire
|
||||
if ( $PrivJrn == 0 ) {
|
||||
// Pas de droit spécifique sur jrn => droit par défaut = Lire
|
||||
return 1;
|
||||
}
|
||||
$Priv=pg_fetch_array($Res2,0);
|
||||
|
||||
if ( $Priv['uj_priv'] == "X" ) return 0;
|
||||
if ( $Priv['uj_priv'] == "R" ) return 1;
|
||||
if ( $Priv['uj_priv'] == "W" ) return 2;
|
||||
echo_debug ("Droit Journal $Priv[uj_priv]");
|
||||
echo '<H2 class="error"> Undefined right</H2>';
|
||||
return 0;
|
||||
}
|
||||
echo '<H2 class="error"> Undefined default right</H2>';
|
||||
return 0;
|
||||
|
||||
}
|
||||
/* function CheckAction
|
||||
* Purpose : Check if an user is allowed to do an action
|
||||
*
|
||||
* parm :
|
||||
* - p_dossier dossier id
|
||||
* - p_login user's login
|
||||
* - p_action_id
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* - 0 no priv
|
||||
* - 1 priv granted
|
||||
*
|
||||
*/
|
||||
function CheckAction ( $p_dossier,$p_login,$p_action_id)
|
||||
{
|
||||
if ( CheckIsAdmin ($p_login) ) return 1;
|
||||
$l_Db=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($l_Db);
|
||||
$Res=ExecSql($cn,"select * from user_sec_act where ua_login='$p_login' and ua_act_id=$p_action_id");
|
||||
$Count=pg_NumRows($Res);
|
||||
if ( $Count == 0 ) return 0;
|
||||
if ( $Count == 1 ) return 1;
|
||||
echo "<H2 class=\"error\"> Invalid action !!! </H2>";
|
||||
}
|
||||
/* function CheckIsAdmin
|
||||
* Purpose : Check if an user is an administrator
|
||||
*
|
||||
* parm :
|
||||
* - $p_user user login
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* - 0 if no
|
||||
* - 1 if yes
|
||||
*
|
||||
*/
|
||||
function CheckIsAdmin($p_user)
|
||||
{
|
||||
if ( $p_user == 'webcompta') return 1;
|
||||
$sql="select use_id from ac_users where use_login='$p_user'
|
||||
and use_active=1 and use_admin=1 ";
|
||||
$cn=DbConnect();
|
||||
|
||||
$isAdmin=CountSql($cn,$sql);
|
||||
|
||||
|
||||
return $isAdmin;
|
||||
|
||||
}
|
||||
?>
|
||||
67
include/constant.php
Normal file
67
include/constant.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?
|
||||
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
// $Revision$
|
||||
|
||||
// securite correspond a la table
|
||||
// action
|
||||
define ("ENCJRN",1);
|
||||
define("FACT",2);
|
||||
define ("FICHE",3);
|
||||
define ("IMP",4);
|
||||
define("FORM",5);
|
||||
define ("MPCMN",6);
|
||||
define ("GJRN",7);
|
||||
define ("PARM",8);
|
||||
define ("SECU",9);
|
||||
define ("CENTRALIZE",10);
|
||||
|
||||
|
||||
// Erreur
|
||||
define ("NOERROR",0);
|
||||
define ("BADPARM",1);
|
||||
define ("BADDATE",2);
|
||||
define ("NOTPERIODE",3);
|
||||
define ("PERIODCLOSED",4);
|
||||
define ("INVALID_ECH",5);
|
||||
define ("RAPPT_ALREADY_USED",6);
|
||||
define ("RAPPT_NOT_EXIST",7);
|
||||
define ("DIFF_AMOUNT",8);
|
||||
define ("RAPPT_NOMATCH_AMOUNT",9);
|
||||
define ("NO_PERIOD_SELECTED",10);
|
||||
define ("NO_POST_SELECTED",11);
|
||||
define ("LAST",1);
|
||||
define ("FIRST",0);
|
||||
define ("ERROR",12);
|
||||
|
||||
//valeurs standardd
|
||||
define ("YES",1);
|
||||
define ("NO",0);
|
||||
define ("OPEN",1);
|
||||
define ("CLOSED",0);
|
||||
define ("NOTCENTRALIZED",3);
|
||||
|
||||
// Pour les ShowMenuComptaLeft
|
||||
define ("MENU_FACT",1);
|
||||
define ("MENU_FICHE",2);
|
||||
define ("MENU_PARAM",3);
|
||||
?>
|
||||
33
include/debug.php
Normal file
33
include/debug.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
function echo_debug ($p_log) {
|
||||
$fdebug=fopen("/tmp/debug_log","a+");
|
||||
if ( $fdebug != false ) {
|
||||
fwrite($fdebug,date("Ymd H:i:s").$p_log."\n");
|
||||
fclose($fdebug);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
51
include/facture_inc.php
Normal file
51
include/facture_inc.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ViewFactImpaye($p_cn) {
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ViewFactAll($p_cn) {
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
543
include/fiche_inc.php
Normal file
543
include/fiche_inc.php
Normal file
|
|
@ -0,0 +1,543 @@
|
|||
<?
|
||||
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
// $Revision$
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function AddFiche($p_cn,$p_type,$p_array) {
|
||||
echo_debug(" AddFiche($p_cn,$p_type,$p_array) ");
|
||||
|
||||
foreach ($p_array as $key=>$element){
|
||||
${"p_$key"}=$element;
|
||||
echo_debug("p_$key=$element;");
|
||||
}
|
||||
$base=GetBaseFiche($p_cn,$p_type);
|
||||
$num=GetNextFiche($p_cn,$base);
|
||||
$sql=sprintf("insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
|
||||
values (%s,'%s',%d)",
|
||||
$num,
|
||||
$p_nom0,
|
||||
$base);
|
||||
echo_debug($sql);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$sql=sprintf("insert into fiche ( f_id,f_label,f_fd_id) values (%d,'%s',%d)",
|
||||
$num,$p_nom0,$p_type);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
for ( $i = 1; $i < $p_inc;$i++) {
|
||||
$sql=sprintf("insert into isupp (is_f_id,is_isd_id,is_value) values (
|
||||
%d,%d,'%s')",
|
||||
$num, ${"p_isd_id$i"},${"p_nom$i"});
|
||||
echo_debug($sql);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function EncodeFiche($p_cn,$p_type,$p_array=null) {
|
||||
echo_debug("function EncodeFiche($p_cn,$p_type) ");
|
||||
$ch_col="</TD><TD>";
|
||||
$ch_li='</TR><TR>';
|
||||
echo '<FORM action="fiche.php" method="post">';
|
||||
echo '<INPUT TYPE="HIDDEN" name="fiche" value="'.$p_type.'">';
|
||||
|
||||
echo "<TABLE>";
|
||||
if ($p_array == null) {
|
||||
$p_f_id="";
|
||||
echo_debug("Array is null");
|
||||
$sql="select isd_id,isd_label from isupp_def where isd_fd_id=".$p_type;
|
||||
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
|
||||
echo '<INPUT TYPE="HIDDEN" name="f_id" value="'.$p_f_id.'">';
|
||||
for ($i=0;$i < $Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
$Hid=sprintf('<INPUT TYPE="HIDDEN" name="isd_id%d" value="%s">',
|
||||
$i,$l_line['isd_id']);
|
||||
printf ('<TR><TD> %s </TD><TD><INPUT TYPE="TEXT" NAME="nom%d">%s</TD></TR>',
|
||||
$l_line['isd_label'], $i,$Hid);
|
||||
}
|
||||
echo '</TR>';
|
||||
echo '</TABLE>';
|
||||
echo '<INPUT TYPE="HIDDEN" name="inc" value="'.$Max.'">';
|
||||
echo '<INPUT TYPE="SUBMIT" name="add_fiche" value="ajoute">';
|
||||
echo '</FORM>';
|
||||
}else {
|
||||
$sql="select f_label,f_fd_id from fiche where f_id=".$p_type;
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max == 0 ) return;
|
||||
$l_line=pg_fetch_array($Res,0);
|
||||
printf('<input TYPE="TEXT" name="f_label" value="%s"><BR>',
|
||||
$l_line['f_label']);
|
||||
echo '<INPUT TYPE="HIDDEN" name="f_fd_id" value="'.$l_line['f_fd_id'].'">';
|
||||
|
||||
$sql="select isd_fd_id,isd_id,isd_label,is_value,is_id,is_f_id from isupp left join isupp_def on isd_id=is_isd_id where is_f_id=".$p_type;
|
||||
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
echo_debug("Max ==== $Max");
|
||||
echo '<INPUT TYPE="HIDDEN" name="f_id" value="'.$p_type.'">';
|
||||
|
||||
echo '<INPUT TYPE="HIDDEN" name="max" value="'.$Max.'">';
|
||||
for ($i=0;$i < $Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
|
||||
|
||||
$Hid=sprintf('<INPUT TYPE="HIDDEN" name="is_id%d" value="%s">',
|
||||
$i,$l_line['is_id']);
|
||||
printf ('<TR><TD> %s </TD><TD><INPUT TYPE="TEXT" NAME="nom%d" VALUE="%s">%s</TD></TR>',
|
||||
$l_line['isd_label'], $i, $l_line['is_value'],$Hid);
|
||||
}
|
||||
echo '</TR>';
|
||||
echo '</TABLE>';
|
||||
echo '<INPUT TYPE="SUBMIT" name="update_fiche" value="Mis à jour">';
|
||||
echo '</FORM>';
|
||||
}
|
||||
}
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetBaseFiche($p_cn,$p_type) {
|
||||
$base=null;
|
||||
$Res=ExecSql($p_cn,"select fd_class_base from fichedef where fd_id=".$p_type);
|
||||
if ( pg_NumRows($Res) == 0 ) return;
|
||||
$base=pg_fetch_array($Res,0);
|
||||
return $base['fd_class_base'];
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ViewFiche($p_cn,$p_type) {
|
||||
$Res=ExecSql($p_cn,"select f_id,f_label from fiche where f_fd_id='".$p_type."' order by f_id");
|
||||
$Max=pg_NumRows($Res);
|
||||
|
||||
for ( $i = 0; $i < $Max; $i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
$div="<DIV>";
|
||||
$span_mod='<span class="mtitle"><A class="mtitle" href="fiche.php?action=detail&fiche_id='.$l_line['f_id'].'"> Modifie</A></SPAN>';
|
||||
$span_del='<span class="mtitle2" ALIGN="left">'.
|
||||
'<A class="mtitle" href="fiche.php?f_fd_id='.$p_type.'&action=delete&fiche_id='.$l_line['f_id'].
|
||||
'"> delete</A></SPAN>';
|
||||
$span_id='<SPAN style="background-color:lightgrey;">'.$l_line['f_id']."</SPAN>";
|
||||
if ( $i %2 == 0 )
|
||||
$div='<DIV style="background-color:#DDE6FF;">';
|
||||
echo $div.$span_del.' '.' '.' '.' '.' '.' '.
|
||||
$span_mod." "." "." ".$span_id." "." "." ".$l_line['f_label']."</DIV>";
|
||||
}
|
||||
echo '<FORM METHOD="POST" action="fiche.php">';
|
||||
echo '<INPUT TYPE="HIDDEN" name="fiche" value="'.$p_type.'">';
|
||||
echo '<INPUT TYPE="SUBMIT" name="add" Value="Ajout fiche">';
|
||||
echo '</FORM>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetNextFiche($p_cn,$p_base) {
|
||||
$Res=ExecSql($p_cn,"select max(pcm_val) as maxcode from tmp_pcmn where pcm_val_parent = $p_base");
|
||||
$Max=pg_NumRows($Res);
|
||||
echo_debug("$Max=pg_NumRows");
|
||||
$l_line=pg_fetch_array($Res,0);
|
||||
$ret=$l_line['maxcode'];
|
||||
if ( $ret == "" ) {
|
||||
$ret=sprintf("%d%04d",$p_base,0);
|
||||
return $ret+1;
|
||||
|
||||
}
|
||||
|
||||
echo_debug("ret $ret");
|
||||
return $ret+1;
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetDataFiche($p_cn,$p_fiche_id) {
|
||||
|
||||
}
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ViewFicheDetail($p_cn,$p_id) {
|
||||
$sql="insert into isupp (is_f_id,is_isd_id) select".
|
||||
" '".$p_id."',isd_id from isupp_def ".
|
||||
" where isd_id not in ".
|
||||
"(select is_isd_id from isupp where is_f_id=".$p_id.") ".
|
||||
" and isd_fd_id=(select distinct f_fd_id from fiche ".
|
||||
" where f_id=".$p_id.")";
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
EncodeFiche ($p_cn,$p_id,1);
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function UpdateFiche($p_cn,$p_array) {
|
||||
foreach ( $p_array as $key=> $element) {
|
||||
echo_debug("$key => $element");
|
||||
${"$key"}=$element;
|
||||
}
|
||||
$sql=sprintf("update tmp_pcmn set pcm_lib='%s' where pcm_val=%s",
|
||||
$f_label,
|
||||
$f_id);
|
||||
echo_debug($sql);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$sql=sprintf("update fiche set f_label='%s' where f_id=%s",
|
||||
$f_label,
|
||||
$f_id);
|
||||
echo_debug($sql);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
for ( $i =0 ; $i < $max ; $i++) {
|
||||
$sql=sprintf("update isupp set is_value='%s' where is_id=%d",
|
||||
${"nom$i"},
|
||||
${"is_id$i"});
|
||||
echo_debug($sql);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function EncodeModele($p_js)
|
||||
{
|
||||
echo '<H2 CLASS="info"> Ajout d\'un modèle</H2>';
|
||||
echo '<FORM ACTION="fiche.php" METHOD="post">';
|
||||
echo '<BR>Libellé <INPUT TYPE="TEXT" NAME="nom_mod">';
|
||||
echo '<BR>Classe de base <INPUT TYPE="TEXT" NAME="class_base">';
|
||||
echo $p_js;
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="inc" VALUE="1">';
|
||||
echo '<BR><INPUT TYPE="SUBMIT" name="record_model" VALUE="Ajoute modèle">';
|
||||
echo '</FORM>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function DefModele ($p_js,$p_array=null,$p_ligne=1)
|
||||
{
|
||||
echo_debug("DefModele ($p_array,$p_ligne=1) ");
|
||||
for ($i=0; $i < $p_ligne; $i++) {
|
||||
${"p_LABEL$i"}="";
|
||||
${"p_inform$i"}="";
|
||||
${"p_isd_id$i"}="";
|
||||
}
|
||||
if ($p_array != null) {
|
||||
foreach ( $p_array as $key => $element){
|
||||
${"p_$key"}=$element;
|
||||
echo_debug ("p_$key $element");
|
||||
}//foreach
|
||||
}else {
|
||||
$p_nom_mod="";
|
||||
$p_class_base="";
|
||||
}
|
||||
|
||||
echo '<FORM ACTION="fiche.php" METHOD="POST">';
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="inc" VALUE="'.$p_ligne.'">';
|
||||
// echo '<INPUT TYPE="HIDDEN" NAME="ligne" VALUE="'.$p_ligne.'">';
|
||||
echo '<BR>Label<INPUT TYPE="TEXT" NAME="nom_mod" VALUE="'.$p_nom_mod.'">';
|
||||
echo '<BR>classe<INPUT TYPE="TEXT" NAME="class_base" VALUE="'.$p_class_base.'">'.$p_js;
|
||||
|
||||
if ( isset($p_fd_id) ) {
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="fd_id" VALUE="'.$p_fd_id.'">';
|
||||
}
|
||||
for ( $i=0; $i < $p_ligne ; $i++ ) {
|
||||
if ( isset($p_fd_id) ) {
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="isd_id'.$i.'" VALUE="'.${"p_isd_id$i"}.'">';
|
||||
}
|
||||
printf( '<BR>Libellé <INPUT TYPE="TEXT" NAME="LABEL%d" VALUE="%s">',
|
||||
$i,
|
||||
${"p_LABEL$i"}
|
||||
);
|
||||
if ( ${"p_inform$i"} == "on" || ${"p_inform$i"}=='t' ) {
|
||||
$val="checked";
|
||||
} else {
|
||||
$val="";
|
||||
}
|
||||
printf('Dans les formulaires <INPUT TYPE="CHECKBOX" name="inform%d" %s > ',
|
||||
$i,
|
||||
$val
|
||||
);
|
||||
}
|
||||
echo '<BR><INPUT TYPE="submit" name="add_ligne" VALUE="Ajoute un champs">';
|
||||
if ( isset($p_fd_id) ){
|
||||
echo '<BR><INPUT TYPE="SUBMIT" NAME="update_modele" VALUE="Enregistrement">';
|
||||
}else {
|
||||
echo '<BR><INPUT TYPE="SUBMIT" NAME="add_modele" VALUE="Enregistrement">';
|
||||
}//if isset p_fd_id else
|
||||
|
||||
echo '<FORM>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function AddModele($p_cn,$p_array) {
|
||||
echo_debug("AddModele");
|
||||
$p_ligne=$p_array['inc'];
|
||||
for ($i=0; $i < $p_ligne; $i++) {
|
||||
${"p_inform$i"}="";
|
||||
}
|
||||
|
||||
foreach ( $p_array as $key=>$element ) {
|
||||
echo_debug("p_$key $element");
|
||||
${"p_$key"}=$element;
|
||||
}
|
||||
$p_nom_mod=FormatString($p_nom_mod);
|
||||
$p_class_base=FormatString($p_class_base);
|
||||
$sql=sprintf("insert into fichedef(fd_label,fd_class_base) values ('%s','%s')",
|
||||
$p_nom_mod,$p_class_base);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
|
||||
$f_id=GetSequence($p_cn,"s_fdef");
|
||||
|
||||
for ( $i=0; $i < $p_inc; $i++) {
|
||||
if ( ${"p_inform$i"} == "on" ) {
|
||||
$valform="true";
|
||||
}else {
|
||||
$valform="false";
|
||||
}
|
||||
${"p_LABEL$i"}=FormatString(${"p_LABEL$i"});
|
||||
if ( ${"p_LABEL$i"} != null ) {
|
||||
$sql=sprintf("insert into isupp_def(isd_label,isd_fd_id,isd_form) values ('%s',%d,%s)",
|
||||
${"p_LABEL$i"},$f_id,$valform);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function UpdateModele($p_cn,$p_fiche,$p_js) {
|
||||
$array=GetDataModele($p_cn,$p_fiche);
|
||||
if ($array==null) {
|
||||
echo_error ("fiche_inc:UpdateModele Fiche non trouvée");
|
||||
return;
|
||||
}
|
||||
foreach ( $array as $key=>$element) echo_debug("$key => $element");
|
||||
DefModele($p_js,$array,$array['ligne']);
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetDataModele($p_cn,$p_fiche) {
|
||||
$Res=ExecSql($p_cn,"select fd_id,fd_label,fd_class_base,
|
||||
isd_id,isd_label,isd_form
|
||||
from fichedef inner join isupp_def on isd_fd_id=fd_id
|
||||
where fd_id=$p_fiche");
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0) return null;
|
||||
for ($i=0; $i < $Max;$i++) {
|
||||
$line=pg_fetch_array($Res,$i);
|
||||
if ($i == 0 ) {
|
||||
$array["nom_mod"]=$line['fd_label'];
|
||||
$array["class_base"]=$line['fd_class_base'];
|
||||
$array["fd_id"]=$line['fd_id'];
|
||||
}//if $i == 0
|
||||
//inform
|
||||
$text=sprintf("inform%d",$i);
|
||||
$array[$text]=$line['isd_form'];
|
||||
//Label
|
||||
$text=sprintf("LABEL%d",$i);
|
||||
$array[$text]=$line['isd_label'];
|
||||
//isd_id
|
||||
$text=sprintf("isd_id%d",$i);
|
||||
$array[$text]=$line['isd_id'];
|
||||
|
||||
}//for
|
||||
$array['ligne']=$Max;
|
||||
return $array;
|
||||
}
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function SaveModele($p_cn,$p_array) {
|
||||
for ($i=0; $i < $p_array['inc']; $i++) {
|
||||
${"inform$i"}="";
|
||||
}
|
||||
|
||||
foreach ($p_array as $key=>$element){
|
||||
echo_debug("$key => $element");
|
||||
${"$key"}=$element;
|
||||
}//foreach
|
||||
$nom_mod=FormatString($nom_mod);
|
||||
$class_base=FormatString($class_base);
|
||||
if ( $nom_mod != null ) {
|
||||
$sql=sprintf("update fichedef set fd_label='%s', fd_class_base='%s' where fd_id=%d",
|
||||
$nom_mod,$class_base,$fd_id);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}
|
||||
for ($i=1;$i<$inc;$i++){
|
||||
if ( ${"inform$i"} != null) {
|
||||
$valform='true';
|
||||
}else {
|
||||
$valform='false';
|
||||
} //if ( ${"inform$d") != null)
|
||||
|
||||
if ( ${"isd_id$i"} != null ) {
|
||||
${"LABEL$i"}=FormatString(${"LABEL$i"});
|
||||
if ( ${"LABEL$i"} != null ) {
|
||||
$sql=sprintf("update isupp_def set isd_label='%s',isd_form=%s where isd_id=%d",
|
||||
${"LABEL$i"},$valform,${"isd_id$i"});
|
||||
}
|
||||
} // if ( ${"p_isd_id$i"} != null )
|
||||
else {
|
||||
${"LABEL$i"}=FormatString(${"LABEL$i"});
|
||||
if ( ${"LABEL$i"} != null ) {
|
||||
$sql=sprintf("insert into isupp_def( isd_label,isd_fd_id,isd_form)
|
||||
values ('%s',%d,%s)",
|
||||
${"LABEL$i"},$fd_id,$valform);
|
||||
}// if ( ${"LABEL$i"} != null )
|
||||
}//else if ( ${"p_isd_id$i"} != null )
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}//for
|
||||
}
|
||||
function Remove ($p_cn, $p_fid) {
|
||||
if ( ! isset ($p_cn) ||
|
||||
! isset ($p_fid) ) {
|
||||
echo_error ("Remove Missing Parameter p_cn = $p_cn p_fid=$p_fid");
|
||||
return;
|
||||
}
|
||||
if ( CountSql($p_cn,"select * from jrnx where j_poste=$p_fid") == 0 ) {
|
||||
$Res=ExecSql($p_cn,"delete from isupp where is_f_id=$p_fid");
|
||||
$Res=ExecSql($p_cn,"delete from fiche where f_id=$p_fid");
|
||||
} else {
|
||||
echo "<SCRIPT> alert('Impossible ce poste est utilisé dans un journal'); </SCRIPT>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
308
include/form_inc.php
Normal file
308
include/form_inc.php
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
//$Revision$
|
||||
|
||||
/* function EncodeForm
|
||||
* Purpose :
|
||||
* Encoding Form
|
||||
*
|
||||
* parm :
|
||||
* - array of previous changes
|
||||
* - sessid for the search window
|
||||
* - p_line number of line
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function EncodeForm($p_line,$p_sessid,$p_array=null) {
|
||||
echo '<SCRIPT LANGUAGE="javascript" SRC="win_search_poste.js"></SCRIPT>';
|
||||
$search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$p_sessid."')\">";
|
||||
for ( $i =0 ; $i <= $p_line; $i++) {
|
||||
${"text$i"}="";
|
||||
${"form$i"}="";
|
||||
${"pos$i"}="";
|
||||
}
|
||||
if ( $p_array != null ) {
|
||||
foreach ( $p_array as $key=> $element ) {
|
||||
${"$key"}=$element;
|
||||
echo_debug ("EncodeForm $key = $element");
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
$form_nom="";
|
||||
$text0="";
|
||||
$form0="";
|
||||
}
|
||||
echo "<FORM ACTION=\"form.php\" METHOD=\"POST\">";
|
||||
printf ("Nom du formulaire : <INPUT TYPE=\"TEXT\" NAME=\"form_nom\" VALUE=\"%s\">",
|
||||
$form_nom);
|
||||
printf ('<INPUT TYPE="HIDDEN" NAME="line" value="%s"',
|
||||
$p_line);
|
||||
if ( isset ($fr_id)) printf ('<INPUT TYPE="HIDDEN" NAME="fr_id" value="%s"',
|
||||
$fr_id);
|
||||
|
||||
echo '<TABLE>';
|
||||
echo "<TR>";
|
||||
if ( isset($fr_id) ) echo "<TH> Position </TH>";
|
||||
echo "<TH> Texte </TH>";
|
||||
echo "<TH> Formule</TH>";
|
||||
|
||||
echo '</TR>';
|
||||
for ( $i =0 ; $i < $p_line;$i++) {
|
||||
echo "<TR>";
|
||||
// si fr_id != null alors les donnees viennent de
|
||||
// GetDataForm: ce n'est pas un nouvel enregistrement
|
||||
//
|
||||
if ( isset($fr_id)) {
|
||||
echo "<TD>";
|
||||
printf ('<input TYPE="TEXT" NAME="pos%d" size="3" VALUE="%s">',
|
||||
$i,${"pos$i"});
|
||||
echo '</TD>';
|
||||
}
|
||||
|
||||
echo "<TD>";
|
||||
printf ('<input TYPE="TEXT" NAME="text%d" size="25" VALUE="%s">',
|
||||
$i,${"text$i"});
|
||||
echo '</TD>';
|
||||
|
||||
echo "<TD>";
|
||||
printf ('<input TYPE="TEXT" NAME="form%d" SIZE="25" VALUE="%s">',
|
||||
$i,${"form$i"});
|
||||
echo $search;
|
||||
echo '</TD>';
|
||||
|
||||
echo "</TR>";
|
||||
}
|
||||
echo "</TABLE>";
|
||||
if ( isset($fr_id)){
|
||||
echo '<INPUT TYPE="submit" value="Enregistre" name="update">';
|
||||
}else {
|
||||
echo '<INPUT TYPE="submit" value="Enregistre" name="record">';
|
||||
}
|
||||
echo '<INPUT TYPE="submit" value="Ajoute une ligne" name="add_line">';
|
||||
echo "</FORM>";
|
||||
|
||||
}
|
||||
/* function ViewForm
|
||||
* Purpose : Show the details of a form
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connection
|
||||
* - $p_id gives the formdef.fr_id
|
||||
* - sessid for the search window
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function ViewForm($p_cn,$p_sessid,$p_id) {
|
||||
$array=GetDataForm($p_cn,$p_id);
|
||||
$l_nom=GetFormName($p_cn,$p_id);
|
||||
$array['form_nom']=$l_nom;
|
||||
|
||||
$l_line=GetNumberLine($p_cn,$p_id);
|
||||
EncodeForm($l_line,$p_sessid,$array);
|
||||
|
||||
}
|
||||
/* function GetDataForm
|
||||
* Purpose :
|
||||
* Get data from a form
|
||||
* parm :
|
||||
* - $p_cn connection
|
||||
* - $p_id gives the formdef.fr_id
|
||||
* -
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - array
|
||||
*
|
||||
*/
|
||||
function GetDataForm($p_cn,$p_id) {
|
||||
$Res=ExecSql($p_cn,"select fo_id,fo_fr_id,fo_pos,fo_label,fo_formula from form where fo_fr_id=$p_id
|
||||
order by fo_pos");
|
||||
$Max=pg_NumRows($Res);
|
||||
for ( $i=0;$i<$Max;$i++){
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
|
||||
// get the fo_id
|
||||
$text=sprintf("fo_id%d",$i);
|
||||
$array[$text]=$l_line['fo_id'];
|
||||
// get the fo_label
|
||||
$text=sprintf("text%d",$i);
|
||||
$array[$text]=$l_line['fo_label'];
|
||||
// get the fo_formula
|
||||
$text=sprintf("form%d",$i);
|
||||
$array[$text]=$l_line['fo_formula'];
|
||||
// get the pos
|
||||
$text=sprintf("pos%d",$i);
|
||||
$array[$text]=$l_line['fo_pos'];
|
||||
} //for
|
||||
$array["fr_id"]=$p_id;
|
||||
return $array;
|
||||
}
|
||||
/* function GetNumberLine
|
||||
* Purpose : Get the number of line of a form
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connection
|
||||
* - $p_id gives the formdef.fr_id
|
||||
* -
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - integer
|
||||
*
|
||||
*/
|
||||
function GetNumberLine($p_cn,$p_id) {
|
||||
$Res=ExecSql($p_cn,"select * from form where fo_fr_id=".$p_id);
|
||||
$count=pg_NumRows($Res);
|
||||
return $count;
|
||||
}
|
||||
/* function GetFormName
|
||||
* Purpose : Get the name of the form
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connection
|
||||
* - $p_id formdef.fr_id
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - string name
|
||||
*
|
||||
*/
|
||||
function GetFormName($p_cn,$p_id) {
|
||||
$Res=ExecSql($p_cn,"select fr_label from formdef where fr_id=".$p_id);
|
||||
if ( pg_NumRows($Res) == 0 ) return null;
|
||||
$name=pg_fetch_array($Res,0);
|
||||
return $name['fr_label'];
|
||||
}
|
||||
/* function UpdateForm
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $array
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function UpdateForm($p_cn,$p_array) {
|
||||
foreach ($p_array as $key=>$element) {
|
||||
echo_debug ("UpdateForm $key = $element");
|
||||
${"$key"}=$element;
|
||||
}
|
||||
$Res=ExecSql($p_cn,"update formdef set fr_label='".$form_nom."' where fr_id=".$fr_id);
|
||||
$Res=ExecSql($p_cn,"delete from form where fo_fr_id=".$fr_id);
|
||||
// Test les positions
|
||||
for ($i =0; $i <$line;$i++) {
|
||||
echo_debug ("position =".${"pos$i"});
|
||||
if ( (string) ${"pos$i"} != (string) (int) ${"pos$i"}) {
|
||||
${"pos$i"}=$i+1;
|
||||
}
|
||||
if ( ${"pos$i"} > $line || ${"pos$i"} < 0) {
|
||||
${"pos$i"}=$i+1;
|
||||
echo_debug("position trop grand max = $line+1 ");
|
||||
}
|
||||
}
|
||||
for ($i =0; $i <$line;$i++) {
|
||||
for ( $o=$i+1; $o < $line;$o++) {
|
||||
if ( ${"pos$i"} == ${"pos$o"} ) {
|
||||
${"pos$o"}=$o+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( $i=0;$i<$line;$i++) {
|
||||
if ( strlen(trim(${"text$i"})) != 0) {
|
||||
${"text$i"}=FormatString(${"text$i"});
|
||||
${"form$i"}=FormatString(${"form$i"});
|
||||
if ( ${"text$i"} != null ) {
|
||||
${"form$i"}=(${"form$i"}==null)?${"form$i"}:"'".${"form$i"}."'";
|
||||
$sql=sprintf("insert into form (fo_fr_id,
|
||||
fo_pos,
|
||||
fo_label,
|
||||
fo_formula) values
|
||||
( %d,
|
||||
%d,
|
||||
'%s',
|
||||
%s)",
|
||||
$fr_id,${"pos$i"},${"text$i"},${"form$i"}
|
||||
);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}
|
||||
}//if
|
||||
}//for
|
||||
|
||||
}
|
||||
/* function AddForm
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $array
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function AddForm($p_cn,$p_array) {
|
||||
foreach ($p_array as $key=>$element) {
|
||||
echo_debug ("AddForm $key = $element");
|
||||
${"$key"}=$element;
|
||||
}
|
||||
|
||||
if ( !isset ($form_nom) ||
|
||||
! isset ($line) ) {
|
||||
echo_error("Nom ou ligne non défini");
|
||||
return;
|
||||
}
|
||||
$sql="insert into formdef (fr_label) values ('".$form_nom."')";
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$n=GetSequence($p_cn,"s_formdef");
|
||||
|
||||
for ($i=0;$i < $line;$i++) {
|
||||
${"text$i"}=FormatString(${"text$i"});
|
||||
${"form$i"}=FormatString(${"form$i"});
|
||||
if ( ${"text$i"} != null ) {
|
||||
${"form$i"}=(${"form$i"}==null)?${"form$i"}:"'".${"form$i"}."'";
|
||||
$sql=sprintf("insert into form (fo_fr_id,
|
||||
fo_pos,
|
||||
fo_label,
|
||||
fo_formula) values
|
||||
( %d,
|
||||
%d,
|
||||
'%s',
|
||||
%s)",
|
||||
$n,$i+1,${"text$i"},${"form$i"}
|
||||
);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}//if
|
||||
}//for $i
|
||||
}
|
||||
|
||||
?>
|
||||
593
include/impress_inc.php
Normal file
593
include/impress_inc.php
Normal file
|
|
@ -0,0 +1,593 @@
|
|||
<?
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
// $Revision$
|
||||
|
||||
/* function ViewImp
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ViewImp($p_array,$p_cn) {
|
||||
include_once("preference.php");
|
||||
$periode=FormPeriodeMult($p_cn);
|
||||
foreach ( $p_array as $key=>$element) {
|
||||
echo_debug("VIEWIMP $key $element");
|
||||
${"$key"}=$element;
|
||||
}
|
||||
if ( ! isset($type) ) return;
|
||||
|
||||
if ( $action=="viewhtml") echo '<FORM ACTION=impress.php METHOD="POST">';
|
||||
else {
|
||||
if ( $type=="jrn")
|
||||
echo '<FORM ACTION=send_jrn_pdf.php METHOD="POST">';
|
||||
if ( $type=="poste")
|
||||
echo '<FORM ACTION=send_poste_pdf.php METHOD="POST">';
|
||||
}
|
||||
echo $periode;
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="type" value="'.$type.'">';
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="action" value="'.$action.'">';
|
||||
if (isset ($central)) {
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="central" value="'.$central.'">';
|
||||
}
|
||||
if ( isset($filter))
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="filter" value="'.$filter.'">';
|
||||
if ( isset ($p_id)) {
|
||||
echo '<INPUT TYPE="HIDDEN" NAME="p_id" value="'.$p_id.'">';
|
||||
} else {
|
||||
include_once("poste.php");
|
||||
echo PosteForm($p_cn);
|
||||
}
|
||||
echo '<INPUT TYPE="SUBMIT" name="print" Value="Executer">';
|
||||
|
||||
echo '</FORM>';
|
||||
echo "</DIV>";
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function Imp($p_array,$p_cn) {
|
||||
if ( ! isset($p_array['action'])) {
|
||||
echo_error ("IMP no action specified"); return;
|
||||
}
|
||||
if ( $p_array['action']=="viewhtml") {
|
||||
return ImpHtml($p_array,$p_cn);
|
||||
}
|
||||
echo_error ("IMP no action specified"); return;
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ImpHtml($p_array,$p_cn)
|
||||
{
|
||||
foreach($p_array as $key=>$element) {
|
||||
${"$key"}=$element;
|
||||
echo_debug("ImpHtml $key => $element");
|
||||
}
|
||||
|
||||
|
||||
$colvide="<TD></TD>";
|
||||
// formulaire
|
||||
if ( $type == "form" ) {
|
||||
if ( !isset ($periode)) return NO_PERIOD_SELECTED;
|
||||
$cond=CreatePeriodeCond($periode);
|
||||
$Res=ExecSql($p_cn,"select fo_id ,
|
||||
fo_fr_id,
|
||||
fo_pos,
|
||||
fo_label,
|
||||
fo_formula,
|
||||
fr_label from form
|
||||
inner join formdef on fr_id=fo_fr_id
|
||||
order by fo_pos");
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0) return $ret="";
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
$col=ParseFormula($p_cn,
|
||||
$l_line['fo_label'],
|
||||
$l_line['fo_formula'],$cond);
|
||||
echo "<div>";
|
||||
foreach ($col as $key=> $element) {
|
||||
echo "$element ";
|
||||
}
|
||||
echo "</div>";
|
||||
} //for ($i
|
||||
|
||||
}//form
|
||||
if ($type=="poste") {
|
||||
if ( ! isset ( $poste )) return NO_POST_SELECTED;
|
||||
if ( !isset ($periode)) return NO_PERIOD_SELECTED;
|
||||
include_once("poste.php");
|
||||
$cond=CreatePeriodeCond($periode);
|
||||
$ret="" ;
|
||||
for ( $i =0;$i<count($poste);$i++) {
|
||||
$ret.=sprintf("<H2 class=\"info\">%d %s</H2>",
|
||||
$poste[$i],GetPosteLibelle($p_cn,$poste[$i],1));
|
||||
$ret.="<TABLE border=0 >";
|
||||
list ($array,$tot_deb,$tot_cred)=GetDataPoste($p_cn,$poste[$i],$cond);
|
||||
if ( $array == null) continue;
|
||||
foreach ($array as $col=>$element) {
|
||||
$ret.="<TR>";
|
||||
$ret.=sprintf("<TD>%s</TD>",$element['jr_internal']);
|
||||
$ret.=sprintf("<TD>%s</TD>",$element['j_date']);
|
||||
$ret.=sprintf("<TD>jrn:%s</TD>",$element['jrn_name']);
|
||||
$ret.=sprintf("<TD>%s</TD>",$element['description']);
|
||||
if ( $element['j_debit']=='t') {
|
||||
$ret.=sprintf("<TD> debit</TD><TD ALIGN=\"right\"> % 8.2f</TD>",$element['montant']);
|
||||
} else {
|
||||
$ret.=sprintf("<TD>credit</TD> $colvide <TD ALIGN=\"right\"> % 8.2f</TD>",$element['montant']);
|
||||
|
||||
}
|
||||
$ret.="</TR>";
|
||||
}//foreach
|
||||
$ret.=sprintf("$colvide $colvide $colvide $colvide ".
|
||||
"<TD ALIGN=\"right\">% 8.2f</TD>".
|
||||
"<TD ALIGN=\"right\">% 8.2f</TD>",
|
||||
$tot_deb,
|
||||
$tot_cred);
|
||||
$ret.="</TABLE>";
|
||||
$ret.="Total débit :".$tot_deb." Total Crédit:".$tot_cred;
|
||||
}// for i
|
||||
return $ret;
|
||||
}//poste
|
||||
if ($type=="jrn") {
|
||||
|
||||
echo_debug("imp html journaux");
|
||||
$ret="";
|
||||
if (isset($filter)) {
|
||||
$array=GetDataJrn($p_cn,$p_array,$filter);
|
||||
}
|
||||
$cass="";
|
||||
$c=0;
|
||||
|
||||
foreach ($array as $a=>$e2) {
|
||||
// echo_debug($ret);
|
||||
|
||||
//cassure entre op
|
||||
if ( $cass!=$e2['grp'] ) {
|
||||
$cass=$e2['grp'];
|
||||
$ret.='<TR style="background-color:#89BEFF"><TD>'.$e2['j_date']."</TD>";
|
||||
$ret.="<TD>".$e2['jr_internal']."</TD><TD COLSPAN=4> ".$e2['comment']."</TD></TR>";
|
||||
}
|
||||
$ret.="<TR>";
|
||||
$ret.=$colvide;
|
||||
|
||||
if ($e2['debit']=='f') $ret.=$colvide;
|
||||
$ret.="<TD>".$e2['poste']."</TD>";
|
||||
if ($e2['debit']=='t') $ret.=$colvide;
|
||||
$ret.="<TD>".$e2['description']."</TD>";
|
||||
if ($e2['debit']=='f') $ret.=$colvide;
|
||||
$ret.="<TD>".$e2['montant']."</TD>";
|
||||
if ($e2['debit']=='t') $ret.=$colvide;
|
||||
$ret.="</TR>";
|
||||
}
|
||||
echo_debug($ret);
|
||||
|
||||
return $ret ;
|
||||
}//jrn
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetDataPoste($p_cn,$p_poste,$p_condition)
|
||||
{
|
||||
$Res=ExecSql($p_cn,"select to_char(j_date,'DD.MM.YYYY') as j_date,".
|
||||
"to_char(j_montant,'999999999.99') as montant,".
|
||||
" j_text as description,jrn_def_name as jrn_name,".
|
||||
"j_debit, jr_internal, ".
|
||||
" case when j_debit='t' then 'debit' else 'credit' end as debit".
|
||||
" from jrnx left join jrn_def on jrn_def_id=j_jrn_def ".
|
||||
" left join jrn on jr_grpt_id=j_grpt".
|
||||
" where j_poste=".$p_poste." and ".$p_condition.
|
||||
" order by j_date");
|
||||
$array=array();
|
||||
$tot_cred=0;
|
||||
$tot_deb=0;
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max == 0 ) return null;
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$array[]=pg_fetch_array($Res,$i);
|
||||
if ($array[$i]['j_debit']=='t') {
|
||||
$tot_deb+=$array[$i]['montant'] ;
|
||||
} else {
|
||||
$tot_cred+=$array[$i]['montant'] ;
|
||||
}
|
||||
}
|
||||
return array($array,$tot_deb,$tot_cred);
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetDataJrn($p_cn,$p_array,$filter=YES)
|
||||
{
|
||||
if ( !isset ($p_array['periode']) ) return NO_PERIOD_SELECTED;
|
||||
$cond=CreatePeriodeCond($p_array['periode']);
|
||||
if ( $filter==YES) {
|
||||
$Res=ExecSql($p_cn,"select to_char(j_date,'DD.MM.YYYY') as j_date,
|
||||
j_montant as montant,j_debit as debit,j_poste as poste,".
|
||||
"j_text as description,j_grpt as grp,jr_comment as comment,
|
||||
j_rapt as oc,jr_internal from jrnx left join jrn on ".
|
||||
"jr_grpt_id=j_grpt where j_jrn_def=".$p_array['p_id'].
|
||||
" and ".$cond." order by j_date,j_grpt,j_debit desc");
|
||||
}
|
||||
if ( $filter == NO) {
|
||||
if ( $p_array['central']=='no') {
|
||||
$Res=ExecSql($p_cn,"select to_char(j_date,'DD.MM.YYYY') as j_date,
|
||||
j_montant as montant,j_debit as debit,j_poste as poste,".
|
||||
"j_text as description,j_grpt as grp,jr_comment as comment,
|
||||
j_rapt as oc,jr_internal from jrnx left join jrn on ".
|
||||
"jr_grpt_id=j_grpt where ".
|
||||
$cond." order by j_date,j_grpt,j_debit desc");
|
||||
} else {
|
||||
$cond=CreatePeriodeCond($p_array['periode'],"c_periode");
|
||||
|
||||
$Res=ExecSql($p_cn,"select to_char(c_date,'DD.MM.YYYY') as j_date,
|
||||
c_montant as montant,c_debit as debit,c_poste as poste,".
|
||||
"c_description as description,c_grp as grp,c_comment as comment,
|
||||
c_rapt as oc,c_internal from centralized left join jrn on ".
|
||||
"jr_grpt_id=c_grp where ".
|
||||
$cond." order by c_id,c_date,c_grp,c_debit desc");
|
||||
|
||||
}
|
||||
}// filter == no
|
||||
$array=array();
|
||||
$Max=pg_NumRows($Res);
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$array[]=pg_fetch_array($Res,$i);
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function CreatePeriodeCond($p_periode,$p_field=" j_tech_per") {
|
||||
$cond_periode=" $p_field in (";
|
||||
|
||||
// condition periode
|
||||
foreach ( $p_periode as $per) {
|
||||
$cond_periode.=$per.",";
|
||||
}
|
||||
$cond_periode=substr($cond_periode,0,strlen($cond_periode)-1);
|
||||
$cond_periode.=")";
|
||||
return $cond_periode;
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetDataJrnPdf($p_cn,$p_array,$p_limit,$p_offset)
|
||||
{
|
||||
if ( !isset ($p_array['periode']) ) return NO_PERIOD_SELECTED;
|
||||
|
||||
if ( $p_array['filter']==YES) {
|
||||
$cond=CreatePeriodeCond($p_array['periode']);
|
||||
$Res=ExecSql($p_cn,"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,".
|
||||
"j_text as description,j_grpt as grp,jr_comment as comment,
|
||||
j_rapt as oc, j_tech_per as periode from jrnx left join jrn on ".
|
||||
"jr_grpt_id=j_grpt where j_jrn_def=".$p_array['p_id'].
|
||||
" and ".$cond." order by j_id,j_date,j_grpt,j_debit desc".
|
||||
" limit ".$p_limit." offset ".$p_offset);
|
||||
} else {
|
||||
if ( $p_array['central']=='no' ) {
|
||||
$cond=CreatePeriodeCond($p_array['periode']);
|
||||
$Res=ExecSql($p_cn,"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,".
|
||||
"j_text as description,j_grpt as grp,jr_comment as comment,
|
||||
j_rapt as oc, j_tech_per as periode from jrnx left join jrn on ".
|
||||
"jr_grpt_id=j_grpt where ".
|
||||
" ".$cond." order by j_date,j_grpt,j_debit desc".
|
||||
" limit ".$p_limit." offset ".$p_offset);
|
||||
|
||||
} else {
|
||||
$cond=CreatePeriodeCond($p_array['periode'],"c_periode");
|
||||
$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 j_poste,
|
||||
c_description as description,
|
||||
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 where ".
|
||||
$cond." order by c_id ";
|
||||
$Res=ExecSql($p_cn,$Sql." limit ".$p_limit." offset ".$p_offset);
|
||||
} // 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']):"";
|
||||
$tot_deb+=$line['deb_montant'];
|
||||
$tot_cred+=$line['cred_montant'];
|
||||
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'=>$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("Total debit $tot_deb,credit $tot_cred");
|
||||
$a=array($array,$tot_deb,$tot_cred);
|
||||
return $a;
|
||||
}
|
||||
function GetDataGrpt($p_cn,$p_array)
|
||||
{
|
||||
if ( !isset ($p_array['periode']) ) return NO_PERIOD_SELECTED;
|
||||
$cond=CreatePeriodeCond($p_array['periode']);
|
||||
$Res=ExecSql($p_cn,"select distinct ".
|
||||
" j_grpt as grp".
|
||||
" from jrnx ".
|
||||
" where j_jrn_def=".$p_array['p_id'].
|
||||
" and ".$cond." order by j_grpt");
|
||||
$array=array();
|
||||
$Max=pg_NumRows($Res);
|
||||
$case="";
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$array[]=pg_fetch_array($Res,$i);
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
/* function GetRappel
|
||||
* Purpose : Get the amount on each page
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn
|
||||
* - $p_jrnx_id jrnx.j_id
|
||||
* - $p_jrn_id jrn.jr_id
|
||||
* - $which LAST or FIRST
|
||||
* - $p_type valeur JRN GL-CENTRAL GL-NOCENTRAL
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* - array sum (deb) sum(cred)
|
||||
*
|
||||
*/
|
||||
|
||||
function GetRappel($p_cn,$p_jrnx_id,$p_jrn_id,$p_exercice,$which,$p_type)
|
||||
{
|
||||
include_once("preference.php");
|
||||
|
||||
if ( $which == LAST)
|
||||
$cmp="<=";
|
||||
else
|
||||
$cmp="<";
|
||||
|
||||
if ( $p_type == 'JRN' ) {
|
||||
$c_line=CountSql($p_cn,"select * from jrnx left join parm_periode on j_tech_per=p_id ".
|
||||
"where j_jrn_def=$p_jrn_id and p_exercice='".$p_exercice."'".
|
||||
" and j_id $cmp $p_jrnx_id ");
|
||||
|
||||
if ($c_line == 0 ) { return array (0,0); }
|
||||
$sql="select sum(j_montant) as tot_amount ".
|
||||
" from jrnx ".
|
||||
" left join parm_periode on j_tech_per=p_id ".
|
||||
" where j_jrn_def=$p_jrn_id and ".
|
||||
" p_exercice='".$p_exercice."'".
|
||||
" and j_id $cmp $p_jrnx_id " ;
|
||||
$Res=ExecSql($p_cn,$sql." and j_debit='t' ");
|
||||
if ( pg_NumRows($Res) == 0 )
|
||||
$deb=0;
|
||||
else {
|
||||
$line=pg_fetch_array($Res,0);
|
||||
$deb=$line['tot_amount'];
|
||||
}
|
||||
|
||||
$Res=ExecSql($p_cn,$sql." and j_debit='f' ");
|
||||
if ( pg_NumRows($Res) == 0 )
|
||||
$cred=0;
|
||||
else {
|
||||
|
||||
$line=pg_fetch_array($Res,0);
|
||||
$cred=$line['tot_amount'];
|
||||
}
|
||||
echo_debug("MONTANT $deb,$cred");
|
||||
$a=array($deb,$cred);
|
||||
return $a;
|
||||
}
|
||||
if ($p_type=='GL-CENTRAL') { // Si Grand Livre, prendre donnée centralisée{
|
||||
$c_line=CountSql($p_cn,"select * from centralized left join parm_periode on c_periode=p_id ".
|
||||
"where p_exercice='".$p_exercice."'".
|
||||
" and c_id $cmp $p_jrnx_id ");
|
||||
|
||||
if ($c_line == 0 ) { return array (0,0); }
|
||||
$sql="select sum(c_montant) as tot_amount ".
|
||||
" from centralized ".
|
||||
" left join parm_periode on c_periode=p_id ".
|
||||
" where ".
|
||||
" p_exercice='".$p_exercice."'".
|
||||
" and c_id $cmp $p_jrnx_id " ;
|
||||
$Res=ExecSql($p_cn,$sql." and c_debit='t' ");
|
||||
if ( pg_NumRows($Res) == 0 )
|
||||
$deb=0;
|
||||
else {
|
||||
$line=pg_fetch_array($Res,0);
|
||||
$deb=$line['tot_amount'];
|
||||
}
|
||||
|
||||
$Res=ExecSql($p_cn,$sql." and c_debit='f' ");
|
||||
if ( pg_NumRows($Res) == 0 )
|
||||
$cred=0;
|
||||
else {
|
||||
|
||||
$line=pg_fetch_array($Res,0);
|
||||
$cred=$line['tot_amount'];
|
||||
}
|
||||
echo_debug("MONTANT $deb,$cred");
|
||||
$a=array($deb,$cred);
|
||||
return $a;
|
||||
}
|
||||
if ($p_type=='GL-NOCENTRAL') { // Si Grand Livre, prendre donnée non centralisée{
|
||||
return array(0,0);
|
||||
}
|
||||
|
||||
}
|
||||
/* function ParseFormula
|
||||
* Purpose : Parse the formula contained in the fo_formula
|
||||
* field and return a array containing all the columns
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $p_label
|
||||
* - $p_formula
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - array
|
||||
*
|
||||
*/
|
||||
function ParseFormula($p_cn,$p_label,$p_formula,$p_cond)
|
||||
{
|
||||
$aret=array();
|
||||
$l_debit=0;
|
||||
$l_credit=0;
|
||||
// somme debit
|
||||
$Res=ExecSql($p_cn,"select sum (j_montant) as montant from
|
||||
jrnx where $p_cond and j_debit='t' and j_poste like '$p_formula'");
|
||||
if (pg_NumRows($Res)==0){
|
||||
$l_debit=0;
|
||||
} else {
|
||||
$l=pg_fetch_array($Res,0);
|
||||
$l_debit=$l['montant'];
|
||||
}
|
||||
// somme credit
|
||||
$Res=ExecSql($p_cn,"select sum (j_montant) as montant from
|
||||
jrnx where $p_cond and j_debit='f' and j_poste like '$p_formula'");
|
||||
if (pg_NumRows($Res)==0) {
|
||||
$l_credit=0;
|
||||
} else {
|
||||
$l=pg_fetch_array($Res,0);
|
||||
$l_credit=$l['montant'];
|
||||
}
|
||||
|
||||
if ( $l_credit==$l_debit) {
|
||||
$aret=array('desc' => $p_label,
|
||||
'montant' => '0');
|
||||
}
|
||||
if ( $l_credit < $l_debit) {
|
||||
$l2=sprintf("% .2f",$l_debit-$l_credit);
|
||||
$aret=array('desc' => $p_label,
|
||||
'montant' => $l2);
|
||||
}
|
||||
if ( $l_credit>$l_debit) {
|
||||
$l2=sprintf("(% .2f)",$l_credit-$l_debit);
|
||||
$aret=array('desc' => $p_label,
|
||||
'montant' => $l2);
|
||||
|
||||
}
|
||||
return $aret;
|
||||
}
|
||||
?>
|
||||
1072
include/jrn.php
Normal file
1072
include/jrn.php
Normal file
File diff suppressed because it is too large
Load diff
102
include/poste.php
Normal file
102
include/poste.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* $Revision$ */
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetPosteLibelle($p_dossier,$p_id,$is_cn=0)
|
||||
{
|
||||
include_once("postgres.php");
|
||||
if ( ! isset($is_cn) ) $is_cn=0;
|
||||
if ( $is_cn == 0) {
|
||||
$l_dossier=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($l_dossier);
|
||||
} else {
|
||||
$cn=$p_dossier;
|
||||
}
|
||||
$Res=ExecSql($cn,"select pcm_lib from tmp_pcmn where pcm_val=$p_id");
|
||||
if ( pg_NumRows($Res) == 0) { return "non existing poste";}
|
||||
$l_poste=pg_fetch_row($Res,0);
|
||||
return $l_poste[0];
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function GetNumberLine($p_dossier,$p_jrn)
|
||||
{
|
||||
$l_dossier=sprintf("dossier%d",$p_jrn);
|
||||
$cn=DbConnect($l_dossier);
|
||||
$Res=ExecSql($cn,"select jrn_deb_max_line,jrn_cred_max_line from jrn_def where jrn_def_id=$p_jrn");
|
||||
if ( pg_NumRows($Res) == 0 ) {
|
||||
echo "<H2 class=\"warning\"> Journal non trouvé </H2>";
|
||||
// return (3,3);
|
||||
}
|
||||
$l_line=pg_fetch_array($Res,0);
|
||||
$l_deb=$l_line['jrn_deb_max_line'];
|
||||
$l_cred=$l_line['jrn_cred_max_line'];
|
||||
// return ($l_deb,$l_cred);
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function PosteForm($p_cn) {
|
||||
$Res=ExecSql($p_cn,"select pcm_val,pcm_lib from tmp_pcmn order by pcm_val::text");
|
||||
$Max=pg_NumRows($Res);
|
||||
if ($Max==0) return null;
|
||||
$ret='<SELECT NAME="poste[]" SIZE="15" MULTIPLE>';
|
||||
for ( $i = 0;$i< $Max;$i++) {
|
||||
$line=pg_fetch_array($Res,$i);
|
||||
$ret.=sprintf('<OPTION VALUE="%s" > %s - %s',
|
||||
$line['pcm_val'],
|
||||
$line['pcm_val'],
|
||||
$line['pcm_lib']);
|
||||
}//for
|
||||
$ret.="</SELECT>";
|
||||
return $ret;
|
||||
}
|
||||
?>
|
||||
354
include/postgres.php
Normal file
354
include/postgres.php
Normal file
|
|
@ -0,0 +1,354 @@
|
|||
<? //$Revision$
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//$Revision$
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
|
||||
/*++
|
||||
* function : CheckUser
|
||||
* Parameter : none
|
||||
* return : not use
|
||||
* Description :
|
||||
* Check if user is active and exists in the
|
||||
* repository
|
||||
* Automatically redirect
|
||||
*
|
||||
++*/
|
||||
function CheckUser()
|
||||
{
|
||||
global $user,$pass,$IsValid;
|
||||
echo_debug("CheckUser");
|
||||
$res=0;
|
||||
$pass5=md5($pass);
|
||||
if ( $IsValid == 1 ) { return; }
|
||||
$cn=pg_connect("dbname=account_repository host=127.0.0.1 user='webcompta'");
|
||||
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='$user'
|
||||
and ac_users.use_active=1
|
||||
and ac_users.use_pass='$pass5'";
|
||||
echo_debug("Sql = $sql");
|
||||
$ret=pg_exec($cn,$sql);
|
||||
$res=pg_NumRows($ret);
|
||||
echo_debug("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 $IsValid=1;
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
/*++
|
||||
* function : ShowDossier
|
||||
* Parameter : p_type string : all for all dossiers lim for only the
|
||||
* dossier where we've got rights
|
||||
* Return : nothing
|
||||
* Description :
|
||||
* Show the folder where user have access
|
||||
++*/
|
||||
function ShowDossier($p_type,$p_first=0,$p_max=10,$p_Num=0) {
|
||||
global $user;
|
||||
if ( $p_max == 0 ) {
|
||||
$l_step="";
|
||||
} else {
|
||||
$l_step="LIMIT $p_max OFFSET $p_first";
|
||||
}
|
||||
$cn=DbConnect();
|
||||
if ( $p_type == "all") {
|
||||
$l_sql="select *, 'W' as priv_priv from ac_dossier ORDER BY dos_name ";
|
||||
$p_Num=CountSql($cn,$l_sql);
|
||||
} else {
|
||||
$l_sql="select * from jnt_use_dos
|
||||
natural join ac_dossier
|
||||
natural join ac_users
|
||||
inner join priv_user on priv_jnt=jnt_id where
|
||||
use_login='".$user."' and priv_priv !='NO'
|
||||
order by dos_name ";
|
||||
$p_Num=CountSql($cn,$l_sql);
|
||||
}
|
||||
$l_sql=$l_sql.$l_step;
|
||||
$p_res=ExecSql($cn,$l_sql);
|
||||
|
||||
echo_debug("ShowDossier:".$p_res." Line = $p_Num");
|
||||
|
||||
$Max=pg_NumRows($p_res);
|
||||
if ( $Max == 0 ) return null;
|
||||
for ( $i=0;$i<$Max; $i++) {
|
||||
// echo_debug ("i = $i");
|
||||
$row[]=pg_fetch_array($p_res,$i);
|
||||
//echo $row[dossier];
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
/*++
|
||||
* function : CheckAccess
|
||||
* Parameter : $p_right (user or admin)
|
||||
* $p_database (name of the database)
|
||||
* Return : 1 if ok
|
||||
* Description :
|
||||
* Check user's access right to the given database
|
||||
++*/
|
||||
function CheckAccess($p_right,$p_database)
|
||||
{
|
||||
// global $user,$pass;
|
||||
// echo "User is $user";
|
||||
// $cn=pg_connect("host=127.0.0.1 dbname=$p_database user='webcompta' ");
|
||||
// $ret=pg_exec($cn,"select name from ac_dossier where name='$user' and dossier='$p_database' and priv='$p_right'");
|
||||
// if ( pg_NumRows($ret) == 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>
|
||||
// You haven't the right to connect
|
||||
// </FONT></BLINK></P>";
|
||||
// session_unset();
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// return $ret;
|
||||
|
||||
}
|
||||
// Check if the user has admin right
|
||||
// to be complete
|
||||
function CheckAdmin() {
|
||||
global $user,$pass;
|
||||
$res=0;
|
||||
|
||||
if ( $user != 'webcompta') {
|
||||
$pass5=md5($pass);
|
||||
$sql="select use_id from ac_users where use_login='$user'
|
||||
and use_active=1 and use_admin=1 and use_pass='$pass5'";
|
||||
|
||||
$cn=DbConnect();
|
||||
|
||||
$isAdmin=CountSql($cn,$sql);
|
||||
} else $isAdmin=1;
|
||||
|
||||
return $isAdmin;
|
||||
}
|
||||
function DbConnect($p_db="account_repository") {
|
||||
$a=pg_connect("dbname=$p_db host=127.0.0.1 user='webcompta'");
|
||||
echo_debug ("connect to $p_db");
|
||||
return $a;
|
||||
}
|
||||
function ExecSql($p_connection, $p_string) {
|
||||
echo_debug("SQL = $p_string");
|
||||
$ret=pg_exec($p_connection,$p_string);
|
||||
if ( $ret == false ) { echo_error ("SQL ERROR ::: $p_string");}
|
||||
return $ret;
|
||||
}
|
||||
/*
|
||||
* GetAllUser
|
||||
* Return all the users
|
||||
* as an array
|
||||
*/
|
||||
function GetAllUser() {
|
||||
echo_debug("GetUser");
|
||||
$cn=DbConnect();
|
||||
$sql="select * from ac_users where use_login!='webcompta'";
|
||||
echo_debug("ExecSql");
|
||||
$Res=ExecSql($cn,$sql);
|
||||
$Num=pg_NumRows($Res);
|
||||
if ( $Num == 0 ) return null;
|
||||
for ($i=0;$i < $Num; $i++) {
|
||||
$User[]=pg_fetch_array($Res,$i);
|
||||
}
|
||||
return $User;
|
||||
}
|
||||
/* GetUid
|
||||
* Check if the User is valid
|
||||
* and return an array with his property
|
||||
*/
|
||||
function GetUid($p_uid) {
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSql($cn,"select * from ac_users where use_id=".$p_uid);
|
||||
$Num=pg_NumRows($Res);
|
||||
if ( $Num == 0 ) { return false; }
|
||||
for ($i=0;$i < $Num; $i++) {
|
||||
$Prop[]=pg_fetch_array($Res,$i);
|
||||
}
|
||||
return $Prop;
|
||||
}
|
||||
/*
|
||||
* GetPriv
|
||||
* Get the privilege of an user on a folder
|
||||
*/
|
||||
function GetPriv($p_dossier,$p_login)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSql($cn,"select priv_priv
|
||||
from priv_user left join jnt_use_dos on jnt_id=priv_jnt
|
||||
inner join ac_users on ac_users.use_id=jnt_use_dos.use_id
|
||||
where use_login='$p_login' and dos_id=$p_dossier");
|
||||
$Num=pg_NumRows($Res);
|
||||
echo_debug("Found ".$Num." rows in GetPriv");
|
||||
if ( $Num==0) { return 0;}
|
||||
for($i=0;$i < $Num;$i++) {
|
||||
$Right=pg_fetch_array($Res,$i);
|
||||
$Priv[]=$Right['priv_priv'];
|
||||
}
|
||||
return $Priv;
|
||||
}
|
||||
/* ExisteJnt
|
||||
* Get the number of rows
|
||||
* from table jnt_use_dos where $p_dossier = dos_id and
|
||||
* use_id=$p_user
|
||||
*/
|
||||
function ExisteJnt($p_dossier,$p_user)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSql($cn,"select * from jnt_use_dos where dos_id=".$p_dossier." and use_id=".$p_user);
|
||||
return pg_NumRows($Res);
|
||||
}
|
||||
/* ExistePriv
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function ExistePriv($p_jntid)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSql($cn,"select * from priv_user where priv_jnt=".$p_jntid);
|
||||
return pg_NumRows($Res);
|
||||
}
|
||||
/* GetJnt
|
||||
* Get the jnt
|
||||
*
|
||||
*
|
||||
*/
|
||||
function GetJnt($p_dossier,$p_user)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSql($cn,"select jnt_id from jnt_use_dos where dos_id=".$p_dossier." and use_id=".$p_user);
|
||||
$R=pg_fetch_array($Res,0);
|
||||
return $R['jnt_id'];
|
||||
}
|
||||
/* GetDbId
|
||||
* Get the dos_id of a dossier
|
||||
* parm: name of the folder
|
||||
*/
|
||||
function GetDbId($p_name)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$r_sql=ExecSql($cn,"select dos_id from ac_dossier
|
||||
where dos_name='".$p_name."'");
|
||||
$num=pg_NumRows($r_sql);
|
||||
if ( $num == 0 ) {
|
||||
return 0;
|
||||
} else {
|
||||
$l_db=pg_fetch_array($r_sql,0);
|
||||
return $l_db['dos_id'];
|
||||
}
|
||||
|
||||
}
|
||||
/* CountSql
|
||||
* Count the number of row
|
||||
*
|
||||
* parm: p_conn connection handler
|
||||
* p_sql sql string
|
||||
*/
|
||||
|
||||
function CountSql($p_conn,$p_sql)
|
||||
{
|
||||
$r_sql=ExecSql($p_conn,$p_sql);
|
||||
return pg_NumRows($r_sql);
|
||||
|
||||
}
|
||||
/* GetDossierName
|
||||
* Param: id of a dossier
|
||||
* return : Name of the dossier
|
||||
*/
|
||||
function GetDossierName($p_dossier)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$Ret=ExecSql($cn,"select dos_name from ac_dossier where dos_id=".$p_dossier);
|
||||
$r= pg_fetch_array($Ret,0);
|
||||
return $r['dos_name'];
|
||||
}
|
||||
/* GetSequence
|
||||
* get the current sequence
|
||||
*/
|
||||
function GetSequence($p_cn,$p_seq)
|
||||
{
|
||||
$Res=ExecSql($p_cn,"select currval('$p_seq') as seq");
|
||||
$seq=pg_fetch_array($Res,0);
|
||||
return $seq['seq'];
|
||||
}
|
||||
function StartSql($p_cn) {
|
||||
$Res=ExecSql($p_cn,"start transaction");
|
||||
}
|
||||
function EndSql($p_cn) {
|
||||
$Res=ExecSql($p_cn,"end transaction");
|
||||
}
|
||||
function Commit($p_cn) {
|
||||
$Res=ExecSql($p_cn,"commit");
|
||||
}
|
||||
function Rollback($p_cn) {
|
||||
$Res=ExecSql($p_cn,"rollback");
|
||||
}
|
||||
function AlterSequence($p_cn,$p_name,$p_value) {
|
||||
|
||||
$Res=ExecSql($p_cn,"drop sequence $p_name");
|
||||
$Res=ExecSql($p_cn,"create sequence $p_name start $p_value");
|
||||
}
|
||||
function GetLogin($p_uid)
|
||||
{
|
||||
$cn=DbConnect();
|
||||
$Res=ExecSql($cn,"select use_login from ac_users where use_id=$p_uid");
|
||||
if ( pg_NumRows($Res) == 0 ) return null;
|
||||
$a_login=pg_fetch_array($Res,0);
|
||||
return $a_login['use_login'];
|
||||
}
|
||||
|
||||
/* function SyncRight
|
||||
* Purpose : Synchronize les droits par défaut
|
||||
* avec les journaux existants
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function SyncRight($p_dossier,$p_user) {
|
||||
$priv=GetPriv($p_dossier,$p_user);
|
||||
$right=$priv[0];
|
||||
$ldb=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($ldb);
|
||||
|
||||
$sql="insert into user_sec_jrn(uj_login,uj_jrn_id,uj_priv) ".
|
||||
"select '".$p_user."',jrn_def_id,'".$right."' from jrn_def ".
|
||||
"where jrn_def_id not in ".
|
||||
"(select uj_jrn_id from user_sec_jrn where uj_login='".$p_user."')";
|
||||
$Res=ExecSql($cn,$sql);
|
||||
}
|
||||
?>
|
||||
350
include/preference.php
Normal file
350
include/preference.php
Normal file
|
|
@ -0,0 +1,350 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* $Revision$ */
|
||||
|
||||
/* function FormPeriodeMult
|
||||
* Purpose :
|
||||
* Generate the form for the periode
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - string containing html code for the
|
||||
* form
|
||||
*
|
||||
*/
|
||||
function FormPeriodeMult($p_cn)
|
||||
{
|
||||
$sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start,
|
||||
to_char(p_end,'DD.MM.YYYY') as p_end
|
||||
from parm_periode
|
||||
order by p_start";
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
$ret='<SELECT NAME="periode[]" SIZE="12" multiple>';
|
||||
for ( $i = 0; $i < $Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
$ret.=sprintf('<OPTION VALUE="%s">%s - %s',$l_line['p_id']
|
||||
,$l_line['p_start']
|
||||
,$l_line['p_end']);
|
||||
|
||||
}
|
||||
$ret.="</SELECT>";
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/* function FormPeriode
|
||||
* Purpose :
|
||||
* Generate the form for the periode
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $p_default default periode
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - string containing html code for the
|
||||
* form
|
||||
*
|
||||
*/
|
||||
function FormPeriode($p_cn,$l_default=0,$p_type=OPEN)
|
||||
{
|
||||
|
||||
if ($p_type==CLOSED) {
|
||||
$sql_closed="p_closed=true";
|
||||
$sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start,
|
||||
to_char(p_end,'DD.MM.YYYY') as p_end
|
||||
from parm_periode where
|
||||
$sql_closed order by p_start";
|
||||
|
||||
}
|
||||
if ($p_type==OPEN) {
|
||||
$sql_closed="p_closed=false";
|
||||
$sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start,
|
||||
to_char(p_end,'DD.MM.YYYY') as p_end
|
||||
from parm_periode where
|
||||
$sql_closed order by p_start";
|
||||
|
||||
}
|
||||
if ($p_type==NOTCENTRALIZED) {
|
||||
$sql="select p_id,to_char(p_start,'DD.MM.YYYY') as p_start,
|
||||
to_char(p_end,'DD.MM.YYYY') as p_end
|
||||
from parm_periode where
|
||||
p_closed=true and p_id not in (
|
||||
select c_periode from centralized)
|
||||
order by p_start";
|
||||
}
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
$Max=pg_NumRows($Res);
|
||||
if ( $Max == 0 ) return null;
|
||||
$ret='<SELECT NAME="periode">';
|
||||
for ( $i = 0; $i < $Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
if ( $l_default == $l_line['p_id'] )
|
||||
$sel="SELECTED";
|
||||
else
|
||||
$sel="";
|
||||
|
||||
$ret.=sprintf('<OPTION VALUE="%s" %s>%s - %s',$l_line['p_id']
|
||||
,$sel
|
||||
,$l_line['p_start']
|
||||
,$l_line['p_end']);
|
||||
|
||||
}
|
||||
$ret.="</SELECT>";
|
||||
return $ret;
|
||||
}
|
||||
/* function SetUserPeriode
|
||||
* Purpose : Set the selected periode in the user's preferences
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $p_periode
|
||||
* - $p_user
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function SetUserPeriode($p_cn,$p_periode,$p_user) {
|
||||
$sql="update user_pref set pref_periode=$p_periode where pref_user='$p_user'";
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
}
|
||||
/* function GetUserPeriode
|
||||
* Purpose : Get the default periode from the user's preferences
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $p_user
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - the default periode
|
||||
*
|
||||
*/
|
||||
|
||||
function GetUserPeriode($p_cn,$p_user) {
|
||||
$array=GetUserPreferences($p_cn,$p_user);
|
||||
return $array['active_periode'];
|
||||
}
|
||||
/* function SetUserPreferences
|
||||
* Purpose : Get the default user's preferences
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connexion
|
||||
* - $p_user
|
||||
* gen :
|
||||
* - none
|
||||
* return:
|
||||
* - none
|
||||
*
|
||||
*/
|
||||
function GetUserPreferences ($p_cn,$p_user)
|
||||
{
|
||||
// si preference n'existe pas, les créer
|
||||
$sql="select pref_periode as active_periode from user_pref where pref_user='".$p_user."'";
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
if (pg_NumRows($Res) == 0 ) {
|
||||
$sql=sprintf("insert into user_pref (pref_periode,pref_user) values
|
||||
( %d , '%s')" ,
|
||||
1, $p_user);
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
|
||||
$l_array=GetUserPreferences($p_cn,$p_user);
|
||||
} else {
|
||||
$l_array= pg_fetch_array($Res,0);
|
||||
}
|
||||
return $l_array;
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* - array containing the start date & the end date
|
||||
*
|
||||
*/
|
||||
function GetPeriode($p_cn,$p_periode)
|
||||
{
|
||||
$sql="select to_char(p_start,'DD.MM.YYYY') as p_start,
|
||||
to_char(p_end,'DD.MM.YYYY') as p_end
|
||||
from parm_periode
|
||||
where p_id=".$p_periode;
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
if ( pg_NumRows($Res) == 0) return null;
|
||||
return pg_fetch_array($Res,0);
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* - array containing the start date & the end date
|
||||
*
|
||||
*/
|
||||
function PeriodeClosed($p_cn,$p_periode)
|
||||
{
|
||||
$sql="select p_closed
|
||||
from parm_periode
|
||||
where p_id=".$p_periode;
|
||||
$Res=ExecSql($p_cn,$sql);
|
||||
if ( pg_NumRows($Res) == 0) return null;
|
||||
$l_line=pg_fetch_array($Res,0);
|
||||
return $l_line['p_closed'];
|
||||
|
||||
}
|
||||
/* function GetExercice
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* - $p_cn connection
|
||||
* - $p_periode periode
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* - Exercice of the periode
|
||||
*
|
||||
*/
|
||||
function GetExercice($p_cn,$p_periode)
|
||||
{
|
||||
$Res=ExecSql($p_cn,"select p_exercice from parm_periode".
|
||||
" where p_id=$p_periode");
|
||||
$line=pg_fetch_array($Res,0);
|
||||
return $line['p_exercice'];
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowDevise($p_cn)
|
||||
{
|
||||
echo "<h2 class=\"info\"> Devises </H2>";
|
||||
echo '<TABLE ALIGN="CENTER">';
|
||||
echo "<TR>";
|
||||
echo '<TH> CODE </TH>';
|
||||
echo '<TH> Valeur <BR>(par rapport à l\'euro) </TH>';
|
||||
echo "</TR>";
|
||||
|
||||
$Res=ExecSql($p_cn,"select pm_id,pm_code,pm_rate from parm_money order by pm_code");
|
||||
$Max=pg_NumRows($Res);
|
||||
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
echo '<TR>';
|
||||
echo '<TD>'.$l_line['pm_code'].'</TD>';
|
||||
$l_rate=sprintf("% 10.6f",$l_line['pm_rate']);
|
||||
echo '<TD ALIGN="RIGHT">'.$l_rate.'</TD>';
|
||||
echo "<TD class=\"mtitle\"> <A class=\"mtitle\" HREF=\"dossier_prefs.php?p_mid=$l_line[pm_id]&p_action=change&p_code=$l_line[pm_code]&p_rate=$l_line[pm_rate]\">Change</A></TD>";
|
||||
echo "<TD class=\"mtitle\"> <A class=\"mtitle\" HREF=\"dossier_prefs.php?p_mid=$l_line[pm_id]&p_action=delete&p_code=$l_line[pm_code]\">Efface</A></TD>";
|
||||
echo '</TR>';
|
||||
|
||||
}
|
||||
echo '<TR> <FORM ACTION="dossier_prefs.php" METHOD="POST">';
|
||||
echo '<TD> <INPUT TYPE="text" NAME="p_devise"></TD>';
|
||||
echo '<TD> <INPUT TYPE="text" NAME="p_rate"></TD>';
|
||||
echo '<TD> <INPUT TYPE="SUBMIT" NAME="action" Value="Ajout"</TD>';
|
||||
echo '</FORM></TR>';
|
||||
echo '</TABLE>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowPeriode($p_cn)
|
||||
{
|
||||
echo "<h2 class=\"info\"> Période </H2>";
|
||||
$Res=ExecSql($p_cn,"select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,p_closed,p_exercice
|
||||
from parm_periode order by p_start");
|
||||
$Max=pg_NumRows($Res);
|
||||
echo '<TABLE ALIGN="CENTER" WIDTH="90%">';
|
||||
echo "</TR>";
|
||||
echo '<TH> Date début </TH>';
|
||||
echo '<TH> Date début </TH>';
|
||||
echo '<TH> Exercice </TH>';
|
||||
echo "</TR>";
|
||||
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
echo '<TR>';
|
||||
echo '<TD ALIGN="CENTER"> '.$l_line['date_start'].'</TD>';
|
||||
echo '<TD ALIGN="CENTER"> '.$l_line['date_end'].'</TD>';
|
||||
echo '<TD ALIGN="CENTER"> '.$l_line['p_exercice'].'</TD>';
|
||||
echo_debug(" closed : $l_line[p_closed]");
|
||||
if ( $l_line['p_closed'] == 't' ) {
|
||||
$closed='<TD></TD>';
|
||||
$change='<TD></TD>';
|
||||
$remove='<TD></TD>';
|
||||
} else {
|
||||
$closed='<TD class="mtitle">';
|
||||
$closed.='<A class="mtitle" HREF="dossier_prefs.php?p_action=closed&p_per='.$l_line['p_id'].'"> Cloturer</A>';
|
||||
$change='<TD class="mtitle">';
|
||||
$change.='<A class="mtitle" HREF=dossier_prefs.php?p_action=change_per&p_per='.
|
||||
$l_line['p_id']."&p_date_start=".$l_line['date_start'].
|
||||
"&p_date_end=".$l_line['date_end']."&p_exercice=".
|
||||
$l_line['p_exercice']."> Changer</A>";
|
||||
$remove='<TD class="mtitle">';
|
||||
$remove.='<A class="mtitle" HREF=dossier_prefs.php?p_action=delete_per&p_per='.
|
||||
$l_line['p_id']."> Efface</A>";
|
||||
|
||||
}
|
||||
echo "$closed";
|
||||
echo $change;
|
||||
|
||||
echo $remove;
|
||||
|
||||
echo '</TR>';
|
||||
|
||||
}
|
||||
echo '<TR> <FORM ACTION="dossier_prefs.php" METHOD="POST">';
|
||||
echo '<TD> <INPUT TYPE="text" NAME="p_date_start"></TD>';
|
||||
echo '<TD> <INPUT TYPE="text" NAME="p_date_end"></TD>';
|
||||
echo '<TD> <INPUT TYPE="text" NAME="p_exercice"></TD>';
|
||||
echo '<TD> <INPUT TYPE="SUBMIT" NAME="add_per" Value="Ajout"</TD>';
|
||||
echo '</FORM></TR>';
|
||||
|
||||
echo '</TABLE>';
|
||||
}
|
||||
?>
|
||||
578
include/top_menu_compta.php
Normal file
578
include/top_menu_compta.php
Normal file
|
|
@ -0,0 +1,578 @@
|
|||
<?
|
||||
|
||||
/*
|
||||
* This file is part of WCOMPTA.
|
||||
*
|
||||
* WCOMPTA 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.
|
||||
*
|
||||
* WCOMPTA 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 WCOMPTA; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
|
||||
/* $Revision$ */
|
||||
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowMenu($p_check = 1,$p_item="")
|
||||
{
|
||||
/* $p_check == 1 si test sur Admin */
|
||||
include_once("postgres.php");
|
||||
echo '<div class="mtitle">';
|
||||
echo "<TABLE align=center><TR>";
|
||||
if ( $p_check == 1 ) {
|
||||
if ( CheckAdmin() != 0 ) {
|
||||
/* Administrator Menu */
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF=admin_repo.php>Administrator Menu</A></TD>';
|
||||
}
|
||||
}
|
||||
if (strlen ( $p_item ) != 0 ) {
|
||||
echo '<TD class="mtitle">'.$p_item.'</A></TD>';
|
||||
}
|
||||
|
||||
echo ' <TD class="mtitle"> <A class="mtitle" HREF="user_pref.php">Préférence</A></TD>';
|
||||
|
||||
echo "<TD class=\"mtitle\">";
|
||||
html_button_logout();
|
||||
echo "</TD>";
|
||||
echo "</TR></TABLE>";
|
||||
echo "</div>";
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuAdmin($p_dossier)
|
||||
{
|
||||
include_once("postgres.php");
|
||||
$l_name=GetDossierName($p_dossier);
|
||||
echo "<P> <H2 class=\"info\"> $l_name </H2></P>";
|
||||
echo '<div class="tmenu">';
|
||||
echo '<TABLE ALIGN="CENTER"><TR>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=1">Mise à jour Plan Comptable</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="jrn_update.php">Gestion Journaux</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="dossier_prefs.php">Préférences</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="user_sec.php">Sécurité Utilisateur</A></TD>';
|
||||
echo '</TR></TABLE>';
|
||||
echo "</DIV>";
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuCompta($p_dossier)
|
||||
{
|
||||
include_once("postgres.php");
|
||||
$l_name=GetDossierName($p_dossier);
|
||||
echo "<P> <H2 class=\"info\"> $l_name </H2></P>";
|
||||
echo '<div class="tmenu">';
|
||||
echo '<TABLE><TR>';
|
||||
// TODO echo '<TD class="mtitle"><A class="mtitle" HREF="facturation.php">Facturation</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="enc_jrn.php">Encodage Journaux</A></TD>';
|
||||
echo '<TD class="mtitle"<A class="mtitle" HREF="form.php">Formulaire </A> </TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="impress.php">Impression</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="fiche.php">Fiche</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=1">Plan Comptable</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="jrn_update.php">Gestion Journaux</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="central.php">Centralise</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="dossier_prefs.php">Paramètres</A></TD>';
|
||||
echo '<TD class="mtitle"><A class="mtitle" HREF="user_sec.php">Sécurité</A></TD>';
|
||||
|
||||
echo "</TR>";
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowMenuComptaLeft($p_dossier,$p_item)
|
||||
{
|
||||
switch ($p_item) {
|
||||
case MENU_FACT:
|
||||
echo '<div class="lmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="not_implemented.php">Créer une facture</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="facturation.php?action=vue&fact=all">Voir les factures</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="facturation.php?action=vue&fact=impaye">Facture non payées</A></TD></TR>';
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
break;
|
||||
case MENU_FICHE:
|
||||
$l_dossier=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($l_dossier);
|
||||
echo '<div class="lmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD colspan="3" class="mtitle">
|
||||
<A class="mtitle" HREF="fiche.php?action=add_modele&fiche=modele">Creation Modele</A></TD></TR>';
|
||||
$Res=ExecSql($cn,"select fd_id,fd_label from fichedef order by fd_label");
|
||||
$Max=pg_NumRows($Res);
|
||||
for ( $i=0; $i < $Max;$i++) {
|
||||
$l_line=pg_fetch_array($Res,$i);
|
||||
printf('<TR><TD class="cell">%s</TD><TD class="mtitle"><A class="mtitle" HREF="fiche.php?action=vue&fiche=%d">Voir</A>
|
||||
</TD>
|
||||
<TD class="mtitle"><A class="mtitle" HREF="fiche.php?action=modifier&fiche=%d">Modifier</A></TD>
|
||||
</TR>',
|
||||
$l_line['fd_label'],
|
||||
$l_line['fd_id'],
|
||||
$l_line['fd_id']);
|
||||
}
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
break;
|
||||
case MENU_PARAM:
|
||||
$l_dossier=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($l_dossier);
|
||||
echo '<div class="lmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="dossier_prefs.php?p_action=devise">Devises</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="dossier_prefs.php?p_action=periode">Périodes</A></TD></TR>';
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowMenuComptaRight($p_dossier=0,$p_more="")
|
||||
{
|
||||
include_once("ac_common.php");
|
||||
echo '<div class="rmenu">';
|
||||
echo '<TABLE>';
|
||||
if ( CheckAdmin() != 0 && $p_dossier != 0) {
|
||||
echo '<TR><TD class="mtitle"> <A class="mtitle" HREF="admin_repo.php">Admin</A></TD></TR>';
|
||||
}
|
||||
echo '<TR><TD class="mtitle"> <A class="mtitle" HREF="login.php">Accueil</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"> <A class="mtitle" HREF="user_pref.php">Preference</A></TD></TR>';
|
||||
if ( strlen ($p_more) != 0 ) {
|
||||
printf ('<TR><TD class="mtitle"> %s </TD></TR>',$p_more);
|
||||
}
|
||||
echo '<TR><TD class="mtitle"> ';
|
||||
html_button_logout();
|
||||
echo ' </TD></TR>';
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowMenuAdminGlobalRight($p_dossier=0)
|
||||
{
|
||||
include_once("ac_common.php");
|
||||
echo '<div class="rmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD class="mtitle"> <A class="mtitle" HREF="login.php">Accueil</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"> <A class="mtitle" HREF="user_pref.php">Preference</A></TD></TR>';
|
||||
if ( $p_dossier != 0) {
|
||||
printf( '<TR><TD class="mtitle"> <A class="mtitle" HREF="compta.php?dos=%d">Retour Dossier</A></TD></TR>',
|
||||
$p_dossier);
|
||||
}
|
||||
|
||||
echo '<TR><TD class="mtitle"> ';
|
||||
html_button_logout();
|
||||
echo ' </TD></TR>';
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuPcmn($p_start=1)
|
||||
{
|
||||
echo '<div class="lmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=1">1 Immobilisé </A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=2">2 Actif a un an au plus</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=3">3 Stock et commande</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=4">4 Compte tiers</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=5">5 Actif</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=6">6 Charges</A></TD></TR>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="pcmn_update.php?p_start=7">7 Produits</A></TD></TR>';
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuJrn($p_dossier)
|
||||
{
|
||||
echo '<div class="lmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="jrn_add.php">Création Journal </A></TD></TR>';
|
||||
include_once("postgres.php");
|
||||
$l_jrn=sprintf("dossier%d",$p_dossier);
|
||||
$Cn=DbConnect($l_jrn);
|
||||
$Ret=ExecSql($Cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
|
||||
$Max=pg_NumRows($Ret);
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Ret,$i);
|
||||
printf ('<TR><TD class="mtitle"><A class="mtitle" HREF="jrn_detail.php?p_jrn=%s">%s</A></TD></TR>',
|
||||
$l_line['jrn_def_id'],$l_line['jrn_def_name']);
|
||||
|
||||
}
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuJrnUser($p_dossier,$p_user)
|
||||
{
|
||||
echo '<div class="searchmenu">';
|
||||
echo '<TABLE>';
|
||||
|
||||
include_once("postgres.php");
|
||||
$l_jrn=sprintf("dossier%d",$p_dossier);
|
||||
$Cn=DbConnect($l_jrn);
|
||||
if ( CheckAdmin() ==0) {
|
||||
$Ret=ExecSql($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='$p_user'
|
||||
and uj_priv !='X'
|
||||
");
|
||||
} else {
|
||||
$Ret=ExecSql($Cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
|
||||
jrn_type_id,jrn_desc,'W' as uj_priv
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
|
||||
|
||||
}
|
||||
$Max=pg_NumRows($Ret);
|
||||
include_once("check_priv.php");
|
||||
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Ret,$i);
|
||||
// Admin have always rights
|
||||
if ( CheckAdmin() == 0 ){
|
||||
$right=CheckJrn($p_dossier,$p_user,$l_line['jrn_def_id']);
|
||||
}else {
|
||||
$right=3;
|
||||
}
|
||||
|
||||
printf ('<TR><TD class="cell">%s</TD>',$l_line['jrn_def_name']);
|
||||
if ( $right > 0 ) {
|
||||
// Lecture
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="enc_jrn.php?p_jrn=%s&action=view">Voir</A></TD>',
|
||||
$l_line['jrn_def_id']);
|
||||
}
|
||||
// ecriture
|
||||
if ( $right > 1 ) {
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="enc_jrn.php?p_jrn=%s&action=record&max_deb=%s&max_cred=%s">Encoder</A></TD></TR>',
|
||||
$l_line['jrn_def_id'],
|
||||
$l_line['jrn_deb_max_line'],
|
||||
$l_line['jrn_cred_max_line']);
|
||||
}
|
||||
}
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuRecherche($p_dossier,$p_jrn,$p_array=null)
|
||||
{
|
||||
echo_debug("ShowMenuRecherche($p_dossier,$p_jrn,$p_array)");
|
||||
if ( $p_array != null ) {
|
||||
foreach ( $p_array as $key=> $element) {
|
||||
${"p_$key"}=$element;
|
||||
echo_debug("p_$key =$element;");
|
||||
}
|
||||
}
|
||||
$opt='<OPTION VALUE="<="> <=';
|
||||
$opt.='<OPTION VALUE="<"> <';
|
||||
$opt.='<OPTION VALUE="="> =';
|
||||
$opt.='<OPTION VALUE=">"> >';
|
||||
$opt.='<OPTION VALUE=">="> >=';
|
||||
if ( ! isset ($p_date_start)) $p_date_start="";
|
||||
if ( ! isset ($p_date_end)) $p_date_end="";
|
||||
if ( ! isset ($p_mont_sel))$p_mont_sel="";
|
||||
if ( ! isset ($p_s_comment))$p_s_comment="";
|
||||
if ( ! isset ($p_s_montant)) $p_s_montant="";
|
||||
|
||||
if ( $p_mont_sel != "" ) $opt.='<OPTION value="'.$p_mont_sel.'" SELECTED> '.$p_mont_sel;
|
||||
|
||||
echo '<div class="searchmenu">';
|
||||
echo '<div style="border-style:outset;border-width:1pt;">';
|
||||
echo "<B>Recherche</B>";
|
||||
echo '<FORM ACTION="enc_jrn.php" METHOD="POST">';
|
||||
echo '<TABLE>';
|
||||
echo "<TR>";
|
||||
echo '<TD COLSPAN="3"> Date compris entre</TD> ';
|
||||
echo "</TR> <TR>";
|
||||
echo '<TD> <INPUT TYPE="TEXT" NAME="date_start" SIZE="10" VALUE="'.$p_date_start.'"></TD>';
|
||||
echo '<TD> <INPUT TYPE="TEXT" NAME="date_end" size="10" Value="'.$p_date_end.'"></TD>';
|
||||
echo '</TD><TD>';
|
||||
echo "</TR> <TR>";
|
||||
echo "<TD> Montant ";
|
||||
echo ' <SELECT NAME="mont_sel">'.$opt.' </SELECT></TD><TD>';
|
||||
echo ' <INPUT TYPE="TEXT" NAME="s_montant" SIZE="10" VALUE="'.$p_s_montant.'"></TD>';
|
||||
echo "</TR><TR>";
|
||||
echo '<TD colspan="3"> Le commentaire contient </TD>';
|
||||
echo "</TR><TR>";
|
||||
echo '<TD COLSPAN="3"> <INPUT TYPE="TEXT" NAME="s_comment" VALUE="'.$p_s_comment.'"></TD>';
|
||||
echo "</TR><TR>";
|
||||
echo '<TD COLSPAN="3"><INPUT TYPE="SUBMIT" VALUE="Recherche" NAME="viewsearch"></TD>';
|
||||
echo "</TR>";
|
||||
echo "</TABLE>";
|
||||
echo "</FORM>";
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
function ShowMenuComptaForm($p_dossier) {
|
||||
include_once("postgres.php");
|
||||
$l_dossier=sprintf("dossier%d",$p_dossier);
|
||||
$cn=DbConnect($l_dossier);
|
||||
echo '<div class="lmenu">';
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="form.php?action=add">Ajout de formulaire </A></TD></TR>';
|
||||
$l_jrn=sprintf("dossier%d",$p_dossier);
|
||||
$Cn=DbConnect($l_jrn);
|
||||
$Ret=ExecSql($Cn,"select fr_id, fr_label
|
||||
from formdef order by fr_label");
|
||||
$Max=pg_NumRows($Ret);
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Ret,$i);
|
||||
printf ('<TR><TD class="mtitle"><A class="mtitle" HREF="form.php?action=view&fr_id=%s">%s</A></TD></TR>',
|
||||
$l_line['fr_id'],$l_line['fr_label']);
|
||||
|
||||
}
|
||||
echo "</TABLE>";
|
||||
echo '</div>';
|
||||
}
|
||||
/* function
|
||||
* Purpose :
|
||||
*
|
||||
* parm :
|
||||
* -
|
||||
* gen :
|
||||
* -
|
||||
* return:
|
||||
* -
|
||||
*
|
||||
*/
|
||||
|
||||
function ShowMenuJrnUserImp($p_cn,$p_user,$p_dossier)
|
||||
{
|
||||
echo '<div class="lmenu">';
|
||||
include_once("preference.php");
|
||||
echo '<TABLE>';
|
||||
echo '<TR><TD style="background-color:#4F8DFF;color:white;font-style:bold;align:center" COLSPAN="3" > Journaux</TD></TR>';
|
||||
include_once("postgres.php");
|
||||
if ( CheckAdmin() ==0) {
|
||||
$Ret=ExecSql($p_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='$p_user'
|
||||
and uj_priv !='X'
|
||||
");
|
||||
} else {
|
||||
$Ret=ExecSql($p_cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
|
||||
jrn_type_id,jrn_desc,'W' as uj_priv
|
||||
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
|
||||
|
||||
}
|
||||
$Max=pg_NumRows($Ret);
|
||||
include_once("check_priv.php");
|
||||
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Ret,$i);
|
||||
// Admin have always rights
|
||||
if ( CheckAdmin() == 0 ){
|
||||
$right=CheckJrn($p_dossier,$p_user,$l_line['jrn_def_id']);
|
||||
}else {
|
||||
$right=3;
|
||||
}
|
||||
|
||||
printf ('<TR><TD class="cell">%s</TD>',$l_line['jrn_def_name']);
|
||||
|
||||
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="impress.php?p_id=%s&action=viewhtml&type=jrn&filter=%d">Html</A></TD>',
|
||||
$l_line['jrn_def_id'],YES);
|
||||
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="impress.php?p_id=%s&action=viewpdf&type=jrn&filter=%d">Pdf</A></TD></TR>',
|
||||
$l_line['jrn_def_id'],YES
|
||||
);
|
||||
|
||||
}
|
||||
$NoPriv=CountSql($p_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='$p_user'
|
||||
and uj_priv ='X'
|
||||
");
|
||||
// Pour voir tout les journal ?
|
||||
if ( $NoPriv == 0 ) {
|
||||
printf ('<TR><TD class="cell">Grand Livre Non Centralisé</TD>');
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="impress.php?p_id=all&action=viewhtml&type=jrn&filter=%d¢ral=no">Html</A></TD>',NO);
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="impress.php?p_id=all&action=viewpdf&type=jrn&filter=%d¢ral=no">Pdf</A></TD></TR>',NO);
|
||||
|
||||
printf ('<TR><TD class="cell">Grand Livre Centralisé</TD>');
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="impress.php?p_id=all&action=viewhtml&type=jrn&filter=%d¢ral=yes">Html</A></TD>',NO);
|
||||
printf ('<TD class="mtitle"><A class="mtitle" HREF="impress.php?p_id=all&action=viewpdf&type=jrn&filter=%d¢ral=yes">Pdf</A></TD></TR>',NO);
|
||||
|
||||
}
|
||||
echo "</TABLE>";
|
||||
// Formulaire
|
||||
echo "<TABLE>";
|
||||
echo '<TR><TD style="background-color:#4F8DFF;color:white" COLSPAN="3" > Formulaire</TD></TR>';
|
||||
|
||||
$Ret=ExecSql($p_cn,"select fr_id, fr_label from formdef order by fr_label");
|
||||
$Max=pg_NumRows($Ret);
|
||||
|
||||
for ($i=0;$i<$Max;$i++) {
|
||||
$l_line=pg_fetch_array($Ret,$i);
|
||||
printf ('<TR><TD class="cell">%s</TD>',$l_line['fr_label']);
|
||||
|
||||
|
||||
printf ('<TD class="mtitle"><A class="mtitle"
|
||||
HREF="impress.php?p_id=%s&action=viewhtml&type=form">Html</A></TD>',
|
||||
$l_line['fr_id']);
|
||||
|
||||
printf ('<TD class="mtitle"><A class="mtitle"
|
||||
HREF="impress.php?p_id=%s&action=viewpdf&type=form">Pdf</A></TD></TR>',
|
||||
$l_line['fr_id']
|
||||
);
|
||||
|
||||
}
|
||||
echo "</TABLE>";
|
||||
// poste &
|
||||
echo "<TABLE>";
|
||||
echo '<TR><TD style="background-color:#4F8DFF;color:white" COLSPAN="3" > Poste </TD></TR>';
|
||||
|
||||
|
||||
printf ('<TR><TD class="cell">Poste</TD>');
|
||||
|
||||
|
||||
printf ('<TD class="mtitle"><A class="mtitle"
|
||||
HREF="impress.php?action=viewhtml&type=poste">Html</A></TD>'
|
||||
);
|
||||
|
||||
printf ('<TD class="mtitle"><A class="mtitle"
|
||||
HREF="impress.php?action=viewpdf&type=poste">Pdf</A></TD></TR>'
|
||||
);
|
||||
|
||||
|
||||
echo "</TABLE>";
|
||||
|
||||
echo "</DIV>";
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue