Admin() == 0 && $User->is_local_admin()==0)
{
$sql="select jrn_def_id,jrn_def_name
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$User->login'
and uj_priv !='X'
";
$ret=$cn->make_array($sql);
}
else
{
$ret=$cn->make_array("select jrn_def_id,jrn_def_name
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
}
// Count the forbidden journaux
$NoPriv=$cn->count_sql("select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
jrn_deb_max_line,jrn_cred_max_line
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$User->id'
and uj_priv ='X'
");
// Pour voir tout les journal ?
if ( $NoPriv == 0 )
{
$a=count($ret);
$all=array('value'=>0,'label'=>'Tous les journaux');
$ret[$a]=$all;
}
if ( count($ret) < 1 )
NoAccess();
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$User->get_exercice();
//-----------------------------------------------------
// Form
//-----------------------------------------------------
echo '
';
/*
* Let you change the exercice
*/
echo '';
echo '';
//-----------------------------------------------------
// If print is asked
// First time in html
// after in pdf or cvs
//-----------------------------------------------------
if ( isset( $_REQUEST['bt_html'] ) )
{
require_once("class_acc_ledger.php");
$d=var_export($_GET,true);
$Jrn=new Acc_Ledger($cn,$_GET['jrn_id']);
$Jrn->get_name();
if ( $_GET['p_simple']==0 )
{
$Row=$Jrn->get_row( $_GET['from_periode'],
$_GET['to_periode']
);
}
else
{
$Row=$Jrn->get_rowSimple($_GET['from_periode'],
$_GET['to_periode']
);
}
$rep="";
$hid=new IHidden();
echo '
";
// If the ledger is financial :
// the credit must be negative and written in red
// Get the jrn type
if ( $line['jrn_def_type'] == 'FIN' )
{
$positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1",
array($line['jr_id']));
if ($cn->count() != 0)
$positive = 1;
else
$positive = ($positive > 0)?1:0;
echo "