diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php
index 8d2b93ccb6f..25fdf013f9a 100644
--- a/htdocs/accountancy/closure/index.php
+++ b/htdocs/accountancy/closure/index.php
@@ -17,7 +17,7 @@
*/
/**
- * \file htdocs/accountancy/customer/index.php
+ * \file htdocs/accountancy/closure/index.php
* \ingroup Accountancy
* \brief Home closure page
*/
@@ -140,7 +140,6 @@ $textnextyear = ' trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescVentilCustomer") . '
';
-print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
';
print '
';
@@ -149,12 +148,9 @@ $y = $year_current;
$buttonbind = '' . $langs->trans("ValidateHistory") . '';
print_barre_liste($langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
-//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '
';
print '
';
-print '| ' . $langs->trans("Account") . ' | ';
-print '' . $langs->trans("Label") . ' | ';
for($i = 1; $i <= 12; $i ++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
if ($j > 12) $j-=12;
@@ -178,11 +174,6 @@ $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND f.fk_statut > 0";
$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL";
-if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
-} else {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
-}
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
dol_syslog('htdocs/accountancy/customer/index.php sql=' . $sql, LOG_DEBUG);
@@ -192,20 +183,7 @@ if ($resql) {
while ( $row = $db->fetch_row($resql)) {
- print '
| ';
- if ($row[0] == 'tobind')
- {
- print $langs->trans("Unknown");
- }
- else print length_accountg($row[0]);
- print ' | ';
- print '';
- if ($row[0] == 'tobind')
- {
- print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
- }
- else print $row[1];
- print ' | ';
+ print '
';
for($i = 2; $i <= 12; $i ++) {
print '| ' . price($row[$i]) . ' | ';
}
@@ -220,197 +198,6 @@ if ($resql) {
print "
\n";
print '
';
-
-print '
';
-
-
-print_barre_liste($langs->trans("OverviewOfAmountOfLinesBound"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
-//print load_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
-
-print '';
-print '
';
-print '| ' . $langs->trans("Account") . ' | ';
-print '' . $langs->trans("Label") . ' | ';
-for($i = 1; $i <= 12; $i ++) {
- $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
- if ($j > 12) $j-=12;
- print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' | ';
-}
-print '' . $langs->trans("Total") . ' |
';
-
-$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
-$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
-for($i = 1; $i <= 12; $i ++) {
- $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
- if ($j > 12) $j-=12;
- $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
-}
-$sql .= " SUM(fd.total_ht) as total";
-$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
-$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
-$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
-$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
-$sql .= " AND f.fk_statut > 0";
-if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
-} else {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
-}
-$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');
-$resql = $db->query($sql);
-if ($resql) {
- $num = $db->num_rows($resql);
-
- while ( $row = $db->fetch_row($resql)) {
-
- print '| ';
- if ($row[0] == 'tobind')
- {
- print $langs->trans("Unknown");
- }
- else print length_accountg($row[0]);
- print ' | ';
-
- print '';
- if ($row[0] == 'tobind')
- {
- print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
- }
- else print $row[1];
- print ' | ';
-
- for($i = 2; $i <= 12; $i++) {
- print '' . price($row[$i]) . ' | ';
- }
- print '' . price($row[13]) . ' | ';
- print '' . price($row[14]) . ' | ';
- print '
';
- }
- $db->free($resql);
-} else {
- print $db->lasterror(); // Show last sql error
-}
-print "
\n";
-print '
';
-
-
-if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
-{
- print '
';
- print '
';
-
- print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
- //print load_fiche_titre($langs->trans("OtherInfo"), '', '');
-
- print '';
- print '
';
- print '| ' . $langs->trans("TotalVente") . ' | ';
- for($i = 1; $i <= 12; $i ++) {
- $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
- if ($j > 12) $j-=12;
- print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' | ';
- }
- print '' . $langs->trans("Total") . ' |
';
-
- $sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
- for($i = 1; $i <= 12; $i ++) {
- $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
- if ($j > 12) $j-=12;
- $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
- }
- $sql .= " SUM(fd.total_ht) as total";
- $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
- $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
- $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
- $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
- $sql .= " AND f.fk_statut > 0";
- if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
- } else {
- $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');
- $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]) . ' | ';
- }
- print '' . price($row[13]) . ' | ';
- print '
';
- }
- $db->free($resql);
- } else {
- print $db->lasterror(); // Show last sql error
- }
- print "
\n";
- print '
';
-
-
- if (! empty($conf->margin->enabled)) {
- print "
\n";
- print '';
- print '
';
- print '| ' . $langs->trans("TotalMarge") . ' | ';
- for($i = 1; $i <= 12; $i ++) {
- $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
- if ($j > 12) $j-=12;
- print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' | ';
- }
- print '' . $langs->trans("Total") . ' |
';
-
- $sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
- for($i = 1; $i <= 12; $i ++) {
- $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
- if ($j > 12) $j-=12;
- $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
- }
- $sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
- $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
- $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
- $sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
- $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
- $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")"; // We don't share object for accountancy
- $sql .= " AND f.fk_statut > 0";
- if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
- } else {
- $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');
- $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(price2num($row[$i])) . ' | ';
- }
- print '' . price(price2num($row[13])) . ' | ';
- print '
';
- }
- $db->free($resql);
- } else {
- print $db->lasterror(); // Show last sql error
- }
- print "
\n";
- print '
';
- }
-}
-
// End of page
llxFooter();
$db->close();