Correction bug #14017
This commit is contained in:
parent
62fd5f688e
commit
5d35dd22db
@ -22,10 +22,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/facture.php
|
\file htdocs/compta/facture.php
|
||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Page de création d'une facture
|
\brief Page de création d'une facture
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -36,7 +36,7 @@ $user->getrights('facture');
|
|||||||
$user->getrights('banque');
|
$user->getrights('banque');
|
||||||
|
|
||||||
if (!$user->rights->facture->lire)
|
if (!$user->rights->facture->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$langs->load("main"); // BUG De chargement de traduction ne pas modifier cette ligne
|
$langs->load("main"); // BUG De chargement de traduction ne pas modifier cette ligne
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -49,12 +49,12 @@ if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
|
|||||||
// Sécurité accés client
|
// Sécurité accés client
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socidp = $user->societe_id;
|
$socidp = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxHeader('',$langs->trans("UnpayedBills"));
|
llxHeader('',$langs->trans("BillsCustomersUnpayed"));
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -67,128 +67,127 @@ $sortfield=$_GET["sortfield"];
|
|||||||
$sortorder=$_GET["sortorder"];
|
$sortorder=$_GET["sortorder"];
|
||||||
if (! $sortfield) $sortfield="f.date_lim_reglement";
|
if (! $sortfield) $sortfield="f.date_lim_reglement";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if ($page == -1) $page = 0;
|
|
||||||
|
|
||||||
if ($user->rights->facture->lire)
|
if ($user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $page ;
|
$offset = $limit * $page ;
|
||||||
|
|
||||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.increment,f.total,f.total_ttc,";
|
$sql = "SELECT s.nom,s.idp,f.facnumber,f.increment,f.total,f.total_ttc,";
|
||||||
$sql.= $db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite, ";
|
$sql.= $db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite, ";
|
||||||
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut, sum(pf.amount) as am";
|
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut, sum(pf.amount) as am";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ",".MAIN_DB_PREFIX."facture as f";
|
$sql.= ",".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||||
$sql.= " WHERE f.fk_soc = s.idp";
|
$sql.= " WHERE f.fk_soc = s.idp";
|
||||||
$sql.= " AND f.paye = 0 AND f.fk_statut = 1";
|
$sql.= " AND f.paye = 0 AND f.fk_statut = 1";
|
||||||
if ($socidp) $sql .= " AND s.idp = $socidp";
|
if ($socidp) $sql .= " AND s.idp = $socidp";
|
||||||
|
|
||||||
if ($_GET["filtre"])
|
if ($_GET["filtre"])
|
||||||
{
|
{
|
||||||
$filtrearr = split(",", $_GET["filtre"]);
|
$filtrearr = split(",", $_GET["filtre"]);
|
||||||
foreach ($filtrearr as $fil)
|
foreach ($filtrearr as $fil)
|
||||||
{
|
{
|
||||||
$filt = split(":", $fil);
|
$filt = split(":", $fil);
|
||||||
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["search_ref"])
|
if ($_GET["search_ref"])
|
||||||
{
|
{
|
||||||
$sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'";
|
$sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["search_societe"])
|
if ($_GET["search_societe"])
|
||||||
{
|
{
|
||||||
$sql .= " AND s.nom like '%".$_GET["search_societe"]."%'";
|
$sql .= " AND s.nom like '%".$_GET["search_societe"]."%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["search_montant_ht"])
|
if ($_GET["search_montant_ht"])
|
||||||
{
|
{
|
||||||
$sql .= " AND f.total = '".$_GET["search_montant_ht"]."'";
|
$sql .= " AND f.total = '".$_GET["search_montant_ht"]."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["search_montant_ttc"])
|
if ($_GET["search_montant_ttc"])
|
||||||
{
|
{
|
||||||
$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
|
$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($_POST["sf_ref"]) > 0)
|
if (strlen($_POST["sf_ref"]) > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
|
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " GROUP BY f.facnumber";
|
$sql .= " GROUP BY f.facnumber";
|
||||||
|
|
||||||
$sql .= " ORDER BY ";
|
$sql .= " ORDER BY ";
|
||||||
$listfield=split(',',$sortfield);
|
$listfield=split(',',$sortfield);
|
||||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||||
$sql .= " f.fk_soc ASC";
|
$sql .= " f.fk_soc ASC";
|
||||||
|
|
||||||
//$sql .= $db->plimit($limit+1,$offset);
|
//$sql .= $db->plimit($limit+1,$offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($socidp);
|
$soc->fetch($socidp);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("BillsCustomersUnpayed")." ".($socidp?" $soc->nom":""),$page,"impayees.php","&socidp=$socidp",$sortfield,$sortorder,'',$num);
|
print_barre_liste($langs->trans("BillsCustomersUnpayed")." ".($socidp?" $soc->nom":""),$page,"impayees.php","&socidp=$socidp",$sortfield,$sortorder,'',$num);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socidp=$socidp","",$sortfield);
|
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socidp=$socidp","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socidp=$socidp",'align="center"',$sortfield);
|
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socidp=$socidp",'align="center"',$sortfield);
|
||||||
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socidp=$socidp",'align="center"',$sortfield);
|
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socidp=$socidp",'align="center"',$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socidp=$socidp","",$sortfield);
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socidp=$socidp","",$sortfield);
|
||||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socidp=$socidp",'align="right"',$sortfield);
|
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socidp=$socidp",'align="right"',$sortfield);
|
||||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socidp=$socidp",'align="right"',$sortfield);
|
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socidp=$socidp",'align="right"',$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socidp=$socidp",'align="right"',$sortfield);
|
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socidp=$socidp",'align="right"',$sortfield);
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","","&socidp=$socidp",'align="right"',$sortfield);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye","","&socidp=$socidp",'align="right"',$sortfield);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<form method="get" action="impayees.php">';
|
print '<form method="get" action="impayees.php">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre" valign="right">';
|
print '<td class="liste_titre" valign="right">';
|
||||||
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET["search_ref"].'"></td>';
|
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET["search_ref"].'"></td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" name="search_societe" value="'.$_GET["search_societe"].'">';
|
print '<input class="flat" type="text" name="search_societe" value="'.$_GET["search_societe"].'">';
|
||||||
print '</td><td class="liste_titre" align="right">';
|
print '</td><td class="liste_titre" align="right">';
|
||||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET["search_montant_ht"].'">';
|
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET["search_montant_ht"].'">';
|
||||||
print '</td><td class="liste_titre" align="right">';
|
print '</td><td class="liste_titre" align="right">';
|
||||||
print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$_GET["search_montant_ttc"].'">';
|
print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$_GET["search_montant_ttc"].'">';
|
||||||
print '</td><td class="liste_titre" colspan="2" align="right">';
|
print '</td><td class="liste_titre" colspan="2" align="right">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
$var=True;
|
$var=True;
|
||||||
$total=0;
|
$total=0;
|
||||||
$totalrecu=0;
|
$totalrecu=0;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
$class = "impayee";
|
$class = "impayee";
|
||||||
|
|
||||||
print '<td nowrap><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill")."</a> ";
|
print '<td nowrap><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill")."</a> ";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a>'.$objp->increment;
|
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a>'.$objp->increment;
|
||||||
if ($objp->datelimite < (time() - $warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans("Late"));
|
if ($objp->datelimite < (time() - $warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans("Late"));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user