Fix : link to invoice list + SQL was bad when several invoices had the same amount on the same thirdparty
This commit is contained in:
parent
c7f3778b90
commit
bc0a52fa71
@ -173,7 +173,7 @@ $catotal=0;
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,";
|
||||
$sql.= " sum(DISTINCT l.total_ht) as amount, sum(DISTINCT l.total_ttc) as amount_ttc";
|
||||
$sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON l.fk_facture = f.rowid";
|
||||
|
||||
@ -177,7 +177,7 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
|
||||
$catotal=0;
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,";
|
||||
$sql.= " sum(DISTINCT f.total) as amount, sum(DISTINCT f.total_ttc) as amount_ttc";
|
||||
$sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f";
|
||||
if ($selected_cat === -2) {
|
||||
@ -227,6 +227,7 @@ $sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY s.rowid, s.nom";
|
||||
$sql.= " ORDER BY s.rowid";
|
||||
echo $sql;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
@ -406,13 +407,13 @@ if (count($amount)) {
|
||||
print '<td align="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid='.$key.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?socid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid=-1">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?socid=-1">';
|
||||
}
|
||||
} else {
|
||||
if ($key > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user