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 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00021 require_once("class_ispan.php");
00022 require_once("class_icard.php");
00023 require_once("class_iselect.php");
00024 require_once("class_icheckbox.php");
00025 require_once('class_acc_operation.php');
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 require_once('class_database.php');
00037 require_once('class_ipopup.php');
00038 global $g_user;
00039
00040 echo IPoste::ipopup('ipop_account');
00041 echo ICard::ipopup('ipopcard');
00042 $search_card=new IPopup('ipop_card');
00043 $search_card->title=_('Recherche de fiche');
00044 $search_card->value='';
00045 echo $search_card->input();
00046
00047
00048
00049
00050 echo '<div class="content">';
00051
00052 echo '<FORM action="?" METHOD="GET">';
00053 echo HtmlInput::hidden('ac',$_REQUEST['ac']);
00054 echo HtmlInput::hidden('type','poste');
00055 echo dossier::hidden();
00056 echo '<TABLE><TR>';
00057 $span=new ISpan();
00058
00059 $w=new IPoste('poste_id');
00060 $w->set_attribute('ipopup','ipop_account');
00061 $w->set_attribute('label','poste_id_label');
00062 $w->set_attribute('account','poste_id');
00063 $w->table=0;
00064 $w->value=(isset($_REQUEST['poste_id']))?$_REQUEST['poste_id']:"";
00065 $w->label="Choississez le poste";
00066 print td('Choississez un poste ').td($w->input());
00067 echo td($span->input('poste_id_label'));
00068 echo '</tr><tr>';
00069
00070 $w_poste=new ICard('f_id');
00071 $w_poste->table=0;
00072 $w_poste->jrn=0;
00073 echo td("Ou choississez la fiche");
00074 $w_poste->set_attribute('label','f_id_label');
00075 $w_poste->set_attribute('ipopup','ipop_card');
00076 $w_poste->set_attribute('gDossier',dossier::id());
00077 $w_poste->set_attribute('typecard','all');
00078 $w_poste->set_function('fill_data');
00079 $w_poste->set_dblclick("fill_ipopcard(this);");
00080
00081
00082 $w_poste->value=(isset($_REQUEST['f_id']))?$_REQUEST['f_id']:"";
00083 print td($w_poste->input().$w_poste->search());
00084 echo td($span->input('f_id_label'));
00085 print '</TR>';
00086 print '<TR>';
00087
00088 $date_from=new IDate('from_periode');
00089 $date_to=new IDate('to_periode');
00090 $year=$g_user->get_exercice();
00091 $date_from->value=(isset($_REQUEST['from_periode']))?$_REQUEST['from_periode']:"01.01.".$year;
00092 $date_to->value=(isset($_REQUEST['to_periode']))?$_REQUEST['to_periode']:"31.12.".$year;
00093 echo td(_('Depuis').$date_from->input());
00094 echo td(_('Jusque ').$date_to->input());
00095
00096 print "<TR><TD>";
00097 $all=new ICheckBox();
00098 $all->label="Tous les postes qui en dépendent";
00099 $all->disabled=false;
00100 $all->selected=(isset($_REQUEST['poste_fille']))?true:false;
00101 echo $all->input("poste_fille");
00102 echo '</TD></TR><TR><TD>';
00103 $detail=new ICheckBox();
00104 $detail->label="Détail des opérations";
00105 $detail->disabled=false;
00106 $detail->selected=(isset($_REQUEST['oper_detail']))?true:false;
00107 echo $detail->input("oper_detail");
00108 echo '</td></tr>';
00109 $a_let=array(
00110 array('value'=>0,'label'=>'Toutes les opérations'),
00111 array('value'=>1,'label'=>' Opérations lettrées'),
00112 array('value'=>2,'label'=>' Opérations non lettrées')
00113 );
00114 echo '</TABLE>';
00115 $salet=new ISelect('ople');
00116 $salet->value=$a_let;
00117 $salet->selected=(isset ($_GET['ople']))?$_GET['ople']:0;
00118
00119 echo $salet->input();
00120
00121 print HtmlInput::submit('bt_html','Visualisation');
00122
00123 echo '</FORM>';
00124 echo '<hr>';
00125 echo '</div>';
00126
00127
00128
00129
00130
00131
00132 if ( isset( $_REQUEST['bt_html'] ) )
00133 {
00134 if ( isDate($_REQUEST['from_periode'])==null || isDate($_REQUEST['to_periode'])==null)
00135 {
00136 echo alert('Date malformée, désolée');
00137 exit();
00138 }
00139 require_once("class_acc_account_ledger.php");
00140 $go=0;
00141
00142 if ( isset($_GET['poste_id']) && strlen(trim($_GET['poste_id'])) != 0 )
00143 {
00144 if ( isset ($_GET['poste_fille']) )
00145 {
00146 $parent=$_GET['poste_id'];
00147 $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '$parent%' order by pcm_val::text");
00148 $go=3;
00149 }
00150
00151 elseif ( $cn->count_sql('select * from tmp_pcmn where pcm_val=$1',array($_GET['poste_id'])) != 0 )
00152 {
00153 $Poste=new Acc_Account_Ledger($cn,$_GET['poste_id']);
00154 $go=1;
00155 }
00156 }
00157 if ( strlen(trim($_GET['f_id'])) != 0 )
00158 {
00159 require_once("class_fiche.php");
00160
00161 $fiche=new Fiche($cn);
00162 $qcode=$fiche->get_by_qcode($_GET['f_id']);
00163 $p=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
00164 if ( $p != NOTFOUND)
00165 {
00166 $go=2;
00167 }
00168 }
00169
00170
00171 if ( $go == 1)
00172 {
00173 echo '<div class="content">';
00174 if ( ! isset($_REQUEST['oper_detail']) )
00175 {
00176 Acc_Account_Ledger::HtmlTableHeader();
00177 echo '<div class="content">';
00178 $Poste->HtmlTable(null,$_GET['ople']);
00179 echo '</div>';
00180 echo Acc_Account_Ledger::HtmlTableHeader();
00181 }
00182 else
00183 {
00184
00185
00186
00187 Acc_Account_Ledger::HtmlTableHeader();
00188
00189 $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$_GET['ople']);
00190 if ( empty($Poste->row)) exit();
00191 $Poste->load();
00192
00193 echo '<table class="result" style="width:80%;margin-left:10%">';
00194 echo '<tr><td class="mtitle" style="width:auto" colspan="6"><h2 class="info">'. $_GET['poste_id'].' '.h($Poste->label).'</h2></td></tr>';
00195
00196 $old=array();
00197 foreach ($Poste->row as $detail)
00198 {
00199 if ( in_array($detail['jr_id'],$old) == TRUE ) continue;
00200 $old[]=$detail['jr_id'];
00201 echo '<tr><td class="mtitle" style="width:auto" colspan="6">'.$detail['j_date'].' '.$detail['jr_internal'].h($detail['description']).'</td></tr>';
00202
00203 $op=new Acc_Operation($cn);
00204 $op->jr_id=$detail['jr_id'];
00205 $op->poste=$_GET['poste_id'];
00206 echo $op->display_jrnx_detail(1);
00207 }
00208 echo '</table>';
00209
00210 echo Acc_Account_Ledger::HtmlTableHeader();
00211 }
00212 echo "</div>";
00213 exit;
00214 }
00215
00216
00217 if ( $go == 2)
00218 {
00219 if ( ! isset($_REQUEST['oper_detail']) )
00220 {
00221 echo '<div class="content">';
00222 echo '<h2 class="info"> ' .
00223 '(' . $fiche->id . ')' .
00224 $fiche->getName() . ' ' .
00225 ' [ ' . $fiche->get_quick_code() . ' ] ' .
00226 '</h2>';
00227 $fiche->HtmlTableHeader();
00228 $fiche->HtmlTable(null, $_GET['ople']);
00229 $fiche->HtmlTableHeader();
00230 echo "</div>";
00231 }
00232 else
00233 {
00234
00235 echo '<div class="content">';
00236 echo '<h2 class="info"> ' .
00237 '(' . $fiche->id . ')' .
00238 $fiche->getName() . ' ' .
00239 ' [ ' . $fiche->get_quick_code() . ' ] ' .
00240 '<h2>';
00241
00242 $fiche->HtmlTableHeader();
00243 $fiche->HtmlTableDetail();
00244 $fiche->HtmlTableHeader();
00245 echo "</div>";
00246 }
00247 exit;
00248 }
00249
00250
00251 if ( $go == 3 )
00252 {
00253
00254 if ( sizeof($a_poste) == 0 )
00255 exit;
00256 echo '<div class="content">';
00257
00258
00259 if ( ! isset ($_REQUEST['oper_detail']))
00260 {
00261 $Poste=new Acc_Account_Ledger($cn,$_GET['poste_id']);
00262 echo Acc_Account_Ledger::HtmlTableHeader();
00263
00264 foreach ($a_poste as $poste_id )
00265 {
00266 $Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']);
00267 $Poste->HtmlTable(null,$_GET['ople']);
00268 }
00269 echo Acc_Account_Ledger::HtmlTableHeader();
00270 echo "</div>";
00271 }
00272 else
00273 {
00274
00275
00276
00277 echo Acc_Account_Ledger::HtmlTableHeader();
00278 echo '<table style="width:100%;margin-left:0%">';
00279 foreach ($a_poste as $poste_id )
00280 {
00281 $Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']);
00282 $Poste->load();
00283 $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$_GET['ople']);
00284 if ( empty($Poste->row)) continue;
00285 echo '<tr><td class="mtitle" style="width:auto" colspan="6"><h2 class="title">'. $poste_id['pcm_val'].' '.h($Poste->label).'</h2></td></tr>';
00286
00287 $detail=$Poste->row[0];
00288
00289 $old=array();
00290
00291 foreach ($Poste->row as $detail)
00292 {
00293
00294 if ( in_array($detail['jr_id'],$old) == TRUE ) continue;
00295 $old[]=$detail['jr_id'];
00296 echo tr(td("Journal :".$detail['jrn_def_name'],''),'style="width:auto" colspan="6"');
00297 echo '<tr><td class="mtitle" style="width:auto" colspan="6">'. $detail['j_date'].' '.$detail['jr_internal'].' '.hb($detail['description']).' '.hi($detail['jr_pj_number']).'</td></tr>';
00298
00299 $op=new Acc_Operation($cn);
00300 $op->poste=$poste_id['pcm_val'];
00301
00302 $op->jr_id=$detail['jr_id'];
00303 echo $op->display_jrnx_detail(1);
00304 }
00305 }
00306 echo '</table>';
00307 echo Acc_Account_Ledger::HtmlTableHeader();
00308 }
00309
00310 exit;
00311 }
00312 }
00313 ?>