diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 9af3d0d19d9..f1bea3bd4a1 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -23,7 +23,7 @@
/**
* \file htdocs/accountancy/customer/index.php
* \ingroup Advanced accountancy
- * \brief Home customer ventilation
+ * \brief Home customer journalization page
*/
require '../../main.inc.php';
@@ -58,7 +58,7 @@ if ($year == 0) {
}
// Validate History
-$action = GETPOST('action','alpha');
+$action = GETPOST('action','aZ09');
@@ -97,7 +97,7 @@ if ($action == 'validatehistory') {
$sql1 .= " AND fd.fk_code_ventilation = 0";
}
- dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
+ dol_syslog('htdocs/accountancy/customer/index.php');
$resql1 = $db->query($sql1);
if (! $resql1) {
@@ -173,7 +173,7 @@ print $langs->trans("DescVentilCustomer") . '
';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
';
print '
';
//print '
';
@@ -189,7 +189,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
-dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
+dol_syslog('htdocs/accountancy/customer/index.php');
$result = $db->query($sql);
if ($result) {
$row = $db->fetch_row($result);
@@ -233,7 +233,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
}
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
-dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
+dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -289,7 +289,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
-dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
+dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -347,7 +347,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);
if ($resql) {
- $i = 0;
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
@@ -357,7 +356,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
}
print '' . price($row[13]) . ' | ';
print '';
- $i ++;
}
$db->free($resql);
} else {
@@ -365,6 +363,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
}
print "\n";
+
if (! empty($conf->margin->enabled)) {
print "
\n";
print '';
@@ -390,7 +389,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
}
- dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
+ dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php
index fdbf4d1ce4b..b17aeedb4bd 100644
--- a/htdocs/accountancy/expensereport/index.php
+++ b/htdocs/accountancy/expensereport/index.php
@@ -69,7 +69,7 @@ if ($action == 'validatehistory') {
// First clean corrupted data
$sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
- $sqlclean .= " SET erd.fk_code_ventilation = 0";
+ $sqlclean .= " SET fk_code_ventilation = 0";
$sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN ';
$sqlclean .= ' (SELECT accnt.rowid ';
$sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
@@ -93,6 +93,8 @@ if ($action == 'validatehistory') {
$sql1 .= " AND erd.fk_code_ventilation = 0";
}
+ dol_syslog('htdocs/accountancy/expensereport/index.php');
+
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
@@ -107,7 +109,7 @@ if ($action == 'validatehistory') {
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
- $sql1 .= " SET erd.fk_code_ventilation = 0";
+ $sql1 .= " SET fk_code_ventilation = 0";
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
@@ -129,8 +131,9 @@ if ($action == 'validatehistory') {
$error = 0;
$db->begin();
+ // Now clean
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
- $sql1.= " SET erd.fk_code_ventilation = 0";
+ $sql1.= " SET fk_code_ventilation = 0";
$sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
$sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
@@ -166,25 +169,25 @@ print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv
print '
';
//print '';
-$buttonbind = '' . $langs->trans("ValidateHistory") . '';
-$buttonreset = '' . $langs->trans("CleanHistory", $year_current) . '';
$y = $year_current;
-print '
';
+$buttonbind = '' . $langs->trans("ValidateHistory") . '';
+$buttonreset = '' . $langs->trans("CleanHistory", $year_current) . '';
+
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '';
-print '| ' . $langs->trans("Account") . ' | ';
+print '
| ' . $langs->trans("Account") . ' | ';
print '' . $langs->trans("Label") . ' | ';
for($i = 1; $i <= 12; $i ++) {
print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ' | ';
@@ -196,7 +199,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'",
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
-$sql .= " ROUND(SUM(erd.total_ht),2) as total";
+$sql .= " SUM(erd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
@@ -237,7 +240,7 @@ print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '
print '';
-print '| ' . $langs->trans("Account") . ' | ';
+print '
| ' . $langs->trans("Account") . ' | ';
print '' . $langs->trans("Label") . ' | ';
for($i = 1; $i <= 12; $i ++) {
print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ' | ';
@@ -260,7 +263,7 @@ $sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We d
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
-dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
+dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -304,7 +307,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
- $sql .= " ROUND(SUM(erd.total_ht),2) as total";
+ $sql .= " SUM(erd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
@@ -312,14 +315,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
- dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
+ dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) {
-
-
print '
| ' . $row[0] . ' | ';
for($i = 1; $i <= 12; $i ++) {
print '' . price($row[$i]) . ' | ';
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index fb5f28fc27d..f862feb5ba3 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -21,12 +21,13 @@
/**
* \file htdocs/accountancy/supplier/index.php
* \ingroup Advanced accountancy
- * \brief Home supplier ventilation
+ * \brief Home supplier journalization page
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
// Langs
$langs->load("compta");
@@ -55,7 +56,7 @@ if ($year == 0) {
}
// Validate History
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'aZ09');
/*
@@ -93,6 +94,8 @@ if ($action == 'validatehistory') {
$sql1 .= " AND fd.fk_code_ventilation = 0";
}
+ dol_syslog('htdocs/accountancy/supplier/index.php');
+
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
@@ -159,33 +162,28 @@ llxHeader('', $langs->trans("SuppliersVentilation"));
$textprevyear = '' . img_previous() . '';
$textnextyear = ' ' . img_next() . '';
-print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
+print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilSupplier") . '
';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
';
print '
';
//print '';
+
+$y = $year_current;
+
$buttonbind = '' . $langs->trans("ValidateHistory") . '';
$buttonreset = '' . $langs->trans("CleanHistory", $year_current) . '';
-
-$y = $year_current;
-
-$var = true;
-
-
-print '
';
-
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '';
-print '| ' . $langs->trans("Account") . ' | ';
+print '
| ' . $langs->trans("Account") . ' | ';
print '' . $langs->trans("Label") . ' | ';
for($i = 1; $i <= 12; $i ++) {
print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ' | ';
@@ -197,7 +195,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'",
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
-$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
+$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
@@ -208,7 +206,7 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d
$sql .= " AND aa.account_number IS NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
-dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
+dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -239,7 +237,7 @@ print '
';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '';
-print '| ' . $langs->trans("Account") . ' | ';
+print '
| ' . $langs->trans("Account") . ' | ';
print '' . $langs->trans("Label") . ' | ';
for($i = 1; $i <= 12; $i ++) {
print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ' | ';
@@ -251,7 +249,7 @@ $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'",
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
-$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
+$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
@@ -262,7 +260,7 @@ $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We d
$sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
-dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
+dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
@@ -306,7 +304,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
- $sql .= " ROUND(SUM(ffd.total_ht),2) as total";
+ $sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
@@ -314,7 +312,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND ff.fk_statut > 0 ";
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
- dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
+ dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);