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 ''; + $form->select_conditions_paiements($search_paymentterms, 'search_paymentterms', -1, 1, 1); + print ''; + } if (! empty($arrayfields['f.total_ht']['checked'])) { // Amount @@ -869,6 +881,7 @@ if ($resql) if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder); + if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder); @@ -1081,6 +1094,15 @@ if ($resql) if (! $i) $totalarray['nbfield']++; } + // Payment terms + if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) + { + print ''; + $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none'); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) {