$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/include/ajax_anc_key_compute.php b/include/ajax_anc_key_compute.php
new file mode 100644
index 000000000..8d375fedc
--- /dev/null
+++ b/include/ajax_anc_key_compute.php
@@ -0,0 +1,61 @@
+fill_table($target,$amount);
+
+////
+$response = ob_get_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/include/anc_key.inc.php b/include/anc_key.inc.php
new file mode 100644
index 000000000..0365faea8
--- /dev/null
+++ b/include/anc_key.inc.php
@@ -0,0 +1,64 @@
+save($_POST);
+ Anc_Key::display_list();
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo span($e->getMessage(),' class="notice"');
+ }
+ }
+ $key->input();
+ break;
+}
+?>
diff --git a/include/class_anc_key.php b/include/class_anc_key.php
new file mode 100644
index 000000000..0cdfecf17
--- /dev/null
+++ b/include/class_anc_key.php
@@ -0,0 +1,296 @@
+key=new Anc_Key_SQL($cn, $p_id);
+ $this->a_ledger=null;
+ $this->a_activity=null;
+ $this->a_row=null;
+ }
+
+ /**
+ * @brief display list of available keys
+ * @param $p_amount amount to distribute
+ * @param $p_target target to update
+ * @param $p_ledger is the jrn_def_id
+ */
+ static function display_choice($p_amount, $p_target,$p_ledger)
+ {
+ global $cn;
+ $a_key=$cn->get_array(' select kd_id,
+ kd_name,
+ kd_description
+ from
+ key_distribution
+ join key_distribution_ledger using (kd_id)
+ where
+ jrn_def_id=$1',
+ array(
+ $p_ledger
+ ));
+ if (empty($a_key))
+ {
+ echo _('Aucune clef disponible');
+ }
+ include 'template/anc_key_display_choice.php';
+ }
+
+ /**
+ * @brief display a list of keys, choose one to modify it
+ *
+ */
+ static function display_list()
+ {
+ global $cn;
+ $keysql=new Anc_Key_SQL($cn);
+ $rkey=$keysql->seek(' order by kd_name');
+ $a_key=$cn->fetch_all($rkey);
+ if (empty($a_key))
+ {
+ echo _('Aucune clef disponible');
+ }
+ include 'template/anc_key_display_list.php';
+ }
+
+ /**
+ * @brief Show the detail for a key distribution and let you change it
+ * for adding or update
+ */
+ function input()
+ {
+ global $cn;
+
+ $plan=$cn->get_array('
+ select
+ pa_id,
+ pa_name ,
+ pa_description
+ from
+ plan_analytique
+ order by pa_name');
+ $count_max=count($plan);
+
+ $a_row=$cn->get_array('select ke_id,ke_row,ke_percent from key_distribution_detail
+ where
+ kd_id=$1 order by ke_row', array($this->key->getp('id')));
+
+ require_once 'template/anc_key_input.php';
+ }
+
+ /**
+ * @brief verify that data are ok
+ * @param type $p_array
+ */
+ function verify($p_array)
+ {
+ $a_percent=$p_array['percent'];
+ if (count($a_percent)==0)
+ {
+ throw Exception(_('Aucune répartition'));
+ }
+ $tot_percent=0;
+ bcscale(4);
+ for ($i=0; $i| + > + + + | ++ + | + +
| + + + + | ++ + | + +