noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 11/27: Distribution key ; bouton ajout ligne


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 11/27: Distribution key ; bouton ajout ligne Task #1021 - Comptabilité analytique : clef de répartition : bouton ajout
Date: Thu, 02 Oct 2014 14:23:12 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 30e58edeec578bc175ff17f4a35683763d7a03b4
Author: Dany De Bontridder <address@hidden>
Date:   Tue Sep 16 22:38:50 2014 +0200

    Distribution key ; bouton ajout ligne
    Task #1021 - Comptabilité analytique : clef de répartition : bouton ajout
---
 html/do.php                        |    2 +-
 html/js/anc_script.js              |   52 ++++++++++++++++++++++++++++++++++++
 include/compta_ach.inc.php         |    1 +
 include/template/anc_key_input.php |   23 +++++++++++-----
 sql/upgrade.sql                    |    5 +++
 5 files changed, 75 insertions(+), 8 deletions(-)

diff --git a/html/do.php b/html/do.php
index fda7e03..56223d7 100644
--- a/html/do.php
+++ b/html/do.php
@@ -20,7 +20,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 define('ALLOWED',1);
-
+var_dump($_POST);
 /**\file
  * \brief Main file
  */
diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index 87433f1..723697a 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -480,4 +480,56 @@ function anc_key_choice(p_dossier, p_table, p_amount)
     } catch (e) {
         error_message(e.message);
     }
+}
+function add_row_key(p_table, p_seq)
+{
+    var mytable = g(p_table).tBodies[0];
+    // var max = parseFloat(g('amount_t' + p_seq).value);
+    if (!mytable)
+    {
+        return;
+    }
+    var new_value = mytable.rows.length + 1;
+
+
+    if (mytable.rows.length > 15)
+    {
+        alert("Maximum 15 lignes ");
+        return;
+    }
+   /* var amount = compute_total_table(p_table, p_seq);
+    if (max < amount)
+    {
+        alert('Montant incorrect : max = ' + max + " calculé=" + amount);
+        return;
+    }
+    */
+    // For the detail view (modify_op) there is several form and then several 
time the
+    // element
+    var rowToCopy = mytable.rows[1];
+    var row = mytable.insertRow(mytable.rows.length);
+
+    for (var i = 0; i < rowToCopy.cells.length; i++)
+    {
+        var cell = row.insertCell(i);
+        cell.className=rowToCopy.cells[i].className;
+        var txt = rowToCopy.cells[i].innerHTML;
+//     txt=txt.replace(/row_1/g,"row_"+new_value);
+        if (  i == 0 )
+        {
+            cell.innerHTML =mytable.rows.length-1 ;
+        } 
+        else
+        {
+            if (i == rowToCopy.cells.length -1 )  {
+                txt=txt.replace(/value="[0-9]*.{1}[0-9]*"/,'value="0"')
+            }
+           cell.innerHTML = txt;
+        }
+    }
+    $('total_key').innerHTML="?";
+ /*   var col = document.getElementsByName("val[" + p_seq + "][]");
+    col[col.length - 1].value = max - amount;
+    anc_refresh_remain(p_table, p_seq);
+    */
 }
\ No newline at end of file
diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php
index 69dc8c5..6299580 100644
--- a/include/compta_ach.inc.php
+++ b/include/compta_ach.inc.php
@@ -25,6 +25,7 @@
  * \brief file included to manage all the sold operation
  */
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+var_dump($_POST);
 require_once("class_icheckbox.php");
 require_once("class_acc_ledger_purchase.php");
 require_once ('class_pre_op_ach.php');
diff --git a/include/template/anc_key_input.php 
b/include/template/anc_key_input.php
index 279dd2f..f348112 100644
--- a/include/template/anc_key_input.php
+++ b/include/template/anc_key_input.php
@@ -47,7 +47,7 @@
         <h2>
             <?php echo _('Répartition'); ?>
         </h2>
-        <table class="result" style="margin-left: 
8%;width:84%;margin-right:8%">
+        <table id="key_account_tb" class="result" style="margin-left: 
8%;width:84%;margin-right:8%">
             <tr>
                 <th><?php echo _('n°'); ?></th>
                 <?php
@@ -60,7 +60,7 @@
                     <?php
                 endfor;
                 ?>
-                <th>
+                    <th class="num">
                     <?php echo _('Pourcentage'); ?>
                     <?php echo HtmlInput::infobulle(41); ?>
                 </th>
@@ -73,6 +73,7 @@
                 $a_row [0]['ke_id']=-1;
                 
             }
+            $tot_key=0;
             for ($j=0; $j<count($a_row); $j++):
                 ?>
                 <tr>
@@ -82,6 +83,7 @@
                     </td>
                         <?php
                          $percent=$a_row[$j]['ke_percent'];
+                         $tot_key=bcadd($tot_key,$percent);
                         // For each plan
                         for ($i=0; $i<count($plan); $i++):
                             if ( $j == 0 ) {
@@ -120,7 +122,7 @@
                         <?php
                     endfor;
                     ?>
-                    <td>
+                        <td class="num">
                         <?php
                         $inum_percent=new INum('percent[]');
                         $inum_percent->value=$percent;
@@ -131,11 +133,18 @@
                 <?php
             endfor;
             ?>
-            <tr>
-
-            </tr>
+                <tfoot style="font-weight: bolder">
+                    <tr>
+                        <td style="width: auto" colspan="<?php echo 
count($plan)+1;?>">
+                            <?php echo _('Total')?>
+                        </td>
+                        <td id="total_key" class="num">
+                            <?php echo $tot_key;?>
+                        </td>
+                    </tr>
+                </tfoot>
         </table>
-
+<input type="button" class="smallbutton" value="<?php echo _('Ajout ligne')?>" 
onclick="add_row_key('key_account_tb',0);">
 
         <div>
             <div>
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 688ae8d..ed45527 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -18,3 +18,8 @@ $function$
 
 -- bug 
 alter table action_gestion alter ag_title type text;
+
+INSERT INTO menu_ref(me_code, me_menu, me_file,   
me_type,me_description_etendue)VALUES ('ANCKEY', 'Clef de répartition',  
'anc_key.inc.php','ME','Permet de gèrer les clefs de répartition en 
comptabilité analytique');
+
+insert into 
profile_menu(me_code,p_id,p_type_display,pm_default,me_code_dep,p_order) values 
('ANCKEY',1,'E',0,'ANC',15);
+insert into 
profile_menu(me_code,p_id,p_type_display,pm_default,me_code_dep,p_order) values 
('ANCKEY',2,'E',0,'ANC',15);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]