diff --git a/html/compute.php b/html/compute.php index 1ad8c2eda..d49d484ed 100644 --- a/html/compute.php +++ b/html/compute.php @@ -73,7 +73,8 @@ if ( $t != -1 && isNumber($t) == 1 ) { $total->set_parameter('amount_vat_rate',$tva_rate->get_parameter('rate')); $total->compute_vat(); - $tvac=bcadd($total->get_parameter('amount_vat'),$amount); + if ($tva_rate->get_parameter('both_side')== 1) $total->set_parameter('amount_vat', 0); + $tvac=($tva_rate->get_parameter('rate') == 0 || $tva_rate->get_parameter('both_side')== 1) ? $amount : bcadd($total->get_parameter('amount_vat'),$amount); header("Content-type: text/html; charset: utf8",true); echo '{"ctl":"'.$n.'","htva":"'.$amount.'","tva":"'.$total->get_parameter('amount_vat').'","tvac":"'.$tvac.'"}'; } diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index c796ea6b5..bff7555d8 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -569,7 +569,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger if ( $g_parameter->MY_TVA_USE=='Y') { $acc_amount->set_parameter('amount_vat_rate',$oTva->get_parameter('rate')); - if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0) + if ( strlen(trim(${'e_march'.$i.'_tva_amount'})) ==0 || ${'e_march'.$i.'_tva_amount'} == 0) { $acc_amount->compute_vat(); @@ -1489,7 +1489,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger same */ bcscale(2); $css_void_tva=($both_side == 1)?'style="text-decoration:line-through"':''; - if ( bcsub($tva_item,$tva_computed) != 0) + if ( bcsub($tva_item,$tva_computed) != 0 && ! ($tva_item == 0 && $both_side == 1)) { $r.='