30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
48$langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
54$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57if (empty($page) || $page == -1) {
60$offset = $limit * $page;
67 $socid = $user->socid;
71$hookmanager->initHooks(array(
'withdrawalsreceiptsrejectedlist'));
73if ($type ==
'bank-transfer') {
74 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
86$title = $langs->trans(
"WithdrawsRefused");
87if ($type ==
'bank-transfer') {
88 $title = $langs->trans(
"CreditTransfersRefused");
93if ($sortorder ==
"") {
96if ($sortfield ==
"") {
97 $sortfield =
"p.datec";
102$thirdpartystatic =
new Societe($db);
103$userstatic =
new User($db);
107$sql =
"SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
108$sql .=
" s.rowid as socid, s.nom as name, p.datec";
109$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
110$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
111$sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
112$sql .=
" , ".MAIN_DB_PREFIX.
"societe as s";
113$sql .=
" WHERE pr.fk_prelevement_lignes = pl.rowid";
114$sql .=
" AND pl.fk_prelevement_bons = p.rowid";
115$sql .=
" AND pl.fk_soc = s.rowid";
116$sql .=
" AND p.entity = ".((int)
$conf->entity);
117if ($type ==
'bank-transfer') {
118 $sql .=
" AND p.type = 'bank-transfer'";
120 $sql .=
" AND p.type = 'debit-order'";
123 $sql .=
" AND s.rowid = ".((int) $socid);
126if ($type ==
'bank-transfer') {
128 $sql .=
" SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
129 $sql .=
" u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
130 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
131 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_rejet as pr";
132 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
133 $sql .=
" , ".MAIN_DB_PREFIX.
"user as u";
134 $sql .=
" WHERE pr.fk_prelevement_lignes = pl.rowid";
135 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
136 $sql .=
" AND pl.fk_user = u.rowid";
137 $sql .=
" AND p.entity = ".((int)
$conf->entity);
138 $sql .=
" AND p.type = 'bank-transfer'";
140 $sql .=
" AND s.rowid = ".((int) $socid);
143if ($type ==
'bank-transfer') {
144 $sortfield =
'datec';
146$sql .= $db->order($sortfield, $sortorder);
147$sql .= $db->plimit($limit + 1, $offset);
149$result = $db->query($sql);
151 $num = $db->num_rows($result);
155 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num);
156 print
"\n<!-- debut table -->\n";
157 print
'<table class="noborder tagtable liste" width="100%" cellpadding="4">';
158 print
'<tr class="liste_titre">';
167 $maxlim = min($num, $limit);
168 while ($i < $maxlim) {
169 $obj = $db->fetch_object($result);
170 $bon->fetch($obj->bonId);
172 print
'<tr class="oddeven">';
175 print $line->LibStatut($obj->statut, 2).
' ';
176 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid.
'">';
177 print substr(
'000000'.$obj->rowid, -6).
"</a></td>";
179 if ($bon->checkIfSalaryBonPrelevement()) {
180 print
'<td><a href="'.DOL_URL_ROOT.
'/salaries/card.php?id='.$obj->socid.
'">'.$obj->name.
"</a></td>\n";
182 $thirdpartystatic->id = $obj->socid;
183 $thirdpartystatic->name = $obj->name;
185 print
'<td class="tdoverflowmax200"><a href="'.DOL_URL_ROOT.
'/comm/card.php?socid='.$obj->socid.
'">'.$thirdpartystatic->getNomUrl(1).
"</a></td>\n";
188 print
'<td>'.$rej->motifs[$obj->motif].
'</td>';
195 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.