dolibarr  9.0.0
rejets.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
27 require '../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
32 
33 // Load translation files required by the page
34 $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
35 
36 // Security check
37 $socid = GETPOST('socid','int');
38 if ($user->societe_id) $socid=$user->societe_id;
39 $result = restrictedArea($user, 'prelevement','','','bons');
40 
41 // Get supervariables
42 $page = GETPOST('page','int');
43 $sortorder = GETPOST('sortorder','alpha');
44 $sortfield = GETPOST('sortfield','alpha');
45 
46 /*
47  * View
48  */
49 
50 llxHeader('',$langs->trans("WithdrawsRefused"));
51 
52 $offset = $conf->liste_limit * $page ;
53 $pageprev = $page - 1;
54 $pagenext = $page + 1;
55 
56 if ($sortorder == "") $sortorder="DESC";
57 if ($sortfield == "") $sortfield="p.datec";
58 
59 $rej = new RejetPrelevement($db, $user);
60 $ligne = new LignePrelevement($db, $user);
61 
62 /*
63  * Liste des factures
64  *
65  */
66 $sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut";
67 $sql.= " , s.rowid as socid, s.nom";
68 $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
69 $sql.= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
70 $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
71 $sql.= " , ".MAIN_DB_PREFIX."societe as s";
72 $sql.= " WHERE pr.fk_prelevement_lignes = pl.rowid";
73 $sql.= " AND pl.fk_prelevement_bons = p.rowid";
74 $sql.= " AND pl.fk_soc = s.rowid";
75 $sql.= " AND p.entity = ".$conf->entity;
76 if ($socid) $sql.= " AND s.rowid = ".$socid;
77 $sql.= " ".$db->order($sortfield, $sortorder);
78 $sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
79 
80 $result = $db->query($sql);
81 if ($result)
82 {
83  $num = $db->num_rows($result);
84  $i = 0;
85 
86  print_barre_liste($langs->trans("WithdrawsRefused"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
87  print"\n<!-- debut table -->\n";
88  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
89  print '<tr class="liste_titre">';
90  print_liste_field_titre("Line",$_SERVER["PHP_SELF"],"p.ref",'',$urladd);
91  print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
92  print_liste_field_titre("Reason",$_SERVER["PHP_SELF"],"pr.motif","",$urladd);
93  print "</tr>\n";
94 
95  $total = 0;
96 
97  while ($i < min($num,$conf->liste_limit))
98  {
99  $obj = $db->fetch_object($result);
100 
101  print '<tr class="oddeven"><td>';
102  print $ligne->LibStatut($obj->statut,2).'&nbsp;';
103  print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
104 
105  print substr('000000'.$obj->rowid, -6)."</a></td>";
106 
107  print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
108 
109  print '<td>'.$rej->motifs[$obj->motif].'</td>';
110  print "</tr>\n";
111 
112  $i++;
113  }
114 
115  print "</table>";
116  $db->free($result);
117 }
118 else
119 {
120  dol_print_error($db);
121 }
122 
123 // End of page
124 llxFooter();
125 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
llxHeader()
Empty header.
Definition: wrapper.php:44
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
Class to manage standing orders rejects.
Class to manage withdrawals.