From e2751833aa39790b82552669bb0eb220d6762896 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Thu, 13 Dec 2007 13:54:16 +0000 Subject: [PATCH] task #7524 improve ca --- html/js/caod_compute.js | 66 +++++++++++++++++++++++++++++++++ include/ca_od.inc.php | 8 +++- include/class_balance_ca_bs.php | 4 ++ include/class_groupop.php | 2 + include/class_widget.php | 4 +- include/constant.php | 4 ++ include/dossier.inc.php | 1 + sql/upgrade.sql | 2 +- 8 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 html/js/caod_compute.js diff --git a/html/js/caod_compute.js b/html/js/caod_compute.js new file mode 100644 index 000000000..6c36f155b --- /dev/null +++ b/html/js/caod_compute.js @@ -0,0 +1,66 @@ +/* + * This file is part of PhpCompta. + * + * PhpCompta is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpCompta is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpCompta; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +function caod_checkTotal() { + var ie4=false; + if ( document.all ) { + ie4=true; + }// Ajouter getElementById par document.all[str] + var total_deb=0.0; + var total_cred=0.0; + var nb_item=10; + + for (var i=0;i table=0; echo '
'; @@ -131,6 +131,12 @@ if ( isset($_GET['new'])) { echo $a->form(); echo $wSubmit->Submit("save","Sauver"); echo ''; + echo '
+ Débit = + Crédit = + Difference = +
+ '; echo '
'; exit(); diff --git a/include/class_balance_ca_bs.php b/include/class_balance_ca_bs.php index cbd01029d..e5c34909d 100644 --- a/include/class_balance_ca_bs.php +++ b/include/class_balance_ca_bs.php @@ -120,6 +120,7 @@ class balance_ca_bs extends print_ca { $r.="Débit"; $r.="Crédit"; $r.="Solde"; + $r.="D/C"; $r.=""; $array=$this->get_data(); @@ -138,6 +139,9 @@ class balance_ca_bs extends print_ca { $r.=sprintf("%12.2f",$row['sum_deb']); $r.=sprintf("%12.2f",$row['sum_cred']); $r.=sprintf("%12.2f",$row['solde']); + $deb=($row['sum_deb'] > $row['sum_cred')?"D":"C"; + $deb=($row['solde'] == 0 )?'':$deb; + $r.=sprintf("%s",$deb); $r.=""; } $r.=""; diff --git a/include/class_groupop.php b/include/class_groupop.php index edd90a0e4..ed2ef7fe5 100644 --- a/include/class_groupop.php +++ b/include/class_groupop.php @@ -133,11 +133,13 @@ class groupop $wAmount=new widget("text","","pamount$i",0.0); $wAmount->size=12; $wAmount->table=1; + $wAmount->javascript=" onChange=caod_checkTotal()"; $wAmount->readonly=$p_readonly; $wDebit=new widget("checkbox","","pdeb$i"); $wDebit->table=1; $wDebit->readonly=$p_readonly; + $wDebit->javascript=" onChange=caod_checkTotal()"; if ( isset ($this->a_operation[$i])) { $wSelect->selected=$this->a_operation[$i]->po_id; $wAmount->value=$this->a_operation[$i]->oa_amount; diff --git a/include/class_widget.php b/include/class_widget.php index eb4bef96a..2058fa7ee 100644 --- a/include/class_widget.php +++ b/include/class_widget.php @@ -194,13 +194,13 @@ class widget { if (strtoupper($this->type)=="CHECKBOX") { if ( $this->readonly == true) { $check=( $this->selected==true )?"checked":"unchecked"; - $r='name.'" name="'.$this->name.'"'; $r.=" $check"; $r.=' disabled>'; } else { $check=( $this->selected==true )?"checked":"unchecked"; - $r='name.'" name="'.$this->name.'"'; $r.=" $check"; $r.=' '.$disabled." ".$this->javascript.'>'; } diff --git a/include/constant.php b/include/constant.php index 87ddfa3e3..73233c60e 100644 --- a/include/constant.php +++ b/include/constant.php @@ -183,6 +183,10 @@ define ('JS_COMPUTE_DIRECT',' '); +define ('JS_CAOD_COMPUTE',' +'); + // One line calculator define ("JS_CALC_LINE",'
diff --git a/include/dossier.inc.php b/include/dossier.inc.php index 726a47124..86c3cbc93 100644 --- a/include/dossier.inc.php +++ b/include/dossier.inc.php @@ -33,6 +33,7 @@ echo '
'; if ( isset ($_POST["DATABASE"]) ) { $cn=DbConnect(); $dos=trim($_POST["DATABASE"]); +$dos=FormatString($dos); if (strlen($dos)==0) { echo ("Dataname name is empty"); exit -1; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 57c1ab589..0a5b72b37 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -52,7 +52,7 @@ if length(trim(NEW.ga_id)) = 0 then NEW.ga_id:=NULL; return NEW; end if; -select ga_id from groupe_analytique where ga_id=NEW.ga_id; +perform 'select ga_id from groupe_analytique where ga_id='||NEW.ga_id; if NOT FOUND then raise exception' Inexistent Group Analytic %',NEW.ga_id; end if;