27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33 $langs->loadLangs(array(
'banks',
'withdrawals',
'companies',
'categories'));
35 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
36 $massaction =
GETPOST(
'massaction',
'alpha');
37 $show_files =
GETPOST(
'show_files',
'int');
38 $confirm =
GETPOST(
'confirm',
'alpha');
39 $cancel =
GETPOST(
'cancel',
'alpha');
40 $toselect =
GETPOST(
'toselect',
'array');
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'directdebitcredittransferlinelist';
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
43 $optioncss =
GETPOST(
'optioncss',
'aZ');
46 $socid =
GETPOST(
'socid',
'int');
47 if ($user->socid) $socid = $user->socid;
50 $type =
GETPOST(
'type',
'aZ09');
52 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
53 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
56 if (empty($page) || $page == -1) { $page = 0; }
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
60 if (!$sortorder) $sortorder =
"DESC";
61 if (!$sortfield) $sortfield =
"p.datec";
63 $search_line =
GETPOST(
'search_line',
'alpha');
64 $search_bon =
GETPOST(
'search_bon',
'alpha');
65 $search_code =
GETPOST(
'search_code',
'alpha');
66 $search_company =
GETPOST(
'search_company',
'alpha');
67 $statut =
GETPOST(
'statut',
'int');
73 $hookmanager->initHooks(array(
'withdrawalsreceiptslineslist'));
80 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
94 $form =
new Form($db);
96 llxHeader(
'', $langs->trans(
"WithdrawalsLines"));
98 $sql =
"SELECT p.rowid, p.ref, p.statut as status, p.datec";
99 $sql .=
" , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
100 $sql .=
" , s.rowid as socid, s.nom as name, s.code_client, s.email";
101 $sql .=
" , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
102 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
103 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
104 $sql .=
" , ".MAIN_DB_PREFIX.
"prelevement_facture as pf";
105 if ($type ==
'bank-transfer') {
106 $sql .=
" , ".MAIN_DB_PREFIX.
"facture_fourn as f";
108 $sql .=
" , ".MAIN_DB_PREFIX.
"facture as f";
110 $sql .=
" , ".MAIN_DB_PREFIX.
"societe as s";
111 $sql .=
" WHERE pl.fk_prelevement_bons = p.rowid";
112 $sql .=
" AND pf.fk_prelevement_lignes = pl.rowid";
113 if ($type ==
'bank-transfer') {
114 $sql .=
" AND pf.fk_facture_fourn = f.rowid";
116 $sql .=
" AND pf.fk_facture = f.rowid";
118 $sql .=
" AND f.fk_soc = s.rowid";
119 $sql .=
" AND f.entity IN (".getEntity(
'invoice').
")";
120 if ($socid) $sql .=
" AND s.rowid = ".$socid;
121 if ($search_line) $sql .=
" AND pl.rowid = '".$db->escape($search_line).
"'";
123 if ($type ==
'bank-transfer') {
124 if ($search_code) $sql .=
natural_search(
"s.code_fourn", $search_code);
126 if ($search_code) $sql .=
natural_search(
"s.code_client", $search_code);
128 if ($search_company) $sql .=
natural_search(
"s.nom", $search_company);
130 $sql .= $db->order($sortfield, $sortorder);
133 $nbtotalofrecords =
'';
134 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
136 $result = $db->query($sql);
137 $nbtotalofrecords = $db->num_rows($result);
138 if (($page * $limit) > $nbtotalofrecords)
145 $sql .= $db->plimit($limit + 1, $offset);
147 $result = $db->query($sql);
150 $num = $db->num_rows($result);
153 $param =
"&statut=".urlencode($statut);
154 $param .=
"&search_bon=".urlencode($search_bon);
155 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
157 print"\n<!-- debut table -->\n";
158 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
159 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
160 print '<input type="hidden" name="token" value="'.newToken().
'">';
161 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
162 print '<input type="hidden" name="action" value="list">';
163 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
164 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
165 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
167 $title = $langs->trans(
"WithdrawalsLines");
168 if ($type ==
'bank-transfer') {
169 $title = $langs->trans(
"CreditTransferLines");
171 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'generic', 0,
'',
'', $limit, 0, 0, 1);
175 print '<div class="div-table-responsive">';
176 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
178 print '<tr class="liste_titre">';
179 print
'<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'.dol_escape_htmltag($search_line).
'" size="6"></td>';
180 print
'<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'.dol_escape_htmltag($search_bon).
'" size="6"></td>';
181 print
'<td class="liste_titre"> </td>';
182 print
'<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.dol_escape_htmltag($search_company).
'" size="6"></td>';
183 print
'<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'.dol_escape_htmltag($search_code).
'" size="6"></td>';
184 print
'<td class="liste_titre"> </td>';
185 print
'<td class="liste_titre"> </td>';
186 print
'<td class="liste_titre maxwidthsearch">';
187 $searchpicto = $form->showFilterButtons();
192 $columntitle =
"WithdrawalsReceipts";
193 if ($type ==
'bank-transfer') {
194 $columntitle =
"BankTransferReceipts";
197 print
'<tr class="liste_titre">';
209 while ($i < min($num, $limit))
211 $obj = $db->fetch_object($result);
213 $bon->id = $obj->rowid;
214 $bon->ref = $obj->ref;
215 $bon->statut = $obj->status;
217 $company->id = $obj->socid;
218 $company->name = $obj->name;
219 $company->email = $obj->email;
220 $company->code_client = $obj->code_client;
222 print
'<tr class="oddeven">';
225 print $bon->getNomUrl(1);
229 print $line->LibStatut($obj->statut_ligne, 2);
231 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid_ligne.
'">';
232 print substr(
'000000'.$obj->rowid_ligne, -6);
236 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->facid.
'">';
237 print
img_object($langs->trans(
"ShowBill"),
"bill");
238 print
' <a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->facid.
'">'.$obj->invoiceref.
"</a></td>\n";
243 print $company->getNomUrl(1);
246 print
'<td align="center"><a href="card.php?id='.$obj->rowid.
'">'.$obj->code_client.
"</a></td>\n";
248 print
'<td class="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
250 print
'<td class="right">'.price($obj->amount).
"</td>\n";
252 print
'<td> </td>';
258 print
'<tr><td class="opacitymedium" colspan="8">'.$langs->trans(
"None").
'</td></tr>';
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.
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_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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 $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Class to manage withdrawals.