*** empty log message ***

This commit is contained in:
Rodolphe Quiedeville 2002-09-26 14:38:57 +00:00
parent 34a08fca48
commit ae41bd89d2
2 changed files with 15 additions and 97 deletions

View File

@ -125,6 +125,7 @@ for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
print "<TD align=\"right\">Collectée</TD>";
print "<TD align=\"right\">Payée</TD>";
print "<td>&nbsp;</td>\n";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
$var=True;
$total = 0; $subtotal = 0;
@ -145,21 +146,24 @@ for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
$subtotal = $subtotal + $diff;
print "<td align=\"right\">".price($diff)."</td>\n";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
$i++;
if ($i > 2) {
print '<tr><td align="right" colspan="3">Sous total :</td><td align="right">'.price($subtotal).'</td>';
print '<tr><td align="right" colspan="3">Sous total :</td><td align="right">'.price($subtotal).'</td><td align="right"><small>'.price($subtotal * 0.8).'</small></td>';
$i = 0;
$subtotal = 0;
}
}
print '<tr><td align="right" colspan="3">Total :</td><td align="right"><b>'.price($total).'</b></td>';
print "<td>&nbsp;</td>\n";
print "</TABLE>";
echo '</td><td valign="top" width="50%">';
/*
* Payée
* Réglée
*/
print "<table width=\"100%\">";

View File

@ -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 "<TD>$obj->dm</TD>\n";
$total = $total + $obj->amount;
print "<TD align=\"right\">".price($obj->amount)."</TD><td align=\"right\">".$total."</td>\n";
print "<TD align=\"right\">".price($obj->amount)."</TD>";
print "<td align=\"right\">".$total."</td>\n";
print "</TR>\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 '<table width="100%">';
echo '<tr><td width="50%" valign="top"><b>TVA collectée</b></td>';
echo '<td>Tva Réglée</td></tr>';
for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
echo '<tr><td width="50%" valign="top">';
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\">";
print "<TD width=\"30%\">Année $y</TD>";
print "<TD align=\"right\">Collectée</TD>";
print "<TD align=\"right\">Payée</TD>";
print "<td>&nbsp;</td>\n";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
$var=True;
$total = 0; $subtotal = 0;
$i=0;
for ($m = 1 ; $m < 13 ; $m++ ) {
$var=!$var;
print "<TR $bc[$var]>";
print '<TD>'.strftime("%b %Y",mktime(0,0,0,$m,1,$y)).'</TD>';
$x_coll = tva_coll($db, $y, $m);
print "<TD align=\"right\">".price($x_coll)."</TD>";
$x_paye = tva_paye($db, $y, $m);
print "<TD align=\"right\">".price($x_paye)."</TD>";
$diff = $x_coll - $x_paye;
$total = $total + $diff;
$subtotal = $subtotal + $diff;
print "<td align=\"right\">".price($diff)."</td>\n";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
$i++;
if ($i > 2) {
print '<tr><td align="right" colspan="3">Sous total :</td><td align="right">'.price($subtotal).'</td><td align="right"><small>'.price($subtotal * 0.8).'</small></td>';
$i = 0;
$subtotal = 0;
}
}
print '<tr><td align="right" colspan="3">Total :</td><td align="right"><b>'.price($total).'</b></td>';
print "<td>&nbsp;</td>\n";
print "</TABLE>";
echo '</td><td valign="top" width="50%">';
/*
* Payée
*/
echo '<tr>';
echo '<td valign="top" width="50%">';
print "<table width=\"100%\">";
print "<tr><td valign=\"top\">";
$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 "</td></tr></table>";
echo '</td></tr>';
}
echo '</table>';