Report of turnover by vat rate / product type / country
This commit is contained in:
parent
7099068f05
commit
3e27d7dd2a
361
htdocs/compta/stats/byratecountry.php
Normal file
361
htdocs/compta/stats/byratecountry.php
Normal file
@ -0,0 +1,361 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007, 2015 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/tva/quadri_detail.php
|
||||
* \ingroup tax
|
||||
* \brief VAT by rate
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
||||
|
||||
$langs->loadLangs(array("other","compta","banks","bills","companies","product","trips","admin","accountancy"));
|
||||
|
||||
$modecompta = GETPOST('modecompta','alpha');
|
||||
|
||||
// Date range
|
||||
$year=GETPOST("year",'int');
|
||||
$month=GETPOST("month",'int');
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$month_current = strftime("%m",dol_now());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$month_current = strftime("%m",dol_now());
|
||||
$year_start = $year;
|
||||
}
|
||||
$date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
|
||||
$date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
{
|
||||
$q=GETPOST("q","int");
|
||||
if (empty($q))
|
||||
{
|
||||
// We define date_start and date_end
|
||||
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_end=$year_start;
|
||||
$month_end=$month_start;
|
||||
if (! GETPOST("month")) // If month not forced
|
||||
{
|
||||
if (! GETPOST('year') && $month_start > $month_current)
|
||||
{
|
||||
$year_start--;
|
||||
$year_end--;
|
||||
}
|
||||
$month_end=$month_start-1;
|
||||
if ($month_end < 1) $month_end=12;
|
||||
else $year_end++;
|
||||
}
|
||||
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
}
|
||||
}
|
||||
|
||||
// $date_start and $date_end are defined. We force $year_start and $nbofyear
|
||||
$tmps=dol_getdate($date_start);
|
||||
$year_start = $tmps['year'];
|
||||
$tmpe=dol_getdate($date_end);
|
||||
$year_end = $tmpe['year'];
|
||||
|
||||
$tmp_date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
|
||||
if ($tmp_date_end < $date_end || $date_end < $date_start) $date_end = $tmp_date_end;
|
||||
|
||||
$min = price2num(GETPOST("min","alpha"));
|
||||
if (empty($min)) $min = 0;
|
||||
|
||||
// Define modetax (0 or 1)
|
||||
// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
|
||||
$modetax = $conf->global->TAX_MODE;
|
||||
if (GETPOSTISSET("modetax")) $modetax=GETPOST("modetax",'int');
|
||||
if (empty($modetax)) $modetax=0;
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$company_static=new Societe($db);
|
||||
$invoice_customer=new Facture($db);
|
||||
$invoice_supplier=new FactureFournisseur($db);
|
||||
$expensereport=new ExpenseReport($db);
|
||||
$product_static=new Product($db);
|
||||
$payment_static=new Paiement($db);
|
||||
$paymentfourn_static=new PaiementFourn($db);
|
||||
$paymentexpensereport_static=new PaymentExpenseReport($db);
|
||||
|
||||
$morequerystring='';
|
||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||
foreach ($listofparams as $param)
|
||||
{
|
||||
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
||||
}
|
||||
|
||||
llxHeader('',$langs->trans("TurnoverReport"),'','',0,0,'','',$morequerystring);
|
||||
|
||||
|
||||
//print load_fiche_titre($langs->trans("VAT"),"");
|
||||
|
||||
//$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
|
||||
// Show report header
|
||||
$name=$langs->trans("xxx");
|
||||
$calcmode='';
|
||||
if ($modetax == 0) $calcmode=$langs->trans('OptionVATDefault');
|
||||
if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption');
|
||||
if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices');
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
// Set period
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) {
|
||||
$prevquarter--;
|
||||
} else {
|
||||
$prevquarter=4; $prevyear--;
|
||||
}
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) {
|
||||
$nextquarter++;
|
||||
} else {
|
||||
$nextquarter=1; $nextyear++;
|
||||
}
|
||||
$description.=$fsearch;
|
||||
$builddate=dol_now();
|
||||
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='<br>'.$langs->trans("RulesVATInServices");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
}
|
||||
if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue");
|
||||
|
||||
// Customers invoices
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
|
||||
// Suppliers invoices
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$productcust;
|
||||
$amountsup=$amountcust;
|
||||
$namesup=$namecust;
|
||||
|
||||
|
||||
|
||||
|
||||
// Show report header
|
||||
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByVatRate");
|
||||
|
||||
if ($modecompta=="CREANCES-DETTES") {
|
||||
$calcmode=$langs->trans("CalcModeDebt");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.= $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$builddate=dol_now();
|
||||
} else {
|
||||
$calcmode=$langs->trans("CalcModeEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
$builddate=dol_now();
|
||||
}
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
else $periodlink = '';
|
||||
|
||||
$description.=' <input type="hidden" name="modecompta" value="'.$modecompta.'">';
|
||||
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||
{
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("TurnoverbyVatrate") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("ProductOrService") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Country") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT fd.tva_tx AS vatrate,";
|
||||
$sql .= " fd.product_type AS product_type,";
|
||||
$sql .= " cc.label AS country,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND f.type IN (0,1,2,5)";
|
||||
} else {
|
||||
$sql.= " AND f.type IN (0,1,2,3,5)";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")";
|
||||
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
|
||||
|
||||
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($row[0]) . '</td>';
|
||||
if ($row[1] == 0) {
|
||||
print '<td align="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td align="left">'. $langs->trans("Service") . '</td>';
|
||||
}
|
||||
print '<td>' .$row[2] . '</td>';
|
||||
|
||||
for($i = 3; $i <= 14; $i ++) {
|
||||
print '<td align="right" width="6%">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right" width="6%"><b>' . price($row[15]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("PurchasebyVatrate") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("ProductOrService") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Country") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
|
||||
|
||||
$sql2 = "SELECT ffd.tva_tx AS vatrate,";
|
||||
$sql2 .= " ffd.product_type AS product_type,";
|
||||
$sql2 .= " cc.label AS country,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql2 .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql2 .= " SUM(ffd.total_ht) as total";
|
||||
$sql2 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = ff.fk_soc";
|
||||
$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
|
||||
$sql2 .= " WHERE ff.datef >= '" . $db->idate($date_start) . "'";
|
||||
$sql2 .= " AND ff.datef <= '" . $db->idate($date_end) . "'";
|
||||
$sql.= " AND ff.fk_statut in (1,2)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND ff.type IN (0,1,2,5)";
|
||||
} else {
|
||||
$sql.= " AND ff.type IN (0,1,2,3,5)";
|
||||
}
|
||||
$sql2 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")";
|
||||
$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
|
||||
|
||||
//print $sql2;
|
||||
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql2 = $db->query($sql2);
|
||||
if ($resql2) {
|
||||
$num = $db->num_rows($resql2);
|
||||
|
||||
while ( $row = $db->fetch_row($resql2)) {
|
||||
print '<tr class="oddeven"><td class="right">' . vatrate($row[0]) . '</td>';
|
||||
if ($row[1] == 0) {
|
||||
print '<td align="left">'. $langs->trans("Product") . '</td>';
|
||||
} else {
|
||||
print '<td align="left">'. $langs->trans("Service") . '</td>';
|
||||
}
|
||||
print '<td>' . $row[2] . '</td>';
|
||||
for($i = 3; $i <= 14; $i ++) {
|
||||
print '<td align="right" width="6%">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right" width="6%"><b>' . price($row[15]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql2);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
} else {
|
||||
// $modecompta != 'CREANCES-DETTES'
|
||||
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
|
||||
// invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
|
||||
// Because there is no way to know this, this report is not relevant.
|
||||
print '<br>'.$langs->trans("TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant") . '<br>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -29,9 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("categories");
|
||||
$langs->load("errors");
|
||||
$langs->loadLangs(array("products","categories","errors",'accountancy'));
|
||||
|
||||
// Security pack (data & check)
|
||||
$socid = GETPOST('socid','int');
|
||||
@ -78,13 +76,13 @@ if (empty($year))
|
||||
$month_current = strftime("%m",dol_now());
|
||||
$year_start = $year;
|
||||
}
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
$date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
|
||||
$date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
{
|
||||
$q=GETPOST("q")?GETPOST("q"):0;
|
||||
if ($q==0)
|
||||
$q=GETPOST("q","int");
|
||||
if (empty($q))
|
||||
{
|
||||
// We define date_start and date_end
|
||||
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
@ -103,10 +101,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
}
|
||||
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
|
||||
}
|
||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
else
|
||||
{
|
||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
}
|
||||
} else {
|
||||
// TODO We define q
|
||||
}
|
||||
@ -188,7 +189,7 @@ report_header($name,$namelink,$period,$periodlink,$description,$builddate,$expor
|
||||
|
||||
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||
{
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -205,17 +206,17 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
|
||||
$sql.= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
|
||||
$sql.= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
|
||||
if ($selected_cat === -2) // Without any category
|
||||
{
|
||||
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
||||
}
|
||||
else if ($selected_cat) // Into a specific category
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
}
|
||||
$sql.= " WHERE l.fk_product = p.rowid";
|
||||
$sql.= " AND l.fk_facture = f.rowid";
|
||||
$sql.= " WHERE l.fk_facture = f.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND f.type IN (0,1,2,5)";
|
||||
@ -363,23 +364,21 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
);
|
||||
print "</tr>\n";
|
||||
|
||||
// Array Data
|
||||
$var=true;
|
||||
|
||||
if (count($name)) {
|
||||
foreach($name as $key=>$value) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Product
|
||||
print "<td>";
|
||||
$fullname=$name[$key];
|
||||
if ($key >= 0) {
|
||||
if ($key > 0) {
|
||||
$linkname='<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"),$type[$key]==0?'product':'service').' '.$fullname.'</a>';
|
||||
} else {
|
||||
$linkname=$langs->trans("PaymentsNotLinkedToProduct");
|
||||
}
|
||||
|
||||
print "<td>".$linkname."</td>\n";
|
||||
print $linkname;
|
||||
print "</td>\n";
|
||||
|
||||
// Quantity
|
||||
print '<td align="right">';
|
||||
@ -423,11 +422,11 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
// Total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($qtytotal).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$qtytotal.'</td>';
|
||||
print '<td align="right">100%</td>';
|
||||
print '<td align="right">'.price($catotal_ht).'</td>';
|
||||
print '<td align="right">'.price($catotal).'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">100%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -90,8 +90,8 @@ $date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GE
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
{
|
||||
$q=GETPOST("q")?GETPOST("q"):0;
|
||||
if ($q==0)
|
||||
$q=GETPOST("q","int")?GETPOST("q","int"):0;
|
||||
if (empty($q))
|
||||
{
|
||||
// We define date_start and date_end
|
||||
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
|
||||
@ -565,7 +565,7 @@ print '</div>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>";
|
||||
print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
@ -614,7 +614,7 @@ print '</div>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>";
|
||||
print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>";
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
@ -622,7 +622,7 @@ print '</div>';
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Total CA previsionnel : </i></td><td align=\"right\"><i>".price($total_CA)."</i></td><td colspan=\"3\"><-- bug ici car bug sur les 2 precedents</td></tr>";
|
||||
print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Total CA previsionnel : </i></td><td align=\"right\"><i>".price($total_CA)."</i></td><td colspan=\"3\"><-- bug ici car bug sur les 2 precedents</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -699,7 +699,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
//if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1103,6 +1102,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report", $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire);
|
||||
}
|
||||
|
||||
// Accountancy (simple)
|
||||
@ -1131,6 +1131,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report", $langs->trans("ByVatRate"),2,$user->rights->compta->resultat->lire);
|
||||
|
||||
// Journaux
|
||||
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
|
||||
|
||||
@ -192,6 +192,7 @@ ListAccounts=List of the accounting accounts
|
||||
UnknownAccountForThirdparty=Unknown third party account. We will use %s
|
||||
UnknownAccountForThirdpartyBlocking=Unknown third party account. Blocking error
|
||||
UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third party account and waiting account not defined. Blocking error
|
||||
PaymentsNotLinkedToProduct=Payment not linked to any product / service
|
||||
|
||||
Pcgtype=Group of account
|
||||
Pcgsubtype=Subgroup of account
|
||||
|
||||
@ -210,7 +210,7 @@ Pcg_version=Chart of accounts models
|
||||
Pcg_type=Pcg type
|
||||
Pcg_subtype=Pcg subtype
|
||||
InvoiceLinesToDispatch=Invoice lines to dispatch
|
||||
ByProductsAndServices=By products and services
|
||||
ByProductsAndServices=By product and service
|
||||
RefExt=External ref
|
||||
ToCreateAPredefinedInvoice=To create a template invoice, create a standard invoice, then, without validating it, click onto button "%s".
|
||||
LinkedOrder=Link to order
|
||||
@ -218,7 +218,8 @@ Mode1=Method 1
|
||||
Mode2=Method 2
|
||||
CalculationRuleDesc=To calculate total VAT, there is two methods:<br>Method 1 is rounding vat on each line, then summing them.<br>Method 2 is summing all vat on each line, then rounding result.<br>Final result may differs from few cents. Default mode is mode <b>%s</b>.
|
||||
CalculationRuleDescSupplier=According to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier.
|
||||
TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a <b>cash accountancy</b> mode is not relevant. This report is only available when using <b>engagement accountancy</b> mode (see setup of accountancy module).
|
||||
TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a <b>cash accounting</b> mode is not relevant. This report is only available when using <b>commitment accounting</b> mode (see setup of accountancy module).
|
||||
TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=Turnover report per sale tax rate, when using a <b>cash accounting</b> mode is not relevant. This report is only available when using <b>commitment accounting</b> mode (see setup of accountancy module).
|
||||
CalculationMode=Calculation mode
|
||||
AccountancyJournal=Accounting code journal
|
||||
ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for VAT on sales (used if not defined on VAT dictionary setup)
|
||||
@ -248,4 +249,7 @@ AccountingAffectation=Accounting assignement
|
||||
LastDayTaxIsRelatedTo=Last day of period the tax is related to
|
||||
VATDue=Sale tax claimed
|
||||
ClaimedForThisPeriod=Claimed for the period
|
||||
PaidDuringThisPeriod=Paid during this period
|
||||
PaidDuringThisPeriod=Paid during this period
|
||||
ByVatRate=By sale tax rate
|
||||
TurnoverbyVatrate=Turnover by sale tax rate
|
||||
PurchasebyVatrate=Purchase by sale tax rate
|
||||
@ -494,7 +494,7 @@ Received=Received
|
||||
Paid=Paid
|
||||
Topic=Subject
|
||||
ByCompanies=By third parties
|
||||
ByUsers=By users
|
||||
ByUsers=By user
|
||||
Links=Links
|
||||
Link=Link
|
||||
Rejects=Rejects
|
||||
|
||||
Loading…
Reference in New Issue
Block a user