2004-10-19 22:19:58 +02:00
|
|
|
<?php
|
2005-04-30 16:49:40 +02:00
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2012-03-18 11:13:01 +01:00
|
|
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2005-04-30 16:49:40 +02:00
|
|
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2013-04-09 17:18:07 +02:00
|
|
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
2004-03-05 17:10:16 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-03-05 17:10:16 +01:00
|
|
|
* (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
|
2011-08-03 02:45:22 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-03-05 17:10:16 +01:00
|
|
|
*/
|
|
|
|
|
|
2005-04-30 16:49:40 +02:00
|
|
|
/**
|
2009-10-04 14:16:45 +02:00
|
|
|
* \file htdocs/comm/propal/note.php
|
2013-12-14 01:28:59 +01:00
|
|
|
* \ingroup propal
|
2009-10-04 14:16:45 +02:00
|
|
|
* \brief Fiche d'information sur une proposition commerciale
|
2009-08-05 20:11:27 +02:00
|
|
|
*/
|
2004-03-05 17:10:16 +01:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
|
2004-11-07 16:14:09 +01:00
|
|
|
|
2005-06-27 23:47:44 +02:00
|
|
|
$langs->load('propal');
|
2005-09-11 13:49:43 +02:00
|
|
|
$langs->load('compta');
|
2006-06-10 21:36:43 +02:00
|
|
|
$langs->load('bills');
|
2004-03-05 17:10:16 +01:00
|
|
|
|
2012-03-16 22:02:14 +01:00
|
|
|
$id = GETPOST('id','int');
|
|
|
|
|
$ref=GETPOST('ref','alpha');
|
|
|
|
|
$action=GETPOST('action','alpha');
|
2004-03-05 17:10:16 +01:00
|
|
|
|
2008-02-24 14:18:40 +01:00
|
|
|
// Security check
|
2008-02-25 21:03:21 +01:00
|
|
|
if ($user->societe_id) $socid=$user->societe_id;
|
2010-06-30 17:01:18 +02:00
|
|
|
$result = restrictedArea($user, 'propale', $id, 'propal');
|
2008-02-24 14:18:40 +01:00
|
|
|
|
2012-03-16 22:02:14 +01:00
|
|
|
$object = new Propal($db);
|
2008-02-24 14:18:40 +01:00
|
|
|
|
2004-03-05 17:10:16 +01:00
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
/* Actions */
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
if ($action == 'setnote_public' && $user->rights->propale->creer)
|
|
|
|
|
{
|
|
|
|
|
$object->fetch($id);
|
2013-04-10 10:58:38 +02:00
|
|
|
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
|
2012-07-02 19:30:37 +02:00
|
|
|
if ($result < 0) dol_print_error($db,$object->error);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-09 17:18:07 +02:00
|
|
|
else if ($action == 'setnote_private' && $user->rights->propale->creer)
|
2012-07-02 19:30:37 +02:00
|
|
|
{
|
|
|
|
|
$object->fetch($id);
|
2013-04-10 10:58:38 +02:00
|
|
|
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
|
2012-07-02 19:30:37 +02:00
|
|
|
if ($result < 0) dol_print_error($db,$object->error);
|
2004-03-05 17:10:16 +01:00
|
|
|
}
|
|
|
|
|
|
2006-02-12 17:23:43 +01:00
|
|
|
|
2004-03-05 17:10:16 +01:00
|
|
|
/******************************************************************************/
|
2006-02-12 17:23:43 +01:00
|
|
|
/* Affichage fiche */
|
2004-03-05 17:10:16 +01:00
|
|
|
/******************************************************************************/
|
|
|
|
|
|
2012-07-28 17:34:21 +02:00
|
|
|
llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
|
2006-02-12 17:23:43 +01:00
|
|
|
|
2011-11-08 10:18:45 +01:00
|
|
|
$form = new Form($db);
|
2006-02-12 17:23:43 +01:00
|
|
|
|
2009-10-04 14:16:45 +02:00
|
|
|
if ($id > 0 || ! empty($ref))
|
2004-03-05 17:10:16 +01:00
|
|
|
{
|
2006-02-12 17:23:43 +01:00
|
|
|
if ($mesg) print $mesg;
|
2009-08-05 19:49:12 +02:00
|
|
|
|
2012-03-23 18:19:50 +01:00
|
|
|
$now=dol_now();
|
2009-08-05 19:49:12 +02:00
|
|
|
|
2012-03-16 22:02:14 +01:00
|
|
|
if ($object->fetch($id, $ref))
|
2004-03-05 17:10:16 +01:00
|
|
|
{
|
2005-06-27 23:47:44 +02:00
|
|
|
$societe = new Societe($db);
|
2012-03-16 22:02:14 +01:00
|
|
|
if ( $societe->fetch($object->socid) )
|
2005-06-27 23:47:44 +02:00
|
|
|
{
|
2012-03-16 22:02:14 +01:00
|
|
|
$head = propal_prepare_head($object);
|
2009-08-05 19:49:12 +02:00
|
|
|
dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal');
|
|
|
|
|
|
2009-04-27 22:37:50 +02:00
|
|
|
print '<table class="border" width="100%">';
|
2005-06-27 23:47:44 +02:00
|
|
|
|
2012-07-28 17:20:17 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
|
2009-08-05 19:49:12 +02:00
|
|
|
|
2009-10-04 14:16:45 +02:00
|
|
|
// Ref
|
|
|
|
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
2012-03-16 22:02:14 +01:00
|
|
|
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
2009-10-04 14:16:45 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
|
|
|
|
// Ref client
|
|
|
|
|
print '<tr><td>';
|
2013-07-19 14:23:42 +02:00
|
|
|
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
|
2009-10-04 14:16:45 +02:00
|
|
|
print $langs->trans('RefCustomer').'</td><td align="left">';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr></table>';
|
|
|
|
|
print '</td><td colspan="3">';
|
2012-03-16 22:02:14 +01:00
|
|
|
print $object->ref_client;
|
2009-10-04 14:16:45 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Customer
|
2012-03-16 22:02:14 +01:00
|
|
|
if ( is_null($object->client) )
|
|
|
|
|
$object->fetch_thirdparty();
|
2009-10-04 14:16:45 +02:00
|
|
|
print "<tr><td>".$langs->trans("Company")."</td>";
|
2012-03-16 22:02:14 +01:00
|
|
|
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
2009-08-05 19:49:12 +02:00
|
|
|
|
2006-06-04 00:01:38 +02:00
|
|
|
// Ligne info remises tiers
|
2009-08-05 20:11:27 +02:00
|
|
|
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
2013-06-16 21:31:21 +02:00
|
|
|
if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent);
|
2006-06-04 00:01:38 +02:00
|
|
|
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
2007-12-02 21:55:23 +01:00
|
|
|
$absolute_discount=$societe->getAvailableDiscounts();
|
2006-06-04 00:01:38 +02:00
|
|
|
print '. ';
|
2011-11-23 14:55:36 +01:00
|
|
|
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
|
2006-06-04 00:01:38 +02:00
|
|
|
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
|
|
|
|
print '.';
|
|
|
|
|
print '</td></tr>';
|
2009-08-05 19:49:12 +02:00
|
|
|
|
2006-04-06 02:35:19 +02:00
|
|
|
// Date
|
2009-08-05 20:11:27 +02:00
|
|
|
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
|
2012-03-16 22:02:14 +01:00
|
|
|
print dol_print_date($object->date,'daytext');
|
2009-08-05 20:11:27 +02:00
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
// Date fin propal
|
|
|
|
|
print '<tr>';
|
|
|
|
|
print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">';
|
2012-03-16 22:02:14 +01:00
|
|
|
if ($object->fin_validite)
|
2009-08-05 20:11:27 +02:00
|
|
|
{
|
2012-03-16 22:02:14 +01:00
|
|
|
print dol_print_date($object->fin_validite,'daytext');
|
|
|
|
|
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
2009-08-05 20:11:27 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print $langs->trans("Unknown");
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
2012-03-18 00:59:24 +01:00
|
|
|
|
2009-04-27 22:37:50 +02:00
|
|
|
print "</table>";
|
2012-03-18 00:59:24 +01:00
|
|
|
|
2012-03-17 18:27:31 +01:00
|
|
|
print '<br>';
|
2012-03-18 00:59:24 +01:00
|
|
|
|
2012-08-23 02:04:35 +02:00
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
2005-07-11 02:49:16 +02:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
dol_fiche_end();
|
2005-06-27 23:47:44 +02:00
|
|
|
}
|
2009-08-05 20:11:27 +02:00
|
|
|
}
|
2004-03-05 17:10:16 +01:00
|
|
|
}
|
2012-03-16 22:02:14 +01:00
|
|
|
|
2009-04-27 22:37:50 +02:00
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-03-16 22:02:14 +01:00
|
|
|
$db->close();
|
2004-03-05 17:10:16 +01:00
|
|
|
?>
|