From 94e4ebf02b8d7d4889ba1b2e9a696374b1d310f1 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 3 Dec 2004 09:52:25 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/telephonie/sql/Makefile | 30 +++++++++ .../sql/llx_telephonie_client_statistique.sql | 10 +++ .../sql/llx_telephonie_client_stats.sql | 12 ++++ .../sql/llx_telephonie_commande.sql | 20 ++++++ .../llx_telephonie_communications_details.sql | 20 ++++++ .../sql/llx_telephonie_concurrents.sql | 34 ++++++++++ .../sql/llx_telephonie_contact_facture.sql | 17 +++++ .../telephonie/sql/llx_telephonie_facture.sql | 49 ++++++++++++++ .../sql/llx_telephonie_groupeligne.sql | 33 +++++++++ .../sql/llx_telephonie_ligne_statistique.sql | 12 ++++ .../telephonie/sql/llx_telephonie_prefix.sql | 13 ++++ .../sql/llx_telephonie_societe_ligne.sql | 67 +++++++++++++++++++ .../telephonie/sql/llx_telephonie_tarif.sql | 7 ++ .../sql/llx_telephonie_tarif_client.sql | 19 ++++++ .../sql/llx_telephonie_tarif_fournisseur.sql | 21 ++++++ 15 files changed, 364 insertions(+) create mode 100644 htdocs/telephonie/sql/Makefile create mode 100644 htdocs/telephonie/sql/llx_telephonie_client_statistique.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_client_stats.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_commande.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_communications_details.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_concurrents.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_contact_facture.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_facture.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_groupeligne.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_prefix.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_client.sql create mode 100644 htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql diff --git a/htdocs/telephonie/sql/Makefile b/htdocs/telephonie/sql/Makefile new file mode 100644 index 00000000000..efc12518d20 --- /dev/null +++ b/htdocs/telephonie/sql/Makefile @@ -0,0 +1,30 @@ +# Copyright (C) 2004 Rodolphe Quiedeville +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# $Id$ +# $Source$ +# +# Special Makefile for telephonie +# + + +TABLES=$(shell find . -name "*sql") + + + +sql.all: $(TABLES) + find . -name "*sql" | xargs cat | grep -v ^-- | cut -d "-" -f 1 > sql.all + diff --git a/htdocs/telephonie/sql/llx_telephonie_client_statistique.sql b/htdocs/telephonie/sql/llx_telephonie_client_statistique.sql new file mode 100644 index 00000000000..67b533b6883 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_client_statistique.sql @@ -0,0 +1,10 @@ + +create table llx_telephonie_client_statistique ( + dates date, + stat varchar(15), + nb real, + + UNIQUE (dates, stat) + +)type=innodb; + diff --git a/htdocs/telephonie/sql/llx_telephonie_client_stats.sql b/htdocs/telephonie/sql/llx_telephonie_client_stats.sql new file mode 100644 index 00000000000..b09415394c1 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_client_stats.sql @@ -0,0 +1,12 @@ +-- +-- +create table llx_telephonie_client_stats ( + fk_client_comm integer NOT NULL, -- Client décideur + ca real, + gain real, + + UNIQUE INDEX(fk_client_comm) +)type=innodb; + + +ALTER TABLE llx_telephonie_client_stats ADD FOREIGN KEY (fk_client_comm) REFERENCES llx_societe(idp); diff --git a/htdocs/telephonie/sql/llx_telephonie_commande.sql b/htdocs/telephonie/sql/llx_telephonie_commande.sql new file mode 100644 index 00000000000..5bcd2ca106c --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_commande.sql @@ -0,0 +1,20 @@ + +-- +-- +-- +-- +create table llx_telephonie_commande ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime NOT NULL, + fk_user_creat integer NOT NULL, + fk_fournisseur integer NOT NULL, + filename varchar(255) NOT NULL + + +)type=innodb; + +ALTER TABLE llx_telephonie_commande ADD INDEX (fk_user_creat); +ALTER TABLE llx_telephonie_commande ADD INDEX (fk_fournisseur); + +ALTER TABLE llx_telephonie_commande ADD FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid); +ALTER TABLE llx_telephonie_commande ADD FOREIGN KEY (fk_fournisseur) REFERENCES llx_telephonie_fournisseur (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_communications_details.sql b/htdocs/telephonie/sql/llx_telephonie_communications_details.sql new file mode 100644 index 00000000000..400e31d0fd9 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_communications_details.sql @@ -0,0 +1,20 @@ + +create table llx_telephonie_communications_details ( + ligne varchar(255) NOT NULL, + date datetime, + numero varchar(255), + dest varchar(255), + dureetext varchar(255), + fourn_cout varchar(255), + fourn_montant real, + duree integer, -- duree en secondes + tarif_achat_temp real, -- fournisseur tarif temporel + tarif_achat_fixe real, -- fournisseur tarif temporel + tarif_vente_temp real, -- fournisseur tarif temporel + tarif_vente_fixe real, -- fournisseur tarif temporel + cout_achat real, + cout_vente real, + remise real + +)type=innodb; + diff --git a/htdocs/telephonie/sql/llx_telephonie_concurrents.sql b/htdocs/telephonie/sql/llx_telephonie_concurrents.sql new file mode 100644 index 00000000000..bfe4a21ab61 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_concurrents.sql @@ -0,0 +1,34 @@ +-- ======================================================================== +-- Copyright (C) 2004 Rodolphe Quiedeville +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- ======================================================================== + +create table llx_telephonie_concurrents ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + nom varchar(255) NOT NULL, + active smallint DEFAULT 1 + +)type=innodb; + +insert into llx_telephonie_concurrents (nom,active) values ('Inconnu',0); + +insert into llx_telephonie_concurrents (nom) values ('Cegetel'); +insert into llx_telephonie_concurrents (nom) values ('France Telecom'); +insert into llx_telephonie_concurrents (nom) values ('Neuf Telecom'); \ No newline at end of file diff --git a/htdocs/telephonie/sql/llx_telephonie_contact_facture.sql b/htdocs/telephonie/sql/llx_telephonie_contact_facture.sql new file mode 100644 index 00000000000..827a209e36e --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_contact_facture.sql @@ -0,0 +1,17 @@ +-- +-- +-- +-- +create table llx_telephonie_contact_facture ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_contact integer NOT NULL, + fk_ligne integer NOT NULL, + + UNIQUE (fk_contact, fk_ligne) +)type=innodb; + +ALTER TABLE llx_telephonie_contact_facture ADD INDEX (fk_contact); +ALTER TABLE llx_telephonie_contact_facture ADD INDEX (fk_ligne); + +ALTER TABLE llx_telephonie_contact_facture ADD FOREIGN KEY (fk_contact) REFERENCES llx_socpeople (idp); +ALTER TABLE llx_telephonie_contact_facture ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_facture.sql b/htdocs/telephonie/sql/llx_telephonie_facture.sql new file mode 100644 index 00000000000..d5a55e976d1 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_facture.sql @@ -0,0 +1,49 @@ +-- ======================================================================== +-- Copyright (C) 2004 Rodolphe Quiedeville +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-- +-- $Id$ +-- $Source$ +-- +-- ======================================================================== + +create table llx_telephonie_facture ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_ligne integer NOT NULL, + ligne varchar(255) NOT NULL, + date varchar(255) NOT NULL, + fourn_montant real, -- montant donné par le fournisseur + cout_achat real, -- cout calculé sur le fournisseur + cout_vente real, -- cout de vente + remise real, + cout_vente_remise real, + gain real, + fk_facture integer + +)type=innodb; + +-- +-- +ALTER TABLE llx_telephonie_facture ADD INDEX (fk_facture); +ALTER TABLE llx_telephonie_facture ADD INDEX (fk_ligne); + +-- +-- +ALTER TABLE llx_telephonie_facture ADD FOREIGN KEY (fk_facture) +REFERENCES llx_facture (rowid); + +ALTER TABLE llx_telephonie_facture ADD FOREIGN KEY (fk_ligne) +REFERENCES llx_telephonie_societe_ligne (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_groupeligne.sql b/htdocs/telephonie/sql/llx_telephonie_groupeligne.sql new file mode 100644 index 00000000000..ce35349bef3 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_groupeligne.sql @@ -0,0 +1,33 @@ +-- +-- Groupe de lignes +-- +-- +-- +create table llx_telephonie_groupeligne ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + nom varchar(255), + + UNIQUE INDEX(nom) +)type=innodb; + + +create table llx_telephonie_groupe_ligne ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_groupe integer NOT NULL, -- groupe + fk_ligne integer NOT NULL, -- ligne + fk_user integer NOT NULL, + + UNIQUE INDEX(fk_groupe, fk_ligne) +)type=innodb; + + +ALTER TABLE llx_telephonie_groupe_ligne ADD INDEX (fk_groupe); +ALTER TABLE llx_telephonie_groupe_ligne ADD INDEX (fk_ligne); +ALTER TABLE llx_telephonie_groupe_ligne ADD INDEX (fk_user); + +ALTER TABLE llx_telephonie_groupe_ligne ADD FOREIGN KEY (fk_groupe) REFERENCES llx_telephonie_groupeligne(rowid); +ALTER TABLE llx_telephonie_groupe_ligne ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne(rowid); + +ALTER TABLE llx_telephonie_groupe_ligne ADD FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); + + diff --git a/htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql b/htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql new file mode 100644 index 00000000000..7d7d6f2911f --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_ligne_statistique.sql @@ -0,0 +1,12 @@ +-- +-- +-- +-- +create table llx_telephonie_ligne_statistique ( + dates date, + statut smallint, + nb integer, + + UNIQUE (dates, statut) +)type=innodb; + diff --git a/htdocs/telephonie/sql/llx_telephonie_prefix.sql b/htdocs/telephonie/sql/llx_telephonie_prefix.sql new file mode 100644 index 00000000000..6aeac799151 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_prefix.sql @@ -0,0 +1,13 @@ + + +create table llx_telephonie_prefix ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_tarif integer NOT NULL, + prefix varchar(10), + + UNIQUE INDEX(prefix) +)type=innodb; + +ALTER TABLE llx_telephonie_prefix ADD INDEX (fk_tarif); + +ALTER TABLE llx_telephonie_prefix ADD FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql b/htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql new file mode 100644 index 00000000000..26989d2baa5 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_societe_ligne.sql @@ -0,0 +1,67 @@ +-- +-- Statut des lignes +-- +-- 0 a commander +-- 1 commandée +-- 2 recue +-- 3 probleme +-- +create table llx_telephonie_societe_ligne ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + datec datetime, + fk_client_comm integer NOT NULL, -- Client décideur + fk_soc integer NOT NULL, + ligne varchar(12) NOT NULL, + fk_soc_facture integer NOT NULL, + statut smallint DEFAULT 0, + fk_fournisseur integer NOT NULL, + remise real DEFAULT 0, + note text, + fk_commercial integer NOT NULL, + fk_concurrent integer DEFAULT 1 NOT NULL, + fk_user_creat integer, + date_commande datetime, + fk_user_commande integer, + isfacturable enum('oui','non') DEFAULT 'oui', + mode_paiement enum('vir','pre') DEFAULT 'pre', + + code_analytique varchar(12), + + UNIQUE INDEX(fk_soc, ligne) +)type=innodb; + +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_fournisseur); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_client_comm); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_soc); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_soc_facture); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_user_creat); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_user_commande); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_commercial); +ALTER TABLE llx_telephonie_societe_ligne ADD INDEX (fk_concurrent); + +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_fournisseur) REFERENCES llx_telephonie_fournisseur (rowid); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_client_comm) REFERENCES llx_societe(idp); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_soc) REFERENCES llx_societe(idp); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_soc_facture) REFERENCES llx_societe(idp); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_user_commande) REFERENCES llx_user(rowid); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_commercial) REFERENCES llx_user(rowid); +ALTER TABLE llx_telephonie_societe_ligne ADD FOREIGN KEY (fk_concurrent) REFERENCES llx_telephonie_concurrents (rowid); + + + +create table llx_telephonie_societe_ligne_statut ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms datetime, + fk_ligne integer NOT NULL, + statut smallint NOT NULL, + fk_user integer, + comment varchar(255) + +)type=innodb; + +ALTER TABLE llx_telephonie_societe_ligne_statut ADD INDEX (fk_ligne); +ALTER TABLE llx_telephonie_societe_ligne_statut ADD INDEX (fk_user); + +ALTER TABLE llx_telephonie_societe_ligne_statut ADD FOREIGN KEY (fk_ligne) REFERENCES llx_telephonie_societe_ligne(rowid); +ALTER TABLE llx_telephonie_societe_ligne_statut ADD FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif.sql b/htdocs/telephonie/sql/llx_telephonie_tarif.sql new file mode 100644 index 00000000000..1e22401e2cb --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_tarif.sql @@ -0,0 +1,7 @@ +create table llx_telephonie_tarif ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + libelle varchar(255), + + UNIQUE INDEX(libelle) +)type=innodb; + diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_client.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_client.sql new file mode 100644 index 00000000000..87d03e51174 --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_tarif_client.sql @@ -0,0 +1,19 @@ +-- +create table llx_telephonie_tarif_client ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_tarif integer NOT NULL, + fk_client integer NOT NULL, + temporel real default 0, + fixe real default 0, + fk_user integer NOT NULL, + + UNIQUE INDEX(fk_tarif, fk_client) +)type=innodb; + +ALTER TABLE llx_telephonie_tarif_client ADD INDEX (fk_tarif); +ALTER TABLE llx_telephonie_tarif_client ADD INDEX (fk_client); +ALTER TABLE llx_telephonie_tarif_client ADD INDEX (fk_user); + +ALTER TABLE llx_telephonie_tarif_client ADD FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); +ALTER TABLE llx_telephonie_tarif_client ADD FOREIGN KEY (fk_client) REFERENCES llx_societe (idp); +ALTER TABLE llx_telephonie_tarif_client ADD FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); diff --git a/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql b/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql new file mode 100644 index 00000000000..f80408a384c --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_tarif_fournisseur.sql @@ -0,0 +1,21 @@ + +-- +-- +-- +-- +create table llx_telephonie_tarif_fournisseur ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_tarif integer NOT NULL, + fk_fournisseur integer NOT NULL, + temporel real default 0, + fixe real default 0, + + UNIQUE INDEX(fk_tarif, fk_fournisseur) +)type=innodb; + +ALTER TABLE llx_telephonie_tarif_fournisseur ADD INDEX (fk_tarif); +ALTER TABLE llx_telephonie_tarif_fournisseur ADD INDEX (fk_fournisseur); + +ALTER TABLE llx_telephonie_tarif_fournisseur ADD FOREIGN KEY (fk_tarif) REFERENCES llx_telephonie_tarif (rowid); +ALTER TABLE llx_telephonie_tarif_fournisseur ADD FOREIGN KEY (fk_fournisseur) REFERENCES llx_telephonie_fournisseur (rowid); +--