30require
'../../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37$langs->loadLangs(array(
'banks',
'categories',
'bills'));
39$search_ref =
GETPOST(
'search_ref',
'alpha');
40$search_date_startday =
GETPOSTINT(
'search_date_startday');
41$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
42$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
43$search_date_endday =
GETPOSTINT(
'search_date_endday');
44$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
45$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
46$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
47$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
48$search_account =
GETPOST(
'search_account',
'alpha');
49$search_amount =
GETPOST(
'search_amount',
'alpha');
50$mode =
GETPOST(
'mode',
'alpha');
53$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
54$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
56if (empty($page) || $page == -1) {
59$offset = $limit * $page;
66 $sortfield =
"bc.date_bordereau";
69$optioncss =
GETPOST(
'optioncss',
'alpha');
70$view =
GETPOST(
"view",
'alpha');
75$accountstatic =
new Account($db);
79$arrayofpaymentmodetomanage = explode(
',',
getDolGlobalString(
'BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT',
'CHQ'));
81$arrayoflabels = array();
82foreach ($arrayofpaymentmodetomanage as $key => $val) {
83 $labelval = ($langs->trans(
"PaymentType".$val) !=
"PaymentType".$val ? $langs->trans(
"PaymentType".$val) : $val);
84 $arrayoflabels[$key] = $labelval;
88 'bc.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 10),
89 'bc.type' => array(
'label' =>
"Type",
'checked' => 1,
'position' => 20),
90 'bc.date_bordereau' => array(
'label' =>
"DateCreation",
'checked' => 1,
'position' => 30),
91 'ba.label' => array(
'label' =>
"BankAccount",
'checked' => 1,
'position' => 40),
92 'bc.nbcheque' => array(
'label' =>
"NbOfCheques",
'checked' => 1,
'position' => 50),
93 'bc.amount' => array(
'label' =>
"Amount",
'checked' => 1,
'position' => 60),
94 'bc.statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 70)
97'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
100$hookmanager->initHooks(array(
'chequelist'));
111$parameters = array();
112$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
117if (empty($reshook)) {
118 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
121 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
124 $search_account =
'';
125 $search_date_startday =
'';
126 $search_date_startmonth =
'';
127 $search_date_startyear =
'';
128 $search_date_endday =
'';
129 $search_date_endmonth =
'';
130 $search_date_endyear =
'';
131 $search_date_start =
'';
132 $search_date_end =
'';
142$form =
new Form($db);
144llxHeader(
'', $langs->trans(
"ChequeDeposits"),
'', 0, 0,
'',
'',
'',
'bodyforlist');
146$sql =
"SELECT bc.rowid, bc.ref, bc.date_bordereau,";
147$sql .=
" bc.nbcheque, bc.amount, bc.statut, bc.type,";
148$sql .=
" ba.rowid as bid, ba.label";
151$parameters = array();
152$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
153$sql .= $hookmanager->resPrint;
157$sql .=
" FROM ".MAIN_DB_PREFIX.
"bordereau_cheque as bc,";
158$sql .=
" ".MAIN_DB_PREFIX.
"bank_account as ba";
159$sql .=
" WHERE bc.fk_bank_account = ba.rowid";
160$sql .=
" AND bc.entity = ".((int) $conf->entity);
166if ($search_account > 0) {
167 $sql .=
" AND bc.fk_bank_account = ".((int) $search_account);
172if ($search_date_start) {
173 $sql .=
" AND bc.date_bordereau >= '" . $db->idate($search_date_start) .
"'";
175if ($search_date_end) {
176 $sql .=
" AND bc.date_bordereau <= '" . $db->idate($search_date_end) .
"'";
180$parameters = array();
181$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
182$sql .= $hookmanager->resPrint;
185$nbtotalofrecords =
'';
188 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
189 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
190 $resql = $db->query($sqlforcount);
192 $objforcount = $db->fetch_object($resql);
193 $nbtotalofrecords = $objforcount->nbtotalofrecords;
198 if (($page * $limit) > $nbtotalofrecords) {
206$sql .= $db->order($sortfield, $sortorder);
208 $sql .= $db->plimit($limit + 1, $offset);
212$resql = $db->query($sql);
214 $num = $db->num_rows($resql);
218 $param .=
'&mode='.urlencode($mode);
220 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
221 $param .=
'&contextpage='.$contextpage;
223 if ($search_date_startday) {
224 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
226 if ($search_date_startmonth) {
227 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
229 if ($search_date_startyear) {
230 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
232 if ($search_date_endday) {
233 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
235 if ($search_date_endmonth) {
236 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
238 if ($search_date_endyear) {
239 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
241 if ($limit > 0 && $limit != $conf->liste_limit) {
242 $param .=
'&limit='.$limit;
244 if ($search_amount !=
'') {
245 $param .=
'&search_amount='.urlencode($search_amount);
247 if ($search_account > 0) {
248 $param .=
'&search_account='.urlencode((
string) ($search_account));
251 $url = DOL_URL_ROOT.
'/compta/paiement/cheque/card.php?action=new';
254 $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'));
255 $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'));
257 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewCheckDeposit'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'banque',
'cheque'));
259 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
260 if ($optioncss !=
'') {
261 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
263 print
'<input type="hidden" name="token" value="'.newToken().
'">';
264 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
265 print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
266 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
267 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
268 print
'<input type="hidden" name="page" value="'.$page.
'">';
269 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
273 print_barre_liste($langs->trans(
"MenuChequeDeposits"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'bank_account', 0, $newcardbutton,
'', $limit);
275 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
276 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
277 $massactionbutton =
'';
278 if ($massactionbutton) {
279 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
283 print
'<div class="div-table-responsive">';
284 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">';
288 print
'<tr class="liste_titre_filter">';
292 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
293 $searchpicto = $form->showFilterButtons(
'left');
299 if (!empty($arrayfields[
'bc.ref'][
'checked'])) {
300 print
'<td class="liste_titre">';
301 print
'<input class="flat" type="text" size="4" name="search_ref" value="' . $search_ref .
'">';
306 if (!empty($arrayfields[
'bc.type'][
'checked'])) {
307 print
'<td class="liste_titre">';
312 if (!empty($arrayfields[
'bc.date_bordereau'][
'checked'])) {
313 print
'<td class="liste_titre center">';
314 print
'<div class="nowrapfordate">';
315 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
317 print
'<div class="nowrapfordate">';
318 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
324 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
325 print
'<td class="liste_titre">';
326 $form->select_comptes($search_account,
'search_account', 0,
'', 1);
331 if (!empty($arrayfields[
'bc.nbcheque'][
'checked'])) {
332 print
'<td class="liste_titre"> </td>';
336 if (!empty($arrayfields[
'bc.amount'][
'checked'])) {
337 print
'<td class="liste_titre right">';
338 print
'<input class="flat maxwidth50" type="text" name="search_amount" value="' . $search_amount .
'">';
343 if (!empty($arrayfields[
'bc.statut'][
'checked'])) {
344 print
'<td class="liste_titre"></td>';
348 $parameters = array(
'arrayfields' => $arrayfields);
349 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
350 print $hookmanager->resPrint;
354 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
355 $searchpicto = $form->showFilterButtons();
362 $totalarray = array();
363 $totalarray[
'nbfield'] = 0;
367 print
'<tr class="liste_titre">';
369 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
370 $totalarray[
'nbfield']++;
372 if (!empty($arrayfields[
'bc.ref'][
'checked'])) {
373 print_liste_field_titre($arrayfields[
'bc.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.ref",
"", $param,
"", $sortfield, $sortorder);
374 $totalarray[
'nbfield']++;
376 if (!empty($arrayfields[
'bc.type'][
'checked'])) {
377 print_liste_field_titre($arrayfields[
'bc.type'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.type",
"", $param,
"", $sortfield, $sortorder);
378 $totalarray[
'nbfield']++;
380 if (!empty($arrayfields[
'bc.date_bordereau'][
'checked'])) {
381 print_liste_field_titre($arrayfields[
'bc.date_bordereau'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.date_bordereau",
"", $param,
'align="center"', $sortfield, $sortorder);
382 $totalarray[
'nbfield']++;
384 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
385 print_liste_field_titre($arrayfields[
'ba.label'][
'label'], $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
386 $totalarray[
'nbfield']++;
388 if (!empty($arrayfields[
'bc.nbcheque'][
'checked'])) {
389 print_liste_field_titre($arrayfields[
'bc.nbcheque'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.nbcheque",
"", $param,
'class="right"', $sortfield, $sortorder);
390 $totalarray[
'nbfield']++;
392 if (!empty($arrayfields[
'bc.amount'][
'checked'])) {
393 print_liste_field_titre($arrayfields[
'bc.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
394 $totalarray[
'nbfield']++;
396 if (!empty($arrayfields[
'bc.statut'][
'checked'])) {
397 print_liste_field_titre($arrayfields[
'bc.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.statut",
"", $param,
'class="right"', $sortfield, $sortorder);
398 $totalarray[
'nbfield']++;
402 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
403 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
404 print $hookmanager->resPrint;
407 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
408 $totalarray[
'nbfield']++;
414 foreach ($arrayfields as $column) {
415 if ($column[
'checked']) {
424 $totalarray = array();
425 $totalarray[
'nbfield'] = 0;
426 $imaxinloop = ($limit ? min($num, $limit) : $num);
427 while ($i < $imaxinloop) {
428 $objp = $db->fetch_object($resql);
430 $checkdepositstatic->id = $objp->rowid;
431 $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
432 $checkdepositstatic->statut = $objp->statut;
433 $checkdepositstatic->nbcheque = $objp->nbcheque;
434 $checkdepositstatic->amount = $objp->amount;
435 $checkdepositstatic->date_bordereau = $objp->date_bordereau;
436 $checkdepositstatic->type = $objp->type;
439 $account->fetch($objp->bid);
440 $checkdepositstatic->account_id = $account->getNomUrl(1);
442 if ($mode ==
'kanban') {
444 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
445 print
'<div class="box-flex-container kanban">';
448 print $checkdepositstatic->getKanbanView(
'', array(
'selected' => in_array($checkdepositstatic->id, $arrayofselected)));
449 if ($i == ($imaxinloop - 1)) {
454 print
'<tr class="oddeven">';
458 print
'<td class="nowrap center"></td>';
460 $totalarray[
'nbfield']++;
465 if (!empty($arrayfields[
'bc.ref'][
'checked'])) {
467 print $checkdepositstatic->getNomUrl(1);
470 $totalarray[
'nbfield']++;
475 if (!empty($arrayfields[
'bc.type'][
'checked'])) {
476 $labelpaymentmode = ($langs->transnoentitiesnoconv(
"PaymentType".$checkdepositstatic->type) !=
"PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv(
"PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
477 print
'<td>'.dol_escape_htmltag($labelpaymentmode).
'</td>';
479 $totalarray[
'nbfield']++;
484 if (!empty($arrayfields[
'bc.date_bordereau'][
'checked'])) {
485 print
'<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau),
'dayhour',
'tzuser').
'</td>';
487 $totalarray[
'nbfield']++;
492 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
495 print
'<a href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?account='.$objp->bid.
'">'.
img_object($langs->trans(
"ShowAccount"),
'account').
' '.$objp->label.
'</a>';
501 $totalarray[
'nbfield']++;
506 if (!empty($arrayfields[
'bc.nbcheque'][
'checked'])) {
507 print
'<td class="right">'.$objp->nbcheque.
'</td>';
509 $totalarray[
'nbfield']++;
514 if (!empty($arrayfields[
'bc.amount'][
'checked'])) {
515 print
'<td class="right"><span class="amount">'.price($objp->amount).
'</span></td>';
517 $totalarray[
'nbfield']++;
519 if (empty($totalarray[
'val'][
'amount'])) {
520 $totalarray[
'val'][
'amount'] = $objp->amount;
522 $totalarray[
'val'][
'amount'] += $objp->amount;
527 if (!empty($arrayfields[
'bc.statut'][
'checked'])) {
528 print
'<td class="right">';
529 print $checkdepositstatic->LibStatut($objp->statut, 5);
532 $totalarray[
'nbfield']++;
538 print
'<td class="nowrap center"></td>';
540 $totalarray[
'nbfield']++;
552 foreach ($arrayfields as $key => $val) {
553 if (!empty($val[
'checked'])) {
557 print
'<tr class="oddeven">';
558 print
'<td colspan="' . $colspan .
'" class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
"</td>";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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 a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.