Go to the documentation of this file.
28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
37 $langs->loadLangs(array(
'banks',
'categories',
'bills',
'companies',
'withdrawals'));
42 $socid =
GETPOST(
'socid',
'int');
43 $type =
GETPOST(
'type',
'aZ09');
46 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
47 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
48 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
50 if (empty($page) || $page == -1) {
53 $offset = $limit * $page;
54 $pageprev = $page - 1;
55 $pagenext = $page + 1;
66 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
68 $hookmanager->initHooks(array(
'directdebitprevcard',
'globalcard',
'directdebitprevlist'));
71 if ($user->socid > 0) {
75 $type = $object->type;
76 if ($type ==
'bank-transfer') {
77 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
88 $thirdpartytmp =
new Societe($db);
90 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
92 if ($id > 0 || $ref) {
93 if ($object->fetch($id, $ref) >= 0) {
95 print
dol_get_fiche_head($head,
'invoices', $langs->trans(
"WithdrawalsReceipts"), -1,
'payment');
97 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type !=
'bank-transfer' ?
'' :
'&type=bank-transfer').
'">'.$langs->trans(
"BackToList").
'</a>';
101 print
'<div class="fichecenter">';
102 print
'<div class="underbanner clearboth"></div>';
103 print
'<table class="border centpercent tableforfield">'.
"\n";
106 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date($object->datec,
'day').
'</td></tr>';
107 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td><span class="amount">'.
price($object->amount).
'</span></td></tr>';
109 if (!empty($object->date_trans)) {
110 $muser =
new User($db);
111 $muser->fetch($object->user_trans);
113 print
'<tr><td>'.$langs->trans(
"TransData").
'</td><td>';
115 print
' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getNomUrl(-1).
'</td></tr>';
116 print
'<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
117 print $object->methodes_trans[$object->method_trans];
120 if (!empty($object->date_credit)) {
121 print
'<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
130 print
'<div class="underbanner clearboth"></div>';
131 print
'<table class="border centpercent tableforfield">';
135 $fk_bank_account = $object->fk_bank_account;
136 if (empty($fk_bank_account)) {
137 $fk_bank_account = ($object->type ==
'bank-transfer' ?
getDolGlobalInt(
'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') :
getDolGlobalInt(
'PRELEVEMENT_ID_BANKACCOUNT'));
139 if ($fk_bank_account > 0) {
140 $result = $acc->fetch($fk_bank_account);
143 $labelofbankfield =
"BankToReceiveWithdraw";
144 if ($object->type ==
'bank-transfer') {
145 $labelofbankfield =
'BankToPayCreditTransfer';
148 print
'<tr><td class="titlefieldcreate">';
149 print
$form->textwithpicto($langs->trans(
"BankAccount"), $langs->trans($labelofbankfield));
154 print $acc->getNomUrl(1);
159 $modulepart =
'prelevement';
160 if ($object->type ==
'bank-transfer') {
161 $modulepart =
'paymentbybanktransfer';
164 print
'<tr><td class="titlefieldcreate">';
165 $labelfororderfield =
'WithdrawalFile';
166 if ($object->type ==
'bank-transfer') {
167 $labelfororderfield =
'CreditTransferFile';
169 print $langs->trans($labelfororderfield).
'</td><td>';
172 $labelentity = $conf->entity;
173 $relativepath =
'receipts/'.$object->ref.
'-'.$labelentity.
'.xml';
175 if ($type !=
'bank-transfer') {
176 $dir = $conf->prelevement->dir_output;
178 $dir = $conf->paymentbybanktransfer->dir_output;
181 $relativepath =
'receipts/'.$object->ref.
'.xml';
184 $relativepath =
'receipts/'.$object->ref.
'.xml';
187 print
'<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath;
188 print
img_picto(
'',
'download',
'class="paddingleft"');
190 print
'</td></tr></table>';
202 $sql =
"SELECT pf.rowid, p.type,";
203 $sql .=
" f.rowid as facid, f.ref as ref, f.total_ttc,";
204 if ($object->type ==
'bank-transfer') {
205 $sql .=
" f.ref_supplier,";
207 $sql .=
" s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
208 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
209 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
210 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement as pf";
211 if ($object->type !=
'bank-transfer') {
212 $sql .=
", ".MAIN_DB_PREFIX.
"facture as f";
214 $sql .=
", ".MAIN_DB_PREFIX.
"facture_fourn as f";
216 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
217 $sql .=
" WHERE pf.fk_prelevement_lignes = pl.rowid";
218 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
219 $sql .=
" AND f.fk_soc = s.rowid";
220 if ($object->type !=
'bank-transfer') {
221 $sql .=
" AND pf.fk_facture = f.rowid";
223 $sql .=
" AND pf.fk_facture_fourn = f.rowid";
225 if ($object->type !=
'bank-transfer') {
226 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
228 $sql .=
" AND f.entity IN (".getEntity(
'supplier_invoice').
")";
230 if ($object->id > 0) {
231 $sql .=
" AND p.rowid = ".((int) $object->id);
234 $sql .=
" AND s.rowid = ".((int) $socid);
236 $sql .= $db->order($sortfield, $sortorder);
239 $nbtotalofrecords =
'';
241 $resql = $db->query(
$sql);
242 $nbtotalofrecords = $db->num_rows($resql);
243 if (($page * $limit) > $nbtotalofrecords) {
249 $sql .= $db->plimit($limit + 1, $offset);
251 $resql = $db->query(
$sql);
253 $num = $db->num_rows($resql);
256 if ($limit > 0 && $limit != $conf->liste_limit) {
257 $param.=
'&limit='.((int) $limit);
259 $param =
"&id=".urlencode($id);
262 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
263 if ($optioncss !=
'') {
264 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
266 print
'<input type="hidden" name="token" value="'.newToken().
'">';
267 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
268 print
'<input type="hidden" name="action" value="list">';
269 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
270 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
271 print
'<input type="hidden" name="page" value="'.$page.
'">';
272 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
273 print
'<input type="hidden" name="id" value="'.$id.
'">';
275 $massactionbutton =
'';
277 print_barre_liste($langs->trans(
"Invoices"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
279 print
"\n<!-- debut table -->\n";
280 print
'<div class="div-table-responsive-no-min">';
281 print
'<table class="liste centpercent">';
282 print
'<tr class="liste_titre">';
284 if ($object->type ==
'bank-transfer') {
285 print_liste_field_titre(
"RefSupplierShort", $_SERVER[
"PHP_SELF"],
"f.ref_supplier",
'', $param,
'', $sortfield, $sortorder);
288 print_liste_field_titre(
"AmountInvoice", $_SERVER[
"PHP_SELF"],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
289 print_liste_field_titre(
"AmountRequested", $_SERVER[
"PHP_SELF"],
"pl.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
290 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"",
"", $param,
'align="center"', $sortfield, $sortorder);
295 $totalamount_requested = 0;
297 $invoicetmpcustomer =
new Facture($db);
300 while ($i < min($num, $limit)) {
301 $obj = $db->fetch_object($resql);
303 if ($obj->type ==
'bank-transfer') {
304 $invoicetmp = $invoicetmpsupplier;
306 $invoicetmp = $invoicetmpcustomer;
308 $invoicetmp->fetch($obj->facid);
310 $thirdpartytmp->fetch($obj->socid);
312 print
'<tr class="oddeven">';
315 print $invoicetmp->getNomUrl(1);
318 if ($object->type ==
'bank-transfer') {
325 print $thirdpartytmp->getNomUrl(1);
329 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
332 print
'<td class="right"><span class="amount">'.price($obj->amount_requested).
"</span></td>\n";
335 print
'<td class="center">';
337 if ($obj->statut == 0) {
339 } elseif ($obj->statut == 2) {
340 if ($obj->type ==
'bank-transfer') {
341 print $langs->trans(
"StatusDebited");
343 print $langs->trans(
"StatusCredited");
345 } elseif ($obj->statut == 3) {
346 print
'<b>'.$langs->trans(
"StatusRefused").
'</b>';
355 $totalinvoices += $obj->total_ttc;
356 $totalamount_requested += $obj->amount_requested;
362 print
'<tr class="liste_total">';
363 print
'<td>'.$langs->trans(
"Total").
'</td>';
364 if ($object->type ==
'bank-transfer') {
365 print
'<td> </td>';
367 print
'<td> </td>';
368 print
'<td class="right">';
370 print
'<td class="right">';
372 if (($nbtotalofrecords <= $num) && $totalamount_requested != $object->amount) {
373 print
img_warning(
"AmountOfFileDiffersFromSumOfInvoices");
375 print
price($totalamount_requested);
377 print
'<td> </td>';
378 print
'<td> </td>';
Class to manage third parties objects (customers, suppliers, prospects...)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Class to manage invoices.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_is_file($pathoffile)
Return if path is a file.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
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.
if(isModEnabled('facture') && $user->hasRight('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') && $user->hasRight('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)) $sql
Social contributions to pay.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
Class to manage Dolibarr users.
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.
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.
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Class to manage bank accounts.