#419 : réécriture paramètrage journaux

This commit is contained in:
Dany De Bontridder 2011-11-05 23:39:54 +00:00
parent 249222be25
commit 8f0461092e
7 changed files with 683 additions and 771 deletions

View file

@ -42,6 +42,7 @@ require_once('ac_common.php');
require_once('class_inum.php');
require_once('class_lettering.php');
require_once 'class_sort_table.php';
require_once 'class_jrn_def_sql.php';
/*!\file
* \brief Class for jrn, class acc_ledger for manipulating the ledger
*/
@ -49,7 +50,7 @@ require_once 'class_sort_table.php';
/*!\brief Class for jrn, class acc_ledger for manipulating the ledger
*
*/
class Acc_Ledger
class Acc_Ledger extends jrn_def_sql
{
var $id; /*!< jrn_def.jrn_def_id */
var $name; /*!< jrn_def.jrn_def_name */
@ -66,10 +67,13 @@ class Acc_Ledger
function __construct ($p_cn,$p_id)
{
$this->id=$p_id;
$this->name=&$this->jrn_def_name;
$this->jrn_def_id=&$this->id;
$this->db=$p_cn;
$this->row=null;
$this->nb=10;
}
function get_last_pj()
{
if ( $this->db->exist_sequence("s_jrn_pj".$this->id) )
@ -313,8 +317,8 @@ class Acc_Ledger
}
$Res=$this->db->exec_sql("select jrn_def_name from ".
" jrn_def where jrn_def_id=".
$this->id);
" jrn_def where jrn_def_id=$1",
array($this->id));
$Max=Database::num_row($Res);
if ($Max==0) return null;
$ret=Database::fetch_array($Res,0);
@ -565,7 +569,7 @@ class Acc_Ledger
// Build the sql
list($sql,$where)=$Ledger->build_search_sql($_GET);
// Count nb of line
$max_line=$cn->count_sql($sql);
$max_line=$this->db->count_sql($sql);
$step=$_SESSION['g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
@ -3038,6 +3042,297 @@ class Acc_Ledger
$first_name=$this->db->get_value('select ad_value from fiche_detail where ad_id=32 and f_id=$1',array($tiers));
return $name.' '.$first_name;
}
/**
* @brief listing of all ledgers
* @return HTML string
*/
function listing()
{
$str_dossier = dossier::get();
$base_url="?".dossier::get()."&ac=".$_REQUEST['ac'];
$r="";
$r.='<TABLE>';
$r.='<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base_url.'&sa=add">' . _('Création') . ' </A></TD></TR>';
$ret = $this->db->exec_sql("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 order by jrn_def_name");
$Max = Database::num_row($ret);
}
for ($i = 0; $i < $Max; $i++)
{
$l_line = Database::fetch_array($ret, $i);
$url=$base_url."&sa=detail&p_jrn=".$l_line['jrn_def_id'];
$r.=sprintf('<TR><TD class="mtitle"><A class="mtitle" HREF="%s">%s</A></TD></TR>', $url, h($l_line['jrn_def_name']));
}
$r.= "</TABLE>";
return $r;
}
/**
* display detail of a ledger
*
*/
function display_ledger()
{
if ( $this->load() == -1 ) {
throw new Exception(_("Journal n'existe pas"),-1);
}
$type=$this->jrn_def_type;
$name=$this->jrn_def_name;
$code=$this->jrn_def_code;
/* widget for searching an account */
$wSearch=new IPoste();
$wSearch->set_attribute('ipopup','ipop_account');
$wSearch->set_attribute('account','p_jrn_class_deb');
$wSearch->set_attribute('no_overwrite','1');
$wSearch->set_attribute('noquery','1');
$wSearch->table=3;
$wSearch->name="p_jrn_class_deb";
$wSearch->size=20;
$wSearch->value=$this->jrn_def_class_deb;
$search=$wSearch->input();
$wPjPref=new IText();
$wPjPref->name='jrn_def_pj_pref';
$wPjPref->value=$this->jrn_def_pj_pref;
$pj_pref=$wPjPref->input();
$wPjSeq=new INum();
$wPjSeq->value=0;
$wPjSeq->name='jrn_def_pj_seq';
$pj_seq=$wPjSeq->input();
$last_seq=$this->get_last_pj();
$name=$this->jrn_def_name;
$hidden= HtmlInput::hidden('p_jrn',$this->id);
$hidden.= HtmlInput::hidden('sa','detail');
$hidden.= dossier::hidden();
$hidden.=HtmlInput::hidden('p_jrn_deb_max_line',10);
$hidden.=HtmlInput::hidden('p_ech_lib','echeance');
$hidden.=HtmlInput::hidden('p_jrn_type',$type);
/* Load the card */
$card=$this->get_fiche_def();
$rdeb=explode(',',$card['deb']);
$rcred=explode(',',$card['cred']);
/* Numbering (only FIN) */
$num_op=new ICheckBox('numb_operation');
if ( $this->jrn_def_num_op==1) $num_op->selected=true;
/* bank card */
$qcode_bank='';
if ( $type=='FIN')
{
$f_id=$this->jrn_def_bank;
if ( isNumber($f_id)==1)
{
$fBank=new Fiche($this->db,$f_id);
$qcode_bank=$fBank->get_quick_code();
}
}
$new=false;
$cn=$this->db;
echo $hidden;
require_once('template/param_jrn.php');
}
/**
* Verify before update
*
* @param type $array
* 'p_jrn' => string '3' (length=1)
'sa' => string 'detail' (length=6)
'gDossier' => string '82' (length=2)
'p_jrn_deb_max_line' => string '10' (length=2)
'p_ech_lib' => string 'echeance' (length=8)
'p_jrn_type' => string 'ACH' (length=3)
'p_jrn_name' => string 'Achat' (length=5)
'jrn_def_pj_pref' => string 'ACH' (length=3)
'jrn_def_pj_seq' => string '0' (length=1)
'FICHECRED' =>
array
0 => string '4' (length=1)
'FICHEDEB' =>
array
0 => string '7' (length=1)
1 => string '5' (length=1)
2 => string '13' (length=2)
'update' => string 'Sauve' (length=5
*@exception is throw is test are not valid
*/
function verify_ledger($array)
{
extract ($array);
try
{
if (isNumber($p_jrn ) == 0) throw new Exception("Id invalide");
if (isNumber($p_jrn_deb_max_line) == 0) throw new Exception ("Nombre de ligne incorrect");
if (trim($p_jrn_name) == "") throw new Exception ("Nom de journal invalide");
if ($this->db->get_value("select count(*) from jrn_def where jrn_def_name=$1 and jrn_Def_id<>$2",
array($p_jrn_name,$p_jrn)) > 0) throw new Exception ("Un journal avec ce nom existe déjà");
if ($p_jrn_type=='FIN')
{
$a=new Fiche($this->db);
$result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
if ( $result==1)throw new Exception ("Aucun compte en banque n'est donné");
}
} catch(Exception $e)
{
throw $e;
}
}
/**
* update a ledger
* @param type $array normally post
* @see verify_ledger
*/
function update($array)
{
extract ($array);
$this->jrn_def_id=$p_jrn;
$this->jrn_def_name=$p_jrn_name;
$this->jrn_def_ech_lib=$p_ech_lib;
$this->jrn_def_max_line_deb=$p_jrn_deb_max_line;
$this->jrn_def_type=$p_jrn_type;
$this->jrn_def_pj_pref=$jrn_def_pj_pref;
$this->jrn_def_fiche_deb=(isset($FICHEDEB))?join($FICHEDEB,','):"";
switch($this->jrn_def_type)
{
case 'ACH':
case 'VEN':
$this->jrn_def_fiche_cred=(isset($FICHECRED))?join($FICHECRED,','):'';
break;
case 'ODS':
$this->jrn_def_class_deb=$p_jrn_class_deb;
break;
case 'FIN':
$a=new Fiche($this->db);
$result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
$bank=$a->id;
$this->jrn_def_bank=$bank;
if ( $result==-1)throw new Exception ("Aucun compte en banque n'est donné");
$this->jrn_def_num_op=(isset($numb_operation))?1:0;
break;
}
parent::update();
//Reset sequence if needed
if ($jrn_def_pj_seq != 0)
{
$Res=$this->db->alter_seq("s_jrn_pj".$p_jrn,$jrn_def_pj_seq);
}
}
/**
* display screen to enter a new ledger
*/
function input_new()
{
$wSearch=new IPoste();
$wSearch->table=3;
$wSearch->set_attribute('ipopup','ipop_account');
$wSearch->set_attribute('account','p_jrn_class_deb');
$wSearch->set_attribute('no_overwrite','1');
$wSearch->set_attribute('noquery','1');
$wSearch->name="p_jrn_class_deb";
$wSearch->size=20;
$search=$wSearch->input();
/* construct all the hidden */
$hidden= HtmlInput::hidden('p_jrn',-1);
$hidden.= HtmlInput::hidden('p_action','jrn');
$hidden.= HtmlInput::hidden('sa','add');
$hidden.= dossier::hidden();
$hidden.=HtmlInput::hidden('p_jrn_deb_max_line',10);
$hidden.=HtmlInput::hidden('p_ech_lib','echeance');
/* properties of the ledger */
$name="";
$code="";
$wType=new ISelect();
$wType->value=$this->db->make_array('select jrn_type_id,jrn_desc from jrn_type');
$wType->name="p_jrn_type";
$type=$wType->input();
$rcred=$rdeb=array();
$wPjPref=new IText();
$wPjPref->name='jrn_def_pj_pref';
$pj_pref=$wPjPref->input();
$pj_seq='';
$last_seq=0;
$new=true;
/* bank card */
$qcode_bank='';
/* Numbering (only FIN) */
$num_op=new ICheckBox('numb_operation');
echo dossier::hidden();
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('p_jrn',-1);
echo HtmlInput::hidden('sa','add');
$cn=$this->db;
require_once('template/param_jrn.php');
}
/**
* Insert a new ledger
* @param type $array normally $_POST
* @see verify_ledger
*/
function save_new($array)
{
$this->load();
extract ($array);
$this->jrn_def_id=-1;
$this->jrn_def_name=$p_jrn_name;
$this->jrn_def_ech_lib=$p_ech_lib;
$this->jrn_def_max_line_deb=$p_jrn_deb_max_line;
$this->jrn_def_type=$p_jrn_type;
$this->jrn_def_pj_pref=$jrn_def_pj_pref;
$this->jrn_def_fiche_deb=(isset($FICHEDEB))?join($FICHEDEB,','):"";
$this->jrn_def_code=sprintf("%s%02d",trim(substr($this->jrn_def_type,0,1)),Acc_Ledger::next_number($this->db,$this->jrn_def_type));
switch($this->jrn_def_type)
{
case 'ACH':
case 'VEN':
$this->jrn_def_fiche_cred=(isset($FICHECRED))?join($FICHECRED,','):'';
break;
case 'ODS':
$this->jrn_def_class_deb=$p_jrn_class_deb;
break;
case 'FIN':
$a=new Fiche($this->db);
$result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
$bank=$a->id;
$this->jrn_def_bank=$bank;
if ( $result==-1)throw new Exception ("Aucun compte en banque n'est donné");
$this->jrn_def_num_op=(isset($numb_operation))?1:0;
break;
}
parent::insert();
}
/**
* delete a ledger IF is not already used
* @exeption : cannot delete
*/
function delete_ledger()
{
try
{
if ( $this->db->get_value("select count(jr_id) from jrn where jr_def_id=$1",array($this->jrn_def_id))>0)
throw new Exception("Impossible d'effacer un journal qui contient des opérations");
parent::delete();
}
catch(Exception $e)
{
throw $e;
}
}
}

View file

@ -0,0 +1,380 @@
<?php
/**
* @file
* @brief Manage the table public.jrn_def
*
*
Example
@code
@endcode
*/
require_once('class_database.php');
require_once('ac_common.php');
/**
* @brief Manage the table public.jrn_def
*/
class Jrn_Def_sql
{
/* example private $variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0); */
protected $variable = array(
"jrn_def_id" => "jrn_def_id",
"jrn_def_name" => "jrn_def_name"
, "jrn_def_class_deb" => "jrn_def_class_deb"
, "jrn_def_class_cred" => "jrn_def_class_cred"
, "jrn_def_fiche_deb" => "jrn_def_fiche_deb"
, "jrn_def_fiche_cred" => "jrn_def_fiche_cred"
, "jrn_deb_max_line" => "jrn_deb_max_line"
, "jrn_cred_max_line" => "jrn_cred_max_line"
, "jrn_def_ech" => "jrn_def_ech"
, "jrn_def_ech_lib" => "jrn_def_ech_lib"
, "jrn_def_type" => "jrn_def_type"
, "jrn_def_code" => "jrn_def_code"
, "jrn_def_pj_pref" => "jrn_def_pj_pref"
, "jrn_def_bank" => "jrn_def_bank"
, "jrn_def_num_op" => "jrn_def_num_op"
);
function __construct(& $p_cn, $p_id=-1)
{
$this->db = $p_cn;
$this->jrn_def_id = $p_id;
if ($p_id == -1)
{
/* Initialize an empty object */
foreach ($this->variable as $key => $value)
$this->$value = null;
$this->jrn_def_id = $p_id;
}
else
{
/* load it */
$this->load();
}
}
public function get_parameter($p_string)
{
if (array_key_exists($p_string, $this->variable))
{
$idx = $this->variable[$p_string];
return $this->$idx;
}
else
throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur attribut inexistant');
}
public function set_parameter($p_string, $p_value)
{
if (array_key_exists($p_string, $this->variable))
{
$idx = $this->variable[$p_string];
$this->$idx = $p_value;
}
else
throw new Exception(__FILE__ . ":" . __LINE__ . $p_string . 'Erreur attribut inexistant');
}
public function get_info()
{
return var_export($this, true);
}
public function verify_sql()
{
// Verify that the elt we want to add is correct
/* verify only the datatype */
if (trim($this->jrn_def_name) == '')
$this->jrn_def_name = null;
if (trim($this->jrn_def_class_deb) == '')
$this->jrn_def_class_deb = null;
if (trim($this->jrn_def_class_cred) == '')
$this->jrn_def_class_cred = null;
if (trim($this->jrn_def_fiche_deb) == '')
$this->jrn_def_fiche_deb = null;
if (trim($this->jrn_def_fiche_cred) == '')
$this->jrn_def_fiche_cred = null;
if (trim($this->jrn_deb_max_line) == '')
$this->jrn_deb_max_line = null;
if ($this->jrn_deb_max_line !== null && settype($this->jrn_deb_max_line, 'float') == false)
throw new Exception('DATATYPE jrn_deb_max_line $this->jrn_deb_max_line non numerique');
if (trim($this->jrn_cred_max_line) == '')
$this->jrn_cred_max_line = null;
if ($this->jrn_cred_max_line !== null && settype($this->jrn_cred_max_line, 'float') == false)
throw new Exception('DATATYPE jrn_cred_max_line $this->jrn_cred_max_line non numerique');
if (trim($this->jrn_def_ech) == '')
$this->jrn_def_ech = null;
if (trim($this->jrn_def_ech_lib) == '')
$this->jrn_def_ech_lib = null;
if (trim($this->jrn_def_type) == '')
$this->jrn_def_type = null;
if (trim($this->jrn_def_code) == '')
$this->jrn_def_code = null;
if (trim($this->jrn_def_pj_pref) == '')
$this->jrn_def_pj_pref = null;
if (trim($this->jrn_def_bank) == '')
$this->jrn_def_bank = null;
if ($this->jrn_def_bank !== null && settype($this->jrn_def_bank, 'float') == false)
throw new Exception('DATATYPE jrn_def_bank $this->jrn_def_bank non numerique');
if (trim($this->jrn_def_num_op) == '')
$this->jrn_def_num_op = null;
if ($this->jrn_def_num_op !== null && settype($this->jrn_def_num_op, 'float') == false)
throw new Exception('DATATYPE jrn_def_num_op $this->jrn_def_num_op non numerique');
}
public function save()
{
/* please adapt */
if ($this->jrn_def_id == -1)
$this->insert();
else
$this->update();
}
/**
* @brief retrieve array of object thanks a condition
* @param $cond condition (where clause) (optional by default all the rows are fetched)
* you can use this parameter for the order or subselect
* @param $p_array array for the SQL stmt
* @see Database::exec_sql get_object Database::num_row
* @return the return value of exec_sql
*/
public function seek($cond='', $p_array=null)
{
$sql = "select * from public.jrn_def $cond";
$aobj = array();
$ret = $this->db->exec_sql($sql, $p_array);
return $ret;
}
/**
* get_seek return the next object, the return of the query must have all the column
* of the object
* @param $p_ret is the return value of an exec_sql
* @param $idx is the index
* @see seek
* @return object
*/
public function get_object($p_ret, $idx)
{
// map each row in a object
$oobj = new Jrn_Def_sql($this->db);
$array = Database::fetch_array($p_ret, $idx);
foreach ($array as $idx => $value)
{
$oobj->$idx = $value;
}
return $oobj;
}
public function insert()
{
if ($this->verify_sql() != 0)
return;
if ($this->jrn_def_id == -1)
{
/* please adapt */
$sql = "insert into public.jrn_def(jrn_def_name
,jrn_def_class_deb
,jrn_def_class_cred
,jrn_def_fiche_deb
,jrn_def_fiche_cred
,jrn_deb_max_line
,jrn_cred_max_line
,jrn_def_ech
,jrn_def_ech_lib
,jrn_def_type
,jrn_def_code
,jrn_def_pj_pref
,jrn_def_bank
,jrn_def_num_op
) values ($1
,$2
,$3
,$4
,$5
,$6
,$7
,$8
,$9
,$10
,$11
,$12
,$13
,$14
) returning jrn_def_id";
$this->jrn_def_id = $this->db->get_value(
$sql, array($this->jrn_def_name
, $this->jrn_def_class_deb
, $this->jrn_def_class_cred
, $this->jrn_def_fiche_deb
, $this->jrn_def_fiche_cred
, $this->jrn_deb_max_line
, $this->jrn_cred_max_line
, $this->jrn_def_ech
, $this->jrn_def_ech_lib
, $this->jrn_def_type
, $this->jrn_def_code
, $this->jrn_def_pj_pref
, $this->jrn_def_bank
, $this->jrn_def_num_op
)
);
}
else
{
$sql = "insert into public.jrn_def(jrn_def_name
,jrn_def_class_deb
,jrn_def_class_cred
,jrn_def_fiche_deb
,jrn_def_fiche_cred
,jrn_deb_max_line
,jrn_cred_max_line
,jrn_def_ech
,jrn_def_ech_lib
,jrn_def_type
,jrn_def_code
,jrn_def_pj_pref
,jrn_def_bank
,jrn_def_num_op
,jrn_def_id) values ($1
,$2
,$3
,$4
,$5
,$6
,$7
,$8
,$9
,$10
,$11
,$12
,$13
,$14
,$15
) returning jrn_def_id";
$this->jrn_def_id = $this->db->get_value(
$sql, array($this->jrn_def_name
, $this->jrn_def_class_deb
, $this->jrn_def_class_cred
, $this->jrn_def_fiche_deb
, $this->jrn_def_fiche_cred
, $this->jrn_deb_max_line
, $this->jrn_cred_max_line
, $this->jrn_def_ech
, $this->jrn_def_ech_lib
, $this->jrn_def_type
, $this->jrn_def_code
, $this->jrn_def_pj_pref
, $this->jrn_def_bank
, $this->jrn_def_num_op
, $this->jrn_def_id)
);
}
}
public function update()
{
if ($this->verify_sql() != 0)
return;
/* please adapt */
$sql = " update public.jrn_def set jrn_def_name = $1
,jrn_def_class_deb = $2
,jrn_def_class_cred = $3
,jrn_def_fiche_deb = $4
,jrn_def_fiche_cred = $5
,jrn_deb_max_line = $6
,jrn_cred_max_line = $7
,jrn_def_ech = $8
,jrn_def_ech_lib = $9
,jrn_def_type = $10
,jrn_def_code = $11
,jrn_def_pj_pref = $12
,jrn_def_bank = $13
,jrn_def_num_op = $14
where jrn_def_id= $15";
$res = $this->db->exec_sql(
$sql, array($this->jrn_def_name
, $this->jrn_def_class_deb
, $this->jrn_def_class_cred
, $this->jrn_def_fiche_deb
, $this->jrn_def_fiche_cred
, $this->jrn_deb_max_line
, $this->jrn_cred_max_line
, $this->jrn_def_ech
, $this->jrn_def_ech_lib
, $this->jrn_def_type
, $this->jrn_def_code
, $this->jrn_def_pj_pref
, $this->jrn_def_bank
, $this->jrn_def_num_op
, $this->jrn_def_id)
);
}
/**
* @brief load a object
* @return 0 on success -1 the object is not found
*/
public function load()
{
$sql = "select jrn_def_name
,jrn_def_class_deb
,jrn_def_class_cred
,jrn_def_fiche_deb
,jrn_def_fiche_cred
,jrn_deb_max_line
,jrn_cred_max_line
,jrn_def_ech
,jrn_def_ech_lib
,jrn_def_type
,jrn_def_code
,jrn_def_pj_pref
,jrn_def_bank
,jrn_def_num_op
from public.jrn_def where jrn_def_id=$1";
/* please adapt */
$res = $this->db->get_array(
$sql, array($this->jrn_def_id)
);
if (count($res) == 0)
{
/* Initialize an empty object */
foreach ($this->variable as $key => $value)
$this->$key = '';
return -1;
}
foreach ($res[0] as $idx => $value)
{
$this->$idx = $value;
}
return 0;
}
public function delete()
{
$sql = "delete from public.jrn_def where jrn_def_id=$1";
$res = $this->db->exec_sql($sql, array($this->jrn_def_id));
}
/**
* Unit test for the class
*/
static function test_me()
{
}
}
// Jrn_Def_sql::test_me();
?>

View file

@ -1,46 +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");
require_once('class_database.php');
include_once ("class_user.php");
$cn=new Database($gDossier);
$User=new User($cn);
$User->Check();
$User->check_dossier($gDossier);
include_once ("user_menu.php");
$User->can_request(PARJRN);
echo '<div class="lmenu">';
MenuJrn($gDossier);
echo '</div>';
html_page_stop();
?>

View file

@ -1,198 +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");
require_once("class_itext.php");
require_once("class_iselect.php");
require_once ('class_acc_ledger.php');
/* ipopup for search poste */
echo IPoste::ipopup('ipop_account');
/* search card */
$search_card=new IPopup('ipop_card');
$search_card->title=_('Recherche de fiche');
echo $search_card->input();
html_page_start($_SESSION['g_theme']);
require_once('class_dossier.php');
$gDossier=dossier::id();
require_once('class_database.php');
/* Admin. Dossier */
include_once ("class_user.php");
$cn=new Database($gDossier);
$User=new User($cn);
$User->Check();
$User->check_dossier($gDossier);
include_once ("user_menu.php");
$User->can_request(PARJRN);
if ( isset ($_POST["add"]) )
{
if ( !isset($_POST["p_jrn_name"]) || ! isset($_POST["p_jrn_type"] ))
{
echo '<H2 CLASS="error">'._('Un paramètre manque').'</H2>';
}
else
{
/* if name already use we stop */
if ( $cn->count_sql("select * from jrn_def where upper(jrn_def_name)=upper($1)",array($_POST['p_jrn_name'])) >0 )
{
alert (_('Un journal de ce nom existe déjà'));
}
else
{
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"];
$p_jrn_class_deb=sql_string($_POST["p_jrn_class_deb"]);
if (strlen(trim($p_jrn_name))==0) return;
// compute the jrn_def.jrn_def_code
$p_code=sprintf("%s%02d",trim(substr($_POST['p_jrn_type'],0,1)),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["FICHECRED"]))
{
$p_jrn_fiche_cred=join(",",$_POST["FICHECRED"]);
}
$l_cred_max_line=$l_deb_max_line;
$cn->start();
$bank=null;
if (isset($_POST['bank']))
{
$a=new Fiche($cn);
$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
$bank=$a->id;
if ($bank==0) $bank=null;
}
$nop=0;
if (isset($_POST['numb_operation']))
{
$nop=1;
}
if ($_POST['p_jrn_type']=='FIN' && $bank==null)
{
alert("Vous devez donner un compte en banque");
}
else
{
$Sql="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,jrn_def_pj_pref,jrn_def_bank,jrn_def_num_op)
values ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
$sql_array=array(
$p_jrn_name,$p_jrn_class_deb,$p_jrn_class_deb,
$l_deb_max_line,$l_cred_max_line,$_POST['p_jrn_type'],
$p_jrn_fiche_deb,$p_jrn_fiche_cred,
$p_code,$_POST['jrn_def_pj_pref'],
$bank,$nop);
$Res=$cn->exec_sql($Sql,$sql_array);
$ledger_id=$cn->get_current_seq('s_jrn_def');
$Res=$cn->create_sequence('s_jrn_pj'.$ledger_id);
$cn->commit();
}
}
}
echo '<div class="lmenu">';
MenuJrn();
echo '</div>';
exit();
}
echo '<div class="lmenu">';
MenuJrn();
echo '</div>';
echo '<DIV CLASS="u_redcontent">';
/* widget for searching an account */
$wSearch=new IPoste();
$wSearch->table=3;
$wSearch->set_attribute('ipopup','ipop_account');
$wSearch->set_attribute('account','p_jrn_class_deb');
$wSearch->set_attribute('no_overwrite','1');
$wSearch->set_attribute('noquery','1');
$wSearch->name="p_jrn_class_deb";
$wSearch->size=20;
$search=$wSearch->input();
/* construct all the hidden */
$hidden= HtmlInput::hidden('p_jrn',0);
$hidden.= HtmlInput::hidden('p_action','jrn');
$hidden.= HtmlInput::hidden('sa','add');
$hidden.= dossier::hidden();
$hidden.=HtmlInput::hidden('p_jrn_deb_max_line',10);
$hidden.=HtmlInput::hidden('p_ech_lib','echeance');
/* properties of the ledger */
$name="";
$code="";
$wType=new ISelect();
$wType->value=$cn->make_array('select jrn_type_id,jrn_desc from jrn_type');
$wType->name="p_jrn_type";
$type=$wType->input();
$rcred=$rdeb=array();
$wPjPref=new IText();
$wPjPref->name='jrn_def_pj_pref';
$pj_pref=$wPjPref->input();
$pj_seq='';
$last_seq=0;
$new=true;
/* bank card */
$qcode_bank='';
/* Numbering (only FIN) */
$num_op=new ICheckBox('numb_operation');
echo '<FORM METHOD="POST">';
echo dossier::hidden();
echo HtmlInput::hidden('p_action','jrn');
echo HtmlInput::hidden('p_jrn',-1);
echo HtmlInput::hidden('sa','add');
require_once('template/param_jrn.php');
echo HtmlInput::submit('add','Sauver');
echo '<INPUT TYPE="RESET" class="button" VALUE="Reset">';
echo '</FORM>';
echo "</DIV>";
html_page_stop();
?>

View file

@ -1,256 +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_itext.php");
require_once('class_dossier.php');
require_once('class_acc_ledger.php');
/* javascript for the search poste */
require_once('class_ipopup.php');
/* ipopup for search poste */
echo IPoste::ipopup('ipop_account');
/* search card */
$search_card=new IPopup('ipop_card');
$search_card->title=_('Recherche de fiche');
echo $search_card->input();
$gDossier=dossier::id();
include_once ("ac_common.php");
html_page_start($_SESSION['g_theme']);
require_once('class_database.php');
/* Admin. Dossier */
$cn=new Database($gDossier);
include_once ("class_user.php");
$User=new User($cn);
$User->Check();
$User->check_dossier($gDossier);
$User->can_request(PARJRN);
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 ( isNumber($_POST['p_jrn'])==0)
{
alert(_("Impossible d\'effacer ce journal.\n Il est utilisé\n"));
}
else if ( $cn->get_value("select count(*) from jrn where jr_def_id=$1",array($_POST['p_jrn'])) == 0 )
{
$cn->exec_sql("delete from jrn_def where jrn_def_id=$1",array($_POST['p_jrn']));
}
else
{
alert(_("Impossible d\'effacer ce journal.\n Il est utilisé\n"));
}
}
//--------------------------------------------------
// Update ledger
If ( isset ($_POST["update"] ))
{
if ( !isset($_POST["p_jrn_name"]) )
{
echo '<H2 CLASS="error">'._('Un paramètre manque').'</H2>';
}
else
{
if ( isset ($_POST['p_ech']) && $_POST['p_ech'] == 'no' )
{
$p_ech='false';
$p_ech_lib='null';
}
else
{
$p_ech='true';
$p_ech_lib="'".$_POST['p_ech_lib']."'";
}
$nop=0;
if (isset($_POST['numb_operation']))
{
$nop=1;
}
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=sql_string($p_jrn_name);
$p_jrn_fiche_deb="";
$p_jrn_fiche_cred="";
$bank=null;
if (isset($_POST['bank']))
{
$a=new Fiche($cn);
$a->get_by_qcode(trim(strtoupper($_POST['bank'])),false);
$bank=$a->id;
if ($bank==0) $bank=null;
}
$err=0;
if ($_POST['p_jrn_type']=='FIN' && $bank==null)
{
alert("Vous devez donner un compte en banque");
$err=1;
}
if ( isset ($_POST["FICHEDEB"]))
{
$p_jrn_fiche_deb=join(",",$_POST["FICHEDEB"]);
}
if ( isset ($_POST["FICHECRED"]))
{
$p_jrn_fiche_cred=join(",",$_POST["FICHECRED"]);
}
if ($err==0)
{
$p_jrn_class_deb=(isset($_POST['p_jrn_class_deb']))?$_POST['p_jrn_class_deb']:'';
$Sql="update jrn_def set jrn_def_name=$1,jrn_def_class_deb=$2,jrn_def_class_cred=$3,
jrn_deb_max_line=$4,jrn_cred_max_line=$5,jrn_def_ech=$6,jrn_def_ech_lib=$7,jrn_def_fiche_deb=$8,
jrn_def_fiche_cred=$9, jrn_def_pj_pref=upper($10), jrn_def_bank=$12,jrn_def_num_op=$13
where jrn_def_id=$11";
$sql_array=array(
$p_jrn_name,$p_jrn_class_deb,$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,
$_POST['jrn_def_pj_pref'],
$_GET['p_jrn'],
$bank,
$nop
);
$Res=$cn->exec_sql($Sql,$sql_array);
if ( isNumber($_POST['jrn_def_pj_seq']) == 1 && $_POST['jrn_def_pj_seq']!=0)
$Res=$cn->alter_seq("s_jrn_pj".$_GET['p_jrn'],$_POST['jrn_def_pj_seq']);
}
}
}
echo '<div class="lmenu">';
MenuJrn();
echo '</div>';
?>
<script language="javascript">
function m_confirm()
{
return confirm ("Etes-vous sur de vouloir effacer ce journal ?");
}
</script>
<?php
$Res=$cn->exec_sql("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".
",jrn_def_bank,jrn_def_num_op".
" from jrn_def where".
" jrn_def_id=".$_REQUEST['p_jrn']);
if ( Database::num_row($Res) == 0 ) exit();
$l_line=Database::fetch_array($Res,0);
/* Load all the properties of the ledger */
$Ledger=new Acc_Ledger($cn,$_REQUEST['p_jrn']);
$prop=$Ledger->get_propertie();
$type=$prop['jrn_def_type'];
$name=$prop['jrn_def_name'];
$code=$prop['jrn_def_code'];
/* widget for searching an account */
$wSearch=new IPoste();
$wSearch->set_attribute('ipopup','ipop_account');
$wSearch->set_attribute('account','p_jrn_class_deb');
$wSearch->set_attribute('no_overwrite','1');
$wSearch->set_attribute('noquery','1');
$wSearch->table=3;
$wSearch->name="p_jrn_class_deb";
$wSearch->size=20;
$wSearch->value=$prop['jrn_def_class_deb'];
$search=$wSearch->input();
$new=false;
$wPjPref=new IText();
$wPjPref->name='jrn_def_pj_pref';
$wPjPref->value=$prop['jrn_def_pj_pref'];
$pj_pref=$wPjPref->input();
$wPjSeq=new INum();
$wPjSeq->value=0;
$wPjSeq->name='jrn_def_pj_seq';
$pj_seq=$wPjSeq->input();
$last_seq=$Ledger->get_last_pj();
$name=$l_line['jrn_def_name'];
/* construct all the hidden */
$hidden= HtmlInput::hidden('p_jrn',$_GET['p_jrn']);
$hidden.= HtmlInput::hidden('p_action','jrn');
$hidden.= HtmlInput::hidden('sa','detail');
$hidden.= dossier::hidden();
$hidden.=HtmlInput::hidden('p_jrn_deb_max_line',10);
$hidden.=HtmlInput::hidden('p_ech_lib','echeance');
$hidden.=HtmlInput::hidden('p_jrn_type',$type);
/* Load the card */
$card=$Ledger->get_fiche_def();
$rdeb=explode(',',$card['deb']);
$rcred=explode(',',$card['cred']);
/* Numbering (only FIN) */
$num_op=new ICheckBox('numb_operation');
if ( $l_line['jrn_def_num_op']==1) $num_op->selected=true;
/* bank card */
$qcode_bank='';
if ( $type=='FIN')
{
$f_id=$l_line['jrn_def_bank'];
if ( isNumber($f_id)==1)
{
$fBank=new Fiche($cn,$f_id);
$qcode_bank=$fBank->get_quick_code();
}
}
echo '<div class="u_redcontent">';
echo '<form method="POST">';
echo $hidden;
require_once('template/param_jrn.php');
echo '<INPUT TYPE="SUBMIT" class="button" VALUE="Sauve" name="update">
<INPUT TYPE="RESET" class="button" VALUE="Reset">
<INPUT TYPE="submit" class="button" name="efface" value="Efface" onClick="return m_confirm();">';
echo '</FORM>';
echo "</DIV>";
html_page_stop();
?>

View file

@ -14,7 +14,8 @@ if ($new || $type=='ODS' ):
<?php echo $search;?>
</TD>
<TD CLASS="notice">
<?=_("Uniquement pour les journaux d'Opérations Diverses")?>
<?=_("Uniquement pour les journaux d'Opérations Diverses, les valeurs sont séparées par des espaces, on peut aussi
utiliser le * pour indiquer 'tous les postes qui en dépendent' exemple: 4*")?>
</TD>
</TR>
<?
@ -84,7 +85,7 @@ echo $card->input();
<?php echo $pj_pref; ?>
</TD>
<TD>
<span class="notice"><?=_('Le préfixe des pièces peut être différent pour chaque journal')?></span><br>
<span class="notice"><?=_('Le préfixe des pièces doit être différent pour chaque journal, on peut aussi utiliser l\'année')?></span><br>
<span class="notice"><?=_('Uniquement des chiffres')?></span>
</TD>

View file

@ -31,118 +31,6 @@ require_once("class_ispan.php");
/*!
* \brief show the top menu for the user profile
* and highight the selected one
* \param p_high what to hightlight, by default it is autodetected
* but sometimes it must be given. Default value=""
*
* \return string
*
*/
function ShowMenuCompta_deprecated($p_high="")
{
require_once('class_database.php');
// find our current menu
$default=basename($_SERVER['PHP_SELF']);
switch ($default)
{
case "user_jrn.php":
$default.="?show&".dossier::get();
break;
}
if ( $p_high !== "" ) $default=$p_high;
$default=-1;
if ( isset($_REQUEST['p_action']))
{
switch ($_REQUEST['p_action'] )
{
case 'impress':
$default=5;
break;
case 'fiche':
$default=6;
break;
case 'quick_writing':
$default=4;
break;
case 'gl':
$default=0;
break;
case 'ven':
$default=1;
break;
case 'client':
$default=1;
break;
case 'ach':
case 'fournisseur':
$default=2;
break;
case 'fin':
$default=3;
break;
case 'let':
$default=10;
break;
}
}
$str_dossier=dossier::get();
$p_array=array(
array("compta.php?p_action=gl&".$str_dossier ,_("Historique"),_("Historique : toutes les opérations"),0),
array("compta.php?p_action=ven&".$str_dossier ,_("Recette"),_("Journal de vente, produit et recette"),1),
array("compta.php?p_action=ach&".$str_dossier,_("Dépense"),_("Journaux de dépense, d'achat"),2 ),
array("compta.php?p_action=fin&".$str_dossier,_("Financier"),_("Journaux financiers: les banques, la caisse"),3),
array('compta.php?p_action=quick_writing&'.$str_dossier,_('Opération Diverses'),_('Journaux d\'OD: salaires, déclarations TVA,...'),4),
array("compta.php?p_action=impress&".$str_dossier,_("Impression"),_("Impression"),5),
array("compta.php?p_action=fiche&".$str_dossier,_("Fiche"),_("Ajouter, modifier ou effacer des fiches"),6),
array("compta.php?p_action=let&".$str_dossier,_("Lettrage"),_("Ajouter, modifier ou effacer des lettrage"),10),
array("user_advanced.php?".$str_dossier,_("Avancé"),_("Opérations délicates"),7),
);
$result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' style="width:100%;"');
$str_dossier=dossier::get();
$r="";
$r.=menu_tool("compta.php");
$r.='<div class="topmenu">';
$r.=$result;
$r.='</div>';
return $r;
}
/*!
**************************************************
* \brief build the menu of user_advanced.php
*
* \param $default
*
* \return the menu
*/
function ShowMenuAdvanced_deprecated($default="")
{
$str_dossier=dossier::get();
// Show the left menu
$left_menu=ShowItem(array(
//('rapprt.php','Rapprochement'),
array('user_advanced.php?'.$str_dossier.'&p_action=preod',_('Ecritures definies'),"",9),
array('compta.php?p_action=stock&'.$str_dossier,'Stock',_("Gestion des stocks"),5),
array('user_advanced.php?p_action=defreport&'.$str_dossier,_('Rapport'),_("Rapport"),6),
array('user_advanced.php?p_action=ouv&'.$str_dossier,_('Ecriture ouverture'),"",8),
array('user_advanced.php?p_action=verif&'.$str_dossier,_('Vérification'),"",10)
),
'H',"mtitle","mtitle",$default);
$r='<div class="u_subtmenu">'.$left_menu."</div>";
return $r;
}
/*!
* \brief Show the menu for the card management
*
@ -229,66 +117,7 @@ function MenuAdmin()
$menu=ShowItem($item,'H',"mtitle","mtitle",$def,' style="width:80%;margin-left:10%" ');
return $menu;
}
/*!
* \brief Show the parameter menu
*
* \param $p_action the last action choosed
*
*
*
* \return HTML Code
*
*
*/
function ShowMenuParam($p_action="")
{
$s=dossier::get();
$sub_menu=ShowItem(array(
array('parametre.php?p_action=company&'.$s,_('Sociétés'),_('Parametre societe'),1),
array('parametre.php?p_action=periode&'.$s,_('Periode'),_("Gestion des periodes"),25),
array('parametre.php?p_action=divers&'.$s,_('Divers'),_('Devise, moyen de paiement'),2),
array('parametre.php?p_action=pcmn&'.$s,_('Plan Comptable'),_('Modification du plan comptable'),11),
array('parametre.php?p_action=ext&'.$s,_('Extension'),_('Extension'),3),
array('parametre.php?p_action=sec&'.$s,_('Sécurité'),_('securite'),8),
array('parametre.php?p_action=preod&'.$s,_('Ecritures définies'),_('Ecritures définies'),12),
array('parametre.php?p_action=document&'.$s,_('Document'),_('Facture, lettre de rappel, proposition...'),7),
array('parametre.php?p_action=jrn&'.$s,_('Journaux'),_('Creation et modification de journaux'),10)
),
'H',"mtitle","mtitle",$p_action,' width="100%"');
return $sub_menu;
}
/*!
* \brief display the html the menu in the jrn page
*
* \return nothing
*
*
*/
function MenuJrn()
{
$str_dossier=dossier::get();
echo '<TABLE>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=jrn&sa=add&'.$str_dossier.'">'._('Création').' </A></TD></TR>';
require_once('class_database.php');
$Cn=new Database(dossier::id());
$Ret=$Cn->exec_sql("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 order by jrn_def_name");
$Max=Database::num_row($Ret);
for ($i=0;$i<$Max;$i++)
{
$l_line=Database::fetch_array($Ret,$i);
printf ('<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=jrn&sa=detail&p_jrn=%s&'.$str_dossier.'">%s</A></TD></TR>',
$l_line['jrn_def_id'],$l_line['jrn_def_name']);
}
echo "</TABLE>";
}
/*!
* \brief Show the menu from the pcmn page
*
@ -319,96 +148,3 @@ function menu_acc_plan($p_start=1)
echo "</TABLE>";
}
/*!
* \brief Show the menu for importing, verify and transfert Bank CSV
*
* \return nothing
*/
function ShowMenuImport()
{
$str_dossier=dossier::get();
echo '<TABLE>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="import.php?action=import&'.$str_dossier.'">'._('Importer CSV').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="import.php?action=verif&'.$str_dossier.'">'._('Verif CSV').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="import.php?action=transfer&'.$str_dossier.'">'._('Transfert CSV').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="import.php?action=purge&'.$str_dossier.'">'._('Purge CSV').'</A></TD></TR>';
echo "</TABLE>";
}
/*!\brief show the top menu to access the different modules in top
* \param $p_from from which module this function is called
* \note must include javascript : acc_ledger.js
* \return string
*/
function menu_tool_deprecated($p_from)
{
if ( ! isset ($_REQUEST['gDossier']))
return "" ;
$r="";
$r.= '<div class="u_tool">';
$r.= '<div class="name">';
$r.= "<H2 class=\"dossier\"> Dossier : ".h(dossier::name())."</h2> ";
$r.=IButton::show_calc();
$r.= '</div>';
$r.= '<div class="acces_direct">';
if ( $p_from == 'compta') $view='E';
else $view='S';
$agent=$_SERVER['HTTP_USER_AGENT'];
$amodule=array(
array('value'=>'access.php','label'=>_('Tableau de bord')),
array('value'=>'user_pref.php','label'=>_('Preference')),
array('value'=>'parametre.php','label'=>_('Paramètre')),
array('value'=>'user_login.php','label'=>_('Autre Dossier')),
array('value'=>'logout.php','label'=>_('Deconnexion')),
array('value'=>'new_line'),
array('value'=>'compta.php','label'=>_('Compta Générale')),
array('value'=>'commercial.php','label'=>_('Gestion')),
array('value'=>'comptanalytic.php','label'=>_('Compt. Analytique')),
array('value'=>'extension.php','label'=>_('Extension'))
) ;
$gDossier=dossier::id();
$r.= '<table>';
$r.='<tr>';
foreach($amodule as $col )
{
$url=$col['value'].'?'.dossier::get();
if ( $p_from==$col['value'])
{
$r.= '<td style="background-color:red">'.
'<a class="mtitle" href="'.$url.'" >'.$col['label'].'</a>'.
'</td>';
}
else
{
if ( $col['value']=='new_line')
{
$r.='</tr><tr>';
continue;
}
$r.= '<td class="tool">'.
'<a class="cell" href="'.$url.'" >'.$col['label'].'</a>'.
'</td>';
}
}
$r.='<td class="tool">';
$r.= '<A class="cell" HREF="javascript:openRecherche('.$gDossier.')">'.
_('Recherche').'</a></td>';
$r.='</tr>';
$r.= '</table>';
$r.= '</div>';
$r.= '</div>';
$r.= '</div>';
return $r;
}