Merge pull request #14636 from TobiasSekan/AddTableHelperMethod

NEW Add helper function for table headers with numbers
This commit is contained in:
Laurent Destailleur 2020-09-12 01:21:24 +02:00 committed by GitHub
commit fab3a774d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 531 additions and 507 deletions

View File

@ -5,6 +5,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com> * Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* *
* 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
@ -52,8 +53,7 @@ $bid = GETPOST('bid', 'int');
// Securite acces client // Securite acces client
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
if (isset($user->socid) && $user->socid > 0) if (isset($user->socid) && $user->socid > 0) {
{
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
@ -84,48 +84,39 @@ print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial');
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
{
// Search proposal // Search proposal
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
{
$listofsearchfields['search_proposal'] = array('text'=>'Proposal'); $listofsearchfields['search_proposal'] = array('text'=>'Proposal');
} }
// Search customer order // Search customer order
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
{
$listofsearchfields['search_customer_order'] = array('text'=>'CustomerOrder'); $listofsearchfields['search_customer_order'] = array('text'=>'CustomerOrder');
} }
// Search supplier proposal // Search supplier proposal
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
{
$listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort'); $listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort');
} }
// Search supplier order // Search supplier order
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) {
{
$listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder'); $listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder');
} }
// Search intervention // Search intervention
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) {
{
$listofsearchfields['search_intervention'] = array('text'=>'Intervention'); $listofsearchfields['search_intervention'] = array('text'=>'Intervention');
} }
// Search contract // Search contract
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
{
$listofsearchfields['search_contract'] = array('text'=>'Contract'); $listofsearchfields['search_contract'] = array('text'=>'Contract');
} }
if (count($listofsearchfields)) if (count($listofsearchfields)) {
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">'; print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
$i = 0; $i = 0;
foreach ($listofsearchfields as $key => $value) foreach ($listofsearchfields as $key => $value) {
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr '.$bc[false].'>'; print '<tr '.$bc[false].'>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>'; print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
@ -144,8 +135,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
/* /*
* Draft customer proposals * Draft customer proposals
*/ */
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
{
$langs->load("propal"); $langs->load("propal");
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
@ -163,34 +153,25 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
if ($socid) $sql .= " AND s.rowid = ".$socid; if ($socid) $sql .= " AND s.rowid = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$total = 0; $total = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("ProposalsDraft").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?search_status=0"><span class="badge">'.$num.'</span></a></th></tr>';
if ($num > 0)
{
$i = 0;
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop) startSimpleTable("ProposalsDraft", "comm/propal/list.php", "search_status=0", 2, $num);
{
if ($num > 0) {
$i = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$propalstatic->id = $obj->rowid; $propalstatic->id = $obj->rowid;
$propalstatic->ref = $obj->ref; $propalstatic->ref = $obj->ref;
$propalstatic->ref_client = $obj->ref_client; $propalstatic->ref_client = $obj->ref_client;
$propalstatic->total_ht = $obj->total_ht; $propalstatic->total_ht = $obj->total_ht;
$propalstatic->total_tva = $obj->total_tva; $propalstatic->total_tva = $obj->total_tva;
$propalstatic->total_ttc = $obj->total_ttc; $propalstatic->total_ttc = $obj->total_ttc;
print $propalstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
@ -200,24 +181,20 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$companystatic->entity = $obj->entity; $companystatic->entity = $obj->entity;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
$companystatic->code_compta = $obj->code_compta; $companystatic->code_compta = $obj->code_compta;
print $companystatic->getNomUrl(1, 'customer', 16);
print '</td>'; print '<tr class="oddeven">';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>'; print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td>';
print '</tr>';
$i++; $i++;
$total += $obj->total_ht; $total += $obj->total_ht;
} }
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
} elseif ($total > 0)
{
print '<tr class="liste_total"><td colspan="2" class="right">'.$langs->trans("Total").'</td><td class="right">'.price($total)."</td></tr>";
} }
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table></div><br>";
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
finishSimpleTable(true);
$db->free($resql); $db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -225,12 +202,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
} }
/* /*
* Draft supplier proposals * Draft supplier proposals
*/ */
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
{
$langs->load("supplier_proposal"); $langs->load("supplier_proposal");
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
@ -248,33 +223,24 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
if ($socid) $sql .= " AND s.rowid = ".$socid; if ($socid) $sql .= " AND s.rowid = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$total = 0; $total = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").' <a href="'.DOL_URL_ROOT.'/supplier_proposal/list.php?search_status=0"><span class="badge">'.$num.'</span></a></th></tr>';
if ($num > 0)
{
$i = 0;
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop) startSimpleTable("SupplierProposalsDraft", "supplier_proposal/list.php", "search_status=0", 2, $num);
{
if ($num > 0) {
$i = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$supplierproposalstatic->id = $obj->rowid; $supplierproposalstatic->id = $obj->rowid;
$supplierproposalstatic->ref = $obj->ref; $supplierproposalstatic->ref = $obj->ref;
$supplierproposalstatic->total_ht = $obj->total_ht; $supplierproposalstatic->total_ht = $obj->total_ht;
$supplierproposalstatic->total_tva = $obj->total_tva; $supplierproposalstatic->total_tva = $obj->total_tva;
$supplierproposalstatic->total_ttc = $obj->total_ttc; $supplierproposalstatic->total_ttc = $obj->total_ttc;
print $supplierproposalstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
@ -283,24 +249,20 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity; $companystatic->entity = $obj->entity;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'supplier', 16);
print '</td>'; print '<tr class="oddeven">';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>'; print '<td class="nowrap">'.$supplierproposalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td>';
print '</tr>';
$i++; $i++;
$total += $obj->total_ht; $total += $obj->total_ht;
} }
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
} elseif ($total > 0)
{
print '<tr class="liste_total"><td class="right">'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
} }
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table></div><br>";
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
finishSimpleTable(true);
$db->free($resql); $db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -311,8 +273,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
/* /*
* Draft customer orders * Draft customer orders
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
{
$langs->load("orders"); $langs->load("orders");
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
@ -330,33 +291,25 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
if ($socid) $sql .= " AND c.fk_soc = ".$socid; if ($socid) $sql .= " AND c.fk_soc = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$total = 0; $total = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("DraftOrders").' <a href="'.DOL_URL_ROOT.'/commande/list.php?search_status=0"><span class="badge">'.$num.'</span></a></th></tr>';
if ($num > 0)
{
$i = 0;
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop) startSimpleTable("DraftOrders", "commande/list.php", "search_status=0", 2, $num);
{
if ($num > 0) {
$i = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$orderstatic->id = $obj->rowid; $orderstatic->id = $obj->rowid;
$orderstatic->ref = $obj->ref; $orderstatic->ref = $obj->ref;
$orderstatic->ref_client = $obj->ref_client; $orderstatic->ref_client = $obj->ref_client;
$orderstatic->total_ht = $obj->total_ht; $orderstatic->total_ht = $obj->total_ht;
$orderstatic->total_tva = $obj->total_tva; $orderstatic->total_tva = $obj->total_tva;
$orderstatic->total_ttc = $obj->total_ttc; $orderstatic->total_ttc = $obj->total_ttc;
print $orderstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
@ -365,29 +318,20 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
$companystatic->entity = $obj->entity; $companystatic->entity = $obj->entity;
print $companystatic->getNomUrl(1, 'customer', 16);
print '</td>'; print '<tr class="oddeven">';
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print '<td class="nowrap">'.$orderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
} else { print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '<td class="nowrap right">'.price($obj->total_ttc).'</td></tr>'; print '</tr>';
}
$i++; $i++;
$total += $obj->total_ttc; $total += $obj->total_ttc;
} }
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
} elseif ($total > 0)
{
print '<tr class="liste_total"><td class="right">'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
} }
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
}
print "</table>";
print "</div><br>";
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
finishSimpleTable(true);
$db->free($resql); $db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -398,8 +342,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
/* /*
* Draft suppliers orders * Draft suppliers orders
*/ */
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) {
{
$langs->load("orders"); $langs->load("orders");
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
@ -417,33 +360,25 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
if ($socid) $sql .= " AND cf.fk_soc = ".$socid; if ($socid) $sql .= " AND cf.fk_soc = ".$socid;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$total = 0; $total = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("DraftSuppliersOrders").' <a href="'.DOL_URL_ROOT.'/fourn/commande/list.php?search_status=0"><span class="badge">'.$num.'</span></a></th></tr>';
if ($num > 0)
{
$i = 0;
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop) startSimpleTable("DraftSuppliersOrders", "fourn/commande/list.php", "search_status=0", 2, $num);
{
if ($num > 0) {
$i = 0;
while ($i < $nbofloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$supplierorderstatic->id = $obj->rowid; $supplierorderstatic->id = $obj->rowid;
$supplierorderstatic->ref = $obj->ref; $supplierorderstatic->ref = $obj->ref;
$supplierorderstatic->ref_supplier = $obj->ref_suppliert; $supplierorderstatic->ref_supplier = $obj->ref_suppliert;
$supplierorderstatic->total_ht = $obj->total_ht; $supplierorderstatic->total_ht = $obj->total_ht;
$supplierorderstatic->total_tva = $obj->total_tva; $supplierorderstatic->total_tva = $obj->total_tva;
$supplierorderstatic->total_ttc = $obj->total_ttc; $supplierorderstatic->total_ttc = $obj->total_ttc;
print $supplierorderstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id = $obj->socid; $companystatic->id = $obj->socid;
$companystatic->name = $obj->name; $companystatic->name = $obj->name;
$companystatic->client = $obj->client; $companystatic->client = $obj->client;
@ -452,47 +387,34 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity; $companystatic->entity = $obj->entity;
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'supplier', 16);
print '</td>'; print '<tr class="oddeven">';
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print '<td class="nowrap">'.$supplierorderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap right">'.price($obj->total_ht).'</td></tr>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
} else { print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '<td class="nowrap right">'.price($obj->total_ttc).'</td></tr>'; print '</tr>';
}
$i++; $i++;
$total += $obj->total_ttc; $total += $obj->total_ttc;
} }
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
} elseif ($total > 0)
{
print '<tr class="liste_total"><td class="right">'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
} }
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</td></tr>';
}
print "</table>";
print "</div><br>";
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
finishSimpleTable(true);
$db->free($resql); $db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max = 3; $max = 3;
/* /*
* Last modified customers or prospects * Last modified customers or prospects
*/ */
if (!empty($conf->societe->enabled) && $user->rights->societe->lire) if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
{
$langs->load("boxes"); $langs->load("boxes");
$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
@ -510,26 +432,26 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$header = "BoxTitleLastCustomersOrProspects";
}
elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$header = "BoxTitleLastModifiedProspects";
}
else {
$header = "BoxTitleLastModifiedCustomers";
}
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
startSimpleTable($langs->trans($header, min($max, $num)), "societe/list.php", "type=p,c", 1);
if ($num) {
$i = 0; $i = 0;
print '<div class="div-table-responsive-no-min">'; while ($i < $num && $i < $max) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="2">';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects", $max);
elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects", $max);
else print $langs->trans("BoxTitleLastModifiedCustomers", $max);
print '</th>';
print '<th class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=p,c">'.$langs->trans("FullList").'</a></th>';
print '</tr>';
if ($num)
{
while ($i < $num)
{
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$companystatic->id = $objp->rowid; $companystatic->id = $objp->rowid;
$companystatic->name = $objp->name; $companystatic->name = $objp->name;
$companystatic->client = $objp->client; $companystatic->client = $objp->client;
@ -539,28 +461,30 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
$companystatic->code_compta = $objp->code_compta; $companystatic->code_compta = $objp->code_compta;
$companystatic->entity = $objp->entity; $companystatic->entity = $objp->entity;
$companystatic->email = $objp->email; $companystatic->email = $objp->email;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>';
print '<td class="right" nowrap>'; print '<td class="right" nowrap>'.$companystatic->getLibCustProspStatut().'</td>';
print $companystatic->getLibCustProspStatut(); print '<td class="right" nowrap>'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
print "</td>";
print '<td class="right" nowrap>'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
print '</tr>'; print '</tr>';
$i++; $i++;
} }
}
addSummaryTableLine(3, $num);
finishSimpleTable(true);
$db->free($resql); $db->free($resql);
} else { } else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; dol_print_error($db);
}
print "</table>";
print "</div><br>";
} }
} }
// Last suppliers
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) /*
{ * Last suppliers
*/
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) {
$langs->load("boxes"); $langs->load("boxes");
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm";
@ -576,23 +500,16 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$sql .= " ORDER BY s.datec DESC"; $sql .= " ORDER BY s.datec DESC";
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql) {
{ $num = $db->num_rows($resql);
$num = $db->num_rows($result); startSimpleTable($langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)), "societe/list.php", "type=f");
$i = 0;
if ($num) {
$i = 0;
while ($i < $num && $i < $max) {
$objp = $db->fetch_object($resql);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)).'</th>';
print '<th class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("FullList").'</a></th>';
print '</tr>';
if ($num)
{
while ($i < $num && $i < $max)
{
$objp = $db->fetch_object($result);
$companystatic->id = $objp->rowid; $companystatic->id = $objp->rowid;
$companystatic->name = $objp->name; $companystatic->name = $objp->name;
$companystatic->code_client = $objp->code_client; $companystatic->code_client = $objp->code_client;
@ -600,6 +517,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
$companystatic->entity = $objp->entity; $companystatic->entity = $objp->entity;
$companystatic->email = $objp->email; $companystatic->email = $objp->email;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>'; print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
@ -607,11 +525,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++; $i++;
} }
} else {
print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
print '</table>';
print '</div><br>'; addSummaryTableLine(2, $num);
finishSimpleTable(true);
$db->free($resql);
} else {
dol_print_error($db);
} }
} }
@ -619,8 +539,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
/* /*
* Last actions * Last actions
*/ */
if ($user->rights->agenda->myactions->read) if ($user->rights->agenda->myactions->read) {
{
show_array_last_actions_done($max); show_array_last_actions_done($max);
} }
@ -628,8 +547,7 @@ if ($user->rights->agenda->myactions->read)
/* /*
* Actions to do * Actions to do
*/ */
if ($user->rights->agenda->myactions->read) if ($user->rights->agenda->myactions->read) {
{
show_array_actions_to_do(10); show_array_actions_to_do(10);
} }
@ -637,8 +555,7 @@ if ($user->rights->agenda->myactions->read)
/* /*
* Latest contracts * Latest contracts
*/ */
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
{
$langs->load("contracts"); $langs->load("contracts");
$sql = "SELECT s.nom as name, s.rowid, s.canvas, "; $sql = "SELECT s.nom as name, s.rowid, s.canvas, ";
@ -659,24 +576,17 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
$sql .= $db->plimit(5, 0); $sql .= $db->plimit(5, 0);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
startSimpleTable($langs->trans("LastContracts", 5), "", "", 2);
if ($num > 0) if ($num > 0) {
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("LastContracts", 5).'</th></tr>';
$i = 0; $i = 0;
$staticcontrat = new Contrat($db); $staticcontrat = new Contrat($db);
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), "contract")." ".$obj->ref."</a></td>';
print '<td>';
$companystatic->id = $objp->rowid; $companystatic->id = $objp->rowid;
$companystatic->name = $objp->name; $companystatic->name = $objp->name;
$companystatic->code_client = $objp->code_client; $companystatic->code_client = $objp->code_client;
@ -684,25 +594,30 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
$companystatic->entity = $objp->entity; $companystatic->entity = $objp->entity;
$companystatic->email = $objp->email; $companystatic->email = $objp->email;
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>'."\n"; print '<tr class="oddeven">';
print "<td class=\"right\">".$staticcontrat->LibStatut($obj->statut, 3)."</td></tr>\n"; print '<td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), "contract")." ".$obj->ref."</a></td>';
print '<td>'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).'</td>';
print '</tr>';
$i++; $i++;
} }
print "</table>";
print "</div><br>";
} }
addSummaryTableLine(2, $num);
finishSimpleTable(true);
$db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
/* /*
* Opened proposals * Opened proposals
*/ */
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
{
$langs->load("propal"); $langs->load("propal");
$sql = "SELECT s.nom as name, s.rowid, s.code_client"; $sql = "SELECT s.nom as name, s.rowid, s.code_client";
@ -719,27 +634,18 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
if ($socid) $sql .= " AND s.rowid = ".$socid; if ($socid) $sql .= " AND s.rowid = ".$socid;
$sql .= " ORDER BY p.rowid DESC"; $sql .= " ORDER BY p.rowid DESC";
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql) {
{
$total = 0; $total = 0;
$num = $db->num_rows($result); $num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?search_status=1"><span class="badge">'.$num.'</span></th></tr>';
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop) startSimpleTable("ProposalsOpened", "comm/propal/list.php", "search_status=1", 4, $num);
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">'; if ($num > 0) {
$i = 0;
// Ref while ($i < $nbofloop) {
print '<td class="nowrap" width="140">'; $obj = $db->fetch_object($resql);
$propalstatic->id = $obj->propalid; $propalstatic->id = $obj->propalid;
$propalstatic->ref = $obj->ref; $propalstatic->ref = $obj->ref;
@ -748,6 +654,19 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$propalstatic->total_tva = $obj->total_tva; $propalstatic->total_tva = $obj->total_tva;
$propalstatic->total_ttc = $obj->total_ttc; $propalstatic->total_ttc = $obj->total_ttc;
$companystatic->id = $obj->rowid;
$companystatic->name = $obj->name;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $propalstatic->getNomUrl(1); print $propalstatic->getNomUrl(1);
@ -761,52 +680,33 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>"; print "</td>";
print '<td class="nowrap">'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
$companystatic->id = $obj->rowid; print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
$companystatic->name = $obj->name; print '<td class="right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
$companystatic->client = $obj->client; print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>';
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur; print '</tr>';
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>';
print '<td class="right">';
print dol_print_date($db->jdate($obj->dp), 'day').'</td>'."\n";
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td class="right">'.price($obj->total_ht).'</td>';
} else {
print '<td class="right">'.price($obj->total_ttc).'</td>';
}
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>'."\n";
print '</tr>'."\n";
$i++; $i++;
$total += $obj->total_ttc; $total += $obj->total_ttc;
} }
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="5" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
} elseif ($total > 0)
{
print '<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans("Total")."</td><td class=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
}
print "</table>";
print "</div><br>";
} }
addSummaryTableLine(5, $num, $nbofloop, $total, "NoProposal", true);
finishSimpleTable(true);
$db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
/* /*
* Opened Order * Opened Order
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
{
$langs->load("orders"); $langs->load("orders");
$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
@ -823,27 +723,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
if ($socid) $sql .= " AND s.rowid = ".$socid; if ($socid) $sql .= " AND s.rowid = ".$socid;
$sql .= " ORDER BY c.rowid DESC"; $sql .= " ORDER BY c.rowid DESC";
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql) {
{
$total = 0; $total = 0;
$num = $db->num_rows($result); $num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th class="liste_titre" colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?search_status=1"><span class="badge">'.$num.'</span></th></tr>';
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop) startSimpleTable("OrdersOpened", "commande/list.php", "search_status=1", 4, $num);
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">'; if ($num > 0) {
$i = 0;
// Ref while ($i < $nbofloop) {
print '<td class="nowrap" width="140">'; $obj = $db->fetch_object($resql);
$orderstatic->id = $obj->commandeid; $orderstatic->id = $obj->commandeid;
$orderstatic->ref = $obj->ref; $orderstatic->ref = $obj->ref;
@ -852,6 +743,19 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$orderstatic->total_tva = $obj->total_tva; $orderstatic->total_tva = $obj->total_tva;
$orderstatic->total_ttc = $obj->total_ttc; $orderstatic->total_ttc = $obj->total_ttc;
$companystatic->id = $obj->rowid;
$companystatic->name = $obj->name;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print '<tr class="oddeven">';
// Ref
print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $orderstatic->getNomUrl(1); print $orderstatic->getNomUrl(1);
@ -865,49 +769,27 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid; $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>"; print "</td>";
print '<td class="nowrap">'; print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
$companystatic->id = $obj->rowid; print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
$companystatic->name = $obj->name; print '<td class="right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
$companystatic->client = $obj->client; print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>';
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas = $obj->canvas;
$companystatic->entity = $obj->entity;
$companystatic->email = $obj->email;
print $companystatic->getNomUrl(1, 'customer', 44);
print '</td>';
print '<td class="right">';
print dol_print_date($db->jdate($obj->dp), 'day').'</td>'."\n";
if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td class="right">'.price($obj->total_ht).'</td>';
} else {
print '<td class="right">'.price($obj->total_ttc).'</td>';
}
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";
$i++; $i++;
$total += $obj->total_ttc; $total += $obj->total_ttc;
} }
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="5" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
} elseif ($total > 0)
{
print '<tr class="liste_total"><td colspan="3" class="right">'.$langs->trans("Total")."</td><td class=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
}
print "</table>";
print "</div><br>";
} }
addSummaryTableLine(5, $num, $nbofloop, $num, $total, "None", true);
finishSimpleTable(true);
$db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
print '</div></div></div>'; print '</div></div></div>';
$parameters = array('user' => $user); $parameters = array('user' => $user);

View File

@ -8667,3 +8667,145 @@ function currentToken()
{ {
return $_SESSION['token']; return $_SESSION['token'];
} }
/**
* Start a table with headers and a optinal clickable number
* (don't forget to use "finishSimpleTable()" after the last table row)
*
* @see finishSimpleTable
*
* @param string $header The first left header of the table (automatic translated)
* @param string $link (optional) The link to a internal dolibarr page, when click on the number (without the first "/")
* @param string $arguments (optional) Additional arguments for the link (e.g. "search_status=0")
* @param integer $emptyRows (optional) The count of empty rows after the first header
* @param integer $number (optional) The number that is shown right after the first header, when not set the link is shown on the right side of the header as "FullList"
* @return void
*/
function startSimpleTable($header, $link = "", $arguments = "", $emptyRows = 0, $number = -1)
{
global $langs;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print $emptyRows < 1 ? '<th>' : '<th colspan="'.($emptyRows + 1).'">';
print $langs->trans($header);
// extra space between the first header and the number
if ($number > -1) {
print ' ';
}
if (!empty($link)) {
if (!empty($arguments)) {
print '<a href="'.DOL_URL_ROOT.'/'.$link.'?'.$arguments.'">';
} else {
print '<a href="'.DOL_URL_ROOT.'/'.$link.'">';
}
}
if ($number > -1) {
print '<span class="badge">'.$number.'</span>';
}
if (!empty($link)) {
print '</a>';
}
print '</th>';
if ($number < 0 && !empty($link)) {
print '<th class="right">';
if (!empty($arguments)) {
print '<a class="commonlink" href="'.DOL_URL_ROOT.'/'.$link.'?'.$arguments.'">';
} else {
print '<a class="commonlink" href="'.DOL_URL_ROOT.'/'.$link.'">';
}
print $langs->trans("FullList");
print '</a>';
print '</th>';
}
print '</tr>';
}
/**
* Add the correct HTML close tags for "startSimpleTable(...)"
* (use after the last table line)
*
* @see startSimpleTable
*
* @param bool $addLineBreak (optional) Add a extra line break after the complete table (\<br\>)
*
* @return void
*/
function finishSimpleTable($addLineBreak = false)
{
print '</table>';
print '</div>';
if ($addLineBreak) {
print '<br>';
}
}
/**
* Add a summary line to the current open table ("None", "XMoreLines" or "Total xxx")
*
* @param integer $tableColumnCount The complete count columns of the table
* @param integer $num The count of the rows of the table, when it is zero (0) the "$noneWord" is shown instead
* @param integer $nbofloop (optional) The maximum count of rows thaht the table show (when it is zero (0) no summary line will show, expect "$noneWord" when $num === 0)
* @param integer $total (optional) The total value thaht is shown after when the table has minimum of one entire
* @param string $noneWord (optional) The word that is shown when the table has no entires ($num === 0)
* @param boolean $extraRightColumn (optional) Add a addtional column after the summary word and total number
* @return void
*/
function addSummaryTableLine($tableColumnCount, $num, $nbofloop = 0, $total = 0, $noneWord = "None", $extraRightColumn = false)
{
global $langs;
if ($num === 0) {
print '<tr class="oddeven">';
print '<td colspan="'.$tableColumnCount.'" class="opacitymedium">'.$langs->trans($noneWord).'</td>';
print '</tr>';
return;
}
if ($nbofloop === 0)
{
// don't show a summary line
return;
}
if ($num === 0) {
$colspan = $tableColumnCount;
}
elseif ($num > $nbofloop) {
$colspan = $tableColumnCount;
} else {
$colspan = $tableColumnCount - 1;
}
if ($extraRightColumn) {
$colspan--;
}
print '<tr class="liste_total">';
if ($nbofloop > 0 && $num > $nbofloop) {
print '<td colspan="'.$colspan.'" class="right">'.$langs->trans("XMoreLines", ($num - $nbofloop)).'</td>';
} else {
print '<td colspan="'.$colspan.'" class="right"> '.$langs->trans("Total").'</td>';
print '<td class="right" width="100">'.price($total).'</td>';
}
if ($extraRightColumn) {
print '<td></td>';
}
print '</tr>';
}