Start with user printing

This commit is contained in:
sparkyx 2004-11-23 22:01:09 +00:00
parent 409e213e62
commit 8bccff39fb
6 changed files with 80 additions and 133 deletions

View file

@ -193,6 +193,11 @@ Recopier simplement le fichier fourni
Sinon, adaptez votre fichier, il doit avoir au minimum les options
suivantes
<verb>
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
register_globals = on
[Session]

View file

@ -31,114 +31,46 @@ include ("check_priv.php");
include_once ("top_menu_compta.php");
ShowMenuCompta($g_dossier,$g_UserProperty);
$p_array=array(array("user_jrn.php?JRN_TYPE=VEN" ,"Entrée"),
array("user_jrn.php?JRN_TYPE=ACH","Dépense"),
array("user_jrn.php?JRN_TYPE=FIN","Financier"),
array("user_jrn.php?JRN_TYPE=OD","Op. Diverses"),
array("impress.php","Impression"),
array("","Recherche")
);
$result=ShowItem($p_array,'H',"cell","mtitle","impress.php");
echo "<DIV class=\"u_subtmenu\">";
echo $result;
echo "</DIV>";
// show sub menu
$result=ShowJrn("user_impress.php");
echo "<DIV class=\"u_subtmenu\">";
echo $result;
$p_array=array(array ("user_impress.php?type=jrn","Journaux"),
array("user_impress.php?type=poste","Poste"),
array("user_impress.php?type=form","Formulaire")
);
$default=( isset ($_GET['type']))?"user_impress.php?type=".$_GET['type']:"";
$result=ShowItem($p_array,'H',"cell","mtitle",$default);
echo $result;
echo "</DIV>";
// $_GET['direct'] if we want to print from
// the advanced menu in the user interface
if ( isset ($_GET['direct'])) {
if ( isset ($g_jrn) ) {
echo_debug(__FILE__,__LINE__,"g_jrn is set --> come from user_profile");
$p_id=$g_jrn;
} else {
if (isset ($_GET["p_id"]) ) {
$p_id=$_GET["p_id"];
}
}
}
include_once("impress_inc.php");
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,IMP);
if ($r == 0 ){
if (CheckAction($g_dossier,$g_user,IMP) == 0 ){
/* Cannot Access */
NoAccess();
}
if ( isset ($_GET["type"])) {
if ( $type=="jrn") {
$right=CheckJrn($g_dossier,$g_user,$p_id);
if ($right == 0 ){
/* Cannot Access */
NoAccess();
exit -1;
}
}
}
}
$l_Db=sprintf("dossier%d",$g_dossier);
$cn=DbConnect($l_Db);
// if the user has the profile compta show the left menu
if ( $g_UserProperty['use_usertype'] == 'compta' or
! isset ($_GET['direct']))
ShowMenuJrnUserImp($cn,$g_user,$g_dossier);
// if the user has the profile compta show the left menu
if ( $g_UserProperty['use_usertype'] == 'user') {
if ( isset ($_GET['direct'])){
// Get the jrn_type_id
include_once('jrn.php');
$JrnProp=GetJrnProp($g_dossier,$g_jrn);
$jrn_type=$JrnProp['jrn_def_type'];
// Display available menus
ShowMenuJrnUser($g_dossier,$g_UserProperty,$jrn_type,$g_jrn);
// display jrn's menu
include_once('user_menu.php');
$menu_jrn=u_ShowMenuJrn($cn,$jrn_type);
echo '<div class="searchmenu">';
echo $menu_jrn;
echo '</DIV>';
// something is choosen
$default=( isset ($_GET['type']))?$_GET['type']:"";
switch ($default) {
case "jrn":
include ("impress_jrn.php");
break;
case "poste":
include ("impress_poste.php");
break;
case "form":
include ("impress_form.php");
break;
}
} // Menu for user's profile when printing from user_jrn
// Ask the period
if ( isset ( $_GET["action"]) ) {
echo_debug(__FILE__,__LINE__," action is set ");
$a_print=$HTTP_GET_VARS;
// p_id come from the user interface
if ( isset($p_id) and isset ( $_GET['direct'])) {
$a_print['p_id']=$p_id;
}
echo '<DIV class="redcontent">';
echo '<h2 class="info"> Choississez la période</h2>';
ViewImp($a_print,$cn);
echo '</DIV>';
}//if ( isset ( $_GET["action"] ))
// The period is given, now show the result
if ( isset ( $_POST["print"]) ) {
echo '<DIV class="redcontent">';
$result=Imp($HTTP_POST_VARS,$cn);
if ($result== NO_PERIOD_SELECTED) {
echo "<SCRIPT>alert(\"Aucune période choisie\"); </SCRIPT>";
return;
}
if ($result== NO_POST_SELECTED) {
echo "<SCRIPT>alert(\"Aucune poste choisi\"); </SCRIPT>";
return;
}
if ( $_POST["action"]=="viewhtml") {
echo "<TABLE>";
echo $result;
echo "<TABLE>";
}
echo '</DIV>';
}//if ( isset ( $_GET["action"] ))
html_page_stop();
?>

View file

@ -45,16 +45,15 @@ $l_Db=sprintf("dossier%d",$g_dossier);
$cn=DbConnect($l_Db);
ShowMenuCompta($g_dossier,$g_UserProperty);
// ShowMenuComptaRight($g_dossier,$g_UserProperty);
if ( $g_UserProperty['use_admin'] == 0 ) {
$r=CheckAction($g_dossier,$g_user,ENCJRN);
if ($r == 0 ){
// check if user can access
if (CheckAction($g_dossier,$g_user,ENCJRN) == 0 ){
/* Cannot Access */
NoAccess();
}
if ( isset ($g_jrn)) {
$right=CheckJrn($g_dossier,$g_user,$g_jrn);
if ($right == 0 ){
if ($CheckJrn($g_dossier,$g_user,$g_jrn) == 0 ){
/* Cannot Access */
NoAccess();
exit -1;
@ -100,15 +99,14 @@ if ( isset ($_GET['JRN_TYPE'] ) ) {
// if a journal is selected show the journal's menu
if ( $g_jrn != -1 ) {
$p_array=array(array("user_jrn.php?JRN_TYPE=VEN" ,"Entrée"),
array("user_jrn.php?JRN_TYPE=ACH","Dépense"),
array("user_jrn.php?JRN_TYPE=FIN","Financier"),
array("user_jrn.php?JRN_TYPE=OD","Op. Diverses"),
array("impress.php","Impression"),
array("","Recherche")
);
$result=ShowItem($p_array,'H',"cell","mtitle","user_jrn.php?JRN_TYPE=".$jrn_type);
// $p_array=array(array("user_jrn.php?JRN_TYPE=VEN" ,"Entrée"),
// array("user_jrn.php?JRN_TYPE=ACH","Dépense"),
// array("user_jrn.php?JRN_TYPE=FIN","Financier"),
// array("user_jrn.php?JRN_TYPE=OD","Op. Diverses"),
// array("impress.php","Impression"),
// array("","Recherche")
// );
$result=ShowJrn( "user_jrn.php?JRN_TYPE=".$jrn_type);
// Get the jrn_type_id
include_once('jrn.php');
$JrnProp=GetJrnProp($g_dossier,$g_jrn);

View file

@ -438,15 +438,8 @@ function ShowMenuJrnUserImp($p_cn,$p_user,$p_dossier)
$right=3;
}
printf ('<TR><TD class="cell">%s</TD>',$l_line['jrn_def_name']);
printf ('<TD class="mshort"><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="mshort"><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
);
printf ('<TR><TD class="cell"><a class="mtitle"
href="user_impress.php?type=jrn&action=print&p_id=%d">%s</a></TD></TR>',$l_line['jrn_def_id'],$l_line['jrn_def_name']);
}
$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,
@ -459,10 +452,8 @@ function ShowMenuJrnUserImp($p_cn,$p_user,$p_dossier)
");
// Pour voir tout les journal ?
if ( $NoPriv == 0 ) {
printf ('<TR><TD class="cell">Grand Livre </TD>');
printf ('<TD class="mshort"><A class="mtitle" HREF="impress.php?p_id=all&action=viewhtml&type=jrn&filter=%d">Html</A></TD>',NO);
printf ('<TD class="mshort"><A class="mtitle" HREF="impress.php?p_id=all&action=viewpdf&type=jrn&filter=%d">Pdf</A></TD></TR>',NO);
printf ('<TR><TD class="cell"><a class="mtitle" href="user_impress.php?type=jrn&action=print&p_id=0">Grand Livre </TD></TR>');
}
echo "</TABLE>";
// Formulaire
@ -493,16 +484,11 @@ function ShowMenuJrnUserImp($p_cn,$p_user,$p_dossier)
echo '<TR><TD style="background-color:#4F8DFF;color:white" COLSPAN="3" > Poste </TD></TR>';
printf ('<TR><TD class="cell">Poste</TD>');
printf ('<TD class="mshort"><A class="mtitle"
HREF="impress.php?action=viewhtml&type=poste">Html</A></TD>'
);
printf ('<TD class="mshort"><A class="mtitle"
HREF="impress.php?action=viewpdf&type=poste">Pdf</A></TD></TR>'
);
printf ('<TR><TD class="cell"><A class="mtitle"
HREF="impress.php?action=viewhtml&type=poste">Poste
</A>
</TD>
</TR>');
echo "</TABLE>";

View file

@ -356,9 +356,12 @@ function ListJrn($p_cn,$p_jrn,$p_where="",$p_array=null)
$r.="<TD>";
// cancel operation
$r.=sprintf('<input TYPE="BUTTON" VALUE="%s" onClick="cancelOperation(\'%s\',\'%s\')">',
"Effacer",$row['jr_grpt_id'],$l_sessid);
"Annuler",$row['jr_grpt_id'],$l_sessid);
$r.="</TD>";
}
else {
$r.="<TD> Opération annulée</TD>";
}
// end row
$r.="</tr>";

View file

@ -418,4 +418,27 @@ $left_menu=ShowItem(array(
'V');
return $left_menu;
}
/* function ShowJrn
**************************************************
* Purpose : Return a string containing the menu
* main menu when you click on Journaux
* parm :
* - $p_menu the current menu (selected)
* gen :
* - none
* return: a string
*/
function ShowJrn($p_menu="")
{
$p_array=array(array("user_jrn.php?JRN_TYPE=VEN" ,"Entrée"),
array("user_jrn.php?JRN_TYPE=ACH","Dépense"),
array("user_jrn.php?JRN_TYPE=FIN","Financier"),
array("user_jrn.php?JRN_TYPE=OD","Op. Diverses"),
array("user_impress.php","Impression"),
array("user_search.php","Recherche")
);
$result=ShowItem($p_array,'H',"cell","mtitle",$p_menu);
return $result;
}
?>