From 3de5ef73c0fa0066e37d6c474a359681c0ad3fda Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 10 May 2002 12:28:10 +0000 Subject: [PATCH] . --- .../{actioncomm.php3 => action/fiche.php3} | 210 ++---- htdocs/comm/action/index.php3 | 244 +++++++ htdocs/comm/action/pre.inc.php3 | 57 ++ htdocs/comm/actioncomm.class.php3 | 39 +- htdocs/comm/cactioncomm.class.php3 | 1 - htdocs/comm/clients.php3 | 217 ++++++ htdocs/comm/contact.php3 | 23 +- htdocs/comm/fiche.php3 | 543 +++++++++++++++ htdocs/comm/index.php3 | 652 +++--------------- htdocs/comm/people.php3 | 41 +- htdocs/comm/pre.inc.php3 | 4 +- htdocs/comm/projet/fiche.php3 | 23 +- htdocs/comm/projet/index.php3 | 3 +- htdocs/comm/projet/pre.inc.php3 | 57 +- htdocs/comm/projet/project.class.php3 | 35 +- htdocs/comm/propal.php3 | 48 +- htdocs/compta/fiche.php3 | 475 +++++++++++++ htdocs/compta/propal.php3 | 596 ++++++++++++++++ htdocs/contact.class.php3 | 5 +- htdocs/lib/functions.inc.php3 | 2 +- htdocs/main.inc.php3 | 6 +- htdocs/product/index.php3 | 11 +- htdocs/soc.php3 | 4 +- htdocs/theme/dolibarr/img/editdelete.png | Bin 0 -> 558 bytes htdocs/theme/dolibarr/img/fileclose.png | Bin 0 -> 510 bytes htdocs/theme/dolibarr/img/filenew.png | Bin 0 -> 474 bytes htdocs/todocomm.class.php3 | 81 --- mysql/tables/Makefile | 2 +- mysql/tables/actioncomm.sql | 18 +- mysql/tables/c_actioncomm.sql | 5 +- mysql/tables/c_paiement.sql | 2 + mysql/tables/drop.sql | 2 - mysql/tables/llx_bookmark.sql | 8 +- mysql/tables/societe.sql | 3 +- 34 files changed, 2414 insertions(+), 1003 deletions(-) rename htdocs/comm/{actioncomm.php3 => action/fiche.php3} (56%) create mode 100644 htdocs/comm/action/index.php3 create mode 100644 htdocs/comm/action/pre.inc.php3 create mode 100644 htdocs/comm/clients.php3 create mode 100644 htdocs/comm/fiche.php3 create mode 100644 htdocs/compta/fiche.php3 create mode 100644 htdocs/compta/propal.php3 create mode 100644 htdocs/theme/dolibarr/img/editdelete.png create mode 100644 htdocs/theme/dolibarr/img/fileclose.png create mode 100644 htdocs/theme/dolibarr/img/filenew.png delete mode 100644 htdocs/todocomm.class.php3 diff --git a/htdocs/comm/actioncomm.php3 b/htdocs/comm/action/fiche.php3 similarity index 56% rename from htdocs/comm/actioncomm.php3 rename to htdocs/comm/action/fiche.php3 index c328d361e25..92889bc36e6 100644 --- a/htdocs/comm/actioncomm.php3 +++ b/htdocs/comm/action/fiche.php3 @@ -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 '
Rendez-vous
'; print 'Société'; - print ''.$societe->nom.''; + print ''.$societe->nom.''; print 'Contact'.$contact->fullname.''; print 'Date'; print_date_select(); @@ -156,7 +166,7 @@ if ($action=='create' && $actionid && $contactid) { else { - print '
'; + print ''; print ''; print ''; @@ -170,18 +180,19 @@ if ($action=='create' && $actionid && $contactid) { print 'Action'.$caction->libelle.''; print 'Société'; - print ''.$societe->nom.''; + print ''.$societe->nom.''; print 'Contact'.$contact->fullname.''; print 'Date'.strftime('%d %B %Y %H:%M',time()).''; print 'Commentaire'; print ''; print '
Prochaine Action à faire
'; - + print 'Ajouter'; print 'Date'; print_date_select(); print ''; print 'Action'; + print 'Calendrier'; print 'Commentaire'; print ''; @@ -200,9 +211,13 @@ if ($id) { $act = new ActionComm($db); $act->fetch($id); + $act->societe->fetch($act->societe->id); + + print_titre ("Action commerciale"); + print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -210,125 +225,8 @@ if ($id) { print nl2br($act->note).''; print '
Action'.$act->type.'
Société'.$nom.'
Type'.$act->type.'
Société'.$act->societe->nom.'Contact'.$fullname.'
Auteur'.$fullname.'Date'.strftime('%d %B %Y %H:%M',time()).'
'; - $limit = 10; - print '

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 ""; - print ''; - print ''; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $obj = $db->fetch_object( $i); - - $var=!$var; - - print ""; - print "\n"; - print ''; - print "\n"; - - $i++; - } - print "
DateAction
" .strftime("%Y %b %d %H:%M",$obj->da)."'.$obj->libelle.'
"; - $db->free(); - } else { - print $db->error() . '
' . $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 "

"; - print ''; - print ''; - print ''; - print ''; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $obj = $db->fetch_object( $i); - - $var=!$var; - - print ""; - - if ($oldyear == strftime("%Y",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print "\n"; - print "\n"; - - print ''; - - print ''; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
DateSociétéActionAuteur
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."'; - - print ' '.$obj->societe.''.$obj->libelle.'$obj->code$obj->stcomm
"; - $db->free(); - } else { - print $db->error() . ' ' . $sql ; - } + print '

Supprimer'; } $db->close(); diff --git a/htdocs/comm/action/index.php3 b/htdocs/comm/action/index.php3 new file mode 100644 index 00000000000..0a91b78110b --- /dev/null +++ b/htdocs/comm/action/index.php3 @@ -0,0 +1,244 @@ + + * + * $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 ""; + print ''; + print ''; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + print "\n"; + print ''; + print "\n"; + + $i++; + } + print "
DateAction
" .strftime("%Y %b %d %H:%M",$obj->da)."'.$obj->libelle.'
"; + $db->free(); + } else { + print $db->error() . '
' . $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 ""; + print ''; + print ''; + print ''; + print ''; + print ''; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + print ''; + /* + * Contact + */ + print ''; + /* + * + */ + print "\n"; + + print "\n"; + $i++; + } + print "
DateSociétéActionContactAuteur
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."'; + + print ' '.$obj->societe.''.$obj->libelle.''; + if ($obj->fk_contact) { + $cont = new Contact($db); + $cont->fetch($obj->fk_contact); + print ''.$cont->fullname.''; + } else { + print " "; + } + print '$obj->code
"; + $db->free(); + } else { + print $db->error() . ' ' . $sql ; + } +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/comm/action/pre.inc.php3 b/htdocs/comm/action/pre.inc.php3 new file mode 100644 index 00000000000..5be305ca1a0 --- /dev/null +++ b/htdocs/comm/action/pre.inc.php3 @@ -0,0 +1,57 @@ + + * + * $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); + +} + +?> diff --git a/htdocs/comm/actioncomm.class.php3 b/htdocs/comm/actioncomm.class.php3 index 5c2fcf349ba..1b7f3f07460 100644 --- a/htdocs/comm/actioncomm.class.php3 +++ b/htdocs/comm/actioncomm.class.php3 @@ -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() . "
" . $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) ) { + + } + } } ?> - diff --git a/htdocs/comm/cactioncomm.class.php3 b/htdocs/comm/cactioncomm.class.php3 index 12c6e3dfede..5cb8517e37e 100644 --- a/htdocs/comm/cactioncomm.class.php3 +++ b/htdocs/comm/cactioncomm.class.php3 @@ -51,4 +51,3 @@ class CActioncomm { } } ?> - diff --git a/htdocs/comm/clients.php3 b/htdocs/comm/clients.php3 new file mode 100644 index 00000000000..f567b666f88 --- /dev/null +++ b/htdocs/comm/clients.php3 @@ -0,0 +1,217 @@ + + * + * $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 ""; + print ''; + print ""; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + if ($conf->fichinter->enabled) { + print "\n"; + } else { + print "\n"; + } + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Société",$PHP_SELF,"s.nom"); + print "VilleemailStatut  
idp\">$obj->nom".$obj->ville."  $obj->stcomm$obj->prefix_comm idp&action=create\">[Propal]idp&action=create\">[Fiche Inter] 
"; + $db->free(); + } else { + print $db->error() . ' ' . $sql; + } + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/comm/contact.php3 b/htdocs/comm/contact.php3 index 17e064918b6..2e624fb1754 100644 --- a/htdocs/comm/contact.php3 +++ b/htdocs/comm/contact.php3 @@ -36,21 +36,6 @@ $offset = $limit * $page ; print_barre_liste("Liste des contacts",$page, $PHP_SELF); -print "

"; - -print "| *\n| "; -for ($i = 65 ; $i < 91; $i++) { - print ""; - - if ($begin == chr($i) ) { - print "->" . chr($i) . "<-" ; - } else { - print chr($i) ; - } - print " | "; -} -print "
"; - /* * @@ -114,9 +99,11 @@ if ($result) { print "$obj->firstname"; print ' '; - print "idp\">$obj->nom\n"; - print "$obj->email \n"; - print ''.$obj->phone.' '; + print "idp\">$obj->nom\n"; + + print ''.$obj->email.' '; + + print ''.$obj->phone.' '; print "idp&setcontact=$obj->cidp&action=create\">[Propal]\n"; print "\n"; diff --git a/htdocs/comm/fiche.php3 b/htdocs/comm/fiche.php3 new file mode 100644 index 00000000000..1cee4156615 --- /dev/null +++ b/htdocs/comm/fiche.php3 @@ -0,0 +1,543 @@ + + * + * $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 "$errmesg
"; + } + + /* + * + */ + print "\n"; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
Fiche client : $objsoc->nom
idp&action=add_bookmark\">[Bookmark]idp&action=create\">[Projet]idp&action=create\">[Propal]idp\">Notes[idp&action=edit\">Editer]
"; + /* + * + * + */ + + + print "\n"; + print "\n"; + print '"; + print "
"; + print ""; + + print ""; + print ""; + print ""; + + print ""; + print ""; + + print ""; + + print "
Type $objsoc->typentEffectif$objsoc->effectif
Tel $objsoc->tel fax$objsoc->fax 
Ville".nl2br($objsoc->address)."
$objsoc->cp $objsoc->ville
sirensiren\">$objsoc->siren prefix"; + if ($objsoc->prefix_comm) { + print $objsoc->prefix_comm; + } else { + print "[idp&action=attribute_prefix\">Attribuer]"; + } + + print "
Siteurl\">$objsoc->url 
"; + + /* + * + */ + print "
'; + + /* + * + * Propales + * + */ + $var=!$var; + print ""; + $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 ""; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < 4) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\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 "
idp\">liste des propales ($num)
propalid\">$objp->ref\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price - $objp->remise)."$objp->statut
"; + $i = 0 ; + $num = $db->num_rows(); + if ($num > 0) { + $tag = !$tag; print ""; + print ""; + } + while ($i < $num && $i < 5) { + $obj = $db->fetch_object( $i); + $tag = !$tag; + print ""; + print ''; + + print ""; + $i++; + } + $db->free(); + print "
idp\">liste des projets ($num)
'.$obj->title.'".$obj->ref ."
"; + } else { + print $db->error(); + } + + /* + * + * + */ + print "
\n"; + /* + * + * + * + */ + if ($action == 'changevalue') { + + print "
"; + print "idp\" method=\"post\">"; + print ""; + print "Cette société est un cabinet de recrutement : "; + print ""; + print ""; + print "\n"; + } else { + /* + * + * Liste des contacts + * + */ + print ""; + + print ""; + print ''; + print ""; + print ""; + + $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 ""; + } else { + print ""; + } + print ''; + + if ($obj->note) { + print "
".nl2br($obj->note); + } + print ""; + print ""; + print ''; + print ''; + print ''; + print ""; + print "\n"; + $i++; + $tag = !$tag; + } + print "
Prénom NomPosteTélFaxEmailidp&action=addcontact\">Ajouter
'; + //print ''; + //print ' '; + print ''.$obj->firstname.' '. $obj->name.' $obj->poste '.$obj->phone.' '.$obj->fax.' '.$obj->email.' idp&action=editcontact&contactid=$obj->idp\">Modifier
"; + + print "\n
\n"; + + /* + * + * Listes des actions a faire + * + */ + print ''; + print ''; + print ''; + print '
Actions à faire
'; + + $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 "\n"; + + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $var = !$var; + + $obj = $db->fetch_object( $i); + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + if ($obj->propalrowid) { + print ''; + } else { + print ''; + } + /* + * Contact pour cette action + * + */ + if ($obj->fk_contact) { + $contact = new Contact($db); + $contact->fetch($obj->fk_contact); + print ''; + } else { + print ''; + } + /* + */ + print ''; + print "\n"; + $i++; + } + print "
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.$obj->libelle.''.$obj->libelle.''.$contact->fullname.' '.$obj->code.'
"; + + $db->free(); + } else { + print $db->error(); + } + print "
"; + + + + + + + /* + * + * Listes des actions effectuees + * + */ + print ''; + print ''; + print ''; + print '
Actions effectuées
'; + + $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 "\n"; + + $i = 0 ; + $num = $db->num_rows(); + $oldyear=''; + $oldmonth=''; + while ($i < $num) { + $var = !$var; + + $obj = $db->fetch_object( $i); + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + if ($obj->propalrowid) { + print ''; + } else { + print ''; + } + /* + * Contact pour cette action + * + */ + if ($obj->fk_contact) { + $contact = new Contact($db); + $contact->fetch($obj->fk_contact); + print ''; + } else { + print ''; + } + /* + */ + print ''; + print "\n"; + $i++; + } + print "
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.$obj->libelle.''.$obj->libelle.''.$contact->fullname.' '.$obj->code.'
"; + + $db->free(); + } else { + print $db->error(); + } + print "
"; + + + + + + /* + * + * Notes sur la societe + * + */ + print ''; + print ""; + print "
".nl2br($objsoc->note)."
"; + /* + * + * + * + */ + + } + } else { + print $db->error() . "
" . $sql; + } +} else { + print "Erreur"; +} +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/comm/index.php3 b/htdocs/comm/index.php3 index 5dbcbee8db9..364a0a43c6b 100644 --- a/htdocs/comm/index.php3 +++ b/htdocs/comm/index.php3 @@ -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 ''; + +print '"; + $i++; } + $db->free(); + print "
'; + +print ''; +print ""; +print ""; +print "\n"; + +$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 0"; +if (valeur($sql)) { + $var=!$var; + print ""; +} + +$sql = "SELECT count(*) FROM llx_propal WHERE fk_statut = 1"; +if (valeur($sql)) { + $var=!$var; + print ""; +} + + +print "
Propositions commerciales
Brouillons".valeur($sql)."
Ouvertes".valeur($sql)."

"; +/* * * */ -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 ""; + print ""; + print ""; + print "\n"; + + while ($i < $num) { + $obj = $db->fetch_object( $i); + $var = !$var; + print ""; + print ''; + print ''; + print ''; + $i++; } + print '
Bookmark
'.$obj->nom.''; + print '
'; } - - - /* - * - * Mode fiche + * * * - */ -if ($socid > 0) { - $societe = new Societe($db, $socid); - + */ +print '
'; - $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 ''; + print ""; + print ""; + print "\n"; - if ($result) { - $objsoc = $db->fetch_object(0); - - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) { - print "$errmesg
"; - } - - /* - * - */ - print "
Actions à faire
\n"; - - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "
Fiche client : $objsoc->nom
idp&action=add\">[Bookmark]idp&action=create\">[Projet]idp&action=create\">[Propal]idp\">Notes[idp&action=edit\">Editer]
"; - /* - * - * - */ - - - print "\n"; - print "\n"; - print ''; - /* - * - */ - print ""; - print "
"; - print ""; - - print ""; - print ""; - print ""; - - print ""; - print ""; - - print ""; - - print "
Type $objsoc->typentEffectif$objsoc->effectif
Tel $objsoc->tel fax$objsoc->fax 
Ville".nl2br($objsoc->address)."
$objsoc->cp $objsoc->ville
sirensiren\">$objsoc->siren prefix"; - if ($objsoc->prefix_comm) { - print $objsoc->prefix_comm; - } else { - print "[idp&action=attribute_prefix\">Attribuer]"; - } - - print "
Siteurl\">$objsoc->url 
"; - - /* - * - */ - print "
'; - - /* - * - * Propales - * - */ + $i = 0; + while ($i < $db->num_rows() ) { + $obj = $db->fetch_object($i); $var=!$var; - print ""; - $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 ""; - } - $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; - while ($i < $num && $i < 2) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\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 ""; - print ""; - } - - while ($i < $num && $i < 2) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - if ($objp->df > 0 ) { - print "\n"; - } else { - print "\n"; - } - print "\n"; - $paye[1] = "payée"; - $paye[0] = "non payée"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); - } else { - print $db->error(); - } - print "
idp\">liste des propales ($num)
propalid\">$objp->ref\n"; - if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) { - print " > 15 jours"; - } - print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price - $objp->remise)."$objp->statut
idp\">liste des factures ($num)
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!".number_format($objp->amount, 2, ',', ' ')."".$paye[$objp->paye]."
"; - - - - print '
"; - - - print ""; - /* - * - * 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 ""; - $i = 0 ; $num = $db->num_rows(); - if ($num > 0) { - $tag = !$tag; print ""; - print ""; - } - while ($i < $num && $i < 5) { - $obj = $db->fetch_object( $i); - $tag = !$tag; - print ""; - $nw = time(); - if ($nw <= $obj->df && $nw >= $obj->dd) { - print ""; - } else { - print ""; - } - print ""; - $i++; - } - $db->free(); - print "
idp\">liste des ventes ($num)
$obj->label$obj->label".strftime("%d %b %Y", $obj->dd) ."".strftime("%d %b %Y", $obj->df) ."
"; - } 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 ""; - $i = 0 ; - $num = $db->num_rows(); - if ($num > 0) { - $tag = !$tag; print ""; - print ""; - } - while ($i < $num && $i < 5) { - $obj = $db->fetch_object( $i); - $tag = !$tag; - print ""; - print ''; - - print ""; - $i++; - } - $db->free(); - print "
idp\">liste des projets ($num)
'.$obj->title.'".strftime("%d %b %Y", $obj->do) ."
"; - } else { - print $db->error(); - } - - /* - * - * - */ - print "
\n"; - /* - * - * - * - */ - if ($action == 'changevalue') { - - print "
"; - print "
idp\" method=\"post\">"; - print ""; - print "Cette société est un cabinet de recrutement : "; - print ""; - print ""; - print "
\n"; - } else { - /* - * - * Liste des contacts - * - */ - print ""; - - print ""; - print ''; - print ""; - print ""; - $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 ""; - } else { - print ""; - } - print ''; - - if ($obj->note) { - print "
".nl2br($obj->note); - } - print ""; - print ""; - print ''; - print ''; - print ''; - print ""; - print "\n"; - $i++; - $tag = !$tag; - } - print "
Prénom NomPosteTélFaxEmailidp&action=addcontact\">Ajouter
'.$obj->firstname.' '. $obj->name.' $obj->poste '.$obj->phone.' '.$obj->fax.' '.$obj->email.' idp&action=editcontact&contactid=$obj->idp\">Modifier
"; - - print "\n
\n"; - /* - * - */ - print ''; - print ''; - print '
'; - /* - * - * 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 "\n"; - - $i = 0 ; $num = $db->num_rows(); - while ($i < $num) { - $var = !$var; - - $obj = $db->fetch_object( $i); - print ""; - - if ($oldyear == strftime("%Y",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) ) { - print ''; - } else { - print "\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print "\n"; - print "\n"; - - print ''; - - if ($obj->propalrowid) { - print ''; - } else { - print ''; - } - /* - * Contact pour cette action - * - */ - if ($obj->fk_contact) { - $contact = new Contact($db); - $contact->fetch($obj->fk_contact); - print ''; - } else { - print ''; - } - /* - */ - print ''; - print "\n"; - $i++; - } - print "
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.$obj->libelle.''.$obj->libelle.''.$contact->fullname.' '.$obj->code.'
"; - - $db->free(); - } else { - print $db->error(); - } - print "
"; - /* - * - * Notes sur la societe - * - */ - print ''; - print ""; - print "
".nl2br($objsoc->note)."
"; - /* - * - * - * - */ - - - - - } - } else { - print $db->error() . "
" . $sql; + print "
".strftime("%d %b %Y",$obj->da)."$obj->libelle $obj->label

"; } 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 ""; - print ''; - print ""; - print ""; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $obj = $db->fetch_object( $i); - - $var=!$var; - - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - if ($conf->fichinter->enabled) { - print "\n"; - } else { - print "\n"; - } - print "\n"; - $i++; - } - print "
"; - print_liste_field_titre("Société",$PHP_SELF,"s.nom"); - print "VilleemailStatut  
idp\">$obj->nom".$obj->ville."  $obj->stcomm$obj->prefix_comm idp&action=create\">[Propal]idp&action=create\">[Fiche Inter] 
"; - $db->free(); - } else { - print $db->error() . ' ' . $sql; - } + print $db->error(); } + + +print ''; + +print ''; + $db->close(); + + llxFooter("Dernière modification $Date$ révision $Revision$"); ?> diff --git a/htdocs/comm/people.php3 b/htdocs/comm/people.php3 index 781fbc7b0e4..ea8a07e3755 100644 --- a/htdocs/comm/people.php3 +++ b/htdocs/comm/people.php3 @@ -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 "
"; - print "<-Prev\n| "; - for ($i = 65 ; $i < 91; $i++) { - print "" . chr($i) . " | "; - } - print " idp&to=next\">Next->\n"; - print "
"; - - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) { - print "$errmesg
"; - } /* * * @@ -113,22 +89,7 @@ if ($socid > 0) { print "[Ajouter un contact]"; print ''; - print "
"; - print "\n"; - print "\n"; - print "\n"; - print "
"; - print "tel : $objsoc->tel
"; - print "fax : $objsoc->fax
"; - print "$objsoc->cp $objsoc->ville
"; - if ($objsoc->url) { - print "url\">$objsoc->url
"; - } - print "
"; - print ""; - - print "
Créée le" . strftime("%d %b %Y %H:%M", $objsoc->dc) . "
"; /* * diff --git a/htdocs/comm/pre.inc.php3 b/htdocs/comm/pre.inc.php3 index ed490ff133e..63dc631093b 100644 --- a/htdocs/comm/pre.inc.php3 +++ b/htdocs/comm/pre.inc.php3 @@ -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"); diff --git a/htdocs/comm/projet/fiche.php3 b/htdocs/comm/projet/fiche.php3 index b84f7ec347a..54a0e85cc32 100644 --- a/htdocs/comm/projet/fiche.php3 +++ b/htdocs/comm/projet/fiche.php3 @@ -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 "Projets"; print ""; -$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 ''; print ''; @@ -97,7 +89,7 @@ if ($action == 'create') { print ''; print '
Société
Titre'.$projet->title.'
'; - $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 ''; for ($i = 0; $ifetch($db, $propales[$i]); + $propale = new Propal($db); + $propale->fetch($propales[$i]); $var=!$var; print ""; @@ -129,8 +121,7 @@ if ($action == 'create') { } print ''.$i.' propales'; - print 'Soit : '.francs($total).' FF HT'; - print 'Total : '.price($total).''; + print 'Total : '.price($total).''; print 'Euros HT'; print ""; diff --git a/htdocs/comm/projet/index.php3 b/htdocs/comm/projet/index.php3 index ad16942bb25..33b35be24f1 100644 --- a/htdocs/comm/projet/index.php3 +++ b/htdocs/comm/projet/index.php3 @@ -16,8 +16,7 @@ if($socidp) { } print ''; -$bc[0]="bgcolor=\"#90c090\""; -$bc[1]="bgcolor=\"#b0e0b0\""; + $db = new Db(); /* diff --git a/htdocs/comm/projet/pre.inc.php3 b/htdocs/comm/projet/pre.inc.php3 index 7ce27bf37b7..0c0b4227954 100644 --- a/htdocs/comm/projet/pre.inc.php3 +++ b/htdocs/comm/projet/pre.inc.php3 @@ -31,61 +31,28 @@ function llxHeader($head = "", $urlp = "") { */ top_menu($head); - print ""; + $menu = new Menu(); - print ""; - /* - * - */ - print ""; - /* - * - */ - print ""; + $menu->add("/comm/propal.php3", "Propales"); - print ""; + $menu->add("/comm/projet/", "Projets"); - print "
"; - print "\n"; - print "Recap
\n"; - print "
"; + $menu->add("/comm/index.php3", "Clients"); - print "Factures
\n"; + $menu->add_submenu("/soc.php3?&action=create", "Nouvelle société"); + $menu->add_submenu("/comm/contact.php3", "Contacts"); - print "Produits
\n"; + $menu->add("/comm/action/", "Actions"); - print "
"; - print "
Societes
\n"; - print "
"; - print ''; - print ''; - print ' '; - print ""; - print "
"; + $menu->add_submenu("/comm/propal.php3?viewstatut=0", "Brouillons"); + $menu->add_submenu("/comm/propal.php3?viewstatut=1", "Ouvertes"); - print "
Contacts
\n"; - print "
"; - print ''; - print ''; - print " "; - print ""; - print "
"; + $menu->add("/product/", "Produits"); + $menu->add("/service/", "Services"); - print "
"; - print ""; - print ""; - print "
"; - print "
"; + left_menu($menu->liste); - print ""; - - - print "\n"; } -/* - * $Id$ - * $Source$ - */ ?> diff --git a/htdocs/comm/projet/project.class.php3 b/htdocs/comm/projet/project.class.php3 index 8e048fc0c2b..ff8fe3fb8dd 100644 --- a/htdocs/comm/projet/project.class.php3 +++ b/htdocs/comm/projet/project.class.php3 @@ -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 ''.$sql.'
'.$db->error(); + print ''.$sql.'
'.$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() . '
' .$sql; + print $this->db->error() . '
' .$sql; } diff --git a/htdocs/comm/propal.php3 b/htdocs/comm/propal.php3 index 040c7abf0d9..069d6e8dda5 100644 --- a/htdocs/comm/propal.php3 +++ b/htdocs/comm/propal.php3 @@ -116,9 +116,8 @@ if ($propalid) { print ""; - print ""; - print ""; - // + print ""; + print ""; print ''; @@ -192,7 +191,7 @@ if ($propalid) { $num = $db->num_rows(); $i = 0; $total = 0; print "

Produits

Sociétéidp\">$obj->nomidp\">Autres propalesNote :
". nl2br($obj->note)."
Sociétéidp\">$obj->nomidp\">Autres propalesNote :
". nl2br($obj->note)."
date'.strftime("%A %d %B %Y",$obj->dp).'
"; - print ""; + print ""; print ""; print ""; print "\n"; @@ -215,44 +214,7 @@ if ($propalid) { /* * */ - print ""; print "
RéfProduitPrixQté.
"; - /* - * 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 "

Facture(s) associée(s)"; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print ""; - $total = $total + $objp->amount; - $i++; - } - print "\n"; - print "
NumDateAuteurPrix
facid\">$objp->facnumber"; - if ($objp->paye) { print " (payée)"; } - print "".strftime("%d %B %Y",$objp->df)."$objp->author$objp->amount
Total : $total Euros HT
"; - $db->free(); - } + print "

"; /* * Actions @@ -548,7 +510,7 @@ if ($propalid) { $var=!$var; print ""; print "propalid\">$objp->ref\n"; - print "idp\">$objp->nom\n"; + print "idp\">$objp->nom\n"; $now = time(); $lim = 3600 * 24 * 15 ; diff --git a/htdocs/compta/fiche.php3 b/htdocs/compta/fiche.php3 new file mode 100644 index 00000000000..a0bb8d60db3 --- /dev/null +++ b/htdocs/compta/fiche.php3 @@ -0,0 +1,475 @@ + + * + * $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 "$errmesg
"; + } + + /* + * + */ + print "\n"; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
Fiche client : $objsoc->nom
idp&action=add\">[Bookmark]idp&action=create\">[Projet]idp&action=create\">[Propal]idp\">Notes[idp&action=edit\">Editer]
"; + /* + * + * + */ + + + print "\n"; + print "\n"; + print '"; + print "
"; + print ""; + + print ""; + print ""; + print ""; + + print ""; + print ""; + + print ""; + + print "
Type $objsoc->typentEffectif$objsoc->effectif
Tel $objsoc->tel fax$objsoc->fax 
Ville".nl2br($objsoc->address)."
$objsoc->cp $objsoc->ville
sirensiren\">$objsoc->siren prefix"; + if ($objsoc->prefix_comm) { + print $objsoc->prefix_comm; + } else { + print "[idp&action=attribute_prefix\">Attribuer]"; + } + + print "
Siteurl\">$objsoc->url 
"; + + /* + * + */ + print "
'; + + /* + * + * Propales + * + */ + $var=!$var; + print ""; + $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 ""; + } + $i = 0; $now = time(); $lim = 3600 * 24 * 15 ; + while ($i < $num && $i < 2) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\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 ""; + print ""; + } + + while ($i < $num && $i < 2) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + if ($objp->df > 0 ) { + print "\n"; + } else { + print "\n"; + } + print "\n"; + $paye[1] = "payée"; + $paye[0] = "non payée"; + print "\n"; + print "\n"; + $i++; + } + $db->free(); + } else { + print $db->error(); + } + print "
idp\">liste des propales ($num)
propalid\">$objp->ref\n"; + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) { + print " > 15 jours"; + } + print "".strftime("%d %B %Y",$objp->dp)."".price($objp->price - $objp->remise)."$objp->statut
idp\">liste des factures ($num)
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!".number_format($objp->amount, 2, ',', ' ')."".$paye[$objp->paye]."
"; + + + + /* + * + * 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 ""; + $i = 0 ; + $num = $db->num_rows(); + if ($num > 0) { + $tag = !$tag; print ""; + print ""; + } + while ($i < $num && $i < 5) { + $obj = $db->fetch_object( $i); + $tag = !$tag; + print ""; + print ''; + + print ""; + $i++; + } + $db->free(); + print "
idp\">liste des projets ($num)
'.$obj->title.'".strftime("%d %b %Y", $obj->do) ."
"; + } else { + print $db->error(); + } + + /* + * + * + */ + print "
\n"; + /* + * + * + * + */ + if ($action == 'changevalue') { + + print "
"; + print "
idp\" method=\"post\">"; + print ""; + print "Cette société est un cabinet de recrutement : "; + print ""; + print ""; + print "
\n"; + } else { + /* + * + * Liste des contacts + * + */ + print ""; + + print ""; + print ''; + print ""; + print ""; + + $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 ""; + } else { + print ""; + } + print ''; + + if ($obj->note) { + print "
".nl2br($obj->note); + } + print ""; + print ""; + print ''; + print ''; + print ''; + print ""; + print "\n"; + $i++; + $tag = !$tag; + } + print "
Prénom NomPosteTélFaxEmailidp&action=addcontact\">Ajouter
'; + //print ''; + //print ' '; + print ''.$obj->firstname.' '. $obj->name.' $obj->poste '.$obj->phone.' '.$obj->fax.' '.$obj->email.' idp&action=editcontact&contactid=$obj->idp\">Modifier
"; + + print "\n
\n"; + /* + * + */ + print ''; + print ''; + print '
'; + /* + * + * 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 "\n"; + + $i = 0 ; $num = $db->num_rows(); + while ($i < $num) { + $var = !$var; + + $obj = $db->fetch_object( $i); + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) { + print ''; + } else { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + if ($obj->propalrowid) { + print ''; + } else { + print ''; + } + /* + * Contact pour cette action + * + */ + if ($obj->fk_contact) { + $contact = new Contact($db); + $contact->fetch($obj->fk_contact); + print ''; + } else { + print ''; + } + /* + */ + print ''; + print "\n"; + $i++; + } + print "
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.$obj->libelle.''.$obj->libelle.''.$contact->fullname.' '.$obj->code.'
"; + + $db->free(); + } else { + print $db->error(); + } + print "
"; + /* + * + * Notes sur la societe + * + */ + print ''; + print ""; + print "
".nl2br($objsoc->note)."
"; + /* + * + * + * + */ + + } + } else { + print $db->error() . "
" . $sql; + } +} else { + print "Erreur"; +} +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/compta/propal.php3 b/htdocs/compta/propal.php3 new file mode 100644 index 00000000000..1bc73161d37 --- /dev/null +++ b/htdocs/compta/propal.php3 @@ -0,0 +1,596 @@ + + * + * $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 "Propal supprimée"; + } else { + print $db->error(); + print "

$sql"; + } + } else { + print $db->error(); + print "

$sql"; + } + $propalid = 0; + $brouillon = 1; +} +/* + * + * Mode fiche + * + * + */ +if ($propalid) { + $propal = new Propal($db); + $propal->fetch($propalid); + + + if ($valid == 1) { + $propal->valid($user->id); + } + /* + * + */ + print ""; + print ""; + print "
Proposition commerciale : $propal->ref
"; + /* + * + */ + $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 ""; + + print ""; + print ""; + // + + print ''; + + if ($obj->fk_projet) { + $projet = new Project(); + $projet->fetch($db,$obj->fk_projet); + print ''; + } + print ""; + /* + * + */ + + print ""; + /* + * + */ + + print ""; + + /* + * + */ + + $totalht = $propal->price - $propal->remise ; + + print ""; + /* + * + */ + print ''; + + /* + * + */ + print ""; + + print ''; + + + print "
Sociétéidp\">$obj->nomidp\">Autres propalesNote :
". nl2br($obj->note)."
date'.strftime("%A %d %B %Y",$obj->dp).'
Projet'; + print ''; + print $projet->title.'
Destinataire$obj->firstname $obj->name <$obj->email>
Montant HT".price($obj->price)." euros
Remise".price($obj->remise)." euros
Total HT".price($totalht)." euros
Auteur'; + $author = new User($db, $obj->fk_user_author); + $author->fetch(''); + print $author->fullname.'
Statut :$obj->lst
"; + + if ($action == 'statut') { + print "

"; + print ""; + print "'; + print '

'; + print "
"; + } + + + print "
"; + /* + * 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 "

Produits"; + print ""; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ""; + $total = $total + $objp->price; + $i++; + } + //print "\n"; + print "
RéfProduitPrixQté.
[$objp->ref]$objp->product".price($objp->price)."".$objp->qty."
Total : ".price($total)."Euros HT
"; + } + /* + * + */ + print "

"; + /* + * 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 "

Facture(s) associée(s)"; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print ""; + $total = $total + $objp->amount; + $i++; + } + print "\n"; + print "
NumDateAuteurPrix
facid\">$objp->facnumber"; + if ($objp->paye) { print " (payée)"; } + print "".strftime("%d %B %Y",$objp->df)."$objp->author$objp->amount
Total : $total Euros HT
"; + $db->free(); + } + print "

"; + /* + * Actions + */ + print "

"; + + if ($obj->statut == 0) { + print ""; + } else { + if ($obj->statut == 1) { + print ""; + } else { + print ""; + } + } + if ($obj->statut == 2) { + print ""; + } else { + print ""; + } + if ($obj->statut == 1) { + $file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; + if (file_exists($file)) { + print ""; + } else { + print ""; + } + } else { + print ""; + } + if ($obj->statut == 0) { + print ""; + } else { + print ""; + } + print "
[Supprimer][Cloturer]-Emettre une facture-"; + print "[Envoyer la propale par mail]! Propale non generee !-[Valider]-
"; + /* + * + */ + if ($action == 'fax') { + print "


Génération du fax
"; + $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 "

Resultat :

"; + + $output = system($command); + print "

command : $command
"; + } + /* + * 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 "

envoyé à $sendto"; + print "

envoyé par ".htmlentities($replyto); + } else { + print "!! 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 "

$sql

"; + } + } else { + print $db->error(); + } + } + /* + * + */ + print "
"; + print "
"; + print "Documents générés
"; + print ""; + + $file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; + if (file_exists($file)) { + print ""; + print ''; + } + $file = $conf->propal->outputdir . "/$obj->ref/$obj->ref.ps"; + if (file_exists($file)) { + print ""; + print ''; + print ""; + } + print ''; + + $file = $GLOBALS["GLJ_ROOT"] . "/www-sys/doc/propale/$obj->ref/FAX-$obj->ref.ps"; + if (file_exists($file)) { + print ""; + } + print "
Propale PDF'.$obj->ref.'.pdf
Propale Postscript'.$obj->ref.'.s
(liste...)
FAX d'entete
\n"; + /* + * + */ + print "
"; + print "Propale envoyée
"; + /* + * + */ + $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 ""; + print "\n"; + + while ($i < $num) { + $objp = $db->fetch_object( $i); + print "\n"; + $authoract = new User($db); + $authoract->id = $objp->fk_user_author; + $authoract->fetch(''); + print "\n"; + print ""; + $i++; + } + print "
DateAuteur
".strftime("%d %B %Y %H:%M:%S",$objp->da)."$authoract->code
$objp->note
"; + $db->free(); + } else { + print $db->error(); + } + /* + * + */ + print "
"; + /* + * + * + */ + 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 "
\n"; + print "\n"; + print "\n"; + print "\n"; + + print "

Envoyer la propale par mail"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + + print "
Destinataire$obj->firstname $obj->nameemail\">
Expediteur$from_name$from_mail
Reply-to$replytoname$replytomail
"; + print ""; + print "

"; + } + + } else { + print "Num rows = " . $db->num_rows(); + print "

$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
'; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + print '
 NomDate
Création'.$author->fullname.''.$obj->datec.'
Validation'.$validor->fullname.' '.$obj->date_valid.' 
Cloture'.$cloturor->fullname.' '.$obj->date_cloture.' 
'; + } else { + print '

Voir le suivi des actions '; + } + + } else { + print $db->error(); + print "

$sql"; + } + + + /* + * + * + * + */ +} else { + /* + * + * + * Mode Liste des propales + * + * + */ + print ""; + print ""; + print "
Propositions commerciales
"; + + $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 ""; + + $oldstatut = -1; + $subtotal = 0; + while ($i < $num) { + $objp = $db->fetch_object( $i); + + if ($objp->statut <> $oldstatut ) { + $oldstatut = $objp->statut; + + if ($i > 0) { + print "\n"; + print "\n"; + } + $subtotal = 0; + + print ''; + print ""; + print ""; + print ""; + print ""; + print "'; + print "\n"; + $var=True; + } + + $var=!$var; + print ""; + print "\n"; + print "\n"; + + $now = time(); + $lim = 3600 * 24 * 15 ; + + if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) { + print ""; + } else { + print ""; + } + + print "\n"; + + print "\n"; + print "\n"; + print "\n"; + + $total = $total + $objp->price; + $subtotal = $subtotal + $objp->price; + + $i++; + } + print "\n"; + print "\n"; + + + print ""; + print ""; + print ""; + print "
Total : ".price($subtotal)."Euros HT
RéfSociétéDatePrixStatut statutid\">"; + print '
propalid\">$objp->refidp\">$objp->nom > 15 jours "; + $y = strftime("%Y",$objp->dp); + $m = strftime("%m",$objp->dp); + + print strftime("%d",$objp->dp)."\n"; + print " "; + print strftime("%B",$objp->dp)."\n"; + print " "; + print strftime("%Y",$objp->dp)."".price($objp->price)."$objp->statut
Total : ".price($subtotal)."Euros HT
$i propalesTotal : ".price($total)."Euros HT
"; + $db->free(); + } else { + print $db->error(); + } +} +$db->close(); +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/contact.class.php3 b/htdocs/contact.class.php3 index 426fbe4f997..a04b81620f1 100644 --- a/htdocs/contact.class.php3 +++ b/htdocs/contact.class.php3 @@ -75,8 +75,5 @@ class Contact { } -/* - * $Id$ - * $Source$ - */ + ?> diff --git a/htdocs/lib/functions.inc.php3 b/htdocs/lib/functions.inc.php3 index 26f91947fd1..5fd5315f76d 100644 --- a/htdocs/lib/functions.inc.php3 +++ b/htdocs/lib/functions.inc.php3 @@ -54,7 +54,7 @@ function print_barre_liste($titre,$page,$file) { print 'Page précédente'; } print 'Page suivante'; - print ''; + print '

'; } /* * diff --git a/htdocs/main.inc.php3 b/htdocs/main.inc.php3 index 78a6257f36e..95ebfa349aa 100644 --- a/htdocs/main.inc.php3 +++ b/htdocs/main.inc.php3 @@ -70,14 +70,14 @@ function top_menu($head) { print ''; if ($user->comm > 0) { - print 'Commercial'; + print 'Commercial'; } else { print '-'; } print ''; if ($user->compta > 0) { - print 'Compta'; + print 'Compta'; } else { print '-'; } @@ -127,7 +127,7 @@ function left_menu($menu) { } print ""; - print 'Societes'; + print 'Societes'; print '

'; print ''; print ''; diff --git a/htdocs/product/index.php3 b/htdocs/product/index.php3 index 009ddcdebb8..15ffffbff0e 100644 --- a/htdocs/product/index.php3 +++ b/htdocs/product/index.php3 @@ -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 '
Liste des produits
'; @@ -63,7 +56,7 @@ print '
Liste des produits
'; $num = $db->num_rows(); $i = 0; print "

"; - print ""; + print ""; print ""; print ""; print ""; diff --git a/htdocs/soc.php3 b/htdocs/soc.php3 index a3bb6a5b8fd..50ecc6d4f5f 100644 --- a/htdocs/soc.php3 +++ b/htdocs/soc.php3 @@ -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 ''; print ''; diff --git a/htdocs/theme/dolibarr/img/editdelete.png b/htdocs/theme/dolibarr/img/editdelete.png new file mode 100644 index 0000000000000000000000000000000000000000..5999892c878cd7785f10d4b701fc434c8c6b09e1 GIT binary patch literal 558 zcmV+}0@3}6P)KrWX9(5w)(TFsc(>+_;eC?sC$o}Kb(|A1^Z3!vvA>;D#KGMNQHDwX2? zmv7|r`M;?tWC4&A>2w;?G-DHB5d9v?9})Q@UOA1}%|y>TxYmL{9Pnc};AQiKZnqb| w7&uE`7e*gdg07*qoM6N<$f~2DI0{{R3 literal 0 HcmV?d00001 diff --git a/htdocs/theme/dolibarr/img/fileclose.png b/htdocs/theme/dolibarr/img/fileclose.png new file mode 100644 index 0000000000000000000000000000000000000000..87faccb61ba33447141f8504d84746cd7fec37ad GIT binary patch literal 510 zcmVWEbP-5hy)=E3b#dyEj(g%XO>G)$W+75%(wr{?21OCamog^ zwMj8Raa|y>i5k8RvDRXYp?+4UP%6~^R1o^18c)WGBAgtbP&uj~%aX^ZN4njv3jI*6 z1%!U6ViOYt0Te-&B^6o0_kE-<0l2-pWf|fCo?o8PpPE5`K-7tdO^mna5qJTkw-JlQ zB7@`riA|I|kd$^xS+ITIX7Vv1>PIVQ-nZ3`@@7gJ@ z9#%6y9U{QR`Gu>XP%6~S+$b|PPS1935kfe{X}+TXpw(;vAcQ~&;q;uIE$8I`Q$4LM z2Ul6E*8#)$DX8-^I07*qoM6N<$f}*6& Avj6}9 literal 0 HcmV?d00001 diff --git a/htdocs/theme/dolibarr/img/filenew.png b/htdocs/theme/dolibarr/img/filenew.png new file mode 100644 index 0000000000000000000000000000000000000000..563f859eda012468a45ec7cb0350f441877de716 GIT binary patch literal 474 zcmV<00VV#4P)>-bV?k@ zL{Y?iKK~rIX0TpC5DK)=TG&hLL z5N8mZA}+7I`|}8@s4vPR%d_f>DxhYd;t`iGzi3Kzm*H)Skv;OzWjU8u1>0EiLlxaG}@ QO#lD@07*qoM6N<$f*hp8c>n+a literal 0 HcmV?d00001 diff --git a/htdocs/todocomm.class.php3 b/htdocs/todocomm.class.php3 deleted file mode 100644 index 0b4f0f883fa..00000000000 --- a/htdocs/todocomm.class.php3 +++ /dev/null @@ -1,81 +0,0 @@ - - * - * $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(); - } - } -} -?> - diff --git a/mysql/tables/Makefile b/mysql/tables/Makefile index 3ece695c045..bfef6a782b4 100644 --- a/mysql/tables/Makefile +++ b/mysql/tables/Makefile @@ -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 diff --git a/mysql/tables/actioncomm.sql b/mysql/tables/actioncomm.sql index c61b7e942d5..74e961bcfe6 100644 --- a/mysql/tables/actioncomm.sql +++ b/mysql/tables/actioncomm.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 + + + diff --git a/mysql/tables/c_actioncomm.sql b/mysql/tables/c_actioncomm.sql index 2dec65f9e3c..288e3230b42 100644 --- a/mysql/tables/c_actioncomm.sql +++ b/mysql/tables/c_actioncomm.sql @@ -1,4 +1,6 @@ -- ======================================================================== +-- Copyright (C) 2001-2002 Rodolphe Quiedeville +-- -- $Id$ -- $Source$ -- @@ -21,5 +23,6 @@ create table c_actioncomm ( id integer PRIMARY KEY, - libelle varchar(30) + libelle varchar(30), + todo tinyint ); diff --git a/mysql/tables/c_paiement.sql b/mysql/tables/c_paiement.sql index 3fa1482f976..a8030b9f5b3 100644 --- a/mysql/tables/c_paiement.sql +++ b/mysql/tables/c_paiement.sql @@ -1,4 +1,6 @@ -- ======================================================================== +-- Copyright (C) 2001-2002 Rodolphe Quiedeville +-- -- $Id$ -- $Source$ -- diff --git a/mysql/tables/drop.sql b/mysql/tables/drop.sql index 70089dc1857..76f4340fa6a 100644 --- a/mysql/tables/drop.sql +++ b/mysql/tables/drop.sql @@ -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; diff --git a/mysql/tables/llx_bookmark.sql b/mysql/tables/llx_bookmark.sql index 62de5c45e38..c2ee9ac5702 100644 --- a/mysql/tables/llx_bookmark.sql +++ b/mysql/tables/llx_bookmark.sql @@ -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 ); diff --git a/mysql/tables/societe.sql b/mysql/tables/societe.sql index 604dc331b56..86a9760c6cf 100644 --- a/mysql/tables/societe.sql +++ b/mysql/tables/societe.sql @@ -1,6 +1,5 @@ -- ======================================================================== -- Copyright (C) 2000-2002 Rodolphe Quiedeville --- 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 (
RéfNomPrix