noalyss Version-9
anc_key_input.php
Go to the documentation of this file.
1<?php
2/*
3 Copyright (C) 2014 danydb@aevalys.eu
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 */
20
21/*
22 * all the pa_id and analytic plan
23 */
24?>
25<form method="post" action="do.php" style="display:inline">
26 <?php
27 echo HtmlInput::request_to_hidden(array('gDossier', 'ac'));
28 echo HtmlInput::hidden('op','consult');
29 echo HtmlInput::hidden('key', $this->key->getp('id'));
31 $name=$http->post("name_key","string",$this->key->getp('name'));
32 $description_text=$http->post("description_key","string",$this->key->getp('description'));
33 ?>
34 <div class="content">
35 <div style="width:30%;display:inline-block;min-height: 75px">
36 <?php
37 $name=new IText('name_key',$name);
38 echo $name->input();
39 ?>
40 </div>
41 <div style="width: 65%;display:inline-block;min-height: 75px">
42 <?php
43 $description=new IText('description_key',$description_text);
44 $description->css_size='70%';
45 echo $description->input();
46 ?>
47 </div>
48 <h2>
49 <?php echo _('RĂ©partition'); ?>
50 </h2>
51 <table id="key_account_tb" class="result" style="margin-left: 8%;width:84%;margin-right:8%">
52 <tr>
53 <th><?php echo _('n°'); ?></th>
54 <?php
55 // Show all the possible analytic plan
56 for ($i=0; $i<count($plan); $i++):
57 ?>
58 <th>
59 <?php echo $plan[$i]['pa_name']; ?>
60 </th>
61 <?php
63 ?>
64 <th style="text-align: right">
65 <?php echo Icon_Action::infobulle(41); ?>
66 <?php echo _('Pourcentage'); ?>
67 </th>
68 </tr>
69 <?php
71 if ($count_row == 0 ) {
72 $a_row [0]['ke_row']=1;
73 $a_row [0]['ke_percent']=0;
74 $a_row [0]['ke_id']=-1;
75
76 }
78 for ($j=0; $j<count($a_row); $j++):
79 ?>
80 <tr>
81 <td>
82 <?php echo $a_row[$j]['ke_row']; ?>
83 <?php echo HtmlInput::hidden('row[]', $a_row[$j]['ke_id']); ?>
84 </td>
85 <?php
86 $percent=$a_row[$j]['ke_percent'];
88 // For each plan
89 for ($i=0; $i<count($plan); $i++):
90 if ( $j == 0 ) {
91 echo HtmlInput::hidden('pa[]',$plan[$i]['pa_id']);
92 }
93 $a_poste=$cn->make_array("select po_id,po_name from poste_analytique where pa_id=$1", 1, array($plan[$i]['pa_id']));
94 $select=new ISelect('po_id['.$j.'][]');
96 $value=$cn->get_array('select po_id,ke_percent
97 from key_distribution_activity as ka
98 join key_distribution_detail using (ke_id)
99 join key_distribution using (kd_id)
100 left join poste_analytique using(po_id)
101
102 where ke_id=$1 and ka.pa_id=$2 ', array($a_row[$j]['ke_id'],$plan[$i]['pa_id']));
104 if (sizeof($value)==1)
105 {
106 $selected=$value[0]['po_id'];
107
108 }
109 if (isset($_POST['po_id']))
110 {
111 $a_po_id=$http->post('po_id', "array",array());
112 $selected=$a_po_id[$j][$i];
113 $a_percent=$http->post('percent',"array", array());
114 $percent=$a_percent[$j];
115 }
117 ?>
118 <td>
119 <?php
120 echo $select->input();
121 ?>
122 </td>
123 <?php
124 endfor;
125 ?>
126 <td class="num">
127 <?php
128 $inum_percent=new INum('percent[]');
129 $inum_percent->javascript=' onchange="format_number(this,2);anc_key_compute_table();"';
130 $inum_percent->value=sprintf("%.2f",$percent);
131 echo $inum_percent->input();
132 ?>
133 </td>
134 </tr>
135 <?php
136 endfor;
137 ?>
138 <tfoot style="font-weight: bolder">
139 <tr>
140 <td style="width: auto" colspan="<?php echo count($plan)+1;?>">
141 <?php echo _('Total')?>
142 </td>
143 <td class="num">
144 <span id="total_key"><?php echo nb($tot_key);?></span>%
145 </td>
146 </tr>
147 </tfoot>
148 </table>
149<input type="button" class="smallbutton" value="<?php echo _('Ajout ligne')?>" onclick="add_row_key('key_account_tb');">
150
151 <div>
152 <div>
153 <h2>
154 <?php echo _("Disponible dans les journaux "); ?>
155 </h2>
156 </div>
157 <div style="margin-left: 8%;width:84%;margin-right:8%">
158
159 <?php
160 if ( $this->key->getp("id") == -1 )
161 {
162 // for a new key
163 $jrn=$cn->get_array('select null as kl_id,jrn_def_id,jrn_def_name,jrn_def_description
164 from jrn_def
165 order by jrn_def_name ');
166 }else {
167 // for an existing one
168 $jrn=$cn->get_array('select kl_id,jrn_def_id,jrn_def_name,jrn_def_description
169 from jrn_def
170 left join key_distribution_ledger using (jrn_def_id)
171 where kd_id=$1 or kd_id is null
172 order by jrn_def_name ', array($this->key->getp('id')));
173 }
174 $post_jrn=$http->post("jrn","string",-1);
175 ?>
176 <table id="jrn_def_tb" class="result">
177 <?php for ($i=0; $i<count($jrn); $i++): ?>
178 <tr>
179 <td>
180 <?php $checkbox=new ICheckBox("jrn[]"); ?>
181 <?php $checkbox->value=$jrn[$i]['jrn_def_id']; ?>
182 <?php
183 $checkbox->selected=false;
184 if ( ($post_jrn == -1 && $jrn[$i]['kl_id']<>"" ) || (is_array($post_jrn) && in_array($jrn[$i]['jrn_def_id'], $post_jrn)))
185 {
186 $checkbox->selected=true;
187 }
188 ?>
189 <?php echo $checkbox->input(); ?>
190 </td>
191 <td>
192 <?php echo h($jrn[$i]['jrn_def_name']); ?>
193 </td>
194 <td>
195 <?php echo h($jrn[$i]['jrn_def_description']); ?>
196 </td>
197 </tr>
198 <?php endfor; ?>
199 </table>
200 </div>
201 </div>
202
203 <!-- end -->
204 </div>
205 <?php echo HtmlInput::submit('save_key', _('Sauver')); ?>
206</form>
207<form style="display:inline" action="do.php" id="anc_key_input_frm" method="post">
208 <?php
209 echo HtmlInput::request_to_hidden(array('gDossier', 'ac'));
210 echo HtmlInput::hidden('op','delete_key');
211 echo HtmlInput::hidden('key', $this->key->getp('id'));
212 if ($this->key->getp('id') != -1) echo HtmlInput::submit('delete_key', _('Effacer'),'onclick="return confirm_box(\'anc_key_input_frm\',\''._('Confirmer effacement?').'\')"'); ?>
213</form>
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
span($p_string, $p_extra='')
Definition: ac_common.php:43
tr($p_string, $p_extra='')
Definition: ac_common.php:88
nb($p_number)
format the number for the CSV export
Definition: ac_common.php:107
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
h( $row[ 'oa_description'])
$opd_description style
$value
$percent
$inum_percent
$selected
for($i=0; $i< count($plan); $i++)( $j==0) $a_poste
if($count_row==0) $tot_key
$select value
$http
$select
$description
$name
$description_text
$post_jrn
for($i=0; $i< count($plan); $i++) endfor
$count_row
$input_from type
Definition: balance.inc.php:65
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
static hidden($p_name, $p_value, $p_id="")
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
Html Input.
This class handles only the numeric input, the input will call a javascript to change comma to period...
Definition: inum.class.php:42
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Html Input.
Definition: itext.class.php:30
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
$all table
$_POST['ac']
Definition: do.php:310