Modif recherche
This commit is contained in:
parent
c9b67412ca
commit
1006228bef
@ -95,18 +95,39 @@ if ($account)
|
||||
}
|
||||
$acct=new Account($db);
|
||||
$acct->fetch($account);
|
||||
|
||||
$sql = "SELECT rowid, label FROM llx_bank_categ;";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=True;
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
$options = "<option value=\"0\" SELECTED></option>";
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($i);
|
||||
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
|
||||
print_titre("Compte : " .$acct->label);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Formulaire de recherche
|
||||
*
|
||||
*/
|
||||
print '<form method="post" action="'."$PHP_SELF?vline=$vline&account=$account".'">';
|
||||
print '<form method="post" action="'."$PHP_SELF?account=$account".'">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="2">';
|
||||
print "<TR>";
|
||||
print '<td> </td>';
|
||||
print '<td> </td><td><input type="text" name="req_desc" size="24"></TD>';
|
||||
print '<td> </td><td><input type="text" name="req_desc" value="'.$HTTP_POST_VARS["req_desc"].'" size="24"></TD>';
|
||||
print '<td align="right"><input type="text" name="req_debit" size="6"></TD>';
|
||||
print '<td align="right"><input type="text" name="req_credit" size="6"></TD>';
|
||||
print '<td align="center"><input type="submit" value="Chercher"></td>';
|
||||
@ -124,33 +145,32 @@ if ($account)
|
||||
print "<td>Date</td><td>Type</td><td>Description</TD>";
|
||||
print "<td align=\"right\">Débit</TD>";
|
||||
print "<td align=\"right\">Crédit</TD>";
|
||||
print "<td align=\"right\">Solde</TD>";
|
||||
print "<td align=\"right\">Relevé</td>";
|
||||
print "</TR>\n";
|
||||
print "<td align=\"right\">Solde</td>";
|
||||
print "<td align=\"right\">Relevé</td></tr>";
|
||||
|
||||
$limit = 20;
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_bank";
|
||||
if ($account) { $sql .= " WHERE fk_account=$account"; }
|
||||
if ($HTTP_POST_VARS["req_desc"])
|
||||
{
|
||||
$sql_rech = " AND lower(b.label) like '%".strtolower($HTTP_POST_VARS["req_desc"])."%'";
|
||||
}
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_bank WHERE 1=1";
|
||||
if ($account) { $sql .= " AND fk_account=$account"; }
|
||||
$sql .= $sql_rech;
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$nbline = $db->result (0, 0);
|
||||
$db->free();
|
||||
|
||||
if ($nbline > $limit )
|
||||
if ($nbline > $viewline )
|
||||
{
|
||||
$offset = $nbline - $limit;
|
||||
$limit = $nbline - $viewline ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$offset = 0;
|
||||
$limit = $viewline;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
print "<tr><td>".$nbline;
|
||||
|
||||
|
||||
$sql = "SELECT rowid, label FROM llx_bank_categ;";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -173,12 +193,6 @@ if ($account)
|
||||
* select sum(amount) from solde ;
|
||||
*/
|
||||
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$sql = "SELECT sum (b.amount) FROM llx_bank as b ";
|
||||
|
||||
|
||||
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
|
||||
$sql .= " FROM llx_bank as b ";
|
||||
|
||||
@ -192,10 +206,7 @@ if ($account)
|
||||
$sql .= " AND b.amount = -".$req_debit;
|
||||
}
|
||||
|
||||
if ($HTTP_POST_VARS["req_desc"])
|
||||
{
|
||||
$sql .= " AND lower(b.label) like '%".strtolower($HTTP_POST_VARS["req_desc"])."%'";
|
||||
}
|
||||
$sql .= $sql_rech;
|
||||
|
||||
if ($vue)
|
||||
{
|
||||
@ -209,7 +220,6 @@ if ($account)
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY b.dateo ASC";
|
||||
$sql .= $db->plimit($limit, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -225,83 +235,92 @@ if ($account)
|
||||
$objp = $db->fetch_object( $i);
|
||||
$total = $total + $objp->amount;
|
||||
$time = time();
|
||||
$var = !$var;
|
||||
if ($objp->do > $time && !$sep)
|
||||
if ($i > ($nbline - $viewline))
|
||||
{
|
||||
$sep = 1 ;
|
||||
print "<tr><td align=\"right\" colspan=\"5\"> </td>";
|
||||
print "<td align=\"right\"><b>".price($total - $objp->amount)."</b></td>";
|
||||
print "<td> </td>";
|
||||
print '</tr><tr>';
|
||||
print '<td><input name="dateoy" type="text" size="4" value="'.strftime("%Y",time()).'" maxlength="4">';
|
||||
print '<input name="dateo" type="text" size="4" maxlength="4"></td>';
|
||||
print '<td>';
|
||||
print '<select name="operation">';
|
||||
print '<option value="CB">CB';
|
||||
print '<option value="CHQ">CHQ';
|
||||
print '<option value="DEP">DEP';
|
||||
print '<option value="TIP">TIP';
|
||||
print '<option value="PRE">PRE';
|
||||
print '<option value="VIR">VIR';
|
||||
print '</select></td>';
|
||||
print '<td><input name="num_chq" type="text" size="6"> -';
|
||||
print "<input name=\"label\" type=\"text\" size=40></td>";
|
||||
print "<td><input name=\"debit\" type=\"text\" size=8></td>";
|
||||
print "<td><input name=\"credit\" type=\"text\" size=8></td>";
|
||||
print "<td colspan=\"3\" align=\"center\"><select name=\"cat1\">$options</select></td>";
|
||||
print "</tr><tr><td colspan=\"3\"><small>YYYYMMDD</small></td><td>0000.00</td>";
|
||||
print '<td colspan="4" align="center"><input type="submit" value="ajouter"></td></tr>';
|
||||
}
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".strftime("%d %b %y",$objp->do)."</TD>\n";
|
||||
print "<td>".$objp->fk_type."</TD>\n";
|
||||
|
||||
if ($objp->num_chq)
|
||||
{
|
||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$account\">CHQ $objp->num_chq - $objp->label</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$account\">$objp->label</a> </td>";
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
if ($action !='search')
|
||||
{
|
||||
if ($total > 0)
|
||||
$var=!$var;
|
||||
|
||||
if ($objp->do > $time && !$sep)
|
||||
{
|
||||
print '<td align="right">'.price($total)."</TD>\n";
|
||||
$sep = 1 ;
|
||||
print "<tr><td align=\"right\" colspan=\"5\"> </td>";
|
||||
print "<td align=\"right\"><b>".price($total - $objp->amount)."</b></td>";
|
||||
print "<td> </td>";
|
||||
print '</tr><tr>';
|
||||
print '<td><input name="dateoy" type="text" size="4" value="'.strftime("%Y",time()).'" maxlength="4">';
|
||||
print '<input name="dateo" type="text" size="4" maxlength="4"></td>';
|
||||
print '<td>';
|
||||
print '<select name="operation">';
|
||||
print '<option value="CB">CB';
|
||||
print '<option value="CHQ">CHQ';
|
||||
print '<option value="DEP">DEP';
|
||||
print '<option value="TIP">TIP';
|
||||
print '<option value="PRE">PRE';
|
||||
print '<option value="VIR">VIR';
|
||||
print '</select></td>';
|
||||
print '<td><input name="num_chq" type="text" size="6"> -';
|
||||
print "<input name=\"label\" type=\"text\" size=40></td>";
|
||||
print "<td><input name=\"debit\" type=\"text\" size=8></td>";
|
||||
print "<td><input name=\"credit\" type=\"text\" size=8></td>";
|
||||
print "<td colspan=\"3\" align=\"center\"><select name=\"cat1\">$options</select></td>";
|
||||
print "</tr><tr><td colspan=\"3\"><small>YYYYMMDD</small></td><td>0000.00</td>";
|
||||
print '<td colspan="4" align="center"><input type="submit" value="ajouter"></td></tr>';
|
||||
}
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td>".strftime("%d %b %y",$objp->do)."</TD>\n";
|
||||
print "<td>".$objp->fk_type."</TD>\n";
|
||||
|
||||
if ($objp->num_chq)
|
||||
{
|
||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$account\">CHQ $objp->num_chq - $objp->label</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"right\"><b>".price($total)."</b></TD>\n";
|
||||
//Xavier DUTOIT : Ajout d'un lien pour modifier la ligne
|
||||
print "<td><a href=\"ligne.php?rowid=$objp->rowid&account=$account\">$objp->label</a> </td>";
|
||||
|
||||
// print "<td>$objp->label </td>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">-</TD>';
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
if ($action !='search')
|
||||
{
|
||||
if ($total > 0)
|
||||
{
|
||||
print '<td align="right">'.price($total)."</TD>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"right\"><b>".price($total)."</b></TD>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="right">-</TD>';
|
||||
}
|
||||
|
||||
if ($objp->rappro)
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$account\">$objp->num_releve</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"$PHP_SELF?action=del&rowid=$objp->rowid&account=$account\">[Del]</a></td>";
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
|
||||
}
|
||||
|
||||
if ($objp->rappro)
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$account\">$objp->num_releve</a></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"$PHP_SELF?action=del&rowid=$objp->rowid&account=$account\">[Del]</a></td>";
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user