29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35 $langs->loadLangs(array(
'banks',
'withdrawals',
'companies',
'categories'));
37 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
38 $massaction =
GETPOST(
'massaction',
'alpha');
39 $show_files =
GETPOST(
'show_files',
'int');
40 $confirm =
GETPOST(
'confirm',
'alpha');
41 $cancel =
GETPOST(
'cancel',
'alpha');
42 $toselect =
GETPOST(
'toselect',
'array');
43 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlinelist';
44 $backtopage =
GETPOST(
'backtopage',
'alpha');
45 $optioncss =
GETPOST(
'optioncss',
'aZ');
47 $type =
GETPOST(
'type',
'aZ09');
49 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
50 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
53 if (empty($page) || $page == -1) {
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
63 $sortfield =
"p.datec";
66 $search_line =
GETPOST(
'search_line',
'alpha');
67 $search_bon =
GETPOST(
'search_bon',
'alpha');
68 $search_code =
GETPOST(
'search_code',
'alpha');
69 $search_company =
GETPOST(
'search_company',
'alpha');
70 $statut =
GETPOST(
'statut',
'int');
76 $hookmanager->initHooks(array(
'withdrawalsreceiptslineslist'));
79 $socid =
GETPOST(
'socid',
'int');
81 $socid = $user->socid;
83 if ($type ==
'bank-transfer') {
84 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
94 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
109 llxHeader(
'', $langs->trans(
"WithdrawalsLines"));
111 $sql =
"SELECT p.rowid, p.ref, p.statut as status, p.datec";
112 $sql .=
" , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
113 $sql .=
" , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.email";
114 $sql .=
" , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
118 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
119 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
120 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement as pf";
121 if ($type ==
'bank-transfer') {
122 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn as f";
124 $sql .=
" , ".MAIN_DB_PREFIX.
"facture as f";
126 $sql .=
" , ".MAIN_DB_PREFIX.
"societe as s";
127 $sql .=
" WHERE pl.fk_prelevement_bons = p.rowid";
128 $sql .=
" AND pf.fk_prelevement_lignes = pl.rowid";
129 if ($type ==
'bank-transfer') {
130 $sql .=
" AND pf.fk_facture_fourn = f.rowid";
132 $sql .=
" AND pf.fk_facture = f.rowid";
134 $sql .=
" AND f.fk_soc = s.rowid";
135 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
137 $sql .=
" AND s.rowid = ".((int) $socid);
140 $sql .=
" AND pl.rowid = '".$db->escape($search_line).
"'";
145 if ($type ==
'bank-transfer') {
154 if ($search_company) {
160 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
162 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
163 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
164 $resql = $db->query($sqlforcount);
166 $objforcount = $db->fetch_object(
$resql);
179 $sql .= $db->order($sortfield, $sortorder);
181 $sql .= $db->plimit($limit + 1, $offset);
184 $result = $db->query($sql);
186 $num = $db->num_rows($result);
189 $param =
"&statut=".urlencode($statut);
190 $param .=
"&search_bon=".urlencode($search_bon);
191 if ($type ==
'bank-transfer') {
192 $param .=
'&type=bank-transfer';
194 if ($limit > 0 && $limit != $conf->liste_limit) {
195 $param .=
'&limit='.urlencode($limit);
198 print
"\n<!-- debut table -->\n";
199 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
200 if ($optioncss !=
'') {
201 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
203 print
'<input type="hidden" name="token" value="'.newToken().
'">';
204 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
205 print
'<input type="hidden" name="action" value="list">';
206 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
207 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
208 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
210 print
'<input type="hidden" name="type" value="'.$type.
'">';
213 $title = $langs->trans(
"WithdrawalsLines");
214 if ($type ==
'bank-transfer') {
215 $title = $langs->trans(
"CreditTransferLines");
217 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
$nbtotalofrecords,
'generic', 0,
'',
'', $limit, 0, 0, 1);
221 print
'<div class="div-table-responsive">';
222 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
224 print
'<tr class="liste_titre">';
225 print
'<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'.dol_escape_htmltag($search_line).
'" size="6"></td>';
226 print
'<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'.dol_escape_htmltag($search_bon).
'" size="6"></td>';
227 print
'<td class="liste_titre"> </td>';
228 print
'<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.dol_escape_htmltag($search_company).
'" size="6"></td>';
229 print
'<td class="liste_titre center"><input type="text" class="flat" name="search_code" value="'.dol_escape_htmltag($search_code).
'" size="6"></td>';
230 print
'<td class="liste_titre"> </td>';
231 print
'<td class="liste_titre"> </td>';
232 print
'<td class="liste_titre maxwidthsearch">';
233 $searchpicto =
$form->showFilterButtons();
238 $columntitle =
"WithdrawalsReceipts";
239 $columntitlethirdparty =
"CustomerCode";
240 $columncodethirdparty =
"s.code_client";
241 if ($type ==
'bank-transfer') {
242 $columntitle =
"BankTransferReceipts";
243 $columntitlethirdparty =
"SupplierCode";
244 $columncodethirdparty =
"s.code_fournisseur";
247 print
'<tr class="liste_titre">';
252 print_liste_field_titre($columntitlethirdparty, $_SERVER[
"PHP_SELF"], $columncodethirdparty,
'', $param,
'', $sortfield, $sortorder,
'center ');
253 print_liste_field_titre(
"Date", $_SERVER[
"PHP_SELF"],
"p.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
254 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"pl.amount",
"", $param,
'', $sortfield, $sortorder,
'right ');
259 while ($i < min($num, $limit)) {
260 $obj = $db->fetch_object($result);
262 $bon->id = $obj->rowid;
263 $bon->ref = $obj->ref;
264 $bon->statut = $obj->status;
266 $company->id = $obj->socid;
267 $company->name = $obj->name;
268 $company->email = $obj->email;
269 $company->code_client = $obj->code_client;
271 print
'<tr class="oddeven">';
274 print $bon->getNomUrl(1);
278 print $line->LibStatut($obj->statut_ligne, 2);
280 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid_ligne.
'">';
281 print substr(
'000000'.$obj->rowid_ligne, -6);
285 $link_to_bill =
'/compta/facture/card.php?facid=';
286 $link_title =
'Invoice';
287 $link_picto =
'bill';
288 if ($type ==
'bank-transfer') {
289 $link_to_bill =
'/fourn/facture/card.php?facid=';
290 $link_title =
'SupplierInvoice';
291 $link_picto =
'supplier_invoice';
293 print
'<a href="'.DOL_URL_ROOT.$link_to_bill.$obj->facid.
'">';
294 print
img_object($langs->trans($link_title), $link_picto);
295 print
' '.$obj->invoiceref.
"</td>\n";
300 print $company->getNomUrl(1);
304 print
'<td class="center">';
305 $link_to_tab =
'/comm/card.php?socid=';
306 $link_code = $obj->code_client;
307 if ($type ==
'bank-transfer') {
308 $link_to_tab =
'/fourn/card.php?socid=';
309 $link_code = $obj->code_fournisseur;
311 print
'<a href="'.DOL_URL_ROOT.$link_to_tab.$company->id.
'">'.$link_code.
"</a></td>\n";
313 print
'<td class="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
315 print
'<td class="right"><span class="amount">'.price($obj->amount).
"</span></td>\n";
317 print
'<td> </td>';
323 print
'<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
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.
Class to manage withdrawals.
Class to manage third parties objects (customers, suppliers, prospects...)
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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...
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.
$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.