';
print '| '.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllSendings").' '.$num.' | ';
print ''.img_picto($langs->trans("Statistics"),'stats').' | ';
@@ -868,7 +866,6 @@ if ($id > 0)
{
print '';
- $tableaushown=1;
print '';
print '| '.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).' | '.$langs->trans("AllBills").' '.$num.' | ';
print ''.img_picto($langs->trans("Statistics"),'stats').' | ';
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index cfcd0a6f746..920419a8769 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -25,6 +25,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$langs->load("companies");
if (! empty($conf->facture->enabled)) $langs->load("bills");
@@ -43,6 +44,7 @@ if ($user->societe_id > 0)
* View
*/
+$form = new Form($db);
$userstatic=new User($db);
llxHeader();
@@ -58,28 +60,7 @@ if ($socid > 0)
$head = societe_prepare_head($societe);
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
-
- print "\n";
- print '';
-
- print '';
-
- // Name
- print '| '.$langs->trans("Name").' | '.$societe->name.' | ';
-
- // Prefix
- if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
- {
- print '| '.$langs->trans("Prefix").' | ';
- print ($societe->prefix_comm?$societe->prefix_comm:' ');
- print ' | ';
- }
-
- print " ";
-
- print " | \n";
-
- print '';
+ dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
@@ -87,6 +68,18 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("CustomerPreview"));
print '';
+ print '';
+ print '| '.$langs->trans("Date").' | ';
+ print ''.$langs->trans("Element").' | ';
+ print ''.$langs->trans("Status").' | ';
+ print ''.$langs->trans("Debit").' | ';
+ print ''.$langs->trans("Credit").' | ';
+ print ''.$langs->trans("Balance").' | ';
+ print ''.$langs->trans("Author").' | ';
+ print ' ';
+
+ $TData = array();
+ $TDataSort = array();
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
@@ -95,7 +88,7 @@ if ($socid > 0)
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.fk_user_valid = u.rowid";
- $sql.= " ORDER BY f.datef DESC";
+ $sql.= " ORDER BY f.datef ASC";
$resql=$db->query($sql);
if ($resql)
@@ -103,23 +96,6 @@ if ($socid > 0)
$var=true;
$num = $db->num_rows($resql);
- print '';
- print '| '.$langs->trans("Date").' | ';
- print ' | ';
- print ''.$langs->trans("Status").' | ';
- print ''.$langs->trans("Debit").' | ';
- print ''.$langs->trans("Credit").' | ';
- print ''.$langs->trans("Balance").' | ';
- print ' | ';
- print ' ';
-
- if (! $num > 0)
- {
- print '| '.$langs->trans("NoInvoice").' | ';
- }
-
- $solde = 0;
-
// Boucle sur chaque facture
for ($i = 0 ; $i < $num ; $i++)
{
@@ -133,29 +109,18 @@ if ($socid > 0)
continue;
}
$totalpaye = $fac->getSommePaiement();
-
- $var=!$var;
- print "";
-
- print "| ".dol_print_date($fac->date,'day')." | \n";
- print ''.img_object($langs->trans("ShowBill"),"bill")." ".$fac->ref." | \n";
-
- print ''.$fac->getLibStatut(2,$totalpaye).' | ';
- print ''.price($fac->total_ttc)." | \n";
- if (($fac->statut == Facture::STATUS_ABANDONED ) || ($fac->statut == Facture::STATUS_CLOSED && ! $fact->close_code) ) $solde = $solde = $solde + $totalpaye;
- else $solde = $solde + $fac->total_ttc;
-
- print ' | ';
- print ''.price($solde)." | \n";
-
- // Author
+
$userstatic->id=$objf->userid;
$userstatic->login=$objf->login;
- print '';
- print $userstatic->getLoginUrl(1);
- print ' | ';
-
- print " \n";
+
+ $TData[] = array(
+ 'date' => $fac->date,
+ 'link' => $fac->getNomUrl(1),
+ 'status' => $fac->getLibStatut(2,$totalpaye),
+ 'amount' => $fac->total_ttc,
+ 'author' => $userstatic->getLoginUrl(1)
+ );
+ $TDataSort[] = $fac->date;
// Paiements
$sql = "SELECT p.rowid, p.datep as dp, pf.amount, p.statut,";
@@ -166,6 +131,7 @@ if ($socid > 0)
$sql.= " WHERE pf.fk_paiement = p.rowid";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND pf.fk_facture = ".$fac->id;
+ $sql.= " ORDER BY p.datep ASC";
$resqlp = $db->query($sql);
if ($resqlp)
@@ -176,26 +142,21 @@ if ($socid > 0)
while ($j < $nump)
{
$objp = $db->fetch_object($resqlp);
- //$var=!$var;
- print "";
- print '| '.dol_print_date($db->jdate($objp->dp),'day')." | \n";
- print '';
- print ' '; // Decalage
- print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.' | ';
- print " | \n";
- print " | \n";
- print ''.price($objp->amount).' | ';
- $solde = $solde - $objp->amount;
- print ''.price($solde)." | \n";
-
- // Author
+
+ $paymentstatic = new Paiement($db);
+ $paymentstatic->id = $objp->rowid;
+
$userstatic->id=$objp->userid;
$userstatic->login=$objp->login;
- print '';
- print $userstatic->getLoginUrl(1);
- print ' | ';
-
- print ' ';
+
+ $TData[] = array(
+ 'date' => $db->jdate($objp->dp),
+ 'link' => $langs->trans("Payment") .' '. $paymentstatic->getNomUrl(1),
+ 'status' => '',
+ 'amount' => -$objp->amount,
+ 'author' => $userstatic->getLoginUrl(1)
+ );
+ $TDataSort[] = $db->jdate($objp->dp);
$j++;
}
@@ -212,9 +173,63 @@ if ($socid > 0)
{
dol_print_error($db);
}
+
+ if(empty($TData)) {
+ print '| '.$langs->trans("NoInvoice").' | ';
+ } else {
+
+ // Sort array by date
+ asort($TDataSort);
+ array_multisort($TData,$TDataSort);
+
+ // Balance calculation
+ foreach($TData as &$data1) {
+ $balance += $data1['amount'];
+ $data1['balance'] += $balance;
+ }
+
+ // Reverse array to have last elements on top
+ $TData = array_reverse($TData);
+
+ $totalDebit = 0;
+ $totalCredit = 0;
+
+ // Display array
+ foreach($TData as $data) {
+ $var=!$var;
+ print "";
+
+ print "| ".dol_print_date($data['date'],'day')." | \n";
+ print ''.$data['link']." | \n";
+
+ print ''.$data['status'].' | ';
+ print ''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')." | \n";
+ $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0;
+ print ''.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))." | \n";
+ $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']);
+ print ''.price($data['balance'])." | \n";
+
+ // Author
+ print '';
+ print $data['author'];
+ print ' | ';
+
+ print " \n";
+ }
+
+ print '';
+ print '| | ';
+ print ''.price($totalDebit).' | ';
+ print ''.price($totalCredit).' | ';
+ print ' | ';
+ print " \n";
+ }
+
print " ";
print " ";
}
+
+ print '';
}
else
{
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index abaf5d24837..896cc0824d0 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -886,7 +886,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
} else {
$morehtmlright.=$object->getLibStatut(2);
}
- if (! empty($object->name_nalias)) $morehtmlref.=''.$object->name_alias.' ';
+ if (! empty($object->name_alias)) $morehtmlref.=''.$object->name_alias.' ';
$morehtmlref.='';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
$morehtmlref.=' ';
diff --git a/htdocs/install/mysql/data/llx_const.sql b/htdocs/install/mysql/data/llx_const.sql
index 2c25765223e..95dfb2683f9 100644
--- a/htdocs/install/mysql/data/llx_const.sql
+++ b/htdocs/install/mysql/data/llx_const.sql
@@ -53,6 +53,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_M
-- IHM
--
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_LISTE_LIMIT','25','chaine','Longueur maximum des listes',0,0);
+insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0,0);
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_SHOW_WORKBOARD','1','yesno','Affichage tableau de bord de travail Dolibarr',0,0);
insert into llx_const (name, value, type, note, visible) values ('MAIN_MENU_STANDARD','eldy_menu.php','chaine','Menu manager for internal users',0);
diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
index 670177d1e55..896714362e1 100755
--- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
+++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
@@ -20,6 +20,7 @@
INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0);
+INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0);
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
|