28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38$langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
44$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
45$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
47if (empty($page) || $page == -1) {
50$offset = $limit * $page;
57 $socid = $user->socid;
59if ($type ==
'bank-transfer') {
60 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
72$title = $langs->trans(
"WithdrawsRefused");
73if ($type ==
'bank-transfer') {
74 $title = $langs->trans(
"CreditTransfersRefused");
79if ($sortorder ==
"") {
82if ($sortfield ==
"") {
83 $sortfield =
"p.datec";
88$thirdpartystatic =
new Societe($db);
89$userstatic =
new User($db);
91$hookmanager->initHooks(array(
'withdrawalsreceiptsrejectedlist'));
96$sql =
"SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
97$sql .=
" s.rowid as socid, s.nom as name, p.datec";
98$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
99$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
100$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
101$sql .=
" , ".MAIN_DB_PREFIX.
"societe as s";
102$sql .=
" WHERE pr.fk_prelevement_lignes = pl.rowid";
103$sql .=
" AND pl.fk_prelevement_bons = p.rowid";
104$sql .=
" AND pl.fk_soc = s.rowid";
105$sql .=
" AND p.entity = ".((int) $conf->entity);
106if ($type ==
'bank-transfer') {
107 $sql .=
" AND p.type = 'bank-transfer'";
109 $sql .=
" AND p.type = 'debit-order'";
112 $sql .=
" AND s.rowid = ".((int) $socid);
115if ($type ==
'bank-transfer') {
117 $sql .=
" SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
118 $sql .=
" u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
119 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
120 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
121 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
122 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
123 $sql .=
" WHERE pr.fk_prelevement_lignes = pl.rowid";
124 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
125 $sql .=
" AND pl.fk_user = u.rowid";
126 $sql .=
" AND p.entity = ".((int) $conf->entity);
127 $sql .=
" AND p.type = 'bank-transfer'";
129 $sql .=
" AND s.rowid = ".((int) $socid);
132if ($type ==
'bank-transfer') {
133 $sortfield =
'datec';
135$sql .= $db->order($sortfield, $sortorder);
136$sql .= $db->plimit($limit + 1, $offset);
138$result = $db->query($sql);
140 $num = $db->num_rows($result);
144 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
145 print
"\n<!-- debut table -->\n";
146 print
'<table class="noborder tagtable liste" width="100%" cellpadding="4">';
147 print
'<tr class="liste_titre">';
156 $maxlim = min($num, $limit);
157 while ($i < $maxlim) {
158 $obj = $db->fetch_object($result);
159 $bon->fetch($obj->bonId);
161 print
'<tr class="oddeven">';
164 print $line->LibStatut($obj->statut, 2).
' ';
165 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid.
'">';
166 print substr(
'000000'.$obj->rowid, -6).
"</a></td>";
168 if ($bon->checkIfSalaryBonPrelevement()) {
169 print
'<td><a href="'.DOL_URL_ROOT.
'/salaries/card.php?id='.$obj->socid.
'">'.$obj->name.
"</a></td>\n";
171 $thirdpartystatic->id = $obj->socid;
172 $thirdpartystatic->name = $obj->name;
174 print
'<td class="tdoverlowmax200"><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$thirdpartystatic->getNomUrl(1).
"</a></td>\n";
177 print
'<td>'.$rej->motifs[$obj->motif].
'</td>';
184 print
'<tr><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage withdrawal receipts.
Class to manage withdrawals.
Class to manage standing orders rejects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.