Affiche liens de criture sur page des rappro et sur page de detail d'une ecriture
This commit is contained in:
parent
bc797e3157
commit
fe87b759da
@ -121,25 +121,37 @@ class Account
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/**
|
||||
* \brief Renvoi tableau des liens
|
||||
* \param line_id Id ligne écriture
|
||||
* \retuen array Tableau des liens
|
||||
*/
|
||||
function get_url($line_id)
|
||||
{
|
||||
$lines = array();
|
||||
$sql = "SELECT fk_bank, url_id, url, label FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank = $line_id";
|
||||
$sql = "SELECT url_id, url, label, type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_url";
|
||||
$sql.= " WHERE fk_bank = ".$line_id;
|
||||
$sql.= " ORDER BY type, label";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows();
|
||||
$num = $this->db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
// Anciens liens (pour compatibilité)
|
||||
$lines[$i][0] = $obj->url;
|
||||
$lines[$i][1] = $obj->url_id;
|
||||
$lines[$i][2] = $obj->label;
|
||||
$lines[$i][3] = $obj->type;
|
||||
// Nouveaux liens
|
||||
$lines[$i]['url'] = $obj->url;
|
||||
$lines[$i]['url_id'] = $obj->url_id;
|
||||
$lines[$i]['label'] = $obj->label;
|
||||
$lines[$i]['type'] = $obj->type;
|
||||
$i++;
|
||||
}
|
||||
return $lines;
|
||||
|
||||
@ -365,7 +365,7 @@ llxFooter('$Date$ - $Revision$');
|
||||
*/
|
||||
function _print_lines($db,$result,$sql,$acct)
|
||||
{
|
||||
global $bc, $nbline, $viewline, $user, $page;
|
||||
global $langs, $bc, $nbline, $viewline, $user, $page;
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
@ -395,18 +395,19 @@ function _print_lines($db,$result,$sql,$acct)
|
||||
print "<td nowrap>".dolibarr_print_date($objp->do,"%d/%m/%y")."</td>\n";
|
||||
print "<td nowrap> ".dolibarr_print_date($objp->dv,"%d/%m/%y")."</td>\n";
|
||||
print "<td nowrap> ".$objp->fk_type." ".($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$acct->id\">$objp->label</a>";
|
||||
print '<td><a href="ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">'.$objp->label.'</a>';
|
||||
|
||||
/*
|
||||
* Ajout les liens
|
||||
*/
|
||||
$urls_line = $acct->get_url($objp->rowid);
|
||||
$numurl = sizeof($urls_line);
|
||||
$k = 0;
|
||||
while ($k < $numurl)
|
||||
$links = $acct->get_url($objp->rowid);
|
||||
foreach($links as $key=>$val)
|
||||
{
|
||||
print ' <a href="'.$urls_line[$k][0].$urls_line[$k][1].'">'.$urls_line[$k][2].'</a>';
|
||||
$k++;
|
||||
print ' - ';
|
||||
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||
// if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; }
|
||||
// if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; }
|
||||
print $links[$key]['label'].'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -129,8 +129,21 @@ if ($_POST["action"] == 'type')
|
||||
|
||||
if ($_POST["action"] == 'num_releve')
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank set num_releve=".$_POST["num_rel"]." WHERE rowid = $rowid;";
|
||||
$result = $db->query($sql);
|
||||
$db->begin();
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " SET num_releve='".$_POST["num_rel"]."'";
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -198,6 +211,8 @@ if ($result)
|
||||
$acct->fetch($objp->fk_account);
|
||||
$account = $acct->id;
|
||||
|
||||
$links=$acct->get_url($rowid);
|
||||
|
||||
// Tableau sur 4 colonne si déja rapproché, sinon sur 5 colonnes
|
||||
|
||||
// Author
|
||||
@ -211,7 +226,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="3"> </td>';
|
||||
print '<td colspan="4"> </td>';
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
@ -246,7 +261,10 @@ if ($result)
|
||||
else
|
||||
{
|
||||
*/
|
||||
print '<td colspan="4"><a href="account.php?account='.$acct->id."\">".$acct->label."</a></td>";
|
||||
print '<td colspan="4">';
|
||||
print '<a href="account.php?account='.$acct->id.'">'.$acct->label.'</a>';
|
||||
print '<input type="hidden" name="accountid" value="'.$acct->id.'">';
|
||||
print '</td>';
|
||||
/*
|
||||
}
|
||||
*/
|
||||
@ -254,23 +272,24 @@ if ($result)
|
||||
|
||||
// Date ope
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if (! $objp->rappro)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
$html->select_date($objp->do,'do');
|
||||
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="4">';
|
||||
print dolibarr_print_date($objp->do);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Value date
|
||||
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
||||
print '<td colspan="3">';
|
||||
if (! $objp->rappro)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
$html->select_date($objp->dv,'dv');
|
||||
print ' ';
|
||||
print '<a href="ligne.php?action=dvprev&account='.$_GET["account"].'&rowid='.$objp->rowid.'">';
|
||||
@ -281,6 +300,7 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="4">';
|
||||
print dolibarr_print_date($objp->dv);
|
||||
}
|
||||
print "</td></tr>";
|
||||
@ -290,26 +310,43 @@ if ($result)
|
||||
if (! $objp->rappro)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<input name="label" class="flat" value="'.$objp->label.'" size="50">';
|
||||
print '</td>';
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="2">';
|
||||
print '<td colspan="4">';
|
||||
print $objp->label;
|
||||
}
|
||||
print '<input name="label" class="flat" value="'.$objp->label.'" size="50">';
|
||||
print '</td>';
|
||||
print '<td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Affiche liens
|
||||
if (sizeof($links)) {
|
||||
print "<tr><td>".$langs->trans("Links")."</td>";
|
||||
print '<td colspan="3">';
|
||||
foreach($links as $key=>$val)
|
||||
{
|
||||
if ($key) print '<br>';
|
||||
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||
if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; }
|
||||
if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; }
|
||||
print $links[$key]['label'].'</a>';
|
||||
}
|
||||
print '</td><td> </td></tr>';
|
||||
}
|
||||
|
||||
// Amount
|
||||
print "<tr><td>".$langs->trans("Amount")."</td>";
|
||||
print '<td colspan="3">';
|
||||
if (! $objp->rappro)
|
||||
{
|
||||
print '<input name="amount" class="flat" value="'.price($objp->amount).'">';
|
||||
print '<td colspan="3">';
|
||||
print '<input name="amount" class="flat" size="10" value="'.price($objp->amount).'"> '.$conf->monnaie;
|
||||
print '</td><td align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="4">';
|
||||
print price($objp->amount);
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
@ -122,109 +122,123 @@ $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;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " WHERE rappro=0 AND fk_account=".$_GET["account"];
|
||||
$sql.= " ORDER BY dateo";
|
||||
$sql.= " ASC LIMIT ".$conf->liste_limit;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=True;
|
||||
$num = $db->num_rows($resql);
|
||||
$var=True;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
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").' : ';
|
||||
$resqlr=$db->query($sql);
|
||||
if ($resqlr)
|
||||
{
|
||||
$numr=$db->num_rows($resqlr);
|
||||
$i=0;
|
||||
while (($i < $numr) && ($i < $nbmax))
|
||||
{
|
||||
$objr = $db->fetch_object($resqlr);
|
||||
$last_releve = $objr->num_releve;
|
||||
$i++;
|
||||
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
||||
}
|
||||
if ($num >= $nbmax) $liste="... ".$liste;
|
||||
print "$liste";
|
||||
if ($num > 0) print '<br><br>';
|
||||
else print $langs->trans("None").'<br><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
print_titre($langs->trans("Reconciliation").': <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
||||
print '<br>';
|
||||
|
||||
if ($msg) {
|
||||
print "$msg<br><br>";
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
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";
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
|
||||
// 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").' : ';
|
||||
$resqlr=$db->query($sql);
|
||||
if ($resqlr)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
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."\">";
|
||||
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
||||
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>';
|
||||
|
||||
if ($objp->amount < 0)
|
||||
$numr=$db->num_rows($resqlr);
|
||||
$i=0;
|
||||
while (($i < $numr) && ($i < $nbmax))
|
||||
{
|
||||
print "<td align=\"right\" nowrap>".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
$objr = $db->fetch_object($resqlr);
|
||||
$last_releve = $objr->num_releve;
|
||||
$i++;
|
||||
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
||||
}
|
||||
else
|
||||
if ($num >= $nbmax) $liste="... ".$liste;
|
||||
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 "<tr class=\"liste_titre\">\n";
|
||||
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";
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
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."\">";
|
||||
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->do).'</td>';
|
||||
print '<td nowrap>'.dolibarr_print_date($objp->dv).'</td>';
|
||||
print '<td nowrap>'.$objp->type.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
||||
print '<td><a href="ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">'.$objp->label.'</a>';
|
||||
/*
|
||||
* Ajout les liens
|
||||
*/
|
||||
$links = $acct->get_url($objp->rowid);
|
||||
foreach($links as $key=>$val)
|
||||
{
|
||||
print "<td> </td><td align=\"right\" nowrap>".price($objp->amount)."</td>\n";
|
||||
print ' - ';
|
||||
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
|
||||
// if ($links[$key]['type']=='payment') { print img_object($langs->trans('ShowPayment'),'payment').' '; }
|
||||
// if ($links[$key]['type']=='company') { print img_object($langs->trans('ShowCustomer'),'company').' '; }
|
||||
print $links[$key]['label'].'</a>';
|
||||
}
|
||||
|
||||
if ($objp->rappro)
|
||||
print '</td>';
|
||||
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
// 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>";
|
||||
print "<td align=\"right\" nowrap>".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Si pas encore rapproch
|
||||
print "<td> </td><td align=\"right\" nowrap>".price($objp->amount)."</td>\n";
|
||||
}
|
||||
|
||||
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ée
|
||||
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.'&orig_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();
|
||||
@ -240,39 +254,39 @@ if ($resql)
|
||||
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>\n";
|
||||
print "</form>\n";
|
||||
$i++;
|
||||
|
||||
|
||||
// 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>\n";
|
||||
print "</form>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num != 0)
|
||||
$db->free($resql);
|
||||
|
||||
if ($num != 0)
|
||||
{
|
||||
print "</table>\n";
|
||||
print "</table><br>\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user