[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 10/28: Correct report amount
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 10/28: Correct report amount |
Date: |
Sat, 30 Nov 2019 07:51:22 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 1d78f24bee67859ecef66740e94a9129e422cbbd
Author: Dany De Bontridder <address@hidden>
Date: Sun Nov 17 21:34:22 2019 +0100
Correct report amount
---
include/class/acc_ledger.class.php | 40 ++++++++++++++++++++---------
include/class/print_ledger_simple.class.php | 2 +-
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index dabc16a..2221c1e 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -46,7 +46,6 @@ require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
require_once NOALYSS_INCLUDE.'/database/jrn_def_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_payment.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger_history.class.php';
-//require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/pre_op_ods.class.php';
@@ -571,7 +570,7 @@ class Acc_Ledger extends jrn_def_sql
global $g_parameter;
$msg=array();
if (!$p_readonly)
- $msg=$this->verify($p_array);
+ $msg=$this->verify_operation($p_array);
$this->id=$p_array['p_jrn'];
if (empty($p_array))
return _("Aucun résultat");
@@ -1926,8 +1925,12 @@ class Acc_Ledger extends jrn_def_sql
$ret=$array[0];
/* retrieve all vat code */
$array=$this->db->get_array("select coalesce(sum(qp_vat),0) as
sum_vat,tva_id
- from quant_purchase as p right join
tva_rate on (qp_vat_code=tva_id) join jrnx using(j_id)
- where tva_rate !=0 and j_date >=
to_date($1,'DD.MM.YYYY') and j_date < to_date($2,'DD.MM.YYYY')
+ from quant_purchase as p
+ right join tva_rate on
(qp_vat_code=tva_id) join jrnx using(j_id)
+ where
+ tva_rate !=0
+ and j_date >=
to_date($1,'DD.MM.YYYY')
+ and j_date <
to_date($2,'DD.MM.YYYY')
and j_jrn_def = $3
group by tva_id",
array($min_date, $max_date, $this->id));
@@ -1941,7 +1944,7 @@ class Acc_Ledger extends jrn_def_sql
',0 as priv'.
',0 as tva_nd'.
',coalesce(sum(qs_vat_sided),0) as reversed'.
- ',coalesce(sum(qs_vat_sided),0) as tva_np'.
+ ',0 as tva_np'.
' from quant_sold join jrnx using(j_id) '.
" where j_date >= to_date($1,'DD.MM.YYYY') and j_date <
to_date($2,'DD.MM.YYYY') ".
' and j_jrn_def = $3';
@@ -1950,10 +1953,14 @@ class Acc_Ledger extends jrn_def_sql
$ret=$array[0];
/* retrieve all vat code */
$array=$this->db->get_array("select coalesce(sum(qs_vat),0) as
sum_vat,tva_id
- from quant_sold as p right join
tva_rate on (qs_vat_code=tva_id) join jrnx using(j_id)
- where tva_rate !=0 and
- j_date >= to_date($1,'DD.MM.YYYY') and
j_date < to_date($2,'DD.MM.YYYY')
- and j_jrn_def = $3
+ from quant_sold as p
+ right join tva_rate on
(qs_vat_code=tva_id)
+ join jrnx using(j_id)
+ where
+ tva_rate !=0 and
+ j_date >=
to_date($1,'DD.MM.YYYY')
+ and j_date < to_date($2,'DD.MM.YYYY')
+ and j_jrn_def = $3
group by tva_id",
array($min_date, $max_date, $this->id));
$ret['tva']=$array;
@@ -1965,10 +1972,19 @@ class Acc_Ledger extends jrn_def_sql
$ledger=new Acc_Ledger_Fin($this->db, $this->id);
$qcode=$ledger->get_bank();
$bank_card=new Fiche($this->db, $qcode);
-
+ $periode=new Periode($this->db);
+ //$periode->find_periode($min_date);
+ //$a_date=$periode->get_limit($periode->get_exercice());
+
/* add the amount from Opening Writing */
- $cond=sprintf(" j_jrn_def <> %d and j_date >=
to_date('%s','DD.MM.YYYY') and j_date < to_date('%s','DD.MM.YYYY') ",
- $this->id, $min_date, $max_date);
+ if ( $min_date <> $max_date)
+ {
+ $cond=sprintf("j_date >= to_date('%s','DD.MM.YYYY') and
j_date < to_date('%s','DD.MM.YYYY') ",
+ $min_date,$max_date);
+ }else{
+ $cond=sprintf("j_date = to_date('%s','DD.MM.YYYY') ",
+ $min_date);
+ }
$saldo=$bank_card->get_bk_balance($cond);
$ret['amount']=bcsub($saldo['debit'], $saldo['credit']);
}
diff --git a/include/class/print_ledger_simple.class.php
b/include/class/print_ledger_simple.class.php
index 399a8a5..a92a7e9 100644
--- a/include/class/print_ledger_simple.class.php
+++ b/include/class/print_ledger_simple.class.php
@@ -215,7 +215,7 @@ class Print_Ledger_Simple extends \Print_Ledger
*/
function export()
{
- bcscale(2);
+ bcscale(4);
$ledger=$this->get_ledger();
$ledger_history=Acc_Ledger_History::factory($this->cn,
array($ledger->id),
- [Noalyss-commit] [noalyss] 11/28: In Acc_Ledger, the type shouldn't be overrided , create new attr ledger_type, (continued)
- [Noalyss-commit] [noalyss] 11/28: In Acc_Ledger, the type shouldn't be overrided , create new attr ledger_type, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 19/28: Data_SQL Function prefix turn an object to an array but key can have a prefix, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 06/28: PDFTK Convert in PDF if working from home, see http://wiki.noalyss.eu/doku.php?id=menu:ancgl, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 14/28: Bug PHP : confuse NULL and 0, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 13/28: cosmetid add a button close for the "forget-email-box", Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 15/28: Bug Array to string conversion error, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 16/28: Bug : when e_march is null it is considered as an empty string instead of 0, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 17/28: Cosmetic, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 12/28: Improve PHPUNIT test, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 22/28: Search operation : all, paid or unpaid, including the CSV export and the filter, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 10/28: Correct report amount,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 21/28: Fix problem with Acc_Ledger_purchase or sold and quantity or vat amount were an empty string, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 24/28: Merge branch 'dev-7200', Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 26/28: warning about session_start, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 28/28: Merge branch 'dev-7200', Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 02/28: Task #0001762: TVA France , add the possibility to compute VAT at the date of operation , payment. PRINTTVA : Add feature summary of VAT depending of operation date, payment date or VAT setting, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 03/28: Task #1762 , printtva peut mettre donner les totaux de tva suivant l'exigibilité configuré par Code TVA , par date de paiement ou par date d'opération, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 25/28: Acc_Ledger_Search , fix small bug + Test file, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 23/28: File to restore for testing, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 20/28: PHPUNIT Suppress risky test, Dany De Bontridder, 2019/11/30
- [Noalyss-commit] [noalyss] 27/28: Change logo, Dany De Bontridder, 2019/11/30