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'));
36 $socid =
GETPOST(
'socid',
'int');
37 if ($user->societe_id) $socid=$user->societe_id;
41 $limit =
GETPOST(
'limit',
'int')?
GETPOST(
'limit',
'int'):$conf->liste_limit;
42 $sortfield =
GETPOST(
'sortfield',
'alpha');
43 $sortorder =
GETPOST(
'sortorder',
'alpha');
45 if (empty($page) || $page == -1) { $page = 0; }
46 $offset = $limit * $page;
47 $pageprev = $page - 1;
48 $pagenext = $page + 1;
49 if (! $sortorder) $sortorder=
"DESC";
50 if (! $sortfield) $sortfield=
"p.datec";
52 $search_line =
GETPOST(
'search_line',
'alpha');
53 $search_bon =
GETPOST(
'search_bon',
'alpha');
54 $search_code =
GETPOST(
'search_code',
'alpha');
55 $search_company =
GETPOST(
'search_company',
'alpha');
56 $statut =
GETPOST(
'statut',
'int');
66 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
82 llxHeader(
'',$langs->trans(
"WithdrawalsLines"));
84 $sql =
"SELECT p.rowid, p.ref, p.statut, p.datec";
85 $sql.=
" ,f.rowid as facid, f.facnumber, f.total_ttc";
86 $sql.=
" , s.rowid as socid, s.nom as name, s.code_client";
87 $sql.=
" , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
88 $sql.=
" FROM ".MAIN_DB_PREFIX.
"prelevement_bons as p";
89 $sql.=
" , ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
90 $sql.=
" , ".MAIN_DB_PREFIX.
"prelevement_facture as pf";
91 $sql.=
" , ".MAIN_DB_PREFIX.
"facture as f";
92 $sql.=
" , ".MAIN_DB_PREFIX.
"societe as s";
93 $sql.=
" WHERE pl.fk_prelevement_bons = p.rowid";
94 $sql.=
" AND pf.fk_prelevement_lignes = pl.rowid";
95 $sql.=
" AND pf.fk_facture = f.rowid";
96 $sql.=
" AND f.fk_soc = s.rowid";
97 $sql.=
" AND f.entity = ".$conf->entity;
98 if ($socid) $sql.=
" AND s.rowid = ".$socid;
99 if ($search_line) $sql.=
" AND pl.rowid = '".$db->escape($search_line).
"'";
101 if ($search_code) $sql.=
natural_search(
"s.code_client", $search_code);
102 if ($search_company) $sql.=
natural_search(
"s.nom", $search_company);
104 $sql.= $db->order($sortfield,$sortorder);
107 $nbtotalofrecords =
'';
108 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
110 $result = $db->query($sql);
111 $nbtotalofrecords = $db->num_rows($result);
112 if (($page * $limit) > $nbtotalofrecords)
119 $sql.= $db->plimit($limit + 1,$offset);
121 $result = $db->query($sql);
124 $num = $db->num_rows($result);
127 $urladd =
"&statut=".$statut;
128 $urladd .=
"&search_bon=".$search_bon;
129 if ($limit > 0 && $limit != $conf->liste_limit) $urladd.=
'&limit='.urlencode($limit);
131 print"\n<!-- debut table -->\n";
132 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="GET">';
134 print_barre_liste($langs->trans(
"WithdrawalsLines"), $page, $_SERVER[
"PHP_SELF"], $urladd, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_generic', 0,
'',
'', $limit);
138 print '<div class="div-table-responsive">';
139 print '<table class="tagtable liste'.($moreforfilter?
" listwithfilterbefore":
"").
'">'.
"\n";
141 print '<tr class="liste_titre">';
142 print
'<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'.
dol_escape_htmltag($search_line).
'" size="6"></td>';
143 print
'<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'.
dol_escape_htmltag($search_bon).
'" size="6"></td>';
144 print
'<td class="liste_titre"> </td>';
145 print
'<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.
dol_escape_htmltag($search_company).
'" size="6"></td>';
146 print
'<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'.
dol_escape_htmltag($search_code).
'" size="6"></td>';
147 print
'<td class="liste_titre"> </td>';
148 print
'<td class="liste_titre"> </td>';
149 print
'<td class="liste_titre" align="right">';
150 $searchpicto=$form->showFilterButtons();
155 print
'<tr class="liste_titre">';
166 while ($i < min($num,$limit))
168 $obj = $db->fetch_object($result);
170 print
'<tr class="oddeven"><td>';
172 print $ligne->LibStatut($obj->statut_ligne,2);
175 print
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.
'">';
176 print substr(
'000000'.$obj->rowid_ligne, -6);
181 print $bon->LibStatut($obj->statut,2);
184 print
'<a href="card.php?id='.$obj->rowid.
'">'.$obj->ref.
"</a></td>\n";
186 print
'<td><a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->facid.
'">';
187 print
img_object($langs->trans(
"ShowBill"),
"bill");
188 print
' <a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?facid='.$obj->facid.
'">'.$obj->facnumber.
"</a></td>\n";
191 print
'<td><a href="card.php?id='.$obj->rowid.
'">'.$obj->name.
"</a></td>\n";
193 print
'<td align="center"><a href="card.php?id='.$obj->rowid.
'">'.$obj->code_client.
"</a></td>\n";
195 print
'<td align="center">'.dol_print_date($db->jdate($obj->datec),
'day').
"</td>\n";
197 print
'<td align="right">'.price($obj->amount).
"</td>\n";
199 print
'<td> </td>';
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
Class to manage withdrawal receipts.
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...
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Class to manage withdrawals.