diff --git a/include/class/tax_summary.class.php b/include/class/tax_summary.class.php
index 8c482b238..ce950707c 100644
--- a/include/class/tax_summary.class.php
+++ b/include/class/tax_summary.class.php
@@ -104,31 +104,34 @@ class Tax_Summary
/*-------------SALE ---------------------------------*/
$sql="select count(*)
from
- jrnx
- join quant_sold on (quant_sold.j_id = jrnx.j_id)
+ quant_sold
where
- jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'VEN')
- and j_date >= to_date($1,'DD.MM.YYYY')
- and j_date <= to_date($2,'DD.MM.YYYY')
+ j_id in (select j_id from jrnx
+ where
+ jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'VEN')
+ and j_date >= to_date($1,'DD.MM.YYYY')
+ and j_date <= to_date($2,'DD.MM.YYYY')
+ )
";
$cnt=$this->db->get_value($sql,[$this->date_start,$this->date_end]);
if ($cnt == 0) {
- throw new Exception(_("Aucune Donnée"));
+ throw new Exception(_("Données manquantes"));
}
/*-------------Purchase ---------------------------------*/
$sql="select count(*)
from
- jrnx
- join quant_purchase as qp on (jrnx.j_id = qp.j_id)
+ quant_purchase
where
- jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'ACH')
- and j_date >= to_date($1,'DD.MM.YYYY')
- and j_date <= to_date($2,'DD.MM.YYYY')
+ j_id in (select j_id from jrnx
+ where
+ jrnx.j_jrn_def in (select jrn_def_id from jrn_def where jrn_def_type = 'VEN')
+ and j_date >= to_date($1,'DD.MM.YYYY')
+ and j_date <= to_date($2,'DD.MM.YYYY')
+ )
";
$cnt=$this->db->get_value($sql,[$this->date_start,$this->date_end]);
- if ($cnt == 0) {
- throw new Exception(_("Aucune Donnée"));
-
+ if ($cnt > 0) {
+ throw new Exception(_("Données manquantes"));
}
}
diff --git a/unit-test/include/class/acc_computeTest.class.php b/unit-test/include/class/acc_computeTest.class.php
index 1b19e5fb9..09b9386af 100644
--- a/unit-test/include/class/acc_computeTest.class.php
+++ b/unit-test/include/class/acc_computeTest.class.php
@@ -155,7 +155,14 @@ class Acc_ComputeTest extends TestCase
*/
public function testCorrect()
{
+ $this->object->amount=100.0;
+ $this->object->amount_perso=15.3333;
+ $this->object->amount_vat=20.6666;
+ $this->object->amount_nd_vat=1.5;
$this->object->correct();
+ $this->assertEquals($this->object->amount,84.6667);
+ $this->assertEquals($this->object->amount_perso,15.3333);
+ $this->assertEquals($this->object->amount_vat,20.67);
}
/**
@@ -167,6 +174,7 @@ class Acc_ComputeTest extends TestCase
$this->object->verify();
$new=new Acc_Compute();
$this->object->verify($new);
+ $this->assertTrue(TRUE);
}
/**
@@ -176,7 +184,11 @@ class Acc_ComputeTest extends TestCase
*/
public function testDisplay()
{
+ ob_start();
$this->object->display();
+ $result= ob_get_flush();
+ $this->assertStringStartsWith("key amount Description amount value is 0
key amount_vat Description amount_vat value is 0
",$result);
+ $this->assertStringEndsWith("
key amount_perso_rate Description amount_perso_rate value is 0
",$result);
}
/**