29require
'../../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36$langs->loadLangs(array(
'banks',
'categories',
'bills'));
40 $socid = $user->socid;
44$search_ref =
GETPOST(
'search_ref',
'alpha');
45$search_account =
GETPOST(
'search_account',
'int');
46$search_amount =
GETPOST(
'search_amount',
'alpha');
47$mode =
GETPOST(
'mode',
'alpha');
49$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
50$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
53if (empty($page) || $page == -1) {
56$offset = $limit * $page;
63 $sortfield =
"bc.date_bordereau";
68$optioncss =
GETPOST(
'optioncss',
'alpha');
69$view =
GETPOST(
"view",
'alpha');
74$accountstatic =
new Account($db);
78$arrayofpaymentmodetomanage = explode(
',',
getDolGlobalString(
'BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT',
'CHQ'));
80$arrayoflabels = array();
81foreach ($arrayofpaymentmodetomanage as $key => $val) {
82 $labelval = ($langs->trans(
"PaymentType".$val) !=
"PaymentType".$val ? $langs->trans(
"PaymentType".$val) : $val);
83 $arrayoflabels[$key] = $labelval;
92if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
106llxHeader(
'', $langs->trans(
"ChequeDeposits"));
108$sql =
"SELECT bc.rowid, bc.ref, bc.date_bordereau,";
109$sql .=
" bc.nbcheque, bc.amount, bc.statut, bc.type,";
110$sql .=
" ba.rowid as bid, ba.label";
114$sql .=
" FROM ".MAIN_DB_PREFIX.
"bordereau_cheque as bc,";
115$sql .=
" ".MAIN_DB_PREFIX.
"bank_account as ba";
116$sql .=
" WHERE bc.fk_bank_account = ba.rowid";
117$sql .=
" AND bc.entity = ".((int) $conf->entity);
123if ($search_account > 0) {
124 $sql .=
" AND bc.fk_bank_account = ".((int) $search_account);
132$nbtotalofrecords =
'';
135 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
136 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
137 $resql = $db->query($sqlforcount);
139 $objforcount = $db->fetch_object($resql);
140 $nbtotalofrecords = $objforcount->nbtotalofrecords;
145 if (($page * $limit) > $nbtotalofrecords) {
152$sql .= $db->order($sortfield, $sortorder);
154 $sql .= $db->plimit($limit + 1, $offset);
158$resql = $db->query($sql);
160 $num = $db->num_rows($resql);
164 $param .=
'&mode='.urlencode($mode);
166 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
167 $param .=
'&contextpage='.$contextpage;
169 if ($limit > 0 && $limit != $conf->liste_limit) {
170 $param .=
'&limit='.$limit;
173 $url = DOL_URL_ROOT.
'/compta/paiement/cheque/card.php?action=new';
174 if (!empty($socid)) {
175 $url .=
'&socid='.$socid;
178 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
179 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
180 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewCheckDeposit'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->banque->cheque);
182 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
183 if ($optioncss !=
'') {
184 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
186 print
'<input type="hidden" name="token" value="'.newToken().
'">';
187 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
188 print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
189 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
190 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
191 print
'<input type="hidden" name="page" value="'.$page.
'">';
192 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
195 print_barre_liste($langs->trans(
"MenuChequeDeposits"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'bank_account', 0, $newcardbutton,
'', $limit);
199 print
'<div class="div-table-responsive">';
200 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
203 print
'<tr class="liste_titre">';
204 print
'<td class="liste_titre">';
205 print
'<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.
'">';
208 print
'<td class="liste_titre">';
210 print
'<td class="liste_titre center">';
211 if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
212 print
'<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.
'">';
214 print
'<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.
'">';
215 print $formother->selectyear($year ? $year : -1,
'year', 1, 20, 5);
217 print
'<td class="liste_titre">';
218 $form->select_comptes($search_account,
'search_account', 0,
'', 1);
220 print
'<td class="liste_titre"> </td>';
221 print
'<td class="liste_titre right">';
222 print
'<input class="flat maxwidth50" type="text" name="search_amount" value="'.$search_amount.
'">';
224 print
'<td class="liste_titre"></td>';
225 print
'<td class="liste_titre maxwidthsearch">';
226 $searchpicto = $form->showFilterAndCheckAddButtons(0);
231 print
'<tr class="liste_titre">';
234 print_liste_field_titre(
"DateCreation", $_SERVER[
"PHP_SELF"],
"bc.date_bordereau",
"", $param,
'align="center"', $sortfield, $sortorder);
236 print_liste_field_titre(
"NbOfCheques", $_SERVER[
"PHP_SELF"],
"bc.nbcheque",
"", $param,
'class="right"', $sortfield, $sortorder);
237 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"bc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
238 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"bc.statut",
"", $param,
'class="right"', $sortfield, $sortorder);
245 $imaxinloop = ($limit ? min($num, $limit) : $num);
246 while ($i < $imaxinloop) {
247 $objp = $db->fetch_object($resql);
249 $checkdepositstatic->id = $objp->rowid;
250 $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
251 $checkdepositstatic->statut = $objp->statut;
252 $checkdepositstatic->nbcheque = $objp->nbcheque;
253 $checkdepositstatic->amount = $objp->amount;
254 $checkdepositstatic->date_bordereau = $objp->date_bordereau;
255 $checkdepositstatic->type = $objp->type;
258 $account->fetch($objp->bid);
259 $checkdepositstatic->account_id = $account->getNomUrl(1);
261 if ($mode ==
'kanban') {
263 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
264 print
'<div class="box-flex-container kanban">';
267 print $checkdepositstatic->getKanbanView(
'', array(
'selected' => in_array($checkdepositstatic->id, $arrayofselected)));
268 if ($i == ($imaxinloop - 1)) {
273 print
'<tr class="oddeven">';
277 print $checkdepositstatic->getNomUrl(1);
281 $labelpaymentmode = ($langs->transnoentitiesnoconv(
"PaymentType".$checkdepositstatic->type) !=
"PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv(
"PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
282 print
'<td>'.dol_escape_htmltag($labelpaymentmode).
'</td>';
285 print
'<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau),
'dayhour',
'tzuser').
'</td>';
290 print
'<a href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?account='.$objp->bid.
'">'.
img_object($langs->trans(
"ShowAccount"),
'account').
' '.$objp->label.
'</a>';
297 print
'<td class="right">'.$objp->nbcheque.
'</td>';
300 print
'<td class="right"><span class="amount">'.price($objp->amount).
'</span></td>';
303 print
'<td class="right">';
304 print $checkdepositstatic->LibStatut($objp->statut, 5);
314 print
'<tr class="oddeven">';
315 print
'<td colspan="7" class="opacitymedium">'.$langs->trans(
"None").
"</td>";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage cheque delivery receipts.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.