PHP8 Warnings / Wrong data / CSS - Accountancy - Result sales revenues by soc

This commit is contained in:
Alexandre SPANGARO 2022-08-20 03:13:20 +02:00
parent 0e5a463f30
commit 4c8ba7db21

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr> * Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -158,13 +159,27 @@ $commonparams['sortorder'] = $sortorder;
$commonparams['sortfield'] = $sortfield; $commonparams['sortfield'] = $sortfield;
$headerparams = array(); $headerparams = array();
if (!empty($date_startyear)) {
$headerparams['date_startyear'] = $date_startyear; $headerparams['date_startyear'] = $date_startyear;
}
if (!empty($date_startmonth)) {
$headerparams['date_startmonth'] = $date_startmonth; $headerparams['date_startmonth'] = $date_startmonth;
}
if (!empty($date_startday)) {
$headerparams['date_startday'] = $date_startday; $headerparams['date_startday'] = $date_startday;
}
if (!empty($date_endyear)) {
$headerparams['date_endyear'] = $date_endyear; $headerparams['date_endyear'] = $date_endyear;
}
if (!empty($date_endmonth)) {
$headerparams['date_endmonth'] = $date_endmonth; $headerparams['date_endmonth'] = $date_endmonth;
}
if (!empty($date_endday)) {
$headerparams['date_endday'] = $date_endday; $headerparams['date_endday'] = $date_endday;
}
if (!empty($q)) {
$headerparams['q'] = $q; $headerparams['q'] = $q;
}
$tableparams = array(); $tableparams = array();
$tableparams['search_categ'] = $selected_cat; $tableparams['search_categ'] = $selected_cat;
@ -250,8 +265,10 @@ $name = array();
// Show Array // Show Array
$catotal = 0; $catotal = 0;
$catotal_ht = 0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,"; $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.fk_pays,";
$sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc"; $sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) { // Without any category if ($selected_cat === -2) { // Without any category
@ -281,10 +298,10 @@ if ($modecompta == 'CREANCES-DETTES') {
} }
} elseif ($modecompta == "RECETTES-DEPENSES") { } elseif ($modecompta == "RECETTES-DEPENSES") {
/* /*
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * List of payments (old payments are not seen by this query because on older versions,
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) * they were not linked via the table llx_paiement_facture. They are added later)
*/ */
$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc"; $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql .= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql .= ", ".MAIN_DB_PREFIX."paiement as p"; $sql .= ", ".MAIN_DB_PREFIX."paiement as p";
@ -344,7 +361,11 @@ if ($result) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$amount_ht[$obj->socid] = $obj->amount; $amount_ht[$obj->socid] = $obj->amount;
$amount[$obj->socid] = $obj->amount_ttc; $amount[$obj->socid] = $obj->amount_ttc;
$name[$obj->socid] = $obj->name.' '.$obj->firstname; $fullname = $obj->name;
if (!empty($obj->name_alias)) {
$fullname .= ' ('.$obj->name_alias.')';
}
$name[$obj->socid] = $fullname;
$address_zip[$obj->socid] = $obj->zip; $address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town; $address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays); $address_pays[$obj->socid] = getCountry($obj->fk_pays);
@ -356,7 +377,7 @@ if ($result) {
dol_print_error($db); dol_print_error($db);
} }
// On ajoute les paiements anciennes version, non lies par paiement_facture // We add the old versions of payments, not linked by table llx_paiement_facture
if ($modecompta == "RECETTES-DEPENSES") { if ($modecompta == "RECETTES-DEPENSES") {
$sql = "SELECT '0' as socid, 'Autres' as name, sum(p.amount) as amount_ttc"; $sql = "SELECT '0' as socid, 'Autres' as name, sum(p.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -409,7 +430,7 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
// Category filter // Category filter
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td class="nowraponall">';
print img_picto('', 'category', 'class="paddingrightonly"'); print img_picto('', 'category', 'class="paddingrightonly"');
print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', 0, $langs->trans("Category")); print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' '; print ' ';
@ -435,7 +456,7 @@ print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">'; print '<input class="flat" size="6" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print $form->select_country($search_country, 'search_country'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
//print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">'; //print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';