28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33$langs->loadLangs(array(
'banks',
'categories',
'withdrawals'));
35$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
36$massaction =
GETPOST(
'massaction',
'alpha');
37$confirm =
GETPOST(
'confirm',
'alpha');
38$cancel =
GETPOST(
'cancel',
'alpha');
39$toselect =
GETPOST(
'toselect',
'array');
40$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlist';
41$backtopage =
GETPOST(
'backtopage',
'alpha');
42$optioncss =
GETPOST(
'optioncss',
'alpha');
43$mode =
GETPOST(
'mode',
'alpha');
48$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
49$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
50$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
51$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
52if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
56$offset = $limit * $page;
63 $sortfield =
"p.datec";
67$statut =
GETPOST(
'statut',
'int');
68$search_ref =
GETPOST(
'search_ref',
'alpha');
69$search_amount =
GETPOST(
'search_amount',
'alpha');
72$hookmanager->initHooks(array(
'withdrawalsreceiptslist'));
74$usercancreate = $user->rights->prelevement->bons->creer;
75if ($type ==
'bank-transfer') {
76 $usercancreate = $user->rights->paymentbybanktransfer->create;
80$socid =
GETPOST(
'socid',
'int');
82 $socid = $user->socid;
84if ($type ==
'bank-transfer') {
85 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
95if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
107$titlekey =
"WithdrawalsReceipts";
108$title = $langs->trans(
"WithdrawalsReceipts");
109if ($type ==
'bank-transfer') {
110 $titlekey =
"BankTransferReceipts";
111 $title = $langs->trans(
"BankTransferReceipts");
116$sql =
"SELECT p.rowid, p.ref, p.amount, p.statut, p.datec";
120$sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
121$sql .=
" WHERE p.entity IN (".getEntity(
'invoice').
")";
122if ($type ==
'bank-transfer') {
123 $sql .=
" AND p.type = 'bank-transfer'";
125 $sql .=
" AND p.type = 'debit-order'";
135$nbtotalofrecords =
'';
138 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
139 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
140 $resql = $db->query($sqlforcount);
142 $objforcount = $db->fetch_object($resql);
143 $nbtotalofrecords = $objforcount->nbtotalofrecords;
148 if (($page * $limit) > $nbtotalofrecords) {
156$sql .= $db->order($sortfield, $sortorder);
158 $sql .= $db->plimit($limit + 1, $offset);
161$resql = $db->query($sql);
167$num = $db->num_rows($resql);
174$arrayofselected = is_array($toselect) ? $toselect : array();
176$param .=
"&statut=".urlencode($statut);
177if ($type ==
'bank-transfer') {
178 $param .=
'&type=bank-transfer';
181 $param .=
'&mode='.urlencode($mode);
183if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
184 $param .=
'&contextpage='.urlencode($contextpage);
186if ($limit > 0 && $limit != $conf->liste_limit) {
187 $param .=
'&limit='.((int) $limit);
189if ($optioncss !=
'') {
190 $param .=
'&optioncss='.urlencode($optioncss);
193$arrayofmassactions = array(
197$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
199print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
200print
'<input type="hidden" name="token" value="'.newToken().
'">';
201if ($optioncss !=
'') {
202 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
204print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
205print
'<input type="hidden" name="action" value="list">';
206print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
207print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
208print
'<input type="hidden" name="page" value="'.$page.
'">';
209print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
210print
'<input type="hidden" name="page_y" value="">';
211print
'<input type="hidden" name="mode" value="'.$mode.
'">';
214 print
'<input type="hidden" name="type" value="'.$type.
'">';
218$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
219$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
221 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewStandingOrder'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php?type='.urlencode($type));
224print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
231$parameters = array();
232$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
233if (empty($reshook)) {
234 $moreforfilter .= $hookmanager->resPrint;
236 $moreforfilter = $hookmanager->resPrint;
239if (!empty($moreforfilter)) {
240 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
241 print $moreforfilter;
242 $parameters = array();
243 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
244 print $hookmanager->resPrint;
248$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
249$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
250$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
252print
'<div class="div-table-responsive">';
253print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
257print
'<tr class="liste_titre_filter">';
260 print
'<td class="liste_titre center maxwidthsearch">';
261 $searchpicto = $form->showFilterButtons(
'left');
265print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
266print
'<td class="liste_titre"> </td>';
267print
'<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'"></td>';
268print
'<td class="liste_titre"> </td>';
271 print
'<td class="liste_titre center maxwidthsearch">';
272 $searchpicto = $form->showFilterButtons();
278$totalarray = array();
279$totalarray[
'nbfield'] = 0;
283print
'<tr class="liste_titre">';
286 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
287 $totalarray[
'nbfield']++;
290$totalarray[
'nbfield']++;
291print_liste_field_titre(
"Date", $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
292$totalarray[
'nbfield']++;
293print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"p.amount",
"", $param,
'', $sortfield, $sortorder,
'right ');
294$totalarray[
'nbfield']++;
296$totalarray[
'nbfield']++;
299 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
300 $totalarray[
'nbfield']++;
308$savnbfield = $totalarray[
'nbfield'];
309$totalarray = array();
310$totalarray[
'nbfield'] = 0;
312$imaxinloop = ($limit ? min($num, $limit) : $num);
313while ($i < $imaxinloop) {
314 $obj = $db->fetch_object($resql);
316 $directdebitorder->id = $obj->rowid;
317 $directdebitorder->ref = $obj->ref;
318 $directdebitorder->date_echeance = $obj->datec;
319 $directdebitorder->total = $obj->amount;
320 $directdebitorder->statut = $obj->statut;
322 $object = $directdebitorder;
324 if ($mode ==
'kanban') {
326 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
327 print
'<div class="box-flex-container kanban">';
330 if ($massactionbutton || $massaction) {
332 if (in_array($object->id, $arrayofselected)) {
336 print $directdebitorder->getKanbanView(
'', array(
'selected' => in_array($obj->id, $arrayofselected)));
337 if ($i == ($imaxinloop - 1)) {
344 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
348 print
'<td class="nowrap center">';
349 if ($massactionbutton || $massaction) {
351 if (in_array($object->id, $arrayofselected)) {
354 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
358 $totalarray[
'nbfield']++;
363 print $directdebitorder->getNomUrl(1);
366 print
'<td class="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
368 print
'<td class="right"><span class="amount">'.price($obj->amount).
"</span></td>\n";
370 print
'<td class="right">';
371 print $bon->LibStatut($obj->statut, 5);
376 print
'<td class="nowrap center">';
377 if ($massactionbutton || $massaction) {
379 if (in_array($object->id, $arrayofselected)) {
382 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
386 $totalarray[
'nbfield']++;
396 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
401$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
402$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
403print $hookmanager->resPrint;
405print
'</table>'.
"\n";
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get 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.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.