list.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <?php
  2. /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2014 Alexandre Spangaro <aspangaro@open-dsi.fr>
  6. * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/compta/paiement/cheque/list.php
  23. * \ingroup compta
  24. * \brief Page list of cheque deposits
  25. */
  26. // Load Dolibarr environment
  27. require '../../../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  32. // Load translation files required by the page
  33. $langs->loadLangs(array('banks', 'categories', 'bills'));
  34. // Security check
  35. if ($user->socid) {
  36. $socid = $user->socid;
  37. }
  38. $result = restrictedArea($user, 'banque', '', '');
  39. $search_ref = GETPOST('search_ref', 'alpha');
  40. $search_date_startday = GETPOST('search_date_startday', 'int');
  41. $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
  42. $search_date_startyear = GETPOST('search_date_startyear', 'int');
  43. $search_date_endday = GETPOST('search_date_endday', 'int');
  44. $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
  45. $search_date_endyear = GETPOST('search_date_endyear', 'int');
  46. $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
  47. $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
  48. $search_account = GETPOST('search_account', 'int');
  49. $search_amount = GETPOST('search_amount', 'alpha');
  50. $mode = GETPOST('mode', 'alpha');
  51. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  52. $sortfield = GETPOST('sortfield', 'aZ09comma');
  53. $sortorder = GETPOST('sortorder', 'aZ09comma');
  54. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  55. if (empty($page) || $page == -1) {
  56. $page = 0;
  57. } // If $page is not defined, or '' or -1
  58. $offset = $limit * $page;
  59. $pageprev = $page - 1;
  60. $pagenext = $page + 1;
  61. if (!$sortorder) {
  62. $sortorder = "DESC";
  63. }
  64. if (!$sortfield) {
  65. $sortfield = "bc.date_bordereau";
  66. }
  67. $optioncss = GETPOST('optioncss', 'alpha');
  68. $view = GETPOST("view", 'alpha');
  69. $form = new Form($db);
  70. $formother = new FormOther($db);
  71. $checkdepositstatic = new RemiseCheque($db);
  72. $accountstatic = new Account($db);
  73. // List of payment mode to support
  74. // Example: BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT = 'CHQ','TRA'
  75. $arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODES_FOR_DEPOSIT_MANAGEMENT', 'CHQ'));
  76. $arrayoflabels = array();
  77. foreach ($arrayofpaymentmodetomanage as $key => $val) {
  78. $labelval = ($langs->trans("PaymentType".$val) != "PaymentType".$val ? $langs->trans("PaymentType".$val) : $val);
  79. $arrayoflabels[$key] = $labelval;
  80. }
  81. $arrayfields = array(
  82. 'bc.ref' => array('label'=>"Ref", 'checked'=>1, 'position'=>10),
  83. 'bc.type' => array('label'=>"Type", 'checked'=>1, 'position'=>20),
  84. 'bc.date_bordereau' => array('label'=>"DateCreation", 'checked'=>1, 'position'=>30),
  85. 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>40),
  86. 'bc.nbcheque' => array('label'=>"NbOfCheques", 'checked'=>1, 'position'=>50),
  87. 'bc.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>60),
  88. 'bc.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>70)
  89. );
  90. $arrayfields = dol_sort_array($arrayfields, 'position');
  91. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  92. $hookmanager->initHooks(array('chequelist'));
  93. $object = new RemiseCheque($db);
  94. /*
  95. * Actions
  96. */
  97. $parameters = array('socid'=>$socid);
  98. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  99. if ($reshook < 0) {
  100. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  101. }
  102. if (empty($reshook)) {
  103. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  104. // All tests are required to be compatible with all browsers
  105. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  106. $search_ref = '';
  107. $search_amount = '';
  108. $search_account = '';
  109. $search_date_startday = '';
  110. $search_date_startmonth = '';
  111. $search_date_startyear = '';
  112. $search_date_endday = '';
  113. $search_date_endmonth = '';
  114. $search_date_endyear = '';
  115. $search_date_start = '';
  116. $search_date_end = '';
  117. }
  118. }
  119. /*
  120. * View
  121. */
  122. $form = new Form($db);
  123. llxHeader('', $langs->trans("ChequeDeposits"));
  124. $sql = "SELECT bc.rowid, bc.ref, bc.date_bordereau,";
  125. $sql .= " bc.nbcheque, bc.amount, bc.statut, bc.type,";
  126. $sql .= " ba.rowid as bid, ba.label";
  127. // Add fields from hooks
  128. $parameters = array();
  129. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
  130. $sql .= $hookmanager->resPrint;
  131. $sqlfields = $sql; // $sql fields to remove for count total
  132. $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
  133. $sql .= " ".MAIN_DB_PREFIX."bank_account as ba";
  134. $sql .= " WHERE bc.fk_bank_account = ba.rowid";
  135. $sql .= " AND bc.entity = ".((int) $conf->entity);
  136. // Search criteria
  137. if ($search_ref) {
  138. $sql .= natural_search("bc.ref", $search_ref);
  139. }
  140. if ($search_account > 0) {
  141. $sql .= " AND bc.fk_bank_account = ".((int) $search_account);
  142. }
  143. if ($search_amount) {
  144. $sql .= natural_search("bc.amount", price2num($search_amount));
  145. }
  146. if ($search_date_start) {
  147. $sql .= " AND bc.date_bordereau >= '" . $db->idate($search_date_start) . "'";
  148. }
  149. if ($search_date_end) {
  150. $sql .= " AND bc.date_bordereau <= '" . $db->idate($search_date_end) . "'";
  151. }
  152. // Add where from hooks
  153. $parameters = array();
  154. $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
  155. $sql .= $hookmanager->resPrint;
  156. // Count total nb of records
  157. $nbtotalofrecords = '';
  158. if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
  159. /* The fast and low memory method to get and count full list converts the sql into a sql count */
  160. $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
  161. $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
  162. $resql = $db->query($sqlforcount);
  163. if ($resql) {
  164. $objforcount = $db->fetch_object($resql);
  165. $nbtotalofrecords = $objforcount->nbtotalofrecords;
  166. } else {
  167. dol_print_error($db);
  168. }
  169. if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
  170. $page = 0;
  171. $offset = 0;
  172. }
  173. $db->free($resql);
  174. }
  175. // Complete request and execute it with limit
  176. $sql .= $db->order($sortfield, $sortorder);
  177. if ($limit) {
  178. $sql .= $db->plimit($limit + 1, $offset);
  179. }
  180. //print "$sql";
  181. $resql = $db->query($sql);
  182. if ($resql) {
  183. $num = $db->num_rows($resql);
  184. $i = 0;
  185. $param = '';
  186. if (!empty($mode)) {
  187. $param .= '&mode='.urlencode($mode);
  188. }
  189. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  190. $param .= '&contextpage='.$contextpage;
  191. }
  192. if ($search_date_startday) {
  193. $param .= '&search_date_startday='.urlencode($search_date_startday);
  194. }
  195. if ($search_date_startmonth) {
  196. $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
  197. }
  198. if ($search_date_startyear) {
  199. $param .= '&search_date_startyear='.urlencode($search_date_startyear);
  200. }
  201. if ($search_date_endday) {
  202. $param .= '&search_date_endday='.urlencode($search_date_endday);
  203. }
  204. if ($search_date_endmonth) {
  205. $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
  206. }
  207. if ($search_date_endyear) {
  208. $param .= '&search_date_endyear='.urlencode($search_date_endyear);
  209. }
  210. if ($limit > 0 && $limit != $conf->liste_limit) {
  211. $param .= '&limit='.$limit;
  212. }
  213. if ($search_amount != '') {
  214. $param .= '&search_amount='.urlencode($search_amount);
  215. }
  216. if ($search_account > 0) {
  217. $param .= '&search_account='.urlencode($search_account);
  218. }
  219. $url = DOL_URL_ROOT.'/compta/paiement/cheque/card.php?action=new';
  220. if (!empty($socid)) {
  221. $url .= '&socid='.$socid;
  222. }
  223. $newcardbutton = '';
  224. $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'));
  225. $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'));
  226. $newcardbutton .= dolGetButtonTitleSeparator();
  227. $newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('banque', 'cheque'));
  228. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  229. if ($optioncss != '') {
  230. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  231. }
  232. print '<input type="hidden" name="token" value="'.newToken().'">';
  233. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  234. print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
  235. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  236. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  237. print '<input type="hidden" name="page" value="'.$page.'">';
  238. print '<input type="hidden" name="mode" value="'.$mode.'">';
  239. print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit);
  240. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  241. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
  242. $massactionbutton = '';
  243. if ($massactionbutton) {
  244. $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
  245. }
  246. $moreforfilter = '';
  247. print '<div class="div-table-responsive">';
  248. print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
  249. // Fields title search
  250. // --------------------------------------------------------------------
  251. print '<tr class="liste_titre_filter">';
  252. // Action column
  253. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  254. print '<td class="liste_titre center maxwidthsearch actioncolumn">';
  255. $searchpicto = $form->showFilterButtons('left');
  256. print $searchpicto;
  257. print '</td>';
  258. }
  259. // Filter: Ref
  260. if (!empty($arrayfields['bc.ref']['checked'])) {
  261. print '<td class="liste_titre">';
  262. print '<input class="flat" type="text" size="4" name="search_ref" value="' . $search_ref . '">';
  263. print '</td>';
  264. }
  265. // Filter: Type
  266. if (!empty($arrayfields['bc.type']['checked'])) {
  267. print '<td class="liste_titre">';
  268. print '</td>';
  269. }
  270. // Filter: Date
  271. if (!empty($arrayfields['bc.date_bordereau']['checked'])) {
  272. print '<td class="liste_titre center">';
  273. print '<div class="nowrapfordate">';
  274. print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
  275. print '</div>';
  276. print '<div class="nowrapfordate">';
  277. print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
  278. print '</div>';
  279. print '</td>';
  280. }
  281. // Filter: Bank account
  282. if (!empty($arrayfields['ba.label']['checked'])) {
  283. print '<td class="liste_titre">';
  284. $form->select_comptes($search_account, 'search_account', 0, '', 1);
  285. print '</td>';
  286. }
  287. // Filter: Number of cheques
  288. if (!empty($arrayfields['bc.nbcheque']['checked'])) {
  289. print '<td class="liste_titre">&nbsp;</td>';
  290. }
  291. // Filter: Amount
  292. if (!empty($arrayfields['bc.amount']['checked'])) {
  293. print '<td class="liste_titre right">';
  294. print '<input class="flat maxwidth50" type="text" name="search_amount" value="' . $search_amount . '">';
  295. print '</td>';
  296. }
  297. // Filter: Status (only placeholder)
  298. if (!empty($arrayfields['bc.statut']['checked'])) {
  299. print '<td class="liste_titre"></td>';
  300. }
  301. // Fields from hook
  302. $parameters = array('arrayfields'=>$arrayfields);
  303. $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
  304. print $hookmanager->resPrint;
  305. // Action column
  306. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  307. print '<td class="liste_titre center maxwidthsearch actioncolumn">';
  308. $searchpicto = $form->showFilterButtons();
  309. print $searchpicto;
  310. print '</td>';
  311. }
  312. print "</tr>\n";
  313. $totalarray = array();
  314. $totalarray['nbfield'] = 0;
  315. // Fields title label
  316. // --------------------------------------------------------------------
  317. print '<tr class="liste_titre">';
  318. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  319. print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
  320. $totalarray['nbfield']++;
  321. }
  322. if (!empty($arrayfields['bc.ref']['checked'])) {
  323. print_liste_field_titre($arrayfields['bc.ref']['label'], $_SERVER["PHP_SELF"], "bc.ref", "", $param, "", $sortfield, $sortorder);
  324. $totalarray['nbfield']++;
  325. }
  326. if (!empty($arrayfields['bc.type']['checked'])) {
  327. print_liste_field_titre($arrayfields['bc.type']['label'], $_SERVER["PHP_SELF"], "bc.type", "", $param, "", $sortfield, $sortorder);
  328. $totalarray['nbfield']++;
  329. }
  330. if (!empty($arrayfields['bc.date_bordereau']['checked'])) {
  331. print_liste_field_titre($arrayfields['bc.date_bordereau']['label'], $_SERVER["PHP_SELF"], "bc.date_bordereau", "", $param, 'align="center"', $sortfield, $sortorder);
  332. $totalarray['nbfield']++;
  333. }
  334. if (!empty($arrayfields['ba.label']['checked'])) {
  335. print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
  336. $totalarray['nbfield']++;
  337. }
  338. if (!empty($arrayfields['bc.nbcheque']['checked'])) {
  339. print_liste_field_titre($arrayfields['bc.nbcheque']['label'], $_SERVER["PHP_SELF"], "bc.nbcheque", "", $param, 'class="right"', $sortfield, $sortorder);
  340. $totalarray['nbfield']++;
  341. }
  342. if (!empty($arrayfields['bc.amount']['checked'])) {
  343. print_liste_field_titre($arrayfields['bc.amount']['label'], $_SERVER["PHP_SELF"], "bc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
  344. $totalarray['nbfield']++;
  345. }
  346. if (!empty($arrayfields['bc.statut']['checked'])) {
  347. print_liste_field_titre($arrayfields['bc.statut']['label'], $_SERVER["PHP_SELF"], "bc.statut", "", $param, 'class="right"', $sortfield, $sortorder);
  348. $totalarray['nbfield']++;
  349. }
  350. // Hook fields
  351. $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
  352. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
  353. print $hookmanager->resPrint;
  354. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  355. print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
  356. $totalarray['nbfield']++;
  357. }
  358. print "</tr>\n";
  359. $checkedCount = 0;
  360. foreach ($arrayfields as $column) {
  361. if ($column['checked']) {
  362. $checkedCount++;
  363. }
  364. }
  365. if ($num > 0) {
  366. $savnbfield = 8;
  367. $i = 0;
  368. $totalarray = array();
  369. $totalarray['nbfield'] = 0;
  370. $imaxinloop = ($limit ? min($num, $limit) : $num);
  371. while ($i < $imaxinloop) {
  372. $objp = $db->fetch_object($resql);
  373. $checkdepositstatic->id = $objp->rowid;
  374. $checkdepositstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
  375. $checkdepositstatic->statut = $objp->statut;
  376. $checkdepositstatic->nbcheque = $objp->nbcheque;
  377. $checkdepositstatic->amount = $objp->amount;
  378. $checkdepositstatic->date_bordereau = $objp->date_bordereau;
  379. $checkdepositstatic->type = $objp->type;
  380. $account = new Account($db);
  381. $account->fetch($objp->bid);
  382. $checkdepositstatic->account_id = $account->getNomUrl(1);
  383. if ($mode == 'kanban') {
  384. if ($i == 0) {
  385. print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
  386. print '<div class="box-flex-container kanban">';
  387. }
  388. // Output Kanban
  389. print $checkdepositstatic->getKanbanView('', array('selected' => in_array($checkdepositstatic->id, $arrayofselected)));
  390. if ($i == ($imaxinloop - 1)) {
  391. print '</div>';
  392. print '</td></tr>';
  393. }
  394. } else {
  395. print '<tr class="oddeven">';
  396. // Action column
  397. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  398. print '<td class="nowrap center"></td>';
  399. if (!$i) {
  400. $totalarray['nbfield']++;
  401. }
  402. }
  403. // Num ref cheque
  404. if (!empty($arrayfields['bc.ref']['checked'])) {
  405. print '<td>';
  406. print $checkdepositstatic->getNomUrl(1);
  407. print '</td>';
  408. if (!$i) {
  409. $totalarray['nbfield']++;
  410. }
  411. }
  412. // Type
  413. if (!empty($arrayfields['bc.type']['checked'])) {
  414. $labelpaymentmode = ($langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) != "PaymentType".$checkdepositstatic->type ? $langs->transnoentitiesnoconv("PaymentType".$checkdepositstatic->type) : $checkdepositstatic->type);
  415. print '<td>'.dol_escape_htmltag($labelpaymentmode).'</td>';
  416. if (!$i) {
  417. $totalarray['nbfield']++;
  418. }
  419. }
  420. // Date
  421. if (!empty($arrayfields['bc.date_bordereau']['checked'])) {
  422. print '<td class="center">'.dol_print_date($db->jdate($objp->date_bordereau), 'dayhour', 'tzuser').'</td>';
  423. if (!$i) {
  424. $totalarray['nbfield']++;
  425. }
  426. }
  427. // Bank
  428. if (!empty($arrayfields['ba.label']['checked'])) {
  429. print '<td>';
  430. if ($objp->bid) {
  431. print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.$objp->label.'</a>';
  432. } else {
  433. print '&nbsp;';
  434. }
  435. print '</td>';
  436. if (!$i) {
  437. $totalarray['nbfield']++;
  438. }
  439. }
  440. // Number of cheques
  441. if (!empty($arrayfields['bc.nbcheque']['checked'])) {
  442. print '<td class="right">'.$objp->nbcheque.'</td>';
  443. if (!$i) {
  444. $totalarray['nbfield']++;
  445. }
  446. }
  447. // Amount
  448. if (!empty($arrayfields['bc.amount']['checked'])) {
  449. print '<td class="right"><span class="amount">'.price($objp->amount).'</span></td>';
  450. if (!$i) {
  451. $totalarray['nbfield']++;
  452. }
  453. if (empty($totalarray['val']['amount'])) {
  454. $totalarray['val']['amount'] = $objp->amount;
  455. } else {
  456. $totalarray['val']['amount'] += $objp->amount;
  457. }
  458. }
  459. // Status
  460. if (!empty($arrayfields['bc.statut']['checked'])) {
  461. print '<td class="right">';
  462. print $checkdepositstatic->LibStatut($objp->statut, 5);
  463. print '</td>';
  464. if (!$i) {
  465. $totalarray['nbfield']++;
  466. }
  467. }
  468. // Action column
  469. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  470. print '<td class="nowrap center"></td>';
  471. if (!$i) {
  472. $totalarray['nbfield']++;
  473. }
  474. }
  475. print "</tr>\n";
  476. }
  477. $i++;
  478. }
  479. } else {
  480. // If no record found
  481. if ($num == 0) {
  482. $colspan = 1;
  483. foreach ($arrayfields as $key => $val) {
  484. if (!empty($val['checked'])) {
  485. $colspan++;
  486. }
  487. }
  488. print '<tr class="oddeven">';
  489. print '<td colspan="' . $colspan . '" class="opacitymedium">' . $langs->trans("NoRecordFound") . "</td>";
  490. print '</tr>';
  491. }
  492. }
  493. print "</table>";
  494. print "</div>";
  495. print "</form>\n";
  496. } else {
  497. dol_print_error($db);
  498. }
  499. // End of page
  500. llxFooter();
  501. $db->close();