This commit is contained in:
sparkyx 2008-01-10 21:36:06 +00:00
parent c4d3152ebf
commit 97fadbacea
6 changed files with 0 additions and 916 deletions

View file

@ -1,60 +0,0 @@
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function CheckTotal() {
var ie4=false;
if ( document.all ) {
ie4=true;
}// Ajouter getElementById par document.all[str]
var deb=0;
for (var i=0;1;i++) {
a=document.getElementById("mont_deb"+i);
if ( a == null ) {
document.forms[0].sum_deb.value=deb;
break;
} else {
if ( isNaN(a.value) == true) {
a.value=0;
alert ("Not a Number !!! ");
}
deb+=eval(a.value);
}
}
var cred=0;
for (var i=0;1;i++) {
a=document.getElementById("mont_cred"+i);
if ( a == null ) {
document.forms[0].sum_cred.value=cred;
break;
} else {
if ( isNaN(a.value) == true) {
a.value=0;
alert ("Not a Number !!! ");
}
cred+=eval(a.value);
}
}
if ( deb != cred ) {
document.getElementById("diff").style.color="red";
document.getElementById("diff").style.fontWeight="bold";
document.getElementById("diff").innerHTML="Différence";
} else {
document.getElementById("diff").innerHTML="";
}
}

View file

@ -1,194 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
/*! \file
* \brief To add a ledger
*/
include_once ("ac_common.php");
include_once("jrn.php");
require_once ('class_acc_ledger.php');
html_page_start($_SESSION['g_theme']);
require_once('class_dossier.php');
$gDossier=dossier::id();
include_once ("postgres.php");
/* Admin. Dossier */
$rep=DbConnect();
include_once ("class_user.php");
$User=new cl_user($rep);
$User->Check();
include_once("check_priv.php");
include_once ("user_menu.php");
echo '<div class="u_tmenu">';
echo ShowMenuCompta();
echo '</div>';
$cn=DbConnect($gDossier);
$User->can_request($cn,GJRN);
echo JS_SEARCH_POSTE;
If ( isset ($_POST["JRN_ADD"]) ) {
if ( !isset($_POST["p_jrn_name"]) || ! isset($_POST["p_jrn_type"] )) {
echo '<H2 CLASS="error"> Un paramètre manque</H2>';
}
else {
if ( $_POST['p_ech'] == 'no' ) {
$p_ech='false';
$p_ech_lib='null';
} else {
$p_ech='true';
$p_ech_lib="'".$_POST['p_ech_lib']."'";
}
if (strlen(trim($_POST['p_jrn_deb_max_line'])) == 0 ||
(string) (int)$_POST['p_jrn_deb_max_line'] != (string)$_POST['p_jrn_deb_max_line'] )
$l_deb_max_line=1;
else
$l_deb_max_line=$_POST['p_jrn_deb_max_line'];
$p_jrn_name=$_POST["p_jrn_name"];
echo_debug('jrn_add.php',__LINE__,"nom journal $p_jrn_name");
$p_jrn_class_deb=FormatString($_POST["p_jrn_class_deb"]);
if (strlen(trim($p_jrn_name))==0) return;
$p_jrn_name=FormatString($p_jrn_name);
$p_jrn_class_cred=FormatString($_POST["p_jrn_class_deb"]);
// compute the jrn_def.jrn_def_code
$p_code=sprintf("%s-%02d",trim($_POST['p_jrn_type']),Acc_Ledger::next_number($cn,$_POST['p_jrn_type']));
$p_jrn_fiche_deb="";
$p_jrn_fiche_cred="";
if ( isset ($_POST["FICHEDEB"])) {
$p_jrn_fiche_deb=join(",",$_POST["FICHEDEB"]);
}
if ( isset ($_POST["FICHEDEB"])) {
$p_jrn_fiche_cred=join(",",$_POST["FICHEDEB"]);
}
$l_cred_max_line=$l_deb_max_line;
$Sql=sprintf("insert into jrn_def(jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
jrn_def_type,jrn_def_fiche_deb,jrn_def_fiche_cred,jrn_def_code)
values ('%s','%s','%s',%s,%s,'%s','%s','%s','%s')",
$p_jrn_name,$p_jrn_class_deb,$p_jrn_class_cred,
$l_deb_max_line,$l_cred_max_line,$_POST['p_jrn_type'],
$p_jrn_fiche_deb,$p_jrn_fiche_cred,
$p_code
);
echo_debug($Sql);
$Res=ExecSql($cn,$Sql);
}
}
echo ShowMenuAdvanced();
echo '<div class="lmenu">';
MenuJrn();
echo '</div>';
$sessid=$_REQUEST['PHPSESSID'];
$search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$sessid."',".$gDossier.",'not')\">";
echo '<DIV CLASS="u_redcontent">';
echo '<FORM ACTION="jrn_add.php" METHOD="POST">';
echo dossier::hidden();
echo '<INPUT TYPE="HIDDEN" NAME="JRN_ADD">';
echo '<TABLE>';
echo '<TR>';
echo '<TD> Nom journal </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_name"></TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Postes utilisables journal (débit/crédit) </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_class_deb">'.$search.'</TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Nombre de lignes par défaut </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_deb_max_line" ></TD>';
echo '</TR>';
/*
echo '<TR>';
echo '<TD> Postes utilisables journal (crédit) </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_class_cred">'.$search.'</TD>';
echo '</TR>';
*/
echo '<TR>';
echo '<TD> Date d\'échéance </TD>';
echo '<TD> <INPUT TYPE="radio" NAME="p_ech" VALUE="yes" >Oui';
echo '<INPUT TYPE="radio" NAME="p_ech" VALUE="no" CHECKED>Non</TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Libellé echéance </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_ech_lib" ></TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Type de journal </TD>';
echo '<TD> ';
$Res=ExecSql($cn,"select jrn_type_id,jrn_desc from jrn_type");
$Max=pg_NumRows($Res);
echo '<SELECT NAME="p_jrn_type">';
for ($i=0;$i<$Max;$i++) {
$Line=pg_fetch_array($Res,$i);
printf ('<OPTION VALUE="%s">%s',$Line['jrn_type_id'],$Line['jrn_desc']);
}
echo '</SELECT>';
echo '</TD>';
echo '</TR>';
?>
<?php
// Get all the fiches
echo '<tr> <td colspan="2"><H2 class="info"> Fiches </H2></TD></TR>';
$Res=ExecSql($cn,"select fd_id,fd_label from fiche_def order by fd_label");
$num=pg_NumRows($Res);
echo '<TR>';
echo '<th> Fiches Dédit</TH>';
echo '<th> Fiches Crébit</TH>';
echo '</TR>';
// Show the fiche in deb section
for ($i=0;$i<$num;$i++) {
$res=pg_fetch_array($Res,$i);
echo '<TR>';
printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]">%s</TD>',
$res['fd_id'],$res['fd_label']);
printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHECRED[]">%s</TD>',
$res['fd_id'],$res['fd_label']);
echo '</TR>';
}
?>
<TR><TD><INPUT TYPE="SUBMIT" VALUE="Sauve"></TD><TD><INPUT TYPE="RESET" VALUE="Reset"></TD></TR>
<?php
echo '</TABLE>';
echo '</FORM>';
echo "</DIV>";
html_page_stop();
?>

View file

@ -1,269 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
/*! \file
* \brief Show and let modify ledger parameter
*/
require_once('class_dossier.php');
$gDossier=dossier::id();
include_once ("ac_common.php");
html_page_start($_SESSION['g_theme']);
include_once ("postgres.php");
/* Admin. Dossier */
$rep=DbConnect();
include_once ("class_user.php");
$User=new cl_user($rep);
$User->Check();
//include_once ("top_menu_compta.php");
include_once ("user_menu.php");
echo '<div class="u_tmenu">';
echo ShowMenuCompta(7);
echo '</div>';
include_once("check_priv.php");
$cn=DbConnect($gDossier);
$User->can_request($cn,GJRN);
// Javascript
echo JS_SEARCH_POSTE;
if ( isset( $_REQUEST['p_jrn'] )) {
$p_jrn=$_REQUEST['p_jrn'];
} else {
echo '<h2 class="error">Journal inexistant</h2>';
exit();
}
//--------------------------------------------------
// remove ledger
//--------------------------------------------------
if ( isset($_POST["efface"])) {
if ( CountSql($cn,"select * from jrn where jr_def_id=".$_POST['p_jrn']." limit 3") == 0 )
{
ExecSql($cn,"delete from jrn_def where jrn_def_id=".$_POST['p_jrn']);
} else {
?>
<script language="javascript">
alert("Impossible d'effacer ce journal.\n Il est utilisé\n");
</script>
<?php
}
}
//--------------------------------------------------
// Update ledger
If ( isset ($_POST["JRN_UPD"] )) {
if ( !isset($_POST["p_jrn_name"]) ) {
echo '<H2 CLASS="error"> Un paramètre manque</H2>';
}
else {
if ( $_POST['p_ech'] == 'no' ) {
$p_ech='false';
$p_ech_lib='null';
} else {
$p_ech='true';
$p_ech_lib="'".$_POST['p_ech_lib']."'";
}
if ( strlen(trim($_POST['p_jrn_deb_max_line'])) == 0 ||
(string) (int)$_POST['p_jrn_deb_max_line'] != (string)$_POST['p_jrn_deb_max_line'] ||
$_POST['p_jrn_deb_max_line'] <= 0
)
$l_deb_max_line=1;
else
$l_deb_max_line=$_POST['p_jrn_deb_max_line'];
$l_cred_max_line=$l_deb_max_line;
$p_jrn_name=$_POST['p_jrn_name'];
if (strlen(trim($p_jrn_name))==0) return;
$p_jrn_name=FormatString($p_jrn_name);
$p_jrn_fiche_deb="";
$p_jrn_fiche_cred="";
if ( isset ($_POST["FICHEDEB"])) {
$p_jrn_fiche_deb=join(",",$_POST["FICHEDEB"]);
}
if ( isset ($_POST["FICHECRED"])) {
$p_jrn_fiche_cred=join(",",$_POST["FICHECRED"]);
}
$Sql=sprintf("update jrn_def set jrn_def_name='%s',jrn_def_class_deb='%s',jrn_def_class_cred='%s',
jrn_deb_max_line=%s,jrn_cred_max_line=%s,jrn_def_ech=%s,jrn_def_ech_lib=%s,jrn_def_fiche_deb='%s',
jrn_def_fiche_cred='%s'
where jrn_def_id=%s",
$p_jrn_name,$_POST['p_jrn_class_deb'],$_POST['p_jrn_class_deb'],
$l_deb_max_line,$l_cred_max_line,
$p_ech,$p_ech_lib,
$p_jrn_fiche_deb,$p_jrn_fiche_cred,
$_GET['p_jrn']
);
echo_debug($Sql);
$Res=ExecSql($cn,$Sql);
}
}
echo ShowMenuAdvanced(1);
echo '<div class="lmenu">';
MenuJrn();
echo '</div>';
?>
<script language="javascript">
function m_confirm() {
return confirm ("Etes-vous sur de vouloir effacer ce journal ?");
}
</script>
<?
$Res=ExecSql($cn,"select jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,".
"jrn_deb_max_line,jrn_cred_max_line,jrn_def_code".
",jrn_def_type,jrn_def_ech, jrn_def_ech_lib,jrn_def_fiche_deb,jrn_def_fiche_cred".
" from jrn_def where".
" jrn_def_id=".$_REQUEST['p_jrn']);
if ( pg_NumRows($Res) == 0 ) exit();
$l_line=pg_fetch_array($Res,0);
$sessid = $_REQUEST['PHPSESSID'];
$search='<INPUT TYPE="BUTTON" VALUE="Cherche" OnClick="SearchPoste(\''.$sessid."',".dossier::id().",'not','".$_GET['p_jrn']."')\">";
echo '<DIV CLASS="u_redcontent">';
echo '<H2 class="info">'.$l_line['jrn_def_name'].'</H2>';
echo '<FORM ACTION="jrn_detail.php?p_jrn='.$_GET['p_jrn'].'" METHOD="POST">';
echo dossier::hidden();
echo '<INPUT TYPE="HIDDEN" NAME="JRN_UPD">';
echo '<TABLE>';
echo '<TR>';
echo '<TD> Nom journal </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_name" VALUE="'.$l_line['jrn_def_name'].'"></TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Postes utilisables journal (d&eacute;bit/cr&eacute;dit) </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_class_deb" VALUE="'.$l_line['jrn_def_class_deb'].'">'.$search.'</TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Nombre de lignes par défaut </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_deb_max_line" VALUE="'.$l_line['jrn_deb_max_line'].'"></TD>';
echo '</TR>';
/*echo '<TR>';
echo '<TD> Postes utilisables journal (crédit) </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_jrn_class_cred" VALUE="'.$l_line['jrn_def_class_cred'].'">'.$search.'</TD>';
echo '</TR>';
*/
echo '<TR>';
echo '<TD> Date d\'échéance </TD>';
if ( $l_line['jrn_def_ech'] == 't' ) {
echo '<TD> <INPUT TYPE="radio" NAME="p_ech" VALUE="yes" checked> Oui';
echo '<INPUT TYPE="radio" NAME="p_ech" VALUE="no">Non </TD>';
}
if ( $l_line['jrn_def_ech'] == 'f' ) {
echo '<TD> <INPUT TYPE="radio" NAME="p_ech" VALUE="yes" >Oui';
echo '<INPUT TYPE="radio" NAME="p_ech" VALUE="no" CHECKED>Non</TD>';
}
echo '</TR>';
echo '<TR>';
echo '<TD> Libellé echéance </TD>';
echo '<TD> <INPUT TYPE="text" NAME="p_ech_lib" VALUE="'.$l_line['jrn_def_ech_lib'].'"></TD>';
echo '</TR>';
echo '<TR>';
echo '<TD> Type de journal </TD>';
echo '<TD> ';
$Res=ExecSql($cn,"select jrn_type_id,jrn_desc from jrn_type where ".
"trim(jrn_type_id)=trim('".$l_line['jrn_def_type']."')");
$Max=pg_NumRows($Res);
for ($i=0;$i<$Max;$i++) {
$Line=pg_fetch_array($Res,$i);
echo_debug('jrn_detail.php',__LINE__,"jrn type !".$Line['jrn_type_id']."!,!".$l_line['jrn_def_type']."!");
printf (' %s',$Line['jrn_desc']);
}
echo '</TD>';
echo '</TR>';
echo "<TR><TD> Code </TD><TD>".$l_line['jrn_def_code']."</TD></TR>";
?>
<?php
echo '</TABLE>';
// Get all the fiches
echo '<H2 class="info"> Fiches </H2>';
$Res=ExecSql($cn,"select fd_id,fd_label from fiche_def order by fd_label");
$num=pg_NumRows($Res);
$rdeb=split(',',$l_line['jrn_def_fiche_deb']);
$rcred=split(',',$l_line['jrn_def_fiche_cred']);
echo '<TABLE>';
echo '<TR>';
echo '<th> Fiches Débit</TH>';
echo '<th> Fiches Crédit</TH>';
echo '</TR>';
// Show the fiche in deb section
for ($i=0;$i<$num;$i++) {
$res=pg_fetch_array($Res,$i);
$CHECKED=" unchecked";
foreach ( $rdeb as $element) {
if ( $element == $res['fd_id'] ) {
$CHECKED="CHECKED";
break;
}
}
echo '<TR>';
printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]" %s>%s</TD>',
$res['fd_id'],$CHECKED,$res['fd_label']);
$CHECKED=" unchecked";
foreach ( $rcred as $element) {
if ( $element == $res['fd_id'] ) {
$CHECKED="CHECKED";
break;
}
}
printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHECRED[]" %s>%s</TD>',
$res['fd_id'],$CHECKED,$res['fd_label']);
echo '</TR>';
}
?>
<hr>
<TABLE><TR>
<TD><INPUT TYPE="SUBMIT" VALUE="Sauve"></TD>
<TD><INPUT TYPE="RESET" VALUE="Reset"></TD>
<TD><form method="post">
<?php echo dossier::hidden(); ?>
<INPUT TYPE="submit" name="efface" value="Efface" onClick="return m_confirm();">
<input type="hidden" name="p_jrn" value="<? echo $_GET['p_jrn'];?>">
</form>
</TD></TR></TABLE>
<?php
echo '</FORM>';
echo "</DIV>";
html_page_stop();
?>

View file

@ -1,60 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
/*! \file
* \brief create, modify parameter ledger
*/
require_once('class_dossier.php');
$gDossier=dossier::id();
include_once ("ac_common.php");
html_page_start($_SESSION['g_theme']);
include_once ("postgres.php");
/* Admin. Dossier */
$rep=DbConnect();
include_once ("class_user.php");
$User=new cl_user($rep);
$User->Check();
include_once ("check_priv.php");
include_once ("user_menu.php");
echo '<div class="u_tmenu">';
echo ShowMenuCompta("user_advanced.php?".dossier::get());
echo '</div>';
$cn=DbConnect($gDossier);
echo '<div class="u_subtmenu">';
echo ShowMenuAdvanced("jrn_update.php?".dossier::get());
echo '</div>';
$User->can_request($cn,GJRN);
echo '<div class="lmenu">';
MenuJrn($gDossier);
echo '</div>';
html_page_stop();
?>

View file

@ -1,127 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
// $Revision$
/*! \file
* \brief Modify the "Plan Comptable"
*/
include_once ("ac_common.php");
require_once('class_dossier.php');
$gDossier=dossier::id();
include_once ("postgres.php");
include_once("check_priv.php");
/* Admin. Dossier */
$rep=DbConnect();
include_once ("class_user.php");
$User=new cl_user($rep);
$User->Check();
html_page_start($User->theme,"onLoad='window.focus();'");
$User->can_request(DbConnect($gDossier),MPCMN);
include ("user_menu.php");
/* Modif d'une ligne */
if ( isset ($_POST["update"] ) ) {
foreach ($_POST as $name => $element) {
echo_debug('line_update.php',__LINE__,"name $name $element");
}
echo JS_UPDATE_PCMN;
$cn=DbConnect($gDossier);
$p_val=trim($_POST["p_val"]);
$p_lib=FormatString($_POST["p_name"]);
$p_parent=trim($_POST["p_val_parent"]);
$old_line=trim($_POST["p_old"]);
// Check if p_parent and p_val are number
if ( ! is_numeric($p_val) || ! is_numeric($p_parent) ) {
// not number no update
echo '<script> alert(\' Valeurs invalides, pas de changement opéré;\');
</script>';
echo "<script>
window.close();
self.opener.RefreshMe();
</script>";
exit();
}
echo_debug('line_update.php',__LINE__,"Update old : $old_line News = $p_val $p_lib");
if ( strlen ($p_val) != 0 && strlen ($p_lib) != 0 && strlen($old_line)!=0 ) {
if (strlen ($p_val) == 1 ) {
$p_parent=0;
} else {
if ( strlen($p_parent)==0 ) {
$p_parent=substr($p_val,0,strlen($p_val)-1);
echo_debug('line_update.php',__LINE__,"Modif valeur = $p_val parent = $p_parent");
}
}
/* Parent existe */
$Ret=ExecSql($cn,"select pcm_val from tmp_pcmn where pcm_val=$p_parent");
if ( pg_NumRows($Ret) == 0 || $p_parent==$old_line ) {
echo '<SCRIPT> alert(" Ne peut pas modifier; aucune poste parent"); </SCRIPT>';
} else {
$Ret=ExecSql($cn,"update tmp_pcmn set pcm_val=$p_val, pcm_lib='$p_lib',pcm_val_parent=$p_parent where pcm_val=$old_line");
}
} else {
echo '<script> alert(\'Update Valeurs invalides\'); </script>';
}
echo "<script>
window.close();
self.opener.RefreshMe();
</script>";
}
?>
<FORM ACTION="line_update.php" METHOD="POST">
<TABLE>
<TR>
<?php
$l=$_GET['l'];
$p=$_GET['p'];
$n=$_GET['n'];
printf ('<TD>Numéro de classe </TD><TD><INPUT TYPE="TEXT" name="p_val" value="%s"></TD>',$l);
echo "</TR><TR>";
printf('<TD>Libellé </TD><TD><INPUT TYPE="TEXT" size="70" NAME="p_name" value="%s"></TD>',urldecode($n));
echo "</TR><TR>";
printf ('<TD>Classe Parent</TD><TD><INPUT TYPE="TEXT" name="p_val_parent" value="%s"></TD>',$p);
echo dossier::hidden();
?>
</TR>
</TABLE>
<TABLE>
<TR>
<TD><INPUT TYPE="Submit" VALUE="Sauve">
<INPUT TYPE="HIDDEN" name="update">
<?php printf ('<INPUT TYPE="HIDDEN" name="p_old" value="%s">',$l); ?>
</TD><TD><input type="button" Value="Retour sans sauver" onClick='window.close();'></TD></TR>
</TABLE>
</FORM>
<?php
html_page_stop();
?>

View file

@ -1,206 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
/*! \file
* \brief concerns the management of the "Plan Comptable"
*/
include_once ("ac_common.php");
html_page_start($_SESSION['g_theme']);
require_once("constant.php");
require_once('class_dossier.php');
$gDossier=dossier::id();
include_once ("postgres.php");
/* Admin. Dossier */
$rep=DbConnect();
include_once ("class_user.php");
$User=new cl_user($rep);
$User->Check();
include_once ("user_menu.php");
include_once ("check_priv.php");
//echo ShowMenuCompta("user_advanced.php");
echo ShowMenuCompta(7);
$cn=DbConnect($gDossier);
echo JS_UPDATE_PCMN;
/* Store the p_start parameter */
if ( ! isset ( $_SESSION['g_start']) ) {
$_SESSION['g_start']="";
}
if ( isset ($_GET['p_start'])) {
$g_start=$_GET['p_start'];
$_SESSION["g_start"]=$g_start;
}
echo '<div class="u_subtmenu">';
echo ShowMenuAdvanced(4);
echo '</div>';
$User->can_request($cn,MPCMN);
echo '<div class="lmenu">';
ShowMenuPcmn($_SESSION['g_start']);
echo '</div>';
echo '<DIV CLASS="u_redcontent">';
/* Analyse ce qui est demandé */
/* Effacement d'une ligne */
if (isset ($_GET['action'])) {
//-----------------------------------------------------
// Action == remove a line
if ( $_GET['action']=="del" ) {
if ( isset ($_GET['l']) ) {
/* Ligne a enfant*/
$R=ExecSql($cn,"select pcm_val from tmp_pcmn where pcm_val_parent=".$_GET['l']);
if ( pg_NumRows($R) != 0 ) {
echo "<SCRIPT> alert(\"Ne peut pas effacer le poste: d'autres postes en dépendent\");</SCRIPT>";
} else {
/* Vérifier que le poste n'est pas utilisé qq part dans les journaux */
$Res=ExecSql($cn,"select * from jrnx where j_poste=".$_GET['l']);
if ( pg_NumRows($R) != 0 ) {
echo "<SCRIPT> alert(\"Ne peut pas effacer le poste: il est utilisé dans les journaux\");</SCRIPT>";
}
else {
$Del=ExecSql($cn,"delete from tmp_pcmn where pcm_val=".$_GET['l']);
} // if pg_NumRows
} // if pg_NumRows
} // isset ($l)
} //$action == del
} // isset action
//-----------------------------------------------------
/* Ajout d'une ligne */
if ( isset ( $_POST["Add"] ) ) {
extract ($_POST);
$p_val=trim($p_val);
$p_parent=trim($p_parent);
if ( isset ( $p_val) && isset ( $p_lib ) && isNumber($p_val) && isNumber($p_parent) ) {
$p_val=trim($p_val);
$p_lib=FormatString(trim($p_lib));
$p_parent=$_POST["p_parent"];
if ( strlen ($p_val) != 0 && strlen ($p_lib) != 0 ) {
if (strlen ($p_val) == 1 ) {
$p_parent=0;
} else {
if ( strlen(trim($p_parent))==0 &&
(string) $p_parent != (string)(int) $p_parent) {
$p_parent=substr($p_val,0,strlen($p_val)-1);
}
echo_debug('pcmn_update.php',__LINE__,"Ajout valeur = $p_val parent = $p_parent");
}
/* Parent existe */
$Ret=ExecSql($cn,"select pcm_val from tmp_pcmn where pcm_val=$p_parent");
if ( pg_NumRows($Ret) == 0 ) {
echo '<SCRIPT> alert(" Ne peut pas modifier; aucune poste parent"); </SCRIPT>';
} else {
// Check if the account already exists
$Count=CountSql($cn,"select * from tmp_pcmn where pcm_val='".$p_val."'");
if ( $Count != 0 )
{
// Alert message account already exists
echo '<SCRIPT> alert(" Ce poste existe déjà "); </SCRIPT>';
} else
{
$Ret=ExecSql($cn,"insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent) values ('$p_val','$p_lib',$p_parent)");
}
}
} else {
echo '<H2 class="error"> Valeurs invalides </H3>';
}
}
}
$Ret=ExecSql($cn,"select pcm_val,pcm_lib,pcm_val_parent from tmp_pcmn where substr(pcm_val::text,1,1)='".$_SESSION['g_start']."' order by pcm_val::text");
$MaxRow=pg_NumRows($Ret);
?>
<FORM ACTION="pcmn_update.php" METHOD="POST">
<?php
echo dossier::hidden();
?>
<TABLE ALIGN="center" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TH> Classe </TH>
<TH> Libellé </TH>
<TH> Parent </TH>
</TR>
<TR>
<TD>
<INPUT TYPE="TEXT" NAME="p_val" SIZE=7>
</TD>
<TD>
<INPUT TYPE="TEXT" NAME="p_lib" size=50>
</TD>
<TD>
<INPUT TYPE="TEXT" NAME="p_parent" size=5>
</TD>
<TD>
<INPUT TYPE="SUBMIT" Value="Add" Name="Add">
</TD>
</TR>
<?php
$str_dossier=dossier::get();
for ($i=0; $i <$MaxRow; $i++) {
$A=pg_fetch_array($Ret,$i);
if ( $i%2 == 0 ) {
$td ='<TD class="odd">';
} else {
$td='<TD class="even">';
}
echo "<TR> $td";
echo $A['pcm_val'];
echo "</td> $td";
// printf ("<A HREF=line_update.php?l=%d&n=%s&p=%s>",$A['pcm_val'],urlencode($A['pcm_lib']),$A['pcm_val_parent']);
printf ("<A HREF=\"javascript:PcmnUpdate(%d,'%s','%s','%s',%d)\">",
$A['pcm_val'],
FormatString($A['pcm_lib']),
$A['pcm_val_parent'],
$_REQUEST['PHPSESSID'],
dossier::id());
echo $A['pcm_lib'];
echo '</A>';
echo "</TD>";
echo $td;
echo $A['pcm_val_parent'];
echo '</TD>';
echo $td;
printf ('<A href="pcmn_update.php?l=%d&action=del&%s">Delete</A>',$A['pcm_val'],$str_dossier);
echo "</TD>";
echo "</TR>";
}
echo "</TABLE>";
echo "</FORM>";
echo "</DIV>";
html_page_stop();
?>