dolibarr  9.0.0
ligne.php
Go to the documentation of this 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-2017 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
6  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
7  * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
8  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
9  * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
10  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
32 require '../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other'));
38 if (! empty($conf->adherent->enabled)) $langs->load("members");
39 if (! empty($conf->don->enabled)) $langs->load("donations");
40 if (! empty($conf->loan->enabled)) $langs->load("loan");
41 if (! empty($conf->salaries->enabled)) $langs->load("salaries");
42 
43 
44 $id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
45 $ref = GETPOST('ref','alpha');
46 $action=GETPOST('action','alpha');
47 $confirm=GETPOST('confirm','alpha');
48 $rowid=GETPOST("rowid",'int');
49 $orig_account=GETPOST("orig_account");
50 $backtopage=GETPOST('backtopage','alpha');
51 $cancel=GETPOST('cancel','alpha');
52 
53 // Security check
54 $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
55 $fieldtype = (! empty($ref) ? 'ref' :'rowid');
56 if ($user->societe_id) $socid=$user->societe_id;
57 $result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype);
58 if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) accessforbidden();
59 
60 
61 /*
62  * Actions
63  */
64 
65 if ($cancel)
66 {
67  if ($backtopage)
68  {
69  header("Location: ".$backtopage);
70  exit;
71  }
72 }
73 
74 
75 if ($user->rights->banque->consolidate && $action == 'donext')
76 {
77  $al = new AccountLine($db);
78  $al->dateo_next($_GET["rowid"]);
79 }elseif ($user->rights->banque->consolidate && $action == 'doprev')
80 {
81  $al = new AccountLine($db);
82  $al->dateo_previous($_GET["rowid"]);
83 }elseif ($user->rights->banque->consolidate && $action == 'dvnext')
84 {
85  $al = new AccountLine($db);
86  $al->datev_next($_GET["rowid"]);
87 }elseif ($user->rights->banque->consolidate && $action == 'dvprev')
88 {
89  $al = new AccountLine($db);
90  $al->datev_previous($_GET["rowid"]);
91 }
92 
93 if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier)
94 {
95  $cat1=GETPOST("cat1",'int');
96  if (!empty($rowid) && !empty($cat1)) {
97  $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$cat1;
98  if (! $db->query($sql))
99  {
100  dol_print_error($db);
101  }
102  }
103  else
104  {
105  setEventMessages($langs->trans("MissingIds"), null, 'errors');
106  }
107 }
108 
109 if ($user->rights->banque->modifier && $action == "update")
110 {
111  $error=0;
112 
113  $acline = new AccountLine($db);
114  $acline->fetch($rowid);
115 
116  $acsource = new Account($db);
117  $acsource->fetch($id);
118 
119  $actarget = new Account($db);
120  if (GETPOST('accountid','int') > 0 && ! $acline->rappro && ! $acline->getVentilExportCompta()) // We ask to change bank account
121  {
122  $actarget->fetch(GETPOST('accountid','int'));
123  }
124  else
125  {
126  $actarget->fetch($id);
127  }
128 
129  if ($actarget->courant == Account::TYPE_CASH && GETPOST('value','alpha') != 'LIQ')
130  {
131  setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
132  $error++;
133  }
134 
135  if (! $error)
136  {
137  $db->begin();
138 
139  $amount = price2num($_POST['amount']);
140  $dateop = dol_mktime(12,0,0,$_POST["dateomonth"],$_POST["dateoday"],$_POST["dateoyear"]);
141  $dateval= dol_mktime(12,0,0,$_POST["datevmonth"],$_POST["datevday"],$_POST["datevyear"]);
142  $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
143  $sql.= " SET ";
144  // Always opened
145  if (isset($_POST['value'])) $sql.=" fk_type='".$db->escape($_POST['value'])."',";
146  if (isset($_POST['num_chq'])) $sql.=" num_chq='".$db->escape($_POST["num_chq"])."',";
147  if (isset($_POST['banque'])) $sql.=" banque='".$db->escape($_POST["banque"])."',";
148  if (isset($_POST['emetteur'])) $sql.=" emetteur='".$db->escape($_POST["emetteur"])."',";
149  // Blocked when conciliated
150  if (! $acline->rappro)
151  {
152  if (isset($_POST['label'])) $sql.=" label='".$db->escape($_POST["label"])."',";
153  if (isset($_POST['amount'])) $sql.=" amount='".$amount."',";
154  if (isset($_POST['dateomonth'])) $sql.=" dateo = '".$db->idate($dateop)."',";
155  if (isset($_POST['datevmonth'])) $sql.=" datev = '".$db->idate($dateval)."',";
156  }
157  $sql.= " fk_account = ".$actarget->id;
158  $sql.= " WHERE rowid = ".$acline->id;
159 
160  $result = $db->query($sql);
161  if (! $result)
162  {
163  $error++;
164  }
165 
166  if (! $error)
167  {
168  $arrayofcategs=GETPOST('custcats', 'array');
169  $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid;
170  if (! $db->query($sql))
171  {
172  $error++;
173  dol_print_error($db);
174  }
175  if (count($arrayofcategs))
176  {
177  foreach($arrayofcategs as $val)
178  {
179  $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$val.")";
180  if (! $db->query($sql))
181  {
182  $error++;
183  dol_print_error($db);
184  }
185  }
186  // $arrayselected will be loaded after in page output
187  }
188  }
189 
190  if (! $error)
191  {
192  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
193  $db->commit();
194  }
195  else
196  {
197  $db->rollback();
198  dol_print_error($db);
199  }
200  }
201 }
202 
203 // Reconcile
204 if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == 'setreconcile'))
205 {
206  $num_rel=trim($_POST["num_rel"]);
207  $rappro=$_POST['reconciled']?1:0;
208 
209  // Check parameters
210  if ($rappro && empty($num_rel))
211  {
212  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountStatement")), null, 'errors');
213  $error++;
214  }
215 
216  if (! $error)
217  {
218  $db->begin();
219 
220  $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
221  $sql.= " SET num_releve=".($num_rel?"'".$num_rel."'":"null");
222  if (empty($num_rel)) $sql.= ", rappro = 0";
223  else $sql.=", rappro = ".$rappro;
224  $sql.= " WHERE rowid = ".$rowid;
225 
226  dol_syslog("ligne.php", LOG_DEBUG);
227  $result = $db->query($sql);
228  if ($result)
229  {
230  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
231  $db->commit();
232  }
233  else
234  {
235  $db->rollback();
236  dol_print_error($db);
237  }
238  }
239 }
240 
241 
242 
243 /*
244  * View
245  */
246 
247 $form = new Form($db);
248 
249 llxHeader('', $langs->trans("BankTransaction"));
250 
251 $c = new Categorie($db);
252 $cats = $c->containing($rowid, Categorie::TYPE_BANK_LINE);
253 foreach ($cats as $cat) {
254  $arrayselected[] = $cat->id;
255 }
256 
257 $tabs = array(
258  array(
259  DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$rowid,
260  $langs->trans('Card')
261  ),
262  array(
263  DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$rowid,
264  $langs->trans('Info')
265  )
266 );
267 
268 
269 $sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
270 $sql.= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
271 $sql.= " b.emetteur,b.banque";
272 $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
273 $sql.= " WHERE rowid=".$rowid;
274 $sql.= " ORDER BY dateo ASC";
275 $result = $db->query($sql);
276 if ($result)
277 {
278  $i = 0; $total = 0;
279  if ($db->num_rows($result))
280  {
281  $objp = $db->fetch_object($result);
282 
283  $total = $total + $objp->amount;
284 
285  $acct=new Account($db);
286  $acct->fetch($objp->fk_account);
287  $account = $acct->id;
288 
289  $bankline = new AccountLine($db);
290  $bankline->fetch($rowid, $ref);
291 
292  $links=$acct->get_url($rowid);
293  $bankline->load_previous_next_ref('','rowid');
294 
295  // Confirmations
296  if ($action == 'delete_categ')
297  {
298  print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$rowid."&cat1=".GETPOST("fk_categ")."&orig_account=".$orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1);
299  }
300 
301  print '<form name="update" method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'">';
302  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
303  print '<input type="hidden" name="action" value="update">';
304  print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
305  print '<input type="hidden" name="id" value="'.$acct->id.'">';
306 
307  dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), -1, 'account', 0);
308 
309  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
310 
311 
312  dol_banner_tab($bankline, 'rowid', $linkback);
313 
314  print '<div class="fichecenter">';
315 
316  print '<div class="underbanner clearboth"></div>';
317  print '<table class="border" width="100%">';
318 
319  $i++;
320 
321  // Bank account
322  print '<tr><td class="titlefield">'.$langs->trans("Account").'</td>';
323  print '<td>';
324  if (! $objp->rappro && ! $bankline->getVentilExportCompta())
325  {
326  print $form->select_comptes($acct->id, 'accountid', 0, '', 0);
327  }
328  else
329  {
330  print $acct->getNomUrl(1,'transactions','reflabel');
331  }
332  print '</td>';
333  print '</tr>';
334 
335  // Show links of bank transactions
336  if (count($links))
337  {
338  print '<tr><td class="tdtop">'.$langs->trans("Links").'</td>';
339  print '<td>';
340  foreach($links as $key=>$val)
341  {
342  if ($key) print '<br>';
343  if ($links[$key]['type']=='payment') {
344  require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
345  $paymenttmp=new Paiement($db);
346  $paymenttmp->fetch($links[$key]['url_id']);
347  $paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
348  /*print '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$links[$key]['url_id'].'">';
349  print img_object($langs->trans('ShowPayment'),'payment').' ';
350  print $langs->trans("Payment");
351  print '</a>';*/
352  print $paymenttmp->getNomUrl(1);
353  }
354  else if ($links[$key]['type']=='payment_supplier') {
355  require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
356  $paymenttmp=new PaiementFourn($db);
357  $paymenttmp->fetch($links[$key]['url_id']);
358  $paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
359  /*print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$links[$key]['url_id'].'">';
360  print img_object($langs->trans('ShowPayment'),'payment').' ';
361  print $langs->trans("Payment");
362  print '</a>';*/
363  print $paymenttmp->getNomUrl(1);
364  }
365  else if ($links[$key]['type']=='company') {
366  $societe=new Societe($db);
367  $societe->fetch($links[$key]['url_id']);
368  print $societe->getNomUrl(1);
369  }
370  else if ($links[$key]['type']=='sc') {
371  print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
372  print img_object($langs->trans('ShowSocialContribution'),'bill').' ';
373  print $langs->trans("SocialContribution").($links[$key]['label']?' - '.$links[$key]['label']:'');
374  print '</a>';
375  }
376  else if ($links[$key]['type']=='payment_sc') {
377  print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
378  print img_object($langs->trans('ShowPayment'),'payment').' ';
379  print $langs->trans("SocialContributionPayment");
380  print '</a>';
381  }
382  else if ($links[$key]['type']=='payment_vat') {
383  print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">';
384  print img_object($langs->trans('ShowVAT'),'payment').' ';
385  print $langs->trans("VATPayment");
386  print '</a>';
387  }
388  else if ($links[$key]['type']=='payment_salary') {
389  print '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$links[$key]['url_id'].'">';
390  print img_object($langs->trans('ShowPaymentSalary'),'payment').' ';
391  print $langs->trans("SalaryPayment");
392  print '</a>';
393  }
394  else if ($links[$key]['type']=='payment_loan') {
395  print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
396  print img_object($langs->trans('ShowLoanPayment'),'payment').' ';
397  print $langs->trans("PaymentLoan");
398  print '</a>';
399  }
400  else if ($links[$key]['type']=='loan') {
401  print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
402  print img_object($langs->trans('ShowLoan'),'bill').' ';
403  print $langs->trans("Loan");
404  print '</a>';
405  }
406  else if ($links[$key]['type']=='member') {
407  print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
408  print img_object($langs->trans('ShowMember'),'user').' ';
409  print $links[$key]['label'];
410  print '</a>';
411  }
412  else if ($links[$key]['type']=='payment_donation') {
413  print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
414  print img_object($langs->trans('ShowDonation'),'payment').' ';
415  print $langs->trans("DonationPayment");
416  print '</a>';
417  }
418  else if ($links[$key]['type']=='banktransfert') {
419  print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
420  print img_object($langs->trans('ShowTransaction'),'payment').' ';
421  print $langs->trans("TransactionOnTheOtherAccount");
422  print '</a>';
423  }
424  else if ($links[$key]['type']=='user') {
425  print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
426  print img_object($langs->trans('ShowUser'),'user').' ';
427  print $langs->trans("User");
428  print '</a>';
429  }
430  else if ($links[$key]['type']=='payment_various') {
431  print '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$links[$key]['url_id'].'">';
432  print img_object($langs->trans('ShowVariousPayment'),'payment').' ';
433  print $langs->trans("VariousPayment");
434  print '</a>';
435  }
436  else {
437  print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
438  print img_object('','generic').' ';
439  print $links[$key]['label'];
440  print '</a>';
441  }
442  }
443  print '</td></tr>';
444  }
445 
446  //$user->rights->banque->modifier=false;
447  //$user->rights->banque->consolidate=true;
448 
449  // Type of payment / Number
450  print "<tr><td>".$langs->trans("Type")." / ".$langs->trans("Numero");
451  print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
452  print "</td>";
453  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
454  {
455  print '<td>';
456  $form->select_types_paiements($objp->fk_type,"value",'',2);
457  print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
458  if ($objp->receiptid)
459  {
460  include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
461  $receipt=new RemiseCheque($db);
462  $receipt->fetch($objp->receiptid);
463  print ' &nbsp; &nbsp; '.$langs->trans("CheckReceipt").': '.$receipt->getNomUrl(2);
464  }
465  print '</td>';
466  }
467  else
468  {
469  print '<td>'.$objp->fk_type.' '.$objp->num_chq.'</td>';
470  }
471  print "</tr>";
472 
473  // Transmitter
474  print "<tr><td>".$langs->trans("CheckTransmitter");
475  print ' <em>('.$langs->trans("ChequeMaker").')</em>';
476  print "</td>";
477  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
478  {
479  print '<td>';
480  print '<input type="text" class="flat minwidth200" name="emetteur" value="'.(empty($objp->emetteur) ? '' : stripslashes($objp->emetteur)).'">';
481  print '</td>';
482  }
483  else
484  {
485  print '<td>'.$objp->emetteur.'</td>';
486  }
487  print "</tr>";
488 
489  // Bank of cheque
490  print "<tr><td>".$langs->trans("Bank");
491  print ' <em>('.$langs->trans("ChequeBank").')</em>';
492  print "</td>";
493  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
494  {
495  print '<td>';
496  print '<input type="text" class="flat minwidth200" name="banque" value="'.(empty($objp->banque) ? '' : $objp->banque).'">';
497  print '</td>';
498  }
499  else
500  {
501  print '<td>'.$objp->banque.'</td>';
502  }
503  print "</tr>";
504 
505  // Date ope
506  print '<tr><td>'.$langs->trans("DateOperation").'</td>';
507  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
508  {
509  print '<td>';
510  print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
511  if (! $objp->rappro)
512  {
513  print ' &nbsp; ';
514  print '<a href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
515  print img_edit_remove() . "</a> ";
516  print '<a href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
517  print img_edit_add() ."</a>";
518  }
519  print '</td>';
520  }
521  else
522  {
523  print '<td>';
524  print dol_print_date($db->jdate($objp->do),"day");
525  print '</td>';
526  }
527  print '</tr>';
528 
529  // Value date
530  print "<tr><td>".$langs->trans("DateValue")."</td>";
531  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
532  {
533  print '<td>';
534  print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
535  if (! $objp->rappro)
536  {
537  print ' &nbsp; ';
538  print '<a href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
539  print img_edit_remove() . "</a> ";
540  print '<a href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
541  print img_edit_add() ."</a>";
542  }
543  print '</td>';
544  }
545  else
546  {
547  print '<td>';
548  print dol_print_date($db->jdate($objp->dv),"day");
549  print '</td>';
550  }
551  print "</tr>";
552 
553  // Description
554  print "<tr><td>".$langs->trans("Label")."</td>";
555  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
556  {
557  print '<td>';
558  print '<input name="label" class="flat minwidth300" '.($objp->rappro?' disabled':'').' value="';
559  if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
560  {
561  // Label generique car entre parentheses. On l'affiche en le traduisant
562  print $langs->trans($reg[1]);
563  }
564  else
565  {
566  print $objp->label;
567  }
568  print '">';
569  print '</td>';
570  }
571  else
572  {
573  print '<td>';
574  if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
575  {
576  // Label generique car entre parentheses. On l'affiche en le traduisant
577  print $langs->trans($reg[1]);
578  }
579  else
580  {
581  print $objp->label;
582  }
583  print '</td>';
584  }
585  print '</tr>';
586 
587  // Amount
588  print "<tr><td>".$langs->trans("Amount")."</td>";
589  if ($user->rights->banque->modifier)
590  {
591  print '<td>';
592  print '<input name="amount" class="flat maxwidth100" '.($objp->rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
593  print '</td>';
594  }
595  else
596  {
597  print '<td>';
598  print price($objp->amount);
599  print '</td>';
600  }
601  print "</tr>";
602 
603  // Categories
604  if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
605  {
606  $langs->load('categories');
607 
608  // Bank line
609  print '<tr><td class="toptd">' . fieldLabel('RubriquesTransactions', 'custcats') . '</td><td>';
610  $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
611  print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
612  print "</td></tr>";
613  }
614 
615  print "</table>";
616 
617  print '</div>';
618 
619  dol_fiche_end();
620 
621 
622  print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
623 
624  print "</form>";
625 
626 
627 
628  // Releve rappro
629  if ($acct->canBeConciliated() > 0) // Si compte rapprochable
630  {
631  print load_fiche_titre($langs->trans("Reconciliation"), '', 'title_bank.png');
632  print '<hr>'."\n";
633 
634  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$objp->rowid.'">';
635  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
636  print '<input type="hidden" name="action" value="setreconcile">';
637  print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
638  print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
639 
640  print '<div class="fichecenter">';
641 
642  print '<table class="border" width="100%">';
643 
644  print '<tr><td class="titlefield">'.$langs->trans("Conciliation")."</td>";
645  if ($user->rights->banque->consolidate)
646  {
647  print '<td>';
648  if ($objp->rappro)
649  {
650  print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled':'').'>';
651  print '<input name="num_rel" type="hidden" value="'.$objp->num_releve.'">';
652  }
653  else
654  {
655  print $langs->trans("AccountStatement").' <input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled':'').'>';
656  }
657  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>';
658  print '</td>';
659  }
660  else
661  {
662  print '<td>'.$objp->num_releve.'&nbsp;</td>';
663  }
664  print '</tr>';
665 
666  print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
667  if ($user->rights->banque->consolidate)
668  {
669  print '<td>';
670  print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked="checked"':''):($objp->rappro?' checked="checked"':'')).'">';
671  print '</td>';
672  }
673  else
674  {
675  print '<td>'.yn($objp->rappro).'</td>';
676  }
677  print '</tr>';
678  print '</table>';
679 
680  print '</div>';
681 
682  print '<div class="center">';
683 
684  print '<input type="submit" class="button" value="'.$langs->trans("Update").'">';
685  if ($backtopage)
686  {
687  print ' &nbsp; ';
688  print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
689  }
690  print '</div>';
691 
692  print '</form>';
693  }
694  }
695 
696  $db->free($result);
697 }
698 else dol_print_error($db);
699 
700 // End of page
701 llxFooter();
702 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Class to manage bank transaction lines.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to manage bank accounts.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage payments of customer invoices.
llxHeader()
Empty header.
Definition: wrapper.php:44
const TYPE_CASH
Cash account.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
img_edit_add($titlealt='default', $other='')
Show logo +.
fieldLabel($langkey, $fieldkey, $fieldrequired=0)
Show a string with the label tag dedicated to the HTML edit field.
Class to manage payments for supplier invoices.
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
Class to manage cheque delivery receipts.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
img_edit_remove($titlealt='default', $other='')
Show logo -.