dolibarr  7.0.0-beta
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@capnetworks.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 $langs->load("banks");
34 $langs->load("categories");
35 $langs->load("withdrawals");
36 $langs->load("companies");
37 
38 // Security check
39 $socid = GETPOST('socid','int');
40 if ($user->societe_id) $socid=$user->societe_id;
41 $result = restrictedArea($user, 'prelevement','','','bons');
42 
43 // Get supervariables
44 $page = GETPOST('page','int');
45 $sortorder = GETPOST('sortorder','alpha');
46 $sortfield = GETPOST('sortfield','alpha');
47 
48 /*
49  * View
50  */
51 
52 llxHeader('',$langs->trans("WithdrawsRefused"));
53 
54 $offset = $conf->liste_limit * $page ;
55 $pageprev = $page - 1;
56 $pagenext = $page + 1;
57 
58 if ($sortorder == "") $sortorder="DESC";
59 if ($sortfield == "") $sortfield="p.datec";
60 
61 $rej = new RejetPrelevement($db, $user);
62 $ligne = new LignePrelevement($db, $user);
63 
64 /*
65  * Liste des factures
66  *
67  */
68 $sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut";
69 $sql.= " , s.rowid as socid, s.nom";
70 $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
71 $sql.= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
72 $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
73 $sql.= " , ".MAIN_DB_PREFIX."societe as s";
74 $sql.= " WHERE pr.fk_prelevement_lignes = pl.rowid";
75 $sql.= " AND pl.fk_prelevement_bons = p.rowid";
76 $sql.= " AND pl.fk_soc = s.rowid";
77 $sql.= " AND p.entity = ".$conf->entity;
78 if ($socid) $sql.= " AND s.rowid = ".$socid;
79 $sql.= " ".$db->order($sortfield, $sortorder);
80 $sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
81 
82 $result = $db->query($sql);
83 if ($result)
84 {
85  $num = $db->num_rows($result);
86  $i = 0;
87 
88  print_barre_liste($langs->trans("WithdrawsRefused"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
89  print"\n<!-- debut table -->\n";
90  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
91  print '<tr class="liste_titre">';
92  print_liste_field_titre("Line",$_SERVER["PHP_SELF"],"p.ref",'',$urladd);
93  print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
94  print_liste_field_titre("Reason",$_SERVER["PHP_SELF"],"pr.motif","",$urladd);
95  print "</tr>\n";
96 
97  $total = 0;
98 
99  while ($i < min($num,$conf->liste_limit))
100  {
101  $obj = $db->fetch_object($result);
102 
103  print '<tr class="oddeven"><td>';
104  print $ligne->LibStatut($obj->statut,2).'&nbsp;';
105  print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
106 
107  print substr('000000'.$obj->rowid, -6)."</a></td>";
108 
109  print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.stripslashes($obj->nom)."</a></td>\n";
110 
111  print '<td>'.$rej->motifs[$obj->motif].'</td>';
112  print "</tr>\n";
113 
114  $i++;
115  }
116 
117  print "</table>";
118  $db->free($result);
119 }
120 else
121 {
122  dol_print_error($db);
123 }
124 
125 llxFooter();
126 $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.
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:46
print
Draft customers invoices.
Definition: index.php:91
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.
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.
Class to manage withdrawals.