diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 99f3a0ba082..4cac0678f4e 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -367,6 +367,7 @@ $now=dol_now();
$search_ref = GETPOST("search_ref");
$search_refcustomer=GETPOST('search_refcustomer');
$search_societe = GETPOST("search_societe");
+$search_paymentmode = GETPOST("search_paymentmode");
$search_montant_ht = GETPOST("search_montant_ht");
$search_montant_ttc = GETPOST("search_montant_ttc");
$late = GETPOST("late");
@@ -386,7 +387,7 @@ $limit = $conf->liste_limit;
$sql = "SELECT s.nom, s.rowid as socid, s.email";
$sql.= ", f.rowid as facid, f.facnumber, f.ref_client, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp";
$sql.= ", f.datef as df, f.date_lim_reglement as datelimite";
-$sql.= ", f.paye as paye, f.fk_statut, f.type";
+$sql.= ", f.paye as paye, f.fk_statut, f.type, f.fk_mode_reglement";
$sql.= ", sum(pf.amount) as am";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@@ -412,6 +413,7 @@ if (GETPOST('filtre'))
if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$db->escape($search_ref)."%'";
if ($search_refcustomer) $sql .= " AND f.ref_client LIKE '%".$db->escape($search_refcustomer)."%'";
if ($search_societe) $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
+if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
@@ -441,6 +443,7 @@ if ($resql)
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_refcustomer) $param.='&search_ref='.urlencode($search_refcustomer);
if ($search_societe) $param.='&search_societe='.urlencode($search_societe);
+ if ($search_societe) $param.='&search_paymentmode='.urlencode($search_paymentmode);
if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
if ($late) $param.='&late='.urlencode($late);
@@ -530,6 +533,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"f.fk_reglement_mode","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
@@ -557,6 +561,9 @@ if ($resql)
print '
| ';
print ' | ';
print ' | ';
+ print '';
+ $form->select_types_paiements($search_paymentmode, 'search_paymentmode');
+ print ' | ';
print ' | ';
print ' | ';
print ' | ';
@@ -636,7 +643,20 @@ if ($resql)
print ''.dol_print_date($db->jdate($objp->df),'day').' | '."\n";
print ''.dol_print_date($db->jdate($objp->datelimite),'day').' | '."\n";
- print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,28).' | ';
+ print '';
+ $thirdparty=new Societe($db);
+ $thirdparty->id=$objp->socid;
+ $thirdparty->nom=$objp->nom;
+ $thirdparty->client=$objp->client;
+ $thirdparty->code_client=$objp->code_client;
+ print $thirdparty->getNomUrl(1,'customer');
+ print ' | ';
+
+ // Payment mode
+ print '';
+ $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none');
+ print ' | ';
+
print ''.price($objp->total_ht).' | ';
print ''.price($objp->total_tva);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 3532125ed8e..92214e2f9d5 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -64,6 +64,7 @@ $userid=GETPOST('userid','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
$search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_societe=GETPOST('search_societe','alpha');
+$search_paymentmode=GETPOST('search_paymentmode','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('search_status','alpha');
@@ -142,7 +143,7 @@ if (! $sall) $sql = 'SELECT';
else $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
-$sql.= ' f.paye as paye, f.fk_statut,';
+$sql.= ' f.paye as paye, f.fk_statut, f.fk_mode_reglement, ';
$sql.= ' s.nom, s.rowid as socid, s.code_client, s.client ';
if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
@@ -186,6 +187,10 @@ if ($search_societe)
{
$sql .= natural_search('s.nom', $search_societe);
}
+if ($search_paymentmode)
+{
+ $sql.= ' AND f.fk_mode_reglement = '.$search_paymentmode;
+}
if ($search_montant_ht)
{
$sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
@@ -260,6 +265,7 @@ if ($resql)
if ($search_ref) $param.='&search_ref=' .$search_ref;
if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer;
if ($search_societe) $param.='&search_societe=' .$search_societe;
+ if ($search_societe) $param.='&search_paymentmode=' .$search_paymentmode;
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
@@ -288,7 +294,7 @@ if ($resql)
if ($moreforfilter)
{
print ' | ';
- print '| ';
+ print ' | ';
print $moreforfilter;
print ' |
';
}
@@ -299,6 +305,7 @@ if ($resql)
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans('PaymentMode'),$_SERVER['PHP_SELF'],'f.fk_mode_reglement','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountVAT'),$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
@@ -322,6 +329,10 @@ if ($resql)
print '';
print ' | ';
print ' | ';
+ print '';
+ $form->select_types_paiements($search_paymentmode, 'search_paymentmode');
+ print ' | ';
+
print ' | ';
print ' | ';
print ' | ';
@@ -404,6 +415,11 @@ if ($resql)
print $thirdparty->getNomUrl(1,'customer');
print '';
+ // Payment mode
+ print '';
+ $form->form_modes_reglement($_SERVER['PHP_SELF'], $objp->fk_mode_reglement, 'none');
+ print ' | ';
+
print ''.price($objp->total_ht,0,$langs).' | ';
print ''.price($objp->total_tva,0,$langs).' | ';