mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
.
This commit is contained in:
parent
ab73cd7766
commit
3de5ef73c0
|
|
@ -21,20 +21,13 @@
|
|||
*/
|
||||
require("./pre.inc.php3");
|
||||
|
||||
require("../../contact.class.php3");
|
||||
require("../..//lib/webcal.class.php3");
|
||||
require("../cactioncomm.class.php3");
|
||||
require("../actioncomm.class.php3");
|
||||
|
||||
require("../contact.class.php3");
|
||||
require("../lib/webcal.class.php3");
|
||||
require("cactioncomm.class.php3");
|
||||
require("actioncomm.class.php3");
|
||||
require("../todocomm.class.php3");
|
||||
|
||||
llxHeader();
|
||||
$db = new Db();
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
|
@ -44,17 +37,23 @@ if ($action=='add_action') {
|
|||
$contact = new Contact($db);
|
||||
$contact->fetch($contactid);
|
||||
|
||||
|
||||
$actioncomm = new ActionComm($db);
|
||||
|
||||
if ($actionid == 5) {
|
||||
$actioncomm->date = $db->idate(mktime($heurehour,$heuremin,0,$remonth,$reday,$reyear));
|
||||
$actioncomm->percent = 0;
|
||||
} else {
|
||||
$actioncomm->date = $date;
|
||||
$actioncomm->percent = 100;
|
||||
}
|
||||
$actioncomm->priority = 2;
|
||||
$actioncomm->type = $actionid;
|
||||
$actioncomm->contact = $contactid;
|
||||
|
||||
|
||||
|
||||
$actioncomm->user = $user;
|
||||
|
||||
$actioncomm->societe = $socid;
|
||||
$actioncomm->note = $note;
|
||||
|
||||
|
|
@ -65,36 +64,47 @@ if ($action=='add_action') {
|
|||
$societe->fetch($socid);
|
||||
|
||||
|
||||
$todo = new TodoComm($db);
|
||||
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
|
||||
if ($todo) {
|
||||
|
||||
$todo->libelle = $todo_label;
|
||||
$todo = new ActionComm($db);
|
||||
$todo->type = 0;
|
||||
$todo->date = $db->idate(mktime(12,0,0,$remonth, $reday, $reyear));
|
||||
|
||||
$todo->societe = $societe->id;
|
||||
$todo->contact = $contactid;
|
||||
$todo->libelle = $todo_label;
|
||||
$todo->priority = 2;
|
||||
$todo->societe = $societe->id;
|
||||
$todo->contact = $contactid;
|
||||
|
||||
$todo->user = $user;
|
||||
|
||||
$todo->note = $todo_note;
|
||||
$todo->note = $todo_note;
|
||||
|
||||
$todo->percent = 0;
|
||||
|
||||
$todo->add($user);
|
||||
|
||||
$todo->add($user);
|
||||
if ($conf->webcal && $todo_webcal) {
|
||||
|
||||
$webcal = new Webcal();
|
||||
$webcal = new Webcal();
|
||||
|
||||
$webcal->heure = $heurehour . $heuremin . '00';
|
||||
$webcal->duree = ($dureehour * 60) + $dureemin;
|
||||
|
||||
if ($actionid == 5) {
|
||||
$libelle = "Rendez-vous avec ".$contact->fullname;
|
||||
$libelle .= "\n" . $todo->libelle;
|
||||
} else {
|
||||
$libelle = $todo->libelle;
|
||||
$webcal->heure = $heurehour . $heuremin . '00';
|
||||
$webcal->duree = ($dureehour * 60) + $dureemin;
|
||||
|
||||
if ($actionid == 5) {
|
||||
$libelle = "Rendez-vous avec ".$contact->fullname;
|
||||
$libelle .= "\n" . $todo->libelle;
|
||||
} else {
|
||||
$libelle = $todo->libelle;
|
||||
}
|
||||
|
||||
$webcal->add($user, $todo->date, $societe->nom, $libelle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$webcal->add($user, $todo->date, $societe->nom, $libelle);
|
||||
|
||||
Header("Location: /comm/fiche.php3?socid=$socid");
|
||||
}
|
||||
|
||||
|
||||
llxHeader();
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
|
@ -128,7 +138,7 @@ if ($action=='create' && $actionid && $contactid) {
|
|||
|
||||
print '<tr><td colspan="2" bgcolor="#e0e0e0"><div class="titre">Rendez-vous</div></td></tr>';
|
||||
print '<tr><td width="10%">Société</td><td width="40%"bgcolor="#e0e0e0">';
|
||||
print '<b><a href="index.php3?socid='.$socid.'">'.$societe->nom.'</a></td></tr>';
|
||||
print '<b><a href="../fiche.php3?socid='.$socid.'">'.$societe->nom.'</a></td></tr>';
|
||||
print '<tr><td width="10%">Contact</td><td width="40%"bgcolor="#e0e0e0"><b>'.$contact->fullname.'</td></tr>';
|
||||
print '<tr><td width="10%">Date</td><td width="40%">';
|
||||
print_date_select();
|
||||
|
|
@ -156,7 +166,7 @@ if ($action=='create' && $actionid && $contactid) {
|
|||
else
|
||||
{
|
||||
|
||||
print '<form action="index.php3?socid='.$socid.'" method="post">';
|
||||
print '<form action="fiche.php3?socid='.$socid.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="add_action">';
|
||||
|
||||
print '<input type="hidden" name="date" value="'.$db->idate(time()).'">';
|
||||
|
|
@ -170,18 +180,19 @@ if ($action=='create' && $actionid && $contactid) {
|
|||
|
||||
print '<tr><td width="10%">Action</td><td bgcolor="#e0e0e0"><b>'.$caction->libelle.'</td></tr>';
|
||||
print '<tr><td width="10%">Société</td><td width="40%"bgcolor="#e0e0e0">';
|
||||
print '<b><a href="index.php3?socid='.$socid.'">'.$societe->nom.'</a></td></tr>';
|
||||
print '<b><a href="../fiche.php3?socid='.$socid.'">'.$societe->nom.'</a></td></tr>';
|
||||
print '<tr><td width="10%">Contact</td><td width="40%"bgcolor="#e0e0e0"><b>'.$contact->fullname.'</td></tr>';
|
||||
print '<td>Date</td><td>'.strftime('%d %B %Y %H:%M',time()).'</td></tr>';
|
||||
print '<tr><td valign="top">Commentaire</td><td>';
|
||||
print '<textarea cols="60" rows="6" name="note"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td colspan="2" bgcolor="#e0e0e0"><div class="titre">Prochaine Action à faire</div></td></tr>';
|
||||
|
||||
print '<tr><td width="10%">Ajouter</td><td><input type="checkbox" name="todo"></td></tr>';
|
||||
print '<tr><td width="10%">Date</td><td width="40%">';
|
||||
print_date_select();
|
||||
print '</td></tr>';
|
||||
print '<tr><td width="10%">Action</td><td><input type="text" name="todo_label" size="30"></td></tr>';
|
||||
print '<tr><td width="10%">Calendrier</td><td><input type="checkbox" name="todo_webcal"></td></tr>';
|
||||
print '<tr><td valign="top">Commentaire</td><td>';
|
||||
print '<textarea cols="60" rows="6" name="todo_note"></textarea></td></tr>';
|
||||
|
||||
|
|
@ -200,9 +211,13 @@ if ($id) {
|
|||
$act = new ActionComm($db);
|
||||
$act->fetch($id);
|
||||
|
||||
$act->societe->fetch($act->societe->id);
|
||||
|
||||
print_titre ("Action commerciale");
|
||||
|
||||
print '<table width="100%" border="1" cellspacing="0" cellpadding="3">';
|
||||
print '<tr><td width="10%">Action</td><td colspan="3" bgcolor="#e0e0e0"><b>'.$act->type.'</td></tr>';
|
||||
print '<tr><td width="10%">Société</td><td width="40%"bgcolor="#e0e0e0"><b>'.$nom.'</td>';
|
||||
print '<tr><td width="10%">Type</td><td colspan="3" bgcolor="#e0e0e0"><b>'.$act->type.'</td></tr>';
|
||||
print '<tr><td width="10%">Société</td><td width="40%"bgcolor="#e0e0e0"><b>'.$act->societe->nom.'</td>';
|
||||
print '<td width="10%">Contact</td><td width="40%"bgcolor="#e0e0e0"><b>'.$fullname.'</td></tr>';
|
||||
print '<tr><td>Auteur</td><td>'.$fullname.'</td>';
|
||||
print '<td>Date</td><td>'.strftime('%d %B %Y %H:%M',time()).'</td></tr>';
|
||||
|
|
@ -210,125 +225,8 @@ if ($id) {
|
|||
print nl2br($act->note).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
$limit = 10;
|
||||
print '<p>Vos 10 dernières actions';
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Liste
|
||||
*
|
||||
*/
|
||||
|
||||
if ($socid) {
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
print_barre_liste("Liste des actions commerciales effectuées sur " . $societe->nom,$page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u";
|
||||
$sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
|
||||
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD>Date</TD>';
|
||||
print "<TD>Action</TD>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD width=\"10%\">" .strftime("%Y %b %d %H:%M",$obj->da)."</TD>\n";
|
||||
print '<TD width="30%"><a href="actioncomm.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
print "</TR>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . '<br>' . $sql;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
print_barre_liste("Liste des actions commerciales effectuées",$page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u";
|
||||
$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
|
||||
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit( $limit, $offset);
|
||||
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD colspan="4">Date</TD>';
|
||||
print '<TD>Société</a></td>';
|
||||
print '<TD>Action</a></TD>';
|
||||
print "<TD>Auteur</TD>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD>" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD>" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<TD width="50%">';
|
||||
|
||||
print ' <a href="index.php3?socid='.$obj->socidp.'">'.$obj->societe.'</A></TD>';
|
||||
|
||||
print '<TD width="30%"><a href="actioncomm.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
print "<TD width=\"20%\">$obj->code</TD>\n";
|
||||
print "<TD align=\"center\">$obj->stcomm</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . ' ' . $sql ;
|
||||
}
|
||||
print '<p><p><a href="index.php3?action=delete_action&actionid='.$act->id.'">Supprimer</a>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
244
htdocs/comm/action/index.php3
Normal file
244
htdocs/comm/action/index.php3
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
|
||||
|
||||
require("../../contact.class.php3");
|
||||
require("../../lib/webcal.class.php3");
|
||||
require("../cactioncomm.class.php3");
|
||||
require("../actioncomm.class.php3");
|
||||
|
||||
|
||||
llxHeader();
|
||||
$db = new Db();
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action=='delete_action') {
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->delete($actionid);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action=='add_action') {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($contactid);
|
||||
|
||||
|
||||
$actioncomm = new ActionComm($db);
|
||||
|
||||
if ($actionid == 5) {
|
||||
$actioncomm->date = $db->idate(mktime($heurehour,$heuremin,0,$remonth,$reday,$reyear));
|
||||
} else {
|
||||
$actioncomm->date = $date;
|
||||
}
|
||||
$actioncomm->type = $actionid;
|
||||
$actioncomm->contact = $contactid;
|
||||
|
||||
$actioncomm->societe = $socid;
|
||||
$actioncomm->note = $note;
|
||||
|
||||
$actioncomm->add($user);
|
||||
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
|
||||
$todo = new TodoComm($db);
|
||||
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
|
||||
|
||||
$todo->libelle = $todo_label;
|
||||
|
||||
$todo->societe = $societe->id;
|
||||
$todo->contact = $contactid;
|
||||
|
||||
$todo->note = $todo_note;
|
||||
|
||||
$todo->add($user);
|
||||
|
||||
$webcal = new Webcal();
|
||||
|
||||
$webcal->heure = $heurehour . $heuremin . '00';
|
||||
$webcal->duree = ($dureehour * 60) + $dureemin;
|
||||
|
||||
if ($actionid == 5) {
|
||||
$libelle = "Rendez-vous avec ".$contact->fullname;
|
||||
$libelle .= "\n" . $todo->libelle;
|
||||
} else {
|
||||
$libelle = $todo->libelle;
|
||||
}
|
||||
|
||||
|
||||
$webcal->add($user, $todo->date, $societe->nom, $libelle);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Liste
|
||||
*
|
||||
*/
|
||||
|
||||
if ($socid) {
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
print_barre_liste("Liste des actions commerciales effectuées sur " . $societe->nom,$page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u";
|
||||
$sql .= " WHERE a.fk_soc = $socid AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
|
||||
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD>Date</TD>';
|
||||
print "<TD>Action</TD>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD width=\"10%\">" .strftime("%Y %b %d %H:%M",$obj->da)."</TD>\n";
|
||||
print '<TD width="30%"><a href="fiche.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
print "</TR>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . '<br>' . $sql;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
print_barre_liste("Liste des actions commerciales effectuées",$page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u";
|
||||
$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
|
||||
|
||||
if ($type) {
|
||||
$sql .= " AND c.id = $type";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
$sql .= $db->plimit( $limit, $offset);
|
||||
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print '<TD colspan="4">Date</TD>';
|
||||
print '<TD>Société</a></td>';
|
||||
print '<TD>Action</a></TD>';
|
||||
print '<TD>Contact</a></TD>';
|
||||
print "<TD align=\"right\">Auteur</TD>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD>" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD>" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<TD width="20%">';
|
||||
|
||||
print ' <a href="/comm/fiche.php3?socid='.$obj->socidp.'">'.$obj->societe.'</A></TD>';
|
||||
|
||||
print '<TD width="30%"><a href="fiche.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
|
||||
/*
|
||||
* Contact
|
||||
*/
|
||||
print '<TD width="30%">';
|
||||
if ($obj->fk_contact) {
|
||||
$cont = new Contact($db);
|
||||
$cont->fetch($obj->fk_contact);
|
||||
print '<a href="/comm/contact.php3?id='.$cont->id.'">'.$cont->fullname.'</a>';
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<TD align=\"right\" width=\"20%\">$obj->code</TD>\n";
|
||||
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . ' ' . $sql ;
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
57
htdocs/comm/action/pre.inc.php3
Normal file
57
htdocs/comm/action/pre.inc.php3
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
require("../../main.inc.php3");
|
||||
|
||||
function llxHeader($head = "", $urlp = "") {
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add("/comm/clients.php3", "Clients");
|
||||
|
||||
$menu->add_submenu("/soc.php3?&action=create", "Nouvelle société");
|
||||
$menu->add_submenu("/comm/contact.php3", "Contacts");
|
||||
|
||||
$menu->add("/comm/action/", "Actions");
|
||||
|
||||
$menu->add("/comm/propal.php3", "Propales");
|
||||
|
||||
$menu->add_submenu("/comm/propal.php3?viewstatut=0", "Brouillons");
|
||||
$menu->add_submenu("/comm/propal.php3?viewstatut=1", "Ouvertes");
|
||||
|
||||
$menu->add("/product/", "Produits");
|
||||
|
||||
$menu->add("/service/", "Services");
|
||||
|
||||
$menu->add("/comm/projet/", "Projets");
|
||||
|
||||
left_menu($menu->liste);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -26,26 +26,39 @@ class ActionComm {
|
|||
|
||||
var $date;
|
||||
var $type;
|
||||
|
||||
var $priority;
|
||||
|
||||
var $user;
|
||||
var $author;
|
||||
|
||||
var $societe;
|
||||
var $contact;
|
||||
var $note;
|
||||
|
||||
var $percent;
|
||||
|
||||
|
||||
Function ActionComm($db) {
|
||||
$this->db = $db;
|
||||
$this->societe = new Societe($db);
|
||||
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function add($user) {
|
||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author, fk_contact, note) ";
|
||||
$sql .= " VALUES ('$this->date',$this->type,$this->societe, $user->id, $this->contact,'$this->note')";
|
||||
Function add($author) {
|
||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author, fk_user_action, fk_contact, percent, note,priority) ";
|
||||
$sql .= " VALUES ('$this->date',$this->type,$this->societe, $author->id,";
|
||||
$sql .= $this->user->id . ", $this->contact, $this->percent, '$this->note', $this->priority);";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
|
||||
|
||||
} else {
|
||||
print $this->db->error() . "<br>" . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
@ -55,24 +68,38 @@ class ActionComm {
|
|||
*/
|
||||
Function fetch($id) {
|
||||
|
||||
$sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note,c.libelle ";
|
||||
$sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note,c.libelle, fk_soc ";
|
||||
$sql .= "FROM actioncomm as a, c_actioncomm as c WHERE a.id=$id AND a.fk_action=c.id;";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
if ($this->db->num_rows()) {
|
||||
$obj = $this->db->fetch_object(0);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->id = $id;
|
||||
$this->type = $obj->libelle;
|
||||
$this->date = $obj->da;
|
||||
$this->note =$obj->note;
|
||||
|
||||
$this->societe->id = $obj->fk_soc;
|
||||
|
||||
$this->db->free();
|
||||
}
|
||||
} else {
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function delete($id) {
|
||||
|
||||
$sql = "DELETE FROM actioncomm WHERE id=$id;";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -51,4 +51,3 @@ class CActioncomm {
|
|||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
|||
217
htdocs/comm/clients.php3
Normal file
217
htdocs/comm/clients.php3
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
require("../contact.class.php3");
|
||||
require("../lib/webcal.class.php3");
|
||||
require("cactioncomm.class.php3");
|
||||
require("actioncomm.class.php3");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield="nom";
|
||||
}
|
||||
|
||||
if ($action=='add_action') {
|
||||
/*
|
||||
* Vient de actioncomm.php3
|
||||
*
|
||||
*/
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->date = $date;
|
||||
$actioncomm->type = $actionid;
|
||||
$actioncomm->contact = $contactid;
|
||||
|
||||
$actioncomm->societe = $socid;
|
||||
$actioncomm->note = $note;
|
||||
|
||||
$actioncomm->add($user);
|
||||
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
|
||||
$todo = new TodoComm($db);
|
||||
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
|
||||
|
||||
$todo->libelle = $todo_label;
|
||||
|
||||
$todo->societe = $societe->id;
|
||||
$todo->contact = $contactid;
|
||||
|
||||
$todo->note = $todo_note;
|
||||
|
||||
$todo->add($user);
|
||||
|
||||
$webcal = new Webcal();
|
||||
$webcal->add($user, $todo->date, $societe->nom, $todo->libelle);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'attribute_prefix') {
|
||||
$societe = new Societe($db, $socid);
|
||||
$societe->attribute_prefix($db, $socid);
|
||||
}
|
||||
|
||||
if ($action == 'recontact') {
|
||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||
$sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'note') {
|
||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'stcomm') {
|
||||
if ($stcommid <> 'null' && $stcommid <> $oldstcomm) {
|
||||
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
||||
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
} else {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
|
||||
if ($actioncommid) {
|
||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if (!$result) {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
/*
|
||||
* Recherche
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($mode == 'search') {
|
||||
if ($mode-search == 'soc') {
|
||||
$sql = "SELECT s.idp FROM societe as s ";
|
||||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
}
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() == 1) {
|
||||
$obj = $db->fetch_object(0);
|
||||
$socid = $obj->idp;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print_barre_liste("Liste des clients", $page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.client=1";
|
||||
|
||||
if (strlen($stcomm)) {
|
||||
$sql .= " AND s.fk_stcomm=$stcomm";
|
||||
}
|
||||
|
||||
if (strlen($begin)) {
|
||||
$sql .= " AND upper(s.nom) like '$begin%'";
|
||||
}
|
||||
|
||||
if ($socname) {
|
||||
$sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
$sortfield = "lower(s.nom)";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if ($sortorder == "DESC") {
|
||||
$sortorder="ASC";
|
||||
} else {
|
||||
$sortorder="DESC";
|
||||
}
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print "<TD valign=\"center\">";
|
||||
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
||||
print "</td><TD>Ville</TD>";
|
||||
print "<TD>email</TD>";
|
||||
print "<TD align=\"center\">Statut</TD><td> </td><td colspan=\"2\"> </td>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"fiche.php3?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
print "<TD>".$obj->ville." </TD>\n";
|
||||
print "<TD> </TD>\n";
|
||||
print "<TD align=\"center\">$obj->stcomm</TD>\n";
|
||||
print "<TD align=\"center\">$obj->prefix_comm </TD>\n";
|
||||
print "<TD align=\"center\"><a href=\"addpropal.php3?socidp=$obj->idp&action=create\">[Propal]</A></td>\n";
|
||||
if ($conf->fichinter->enabled) {
|
||||
print "<TD align=\"center\"><a href=\"../fichinter/fiche.php3?socidp=$obj->idp&action=create\">[Fiche Inter]</A></td>\n";
|
||||
} else {
|
||||
print "<TD> </TD>\n";
|
||||
}
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . ' ' . $sql;
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
|
|
@ -36,21 +36,6 @@ $offset = $limit * $page ;
|
|||
|
||||
print_barre_liste("Liste des contacts",$page, $PHP_SELF);
|
||||
|
||||
print "<DIV align=\"center\">";
|
||||
|
||||
print "| <A href=\"$PHP_SELF?page=$pageprev&stcomm=$stcomm&sortfield=$sortfield&sortorder=$sortorder&aclasser=$aclasser&coord=$coord\">*</A>\n| ";
|
||||
for ($i = 65 ; $i < 91; $i++) {
|
||||
print "<A href=\"$PHP_SELF?begin=" . chr($i) . "&stcomm=$stcomm\" class=\"T3\">";
|
||||
|
||||
if ($begin == chr($i) ) {
|
||||
print "<b>->" . chr($i) . "<-</b>" ;
|
||||
} else {
|
||||
print chr($i) ;
|
||||
}
|
||||
print "</A> | ";
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
@ -114,9 +99,11 @@ if ($result) {
|
|||
print "<TD>$obj->firstname</TD>";
|
||||
|
||||
print '<TD><a href="contact.php3?socid='.$obj->idp.'"><img src="/theme/'.$conf->theme.'/img/filter.png" border="0"></a> ';
|
||||
print "<a href=\"index.php3?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
print "<TD>$obj->email </TD>\n";
|
||||
print '<td><a href="actioncomm.php3?action=create&actionid=1&contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.$obj->phone.'</a> </td>';
|
||||
print "<a href=\"fiche.php3?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=4&contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.$obj->email.'</a> </td>';
|
||||
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=1&contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.$obj->phone.'</a> </td>';
|
||||
|
||||
print "<TD><a href=\"addpropal.php3?socidp=$obj->idp&setcontact=$obj->cidp&action=create\">[Propal]</A></td>\n";
|
||||
print "</TR>\n";
|
||||
|
|
|
|||
543
htdocs/comm/fiche.php3
Normal file
543
htdocs/comm/fiche.php3
Normal file
|
|
@ -0,0 +1,543 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
require("../contact.class.php3");
|
||||
require("../lib/webcal.class.php3");
|
||||
require("cactioncomm.class.php3");
|
||||
require("actioncomm.class.php3");
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield="nom";
|
||||
}
|
||||
|
||||
if ($action=='add_action') {
|
||||
/*
|
||||
* Vient de actioncomm.php3
|
||||
*
|
||||
*/
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->date = $date;
|
||||
$actioncomm->type = $actionid;
|
||||
$actioncomm->contact = $contactid;
|
||||
|
||||
$actioncomm->societe = $socid;
|
||||
$actioncomm->note = $note;
|
||||
|
||||
$actioncomm->add($user);
|
||||
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
|
||||
$todo = new TodoComm($db);
|
||||
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
|
||||
|
||||
$todo->libelle = $todo_label;
|
||||
|
||||
$todo->societe = $societe->id;
|
||||
$todo->contact = $contactid;
|
||||
|
||||
$todo->note = $todo_note;
|
||||
|
||||
$todo->add($user);
|
||||
|
||||
$webcal = new Webcal();
|
||||
$webcal->add($user, $todo->date, $societe->nom, $todo->libelle);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'attribute_prefix') {
|
||||
$societe = new Societe($db, $socid);
|
||||
$societe->attribute_prefix($db, $socid);
|
||||
}
|
||||
|
||||
if ($action == 'recontact') {
|
||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||
$sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'note') {
|
||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'stcomm') {
|
||||
if ($stcommid <> 'null' && $stcommid <> $oldstcomm) {
|
||||
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
||||
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
} else {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
|
||||
if ($actioncommid) {
|
||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if (!$result) {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
/*
|
||||
* Recherche
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($mode == 'search') {
|
||||
if ($mode-search == 'soc') {
|
||||
$sql = "SELECT s.idp FROM societe as s ";
|
||||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
}
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() == 1) {
|
||||
$obj = $db->fetch_object(0);
|
||||
$socid = $obj->idp;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($socid > 0) {
|
||||
$societe = new Societe($db, $socid);
|
||||
|
||||
|
||||
$sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
|
||||
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
|
||||
|
||||
if ($to == 'next') {
|
||||
$sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
||||
} elseif ($to == 'prev') {
|
||||
$sql .= " AND s.idp < $socid ORDER BY idp DESC LIMIT 1";
|
||||
} else {
|
||||
$sql .= " AND s.idp = $socid";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$objsoc = $db->fetch_object(0);
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg) {
|
||||
print "<b>$errmesg</b><br>";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
|
||||
|
||||
print "<tr><td><div class=\"titre\">Fiche client : $objsoc->nom</div></td>";
|
||||
print "<td align=\"center\"><a href=\"index.php3?socidp=$objsoc->idp&action=add_bookmark\">[Bookmark]</a></td>";
|
||||
print "<td align=\"center\"><a href=\"projet/fiche.php3?socidp=$objsoc->idp&action=create\">[Projet]</a></td>";
|
||||
print "<td align=\"center\"><a href=\"addpropal.php3?socidp=$objsoc->idp&action=create\">[Propal]</a></td>";
|
||||
print "<td><a href=\"socnote.php3?socid=$objsoc->idp\">Notes</a></td>";
|
||||
print "<td align=\"center\">[<a href=\"../soc.php3?socid=$objsoc->idp&action=edit\">Editer</a>]</td>";
|
||||
print "</tr></table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
print "<table width=\"100%\" border=0><tr>\n";
|
||||
print "<td valign=\"top\">";
|
||||
print "<table cellspacing=\"0\" border=\"1\" width=\"100%\">";
|
||||
|
||||
print "<tr><td>Type</td><td> $objsoc->typent</td><td>Effectif</td><td>$objsoc->effectif</td></tr>";
|
||||
print "<tr><td>Tel</td><td> $objsoc->tel </td><td>fax</td><td>$objsoc->fax </td></tr>";
|
||||
print "<tr><td>Ville</td><td colspan=\"3\">".nl2br($objsoc->address)."<br>$objsoc->cp $objsoc->ville</td></tr>";
|
||||
|
||||
print "<tr><td>siren</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=$objsoc->siren\">$objsoc->siren</a> </td>";
|
||||
print "<td>prefix</td><td>";
|
||||
if ($objsoc->prefix_comm) {
|
||||
print $objsoc->prefix_comm;
|
||||
} else {
|
||||
print "[<a href=\"$PHP_SELF?socid=$objsoc->idp&action=attribute_prefix\">Attribuer</a>]";
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>Site</td><td colspan=\"3\"><a href=\"http://$objsoc->url\">$objsoc->url</a> </td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "</td>\n";
|
||||
print '<td valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
*
|
||||
* Propales
|
||||
*
|
||||
*/
|
||||
$var=!$var;
|
||||
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">";
|
||||
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
||||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
|
||||
$sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
if ($num >0 ) {
|
||||
print "<tr $bc[$var]><td colspan=\"4\"><a href=\"propal.php3?socidp=$objsoc->idp\">liste des propales ($num)</td></tr>";
|
||||
}
|
||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
||||
while ($i < $num && $i < 4) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"propal.php3?propalid=$objp->propalid\">$objp->ref</a>\n";
|
||||
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) {
|
||||
print " <b>> 15 jours</b>";
|
||||
}
|
||||
print "</td><TD align=\"right\">".strftime("%d %B %Y",$objp->dp)."</TD>\n";
|
||||
print "<TD align=\"right\">".price($objp->price - $objp->remise)."</TD>\n";
|
||||
print "<TD align=\"center\">$objp->statut</TD></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Liste des projets associés
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
|
||||
$sql .= " FROM llx_projet as p WHERE p.fk_soc = $objsoc->idp";
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">";
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows();
|
||||
if ($num > 0) {
|
||||
$tag = !$tag; print "<tr $bc[$tag]>";
|
||||
print "<td colspan=\"2\"><a href=\"projet/index.php3?socidp=$objsoc->idp\">liste des projets ($num)</td></tr>";
|
||||
}
|
||||
while ($i < $num && $i < 5) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
$tag = !$tag;
|
||||
print "<tr $bc[$tag]>";
|
||||
print '<td><a href="projet/fiche.php3?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".$obj->ref ."</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print "</table>";
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print "</td></tr>";
|
||||
print "</table>\n";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action == 'changevalue') {
|
||||
|
||||
print "<HR noshade>";
|
||||
print "<form action=\"index.php3?socid=$objsoc->idp\" method=\"post\">";
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">";
|
||||
print "Cette société est un cabinet de recrutement : ";
|
||||
print "<select name=\"selectvalue\">";
|
||||
print "<option value=\"\">";
|
||||
print "<option value=\"t\">Oui";
|
||||
print "<option value=\"f\">Non";
|
||||
print "</select>";
|
||||
print "<input type=\"submit\" value=\"Mettre à jour\">";
|
||||
print "</form>\n";
|
||||
} else {
|
||||
/*
|
||||
*
|
||||
* Liste des contacts
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=2>";
|
||||
|
||||
print "<tr><td><b>Prénom Nom</b></td>";
|
||||
print '<td><b>Poste</b></td><td><b>Tél</b></td>';
|
||||
print "<td><b>Fax</b></td><td><b>Email</b></td>";
|
||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
|
||||
|
||||
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec";
|
||||
$result = $db->query($sql);
|
||||
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
if ($tag) {
|
||||
print "<tr bgcolor=\"e0e0e0\">";
|
||||
} else {
|
||||
print "<tr>";
|
||||
}
|
||||
print '<td>';
|
||||
//print '<a href="action/fiche.php3?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">';
|
||||
//print '<img border="0" src="/theme/'.$conf->theme.'/img/filenew.png"></a> ';
|
||||
print '<a href="action/fiche.php3?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->firstname.' '. $obj->name.'</a> </td>';
|
||||
|
||||
if ($obj->note) {
|
||||
print "<br><b>".nl2br($obj->note);
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>$obj->poste </td>";
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a> </td>';
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->fax.'</a> </td>';
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a> </td>';
|
||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$tag = !$tag;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print "\n<hr noshade size=1>\n";
|
||||
|
||||
/*
|
||||
*
|
||||
* Listes des actions a faire
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<tr class="liste_titre"><td>Actions à faire</a></td></tr>';
|
||||
print '<tr>';
|
||||
print '<td valign="top">';
|
||||
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u ";
|
||||
$sql .= " WHERE a.fk_soc = $objsoc->idp ";
|
||||
$sql .= " AND u.rowid = a.fk_user_author";
|
||||
$sql .= " AND c.id=a.fk_action AND a.percent < 100";
|
||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n";
|
||||
|
||||
$i = 0 ; $num = $db->num_rows();
|
||||
while ($i < $num) {
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object( $i);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<td width="10%"> </td>';
|
||||
|
||||
if ($obj->propalrowid) {
|
||||
print '<td width="40%"><a href="propal.php3?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%">'.$obj->libelle.'</td>';
|
||||
}
|
||||
/*
|
||||
* Contact pour cette action
|
||||
*
|
||||
*/
|
||||
if ($obj->fk_contact) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($obj->fk_contact);
|
||||
print '<td width="40%"><a href="people.php3?socid='.$objsoc->idp.'&contactid='.$contact->id.'">'.$contact->fullname.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%"> </td>';
|
||||
}
|
||||
/*
|
||||
*/
|
||||
print '<td width="20%"><a href="../user.php3">'.$obj->code.'</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</td></tr></table>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Listes des actions effectuees
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<tr class="liste_titre"><td>Actions effectuées</a></td></tr>';
|
||||
print '<tr>';
|
||||
print '<td valign="top">';
|
||||
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u ";
|
||||
$sql .= " WHERE a.fk_soc = $objsoc->idp ";
|
||||
$sql .= " AND u.rowid = a.fk_user_author";
|
||||
$sql .= " AND c.id=a.fk_action AND a.percent = 100";
|
||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n";
|
||||
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows();
|
||||
$oldyear='';
|
||||
$oldmonth='';
|
||||
while ($i < $num) {
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object( $i);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<td width="10%"> </td>';
|
||||
|
||||
if ($obj->propalrowid) {
|
||||
print '<td width="40%"><a href="propal.php3?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%">'.$obj->libelle.'</td>';
|
||||
}
|
||||
/*
|
||||
* Contact pour cette action
|
||||
*
|
||||
*/
|
||||
if ($obj->fk_contact) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($obj->fk_contact);
|
||||
print '<td width="40%"><a href="people.php3?socid='.$objsoc->idp.'&contactid='.$contact->id.'">'.$contact->fullname.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%"> </td>';
|
||||
}
|
||||
/*
|
||||
*/
|
||||
print '<td width="20%"><a href="../user.php3">'.$obj->code.'</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</td></tr></table>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Notes sur la societe
|
||||
*
|
||||
*/
|
||||
print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
|
||||
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
||||
print "</table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
} else {
|
||||
print $db->error() . "<br>" . $sql;
|
||||
}
|
||||
} else {
|
||||
print "Erreur";
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
|
|
@ -20,580 +20,142 @@
|
|||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
require("../contact.class.php3");
|
||||
require("../lib/webcal.class.php3");
|
||||
require("cactioncomm.class.php3");
|
||||
require("actioncomm.class.php3");
|
||||
require("../todocomm.class.php3");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield="nom";
|
||||
}
|
||||
|
||||
if ($action=='add_action') {
|
||||
/*
|
||||
* Vient de actioncomm.php3
|
||||
*
|
||||
*/
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->date = $date;
|
||||
$actioncomm->type = $actionid;
|
||||
$actioncomm->contact = $contactid;
|
||||
|
||||
$actioncomm->societe = $socid;
|
||||
$actioncomm->note = $note;
|
||||
|
||||
$actioncomm->add($user);
|
||||
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
|
||||
$todo = new TodoComm($db);
|
||||
$todo->date = mktime(12,0,0,$remonth, $reday, $reyear);
|
||||
|
||||
$todo->libelle = $todo_label;
|
||||
|
||||
$todo->societe = $societe->id;
|
||||
$todo->contact = $contactid;
|
||||
|
||||
$todo->note = $todo_note;
|
||||
|
||||
$todo->add($user);
|
||||
|
||||
$webcal = new Webcal();
|
||||
$webcal->add($user, $todo->date, $societe->nom, $todo->libelle);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'attribute_prefix') {
|
||||
$societe = new Societe($db, $socid);
|
||||
$societe->attribute_prefix($db, $socid);
|
||||
}
|
||||
|
||||
if ($action == 'recontact') {
|
||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||
$sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'note') {
|
||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'stcomm') {
|
||||
if ($stcommid <> 'null' && $stcommid <> $oldstcomm) {
|
||||
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
||||
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
} else {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
|
||||
if ($actioncommid) {
|
||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if (!$result) {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
function valeur($sql) {
|
||||
global $db;
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() ) {
|
||||
$valeur = $db->result(0,0);
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
return $valeur;
|
||||
}
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
/*
|
||||
* Recherche
|
||||
*
|
||||
*/
|
||||
$db = new Db();
|
||||
|
||||
|
||||
if ($action == 'add_bookmark') {
|
||||
$sql = "INSERT INTO llx_bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
|
||||
if (! $db->query($sql) ) {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'del_bookmark') {
|
||||
$sql = "DELETE FROM llx_bookmark WHERE rowid=$bid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print_titre("Espace commercial");
|
||||
|
||||
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
|
||||
|
||||
print '<tr><td valign="top" width="30%">';
|
||||
|
||||
print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">';
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<td colspan=\"2\">Propositions commerciales</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 0";
|
||||
if (valeur($sql)) {
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td><a href=\"propal.php3?viewstatut=0\">Brouillons</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
|
||||
}
|
||||
|
||||
$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 1";
|
||||
if (valeur($sql)) {
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td><a href=\"propal.php3?viewstatut=1\">Ouvertes</a></td><td align=\"right\">".valeur($sql)."</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
print "</table><br>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($mode == 'search') {
|
||||
if ($mode-search == 'soc') {
|
||||
$sql = "SELECT s.idp FROM societe as s ";
|
||||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
}
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() == 1) {
|
||||
$obj = $db->fetch_object(0);
|
||||
$socid = $obj->idp;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
$sql = "SELECT s.idp, s.nom,b.rowid as bid";
|
||||
$sql .= " FROM societe as s, llx_bookmark as b";
|
||||
$sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id;
|
||||
$sql .= " ORDER BY lower(s.nom) ASC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<TD colspan=\"2\">Bookmark</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
$var = !$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
|
||||
print '<td align="right"><a href="index.php3?action=del_bookmark&bid='.$obj->bid.'">';
|
||||
print '<img src="/theme/'.$conf->theme.'/img/editdelete.png" border="0"></a></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($socid > 0) {
|
||||
$societe = new Societe($db, $socid);
|
||||
|
||||
*/
|
||||
print '</td><td valign="top" width="70%">';
|
||||
|
||||
$sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
|
||||
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, a.fk_contact";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c";
|
||||
$sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND a.fk_user_action = $user->id";
|
||||
$sql .= " ORDER BY a.datea DESC";
|
||||
|
||||
if ($to == 'next') {
|
||||
$sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
||||
} elseif ($to == 'prev') {
|
||||
$sql .= " AND s.idp < $socid ORDER BY idp DESC LIMIT 1";
|
||||
} else {
|
||||
$sql .= " AND s.idp = $socid";
|
||||
}
|
||||
if ( $db->query($sql) ) {
|
||||
|
||||
$result = $db->query($sql);
|
||||
print '<TABLE border="0" cellspacing="0" cellpadding="3" width="100%">';
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<td colspan=\"2\">Actions à faire</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
if ($result) {
|
||||
$objsoc = $db->fetch_object(0);
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg) {
|
||||
print "<b>$errmesg</b><br>";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
|
||||
|
||||
print "<tr><td><div class=\"titre\">Fiche client : $objsoc->nom</div></td>";
|
||||
print "<td align=\"center\"><a href=\"bookmark.php3?socidp=$objsoc->idp&action=add\">[Bookmark]</a></td>";
|
||||
print "<td align=\"center\"><a href=\"projet/fiche.php3?socidp=$objsoc->idp&action=create\">[Projet]</a></td>";
|
||||
print "<td align=\"center\"><a href=\"addpropal.php3?socidp=$objsoc->idp&action=create\">[Propal]</a></td>";
|
||||
print "<td><a href=\"socnote.php3?socid=$objsoc->idp\">Notes</a></td>";
|
||||
print "<td align=\"center\">[<a href=\"../soc.php3?socid=$objsoc->idp&action=edit\">Editer</a>]</td>";
|
||||
print "</tr></table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
print "<table width=\"100%\" border=0><tr>\n";
|
||||
print "<td valign=\"top\">";
|
||||
print "<table cellspacing=\"0\" border=\"1\" width=\"100%\">";
|
||||
|
||||
print "<tr><td>Type</td><td> $objsoc->typent</td><td>Effectif</td><td>$objsoc->effectif</td></tr>";
|
||||
print "<tr><td>Tel</td><td> $objsoc->tel </td><td>fax</td><td>$objsoc->fax </td></tr>";
|
||||
print "<tr><td>Ville</td><td colspan=\"3\">".nl2br($objsoc->address)."<br>$objsoc->cp $objsoc->ville</td></tr>";
|
||||
|
||||
print "<tr><td>siren</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=$objsoc->siren\">$objsoc->siren</a> </td>";
|
||||
print "<td>prefix</td><td>";
|
||||
if ($objsoc->prefix_comm) {
|
||||
print $objsoc->prefix_comm;
|
||||
} else {
|
||||
print "[<a href=\"$PHP_SELF?socid=$objsoc->idp&action=attribute_prefix\">Attribuer</a>]";
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>Site</td><td colspan=\"3\"><a href=\"http://$objsoc->url\">$objsoc->url</a> </td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "</td>\n";
|
||||
print '<td valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
*
|
||||
* Propales
|
||||
*
|
||||
*/
|
||||
$i = 0;
|
||||
while ($i < $db->num_rows() ) {
|
||||
$obj = $db->fetch_object($i);
|
||||
$var=!$var;
|
||||
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">";
|
||||
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
||||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
|
||||
$sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
if ($num >0 ) {
|
||||
print "<tr $bc[$var]><td colspan=\"4\"><a href=\"propal.php3?socidp=$objsoc->idp\">liste des propales ($num)</td></tr>";
|
||||
}
|
||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
||||
while ($i < $num && $i < 2) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"propal.php3?propalid=$objp->propalid\">$objp->ref</a>\n";
|
||||
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) {
|
||||
print " <b>> 15 jours</b>";
|
||||
}
|
||||
print "</td><TD align=\"right\">".strftime("%d %B %Y",$objp->dp)."</TD>\n";
|
||||
print "<TD align=\"right\">".price($objp->price - $objp->remise)."</TD>\n";
|
||||
print "<TD align=\"center\">$objp->statut</TD></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
/*
|
||||
* Factures
|
||||
*/
|
||||
$var=!$var;
|
||||
$sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
|
||||
$sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC";
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows(); $i = 0;
|
||||
if ($num > 0) {
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td colspan=\"4\"><a href=\"../compta/index.php3?socidp=$objsoc->idp\">liste des factures ($num)</td></tr>";
|
||||
}
|
||||
|
||||
while ($i < $num && $i < 2) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
|
||||
if ($objp->df > 0 ) {
|
||||
print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
||||
} else {
|
||||
print "<TD align=\"right\"><b>!!!</b></TD>\n";
|
||||
}
|
||||
print "<TD align=\"right\">".number_format($objp->amount, 2, ',', ' ')."</TD>\n";
|
||||
$paye[1] = "payée";
|
||||
$paye[0] = "<b>non payée</b>";
|
||||
print "<TD align=\"center\">".$paye[$objp->paye]."</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<tr><td valign=\"top\">";
|
||||
|
||||
|
||||
print "</td><td valign=\"top\">";
|
||||
/*
|
||||
*
|
||||
* Ventes
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT p.rowid,p.label,p.ref,".$db->pdate("v.dated")." as dd,".$db->pdate("v.datef")." as df";
|
||||
$sql .= " FROM llx_product as p, llx_ventes as v WHERE p.rowid = v.fk_product AND v.fk_soc = $objsoc->idp ORDER BY dated DESC";
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">";
|
||||
$i = 0 ; $num = $db->num_rows();
|
||||
if ($num > 0) {
|
||||
$tag = !$tag; print "<tr $bc[$tag]>";
|
||||
print "<td colspan=\"3\"><a href=\"../compta/index.php3?socidp=$objsoc->idp\">liste des ventes ($num)</td></tr>";
|
||||
}
|
||||
while ($i < $num && $i < 5) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
$tag = !$tag;
|
||||
print "<tr $bc[$tag]>";
|
||||
$nw = time();
|
||||
if ($nw <= $obj->df && $nw >= $obj->dd) {
|
||||
print "<td><b>$obj->label</b></td>";
|
||||
} else {
|
||||
print "<td>$obj->label</td>";
|
||||
}
|
||||
print "<td align=\"right\">".strftime("%d %b %Y", $obj->dd) ."</td><td align=\"right\">".strftime("%d %b %Y", $obj->df) ."</tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print "</table>";
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
/*
|
||||
*
|
||||
* Liste des projets associés
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
|
||||
$sql .= " FROM llx_projet as p WHERE p.fk_soc = $objsoc->idp";
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">";
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows();
|
||||
if ($num > 0) {
|
||||
$tag = !$tag; print "<tr $bc[$tag]>";
|
||||
print "<td colspan=\"2\"><a href=\"projet/index.php3?socidp=$objsoc->idp\">liste des projets ($num)</td></tr>";
|
||||
}
|
||||
while ($i < $num && $i < 5) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
$tag = !$tag;
|
||||
print "<tr $bc[$tag]>";
|
||||
print '<td><a href="projet/fiche.php3?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print "</table>";
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print "</td></tr>";
|
||||
print "</table>\n";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action == 'changevalue') {
|
||||
|
||||
print "<HR noshade>";
|
||||
print "<form action=\"index.php3?socid=$objsoc->idp\" method=\"post\">";
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">";
|
||||
print "Cette société est un cabinet de recrutement : ";
|
||||
print "<select name=\"selectvalue\">";
|
||||
print "<option value=\"\">";
|
||||
print "<option value=\"t\">Oui";
|
||||
print "<option value=\"f\">Non";
|
||||
print "</select>";
|
||||
print "<input type=\"submit\" value=\"Mettre à jour\">";
|
||||
print "</form>\n";
|
||||
} else {
|
||||
/*
|
||||
*
|
||||
* Liste des contacts
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=2>";
|
||||
|
||||
print "<tr><td><b>Prénom Nom</b></td>";
|
||||
print '<td><b>Poste</b></td><td><b>Tél</b></td>';
|
||||
print "<td><b>Fax</b></td><td><b>Email</b></td>";
|
||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
|
||||
|
||||
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec";
|
||||
$result = $db->query($sql);
|
||||
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
if ($tag) {
|
||||
print "<tr bgcolor=\"e0e0e0\">";
|
||||
} else {
|
||||
print "<tr>";
|
||||
}
|
||||
print '<td><a href="actioncomm.php3?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->firstname.' '. $obj->name.'</a> </td>';
|
||||
|
||||
if ($obj->note) {
|
||||
print "<br><b>".nl2br($obj->note);
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>$obj->poste </td>";
|
||||
print '<td><a href="actioncomm.php3?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a> </td>';
|
||||
print '<td><a href="actioncomm.php3?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->fax.'</a> </td>';
|
||||
print '<td><a href="actioncomm.php3?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a> </td>';
|
||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$tag = !$tag;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print "\n<hr noshade size=1>\n";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<tr>';
|
||||
print '<td valign="top">';
|
||||
/*
|
||||
*
|
||||
* Listes des actions
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u ";
|
||||
$sql .= " WHERE a.fk_soc = $objsoc->idp ";
|
||||
$sql .= " AND u.rowid = a.fk_user_author";
|
||||
$sql .= " AND c.id=a.fk_action ";
|
||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n";
|
||||
|
||||
$i = 0 ; $num = $db->num_rows();
|
||||
while ($i < $num) {
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object( $i);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<td width="10%"> </td>';
|
||||
|
||||
if ($obj->propalrowid) {
|
||||
print '<td width="40%"><a href="propal.php3?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%">'.$obj->libelle.'</td>';
|
||||
}
|
||||
/*
|
||||
* Contact pour cette action
|
||||
*
|
||||
*/
|
||||
if ($obj->fk_contact) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($obj->fk_contact);
|
||||
print '<td width="40%"><a href="people.php3?socid='.$objsoc->idp.'&contactid='.$contact->id.'">'.$contact->fullname.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%"> </td>';
|
||||
}
|
||||
/*
|
||||
*/
|
||||
print '<td width="20%"><a href="../user.php3">'.$obj->code.'</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</td></tr></table>";
|
||||
/*
|
||||
*
|
||||
* Notes sur la societe
|
||||
*
|
||||
*/
|
||||
print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
|
||||
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
||||
print "</table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
print $db->error() . "<br>" . $sql;
|
||||
print "<tr $bc[$var]><td>".strftime("%d %b %Y",$obj->da)."</td><td><a href=\"action/fiche.php3\">$obj->libelle $obj->label</a></td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print "</table><br>";
|
||||
} else {
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print_barre_liste("Liste des clients", $page, $PHP_SELF);
|
||||
|
||||
$sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.client=1";
|
||||
|
||||
if (strlen($stcomm)) {
|
||||
$sql .= " AND s.fk_stcomm=$stcomm";
|
||||
}
|
||||
|
||||
if (strlen($begin)) {
|
||||
$sql .= " AND upper(s.nom) like '$begin%'";
|
||||
}
|
||||
|
||||
if ($socname) {
|
||||
$sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
$sortfield = "lower(s.nom)";
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
if ($sortorder == "DESC") {
|
||||
$sortorder="ASC";
|
||||
} else {
|
||||
$sortorder="DESC";
|
||||
}
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print '<TR class="liste_titre">';
|
||||
print "<TD valign=\"center\">";
|
||||
print_liste_field_titre("Société",$PHP_SELF,"s.nom");
|
||||
print "</td><TD>Ville</TD>";
|
||||
print "<TD>email</TD>";
|
||||
print "<TD align=\"center\">Statut</TD><td> </td><td colspan=\"2\"> </td>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"index.php3?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
print "<TD>".$obj->ville." </TD>\n";
|
||||
print "<TD> </TD>\n";
|
||||
print "<TD align=\"center\">$obj->stcomm</TD>\n";
|
||||
print "<TD align=\"center\">$obj->prefix_comm </TD>\n";
|
||||
print "<TD align=\"center\"><a href=\"addpropal.php3?socidp=$obj->idp&action=create\">[Propal]</A></td>\n";
|
||||
if ($conf->fichinter->enabled) {
|
||||
print "<TD align=\"center\"><a href=\"../fichinter/fiche.php3?socidp=$obj->idp&action=create\">[Fiche Inter]</A></td>\n";
|
||||
} else {
|
||||
print "<TD> </TD>\n";
|
||||
}
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . ' ' . $sql;
|
||||
}
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -27,17 +27,6 @@ if ($sortorder == "") {
|
|||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
$active["1"] = "Offres en ligne";
|
||||
$active["-1"] = "Moderation";
|
||||
$active["-2"] = "Refusées";
|
||||
$active["0"] = "Rédaction";
|
||||
$active["-3"] = "Désactivées";
|
||||
$active["-4"] = "Supprimées";
|
||||
|
||||
$yn["t"] = "oui";
|
||||
$yn["f"] = "non";
|
||||
$deacmeth["b"] = "robots";
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
$email = trim($email);
|
||||
|
|
@ -47,7 +36,7 @@ if ($action == 'add') {
|
|||
$sql .= " VALUES (now(),$socid,'$name','$firstname','$poste','$phone','$fax','$email')";
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
Header("Location: index.php3?socid=$socid");
|
||||
Header("Location: fiche.php3?socid=$socid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,19 +78,6 @@ if ($socid > 0) {
|
|||
if ($result) {
|
||||
$objsoc = $db->fetch_object( 0);
|
||||
|
||||
|
||||
print "<DIV align=\"center\">";
|
||||
print "<A href=\"$PHP_SELF?page=$pageprev\"><-Prev</A>\n| ";
|
||||
for ($i = 65 ; $i < 91; $i++) {
|
||||
print "<A href=\"index.php3?begin=" . chr($i) . "\" class=\"T3\">" . chr($i) . "</A> | ";
|
||||
}
|
||||
print " <A href=\"$PHP_SELF?socid=$objsoc->idp&to=next\">Next-></A>\n";
|
||||
print "</DIV>";
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg) {
|
||||
print "<b>$errmesg</b><br>";
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
|
|
@ -113,22 +89,7 @@ if ($socid > 0) {
|
|||
print "<td bgcolor=\"#e0E0E0\" align=\"center\">[<a href=\"people.php3?socid=$socid&action=addcontact\">Ajouter un contact</a>]</td>";
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "<hr>";
|
||||
print "<table width=\"100%\" border=0><tr>\n";
|
||||
print "<td valign=\"top\">";
|
||||
print "tel : $objsoc->tel<br>";
|
||||
print "fax : $objsoc->fax<br>";
|
||||
print "$objsoc->cp $objsoc->ville<br>";
|
||||
if ($objsoc->url) {
|
||||
print "<a href=\"http://$objsoc->url\">$objsoc->url</a><br>";
|
||||
}
|
||||
|
||||
print "</td>\n";
|
||||
print "<td valign=\"top\"><table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>";
|
||||
print "<tr><td>Créée le</td><td align=center><b>" . strftime("%d %b %Y %H:%M", $objsoc->dc) . "</b></td></tr>";
|
||||
|
||||
print "</table></td></tr>\n";
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ function llxHeader($head = "", $urlp = "") {
|
|||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add("/comm/index.php3", "Clients");
|
||||
$menu->add("/comm/clients.php3", "Clients");
|
||||
|
||||
$menu->add_submenu("../soc.php3?&action=create", "Nouvelle société");
|
||||
$menu->add_submenu("contact.php3", "Contacts");
|
||||
|
||||
$menu->add("actioncomm.php3", "Actions");
|
||||
$menu->add("/comm/action/", "Actions");
|
||||
|
||||
$menu->add("/comm/propal.php3", "Propales");
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
require("./pre.inc.php3");
|
||||
require("../../societe.class.php3");
|
||||
|
||||
require("./project.class.php3");
|
||||
require("../propal.class.php3");
|
||||
|
||||
|
|
@ -31,9 +31,6 @@ print "<tr><td>Projets</td>";
|
|||
|
||||
print "</table>";
|
||||
|
||||
$bc[0]="bgcolor=\"#90c090\"";
|
||||
$bc[1]="bgcolor=\"#b0e0b0\"";
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($sortfield == "") {
|
||||
|
|
@ -43,15 +40,10 @@ if ($sortorder == "") {
|
|||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
$yn["t"] = "oui";
|
||||
$yn["f"] = "non";
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = 26;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
if ($action == 'create') {
|
||||
|
||||
|
|
@ -87,8 +79,8 @@ if ($action == 'create') {
|
|||
*
|
||||
*/
|
||||
$propales = array();
|
||||
$projet = new Project();
|
||||
$projet->fetch($db, $id);
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($id);
|
||||
|
||||
print '<table border=1 cellpadding="1" cellspacing="0">';
|
||||
print '<tr><td>Société</td><td></td></tr>';
|
||||
|
|
@ -97,7 +89,7 @@ if ($action == 'create') {
|
|||
print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
$propales = $projet->get_propal_list($db);
|
||||
$propales = $projet->get_propal_list();
|
||||
|
||||
if (sizeof($propales)>0 && is_array($propales)) {
|
||||
|
||||
|
|
@ -112,8 +104,8 @@ if ($action == 'create') {
|
|||
print '</TR>';
|
||||
|
||||
for ($i = 0; $i<sizeof($propales);$i++){
|
||||
$propale = new Propal();
|
||||
$propale->fetch($db, $propales[$i]);
|
||||
$propale = new Propal($db);
|
||||
$propale->fetch($propales[$i]);
|
||||
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
|
|
@ -129,8 +121,7 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
print '<tr><td>'.$i.' propales</td>';
|
||||
print '<td align="right"><small>Soit : '.francs($total).' FF HT</small></td>';
|
||||
print '<td colspan="1" align="right"><b>Total : '.price($total).'</b></td>';
|
||||
print '<td colspan="2" align="right"><b>Total : '.price($total).'</b></td>';
|
||||
print '<td align="left"><b>Euros HT</b></td></tr>';
|
||||
print "</TABLE>";
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ if($socidp) {
|
|||
}
|
||||
print '</tr></table>';
|
||||
|
||||
$bc[0]="bgcolor=\"#90c090\"";
|
||||
$bc[1]="bgcolor=\"#b0e0b0\"";
|
||||
|
||||
|
||||
$db = new Db();
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -31,61 +31,28 @@ function llxHeader($head = "", $urlp = "") {
|
|||
*/
|
||||
top_menu($head);
|
||||
|
||||
print "<TR><TD valign=\"top\" align=\"right\">";
|
||||
$menu = new Menu();
|
||||
|
||||
print "<TABLE border=\"1\" cellspacing=\"0\" width=\"100%\" cellpadding=\"3\">";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<TR><TD valign=\"top\" align=\"right\">";
|
||||
print "<div align=\"center\"><A href=\"".$urlp."propal.php3\">Propal</A></div>\n";
|
||||
print "<A href=\"".$urlp."analyse.php3\">Recap</A><br>\n";
|
||||
print "</TD></TR>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<TR><TD valign=\"top\" align=\"right\" bgcolor=\"#e0e0e0\">";
|
||||
$menu->add("/comm/index.php3", "Clients");
|
||||
|
||||
print "<A href=\"".$urlp."../../compta/\">Factures</A><BR>\n";
|
||||
$menu->add_submenu("/soc.php3?&action=create", "Nouvelle société");
|
||||
$menu->add_submenu("/comm/contact.php3", "Contacts");
|
||||
|
||||
print "<A href=\"".$urlp."../../product/\">Produits</A><BR>\n";
|
||||
$menu->add("/comm/action/", "Actions");
|
||||
|
||||
print "</td></tr>";
|
||||
$menu->add("/comm/propal.php3", "Propales");
|
||||
|
||||
print "<tr><td align=\"right\" valign=\"top\">";
|
||||
print "<CENTER><A href=\"".$urlp."index.php3\">Societes</A></CENTER>\n";
|
||||
print "<form action=\"".$urlp."index.php3\">";
|
||||
print '<input type="hidden" name="mode" value="search">';
|
||||
print '<input type="hidden" name="mode-search" value="soc">';
|
||||
print '<input type="text" name="socname" size="8"> ';
|
||||
print "<input type=\"submit\" value=\"go\">";
|
||||
print "</form>";
|
||||
$menu->add_submenu("/comm/propal.php3?viewstatut=0", "Brouillons");
|
||||
$menu->add_submenu("/comm/propal.php3?viewstatut=1", "Ouvertes");
|
||||
|
||||
print "<CENTER><A href=\"".$urlp."index.php3\">Contacts</A></CENTER>\n";
|
||||
print "<form action=\"../index.php3\">";
|
||||
print '<input type="hidden" name="mode" value="search">';
|
||||
print '<input type="hidden" name="mode-search" value="contact">';
|
||||
print "<input type=\"text\" name=\"contactname\" size=\"8\"> ";
|
||||
print "<input type=\"submit\" value=\"go\">";
|
||||
print "</form>";
|
||||
$menu->add("/product/", "Produits");
|
||||
|
||||
$menu->add("/service/", "Services");
|
||||
|
||||
print "<form action=\"index.php3\">";
|
||||
print "<input type=\"text\" name=\"socid\" size=\"5\">";
|
||||
print "<input type=\"submit\" value=\"id\">";
|
||||
print "</form>";
|
||||
print "</td></tr>";
|
||||
$menu->add("/comm/projet/", "Projets");
|
||||
|
||||
print "</table>";
|
||||
left_menu($menu->liste);
|
||||
|
||||
print "</td>";
|
||||
|
||||
|
||||
print "<TD valign=\"top\" width=\"85%\">\n";
|
||||
}
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,13 @@
|
|||
|
||||
class Project {
|
||||
var $id;
|
||||
var $db;
|
||||
var $ref;
|
||||
var $title;
|
||||
var $socidp;
|
||||
|
||||
Function Project() {
|
||||
|
||||
Function Project($DB) {
|
||||
$this->db = $DB;
|
||||
}
|
||||
/*
|
||||
*
|
||||
|
|
@ -36,14 +37,14 @@ class Project {
|
|||
*
|
||||
*/
|
||||
|
||||
Function create($db, $creatorid) {
|
||||
Function create($creatorid) {
|
||||
|
||||
$sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat) ";
|
||||
$sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid) ;";
|
||||
|
||||
if (!$db->query($sql) )
|
||||
if (!$this->db->query($sql) )
|
||||
{
|
||||
print '<b>'.$sql.'</b><br>'.$db->error();
|
||||
print '<b>'.$sql.'</b><br>'.$this->db->error();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -54,22 +55,22 @@ class Project {
|
|||
*
|
||||
*/
|
||||
|
||||
Function fetch($db, $rowid) {
|
||||
Function fetch($rowid) {
|
||||
|
||||
$sql = "SELECT title, ref FROM llx_projet WHERE rowid=$rowid;";
|
||||
|
||||
if ($db->query($sql) ) {
|
||||
if ($db->num_rows()) {
|
||||
$obj = $db->fetch_object(0);
|
||||
if ($this->db->query($sql) ) {
|
||||
if ($this->db->num_rows()) {
|
||||
$obj = $this->db->fetch_object(0);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->title = $obj->title;
|
||||
|
||||
$db->free();
|
||||
$this->db->free();
|
||||
}
|
||||
} else {
|
||||
print $db->error();
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
@ -77,29 +78,29 @@ class Project {
|
|||
*
|
||||
*
|
||||
*/
|
||||
Function get_propal_list($db) {
|
||||
Function get_propal_list() {
|
||||
$propales = array();
|
||||
$sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;";
|
||||
|
||||
if ($db->query($sql) ) {
|
||||
$nump = $db->num_rows();
|
||||
if ($this->db->query($sql) ) {
|
||||
$nump = $this->db->num_rows();
|
||||
if ($nump) {
|
||||
$i = 0;
|
||||
while ($i < $nump) {
|
||||
$obj = $db->fetch_object($i);
|
||||
$obj = $this->db->fetch_object($i);
|
||||
|
||||
$propales[$i] = $obj->rowid;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$this->db->free();
|
||||
/*
|
||||
* Retourne un tableau contenant la liste des propales associees
|
||||
*/
|
||||
return $propales;
|
||||
}
|
||||
} else {
|
||||
print $db->error() . '<br>' .$sql;
|
||||
print $this->db->error() . '<br>' .$sql;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -116,9 +116,8 @@ if ($propalid) {
|
|||
|
||||
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
|
||||
|
||||
print "<tr><td>Société</td><td><a href=\"index.php3?socid=$obj->idp\">$obj->nom</a></td><td align=\"right\"><a href=\"propal.php3?socidp=$obj->idp\">Autres propales</a></td>";
|
||||
print "<td valign=\"top\" width=\"50%\" rowspan=\"8\">Note :<br>". nl2br($obj->note)."</td></tr>";
|
||||
//
|
||||
print "<tr><td>Société</td><td><a href=\"fiche.php3?socid=$obj->idp\">$obj->nom</a></td><td align=\"right\"><a href=\"propal.php3?socidp=$obj->idp\">Autres propales</a></td>";
|
||||
print "<td valign=\"top\" width=\"50%\" rowspan=\"9\">Note :<br>". nl2br($obj->note)."</td></tr>";
|
||||
|
||||
print '<tr><td>date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
|
||||
|
||||
|
|
@ -192,7 +191,7 @@ if ($propalid) {
|
|||
$num = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||
print "<TR bgcolor=\"orange\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<td>Réf</td><td>Produit</td>";
|
||||
print "<td align=\"right\">Prix</TD><td align=\"center\">Qté.</td>";
|
||||
print "</TR>\n";
|
||||
|
|
@ -215,44 +214,7 @@ if ($propalid) {
|
|||
/*
|
||||
*
|
||||
*/
|
||||
print "</td><td valign=\"top\" width=\"50%\">";
|
||||
/*
|
||||
* Factures associees
|
||||
*/
|
||||
$sql = "SELECT f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.rowid as facid, f.author, f.paye";
|
||||
$sql .= " FROM llx_facture as f, llx_fa_pr as fp WHERE fp.fk_facture = f.rowid AND fp.fk_propal = $propalid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
print "<p><b>Facture(s) associée(s)</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||
print "<tr>";
|
||||
print "<td>Num</td>";
|
||||
print "<td>Date</td>";
|
||||
print "<td>Auteur</td>";
|
||||
print "<td align=\"right\">Prix</TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR bgcolor=\"#e0e0e0\">";
|
||||
print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a>";
|
||||
if ($objp->paye) { print " (<b>payée</b>)"; }
|
||||
print "</TD>\n";
|
||||
print "<TD>".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
||||
print "<TD>$objp->author</TD>\n";
|
||||
print "<TD align=\"right\">$objp->amount</TD>\n";
|
||||
print "</tr>";
|
||||
$total = $total + $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
print "<tr><td align=\"right\" colspan=\"4\">Total : <b>$total</b> Euros HT</td></tr>\n";
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -548,7 +510,7 @@ if ($propalid) {
|
|||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"$PHP_SELF?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
|
||||
print "<TD><a href=\"index.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||||
print "<TD><a href=\"fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||||
|
||||
$now = time();
|
||||
$lim = 3600 * 24 * 15 ;
|
||||
|
|
|
|||
475
htdocs/compta/fiche.php3
Normal file
475
htdocs/compta/fiche.php3
Normal file
|
|
@ -0,0 +1,475 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
require("../contact.class.php3");
|
||||
require("../lib/webcal.class.php3");
|
||||
require("cactioncomm.class.php3");
|
||||
require("actioncomm.class.php3");
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
if ($sortfield == "") {
|
||||
$sortfield="nom";
|
||||
}
|
||||
|
||||
if ($action=='add_action') {
|
||||
/*
|
||||
* Vient de actioncomm.php3
|
||||
*
|
||||
*/
|
||||
$actioncomm = new ActionComm($db);
|
||||
$actioncomm->date = $date;
|
||||
$actioncomm->type = $actionid;
|
||||
$actioncomm->contact = $contactid;
|
||||
|
||||
$actioncomm->societe = $socid;
|
||||
$actioncomm->note = $note;
|
||||
|
||||
$actioncomm->add($user);
|
||||
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'attribute_prefix') {
|
||||
$societe = new Societe($db, $socid);
|
||||
$societe->attribute_prefix($db, $socid);
|
||||
}
|
||||
|
||||
if ($action == 'recontact') {
|
||||
$dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
|
||||
$sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'note') {
|
||||
$sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
}
|
||||
|
||||
if ($action == 'stcomm') {
|
||||
if ($stcommid <> 'null' && $stcommid <> $oldstcomm) {
|
||||
$sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
|
||||
$sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
|
||||
$result = $db->query($sql);
|
||||
} else {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
|
||||
if ($actioncommid) {
|
||||
$sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')";
|
||||
$result = @$db->query($sql);
|
||||
|
||||
if (!$result) {
|
||||
$errmesg = "ERREUR DE DATE !";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
|
||||
/*
|
||||
* Recherche
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($mode == 'search') {
|
||||
if ($mode-search == 'soc') {
|
||||
$sql = "SELECT s.idp FROM societe as s ";
|
||||
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
|
||||
}
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
if ( $db->num_rows() == 1) {
|
||||
$obj = $db->fetch_object(0);
|
||||
$socid = $obj->idp;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($socid > 0) {
|
||||
$societe = new Societe($db, $socid);
|
||||
|
||||
|
||||
$sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
|
||||
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
|
||||
|
||||
if ($to == 'next') {
|
||||
$sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
|
||||
} elseif ($to == 'prev') {
|
||||
$sql .= " AND s.idp < $socid ORDER BY idp DESC LIMIT 1";
|
||||
} else {
|
||||
$sql .= " AND s.idp = $socid";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$objsoc = $db->fetch_object(0);
|
||||
|
||||
$dac = strftime("%Y-%m-%d %H:%M", time());
|
||||
if ($errmesg) {
|
||||
print "<b>$errmesg</b><br>";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
|
||||
|
||||
print "<tr><td><div class=\"titre\">Fiche client : $objsoc->nom</div></td>";
|
||||
print "<td align=\"center\"><a href=\"bookmark.php3?socidp=$objsoc->idp&action=add\">[Bookmark]</a></td>";
|
||||
print "<td align=\"center\"><a href=\"projet/fiche.php3?socidp=$objsoc->idp&action=create\">[Projet]</a></td>";
|
||||
print "<td align=\"center\"><a href=\"addpropal.php3?socidp=$objsoc->idp&action=create\">[Propal]</a></td>";
|
||||
print "<td><a href=\"socnote.php3?socid=$objsoc->idp\">Notes</a></td>";
|
||||
print "<td align=\"center\">[<a href=\"../soc.php3?socid=$objsoc->idp&action=edit\">Editer</a>]</td>";
|
||||
print "</tr></table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
print "<table width=\"100%\" border=0><tr>\n";
|
||||
print "<td valign=\"top\">";
|
||||
print "<table cellspacing=\"0\" border=\"1\" width=\"100%\">";
|
||||
|
||||
print "<tr><td>Type</td><td> $objsoc->typent</td><td>Effectif</td><td>$objsoc->effectif</td></tr>";
|
||||
print "<tr><td>Tel</td><td> $objsoc->tel </td><td>fax</td><td>$objsoc->fax </td></tr>";
|
||||
print "<tr><td>Ville</td><td colspan=\"3\">".nl2br($objsoc->address)."<br>$objsoc->cp $objsoc->ville</td></tr>";
|
||||
|
||||
print "<tr><td>siren</td><td><a href=\"http://www.societe.com/cgi-bin/recherche?rncs=$objsoc->siren\">$objsoc->siren</a> </td>";
|
||||
print "<td>prefix</td><td>";
|
||||
if ($objsoc->prefix_comm) {
|
||||
print $objsoc->prefix_comm;
|
||||
} else {
|
||||
print "[<a href=\"$PHP_SELF?socid=$objsoc->idp&action=attribute_prefix\">Attribuer</a>]";
|
||||
}
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
print "<tr><td>Site</td><td colspan=\"3\"><a href=\"http://$objsoc->url\">$objsoc->url</a> </td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "</td>\n";
|
||||
print '<td valign="top" width="50%">';
|
||||
|
||||
/*
|
||||
*
|
||||
* Propales
|
||||
*
|
||||
*/
|
||||
$var=!$var;
|
||||
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">";
|
||||
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
||||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
|
||||
$sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
if ($num >0 ) {
|
||||
print "<tr $bc[$var]><td colspan=\"4\"><a href=\"propal.php3?socidp=$objsoc->idp\">liste des propales ($num)</td></tr>";
|
||||
}
|
||||
$i = 0; $now = time(); $lim = 3600 * 24 * 15 ;
|
||||
while ($i < $num && $i < 2) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"propal.php3?propalid=$objp->propalid\">$objp->ref</a>\n";
|
||||
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) {
|
||||
print " <b>> 15 jours</b>";
|
||||
}
|
||||
print "</td><TD align=\"right\">".strftime("%d %B %Y",$objp->dp)."</TD>\n";
|
||||
print "<TD align=\"right\">".price($objp->price - $objp->remise)."</TD>\n";
|
||||
print "<TD align=\"center\">$objp->statut</TD></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
}
|
||||
/*
|
||||
* Factures
|
||||
*/
|
||||
$var=!$var;
|
||||
$sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
|
||||
$sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC";
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows(); $i = 0;
|
||||
if ($num > 0) {
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td colspan=\"4\"><a href=\"../compta/index.php3?socidp=$objsoc->idp\">liste des factures ($num)</td></tr>";
|
||||
}
|
||||
|
||||
while ($i < $num && $i < 2) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
|
||||
if ($objp->df > 0 ) {
|
||||
print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
||||
} else {
|
||||
print "<TD align=\"right\"><b>!!!</b></TD>\n";
|
||||
}
|
||||
print "<TD align=\"right\">".number_format($objp->amount, 2, ',', ' ')."</TD>\n";
|
||||
$paye[1] = "payée";
|
||||
$paye[0] = "<b>non payée</b>";
|
||||
print "<TD align=\"center\">".$paye[$objp->paye]."</TD>\n";
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Liste des projets associés
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
|
||||
$sql .= " FROM llx_projet as p WHERE p.fk_soc = $objsoc->idp";
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">";
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows();
|
||||
if ($num > 0) {
|
||||
$tag = !$tag; print "<tr $bc[$tag]>";
|
||||
print "<td colspan=\"2\"><a href=\"projet/index.php3?socidp=$objsoc->idp\">liste des projets ($num)</td></tr>";
|
||||
}
|
||||
while ($i < $num && $i < 5) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
$tag = !$tag;
|
||||
print "<tr $bc[$tag]>";
|
||||
print '<td><a href="projet/fiche.php3?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||
|
||||
print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print "</table>";
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print "</td></tr>";
|
||||
print "</table>\n";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action == 'changevalue') {
|
||||
|
||||
print "<HR noshade>";
|
||||
print "<form action=\"index.php3?socid=$objsoc->idp\" method=\"post\">";
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">";
|
||||
print "Cette société est un cabinet de recrutement : ";
|
||||
print "<select name=\"selectvalue\">";
|
||||
print "<option value=\"\">";
|
||||
print "<option value=\"t\">Oui";
|
||||
print "<option value=\"f\">Non";
|
||||
print "</select>";
|
||||
print "<input type=\"submit\" value=\"Mettre à jour\">";
|
||||
print "</form>\n";
|
||||
} else {
|
||||
/*
|
||||
*
|
||||
* Liste des contacts
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=2>";
|
||||
|
||||
print "<tr><td><b>Prénom Nom</b></td>";
|
||||
print '<td><b>Poste</b></td><td><b>Tél</b></td>';
|
||||
print "<td><b>Fax</b></td><td><b>Email</b></td>";
|
||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
|
||||
|
||||
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp ORDER by p.datec";
|
||||
$result = $db->query($sql);
|
||||
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object( $i);
|
||||
if ($tag) {
|
||||
print "<tr bgcolor=\"e0e0e0\">";
|
||||
} else {
|
||||
print "<tr>";
|
||||
}
|
||||
print '<td>';
|
||||
//print '<a href="action/fiche.php3?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">';
|
||||
//print '<img border="0" src="/theme/'.$conf->theme.'/img/filenew.png"></a> ';
|
||||
print '<a href="action/fiche.php3?action=create&actionid=5&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->firstname.' '. $obj->name.'</a> </td>';
|
||||
|
||||
if ($obj->note) {
|
||||
print "<br><b>".nl2br($obj->note);
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>$obj->poste </td>";
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a> </td>';
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->fax.'</a> </td>';
|
||||
print '<td><a href="action/fiche.php3?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a> </td>';
|
||||
print "<td><a href=\"people.php3?socid=$objsoc->idp&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
$tag = !$tag;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print "\n<hr noshade size=1>\n";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print '<table width="100%" cellspacing=0 border=0 cellpadding=2>';
|
||||
print '<tr>';
|
||||
print '<td valign="top">';
|
||||
/*
|
||||
*
|
||||
* Listes des actions
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid ";
|
||||
$sql .= " FROM actioncomm as a, c_actioncomm as c, llx_user as u ";
|
||||
$sql .= " WHERE a.fk_soc = $objsoc->idp ";
|
||||
$sql .= " AND u.rowid = a.fk_user_author";
|
||||
$sql .= " AND c.id=a.fk_action ";
|
||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n";
|
||||
|
||||
$i = 0 ; $num = $db->num_rows();
|
||||
while ($i < $num) {
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object( $i);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($oldyear == strftime("%Y",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%Y",$obj->da)."</TD>\n";
|
||||
$oldyear = strftime("%Y",$obj->da);
|
||||
}
|
||||
|
||||
if ($oldmonth == strftime("%Y%b",$obj->da) ) {
|
||||
print '<td align="center">|</td>';
|
||||
} else {
|
||||
print "<TD align=\"center\">" .strftime("%b",$obj->da)."</TD>\n";
|
||||
$oldmonth = strftime("%Y%b",$obj->da);
|
||||
}
|
||||
|
||||
print "<TD>" .strftime("%d",$obj->da)."</TD>\n";
|
||||
print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
|
||||
|
||||
print '<td width="10%"> </td>';
|
||||
|
||||
if ($obj->propalrowid) {
|
||||
print '<td width="40%"><a href="propal.php3?propalid='.$obj->propalrowid.'">'.$obj->libelle.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%">'.$obj->libelle.'</td>';
|
||||
}
|
||||
/*
|
||||
* Contact pour cette action
|
||||
*
|
||||
*/
|
||||
if ($obj->fk_contact) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($obj->fk_contact);
|
||||
print '<td width="40%"><a href="people.php3?socid='.$objsoc->idp.'&contactid='.$contact->id.'">'.$contact->fullname.'</a></td>';
|
||||
} else {
|
||||
print '<td width="40%"> </td>';
|
||||
}
|
||||
/*
|
||||
*/
|
||||
print '<td width="20%"><a href="../user.php3">'.$obj->code.'</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
print "</td></tr></table>";
|
||||
/*
|
||||
*
|
||||
* Notes sur la societe
|
||||
*
|
||||
*/
|
||||
print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
|
||||
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
||||
print "</table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
||||
} else {
|
||||
print $db->error() . "<br>" . $sql;
|
||||
}
|
||||
} else {
|
||||
print "Erreur";
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
596
htdocs/compta/propal.php3
Normal file
596
htdocs/compta/propal.php3
Normal file
|
|
@ -0,0 +1,596 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php3");
|
||||
|
||||
require("../lib/CMailFile.class.php3");
|
||||
/*
|
||||
* Modules optionnels
|
||||
*/
|
||||
require("projet/project.class.php3");
|
||||
require("./propal.class.php3");
|
||||
require("./actioncomm.class.php3");
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$db = new Db();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(p.label)";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
$yn["t"] = "oui";
|
||||
$yn["f"] = "non";
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = 26;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if ($action == 'setstatut') {
|
||||
/*
|
||||
* Cloture de la propale
|
||||
*/
|
||||
$propal = new Propal($db);
|
||||
$propal->id = $propalid;
|
||||
$propal->cloture($user->id, $statut, $note);
|
||||
|
||||
} elseif ( $action == 'delete' ) {
|
||||
$sql = "DELETE FROM llx_propal WHERE rowid = $propalid;";
|
||||
if ( $db->query($sql) ) {
|
||||
|
||||
$sql = "DELETE FROM llx_propaldet WHERE fk_propal = $propalid ;";
|
||||
if ( $db->query($sql) ) {
|
||||
print "<b><font color=\"red\">Propal supprimée</font></b>";
|
||||
} else {
|
||||
print $db->error();
|
||||
print "<p>$sql";
|
||||
}
|
||||
} else {
|
||||
print $db->error();
|
||||
print "<p>$sql";
|
||||
}
|
||||
$propalid = 0;
|
||||
$brouillon = 1;
|
||||
}
|
||||
/*
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($propalid) {
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($propalid);
|
||||
|
||||
|
||||
if ($valid == 1) {
|
||||
$propal->valid($user->id);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\">";
|
||||
print "<tr><td><div class=\"titre\">Proposition commerciale : $propal->ref</div></td>";
|
||||
print "</table>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.note, x.firstname, x.name, x.fax, x.phone, x.email, p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture";
|
||||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c, socpeople as x";
|
||||
$sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND x.idp = p.fk_soc_contact AND p.rowid = $propalid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ( $result ) {
|
||||
$obj = $db->fetch_object( 0 );
|
||||
|
||||
if ($db->num_rows()) {
|
||||
|
||||
$color1 = "#e0e0e0";
|
||||
|
||||
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">";
|
||||
|
||||
print "<tr><td>Société</td><td><a href=\"fiche.php3?socid=$obj->idp\">$obj->nom</a></td><td align=\"right\"><a href=\"propal.php3?socidp=$obj->idp\">Autres propales</a></td>";
|
||||
print "<td valign=\"top\" width=\"50%\" rowspan=\"8\">Note :<br>". nl2br($obj->note)."</td></tr>";
|
||||
//
|
||||
|
||||
print '<tr><td>date</td><td colspan="2">'.strftime("%A %d %B %Y",$obj->dp).'</td></tr>';
|
||||
|
||||
if ($obj->fk_projet) {
|
||||
$projet = new Project();
|
||||
$projet->fetch($db,$obj->fk_projet);
|
||||
print '<tr><td>Projet</td><td colspan="1">';
|
||||
print '<a href="projet/fiche.php3?id='.$projet->id.'">';
|
||||
print $projet->title.'</a></td></tr>';
|
||||
}
|
||||
print "<tr><td>Destinataire</td><td colspan=\"2\">$obj->firstname $obj->name <$obj->email></td></tr>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
print "<tr><td bgcolor=\"$color1\">Montant HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->price)." euros</td></tr>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
print "<tr><td bgcolor=\"$color1\">Remise</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\">".price($obj->remise)." euros</td></tr>";
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
$totalht = $propal->price - $propal->remise ;
|
||||
|
||||
print "<tr><td bgcolor=\"$color1\">Total HT</td><td colspan=\"2\" bgcolor=\"$color1\" align=\"right\"><b>".price($totalht)."</b> euros</td></tr>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print '<tr><td>Auteur</td><td colspan="2">';
|
||||
$author = new User($db, $obj->fk_user_author);
|
||||
$author->fetch('');
|
||||
print $author->fullname.'</td></tr>';
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<tr bgcolor=\"#f0f0f0\"><td>Statut :</td><td colspan=2 align=center><b>$obj->lst</b></td>";
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($action == 'statut') {
|
||||
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
|
||||
print "<select name=\"statut\">";
|
||||
print "<option value=\"2\">Signée";
|
||||
print "<option value=\"3\">Non Signée";
|
||||
print '</select>';
|
||||
print '<br><textarea cols="60" rows="6" wrap="soft" name="note">';
|
||||
print $obj->note . "\n----------\n";
|
||||
print '</textarea><br><input type="submit" value="Valider">';
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
|
||||
print "<table width=\"100%\" cellspacing=2><tr><td valign=\"top\">";
|
||||
/*
|
||||
* Produits
|
||||
*/
|
||||
$sql = "SELECT p.label as product, p.ref, pt.price, pt.qty";
|
||||
$sql .= " FROM llx_propaldet as pt, llx_product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
print "<p><b>Produits</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||
print "<TR bgcolor=\"orange\">";
|
||||
print "<td>Réf</td><td>Produit</td>";
|
||||
print "<td align=\"right\">Prix</TD><td align=\"center\">Qté.</td>";
|
||||
print "</TR>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD>[$objp->ref]</TD>\n";
|
||||
print "<TD>$objp->product</TD>\n";
|
||||
print "<TD align=\"right\">".price($objp->price)."</TD><td align=\"center\">".$objp->qty."</td>\n";
|
||||
print "</tr>";
|
||||
$total = $total + $objp->price;
|
||||
$i++;
|
||||
}
|
||||
//print "<tr><td align=\"right\" colspan=\"3\">Total : <b>".price($total)."</b></td><td>Euros HT</td></tr>\n";
|
||||
print "</table>";
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "</td><td valign=\"top\" width=\"50%\">";
|
||||
/*
|
||||
* Factures associees
|
||||
*/
|
||||
$sql = "SELECT f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.rowid as facid, f.author, f.paye";
|
||||
$sql .= " FROM llx_facture as f, llx_fa_pr as fp WHERE fp.fk_facture = f.rowid AND fp.fk_propal = $propalid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
print "<p><b>Facture(s) associée(s)</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||
print "<tr>";
|
||||
print "<td>Num</td>";
|
||||
print "<td>Date</td>";
|
||||
print "<td>Auteur</td>";
|
||||
print "<td align=\"right\">Prix</TD>";
|
||||
print "</TR>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR bgcolor=\"#e0e0e0\">";
|
||||
print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a>";
|
||||
if ($objp->paye) { print " (<b>payée</b>)"; }
|
||||
print "</TD>\n";
|
||||
print "<TD>".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
||||
print "<TD>$objp->author</TD>\n";
|
||||
print "<TD align=\"right\">$objp->amount</TD>\n";
|
||||
print "</tr>";
|
||||
$total = $total + $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
print "<tr><td align=\"right\" colspan=\"4\">Total : <b>$total</b> Euros HT</td></tr>\n";
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
print "</table>";
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
print "<p><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr>";
|
||||
|
||||
if ($obj->statut == 0) {
|
||||
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&action=delete\">Supprimer</a>]</td>";
|
||||
} else {
|
||||
if ($obj->statut == 1) {
|
||||
print "<td bgcolor=\"#e0e0e0\" align=center>[<a href=\"$PHP_SELF?propalid=$propalid&action=statut\">Cloturer</a>]</td>";
|
||||
} else {
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
}
|
||||
if ($obj->statut == 2) {
|
||||
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\"><a href=\"facture.php3?propalid=$propalid&action=create\">Emettre une facture</td>";
|
||||
} else {
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
if ($obj->statut == 1) {
|
||||
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
|
||||
if (file_exists($file)) {
|
||||
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">";
|
||||
print "[<a href=\"$PHP_SELF?propalid=$propalid&action=presend\">Envoyer la propale par mail</a>]</td>";
|
||||
} else {
|
||||
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">! Propale non generee !</td>";
|
||||
}
|
||||
} else {
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
if ($obj->statut == 0) {
|
||||
print "<td bgcolor=\"#e0e0e0\" align=\"center\" width=\"25%\">[<a href=\"$PHP_SELF?propalid=$propalid&valid=1\">Valider</a>]</td>";
|
||||
} else {
|
||||
print "<td align=\"center\" width=\"25%\">-</td>";
|
||||
}
|
||||
print "</tr></table>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
if ($action == 'fax') {
|
||||
print "<hr><b>Génération du fax</b><br>";
|
||||
$command = "export DBI_DSN=\"dbi:mysql:dbname=lolixfr:host=espy:user=rodo\" ";
|
||||
$command .= " ; ../../scripts/propal-tex.pl --propal=$propalid --pdf --gljroot=" . $GLOBALS["GLJ_ROOT"] ;
|
||||
//$command .= " ; ../../scripts/fax-tex.pl --propal=$propalid --gljroot=" . $GLOBALS["GLJ_ROOT"] ;
|
||||
|
||||
print "<p>Resultat :<p>";
|
||||
|
||||
$output = system($command);
|
||||
print "<p>command : $command<br>";
|
||||
}
|
||||
/*
|
||||
* Send
|
||||
*
|
||||
*/
|
||||
if ($action == 'send') {
|
||||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propal/$obj->ref/$obj->ref.pdf";
|
||||
if (file_exists($file)) {
|
||||
|
||||
$subject = "Notre proposition commerciale $obj->ref";
|
||||
$message = "Veuillez trouver ci-joint notre proposition commerciale $obj->ref\n\nCordialement\n\n";
|
||||
$filepath = $file ;
|
||||
$filename = "$obj->ref.pdf";
|
||||
$mimetype = "application/pdf";
|
||||
|
||||
$replyto = "$replytoname <$replytomail>";
|
||||
|
||||
$mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype, $filename);
|
||||
|
||||
if ( $mailfile->sendfile() ) {
|
||||
|
||||
print "<p>envoyé à $sendto";
|
||||
print "<p>envoyé par ".htmlentities($replyto);
|
||||
} else {
|
||||
print "<b>!! erreur d'envoi";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Enregistre l'action
|
||||
*
|
||||
* Ne fonctionne pas, a corriger !
|
||||
*/
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$sql = "INSERT INTO actioncomm (datea,fk_action,fk_soc, propalrowid,note, fk_user_author) ";
|
||||
$sql .= " VALUES (now(), 3, $obj->idp, $propalid, 'Envoyée à $sendto',$user->id);";
|
||||
if (! $db->query($sql) ) {
|
||||
print $db->error();
|
||||
print "<p>$sql</p>";
|
||||
}
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "<hr>";
|
||||
print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
|
||||
print "<b>Documents générés</b><br>";
|
||||
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=3>";
|
||||
|
||||
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf";
|
||||
if (file_exists($file)) {
|
||||
print "<tr><td>Propale PDF</a></td>";
|
||||
print '<td><a href="'.$conf->propal->outputurl.'/'.$obj->ref.'/'.$obj->ref.'.pdf">'.$obj->ref.'.pdf</a></td></tr>';
|
||||
}
|
||||
$file = $conf->propal->outputdir . "/$obj->ref/$obj->ref.ps";
|
||||
if (file_exists($file)) {
|
||||
print "<tr><td>Propale Postscript</a></td>";
|
||||
print '<td><a href="'.$conf->propal->outputurl.'/'.$obj->ref.'/'.$obj->ref.'.ps">'.$obj->ref.'.s</a></td></tr>';
|
||||
print "</tr>";
|
||||
}
|
||||
print '<tr><td colspan="2">(<a href="'.$conf->propal->outputurl.'/'.$obj->ref.'">liste...</a>)</td></tr>';
|
||||
|
||||
$file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propale/$obj->ref/FAX-$obj->ref.ps";
|
||||
if (file_exists($file)) {
|
||||
print "<tr><td><a href=\"../../doc/fax/\">FAX d'entete</a></td></tr>";
|
||||
}
|
||||
print "</table>\n";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "</td><td valign=\"top\" width=\"50%\">";
|
||||
print "<b>Propale envoyée</b><br>";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT ".$db->pdate("a.datea"). " as da, note, fk_user_author" ;
|
||||
$sql .= " FROM actioncomm as a WHERE a.fk_soc = $obj->idp AND a.propalrowid = $propalid ";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0; $total = 0;
|
||||
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||
print "<tr><td>Date</td><td>Auteur</td></TR>\n";
|
||||
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
print "<TR><TD>".strftime("%d %B %Y %H:%M:%S",$objp->da)."</TD>\n";
|
||||
$authoract = new User($db);
|
||||
$authoract->id = $objp->fk_user_author;
|
||||
$authoract->fetch('');
|
||||
print "<TD>$authoract->code</TD></tr>\n";
|
||||
print "<tr><td colspan=\"2\">$objp->note</td></tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
print "</td></tr></table>";
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action == 'presend') {
|
||||
$sendto = "rq@lolix.org";
|
||||
|
||||
$replytoname = $conf->propal->replytoname;
|
||||
$replytomail = $conf->propal->replytomail;
|
||||
|
||||
$from_name = $user->fullname ; //$conf->propal->fromtoname;
|
||||
$from_mail = $user->email; //conf->propal->fromtomail;
|
||||
|
||||
print "<form method=\"post\" action=\"$PHP_SELF?propalid=$propalid&action=send\">\n";
|
||||
print "<input type=\"hidden\" name=\"sendto\" value=\"$sendto\">\n";
|
||||
print "<input type=\"hidden\" name=\"replytoname\" value=\"$replytoname\">\n";
|
||||
print "<input type=\"hidden\" name=\"replytomail\" value=\"$replytomail\">\n";
|
||||
|
||||
print "<p><b>Envoyer la propale par mail</b>";
|
||||
print "<table cellspacing=0 border=1 cellpadding=3>";
|
||||
print "<tr><td>Destinataire</td><td colspan=\"5\">$obj->firstname $obj->name</td>";
|
||||
print "<td><input size=\"30\" name=\"sendto\" value=\"$obj->email\"></td></tr>";
|
||||
print "<tr><td>Expediteur</td><td colspan=\"5\">$from_name</td><td>$from_mail</td></tr>";
|
||||
print "<tr><td>Reply-to</td><td colspan=\"5\">$replytoname</td>";
|
||||
print "<td>$replytomail</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
print "<input type=\"submit\" value=\"Envoyer\">";
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
} else {
|
||||
print "Num rows = " . $db->num_rows();
|
||||
print "<p><b>$sql";
|
||||
}
|
||||
/*
|
||||
* Voir le suivi des actions
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($suivi) {
|
||||
$validor = new User($db, $obj->fk_user_valid);
|
||||
$validor->fetch('');
|
||||
$cloturor = new User($db, $obj->fk_user_cloture);
|
||||
$cloturor->fetch('');
|
||||
|
||||
print 'Suivi des actions<br>';
|
||||
print '<table cellspacing=0 border=1 cellpadding=3>';
|
||||
print '<tr><td> </td><td>Nom</td><td>Date</td></tr>';
|
||||
print '<tr><td>Création</td><td>'.$author->fullname.'</td>';
|
||||
print '<td>'.$obj->datec.'</td></tr>';
|
||||
|
||||
print '<tr><td>Validation</td><td>'.$validor->fullname.' </td>';
|
||||
print '<td>'.$obj->date_valid.' </td></tr>';
|
||||
|
||||
print '<tr><td>Cloture</td><td>'.$cloturor->fullname.' </td>';
|
||||
print '<td>'.$obj->date_cloture.' </td></tr>';
|
||||
print '</table>';
|
||||
} else {
|
||||
print '<p><a href="'.$PHP_SELF.'?propalid='.$propal->id.'&suivi=1">Voir le suivi des actions </a>';
|
||||
}
|
||||
|
||||
} else {
|
||||
print $db->error();
|
||||
print "<p><b>$sql";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
} else {
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Mode Liste des propales
|
||||
*
|
||||
*
|
||||
*/
|
||||
print "<table width=\"100%\">";
|
||||
print "<tr><td><div class=\"titre\">Propositions commerciales</div></td>";
|
||||
print "</table>";
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
|
||||
$sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
|
||||
|
||||
if ($socidp) {
|
||||
$sql .= " AND s.idp = $socidp";
|
||||
}
|
||||
|
||||
if ($viewstatut <> '') {
|
||||
$sql .= " AND c.id = $viewstatut";
|
||||
}
|
||||
|
||||
if ($month > 0) {
|
||||
$sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'";
|
||||
}
|
||||
if ($year > 0) {
|
||||
$sql .= " AND date_format(p.datep, '%Y') = $year";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY p.fk_statut, datep DESC";
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
|
||||
$oldstatut = -1;
|
||||
$subtotal = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
|
||||
if ($objp->statut <> $oldstatut ) {
|
||||
$oldstatut = $objp->statut;
|
||||
|
||||
if ($i > 0) {
|
||||
print "<tr><td align=\"right\" colspan=\"5\">Total : <b>".price($subtotal)."</b></td>\n";
|
||||
print "<td align=\"left\">Euros HT</td></tr>\n";
|
||||
}
|
||||
$subtotal = 0;
|
||||
|
||||
print '<TR class="liste_titre">';
|
||||
print "<TD>Réf</TD>";
|
||||
print "<TD>Société</td>";
|
||||
print "<TD align=\"right\" colspan=\"2\">Date</TD>";
|
||||
print "<TD align=\"right\">Prix</TD>";
|
||||
print "<TD align=\"center\">Statut <a href=\"$PHP_SELF?viewstatut=$objp->statutid\">";
|
||||
print '<img src="/theme/'.$conf->theme.'/img/filter.png" border="0"></a></td>';
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"$PHP_SELF?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
|
||||
print "<TD><a href=\"fiche.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
|
||||
|
||||
$now = time();
|
||||
$lim = 3600 * 24 * 15 ;
|
||||
|
||||
if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) {
|
||||
print "<td><b> > 15 jours</b></td>";
|
||||
} else {
|
||||
print "<td> </td>";
|
||||
}
|
||||
|
||||
print "<TD align=\"right\">";
|
||||
$y = strftime("%Y",$objp->dp);
|
||||
$m = strftime("%m",$objp->dp);
|
||||
|
||||
print strftime("%d",$objp->dp)."\n";
|
||||
print " <a href=\"propal.php3?year=$y&month=$m\">";
|
||||
print strftime("%B",$objp->dp)."</a>\n";
|
||||
print " <a href=\"propal.php3?year=$y\">";
|
||||
print strftime("%Y",$objp->dp)."</a></TD>\n";
|
||||
|
||||
print "<TD align=\"right\">".price($objp->price)."</TD>\n";
|
||||
print "<TD align=\"center\">$objp->statut</TD>\n";
|
||||
print "</TR>\n";
|
||||
|
||||
$total = $total + $objp->price;
|
||||
$subtotal = $subtotal + $objp->price;
|
||||
|
||||
$i++;
|
||||
}
|
||||
print "<tr><td align=\"right\" colspan=\"5\">Total : <b>".price($subtotal)."</b></td>\n";
|
||||
print "<td align=\"left\">Euros HT</td></tr>\n";
|
||||
|
||||
|
||||
print "<tr><td></td><td>$i propales</td>";
|
||||
print "<td colspan=\"3\" align=\"right\"><b>Total : ".price($total)."</b></td>";
|
||||
print "<td align=\"left\"><b>Euros HT</b></td></tr>";
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
$db->close();
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
|
|
@ -75,8 +75,5 @@ class Contact {
|
|||
|
||||
|
||||
}
|
||||
/*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ function print_barre_liste($titre,$page,$file) {
|
|||
print '<a href="'.$file.'?page='.($page-1).'"><img alt="Page précédente" src="/theme/'.$conf->theme.'/img/1leftarrow.png" border="0"></a>';
|
||||
}
|
||||
print '<a href="'.$file.'?page='.($page+1).'"><img alt="Page suivante" src="/theme/'.$conf->theme.'/img/1rightarrow.png" border="0"></a>';
|
||||
print '</td></tr></table>';
|
||||
print '</td></tr></table><p>';
|
||||
}
|
||||
/*
|
||||
*
|
||||
|
|
|
|||
|
|
@ -70,14 +70,14 @@ function top_menu($head) {
|
|||
|
||||
print '<TD width="15%" class="menu" align="center">';
|
||||
if ($user->comm > 0) {
|
||||
print '<A class="menu" href="../comm/">Commercial</A></TD>';
|
||||
print '<A class="menu" href="/comm/">Commercial</A></TD>';
|
||||
} else {
|
||||
print '-';
|
||||
}
|
||||
|
||||
print '<TD width="15%" class="menu" align="center">';
|
||||
if ($user->compta > 0) {
|
||||
print '<A class="menu" href="../compta/">Compta</A></TD>';
|
||||
print '<A class="menu" href="/compta/">Compta</A></TD>';
|
||||
} else {
|
||||
print '-';
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ function left_menu($menu) {
|
|||
}
|
||||
|
||||
print "<TR><TD class=\"barre\" valign=\"top\" align=\"right\">";
|
||||
print '<A class="menu" href="/comm/index.php3">Societes</A>';
|
||||
print '<A class="menu" href="/comm/clients.php3">Societes</A>';
|
||||
print '<form action="/comm/index.php3">';
|
||||
print '<input type="hidden" name="mode" value="search">';
|
||||
print '<input type="hidden" name="mode-search" value="soc">';
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
require("./pre.inc.php3");
|
||||
|
||||
llxHeader();
|
||||
$bc[0]="bgcolor=\"#90c090\"";
|
||||
$bc[1]="bgcolor=\"#b0e0b0\"";
|
||||
|
||||
|
||||
$db = new Db();
|
||||
if ($sortfield == "") {
|
||||
|
|
@ -42,14 +39,10 @@ if ($action == 'update') {
|
|||
$db->query($sql);
|
||||
}
|
||||
|
||||
$yn["t"] = "oui";
|
||||
$yn["f"] = "non";
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = 26;
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
print '<div class="titre">Liste des produits</div>';
|
||||
|
||||
|
|
@ -63,7 +56,7 @@ print '<div class="titre">Liste des produits</div>';
|
|||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR bgcolor=\"orange\">";
|
||||
print "<TR class=\"liste_titre\">";
|
||||
print "<TD>Réf</TD>";
|
||||
print "<TD><a href=\"$PHP_SELF?sortfield=lower(p.label)&sortorder=ASC\">Nom</a></td>";
|
||||
print "<TD align=\"right\">Prix</TD>";
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
require("pre.inc.php3");
|
||||
|
||||
require("./societe.class.php3");
|
||||
|
||||
llxHeader();
|
||||
$db = new Db();
|
||||
if ($sortorder == "") {
|
||||
|
|
@ -104,7 +104,7 @@ if ($action == 'create') {
|
|||
|
||||
$soc = new Societe($db);
|
||||
$soc->id = $socid;
|
||||
$soc->fetch();
|
||||
$soc->fetch($socid);
|
||||
|
||||
print '<form action="soc.php3?socid='.$socid.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
|
|
|||
BIN
htdocs/theme/dolibarr/img/editdelete.png
Normal file
BIN
htdocs/theme/dolibarr/img/editdelete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 558 B |
BIN
htdocs/theme/dolibarr/img/fileclose.png
Normal file
BIN
htdocs/theme/dolibarr/img/fileclose.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 510 B |
BIN
htdocs/theme/dolibarr/img/filenew.png
Normal file
BIN
htdocs/theme/dolibarr/img/filenew.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
|
|
@ -1,81 +0,0 @@
|
|||
<?PHP
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
class TodoComm {
|
||||
var $id;
|
||||
var $db;
|
||||
|
||||
var $date;
|
||||
var $libelle;
|
||||
|
||||
var $user;
|
||||
var $creator;
|
||||
|
||||
var $societe;
|
||||
var $contact;
|
||||
var $note;
|
||||
|
||||
Function TodoComm($DB) {
|
||||
$this->db = $DB;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function add($user) {
|
||||
$sqldate = $this->db->idate($this->date);
|
||||
|
||||
$sql = "INSERT INTO llx_todocomm (datea, label, fk_soc, fk_user_author, fk_contact, note) ";
|
||||
$sql .= " VALUES ('$sqldate', '$this->libelle', $this->societe, $user->id, $this->contact, '$this->note')";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function fetch($db, $id) {
|
||||
|
||||
$sql = "SELECT label FROM llx_todocomm WHERE rowid=$id;";
|
||||
|
||||
if ($db->query($sql) ) {
|
||||
if ($db->num_rows()) {
|
||||
$obj = $db->fetch_object(0);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->libelle = $obj->label;
|
||||
$this->note = $obj->note;
|
||||
|
||||
$db->free();
|
||||
}
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ create:
|
|||
$(MYSQL) $(BASE) < societe.sql
|
||||
$(MYSQL) $(BASE) < socpeople.sql
|
||||
$(MYSQL) $(BASE) < socstatutlog.sql
|
||||
$(MYSQL) $(BASE) < llx_todocomm.sql
|
||||
|
||||
|
||||
drop:
|
||||
$(MYSQL) $(BASE) < drop.sql
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
--
|
||||
-- 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
|
||||
|
|
@ -27,11 +26,24 @@ create table actioncomm
|
|||
id integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datea datetime, -- action date
|
||||
fk_action integer,
|
||||
|
||||
label varchar(50), -- libelle de l'action
|
||||
|
||||
fk_soc integer,
|
||||
author varchar(30),
|
||||
fk_contact integer default 0,
|
||||
|
||||
fk_user_action integer, -- id de la personne qui doit effectuer l'action
|
||||
fk_user_author integer,
|
||||
fk_contact integer,
|
||||
|
||||
priority smallint,
|
||||
|
||||
percent smallint,
|
||||
|
||||
note text,
|
||||
propalrowid integer
|
||||
);
|
||||
|
||||
--create table llx_todocomm
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
-- ========================================================================
|
||||
-- Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
|
|
@ -21,5 +23,6 @@
|
|||
create table c_actioncomm
|
||||
(
|
||||
id integer PRIMARY KEY,
|
||||
libelle varchar(30)
|
||||
libelle varchar(30),
|
||||
todo tinyint
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
-- ========================================================================
|
||||
-- Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ drop table if exists llx_service;
|
|||
|
||||
drop table if exists llx_soc_recontact;
|
||||
|
||||
drop table if exists llx_todocomm;
|
||||
|
||||
drop table if exists llx_user;
|
||||
|
||||
drop table if exists llx_ventes;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
create table llx_bookmark
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_soc int,
|
||||
author varchar(255),
|
||||
dateb datetime
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_soc integer,
|
||||
fk_user integer,
|
||||
dateb datetime
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
-- ========================================================================
|
||||
-- Copyright (C) 2000-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- SGBD : Mysql 3.23
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
|
|
@ -19,6 +18,8 @@
|
|||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- SGBD : Mysql 3.23
|
||||
--
|
||||
-- ========================================================================
|
||||
create table societe
|
||||
(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user