| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2001-2004 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: remise.php,v 1.7 2005/09/07 21:50:09 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/remise.php,v $ 21 */ 22 23 /** 24 \file htdocs/comm/remise.php 25 \ingroup commercial 26 \brief Onglet remise de la societe 27 \version $Revision: 1.7 $ 28 */ 29 30 require_once ("./pre.inc.php"); 31 require_once (DOL_DOCUMENT_ROOT."/contact.class.php"); 32 33 $user->getrights('propale'); 34 $user->getrights('commande'); 35 $user->getrights('projet'); 36 37 38 $langs->load("orders"); 39 $langs->load("companies"); 40 41 42 if ($_POST["action"] == 'setremise') 43 { 44 $soc = New Societe($db); 45 $soc->fetch($_GET["id"]); 46 $soc->set_remise_client($_POST["remise"],$user); 47 48 Header("Location: remise.php?id=".$_GET["id"]); 49 exit; 50 } 51 52 53 llxHeader(); 54 55 $_socid = $_GET["id"]; 56 57 58 // Sécurité si un client essaye d'accéder à une autre fiche que la sienne 59 if ($user->societe_id > 0) 60 { 61 $_socid = $user->societe_id; 62 } 63 64 65 /********************************************************************************* 66 * 67 * Mode fiche 68 * 69 *********************************************************************************/ 70 if ($_socid > 0) 71 { 72 // On recupere les donnees societes par l'objet 73 $objsoc = new Societe($db); 74 $objsoc->id=$_socid; 75 $objsoc->fetch($_socid,$to); 76 77 $dac = strftime("%Y-%m-%d %H:%M", time()); 78 if ($errmesg) 79 { 80 print '<div class="error">'.$errmesg.'</div><br>'; 81 } 82 83 /* 84 * Affichage onglets 85 */ 86 $h = 0; 87 88 $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; 89 $head[$h][1] = $langs->trans("Company"); 90 $h++; 91 92 if ($objsoc->client==1) 93 { 94 $hselected=$h; 95 $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; 96 $head[$h][1] = $langs->trans("Customer"); 97 $h++; 98 } 99 if ($objsoc->client==2) 100 { 101 $hselected=$h; 102 $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; 103 $head[$h][1] = $langs->trans("Prospect"); 104 $h++; 105 } 106 if ($objsoc->fournisseur) 107 { 108 $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; 109 $head[$h][1] = $langs->trans("Supplier"); 110 $h++; 111 } 112 113 if ($conf->compta->enabled) { 114 $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; 115 $head[$h][1] = $langs->trans("Accountancy"); 116 $h++; 117 } 118 119 $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; 120 $head[$h][1] = $langs->trans("Note"); 121 $h++; 122 123 if ($user->societe_id == 0) 124 { 125 $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; 126 $head[$h][1] = $langs->trans("Documents"); 127 $h++; 128 } 129 130 $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; 131 $head[$h][1] = $langs->trans("Notifications"); 132 $h++; 133 134 if ($user->societe_id == 0) 135 { 136 $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; 137 $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); 138 $head[$h][2] = 'image'; 139 } 140 141 dolibarr_fiche_head($head, $hselected, $objsoc->nom); 142 143 /* 144 * 145 * 146 */ 147 print '<form method="POST" action="remise.php?id='.$objsoc->id.'">'; 148 print '<input type="hidden" name="action" value="setremise">'; 149 print '<table width="100%" border="0">'; 150 print '<tr><td valign="top">'; 151 print '<table class="border" width="100%">'; 152 153 print '<tr><td colspan="2" width="25%">'; 154 print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.$objsoc->remise_client."%</td></tr>"; 155 156 print '<tr><td colspan="2">'; 157 print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.$objsoc->remise_client.'">%</td></tr>'; 158 print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>'; 159 160 print "</table>"; 161 print "</form>"; 162 163 print "</td>\n"; 164 165 166 print "</td></tr>"; 167 print "</table></div>\n"; 168 print '<br>'; 169 170 171 /* 172 * Liste de l'historique des remises 173 */ 174 $sql = "SELECT rc.rowid,rc.remise_client,".$db->pdate("rc.datec")." as dc, u.code"; 175 $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u"; 176 $sql .= " WHERE rc.fk_soc =". $objsoc->id; 177 $sql .= " AND u.rowid = rc.fk_user_author"; 178 $sql .= " ORDER BY rc.datec DESC"; 179 180 $resql=$db->query($sql); 181 if ($resql) 182 { 183 print '<table class="noborder" width="100%">'; 184 $tag = !$tag; 185 print '<tr class="liste_titre">'; 186 print '<td>'.$langs->trans("Date").'</td>'; 187 print '<td>'.$langs->trans("Discount").'</td>'; 188 print '<td>'.$langs->trans("User").'</td>'; 189 print '</tr>'; 190 $i = 0 ; 191 $num = $db->num_rows($resql); 192 193 while ($i < $num ) 194 { 195 $obj = $db->fetch_object($resql); 196 $tag = !$tag; 197 print '<tr '.$bc[$tag].'>'; 198 print '<td>'.dolibarr_print_date($obj->dc,"%d %B %Y %H:%M").'</td>'; 199 print '<td>'.$obj->remise_client.' %</td>'; 200 print '<td>'.$obj->code.'</td>'; 201 print '</tr>'; 202 $i++; 203 } 204 $db->free($resql); 205 print "</table>"; 206 } 207 else 208 { 209 dolibarr_print_error($db); 210 } 211 212 } 213 214 $db->close(); 215 216 llxFooter('$Date: 2005/09/07 21:50:09 $ - $Revision: 1.7 $'); 217 ?>
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 |
|