PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/facture/prelevement.php

https://bitbucket.org/speedealing/speedealing
PHP | 577 lines | 422 code | 77 blank | 78 comment | 111 complexity | 96000cc86ccb0e364f7e28f98f92dc7b MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  4. * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
  6. * Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/compta/facture/prelevement.php
  23. * \ingroup facture
  24. * \brief Gestion des prelevement d'une facture
  25. */
  26. require '../../main.inc.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
  31. if (!$user->rights->facture->lire) accessforbidden();
  32. $langs->load("bills");
  33. $langs->load("banks");
  34. $langs->load("withdrawals");
  35. $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
  36. $ref=GETPOST('ref','alpha');
  37. $socid=GETPOST('socid','int');
  38. $action=GETPOST('action','alpha');
  39. $fieldid = (! empty($ref)?'facnumber':'rowid');
  40. if ($user->societe_id) $socid=$user->societe_id;
  41. $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
  42. $object = new Facture($db);
  43. // Load object
  44. if ($id > 0 || ! empty($ref))
  45. {
  46. $ret=$object->fetch($id, $ref);
  47. if ($ret > 0)
  48. {
  49. $object->fetch_thirdparty();
  50. }
  51. }
  52. /*
  53. * Actions
  54. */
  55. if ($action == "new")
  56. {
  57. if ($object->id > 0)
  58. {
  59. $result = $object->demande_prelevement($user);
  60. if ($result > 0)
  61. {
  62. header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
  63. exit;
  64. }
  65. else
  66. {
  67. setEventMessage($object->error, 'errors');
  68. }
  69. }
  70. }
  71. if ($action == "delete")
  72. {
  73. if ($object->id > 0)
  74. {
  75. $result = $object->demande_prelevement_delete($user, GETPOST('did'));
  76. if ($result == 0)
  77. {
  78. header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
  79. exit;
  80. }
  81. }
  82. }
  83. /*
  84. * View
  85. */
  86. $now=dol_now();
  87. llxHeader('', $langs->trans("Bill"));
  88. $form = new Form($db);
  89. /* *************************************************************************** */
  90. /* */
  91. /* Mode fiche */
  92. /* */
  93. /* *************************************************************************** */
  94. if ($object->id > 0)
  95. {
  96. $totalpaye = $object->getSommePaiement();
  97. $totalcreditnotes = $object->getSumCreditNotesUsed();
  98. $totaldeposits = $object->getSumDepositsUsed();
  99. //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
  100. // We can also use bcadd to avoid pb with floating points
  101. // For example print 239.2 - 229.3 - 9.9; does not return 0.
  102. //$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
  103. //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
  104. $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
  105. if ($object->paye) $resteapayer=0;
  106. $resteapayeraffiche=$resteapayer;
  107. $absolute_discount=$object->thirdparty->getAvailableDiscounts('','fk_facture_source IS NULL');
  108. $absolute_creditnote=$object->thirdparty->getAvailableDiscounts('','fk_facture_source IS NOT NULL');
  109. $absolute_discount=price2num($absolute_discount,'MT');
  110. $absolute_creditnote=price2num($absolute_creditnote,'MT');
  111. $author = new User($db);
  112. if ($object->user_author)
  113. {
  114. $author->fetch($object->user_author);
  115. }
  116. $head = facture_prepare_head($object);
  117. dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill');
  118. /*
  119. * Facture
  120. */
  121. print '<table class="border" width="100%">';
  122. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
  123. // Ref
  124. print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="5">';
  125. $morehtmlref='';
  126. $discount=new DiscountAbsolute($db);
  127. $result=$discount->fetch(0,$object->id);
  128. if ($result > 0)
  129. {
  130. $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')';
  131. }
  132. if ($result < 0)
  133. {
  134. dol_print_error('',$discount->error);
  135. }
  136. print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
  137. print "</td></tr>";
  138. // Ref customer
  139. print '<tr><td width="20%">';
  140. print '<table class="nobordernopadding" width="100%"><tr><td>';
  141. print $langs->trans('RefCustomer');
  142. print '</td>';
  143. print '</tr></table>';
  144. print '</td>';
  145. print '<td colspan="5">';
  146. print $object->ref_client;
  147. print '</td></tr>';
  148. // Third party
  149. print '<tr><td>'.$langs->trans('Company').'</td>';
  150. print '<td colspan="5">'.$object->thirdparty->getNomUrl(1,'compta');
  151. print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)</td>';
  152. print '</tr>';
  153. // Type
  154. print '<tr><td>'.$langs->trans('Type').'</td><td colspan="5">';
  155. print $object->getLibType();
  156. if ($object->type == 1)
  157. {
  158. $facreplaced=new Facture($db);
  159. $facreplaced->fetch($object->fk_facture_source);
  160. print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')';
  161. }
  162. if ($object->type == 2)
  163. {
  164. $facusing=new Facture($db);
  165. $facusing->fetch($object->fk_facture_source);
  166. print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')';
  167. }
  168. $facidavoir=$object->getListIdAvoirFromInvoice();
  169. if (count($facidavoir) > 0)
  170. {
  171. print ' ('.$langs->transnoentities("InvoiceHasAvoir");
  172. $i=0;
  173. foreach($facidavoir as $id)
  174. {
  175. if ($i==0) print ' ';
  176. else print ',';
  177. $facavoir=new Facture($db);
  178. $facavoir->fetch($id);
  179. print $facavoir->getNomUrl(1);
  180. }
  181. print ')';
  182. }
  183. // FIXME $facidnext not defined
  184. /*
  185. if ($facidnext > 0)
  186. {
  187. $facthatreplace=new Facture($db);
  188. $facthatreplace->fetch($facidnext);
  189. print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
  190. }
  191. */
  192. print '</td></tr>';
  193. // Discounts
  194. print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
  195. if ($object->thirdparty->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_client);
  196. else print $langs->trans("CompanyHasNoRelativeDiscount");
  197. print '. ';
  198. if ($absolute_discount > 0)
  199. {
  200. if ($object->statut > 0 || $object->type == 2 || $object->type == 3)
  201. {
  202. if ($object->statut == 0)
  203. {
  204. print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)).'. ';
  205. }
  206. else
  207. {
  208. if ($object->statut < 1 || $object->type == 2 || $object->type == 3)
  209. {
  210. $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
  211. print '<br>'.$text.'.<br>';
  212. }
  213. else
  214. {
  215. $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency));
  216. $text2=$langs->trans("AbsoluteDiscountUse");
  217. print $form->textwithpicto($text,$text2);
  218. }
  219. }
  220. }
  221. else
  222. {
  223. // Remise dispo de type non avoir
  224. $filter='fk_facture_source IS NULL';
  225. print '<br>';
  226. $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer);
  227. }
  228. }
  229. if ($absolute_creditnote > 0)
  230. {
  231. // If validated, we show link "add credit note to payment"
  232. if ($object->statut != 1 || $object->type == 2 || $object->type == 3)
  233. {
  234. if ($object->statut == 0 && $object->type != 3)
  235. {
  236. $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency));
  237. print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse"));
  238. }
  239. else print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.';
  240. }
  241. else
  242. {
  243. // Remise dispo de type avoir
  244. $filter='fk_facture_source IS NOT NULL';
  245. if (! $absolute_discount) print '<br>';
  246. $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer);
  247. }
  248. }
  249. if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
  250. print '</td></tr>';
  251. // Date invoice
  252. print '<tr><td>';
  253. print '<table class="nobordernopadding" width="100%"><tr><td>';
  254. print $langs->trans('Date');
  255. print '</td>';
  256. if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
  257. print '</tr></table>';
  258. print '</td><td colspan="3">';
  259. if ($object->type != 2)
  260. {
  261. if ($action == 'editinvoicedate')
  262. {
  263. $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$object->date,'invoicedate');
  264. }
  265. else
  266. {
  267. print dol_print_date($object->date,'daytext');
  268. }
  269. }
  270. else
  271. {
  272. print dol_print_date($object->date,'daytext');
  273. }
  274. print '</td>';
  275. print '</tr>';
  276. // Date payment term
  277. print '<tr><td>';
  278. print '<table class="nobordernopadding" width="100%"><tr><td>';
  279. print $langs->trans('DateMaxPayment');
  280. print '</td>';
  281. if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editpaymentterm&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
  282. print '</tr></table>';
  283. print '</td><td colspan="3">';
  284. if ($object->type != 2)
  285. {
  286. if ($action == 'editpaymentterm')
  287. {
  288. $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$object->date_lim_reglement,'paymentterm');
  289. }
  290. else
  291. {
  292. print dol_print_date($object->date_lim_reglement,'daytext');
  293. if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late'));
  294. }
  295. }
  296. else
  297. {
  298. print '&nbsp;';
  299. }
  300. print '</td></tr>';
  301. // Conditions de reglement
  302. print '<tr><td>';
  303. print '<table class="nobordernopadding" width="100%"><tr><td>';
  304. print $langs->trans('PaymentConditionsShort');
  305. print '</td>';
  306. if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
  307. print '</tr></table>';
  308. print '</td><td colspan="3">';
  309. if ($object->type != 2)
  310. {
  311. if ($action == 'editconditions')
  312. {
  313. $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
  314. }
  315. else
  316. {
  317. $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
  318. }
  319. }
  320. else
  321. {
  322. print '&nbsp;';
  323. }
  324. print '</td></tr>';
  325. // Mode de reglement
  326. print '<tr><td>';
  327. print '<table class="nobordernopadding" width="100%"><tr><td>';
  328. print $langs->trans('PaymentMode');
  329. print '</td>';
  330. if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
  331. print '</tr></table>';
  332. print '</td><td colspan="3">';
  333. if ($action == 'editmode')
  334. {
  335. $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
  336. }
  337. else
  338. {
  339. $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
  340. }
  341. print '</td></tr>';
  342. // Montants
  343. print '<tr><td>'.$langs->trans('AmountHT').'</td>';
  344. print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';
  345. print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
  346. print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
  347. print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
  348. // Amount Local Taxes
  349. if ($mysoc->country_code=='ES')
  350. {
  351. if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
  352. {
  353. print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
  354. print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
  355. print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
  356. }
  357. if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
  358. {
  359. print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
  360. print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
  361. print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
  362. }
  363. }
  364. print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
  365. print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
  366. // Statut
  367. print '<tr><td>'.$langs->trans('Status').'</td>';
  368. print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
  369. print '<tr><td>'.$langs->trans("RIB").'</td><td colspan="5">';
  370. print $object->thirdparty->display_rib();
  371. print '</td></tr>';
  372. print '</table>';
  373. dol_fiche_end();
  374. /*
  375. * Withdrawal request
  376. */
  377. $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
  378. $sql .= " , pfd.date_traite as date_traite";
  379. $sql .= " , pfd.amount";
  380. $sql .= " , u.rowid as user_id, u.name, u.firstname, u.login";
  381. $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
  382. $sql .= " , ".MAIN_DB_PREFIX."user as u";
  383. $sql .= " WHERE fk_facture = ".$object->id;
  384. $sql .= " AND pfd.fk_user_demande = u.rowid";
  385. $sql .= " AND pfd.traite = 0";
  386. $sql .= " ORDER BY pfd.date_demande DESC";
  387. $result_sql = $db->query($sql);
  388. if ($result_sql)
  389. {
  390. $num = $db->num_rows($result_sql);
  391. }
  392. /*
  393. * Buttons
  394. */
  395. print "\n<div class=\"tabsAction\">\n";
  396. // Add a withdraw request
  397. if ($object->statut > 0 && $object->paye == 0 && $num == 0)
  398. {
  399. if ($user->rights->prelevement->bons->creer)
  400. {
  401. print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
  402. }
  403. else
  404. {
  405. print '<a class="butActionRefused" href="#">'.$langs->trans("MakeWithdrawRequest").'</a>';
  406. }
  407. }
  408. else
  409. {
  410. print '<a class="butActionRefused" href="#">'.$langs->trans("MakeWithdrawRequest").'</a>';
  411. }
  412. print "</div><br>\n";
  413. print $langs->trans("DoStandingOrdersBeforePayments").'<br><br>';
  414. /*
  415. * Withdrawals
  416. */
  417. print '<table class="noborder" width="100%">';
  418. print '<tr class="liste_titre">';
  419. print '<td align="left">'.$langs->trans("DateRequest").'</td>';
  420. print '<td align="center">'.$langs->trans("DateProcess").'</td>';
  421. print '<td align="center">'.$langs->trans("Amount").'</td>';
  422. print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
  423. print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>';
  424. print '</tr>';
  425. $var=True;
  426. if ($result_sql)
  427. {
  428. $i = 0;
  429. while ($i < $num)
  430. {
  431. $obj = $db->fetch_object($result_sql);
  432. $var=!$var;
  433. print "<tr ".$bc[$var].">";
  434. print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
  435. print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
  436. print '<td align="center">'.price($obj->amount).'</td>';
  437. print '<td align="center">-</td>';
  438. print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
  439. print '<td>&nbsp;</td>';
  440. print '<td>';
  441. print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete&amp;did='.$obj->rowid.'">';
  442. print img_delete();
  443. print '</a></td>';
  444. print "</tr>\n";
  445. $i++;
  446. }
  447. $db->free($result_sql);
  448. }
  449. else
  450. {
  451. dol_print_error($db);
  452. }
  453. $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande,";
  454. $sql.= " pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
  455. $sql.= " pb.ref,";
  456. $sql.= " u.rowid as user_id, u.name, u.firstname, u.login";
  457. $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd,";
  458. $sql.= " ".MAIN_DB_PREFIX."prelevement_bons as pb,";
  459. $sql.= " ".MAIN_DB_PREFIX."user as u";
  460. $sql.= " WHERE fk_facture = ".$object->id;
  461. $sql.= " AND pfd.fk_user_demande = u.rowid";
  462. $sql.= " AND pb.rowid = pfd.fk_prelevement_bons";
  463. $sql.= " AND pfd.traite = 1";
  464. $sql.= " ORDER BY pfd.date_demande DESC";
  465. $result = $db->query($sql);
  466. if ($result)
  467. {
  468. $num = $db->num_rows($result);
  469. $i = 0;
  470. while ($i < $num)
  471. {
  472. $obj = $db->fetch_object($result);
  473. $var=!$var;
  474. print "<tr $bc[$var]>";
  475. print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
  476. print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
  477. print '<td align="center">'.price($obj->amount).'</td>';
  478. print '<td align="center">';
  479. $withdrawreceipt=new BonPrelevement($db);
  480. $withdrawreceipt->id=$obj->fk_prelevement_bons;
  481. $withdrawreceipt->ref=$obj->ref;
  482. print $withdrawreceipt->getNomUrl(1);
  483. print "</td>\n";
  484. print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
  485. print '<td>&nbsp;</td>';
  486. print '<td>&nbsp;</td>';
  487. print "</tr>\n";
  488. $i++;
  489. }
  490. $db->free($result);
  491. }
  492. else
  493. {
  494. dol_print_error($db);
  495. }
  496. print "</table>";
  497. }
  498. llxFooter();
  499. $db->close();
  500. ?>