Go to the documentation of this file.
27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/modules/modPrelevement.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35 $langs->loadLangs(array(
'banks',
'categories',
'withdrawals',
'companies'));
38 $socid =
GETPOST(
'socid',
'int');
39 $status =
GETPOST(
'status',
'int');
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlist';
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
43 $optioncss =
GETPOST(
'optioncss',
'aZ');
45 $type =
GETPOST(
'type',
'aZ09');
47 $search_facture =
GETPOST(
'search_facture',
'alpha');
48 $search_societe =
GETPOST(
'search_societe',
'alpha');
51 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
52 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55 if (empty($page) || $page == -1 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha') || (empty($toselect) && $massaction ===
'0')) {
58 $offset = $limit * $page;
59 $pageprev = $page - 1;
60 $pagenext = $page + 1;
68 $massactionbutton =
'';
70 $hookmanager->initHooks(array(
'withdrawalstodolist'));
73 $socid = $user->socid;
75 if ($type ==
'bank-transfer') {
76 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
86 $parameters = array(
'socid' => $socid,
'limit' => $limit,
'page' => $page,
'offset' => $offset);
87 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
93 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
96 $search_array_options = array();
105 if ($type !=
'bank-transfer') {
107 $title = $langs->trans(
"RequestStandingOrderToTreat");
109 $title = $langs->trans(
"RequestStandingOrderTreated");
113 $title = $langs->trans(
"RequestPaymentsByBankTransferToTreat");
115 $title = $langs->trans(
"RequestPaymentsByBankTransferTreated");
121 $thirdpartystatic =
new Societe($db);
122 if ($type ==
'bank-transfer') {
125 $invoicestatic =
new Facture($db);
130 $sql =
"SELECT f.ref, f.rowid, f.total_ttc,";
131 $sql .=
" s.nom as name, s.rowid as socid,";
132 $sql .=
" pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande";
133 if ($type !=
'bank-transfer') {
134 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture as f,";
136 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facture_fourn as f,";
138 $sql .=
" ".MAIN_DB_PREFIX.
"societe as s,";
139 $sql .=
" ".MAIN_DB_PREFIX.
"prelevement_facture_demande as pfd";
140 if (empty($user->rights->societe->client->voir) && !$socid) {
141 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
143 $sql .=
" WHERE s.rowid = f.fk_soc";
144 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
145 if (empty($user->rights->societe->client->voir) && !$socid) {
146 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
149 $sql .=
" AND f.fk_soc = ".((int) $socid);
152 $sql .=
" AND pfd.traite = 0";
154 $sql .=
" AND pfd.ext_payment_id IS NULL";
156 $sql .=
" AND pfd.traite = ".((int) $status);
158 $sql .=
" AND f.total_ttc > 0";
159 if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
160 $sql .=
" AND f.fk_statut = ".Facture::STATUS_VALIDATED;
162 if ($type !=
'bank-transfer') {
163 $sql .=
" AND pfd.fk_facture = f.rowid";
165 $sql .=
" AND pfd.fk_facture_fourn = f.rowid";
167 if ($search_facture) {
170 if ($search_societe) {
173 $sql .= $db->order($sortfield, $sortorder);
176 $nbtotalofrecords =
'';
177 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
178 $resql = $db->query($sql);
179 $nbtotalofrecords = $db->num_rows(
$resql);
180 if (($page * $limit) > $nbtotalofrecords) {
186 if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
187 $num = $nbtotalofrecords;
189 $sql .= $db->plimit($limit + 1, $offset);
191 $resql = $db->query($sql);
197 $num = $db->num_rows(
$resql);
202 $newcardbutton =
'<a class="marginrightonly" href="'.DOL_URL_ROOT.
'/compta/prelevement/index.php">'.$langs->trans(
"Back").
'</a>';
203 if ($type ==
'bank-transfer') {
204 $newcardbutton =
'<a class="marginrightonly" href="'.DOL_URL_ROOT.
'/compta/paymentbybanktransfer/index.php">'.$langs->trans(
"Back").
'</a>';
207 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" id="searchFormList" name="searchFormList">';
208 if ($optioncss !=
'') {
209 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
211 print
'<input type="hidden" name="token" value="'.newToken().
'">';
212 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
213 print
'<input type="hidden" name="action" value="list">';
214 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
215 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
216 print
'<input type="hidden" name="page" value="'.$page.
'">';
217 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
221 $label =
'NewStandingOrder';
223 if ($type ==
'bank-transfer') {
224 $label =
'NewPaymentByBankTransfer';
225 $typefilter =
'type='.$type;
227 $newcardbutton .=
dolGetButtonTitle($langs->trans($label),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/compta/prelevement/create.php'.($typefilter ?
'?'.$typefilter :
''));
229 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'generic', 0, $newcardbutton,
'', $limit);
231 print
'<table class="liste centpercent">';
233 print
'<tr class="liste_titre">';
241 print
'<tr class="liste_titre">';
242 print
'<td class="liste_titre"><input type="text" class="flat maxwidth150" name="search_facture" value="'.dol_escape_htmltag($search_facture).
'"></td>';
243 print
'<td class="liste_titre"><input type="text" class="flat maxwidth150" name="search_societe" value="'.dol_escape_htmltag($search_societe).
'"></td>';
244 print
'<td class="liste_titre"></td>';
245 print
'<td class="liste_titre"></td>';
247 print
'<td class="liste_titre maxwidthsearch">';
248 $searchpicto =
$form->showFilterButtons();
254 while ($i < min($num, $limit)) {
255 $obj = $db->fetch_object(
$resql);
260 $invoicestatic->fetch($obj->rowid);
262 print
'<tr class="oddeven">';
266 print $invoicestatic->getNomUrl(1,
'withdraw');
270 $thirdpartystatic->id = $obj->socid;
271 $thirdpartystatic->name = $obj->name;
272 print $thirdpartystatic->getNomUrl(1,
'customer');
275 print
'<td class="right">';
276 print
price($obj->amount, 1, $langs, 1, -1, -1, $conf->currency).
' / '.
price($obj->total_ttc, 1, $langs, 1, -1, -1, $conf->currency);
279 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_demande),
'day').
'</td>';
281 print
'<td class="right"></td>';
287 print
"</table><br>";
Class to manage third parties objects (customers, suppliers, prospects...)
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage suppliers invoices.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Class to manage invoices.
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 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.
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...
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.