Plugins  LAST
 All Data Structures Files Functions Variables Pages
show_list.php
Go to the documentation of this file.
1 <?php
2 //This file is part of NOALYSS and is under GPL
3 //see licence.txt
4 /*!
5  * @file
6  * @brief : this file is called from Import_Bank::list_record , it lets you
7  * set the tiers, remove, transfer the imported operation
8  * @see Import_Bank::list_record
9  */
10 // variable
12 // Duplicate database conx
13 //
14 $conx2=clone $cn;
15 $conx3=clone $cn;
16 
17 // Prepare SQL for suggest
18 $suggest_sql=$conx2->prepare('get_suggest','
19  select id, temp_bank_id,jr_id,f_id
20  from
21  importbank.suggest_bank
22  where
23  temp_bank_id=$1');
24 
25 ?>
26 <h2 class="info">
27 
28  <?php
29  if ( isset ($array[0]['id']))
30  {
31  echo $array[0]['id']." ".$array[0]['i_date']." ".h($array[0]['format_name']);
32  }
33  ?>
34  <?php echo _('Journal')." ".h($jrn_name) ." ". _('Fiche ').h($jrn_account)?>
35 
36 
37 </h2>
38 <form method="get">
39 
40 Filtrer : <?php echo $filter->input()?>
41 <?php echo HtmlInput::request_to_hidden(array('gDossier','plugin_code','ac','sb','sa','id'))?>
42 <?php echo HtmlInput::submit('refresh','Recharger')?>
43 </form>
44 <?php
45 if ( ! $remove ):
46  ?>
47 
48 <form method="get" id="show_list_frm2" onsubmit="return confirm_box('show_list_frm2','Vous confirmez?')">
49 <?php echo HtmlInput::request_to_hidden(array('gDossier','plugin_code','ac','sb','sa','id',$filter->name))?>
50 <?php echo HtmlInput::hidden('form_action2','');?>
51 <?php echo HtmlInput::submit('delete_record',_('Effacer'),
52  ' onclick="$(\'form_action2\').value=\'delete_record\';"');?>
53 <?php echo HtmlInput::submit('transfer_record',_('Transfèrer'),
54  ' onclick="$(\'form_action2\').value=\'transfer_record\';"');?>
55 <?php echo HtmlInput::submit('suggest_record',_('Reconciliation automatique'),
56  ' onclick="$(\'form_action2\').value=\'reconcile_auto\';"');?>
57 <?php echo HtmlInput::submit('selected_record',_('Opérations sélectionnées'),
58  ' onclick="$(\'form_action2\').value=\'selected_record\';"');?>
59  <select name="select_action" id="select_action">
60  <option selected="" value="0"><?php echo _("--choix--")?>
61  </option>
62  <optgroup label="<?php echo _("Contrepartie")?>">
63  <option value="1"><?php echo _("Donner la contrepartie")?></option>
64  <option value="2"><?php echo _("Supprimer la contrepartie")?></option>
65  </optgroup>
66  <optgroup label="<?php echo _("Réconciliation")?>">
67 
68  <option value="4"><?php echo _("Valider réconciliation")?></option>
69  <option value="3"><?php echo _("Supprimer réconciliation")?></option>
70  </optgroup>
71  <optgroup label="<?php echo _("Suppression")?>">
72  <option value="5"><?php echo _("Marquer pour suppression")?></option>
73  <option value="6"><?php echo _("Enlever le marquage de suppression")?></option>
74  </optgroup>
75  </select>
76 
77 </form>
78 <?php endif; ?>
79 <?php echo HtmlInput::filter_table('record_tb_id','1,2,3,4,5,6,7',1); ?>
80 <table id="record_tb_id" class="sortable" >
81  <TR>
82  <th class="sorttable_nosort">
83  <?php
84  $check_all=new ICheckBox('check_all');
85  $check_all->javascript=' onclick = "impb_check_all()"';
86  echo $check_all->input();
87  ?>
88  </th>
89  <TH>N° opération</TH>
90  <th class=" sorttable_sorted_reverse" >Date <span id="sorttable_sortrevind">&nbsp;&blacktriangle;</span></th>
91  <th>Montant</th>
92  <th>Etat</th>
93  <th>Tiers</th>
94  <th>Contrepartie</th>
95  <th>Opération liée</th>
96  <th>Libellé</th>
97  <th>Extra</th>
98 </TR>
99 <?php
101  $plugin_code=$_REQUEST['plugin_code'];
102  for ($i=0;$i<Database::num_row($ret);$i++):
103  $row=Database::fetch_array($ret,$i);
104  $suggest=$conx2->execute('get_suggest',array($row['id']));
105  $a_suggest = Database::fetch_all($suggest);
106  if ( $a_suggest == false ) {$a_suggest = array();}
107  $class=($i%2==0)?' class="even"':'class="odd"';
108 
109  $javascript="onclick=\"reconcilie('div${row['id']}','$gdossier','${row['id']}','$plugin_code')\"";
110 
111 ?>
112 <tr <?php echo $class?> >
113 <td sorttable_customkey="<?php echo $row['is_checked']?>">
114  <?php
115  // Display a check button and update automatically in ajax the table
116  // temp_checked
117  $checked_js = sprintf("onclick=\"impb_check_item(%d,'%s','%s')\"",$dossier_id,$plugin_code,$row['id']);
118  $check = new ICheckBox(sprintf('temp_bank%s',$row['id']));
119  $check->javascript=$checked_js;
120  $check->value=$row['is_checked'];
121  $check->set_check(1);
122  echo $check->input();
123  ?>
124 </td>
125 <TD>
126 <?php echo $row['ref_operation']?>
127 </TD>
128 
129 <TD sorttable_customkey="<?php echo $row['tp_date']; ?>">
130 <?php echo HtmlInput::anchor(format_date($row['tp_date']),"",$javascript)?>
131 </TD>
132 
133 <td class="num" sorttable_customkey="<?php echo $row['amount']; ?>">
134 <?php echo HtmlInput::anchor(nbm($row['amount']),"",$javascript)?>
135 </td>
136 <td id="<?php echo 'st'.$row['id']?>" <?php echo Import_Bank::color_status($row['status'])?> >
137 <?php echo HtmlInput::anchor($row['f_status'],"",$javascript)?>
138 </td>
139 
140 <td>
141 <?php echo HtmlInput::anchor(h($row['tp_third']),"",$javascript)?>
142 </td>
143 <td id="tiers<?php echo $row['id']?>">
144  <?php
145  if ( $row['f_id'] != "") {
146  $fiche=new Fiche($conx3,$row['f_id']);
147  $qcode= $fiche->get_quick_code();
148  if ( $qcode != null ) {
149  echo HtmlInput::card_detail($qcode);
150  }
151  } else {
152  if ( count($a_suggest) == 1) {
153  $fiche=new Fiche($conx3,$a_suggest[0]['f_id']);
154  $qcode= $fiche->get_quick_code();
155  if ( $qcode != null ) {
156  echo HtmlInput::card_detail($qcode, _('Valide')."?");
157  }
158  } else if (count($a_suggest) > 1 ){
159  $text= sprintf(_('Possibles %d'),count($a_suggest));
160  $js_suggest=sprintf("onclick=\"display_suggest('%s','%s','%s')\"",
161  $dossier_id,$_REQUEST['plugin_code'],$row["id"]);
162  echo HtmlInput::anchor($text, "", $js_suggest);
163  }
164  }
165  ?>
166 </td>
167 <td id="concop<?php echo $row['id']?>">
168  <?php
169  if ( $row['tp_rec'] != "") {
170  $a_rec=explode(",", $row['tp_rec']);
171  $nb_arec=count($a_rec);
172  $virg = "";
173  for ($j=0 ; $j < $nb_arec;$j++) {
174  $ref=$conx3->get_value('select jr_internal from jrn where jr_id=$1',
175  array($a_rec[$j]));
176  echo $virg . HtmlInput::detail_op($a_rec[$j],$ref);
177  $virg = " , ";
178  }
179  } else {
180  if ( count($a_suggest) == 1 ) {
181  $ref=$conx3->get_value('select jr_internal from jrn where jr_id=$1',
182  array($a_suggest[0]['jr_id']));
183  echo HtmlInput::detail_op($a_suggest[0]['jr_id'],_('Valide?').$ref);
184  }
185  }
186 
187  ?>
188 </td>
189 <td>
190 <?php echo HtmlInput::anchor(h($row['libelle']),"",$javascript )?>
191 </td>
192 
193 
194 
195 <td >
196 <?php echo HtmlInput::anchor(h($row['tp_extra']),"",$javascript )?>
197 </td>
198 </tr>
199 <?php
200  endfor;
201 ?>
202 
203 </table>
204 <form method="get" id="show_list_frm" onsubmit="return confirm_box('show_list_frm','Vous confirmez?')">
205 <?php echo HtmlInput::request_to_hidden(array('gDossier','plugin_code','ac','sb','sa','id',$filter->name))?>
206 <?php echo HtmlInput::hidden('form_action','');?>
207 <?php echo HtmlInput::submit('delete_record',_('Effacer'),
208  ' onclick="$(\'form_action\').value=\'delete_record\';"');?>
209 <?php echo HtmlInput::submit('transfer_record',_('Transfèrer'),
210  ' onclick="$(\'form_action\').value=\'transfer_record\';"');?>
211 </form>
212 <script>
213  $('select_action').onchange=function(){
214 
215  if ( this.value == 1 ) {
216  waiting_box();
217  this.value=0;
218  new Ajax.Request('ajax.php',
219  {
220  method:'get',
221  parameters:{'gDossier':<?php echo $dossier_id;?>,
222  'act':'display_tiers',
223  'status':<?php echo $filter->selected;?>,
224  'plugin_code':'<?php echo $plugin_code;?>',
225  'import_id':<?php echo $array[0]['id'];?>,
226  'ac':'<?php echo $_REQUEST['ac']?>'
227  },
228  onSuccess:function(req,json){
229  remove_waiting_box();
230  var pos=fixed_position(50,100);
231  // Display a div to select the tiers
232  var div1= { "id":"select_tiers_div",
233  "cssclass":"inner_box",
234  "style":pos,
235  "html":req.responseText
236  };
237  try {
238  add_div(div1);
239  req.responseText.evalScripts();
240  } catch (e) {
241  error_message(e.getMessage);
242  }
243 
244  }
245  })
246  }
247  }
248  function impb_check_all() {
249  waiting_box();
250  var check=($('check_all').checked)?1:0;
251  var gDossier='<?php echo $dossier_id; ?>';
252  var plugin_code='<?php echo $plugin_code; ?>';
253 
254  var tb=document.getElementById('record_tb_id');
255  var a=tb.getElementsByTagName('input');
256 
257 
258  var i=0;
259  for (i = 0 ; i < a.length;i++) {
260  if (a[i].id == 'check_all') {continue;}
261 
262  // Avoid selecting the no visible row
263  if (! a[i].parentNode.parentNode.visible()) {
264  continue;
265  }
266 
267  if ( check == 0) {
268  a[i].checked=false;
269  } else {
270  a[i].checked=true;
271  }
272  var row_id=a[i].id;
273  row_id=row_id.replace(/temp_bank/,"");
274  impb_check_item(gDossier,plugin_code,row_id);
275 
276  }
277  remove_waiting_box();
278  }
279 
280 
281 </script>
endfor
$select_type id
$ret
$suggest_sql
Definition: show_list.php:18
$check value
Definition: show_list.php:120
$check_all
Definition: show_list.php:84
$gdossier
Definition: show_list.php:100
$categorie_appel label
for($i=0;$i< Database::num_row($ret);$i++) $row
static color_status($id)
return the HTML style for the status White : new green : transfered red : error
if($a_suggest==false) $class
Definition: show_list.php:107
endif
Definition: detail_item.php:95
$conx3
Definition: show_list.php:15
$a_suggest
Definition: show_list.php:105
$plugin_code
Definition: show_list.php:101
if(isset($_POST['remove'])) $array
$suggest
Definition: show_list.php:104
$javascript
Definition: show_list.php:109
function impb_check_item(p_dossier, p_plugin_code, p_row_id)
if a row is checked or unchecked, save it into the table temp_bank.is_checked
Definition: bank_js.js:74
& nbsp
$j
Definition: index.php:36
$conx2
Definition: show_list.php:14
$ck selected
Definition: am_card.php:42
$categorie_appel table
$categorie_appel name
$_REQUEST['sb']
Definition: am_print.php:39
$check
Definition: show_list.php:118
$dossier_id
Definition: show_list.php:11
global $cn