*
* This program is free software; you can redistribute it and/or modify
@@ -28,6 +28,8 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/tva/tva.class.php");
require_once(DOL_DOCUMENT_ROOT."/chargesociales.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/tva/tva.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
$langs->load("compta");
@@ -45,6 +47,8 @@ if (! $year) { $year=date("Y", time()); }
* View
*/
+$tva_static = new Tva($db);
+
llxHeader('',$langs->trans("TaxAndDividendsArea"));
print_fiche_titre($langs->trans("TaxAndDividendsArea"),($year?"".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":""));
@@ -62,7 +66,7 @@ print '| '.$langs->trans("PeriodEndDate").' | ';
print ''.$langs->trans("Label").' | ';
print "".$langs->trans("Type")." | ";
print "".$langs->trans("Amount")." | ";
-print "".$langs->trans("NbOfPayments")." | ";
+print "".$langs->trans("NbOfPayments")." | ";
print "".$langs->trans("AlreadyPaid")." | ";
print "\n";
@@ -108,11 +112,11 @@ if ($resql)
$socialcontrib=new ChargeSociales($db);
$socialcontrib->id=$obj->rowid;
$socialcontrib->lib=$obj->libelle;
- print $socialcontrib->getNomUrl(1,'16');
+ print $socialcontrib->getNomUrl(1,'20');
print '';
print ''.$obj->lib.' | ';
print ''.price($obj->total).' | ';
- print ''.$obj->nb.' | ';
+ print ''.$obj->nb.' | ';
print ''.price($obj->totalpaye).' | ';
print '';
$total = $total + $obj->total;
@@ -121,9 +125,9 @@ if ($resql)
$i++;
}
print '| '.$langs->trans("Total").' | ';
- print ''.price($total)." | ";
- print ''.$totalnb.' | ';
- print ''.price($totalpaye)." | ";
+ print ''.price($total)." | ";
+ print ''.$totalnb.' | ';
+ print ''.price($totalpaye)." | ";
print "
";
}
else
@@ -143,14 +147,14 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
print_titre($langs->trans("VATPayments"));
- $sql = "SELECT f.rowid, f.amount, f.label, ".$db->pdate("f.datev")." as dm";
+ $sql = "SELECT f.rowid, f.amount, f.label, f.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as f ";
$sql.= " WHERE f.entity = ".$conf->entity;
if ($year > 0)
{
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
- $sql.= " AND date_format(f.datev, '%Y') = ".$year;
+ $sql.= " AND f.datev between '".$db->idate(dol_get_first_day($year,1))."' AND '".$db->idate(dol_get_last_day($year,12))."'";
}
$sql.= " ORDER BY dm DESC";
@@ -164,22 +168,27 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
print '';
print '| '.$langs->trans("PeriodEndDate").' | ';
print "".$langs->trans("Label")." | ";
- print ''.$langs->trans("Amount")." | ";
- print ''.$langs->trans("DatePayment")." | ";
- print "".$langs->trans("AlreadyPaid")." | ";
+ print ''.$langs->trans("Amount")." | ";
+ print ''.$langs->trans("DatePayment")." | ";
+ print ''.$langs->trans("AlreadyPaid")." | ";
print "
\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
- $var=!$var;
- print "";
- print '| '.dol_print_date($obj->dm,'day').' ? | '."\n";
- print "".$obj->label." | \n";
+
$total = $total + $obj->amount;
+ $var=!$var;
+ print "
";
+ print '| '.dol_print_date($db->jdate($obj->dm),'day').' ? | '."\n";
+
+ $tva_static->id=$obj->rowid;
+ $tva_static->ref=$obj->label;
+ print "".$tva_static->getNomUrl(1)." | \n";
+
print "".price($obj->amount)." | ";
- print ''.dol_print_date($obj->dm,'day')." | \n";
+ print ''.dol_print_date($db->jdate($obj->dm),'day')." | \n";
print "".price($obj->amount)." | ";
print "
\n";
diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php
index 8652f1332c2..76fcf7a0b82 100644
--- a/htdocs/compta/tva/fiche.php
+++ b/htdocs/compta/tva/fiche.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2008 Laurent Destailleur
+ * Copyright (C) 2004-2010 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
/**
* \file htdocs/compta/tva/fiche.php
* \ingroup tax
- * \brief Page des r�glements de TVA
+ * \brief Page of VAT payments
* \version $Id$
*/
@@ -48,12 +48,12 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$tva = new Tva($db);
-
+
$db->begin();
-
+
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
-
+
$tva->accountid=$_POST["accountid"];
$tva->paymenttype=$_POST["paiementtype"];
$tva->datev=$datev;
@@ -80,11 +80,11 @@ if ($_GET["action"] == 'delete')
{
$tva = new Tva($db);
$result=$tva->fetch($_GET['id']);
-
+
if ($tva->rappro == 0)
{
$db->begin();
-
+
$ret=$tva->delete($user);
if ($ret > 0)
{
@@ -94,7 +94,7 @@ if ($_GET["action"] == 'delete')
$result=$accountline->fetch($tva->fk_bank);
$result=$accountline->delete($user);
}
-
+
if ($result > 0)
{
$db->commit();
@@ -146,13 +146,13 @@ if ($_GET["action"] == 'create')
print "';
+ print '';
}
/* ************************************************************************** */
-/* */
-/* Barre d'action */
-/* */
+/* */
+/* Barre d'action */
+/* */
/* ************************************************************************** */
if ($id)
@@ -202,11 +202,11 @@ if ($id)
$head[$h][2] = 'card';
$h++;
- dol_fiche_head($head, 'card', $langs->trans("VATPayment"));
+ dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
print '';
-
+
print "";
print '| '.$langs->trans("Ref").' | ';
print $vatpayment->ref;
@@ -222,7 +222,7 @@ if ($id)
print ' |
';
print '| '.$langs->trans("Amount").' | '.price($vatpayment->amount).' |
';
-
+
if ($conf->banque->enabled)
{
if ($vatpayment->fk_account > 0)
@@ -233,16 +233,16 @@ if ($id)
print '';
print '| '.$langs->trans('BankTransactionLine').' | ';
print '';
- print $bankline->getNomUrl(1,0,'showall');
+ print $bankline->getNomUrl(1,0,'showall');
print ' | ';
print '
';
}
}
print '
';
-
+
print '';
-
+
/*
* Boutons d'actions
*/
diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php
index 558412d2220..3421bcaf812 100644
--- a/htdocs/compta/tva/reglement.php
+++ b/htdocs/compta/tva/reglement.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2009 Laurent Destailleur
+ * Copyright (C) 2004-2010 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
/**
* \file htdocs/compta/tva/reglement.php
* \ingroup tax
- * \brief Liste des r�glements de TVA effectu�s
+ * \brief List of VAT payments
* \version $Id$
*/
diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang
index f64a32223b4..3d18248c895 100644
--- a/htdocs/langs/fr_FR/compta.lang
+++ b/htdocs/langs/fr_FR/compta.lang
@@ -62,7 +62,7 @@ DatePayment=Date de réglement
NewVATPayment=Nouveau réglement de TVA
VATPayment=Réglement TVA
VATPayments=Réglements TVA
-ShowVatPayment=Affiche payment TVA
+ShowVatPayment=Affiche paiement TVA
TotalToPay=Total à payer
TotalVATReceived=Total TVA perçue
CustomerAccountancyCode=Code compta client