FIX List of invoice waiting for direct debit
This commit is contained in:
parent
9d4e672475
commit
eefa2bcaba
@ -107,14 +107,17 @@ if ($type != 'bank-transfer') {
|
|||||||
llxHeader('', $title);
|
llxHeader('', $title);
|
||||||
|
|
||||||
$thirdpartystatic = new Societe($db);
|
$thirdpartystatic = new Societe($db);
|
||||||
$invoicestatic = new Facture($db);
|
if ($type == 'bank-transfer') {
|
||||||
|
$invoicestatic = new FactureFournisseur($db);
|
||||||
|
} else {
|
||||||
|
$invoicestatic = new Facture($db);
|
||||||
|
}
|
||||||
|
|
||||||
// List of requests
|
// List of requests
|
||||||
|
|
||||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc,";
|
$sql = "SELECT f.ref, f.rowid, f.total_ttc,";
|
||||||
$sql .= " s.nom as name, s.rowid as socid,";
|
$sql .= " s.nom as name, s.rowid as socid,";
|
||||||
$sql .= " pfd.date_demande as date_demande,";
|
$sql .= " pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande";
|
||||||
$sql .= " pfd.fk_user_demande";
|
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||||
} else {
|
} else {
|
||||||
@ -128,6 +131,7 @@ $sql .= " AND f.entity IN (".getEntity('invoice').")";
|
|||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||||
if (!$status) $sql .= " AND pfd.traite = 0";
|
if (!$status) $sql .= " AND pfd.traite = 0";
|
||||||
|
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||||
if ($status) $sql .= " AND pfd.traite = ".$status;
|
if ($status) $sql .= " AND pfd.traite = ".$status;
|
||||||
$sql .= " AND f.total_ttc > 0";
|
$sql .= " AND f.total_ttc > 0";
|
||||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||||
@ -143,7 +147,6 @@ if ($search_facture) $sql .= natural_search("f.ref", $search_facture);
|
|||||||
if ($search_societe) $sql .= natural_search("s.nom", $search_societe);
|
if ($search_societe) $sql .= natural_search("s.nom", $search_societe);
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
|
|
||||||
// Count total nb of records
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
@ -207,7 +210,7 @@ print '<table class="liste centpercent">';
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
|
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]);
|
||||||
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
|
print_liste_field_titre("Company", $_SERVER["PHP_SELF"]);
|
||||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
|
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right ');
|
||||||
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
|
print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
|
||||||
print_liste_field_titre('');
|
print_liste_field_titre('');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -230,12 +233,12 @@ while ($i < min($num, $limit))
|
|||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if (empty($obj)) break; // Should not happen
|
if (empty($obj)) break; // Should not happen
|
||||||
|
|
||||||
|
$invoicestatic->fetch($obj->rowid);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Ref facture
|
// Ref facture
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$invoicestatic->id = $obj->rowid;
|
|
||||||
$invoicestatic->ref = $obj->ref;
|
|
||||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -245,7 +248,9 @@ while ($i < min($num, $limit))
|
|||||||
print $thirdpartystatic->getNomUrl(1, 'customer');
|
print $thirdpartystatic->getNomUrl(1, 'customer');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
print '<td class="right">';
|
||||||
|
print price($obj->amount, 1, $langs, 1, -1, -1, $conf->currency).' / '.price($obj->total_ttc, 1, $langs, 1, -1, -1, $conf->currency);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_demande), 'day').'</td>';
|
print '<td class="center">'.dol_print_date($db->jdate($obj->date_demande), 'day').'</td>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user