[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 29/65: Bug#1158 : sign and side of Analytic a
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 29/65: Bug#1158 : sign and side of Analytic accountancy |
Date: |
Wed, 09 Sep 2015 08:27:17 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit fa1f46cc06b2d79dd4bb0986093d73be7410bd6e
Author: Dany De Bontridder <address@hidden>
Date: Thu Sep 3 01:21:36 2015 +0200
Bug#1158 : sign and side of Analytic accountancy
---
html/js/anc_script.js | 6 +++---
include/class_anc_account.php | 3 ++-
include/class_anc_operation.php | 32 ++++++++++++++++++++------------
3 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index 2530d49..5087109 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -31,7 +31,7 @@
function add_row(p_table, p_seq)
{
var mytable = g(p_table).tBodies[0];
- var max = parseFloat(g('amount_t' + p_seq).value);
+ var max =Math.abs( parseFloat(g('amount_t' + p_seq).value));
if (!mytable)
{
return;
@@ -102,7 +102,7 @@ function anc_refresh_remain(p_table, p_seq)
{
try
{
- var tot_line = parseFloat(g('amount_t' + p_seq).value);
+ var tot_line =Math.abs( parseFloat(g('amount_t' + p_seq).value));
var tot_table = compute_total_table(p_table, p_seq);
var remain = tot_line - tot_table;
remain = Math.round(remain * 100) / 100;
@@ -155,7 +155,7 @@ function verify_ca(div)
total_amount += parseFloat(array_value[i].value);
}
- var amount = parseFloat(g('amount_t' + idx).value);
+ var amount = Math.abs(parseFloat(g('amount_t' + idx).value));
var diff = amount - total_amount;
if (Math.round(diff, 2) != 0.0)
diff --git a/include/class_anc_account.php b/include/class_anc_account.php
index 65962f7..1d9da5f 100644
--- a/include/class_anc_account.php
+++ b/include/class_anc_account.php
@@ -172,7 +172,8 @@ class Anc_Account
$sql="delete from poste_analytique where po_id=".$this->id;
$this->db->exec_sql($sql);
}
- /*! \brief return an array of object Poste_Analytique
+ /*!
+ * \brief return an array of object Poste_Analytique
*
*/
function get_list()
diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php
index c5e48a3..20c90cc 100644
--- a/include/class_anc_operation.php
+++ b/include/class_anc_operation.php
@@ -88,6 +88,18 @@ class Anc_Operation
if ( $this->j_id == 0 )
{
$this->j_id=null;
+ } else {
+ // must be the same side than the operation
+ if ( $this->oa_jrnx_id_source == null)
+ {
+ $side=$this->db->get_value('select j_debit from jrnx where
j_id=$1',
+ array($this->j_id));
+ } else
+ {
+ $side=$this->db->get_value('select j_debit from jrnx where
j_id=$1',
+ array($this->oa_jrnx_id_source));
+ }
+ $this->oa_debit=$side;
}
@@ -97,8 +109,9 @@ class Anc_Operation
if ( $this->oa_amount< 0)
{
- $this->oa_debit=($this->oa_debit=='t')?'f':'t';
+ // if negatif must be oa_positive='N'
$this->oa_positive='N';
+ $this->oa_debit=($this->oa_debit=='t')?'f':'t';
}
$oa_row=(isset($this->oa_row))?$this->oa_row:null;
@@ -544,8 +557,8 @@ class Anc_Operation
$nb_row=(isset($val[$p_seq]))?count($val[$p_seq]):1;
$count=0;
- $remain=$p_amount;
- $ctrl_remain="remain".$this->in_div.$table_id;
+ $remain=abs($p_amount);
+ $ctrl_remain="remain".$this->in_div.$table_id;
for ( $i=0; $i < $nb_row;$i++)
{
@@ -591,9 +604,9 @@ class Anc_Operation
$value->javascript='onchange="format_number(this);anc_refresh_remain(\''.$this->in_div.$table_id.'\',\''.$p_seq.'\')"';
$value->name="val[".$p_seq."][]";
$value->size=6;
- $value->value=(isset($val[$p_seq][$i]))?$val[$p_seq][$i]:$p_amount;
+
$value->value=(isset($val[$p_seq][$i]))?$val[$p_seq][$i]:abs($p_amount);
$value->readOnly=($p_mode==1)?false:true;
- $remain=bcsub($remain,$value->value);
+ $remain=bcsub($remain,$value->value);
$result.='<td>'.$value->input().'</td>';
$result.="</tr>";
@@ -682,7 +695,7 @@ class Anc_Operation
$op->j_id=$p_j_id;
$ratio=bcdiv($val[$p_item][$row],${"amount_t".$p_item});
$amount= bcmul($p_nd, $ratio);
- $op->oa_amount=abs(round($amount,2));
+ $op->oa_amount=round($amount,2);
$op->oa_debit=$this->oa_debit;
$op->oa_date=$this->oa_date;
@@ -796,12 +809,7 @@ class Anc_Operation
as mdate,j_montant,j_debit,jr_comment ,j_poste
from jrnx join jrn on (j_grpt=jr_grpt_id) where j_id=$1",
array($op[$i]));
$missing = $a_missing[0];
- $poste=substr(trim($missing['j_poste']),0,1);
- if ( $poste == 6 || $poste == 7) {
- $this->oa_debit = ($poste == 6) ?'t':'f';
- }else {
- $this->oa_debit=$missing['j_debit'];
- }
+
$this->oa_description = $missing['jr_comment'];
$this->j_id = $op[$i];
$group = $this->db->get_next_seq("s_oa_group"); /* for analytic */
- [Noalyss-commit] [noalyss] 18/65: Update the template for the config file, (continued)
- [Noalyss-commit] [noalyss] 18/65: Update the template for the config file, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 19/65: remove margin in tabs_, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 20/65: Bug#1170 : button with wrong redirect, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 21/65: Bug#1166 : in No VAT mode , the amount is divided by 1000, due to an excedent of nbm, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 23/65: beter size for subject, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 15/65: bug in redirect, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 24/65: Update documentation, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 22/65: Script SQL à ajouter, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 27/65: Better debugging : add a button to show the request $_POST and $_GET, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 25/65: insert contact, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 29/65: Bug#1158 : sign and side of Analytic accountancy,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 30/65: comment, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 31/65: Fix issue : cannot zoom an operation after saving it., Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 35/65: Esthetic : message is nothing found in menu, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 33/65: Task#1173 : create a empty database to restaure in command line, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 36/65: Missing file, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 37/65: Use the profile instead of the login name in the view, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 39/65: Add the side D/C to aged balance, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 38/65: translation, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 34/65: increase size of font in box, Dany De Bontridder, 2015/09/09
- [Noalyss-commit] [noalyss] 40/65: Remove ENABLE_CACHE + DB Upgrade, Dany De Bontridder, 2015/09/09