task #7478: Resume TVA Facture / Vente

This commit is contained in:
sparkyx 2007-11-15 10:17:16 +00:00
parent 60a0a1ea85
commit 600ca269e0
2 changed files with 20 additions and 4 deletions

View file

@ -144,6 +144,7 @@ function ExecuteScript($p_cn,$script) {
$buffer=str_replace (';','',$buffer);
}
$sql.=$buffer;
echo_debug('setup.php',__LINE__,"Execute sql $sql");
if ( ExecSql($p_cn,$sql,false) == false ) {
Rollback($p_cn);
if ( DEBUG=='false' ) ob_clean();

View file

@ -551,9 +551,16 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form'
// Sum of invoice
$sum_march+=$fiche_sum;
// vat of the card
$fiche_amount_vat=$fiche_price*$fiche_quant*$vat_rate;
$fiche_amount_vat=round($fiche_price*$fiche_quant*$vat_rate,2);
// value card + vat
$fiche_with_vat=$fiche_price*$fiche_quant*(1+$vat_rate);
$fiche_with_vat=$fiche_price*$fiche_quant+$fiche_amount_vat;
// store in array
if ( $vat_label != "") {
if ( ! isset($a_sum_tva_cat[$vat_label])) {
$a_sum_tva_cat[$vat_label]=0.0;
}
$a_sum_tva_cat[$vat_label]+=$fiche_amount_vat;
}
// Sum of invoice vat
$sum_with_vat+=$fiche_with_vat;
// Show the data
@ -587,9 +594,17 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form'
// end table
$r.='</TABLE> ';
$total_vat=0.0;
$r.='<DIV style="padding:30px;font-size:14px">';
$r.="Total HTVA =".round( $sum_march,2)." <br>";
$r.="Total = ".round($sum_with_vat,2);
$r.="HTVA =".round( $sum_march,2)." <br>";
if ( isset($a_sum_tva_cat) && empty ($a_sum_tva_cat) != true) {
foreach ($a_sum_tva_cat as $tva_cat=>$tva_amount) {
$r.="Tva ".$tva_cat." =".$tva_amount."<br>";
$total_vat+=$tva_amount;
}
}
$r.="TVA =".$total_vat.'<br>';
$r.="TTC = ".round($sum_with_vat,2);
$r.="</DIV>";