Look: Modifications esthétiques mineures
This commit is contained in:
parent
0dee88b364
commit
7cae46ecfb
@ -21,18 +21,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/bank/rappro.php
|
\file htdocs/compta/bank/rappro.php
|
||||||
\ingroup banque
|
\ingroup banque
|
||||||
\brief Page de rapprochement bancaire
|
\brief Page de rapprochement bancaire
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
$langs->load("banks");
|
||||||
|
|
||||||
$user->getrights('compta');
|
$user->getrights('compta');
|
||||||
|
|
||||||
if (! $user->rights->banque->modifier)
|
if (! $user->rights->banque->modifier) accessforbidden();
|
||||||
accessforbidden();
|
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -43,217 +44,225 @@ llxHeader();
|
|||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'rappro')
|
if ($_POST["action"] == 'rappro')
|
||||||
{
|
{
|
||||||
if ($_POST["num_releve"] > 0) {
|
if ($_POST["num_releve"] > 0) {
|
||||||
|
|
||||||
$valrappro=1;
|
$valrappro=1;
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank set rappro=$valrappro, num_releve=".$_POST["num_releve"];
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank set rappro=$valrappro, num_releve=".$_POST["num_releve"];
|
||||||
if ($_POST["rappro"]) {
|
if ($_POST["rappro"]) {
|
||||||
# Si on fait un rapprochement, le user de rapprochement est inclus dans l'update
|
# Si on fait un rapprochement, le user de rapprochement est inclus dans l'update
|
||||||
$sql .= ", fk_user_rappro=".$user->id;
|
$sql .= ", fk_user_rappro=".$user->id;
|
||||||
|
}
|
||||||
|
$sql .= " WHERE rowid=".$_POST["rowid"];
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
if ($cat1 && $_POST["action"]) {
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$msg="Erreur: Saisissez le relevé qui référence la transaction pour la rapprocher.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$sql .= " WHERE rowid=".$_POST["rowid"];
|
|
||||||
|
/*
|
||||||
|
* Action suppression ecriture
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == 'del') {
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"];
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if (! $result) {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$options="";
|
||||||
|
if ($result) {
|
||||||
|
$var=True;
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num) {
|
||||||
|
if ($options == "") { $options = "<option value=\"0\" selected> </option>"; }
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
|
||||||
|
}
|
||||||
|
$db->free($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affichage liste des transactions à rapprocher
|
||||||
|
*/
|
||||||
|
$acct = new Account($db);
|
||||||
|
$acct->fetch($_GET["account"]);
|
||||||
|
|
||||||
|
$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 as type";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b WHERE rappro=0 AND fk_account=".$_GET["account"];
|
||||||
|
$sql .= " ORDER BY dateo";
|
||||||
|
$sql .= " ASC LIMIT ".$conf->liste_limit;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
if ($result) {
|
|
||||||
if ($cat1 && $_POST["action"]) {
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)";
|
|
||||||
$result = $db->query($sql);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msg="Erreur: Saisissez le relevé qui référence la transaction pour la rapprocher.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action suppression ecriture
|
|
||||||
*/
|
|
||||||
if ($_GET["action"] == 'del') {
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"];
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if (!$result) {
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
|
|
||||||
$result = $db->query($sql);
|
|
||||||
$options="";
|
|
||||||
if ($result) {
|
|
||||||
$var=True;
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $num) {
|
|
||||||
if ($options == "") { $options = "<option value=\"0\" selected> </option>"; }
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
|
|
||||||
}
|
|
||||||
$db->free($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Affichage liste des transactions à rapprocher
|
|
||||||
*/
|
|
||||||
$acct = new Account($db);
|
|
||||||
$acct->fetch($_GET["account"]);
|
|
||||||
|
|
||||||
$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 as type";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b WHERE rappro=0 AND fk_account=".$_GET["account"];
|
|
||||||
$sql .= " ORDER BY dateo";
|
|
||||||
$sql .= " ASC LIMIT ".$conf->liste_limit;
|
|
||||||
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$var=True;
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
|
|
||||||
if ($num == 0) {
|
|
||||||
header("Location: /compta/bank/account.php?account=".$_GET["account"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
print_titre('Rapprochement compte bancaire : <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
if ($msg) {
|
|
||||||
print "$msg<br><br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Affiche nom des derniers relevés
|
|
||||||
$nbmax=5;
|
|
||||||
$liste="";
|
|
||||||
|
|
||||||
$sql = "SELECT distinct num_releve FROM ".MAIN_DB_PREFIX."bank";
|
|
||||||
$sql.= " WHERE fk_account=".$_GET["account"];
|
|
||||||
$sql.= " ORDER BY num_releve DESC";
|
|
||||||
$sql.= " LIMIT ".($nbmax+1);
|
|
||||||
print $langs->trans("LastAccountStatements").' : ';
|
|
||||||
$resultr=$db->query($sql);
|
|
||||||
if ($resultr)
|
|
||||||
{
|
{
|
||||||
$numr=$db->num_rows($resultr);
|
$var=True;
|
||||||
$i=0;
|
$num = $db->num_rows($result);
|
||||||
while (($i < $numr) && ($i < $nbmax))
|
|
||||||
{
|
if ($num == 0) {
|
||||||
$objr = $db->fetch_object($resultr);
|
header("Location: /compta/bank/account.php?account=".$_GET["account"]);
|
||||||
$last_releve = $objr->num_releve;
|
exit;
|
||||||
$i++;
|
|
||||||
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
|
||||||
}
|
}
|
||||||
if ($num >= $nbmax) $liste="... ".$liste;
|
else {
|
||||||
print "$liste";
|
|
||||||
if ($num > 0) print '<br><br>';
|
|
||||||
else print $langs->trans("None").'<br><br>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print_titre('Rapprochement compte bancaire : <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
||||||
print "<tr class=\"liste_titre\">";
|
print '<br>';
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
|
||||||
print '<td>'.$langs->trans("DateValue").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Type").'</td>';
|
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
|
||||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
|
||||||
print '<td align="center" width="100">'.$langs->trans("AccountStatement").'<br>(Ex: YYYYMM)</td>';
|
|
||||||
print '<td align="center" width="100" colspan="2">'.$langs->trans("Action").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$i = 0;
|
if ($msg) {
|
||||||
while ($i < $num)
|
print "$msg<br><br>";
|
||||||
{
|
}
|
||||||
$objp = $db->fetch_object($result);
|
|
||||||
|
|
||||||
$var=!$var;
|
// Affiche nom des derniers relevés
|
||||||
print "<tr $bc[$var]>";
|
$nbmax=5;
|
||||||
print '<form method="post" action="rappro.php?account='.$_GET["account"].'">';
|
$liste="";
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"rappro\">";
|
|
||||||
print "<input type=\"hidden\" name=\"account\" value=\"".$_GET["account"]."\">";
|
|
||||||
print "<input type=\"hidden\" name=\"rowid\" value=\"".$objp->rowid."\">";
|
|
||||||
|
|
||||||
print '<td>'.dolibarr_print_date($objp->do).'</td>';
|
|
||||||
print '<td>'.dolibarr_print_date($objp->dv).'</td>';
|
|
||||||
print '<td>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
|
||||||
print '<td>'.$objp->label.'</td>';
|
|
||||||
|
|
||||||
if ($objp->amount < 0)
|
$sql = "SELECT distinct num_releve FROM ".MAIN_DB_PREFIX."bank";
|
||||||
{
|
$sql.= " WHERE fk_account=".$_GET["account"];
|
||||||
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
$sql.= " ORDER BY num_releve DESC";
|
||||||
}
|
$sql.= " LIMIT ".($nbmax+1);
|
||||||
else
|
print $langs->trans("LastAccountStatements").' : ';
|
||||||
{
|
$resultr=$db->query($sql);
|
||||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
if ($resultr)
|
||||||
}
|
{
|
||||||
|
$numr=$db->num_rows($resultr);
|
||||||
if ($objp->do <= mktime() ) {
|
$i=0;
|
||||||
print "<td align=\"center\">";
|
while (($i < $numr) && ($i < $nbmax))
|
||||||
print "<input class=\"flat\" name=\"num_releve\" type=\"text\" value=\"\" size=\"8\">";
|
{
|
||||||
if ($options) {
|
$objr = $db->fetch_object($resultr);
|
||||||
print "<br><select name=\"cat1\">$options";
|
$last_releve = $objr->num_releve;
|
||||||
print "</select>";
|
$i++;
|
||||||
}
|
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
||||||
print "</td>";
|
}
|
||||||
print "<td align=\"center\"><input class=\"button\" type=\"submit\" value=\"".$langs->trans("Rapprocher")."\">";
|
if ($num >= $nbmax) $liste="... ".$liste;
|
||||||
print "</td>";
|
print "$liste";
|
||||||
}
|
if ($num > 0) print '<br><br>';
|
||||||
else {
|
else print $langs->trans("None").'<br><br>';
|
||||||
print "<td align=\"left\" colspan=\"2\">";
|
}
|
||||||
print "Ecriture future. Ne peut pas encore être rapprochée.";
|
else
|
||||||
print "</td>";
|
{
|
||||||
}
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
if ($objp->rappro)
|
|
||||||
{
|
|
||||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($user->rights->banque->modifier)
|
|
||||||
{
|
|
||||||
print '<td align="center" width="30">';
|
|
||||||
if ($objp->do <= mktime() ) {
|
|
||||||
print "<a href=\"rappro.php?action=del&rowid=$objp->rowid&account=$acct->id\">";
|
|
||||||
print img_delete();
|
|
||||||
print "</a>";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print " "; // On n'empeche la suppression car le raprochement ne pourra se faire qu'après la date passée et que l'écriture apparaissent bien sur le compte.
|
|
||||||
}
|
|
||||||
print "</td>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<td align=\"center\"> </td>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>";
|
print '<table class="noborder" width="100%">';
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
|
print '<td>'.$langs->trans("DateValue").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Type").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||||
|
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||||
|
print '<td align="center" width="60">'.$langs->trans("Action").'</td>';
|
||||||
|
print '<td align="center" width="100" colspan="2">'.$langs->trans("AccountStatement").' (Ex: YYYYMM)</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
print "</form>";
|
$i = 0;
|
||||||
$i++;
|
while ($i < $num)
|
||||||
}
|
{
|
||||||
$db->free();
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
if ($num != 0) {
|
$var=!$var;
|
||||||
print "</table>";
|
print "<tr $bc[$var]>";
|
||||||
}
|
print '<form method="post" action="rappro.php?account='.$_GET["account"].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"rappro\">";
|
||||||
|
print "<input type=\"hidden\" name=\"account\" value=\"".$_GET["account"]."\">";
|
||||||
|
print "<input type=\"hidden\" name=\"rowid\" value=\"".$objp->rowid."\">";
|
||||||
|
|
||||||
} else {
|
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
||||||
dolibarr_print_error($db);
|
print '<td nowrap>'.dolibarr_print_date($objp->dv).'</td>';
|
||||||
}
|
print '<td nowrap>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
||||||
|
print '<td>'.$objp->label.'</td>';
|
||||||
|
|
||||||
$db->close();
|
if ($objp->amount < 0)
|
||||||
|
{
|
||||||
|
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
||||||
|
}
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
if ($objp->rappro)
|
||||||
?>
|
{
|
||||||
|
// Si ligne déjà rapprochée, on affiche relevé.
|
||||||
|
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Si pas encore rapproché
|
||||||
|
if ($user->rights->banque->modifier)
|
||||||
|
{
|
||||||
|
print '<td align="center" width="30">';
|
||||||
|
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||||
|
print img_edit();
|
||||||
|
print '</a> ';
|
||||||
|
|
||||||
|
if ($objp->do <= mktime() ) {
|
||||||
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?action=del&rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||||
|
print img_delete();
|
||||||
|
print "</a>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print " "; // On n'empeche la suppression car le raprochement ne pourra se faire qu'après la date passée et que l'écriture apparaissent bien sur le compte.
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<td align=\"center\"> </td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Affiche bouton "Rapprocher"
|
||||||
|
if ($objp->do <= mktime() ) {
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
print "<input class=\"flat\" name=\"num_releve\" type=\"text\" value=\"\" size=\"8\">";
|
||||||
|
if ($options) {
|
||||||
|
print "<br><select name=\"cat1\">$options";
|
||||||
|
print "</select>";
|
||||||
|
}
|
||||||
|
print "</td>";
|
||||||
|
print "<td align=\"center\"><input class=\"button\" type=\"submit\" value=\"".$langs->trans("Rapprocher")."\">";
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "<td align=\"left\" colspan=\"2\">";
|
||||||
|
print "Ecriture future. Ne peut pas encore être rapprochée.";
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
print "</form>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free();
|
||||||
|
|
||||||
|
if ($num != 0) {
|
||||||
|
print "</table>";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user