* Copyright (C) 2004-2009 Laurent Destailleur * * 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, see . */ /** * \file htdocs/comm/remise.php * \ingroup societe * \brief Onglet remise de la societe * \version $Id: remise.php,v 1.35 2011/08/03 00:46:27 eldy Exp $ */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); $langs->load("companies"); $langs->load("orders"); $langs->load("bills"); $_socid = $_GET["id"]; // Security check if ($user->societe_id > 0) { $_socid = $user->societe_id; } if ($_POST["action"] == 'setremise') { $soc = New Societe($db); $soc->fetch($_GET["id"]); $result=$soc->set_remise_client($_POST["remise"],$_POST["note"],$user); if ($result > 0) { Header("Location: remise.php?id=".$_GET["id"]); exit; } else { $errmesg=$soc->error; } } /* * View */ $form=new Form($db); llxHeader(); /********************************************************************************* * * Mode fiche * *********************************************************************************/ if ($_socid > 0) { // On recupere les donnees societes par l'objet $objsoc = new Societe($db); $objsoc->id=$_socid; $objsoc->fetch($_socid,$to); if ($errmesg) { print '
'.$errmesg.'

'; } /* * Affichage onglets */ $head = societe_prepare_head($objsoc); dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); print ''; // Name print ''; print ''; // Remise print '"; print '
'.$langs->trans('Name').''; print $form->showrefnav($objsoc,'id','',1,'rowid','nom'); print '
'; print $langs->trans("CustomerRelativeDiscount").''.$objsoc->remise_client."%
'; print '
'; print_fiche_titre($langs->trans("NewRelativeDiscount"),'',''); print '
'; print ''; print ''; print ''; // Nouvelle valeur print ''; // Motif/Note print ''; print ''; print "
'; print $langs->trans("NewValue").'remise_client).'">%
'; print $langs->trans("NoteReason").'
"; print "
"; print "\n"; print '
'; /* * Liste de l'historique des avoirs */ $sql = "SELECT rc.rowid,rc.remise_client,rc.note, rc.datec as dc,"; $sql.= " u.login, u.rowid as user_id"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise 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 ''; print ''; $i = 0 ; $num = $db->num_rows($resql); while ($i < $num ) { $obj = $db->fetch_object($resql); $tag = !$tag; print ''; print ''; print ''; print ''; print ''; print ''; $i++; } $db->free($resql); print "
'.$langs->trans("Date").''.$langs->trans("CustomerRelativeDiscountShort").''.$langs->trans("NoteReason").''.$langs->trans("User").'
'.dol_print_date($db->jdate($obj->dc),"dayhour").''.$obj->remise_client.' %'.$obj->note.''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'
"; } else { dol_print_error($db); } } $db->close(); llxFooter('$Date: 2011/08/03 00:46:27 $ - $Revision: 1.35 $'); ?>