diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index f60d92eac00..5ca508e6afd 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -50,19 +50,19 @@ $html=new Form($db);
// Affiche en-tête de rapport
if ($modecompta=="CREANCES-DETTES")
{
- $nom="Bilan des recettes et dépenses, détail";
- $nom.=' (Voir le rapport en recettes-dépenses pour n\'inclure que les factures effectivement payées)';
+ $nom=$langs->trans("AnnualByCompaniesDueDebtMode");
+ $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')';
$period=$langs->trans("Year")." ".$year;
- $periodlink=''.img_previous().' '.img_next().'';
+ $periodlink=''.img_previous().' '.img_next().'';
$description=$langs->trans("RulesResultDue");
$builddate=time();
$exportlink=$langs->trans("NotYetAvailable");
}
else {
- $nom="Bilan des recettes et dépenses, détail";
- $nom.=' (Voir le rapport en créances-dettes pour inclure les factures non encore payée)';
+ $nom=$langs->trans("AnnualByCompaniesInputOutputMode");
+ $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')';
$period=$langs->trans("Year")." ".$year;
- $periodlink=''.img_previous().' '.img_next().'';
+ $periodlink=''.img_previous().' '.img_next().'';
$description=$langs->trans("RulesResultInOut");
$builddate=time();
$exportlink=$langs->trans("NotYetAvailable");
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index d1e29a4e6ab..01d7fb85d91 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
- * $Source$
*/
/**
@@ -58,19 +57,19 @@ $html=new Form($db);
// Affiche en-tête du rapport
if ($modecompta=="CREANCES-DETTES")
{
- $nom="Bilan des recettes et dépenses, résumé annuel";
- $nom.=' (Voir le rapport recettes-dépenses pour n\'inclure que les factures effectivement payées)';
+ $nom=$langs->trans("AnnualSummaryDueDebtMode");
+ $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')';
$period="$year_start - $year_end";
- $periodlink=($year_start?"".img_previous()." ".img_next()."":"");
+ $periodlink=($year_start?"".img_previous()." ".img_next()."":"");
$description=$langs->trans("RulesResultDue");
$builddate=time();
$exportlink=$langs->trans("NotYetAvailable");
}
else {
- $nom="Bilan des recettes et dépenses, résumé annuel";
- $nom.=' (Voir le rapport en créances-dettes pour inclure les factures non encore payée)';
+ $nom=$langs->trans("AnnualSummaryInputOutputMode");
+ $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')';
$period="$year_start - $year_end";
- $periodlink=($year_start?"".img_previous()." ".img_next()."":"");
+ $periodlink=($year_start?"".img_previous()." ".img_next()."":"");
$description=$langs->trans("RulesResultInOut");
$builddate=time();
$exportlink=$langs->trans("NotYetAvailable");
@@ -81,6 +80,8 @@ $html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$
/*
* Factures clients
*/
+$subtotal_ht = 0;
+$subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
@@ -136,6 +137,13 @@ if ($modecompta != 'CREANCES-DETTES') {
$encaiss[$row->dm] += $row->amount_ht;
$encaiss_ttc[$row->dm] += $row->amount_ttc;
+ // For DEBUG Only
+ if (eregi('^2007',$row->dm))
+ {
+ $subtotal_ht = $subtotal_ht + $row->amount_ht;
+ $subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
+ }
+
$i++;
}
}
@@ -143,11 +151,22 @@ if ($modecompta != 'CREANCES-DETTES') {
dolibarr_print_error($db);
}
}
-
+/*
+print "
Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n";
+for ($mois = 1 ; $mois <= 12 ; $mois++)
+{
+ $annee = 2007;
+ $case = strftime("%Y-%m",dolibarr_mktime(12,0,0,$mois,1,$annee));
+ print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
+ print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
+}
+*/
/*
* Frais, factures fournisseurs.
*/
+$subtotal_ht = 0;
+$subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f";
@@ -176,6 +195,14 @@ if ($result)
$decaiss[$row->dm] = $row->amount_ht;
$decaiss_ttc[$row->dm] = $row->amount_ttc;
+
+ // For DEBUG Only
+ if (eregi('^2007',$row->dm))
+ {
+ $subtotal_ht = $subtotal_ht + $row->amount_ht;
+ $subtotal_ttc = $subtotal_ttc + $row->amount_ttc;
+ }
+
$i++;
}
$db->free($result);
@@ -183,12 +210,22 @@ if ($result)
else {
dolibarr_print_error($db);
}
-
-
+/*
+print "
Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n";
+for ($mois = 1 ; $mois <= 12 ; $mois++)
+{
+ $annee = 2007;
+ $case = strftime("%Y-%m",dolibarr_mktime(12,0,0,$mois,1,$annee));
+ print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
+ print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
+}
+*/
+
/*
* TVA
*/
-
+$subtotal_ht = 0;
+$subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') {
// TVA à payer
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
@@ -254,6 +291,12 @@ else {
$decaiss[$obj->dm] += $obj->amount;
$decaiss_ttc[$obj->dm] += $obj->amount;
+ // For DEBUG Only
+ if (eregi('^2007',$obj->dm))
+ {
+ $subtotal_ht = $subtotal_ht + $obj->amount;
+ $subtotal_ttc = $subtotal_ttc + $obj->amount;
+ }
$i++;
}
@@ -277,6 +320,12 @@ else {
$encaiss[$obj->dm] += $obj->amount;
$encaiss_ttc[$obj->dm] += $obj->amount;
+ // For DEBUG Only
+ if (eregi('^2007',$obj->dm))
+ {
+ $subtotal_ht = $subtotal_ht + $obj->amount;
+ $subtotal_ttc = $subtotal_ttc + $obj->amount;
+ }
$i++;
}
@@ -285,12 +334,22 @@ else {
dolibarr_print_error($db);
}
}
-
+/*
+print "
TVA: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n";
+for ($mois = 1 ; $mois <= 12 ; $mois++)
+{
+ $annee = 2007;
+ $case = strftime("%Y-%m",dolibarr_mktime(12,0,0,$mois,1,$annee));
+ print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
+ print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
+}
+*/
/*
* Charges sociales non déductibles
*/
-
+$subtotal_ht = 0;
+$subtotal_ttc = 0;
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
@@ -322,11 +381,12 @@ if ($result) {
$decaiss[$obj->dm] += $obj->amount_ht;
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
- if (ereg('^2004',$obj->dm)) {
- $total_ht = $total_ht + $obj->amount_ht;
- $total_ttc = $total_ttc + $obj->amount_ttc;
- }
-
+ // For DEBUG Only
+ if (eregi('^2007',$obj->dm))
+ {
+ $subtotal_ht = $subtotal_ht + $obj->amount_ht;
+ $subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
+ }
$i++;
}
@@ -334,13 +394,24 @@ if ($result) {
} else {
dolibarr_print_error($db);
}
-
+/*
+print "
Charges sociales non deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n";
+for ($mois = 1 ; $mois <= 12 ; $mois++)
+{
+ $annee = 2007;
+ $case = strftime("%Y-%m",dolibarr_mktime(12,0,0,$mois,1,$annee));
+ print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
+ print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
+}
+*/
/*
* Charges sociales déductibles
*/
-
-if ($modecompta == 'CREANCES-DETTES') {
+$subtotal_ht = 0;
+$subtotal_ttc = 0;
+if ($modecompta == 'CREANCES-DETTES')
+{
$sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s";
$sql .= " WHERE s.fk_type = c.id AND c.deductible=1";
@@ -349,7 +420,8 @@ if ($modecompta == 'CREANCES-DETTES') {
}
$sql .= " GROUP BY c.libelle, dm";
}
-else {
+else
+{
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."chargesociales as s, ".MAIN_DB_PREFIX."paiementcharge as p";
$sql .= " WHERE p.fk_charge = s.rowid AND s.fk_type = c.id AND c.deductible=1";
@@ -369,6 +441,13 @@ if ($result) {
$decaiss[$obj->dm] += $obj->amount_ht;
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
+
+ // For DEBUG Only
+ if (eregi('^2007',$obj->dm))
+ {
+ $subtotal_ht = $subtotal_ht + $obj->amount_ht;
+ $subtotal_ttc = $subtotal_ttc + $obj->amount_ttc;
+ }
$i++;
}
@@ -376,12 +455,23 @@ if ($result) {
} else {
dolibarr_print_error($db);
}
-
+/*
+print "
Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n";
+for ($mois = 1 ; $mois <= 12 ; $mois++)
+{
+ $annee = 2007;
+ $case = strftime("%Y-%m",dolibarr_mktime(12,0,0,$mois,1,$annee));
+ print 'Mois '.$mois.': '.$decaiss_ttc[$case].' ';
+ print 'Mois '.$mois.': '.$encaiss_ttc[$case].' ';
+}
+*/
/*
* Affiche tableau
*/
+$totentrees=array();
+$totsorties=array();
print '
| '.$langs->trans("Month").' | '; @@ -400,34 +490,33 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) print '|||
| ".strftime("%B",mktime(1,1,1,$mois,1,$annee))." | "; - for ($annee = $year_start ; $annee <= $year_end ; $annee++) - { - print ''; - $case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee)); - if ($decaiss_ttc[$case]>0) + $var=!$var; + print ' | ||
| ".strftime("%B",dolibarr_mktime(12,0,0,$mois,1,$annee))." | "; + for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print price($decaiss_ttc[$case]); - $totsorties[$annee]+=$decaiss_ttc[$case]; + $case = strftime("%Y-%m",dolibarr_mktime(12,0,0,$mois,1,$annee)); + + print ''; + if ($decaiss_ttc[$case] != 0) + { + print price($decaiss_ttc[$case]); + $totsorties[$annee]+=$decaiss_ttc[$case]; + } + print " | "; + + print ''; + if ($encaiss_ttc[$case] != 0) + { + print price($encaiss_ttc[$case]); + $totentrees[$annee]+=$encaiss_ttc[$case]; + } + print " | "; } - print ""; - print ''; - $case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee)); - if ($encaiss_ttc[$case]>0) - { - print price($encaiss_ttc[$case]); - $totentrees[$annee]+=$encaiss_ttc[$case]; - } - print " | "; - - } - - print '".$linkname." | \n"; print ''.price($amount[$key]).' | '; - print ''.($catotal > 0 ? price(100 / $catotal * $amount[$key]).'%' : ' ').' | '; + print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').' | '; print "\n"; $i++; } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 04d715d7d79..78e73e17af1 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -1,7 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur".$linkname." | \n"; print ''.price($amount[$key]).' | '; - print ''.($catotal > 0 ? price(100 / $catotal * $amount[$key]).'%' : ' ').' | '; + print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').' | '; print "\n"; $i++; } diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 2fd934ff4e7..b5a1a05e2f0 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -17,8 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ - * */ /** @@ -56,19 +54,19 @@ $html=new Form($db); // Affiche en-tête du rapport if ($modecompta=="CREANCES-DETTES") { - $nom="Chiffre d'affaire"; - $nom.=' (Voir le rapport recettes-dépenses pour n\'inclure que les factures effectivement payées)'; + $nom=$langs->trans("SalesTurnover"); + $nom.='