27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/rejetprelevement.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/class/paiement.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35 $langs->loadLangs(array(
'banks',
'categories',
'bills',
'companies',
'withdrawals'));
40 $socid =
GETPOST(
'socid',
'int');
41 $type =
GETPOST(
'type',
'aZ09');
44 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
45 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
46 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
48 if (empty($page) || $page == -1) {
51 $offset = $limit * $page;
52 $pageprev = $page - 1;
53 $pagenext = $page + 1;
64 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
66 $hookmanager->initHooks(array(
'directdebitprevcard',
'globalcard',
'directdebitprevlist'));
69 if ($user->socid > 0) {
73 $type = $object->type;
74 if ($type ==
'bank-transfer') {
75 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
86 $thirdpartytmp =
new Societe($db);
88 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
90 if ($id > 0 || $ref) {
91 if ($object->fetch($id, $ref) >= 0) {
93 print
dol_get_fiche_head($head,
'invoices', $langs->trans(
"WithdrawalsReceipts"), -1,
'payment');
95 $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>';
99 print
'<div class="fichecenter">';
100 print
'<div class="underbanner clearboth"></div>';
101 print
'<table class="border centpercent tableforfield">'.
"\n";
104 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date($object->datec,
'day').
'</td></tr>';
105 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td><span class="amount">'.
price($object->amount).
'</span></td></tr>';
107 if ($object->date_trans <> 0) {
108 $muser =
new User($db);
109 $muser->fetch($object->user_trans);
111 print
'<tr><td>'.$langs->trans(
"TransData").
'</td><td>';
113 print
' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getNomUrl(-1).
'</td></tr>';
114 print
'<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
115 print $object->methodes_trans[$object->method_trans];
118 if ($object->date_credit <> 0) {
119 print
'<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
128 print
'<div class="underbanner clearboth"></div>';
129 print
'<table class="border centpercent tableforfield">';
132 $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
134 print
'<tr><td class="titlefieldcreate">';
135 $labelofbankfield =
"BankToReceiveWithdraw";
136 if ($object->type ==
'bank-transfer') {
137 $labelofbankfield =
'BankToPayCreditTransfer';
139 print $langs->trans($labelofbankfield);
143 print $acc->getNomUrl(1);
148 print
'<tr><td class="titlefieldcreate">';
149 $labelfororderfield =
'WithdrawalFile';
150 if ($object->type ==
'bank-transfer') {
151 $labelfororderfield =
'CreditTransferFile';
153 print $langs->trans($labelfororderfield).
'</td><td>';
154 $relativepath =
'receipts/'.$object->ref.
'.xml';
155 $modulepart =
'prelevement';
156 if ($object->type ==
'bank-transfer') {
157 $modulepart =
'paymentbybanktransfer';
159 print
'<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath;
160 print
img_picto(
'',
'download',
'class="paddingleft"');
162 print
'</td></tr></table>';
174 $sql =
"SELECT pf.rowid, p.type,";
175 $sql .=
" f.rowid as facid, f.ref as ref, f.total_ttc,";
176 $sql .=
" s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
177 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
178 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
179 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_facture as pf";
180 if ($object->type !=
'bank-transfer') {
181 $sql .=
", ".MAIN_DB_PREFIX.
"facture as f";
183 $sql .=
", ".MAIN_DB_PREFIX.
"facture_fourn as f";
185 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
186 $sql .=
" WHERE pf.fk_prelevement_lignes = pl.rowid";
187 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
188 $sql .=
" AND f.fk_soc = s.rowid";
189 if ($object->type !=
'bank-transfer') {
190 $sql .=
" AND pf.fk_facture = f.rowid";
192 $sql .=
" AND pf.fk_facture_fourn = f.rowid";
194 if ($object->type !=
'bank-transfer') {
195 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
197 $sql .=
" AND f.entity IN (".getEntity(
'supplier_invoice').
")";
199 if ($object->id > 0) {
200 $sql .=
" AND p.rowid = ".((int) $object->id);
203 $sql .=
" AND s.rowid = ".((int) $socid);
205 $sql .= $db->order($sortfield, $sortorder);
208 $nbtotalofrecords =
'';
209 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
210 $resql = $db->query($sql);
211 $nbtotalofrecords = $db->num_rows(
$resql);
212 if (($page * $limit) > $nbtotalofrecords) {
218 $sql .= $db->plimit($limit + 1, $offset);
220 $resql = $db->query($sql);
222 $num = $db->num_rows(
$resql);
225 if ($limit > 0 && $limit != $conf->liste_limit) {
226 $param.=
'&limit='.urlencode($limit);
228 $param =
"&id=".urlencode($id);
231 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
232 if ($optioncss !=
'') {
233 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
235 print
'<input type="hidden" name="token" value="'.newToken().
'">';
236 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
237 print
'<input type="hidden" name="action" value="list">';
238 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
239 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
240 print
'<input type="hidden" name="page" value="'.$page.
'">';
241 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
242 print
'<input type="hidden" name="id" value="'.$id.
'">';
244 $massactionbutton =
'';
246 print_barre_liste($langs->trans(
"Invoices"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
248 print
"\n<!-- debut table -->\n";
249 print
'<div class="div-table-responsive-no-min">';
250 print
'<table class="liste centpercent">';
251 print
'<tr class="liste_titre">';
254 print_liste_field_titre(
"AmountInvoice", $_SERVER[
"PHP_SELF"],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
255 print_liste_field_titre(
"AmountRequested", $_SERVER[
"PHP_SELF"],
"pl.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
256 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"",
"", $param,
'align="center"', $sortfield, $sortorder);
261 $totalamount_requested = 0;
263 $invoicetmpcustomer =
new Facture($db);
266 while ($i < min($num, $limit)) {
267 $obj = $db->fetch_object(
$resql);
269 if ($obj->type ==
'bank-transfer') {
270 $invoicetmp = $invoicetmpsupplier;
272 $invoicetmp = $invoicetmpcustomer;
274 $invoicetmp->fetch($obj->facid);
276 $thirdpartytmp->fetch($obj->socid);
278 print
'<tr class="oddeven">';
281 print $invoicetmp->getNomUrl(1);
285 print $thirdpartytmp->getNomUrl(1);
289 print
'<td class="right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
292 print
'<td class="right"><span class="amount">'.price($obj->amount_requested).
"</span></td>\n";
295 print
'<td class="center">';
297 if ($obj->statut == 0) {
299 } elseif ($obj->statut == 2) {
300 if ($obj->type ==
'bank-transfer') {
301 print $langs->trans(
"StatusDebited");
303 print $langs->trans(
"StatusCredited");
305 } elseif ($obj->statut == 3) {
306 print
'<b>'.$langs->trans(
"StatusRefused").
'</b>';
315 $totalinvoices += $obj->total_ttc;
316 $totalamount_requested += $obj->amount_requested;
322 print
'<tr class="liste_total">';
323 print
'<td>'.$langs->trans(
"Total").
'</td>';
324 print
'<td> </td>';
325 print
'<td class="right">';
327 if ($totalamount_requested != $object->amount) {
328 print
img_warning(
"AmountOfFileDiffersFromSumOfInvoices");
331 print
'<td class="right">';
332 print
price($totalamount_requested);
334 print
'<td> </td>';
335 print
'<td> </td>';
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 Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage suppliers invoices.
Class to manage bank accounts.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
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...
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage withdrawal receipts.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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.
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.
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
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.