Show due days in not payed supplier bills
This commit is contained in:
parent
0fe39d4e4b
commit
2999d0b37a
@ -56,6 +56,7 @@ $search_ref_supplier = GETPOST('search_ref_supplier','alpha');
|
||||
$search_company = GETPOST('search_company','alpha');
|
||||
$search_amount_no_tax = GETPOST('search_amount_no_tax','alpha');
|
||||
$search_amount_all_tax = GETPOST('search_amount_all_tax','alpha');
|
||||
$search_duedays = GETPOST('search_duedays','alpha');
|
||||
|
||||
$op1month=GETPOST('op1month');
|
||||
$op1day=GETPOST('op1day');
|
||||
@ -90,6 +91,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$op2day="";
|
||||
$op2year="";
|
||||
$filter_op2="";
|
||||
$duedays="";
|
||||
}
|
||||
|
||||
/*
|
||||
@ -111,6 +113,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql.= " f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc,";
|
||||
$sql.= " f.datef as df, f.date_lim_reglement as datelimite, ";
|
||||
$sql.= " DATEDIFF(f.date_lim_reglement, NOW()) as duedays, ";
|
||||
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut";
|
||||
$sql.= " ,sum(pf.amount) as am";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
@ -153,11 +156,16 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
$sql .= " AND s.nom LIKE '%".$search_company."%'";
|
||||
}
|
||||
|
||||
if ($search_duedays)
|
||||
{
|
||||
$sql .= " AND DATEDIFF(f.date_lim_reglement, NOW()) = '".$search_duedays."'";
|
||||
}
|
||||
|
||||
if ($search_amount_no_tax)
|
||||
{
|
||||
$sql .= " AND f.total_ht = '".$search_amount_no_tax."'";
|
||||
}
|
||||
|
||||
|
||||
if ($search_amount_all_tax)
|
||||
{
|
||||
$sql .= " AND f.total_ttc = '".$search_amount_all_tax."'";
|
||||
@ -196,6 +204,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||
if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2);
|
||||
if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||
if ($search_duedays) $param.='&search_duedays='.urlencode($search_duedays);
|
||||
|
||||
$param.=($option?"&option=".$option:"");
|
||||
if (! empty($late)) $param.='&late='.urlencode($late);
|
||||
@ -221,6 +230,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"f.ref_supplier","",$param,"",$sortfield,$sortorder);
|
||||
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("DueDays"),$_SERVER["PHP_SELF"],"duedays","",$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("AmountHT"),$_SERVER["PHP_SELF"],"f.total_ht","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@ -248,6 +258,9 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
$filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year);
|
||||
print $form->select_date($filter_date2,'op2',0,0,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_duedays" value="'.$search_duedays.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
@ -274,6 +287,16 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
$classname = "impayee";
|
||||
if ($objp->duedays <0)
|
||||
{
|
||||
$overdueclassstart="<strong>";
|
||||
$overdueclassend="</strong>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$overdueclassstart="";
|
||||
$overdueclassend="";
|
||||
}
|
||||
|
||||
print '<td class="nowrap">';
|
||||
$facturestatic->id=$objp->facid;
|
||||
@ -284,9 +307,10 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
print '<td class="nowrap">'.dol_trunc($objp->ref_supplier,12).'</td>';
|
||||
|
||||
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($objp->df),'day')."</td>\n";
|
||||
print '<td class="nowrap" align="center">'.dol_print_date($db->jdate($objp->datelimite),'day');
|
||||
print '<td class="nowrap" align="center">'.$overdueclassstart.dol_print_date($db->jdate($objp->datelimite),'day');
|
||||
if ($objp->datelimite && $db->jdate($objp->datelimite) < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
|
||||
print "</td>\n";
|
||||
print $overdueclassend."</td>\n";
|
||||
print "<td align=\"right\">".$overdueclassstart.$objp->duedays.$overdueclassend."</td>";
|
||||
|
||||
print '<td>';
|
||||
$companystatic->id=$objp->socid;
|
||||
@ -312,7 +336,7 @@ if ($user->rights->fournisseur->facture->lire)
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print "<td colspan=\"5\" align=\"left\">".$langs->trans("Total").": </td>";
|
||||
print "<td colspan=\"6\" align=\"left\">".$langs->trans("Total").": </td>";
|
||||
print "<td align=\"right\"><b>".price($total_ht)."</b></td>";
|
||||
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
|
||||
print "<td align=\"right\"><b>".price($total_paid)."</b></td>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user