コード例 #1
0
ファイル: class_periode.php プロジェクト: Kloadut/noalyss_ynh
 function display_form_periode()
 {
     $str_dossier = dossier::get();
     if ($this->jrn_def_id == 0) {
         $Res = $this->cn->exec_sql("select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,p_central,p_closed,p_exercice,\n                                     (select count(jr_id) as count_op from jrn where jr_tech_per = p_id) as count_op\n                                     from parm_periode\n                                     order by p_start,p_end");
         $Max = Database::num_row($Res);
         echo '<form id="periode_frm" method="POST" onsubmit="return confirm_box(this,\'Confirmez-vous la fermeture des périodes choisies ?\')" >';
         echo HtmlInput::array_to_hidden(array('ac', 'gDossier', 'jrn_def_id', 'choose'), $_REQUEST);
         echo '<TABLE ALIGN="CENTER">';
         echo "</TR>";
         echo '<th>' . ICheckBox::toggle_checkbox("per_toggle", "periode_frm") . "</th>";
         echo '<TH> Date d&eacute;but </TH>';
         echo '<TH> Date fin </TH>';
         echo '<TH> Exercice </TH>';
         echo "</TR>";
         for ($i = 0; $i < $Max; $i++) {
             $l_line = Database::fetch_array($Res, $i);
             $class = "even";
             if ($i % 2 == 0) {
                 $class = "odd";
             }
             $style = '';
             if ($l_line['p_closed'] == 't') {
                 $style = "color:red";
             }
             echo '<TR class="' . $class . '" style="' . $style . '">';
             echo '<td>';
             if ($l_line['p_closed'] == 'f') {
                 $per_to_close = new ICheckBox('sel_per_close[]');
                 $per_to_close->value = $l_line['p_id'];
                 echo $per_to_close->input();
             }
             echo '</td>';
             echo '<TD ALIGN="CENTER"> ' . $l_line['date_start'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['date_end'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['p_exercice'] . '</TD>';
             if ($l_line['p_closed'] == 't') {
                 $closed = $l_line['p_central'] == 't' ? '<TD>Centralis&eacute;e</TD>' : '<TD>Ferm&eacute;e</TD>';
                 $change = '<TD></TD>';
                 $remove = sprintf(_('Nombre opérations %d'), $l_line['count_op']);
                 $remove = td($remove, ' class="mtitle" ');
                 $change = td('<A class="mtitle" HREF="javascript:void(0)"' . ' onclick="return confirm_box(null,\'' . _('Confirmez Réouverture') . ' ?\',function() {window.location=\'do.php?ac=' . $_REQUEST['ac'] . '&action=reopen&p_per=' . $l_line['p_id'] . '&' . $str_dossier . '\';} )"> Réouverture</A>', ' class="mtitle"');
             } else {
                 if ($l_line['count_op'] == 0) {
                     $change = HtmlInput::display_periode($l_line['p_id']);
                 } else {
                     $change = "Non modifiable";
                 }
                 $change = td($change, ' class="mtitle" ');
                 $reopen = td("");
                 $remove = '<TD class="mtitle">';
                 if ($l_line['count_op'] == 0) {
                     $go = 'do.php?' . http_build_query(array('ac' => $_REQUEST['ac'], 'action' => 'delete_per', 'p_per' => $l_line['p_id'], 'gDossier' => Dossier::id()));
                     $remove .= '<A class="mtitle" HREF="javascript:void(0)" ' . 'onclick="return confirm_box (null,\'' . _('Confirmez effacement ?') . '\',function() { window.location=\'' . $go . '\'});" >' . ' Efface</A>';
                 } else {
                     $remove .= sprintf(_('Nombre opérations %d'), $l_line['count_op']);
                 }
                 $remove .= '</td>';
             }
             echo $change;
             echo $remove;
             echo '</TR>';
         }
         echo '</table>';
         echo '<p style="text-align:center">';
         echo HtmlInput::hidden("close_per", 1);
         echo HtmlInput::submit('close_per_bt', 'Fermeture des périodes sélectionnées');
         echo '</p>';
         echo '</form>';
         $but = new IButton('show_per_add', 'Ajout d\'une période');
         $but->javascript = "\$('periode_add_div').show();";
         echo $but->input();
         echo '<div class="inner_box" style="width:40%;" id="periode_add_div">';
         echo HtmlInput::title_box("Ajout d'une période", "periode_add_div", "hide");
         echo '<FORM  METHOD="POST">';
         echo dossier::hidden();
         $istart = new IDate('p_date_start');
         $iend = new IDate('p_date_end');
         $iexercice = new INum('p_exercice');
         $iexercice->size = 5;
         echo '<table>';
         echo '<TR> ';
         echo td('Date de début');
         echo td($istart->input());
         echo '</tr><tr>';
         echo td('Date de fin');
         echo td($iend->input());
         echo '</tr><tr>';
         echo td('Exercice');
         echo td($iexercice->input());
         echo '</TABLE>';
         echo HtmlInput::submit('add_per', 'Valider');
         echo '</FORM>';
         echo '</div>';
         echo create_script("\$('periode_add_div').hide();new Draggable('periode_add_div',{starteffect:function()\n                                  {\n                                     new Effect.Highlight(obj.id,{scroll:window,queue:'end'});\n                                  }}\n                         );");
     } else {
         $Res = $this->cn->exec_sql("select p_id,to_char(p_start,'DD.MM.YYYY') as date_start,to_char(p_end,'DD.MM.YYYY') as date_end,status,p_exercice\n                                     from parm_periode join jrn_periode using (p_id) where jrn_def_id=" . $this->jrn_def_id . "\n                                     order by p_start,p_end");
         $Max = Database::num_row($Res);
         $r = $this->cn->exec_sql('select jrn_Def_name from jrn_Def where jrn_Def_id=' . $this->jrn_def_id);
         $jrn_name = Database::fetch_result($r, 0, 0);
         echo '<h2> Journal ' . $jrn_name . '</h2>';
         echo '<form id="periode_frm" method="POST" onsubmit="return confirm_box(this,\'Confirmez-vous la fermeture des périodes choisies ?\')" >';
         echo HtmlInput::array_to_hidden(array('ac', 'gDossier', 'jrn_def_id', 'choose'), $_REQUEST);
         echo '<TABLE ALIGN="CENTER">';
         echo "</TR>";
         echo '<th>' . ICheckBox::toggle_checkbox("per_toggle", "periode_frm") . "</th>";
         echo '<TH> Date d&eacute;but </TH>';
         echo '<TH> Date fin </TH>';
         echo '<TH> Exercice </TH>';
         echo "</TR>";
         for ($i = 0; $i < $Max; $i++) {
             $l_line = Database::fetch_array($Res, $i);
             if ($l_line['status'] != 'OP') {
                 echo '<TR style="COLOR:RED">';
             } else {
                 echo '<TR>';
             }
             echo '<td>';
             if ($l_line['status'] == 'OP') {
                 $per_to_close = new ICheckBox('sel_per_close[]');
                 $per_to_close->value = $l_line['p_id'];
                 echo $per_to_close->input();
             }
             echo '</td>';
             echo '<TD ALIGN="CENTER"> ' . $l_line['date_start'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['date_end'] . '</TD>';
             echo '<TD  ALIGN="CENTER"> ' . $l_line['p_exercice'] . '</TD>';
             $closed = "";
             if ($l_line['status'] != 'OP') {
                 $go = 'do.php?' . http_build_query(array('ac' => $_REQUEST['ac'], 'action' => 'reopen', 'p_per' => $l_line['p_id'], 'gDossier' => Dossier::id(), 'jrn_def_id' => $this->jrn_def_id));
                 $closed = td('<A class="mtitle" HREF="javascript:void(0)" ' . 'onclick="return confirm_box(null,\'' . _('Confirmez Réouverture') . ' ?\',function() {window.location=\'' . $go . '\';} );"> Réouverture</A>', ' class="mtitle"');
             }
             echo "{$closed}";
             echo '</TR>';
         }
         echo '</TABLE>';
         echo '<p style="text-align:center">';
         echo HtmlInput::submit('close_per', 'Fermeture des périodes sélectionnées');
         echo '</p>';
         echo '</form>';
     }
 }
コード例 #2
0
$grandLivre = new Anc_Grandlivre($cn);
$grandLivre->get_request();
/*
 * Form
 */
echo '<form method="get" >';
echo $grandLivre->display_form();
echo '<p>' . HtmlInput::submit('Recherche', _('Rechercher')) . '</p>';
echo HtmlInput::request_to_hidden(array('sa', 'ac', 'gDossier'));
echo '</form>';
$result = HtmlInput::default_value_request('result', null);
if ($result != null) {
    $result = $grandLivre->display_html();
    if ($grandLivre->has_data != 0) {
        echo '<span style="display:block">';
        echo _('Tout sélectionner') . " " . ICheckBox::toggle_checkbox('export_pdf_bt1', 'export_anc_receipt_pdf');
        echo '</span>';
        echo $grandLivre->show_button();
        echo '<form method="GET" id="export_anc_receipt_pdf" action="export.php" style="display:inline">';
        echo $grandLivre->button_export_pdf();
        echo $grandLivre->display_html();
        echo $grandLivre->button_export_pdf();
        echo HtmlInput::get_to_hidden(array('ac', 'gDossier', 'sa'));
        echo '</form>';
        echo $grandLivre->show_button();
    } else {
        echo '<p class="notice">';
        echo _('Aucune donnée trouvée');
        echo '</p>';
    }
}
コード例 #3
0
 /**
  * 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;
 }