Qual: Merge code between late unpayed invoices and unpayed invoices.
This commit is contained in:
parent
31eaa7c163
commit
c9060f817d
@ -37,6 +37,11 @@ if (!$user->rights->banque->lire)
|
||||
$statut=isset($_GET["statut"])?$_GET["statut"]:'';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
|
||||
@ -16,34 +16,54 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/facture/impayees.php
|
||||
\ingroup facture
|
||||
\brief Page de liste des factures clients impayées
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/compta/facture/impayees.php
|
||||
* \ingroup facture
|
||||
* \brief Page to list and build liste of unpayed invoices
|
||||
* \version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/fpdf/fpdfi/fpdi.php");
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
|
||||
$option = $_REQUEST["option"];
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture',$facid,'');
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("BillsCustomersUnpayed"));
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$diroutputpdf=$conf->facture->dir_output . '/unpayed/temp';
|
||||
|
||||
$title=$langs->trans("BillsCustomersUnpayed");
|
||||
if ($option=='late') $title=$langs->trans("BillsCustomersUnpayed");
|
||||
|
||||
llxHeader('',$title);
|
||||
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
?><script type="text/javascript">
|
||||
<!--
|
||||
function checkall(checked){
|
||||
var checkboxes = [];
|
||||
checkboxes = $$('input').each(function(e){ if(e.type == 'checkbox') checkboxes.push(e) });
|
||||
checkboxes.each(function(e){ e.checked = checked });
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -57,201 +77,277 @@ $sortorder=$_GET["sortorder"];
|
||||
if (! $sortfield) $sortfield="f.date_lim_reglement";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
|
||||
{
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid";
|
||||
$sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc";
|
||||
$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";
|
||||
$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";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ",".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.paye = 0 AND f.fk_statut = 1";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
|
||||
if ($_GET["filtre"])
|
||||
if (is_array($_POST['toGenerate']))
|
||||
{
|
||||
$filtrearr = split(",", $_GET["filtre"]);
|
||||
foreach ($filtrearr as $fil)
|
||||
{
|
||||
$filt = split(":", $fil);
|
||||
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
||||
}
|
||||
}
|
||||
|
||||
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ;
|
||||
|
||||
if ($_GET["search_ref"])
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'";
|
||||
}
|
||||
|
||||
if ($_GET["search_societe"])
|
||||
{
|
||||
$sql .= " AND s.nom like '%".$_GET["search_societe"]."%'";
|
||||
}
|
||||
|
||||
if ($_GET["search_montant_ht"])
|
||||
{
|
||||
$sql .= " AND f.total = '".$_GET["search_montant_ht"]."'";
|
||||
}
|
||||
|
||||
if ($_GET["search_montant_ttc"])
|
||||
{
|
||||
$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
|
||||
}
|
||||
|
||||
if (strlen($_POST["sf_ref"]) > 0)
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
|
||||
}
|
||||
$sql.= " GROUP BY f.facnumber";
|
||||
|
||||
$sql.= " ORDER BY ";
|
||||
$listfield=split(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||
$sql.= " f.facnumber DESC";
|
||||
|
||||
//$sql .= $db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
$titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsCustomersUnpayed"));
|
||||
print_barre_liste($titre,$page,"impayees.php","&socid=$socid",$sortfield,$sortorder,'',0); // We don't want pagination on this page
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=$socid","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socid=$socid",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socid=$socid",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="get" action="impayees.php">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
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" align="left">';
|
||||
print '<input class="flat" type="text" name="search_societe" value="'.$_GET["search_societe"].'">';
|
||||
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 '</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 '</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 '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
$total_ht=0;
|
||||
$total_ttc=0;
|
||||
$total_payed=0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
$class = "impayee";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
$facturestatic->id=$objp->facid;
|
||||
$facturestatic->ref=$objp->facnumber;
|
||||
$facturestatic->type=$objp->type;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
||||
if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
|
||||
$filename=sanitize_string($objp->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
|
||||
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
print "<td nowrap align=\"center\">".dolibarr_print_date($objp->df)."</td>\n";
|
||||
print "<td nowrap align=\"center\">".dolibarr_print_date($objp->datelimite)."</td>\n";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".price($objp->total_ht)."</td>";
|
||||
print "<td align=\"right\">".price($objp->total_ttc)."</td>";
|
||||
print "<td align=\"right\">".price($objp->am)."</td>";
|
||||
|
||||
// Affiche statut de la facture
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_payed+=$objp->am;
|
||||
|
||||
$i++;
|
||||
// liste les fichiers
|
||||
$files = array() ;
|
||||
$factures_bak = $factures ;
|
||||
foreach($_POST['toGenerate'] as $basename){
|
||||
foreach($factures as $facture){
|
||||
if(strstr($facture["name"],$basename)){
|
||||
$files[] = $conf->facture->dir_output.'/'.$basename.'/'.$facture["name"] ;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print "<td colspan=\"4\" 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_payed)."</b></td>";
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
|
||||
// génère le PDF à partir de tous les autres fichiers
|
||||
$pdf=new FPDI();
|
||||
foreach($files as $file){
|
||||
// Charge un document PDF depuis un fichier.
|
||||
$pagecount = $pdf->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplidx = $pdf->ImportPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
|
||||
// vérifie que le chemin d'accès est bien accessible
|
||||
create_exdir($diroutputpdf);
|
||||
|
||||
// enregistre le fichier pdf concaténé
|
||||
$filename=sanitize_string(strtolower($langs->transnoentities("Unpayed")));
|
||||
if ($option=='late') $filename.='_'.sanitize_string(strtolower($langs->transnoentities("Late")));
|
||||
$pdf->Output($diroutputpdf.'/'.$filename.'_'.dolibarr_print_date(mktime(),'dayhourlog').'.pdf');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
$mesg='<div class="error">'.$langs->trans('UnpayedNotChecked').'</div>' ;
|
||||
}
|
||||
}
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid";
|
||||
$sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc";
|
||||
$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";
|
||||
$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";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ",".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.type in (0,1) AND f.fk_statut = 1";
|
||||
$sql.= " AND f.paye = 0";
|
||||
if ($option == 'late')
|
||||
{
|
||||
$sql.=" AND f.date_lim_reglement < ".$db->idate(mktime());
|
||||
}
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
|
||||
if ($_GET["filtre"])
|
||||
{
|
||||
$filtrearr = split(",", $_GET["filtre"]);
|
||||
foreach ($filtrearr as $fil)
|
||||
{
|
||||
$filt = split(":", $fil);
|
||||
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["search_ref"])
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'";
|
||||
}
|
||||
|
||||
if ($_GET["search_societe"])
|
||||
{
|
||||
$sql .= " AND s.nom like '%".$_GET["search_societe"]."%'";
|
||||
}
|
||||
|
||||
if ($_GET["search_montant_ht"])
|
||||
{
|
||||
$sql .= " AND f.total = '".$_GET["search_montant_ht"]."'";
|
||||
}
|
||||
|
||||
if ($_GET["search_montant_ttc"])
|
||||
{
|
||||
$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
|
||||
}
|
||||
|
||||
if (strlen($_POST["sf_ref"]) > 0)
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
|
||||
}
|
||||
$sql.= " GROUP BY f.facnumber";
|
||||
|
||||
$sql.= " ORDER BY ";
|
||||
$listfield=split(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||
$sql.= " f.facnumber DESC";
|
||||
|
||||
//$sql .= $db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
$param="&socid=".$socid."&option=".$option;
|
||||
|
||||
$titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsCustomersUnpayed"));
|
||||
if ($option == 'late') $titre.=' ('.$langs->trans("Late").')';
|
||||
else $titre.=' ('.$langs->trans("All").')';
|
||||
|
||||
$link='';
|
||||
if (empty($option)) $link='<a href="'.$_SERVER["PHP_SELF"].'?option=late">'.$langs->trans("ShowUnpayedLateOnly").'</a>';
|
||||
elseif ($option == 'late') $link='<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("ShowUnpayedAll").'</a>';
|
||||
print_fiche_titre($titre,$link);
|
||||
//print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Generate"),$_SERVER["PHP_SELF"],"");
|
||||
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("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET["search_ref"].'"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="checkbox" onclick="checkall(this.checked);"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_societe" value="'.$_GET["search_societe"].'">';
|
||||
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 '</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 '</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 '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
$total_ht=0;
|
||||
$total_ttc=0;
|
||||
$total_payed=0;
|
||||
|
||||
print '<form id="form_generate_pdf" method="post" action="'.$_SERVER["PHP_SELF"].'?sortfield='. $_GET['sortfield'] .'&sortorder='. $_GET['sortorder'] .'">';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
$class = "impayee";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
$facturestatic->id=$objp->facid;
|
||||
$facturestatic->ref=$objp->facnumber;
|
||||
$facturestatic->type=$objp->type;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
||||
if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
|
||||
$filename=sanitize_string($objp->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
|
||||
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '<td align="center"><input id="cb'.$objp->facid.'" type="checkbox" name="toGenerate[]" value="'.$objp->facnumber.'"></td>' ;
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
print "<td nowrap align=\"center\">".dolibarr_print_date($objp->df)."</td>\n";
|
||||
print "<td nowrap align=\"center\">".dolibarr_print_date($objp->datelimite)."</td>\n";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".price($objp->total_ht)."</td>";
|
||||
print "<td align=\"right\">".price($objp->total_ttc)."</td>";
|
||||
print "<td align=\"right\">".price($objp->am)."</td>";
|
||||
|
||||
// Affiche statut de la facture
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_payed+=$objp->am;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print "<td colspan=\"5\" 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_payed)."</b></td>";
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Show list of available documents
|
||||
*/
|
||||
$filedir=$diroutputpdf;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
|
||||
$genallowed=$user->rights->facture->lire;
|
||||
$delallowed=$user->rights->facture->lire;
|
||||
|
||||
print '<br>';
|
||||
print '<input type="hidden" name="option" value="'.$option.'">';
|
||||
$formfile->show_documents('unpayed','',$filedir,$urlsource,$genallowed,$delallowed,'','',0,0,48,1);
|
||||
print '</form>';
|
||||
|
||||
$db->free();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,367 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/facture/retardspaiement.php
|
||||
\ingroup facture
|
||||
\brief Page generation PDF factures clients impayées
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/fpdf/fpdfi/fpdi.php");
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$facid = isset($_GET["facid"])?$_GET["facid"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'facture',$facid,'');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$diroutputpdf=$conf->facture->dir_output . '/impayes/temp';
|
||||
|
||||
llxHeader('',$langs->trans("BillsLate"));
|
||||
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
?><script type="text/javascript">
|
||||
<!--
|
||||
function checkall(checked){
|
||||
var checkboxes = [];
|
||||
checkboxes = $$('input').each(function(e){ if(e.type == 'checkbox') checkboxes.push(e) });
|
||||
checkboxes.each(function(e){ e.checked = checked });
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Mode Liste *
|
||||
* *
|
||||
***************************************************************************/
|
||||
$page = $_GET["page"];
|
||||
$sortfield=$_GET["sortfield"];
|
||||
$sortorder=$_GET["sortorder"];
|
||||
if (! $sortfield) $sortfield="f.date_lim_reglement";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
|
||||
|
||||
if ($_POST["action"] == "generate_pdf"){
|
||||
if(is_array($_POST['toGenerate']))
|
||||
{
|
||||
|
||||
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('\.pdf|',$_POST['toGenerate']).'\.pdf','\.meta$|\.png','date',SORT_DESC) ;
|
||||
|
||||
// liste les fichiers
|
||||
$files = array() ;
|
||||
$factures_bak = $factures ;
|
||||
foreach($_POST['toGenerate'] as $basename){
|
||||
foreach($factures as $facture){
|
||||
if(strstr($facture["name"],$basename)){
|
||||
$files[] = DOL_DATA_ROOT . '/facture/' . $basename . '/' . $facture["name"] ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// génère le PDF à partir de tous les autres fichiers
|
||||
$pdf=new FPDI();
|
||||
foreach($files as $file){
|
||||
// Charge un document PDF depuis un fichier.
|
||||
$pagecount = $pdf->setSourceFile($file);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplidx = $pdf->ImportPage($i);
|
||||
$s = $pdf->getTemplatesize($tplidx);
|
||||
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
|
||||
// vérifie que le chemin d'accès est bien accessible
|
||||
create_exdir($diroutputpdf);
|
||||
|
||||
// enregistre le fichier pdf concaténé
|
||||
$pdf->Output($diroutputpdf.'/impayes'.dolibarr_date('YmdHis',time()).'.pdf');
|
||||
|
||||
} else {
|
||||
print '<div class="error">'.$langs->trans('UnpayedNotChecked').'</div>' ;
|
||||
}
|
||||
}
|
||||
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid";
|
||||
$sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc";
|
||||
$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";
|
||||
$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";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ",".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.paye = 0 AND f.fk_statut = 1 AND f.date_lim_reglement < NOW()";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
|
||||
if ($_GET["filtre"])
|
||||
{
|
||||
$filtrearr = split(",", $_GET["filtre"]);
|
||||
foreach ($filtrearr as $fil)
|
||||
{
|
||||
$filt = split(":", $fil);
|
||||
$sql .= " AND " . $filt[0] . " = " . $filt[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["search_ref"])
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_GET["search_ref"]."%'";
|
||||
}
|
||||
|
||||
if ($_GET["search_societe"])
|
||||
{
|
||||
$sql .= " AND s.nom like '%".$_GET["search_societe"]."%'";
|
||||
}
|
||||
|
||||
if ($_GET["search_montant_ht"])
|
||||
{
|
||||
$sql .= " AND f.total = '".$_GET["search_montant_ht"]."'";
|
||||
}
|
||||
|
||||
if ($_GET["search_montant_ttc"])
|
||||
{
|
||||
$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
|
||||
}
|
||||
|
||||
if (strlen($_POST["sf_ref"]) > 0)
|
||||
{
|
||||
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
|
||||
}
|
||||
$sql.= " GROUP BY f.facnumber";
|
||||
|
||||
$sql.= " ORDER BY ";
|
||||
$listfield=split(',',$sortfield);
|
||||
foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.",";
|
||||
$sql.= " f.facnumber DESC";
|
||||
|
||||
//$sql .= $db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
$titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsLate"));
|
||||
print_barre_liste($titre,$page,"retardspaiement.php","&socid=$socid",$sortfield,$sortorder,'',0); // We don't want pagination on this page
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=$socid","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Generate"),$_SERVER["PHP_SELF"],"");
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socid=$socid",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socid=$socid",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socid=$socid",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="get" action="retardspaiement.php">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET["search_ref"].'"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="checkbox" onclick="checkall(this.checked);"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_societe" value="'.$_GET["search_societe"].'">';
|
||||
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 '</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 '</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 '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
$total_ht=0;
|
||||
$total_ttc=0;
|
||||
$total_payed=0;
|
||||
|
||||
print '<form id="form_generate_pdf" method="post" action="retardspaiement.php?sortfield='. $_GET['sortfield'] .'&sortorder='. $_GET['sortorder'] .'">';
|
||||
print '<input type="hidden" name="action" value="generate_pdf">';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
$class = "impayee";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
$facturestatic->id=$objp->facid;
|
||||
$facturestatic->ref=$objp->facnumber;
|
||||
$facturestatic->type=$objp->type;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
||||
if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
|
||||
$filename=sanitize_string($objp->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
|
||||
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '<td align="center"><input id="cb'.$objp->facid.'" type="checkbox" name="toGenerate[]" value="'.$objp->facnumber.'"></td>' ;
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
print "<td nowrap align=\"center\">".dolibarr_print_date($objp->df)."</td>\n";
|
||||
print "<td nowrap align=\"center\">".dolibarr_print_date($objp->datelimite)."</td>\n";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,32).'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".price($objp->total_ht)."</td>";
|
||||
print "<td align=\"right\">".price($objp->total_ttc)."</td>";
|
||||
print "<td align=\"right\">".price($objp->am)."</td>";
|
||||
|
||||
// Affiche statut de la facture
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$objp->am);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_payed+=$objp->am;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print "<td colspan=\"5\" 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_payed)."</b></td>";
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
* Gestion des documents générés
|
||||
*/
|
||||
$filedir=$diroutputpdf;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
|
||||
$genallowed=$user->rights->facture->creer;
|
||||
$delallowed=$user->rights->facture->supprimer;
|
||||
|
||||
//class="pair" ou "impair" pour les tr
|
||||
$var = false ; $bc = array("pair","impair") ;
|
||||
|
||||
// liste des fichier
|
||||
$file_list=dol_dir_list($filedir,'files',0,'impayes.*','\.meta$','date',SORT_DESC);;
|
||||
|
||||
print '<br>' ;
|
||||
print_titre($langs->trans("Documents"));
|
||||
print '<table class="border" width="70%">';
|
||||
print '<tr class="liste_titre">' ;
|
||||
print '<td align="center">'.$langs->trans("File").'</td><td align="center">'.$langs->trans("Size").'</td><td align="center">'.$langs->trans("Date").'</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Generate").'"></td>' ;
|
||||
print '</tr>' ;
|
||||
// Pour chaque fichier on affiche une ligne
|
||||
foreach($file_list as $file){
|
||||
$filepath = $filedir."/".$file["name"] ;
|
||||
$var = !$var ;
|
||||
print '<tr class="'.$bc[$var].'">' ;
|
||||
// Nom du fichier
|
||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=impayes&file='.urlencode($filepath).'">'.img_pdf($file["name"],2)." ".$file["name"].'</td>' ;
|
||||
// Taille
|
||||
print '<td align="center">'.filesize($filepath). ' bytes</td>' ;
|
||||
// Date
|
||||
print '<td align="center">'.dolibarr_print_date(filemtime($filepath),'dayhour').'</td>' ;
|
||||
// Suppression
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&modulepart=impayes&file='.urlencode($filepath).'&urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>' ;
|
||||
print '</tr>' ;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -109,14 +109,14 @@ if ($modulepart)
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='$refname'";
|
||||
}
|
||||
|
||||
if ($modulepart == 'impayes')
|
||||
if ($modulepart == 'unpayed')
|
||||
{
|
||||
$user->getrights('facture');
|
||||
if ($user->rights->facture->lire || eregi('^specimen',$original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$original_file;
|
||||
$original_file=$conf->facture->dir_output.'/unpayed/temp/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les fiches intervention
|
||||
|
||||
@ -17,15 +17,15 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/html.formfile.class.php
|
||||
\brief Fichier de la classe des fonctions prédéfinie de composants html fichiers
|
||||
\version $Id$
|
||||
* \file htdocs/html.formfile.class.php
|
||||
* \brief Fichier de la classe des fonctions prédéfinie de composants html fichiers
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class FormFile
|
||||
\brief Classe permettant la génération de composants html fichiers
|
||||
* \class FormFile
|
||||
* \brief Classe permettant la génération de composants html fichiers
|
||||
*/
|
||||
class FormFile
|
||||
{
|
||||
@ -116,15 +116,16 @@ class FormFile
|
||||
* \param genallowed Génération autorisée (1/0 ou array des formats)
|
||||
* \param delallowed Suppression autorisée (1/0)
|
||||
* \param modelselected Modele à pré-sélectionner par défaut
|
||||
* \param modelliste Tableau des modeles possibles
|
||||
* \param modelliste Tableau des modeles possibles. Use '' to hide combo select list.
|
||||
* \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS défini
|
||||
* \param iconPDF N'affiche que l'icone PDF avec le lien (1/0)
|
||||
* \param maxfilenamelength Max length for filename shown
|
||||
* \param noform Do not output html form start and end
|
||||
* \remarks Le fichier de facture détaillée est de la forme
|
||||
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
|
||||
* \return int <0 si ko, nbre de fichiers affichés si ok
|
||||
*/
|
||||
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28)
|
||||
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0)
|
||||
{
|
||||
// filedir = conf->...dir_ouput."/".get_exdir(id)
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
|
||||
@ -145,6 +146,9 @@ class FormFile
|
||||
$headershown=0;
|
||||
$i=0;
|
||||
|
||||
print "\n".'<!-- Start show_document -->'."\n";
|
||||
//print 'filedir='.$filedir;
|
||||
|
||||
// Affiche en-tete tableau
|
||||
if ($genallowed)
|
||||
{
|
||||
@ -247,6 +251,10 @@ class FormFile
|
||||
// ??
|
||||
}
|
||||
}
|
||||
else if ($modulepart == 'unpayed')
|
||||
{
|
||||
$modellist='';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db,'Bad value for modulepart');
|
||||
@ -256,17 +264,26 @@ class FormFile
|
||||
$headershown=1;
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
print '<form action="'.$urlsource.'#builddoc" method="post">';
|
||||
$texte=$langs->trans('Generate');
|
||||
|
||||
if (empty($noform)) print '<form action="'.$urlsource.'#builddoc" method="post">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
|
||||
print_titre($langs->trans("Documents"));
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td align="center">'.$langs->trans('Model').' ';
|
||||
$html->select_array('model',$modellist,$modelselected,0,0,1);
|
||||
$texte=$langs->trans('Generate');
|
||||
if (! empty($modellist))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $langs->trans('Model').' ';
|
||||
$html->select_array('model',$modellist,$modelselected,0,0,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="left">';
|
||||
print $langs->trans("Files");
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
if($conf->global->MAIN_MULTILANGS && ! $forcenomultilang)
|
||||
@ -350,10 +367,10 @@ class FormFile
|
||||
print "</table>\n";
|
||||
if ($genallowed)
|
||||
{
|
||||
print '</form>';
|
||||
if (empty($noform)) print '</form>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '<!-- End show_document -->'."\n";
|
||||
return ($i?$i:$headershown);
|
||||
}
|
||||
|
||||
|
||||
@ -421,11 +421,11 @@ class MenuLeft {
|
||||
}
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR)
|
||||
{
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatable"),2,$user->rights->facture->lire);
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),2,$user->rights->facture->lire);
|
||||
}
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpayed"),2,$user->rights->facture->lire);
|
||||
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/retardspaiement.php?leftmenu=customers_bills",$langs->trans("BillsLate"),2,$user->rights->facture->lire);
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/facture/impayees.php?option=late&leftmenu=customers_bills",$langs->trans("Unpayed").' ('.$langs->trans("Late").')',2,$user->rights->facture->lire);
|
||||
|
||||
if (eregi("customers_bills",$leftmenu)) $newmenu->add_submenu(DOL_URL_ROOT."/compta/paiement/liste.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),2,$user->rights->facture->lire);
|
||||
|
||||
|
||||
@ -195,6 +195,7 @@ Billed=Billed
|
||||
RepeatableInvoice=Repeatable invoice
|
||||
RepeatableInvoices=Repeatable invoices
|
||||
Repeatable=Repeatable
|
||||
Repeatables=Repeatable
|
||||
ChangeIntoRepeatableInvoice=Change into repeatable
|
||||
CreateRepeatableInvoice=Create repeatable invoice
|
||||
CreateFromRepeatableInvoice=Create from repeatable invoice
|
||||
|
||||
@ -349,6 +349,7 @@ Legend=Legend
|
||||
FillTownFromZip=Fill town from zip
|
||||
ShowLog=Show log
|
||||
File=File
|
||||
Files=Files
|
||||
ReadPermissionNotAllowed=Read permission not allowed
|
||||
AmountInCurrency=Amount in %s currency
|
||||
Example=Example
|
||||
|
||||
@ -196,6 +196,7 @@ Billed=Facturado
|
||||
RepeatableInvoice=Factura recurrente
|
||||
RepeatableInvoices=Facturas recurrentes
|
||||
Repeatable=Recurrente
|
||||
Repeatables=Recurrentes
|
||||
ChangeIntoRepeatableInvoice=Modificar en recurrente
|
||||
CreateRepeatableInvoice=Crear factura recurrente
|
||||
CreateFromRepeatableInvoice=Crear despues factura recurrente
|
||||
|
||||
@ -157,12 +157,6 @@ NonPercuRecuperable=Non per
|
||||
SetConditions=Définir conditions de règlement
|
||||
SetMode=Définir mode de règlement
|
||||
Billed=Facturé
|
||||
RepeatableInvoice=Facture récurrente
|
||||
RepeatableInvoices=Factures récurrentes
|
||||
Repeatable=Récurrente
|
||||
ChangeIntoRepeatableInvoice=Modifier en récurrente
|
||||
CreateRepeatableInvoice=Créer facture récurrente
|
||||
CreateFromRepeatableInvoice=Créer depuis facture récurrente
|
||||
ExportDataset_invoice_1=Factures clients et lignes de facture
|
||||
ProformaBill=Facture Proforma :
|
||||
Reduction=Réduction
|
||||
|
||||
@ -194,6 +194,7 @@ Billed=Factur
|
||||
RepeatableInvoice=Facture récurrente
|
||||
RepeatableInvoices=Factures récurrentes
|
||||
Repeatable=Récurrente
|
||||
Repeatables=Récurrentes
|
||||
ChangeIntoRepeatableInvoice=Convertir en récurrente
|
||||
CreateRepeatableInvoice=Créer facture récurrente
|
||||
CreateFromRepeatableInvoice=Créer depuis facture récurrente
|
||||
@ -308,7 +309,8 @@ ChequeDeposits=D
|
||||
Cheques=Chèques
|
||||
CreditNoteConvertedIntoDiscount=Cet avoir a été converti en %s
|
||||
UsBillingContactAsIncoiveRecipientIfExist=Utiliser l'adresse du contact facturation client de la facture plutot que l'adresse du tiers comme destinataire des factures
|
||||
|
||||
ShowUnpayedAll=Afficher tous les impayés
|
||||
ShowUnpayedLateOnly=Afficher impayés en retard uniquement
|
||||
# oursin PDF model
|
||||
Of=du
|
||||
|
||||
@ -342,18 +344,3 @@ IsNotDefined=N'est pas d
|
||||
|
||||
TerreNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn pour les factures et %syymm-nnnn pour les avoirs où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0
|
||||
TerreNumRefModelError=Une facture commençant par $syymm existe en base et est incompatible avec cette numérotation. Supprimer la ou renommer la pour activer ce module.
|
||||
|
||||
# Deprecated
|
||||
|
||||
# orion
|
||||
OrionNumRefModelDesc1=Renvoie le numéro sous la forme FAYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1.
|
||||
OrionNumRefModelDesc2=L'année s'incrémente de 1 SANS remise à zero en début d'année d'exercice.
|
||||
OrionNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre.
|
||||
OrionNumRefModelDesc4=Dans cet exemple nous aurons au 1er septembre 2007 une facture nommée FA0800354.
|
||||
# titan
|
||||
TitanNumRefModelDesc1=Renvoie le numéro sous la forme FAYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1.
|
||||
TitanNumRefModelDesc2=L'année s'incrémente de 1 et le numéro d'incrément se remet à zero en début d'année d'exercice.
|
||||
TitanNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre.
|
||||
TitanNumRefModelDesc4=Dans cet exemple nous aurons au 1er septembre 2007 une facture nommée FA0800001.
|
||||
# pluton
|
||||
PlutonNumRefModelDesc1=Renvoie un numéro de facture personalisable selon un masque à définir.
|
||||
|
||||
@ -351,6 +351,7 @@ Legend=L
|
||||
FillTownFromZip=Renseigner ville
|
||||
ShowLog=Afficher historique
|
||||
File=Fichier
|
||||
Files=Fichiers
|
||||
ReadPermissionNotAllowed=Lecture non autorisée
|
||||
AmountInCurrency=Montants exprimés en %s
|
||||
Example=Exemple
|
||||
|
||||
@ -424,6 +424,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false)
|
||||
if ($format == 'daytext') $format=$conf->format_date_text_short;
|
||||
if ($format == 'dayhour') $format=$conf->format_date_hour_short;
|
||||
if ($format == 'dayhourtext') $format=$conf->format_date_hour_text_short;
|
||||
if ($format == 'dayhourlog') $format='%Y%m%d%H%M%S';
|
||||
if ($format == 'dayhourldap') $format='%Y%m%d%H%M%SZ';
|
||||
if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ';
|
||||
|
||||
@ -1829,7 +1830,7 @@ function dol_avscan_file($file)
|
||||
/**
|
||||
\brief Fonction print_barre_liste
|
||||
\param titre Titre de la page
|
||||
\param page num<EFBFBD>ro de la page
|
||||
\param page numero de la page
|
||||
\param file lien
|
||||
\param options parametres complementaires lien ('' par defaut)
|
||||
\param sortfield champ de tri ('' par defaut)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user