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'));
43 $socid =
GETPOST(
'socid',
'int');
44 $type =
GETPOST(
'type',
'aZ09');
47 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
48 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
49 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
51 if (empty($page) || $page == -1) { $page = 0; }
52 $offset = $limit * $page;
53 $pageprev = $page - 1;
54 $pagenext = $page + 1;
55 if (!$sortfield) $sortfield =
'p.ref';
56 if (!$sortorder) $sortorder =
'DESC';
61 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
63 $hookmanager->initHooks(array(
'directdebitprevcard',
'globalcard',
'directdebitprevlist'));
65 if (!$user->rights->prelevement->bons->lire && $object->type !=
'bank-transfer') {
68 if (!$user->rights->paymentbybanktransfer->read && $object->type ==
'bank-transfer') {
78 $thirdpartytmp =
new Societe($db);
80 llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
84 if ($object->fetch($id, $ref) >= 0)
89 $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>';
93 print '<div class="fichecenter">';
94 print '<div class="underbanner clearboth"></div>';
95 print '<table class="border centpercent tableforfield">'.
"\n";
98 print '<tr><td class="titlefield">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date($object->datec,
'day').
'</td></tr>';
99 print '<tr><td>'.$langs->trans(
"Amount").
'</td><td>'.
price($object->amount).
'</td></tr>';
101 if ($object->date_trans <> 0)
103 $muser =
new User($db);
104 $muser->fetch($object->user_trans);
106 print '<tr><td>'.$langs->trans(
"TransData").
'</td><td>';
108 print ' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getFullName($langs).
'</td></tr>';
109 print '<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
110 print $object->methodes_trans[$object->method_trans];
113 if ($object->date_credit <> 0)
115 print '<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
124 print '<div class="underbanner clearboth"></div>';
125 print '<table class="border centpercent tableforfield">';
128 $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
130 print '<tr><td class="titlefield">';
131 $labelofbankfield =
"BankToReceiveWithdraw";
132 if ($object->type ==
'bank-transfer') $labelofbankfield =
'BankToPayCreditTransfer';
133 print $langs->trans($labelofbankfield);
137 print $acc->getNomUrl(1);
141 print '<tr><td class="titlefield">';
142 $labelfororderfield =
'WithdrawalFile';
143 if ($object->type ==
'bank-transfer') $labelfororderfield =
'CreditTransferFile';
144 print $langs->trans($labelfororderfield).
'</td><td>';
145 $relativepath =
'receipts/'.$object->ref.
'.xml';
146 $modulepart =
'prelevement';
147 if ($object->type ==
'bank-transfer') $modulepart =
'paymentbybanktransfer';
148 print '<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath.
'</a>';
149 print '</td></tr></table>';
161 $sql =
"SELECT pf.rowid, p.type,";
162 $sql .=
" f.rowid as facid, f.ref as ref, f.total_ttc,";
163 $sql .=
" s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
164 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
165 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
166 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_facture as pf";
167 if ($object->type !=
'bank-transfer') {
168 $sql .=
", ".MAIN_DB_PREFIX.
"facture as f";
170 $sql .=
", ".MAIN_DB_PREFIX.
"facture_fourn as f";
172 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
173 $sql .=
" WHERE pf.fk_prelevement_lignes = pl.rowid";
174 $sql .=
" AND pl.fk_prelevement_bons = p.rowid";
175 $sql .=
" AND f.fk_soc = s.rowid";
176 if ($object->type !=
'bank-transfer') {
177 $sql .=
" AND pf.fk_facture = f.rowid";
179 $sql .=
" AND pf.fk_facture_fourn = f.rowid";
181 if ($object->type !=
'bank-transfer') {
182 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
184 $sql .=
" AND f.entity IN (".getEntity(
'supplier_invoice').
")";
186 if ($object->id > 0) $sql .=
" AND p.rowid=".$object->id;
187 if ($socid) $sql .=
" AND s.rowid = ".$socid;
188 $sql .= $db->order($sortfield, $sortorder);
191 $nbtotalofrecords =
'';
192 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
194 $resql = $db->query($sql);
195 $nbtotalofrecords = $db->num_rows(
$resql);
196 if (($page * $limit) > $nbtotalofrecords)
203 $sql .= $db->plimit($limit + 1, $offset);
205 $resql = $db->query($sql);
208 $num = $db->num_rows(
$resql);
214 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
215 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
216 print '<input type="hidden" name="token" value="'.newToken().
'">';
217 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
218 print '<input type="hidden" name="action" value="list">';
219 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
220 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
221 print '<input type="hidden" name="page" value="'.$page.
'">';
222 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
223 print '<input type="hidden" name="id" value="'.$id.
'">';
225 $massactionbutton =
'';
227 print_barre_liste($langs->trans(
"Invoices"), $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
229 print"\n<!-- debut table -->\n";
230 print
'<div class="div-table-responsive-no-min">';
231 print
'<table class="liste centpercent">';
232 print
'<tr class="liste_titre">';
235 print_liste_field_titre(
"AmountInvoice", $_SERVER[
"PHP_SELF"],
"f.total_ttc",
"", $param,
'class="right"', $sortfield, $sortorder);
236 print_liste_field_titre(
"AmountRequested", $_SERVER[
"PHP_SELF"],
"pl.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
237 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"",
"", $param,
'align="center"', $sortfield, $sortorder);
242 $totalamount_requested = 0;
244 $invoicetmpcustomer =
new Facture($db);
247 while ($i < min($num, $limit))
249 $obj = $db->fetch_object(
$resql);
251 if ($obj->type ==
'bank-transfer') {
252 $invoicetmp = $invoicetmpsupplier;
254 $invoicetmp = $invoicetmpcustomer;
256 $invoicetmp->fetch($obj->facid);
258 $thirdpartytmp->fetch($obj->socid);
260 print
'<tr class="oddeven">';
263 print $invoicetmp->getNomUrl(1);
267 print $thirdpartytmp->getNomUrl(1);
271 print
'<td class="right">'.price($obj->total_ttc).
"</td>\n";
274 print
'<td class="right">'.price($obj->amount_requested).
"</td>\n";
277 print
'<td class="center">';
279 if ($obj->statut == 0) {
281 } elseif ($obj->statut == 2) {
282 if ($obj->type ==
'bank-transfer') {
283 print $langs->trans(
"StatusDebited");
285 print $langs->trans(
"StatusCredited");
287 } elseif ($obj->statut == 3) {
288 print
'<b>'.$langs->trans(
"StatusRefused").
'</b>';
297 $totalinvoices += $obj->total_ttc;
298 $totalamount_requested += $obj->amount_requested;
305 print
'<tr class="liste_total">';
306 print
'<td>'.$langs->trans(
"Total").
'</td>';
307 print
'<td> </td>';
308 print
'<td class="right">';
310 if ($totalamount_requested != $object->amount) print
img_warning(
"AmountOfFileDiffersFromSumOfInvoices");
312 print
'<td class="right">';
313 print
price($totalamount_requested);
315 print
'<td> </td>';
316 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.
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.
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.
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 ...
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
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.