Debug reporting

This commit is contained in:
Laurent Destailleur 2010-02-02 21:23:23 +00:00
parent cb61c1cc1e
commit d82fff31d4
3 changed files with 56 additions and 24 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -19,10 +19,10 @@
*/
/**
\file htdocs/compta/resultat/clientfourn.php
\brief Page reporting resultat
\version $Id$
*/
* \file htdocs/compta/resultat/clientfourn.php
* \brief Page reporting resultat
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/compta/tva/tva.class.php");
@ -35,8 +35,33 @@ $langs->load("bills");
if (!$user->rights->facture->lire)
accessforbidden();
$year=$_GET["year"];
if (! $year) { $year = strftime("%Y", time()); }
// Date range
$year=$_REQUEST["year"];
if (empty($year))
{
$year_current = strftime("%Y",dol_now());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
}
$date_start=dol_mktime($_REQUEST["date_starthour"],$_REQUEST["date_startmin"],$_REQUEST["date_startsec"],$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
$date_end=dol_mktime($_REQUEST["date_endhour"],$_REQUEST["date_endmin"],$_REQUEST["date_endsec"],$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
// Quarter
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=(! empty($_REQUEST["q"]))?$_REQUEST["q"]:1; // TODO Set current quarter
if ($q==1) { $date_start=dol_get_first_day($year_start,1); $date_end=dol_get_last_day($year_start,3); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4); $date_end=dol_get_last_day($year_start,6); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7); $date_end=dol_get_last_day($year_start,9); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10); $date_end=dol_get_last_day($year_start,12); }
}
else
{
// TODO We define q
}
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->compta->mode;
if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"];
@ -451,7 +476,7 @@ if ($modecompta == 'CREANCES-DETTES')
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " GROUP BY dm";
$sql.= " ORDER BY dm DESC";
$result=$db->query($sql);
if ($result) {
$num = $db->num_rows($result);
@ -530,7 +555,7 @@ else
$sql.= " AND t.entity = ".$conf->entity;
$sql.= " GROUP BY dm";
$sql.= " ORDER BY dm DESC";
$result=$db->query($sql);
if ($result) {
$num = $db->num_rows($result);
@ -570,7 +595,7 @@ else
$sql.= " AND t.entity = ".$conf->entity;
$sql.= " GROUP BY dm";
$sql.= " ORDER BY dm DESC";
$result=$db->query($sql);
if ($result) {
$num = $db->num_rows($result);

View File

@ -113,12 +113,10 @@ if ($modetax==1) // Calculate on invoice for goods and services
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("Description");
$amountcust=$langs->trans("AmountHT");
$vatcust=$langs->trans("VATReceived");
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
$elementsup=$langs->trans("SuppliersInvoices");
$productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT");
$vatsup=$langs->trans("VATPaid");
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
if ($modetax==0) // Invoice for goods, payment for services
@ -137,21 +135,22 @@ if ($modetax==0) // Invoice for goods, payment for services
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("Description");
$amountcust=$langs->trans("AmountHT");
$vatcust=$langs->trans("VATReceived");
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
$elementsup=$langs->trans("SuppliersInvoices");
$productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT");
$vatsup=$langs->trans("VATPaid");
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");
// VAT Received
print "<br>";
print_titre($vatcust);
//print "<br>";
//print_titre($vatcust);
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -215,15 +214,15 @@ else
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
}
print '</table>';
//print '</table>';
// VAT Paid
print "<br>";
print_titre($vatsup);
//print "<br>";
//print_titre($vatsup);
print "<table class=\"noborder\" width=\"100%\">";
//print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<td align="left">'.$langs->trans("Num")."</td>";
print '<td align="left">'.$langs->trans("Supplier")."</td>";

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
*
* This program is free software; you can redistribute it and/or modify
@ -174,9 +174,15 @@ if ($modetax==0) // Invoice for goods, payment for services
}
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink);
$vatcust=$langs->trans("VATReceived");
$vatsup=$langs->trans("VATPaid");
// VAT Received and paid
//print "<br>";
//print_titre($vatcust);
echo '<table class="noborder" width="100%">';
$y = $year_current;
@ -402,6 +408,8 @@ else
$x_coll_sum += $temp_vat;
}
}
// Total customers
print '<tr class="liste_total">';
print '<td></td>';
print '<td align="right">'.$langs->trans("Total").':</td>';
@ -415,7 +423,6 @@ else
print '</tr>';
}
print '<tr><td colspan="'.($span+1).'">&nbsp;</td></tr>';
//print table headers for this quadri - expenses now
@ -538,6 +545,7 @@ else
}
}
// Total suppliers
print '<tr class="liste_total">';
print '<td>&nbsp;</td>';
print '<td align="right">'.$langs->trans("Total").':</td>';
@ -555,11 +563,11 @@ else
// Total to pay
print '<tr class="liste_titre">';
print '<td class="liste_titre" colspan="'.($span-1).'"></td><td class="liste_titre" align="right" colspan="2">'.$langs->trans("TotalToPay").', '.$langs->trans("Quadri").' '.$q.':</td>';
print '<td class="liste_titre" colspan="'.($span-1).'"></td><td class="liste_titre" align="right" colspan="2">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').':</td>';
print '</tr>'."\n";
$diff = $x_coll_sum - $x_paye_sum;
print '<tr class="list_total">';
print '<tr class="liste_total">';
print '<td class="liste_total" colspan="'.$span.'"></td>';
print '<td class="liste_total" nowrap="nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
print "</tr>\n";