diff --git a/include/class/acc_reconciliation.class.php b/include/class/acc_reconciliation.class.php index 91f83478d..e1c31ab56 100644 --- a/include/class/acc_reconciliation.class.php +++ b/include/class/acc_reconciliation.class.php @@ -365,13 +365,21 @@ j1.j_poste as poste $this->prepare_query_detail_quant(); for ($i=0;$idb->execute("detail_quant",array($array[$i]['first']['jr_id'])); if ( Database::num_row($retdb) != 0) { - // then second_amount takes in account the vat_sided - $row=Database::fetch_array($retdb, 0); - $total_price=bcadd($row['price'],$row['vat_amount']); - $total_price=bcsub($total_price,$row['vat_sided']); + // then second_amount takes in account the vat_sided + $a_row=Database::fetch_all($retdb); + $total_price=0; + foreach ($a_row as $row) { + $total_price=bcadd($total_price,$row['price']); + $total_price=bcadd($total_price,$row['vat_amount']); + $total_price=bcsub($total_price,$row['vat_sided']); + $total_price=bcadd($total_price,$row['nd_amount']); + $total_price=bcadd($total_price,$row['nd_tva_recup']); + + } $first_amount=$total_price; } else { @@ -386,9 +394,16 @@ j1.j_poste as poste if ( Database::num_row($retdb) != 0) { // then second_amount takes in account the vat_sided - $row=Database::fetch_array($retdb, 0); - $total_price=bcadd($row['price'],$row['vat_amount']); - $total_price=bcsub($total_price,$row['vat_sided']); + $a_row=Database::fetch_all($retdb); + $total_price=0; + foreach ($a_row as $row) { + $total_price=bcadd($total_price,$row['price']); + $total_price=bcadd($total_price,$row['vat_amount']); + $total_price=bcsub($total_price,$row['vat_sided']); + $total_price=bcadd($total_price,$row['nd_amount']); + $total_price=bcadd($total_price,$row['nd_tva_recup']); + + } $second_amount=bcadd($second_amount,$total_price); } else { diff --git a/sql/upgrade.sql b/sql/upgrade.sql index f865fd5d1..510baa99d 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,2 +1 @@ -set search_path=public,comptaproc; -update parm_periode set p_exercice_label =p_exercice ; \ No newline at end of file +select * from v_quant_detail vqd where jr_id=6462; \ No newline at end of file