Modifications diverses et uniformisation du look et du code pour la partie TVA

This commit is contained in:
Laurent Destailleur 2004-06-08 23:40:53 +00:00
parent c8f18cc231
commit faa2d81a95
4 changed files with 69 additions and 163 deletions

View File

@ -1,5 +1,6 @@
<?PHP
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,21 +26,21 @@ require("../../tva.class.php");
$mesg = '';
if ($HTTP_POST_VARS["action"] == 'add' && $HTTP_POST_VARS["cancel"] <> 'Annuler')
if ($_POST["action"] == 'add' && $_POST["cancel"] <> 'Annuler')
{
$tva = new Tva($db);
$tva->add_payement(mktime(12,0,0,
$HTTP_POST_VARS["datevmonth"],
$HTTP_POST_VARS["datevday"],
$HTTP_POST_VARS["datevyear"]
$_POST["datevmonth"],
$_POST["datevday"],
$_POST["datevyear"]
),
mktime(12,0,0,
$HTTP_POST_VARS["datepmonth"],
$HTTP_POST_VARS["datepday"],
$HTTP_POST_VARS["datepyear"]
$_POST["datepmonth"],
$_POST["datepday"],
$_POST["datepyear"]
),
$HTTP_POST_VARS["amount"]
$_POST["amount"]
);
Header ( "Location: reglement.php");
}
@ -58,7 +59,7 @@ if ($action == 'create')
print '<div class="titre">Nouveau réglement TVA</div><br>';
print '<table class="border" border="1" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
print "<tr>";
print '<td>Date de paiement</td><td>';
print $html->select_date("","datev");
@ -66,102 +67,13 @@ if ($action == 'create')
print '<td>Date de valeur</td><td>';
print $html->select_date("","datep");
print '</td></tr>';
print '<tr><td>Montant</td><TD><input name="amount" size="10" value=""></td></tr>';
print '<tr><td>Montant</td><td><input name="amount" size="10" value=""></td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" value="Enregistrer">&nbsp;';
print '<input type="submit" name="cancel" value="Annuler"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($id)
{
$product = new Product($db);
$result = $product->fetch($id);
if ( $result )
{
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print '<form action="index.php" method="post">';
print '<td valign="center">Réf : <input class="flat" type="text" size="10" name="sref">&nbsp;<input class="flat" type="submit" value="go"></td>';
print '</form><form action="index.php" method="post">';
print '<td>Libellé : <input class="flat" type="text" size="20" name="snom">&nbsp;<input class="flat" type="submit" value="go"></td>';
print '</form><td>&nbsp;</td></tr></table>';
print_fiche_titre('Fiche produit : '.$product->ref, $mesg);
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Référence</td><td width="40%">'.$product->ref.'</td>';
print '<td>';
if ($product->envente)
{
print "En vente";
}
else
{
print "Cet article n'est pas en vente";
}
print '</td></tr>';
print "<td>Libellé</td><td>$product->label</td>";
print '<td><a href="stats/fiche.php?id='.$id.'">Statistiques</a></td></tr>';
print '<tr><td>Prix</td><TD>'.price($product->price).'</td>';
print '<td valign="top" rowspan="4">';
print "Propositions commerciales : ".$product->count_propale();
print "<br>Proposé à <b>".$product->count_propale_client()."</b> clients";
print "<br>Factures : ".$product->count_facture();
print '</td></tr>';
print '<tr><td>Taux TVA</td><TD>'.$product->tva_tx.' %</td></tr>';
print "<tr><td valign=\"top\">Description</td><td>".nl2br($product->description)."</td></tr>";
print "</table>";
}
if ($action == 'edit')
{
print '<hr><div class="titre">Edition de la fiche produit : '.$product->ref.'</div><br>';
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">\n";
print '<input type="hidden" name="action" value="update">';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4"><tr>';
print '<td width="20%">Référence</td><td><input name="ref" size="20" value="'.$product->ref.'"></td></tr>';
print '<td>Libellé</td><td><input name="libelle" size="40" value="'.$product->label.'"></td></tr>';
print '<tr><td>Prix</td><TD><input name="price" size="10" value="'.$product->price.'"></td></tr>';
print '<tr><td>Taux TVA</td><TD>';
$html = new Form($db);
print $html->select_tva("tva_tx", $product->tva_tx);
print '</td></tr>';
print '<tr><td>Statut</td><TD>';
print '<select name="statut">';
if ($product->envente)
{
print '<option value="1" SELECTED>En vente</option>';
print '<option value="0">Hors Vente</option>';
}
else
{
print '<option value="1">En vente</option>';
print '<option value="0" SELECTED>Hors Vente</option>';
}
print '</td></tr>';
print "<tr><td valign=\"top\">Description</td><td>";
print '<textarea name="desc" rows="8" cols="50">';
print $product->description;
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Enregistrer">&nbsp;';
print '<input type="submit" name="cancel" value="Annuler"></td></tr>';
print '</table>';
print '</form>';
}
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
@ -169,27 +81,8 @@ else
/* */
/* ************************************************************************** */
print '<br><table id="actions" width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
// Aucune action
if ($action == 'create')
{
print '<td width="20%" align="center">-</td>';
}
else
{
print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">Editer</a>]</td>';
}
print '<td width="20%" align="center">-</td>';
print '</table><br>';
if ($id && $action == '')
{
}
$db->close();

View File

@ -1,6 +1,7 @@
<?PHP
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -66,28 +67,28 @@ function pt ($db, $sql, $date) {
$num = $db->num_rows();
$i = 0;
$total = 0 ;
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\">";
print "<TD nowrap width=\"60%\">$date</TD>";
print "<TD align=\"right\">Montant</TD>";
print "<table class=\"border\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<tr class=\"liste_titre\">";
print "<td nowrap width=\"60%\">$date</td>";
print "<td align=\"right\">Montant</td>";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
print "</tr>\n";
$var=True;
while ($i < $num) {
$obj = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD nowrap>$obj->dm</TD>\n";
print "<tr $bc[$var]>";
print "<td nowrap>$obj->dm</td>\n";
$total = $total + $obj->amount;
print "<TD nowrap align=\"right\">".price($obj->amount)."</TD><td nowrap align=\"right\">".$total."</td>\n";
print "</TR>\n";
print "<td nowrap align=\"right\">".price($obj->amount)."</td><td nowrap align=\"right\">".$total."</td>\n";
print "</tr>\n";
$i++;
}
print "<tr class=\"total\"><td align=\"right\">Total :</td><td nowrap align=\"right\"><b>".price($total)."</b></td><td>euros&nbsp;HT</td></tr>";
print "</TABLE>";
print "</table>";
$db->free();
} else {
print $db->error();
@ -111,41 +112,49 @@ if ($year == 0 ) {
$year_start = $year;
}
$textprevyear="<a href=\"$PHP_SELF?year=" . ($year_current-1) . "\">Année précédente (" . ($year_current-1) . ")</a>";
$textprevyear="<a href=\"$PHP_SELF?year=" . ($year_current-1) . "\">".img_previous()."</a>";
// On n'affiche pas "Année suivante" si c'est dans le futur !
if(($year < strftime("%Y",time())) && ($year != 0))
$textnextyear=" - <a href=\"$PHP_SELF?year=" . ($year_current+1) . "\">Année suivante (" . ($year_current+1) . ")</a>";
print_titre( "<table border=\"0\" width=\"100%\"><tr><td nowrap>TVA Solde : " . price($tva->solde($year)) . " euros </td><td align=\"right\">$textprevyear $textnextyear</td></tr></table>");
if(($year < strftime("%Y",time())) && ($year != 0)) {
$textnextyear=" <a href=\"$PHP_SELF?year=" . ($year_current+1) . "\">".img_next()."</a>";
}
print_fiche_titre("TVA Solde : ".price($tva->solde($year_start)),"$textprevyear Année $year_start $textnextyear");
echo '<table width="100%">';
echo '<tr><td width="50%" valign="top">TVA collectée</td>';
echo '<td>Tva Réglée</td></tr>';
echo '<tr><td>';
print_fiche_titre("TVA collectée");
echo '</td><td>';
//<td width="50%" valign="top">TVA collectée</td>';
print_fiche_titre("TVA réglée");
//echo '<td>Tva Réglée</td></tr>';
echo '</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 "<table class=\"border\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
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";
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 nowrap>'.strftime("%b %Y",mktime(0,0,0,$m,1,$y)).'</TD>';
print "<tr $bc[$var]>";
print '<td nowrap>'.strftime("%b %Y",mktime(0,0,0,$m,1,$y)).'</td>';
$x_coll = tva_coll($db, $y, $m);
print "<TD nowrap align=\"right\">".price($x_coll)."</TD>";
print "<td nowrap align=\"right\">".price($x_coll)."</td>";
$x_paye = tva_paye($db, $y, $m);
print "<TD nowrap align=\"right\">".price($x_paye)."</TD>";
print "<td nowrap align=\"right\">".price($x_paye)."</td>";
$diff = $x_coll - $x_paye;
$total = $total + $diff;
@ -153,7 +162,7 @@ for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
print "<td nowrap align=\"right\">".price($diff)."</td>\n";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
print "</tr>\n";
$i++;
if ($i > 2) {
@ -164,16 +173,17 @@ for ($y = $year_current ; $y >= $year_start ; $y=$y-1 ) {
}
print '<tr class="total"><td align="right" colspan="3">Total :</td><td nowrap align="right"><b>'.price($total).'</b></td>';
print "<td>&nbsp;</td>\n";
print "</TABLE>";
print "</table>";
echo '</td><td valign="top" width="50%">';
/*
* Réglée
*/
print "<table width=\"100%\">";
print "<tr><td valign=\"top\">";
// print "<table class=\"border\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
// print "<tr><td valign=\"top\">";
$sql = "SELECT amount, date_format(f.datev,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as f WHERE f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";

View File

@ -1,5 +1,6 @@
<?PHP
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,7 +33,7 @@ $tva = new Tva($db);
print_titre("Réglements TVA");
$sql = "SELECT amount, date_format(f.datev,'%d-%M-%Y') as dm";
$sql = "SELECT amount, ".$db->pdate("f.datev")." as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as f ";
$sql .= " ORDER BY dm DESC";
@ -42,30 +43,31 @@ if ($result)
$num = $db->num_rows();
$i = 0;
$total = 0 ;
print '<br><TABLE border="1" width="100%" cellspacing="0" cellpadding="4">';
print '<TR class="liste_titre">';
print "<TD width=\"60%\">Date</TD>";
print "<TD align=\"right\">Montant</TD>";
print '<br>';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="3">';
print '<tr class="liste_titre">';
print "<td width=\"60%\">Date</td>";
print "<td align=\"right\">Montant</td>";
print "<td>&nbsp;</td>\n";
print "</TR>\n";
$var=True;
print "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object( $i);
$var=!$var;
print "<TR $bc[$var]>";
print "<TD>$obj->dm</TD>\n";
print "<tr $bc[$var]>";
print "<td>".dolibarr_print_date($obj->dm)."</td>\n";
$total = $total + $obj->amount;
print "<TD align=\"right\">".price($obj->amount)."</td><td>&nbsp;</td>";
print "</TR>\n";
print "<td align=\"right\">".price($obj->amount)."</td><td>&nbsp;</td>";
print "</tr>\n";
$i++;
}
print "<tr class=\"total\"><td align=\"right\">Total :</td>";
print "<td align=\"right\"><b>".price($total)."</b></td><td>euros&nbsp;HT</td></tr>";
print "</TABLE>";
print "</table>";
$db->free();
}
else

View File

@ -1,5 +1,6 @@
<?PHP
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by