';
}
else
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index 8bed2c28c00..5b31f85478a 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004 Éric Seigne
+ * Copyright (C) 2004 �ric Seigne
* Copyright (C) 2004-2009 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
*
@@ -26,6 +26,7 @@
\version $Id$
*/
require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/tax.lib.php");
require_once(DOL_DOCUMENT_ROOT."/compta/tva/tva.class.php");
$langs->load("other");
@@ -45,128 +46,12 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
+// Define modetax (0 or 1)
+// 0=normal, 1=option vat for services is on debit
+$modetax = $conf->global->TAX_MODE;
+if (isset($_GET["modetax"])) $modetax=$_GET["modetax"];
-/**
- * \brief On cherche la tva a collecter
- * \param db Handle acces base
- * \param y Year
- * \param m Month
- */
-function tva_coll($db,$y,$m)
-{
- global $conf;
-
- if ($conf->compta->mode == "CREANCES-DETTES")
- {
- // Si on paye la tva sur les factures dues (non brouillon)
- $sql = "SELECT sum(f.tva) as amount";
- $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
- $sql.= ", ".MAIN_DB_PREFIX."societe as s";
- $sql.= " WHERE f.fk_soc = s.rowid";
- $sql.= " AND s.entity = ".$conf->entity;
- $sql.= " AND f.fk_statut IN (1,2)";
- $sql.= " AND date_format(f.datef,'%Y') = ".$y;
- $sql.= " AND date_format(f.datef,'%m') = ".$m;
- }
- else
- {
- // Si on paye la tva sur les payments
-
- // \todo a ce jour on se sait pas la compter car le montant tva d'un payment
- // n'est pas stocké dans la table des payments.
- // Seul le module compta expert peut résoudre ce problème.
- // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le
- // detail part tva et part ht).
-
-/*
- // Tva sur factures payés
- $sql = "SELECT sum(f.tva) as amount";
- $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
- $sql.= " WHERE ";
- $sql.= " f.paye = 1";
- $sql.= " AND date_format(f.datef,'%Y') = ".$y;
- $sql.= " AND date_format(f.datef,'%m') = ".$m;
-*/
- }
-
- $resql = $db->query($sql);
-
- if ($resql)
- {
- $obj = $db->fetch_object($resql);
- return $obj->amount;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
-
-/**
- * \brief On recupere la tva à payer
- * \param db Handle accès base
- * \param y Année
- * \param m Mois
- */
-function tva_paye($db, $y,$m)
-{
- global $conf;
-
- if ($conf->compta->mode == "CREANCES-DETTES")
- {
- // Si on paye la tva sur les factures dues (non brouillon)
- $sql = "SELECT sum(f.total_tva) as amount";
- $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
- $sql.= ", ".MAIN_DB_PREFIX."societe as s";
- $sql.= " WHERE f.fk_soc = s.rowid";
- $sql.= " AND s.entity = ".$conf->entity;
- $sql.= " AND f.fk_statut in (1,2)";
- $sql.= " AND date_format(f.datef,'%Y') = $y";
- $sql.= " AND date_format(f.datef,'%m') = $m";
- }
- else
- {
- // Si on paye la tva sur les payments
-
- // \todo a ce jour on se sait pas la compter car le montant tva d'un payment
- // n'est pas stocke dans la table des payments.
- // Seul le module compta expert peut resoudre ce probleme.
- // (Il faut quand un payment a lieu, stocker en plus du montant du paiement le
- // detail part tva et part ht).
-
-/*
-
- // \todo a ce jour on se sait pas la compter car le montant tva d'un payment
- // n'est pas stocke dans la table des payments.
- // Il faut quand un payment a lieu, stocker en plus du montant du paiement le
- // detail part tva et part ht.
-
- // Tva sur factures payes
- $sql = "SELECT sum(f.total_tva) as amount";
- $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
- // $sql.= " WHERE ";
- $sql .= " WHERE f.fk_statut in (1,2)";
-// $sql.= " f.paye = 1";
- $sql.= " AND date_format(f.datef,'%Y') = $y";
- $sql.= " AND date_format(f.datef,'%m') = $m";
- //print "xx $sql";
-*/
- }
-
- $resql = $db->query($sql);
- if ($resql)
- {
- $obj = $db->fetch_object($resql);
- return $obj->amount;
- }
- else
- {
- dol_print_error($db);
- }
-}
-
function pt ($db, $sql, $date)
{
@@ -227,6 +112,9 @@ print_fiche_titre($langs->trans("VAT"),"$textprevyear ".$langs->trans("Year")."
echo '
';
echo '
';
print_titre($langs->trans("VATSummary"));
+// The report mode is the one defined by defaut in tax module setup
+//print $modetax;
+//print '('.$langs->trans("SeeVATReportInInputOutputMode",'','').')';
echo '
';
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index 56d21decc73..8ca2dab1ce2 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004 Éric Seigne
+ * Copyright (C) 2004 �ric Seigne
* Copyright (C) 2004-2009 Laurent Destailleur
* Copyright (C) 2006-2007 Yannick Warnier
*
@@ -56,7 +56,7 @@ $q=(! empty($_GET["q"]))?$_GET["q"]:1;
// Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit
$modetax = $conf->global->TAX_MODE;
-if ($_GET["modetax"]) $modetax=$_GET["modetax"];
+if (isset($_GET["modetax"])) $modetax=$_GET["modetax"];
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
@@ -80,8 +80,8 @@ $paymentfourn_static=new PaiementFourn($db);
//print_fiche_titre($langs->trans("VAT"),"");
-// Affiche en-tête du rapport
-if ($modetax==1) // Caluclate on invoice for goods and services
+// Affiche en-tete du rapport
+if ($modetax==1) // Calculate on invoice for goods and services
{
$nom=$langs->trans("VATReportByQuartersInDueDebtMode");
$nom.=' ('.$langs->trans("SeeVATReportInInputOutputMode",'','').')';
@@ -94,7 +94,7 @@ if ($modetax==1) // Caluclate on invoice for goods and services
else { $nextquarter=1; $nextyear++; }
$periodlink=($prevyear?"".img_previous()."".img_next()."":"");
$description=$langs->trans("RulesVATDue");
- if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.=' '.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
+ //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.=' '.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
$description.=$fsearch;
$builddate=time();
$exportlink=$langs->trans("NotYetAvailable");
@@ -103,12 +103,12 @@ if ($modetax==1) // Caluclate on invoice for goods and services
$productcust=$langs->trans("ProductOrService");
$amountcust=$langs->trans("AmountHT");
$vatcust=$langs->trans("VATReceived");
- if ($conf->global->FACTURE_TVAOPTION != 'franchise') $vatcust.=' ('.$langs->trans("ToPay").')';
+ if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
$elementsup=$langs->trans("SuppliersInvoices");
$productsup=$langs->trans("ProductOrService");
$amountsup=$langs->trans("AmountHT");
$vatsup=$langs->trans("VATPayed");
- if ($conf->global->FACTURE_TVAOPTION != 'franchise') $vatsup.=' ('.$langs->trans("ToGetBack").')';
+ if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
if ($modetax==0) // Invoice for goods, payment for services
{
@@ -123,7 +123,7 @@ if ($modetax==0) // Invoice for goods, payment for services
else { $nextquarter=1; $nextyear++; }
$periodlink=($prevyear?"".img_previous()."".img_next()."":"");
$description=$langs->trans("RulesVATIn");
- if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.=' '.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
+ if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.=' '.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
$description.=$fsearch;
$builddate=time();
$exportlink=$langs->trans("NotYetAvailable");
@@ -132,12 +132,12 @@ if ($modetax==0) // Invoice for goods, payment for services
$productcust=$langs->trans("ProductOrService");
$amountcust=$langs->trans("AmountHT");
$vatcust=$langs->trans("VATReceived");
- if ($conf->global->FACTURE_TVAOPTION != 'franchise') $vatcust.=' ('.$langs->trans("ToPay").')';
+ if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
$elementsup=$langs->trans("SuppliersInvoices");
$productsup=$langs->trans("ProductOrService");
$amountsup=$langs->trans("AmountHT");
$vatsup=$langs->trans("VATPayed");
- if ($conf->global->FACTURE_TVAOPTION != 'franchise') $vatsup.=' ('.$langs->trans("ToGetBack").')';
+ if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
@@ -386,7 +386,7 @@ else
print '
';
//print table headers for this quadri - expenses now
- //imprime les en-tete de tables pour ce quadri - maintenant les dépenses
+ //imprime les en-tete de tables pour ce quadri - maintenant les d�penses
print '