New: add total vat field
This commit is contained in:
parent
97474bf77f
commit
d03eb5af4a
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -183,7 +183,7 @@ if (! $sortorder) $sortorder="ASC";
|
||||
$limit = $conf->liste_limit;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid";
|
||||
$sql.= ", f.facnumber,f.increment,f.total as total_ht,f.total_ttc";
|
||||
$sql.= ", f.facnumber, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc";
|
||||
$sql.= ", f.datef as df, f.date_lim_reglement as datelimite";
|
||||
$sql.= ", f.paye as paye, f.rowid as facid, f.fk_statut, f.type";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
@ -198,10 +198,10 @@ $sql.= " AND f.type IN (0,1,3) AND f.fk_statut = 1";
|
||||
$sql.= " AND f.paye = 0";
|
||||
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
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 (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
|
||||
if (GETPOST('filtre'))
|
||||
{
|
||||
$filtrearr = explode(",", $_GET["filtre"]);
|
||||
$filtrearr = explode(",", GETPOST('filtre'));
|
||||
foreach ($filtrearr as $fil)
|
||||
{
|
||||
$filt = explode(":", $fil);
|
||||
@ -212,7 +212,7 @@ if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$search_ref."%'";
|
||||
if ($search_societe) $sql .= " AND s.nom LIKE '%".$search_societe."%'";
|
||||
if ($search_montant_ht) $sql .= " AND f.total = '".$search_montant_ht."'";
|
||||
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
|
||||
if (dol_strlen($_POST["sf_ref"]) > 0) $sql .= " AND f.facnumber LIKE '%".$_POST["sf_ref"] . "%'";
|
||||
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_ref') . "%'";
|
||||
$sql.= " GROUP BY f.facnumber,f.increment,f.total,f.total_ttc,f.datef, f.date_lim_reglement,f.paye, f.rowid, f.fk_statut, f.type,s.nom, s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " ORDER BY ";
|
||||
@ -227,15 +227,15 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($socid)
|
||||
if (! empty($socid))
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
}
|
||||
|
||||
$param="";
|
||||
$param.=($socid?"&socid=".$socid:"");
|
||||
$param.=($option?"&option=".$option:"");
|
||||
$param.=(! empty($socid)?"&socid=".$socid:"");
|
||||
$param.=(! empty($option)?"&option=".$option:"");
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_societe) $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
@ -245,7 +245,7 @@ if ($resql)
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$titre=($socid?$langs->trans("BillsCustomersUnpaidForCompany",$soc->nom):$langs->trans("BillsCustomersUnpaid"));
|
||||
$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->nom):$langs->trans("BillsCustomersUnpaid"));
|
||||
if ($option == 'late') $titre.=' ('.$langs->trans("Late").')';
|
||||
else $titre.=' ('.$langs->trans("All").')';
|
||||
|
||||
@ -266,6 +266,7 @@ if ($resql)
|
||||
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("AmountVAT"),$_SERVER["PHP_SELF"],"f.tva","",$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("Rest"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@ -281,13 +282,11 @@ if ($resql)
|
||||
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$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" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
|
||||
print '</td><td class="liste_titre" colspan="3" align="right">';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" colspan="3" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@ -300,6 +299,7 @@ if ($resql)
|
||||
{
|
||||
$var=True;
|
||||
$total_ht=0;
|
||||
$total_tva=0;
|
||||
$total_ttc=0;
|
||||
$total_paid=0;
|
||||
|
||||
@ -352,8 +352,9 @@ if ($resql)
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->nom,28).'</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->total_ht).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->total_tva).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td align="right">'.price($objp->am).'</td>';
|
||||
if ($objp->am==0)
|
||||
{ print '<td align="right"></td>'; }
|
||||
@ -373,6 +374,7 @@ if ($resql)
|
||||
|
||||
print "</tr>\n";
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_tva+=$objp->total_tva;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_paid+=$objp->am;
|
||||
|
||||
@ -381,9 +383,10 @@ if ($resql)
|
||||
|
||||
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_paid).'</b></td>';
|
||||
print '<td align="right"><b>'.price($total_ht).' '.getCurrencySymbol($conf->currency).'</b></td>';
|
||||
print '<td align="right"><b>'.price($total_tva).' '.getCurrencySymbol($conf->currency).'</b></td>';
|
||||
print '<td align="right"><b>'.price($total_ttc).' '.getCurrencySymbol($conf->currency).'</b></td>';
|
||||
print '<td align="right"><b>'.price($total_paid).' '.getCurrencySymbol($conf->currency).'</b></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
@ -415,6 +418,5 @@ else dol_print_error($db,'');
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -140,7 +140,7 @@ $facturestatic=new Facture($db);
|
||||
|
||||
if (! $sall) $sql = 'SELECT';
|
||||
else $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut, f.note,';
|
||||
$sql.= ' s.nom, s.rowid as socid';
|
||||
@ -280,6 +280,7 @@ if ($resql)
|
||||
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('AmountVAT'),$_SERVER['PHP_SELF'],'f.tva','',$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);
|
||||
@ -297,23 +298,19 @@ if ($resql)
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"> </td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '</td><td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
$total=0;
|
||||
$total_ht=0;
|
||||
$total_tva=0;
|
||||
$total_ttc=0;
|
||||
$totalrecu=0;
|
||||
|
||||
@ -343,7 +340,7 @@ if ($resql)
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($objp->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->facid;
|
||||
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -371,11 +368,13 @@ if ($resql)
|
||||
print $thirdparty->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">'.price($objp->total).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($objp->total_tva).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
|
||||
print '<td align="right">'.price($paiement).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
|
||||
print '<td align="right">'.price($paiement).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
|
||||
// Affiche statut de la facture
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
@ -383,7 +382,8 @@ if ($resql)
|
||||
print "</td>";
|
||||
//print "<td> </td>";
|
||||
print "</tr>\n";
|
||||
$total+=$objp->total;
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_tva+=$objp->total_tva;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$totalrecu+=$paiement;
|
||||
$i++;
|
||||
@ -394,9 +394,10 @@ if ($resql)
|
||||
// Print total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total" colspan="4" align="left">'.$langs->trans('Total').'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total_ttc).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($totalrecu).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total_ht).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total_tva).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total_ttc).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($totalrecu).' '.getCurrencySymbol($conf->currency).'</td>';
|
||||
print '<td class="liste_total" align="center"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user