| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: virement.php,v 1.25 2005/08/15 10:38:09 ccomb Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/bank/virement.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/compta/bank/virement.php 26 \ingroup banque 27 \brief Page de saisie d'un virement 28 \version $Revision: 1.25 $ 29 */ 30 31 require ("./pre.inc.php"); 32 require ("./bank.lib.php"); 33 34 $user->getrights('banque'); 35 36 if (!$user->rights->banque->modifier) 37 accessforbidden(); 38 39 llxHeader(); 40 41 $html=new Form($db); 42 43 44 /* 45 * Action ajout d'un virement 46 */ 47 if ($_POST["action"] == 'add') 48 { 49 $mesg=''; 50 $dateo = $_POST["reyear"]."-".$_POST["remonth"]."-".$_POST["reday"]; 51 $label = $_POST["label"]; 52 $amount= $_POST["amount"]; 53 54 if ($label && $amount) { 55 56 $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, datev, dateo, label, amount, fk_user_author,fk_account, fk_type)"; 57 $sql .= " VALUES (now(), '$dateo', '$dateo', '$label', (0 - $amount),$user->id, ".$_POST["account_from"].", 'VIR')"; 58 59 $result = $db->query($sql); 60 if (!$result) 61 { 62 dolibarr_print_error($db); 63 } 64 65 $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, datev, dateo, label, amount, fk_user_author,fk_account, fk_type)"; 66 $sql .= " VALUES (now(), '$dateo', '$dateo', '$label', $amount,$user->id, ".$_POST["account_to"].", 'VIR')"; 67 68 $result = $db->query($sql); 69 if ($result) 70 { 71 $accountfrom=new Account($db); 72 $accountfrom->fetch($_POST["account_from"]); 73 $accountto=new Account($db); 74 $accountto->fetch($_POST["account_to"]); 75 76 $mesg.="<div class=\"ok\"><b>Le virement depuis « <a href=\"account.php?account=".$accountfrom->id."\">".$accountfrom->label."</a> » vers « <a href=\"account.php?account=".$accountto->id."\">".$accountto->label."</a> » de ".$amount." ".$langs->trans("Currency".$conf->monnaie)." a été créé.</b></div>"; 77 } 78 else { 79 dolibarr_print_error($db); 80 } 81 } else { 82 $mesg.="<div class=\"error\"><b>Un libellé de virement et un montant non nul sont obligatoires.</b></div>"; 83 } 84 } 85 86 print_titre("Virement inter-compte"); 87 print '<br>'; 88 89 if ($mesg) { 90 print "$mesg<br>"; 91 } 92 93 print "En saisissant un virement d'un de vos comptes bancaire vers un autre, Dolibarr crée deux écritures comptables (une de débit dans un compte et l'autre de crédit, du même montant, dans l'autre compte. Le même libellé de transaction, et la même date, sont utilisés pour les 2 écritures)<br><br>"; 94 95 print "<form method=\"post\" action=\"virement.php\">"; 96 97 print '<input type="hidden" name="action" value="add">'; 98 99 print '<table class="noborder" width="100%">'; 100 print '<tr class="liste_titre">'; 101 print '<td>'.$langs->trans("From").'</td><td>'.$langs->trans("To").'</td><td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("Amount").'</td>'; 102 print '</tr>'; 103 104 $var=false; 105 print '<tr '.$bc[$var].'><td>'; 106 print "<select class=\"flat\" name=\"account_from\">"; 107 $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_account"; 108 $sql .= " WHERE clos = 0"; 109 $resql = $db->query($sql); 110 if ($resql) 111 { 112 $var=True; 113 $num = $db->num_rows($resql); 114 $i = 0; 115 116 while ($i < $num) 117 { 118 $objp = $db->fetch_object($resql); 119 print "<option value=\"$objp->rowid\">$objp->label</option>"; 120 $i++; 121 } 122 $db->free($resql); 123 } 124 print "</select></td><td>\n"; 125 126 print '<select class="flat" name="account_to">'; 127 $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_account"; 128 $sql .= " WHERE clos = 0"; 129 $resql = $db->query($sql); 130 if ($resql) 131 { 132 $var=True; 133 $num = $db->num_rows(); 134 $i = 0; 135 136 while ($i < $num) 137 { 138 $objp = $db->fetch_object($resql); 139 print "<option value=\"$objp->rowid\">$objp->label</option>"; 140 $i++; 141 } 142 $db->free($resql); 143 } 144 print "</select></td>\n"; 145 146 print "<td>"; 147 $html->select_date(); 148 print "</td>\n"; 149 print '<td><input name="label" class="flat" type="text" size="40"></td>'; 150 print '<td><input name="amount" class="flat" type="text" size="8"></td>'; 151 152 print "</table>"; 153 154 print '<br><center><input type="submit" class="button" value="'.$langs->trans("Add").'"></center>'; 155 156 print "</form>"; 157 158 $db->close(); 159 160 llxFooter('$Date: 2005/08/15 10:38:09 $ - $Revision: 1.25 $'); 161 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
|