noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_anc_print.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  *  \brief this class is the mother class for the CA printing
00024  */
00025 
00026 /*! \brief this class is the mother class for the CA printing
00027  *
00028  *
00029  */
00030 require_once("class_idate.php");
00031 require_once("class_itext.php");
00032 require_once("class_ihidden.php");
00033 require_once("class_iselect.php");
00034 require_once("class_ibutton.php");
00035 require_once('class_database.php');
00036 require_once('constant.php');
00037 require_once('class_dossier.php');
00038 require_once ('class_anc_plan.php');
00039 require_once 'class_ianccard.php';
00040 class Anc_Print
00041 {
00042     var $db;                                            /*!< $db database connection */
00043     var $to;                                            /*!< $to start date */
00044     var $from;                                  /*!< $from end date */
00045     var $from_poste;                            /*!< $from_poste from poste  */
00046     var $to_poste;                              /*!< $to_poste to the poste */
00047 
00048     function Anc_Print($p_cn)
00049     {
00050         $this->db=$p_cn;
00051         $this->from="";
00052         $this->to="";
00053         $this->from_poste="";
00054         $this->to_poste="";
00055         $this->has_data=0;
00056 
00057     }
00058     /*!
00059      * \brief complete the object with the data in $_REQUEST
00060      */
00061     function get_request()
00062     {
00063         if ( isset($_REQUEST['from']))
00064             $this->from=$_REQUEST['from'];
00065 
00066         if ( isset($_REQUEST['to']))
00067             $this->to=$_REQUEST['to'];
00068 
00069         if ( isset($_REQUEST['from_poste']))
00070             $this->from_poste=$_REQUEST['from_poste'];
00071 
00072         if ( isset($_REQUEST['to_poste']))
00073             $this->to_poste=$_REQUEST['to_poste'];
00074         if ( isset($_REQUEST['pa_id']))
00075             $this->pa_id=$_REQUEST['pa_id'];
00076         else
00077             $this->pa_id="";
00078 
00079     }
00080     /*!
00081      * \brief Compute  the form to display
00082      * \param $p_hidden hidden tag to be included (gDossier,...)
00083      *
00084      *
00085      * \return string containing the data
00086      */
00087     function display_form($p_hidden="")
00088     {
00089         /* if there is no analytic plan return */
00090         $pa=new Anc_Plan($this->db);
00091         if ( $pa->count() == 0 )
00092         {
00093             echo '<div class="content">';
00094             echo '<h2 class="error">'._('Aucun plan défini').'</h2>';
00095             echo '</div>';
00096             return;
00097         }
00098 
00099         $from=new IDate('from','from');
00100         $from->size=10;
00101         $from->value=$this->from;
00102 
00103         $to=new IDate('to','to');
00104         $to->value=$this->to;
00105         $to->size=10;
00106 
00107         $from_poste=new IAncCard('from_poste','from_poste');
00108         $from_poste->size=10;
00109         $from_poste->plan_ctl='pa_id';
00110         $from_poste->value=$this->from_poste;
00111 
00112         $to_poste=new IAncCard('to_poste','to_poste');
00113         $to_poste->value=$this->to_poste;
00114         $to_poste->size=10;
00115 
00116         $hidden=new IHidden();
00117         $r=dossier::hidden();
00118         $r.=$hidden->input("result","1");
00119         
00120         $r.=HtmlInput::request_to_hidden(array('ac'));
00121         $r.=$p_hidden;
00122         $plan=new Anc_Plan($this->db);
00123         $plan_id=new ISelect("pa_id");
00124         $plan_id->value=$this->db->make_array("select pa_id, pa_name from plan_analytique order by pa_name");
00125         $plan_id->selected=$this->pa_id;
00126         $choose_from=new IButton();
00127         $choose_from->name=_("Choix Poste");
00128         $choose_from->label=_("Recherche");
00129         $choose_from->javascript="onClick=search_ca(".dossier::id().",'from_poste','pa_id')";
00130         
00131 
00132         $choose_to=new IButton();
00133         $choose_to->name=_("Choix Poste");
00134         $choose_to->label=_("Recherche");
00135 
00136         
00137         $choose_to->javascript="onClick=search_ca(".dossier::id().",'to_poste','pa_id')";
00138       
00139         $r.=HtmlInput::request_to_hidden(array('ac'));
00140         ob_start();
00141         ?>
00142 <table>
00143     <tr>
00144         <td>
00145             <?php 
00146                 echo _('Depuis') ;
00147                 echo HtmlInput::infobulle(37);
00148             ?>
00149         </td>
00150         <td>
00151             <?php 
00152                 echo $from->input(); 
00153             ?>
00154         </td>
00155     </tr>
00156     <tr>
00157         <td>
00158             <?php 
00159                 echo _('Jusque') ;
00160                 echo HtmlInput::infobulle(37);
00161             ?>
00162         </td>
00163         <td>
00164             <?php 
00165                 echo $to->input(); 
00166             ?>
00167         </td>
00168     </tr>
00169     
00170 </table>
00171 <span style="padding:5px;margin:5px;display:block;">
00172     <?php echo _( "Plan Analytique :").$plan_id->input(); ?>
00173 </span>
00174 
00175 <?php
00176         $r.=ob_get_clean();
00177         $r.=_("Entre l'activité ").$from_poste->input();
00178         $r.=$choose_from->input();
00179         $r.=_(" et l'activité ").$to_poste->input();
00180         $r.=$choose_to->input();
00181         $r.='<span class="notice" style="display:block">'._('Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche').'</span>';
00182 
00183         $r.='</span>';
00184         return $r;
00185     }
00186     /*!
00187      * \brief Set the filter (account_date)
00188      *
00189      * \return return the string to add to load
00190      */
00191 
00192     function set_sql_filter()
00193     {
00194         $sql="";
00195         $and=" and ";
00196         if ( $this->from != "" )
00197         {
00198             $sql.="$and a.oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
00199         }
00200         if ( $this->to != "" )
00201         {
00202             $sql.=" $and a.oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
00203         }
00204 
00205         return $sql;
00206 
00207     }
00208   function check()
00209   {
00210 
00211     /*
00212      * check date
00213      */
00214     if (($this->from != '' && isDate ($this->from) == 0)
00215         ||
00216         ($this->to != '' && isDate ($this->to) == 0))
00217       return -1;
00218 
00219     return 0;
00220   }
00221 
00222 
00223 }
 All Data Structures Namespaces Files Functions Variables Enumerations