From db6340a84abc159e1b982fd6059a0bc4dc4ab007 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 19 Mar 2016 13:48:54 +0100 Subject: [PATCH] Bug : with VAT partially deductible and negative amount , it was a balance error , to solve this , the debit is computed (by SQL query ) before inserting into JRN , it slows down the operation but the result is correct --- include/class/class_acc_ledger_purchase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/class/class_acc_ledger_purchase.php b/include/class/class_acc_ledger_purchase.php index b656bb748..950f78ac9 100644 --- a/include/class/class_acc_ledger_purchase.php +++ b/include/class/class_acc_ledger_purchase.php @@ -768,7 +768,9 @@ class Acc_Ledger_Purchase extends Acc_Ledger $acc_operation=new Acc_Operation($this->db); $acc_operation->date=$e_date; $acc_operation->echeance=$e_ech; - $acc_operation->amount=abs(round($tot_debit,2)); + // Total DEB + $acc_operation->amount=$this->db->get_value("select sum(j_montant) from jrnx where j_grpt = $1 and j_debit='t'", + array($seq)); $acc_operation->desc=$e_comm; $acc_operation->grpt=$seq; $acc_operation->jrn=$p_jrn;