dolibarr  13.0.2
line.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@open-dsi.fr>
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 <https://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 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
36 
37 // Load translation files required by the page
38 $langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other'));
39 if (!empty($conf->adherent->enabled)) $langs->load("members");
40 if (!empty($conf->don->enabled)) $langs->load("donations");
41 if (!empty($conf->loan->enabled)) $langs->load("loan");
42 if (!empty($conf->salaries->enabled)) $langs->load("salaries");
43 
44 
45 $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
46 $ref = GETPOST('ref', 'alpha');
47 $action = GETPOST('action', 'aZ09');
48 $confirm = GETPOST('confirm', 'alpha');
49 $rowid = GETPOST("rowid", 'int');
50 $orig_account = GETPOST("orig_account");
51 $backtopage = GETPOST('backtopage', 'alpha');
52 $cancel = GETPOST('cancel', 'alpha');
53 
54 // Security check
55 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
56 $fieldtype = (!empty($ref) ? 'ref' : 'rowid');
57 if ($user->socid) $socid = $user->socid;
58 $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
59 if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) accessforbidden();
60 
61 $hookmanager->initHooks(array('bankline'));
62 
63 
64 /*
65  * Actions
66  */
67 $parameters = array('socid' => $socid);
68 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
69 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
70 if ($cancel)
71 {
72  if ($backtopage)
73  {
74  header("Location: ".$backtopage);
75  exit;
76  }
77 }
78 
79 
80 if ($user->rights->banque->consolidate && $action == 'donext')
81 {
82  $al = new AccountLine($db);
83  $al->dateo_next($_GET["rowid"]);
84 } elseif ($user->rights->banque->consolidate && $action == 'doprev')
85 {
86  $al = new AccountLine($db);
87  $al->dateo_previous($_GET["rowid"]);
88 } elseif ($user->rights->banque->consolidate && $action == 'dvnext')
89 {
90  $al = new AccountLine($db);
91  $al->datev_next($_GET["rowid"]);
92 } elseif ($user->rights->banque->consolidate && $action == 'dvprev')
93 {
94  $al = new AccountLine($db);
95  $al->datev_previous($_GET["rowid"]);
96 }
97 
98 if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier)
99 {
100  $cat1 = GETPOST("cat1", 'int');
101  if (!empty($rowid) && !empty($cat1)) {
102  $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$cat1;
103  if (!$db->query($sql))
104  {
105  dol_print_error($db);
106  }
107  } else {
108  setEventMessages($langs->trans("MissingIds"), null, 'errors');
109  }
110 }
111 
112 if ($user->rights->banque->modifier && $action == "update")
113 {
114  $error = 0;
115 
116  $acline = new AccountLine($db);
117  $acline->fetch($rowid);
118 
119  $acsource = new Account($db);
120  $acsource->fetch($id);
121 
122  $actarget = new Account($db);
123  if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) // We ask to change bank account
124  {
125  $actarget->fetch(GETPOST('accountid', 'int'));
126  } else {
127  $actarget->fetch($id);
128  }
129 
130  if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ')
131  {
132  setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
133  $error++;
134  }
135 
136  if (!$error)
137  {
138  $db->begin();
139 
140  $amount = price2num($_POST['amount']);
141  $dateop = dol_mktime(12, 0, 0, $_POST["dateomonth"], $_POST["dateoday"], $_POST["dateoyear"]);
142  $dateval = dol_mktime(12, 0, 0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
143  $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
144  $sql .= " SET ";
145  // Always opened
146  if (GETPOSTISSET('value')) $sql .= " fk_type='".$db->escape(GETPOST('value'))."',";
147  if (GETPOSTISSET('num_chq')) $sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',";
148  if (GETPOSTISSET('banque')) $sql .= " banque='".$db->escape(GETPOST("banque"))."',";
149  if (GETPOSTISSET('emetteur')) $sql .= " emetteur='".$db->escape(GETPOST("emetteur"))."',";
150  // Blocked when conciliated
151  if (!$acline->rappro)
152  {
153  if (GETPOSTISSET('label')) $sql .= " label = '".$db->escape(GETPOST("label"))."',";
154  if (GETPOSTISSET('amount')) $sql .= " amount= '".$db->escape($amount)."',";
155  if (GETPOSTISSET('dateomonth')) $sql .= " dateo = '".$db->idate($dateop)."',";
156  if (GETPOSTISSET('datevmonth')) $sql .= " datev = '".$db->idate($dateval)."',";
157  }
158  $sql .= " fk_account = ".$actarget->id;
159  $sql .= " WHERE rowid = ".$acline->id;
160 
161  $result = $db->query($sql);
162  if (!$result)
163  {
164  $error++;
165  }
166 
167  if (!$error)
168  {
169  $arrayofcategs = GETPOST('custcats', 'array');
170  $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid;
171  if (!$db->query($sql))
172  {
173  $error++;
174  dol_print_error($db);
175  }
176  if (count($arrayofcategs))
177  {
178  foreach ($arrayofcategs as $val)
179  {
180  $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$val.")";
181  if (!$db->query($sql))
182  {
183  $error++;
184  dol_print_error($db);
185  }
186  }
187  // $arrayselected will be loaded after in page output
188  }
189  }
190 
191  if (!$error)
192  {
193  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
194  $db->commit();
195  } else {
196  $db->rollback();
197  dol_print_error($db);
198  }
199  }
200 }
201 
202 // Reconcile
203 if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == 'setreconcile'))
204 {
205  $num_rel = trim($_POST["num_rel"]);
206  $rappro = $_POST['reconciled'] ? 1 : 0;
207 
208  // Check parameters
209  if ($rappro && empty($num_rel))
210  {
211  setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountStatement")), null, 'errors');
212  $error++;
213  }
214 
215  if (!$error)
216  {
217  $db->begin();
218 
219  $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
220  $sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
221  if (empty($num_rel)) $sql .= ", rappro = 0";
222  else $sql .= ", rappro = ".$rappro;
223  $sql .= " WHERE rowid = ".$rowid;
224 
225  dol_syslog("line.php", LOG_DEBUG);
226  $result = $db->query($sql);
227  if ($result)
228  {
229  setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
230  $db->commit();
231  } else {
232  $db->rollback();
233  dol_print_error($db);
234  }
235  }
236 }
237 
238 
239 
240 /*
241  * View
242  */
243 
244 $form = new Form($db);
245 
246 llxHeader('', $langs->trans("BankTransaction"));
247 
248 $c = new Categorie($db);
249 $cats = $c->containing($rowid, Categorie::TYPE_BANK_LINE);
250 foreach ($cats as $cat) {
251  $arrayselected[] = $cat->id;
252 }
253 
254 $head = bankline_prepare_head($rowid);
255 
256 
257 $sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
258 $sql .= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
259 $sql .= " b.emetteur,b.banque";
260 $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
261 $sql .= " WHERE rowid=".$rowid;
262 $sql .= " ORDER BY dateo ASC";
263 $result = $db->query($sql);
264 if ($result)
265 {
266  $i = 0; $total = 0;
267  if ($db->num_rows($result))
268  {
269  $objp = $db->fetch_object($result);
270 
271  $total = $total + $objp->amount;
272 
273  $acct = new Account($db);
274  $acct->fetch($objp->fk_account);
275  $account = $acct->id;
276 
277  $bankline = new AccountLine($db);
278  $bankline->fetch($rowid, $ref);
279 
280  $links = $acct->get_url($rowid);
281  $bankline->load_previous_next_ref('', 'rowid');
282 
283  // Confirmations
284  if ($action == 'delete_categ')
285  {
286  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);
287  }
288 
289  print '<form name="update" method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'">';
290  print '<input type="hidden" name="token" value="'.newToken().'">';
291  print '<input type="hidden" name="action" value="update">';
292  print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
293  print '<input type="hidden" name="id" value="'.$acct->id.'">';
294 
295  print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
296 
297  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
298 
299 
300  dol_banner_tab($bankline, 'rowid', $linkback);
301 
302  print '<div class="fichecenter2">';
303 
304  print '<div class="underbanner clearboth"></div>';
305  print '<table class="border centpercent tableforfield">';
306 
307  $i++;
308 
309  // Bank account
310  print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
311  print '<td>';
312  if (!$objp->rappro && !$bankline->getVentilExportCompta())
313  {
314  print img_picto('', 'bank_account', 'class="paddingright"');
315  print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1);
316  } else {
317  print $acct->getNomUrl(1, 'transactions', 'reflabel');
318  }
319  print '</td>';
320  print '</tr>';
321 
322  // Show links of bank transactions
323  if (count($links))
324  {
325  print '<tr><td class="tdtop">'.$langs->trans("Links").'</td>';
326  print '<td>';
327  foreach ($links as $key=>$val)
328  {
329  if ($key) print '<br>';
330  if ($links[$key]['type'] == 'payment') {
331  require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
332  $paymenttmp = new Paiement($db);
333  $paymenttmp->fetch($links[$key]['url_id']);
334  $paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
335  /*print '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$links[$key]['url_id'].'">';
336  print img_object($langs->trans('Payment'),'payment').' ';
337  print $langs->trans("Payment");
338  print '</a>';*/
339  print $paymenttmp->getNomUrl(1);
340  } elseif ($links[$key]['type'] == 'payment_supplier') {
341  require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
342  $paymenttmp = new PaiementFourn($db);
343  $paymenttmp->fetch($links[$key]['url_id']);
344  $paymenttmp->ref = $langs->trans("Payment").' '.$paymenttmp->ref;
345  /*print '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$links[$key]['url_id'].'">';
346  print img_object($langs->trans('Payment'),'payment').' ';
347  print $langs->trans("Payment");
348  print '</a>';*/
349  print $paymenttmp->getNomUrl(1);
350  } elseif ($links[$key]['type'] == 'company') {
351  $societe = new Societe($db);
352  $societe->fetch($links[$key]['url_id']);
353  print $societe->getNomUrl(1);
354  } elseif ($links[$key]['type'] == 'sc') {
355  print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
356  print img_object($langs->trans('SocialContribution'), 'bill').' ';
357  print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : '');
358  print '</a>';
359  } elseif ($links[$key]['type'] == 'payment_sc') {
360  print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$links[$key]['url_id'].'">';
361  print img_object($langs->trans('Payment'), 'payment').' ';
362  print $langs->trans("SocialContributionPayment");
363  print '</a>';
364  } elseif ($links[$key]['type'] == 'payment_vat') {
365  print '<a href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$links[$key]['url_id'].'">';
366  print img_object($langs->trans('VAT'), 'payment').' ';
367  print $langs->trans("VATPayment");
368  print '</a>';
369  } elseif ($links[$key]['type'] == 'payment_salary') {
370  print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
371  print img_object($langs->trans('PaymentSalary'), 'payment').' ';
372  print $langs->trans("SalaryPayment");
373  print '</a>';
374  } elseif ($links[$key]['type'] == 'payment_loan') {
375  print '<a href="'.DOL_URL_ROOT.'/loan/payment/card.php?id='.$links[$key]['url_id'].'">';
376  print img_object($langs->trans('LoanPayment'), 'payment').' ';
377  print $langs->trans("PaymentLoan");
378  print '</a>';
379  } elseif ($links[$key]['type'] == 'loan') {
380  print '<a href="'.DOL_URL_ROOT.'/loan/card.php?id='.$links[$key]['url_id'].'">';
381  print img_object($langs->trans('Loan'), 'bill').' ';
382  print $langs->trans("Loan");
383  print '</a>';
384  } elseif ($links[$key]['type'] == 'member') {
385  print '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$links[$key]['url_id'].'">';
386  print img_object($langs->trans('Member'), 'user').' ';
387  print $links[$key]['label'];
388  print '</a>';
389  } elseif ($links[$key]['type'] == 'payment_donation') {
390  print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$links[$key]['url_id'].'">';
391  print img_object($langs->trans('Donation'), 'payment').' ';
392  print $langs->trans("DonationPayment");
393  print '</a>';
394  } elseif ($links[$key]['type'] == 'banktransfert') {
395  print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$links[$key]['url_id'].'">';
396  print img_object($langs->trans('Transaction'), 'payment').' ';
397  print $langs->trans("TransactionOnTheOtherAccount");
398  print '</a>';
399  } elseif ($links[$key]['type'] == 'user') {
400  print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$links[$key]['url_id'].'">';
401  print img_object($langs->trans('User'), 'user').' ';
402  print $langs->trans("User");
403  print '</a>';
404  } elseif ($links[$key]['type'] == 'payment_various') {
405  print '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$links[$key]['url_id'].'">';
406  print img_object($langs->trans('VariousPayment'), 'payment').' ';
407  print $langs->trans("VariousPayment");
408  print '</a>';
409  } else {
410  print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
411  print img_object('', 'generic').' ';
412  print $links[$key]['label'];
413  print '</a>';
414  }
415  }
416  print '</td></tr>';
417  }
418 
419  //$user->rights->banque->modifier=false;
420  //$user->rights->banque->consolidate=true;
421 
422  // Type of payment / Number
423  print "<tr><td>".$langs->trans("Type")." / ".$langs->trans("Numero");
424  print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
425  print "</td>";
426  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
427  {
428  print '<td>';
429  $form->select_types_paiements($objp->fk_type, "value", '', 2);
430  print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
431  if ($objp->receiptid)
432  {
433  include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
434  $receipt = new RemiseCheque($db);
435  $receipt->fetch($objp->receiptid);
436  print ' &nbsp; &nbsp; '.$langs->trans("CheckReceipt").': '.$receipt->getNomUrl(2);
437  }
438  print '</td>';
439  } else {
440  print '<td>'.$objp->fk_type.' '.$objp->num_chq.'</td>';
441  }
442  print "</tr>";
443 
444  // Transmitter
445  print "<tr><td>".$langs->trans("CheckTransmitter");
446  print ' <em>('.$langs->trans("ChequeMaker").')</em>';
447  print "</td>";
448  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
449  {
450  print '<td>';
451  print '<input type="text" class="flat minwidth200" name="emetteur" value="'.(empty($objp->emetteur) ? '' : stripslashes($objp->emetteur)).'">';
452  print '</td>';
453  } else {
454  print '<td>'.$objp->emetteur.'</td>';
455  }
456  print "</tr>";
457 
458  // Bank of cheque
459  print "<tr><td>".$langs->trans("Bank");
460  print ' <em>('.$langs->trans("ChequeBank").')</em>';
461  print "</td>";
462  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
463  {
464  print '<td>';
465  print '<input type="text" class="flat minwidth200" name="banque" value="'.(empty($objp->banque) ? '' : $objp->banque).'">';
466  print '</td>';
467  } else {
468  print '<td>'.$objp->banque.'</td>';
469  }
470  print "</tr>";
471 
472  // Date ope
473  print '<tr><td>'.$langs->trans("DateOperation").'</td>';
474  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
475  {
476  print '<td>';
477  print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
478  if (!$objp->rappro)
479  {
480  print ' &nbsp; ';
481  print '<a href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
482  print img_edit_remove()."</a> ";
483  print '<a href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
484  print img_edit_add()."</a>";
485  }
486  print '</td>';
487  } else {
488  print '<td>';
489  print dol_print_date($db->jdate($objp->do), "day");
490  print '</td>';
491  }
492  print '</tr>';
493 
494  // Value date
495  print "<tr><td>".$langs->trans("DateValue")."</td>";
496  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
497  {
498  print '<td>';
499  print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
500  if (!$objp->rappro)
501  {
502  print ' &nbsp; ';
503  print '<a href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
504  print img_edit_remove()."</a> ";
505  print '<a href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
506  print img_edit_add()."</a>";
507  }
508  print '</td>';
509  } else {
510  print '<td>';
511  print dol_print_date($db->jdate($objp->dv), "day");
512  print '</td>';
513  }
514  print "</tr>";
515 
516  // Description
517  print "<tr><td>".$langs->trans("Label")."</td>";
518  if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
519  {
520  print '<td>';
521  print '<input name="label" class="flat minwidth300" '.($objp->rappro ? ' disabled' : '').' value="';
522  if (preg_match('/^\((.*)\)$/i', $objp->label, $reg))
523  {
524  // Label generique car entre parentheses. On l'affiche en le traduisant
525  print $langs->trans($reg[1]);
526  } else {
527  print $objp->label;
528  }
529  print '">';
530  print '</td>';
531  } else {
532  print '<td>';
533  if (preg_match('/^\((.*)\)$/i', $objp->label, $reg))
534  {
535  // Label generique car entre parentheses. On l'affiche en le traduisant
536  print $langs->trans($reg[1]);
537  } else {
538  print $objp->label;
539  }
540  print '</td>';
541  }
542  print '</tr>';
543 
544  // Amount
545  print "<tr><td>".$langs->trans("Amount")."</td>";
546  if ($user->rights->banque->modifier)
547  {
548  print '<td>';
549  print '<input name="amount" class="flat maxwidth100" '.($objp->rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
550  print '</td>';
551  } else {
552  print '<td>';
553  print price($objp->amount);
554  print '</td>';
555  }
556  print "</tr>";
557 
558  // Categories
559  if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire))
560  {
561  $langs->load('categories');
562 
563  // Bank line
564  print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>';
565  $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
566  print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
567  print "</td></tr>";
568  }
569 
570  print "</table>";
571 
572  print '</div>';
573 
575 
576 
577  print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
578 
579  print "</form>";
580 
581 
582 
583  // Releve rappro
584  if ($acct->canBeConciliated() > 0) // Si compte rapprochable
585  {
586  print load_fiche_titre($langs->trans("Reconciliation"), '', 'bank_account');
587  print '<hr>'."\n";
588 
589  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$objp->rowid.'">';
590  print '<input type="hidden" name="token" value="'.newToken().'">';
591  print '<input type="hidden" name="action" value="setreconcile">';
592  print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
593  print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
594 
595  print '<div class="fichecenter">';
596 
597  print '<table class="border centpercent">';
598 
599  print '<tr><td class="titlefield">'.$langs->trans("Conciliation")."</td>";
600  if ($user->rights->banque->consolidate)
601  {
602  print '<td>';
603  if ($objp->rappro)
604  {
605  print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
606  print '<input name="num_rel" type="hidden" value="'.$objp->num_releve.'">';
607  } else {
608  print $langs->trans("AccountStatement").' <input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
609  }
610  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>';
611  print '</td>';
612  } else {
613  print '<td>'.$objp->num_releve.'&nbsp;</td>';
614  }
615  print '</tr>';
616 
617  print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
618  if ($user->rights->banque->consolidate)
619  {
620  print '<td>';
621  print '<input type="checkbox" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
622  print '</td>';
623  } else {
624  print '<td>'.yn($objp->rappro).'</td>';
625  }
626  print '</tr>';
627  print '</table>';
628 
629  print '</div>';
630 
631  print '<div class="center">';
632 
633  print '<input type="submit" class="button" value="'.$langs->trans("Update").'">';
634  if ($backtopage)
635  {
636  print ' &nbsp; ';
637  print '<input type="submit" name="cancel" class="button button-cancel" value="'.$langs->trans("Cancel").'">';
638  }
639  print '</div>';
640 
641  print '</form>';
642  }
643  }
644 
645  $db->free($result);
646 } else dol_print_error($db);
647 
648 // End of page
649 llxFooter();
650 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Class to manage bank transaction lines.
Class to manage bank accounts.
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...
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage payments of customer invoices.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
const TYPE_CASH
Cash account.
print $_SERVER["PHP_SELF"]
Edit parameters.
img_edit_add($titlealt= 'default', $other= '')
Show logo +.
img_edit_remove($titlealt= 'default', $other= '')
Show logo -.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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 payments for supplier invoices.
llxFooter()
Empty footer.
Definition: wrapper.php:59
Class to manage cheque delivery receipts.