36require_once NOALYSS_INCLUDE.
'/database/anc_key_sql.class.php';
54 from key_distribution_ledger
55 join key_distribution using (kd_id)
57 jrn_def_id=$1', array(
$p_jrn));
65 $this->a_activity=
null;
88 $a_key=
$cn->get_array(
' select kd_id,
93 join key_distribution_ledger using (kd_id)
101 echo _(
'Aucune clef disponible');
102 echo _(
'Allez dans ANCKEY pour en ajouter pour ce journal');
104 include NOALYSS_TEMPLATE.
'/anc_key_display_choice.php';
114 $a_key=
$cn->get_array(
'select b.kd_id,b.kd_name,b.kd_description,
115 (select sum(ke_percent) from key_distribution_detail as a where a.kd_id=b.kd_id) as distrib
116 from key_distribution as b order by b.kd_name');
119 echo _(
'Aucune clef disponible');
121 include NOALYSS_TEMPLATE.
'/anc_key_display_list.php';
132 $plan=
$cn->get_array(
'
140 $count_max=count($plan);
142 $a_row=
$cn->get_array(
'select ke_id,ke_row,ke_percent from key_distribution_detail
144 kd_id=$1 order by ke_row', array($this->key->getp(
'id')));
146 require_once NOALYSS_TEMPLATE.
'/anc_key_input.php';
158 $a_percent=
$http->extract(
'percent',
"array");
160 if (count($a_percent)==0)
162 throw new Exception(_(
'Aucune répartition'));
166 for (
$i=0;
$i<count($a_percent);
$i++)
168 $tot_percent=bcadd($tot_percent, $a_percent[
$i]);
170 if ($tot_percent >100)
172 throw new Exception(_(
'Le total ne vaut pas 100, total calculé = ').$tot_percent);
175 if (trim(
$http->extract(
'name_key'))==
'') {
176 throw new Exception (_(
'Le nom ne peut être vide'));
244 $a_ledger=
$http->extract(
"jrn",
"string",array());
245 $a_percent=
$http->extract(
'percent',
"array",[]);
246 $a_po_id=
$http->extract(
'po_id',
"array",[]);
250 $this->key->setp(
'name',
$http->extract(
'name_key'));
251 $this->key->setp(
'description',
$http->extract(
'description_key'));
258 $key_row->setp(
'key', $this->key->getp(
'id'));
259 $key_row->setp(
'row',
$i+1);
260 $key_row->setp(
'percent', $a_percent[
$i]);
264 $cn->exec_sql(
'delete from key_distribution_activity where ke_id=$1', array($key_row->getp(
'id')));
267 if ($a_percent[
$i]==0)
272 for ($j=0; $j<count($a_po_id[
$i]); $j++)
275 $activity->setp(
'detail', $key_row->ke_id);
276 $value=($a_po_id[
$i][$j]==-1)?
null:$a_po_id[
$i][$j];
277 $activity->setp(
'activity',
$value);
278 $activity->setp(
'plan',
$a_plan[$j]);
283 $cn->exec_sql(
'delete from key_distribution_ledger where kd_id=$1', array($this->key->getp(
'id')));
284 for ($k=0; $k<count($a_ledger); $k++)
287 $ledger->kd_id=$this->key->getp(
'id');
288 $ledger->jrn_def_id=$a_ledger[$k];
297 if ( DEBUGNOALYSS > 0 ) { echo
$e->getTraceAsString(); }
else { echo _(
'erreur').$e->getMessage();}
315 $number=preg_replace(
'/det[0-9]/',
'', $p_target);
319 $op[$number]=$p_amount;
321 $a_plan=
$cn->get_array(
'select pa_id from plan_analytique order by pa_id');
327 $a_poste=
$cn->get_array(
'select po_id,ke_percent,pa_id,ke_row
328 from key_distribution_activity
329 join key_distribution_detail using (ke_id)
332 order by ke_row,pa_id',
333 array($this->key->getp(
'id')));
341 $a_amount=
$cn->get_array(
"select distinct ke_row,ke_percent
342 from key_distribution_activity
343 join key_distribution_detail using (ke_id)
348 array($this->key->getp(
'id'),
$a_plan[0][
'pa_id']));
350 for (
$i=0;
$i< count($a_amount);
$i++)
352 $val[$number][
$i]=bcmul($p_amount,$a_amount[
$i][
'ke_percent']);
361 if (strpos($p_target,
"et")){
363 $pos=strrpos($p_target,
"t");
364 $anc_operation->in_div=substr($p_target,0,
$pos);
367 echo $anc_operation->display_form_plan(
$array, 1, 1, $number, $p_amount,
'',
false);
377 $key->key->setp(
'name',_(
'Nouvelle clef'));
378 $key->key->setp(
'description',_(
'Description de la nouvelle clef'));
380<
input type=
"button" class=
"smallbutton" value=
"<?php echo _('Ajout')?>" onclick=
"$('key_add_div_id').show()">
381<div
id=
"key_add_div_id" style=
"display: none">
392 $this->key->delete();
noalyss_str_replace($search, $replace, $string)
record_log($p_message)
Record an error message into the log file of the server.
manage table key_distribution_activity
manage table key_distribution_detail
manage table key_distribution_ledger
Manage the table key_distribution.
Class to manage distribution keys for Analytic accountancy.
static display_list()
display a list of keys, choose one to modify it
static display_choice($p_amount, $p_target, $p_ledger)
display list of available keys
fill_table($p_target, $p_amount)
Call the Anc_Operation::display_form_plan with the right amounts.
input()
Show the detail for a key distribution and let you change it for adding or update.
verify($p_array)
verify that data are ok
static key_add()
show a form for adding a key + button to display it
save($p_array)
save the data of a repartition key.
static key_available($p_jrn)
Return the number of keys available.
this class is used to show the form for entering an operation only FOR analytic operation to save it,...