29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
39$langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
45$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
46$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
48if (empty($page) || $page == -1) {
51$offset = $limit * $page;
58 $socid = $user->socid;
62$hookmanager->initHooks(array(
'withdrawalsreceiptsrejectedlist'));
64if ($type ==
'bank-transfer') {
65 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
77$title = $langs->trans(
"WithdrawsRefused");
78if ($type ==
'bank-transfer') {
79 $title = $langs->trans(
"CreditTransfersRefused");
84if ($sortorder ==
"") {
87if ($sortfield ==
"") {
88 $sortfield =
"p.datec";
93$thirdpartystatic =
new Societe($db);
94$userstatic =
new User($db);
98$sql =
"SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
99$sql .=
" s.rowid as socid, s.nom as name, p.datec";
100$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
101$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
102$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
103$sql .=
" , ".MAIN_DB_PREFIX.
"societe as s";
104$sql .=
" WHERE pr.fk_prelevement_lignes = pl.rowid";
105$sql .=
" AND pl.fk_prelevement_bons = p.rowid";
106$sql .=
" AND pl.fk_soc = s.rowid";
107$sql .=
" AND p.entity = ".((int) $conf->entity);
108if ($type ==
'bank-transfer') {
109 $sql .=
" AND p.type = 'bank-transfer'";
111 $sql .=
" AND p.type = 'debit-order'";
114 $sql .=
" AND s.rowid = ".((int) $socid);
117if ($type ==
'bank-transfer') {
119 $sql .=
" SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
120 $sql .=
" u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
121 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
122 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
123 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
124 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
125 $sql .=
" WHERE pr.fk_prelevement_lignes = pl.rowid";
126 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
127 $sql .=
" AND pl.fk_user = u.rowid";
128 $sql .=
" AND p.entity = ".((int) $conf->entity);
129 $sql .=
" AND p.type = 'bank-transfer'";
131 $sql .=
" AND s.rowid = ".((int) $socid);
134if ($type ==
'bank-transfer') {
135 $sortfield =
'datec';
137$sql .= $db->order($sortfield, $sortorder);
138$sql .= $db->plimit($limit + 1, $offset);
140$result = $db->query($sql);
142 $num = $db->num_rows($result);
146 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
147 print
"\n<!-- debut table -->\n";
148 print
'<table class="noborder tagtable liste" width="100%" cellpadding="4">';
149 print
'<tr class="liste_titre">';
158 $maxlim = min($num, $limit);
159 while ($i < $maxlim) {
160 $obj = $db->fetch_object($result);
161 $bon->fetch($obj->bonId);
163 print
'<tr class="oddeven">';
166 print $line->LibStatut($obj->statut, 2).
' ';
167 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid.
'">';
168 print substr(
'000000'.$obj->rowid, -6).
"</a></td>";
170 if ($bon->checkIfSalaryBonPrelevement()) {
171 print
'<td><a href="'.DOL_URL_ROOT.
'/salaries/card.php?id='.$obj->socid.
'">'.$obj->name.
"</a></td>\n";
173 $thirdpartystatic->id = $obj->socid;
174 $thirdpartystatic->name = $obj->name;
176 print
'<td class="tdoverflowmax200"><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$thirdpartystatic->getNomUrl(1).
"</a></td>\n";
179 print
'<td>'.$rej->motifs[$obj->motif].
'</td>';
186 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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.