PageRenderTime 189ms CodeModel.GetById 91ms app.highlight 58ms RepoModel.GetById 32ms app.codeStats 1ms

/htdocs/compta/bank/ligne.php

https://bitbucket.org/speedealing/speedealing
PHP | 631 lines | 499 code | 78 blank | 54 comment | 104 complexity | 9fc60bdce3df531ebb117d93f6b324ee MD5 | raw file
  1<?php
  2/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3 * Copyright (C) 2003      Xavier DUTOIT        <doli@sydesy.com>
  4 * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  5 * Copyright (C) 2004      Christophe Combelles <ccomb@free.fr>
  6 * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  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/**
 23 *	\file       htdocs/compta/bank/ligne.php
 24 *	\ingroup    compta
 25 *	\brief      Page to edit a bank transaction record
 26 */
 27
 28require 'pre.inc.php';
 29require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
 30
 31$langs->load("banks");
 32$langs->load("compta");
 33$langs->load("bills");
 34$langs->load("categories");
 35if (! empty($conf->adherent->enabled)) $langs->load("members");
 36
 37
 38$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
 39$ref = GETPOST('ref','alpha');
 40$action=GETPOST('action','alpha');
 41$confirm=GETPOST('confirm','alpha');
 42$rowid=GETPOST("rowid",'int');
 43$orig_account=GETPOST("orig_account");
 44
 45// Security check
 46$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
 47$fieldtype = (! empty($ref) ? 'ref' :'rowid');
 48if ($user->societe_id) $socid=$user->societe_id;
 49$result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype);
 50if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) accessforbidden();
 51
 52
 53/*
 54 * Actions
 55 */
 56
 57if ($user->rights->banque->consolidate && $action == 'dvnext')
 58{
 59    $al = new AccountLine($db);
 60    $al->datev_next($_GET["rowid"]);
 61}
 62
 63if ($user->rights->banque->consolidate && $action == 'dvprev')
 64{
 65    $al = new AccountLine($db);
 66    $al->datev_previous($_GET["rowid"]);
 67}
 68
 69if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier)
 70{
 71    $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".GETPOST("cat1");
 72    if (! $db->query($sql))
 73    {
 74        dol_print_error($db);
 75    }
 76}
 77
 78if ($user->rights->banque->modifier && $action == 'class')
 79{
 80    $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$_POST["cat1"];
 81    if (! $db->query($sql))
 82    {
 83        dol_print_error($db);
 84    }
 85
 86    $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$_POST["cat1"].")";
 87    if (! $db->query($sql))
 88    {
 89        dol_print_error($db);
 90    }
 91}
 92
 93if ($user->rights->banque->modifier && $action == "update")
 94{
 95	$error=0;
 96
 97	$ac = new Account($db);
 98	$ac->fetch($id);
 99
100	if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
101	{
102		$mesg = '<div class="error">'.$langs->trans("ErrorCashAccountAcceptsOnlyCashMoney").'</div>';
103		$error++;
104	}
105
106	if (! $error)
107	{
108		// Avant de modifier la date ou le montant, on controle si ce n'est pas encore rapproche
109		$conciliated=0;
110		$sql = "SELECT b.rappro FROM ".MAIN_DB_PREFIX."bank as b WHERE rowid=".$rowid;
111		$result = $db->query($sql);
112		if ($result)
113		{
114			$objp = $db->fetch_object($result);
115			$conciliated=$objp->rappro;
116		}
117
118		$db->begin();
119
120		$amount = price2num($_POST['amount']);
121		$dateop = dol_mktime(12,0,0,$_POST["dateomonth"],$_POST["dateoday"],$_POST["dateoyear"]);
122		$dateval= dol_mktime(12,0,0,$_POST["datevmonth"],$_POST["datevday"],$_POST["datevyear"]);
123		$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
124		$sql.= " SET ";
125		// Always opened
126		if (isset($_POST['value']))      $sql.=" fk_type='".$db->escape($_POST['value'])."',";
127		if (isset($_POST['num_chq']))    $sql.=" num_chq='".$db->escape($_POST["num_chq"])."',";
128		if (isset($_POST['banque']))     $sql.=" banque='".$db->escape($_POST["banque"])."',";
129		if (isset($_POST['emetteur']))   $sql.=" emetteur='".$db->escape($_POST["emetteur"])."',";
130		// Blocked when conciliated
131		if (! $conciliated)
132		{
133			if (isset($_POST['label']))      $sql.=" label='".$db->escape($_POST["label"])."',";
134			if (isset($_POST['amount']))     $sql.=" amount='".$amount."',";
135			if (isset($_POST['dateomonth'])) $sql.=" dateo = '".$db->idate($dateop)."',";
136			if (isset($_POST['datevmonth'])) $sql.=" datev = '".$db->idate($dateval)."',";
137		}
138		$sql.= " fk_account = ".$id;
139		$sql.= " WHERE rowid = ".$rowid;
140
141		$result = $db->query($sql);
142		if ($result)
143		{
144			$mesg=$langs->trans("RecordSaved");
145			$db->commit();
146		}
147		else
148		{
149			$db->rollback();
150			dol_print_error($db);
151		}
152	}
153}
154
155// Reconcile
156if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == 'setreconcile'))
157{
158    $num_rel=trim($_POST["num_rel"]);
159    $rappro=$_POST['reconciled']?1:0;
160
161    // Check parameters
162    if ($rappro && empty($num_rel))
163    {
164        $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountStatement"));
165        $error++;
166    }
167
168    if (! $error)
169    {
170        $db->begin();
171
172        $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
173        $sql.= " SET num_releve=".($num_rel?"'".$num_rel."'":"null");
174        if (empty($num_rel)) $sql.= ", rappro = 0";
175        else $sql.=", rappro = ".$rappro;
176        $sql.= " WHERE rowid = ".$rowid;
177
178        dol_syslog("ligne.php sql=".$sql, LOG_DEBUG);
179        $result = $db->query($sql);
180        if ($result)
181        {
182            $mesg=$langs->trans("RecordSaved");
183            $db->commit();
184        }
185        else
186        {
187            $db->rollback();
188            dol_print_error($db);
189        }
190    }
191}
192
193
194
195/*
196 * View
197 */
198
199$form = new Form($db);
200
201llxHeader();
202
203// On initialise la liste des categories
204$sql = "SELECT rowid, label";
205$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
206$sql.= " ORDER BY label";
207$result = $db->query($sql);
208if ($result)
209{
210    $var=True;
211    $num = $db->num_rows($result);
212    $i = 0;
213    $options = "<option value=\"0\" selected=\"true\">&nbsp;</option>";
214    while ($i < $num)
215    {
216        $obj = $db->fetch_object($result);
217        $options .= "<option value=\"$obj->rowid\">$obj->label</option>\n";
218        $i++;
219    }
220    $db->free($result);
221}
222
223$var=false;
224
225$tabs = array(
226    array(
227        DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$rowid,
228        $langs->trans('Card')
229    ),
230    array(
231        DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$rowid,
232        $langs->trans('Info')
233    )
234);
235
236dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
237
238dol_htmloutput_mesg($mesg);
239
240$sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
241$sql.= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
242$sql.= " b.emetteur,b.banque";
243$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
244$sql.= " WHERE rowid=".$rowid;
245$sql.= " ORDER BY dateo ASC";
246$result = $db->query($sql);
247if ($result)
248{
249    $i = 0; $total = 0;
250    if ($db->num_rows($result))
251    {
252        $objp = $db->fetch_object($result);
253
254        $total = $total + $objp->amount;
255
256        $acct=new Account($db);
257        $acct->fetch($objp->fk_account);
258        $account = $acct->id;
259
260        $bankline = new AccountLine($db);
261        $bankline->fetch($rowid,$ref);
262
263        $links=$acct->get_url($rowid);
264        $bankline->load_previous_next_ref('','rowid');
265
266        // Confirmations
267        if ($action == 'delete_categ')
268        {
269            $ret=$form->form_confirm($_SERVER['PHP_SELF']."?rowid=".$rowid."&cat1=".GETPOST("fk_categ")."&orig_account=".$orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1);
270            if ($ret == 'html') print '<br>';
271        }
272
273        print '<form name="update" method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'">';
274        print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
275        print '<input type="hidden" name="action" value="update">';
276        print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
277        print '<input type="hidden" name="id" value="'.$acct->id.'">';
278
279        print '<table class="border" width="100%">';
280
281        $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/search.php">'.$langs->trans("BackToList").'</a>';
282
283        // Ref
284        print '<tr><td width="20%">'.$langs->trans("Ref")."</td>";
285        print '<td colspan="4">';
286        print $form->showrefnav($bankline, 'rowid', $linkback, 1, 'rowid', 'rowid');
287        print '</td>';
288        print '</tr>';
289
290        $i++;
291
292
293        // Bank account
294        print "<tr><td>".$langs->trans("Account")."</td>";
295        print '<td colspan="4">';
296        print $acct->getNomUrl(1,'transactions');
297        print '</td>';
298        print '</tr>';
299
300        // Show links of bank transactions
301        if (count($links))
302        {
303            print "<tr><td>".$langs->trans("Links")."</td>";
304            print '<td colspan="4">';
305            foreach($links as $key=>$val)
306            {
307                if ($key) print '<br>';
308                if ($links[$key]['type']=='payment') {
309                    print '<a href="'.DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$links[$key]['url_id'].'">';
310                    print img_object($langs->trans('ShowPayment'),'payment').' ';
311                    print $langs->trans("Payment");
312                    print '</a>';
313                }
314                else if ($links[$key]['type']=='payment_supplier') {
315                    print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$links[$key]['url_id'].'">';
316                    print img_object($langs->trans('ShowPayment'),'payment').' ';
317                    print $langs->trans("Payment");
318                    print '</a>';
319                }
320                else if ($links[$key]['type']=='company') {
321                    print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$links[$key]['url_id'].'">';
322                    print img_object($langs->trans('ShowCompany'),'company').' ';
323                    print $links[$key]['label'];
324                    print '</a>';
325                }
326                else if ($links[$key]['type']=='sc') {
327                    print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
328                    print img_object($langs->trans('ShowSocialContribution'),'bill').' ';
329                    print $langs->trans("SocialContribution").($links[$key]['label']?' - '.$links[$key]['label']:'');
330                    print '</a>';
331                }
332                else if ($links[$key]['type']=='payment_sc') {
333                    print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$links[$key]['url_id'].'">';
334                    print img_object($langs->trans('ShowPayment'),'payment').' ';
335                    print $langs->trans("SocialContributionPayment");
336                    print '</a>';
337                }
338                else if ($links[$key]['type']=='payment_vat') {
339                    print '<a href="'.DOL_URL_ROOT.'/compta/tva/fiche.php?id='.$links[$key]['url_id'].'">';
340                    print img_object($langs->trans('ShowVAT'),'payment').' ';
341                    print $langs->trans("VATPayment");
342                    print '</a>';
343                }
344                else if ($links[$key]['type']=='member') {
345                    print '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$links[$key]['url_id'].'">';
346                    print img_object($langs->trans('ShowMember'),'user').' ';
347                    print $links[$key]['label'];
348                    print '</a>';
349                }
350                else if ($links[$key]['type']=='banktransfert') {
351                    print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
352                    print img_object($langs->trans('ShowTransaction'),'payment').' ';
353                    print $langs->trans("TransactionOnTheOtherAccount");
354                    print '</a>';
355                }
356                else {
357                    print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
358                    print img_object('','generic').' ';
359                    print $links[$key]['label'];
360                    print '</a>';
361                }
362            }
363            print '</td></tr>';
364        }
365
366        $rowspan=0;
367
368        //$user->rights->banque->modifier=false;
369        //$user->rights->banque->consolidate=true;
370
371        // Type of payment / Number
372        print "<tr><td>".$langs->trans("Type")." / ".$langs->trans("Numero");
373        print "</td>";
374        if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
375        {
376            print '<td colspan="3">';
377            print $form->select_types_paiements($objp->fk_type,"value",'',2);
378            print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
379            if ($objp->receiptid)
380            {
381                include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
382                $receipt=new RemiseCheque($db);
383                $receipt->fetch($objp->receiptid);
384                print ' &nbsp; &nbsp; '.$langs->trans("CheckReceipt").': '.$receipt->getNomUrl(2);
385
386            }
387            print '</td>';
388            $rowspan=7;
389            print '<td align="center" rowspan="'.$rowspan.'" width="20%"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
390            print '</td>';
391        }
392        else
393        {
394            print '<td colspan="4">'.$objp->fk_type.' '.$objp->num_chq.'</td>';
395        }
396        print "</tr>";
397
398        // Bank of cheque
399        print "<tr><td>".$langs->trans("Bank")."</td>";
400        if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
401        {
402            print '<td colspan="3">';
403            print '<input type="text" class="flat" size="40" name="banque" value="'.(empty($objp->banque) ? '' : $objp->banque).'">';
404            print '</td>';
405        }
406        else
407        {
408            print '<td colspan="'.($rowspan?'3':'4').'">'.$objp->banque.'</td>';
409        }
410        print "</tr>";
411
412        // Transmitter
413        print "<tr><td>".$langs->trans("CheckTransmitter")."</td>";
414        if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
415        {
416            print '<td colspan="3">';
417            print '<input type="text" class="flat" size="40" name="emetteur" value="'.(empty($objp->emetteur) ? '' : stripslashes($objp->emetteur)).'">';
418            print '</td>';
419        }
420        else
421        {
422            print '<td colspan="'.($rowspan?'3':'4').'">'.$objp->emetteur.'</td>';
423        }
424        print "</tr>";
425
426        // Date ope
427        print '<tr><td>'.$langs->trans("DateOperation").'</td>';
428        if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
429        {
430            print '<td colspan="3">';
431            print $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro);
432            print '</td>';
433        }
434        else
435        {
436            print '<td colspan="'.($rowspan?'3':'4').'">';
437            print dol_print_date($db->jdate($objp->do),"day");
438            print '</td>';
439        }
440        print '</tr>';
441
442        // Value date
443        print "<tr><td>".$langs->trans("DateValue")."</td>";
444        if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
445        {
446            print '<td colspan="3">';
447            print $form->select_date($db->jdate($objp->dv),'datev','','','','update',1,0,1,$objp->rappro);
448            if (! $objp->rappro)
449            {
450                print ' &nbsp; ';
451                print '<a href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
452                print img_edit_remove() . "</a> ";
453                print '<a href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
454                print img_edit_add() ."</a>";
455            }
456            print '</td>';
457        }
458        else
459        {
460            print '<td colspan="'.($rowspan?'3':'4').'">';
461            print dol_print_date($db->jdate($objp->dv),"day");
462            print '</td>';
463        }
464        print "</tr>";
465
466        // Description
467        print "<tr><td>".$langs->trans("Label")."</td>";
468        if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
469        {
470            print '<td colspan="3">';
471            print '<input name="label" class="flat" '.($objp->rappro?' disabled="disabled"':'').' value="';
472            if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
473            {
474                // Label generique car entre parentheses. On l'affiche en le traduisant
475                print $langs->trans($reg[1]);
476            }
477            else
478            {
479                print $objp->label;
480            }
481            print '" size="50">';
482            print '</td>';
483        }
484        else
485        {
486            print '<td colspan="'.($rowspan?'3':'4').'">';
487            if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
488            {
489                // Label generique car entre parentheses. On l'affiche en le traduisant
490                print $langs->trans($reg[1]);
491            }
492            else
493            {
494                print $objp->label;
495            }
496            print '</td>';
497        }
498        print '</tr>';
499
500        // Amount
501        print "<tr><td>".$langs->trans("Amount")."</td>";
502        if ($user->rights->banque->modifier)
503        {
504            print '<td colspan="3">';
505            print '<input name="amount" class="flat" size="10" '.($objp->rappro?' disabled="disabled"':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$conf->currency);
506            print '</td>';
507        }
508        else
509        {
510            print '<td colspan="'.($rowspan?'3':'4').'">';
511            print price($objp->amount);
512            print '</td>';
513        }
514        print "</tr>";
515
516        print "</table>";
517        print "</form>";
518
519        // Releve rappro
520        if ($acct->canBeConciliated() > 0)  // Si compte rapprochable
521        {
522            print '<br>'."\n";
523            print_fiche_titre($langs->trans("Reconciliation"),'','');
524            print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$objp->rowid.'">';
525            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
526            print '<input type="hidden" name="action" value="setreconcile">';
527            print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
528
529            print '<table class="border" width="100%">';
530
531            print '<tr><td width="20%">'.$langs->trans("Conciliation")."</td>";
532            if ($user->rights->banque->consolidate)
533            {
534                print '<td colspan="3">';
535                if ($objp->rappro)
536                {
537                    print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled="disabled"':'').'>';
538                    print '<input name="num_rel" type="hidden" value="'.$objp->num_releve.'">';
539                }
540                else
541                {
542                    print $langs->trans("AccountStatement").' <input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled="disabled"':'').'>';
543                }
544                if ($objp->num_releve) print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?num='.$objp->num_releve.'&account='.$acct->id.'">'.$langs->trans("AccountStatement").' '.$objp->num_releve.')</a>';
545                print '</td><td align="center" rowspan="2" width="20%"><input type="submit" class="button" value="'.$langs->trans("Update").'"></td>';
546            }
547            else
548            {
549                print '<td colspan="4">'.$objp->num_releve.'&nbsp;</td>';
550            }
551            print '</tr>';
552
553            print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
554            if ($user->rights->banque->consolidate)
555            {
556                print '<td colspan="3">';
557                print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked="checked"':''):($objp->rappro?' checked="checked"':'')).'">';
558                print '</td>';
559            }
560            else
561            {
562                print '<td colspan="4">'.yn($objp->rappro).'</td>';
563            }
564            print '</tr>';
565
566            print "</table>";
567            print '</form>';
568        }
569
570    }
571
572    $db->free($result);
573}
574else dol_print_error($db);
575print '</div>';
576
577
578
579// List of bank categories
580
581print '<br>';
582print '<table class="noborder" width="100%">';
583
584print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'&amp;id='.$id.'">';
585print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
586print '<input type="hidden" name="action" value="class">';
587print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
588print '<tr class="liste_titre"><td>'.$langs->trans("Rubriques").'</td><td colspan="2">';
589if ($user->rights->banque->modifier)
590{
591    print '<select class="flat" name="cat1">'.$options.'</select>&nbsp;';
592    print '<input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
593}
594print "</tr>";
595print "</form>";
596
597$sql = "SELECT c.label, c.rowid";
598$sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c";
599$sql.= " WHERE a.lineid=".$rowid." AND a.fk_categ = c.rowid";
600$sql.= " ORDER BY c.label";
601$result = $db->query($sql);
602if ($result)
603{
604    $var=True;
605    $num = $db->num_rows($result);
606    $i = 0; $total = 0;
607    while ($i < $num)
608    {
609        $objp = $db->fetch_object($result);
610
611        $var=!$var;
612        print "<tr ".$bc[$var].">";
613
614        print "<td>".$objp->label."</td>";
615        print "<td align=\"center\"><a href=\"budget.php?bid=".$objp->rowid."\">".$langs->trans("ListBankTransactions")."</a></td>";
616        if ($user->rights->banque->modifier)
617        {
618            print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=delete_categ&amp;rowid='.$rowid.'&amp;fk_categ='.$objp->rowid.'">'.img_delete($langs->trans("Remove")).'</a></td>';
619        }
620        print "</tr>";
621
622        $i++;
623    }
624    $db->free($result);
625}
626print "</table>";
627
628llxFooter();
629
630$db->close();
631?>