28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
36 $langs->loadLangs(array(
'banks',
'categories',
'bills',
'companies',
'withdrawals'));
41 $socid =
GETPOST(
'socid',
'int');
42 $type =
GETPOST(
'type',
'aZ09');
45 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
46 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
47 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
49 if (empty($page) || $page == -1) {
52 $offset = $limit * $page;
53 $pageprev = $page - 1;
54 $pagenext = $page + 1;
65 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
67 $hookmanager->initHooks(array(
'directdebitprevcard',
'globalcard',
'directdebitprevlist'));
70 if ($user->socid > 0) {
74 $type = $object->type;
75 if ($type ==
'bank-transfer') {
76 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
87 $thirdpartytmp =
new Societe($db);
89 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
91 if ($id > 0 || $ref) {
92 if ($object->fetch($id, $ref) >= 0) {
94 print
dol_get_fiche_head($head,
'invoices', $langs->trans(
"WithdrawalsReceipts"), -1,
'payment');
96 $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>';
100 print
'<div class="fichecenter">';
101 print
'<div class="underbanner clearboth"></div>';
102 print
'<table class="border centpercent tableforfield">'.
"\n";
105 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date($object->datec,
'day').
'</td></tr>';
106 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td><span class="amount">'.
price($object->amount).
'</span></td></tr>';
108 if (!empty($object->date_trans)) {
109 $muser =
new User($db);
110 $muser->fetch($object->user_trans);
112 print
'<tr><td>'.$langs->trans(
"TransData").
'</td><td>';
114 print
' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getNomUrl(-1).
'</td></tr>';
115 print
'<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
116 print $object->methodes_trans[$object->method_trans];
119 if (!empty($object->date_credit)) {
120 print
'<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
129 print
'<div class="underbanner clearboth"></div>';
130 print
'<table class="border centpercent tableforfield">';
133 $result = $acc->fetch(($object->type ==
'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT));
135 print
'<tr><td class="titlefieldcreate">';
136 $labelofbankfield =
"BankToReceiveWithdraw";
137 if ($object->type ==
'bank-transfer') {
138 $labelofbankfield =
'BankToPayCreditTransfer';
140 print $langs->trans($labelofbankfield);
145 print $acc->getNomUrl(1);
150 print
'<tr><td class="titlefieldcreate">';
151 $labelfororderfield =
'WithdrawalFile';
152 if ($object->type ==
'bank-transfer') {
153 $labelfororderfield =
'CreditTransferFile';
155 print $langs->trans($labelfororderfield).
'</td><td>';
156 $relativepath =
'receipts/'.$object->ref.
'.xml';
157 $modulepart =
'prelevement';
158 if ($object->type ==
'bank-transfer') {
159 $modulepart =
'paymentbybanktransfer';
161 print
'<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath;
162 print
img_picto(
'',
'download',
'class="paddingleft"');
164 print
'</td></tr></table>';
176 $sql =
"SELECT pf.rowid, p.type,";
177 $sql .=
" f.rowid as facid, f.ref as ref, f.total_ttc,";
178 $sql .=
" s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
179 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
180 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
181 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement as pf";
182 if ($object->type !=
'bank-transfer') {
183 $sql .=
", ".MAIN_DB_PREFIX.
"facture as f";
185 $sql .=
", ".MAIN_DB_PREFIX.
"facture_fourn as f";
187 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
188 $sql .=
" WHERE pf.fk_prelevement_lignes = pl.rowid";
189 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
190 $sql .=
" AND f.fk_soc = s.rowid";
191 if ($object->type !=
'bank-transfer') {
192 $sql .=
" AND pf.fk_facture = f.rowid";
194 $sql .=
" AND pf.fk_facture_fourn = f.rowid";
196 if ($object->type !=
'bank-transfer') {
197 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
199 $sql .=
" AND f.entity IN (".getEntity(
'supplier_invoice').
")";
201 if ($object->id > 0) {
202 $sql .=
" AND p.rowid = ".((int) $object->id);
205 $sql .=
" AND s.rowid = ".((int) $socid);
207 $sql .= $db->order($sortfield, $sortorder);
211 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
212 $resql = $db->query($sql);
220 $sql .= $db->plimit($limit + 1, $offset);
222 $resql = $db->query($sql);
224 $num = $db->num_rows(
$resql);
227 if ($limit > 0 && $limit != $conf->liste_limit) {
228 $param.=
'&limit='.urlencode($limit);
230 $param =
"&id=".urlencode($id);
233 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
234 if ($optioncss !=
'') {
235 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
237 print
'<input type="hidden" name="token" value="'.newToken().
'">';
238 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
239 print
'<input type="hidden" name="action" value="list">';
240 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
241 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
242 print
'<input type="hidden" name="page" value="'.$page.
'">';
243 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
244 print
'<input type="hidden" name="id" value="'.$id.
'">';
246 $massactionbutton =
'';
248 print_barre_liste($langs->trans(
"Invoices"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'', 0,
'',
'', $limit);
250 print
"\n<!-- debut table -->\n";
251 print
'<div class="div-table-responsive-no-min">';
252 print
'<table class="liste centpercent">';
253 print
'<tr class="liste_titre">';
256 print_liste_field_titre(
"AmountInvoice", $_SERVER[
"PHP_SELF"],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
257 print_liste_field_titre(
"AmountRequested", $_SERVER[
"PHP_SELF"],
"pl.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
258 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"",
"", $param,
'align="center"', $sortfield, $sortorder);
263 $totalamount_requested = 0;
265 $invoicetmpcustomer =
new Facture($db);
268 while ($i < min($num, $limit)) {
269 $obj = $db->fetch_object(
$resql);
271 if ($obj->type ==
'bank-transfer') {
272 $invoicetmp = $invoicetmpsupplier;
274 $invoicetmp = $invoicetmpcustomer;
276 $invoicetmp->fetch($obj->facid);
278 $thirdpartytmp->fetch($obj->socid);
280 print
'<tr class="oddeven">';
283 print $invoicetmp->getNomUrl(1);
287 print $thirdpartytmp->getNomUrl(1);
291 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
294 print
'<td class="right"><span class="amount">'.price($obj->amount_requested).
"</span></td>\n";
297 print
'<td class="center">';
299 if ($obj->statut == 0) {
301 } elseif ($obj->statut == 2) {
302 if ($obj->type ==
'bank-transfer') {
303 print $langs->trans(
"StatusDebited");
305 print $langs->trans(
"StatusCredited");
307 } elseif ($obj->statut == 3) {
308 print
'<b>'.$langs->trans(
"StatusRefused").
'</b>';
317 $totalinvoices += $obj->total_ttc;
318 $totalamount_requested += $obj->amount_requested;
324 print
'<tr class="liste_total">';
325 print
'<td>'.$langs->trans(
"Total").
'</td>';
326 print
'<td> </td>';
327 print
'<td class="right">';
329 print
'<td class="right">';
332 print
img_warning(
"AmountOfFileDiffersFromSumOfInvoices");
334 print
price($totalamount_requested);
336 print
'<td> </td>';
337 print
'<td> </td>';
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage withdrawal receipts.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
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.
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
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)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show 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.
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
$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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.