diff --git a/htdocs/compta/tva/index.php3 b/htdocs/compta/tva/index.php3
index 693993535c8..24d403716f2 100644
--- a/htdocs/compta/tva/index.php3
+++ b/htdocs/compta/tva/index.php3
@@ -125,6 +125,7 @@ for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
print "
| Total : | '.price($total).' | ';
+ print " | \n";
print "";
echo '';
+
/*
- * Payée
+ * Réglée
*/
print "";
diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php
index 0d7f9604184..c713c8dfdd2 100644
--- a/htdocs/compta/tva/reglement.php
+++ b/htdocs/compta/tva/reglement.php
@@ -26,34 +26,6 @@ require("../../tva.class.php3");
*
*
*/
-function tva_coll($db, $y,$m) {
- $sql = "SELECT sum(f.tva) as amount";
- $sql .= " FROM llx_facture as f WHERE f.paye = 1";
- $sql .= " AND date_format(f.datef,'%Y') = $y";
- $sql .= " AND date_format(f.datef,'%m') = $m";
-
- $result = $db->query($sql);
- if ($result) {
- $obj = $db->fetch_object ( 0 );
- return $obj->amount;
- }
-}
-/*
- *
- *
- */
-function tva_paye($db, $y,$m) {
- $sql = "SELECT sum(f.tva) as amount";
- $sql .= " FROM llx_facture_fourn as f WHERE f.paye = 1";
- $sql .= " AND date_format(f.datef,'%Y') = $y";
- $sql .= " AND date_format(f.datef,'%m') = $m";
-
- $result = $db->query($sql);
- if ($result) {
- $obj = $db->fetch_object ( 0 );
- return $obj->amount;
- }
-}
function pt ($db, $sql, $date) {
global $bc;
@@ -77,7 +49,8 @@ function pt ($db, $sql, $date) {
print "| $obj->dm | \n";
$total = $total + $obj->amount;
- print "".price($obj->amount)." | ".$total." | \n";
+ print "".price($obj->amount)." | ";
+ print "".$total." | \n";
print "\n";
$i++;
@@ -101,88 +74,29 @@ $db = new Db();
$tva = new Tva($db);
-print "Solde :" . price($tva->solde($year));
+print_titre("Tva Réglée");
-if ($year == 0 ) {
- $year_current = strftime("%Y",time());
- //$year_start = $conf->years;
- $year_start = $year_current;
-} else {
- $year_current = $year;
- $year_start = $year;
-}
echo '';
-echo '| TVA collectée | ';
-echo 'Tva Réglée | ';
for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
- echo '';
-
- print "";
- print "";
- print "| Année $y | ";
- print "Collectée | ";
- print "Payée | ";
- print " | \n";
- print " | \n";
- print " \n";
- $var=True;
- $total = 0; $subtotal = 0;
- $i=0;
- for ($m = 1 ; $m < 13 ; $m++ ) {
- $var=!$var;
- print "";
- print '| '.strftime("%b %Y",mktime(0,0,0,$m,1,$y)).' | ';
-
- $x_coll = tva_coll($db, $y, $m);
- print "".price($x_coll)." | ";
-
- $x_paye = tva_paye($db, $y, $m);
- print "".price($x_paye)." | ";
-
- $diff = $x_coll - $x_paye;
- $total = $total + $diff;
- $subtotal = $subtotal + $diff;
-
- print "".price($diff)." | \n";
- print " | \n";
- print " \n";
-
- $i++;
- if ($i > 2) {
- print '| Sous total : | '.price($subtotal).' | '.price($subtotal * 0.8).' | ';
- $i = 0;
- $subtotal = 0;
- }
- }
- print ' | Total : | '.price($total).' | ';
- print " | \n";
- print " ";
-
- echo ' | ';
- /*
- * Payée
- */
+ echo ' | ';
+ echo '';
print "";
print "| ";
- $sql = "SELECT amount, date_format(f.datev,'%Y-%m') as dm";
- $sql .= " FROM llx_tva as f WHERE f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
- $sql .= " GROUP BY dm DESC";
+ $sql = "SELECT amount, date_format(f.datev,'%d-%M-%Y') as dm";
+ $sql .= " FROM llx_tva as f ";
+ $sql .= " Order BY dm DESC";
- pt($db, $sql,"Année $y");
+ pt($db, $sql,"Date");
print " | ";
echo ' | ';
}
-
-
-
-
echo ' ';
|