Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 require_once '../include/constant.php';
00027 require_once('class_database.php');
00028 require_once('class_user.php');
00029 require_once('class_dossier.php');
00030 require_once('class_periode.php');
00031 require_once('class_html_input.php');
00032 require_once('class_acc_account.php');
00033 require_once('class_exercice.php');
00034 $div=$_REQUEST['div'];
00035 mb_internal_encoding("UTF-8");
00036 define ('ALLOWED',1);
00037
00038
00039
00040
00041 ajax_disconnected($div);
00042 global $g_user,$cn;
00043 $cn=new Database(dossier::id());
00044 $g_user=new User($cn);
00045
00046 if ( $g_user->check_dossier(dossier::id(),true) == 'X' ) exit();
00047
00048 $from_div = (isset($_REQUEST['ajax'])) ? 1 : $_GET['l'];
00049
00050
00051
00052
00053 if ( isset($_GET['f_id']))
00054 {
00055 $exercice=new Exercice($cn);
00056 $old='';
00057 $fiche=new Fiche($cn,$_GET['f_id']);
00058 $year=$g_user->get_exercice();
00059 if ( $year == 0 )
00060 {
00061 $html=_("erreur aucune période par défaut, allez dans préférence pour en choisir une");
00062 }
00063 else
00064 {
00065 $per=new Periode($cn);
00066 $limit_periode=$per->get_limit($year);
00067 $array['from_periode']=$limit_periode[0]->first_day();
00068 $array['to_periode']=$limit_periode[1]->last_day();
00069 if (isset($_GET['ex']))
00070 {
00071 $limit_periode=$per->get_limit($_GET['ex']);
00072 if ( $_GET['ex'] < $year)
00073 $array['from_periode']=$limit_periode[0]->first_day();
00074 else
00075 $array['to_periode']=$limit_periode[1]->last_day();
00076
00077 }
00078
00079
00080
00081
00082 if ($exercice->count() > 1 )
00083 {
00084 $default=(isset($_GET['ex']))?$_GET['ex']:$year;
00085 $dossier=dossier::id();
00086 if ( $div != 'popup')
00087 {
00088 $obj="{div:'$div',f_id:'".$_GET['f_id']."',gDossier:'$dossier',select:this}";
00089 $is=$exercice->select('p_exercice',$default,' onchange="update_history_card('.$obj.');"');
00090 $old=_("Autre exercice")." ".$is->input();
00091 }
00092 else
00093 {
00094 $old='<form method="get" action="popup.php">';
00095 $is=$exercice->select('ex',$default,'onchange = "submit(this)"');
00096 $old.=_("Autre exercice")." ".$is->input();
00097 $old.=HtmlInput::hidden('div','popup');
00098 $old.=HtmlInput::hidden('act',$_GET['act']);
00099 $old.=HtmlInput::hidden('f_id',$_GET['f_id']);
00100 $old.=HtmlInput::hidden('ajax',$_GET['ajax']);
00101 $old.=dossier::hidden();
00102 $old.='</form>';
00103 }
00104 }
00105
00106 ob_start();
00107 require_once('template/history_top.php');
00108 $detail_card=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),$fiche->getName());
00109 echo h2( $fiche->getName().'['.$fiche->strAttribut(ATTR_DEF_QUICKCODE).']',' class="title" ');
00110 echo '<p style="text-align:center;">'.$detail_card.'</p>';
00111
00112 if ( $fiche->HtmlTable($array,0,$from_div)==-1){
00113 echo h2(_("Aucune opération pour l'exercice courant"),'class="error"');
00114 }
00115
00116 echo $old;
00117
00118 $html=ob_get_contents();
00119 ob_end_clean();
00120 }
00121 }
00122
00123
00124
00125 if ( isset($_REQUEST['pcm_val']))
00126 {
00127 $poste=new Acc_Account_Ledger($cn,$_REQUEST['pcm_val']);
00128 $year=$g_user->get_exercice();
00129 if ( $year == 0 )
00130 {
00131 $html=_("erreur aucune période par défaut, allez dans préférence pour en choisir une");
00132 }
00133 else
00134 {
00135 $exercice=new Exercice($cn);
00136 $old='';
00137 $per=new Periode($cn);
00138 $limit_periode=$per->get_limit($year);
00139 $array['from_periode']=$limit_periode[0]->first_day();
00140 $array['to_periode']=$limit_periode[1]->last_day();
00141 if (isset($_GET['ex']))
00142 {
00143 $limit_periode=$per->get_limit($_GET['ex']);
00144 if ( $_GET['ex'] < $year)
00145 $array['from_periode']=$limit_periode[0]->first_day();
00146 else
00147 $array['to_periode']=$limit_periode[1]->last_day();
00148
00149 }
00150
00151
00152
00153 if ($exercice->count() > 1 )
00154 {
00155 $default=(isset($_GET['ex']))?$_GET['ex']:$year;
00156 $dossier=dossier::id();
00157 if ( $div != 'popup')
00158 {
00159 $obj="{div:'$div',pcm_val:'".$_GET['pcm_val']."',gDossier:'$dossier',select:this}";
00160 $is=$exercice->select('p_exercice',$default,' onchange="update_history_account('.$obj.');"');
00161 $old=_("Autre exercice")." ".$is->input();
00162 }
00163 else
00164 {
00165 $old='<form method="get" action="popup.php">';
00166 $is=$exercice->select('ex',$default,'onchange = "submit(this)"');
00167 $old.=_("Autre exercice")." ".$is->input();
00168 $old.=HtmlInput::hidden('div','popup');
00169 $old.=HtmlInput::hidden('act',$_GET['act']);
00170 $old.=HtmlInput::hidden('pcm_val',$_GET['pcm_val']);
00171 $old.=HtmlInput::hidden('ajax',$_GET['ajax']);
00172 $old.=dossier::hidden();
00173 $old.='</form>';
00174 }
00175
00176 }
00177
00178 ob_start();
00179 require_once('template/history_top.php');
00180
00181 if ( $poste->HtmlTable($array) == -1)
00182 {
00183 echo h2($poste->id." ".$poste->name,' class="title"');
00184 echo h2(_("Aucune opération pour l'exercice courant"),'class="error"');
00185 }
00186 echo $old;
00187
00188 $html=ob_get_contents();
00189 ob_end_clean();
00190 }
00191 }
00192 $html=escape_xml($html);
00193 header('Content-type: text/xml; charset=UTF-8');
00194 echo <<<EOF
00195 <?xml version="1.0" encoding="UTF-8"?>
00196 <data>
00197 <ctl>$div</ctl>
00198 <code>$html</code>
00199 </data>
00200 EOF;