Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

user_jrn.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00020 /* $Revision: 1.27 $ */
00025 include_once("ac_common.php");
00026 include_once("user_menu.php");
00027 include_once ("constant.php");
00028 include_once ("postgres.php");
00029 include_once ("check_priv.php");
00030 include_once ("class_widget.php");
00031 require_once("jrn.php");
00032 
00033 $cn=DbConnect($_SESSION['g_dossier']);
00034 include ('class_user.php');
00035 $User=new cl_user($cn);
00036 $User->Check();
00037 
00038 html_page_start($User->theme, 
00039          "OnLoad=\"SetFocus('e_date',0); AttachEvent(document, 'keydown', HandleSubmit, true);\" ");
00040 
00041 // Check if dossier set
00042 if ( ! isset ( $_SESSION['g_dossier'] ) ) {
00043   echo "You must choose a Dossier ";
00044   exit -2;
00045 }
00046 /* Get the _REQUEST value for p_jrn (jrn_def.jrn_def_id) and jrn_type (jrn_def.jrn_def_code) */
00047 $p_jrn=(isset($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
00048 $jrn_type=(isset($_REQUEST['jrn_type']))?$_REQUEST['jrn_type']:-1;
00049 
00050 
00051 echo '<div class="u_tmenu">';
00052 echo ShowMenuCompta($_SESSION['g_dossier']);
00053 echo '</div>';
00054 
00055 if ( $User->admin == 0 ) {
00056   // check if user can access
00057   if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],ENCJRN) == 0 ){
00058     /* Cannot Access */
00059     NoAccess();
00060   }
00061   // if a jrn is asked
00062   if ( $p_jrn != -1 ) {
00063           if (CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$p_jrn) == 0 ){
00064             /* Cannot Access */
00065             NoAccess();
00066             exit -1;
00067           }
00068     } // if isset p_jrn
00069 
00070 }
00071 
00072 // Show the available jrn
00073 $result=ShowJrn("user_jrn.php?jrn_type=".$jrn_type);
00074 echo "<div class=\"u_subtmenu\">";
00075 echo $result;
00076 echo "</div>";
00077 
00078 
00079 
00080 // if a journal is selected show the journal's menu
00081 if ( $p_jrn != -1 ) 
00082 {
00083   // display jrn's menu
00084 
00085   //   echo '</DIV>';
00086   echo '<div class="u_subt2menu">';      
00087   // show the available ledger of the type jrn_type
00088   ShowMenuJrnUser($_SESSION['g_dossier'],$jrn_type,$p_jrn);
00089   echo '</div>';
00090   echo '<div class="lmenu">';      
00091   // show the menu for this journal (Nouveau, voir,...)
00092   $menu_jrn=ShowMenuJrn($cn,$jrn_type, $p_jrn);
00093   echo $menu_jrn;
00094 
00095   echo '</div>';
00096 
00097   $g_dossier=$_SESSION['g_dossier'];
00098   $g_user=$_SESSION['g_user'];
00099       
00100   // Execute Action for p_jrn
00101   if ( $jrn_type=='VEN' )     require('user_action_ven.php');
00102   if ( $jrn_type=='ACH' )     require('user_action_ach.php');
00103   if ( $jrn_type=='FIN' )     require('user_action_fin.php');
00104   if ( $jrn_type=='OD' )     require('user_action_ods.php');
00105   
00106 }
00107 else 
00108 {
00109   if ( $jrn_type=='NONE')
00110     {
00111       include('user_action_gl.php');
00112 
00113     } else {
00114       // no journal are selected so we select the first one
00115       $p_jrn=GetFirstJrnIdForJrnType($_SESSION['g_dossier'],$jrn_type); 
00116       // display jrn's menu
00117       
00118   //   echo '</DIV>';
00119       echo '<div class="u_subt2menu">';      
00120       ShowMenuJrnUser($_SESSION['g_dossier'],$jrn_type,$p_jrn);
00121       echo '</div>';
00122       echo '<div class="lmenu">';      
00123       $menu_jrn=ShowMenuJrn($cn,$jrn_type, $p_jrn);
00124       
00125       echo $menu_jrn;
00126       echo '</div><br>';
00127     }
00128 
00129 }
00130 
00131 html_page_stop();
00132 
00133 ?>