32 |
require("./pre.inc.php"); |
require("./pre.inc.php"); |
33 |
|
|
34 |
if (!$user->rights->banque->lire) |
if (!$user->rights->banque->lire) |
35 |
accessforbidden(); |
accessforbidden(); |
36 |
|
|
37 |
|
|
38 |
$account=isset($_GET["account"])?$_GET["account"]:$_POST["account"]; |
$account=isset($_GET["account"])?$_GET["account"]:$_POST["account"]; |
41 |
$page=isset($_GET["page"])?$_GET["page"]:0; |
$page=isset($_GET["page"])?$_GET["page"]:0; |
42 |
|
|
43 |
if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"])) |
if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"])) |
44 |
{ |
{ |
45 |
|
if ($_POST["credit"] > 0) |
|
if ($_POST["credit"] > 0) |
|
46 |
{ |
{ |
47 |
$amount = $_POST["credit"]; |
$amount = $_POST["credit"]; |
48 |
} |
} |
49 |
else |
else |
50 |
{ |
{ |
51 |
$amount = - $_POST["debit"]; |
$amount = - $_POST["debit"]; |
52 |
} |
} |
|
|
|
|
$dateop = $_POST["dateoy"].$_POST["dateo"]; |
|
|
$operation=$_POST["operation"]; |
|
|
$label=$_POST["label"]; |
|
|
$operation=$_POST["operation"]; |
|
|
$num_chq=$_POST["num_chq"]; |
|
|
$cat1=$_POST["cat1"]; |
|
53 |
|
|
54 |
$acct=new Account($db,$account); |
$dateop = $_POST["dateoy"].$_POST["dateo"]; |
55 |
|
$operation=$_POST["operation"]; |
56 |
|
$label=$_POST["label"]; |
57 |
|
$operation=$_POST["operation"]; |
58 |
|
$num_chq=$_POST["num_chq"]; |
59 |
|
$cat1=$_POST["cat1"]; |
60 |
|
|
61 |
|
$acct=new Account($db,$account); |
62 |
|
|
63 |
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1); |
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1); |
64 |
|
|
65 |
if ($insertid) |
if ($insertid) |
66 |
{ |
{ |
67 |
Header("Location: account.php?account=" . $account); |
Header("Location: account.php?account=" . $account); |
68 |
} |
} |
69 |
else |
else |
70 |
{ |
{ |
71 |
dolibarr_print_error($db); |
dolibarr_print_error($db); |
72 |
} |
} |
73 |
} |
} |
74 |
if ($_GET["action"] == 'del' && $account && $user->rights->banque->modifier) |
if ($_GET["action"] == 'del' && $account && $user->rights->banque->modifier) |
75 |
{ |
{ |
76 |
$acct=new Account($db,$account); |
$acct=new Account($db,$account); |
77 |
$acct->deleteline($_GET["rowid"]); |
$acct->deleteline($_GET["rowid"]); |
78 |
} |
} |
79 |
|
|
80 |
|
|
|
/*********************************************************************************** |
|
|
* |
|
|
* |
|
|
*/ |
|
81 |
|
|
82 |
llxHeader(); |
llxHeader(); |
83 |
|
|
|
|
|
84 |
if ($account > 0) |
if ($account > 0) |
85 |
{ |
{ |
86 |
if ($vline) |
if ($vline) |
171 |
$limitsql = $nbline; |
$limitsql = $nbline; |
172 |
} |
} |
173 |
|
|
174 |
/* |
/** |
175 |
* Formulaire de recherche |
* Formulaire de recherche |
176 |
* |
* |
177 |
*/ |
*/ |
178 |
$mesg=''; |
$mesg=''; |
179 |
|
|
180 |
$nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total |
$nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total |
181 |
if ($limitsql > $viewline) |
if ($limitsql > $viewline) |
182 |
{ |
{ |
183 |
$mesg.='<a href="account.php?account='.$acct->id.'&page='.($page+1).'">'.img_previous().'</a>'; |
$mesg.='<a href="account.php?account='.$acct->id.'&page='.($page+1).'">'.img_previous().'</a>'; |
184 |
} |
} |
185 |
$mesg.= ' Page '.($nbpage-$page).'/'.$nbpage.' '; |
$mesg.= ' Page '.($nbpage-$page).'/'.$nbpage.' '; |
186 |
if ($total_lines > $limitsql ) |
if ($total_lines > $limitsql ) |
187 |
{ |
{ |
188 |
$mesg.= '<a href="account.php?account='.$acct->id.'&page='.($page-1).'">'.img_next().'</a>'; |
$mesg.= '<a href="account.php?account='.$acct->id.'&page='.($page-1).'">'.img_next().'</a>'; |
189 |
} |
} |
190 |
|
|
191 |
|
|
243 |
print "<tr class=\"noborder\"><td colspan=\"8\"> </td></tr>\n"; |
print "<tr class=\"noborder\"><td colspan=\"8\"> </td></tr>\n"; |
244 |
} |
} |
245 |
|
|
246 |
// Ligne de titre |
// Ligne de titre tableau des acritures |
247 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
248 |
print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Value").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Description").'</td>'; |
print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Value").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Description").'</td>'; |
249 |
print '<td align="right">'.$langs->trans("Debit").'</td><td align="right">'.$langs->trans("Credit").'</td>'; |
print '<td align="right">'.$langs->trans("Debit").'</td><td align="right">'.$langs->trans("Credit").'</td>'; |
273 |
*/ |
*/ |
274 |
|
|
275 |
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; |
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; |
276 |
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b "; |
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; |
277 |
$sql .= " WHERE fk_account=".$acct->id; |
$sql.= " WHERE fk_account=".$acct->id; |
278 |
|
if ($req_debit) $sql .= " AND b.amount = -".$req_debit; |
279 |
if ($req_debit) |
if ($req_credit) $sql .= " AND b.amount = ".$req_credit; |
280 |
{ |
$sql.= $sql_rech; |
|
$sql .= " AND b.amount = -".$req_debit; |
|
|
} |
|
|
|
|
|
$sql .= $sql_rech; |
|
|
|
|
281 |
if ($vue) |
if ($vue) |
282 |
{ |
{ |
283 |
if ($vue == 'credit') |
if ($vue == 'credit') |
289 |
$sql .= " AND b.amount < 0 "; |
$sql .= " AND b.amount < 0 "; |
290 |
} |
} |
291 |
} |
} |
292 |
|
$sql.= " ORDER BY b.datev ASC"; |
293 |
$sql .= " ORDER BY b.datev ASC"; |
$sql.= $db->plimit($limitsql, 0); |
|
$sql .= $db->plimit($limitsql, 0); |
|
294 |
|
|
295 |
$result = $db->query($sql); |
$result = $db->query($sql); |
296 |
if ($result) |
if ($result) |
393 |
{ |
{ |
394 |
print ' - '; |
print ' - '; |
395 |
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; |
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; |
396 |
// if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; } |
if ($links[$key]['type']=='payment') { |
397 |
// if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; } |
//print img_object($langs->trans('ShowPayment'),'payment').' '; |
398 |
print $links[$key]['label'].'</a>'; |
print $langs->trans("Payment"); |
399 |
|
} |
400 |
|
else if ($links[$key]['type']=='company') { |
401 |
|
//print img_object($langs->trans('ShowCustomer'),'company').' '; |
402 |
|
print $links[$key]['label']; |
403 |
|
} |
404 |
|
else print $links[$key]['label']; |
405 |
|
print '</a>'; |
406 |
} |
} |
407 |
print '</td>'; |
print '</td>'; |
408 |
|
|