noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 23/29: Task #1749: Cases «Débit» dans les OD'


From: dwm
Subject: [Noalyss-commit] [noalyss] 23/29: Task #1749: Cases «Débit» dans les OD's fait remarquer si débit ou crédit
Date: Sat, 6 Jan 2024 05:59:16 -0500 (EST)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit 15be1c4e64fd65b27fdf395255e9399e8ff3d089
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Dec 30 01:31:57 2023 +0100

    Task #1749: Cases «Débit» dans les OD's
    fait remarquer si débit ou crédit
---
 html/js/noalyss_checkbox.js        | 22 +++++++++++++++++++++-
 include/class/acc_ledger.class.php | 13 +++++++++----
 include/operation_ods_new.inc.php  |  1 +
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/html/js/noalyss_checkbox.js b/html/js/noalyss_checkbox.js
index 61272c176..a04fa1469 100644
--- a/html/js/noalyss_checkbox.js
+++ b/html/js/noalyss_checkbox.js
@@ -87,6 +87,26 @@ function activate_checkbox_range(p_range_name) {
             checkbox_set_range(event, elt, p_range_name);
         },false));
 }
-;
 
+/**
+ * Checkbox for Debit - Credit , from Misc Operation
+ */
+function activate_checkbox_side()
+{
+    var aCheckBox=$$('.debit-credit')
+    aCheckBox.forEach((item)=>item.addEventListener('click',function (event) 
{display_dcside(item)}))
+    aCheckBox.forEach((item)=>display_dcside(item))
+}
 
+/**
+ * Update the SPAN , id based on checkbox id (txtck0), if checked , display 
Debit otherwise Credit
+ * @param item
+ */
+function display_dcside(item)
+{
+    if (item.checked == true) {
+        $('txt'+item.id).update("Débit")
+    } else {
+        $('txt'+item.id).update("Crédit")
+    }
+}
diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index 01f1b7c3c..41650f0b3 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -995,7 +995,7 @@ class Acc_Ledger  extends jrn_def_sql
                 '<th style="text-align:left">'._('Poste').$info_poste.'</th>'.
                 '<th class="visible_gt800 visible_gt1155" 
style="text-align:left">'._('Libellé').'</th>'.
                 '<th style="text-align:left">'._('Montant').'</th>'.
-                '<th style="text-align:left">'._('Débit').'</th>'.
+                '<th style="text-align:left">'._('Côté').'</th>'.
                 '</tr>';
 
 
@@ -1065,13 +1065,13 @@ class Acc_Ledger  extends jrn_def_sql
             $amount->value=(isset(${'amount'.$i}))?${"amount".$i}:''
             ;
             $amount->readonly=$p_readonly;
-            $amount->javascript=' 
onChange="format_number(this);checkTotalDirect()"';
+            
$amount->javascript='onChange="format_number(this);checkTotalDirect()"';
             // D/C
             $deb=new ICheckBox();
             $deb->name='ck'.$i;
             $deb->selected=(isset(${'ck'.$i}))?true:false;
             $deb->readonly=$p_readonly;
-            $deb->javascript=' onChange="checkTotalDirect()"';
+            $deb->javascript='class="debit-credit"  
onChange="checkTotalDirect()"';
             $str_add_button=($add_card==true)?$this->add_card("-1",
                             $quick_code->id):"";
             $ret.='<tr>';
@@ -1085,7 +1085,9 @@ class Acc_Ledger  extends jrn_def_sql
                     '</td>';
             $ret.='<td class="visible_gt800 
visible_gt1155">'.$line_desc->input().'</td>';
             $ret.='<td>'.$amount->input().'</td>';
-            $ret.='<td>'.$deb->input().'</td>';
+            $ret.='<td>'.$deb->input()
+                    .'<span id="txt'.$deb->id.'"></span>'
+                .'</td>';
             $ret.='</tr>';
             // If readonly == 1 then show CA
         }
@@ -1099,6 +1101,9 @@ class Acc_Ledger  extends jrn_def_sql
             $ret.=sprintf(_("Réconciliation/rapprochements : %s"), 
$w->input());
         }
         $ret.=create_script("$('".$wDate->id."').focus()");
+        // for displaying Credit or Debit
+        $ret.=create_script("activate_checkbox_side()");
+
         return $ret;
     }
 
diff --git a/include/operation_ods_new.inc.php 
b/include/operation_ods_new.inc.php
index 5b5197a0b..811434099 100644
--- a/include/operation_ods_new.inc.php
+++ b/include/operation_ods_new.inc.php
@@ -25,6 +25,7 @@
  * \brief to write into the ledgers ODS a new operation
  */
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+\Noalyss\Dbg::echo_file(__FILE__);
 
 
 global $g_user,$g_parameter,$http;



reply via email to

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