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 
00056     }
00057     /*!
00058      * \brief complete the object with the data in $_REQUEST
00059      */
00060     function get_request()
00061     {
00062         if ( isset($_REQUEST['from']))
00063             $this->from=$_REQUEST['from'];
00064 
00065         if ( isset($_REQUEST['to']))
00066             $this->to=$_REQUEST['to'];
00067 
00068         if ( isset($_REQUEST['from_poste']))
00069             $this->from_poste=$_REQUEST['from_poste'];
00070 
00071         if ( isset($_REQUEST['to_poste']))
00072             $this->to_poste=$_REQUEST['to_poste'];
00073         if ( isset($_REQUEST['pa_id']))
00074             $this->pa_id=$_REQUEST['pa_id'];
00075         else
00076             $this->pa_id="";
00077 
00078     }
00079     /*!
00080      * \brief Compute  the form to display
00081      * \param $p_hidden hidden tag to be included (gDossier,...)
00082      *
00083      *
00084      * \return string containing the data
00085      */
00086     function display_form($p_hidden="")
00087     {
00088         /* if there is no analytic plan return */
00089         $pa=new Anc_Plan($this->db);
00090         if ( $pa->count() == 0 )
00091         {
00092             echo '<div class="content">';
00093             echo '<h2 class="error">'._('Aucun plan défini').'</h2>';
00094             echo '</div>';
00095             exit();
00096         }
00097 
00098         $from=new IDate('from','from');
00099         $from->size=10;
00100         $from->value=$this->from;
00101 
00102         $to=new IDate('to','to');
00103         $to->value=$this->to;
00104         $to->size=10;
00105 
00106         $from_poste=new IAncCard('from_poste','from_poste');
00107         $from_poste->size=10;
00108         $from_poste->plan_ctl='pa_id';
00109         $from_poste->value=$this->from_poste;
00110 
00111         $to_poste=new IAncCard('to_poste','to_poste');
00112         $to_poste->value=$this->to_poste;
00113         $to_poste->size=10;
00114 
00115         $hidden=new IHidden();
00116         $r=dossier::hidden();
00117         $r.=$hidden->input("result","1");
00118         $r.="Depuis : ".$from->input();
00119         $r.= "jusque : ".$to->input();
00120         $r.= '<span class="notice">'._('Les dates sont en format DD.MM.YYYY').'</span>';
00121         $r.=HtmlInput::request_to_hidden(array('ac'));
00122         $r.=$p_hidden;
00123         $r.='<span style="padding:5px;margin:5px;display:block;">';
00124         $plan=new Anc_Plan($this->db);
00125         $plan_id=new ISelect("pa_id");
00126         $plan_id->value=$this->db->make_array("select pa_id, pa_name from plan_analytique order by pa_name");
00127         $plan_id->selected=$this->pa_id;
00128         $r.=_( "Plan Analytique :").$plan_id->input();
00129 
00130         $r.=_("Entre l'activité ").$from_poste->input();
00131         $choose=new IButton();
00132         $choose->name=_("Choix Poste");
00133         $choose->label=_("Recherche");
00134         $choose->javascript="onClick=search_ca(".dossier::id().",'from_poste','pa_id')";
00135         $r.=$choose->input();
00136 
00137         $r.=_(" et l'activité ").$to_poste->input();
00138         $choose->javascript="onClick=search_ca(".dossier::id().",'to_poste','pa_id')";
00139         $r.=$choose->input();
00140         $r.='<span class="notice" style="display:block">'._('Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche').'</span>';
00141 
00142         $r.='</span>';
00143         $r.=HtmlInput::request_to_hidden(array('ac'));
00144         return $r;
00145     }
00146     /*!
00147      * \brief Set the filter (account_date)
00148      *
00149      * \return return the string to add to load
00150      */
00151 
00152     function set_sql_filter()
00153     {
00154         $sql="";
00155         $and=" and ";
00156         if ( $this->from != "" )
00157         {
00158             $sql.="$and a.oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
00159         }
00160         if ( $this->to != "" )
00161         {
00162             $sql.=" $and a.oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
00163         }
00164 
00165         return $sql;
00166 
00167     }
00168   function check()
00169   {
00170 
00171     /*
00172      * check date
00173      */
00174     if (($this->from != '' && isDate ($this->from) == 0)
00175         ||
00176         ($this->to != '' && isDate ($this->to) == 0))
00177       return -1;
00178 
00179     return 0;
00180   }
00181 
00182 
00183 }
 All Data Structures Namespaces Files Functions Variables Enumerations