[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2005 Éric Seigne <eric.seigne@ryxeo.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: facture.php,v 1.50 2005/12/07 01:06:53 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/facture.php,v $ 22 */ 23 24 /** 25 \file htdocs/admin/facture.php 26 \ingroup facture 27 \brief Page d'administration/configuration du module Facture 28 \version $Revision: 1.50 $ 29 */ 30 31 require ("./pre.inc.php"); 32 33 $langs->load("admin"); 34 $langs->load("bills"); 35 36 if (!$user->admin) 37 accessforbidden(); 38 39 40 $facture_addon_var = FACTURE_ADDON; 41 $facture_addon_var_pdf = FACTURE_ADDON_PDF; 42 $facture_rib_number_var = FACTURE_RIB_NUMBER; 43 $facture_chq_number_var = FACTURE_CHQ_NUMBER; 44 $facture_tva_option = FACTURE_TVAOPTION; 45 46 $typeconst=array('yesno','texte','chaine'); 47 48 49 if ($_GET["action"] == 'set') 50 { 51 if (dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"])) 52 $facture_addon_var = $_GET["value"]; 53 } 54 55 if ($_POST["action"] == 'setribchq') 56 { 57 if (dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$_POST["rib"])) $facture_rib_number_var = $_POST["rib"]; 58 if (dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"])) $facture_chq_number_var = $_POST["chq"]; 59 } 60 61 if ($_GET["action"] == 'setpdf') 62 { 63 if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"])) $facture_addon_var_pdf = $_GET["value"]; 64 } 65 66 if ($_POST["action"] == 'setforcedate') 67 { 68 dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"]); 69 Header("Location: facture.php"); 70 exit; 71 } 72 73 if ($_POST["action"] == 'update' || $_POST["action"] == 'add') 74 { 75 if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:'')); 76 { 77 print $db->error(); 78 } 79 } 80 81 if ($_GET["action"] == 'delete') 82 { 83 if (! dolibarr_del_const($db, $_GET["rowid"])); 84 { 85 print $db->error(); 86 } 87 } 88 89 90 /* 91 * Affiche page 92 */ 93 94 $dir = "../includes/modules/facture/"; 95 96 97 llxHeader('',$langs->trans("BillsSetup"),'FactureConfiguration'); 98 99 print_titre($langs->trans("BillsSetup")); 100 101 102 /* 103 * Module numérotation 104 */ 105 print "<br>"; 106 print_titre($langs->trans("BillsNumberingModule")); 107 108 print '<table class="noborder" width="100%">'; 109 print '<tr class="liste_titre">'; 110 print '<td>'.$langs->trans("Name").'</td>'; 111 print '<td>'.$langs->trans("Description").'</td>'; 112 print '<td nowrap>'.$langs->trans("Example").'</td>'; 113 print '<td align="center" width="60">'.$langs->trans("Default").'</td>'; 114 print '</tr>'."\n"; 115 116 clearstatcache(); 117 118 $handle=opendir($dir); 119 120 $var=True; 121 while (($file = readdir($handle))!==false) 122 { 123 if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') 124 { 125 $var = !$var; 126 print '<tr '.$bc[$var].'><td width="100">'; 127 echo "$file"; 128 print "</td><td>\n"; 129 130 $filebis = $file."/".$file.".modules.php"; 131 132 // Chargement de la classe de numérotation 133 $classname = "mod_facture_".$file; 134 require_once($dir.$filebis); 135 136 $obj = new $classname($db); 137 print $obj->info(); 138 139 print '</td>'; 140 141 // Affiche example 142 print '<td>'.$obj->getExample().'</td>'; 143 144 print '<td align="center">'; 145 if ($facture_addon_var == "$file") 146 { 147 $title=''; 148 if ($obj->getNextValue() != $langs->trans("NotAvailable")) 149 { 150 $title=$langs->trans("NextValue").': '.$obj->getNextValue(); 151 } 152 print img_tick($title); 153 } 154 else 155 { 156 print '<a href="facture.php?action=set&value='.$file.'">'.$langs->trans("Default").'</a>'; 157 } 158 print "</td></tr>\n"; 159 } 160 } 161 closedir($handle); 162 163 print '</table>'; 164 165 166 /* 167 * PDF 168 */ 169 print '<br>'; 170 print_titre("Modèles de facture pdf"); 171 172 print '<table class="noborder" width="100%">'; 173 print '<tr class="liste_titre">'; 174 print '<td>'.$langs->trans("Name").'</td>'; 175 print '<td>'.$langs->trans("Description").'</td>'; 176 print '<td align="center" width="60">'.$langs->trans("Activated").'</td>'; 177 print '<td align="center" width="60">'.$langs->trans("Default").'</td>'; 178 print "</tr>\n"; 179 180 clearstatcache(); 181 182 $handle=opendir($dir); 183 184 $var=True; 185 while (($file = readdir($handle))!==false) 186 { 187 if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_') 188 { 189 $var = !$var; 190 $name = substr($file, 4, strlen($file) -16); 191 $classname = substr($file, 0, strlen($file) -12); 192 193 print '<tr '.$bc[$var].'><td width="100">'; 194 echo "$name"; 195 print "</td><td>\n"; 196 require_once($dir.$file); 197 $obj = new $classname($db); 198 199 print $obj->description; 200 201 print '</td><td align="center">'; 202 203 if ($facture_addon_var_pdf == "$name") 204 { 205 print ' '; 206 print '</td><td align="center">'; 207 print img_tick(); 208 } 209 else 210 { 211 print ' '; 212 print '</td><td align="center">'; 213 print '<a href="facture.php?action=setpdf&value='.$name.'">'.$langs->trans("Default").'</a>'; 214 } 215 print "</td></tr>\n"; 216 217 } 218 } 219 closedir($handle); 220 221 print '</table>'; 222 223 224 /* 225 * Modes de règlement 226 * 227 */ 228 print '<br>'; 229 print_titre( "Mode de règlement à afficher sur les factures"); 230 231 print '<table class="noborder" width="100%">'; 232 $var=True; 233 234 print '<form action="facture.php" method="post">'; 235 print '<input type="hidden" name="action" value="setribchq">'; 236 print '<tr class="liste_titre">'; 237 print '<td>Mode règlement à proposer</td>'; 238 print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; 239 print "</tr>\n"; 240 $var=!$var; 241 print '<tr '.$bc[$var].'>'; 242 print "<td>Proposer paiement par RIB sur le compte</td>"; 243 print "<td>"; 244 $sql = "SELECT rowid, label"; 245 $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; 246 $sql.= " where clos = 0"; 247 $sql.= " and courant = 1"; 248 if ($db->query($sql)) 249 { 250 $num = $db->num_rows(); 251 $i = 0; 252 if ($num > 0) { 253 print "<select name=\"rib\">"; 254 print '<option value="0">'.$langs->trans("DoNotShow").'</option>'; 255 while ($i < $num) 256 { 257 $var=!$var; 258 $row = $db->fetch_row($i); 259 260 if ($facture_rib_number_var == $row[0]) 261 { 262 print '<option value="'.$row[0].'" selected="true">'.$row[1].'</option>'; 263 } 264 else 265 { 266 print '<option value="'.$row[0].'">'.$row[1].'</option>'; 267 } 268 $i++; 269 } 270 print "</select>"; 271 } else { 272 print "<i>Aucun compte bancaire actif créé</i>"; 273 } 274 } 275 print "</td></tr>"; 276 $var=!$var; 277 print '<tr '.$bc[$var].'>'; 278 print "<td>Proposer paiement par chèque à l'ordre et adresse du titulaire du compte</td>"; 279 print "<td>"; 280 $sql = "SELECT rowid, label"; 281 $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; 282 $sql.= " where clos = 0"; 283 $sql.= " and courant = 1"; 284 $var=True; 285 if ($db->query($sql)) 286 { 287 $num = $db->num_rows(); 288 $i = 0; 289 if ($num > 0) 290 { 291 print "<select name=\"chq\">"; 292 print '<option value="0">'.$langs->trans("DoNotShow").'</option>'; 293 while ($i < $num) 294 { 295 $var=!$var; 296 $row = $db->fetch_row($i); 297 298 if ($facture_chq_number_var == $row[0]) 299 { 300 print '<option value="'.$row[0].'" selected="true">'.$row[1].'</option>'; 301 } 302 else 303 { 304 print '<option value="'.$row[0].'">'.$row[1].'</option>'; 305 } 306 $i++; 307 } 308 print "</select>"; 309 } else { 310 print "<i>Aucun compte bancaire actif créé</i>"; 311 } 312 } 313 print "</td></tr>"; 314 print "</form>"; 315 print "</table>"; 316 317 318 print "<br>"; 319 print_titre($langs->trans("OtherOptions")); 320 321 print '<table class="noborder" width="100%">'; 322 print '<tr class="liste_titre">'; 323 print '<td>'.$langs->trans("Parameter").'</td>'; 324 print '<td align="center" width="60">'.$langs->trans("Value").'</td>'; 325 print '<td width="80"> </td>'; 326 print "</tr>\n"; 327 328 $var=false; 329 print '<form action="facture.php" method="post">'; 330 print '<input type="hidden" name="action" value="setforcedate">'; 331 print '<tr '.$bc[$var].'><td>'; 332 echo "Forcer la définition de la date des factures lors de la validation"; 333 print '</td><td width="60" align="center">'; 334 $forcedate=(defined("FAC_FORCE_DATE_VALIDATION") && FAC_FORCE_DATE_VALIDATION)?1:0; 335 $html=new Form($db); 336 print $html->selectyesno("forcedate",$forcedate,1); 337 print '</td><td align="right">'; 338 print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; 339 print "</td></tr>\n"; 340 print '</form>'; 341 342 print '</table>'; 343 344 345 print "<br>"; 346 347 $db->close(); 348 349 llxFooter('$Date: 2005/12/07 01:06:53 $ - $Revision: 1.50 $'); 350 ?>
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 |
![]() |