From ef617907bf24cbdd8a034a55e95ff2a9c8d6f003 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 15 Oct 2007 14:25:07 +0000 Subject: [PATCH] Add check in javascript for Direct writing --- include/class_acc_ledger.php | 3 ++- include/class_widget.php | 2 +- include/constant.php | 5 +++++ include/quick_writing.inc.php | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 4a51910bd..9f2b310ef 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -894,12 +894,13 @@ class Acc_Ledger { $amount->name='amount'.$i; $amount->value=(isset(${'amount'.$i}))?${"amount".$i}:''; $amount->readonly=$p_readonly; - + $amount->javascript=' onChange="checkTotalDirect()"'; // D/C $deb=new widget('checkbox'); $deb->name='ck'.$i; $deb->selected=(isset(${'ck'.$i}))?true:false; $deb->readonly=$p_readonly; + $deb->javascript=' onChange="checkTotalDirect()"'; $ret.=''; $ret.=''.$quick_code->IOValue().''; diff --git a/include/class_widget.php b/include/class_widget.php index 30ad3e6c2..747917e0b 100644 --- a/include/class_widget.php +++ b/include/class_widget.php @@ -201,7 +201,7 @@ class widget { $check=( $this->selected==true )?"checked":"unchecked"; $r=''; + $r.=' '.$disabled." ".$this->javascript.'>'; } if ($this->table==1) { $r=" $this->label $r "; diff --git a/include/constant.php b/include/constant.php index 62303ee4f..83b245248 100644 --- a/include/constant.php +++ b/include/constant.php @@ -174,6 +174,11 @@ define ('JS_CALENDAR',' '); +define ('JS_COMPUTE_DIRECT',' +'); + + // One line calculator define ("JS_CALC_LINE",'
diff --git a/include/quick_writing.inc.php b/include/quick_writing.inc.php index f881b4db8..3e4a48a1e 100644 --- a/include/quick_writing.inc.php +++ b/include/quick_writing.inc.php @@ -34,6 +34,7 @@ $id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1; function show_direct_form($cn,$ledger,$p_array) { $id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1; + echo JS_COMPUTE_DIRECT; // Show the predef operation // Don't forget the p_jrn @@ -57,9 +58,16 @@ function show_direct_form($cn,$ledger,$p_array) { echo $ledger->show_form($p_array); echo widget::submit_button('summary','Sauvez'); + echo '
+ Débit = + Crédit = + Difference = +
+ '; echo ''; + echo "
".JS_CALC_LINE."
"; echo '
'; }