diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 749a0b28cfb..d978ddb62e5 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -82,6 +82,7 @@ $search_montant_localtax2=GETPOST('search_montant_localtax2', 'alpha'); $search_montant_ttc=GETPOST('search_montant_ttc', 'alpha'); $search_status=GETPOST('search_status', 'intcomma'); $search_paymentmode=GETPOST('search_paymentmode', 'int'); +$search_paymentterms=GETPOST('search_paymentterms', 'int'); $search_town=GETPOST('search_town', 'alpha'); $search_zip=GETPOST('search_zip', 'alpha'); $search_state=trim(GETPOST("search_state")); @@ -162,6 +163,7 @@ $arrayfields=array( 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), 'f.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>1), + 'f.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>1), 'f.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'f.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj=="1")), @@ -214,6 +216,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_montant_ttc=''; $search_status=''; $search_paymentmode=''; + $search_paymentterms=''; $search_town=''; $search_zip=""; $search_state=""; @@ -359,7 +362,7 @@ $thirdpartystatic=new Societe($db); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; +$sql.= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.paye as paye, f.fk_statut,'; @@ -451,6 +454,7 @@ if ($search_status != '-1' && $search_status != '') } } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); +if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); $sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); $sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; @@ -468,7 +472,7 @@ $sql.=$hookmanager->resPrint; if (! $sall) { - $sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,'; + $sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total, f.tva, f.total_ttc,'; $sql.= ' f.localtax1, f.localtax2,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; @@ -562,6 +566,7 @@ if ($resql) if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); + if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); if ($show_files) $param.='&show_files='.urlencode($show_files); if ($option) $param.="&search_option=".urlencode($option); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -776,6 +781,13 @@ if ($resql) $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); print ''; } + // Payment terms + if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) + { + print '