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',
'widthdrawals'));
34 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlist';
37 $socid =
GETPOST(
'socid',
'int');
38 if ($user->socid) $socid = $user->socid;
41 $type =
GETPOST(
'type',
'aZ09');
43 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
44 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
45 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
47 if (empty($page) || $page == -1) { $page = 0; }
48 $offset = $limit * $page;
49 $pageprev = $page - 1;
50 $pagenext = $page + 1;
51 if (!$sortorder) $sortorder =
"DESC";
52 if (!$sortfield) $sortfield =
"p.datec";
55 $statut =
GETPOST(
'statut',
'int');
56 $search_ref =
GETPOST(
'search_ref',
'alpha');
57 $search_amount =
GETPOST(
'search_amount',
'alpha');
60 $hookmanager->initHooks(array(
'withdrawalsreceiptslist'));
62 $usercancreate = $user->rights->prelevement->bons->creer;
63 if ($type ==
'bank-transfer') {
64 $usercancreate = $user->rights->paymentbybanktransfer->create;
72 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
83 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
85 $sql =
"SELECT p.rowid, p.ref, p.amount, p.statut, p.datec";
86 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
87 $sql .=
" WHERE p.entity IN (".getEntity(
'invoice').
")";
88 if ($type ==
'bank-transfer') {
89 $sql .=
" AND p.type = 'bank-transfer'";
91 $sql .=
" AND p.type = 'debit-order'";
94 if ($search_amount) $sql .=
natural_search(
"p.amount", $search_amount, 1);
96 $sql .= $db->order($sortfield, $sortorder);
99 $nbtotalofrecords =
'';
100 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
102 $result = $db->query($sql);
103 $nbtotalofrecords = $db->num_rows($result);
104 if (($page * $limit) > $nbtotalofrecords)
111 $sql .= $db->plimit($limit + 1, $offset);
113 $result = $db->query($sql);
116 $num = $db->num_rows($result);
120 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
121 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
122 $param .=
"&statut=".urlencode($statut);
124 $selectedfields =
'';
129 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewStandingOrder'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php');
133 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
134 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
135 print '<input type="hidden" name="token" value="'.newToken().
'">';
136 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
137 print '<input type="hidden" name="action" value="list">';
138 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
139 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
140 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
142 $titlekey =
"WithdrawalsReceipts";
143 $title = $langs->trans(
"WithdrawalsReceipts");
144 if ($type ==
'bank-transfer') {
145 $titlekey =
"BankTransferReceipts";
146 $title = $langs->trans(
"BankTransferReceipts");
149 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
153 print '<div class="div-table-responsive">';
154 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
156 print '<tr class="liste_titre">';
157 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
158 print
'<td class="liste_titre"> </td>';
159 print
'<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'"></td>';
160 print
'<td class="liste_titre"> </td>';
161 print
'<td class="liste_titre maxwidthsearch">';
162 $searchpicto = $form->showFilterButtons();
167 print
'<tr class="liste_titre">';
172 print
getTitleFieldOfList($selectedfields, 0,
$_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ').
"\n";
178 while ($i < min($num, $limit))
180 $obj = $db->fetch_object($result);
182 $directdebitorder->id = $obj->rowid;
183 $directdebitorder->ref = $obj->ref;
184 $directdebitorder->datec = $obj->datec;
185 $directdebitorder->amount = $obj->amount;
186 $directdebitorder->statut = $obj->statut;
188 print
'<tr class="oddeven">';
191 print $directdebitorder->getNomUrl(1);
194 print
'<td class="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
196 print
'<td class="right">'.price($obj->amount).
"</td>\n";
198 print
'<td class="right">';
199 print $bon->LibStatut($obj->statut, 3);
202 print
'<td class="right"></td>'.
"\n";
208 print
'<tr><td class="opacitymedium" colspan="5">'.$langs->trans(
"None").
'</td></tr>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
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.
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.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
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.