27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32 $langs->loadLangs(array(
'banks',
'categories',
'withdrawals'));
34 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlist';
36 $type =
GETPOST(
'type',
'aZ09');
38 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
39 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
40 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
42 if (empty($page) || $page == -1) {
45 $offset = $limit * $page;
46 $pageprev = $page - 1;
47 $pagenext = $page + 1;
52 $sortfield =
"p.datec";
56 $statut =
GETPOST(
'statut',
'int');
57 $search_ref =
GETPOST(
'search_ref',
'alpha');
58 $search_amount =
GETPOST(
'search_amount',
'alpha');
61 $hookmanager->initHooks(array(
'withdrawalsreceiptslist'));
63 $usercancreate = $user->rights->prelevement->bons->creer;
64 if ($type ==
'bank-transfer') {
65 $usercancreate = $user->rights->paymentbybanktransfer->create;
69 $socid =
GETPOST(
'socid',
'int');
71 $socid = $user->socid;
73 if ($type ==
'bank-transfer') {
74 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
84 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
94 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
96 $sql =
"SELECT p.rowid, p.ref, p.amount, p.statut, p.datec";
97 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
98 $sql .=
" WHERE p.entity IN (".getEntity(
'invoice').
")";
99 if ($type ==
'bank-transfer') {
100 $sql .=
" AND p.type = 'bank-transfer'";
102 $sql .=
" AND p.type = 'debit-order'";
107 if ($search_amount) {
111 $sql .= $db->order($sortfield, $sortorder);
114 $nbtotalofrecords =
'';
115 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
116 $result = $db->query($sql);
117 $nbtotalofrecords = $db->num_rows($result);
118 if (($page * $limit) > $nbtotalofrecords) {
124 $sql .= $db->plimit($limit + 1, $offset);
126 $result = $db->query($sql);
128 $num = $db->num_rows($result);
132 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
133 $param .=
'&contextpage='.urlencode($contextpage);
135 if ($type ==
'bank-transfer') {
136 $param .=
'&type=bank-transfer';
138 if ($limit > 0 && $limit != $conf->liste_limit) {
139 $param .=
'&limit='.urlencode($limit);
141 $param .=
"&statut=".urlencode($statut);
143 $selectedfields =
'';
146 if ($usercancreate) {
147 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewStandingOrder'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php?type='.urlencode($type));
151 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
152 print
'<input type="hidden" name="token" value="'.newToken().
'">';
153 if ($optioncss !=
'') {
154 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
156 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
157 print
'<input type="hidden" name="action" value="list">';
158 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
159 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
160 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
162 $titlekey =
"WithdrawalsReceipts";
163 $title = $langs->trans(
"WithdrawalsReceipts");
164 if ($type ==
'bank-transfer') {
165 $titlekey =
"BankTransferReceipts";
166 $title = $langs->trans(
"BankTransferReceipts");
169 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
173 print
'<div class="div-table-responsive">';
174 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
176 print
'<tr class="liste_titre">';
177 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
178 print
'<td class="liste_titre"> </td>';
179 print
'<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'"></td>';
180 print
'<td class="liste_titre"> </td>';
181 print
'<td class="liste_titre maxwidthsearch">';
182 $searchpicto =
$form->showFilterButtons();
187 print
'<tr class="liste_titre">';
189 print_liste_field_titre(
"Date", $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
190 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"p.amount",
"", $param,
'', $sortfield, $sortorder,
'right ');
192 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ').
"\n";
198 while ($i < min($num, $limit)) {
199 $obj = $db->fetch_object($result);
201 $directdebitorder->id = $obj->rowid;
202 $directdebitorder->ref = $obj->ref;
203 $directdebitorder->datec = $obj->datec;
204 $directdebitorder->amount = $obj->amount;
205 $directdebitorder->statut = $obj->statut;
207 print
'<tr class="oddeven">';
210 print $directdebitorder->getNomUrl(1);
213 print
'<td class="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
215 print
'<td class="right"><span class="amount">'.price($obj->amount).
"</span></td>\n";
217 print
'<td class="right">';
218 print $bon->LibStatut($obj->statut, 5);
221 print
'<td class="right"></td>'.
"\n";
227 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage withdrawal receipts.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
restrictedArea($user, $features, $objectid=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.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.