Beispiel #1
0
 /**
  * show history of all the stock movement
  * @param $p_array usually contains $_GET
  */
 function history($p_array)
 {
     $sql = $this->create_query_histo($p_array);
     require_once NOALYSS_INCLUDE . '/class_sort_table.php';
     $p_url = HtmlInput::get_to_string(array("gDossier", "ac", "wcard", "wdate_start", "wdate_end", "wrepo", "wamount_start", "wamount_end", "wcode_stock", "wdirection"));
     $tb = new Sort_Table();
     $tb->add("Date", $p_url, " order by real_date asc", "order by real_date desc", "da", "dd");
     $tb->add("Code Stock", $p_url, " order by sg_code asc", "order by sg_code desc", "sa", "sd");
     $tb->add("Dépôt", $p_url, " order by r_name asc", "order by r_name desc", "ra", "rd");
     $tb->add("Fiche", $p_url, " order by 2 asc", "order by 2 desc", "fa", "fd");
     $tb->add("Commentaire", $p_url, " order by coalesce(sg_comment,jr_comment)  asc", "order by coalesce(sg_comment,jr_comment)  desc", "ca", "cd");
     $tb->add("Montant", $p_url, " order by j_montant asc", "order by j_montant desc", "ja", "jd");
     $tb->add("Quantité", $p_url, " order by sg_quantity asc", "order by sg_quantity  desc", "qa", "qd");
     $tb->add("IN/OUT", $p_url, " order by (case when sg_type='c' then 'OUT' when sg_type='c' then 'IN' end ) asc", "order by (case when sg_type='c' then 'OUT' when sg_type='c' then 'IN' end ) desc", "ta", "td");
     $order = isset($p_array['ord']) ? $p_array['ord'] : 'da';
     $sql .= $tb->get_sql_order($order);
     $step = $_SESSION['g_pagesize'];
     $page = isset($_GET['offset']) ? $_GET['page'] : 1;
     $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
     $res = $this->cn->exec_sql($sql);
     $max_row = Database::num_row($res);
     $nav_bar = navigation_bar($offset, $max_row, 0, $page);
     if ($step != -1) {
         $res = $this->cn->exec_sql($sql . " , sg_id asc limit " . $step . " offset " . $offset);
     }
     $max_row = Database::num_row($res);
     $this->search_box_button();
     $this->search_box($p_array);
     require_once NOALYSS_INCLUDE . '/template/stock_histo.php';
     $this->export_stock_histo_form();
     echo HtmlInput::print_window();
 }
Beispiel #2
0
echo HtmlInput::button_action(_("Ajout utilisateur"), "\$('create_user').show();", "cu");
echo '</p>';
// Show all the existing user on 7 columns
$repo = new Dossier(0);
/******************************************************/
// Detail of a user
/******************************************************/
$compteur = 0;
$header = new Sort_Table();
$url = basename($_SERVER['PHP_SELF']) . "?action=" . $_REQUEST['action'];
$header->add(_("Login"), $url, " order by use_login asc", "order by use_login desc", "la", "ld");
$header->add(_("Nom"), $url, " order by use_name asc,use_first_name asc", "order by use_name desc,use_first_name desc", "na", "nd");
$header->add(_('Dossier'), $url, ' order by ag_dossier asc', 'order by ag_dossier desc', 'da', 'dd');
$header->add(_("Actif"), $url, " order by use_active asc", "order by  use_active desc", "aa", "ad");
$ord = isset($_REQUEST['ord']) ? $_REQUEST['ord'] : 'la';
$sql = $header->get_sql_order($ord);
$a_user = $repo->get_user_folder($sql);
if (!empty($a_user)) {
    echo '<span style="display:block">';
    echo _('Filtre') . HtmlInput::infobulle(22);
    echo HtmlInput::filter_table("user", "0,1,2,5", "1");
    echo '</span>';
    echo '<table id="user" class="result">';
    echo '<tr>';
    echo '<th>' . $header->get_header(0) . '</th>';
    echo '<th>' . $header->get_header(1) . '</th>';
    echo th(_("Prénom"));
    echo '<th>' . $header->get_header(3) . '</th>';
    echo "<th>" . _('Type') . "</th>";
    echo '<th>' . $header->get_header(2) . '</th>';
    echo '</tr>';
Beispiel #3
0
    if (strlen(trim($post_name)) != 0) {
        $st = new Stock_Sql($cn, $_POST['r_id']);
        $st->from_array($_POST);
        $st->update();
    }
}
$tb = new Sort_Table();
$p_url = HtmlInput::get_to_string(array("ac", "gDossier"));
$tb->add(_("Nom"), $p_url, " order by r_name asc", "order by r_name desc", "ona", "ond");
$tb->add(_("Adresse"), $p_url, " order by r_adress asc", "order by r_adress desc", "oaa", "oad");
$tb->add(_("Ville"), $p_url, " order by r_city asc", "order by r_city desc", "ova", "ovd");
$tb->add(_("Pays"), $p_url, " order by r_country asc", "order by r_country desc", "opa", "opd");
$tb->add(_("Téléphone"), $p_url, " order by r_phone asc", "order by r_phone desc", "opa", "opd");
$sql = "select * from stock_repository ";
$ord = isset($_GET['ord']) ? $_GET['ord'] : "ona";
$order = $tb->get_sql_order($ord);
$array = $cn->get_array($sql . " " . $order);
?>
<div class="content">

<table class="result">
	<tr>
		<th><?php 
echo $tb->get_header(0);
?>
</th>
		<th><?php 
echo $tb->get_header(1);
?>
</th>
		<th><?php 
Beispiel #4
0
global $g_user;
$g_user->Check();
$g_user->check_dossier($gDossier);
require_once NOALYSS_INCLUDE . '/user_menu.php';
/////////////////////////////////////////////////////////////////////////
// List users
/////////////////////////////////////////////////////////////////////////
if (!isset($_REQUEST['action'])) {
    $base_url = $_SERVER['PHP_SELF'] . "?ac=" . $_REQUEST['ac'] . "&" . dossier::get();
    echo '<DIV class="content" >';
    $header = new Sort_Table();
    $header->add('Login', $base_url, "order by use_login asc", "order by use_login desc", 'la', 'ld');
    $header->add('Nom', $base_url, "order by use_name asc,use_first_name asc", "order by use_name desc,use_first_name desc", 'na', 'nd');
    $header->add('Type d\'utilisateur', $base_url, "order by use_admin asc,use_login asc", "order by use_admin desc,use_login desc", 'ta', 'td');
    $order = isset($_REQUEST['ord']) ? $_REQUEST['ord'] : 'la';
    $ord_sql = $header->get_sql_order($order);
    $repo = new Database();
    /*  Show all the active users, including admin */
    $user_sql = $repo->exec_sql("select use_id,\n                                            use_first_name,\n                                            use_name,\n                                            use_login,\n                                            use_admin\n                                                from ac_users left join jnt_use_dos using (use_id)\n\t\t\t\t\twhere use_login != 'phpcompta' and use_active=1\n\t\t\t\t\tand (dos_id=\$1  or (dos_id is null and use_admin=1))" . $ord_sql, array($gDossier));
    $MaxUser = Database::num_row($user_sql);
    echo '<TABLE class="result" style="width:80%;margin-left:10%">';
    echo "<tr>";
    echo '<th>' . $header->get_header(0) . '</th>';
    echo '<th>' . $header->get_header(1) . '</th>';
    echo th('prénom');
    echo th('profil');
    echo '<th>' . $header->get_header(2) . '</th>';
    for ($i = 0; $i < $MaxUser; $i++) {
        echo '<tr>';
        $l_line = Database::fetch_array($user_sql, $i);
        $str = "";
 function Display()
 {
     $tab = new Sort_Table();
     $url = HtmlInput::get_to_string(array('ac', 'gDossier'));
     $tab->add(_("Nom de fiche"), $url, "order by fd_label asc", "order by fd_label desc", "na", "nd");
     $tab->add(_("Basé sur le poste comptable"), $url, "order by fd_class_base asc", "order by fd_class_base desc", "pa", "pd");
     $tab->add(_("Calcul automatique du poste comptable"), $url, "order by fd_create_account asc", "order by fd_create_account desc", "ca", "cd");
     $tab->add(_("Basé sur le modèle"), $url, "order by frd_text asc", "order by frd_text  desc", "ma", "md");
     $order = isset($_GET['ord']) ? $tab->get_sql_order($_GET["ord"]) : $tab->get_sql_order("na");
     $res = $this->cn->exec_sql("SELECT fd_id, fd_class_base, fd_label, fd_create_account, fiche_def_ref.frd_id,\nfrd_text , fd_description FROM fiche_def join fiche_def_ref on (fiche_def.frd_id=fiche_def_ref.frd_id)\n{$order}\n");
     require_once NOALYSS_INCLUDE . '/template/fiche_def_list.php';
 }
Beispiel #6
0
        $pm_default = isset($pm_default) ? 1 : 0;
        $cn->exec_sql("\n                        insert into profile_menu (me_code,me_code_dep,p_id,p_order,pm_default,p_type_display,pm_id_dep)\n                        values (\$1,\$2,\$3,\$4,\$5,\$6,\$7)\n                        ", array($me_code, $me_code_dep, $p_id, $p_order, $pm_default, $p_type, $pm_id_dep));
        $cn->commit();
    } catch (Exception $exc) {
        alert($exc->getMessage());
    }
}
echo '<div id="list_profile" class="content">';
$table = new Sort_Table();
$url = $_SERVER['REQUEST_URI'];
$table->add(_('Nom'), $url, "order by p_name asc", "order by p_name desc", "na", "nd");
$table->add(_('Description'), $url, "order by p_desc asc", "order by p_desc desc", "da", "dd");
$table->add(_('Calculatrice visible'), $url, "order by with_calc asc", "order by with_calc desc", "ca", "cd");
$table->add(_('Accès Direct visible'), $url, "order by with_direct_form asc", "order by with_direct_form desc", "fa", "fd");
$ord = isset($_REQUEST['ord']) ? $_REQUEST['ord'] : 'na';
$order = $table->get_sql_order($ord);
$menu = new Profile_sql($cn);
$ret = $menu->seek("where p_id > 0 " . $order);
echo '<table class="result">';
echo '<tr>';
echo '<th>' . $table->get_header(0) . '</th>';
echo '<th>' . $table->get_header(1) . '</th>';
echo '<th>' . $table->get_header(2) . '</th>';
echo '<th>' . $table->get_header(3) . '</th>';
echo '</tr>';
$gDossier = Dossier::id();
for ($i = 0; $i < Database::num_row($ret); $i++) {
    $row = $menu->get_object($ret, $i);
    $js = sprintf('<a href="javascript:void(0)" style="text-decoration:underline" onclick="get_profile_detail(\'%s\',\'%s\')">', $gDossier, $row->p_id);
    echo '<tr>';
    echo "<td>" . $js . $row->p_name . '</a>' . '</td>';
 /**
 * @brief Show all the operation
 * @param$sql is the sql stmt, normally created by build_search_sql
 * @param$offset the offset
 * @param$p_paid if we want to see info about payment
  \code
  // Example
  // Build the sql
  list($sql,$where)=$Ledger->build_search_sql($_GET);
  // Count nb of line
  $max_line=$cn->count_sql($sql);
 
  $step=$_SESSION['g_pagesize'];
  $page=(isset($_GET['offset']))?$_GET['page']:1;
  $offset=(isset($_GET['offset']))?$_GET['offset']:0;
  // create the nav. bar
  $bar=navigation_bar($offset,$max_line,$step,$page);
  // show a part
  list($count,$html)= $Ledger->list_operation($sql,$offset,0);
  echo $html;
  // show nav bar
  echo $bar;
 
  \endcode
 * \see build_search_sql
 * \see display_search_form
 * \see search_form
 
 * \return HTML string
 */
 public function list_operation($sql, $offset, $p_paid = 0)
 {
     global $g_parameter, $g_user;
     bcscale(2);
     $table = new Sort_Table();
     $gDossier = dossier::id();
     $amount_paid = 0.0;
     $amount_unpaid = 0.0;
     $limit = $_SESSION['g_pagesize'] != -1 ? " LIMIT " . $_SESSION['g_pagesize'] : "";
     $offset = $_SESSION['g_pagesize'] != -1 ? " OFFSET " . Database::escape_string($offset) : "";
     $order = "  order by jr_date_order asc,jr_internal asc";
     // Sort
     $url = "?" . CleanUrl();
     $str_dossier = dossier::get();
     $table->add(_("Date"), $url, 'order by jr_date asc,substring(jr_pj_number,\'[0-9]+$\')::numeric asc', 'order by  jr_date desc,substring(jr_pj_number,\'[0-9]+$\')::numeric desc', "da", "dd");
     $table->add(_('Echeance'), $url, " order by  jr_ech asc", " order by  jr_ech desc", 'ea', 'ed');
     $table->add(_('Paiement'), $url, " order by  jr_date_paid asc", " order by  jr_date_paid desc", 'eap', 'edp');
     $table->add(_('Pièce'), $url, ' order by  substring(jr_pj_number,\'[0-9]+$\')::numeric asc ', ' order by  substring(jr_pj_number,\'[0-9]+$\')::numeric desc ', "pja", "pjd");
     $table->add(_('Tiers'), $url, " order by  name asc", " order by  name desc", 'na', 'nd');
     $table->add(_('Montant'), $url, " order by jr_montant asc", " order by jr_montant desc", "ma", "md");
     $table->add(_("Description"), $url, "order by jr_comment asc", "order by jr_comment desc", "ca", "cd");
     $ord = !isset($_GET['ord']) ? 'da' : $_GET['ord'];
     $order = $table->get_sql_order($ord);
     // Count
     $count = $this->db->count_sql($sql);
     // Add the limit
     $sql .= $order . $limit . $offset;
     // Execute SQL stmt
     $Res = $this->db->exec_sql($sql);
     //starting from here we can refactor, so that instead of returning the generated HTML,
     //this function returns a tree structure.
     $r = "";
     $Max = Database::num_row($Res);
     if ($Max == 0) {
         return array(0, _("Aucun enregistrement trouvé"));
     }
     $r .= '<table class="result">';
     $r .= "<tr >";
     $r .= "<th>" . _("n° interne") . "</th>";
     if ($this->type == 'ALL') {
         $r .= th('Journal');
     }
     $r .= '<th>' . $table->get_header(0) . '</th>';
     if ($p_paid != 0) {
         $r .= '<th>' . $table->get_header(1) . '</td>';
     }
     if ($p_paid != 0) {
         $r .= '<th>' . $table->get_header(2) . '</th>';
     }
     $r .= '<th>' . $table->get_header(3) . '</th>';
     $r .= '<th>' . $table->get_header(4) . '</th>';
     $r .= '<th>' . $table->get_header(6) . '</th>';
     $r .= th('Notes', ' style="width:15%"');
     $r .= '<th>' . $table->get_header(5) . '</th>';
     // if $p_paid is not equal to 0 then we have a paid column
     if ($p_paid != 0) {
         $r .= "<th> " . _('Payé') . "</th>";
     }
     $r .= "<th>" . _('Concerne') . "</th>";
     $r .= "<th>" . _('Document') . "</th>";
     $r .= "</tr>";
     // Total Amount
     $tot = 0.0;
     $gDossier = dossier::id();
     for ($i = 0; $i < $Max; $i++) {
         $row = Database::fetch_array($Res, $i);
         if ($i % 2 == 0) {
             $tr = '<TR class="odd">';
         } else {
             $tr = '<TR class="even">';
         }
         $r .= $tr;
         //internal code
         // button  modify
         $r .= "<TD>";
         // If url contains
         //
         $href = basename($_SERVER['PHP_SELF']);
         $r .= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s </A>', $row['jr_id'], $gDossier, $row['jr_internal']);
         $r .= "</TD>";
         if ($this->type == 'ALL') {
             $r .= td($row['jrn_def_name']);
         }
         // date
         $r .= "<TD>";
         $r .= $row['str_jr_date'];
         $r .= "</TD>";
         // echeance
         if ($p_paid != 0) {
             $r .= "<TD>";
             $r .= $row['str_jr_ech'];
             $r .= "</TD>";
             $r .= "<TD>";
             $r .= $row['str_jr_date_paid'];
             $r .= "</TD>";
         }
         // pj
         $r .= "<TD>";
         $r .= $row['jr_pj_number'];
         $r .= "</TD>";
         // Tiers
         $other = $row['quick_code'] != '' ? '[' . $row['quick_code'] . '] ' . $row['name'] . ' ' . $row['first_name'] : '';
         $r .= td($other);
         // comment
         $r .= "<TD>";
         $tmp_jr_comment = h($row['jr_comment']);
         $r .= $tmp_jr_comment;
         $r .= "</TD>";
         $r .= td(h($row['n_text']), ' style="font-size:0.87em%"');
         // Amount
         // If the ledger is financial :
         // the credit must be negative and written in red
         $positive = 0;
         // Check ledger type :
         if ($row['jrn_def_type'] == 'FIN') {
             $positive = $this->db->get_value("select qf_amount from quant_fin where jr_id=\$1", array($row['jr_id']));
             if ($this->db->count() != 0) {
                 $positive = $positive < 0 ? 1 : 0;
             }
         }
         $r .= "<TD align=\"right\">";
         $t_amount = $row['jr_montant'];
         if ($row['total_invoice'] != null && $row['total_invoice'] != $row['jr_montant']) {
             $t_amount = $row['total_invoice'];
         }
         $tot = $positive != 0 ? bcsub($tot, $t_amount) : bcadd($tot, $t_amount);
         //STAN $positive always == 0
         if ($row['jrn_def_type'] == 'FIN') {
             $r .= $positive != 0 ? "<font color=\"red\">  - " . nbm($t_amount) . "</font>" : nbm($t_amount);
         } else {
             $r .= $t_amount < 0 ? "<font color=\"red\">  " . nbm($t_amount) . "</font>" : nbm($t_amount);
         }
         $r .= "</TD>";
         // Show the paid column if p_paid is not null
         if ($p_paid != 0) {
             $w = new ICheckBox();
             $w->name = "rd_paid" . $row['jr_id'];
             $w->selected = $row['jr_rapt'] == 'paid' ? true : false;
             // if p_paid == 2 then readonly
             $w->readonly = $p_paid == 2 ? true : false;
             $h = new IHidden();
             $h->name = "set_jr_id" . $row['jr_id'];
             $r .= '<TD>' . $w->input() . $h->input() . '</TD>';
             if ($row['jr_rapt'] == 'paid') {
                 $amount_paid = bcadd($amount_paid, $t_amount);
             } else {
                 $amount_unpaid = bcadd($amount_unpaid, $t_amount);
             }
         }
         // Rapprochement
         $rec = new Acc_Reconciliation($this->db);
         $rec->set_jr_id($row['jr_id']);
         $a = $rec->get();
         $r .= "<TD>";
         if ($a != null) {
             foreach ($a as $key => $element) {
                 $operation = new Acc_Operation($this->db);
                 $operation->jr_id = $element;
                 $l_amount = $this->db->get_value("select jr_montant from jrn " . " where jr_id={$element}");
                 $r .= "<A class=\"detail\" HREF=\"javascript:modifyOperation('" . $element . "'," . $gDossier . ")\" > " . $operation->get_internal() . "[" . nbm($l_amount) . "]</A>";
             }
             //for
         }
         // if ( $a != null ) {
         $r .= "</TD>";
         if ($row['jr_valid'] == 'f') {
             $r .= "<TD>" . _("Opération annulée") . "</TD>";
         } else {
         }
         // else
         //document
         if ($row['jr_pj_name'] != "") {
             $r .= '<td>' . HtmlInput::show_receipt_document($row['jr_id']) . '</td>';
         } else {
             $r .= "<TD></TD>";
         }
         // end row
         $r .= "</tr>";
     }
     $amount_paid = round($amount_paid, 4);
     $amount_unpaid = round($amount_unpaid, 4);
     $tot = round($tot, 4);
     $r .= "<TR>";
     $r .= '<TD COLSPAN="5">Total</TD>';
     $r .= '<TD ALIGN="RIGHT">' . nbm($tot) . "</TD>";
     $r .= "</tr>";
     if ($p_paid != 0) {
         $r .= "<TR>";
         $r .= '<TD COLSPAN="5">' . _("Payé") . '</TD>';
         $r .= '<TD ALIGN="RIGHT">' . nbm($amount_paid) . "</TD>";
         $r .= "</tr>";
         $r .= "<TR>";
         $r .= '<TD COLSPAN="5">' . _("Non payé") . '</TD>';
         $r .= '<TD ALIGN="RIGHT">' . nbm($amount_unpaid) . "</TD>";
         $r .= "</tr>";
     }
     $r .= "</table>";
     return array($count, $r);
 }
 /**
  * myList($p_base, $p_filter = "", $p_search = "") 
  * Show list of action by default if sorted on date
  * @param $p_base base url with ac...
  * @param $p_filter filters on the document_type
  * @param $p_search must a valid sql command ( ex 'and  ag_title like upper('%hjkh%'))
  * @return string containing html code
  */
 function myList($p_base, $p_filter = "", $p_search = "")
 {
     // for the sort
     $url = HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")) . '&' . $p_base;
     $table = new Sort_Table();
     $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd');
     $table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd');
     $table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date  desc', 'ra', 'rd');
     $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad');
     $table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd');
     $table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded');
     $table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed');
     $table->add('Titre', $url, 'order by ag_title asc', 'order by ag_title desc', 'ta', 'td');
     $ord = !isset($_GET['ord']) ? "dcd" : $_GET['ord'];
     $sort = $table->get_sql_order($ord);
     if (strlen(trim($p_filter)) != 0) {
         $p_filter_doc = " dt_id in ( {$p_filter} )";
     } else {
         $p_filter_doc = " 1=1 ";
     }
     $sql = "\n             select ag_id,to_char(ag_timestamp,'DD.MM.YYYY') as my_date,\n                to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,\n                to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp),'DD.MM.YY') as str_last_comment,\n                coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag.ag_id),ag_timestamp) as last_comment,\n                f_id_dest,\n                s_value,\n                ag_title,dt_value,ag_ref, ag_priority,ag_state,\n                coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest,\n                (select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,\n                array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags\n            from action_gestion as ag\n                join document_type on (ag_type=dt_id)\n                join document_state on (ag_state=s_id)\n             where {$p_filter_doc} {$p_search} {$sort}";
     $max_line = $this->db->count_sql($sql);
     $step = $_SESSION['g_pagesize'];
     $page = isset($_GET['offset']) ? $_GET['page'] : 1;
     $offset = isset($_GET['offset']) ? Database::escape_string($_GET['offset']) : 0;
     if ($step != -1) {
         $limit = " LIMIT {$step} OFFSET {$offset} ";
     } else {
         $limit = '';
     }
     $bar = navigation_bar($offset, $max_line, $step, $page);
     $Res = $this->db->exec_sql($sql . $limit);
     $a_row = Database::fetch_all($Res);
     $r = "";
     $r .= '<p>' . $bar . '</p>';
     $r .= '<table class="document">';
     $r .= "<tr>";
     $r .= '<th name="ag_id_td" style="display:none" >' . ICheckBox::toggle_checkbox('ag', 'list_ag_frm') . '</th>';
     $r .= '<th>' . $table->get_header(0) . '</th>';
     $r .= '<th>' . $table->get_header(1) . '</th>';
     $r .= '<th>' . $table->get_header(2) . '</th>';
     $r .= '<th>' . $table->get_header(3) . '</th>';
     $r .= '<th>' . $table->get_header(4) . '</th>';
     $r .= '<th>' . $table->get_header(5) . '</th>';
     $r .= '<th>' . $table->get_header(6) . '</th>';
     $r .= '<th>' . $table->get_header(7) . '</th>';
     $r .= th('Priorité');
     $r .= "</tr>";
     // if there are no records return a message
     if (sizeof($a_row) == 0 or $a_row == false) {
         $r = '<div style="clear:both">';
         $r .= '<hr>Aucun enregistrement trouvé';
         $r .= "</div>";
         return $r;
     }
     $today = date('d.m.Y');
     $i = 0;
     $checkbox = new ICheckBox("mag_id[]");
     //show the sub_action
     foreach ($a_row as $row) {
         $href = '<A class="document" HREF="do.php?' . $p_base . HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "gDossier", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag", "ac"), "&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
         $i++;
         $tr = $i % 2 == 0 ? 'even' : 'odd';
         if ($row['ag_priority'] < 2) {
             $tr = 'priority1';
         }
         $st = '';
         if ($row['my_date'] == $today) {
             $st = ' style="font-weight:bold; border:2px solid orange;"';
         }
         $date_remind = format_date($row['my_remind'], 'DD.MM.YYYY', 'YYYYMMDD');
         $date_today = date('Ymd');
         if ($date_remind != "" && $date_remind == $date_today && $row['ag_state'] != 1 && $row['ag_state'] != 3) {
             $st = ' style="font-weight:bold;background:orange"';
         }
         if ($date_remind != "" && $date_remind < $date_today && $row['ag_state'] != 1 && $row['ag_state'] != 3) {
             $st = ' style="font-weight:bold;background:#FF0000;color:white;"';
         }
         $r .= "<tr class=\"{$tr}\" {$st}>";
         $checkbox->value = $row['ag_id'];
         $r .= '<td name="ag_id_td" style="display:none">' . $checkbox->input() . '</td>';
         $r .= "<td>" . $href . smaller_date($row['my_date']) . '</a>' . "</td>";
         $r .= "<td>" . $href . $row['str_last_comment'] . '</a>' . "</td>";
         $r .= "<td>" . $href . smaller_date($row['my_remind']) . '</a>' . "</td>";
         $r .= "<td>" . $href . h($row['tags']) . '</a>' . "</td>";
         $r .= "<td>" . $href . $row['ag_ref'] . '</a>' . "</td>";
         $r .= "<td>" . $href . h($row['dest']) . '</a>' . "</td>";
         // Expediteur
         $fexp = new Fiche($this->db);
         $fexp->id = $row['f_id_dest'];
         $qcode_dest = $fexp->strAttribut(ATTR_DEF_QUICKCODE);
         $qexp = $qcode_dest == NOTFOUND ? "Interne" : $qcode_dest;
         $jsexp = sprintf("javascript:showfiche('%s')", $qexp);
         if ($qexp != 'Interne') {
             $r .= "<td>{$href}" . $qexp . " : " . $fexp->getName() . '</a></td>';
         } else {
             $r .= "<td>{$href} Interne </a></td>";
         }
         $ref = "";
         $r .= '<td>' . $href . h($row['ag_title']) . "</A></td>";
         /*
          * State
          */
         switch ($row['ag_priority']) {
             case 1:
                 $priority = 'Haute';
                 break;
             case 2:
                 $priority = "Moyenne";
                 break;
             case 3:
                 $priority = "Important";
                 break;
         }
         $r .= td($priority);
         $r .= "<td>" . $ref . "</td>";
         $r .= "</tr>";
     }
     $r .= "</table>";
     $r .= '<p>' . $bar . '</p>';
     return $r;
 }