From 5702fc45e39abb6c64f3d02b8f008af9307a57c9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 3 Feb 2006 16:52:19 +0000 Subject: [PATCH] integration support multiprix --- htdocs/comm/multiprix.php | 227 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 htdocs/comm/multiprix.php diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php new file mode 100644 index 00000000000..1a4cd4acd95 --- /dev/null +++ b/htdocs/comm/multiprix.php @@ -0,0 +1,227 @@ + + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2006 Andre Cianfarani + * + * 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. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/comm/remise.php + \ingroup commercial + \brief Onglet remise de la societe + \version $Revision$ +*/ + +require_once("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); + +$user->getrights('propale'); +$user->getrights('commande'); +$user->getrights('projet'); + + +$langs->load("orders"); +$langs->load("companies"); + + +if ($_POST["action"] == 'setpricelevel') +{ + $soc = New Societe($db); + $soc->fetch($_GET["id"]); + $soc->set_price_level($_POST["price_level"],$user); + + Header("Location: multiprix.php?id=".$_GET["id"]); + exit; +} + + +llxHeader(); + +$_socid = $_GET["id"]; + + +// Sécurité si un client essaye d'accéder à une autre fiche que la sienne +if ($user->societe_id > 0) +{ + $_socid = $user->societe_id; +} + +/********************************************************************************* + * + * Mode fiche + * + *********************************************************************************/ +if ($_socid > 0) +{ + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$_socid; + $objsoc->fetch($_socid,$to); + + $dac = strftime("%Y-%m-%d %H:%M", time()); + if ($errmesg) + { + print '
'.$errmesg.'

'; + } + + /* + * Affichage onglets + */ + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Company"); + $h++; + + if ($objsoc->client==1) + { + $hselected=$h; + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Customer"); + $h++; + } + if ($objsoc->client==2) + { + $hselected=$h; + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; + $head[$h][1] = $langs->trans("Prospect"); + $h++; + } + if ($objsoc->fournisseur) + { + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Supplier"); + $h++; + } + + if ($conf->compta->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Accountancy"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Note"); + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Documents"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Notifications"); + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; + $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); + $head[$h][2] = 'image'; + } + + dolibarr_fiche_head($head, $hselected, $objsoc->nom); + + /* + * + * + */ + print '
'; + print ''; + print ''; + print '\n"; + + + print ""; + print "
'; + print ''; + + print '"; + + print ''; + print ''; + + print "
'; + print $langs->trans("PriceLevel").''.$objsoc->price_level."
'; + print $langs->trans("NewValue").''; + print ''; + print '
"; + print ""; + + print "
\n"; + print '
'; + + + /* + * Liste de l'historique des remises + */ + $sql = "SELECT rc.rowid,rc.price_level,".$db->pdate("rc.datec")." as dc, u.login"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_prices as rc, ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE rc.fk_soc =". $objsoc->id; + $sql .= " AND u.rowid = rc.fk_user_author"; + $sql .= " ORDER BY rc.datec DESC"; + + $resql=$db->query($sql); + if ($resql) + { + print ''; + $tag = !$tag; + print ''; + print ''; + print ''; + print ''; + print ''; + $i = 0 ; + $num = $db->num_rows($resql); + + while ($i < $num ) + { + $obj = $db->fetch_object($resql); + $tag = !$tag; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + $db->free($resql); + print "
'.$langs->trans("Date").''.$langs->trans("PriceLevel").''.$langs->trans("User").'
'.dolibarr_print_date($obj->dc,"%d %B %Y %H:%M").''.$obj->price_level.' '.$obj->login.'
"; + } + else + { + dolibarr_print_error($db); + } + +} + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?>