31require
'../../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
46$langs->loadLangs(array(
'banks',
'categories',
'bills'));
48$search_ref =
GETPOST(
'search_ref',
'alpha');
49$search_date_startday =
GETPOSTINT(
'search_date_startday');
50$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
51$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
52$search_date_endday =
GETPOSTINT(
'search_date_endday');
53$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
54$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
55$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
56$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
57$search_account =
GETPOST(
'search_account',
'alpha');
58$search_amount =
GETPOST(
'search_amount',
'alpha');
59$mode =
GETPOST(
'mode',
'alpha');
62$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
63$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
65if (empty($page) || $page == -1) {
68$offset = $limit * $page;
75 $sortfield =
"bc.date_bordereau";
78$optioncss =
GETPOST(
'optioncss',
'alpha');
79$view =
GETPOST(
"view",
'alpha');
84$accountstatic =
new Account($db);
88$arrayofpaymentmodetomanage = explode(
',',
getDolGlobalString(
'BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT',
'CHQ'));
90$arrayoflabels = array();
91foreach ($arrayofpaymentmodetomanage as $key => $val) {
92 $labelval = ($langs->trans(
"PaymentType".$val) !=
"PaymentType".$val ? $langs->trans(
"PaymentType".$val) : $val);
93 $arrayoflabels[$key] = $labelval;
97 'bc.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 10),
98 'bc.type' => array(
'label' =>
"Type",
'checked' => 1,
'position' => 20),
99 'bc.date_bordereau' => array(
'label' =>
"DateCreation",
'checked' => 1,
'position' => 30),
100 'ba.label' => array(
'label' =>
"BankAccount",
'checked' => 1,
'position' => 40),
101 'bc.nbcheque' => array(
'label' =>
"NbOfCheques",
'checked' => 1,
'position' => 50),
102 'bc.amount' => array(
'label' =>
"Amount",
'checked' => 1,
'position' => 60),
103 'bc.statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 70)
106'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
109$hookmanager->initHooks(array(
'chequelist'));
120$parameters = array();
121$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
126if (empty($reshook)) {
127 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
130 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
133 $search_account =
'';
134 $search_date_startday =
'';
135 $search_date_startmonth =
'';
136 $search_date_startyear =
'';
137 $search_date_endday =
'';
138 $search_date_endmonth =
'';
139 $search_date_endyear =
'';
140 $search_date_start =
'';
141 $search_date_end =
'';
151$form =
new Form($db);
153$title = $langs->trans(
"ChequeDeposits");
155llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'bodyforlist');
157$sql =
"SELECT bc.rowid, bc.ref, bc.date_bordereau,";
158$sql .=
" bc.nbcheque, bc.amount, bc.statut, bc.type,";
159$sql .=
" ba.rowid as bid, ba.label";
162$parameters = array();
163$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
164$sql .= $hookmanager->resPrint;
168$sql .=
" FROM ".MAIN_DB_PREFIX.
"bordereau_cheque as bc,";
169$sql .=
" ".MAIN_DB_PREFIX.
"bank_account as ba";
170$sql .=
" WHERE bc.fk_bank_account = ba.rowid";
171$sql .=
" AND bc.entity = ".((int)
$conf->entity);
177if ($search_account > 0) {
178 $sql .=
" AND bc.fk_bank_account = ".((int) $search_account);
183if ($search_date_start) {
184 $sql .=
" AND bc.date_bordereau >= '" . $db->idate($search_date_start) .
"'";
186if ($search_date_end) {
187 $sql .=
" AND bc.date_bordereau <= '" . $db->idate($search_date_end) .
"'";
191$parameters = array();
192$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
193$sql .= $hookmanager->resPrint;
196$nbtotalofrecords =
'';
199 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
200 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
201 $resql = $db->query($sqlforcount);
203 $objforcount = $db->fetch_object($resql);
204 $nbtotalofrecords = $objforcount->nbtotalofrecords;
209 if (($page * $limit) > $nbtotalofrecords) {
217$sql .= $db->order($sortfield, $sortorder);
219 $sql .= $db->plimit($limit + 1, $offset);
223$resql = $db->query($sql);
225 $num = $db->num_rows($resql);
229 $param .=
'&mode='.urlencode($mode);
231 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
232 $param .=
'&contextpage='.$contextpage;
234 if ($search_date_startday) {
235 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
237 if ($search_date_startmonth) {
238 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
240 if ($search_date_startyear) {
241 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
243 if ($search_date_endday) {
244 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
246 if ($search_date_endmonth) {
247 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
249 if ($search_date_endyear) {
250 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
252 if ($limit > 0 && $limit !=
$conf->liste_limit) {
253 $param .=
'&limit='.$limit;
255 if ($search_amount !=
'') {
256 $param .=
'&search_amount='.urlencode($search_amount);
258 if ($search_account > 0) {
259 $param .=
'&search_account='.urlencode((
string) ($search_account));
262 $url = DOL_URL_ROOT.
'/compta/paiement/cheque/card.php?action=new';
265 $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'));
266 $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'));
268 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewCheckDeposit'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'banque',
'cheque'));
270 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
271 if ($optioncss !=
'') {
272 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
274 print
'<input type="hidden" name="token" value="'.newToken().
'">';
275 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
276 print
'<input type="hidden" name="view" value="'.dol_escape_htmltag($view).
'">';
277 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
278 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
279 print
'<input type="hidden" name="page" value="'.$page.
'">';
280 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
284 print_barre_liste($langs->trans(
"MenuChequeDeposits"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'bank_account', 0, $newcardbutton,
'', $limit);
286 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
287 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
288 $massactionbutton =
'';
289 if ($massactionbutton) {
290 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
294 print
'<div class="div-table-responsive">';
295 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">';
299 print
'<tr class="liste_titre_filter">';
303 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
304 $searchpicto = $form->showFilterButtons(
'left');
310 if (!empty($arrayfields[
'bc.ref'][
'checked'])) {
311 print
'<td class="liste_titre">';
312 print
'<input class="flat" type="text" size="4" name="search_ref" value="' . $search_ref .
'">';
317 if (!empty($arrayfields[
'bc.type'][
'checked'])) {
318 print
'<td class="liste_titre">';
323 if (!empty($arrayfields[
'bc.date_bordereau'][
'checked'])) {
324 print
'<td class="liste_titre center">';
325 print
'<div class="nowrapfordate">';
326 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
328 print
'<div class="nowrapfordate">';
329 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
335 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
336 print
'<td class="liste_titre">';
337 $form->select_comptes($search_account,
'search_account', 0,
'', 1);
342 if (!empty($arrayfields[
'bc.nbcheque'][
'checked'])) {
343 print
'<td class="liste_titre"> </td>';
347 if (!empty($arrayfields[
'bc.amount'][
'checked'])) {
348 print
'<td class="liste_titre right">';
349 print
'<input class="flat maxwidth50" type="text" name="search_amount" value="' . $search_amount .
'">';
354 if (!empty($arrayfields[
'bc.statut'][
'checked'])) {
355 print
'<td class="liste_titre"></td>';
359 $parameters = array(
'arrayfields' => $arrayfields);
360 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
361 print $hookmanager->resPrint;
365 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
366 $searchpicto = $form->showFilterButtons();
373 $totalarray = array();
374 $totalarray[
'nbfield'] = 0;
378 print
'<tr class="liste_titre">';
380 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
381 $totalarray[
'nbfield']++;
383 if (!empty($arrayfields[
'bc.ref'][
'checked'])) {
385 print_liste_field_titre($arrayfields[
'bc.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.ref",
"", $param,
"", $sortfield, $sortorder);
386 $totalarray[
'nbfield']++;
388 if (!empty($arrayfields[
'bc.type'][
'checked'])) {
389 print_liste_field_titre($arrayfields[
'bc.type'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.type",
"", $param,
"", $sortfield, $sortorder);
390 $totalarray[
'nbfield']++;
392 if (!empty($arrayfields[
'bc.date_bordereau'][
'checked'])) {
393 print_liste_field_titre($arrayfields[
'bc.date_bordereau'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.date_bordereau",
"", $param,
'align="center"', $sortfield, $sortorder);
394 $totalarray[
'nbfield']++;
396 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
397 print_liste_field_titre($arrayfields[
'ba.label'][
'label'], $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
398 $totalarray[
'nbfield']++;
400 if (!empty($arrayfields[
'bc.nbcheque'][
'checked'])) {
401 print_liste_field_titre($arrayfields[
'bc.nbcheque'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.nbcheque",
"", $param,
'class="right"', $sortfield, $sortorder);
402 $totalarray[
'nbfield']++;
404 if (!empty($arrayfields[
'bc.amount'][
'checked'])) {
405 print_liste_field_titre($arrayfields[
'bc.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
406 $totalarray[
'nbfield']++;
408 if (!empty($arrayfields[
'bc.statut'][
'checked'])) {
409 print_liste_field_titre($arrayfields[
'bc.statut'][
'label'], $_SERVER[
"PHP_SELF"],
"bc.statut",
"", $param,
'class="right"', $sortfield, $sortorder);
410 $totalarray[
'nbfield']++;
414 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
415 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
416 print $hookmanager->resPrint;
419 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
420 $totalarray[
'nbfield']++;
426 foreach ($arrayfields as $column) {
427 if ($column[
'checked']) {
436 $totalarray = array();
437 $totalarray[
'nbfield'] = 0;
438 $imaxinloop = ($limit ? min($num, $limit) : $num);
439 while ($i < $imaxinloop) {
440 $objp = $db->fetch_object($resql);
442 $checkdepositstatic->id = $objp->rowid;
443 $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
444 $checkdepositstatic->statut = $objp->statut;
445 $checkdepositstatic->nbcheque = $objp->nbcheque;
446 $checkdepositstatic->amount = $objp->amount;
447 $checkdepositstatic->date_bordereau = $objp->date_bordereau;
448 $checkdepositstatic->type = $objp->type;
451 $account->fetch($objp->bid);
452 $checkdepositstatic->account_id = $account->getNomUrl(1);
454 if ($mode ==
'kanban') {
456 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
457 print
'<div class="box-flex-container kanban">';
460 print $checkdepositstatic->getKanbanView(
'', array(
'selected' => in_array($checkdepositstatic->id, $arrayofselected)));
461 if ($i == ($imaxinloop - 1)) {
466 print
'<tr class="oddeven">';
470 print
'<td class="nowrap center"></td>';
472 $totalarray[
'nbfield']++;
477 if (!empty($arrayfields[
'bc.ref'][
'checked'])) {
479 print $checkdepositstatic->getNomUrl(1);
482 $totalarray[
'nbfield']++;
487 if (!empty($arrayfields[
'bc.type'][
'checked'])) {
488 $labelpaymentmode = ($langs->transnoentitiesnoconv(
"PaymentType".$checkdepositstatic->type) !=
"PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv(
"PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
489 print
'<td>'.dol_escape_htmltag($labelpaymentmode).
'</td>';
491 $totalarray[
'nbfield']++;
496 if (!empty($arrayfields[
'bc.date_bordereau'][
'checked'])) {
497 print
'<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau),
'dayhour',
'tzuser').
'</td>';
499 $totalarray[
'nbfield']++;
504 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
507 print
'<a href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?account='.$objp->bid.
'">'.
img_object($langs->trans(
"ShowAccount"),
'account').
' '.$objp->label.
'</a>';
513 $totalarray[
'nbfield']++;
518 if (!empty($arrayfields[
'bc.nbcheque'][
'checked'])) {
519 print
'<td class="right">'.$objp->nbcheque.
'</td>';
521 $totalarray[
'nbfield']++;
526 if (!empty($arrayfields[
'bc.amount'][
'checked'])) {
527 print
'<td class="right"><span class="amount">'.price($objp->amount).
'</span></td>';
529 $totalarray[
'nbfield']++;
531 if (empty($totalarray[
'val'][
'amount'])) {
532 $totalarray[
'val'][
'amount'] = $objp->amount;
534 $totalarray[
'val'][
'amount'] += $objp->amount;
539 if (!empty($arrayfields[
'bc.statut'][
'checked'])) {
540 print
'<td class="right">';
541 print $checkdepositstatic->LibStatut($objp->statut, 5);
544 $totalarray[
'nbfield']++;
550 print
'<td class="nowrap center"></td>';
552 $totalarray[
'nbfield']++;
564 foreach ($arrayfields as $key => $val) {
565 if (!empty($val[
'checked'])) {
569 print
'<tr class="oddeven">';
570 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.