Plugins  LAST
 All Data Structures Files Functions Variables Pages
material_detail.php
Go to the documentation of this file.
1 <?php
2 /*
3  * Copyright 2010 De Bontridder Dany <dany@alchimerys.be>
4  * This file is part of NOALYSS.
5  *
6  * NOALYSS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * NOALYSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with NOALYSS; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 ?>
21 <h2 class="title">Modification de matériel</h2>
22 <form id="amrt_detail" onsubmit="return confirm_save_modify('amrt_detail');return false">
23 <?php echo $p_card?>
24 <?php echo $a_id?>
25 <span style="text-align:center;display:block;font-size:2em" id="p_card_label" ><?php echo $card->strAttribut(ATTR_DEF_NAME)?></span>
26 <table>
27 <tr>
28  <td>Fiche</td>
29  <td><?php echo HtmlInput::card_detail($card->strAttribut(ATTR_DEF_QUICKCODE))?></td>
30 </tr>
31 
32 <tr>
33  <td>Date Acquisition</td>
34  <td><?php $p_date->id="amrt_date" ; echo $p_date->input()?></td>
35 </tr>
36 <tr>
37  <td>Montant à amortir</td>
38  <td><?php echo $p_amount->input()?></td>
39 </tr>
40 
41 <tr>
42  <td>Année comptable d'achat</td>
43  <td> <?php echo $p_year->input();?></td>
44 </tr>
45 <tr>
46  <td>
47  Poste comptable ou fiche
48  </td>
49  <td>
50  <?php echo $select_type->input(); ?>
51  </td>
52 </tr>
53 <tr id="deb_use_account_tr_id">
54  <td>Poste de charge dotations amortissement (débit)</td>
55  <td><?php echo $p_deb->input(); ?></td>
56  <td><?php echo $deb_span->input()?></td>
57 </tr>
58 <tr id="cred_use_account_tr_id">
59  <td>Poste amortissement en contrepartie</td>
60  <td><?php echo $p_cred->input();?></td>
61  <td><?php echo $cred_span->input();?></td>
62 </tr>
63 <tr id="deb_use_card_tr_id">
64  <td>Fiche de charge pour amortissement (déb) </td>
65  <td><?php echo $p_card_deb->input()?><?php echo $p_card_deb->search()?></td>
66 </tr>
67 <tr id="cred_use_card_tr_id">
68  <td>Fiche amortissement en contrepartie</td>
69  <td><?php echo $p_card_cred->input();?><?php echo $p_card_cred->search()?></td>
70 </tr>
71 <tr>
72  <td>Nombre d'années amortissement (non modifiable)</td>
73  <td><?php echo $p_number->input()?></td>
74 </tr>
75 <tr>
76  <td>Visible <span class="notice">Y pour oui ou N pour non</span></td>
77  <td><?php echo $p_visible->input();?></td>
78 </tr>
79 <tr>
80  <td> </td>
81  <td></td>
82 </tr>
83 <tr>
84  <td></td>
85  <td></td>
86 </tr>
87 </table>
88 <?php
89 echo HtmlInput::hidden('plugin_code',$_REQUEST['plugin_code']);
90 echo dossier::hidden();
91  if ( $p_number->value == 0 ) :
92 
93  else:
94 ?>
95 <span class="notice"> En changeant le montant à amortir, l'année ou le nombre d'années, les annuités seront recalculées et l'historique effacé</span>
96 
97 <fieldset><legend>Annuités</legend>
98 <table class="result">
99 <th>Année</th>
100 <th>Montant</th>
101 <th>Amortissement acté</th>
102 <th>Pièce </th>
103 <th>n° interne</th>
104 
105 
106 <th>Pourcent</th>
107 
108 <?php
109 bcscale(2);
110 
111 $annuite=0;
112 $done=0;
113 for ($i=0;$i<count($array);$i++):
114  $pct=new INum('pct[]');
115  $pct->value=$array[$i]->ad_percentage;
116 ?>
117 <tr>
118  <td><?php echo HtmlInput::hidden('ad_year[]',$array[$i]->ad_year)?>
119  <?php echo $array[$i]->ad_year?>
120  </td>
121  <td>
122  <?php
123  echo HtmlInput::hidden("ad_id[]",$array[$i]->ad_id);
124  $amount=new INum("amount[]");
125  $amount->value=$array[$i]->ad_amount;
126  echo $amount->input();
127  ?>
128 
129 </td>
130  <?php
131  $annuite=bcadd($annuite,$array[$i]->ad_amount);
132 
133  $x=$cn->get_array('select ha_id,h_pj,jr_internal,h_amount from amortissement.amortissement_histo where a_id=$1 and h_year=$2',
134  array($value_a_id,$array[$i]->ad_year));
135  if ( count ($x) == 1)
136  {
137  echo HtmlInput::hidden('h[]',$x[0]['ha_id']);
138 
139  $done=bcadd($done,$x[0]['h_amount']);
140  $acte=new INum('p_histo[]');
141  $acte->value=$x[0]['h_amount'];
142  echo td($acte->input());
143 
144  $pj=new IText('p_pj[]');
145  $pj->value=$x[0]['h_pj'];
146  echo td($pj->input());
147 
148  if ( $x[0]['jr_internal'] != '' ) {
149  $jr_id=$cn->get_value('select jr_id from jrn where jr_internal=$1',array($x[0]['jr_internal']));
150  /**
151  * @todo : ajout bouton enleve -> ajax
152  */
153  echo td(HtmlInput::detail_op($jr_id,$x[0]['jr_internal']));
154 
155 
156  } else {
157  $concerne=new IConcerned('op_concerne['.$array[$i]->ad_id.']');
158  $concerne->amount_id=$array[$i]->ad_amount;
159  echo '<td>'.$concerne->input().'</td>';
160  }
161  }
162  echo td($pct->input() );
163  ?>
164 </tr>
165 
166 
167 <?php
168 endfor;
169 ?>
170 </table>
171 <span style="font-size:120%;font-weight:bold;font-family:arial;font-style:italic;margin-right:10%">Total = <?php echo nbm($annuite)?></span>
172 <span style="font-size:120%;font-weight:bold;font-family:arial;font-style:italic;margin-right:10%">Amorti = <?php echo nbm($done)?></span>
173 <span style="font-size:120%;font-weight:bold;font-family:arial;font-style:italic;margin-right:10%">Reste = <?php echo nbm($p_amount->value-$done)?></span>
174 
175 <?php
176 if ( $annuite != $p_amount->value)
177  {
178  printf ('<h2 class="error">'._("Différence entre le montant à amortir et le montant amorti = %d'".'</h2>'),nbm($annuite - $p_amount->value));
179  }
180  ?>
181 </fieldset>
182 <?php
183  endif;
184 ?>
185 <p style="text-align: center">
186 <?php
187  echo HtmlInput::submit('sauver',_('Sauver'));
188  $rm=sprintf("remove_mat(%d,'%s',%d)",dossier::id(),$_REQUEST['plugin_code'],$value_a_id);
189  echo HtmlInput::button('remove',_('Effacer'),"onclick=\"$rm\" ");
190  echo HtmlInput::button('close',_('Fermer'),"onclick=\"removeDiv('bxmat');refresh_window()\" ");
191 
192 ?>
193  </p>
194 </FORM>
195 <script>
196 show_selected_material($('select_type_id'));
197 
198 </script>
$note style
if($p_number->value==0) l les annuités seront recalculées et l pct[] ad_year[] select h_pj
if($p_number->value==0) l années
function remove_mat(g_dossier, plugin_code, a_id)
function show_selected_material(obj)
$categorie_appel table
$_REQUEST['sb']
Definition: am_print.php:39
if($p_number->value==0) l les annuités seront recalculées et l pct[] ad_year[] select ha_id
if($p_number->value==0) l les annuités seront recalculées et l pct[] ad_year[] select h_amount from amortissement amortissement_histo where a_id
if($p_number->value==0) l les annuités seront recalculées et l pct[] ad_year[] select jr_internal