dolibarr  7.0.0-beta
reglement.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
24 require '../../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
26 
27 $langs->load("compta");
28 $langs->load("compta");
29 
30 // Security check
31 $socid = isset($_GET["socid"])?$_GET["socid"]:'';
32 if ($user->societe_id) $socid=$user->societe_id;
33 $result = restrictedArea($user, 'tax', '', '', 'charges');
34 $ltt=GETPOST("localTaxType");
35 
36 /*
37  * View
38  */
39 
40 llxHeader();
41 
42 $localtax_static = new Localtax($db);
43 
44 print load_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments",$mysoc->country_code));
45 
46 $sql = "SELECT rowid, amount, label, f.datev as dm";
47 $sql.= " FROM ".MAIN_DB_PREFIX."localtax as f ";
48 $sql.= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$db->escape($ltt);
49 $sql.= " ORDER BY dm DESC";
50 
51 $result = $db->query($sql);
52 if ($result)
53 {
54  $num = $db->num_rows($result);
55  $i = 0;
56  $total = 0 ;
57 
58  print '<table class="noborder" width="100%">';
59  print '<tr class="liste_titre">';
60  print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
61  print "<td>".$langs->trans("Label")."</td>";
62  print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
63  print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
64  print "</tr>\n";
65  $var=1;
66  while ($i < $num)
67  {
68  $obj = $db->fetch_object($result);
69 
70  print '<tr class="oddeven">';
71 
72  $localtax_static->id=$obj->rowid;
73  $localtax_static->ref=$obj->rowid;
74  print "<td>".$localtax_static->getNomUrl(1)."</td>\n";
75  print "<td>".dol_trunc($obj->label,40)."</td>\n";
76  print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
77  $total = $total + $obj->amount;
78 
79  print "<td align=\"right\">".price($obj->amount)."</td>";
80  print "</tr>\n";
81 
82  $i++;
83  }
84  print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total").'</td>';
85  print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
86 
87  print "</table>";
88  $db->free($result);
89 }
90 else
91 {
92  dol_print_error($db);
93 }
94 
95 llxFooter();
96 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91
Class to manage local tax.
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.