dolibarr/htdocs/compta/bank/virement.php3

119 lines
3.1 KiB
PHP
Raw Normal View History

2002-05-11 20:53:13 +02:00
<?PHP
2002-12-22 04:32:07 +01:00
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
2002-05-11 20:53:13 +02:00
* $Id$
* $Source$
*
*
* $viewall
*
*/
require("./pre.inc.php3");
require("./bank.lib.php3");
llxHeader();
$db = new Db();
2002-12-22 04:32:07 +01:00
if ($action == 'add')
{
2002-05-11 20:53:13 +02:00
$author = $GLOBALS["REMOTE_USER"];
2002-06-20 15:23:17 +02:00
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author,fk_account)";
$sql .= " VALUES (now(), $dateo, '$label', (0 - $amount),'$author',$account_from)";
$result = $db->query($sql);
2002-12-22 04:32:07 +01:00
if (!$result)
{
print $db->error();
print "<p>$sql";
}
2002-05-11 20:53:13 +02:00
2002-06-20 15:23:17 +02:00
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author,fk_account)";
$sql .= " VALUES (now(), $dateo, '$label', $amount,'$author',$account_to)";
2002-05-11 20:53:13 +02:00
$result = $db->query($sql);
2002-12-22 04:32:07 +01:00
if (!$result)
{
print $db->error();
print "<p>$sql";
}
2002-05-11 20:53:13 +02:00
}
2002-12-22 04:32:07 +01:00
print_titre("Virement");
2002-05-11 20:53:13 +02:00
print "<form method=\"post\" action=\"$PHP_SELF?viewall=$viewall&vline=$vline&account=$account\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
print "<tr><td>De</td><td>Vers</td><td>Date</td><td>Libelle</td><td>Montant</td></tr>";
print "<tr><td>";
2002-06-20 15:23:17 +02:00
print "<select name=\"account_from\">";
2002-05-11 20:53:13 +02:00
$sql = "SELECT rowid, label FROM llx_bank_account";
$result = $db->query($sql);
2002-12-22 04:32:07 +01:00
if ($result)
{
2002-05-11 20:53:13 +02:00
$var=True;
$num = $db->num_rows();
$i = 0; $total = 0;
2002-12-22 04:32:07 +01:00
while ($i < $num)
{
$objp = $db->fetch_object($i);
print "<option value=\"$objp->rowid\">$objp->label</option><br>";
$i++;
}
2002-05-11 20:53:13 +02:00
}
print "</select></td><td>";
2002-06-20 15:23:17 +02:00
print "<select name=\"account_to\">";
2002-05-11 20:53:13 +02:00
$sql = "SELECT rowid, label FROM llx_bank_account";
$result = $db->query($sql);
2002-12-22 04:32:07 +01:00
if ($result)
{
2002-05-11 20:53:13 +02:00
$var=True;
$num = $db->num_rows();
$i = 0; $total = 0;
2002-12-22 04:32:07 +01:00
while ($i < $num)
{
$objp = $db->fetch_object($i);
print "<option value=\"$objp->rowid\">$objp->label</option><br>";
$i++;
}
2002-05-11 20:53:13 +02:00
}
print "</select></td>";
print "<td><input name=\"dateo\" type=\"text\" size=8 maxlength=8></td>";
print "<td><input name=\"label\" type=\"text\" size=40></td>";
2002-06-20 15:23:17 +02:00
print "<td><input name=\"amount\" type=\"text\" size=8></td>";
2002-05-11 20:53:13 +02:00
print "</tr><tr><td colspan=\"2\">Format : YYYYMMDD - 20010826</td><td colspan=\"2\">0000.00</td></tr>";
2002-12-22 04:32:07 +01:00
print '<tr><td colspan="4" align="center"><input type="submit" value="ajouter"</td></tr>';
2002-05-11 20:53:13 +02:00
print "</table></form>";
2002-12-22 04:32:07 +01:00
2002-05-11 20:53:13 +02:00
$db->close();
2002-12-22 04:32:07 +01:00
llxFooter(" - <em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
2002-05-11 20:53:13 +02:00
?>