28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33 $langs->loadLangs(array(
'banks',
'categories',
'withdrawals'));
35 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlist';
37 $type =
GETPOST(
'type',
'aZ09');
39 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
40 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
41 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
43 if (empty($page) || $page == -1) {
46 $offset = $limit * $page;
47 $pageprev = $page - 1;
48 $pagenext = $page + 1;
53 $sortfield =
"p.datec";
56 $optioncss =
GETPOST(
'optioncss',
'alpha');
59 $statut =
GETPOST(
'statut',
'int');
60 $search_ref =
GETPOST(
'search_ref',
'alpha');
61 $search_amount =
GETPOST(
'search_amount',
'alpha');
64 $hookmanager->initHooks(array(
'withdrawalsreceiptslist'));
66 $usercancreate = $user->rights->prelevement->bons->creer;
67 if ($type ==
'bank-transfer') {
68 $usercancreate = $user->rights->paymentbybanktransfer->create;
72 $socid =
GETPOST(
'socid',
'int');
74 $socid = $user->socid;
76 if ($type ==
'bank-transfer') {
77 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
87 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
97 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
99 $sql =
"SELECT p.rowid, p.ref, p.amount, p.statut, p.datec";
103 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
104 $sql .=
" WHERE p.entity IN (".getEntity(
'invoice').
")";
105 if ($type ==
'bank-transfer') {
106 $sql .=
" AND p.type = 'bank-transfer'";
108 $sql .=
" AND p.type = 'debit-order'";
113 if ($search_amount) {
119 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
121 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
122 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
123 $resql = $db->query($sqlforcount);
125 $objforcount = $db->fetch_object(
$resql);
139 $sql .= $db->order($sortfield, $sortorder);
141 $sql .= $db->plimit($limit + 1, $offset);
144 $result = $db->query($sql);
146 $num = $db->num_rows($result);
150 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
151 $param .=
'&contextpage='.urlencode($contextpage);
153 if ($type ==
'bank-transfer') {
154 $param .=
'&type=bank-transfer';
156 if ($limit > 0 && $limit != $conf->liste_limit) {
157 $param .=
'&limit='.urlencode($limit);
159 $param .=
"&statut=".urlencode($statut);
161 $selectedfields =
'';
164 if ($usercancreate) {
165 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewStandingOrder'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php?type='.urlencode($type));
169 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
170 print
'<input type="hidden" name="token" value="'.newToken().
'">';
171 if ($optioncss !=
'') {
172 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
174 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
175 print
'<input type="hidden" name="action" value="list">';
176 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
177 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
178 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
180 print
'<input type="hidden" name="type" value="'.$type.
'">';
182 $titlekey =
"WithdrawalsReceipts";
183 $title = $langs->trans(
"WithdrawalsReceipts");
184 if ($type ==
'bank-transfer') {
185 $titlekey =
"BankTransferReceipts";
186 $title = $langs->trans(
"BankTransferReceipts");
189 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
$nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit, 0, 0, 1);
193 print
'<div class="div-table-responsive">';
194 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
196 print
'<tr class="liste_titre">';
197 print
'<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
198 print
'<td class="liste_titre"> </td>';
199 print
'<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'"></td>';
200 print
'<td class="liste_titre"> </td>';
201 print
'<td class="liste_titre maxwidthsearch">';
202 $searchpicto =
$form->showFilterButtons();
207 print
'<tr class="liste_titre">';
209 print_liste_field_titre(
"Date", $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
210 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"p.amount",
"", $param,
'', $sortfield, $sortorder,
'right ');
212 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ').
"\n";
218 while ($i < min($num, $limit)) {
219 $obj = $db->fetch_object($result);
221 $directdebitorder->id = $obj->rowid;
222 $directdebitorder->ref = $obj->ref;
223 $directdebitorder->datec = $obj->datec;
224 $directdebitorder->amount = $obj->amount;
225 $directdebitorder->statut = $obj->statut;
227 print
'<tr class="oddeven">';
230 print $directdebitorder->getNomUrl(1);
233 print
'<td class="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
235 print
'<td class="right"><span class="amount">'.price($obj->amount).
"</span></td>\n";
237 print
'<td class="right">';
238 print $bon->LibStatut($obj->statut, 5);
241 print
'<td class="right"></td>'.
"\n";
247 print
'<tr><td colspan="5"><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()
Empty header.
Class to manage withdrawal receipts.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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...
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
$nbtotalofrecords
Count total nb of records.
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.