diff --git a/html/admin/sql/account_repository/constraint.sql b/html/admin/sql/account_repository/constraint.sql
index 58934ec86..83f75685a 100644
--- a/html/admin/sql/account_repository/constraint.sql
+++ b/html/admin/sql/account_repository/constraint.sql
@@ -1,16 +1,7 @@
-ALTER TABLE public.ac_dossier OWNER TO phpcompta;
-ALTER TABLE public.ac_users OWNER TO phpcompta;
-ALTER TABLE public.dossier_id OWNER TO phpcompta;
-ALTER TABLE public.jnt_use_dos OWNER TO phpcompta;
-ALTER TABLE public.modeledef OWNER TO phpcompta;
-ALTER TABLE public.priv_user OWNER TO phpcompta;
-ALTER TABLE public.s_modid OWNER TO phpcompta;
-ALTER TABLE public.seq_jnt_use_dos OWNER TO phpcompta;
-ALTER TABLE public.seq_priv_user OWNER TO phpcompta;
-ALTER TABLE public.theme OWNER TO phpcompta;
-ALTER TABLE public.user_global_pref OWNER TO phpcompta;
-ALTER TABLE public.users_id OWNER TO phpcompta;
-ALTER TABLE public.version OWNER TO phpcompta;
+ SET client_encoding = 'LATIN1';
+ SET check_function_bodies = false;
+ SET client_min_messages = warning;
+SET search_path = public, pg_catalog;
ALTER TABLE ONLY ac_dossier
ADD CONSTRAINT ac_dossier_dos_name_key UNIQUE (dos_name);
ALTER TABLE ONLY ac_dossier
diff --git a/html/admin/sql/account_repository/data.sql b/html/admin/sql/account_repository/data.sql
index 98ee3c51b..4cdc4da8b 100644
--- a/html/admin/sql/account_repository/data.sql
+++ b/html/admin/sql/account_repository/data.sql
@@ -26,7 +26,7 @@ SELECT pg_catalog.setval('s_modid', 6, false);
-- Name: seq_jnt_use_dos; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('seq_jnt_use_dos', 23, true);
+SELECT pg_catalog.setval('seq_jnt_use_dos', 24, true);
--
@@ -71,7 +71,7 @@ INSERT INTO jnt_use_dos (jnt_id, use_id, dos_id) VALUES (13, 4, 1);
--
INSERT INTO modeledef (mod_id, mod_name, mod_desc) VALUES (1, '(BE) Basique', 'Comptabilité Belge, tout doit être adaptée');
-
+INSERT INTO modeledef (mod_id, mod_name, mod_desc) VALUES (2, '(FR) Basique', 'Comptabilité Française, tout doit être adaptée');
--
diff --git a/html/admin/sql/account_repository/function.sql b/html/admin/sql/account_repository/function.sql
index 5718534f0..e69de29bb 100644
--- a/html/admin/sql/account_repository/function.sql
+++ b/html/admin/sql/account_repository/function.sql
@@ -1,6 +0,0 @@
-CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
- AS '$libdir/plpgsql', 'plpgsql_call_handler'
- LANGUAGE c;
-CREATE FUNCTION plpgsql_validator(oid) RETURNS void
- AS '$libdir/plpgsql', 'plpgsql_validator'
- LANGUAGE c;
diff --git a/html/admin/sql/account_repository/index.sql b/html/admin/sql/account_repository/index.sql
index d469fb4a0..5f562969f 100644
--- a/html/admin/sql/account_repository/index.sql
+++ b/html/admin/sql/account_repository/index.sql
@@ -1,11 +1,2 @@
-ALTER INDEX public.ac_dossier_dos_name_key OWNER TO phpcompta;
-ALTER INDEX public.ac_dossier_pkey OWNER TO phpcompta;
-ALTER INDEX public.ac_users_pkey OWNER TO phpcompta;
-ALTER INDEX public.ac_users_use_login_key OWNER TO phpcompta;
-ALTER INDEX public.jnt_use_dos_pkey OWNER TO phpcompta;
-ALTER INDEX public.modeledef_pkey OWNER TO phpcompta;
-ALTER INDEX public.pk_user_global_pref OWNER TO phpcompta;
CREATE INDEX fk_jnt_dos_id ON jnt_use_dos USING btree (dos_id);
-ALTER INDEX public.fk_jnt_dos_id OWNER TO phpcompta;
CREATE INDEX fk_jnt_use_dos ON jnt_use_dos USING btree (use_id);
-ALTER INDEX public.fk_jnt_use_dos OWNER TO phpcompta;
diff --git a/html/admin/sql/account_repository/make-sql b/html/admin/sql/account_repository/make-sql
index 6d2bbe0ff..eeea6ef79 100755
--- a/html/admin/sql/account_repository/make-sql
+++ b/html/admin/sql/account_repository/make-sql
@@ -1,11 +1,20 @@
pg_dump -O -U phpcompta -s account_repository | awk '!/--/ {if ( ! /^$/) print $0;}' > schema.sql
awk '/SEQUENCE/,/;/ { print $0;}' < schema.sql > sequence.sql
-awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE DOMAIN/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql >> table.sql
awk '/CREATE VIEW/,/;/ { print $0;}' < schema.sql > view.sql
awk '/INDEX/,/;/ { print $0;}' < schema.sql > index.sql
-awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql > constraint.sql
+(
+echo " SET client_encoding = 'LATIN1';"
+echo " SET check_function_bodies = false;"
+echo " SET client_min_messages = warning;"
+echo "SET search_path = public, pg_catalog;"
+)> constraint.sql
+
+awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql >> constraint.sql
awk '/CREATE FUNCTION/,/LANGUAGE/ { print $0;}' < schema.sql > function.sql
awk '/COMMENT/,/;/ {print $0;}' < schema.sql > comment.sql
+sed -i -e "/ALTER TABLE.*/d" -e "/ADD CONSTRAINT/d" -e "/CREATE PROCEDURAL.*/d" schema.sql
grep setval schema.sql >> sequence.sql
pg_dump -U phpcompta -D -a -O account_repository > data.sql
diff --git a/html/admin/sql/account_repository/schema.sql b/html/admin/sql/account_repository/schema.sql
index 19c4d6a4d..33fe0ef5c 100644
--- a/html/admin/sql/account_repository/schema.sql
+++ b/html/admin/sql/account_repository/schema.sql
@@ -1,16 +1,18 @@
SET client_encoding = 'LATIN1';
SET check_function_bodies = false;
SET client_min_messages = warning;
-
+COMMENT ON SCHEMA public IS 'Standard public schema';
+SET search_path = public, pg_catalog;
+SET default_tablespace = '';
+SET default_with_oids = false;
CREATE TABLE ac_dossier (
- dos_id integer DEFAULT nextval('dossier_id'::text) NOT NULL,
+ dos_id integer DEFAULT nextval(('dossier_id'::text)::regclass) NOT NULL,
dos_name text NOT NULL,
dos_description text,
dos_jnt_user integer DEFAULT 0
);
-
CREATE TABLE ac_users (
- use_id integer DEFAULT nextval('users_id'::text) NOT NULL,
+ use_id integer DEFAULT nextval(('users_id'::text)::regclass) NOT NULL,
use_first_name text,
use_name text,
use_login text NOT NULL,
@@ -19,62 +21,52 @@ CREATE TABLE ac_users (
use_admin integer DEFAULT 0,
CONSTRAINT ac_users_use_active_check CHECK (((use_active = 0) OR (use_active = 1)))
);
-
CREATE SEQUENCE dossier_id
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
-
CREATE TABLE jnt_use_dos (
- jnt_id integer DEFAULT nextval('seq_jnt_use_dos'::text) NOT NULL,
+ jnt_id integer DEFAULT nextval(('seq_jnt_use_dos'::text)::regclass) NOT NULL,
use_id integer NOT NULL,
dos_id integer NOT NULL
);
-
CREATE TABLE modeledef (
- mod_id integer DEFAULT nextval('s_modid'::text) NOT NULL,
+ mod_id integer DEFAULT nextval(('s_modid'::text)::regclass) NOT NULL,
mod_name text NOT NULL,
mod_desc text
);
-
CREATE TABLE priv_user (
- priv_id integer DEFAULT nextval('seq_priv_user'::text) NOT NULL,
+ priv_id integer DEFAULT nextval(('seq_priv_user'::text)::regclass) NOT NULL,
priv_jnt integer NOT NULL,
priv_priv text
);
-
CREATE SEQUENCE s_modid
START WITH 6
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
-
CREATE SEQUENCE seq_jnt_use_dos
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
-
CREATE SEQUENCE seq_priv_user
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
-
CREATE TABLE theme (
the_name text NOT NULL,
the_filestyle text,
the_filebutton text
);
-
CREATE TABLE user_global_pref (
user_id text NOT NULL,
parameter_type text NOT NULL,
parameter_value text
);
-
COMMENT ON TABLE user_global_pref IS 'The user''s global parameter ';
COMMENT ON COLUMN user_global_pref.user_id IS 'user''s login ';
COMMENT ON COLUMN user_global_pref.parameter_type IS 'the type of parameter ';
@@ -84,38 +76,11 @@ CREATE SEQUENCE users_id
NO MAXVALUE
NO MINVALUE
CACHE 1;
-
CREATE TABLE version (
val integer
);
-
-ALTER TABLE ONLY ac_dossier
- ADD CONSTRAINT ac_dossier_dos_name_key UNIQUE (dos_name);
-ALTER INDEX public.ac_dossier_dos_name_key OWNER TO phpcompta;
-ALTER TABLE ONLY ac_dossier
- ADD CONSTRAINT ac_dossier_pkey PRIMARY KEY (dos_id);
-ALTER INDEX public.ac_dossier_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY ac_users
- ADD CONSTRAINT ac_users_pkey PRIMARY KEY (use_id);
-ALTER INDEX public.ac_users_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY ac_users
- ADD CONSTRAINT ac_users_use_login_key UNIQUE (use_login);
-ALTER INDEX public.ac_users_use_login_key OWNER TO phpcompta;
-ALTER TABLE ONLY jnt_use_dos
- ADD CONSTRAINT jnt_use_dos_pkey PRIMARY KEY (use_id, dos_id);
-ALTER INDEX public.jnt_use_dos_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY modeledef
- ADD CONSTRAINT modeledef_pkey PRIMARY KEY (mod_id);
-ALTER INDEX public.modeledef_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY user_global_pref
- ADD CONSTRAINT pk_user_global_pref PRIMARY KEY (user_id, parameter_type);
-ALTER INDEX public.pk_user_global_pref OWNER TO phpcompta;
CREATE INDEX fk_jnt_dos_id ON jnt_use_dos USING btree (dos_id);
-ALTER INDEX public.fk_jnt_dos_id OWNER TO phpcompta;
CREATE INDEX fk_jnt_use_dos ON jnt_use_dos USING btree (use_id);
-ALTER INDEX public.fk_jnt_use_dos OWNER TO phpcompta;
-ALTER TABLE ONLY user_global_pref
- ADD CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES ac_users(use_login) ON UPDATE CASCADE ON DELETE CASCADE;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
diff --git a/html/admin/sql/account_repository/table.sql b/html/admin/sql/account_repository/table.sql
index b9d9ba822..d56f15ba9 100644
--- a/html/admin/sql/account_repository/table.sql
+++ b/html/admin/sql/account_repository/table.sql
@@ -1,11 +1,11 @@
CREATE TABLE ac_dossier (
- dos_id integer DEFAULT nextval('dossier_id'::text) NOT NULL,
+ dos_id integer DEFAULT nextval(('dossier_id'::text)::regclass) NOT NULL,
dos_name text NOT NULL,
dos_description text,
dos_jnt_user integer DEFAULT 0
);
CREATE TABLE ac_users (
- use_id integer DEFAULT nextval('users_id'::text) NOT NULL,
+ use_id integer DEFAULT nextval(('users_id'::text)::regclass) NOT NULL,
use_first_name text,
use_name text,
use_login text NOT NULL,
@@ -15,17 +15,17 @@ CREATE TABLE ac_users (
CONSTRAINT ac_users_use_active_check CHECK (((use_active = 0) OR (use_active = 1)))
);
CREATE TABLE jnt_use_dos (
- jnt_id integer DEFAULT nextval('seq_jnt_use_dos'::text) NOT NULL,
+ jnt_id integer DEFAULT nextval(('seq_jnt_use_dos'::text)::regclass) NOT NULL,
use_id integer NOT NULL,
dos_id integer NOT NULL
);
CREATE TABLE modeledef (
- mod_id integer DEFAULT nextval('s_modid'::text) NOT NULL,
+ mod_id integer DEFAULT nextval(('s_modid'::text)::regclass) NOT NULL,
mod_name text NOT NULL,
mod_desc text
);
CREATE TABLE priv_user (
- priv_id integer DEFAULT nextval('seq_priv_user'::text) NOT NULL,
+ priv_id integer DEFAULT nextval(('seq_priv_user'::text)::regclass) NOT NULL,
priv_jnt integer NOT NULL,
priv_priv text
);
diff --git a/html/admin/sql/dossier1/comment.sql b/html/admin/sql/dossier1/comment.sql
index 55f1b3274..e48a04b72 100644
--- a/html/admin/sql/dossier1/comment.sql
+++ b/html/admin/sql/dossier1/comment.sql
@@ -1,3 +1,5 @@
+COMMENT ON SCHEMA public IS 'Standard public schema';
+COMMENT ON FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) IS ' Often the primary key is a sequence number and sometimes the value of the sequence is not synchronized with the primary key ( p_sequence : sequence name, p_col : col of the pk,p_table : concerned table';
COMMENT ON TABLE "action" IS 'The different privileges';
COMMENT ON TABLE action_gestion IS 'Action for Managing';
COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
diff --git a/html/admin/sql/dossier1/constraint.sql b/html/admin/sql/dossier1/constraint.sql
index 104249ece..b62b49467 100644
--- a/html/admin/sql/dossier1/constraint.sql
+++ b/html/admin/sql/dossier1/constraint.sql
@@ -1,87 +1,7 @@
-ALTER TABLE public."action" OWNER TO phpcompta;
-ALTER TABLE public.action_gestion OWNER TO phpcompta;
-ALTER TABLE public.attr_def OWNER TO phpcompta;
-ALTER TABLE public.attr_min OWNER TO phpcompta;
-ALTER TABLE public.attr_value OWNER TO phpcompta;
-ALTER TABLE public.centralized OWNER TO phpcompta;
-ALTER TABLE public.document OWNER TO phpcompta;
-ALTER TABLE public.document_modele OWNER TO phpcompta;
-ALTER TABLE public.document_seq OWNER TO phpcompta;
-ALTER TABLE public.document_state OWNER TO phpcompta;
-ALTER TABLE public.document_type OWNER TO phpcompta;
-ALTER TABLE public.fiche OWNER TO phpcompta;
-ALTER TABLE public.fiche_def OWNER TO phpcompta;
-ALTER TABLE public.fiche_def_ref OWNER TO phpcompta;
-ALTER TABLE public.form OWNER TO phpcompta;
-ALTER TABLE public.format_csv_banque OWNER TO phpcompta;
-ALTER TABLE public.formdef OWNER TO phpcompta;
-ALTER TABLE public.import_tmp OWNER TO phpcompta;
-ALTER TABLE public.invoice OWNER TO phpcompta;
-ALTER TABLE public.jnt_fic_att_value OWNER TO phpcompta;
-ALTER TABLE public.jnt_fic_attr OWNER TO phpcompta;
-ALTER TABLE public.jrn OWNER TO phpcompta;
-ALTER TABLE public.jrn_action OWNER TO phpcompta;
-ALTER TABLE public.jrn_def OWNER TO phpcompta;
-ALTER TABLE public.jrn_rapt OWNER TO phpcompta;
-ALTER TABLE public.jrn_type OWNER TO phpcompta;
-ALTER TABLE public.jrnx OWNER TO phpcompta;
-ALTER TABLE public.parameter OWNER TO phpcompta;
-ALTER TABLE public.parm_code OWNER TO phpcompta;
-ALTER TABLE public.parm_money OWNER TO phpcompta;
-ALTER TABLE public.parm_periode OWNER TO phpcompta;
-ALTER TABLE public.quant_sold OWNER TO phpcompta;
-ALTER TABLE public.s_attr_def OWNER TO phpcompta;
-ALTER TABLE public.s_central OWNER TO phpcompta;
-ALTER TABLE public.s_central_order OWNER TO phpcompta;
-ALTER TABLE public.s_centralized OWNER TO phpcompta;
-ALTER TABLE public.s_currency OWNER TO phpcompta;
-ALTER TABLE public.s_fdef OWNER TO phpcompta;
-ALTER TABLE public.s_fiche OWNER TO phpcompta;
-ALTER TABLE public.s_fiche_def_ref OWNER TO phpcompta;
-ALTER TABLE public.s_form OWNER TO phpcompta;
-ALTER TABLE public.s_formdef OWNER TO phpcompta;
-ALTER TABLE public.s_grpt OWNER TO phpcompta;
-ALTER TABLE public.s_idef OWNER TO phpcompta;
-ALTER TABLE public.s_internal OWNER TO phpcompta;
-ALTER TABLE public.s_invoice OWNER TO phpcompta;
-ALTER TABLE public.s_jnt_fic_att_value OWNER TO phpcompta;
-ALTER TABLE public.s_jrn OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_1 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_2 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_3 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_4 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_def OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_op OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_rapt OWNER TO phpcompta;
-ALTER TABLE public.s_jrnaction OWNER TO phpcompta;
-ALTER TABLE public.s_jrnx OWNER TO phpcompta;
-ALTER TABLE public.s_periode OWNER TO phpcompta;
-ALTER TABLE public.s_quantity OWNER TO phpcompta;
-ALTER TABLE public.s_stock_goods OWNER TO phpcompta;
-ALTER TABLE public.s_user_act OWNER TO phpcompta;
-ALTER TABLE public.s_user_jrn OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_1 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_2 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_3 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_4 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_5 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_6 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_7 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_8 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_9 OWNER TO phpcompta;
-ALTER TABLE public.stock_goods OWNER TO phpcompta;
-ALTER TABLE public.tmp_pcmn OWNER TO phpcompta;
-ALTER TABLE public.tva_rate OWNER TO phpcompta;
-ALTER TABLE public.user_local_pref OWNER TO phpcompta;
-ALTER TABLE public.user_sec_act OWNER TO phpcompta;
-ALTER TABLE public.user_sec_jrn OWNER TO phpcompta;
-ALTER TABLE public.version OWNER TO phpcompta;
-ALTER TABLE public.vw_client OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_attr OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_def OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_min OWNER TO phpcompta;
-ALTER TABLE public.vw_poste_qcode OWNER TO phpcompta;
-ALTER TABLE public.vw_supplier OWNER TO phpcompta;
+ SET client_encoding = 'LATIN1';
+ SET check_function_bodies = false;
+ SET client_min_messages = warning;
+SET search_path = public, pg_catalog;
ALTER TABLE ONLY action_gestion
ADD CONSTRAINT action_gestion_pkey PRIMARY KEY (ag_id);
ALTER TABLE ONLY "action"
@@ -134,10 +54,10 @@ ALTER TABLE ONLY parm_code
ADD CONSTRAINT parm_code_pkey PRIMARY KEY (p_code);
ALTER TABLE ONLY parm_money
ADD CONSTRAINT parm_money_pkey PRIMARY KEY (pm_code);
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_p_start_key UNIQUE (p_start);
ALTER TABLE ONLY parm_periode
ADD CONSTRAINT parm_periode_pkey PRIMARY KEY (p_id);
+ALTER TABLE ONLY jnt_fic_attr
+ ADD CONSTRAINT pk_jnt_fic_attr PRIMARY KEY (jnt_id);
ALTER TABLE ONLY user_local_pref
ADD CONSTRAINT pk_user_local_pref PRIMARY KEY (user_id, parameter_type);
ALTER TABLE ONLY quant_sold
diff --git a/html/admin/sql/dossier1/data.sql b/html/admin/sql/dossier1/data.sql
index 142ee5428..c923ce3a4 100644
--- a/html/admin/sql/dossier1/data.sql
+++ b/html/admin/sql/dossier1/data.sql
@@ -12,28 +12,28 @@ SET search_path = public, pg_catalog;
-- Name: action_gestion_ag_id_seq; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('action_gestion', 'ag_id'), 1, false);
+SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('action_gestion', 'ag_id'), 1, true);
--
-- Name: document_d_id_seq; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document', 'd_id'), 1, false);
+SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document', 'd_id'), 35, true);
--
-- Name: document_modele_md_id_seq; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_modele', 'md_id'), 1, false);
+SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_modele', 'md_id'), 1, true);
--
-- Name: document_seq; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('document_seq', 1, false);
+SELECT pg_catalog.setval('document_seq', 1, true);
--
@@ -50,6 +50,13 @@ SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_state', 's_
SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_type', 'dt_id'), 10, false);
+--
+-- Name: s_jnt_id; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jnt_id', 84, true);
+
+
--
-- Name: s_attr_def; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -57,6 +64,13 @@ SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_type', 'dt_
SELECT pg_catalog.setval('s_attr_def', 27, true);
+--
+-- Name: s_cbc; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_cbc', 1, false);
+
+
--
-- Name: s_central; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -89,7 +103,7 @@ SELECT pg_catalog.setval('s_currency', 1, true);
-- Name: s_fdef; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_fdef', 10, true);
+SELECT pg_catalog.setval('s_fdef', 11, true);
--
@@ -124,7 +138,7 @@ SELECT pg_catalog.setval('s_formdef', 1, false);
-- Name: s_grpt; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_grpt', 1, true);
+SELECT pg_catalog.setval('s_grpt', 62, true);
--
@@ -138,7 +152,7 @@ SELECT pg_catalog.setval('s_idef', 2, true);
-- Name: s_internal; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_internal', 1, false);
+SELECT pg_catalog.setval('s_internal', 61, true);
--
@@ -152,14 +166,42 @@ SELECT pg_catalog.setval('s_invoice', 1, false);
-- Name: s_jnt_fic_att_value; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_jnt_fic_att_value', 169, true);
+SELECT pg_catalog.setval('s_jnt_fic_att_value', 413, true);
--
-- Name: s_jrn; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_jrn', 139, true);
+SELECT pg_catalog.setval('s_jrn', 200, true);
+
+
+--
+-- Name: s_jrn_1; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_1', 1, false);
+
+
+--
+-- Name: s_jrn_2; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_2', 1, false);
+
+
+--
+-- Name: s_jrn_3; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_3', 1, false);
+
+
+--
+-- Name: s_jrn_4; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_4', 1, false);
--
@@ -173,14 +215,14 @@ SELECT pg_catalog.setval('s_jrn_def', 5, false);
-- Name: s_jrn_op; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_jrn_op', 461, true);
+SELECT pg_catalog.setval('s_jrn_op', 632, true);
--
-- Name: s_jrn_rapt; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_jrn_rapt', 13, true);
+SELECT pg_catalog.setval('s_jrn_rapt', 14, true);
--
@@ -208,14 +250,14 @@ SELECT pg_catalog.setval('s_periode', 65, true);
-- Name: s_quantity; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_quantity', 1, false);
+SELECT pg_catalog.setval('s_quantity', 56, true);
--
-- Name: s_stock_goods; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_stock_goods', 24, true);
+SELECT pg_catalog.setval('s_stock_goods', 99, true);
--
@@ -231,6 +273,70 @@ SELECT pg_catalog.setval('s_user_act', 15, true);
SELECT pg_catalog.setval('s_user_jrn', 12, true);
+
+--
+-- Name: seq_doc_type_1; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_1', 1, false);
+
+
+--
+-- Name: seq_doc_type_2; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_2', 1, false);
+
+
+--
+-- Name: seq_doc_type_3; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_3', 1, false);
+
+
+--
+-- Name: seq_doc_type_4; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_4', 47, true);
+
+
+--
+-- Name: seq_doc_type_5; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_5', 1, false);
+
+
+--
+-- Name: seq_doc_type_6; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_6', 1, false);
+
+
+--
+-- Name: seq_doc_type_7; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_7', 1, false);
+
+
+--
+-- Name: seq_doc_type_8; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_8', 1, false);
+
+
+--
+-- Name: seq_doc_type_9; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_9', 1, false);
+
+
--
-- Data for Name: action; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
@@ -263,6 +369,7 @@ INSERT INTO "action" (ac_id, ac_description) VALUES (30, 'Module Gestion');
-- Data for Name: action_gestion; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
+INSERT INTO action_gestion (ag_id, ag_type, f_id_dest, f_id_exp, ag_title, ag_timestamp, ag_cal, ag_ref_ag_id, ag_comment, ag_ref) VALUES (1, 1, 2, 0, 'Document Interne', '2007-04-14 00:00:00', 'C', 0, 'qsqsqsqsqsqsqsqsqs', '1/1');
--
@@ -283,7 +390,6 @@ INSERT INTO attr_def (ad_id, ad_text) VALUES (11, 'Montant initial');
INSERT INTO attr_def (ad_id, ad_text) VALUES (12, 'Personne de contact ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (13, 'numéro de tva ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (14, 'Adresse ');
-INSERT INTO attr_def (ad_id, ad_text) VALUES (15, 'code postal ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (16, 'pays ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (17, 'téléphone ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (18, 'email ');
@@ -296,29 +402,7 @@ INSERT INTO attr_def (ad_id, ad_text) VALUES (24, 'Ville');
INSERT INTO attr_def (ad_id, ad_text) VALUES (25, 'Société');
INSERT INTO attr_def (ad_id, ad_text) VALUES (26, 'Fax');
INSERT INTO attr_def (ad_id, ad_text) VALUES (27, 'GSM');
-
-
---
--- Data for Name: fiche_def_ref; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (1, 'Vente Service', 700);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (2, 'Achat Marchandises', 604);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (3, 'Achat Service et biens divers', 61);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (4, 'Banque', 5500);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (5, 'Prêt > a un an', 17);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (6, 'Prêt < a un an', 430);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (8, 'Fournisseurs', 440);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (9, 'Clients', 400);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (10, 'Salaire Administrateur', 6200);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (11, 'Salaire Ouvrier', 6203);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (12, 'Salaire Employé', 6202);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (13, 'Dépenses non admises', 674);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (14, 'Administration des Finances', NULL);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (15, 'Autres fiches', NULL);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (7, 'Matériel à amortir', 2400);
-INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (16, 'Contact', NULL);
-
+INSERT INTO attr_def (ad_id, ad_text) VALUES (15, 'code postal');
--
@@ -366,31 +450,24 @@ INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 19);
INSERT INTO attr_min (frd_id, ad_id) VALUES (14, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 4);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 10);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 12);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 4);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 10);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 12);
INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 12);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 12);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 12);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 9);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 8);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 9);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 10);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 11);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 11);
INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 15);
@@ -421,22 +498,236 @@ INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 18);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 25);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 26);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 27);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 23);
+
+
+--
+-- Data for Name: attr_value; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO attr_value (jft_id, av_text) VALUES (12, '4000001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (13, 'Client 1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (14, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (15, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (16, 'Rue du Client 1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (17, '99999');
+INSERT INTO attr_value (jft_id, av_text) VALUES (18, 'Belgique');
+INSERT INTO attr_value (jft_id, av_text) VALUES (19, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (20, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (21, '4000002');
+INSERT INTO attr_value (jft_id, av_text) VALUES (22, 'Client 2');
+INSERT INTO attr_value (jft_id, av_text) VALUES (23, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (24, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (25, 'Rue du client 2');
+INSERT INTO attr_value (jft_id, av_text) VALUES (26, '108000');
+INSERT INTO attr_value (jft_id, av_text) VALUES (27, 'Belgique');
+INSERT INTO attr_value (jft_id, av_text) VALUES (28, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (29, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (34, 'Marchandise B');
+INSERT INTO attr_value (jft_id, av_text) VALUES (35, '1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (47, '70002');
+INSERT INTO attr_value (jft_id, av_text) VALUES (36, '150');
+INSERT INTO attr_value (jft_id, av_text) VALUES (37, '140');
+INSERT INTO attr_value (jft_id, av_text) VALUES (50, '4400001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (51, 'Fournisseur A');
+INSERT INTO attr_value (jft_id, av_text) VALUES (52, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (53, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (54, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (55, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (56, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (57, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (58, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (59, '4400002');
+INSERT INTO attr_value (jft_id, av_text) VALUES (60, 'Fournisseur B');
+INSERT INTO attr_value (jft_id, av_text) VALUES (61, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (62, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (63, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (64, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (65, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (66, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (67, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (68, '610001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (69, 'fourniture A');
+INSERT INTO attr_value (jft_id, av_text) VALUES (70, '1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (71, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (76, '55000002');
+INSERT INTO attr_value (jft_id, av_text) VALUES (77, 'Argenta');
+INSERT INTO attr_value (jft_id, av_text) VALUES (78, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (79, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (80, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (81, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (82, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (83, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (84, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (85, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (86, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (87, '4000003');
+INSERT INTO attr_value (jft_id, av_text) VALUES (88, '4000004');
+INSERT INTO attr_value (jft_id, av_text) VALUES (89, 'Toto');
+INSERT INTO attr_value (jft_id, av_text) VALUES (90, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (91, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (92, 'Maison de toto');
+INSERT INTO attr_value (jft_id, av_text) VALUES (93, 'cp');
+INSERT INTO attr_value (jft_id, av_text) VALUES (94, 'pays');
+INSERT INTO attr_value (jft_id, av_text) VALUES (95, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (96, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (97, '4000005');
+INSERT INTO attr_value (jft_id, av_text) VALUES (98, 'NOUVEAU CLIENT');
+INSERT INTO attr_value (jft_id, av_text) VALUES (99, 'Toto');
+INSERT INTO attr_value (jft_id, av_text) VALUES (100, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (101, 'Adresse');
+INSERT INTO attr_value (jft_id, av_text) VALUES (102, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (103, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (104, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (105, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (42, 'Marchandise D');
+INSERT INTO attr_value (jft_id, av_text) VALUES (43, '15');
+INSERT INTO attr_value (jft_id, av_text) VALUES (49, '70004');
+INSERT INTO attr_value (jft_id, av_text) VALUES (44, '150');
+INSERT INTO attr_value (jft_id, av_text) VALUES (45, '75');
+INSERT INTO attr_value (jft_id, av_text) VALUES (38, 'Marchandise C');
+INSERT INTO attr_value (jft_id, av_text) VALUES (39, '20');
+INSERT INTO attr_value (jft_id, av_text) VALUES (48, '70003');
+INSERT INTO attr_value (jft_id, av_text) VALUES (40, '200');
+INSERT INTO attr_value (jft_id, av_text) VALUES (41, '100');
+INSERT INTO attr_value (jft_id, av_text) VALUES (107, 'Marchandise Ex');
+INSERT INTO attr_value (jft_id, av_text) VALUES (108, '10');
+INSERT INTO attr_value (jft_id, av_text) VALUES (111, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (109, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (110, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (112, '4400003');
+INSERT INTO attr_value (jft_id, av_text) VALUES (113, 'Fournisseur E');
+INSERT INTO attr_value (jft_id, av_text) VALUES (114, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (115, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (116, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (117, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (118, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (119, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (120, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (121, '4400004');
+INSERT INTO attr_value (jft_id, av_text) VALUES (122, 'Propriétaire bureau');
+INSERT INTO attr_value (jft_id, av_text) VALUES (123, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (124, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (125, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (126, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (127, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (128, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (129, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (73, 'Loyer');
+INSERT INTO attr_value (jft_id, av_text) VALUES (74, '4');
+INSERT INTO attr_value (jft_id, av_text) VALUES (72, '610002');
+INSERT INTO attr_value (jft_id, av_text) VALUES (75, '400');
+INSERT INTO attr_value (jft_id, av_text) VALUES (130, '4400005');
+INSERT INTO attr_value (jft_id, av_text) VALUES (131, 'Fournisseur Eau Gaz');
+INSERT INTO attr_value (jft_id, av_text) VALUES (132, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (133, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (134, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (135, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (136, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (137, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (138, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (140, 'eau, gaz electricité');
+INSERT INTO attr_value (jft_id, av_text) VALUES (141, '1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (139, '610003');
+INSERT INTO attr_value (jft_id, av_text) VALUES (142, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (2, 'Banque 1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (3, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (4, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (1, '550');
+INSERT INTO attr_value (jft_id, av_text) VALUES (5, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (6, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (7, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (8, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (9, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (10, 'a');
+INSERT INTO attr_value (jft_id, av_text) VALUES (11, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (106, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (349, 'FID1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (350, 'FID2');
+INSERT INTO attr_value (jft_id, av_text) VALUES (351, 'FID3');
+INSERT INTO attr_value (jft_id, av_text) VALUES (352, 'FID4');
+INSERT INTO attr_value (jft_id, av_text) VALUES (353, 'FID5');
+INSERT INTO attr_value (jft_id, av_text) VALUES (354, 'FID6');
+INSERT INTO attr_value (jft_id, av_text) VALUES (355, 'FID7');
+INSERT INTO attr_value (jft_id, av_text) VALUES (356, 'FID8');
+INSERT INTO attr_value (jft_id, av_text) VALUES (357, 'FID9');
+INSERT INTO attr_value (jft_id, av_text) VALUES (358, 'FID10');
+INSERT INTO attr_value (jft_id, av_text) VALUES (359, 'FID11');
+INSERT INTO attr_value (jft_id, av_text) VALUES (360, 'FID12');
+INSERT INTO attr_value (jft_id, av_text) VALUES (361, 'FID13');
+INSERT INTO attr_value (jft_id, av_text) VALUES (362, 'FID14');
+INSERT INTO attr_value (jft_id, av_text) VALUES (363, 'FID15');
+INSERT INTO attr_value (jft_id, av_text) VALUES (364, 'FID16');
+INSERT INTO attr_value (jft_id, av_text) VALUES (365, 'FID17');
+INSERT INTO attr_value (jft_id, av_text) VALUES (366, 'FID18');
+INSERT INTO attr_value (jft_id, av_text) VALUES (367, 'FID19');
+INSERT INTO attr_value (jft_id, av_text) VALUES (368, 'FID20');
+INSERT INTO attr_value (jft_id, av_text) VALUES (369, 'FID21');
+INSERT INTO attr_value (jft_id, av_text) VALUES (371, 'Test1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (372, '2400001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (373, '2400002');
+INSERT INTO attr_value (jft_id, av_text) VALUES (406, '2400003');
+INSERT INTO attr_value (jft_id, av_text) VALUES (407, '2400004');
+INSERT INTO attr_value (jft_id, av_text) VALUES (408, '2400005');
+INSERT INTO attr_value (jft_id, av_text) VALUES (409, '2400006');
+INSERT INTO attr_value (jft_id, av_text) VALUES (410, '2400001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (411, '2400001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (412, '2400001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (144, 'Achat Marchandise A');
+INSERT INTO attr_value (jft_id, av_text) VALUES (145, '3');
+INSERT INTO attr_value (jft_id, av_text) VALUES (143, '6040001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (146, '350');
+INSERT INTO attr_value (jft_id, av_text) VALUES (147, '');
+INSERT INTO attr_value (jft_id, av_text) VALUES (148, 'MARCHA');
+INSERT INTO attr_value (jft_id, av_text) VALUES (30, 'Marchandise A');
+INSERT INTO attr_value (jft_id, av_text) VALUES (31, '1');
+INSERT INTO attr_value (jft_id, av_text) VALUES (46, '70001');
+INSERT INTO attr_value (jft_id, av_text) VALUES (32, '100');
+INSERT INTO attr_value (jft_id, av_text) VALUES (33, '120');
+INSERT INTO attr_value (jft_id, av_text) VALUES (413, 'MARCHA');
+
+
+--
+-- Data for Name: centralized; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
--
--- Data for Name: fiche_def; Type: TABLE DATA; Schema: public; Owner: phpcompta
+-- Data for Name: document; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (1, 5500, 'Banque', true, 4);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (2, 400, 'Client', true, 9);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (3, 700, 'Vente', false, 1);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (4, 440, 'Fournisseur', true, 8);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (5, 61, 'Charges', true, 3);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (6, 604, 'Marchandise', true, 2);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (9, NULL, 'Taxes & impot', false, 14);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (7, 604, 'March Cat A', true, 2);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (8, 700, 'March Cat b', false, 1);
+
+
+--
+-- Data for Name: document_modele; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: document_state; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO document_state (s_id, s_value) VALUES (1, 'Envoyé');
+INSERT INTO document_state (s_id, s_value) VALUES (2, 'Brouillon');
+INSERT INTO document_state (s_id, s_value) VALUES (3, 'A envoyer');
+INSERT INTO document_state (s_id, s_value) VALUES (4, 'Reçu');
+
+
+--
+-- Data for Name: document_type; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO document_type (dt_id, dt_value) VALUES (1, 'Document Interne');
+INSERT INTO document_type (dt_id, dt_value) VALUES (2, 'Bons de commande client');
+INSERT INTO document_type (dt_id, dt_value) VALUES (3, 'Bon de commande Fournisseur');
+INSERT INTO document_type (dt_id, dt_value) VALUES (4, 'Facture');
+INSERT INTO document_type (dt_id, dt_value) VALUES (5, 'Lettre de rappel');
+INSERT INTO document_type (dt_id, dt_value) VALUES (6, 'Courrier');
+INSERT INTO document_type (dt_id, dt_value) VALUES (7, 'Proposition');
+INSERT INTO document_type (dt_id, dt_value) VALUES (8, 'Email');
+INSERT INTO document_type (dt_id, dt_value) VALUES (9, 'Divers');
--
@@ -464,6 +755,112 @@ INSERT INTO fiche (f_id, fd_id) VALUES (18, 4);
INSERT INTO fiche (f_id, fd_id) VALUES (19, 4);
INSERT INTO fiche (f_id, fd_id) VALUES (20, 5);
INSERT INTO fiche (f_id, fd_id) VALUES (21, 6);
+INSERT INTO fiche (f_id, fd_id) VALUES (23, 11);
+
+
+--
+-- Data for Name: fiche_def; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (1, 5500, 'Banque', true, 4);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (2, 400, 'Client', true, 9);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (4, 440, 'Fournisseur', true, 8);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (5, 61, 'Charges', true, 3);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (6, 604, 'Marchandise', true, 2);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (9, NULL, 'Taxes & impot', false, 14);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (7, 604, 'March Cat A', true, 2);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (8, 700, 'March Cat b', false, 1);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (3, 700, 'Vente', false, 1);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (11, 2400, 'matos', true, 7);
+
+
+--
+-- Data for Name: fiche_def_ref; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (1, 'Vente Service', 700);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (2, 'Achat Marchandises', 604);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (3, 'Achat Service et biens divers', 61);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (4, 'Banque', 5500);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (5, 'Prêt > a un an', 17);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (6, 'Prêt < a un an', 430);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (8, 'Fournisseurs', 440);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (9, 'Clients', 400);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (10, 'Salaire Administrateur', 6200);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (11, 'Salaire Ouvrier', 6203);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (12, 'Salaire Employé', 6202);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (13, 'Dépenses non admises', 674);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (14, 'Administration des Finances', NULL);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (15, 'Autres fiches', NULL);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (7, 'Matériel à amortir', 2400);
+INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (16, 'Contact', NULL);
+
+
+--
+-- Data for Name: form; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000398, 3000000, 1, 'Prestation [ case 03 ]', '[700%]-[7000005]');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000399, 3000000, 2, 'Prestation intra [ case 47 ]', '[7000005]');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000400, 3000000, 3, 'Tva due [case 54]', '[4513]+[4512]+[4511] FROM=01.2005');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000401, 3000000, 4, 'Marchandises, matière première et auxiliaire [case 81 ]', '[60%]');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000402, 3000000, 7, 'Service et bien divers [case 82]', '[61%]');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000403, 3000000, 8, 'bien d''invest [ case 83 ]', '[2400%]');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000404, 3000000, 9, 'TVA déductible [ case 59 ]', 'abs([4117]-[411%])');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000405, 3000000, 8, 'TVA non ded -> voiture', '[610022]*0.21/2');
+INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000406, 3000000, 9, 'Acompte TVA', '[4117]');
+
+
+--
+-- Data for Name: format_csv_banque; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO format_csv_banque (name, include_file) VALUES ('Fortis', 'fortis_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('EUB', 'eub_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('ING', 'ing_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('CBC', 'cbc_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('Argenta Belgique', 'argenta_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('CBC Belgique', 'cbc_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('Dexia', 'dexia_be.inc.php');
+
+
+--
+-- Data for Name: formdef; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO formdef (fr_id, fr_label) VALUES (3000000, 'TVA déclaration Belge');
+
+
+--
+-- Data for Name: import_tmp; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00002/0038', '2007-01-11', '2007-01-11', '-200.00', 'EUR', '000-0000050-50', 'MEXICAN EXPRESS VOTRE DOMICILIATION 053-2648377-37 POUR AMERICAN EXPRESS INTERNAT - ddr374188753761015 REF. : 008316635267', '000-0000050-50 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00002/0037', '2007-01-11', '2007-01-11', '150.00', 'EUR', '000-0000050-50', 'JEANNE TARZANNE STREET 1000 BXL LOYER MENSUEL', '000-0000051-51 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0036', '2007-01-09', '2007-01-09', '200.00', 'EUR', '000-0000050-50', 'ZWARTE PIET STREET 1001 BXL LOYER MENSUEL', '000-0000052-52 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0035', '2007-01-09', '2007-01-09', '250.00', 'EUR', '000-0000050-50', 'XMAS FATHER STREET 1002 BXL LOYER MENSUEL', '000-0000053-53 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0034', '2007-01-09', '2007-01-09', '300.00', 'EUR', '000-0000050-50', 'ELVIS PRESSELAIT STREET 1003 BXL LOYER MENSUEL', '000-0000054-54 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0033', '2007-01-09', '2007-01-01', '0.00', 'EUR', '000-0000050-50', ' PARTICIPATION AUX FRAIS DE TENUE DE VOTRE COMPTE A VUE POUR LE TRIMESTRE EN COURS', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0032', '2007-01-09', '2007-01-02', '-5.00', 'EUR', '000-0000050-50', ' COUT GESTION CARTE DE DEBIT', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0031', '2007-01-09', '2007-01-01', '-5.00', 'EUR', '000-0000050-50', ' COUT GESTION CARTE DE DEBIT', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0030', '2007-01-09', '2007-01-02', '-14.00', 'EUR', '000-0000050-50', ' COUT SERVICE BANCONTACT/MISTER CASH', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0029', '2007-01-09', '2007-01-01', '5.00', 'EUR', '000-0000050-50', ' INTERETS 01/10/2006 - 31/12/2006', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0028', '2007-01-09', '2007-01-01', '-1.00', 'EUR', '000-0000050-50', ' FRAIS D''EXPEDITION DE VOS AVIS BANCAIRES', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0027', '2007-01-08', '2007-01-08', '350.00', 'EUR', '000-0000050-50', 'MICHEL DUPOND STREET 1004 BXL LOYER MENSUEL', '000-0000055-55 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0026', '2007-01-05', '2007-01-05', '400.00', 'EUR', '000-0000050-50', 'MARIE BASDELAINE STREET 1005 BXL LOYER MENSUEL', '000-0000055-56 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0025', '2007-01-03', '2007-01-03', '450.00', 'EUR', '000-0000050-50', 'JOHN DOE STREET 1006 BXL ', '000-0000057-57 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0024', '2007-01-03', '2007-01-03', '500.00', 'EUR', '000-0000050-50', 'JAY PLUSDIDEE STREET 1007 BXL LOYER MENSUEL', '000-0000058-58 ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0023', '2007-01-03', '2007-01-02', '-177.00', 'EUR', '000-0000050-50', 'MAKRAU ACHAT MISTER CASH', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0022', '2007-01-02', '2007-01-02', '-25.00', 'EUR', '000-0000050-50', 'BRIKOSHOP ACHAT MISTER CASH', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0021', '2007-01-02', '2007-01-02', '-20.00', 'EUR', '000-0000050-50', 'POST CHARGEMENT PROTON', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0020', '2007-01-02', '2007-01-02', '-100.00', 'EUR', '000-0000050-50', 'MAKRAU ACHAT MISTER CASH', ' ', NULL, 'n', 55000001, 1, NULL);
+INSERT INTO import_tmp (code, date_exec, date_valeur, montant, devise, compte_ordre, detail, num_compte, poste_comptable, status, bq_account, jrn, jr_rapt) VALUES ('00001/0019', '2007-01-02', '2006-12-31', '-1000.00', 'EUR', '000-0000050-50', ' CHARGES ECHUES', ' ', NULL, 'n', 55000001, 1, NULL);
+
+
+--
+-- Data for Name: invoice; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
--
@@ -639,350 +1036,105 @@ INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (366, 18, 23);
INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (367, 19, 23);
INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (368, 20, 23);
INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (369, 21, 23);
-
-
---
--- Data for Name: attr_value; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO attr_value (jft_id, av_text) VALUES (12, '4000001');
-INSERT INTO attr_value (jft_id, av_text) VALUES (13, 'Client 1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (14, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (15, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (16, 'Rue du Client 1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (17, '99999');
-INSERT INTO attr_value (jft_id, av_text) VALUES (18, 'Belgique');
-INSERT INTO attr_value (jft_id, av_text) VALUES (19, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (20, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (21, '4000002');
-INSERT INTO attr_value (jft_id, av_text) VALUES (22, 'Client 2');
-INSERT INTO attr_value (jft_id, av_text) VALUES (23, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (24, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (25, 'Rue du client 2');
-INSERT INTO attr_value (jft_id, av_text) VALUES (26, '108000');
-INSERT INTO attr_value (jft_id, av_text) VALUES (27, 'Belgique');
-INSERT INTO attr_value (jft_id, av_text) VALUES (28, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (29, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (34, 'Marchandise B');
-INSERT INTO attr_value (jft_id, av_text) VALUES (35, '1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (47, '70002');
-INSERT INTO attr_value (jft_id, av_text) VALUES (36, '150');
-INSERT INTO attr_value (jft_id, av_text) VALUES (37, '140');
-INSERT INTO attr_value (jft_id, av_text) VALUES (50, '4400001');
-INSERT INTO attr_value (jft_id, av_text) VALUES (51, 'Fournisseur A');
-INSERT INTO attr_value (jft_id, av_text) VALUES (52, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (53, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (54, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (55, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (56, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (57, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (58, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (59, '4400002');
-INSERT INTO attr_value (jft_id, av_text) VALUES (60, 'Fournisseur B');
-INSERT INTO attr_value (jft_id, av_text) VALUES (61, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (62, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (63, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (64, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (65, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (66, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (67, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (68, '610001');
-INSERT INTO attr_value (jft_id, av_text) VALUES (69, 'fourniture A');
-INSERT INTO attr_value (jft_id, av_text) VALUES (70, '1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (71, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (76, '55000002');
-INSERT INTO attr_value (jft_id, av_text) VALUES (77, 'Argenta');
-INSERT INTO attr_value (jft_id, av_text) VALUES (78, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (79, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (80, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (81, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (82, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (83, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (84, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (85, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (86, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (87, '4000003');
-INSERT INTO attr_value (jft_id, av_text) VALUES (88, '4000004');
-INSERT INTO attr_value (jft_id, av_text) VALUES (89, 'Toto');
-INSERT INTO attr_value (jft_id, av_text) VALUES (90, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (91, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (92, 'Maison de toto');
-INSERT INTO attr_value (jft_id, av_text) VALUES (93, 'cp');
-INSERT INTO attr_value (jft_id, av_text) VALUES (94, 'pays');
-INSERT INTO attr_value (jft_id, av_text) VALUES (95, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (96, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (97, '4000005');
-INSERT INTO attr_value (jft_id, av_text) VALUES (98, 'NOUVEAU CLIENT');
-INSERT INTO attr_value (jft_id, av_text) VALUES (99, 'Toto');
-INSERT INTO attr_value (jft_id, av_text) VALUES (100, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (101, 'Adresse');
-INSERT INTO attr_value (jft_id, av_text) VALUES (102, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (103, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (104, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (105, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (42, 'Marchandise D');
-INSERT INTO attr_value (jft_id, av_text) VALUES (43, '15');
-INSERT INTO attr_value (jft_id, av_text) VALUES (49, '70004');
-INSERT INTO attr_value (jft_id, av_text) VALUES (44, '150');
-INSERT INTO attr_value (jft_id, av_text) VALUES (45, '75');
-INSERT INTO attr_value (jft_id, av_text) VALUES (38, 'Marchandise C');
-INSERT INTO attr_value (jft_id, av_text) VALUES (39, '20');
-INSERT INTO attr_value (jft_id, av_text) VALUES (48, '70003');
-INSERT INTO attr_value (jft_id, av_text) VALUES (40, '200');
-INSERT INTO attr_value (jft_id, av_text) VALUES (41, '100');
-INSERT INTO attr_value (jft_id, av_text) VALUES (107, 'Marchandise Ex');
-INSERT INTO attr_value (jft_id, av_text) VALUES (108, '10');
-INSERT INTO attr_value (jft_id, av_text) VALUES (111, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (109, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (110, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (30, 'Marchandise A');
-INSERT INTO attr_value (jft_id, av_text) VALUES (46, '70001');
-INSERT INTO attr_value (jft_id, av_text) VALUES (32, '100');
-INSERT INTO attr_value (jft_id, av_text) VALUES (33, '120');
-INSERT INTO attr_value (jft_id, av_text) VALUES (31, '1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (112, '4400003');
-INSERT INTO attr_value (jft_id, av_text) VALUES (113, 'Fournisseur E');
-INSERT INTO attr_value (jft_id, av_text) VALUES (114, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (115, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (116, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (117, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (118, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (119, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (120, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (121, '4400004');
-INSERT INTO attr_value (jft_id, av_text) VALUES (122, 'Propriétaire bureau');
-INSERT INTO attr_value (jft_id, av_text) VALUES (123, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (124, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (125, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (126, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (127, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (128, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (129, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (73, 'Loyer');
-INSERT INTO attr_value (jft_id, av_text) VALUES (74, '4');
-INSERT INTO attr_value (jft_id, av_text) VALUES (72, '610002');
-INSERT INTO attr_value (jft_id, av_text) VALUES (75, '400');
-INSERT INTO attr_value (jft_id, av_text) VALUES (130, '4400005');
-INSERT INTO attr_value (jft_id, av_text) VALUES (131, 'Fournisseur Eau Gaz');
-INSERT INTO attr_value (jft_id, av_text) VALUES (132, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (133, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (134, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (135, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (136, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (137, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (138, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (140, 'eau, gaz electricité');
-INSERT INTO attr_value (jft_id, av_text) VALUES (141, '1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (139, '610003');
-INSERT INTO attr_value (jft_id, av_text) VALUES (142, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (2, 'Banque 1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (3, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (4, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (1, '550');
-INSERT INTO attr_value (jft_id, av_text) VALUES (5, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (6, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (7, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (8, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (9, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (10, 'a');
-INSERT INTO attr_value (jft_id, av_text) VALUES (11, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (106, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (144, 'Achat Marchandise A');
-INSERT INTO attr_value (jft_id, av_text) VALUES (145, '3');
-INSERT INTO attr_value (jft_id, av_text) VALUES (143, '6040001');
-INSERT INTO attr_value (jft_id, av_text) VALUES (146, '350');
-INSERT INTO attr_value (jft_id, av_text) VALUES (147, '');
-INSERT INTO attr_value (jft_id, av_text) VALUES (148, '1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (349, 'FID1');
-INSERT INTO attr_value (jft_id, av_text) VALUES (350, 'FID2');
-INSERT INTO attr_value (jft_id, av_text) VALUES (351, 'FID3');
-INSERT INTO attr_value (jft_id, av_text) VALUES (352, 'FID4');
-INSERT INTO attr_value (jft_id, av_text) VALUES (353, 'FID5');
-INSERT INTO attr_value (jft_id, av_text) VALUES (354, 'FID6');
-INSERT INTO attr_value (jft_id, av_text) VALUES (355, 'FID7');
-INSERT INTO attr_value (jft_id, av_text) VALUES (356, 'FID8');
-INSERT INTO attr_value (jft_id, av_text) VALUES (357, 'FID9');
-INSERT INTO attr_value (jft_id, av_text) VALUES (358, 'FID10');
-INSERT INTO attr_value (jft_id, av_text) VALUES (359, 'FID11');
-INSERT INTO attr_value (jft_id, av_text) VALUES (360, 'FID12');
-INSERT INTO attr_value (jft_id, av_text) VALUES (361, 'FID13');
-INSERT INTO attr_value (jft_id, av_text) VALUES (362, 'FID14');
-INSERT INTO attr_value (jft_id, av_text) VALUES (363, 'FID15');
-INSERT INTO attr_value (jft_id, av_text) VALUES (364, 'FID16');
-INSERT INTO attr_value (jft_id, av_text) VALUES (365, 'FID17');
-INSERT INTO attr_value (jft_id, av_text) VALUES (366, 'FID18');
-INSERT INTO attr_value (jft_id, av_text) VALUES (367, 'FID19');
-INSERT INTO attr_value (jft_id, av_text) VALUES (368, 'FID20');
-INSERT INTO attr_value (jft_id, av_text) VALUES (369, 'FID21');
-
-
---
--- Data for Name: centralized; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-
-
---
--- Data for Name: document; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-
-
---
--- Data for Name: document_modele; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-
-
---
--- Data for Name: document_state; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO document_state (s_id, s_value) VALUES (1, 'Envoyé');
-INSERT INTO document_state (s_id, s_value) VALUES (2, 'Brouillon');
-INSERT INTO document_state (s_id, s_value) VALUES (3, 'A envoyer');
-INSERT INTO document_state (s_id, s_value) VALUES (4, 'Reçu');
-
-
---
--- Data for Name: document_type; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO document_type (dt_id, dt_value) VALUES (1, 'Document Interne');
-INSERT INTO document_type (dt_id, dt_value) VALUES (2, 'Bons de commande client');
-INSERT INTO document_type (dt_id, dt_value) VALUES (3, 'Bon de commande Fournisseur');
-INSERT INTO document_type (dt_id, dt_value) VALUES (4, 'Facture');
-INSERT INTO document_type (dt_id, dt_value) VALUES (5, 'Lettre de rappel');
-INSERT INTO document_type (dt_id, dt_value) VALUES (6, 'Courrier');
-INSERT INTO document_type (dt_id, dt_value) VALUES (7, 'Proposition');
-INSERT INTO document_type (dt_id, dt_value) VALUES (8, 'Email');
-INSERT INTO document_type (dt_id, dt_value) VALUES (9, 'Divers');
-
-
---
--- Data for Name: formdef; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO formdef (fr_id, fr_label) VALUES (3000000, 'TVA déclaration Belge');
-
-
---
--- Data for Name: form; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000398, 3000000, 1, 'Prestation [ case 03 ]', '[700%]-[7000005]');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000399, 3000000, 2, 'Prestation intra [ case 47 ]', '[7000005]');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000400, 3000000, 3, 'Tva due [case 54]', '[4513]+[4512]+[4511] FROM=01.2005');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000401, 3000000, 4, 'Marchandises, matière première et auxiliaire [case 81 ]', '[60%]');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000402, 3000000, 7, 'Service et bien divers [case 82]', '[61%]');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000403, 3000000, 8, 'bien d''invest [ case 83 ]', '[2400%]');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000404, 3000000, 9, 'TVA déductible [ case 59 ]', 'abs([4117]-[411%])');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000405, 3000000, 8, 'TVA non ded -> voiture', '[610022]*0.21/2');
-INSERT INTO form (fo_id, fo_fr_id, fo_pos, fo_label, fo_formula) VALUES (3000406, 3000000, 9, 'Acompte TVA', '[4117]');
-
-
---
--- Data for Name: format_csv_banque; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-INSERT INTO format_csv_banque (name, include_file) VALUES ('Fortis', 'fortis_be.inc.php');
-INSERT INTO format_csv_banque (name, include_file) VALUES ('EUB', 'eub_be.inc.php');
-INSERT INTO format_csv_banque (name, include_file) VALUES ('ING', 'ing_be.inc.php');
-INSERT INTO format_csv_banque (name, include_file) VALUES ('CBC', 'cbc_be.inc.php');
-INSERT INTO format_csv_banque (name, include_file) VALUES ('Argenta Belgique', 'argenta_be.inc.php');
-INSERT INTO format_csv_banque (name, include_file) VALUES ('CBC Belgique', 'cbc_be.inc.php');
-
---
--- Data for Name: import_tmp; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
-
-
-
---
--- Data for Name: invoice; Type: TABLE DATA; Schema: public; Owner: phpcompta
---
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (371, 23, 1);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (372, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (373, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (406, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (407, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (408, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (409, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (410, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (411, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (412, 23, 5);
+INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (413, 4, 19);
--
-- Data for Name: jnt_fic_attr; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 3);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 4);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 13);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 13);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 6);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 13);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 6);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 19);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 6);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 19);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (8, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (8, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (8, 6);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (8, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (8, 19);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 9);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (9, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (7, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (8, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 24);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 24);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 24);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 5, 1);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 1, 2);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 3, 3);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 4, 4);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 12, 5);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 13, 6);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 14, 7);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 15, 8);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 16, 9);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 17, 10);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 18, 11);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 5, 12);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 1, 13);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 12, 14);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 13, 15);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 14, 16);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 15, 17);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 16, 18);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 17, 19);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 18, 20);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 1, 21);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 2, 22);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 6, 23);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 7, 24);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 5, 25);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 5, 26);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 1, 27);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 12, 28);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 13, 29);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 14, 30);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 15, 31);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 16, 32);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 17, 33);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 18, 34);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 5, 35);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 1, 36);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 2, 37);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 7, 38);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 5, 39);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 1, 40);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 2, 41);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 6, 42);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 7, 43);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 19, 44);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 5, 45);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 1, 46);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 2, 47);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 6, 48);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 7, 49);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 19, 50);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (8, 1, 51);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (8, 2, 52);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (8, 6, 53);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (8, 7, 54);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (8, 19, 55);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 1, 56);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 5, 57);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 9, 58);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 12, 59);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 14, 60);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 15, 61);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 17, 62);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 18, 63);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 16, 64);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 23, 65);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 23, 66);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 23, 67);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 23, 68);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 23, 69);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 23, 70);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (9, 23, 71);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (7, 23, 72);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (8, 23, 73);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 24, 74);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 24, 75);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (11, 5, 77);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (11, 1, 78);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (11, 8, 79);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (11, 9, 80);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (11, 10, 81);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (11, 23, 82);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 19, 83);
--
@@ -1013,15 +1165,16 @@ INSERT INTO jrn_action (ja_id, ja_name, ja_desc, ja_url, ja_action, ja_lang, ja_
--
INSERT INTO jrn_def (jrn_def_id, jrn_def_name, jrn_def_class_deb, jrn_def_class_cred, jrn_def_fiche_deb, jrn_def_fiche_cred, jrn_deb_max_line, jrn_cred_max_line, jrn_def_ech, jrn_def_ech_lib, jrn_def_type, jrn_def_code) VALUES (4, 'Opération Diverses', NULL, NULL, NULL, NULL, 5, 5, false, NULL, 'OD ', 'OD-01');
-INSERT INTO jrn_def (jrn_def_id, jrn_def_name, jrn_def_class_deb, jrn_def_class_cred, jrn_def_fiche_deb, jrn_def_fiche_cred, jrn_deb_max_line, jrn_cred_max_line, jrn_def_ech, jrn_def_ech_lib, jrn_def_type, jrn_def_code) VALUES (3, 'Achat', '6*', '4*', '5', '4', 1, 3, true, 'échéance', 'ACH', 'ACH-01');
INSERT INTO jrn_def (jrn_def_id, jrn_def_name, jrn_def_class_deb, jrn_def_class_cred, jrn_def_fiche_deb, jrn_def_fiche_cred, jrn_deb_max_line, jrn_cred_max_line, jrn_def_ech, jrn_def_ech_lib, jrn_def_type, jrn_def_code) VALUES (2, 'Vente', '7*', '4*', '2', '3', 1, 3, true, 'échéance', 'VEN', 'VEN-01');
INSERT INTO jrn_def (jrn_def_id, jrn_def_name, jrn_def_class_deb, jrn_def_class_cred, jrn_def_fiche_deb, jrn_def_fiche_cred, jrn_deb_max_line, jrn_cred_max_line, jrn_def_ech, jrn_def_ech_lib, jrn_def_type, jrn_def_code) VALUES (1, 'Financier', '5* ', '5*', '1,2,4,9', '1,2,4,9', 5, 5, false, NULL, 'FIN', 'FIN-01');
+INSERT INTO jrn_def (jrn_def_id, jrn_def_name, jrn_def_class_deb, jrn_def_class_cred, jrn_def_fiche_deb, jrn_def_fiche_cred, jrn_deb_max_line, jrn_cred_max_line, jrn_def_ech, jrn_def_ech_lib, jrn_def_type, jrn_def_code) VALUES (3, 'Achat', '6*', '4*', '5,6', '4', 1, 1, true, 'échéance', 'ACH', 'ACH-01');
--
-- Data for Name: jrn_rapt; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
+INSERT INTO jrn_rapt (jra_id, jr_id, jra_concerned) VALUES (14, 189, 189);
--
@@ -1067,7 +1220,7 @@ INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('VIREMENT_INTERNE', '
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('COMPTE_COURANT', '56', 'Poste comptable pour le compte courant');
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('CAISSE', '57', 'Poste comptable pour la caisse');
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('TVA_DNA', '6740', 'Tva non déductible s');
-INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('TVA_DED_IMPOT', '64012', 'Tva déductible par l''impôt');
+INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('TVA_DED_IMPOT', '619000', 'Tva déductible par l''impôt');
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('VENTE', '70', 'Poste comptable de base pour les ventes');
@@ -1114,12 +1267,88 @@ INSERT INTO parm_periode (p_id, p_start, p_end, p_exercice, p_closed, p_central)
-- Data for Name: quant_sold; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (1, '1VEN-01-1', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (2, '1VEN-01-2', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (3, '1VEN-01-3', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (4, '1VEN-01-4', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (5, '1VEN-01-5', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (6, '1VEN-01-6', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (7, '1VEN-01-7', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (8, '1VEN-01-8', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (9, '1VEN-01-9', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (10, '1VEN-01-16', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (11, '1VEN-01-17', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (12, '1VEN-01-18', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (13, '1VEN-01-19', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (14, '1VEN-01-20', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (15, '1VEN-01-21', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (16, '1VEN-01-22', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (17, '1VEN-01-23', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (18, '1VEN-01-24', 7, 1.0000, 150.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (19, '1VEN-01-25', 7, 1.0000, 150.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (20, '1VEN-01-34', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (21, '1VEN-01-35', 7, 1.0000, 150.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (22, '1VEN-01-36', 7, 1.0000, 150.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (23, '1VEN-01-37', 7, 1.0000, 150.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (24, '1VEN-01-38', 7, 1.0000, 150.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (25, '1VEN-01-39', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (26, '1VEN-01-40', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (27, '1VEN-01-41', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (28, '1VEN-01-48', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (29, '1VEN-01-49', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (30, '1VEN-01-50', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (31, '1VEN-01-51', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (32, '1VEN-01-52', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (33, '1VEN-01-53', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (34, '1VEN-01-54', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (35, '1VEN-01-55', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (36, '1VEN-01-56', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (37, '1VEN-01-57', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (38, '1VEN-01-64', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (39, '1VEN-01-65', 4, 10.0000, 1000.0000, 210.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (40, '1VEN-01-66', 4, 95.5000, 9550.0000, 2005.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (41, '1VEN-01-66', 4, 20.0000, 4000.0000, 840.0000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (42, '1VEN-01-68', 4, 123.0000, 147.6000, 0.0000, NULL, 2);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (43, '1VEN-01-68', 4, 5.8000, 5.2200, 0.0000, NULL, 2);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (44, '1VEN-01-70', 4, 1.0000, 120.0000, 0.0000, NULL, 2);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (45, '1VEN-01-71', 4, 10.0000, 10.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (46, '1VEN-01-80', 4, 10.2000, 1022.0400, 214.6300, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (47, '1VEN-01-80', 5, 1.0000, 150.0000, 31.5000, 1, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (48, '1VEN-01-82', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (49, '1VEN-01-83', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (50, '1VEN-01-84', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (51, '1VEN-01-85', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (52, '1VEN-01-86', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (53, '1VEN-01-87', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (54, '1VEN-01-88', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (55, '1VEN-01-89', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
+INSERT INTO quant_sold (qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat, qs_vat_code, qs_client) VALUES (56, '1VEN-01-96', 6, 1.0000, 200.0000, 0.0000, NULL, 3);
--
-- Data for Name: stock_goods; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (79, 590, 21, 'MARCHA', 100.0000, 'd', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (80, 591, 21, 'MARCHA', 45.5000, 'd', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (81, 595, 4, 'MARCHA', 1.0000, 'c', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (82, NULL, 0, 'MARCHA', 2.0000, 'c', '2007-04-17', '2007-04-17', 'phpcompta', NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (83, 598, 4, 'MARCHA', 10.0000, 'c', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (85, 603, 21, 'MARCHA', -5.0000, 'd', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (86, NULL, 0, 'MARCHA', 5.0000, 'd', '2007-04-17', '2007-04-17', 'phpcompta', NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (87, NULL, 0, 'MARCHA', 5.0000, 'd', '2007-04-17', '2007-04-17', 'phpcompta', NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (88, 607, 4, 'MARCHA', 10.2000, 'c', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (89, 608, 5, '', 1.0000, 'c', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (90, 610, 21, 'MARCHA', 1.0000, 'd', NULL, '2007-04-17', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (91, 614, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (92, 616, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (93, 618, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (94, 620, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (95, 622, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (96, 624, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (97, 626, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (98, 628, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
+INSERT INTO stock_goods (sg_id, j_id, f_id, sg_code, sg_quantity, sg_type, sg_date, sg_tech_date, sg_tech_user, sg_comment, sg_exercice) VALUES (99, 630, 6, '', 1.0000, 'c', NULL, '2007-04-19', NULL, NULL, NULL);
--
@@ -1629,8 +1858,10 @@ INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (440
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (610003, 'eau, gaz electricité', 61, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (550, 'Banque 1', 55, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (6040001, 'Marchandise A', 604, 'BE');
-INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (64012, 'TVA récupérable par l''impôt', 64, 'BE');
+INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (6190, 'TVA récupérable par l''impôt', 61, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (6740, 'Dépense non admise', 67, 'BE');
+INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (2400, 'matos', 24, 'BE');
+INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (2400001, 'Test1', 2400, 'BE');
--
@@ -1649,7 +1880,7 @@ INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUE
INSERT INTO user_local_pref (user_id, parameter_type, parameter_value) VALUES ('france', 'PERIODE', '1');
INSERT INTO user_local_pref (user_id, parameter_type, parameter_value) VALUES ('dany', 'PERIODE', '30');
-INSERT INTO user_local_pref (user_id, parameter_type, parameter_value) VALUES ('phpcompta', 'PERIODE', '40');
+INSERT INTO user_local_pref (user_id, parameter_type, parameter_value) VALUES ('phpcompta', 'PERIODE', '57');
--
@@ -1692,151 +1923,10 @@ INSERT INTO user_sec_jrn (uj_id, uj_login, uj_jrn_id, uj_priv) VALUES (8, 'dany'
-- Data for Name: version; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO version (val) VALUES (15);
+INSERT INTO version (val) VALUES (28);
--
--- Add constraint
+-- PostgreSQL database dump complete
--
-ALTER TABLE ONLY action_gestion
- ADD CONSTRAINT action_gestion_pkey PRIMARY KEY (ag_id);
-ALTER INDEX public.action_gestion_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY "action"
- ADD CONSTRAINT action_pkey PRIMARY KEY (ac_id);
-ALTER INDEX public.action_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY attr_def
- ADD CONSTRAINT attr_def_pkey PRIMARY KEY (ad_id);
-ALTER INDEX public.attr_def_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT centralized_pkey PRIMARY KEY (c_id);
-ALTER INDEX public.centralized_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY document_modele
- ADD CONSTRAINT document_modele_pkey PRIMARY KEY (md_id);
-ALTER INDEX public.document_modele_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY document
- ADD CONSTRAINT document_pkey PRIMARY KEY (d_id);
-ALTER INDEX public.document_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY document_state
- ADD CONSTRAINT document_state_pkey PRIMARY KEY (s_id);
-ALTER INDEX public.document_state_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY document_type
- ADD CONSTRAINT document_type_pkey PRIMARY KEY (dt_id);
-ALTER INDEX public.document_type_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY fiche_def
- ADD CONSTRAINT fiche_def_pkey PRIMARY KEY (fd_id);
-ALTER INDEX public.fiche_def_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY fiche_def_ref
- ADD CONSTRAINT fiche_def_ref_pkey PRIMARY KEY (frd_id);
-ALTER INDEX public.fiche_def_ref_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY fiche
- ADD CONSTRAINT fiche_pkey PRIMARY KEY (f_id);
-ALTER INDEX public.fiche_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY form
- ADD CONSTRAINT form_pkey PRIMARY KEY (fo_id);
-ALTER INDEX public.form_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY format_csv_banque
- ADD CONSTRAINT format_csv_banque_pkey PRIMARY KEY (name);
-ALTER INDEX public.format_csv_banque_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY formdef
- ADD CONSTRAINT formdef_pkey PRIMARY KEY (fr_id);
-ALTER INDEX public.formdef_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY invoice
- ADD CONSTRAINT invoice_pkey PRIMARY KEY (iv_id);
-ALTER INDEX public.invoice_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT jnt_fic_att_value_pkey PRIMARY KEY (jft_id);
-ALTER INDEX public.jnt_fic_att_value_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jrn_action
- ADD CONSTRAINT jrn_action_pkey PRIMARY KEY (ja_id);
-ALTER INDEX public.jrn_action_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT jrn_def_jrn_def_name_key UNIQUE (jrn_def_name);
-ALTER INDEX public.jrn_def_jrn_def_name_key OWNER TO phpcompta;
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT jrn_def_pkey PRIMARY KEY (jrn_def_id);
-ALTER INDEX public.jrn_def_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jrn
- ADD CONSTRAINT jrn_pkey PRIMARY KEY (jr_id, jr_def_id);
-ALTER INDEX public.jrn_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jrn_rapt
- ADD CONSTRAINT jrn_rapt_pkey PRIMARY KEY (jra_id);
-ALTER INDEX public.jrn_rapt_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jrn_type
- ADD CONSTRAINT jrn_type_pkey PRIMARY KEY (jrn_type_id);
-ALTER INDEX public.jrn_type_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT jrnx_pkey PRIMARY KEY (j_id);
-ALTER INDEX public.jrnx_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY parameter
- ADD CONSTRAINT parameter_pkey PRIMARY KEY (pr_id);
-ALTER INDEX public.parameter_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY parm_code
- ADD CONSTRAINT parm_code_pkey PRIMARY KEY (p_code);
-ALTER INDEX public.parm_code_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY parm_money
- ADD CONSTRAINT parm_money_pkey PRIMARY KEY (pm_code);
-ALTER INDEX public.parm_money_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_p_start_key UNIQUE (p_start);
-ALTER INDEX public.parm_periode_p_start_key OWNER TO phpcompta;
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_pkey PRIMARY KEY (p_id);
-ALTER INDEX public.parm_periode_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY user_local_pref
- ADD CONSTRAINT pk_user_local_pref PRIMARY KEY (user_id, parameter_type);
-ALTER INDEX public.pk_user_local_pref OWNER TO phpcompta;
-ALTER TABLE ONLY quant_sold
- ADD CONSTRAINT qs_id_pk PRIMARY KEY (qs_id);
-ALTER INDEX public.qs_id_pk OWNER TO phpcompta;
-ALTER TABLE ONLY stock_goods
- ADD CONSTRAINT stock_goods_pkey PRIMARY KEY (sg_id);
-ALTER INDEX public.stock_goods_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY tmp_pcmn
- ADD CONSTRAINT tmp_pcmn_pkey PRIMARY KEY (pcm_val);
-ALTER INDEX public.tmp_pcmn_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY user_sec_act
- ADD CONSTRAINT user_sec_act_pkey PRIMARY KEY (ua_id);
-ALTER INDEX public.user_sec_act_pkey OWNER TO phpcompta;
-ALTER TABLE ONLY user_sec_jrn
- ADD CONSTRAINT user_sec_jrn_pkey PRIMARY KEY (uj_id);
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT "$1" FOREIGN KEY (jrn_def_type) REFERENCES jrn_type(jrn_type_id);
-ALTER TABLE ONLY form
- ADD CONSTRAINT "$1" FOREIGN KEY (fo_fr_id) REFERENCES formdef(fr_id);
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT "$1" FOREIGN KEY (c_jrn_def) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY user_sec_jrn
- ADD CONSTRAINT "$1" FOREIGN KEY (uj_jrn_id) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY user_sec_act
- ADD CONSTRAINT "$1" FOREIGN KEY (ua_act_id) REFERENCES "action"(ac_id);
-ALTER TABLE ONLY jrn_action
- ADD CONSTRAINT "$1" FOREIGN KEY (ja_jrn_type) REFERENCES jrn_type(jrn_type_id);
-ALTER TABLE ONLY fiche_def
- ADD CONSTRAINT "$1" FOREIGN KEY (frd_id) REFERENCES fiche_def_ref(frd_id);
-ALTER TABLE ONLY fiche
- ADD CONSTRAINT "$1" FOREIGN KEY (fd_id) REFERENCES fiche_def(fd_id);
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT "$1" FOREIGN KEY (f_id) REFERENCES fiche(f_id);
-ALTER TABLE ONLY attr_value
- ADD CONSTRAINT "$1" FOREIGN KEY (jft_id) REFERENCES jnt_fic_att_value(jft_id);
-ALTER TABLE ONLY jnt_fic_attr
- ADD CONSTRAINT "$1" FOREIGN KEY (fd_id) REFERENCES fiche_def(fd_id);
-ALTER TABLE ONLY jrn
- ADD CONSTRAINT "$1" FOREIGN KEY (jr_def_id) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY attr_min
- ADD CONSTRAINT "$1" FOREIGN KEY (frd_id) REFERENCES fiche_def_ref(frd_id);
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT "$1" FOREIGN KEY (j_poste) REFERENCES tmp_pcmn(pcm_val);
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT "$2" FOREIGN KEY (j_jrn_def) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-ALTER TABLE ONLY jnt_fic_attr
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-ALTER TABLE ONLY attr_min
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT "$2" FOREIGN KEY (c_poste) REFERENCES tmp_pcmn(pcm_val);
-ALTER TABLE ONLY document_modele
- ADD CONSTRAINT md_type FOREIGN KEY (md_type) REFERENCES document_type(dt_id);
diff --git a/html/admin/sql/dossier1/function.sql b/html/admin/sql/dossier1/function.sql
index e1046306f..3480ab5f5 100644
--- a/html/admin/sql/dossier1/function.sql
+++ b/html/admin/sql/dossier1/function.sql
@@ -30,21 +30,27 @@ $$
CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
AS $$
declare
- class_base poste_comptable;
- maxcode int8;
+ class_base poste_comptable;
+ maxcode poste_comptable;
begin
- select fd_class_base into class_base
- from
- fiche_def join fiche using (fd_id)
- where
- f_id=p_f_id;
- raise notice 'class base %',class_base;
- select max(pcm_val) into maxcode from tmp_pcmn where pcm_val = class_base;
- if maxcode = class_base then
- maxcode=class_base*1000+1;
- end if;
- raise notice 'Max code %',maxcode;
-return maxcode+1;
+ select fd_class_base into class_base
+ from
+ fiche_def join fiche using (fd_id)
+ where
+ f_id=p_f_id;
+ raise notice 'account_compute class base %',class_base;
+ select count (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ if maxcode = 0 then
+ maxcode:=class_base;
+ else
+ select max (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ end if;
+ if maxcode = class_base then
+ maxcode:=class_base*1000;
+ end if;
+ maxcode:=maxcode+1;
+ raise notice 'account_compute Max code %',maxcode;
+ return maxcode;
end;
$$
LANGUAGE plpgsql;
@@ -60,34 +66,45 @@ nCount integer;
begin
if length(trim(p_account)) != 0 then
+ raise notice 'p_account is not empty';
select * into nCount from tmp_pcmn where pcm_val=p_account;
if nCount !=0 then
+ raise notice 'this account exists in tmp_pcmn ';
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+ else
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
nParent:=account_parent(p_account);
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent)
- values (p_account,sName,nParent);
- attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
end if;
else
+ raise notice 'p_account is empty';
select fd_id into nFd_id from fiche where f_id=p_f_id;
bAuto:= account_auto(nFd_id);
if bAuto = true then
+ raise notice 'account generated automatically';
nNew:=account_compute(p_f_id);
-raise debug 'nNew %', nNew;
+ raise notice 'nNew %', nNew;
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
nParent:=account_parent(nNew);
perform account_add (nNew,sName);
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
else
- perform attribut_insert(p_f_id,5,null);
+ select fd_class_base into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if nNew is null or length(trim(nNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+ end if;
end if;
end if;
@@ -118,6 +135,7 @@ begin
raise exception 'Impossible de trouver le compte parent pour %',p_account;
end if;
end loop;
+ raise notice 'account_parent : Parent is %',nParent;
return nParent;
end;
$$
@@ -157,7 +175,7 @@ declare
begin
select nextval('s_jnt_fic_att_value') into n_jft_id;
insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
- insert into attr_value (jft_id,av_text) values (n_jft_id,p_value);
+ insert into attr_value (jft_id,av_text) values (n_jft_id,trim(p_value));
return;
end;
$$
@@ -167,13 +185,14 @@ CREATE FUNCTION card_class_base(p_f_id integer) RETURNS poste_comptable
declare
n_poste fiche_def.fd_class_base%type;
begin
- select fd_class_base into n_poste from fiche_def join fiche using (fd_id)
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
where f_id=p_f_id;
if not FOUND then
raise exception 'Invalid fiche card_class_base(%)',p_f_id;
end if;
-return;
-end;
+return n_poste;
+end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION check_balance(p_grpt integer) RETURNS numeric
@@ -207,6 +226,46 @@ begin
end if;
return 0;
end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) RETURNS integer
+ AS $$
+declare
+last_sequence int8;
+max_sequence int8;
+n integer;
+begin
+ select count(*) into n from pg_class where relkind='S' and relname=lower(p_sequence);
+ if n = 0 then
+ raise exception ' Unknow sequence % ',p_sequence;
+ end if;
+ select count(*) into n from pg_class where relkind='r' and relname=lower(p_table);
+ if n = 0 then
+ raise exception ' Unknow table % ',p_table;
+ end if;
+ execute 'select last_value from '||p_sequence into last_sequence;
+ raise notice 'Last value of the sequence is %', last_sequence;
+ execute 'select max('||p_col||') from '||p_table into max_sequence;
+ if max_sequence is null then
+ max_sequence := 0;
+ end if;
+ raise notice 'Max value of the sequence is %', max_sequence;
+ max_sequence:= max_sequence +1;
+ execute 'alter sequence '||p_sequence||' restart with '||max_sequence;
+return 0;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION drop_it(p_constraint character varying) RETURNS void
+ AS $$
+declare
+ nCount integer;
+begin
+ select count(*) into nCount from pg_constraint where conname=p_constraint;
+ if nCount = 1 then
+ execute 'alter table parm_periode drop constraint '||p_constraint ;
+ end if;
+end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION fiche_account_parent(p_f_id integer) RETURNS poste_comptable
@@ -270,23 +329,23 @@ return;
end;
$$
LANGUAGE plpgsql;
-CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
+CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
AS $$
-declare
- fid_client integer;
- fid_good integer;
+declare
+ fid_client integer;
+ fid_good integer;
begin
- select f_id into fid_client from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_client;
- select f_id into fid_good from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_fiche;
- insert into quant_sold
- (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
- values
- (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
- return;
-end;
-$$
+ select f_id into fid_client from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
+ select f_id into fid_good from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
+ insert into quant_sold
+ (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
+ values
+ (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
+ return;
+end;
+ $$
LANGUAGE plpgsql;
CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
AS $$
@@ -337,18 +396,28 @@ $$
LANGUAGE plpgsql;
CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id;
+if nCounter = 0 then
execute 'create sequence seq_doc_type_'||NEW.dt_id;
raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.jrn_def_id;
+if nCounter = 0 then
execute 'create sequence s_jrn_'||NEW.jrn_def_id;
-raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+ raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+end if;
RETURN NEW;
END;
$$
@@ -358,19 +427,13 @@ CREATE FUNCTION trim_cvs_quote() RETURNS "trigger"
declare
modified import_tmp%ROWTYPE;
begin
- modified.code=new.code;
- modified.montant=new.montant;
- modified.date_exec=new.date_exec;
- modified.date_valeur=new.date_valeur;
- modified.devise=replace(new.devise,'"','');
- modified.poste_comptable=replace(new.poste_comptable,'"','');
+ modified:=NEW;
+ modified.devise=replace(new.devise,'"','');
+ modified.poste_comptable=replace(new.poste_comptable,'"','');
modified.compte_ordre=replace(NEW.COMPTE_ORDRE,'"','');
modified.detail=replace(NEW.DETAIL,'"','');
modified.num_compte=replace(NEW.NUM_COMPTE,'"','');
- modified.bq_account=NEW.bq_account;
- modified.jrn=NEW.jrn;
- modified.ok=new.ok;
- return modified;
+ return modified;
end;
$$
LANGUAGE plpgsql;
@@ -496,7 +559,7 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
select count(*) into nExist
from jnt_fic_att_value join attr_value using (jft_id)
where
- ad_id=23 and av_text=upper(tText);
+ ad_id=23 and av_text=tText;
if nExist = 0 then
exit;
end if;
@@ -507,6 +570,11 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
end loop;
update attr_value set av_text = tText where jft_id=njft_id;
+ update attr_value set av_text = tText
+ where jft_id in
+ ( select jft_id
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where ad_id=25 and av_text=old_qcode);
update jrnx set j_qcode=tText where j_qcode = old_qcode;
return ns;
end;
diff --git a/html/admin/sql/dossier1/index.sql b/html/admin/sql/dossier1/index.sql
index f9d975c98..fc9949796 100644
--- a/html/admin/sql/dossier1/index.sql
+++ b/html/admin/sql/dossier1/index.sql
@@ -1,78 +1,24 @@
-ALTER INDEX public.action_gestion_pkey OWNER TO phpcompta;
-ALTER INDEX public.action_pkey OWNER TO phpcompta;
-ALTER INDEX public.attr_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.centralized_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_modele_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_state_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_type_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_def_ref_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_pkey OWNER TO phpcompta;
-ALTER INDEX public.form_pkey OWNER TO phpcompta;
-ALTER INDEX public.format_csv_banque_pkey OWNER TO phpcompta;
-ALTER INDEX public.formdef_pkey OWNER TO phpcompta;
-ALTER INDEX public.invoice_pkey OWNER TO phpcompta;
-ALTER INDEX public.jnt_fic_att_value_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_action_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_def_jrn_def_name_key OWNER TO phpcompta;
-ALTER INDEX public.jrn_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_rapt_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_type_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrnx_pkey OWNER TO phpcompta;
-ALTER INDEX public.parameter_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_code_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_money_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_periode_p_start_key OWNER TO phpcompta;
-ALTER INDEX public.parm_periode_pkey OWNER TO phpcompta;
-ALTER INDEX public.pk_user_local_pref OWNER TO phpcompta;
-ALTER INDEX public.qs_id_pk OWNER TO phpcompta;
-ALTER INDEX public.stock_goods_pkey OWNER TO phpcompta;
-ALTER INDEX public.tmp_pcmn_pkey OWNER TO phpcompta;
-ALTER INDEX public.user_sec_act_pkey OWNER TO phpcompta;
-ALTER INDEX public.user_sec_jrn_pkey OWNER TO phpcompta;
CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
-ALTER INDEX public.attr_value_jft_id OWNER TO phpcompta;
+CREATE UNIQUE INDEX fd_id_ad_id_x ON jnt_fic_attr USING btree (fd_id, ad_id);
CREATE INDEX fk_attr_value_jft_id ON attr_value USING btree (jft_id);
-ALTER INDEX public.fk_attr_value_jft_id OWNER TO phpcompta;
CREATE INDEX fk_centralized_c_jrn_def ON centralized USING btree (c_jrn_def);
-ALTER INDEX public.fk_centralized_c_jrn_def OWNER TO phpcompta;
CREATE INDEX fk_centralized_c_poste ON centralized USING btree (c_poste);
-ALTER INDEX public.fk_centralized_c_poste OWNER TO phpcompta;
CREATE INDEX fk_fiche_def_frd_id ON fiche_def USING btree (frd_id);
-ALTER INDEX public.fk_fiche_def_frd_id OWNER TO phpcompta;
CREATE INDEX fk_fiche_fd_id ON fiche USING btree (fd_id);
-ALTER INDEX public.fk_fiche_fd_id OWNER TO phpcompta;
CREATE INDEX fk_form_fo_fr_id ON form USING btree (fo_fr_id);
-ALTER INDEX public.fk_form_fo_fr_id OWNER TO phpcompta;
CREATE INDEX fk_jrn_action_ja_jrn_type ON jrn_action USING btree (ja_jrn_type);
-ALTER INDEX public.fk_jrn_action_ja_jrn_type OWNER TO phpcompta;
CREATE INDEX fk_jrn_def ON jrnx USING btree (j_jrn_def);
-ALTER INDEX public.fk_jrn_def OWNER TO phpcompta;
CREATE INDEX fk_jrnx_j_poste ON jrnx USING btree (j_poste);
-ALTER INDEX public.fk_jrnx_j_poste OWNER TO phpcompta;
CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
-ALTER INDEX public.fk_stock_goods_f_id OWNER TO phpcompta;
CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
-ALTER INDEX public.fk_stock_goods_j_id OWNER TO phpcompta;
CREATE INDEX fk_user_sec_act ON user_sec_act USING btree (ua_act_id);
-ALTER INDEX public.fk_user_sec_act OWNER TO phpcompta;
CREATE INDEX fk_user_sec_jrn ON user_sec_jrn USING btree (uj_jrn_id);
-ALTER INDEX public.fk_user_sec_jrn OWNER TO phpcompta;
CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
-ALTER INDEX public.idx_case OWNER TO phpcompta;
CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
-ALTER INDEX public.idx_qs_internal OWNER TO phpcompta;
CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
-ALTER INDEX public.ix_iv_name OWNER TO phpcompta;
CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
-ALTER INDEX public.k_ag_ref OWNER TO phpcompta;
CREATE UNIQUE INDEX x_act ON "action" USING btree (ac_description);
-ALTER INDEX public.x_act OWNER TO phpcompta;
CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
-ALTER INDEX public.x_jrn_jr_id OWNER TO phpcompta;
+CREATE UNIQUE INDEX x_periode ON parm_periode USING btree (p_start, p_end);
CREATE INDEX x_poste ON jrnx USING btree (j_poste);
-ALTER INDEX public.x_poste OWNER TO phpcompta;
CREATE UNIQUE INDEX x_usr_jrn ON user_sec_jrn USING btree (uj_login, uj_jrn_id);
-ALTER INDEX public.x_usr_jrn OWNER TO phpcompta;
diff --git a/html/admin/sql/dossier1/make-sql b/html/admin/sql/dossier1/make-sql
index 931da91f4..045ac351a 100755
--- a/html/admin/sql/dossier1/make-sql
+++ b/html/admin/sql/dossier1/make-sql
@@ -1,11 +1,20 @@
pg_dump -O -U phpcompta -s dossier1 | awk '!/--/ {if ( ! /^$/) print $0;}' > schema.sql
awk '/SEQUENCE/,/;/ { print $0;}' < schema.sql > sequence.sql
-awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE DOMAIN/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql >> table.sql
awk '/CREATE VIEW/,/;/ { print $0;}' < schema.sql > view.sql
awk '/INDEX/,/;/ { print $0;}' < schema.sql > index.sql
-awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql > constraint.sql
+(
+echo " SET client_encoding = 'LATIN1';"
+echo " SET check_function_bodies = false;"
+echo " SET client_min_messages = warning;"
+echo "SET search_path = public, pg_catalog;"
+)> constraint.sql
+
+awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql >> constraint.sql
awk '/CREATE FUNCTION/,/LANGUAGE/ { print $0;}' < schema.sql > function.sql
awk '/COMMENT/,/;/ {print $0;}' < schema.sql > comment.sql
+sed -i -e "/ALTER TABLE.*/d" -e "/ADD CONSTRAINT/d" -e "/CREATE PROCEDURAL/d" schema.sql
grep setval schema.sql >> sequence.sql
pg_dump -U phpcompta -D -a -O dossier1 > data.sql
diff --git a/html/admin/sql/dossier1/schema.sql b/html/admin/sql/dossier1/schema.sql
index d927332b3..1f63b07aa 100644
--- a/html/admin/sql/dossier1/schema.sql
+++ b/html/admin/sql/dossier1/schema.sql
@@ -1,8 +1,594 @@
SET client_encoding = 'LATIN1';
SET check_function_bodies = false;
SET client_min_messages = warning;
+COMMENT ON SCHEMA public IS 'Standard public schema';
SET search_path = public, pg_catalog;
CREATE DOMAIN poste_comptable AS numeric(25,0);
+CREATE FUNCTION account_add(p_id poste_comptable, p_name character varying) RETURNS void
+ AS $$
+declare
+ nParent tmp_pcmn.pcm_val_parent%type;
+ nCount integer;
+begin
+ select count(*) into nCount from tmp_pcmn where pcm_val=p_id;
+ if nCount = 0 then
+ nParent=account_parent(p_id);
+ insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
+ values (p_id, p_name,nParent);
+ end if;
+return;
+end ;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION account_auto(p_fd_id integer) RETURNS boolean
+ AS $$
+declare
+ l_auto bool;
+begin
+ select fd_create_account into l_auto from fiche_def where fd_id=p_fd_id;
+ if l_auto is null then
+ l_auto:=false;
+ end if;
+ return l_auto;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
+ AS $$
+declare
+ class_base poste_comptable;
+ maxcode poste_comptable;
+begin
+ select fd_class_base into class_base
+ from
+ fiche_def join fiche using (fd_id)
+ where
+ f_id=p_f_id;
+ raise notice 'account_compute class base %',class_base;
+ select count (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ if maxcode = 0 then
+ maxcode:=class_base;
+ else
+ select max (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ end if;
+ if maxcode = class_base then
+ maxcode:=class_base*1000;
+ end if;
+ maxcode:=maxcode+1;
+ raise notice 'account_compute Max code %',maxcode;
+ return maxcode;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION account_insert(p_f_id integer, p_account poste_comptable) RETURNS integer
+ AS $$
+declare
+nParent tmp_pcmn.pcm_val_parent%type;
+sName varchar;
+nNew tmp_pcmn.pcm_val%type;
+bAuto bool;
+nFd_id integer;
+nCount integer;
+begin
+
+ if length(trim(p_account)) != 0 then
+ raise notice 'p_account is not empty';
+ select * into nCount from tmp_pcmn where pcm_val=p_account;
+ if nCount !=0 then
+ raise notice 'this account exists in tmp_pcmn ';
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+ else
+ select av_text into sName from
+ attr_value join jnt_fic_att_value using (jft_id)
+ where
+ ad_id=1 and f_id=p_f_id;
+ nParent:=account_parent(p_account);
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+
+ end if;
+ else
+ raise notice 'p_account is empty';
+ select fd_id into nFd_id from fiche where f_id=p_f_id;
+ bAuto:= account_auto(nFd_id);
+ if bAuto = true then
+ raise notice 'account generated automatically';
+ nNew:=account_compute(p_f_id);
+ raise notice 'nNew %', nNew;
+ select av_text into sName from
+ attr_value join jnt_fic_att_value using (jft_id)
+ where
+ ad_id=1 and f_id=p_f_id;
+ nParent:=account_parent(nNew);
+ perform account_add (nNew,sName);
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+
+ else
+ select fd_class_base into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if nNew is null or length(trim(nNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+ end if;
+ end if;
+ end if;
+
+return 0;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION account_parent(p_account poste_comptable) RETURNS poste_comptable
+ AS $$
+declare
+ nParent tmp_pcmn.pcm_val_parent%type;
+ sParent varchar;
+ nCount integer;
+begin
+ sParent:=to_char(p_account,'9999999999999999');
+ sParent:=trim(sParent);
+ nParent:=0;
+ while nParent = 0 loop
+ select count(*) into nCount
+ from tmp_pcmn
+ where
+ pcm_val = to_number(sParent,'9999999999999999');
+ if nCount != 0 then
+ nParent:=to_number(sParent,'9999999999999999');
+ end if;
+ sParent:= substr(sParent,1,length(sParent)-1);
+ if length(sParent) <= 0 then
+ raise exception 'Impossible de trouver le compte parent pour %',p_account;
+ end if;
+ end loop;
+ raise notice 'account_parent : Parent is %',nParent;
+ return nParent;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION account_update(p_f_id integer, p_account poste_comptable) RETURNS integer
+ AS $$
+declare
+nMax fiche.f_id%type;
+nCount integer;
+nParent tmp_pcmn.pcm_val_parent%type;
+sName varchar;
+nJft_id attr_value.jft_id%type;
+begin
+
+ if length(trim(p_account)) != 0 then
+ select count(*) into nCount from tmp_pcmn where pcm_val=p_account;
+ if nCount = 0 then
+ select av_text into sName from
+ attr_value join jnt_fic_att_value using (jft_id)
+ where
+ ad_id=1 and f_id=p_f_id;
+ nParent:=fiche_account_parent(p_f_id);
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ end if;
+ end if;
+ select jft_id into njft_id from jnt_fic_att_value where f_id=p_f_id and ad_id=5;
+ update attr_value set av_text=p_account where jft_id=njft_id;
+
+return njft_id;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION attribut_insert(p_f_id integer, p_ad_id integer, p_value character varying) RETURNS void
+ AS $$
+declare
+ n_jft_id integer;
+begin
+ select nextval('s_jnt_fic_att_value') into n_jft_id;
+ insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
+ insert into attr_value (jft_id,av_text) values (n_jft_id,trim(p_value));
+return;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION card_class_base(p_f_id integer) RETURNS poste_comptable
+ AS $$
+declare
+ n_poste fiche_def.fd_class_base%type;
+begin
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
+ where f_id=p_f_id;
+ if not FOUND then
+ raise exception 'Invalid fiche card_class_base(%)',p_f_id;
+ end if;
+return n_poste;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION check_balance(p_grpt integer) RETURNS numeric
+ AS $$
+declare
+ amount_jrnx_debit numeric;
+ amount_jrnx_credit numeric;
+ amount_jrn numeric;
+begin
+ select sum (j_montant) into amount_jrnx_credit
+ from jrnx
+ where
+ j_grpt=p_grpt
+ and j_debit=false;
+ select sum (j_montant) into amount_jrnx_debit
+ from jrnx
+ where
+ j_grpt=p_grpt
+ and j_debit=true;
+ select jr_montant into amount_jrn
+ from jrn
+ where
+ jr_grpt_id=p_grpt;
+ if ( amount_jrnx_debit != amount_jrnx_credit )
+ then
+ return abs(amount_jrnx_debit-amount_jrnx_credit);
+ end if;
+ if ( amount_jrn != amount_jrnx_credit)
+ then
+ return -1*abs(amount_jrn - amount_jrnx_credit);
+ end if;
+ return 0;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) RETURNS integer
+ AS $$
+declare
+last_sequence int8;
+max_sequence int8;
+n integer;
+begin
+ select count(*) into n from pg_class where relkind='S' and relname=lower(p_sequence);
+ if n = 0 then
+ raise exception ' Unknow sequence % ',p_sequence;
+ end if;
+ select count(*) into n from pg_class where relkind='r' and relname=lower(p_table);
+ if n = 0 then
+ raise exception ' Unknow table % ',p_table;
+ end if;
+ execute 'select last_value from '||p_sequence into last_sequence;
+ raise notice 'Last value of the sequence is %', last_sequence;
+ execute 'select max('||p_col||') from '||p_table into max_sequence;
+ if max_sequence is null then
+ max_sequence := 0;
+ end if;
+ raise notice 'Max value of the sequence is %', max_sequence;
+ max_sequence:= max_sequence +1;
+ execute 'alter sequence '||p_sequence||' restart with '||max_sequence;
+return 0;
+end;
+$$
+ LANGUAGE plpgsql;
+COMMENT ON FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) IS ' Often the primary key is a sequence number and sometimes the value of the sequence is not synchronized with the primary key ( p_sequence : sequence name, p_col : col of the pk,p_table : concerned table';
+CREATE FUNCTION drop_it(p_constraint character varying) RETURNS void
+ AS $$
+declare
+ nCount integer;
+begin
+ select count(*) into nCount from pg_constraint where conname=p_constraint;
+ if nCount = 1 then
+ execute 'alter table parm_periode drop constraint '||p_constraint ;
+ end if;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION fiche_account_parent(p_f_id integer) RETURNS poste_comptable
+ AS $$
+declare
+ret poste_comptable;
+begin
+ select fd_class_base into ret from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if not FOUND then
+ raise exception '% N''existe pas',p_f_id;
+ end if;
+ return ret;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION insert_jrnx(p_date character varying, p_montant numeric, p_poste integer, p_grpt integer, p_jrn_def integer, p_debit boolean, p_tech_user text, p_tech_per integer, p_qcode text) RETURNS void
+ AS $$
+declare
+ sCode varchar;
+ nCount_qcode integer;
+begin
+ sCode=trim(p_qcode);
+ if length(sCode) = 0 or p_qcode is null then
+ select count(*) into nCount_qcode
+ from vw_poste_qcode where j_poste=p_poste;
+ if nCount_qcode = 1 then
+ select j_qcode into sCode
+ from vw_poste_qcode where j_poste=p_poste;
+ else
+ sCode=NULL;
+ end if;
+
+ end if;
+ if p_montant = 0.0 then
+ return;
+ end if;
+ insert into jrnx
+ (
+ j_date,
+ j_montant,
+ j_poste,
+ j_grpt,
+ j_jrn_def,
+ j_debit,
+ j_tech_user,
+ j_tech_per,
+ j_qcode
+ ) values
+ (
+ to_date(p_date,'DD.MM.YYYY'),
+ p_montant,
+ p_poste,
+ p_grpt,
+ p_jrn_def,
+ p_debit,
+ p_tech_user,
+ p_tech_per,
+ sCode
+ );
+return;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
+ AS $$
+declare
+ fid_client integer;
+ fid_good integer;
+begin
+ select f_id into fid_client from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
+ select f_id into fid_good from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
+ insert into quant_sold
+ (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
+ values
+ (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
+ return;
+end;
+ $$
+ LANGUAGE plpgsql;
+CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
+ AS $$
+ declare
+ ns integer;
+ nExist integer;
+ tText text;
+ begin
+ tText := upper(trim(tav_text));
+ tText := replace(tText,' ','');
+
+ loop
+ select nextval('s_jnt_fic_att_value') into ns;
+ if length (tText) = 0 or tText is null then
+ tText := 'FID'||ns;
+ end if;
+ select count(*) into nExist
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where
+ ad_id=23 and av_text=upper(tText);
+ if nExist = 0 then
+ exit;
+ end if;
+ tText:='FID'||ns;
+ end loop;
+ insert into jnt_fic_att_value values (ns,nf_id,23);
+ insert into attr_value values (ns,upper(tText));
+ return ns;
+ end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION proc_check_balance() RETURNS "trigger"
+ AS $$
+declare
+ diff numeric;
+ tt integer;
+begin
+ if TG_OP = 'INSERT' then
+ tt=NEW.jr_grpt_id;
+ diff:=check_balance(tt);
+ if diff != 0 then
+ raise exception 'balance error %',diff ;
+ end if;
+ return NEW;
+ end if;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
+ AS $$
+declare
+nCounter integer;
+ BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id;
+if nCounter = 0 then
+ execute 'create sequence seq_doc_type_'||NEW.dt_id;
+raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
+end if;
+ RETURN NEW;
+ END;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
+ AS $$
+declare
+nCounter integer;
+ BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.jrn_def_id;
+if nCounter = 0 then
+ execute 'create sequence s_jrn_'||NEW.jrn_def_id;
+ raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+end if;
+ RETURN NEW;
+ END;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION trim_cvs_quote() RETURNS "trigger"
+ AS $$
+declare
+ modified import_tmp%ROWTYPE;
+begin
+ modified:=NEW;
+ modified.devise=replace(new.devise,'"','');
+ modified.poste_comptable=replace(new.poste_comptable,'"','');
+ modified.compte_ordre=replace(NEW.COMPTE_ORDRE,'"','');
+ modified.detail=replace(NEW.DETAIL,'"','');
+ modified.num_compte=replace(NEW.NUM_COMPTE,'"','');
+ return modified;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION trim_space_format_csv_banque() RETURNS "trigger"
+ AS $$
+declare
+ modified format_csv_banque%ROWTYPE;
+begin
+ modified.name=trim(NEW.NAME);
+ modified.include_file=trim(new.include_file);
+ if ( length(modified.name) = 0 ) then
+ modified.name=null;
+ end if;
+ if ( length(modified.include_file) = 0 ) then
+ modified.include_file=null;
+ end if;
+ return modified;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION tva_delete(integer) RETURNS void
+ AS $_$
+declare
+ p_tva_id alias for $1;
+ nCount integer;
+begin
+ nCount=0;
+ select count(*) into nCount from quant_sold where qs_vat_code=p_tva_id;
+ if nCount = 0 then
+ delete from tva_rate where tva_id=p_tva_id;
+ end if;
+ return;
+end;
+$_$
+ LANGUAGE plpgsql;
+CREATE FUNCTION tva_insert(integer, text, numeric, text, text) RETURNS integer
+ AS $_$
+declare
+p_tva_id alias for $1;
+p_tva_label alias for $2;
+p_tva_rate alias for $3;
+p_tva_comment alias for $4;
+p_tva_poste alias for $5;
+debit text;
+credit text;
+nCount integer;
+begin
+if length(trim(p_tva_label)) = 0 then
+ return 3;
+end if;
+select count(*) into nCount from tva_rate
+ where tva_id=p_tva_id;
+if nCount != 0 then
+ return 5;
+end if;
+if length(trim(p_tva_poste)) != 0 then
+ if position (',' in p_tva_poste) = 0 then return 4; end if;
+ debit = split_part(p_tva_poste,',',1);
+ credit = split_part(p_tva_poste,',',2);
+ select count(*) into nCount from tmp_pcmn where pcm_val=debit;
+ if nCount = 0 then return 4; end if;
+ select count(*) into nCount from tmp_pcmn where pcm_val=credit;
+ if nCount = 0 then return 4; end if;
+
+end if;
+insert into tva_rate(tva_id,tva_label,tva_rate,tva_comment,tva_poste)
+ values (p_tva_id,p_tva_label,p_tva_rate,p_tva_comment,p_tva_poste);
+return 0;
+end;
+$_$
+ LANGUAGE plpgsql;
+CREATE FUNCTION tva_modify(integer, text, numeric, text, text) RETURNS integer
+ AS $_$declare
+p_tva_id alias for $1;
+p_tva_label alias for $2;
+p_tva_rate alias for $3;
+p_tva_comment alias for $4;
+p_tva_poste alias for $5;
+debit text;
+credit text;
+nCount integer;
+begin
+if length(trim(p_tva_label)) = 0 then
+ return 3;
+end if;
+if length(trim(p_tva_poste)) != 0 then
+ if position (',' in p_tva_poste) = 0 then return 4; end if;
+ debit = split_part(p_tva_poste,',',1);
+ credit = split_part(p_tva_poste,',',2);
+ select count(*) into nCount from tmp_pcmn where pcm_val=debit;
+ if nCount = 0 then return 4; end if;
+ select count(*) into nCount from tmp_pcmn where pcm_val=credit;
+ if nCount = 0 then return 4; end if;
+
+end if;
+update tva_rate set tva_label=p_tva_label,tva_rate=p_tva_rate,tva_comment=p_tva_comment,tva_poste=p_tva_poste
+ where tva_id=p_tva_id;
+return 0;
+end;
+$_$
+ LANGUAGE plpgsql;
+CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS integer
+ AS $$
+ declare
+ ns integer;
+ nExist integer;
+ tText text;
+ old_qcode varchar;
+ begin
+ select av_text into old_qcode from attr_value where jft_id=njft_id;
+ if tav_text = upper( trim(old_qcode)) then
+ return 0;
+ end if;
+
+ tText := trim(upper(tav_text));
+ tText := replace(tText,' ','');
+ if length ( tText) = 0 or tText is null then
+ return 0;
+ end if;
+
+ ns := njft_id;
+ loop
+ select count(*) into nExist
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where
+ ad_id=23 and av_text=tText;
+ if nExist = 0 then
+ exit;
+ end if;
+ if tText = 'FID'||ns then
+ select nextval('s_jnt_fic_att_value') into ns;
+ end if;
+ tText :='FID'||ns;
+
+ end loop;
+ update attr_value set av_text = tText where jft_id=njft_id;
+ update attr_value set av_text = tText
+ where jft_id in
+ ( select jft_id
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where ad_id=25 and av_text=old_qcode);
+ update jrnx set j_qcode=tText where j_qcode = old_qcode;
+ return ns;
+ end;
+$$
+ LANGUAGE plpgsql;
+SET default_tablespace = '';
+SET default_with_oids = false;
CREATE TABLE "action" (
ac_id integer NOT NULL,
ac_description text NOT NULL
@@ -22,7 +608,7 @@ CREATE TABLE action_gestion (
);
COMMENT ON TABLE action_gestion IS 'Action for Managing';
CREATE TABLE attr_def (
- ad_id integer DEFAULT nextval('s_attr_def'::text) NOT NULL,
+ ad_id integer DEFAULT nextval(('s_attr_def'::text)::regclass) NOT NULL,
ad_text text
);
COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
@@ -36,7 +622,7 @@ CREATE TABLE attr_value (
av_text text
);
CREATE TABLE centralized (
- c_id integer DEFAULT nextval('s_centralized'::text) NOT NULL,
+ c_id integer DEFAULT nextval(('s_centralized'::text)::regclass) NOT NULL,
c_j_id integer,
c_date date NOT NULL,
c_internal text NOT NULL,
@@ -72,14 +658,11 @@ CREATE TABLE document_modele (
);
COMMENT ON TABLE document_modele IS ' contains all the template for the documents';
CREATE SEQUENCE document_seq
- START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
-CREATE SEQUENCE S_CENTRAL;
-
CREATE TABLE document_state (
s_id serial NOT NULL,
s_value character varying(50) NOT NULL
@@ -91,12 +674,12 @@ CREATE TABLE document_type (
);
COMMENT ON TABLE document_type IS 'Type of document : meeting, invoice,...';
CREATE TABLE fiche (
- f_id integer DEFAULT nextval('s_fiche'::text) NOT NULL,
+ f_id integer DEFAULT nextval(('s_fiche'::text)::regclass) NOT NULL,
fd_id integer
);
COMMENT ON TABLE fiche IS 'Cards';
CREATE TABLE fiche_def (
- fd_id integer DEFAULT nextval('s_fdef'::text) NOT NULL,
+ fd_id integer DEFAULT nextval(('s_fdef'::text)::regclass) NOT NULL,
fd_class_base poste_comptable,
fd_label text NOT NULL,
fd_create_account boolean DEFAULT false,
@@ -104,13 +687,13 @@ CREATE TABLE fiche_def (
);
COMMENT ON TABLE fiche_def IS 'Cards definition';
CREATE TABLE fiche_def_ref (
- frd_id integer DEFAULT nextval('s_fiche_def_ref'::text) NOT NULL,
+ frd_id integer DEFAULT nextval(('s_fiche_def_ref'::text)::regclass) NOT NULL,
frd_text text,
frd_class_base integer
);
COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
CREATE TABLE form (
- fo_id integer DEFAULT nextval('s_form'::text) NOT NULL,
+ fo_id integer DEFAULT nextval(('s_form'::text)::regclass) NOT NULL,
fo_fr_id integer,
fo_pos integer,
fo_label text,
@@ -122,7 +705,7 @@ CREATE TABLE format_csv_banque (
include_file text NOT NULL
);
CREATE TABLE formdef (
- fr_id integer DEFAULT nextval('s_formdef'::text) NOT NULL,
+ fr_id integer DEFAULT nextval(('s_formdef'::text)::regclass) NOT NULL,
fr_label text
);
CREATE TABLE import_tmp (
@@ -135,29 +718,36 @@ CREATE TABLE import_tmp (
detail text,
num_compte text,
poste_comptable text,
- status varchar(1) default 'n' not null check (status in ('t','d','w','n')),
+ status character varying(1) DEFAULT 'n'::character varying NOT NULL,
bq_account integer NOT NULL,
- jrn integer NOT NULL
-
+ jrn integer NOT NULL,
+ jr_rapt text,
+ CONSTRAINT import_tmp_status_check CHECK ((((((status)::text = 't'::text) OR ((status)::text = 'd'::text)) OR ((status)::text = 'w'::text)) OR ((status)::text = 'n'::text)))
);
CREATE TABLE invoice (
- iv_id integer DEFAULT nextval('s_invoice'::text) NOT NULL,
+ iv_id integer DEFAULT nextval(('s_invoice'::text)::regclass) NOT NULL,
iv_name text NOT NULL,
iv_file oid
);
CREATE TABLE jnt_fic_att_value (
- jft_id integer DEFAULT nextval('s_jnt_fic_att_value'::text) NOT NULL,
+ jft_id integer DEFAULT nextval(('s_jnt_fic_att_value'::text)::regclass) NOT NULL,
f_id integer,
ad_id integer
);
COMMENT ON TABLE jnt_fic_att_value IS 'join between the card and the attribut definition';
+CREATE SEQUENCE s_jnt_id
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE TABLE jnt_fic_attr (
fd_id integer,
- ad_id integer
+ ad_id integer,
+ jnt_id bigint DEFAULT nextval('s_jnt_id'::regclass) NOT NULL
);
COMMENT ON TABLE jnt_fic_attr IS 'join between the family card and the attribut definition';
CREATE TABLE jrn (
- jr_id integer DEFAULT nextval('s_jrn'::text) NOT NULL,
+ jr_id integer DEFAULT nextval(('s_jrn'::text)::regclass) NOT NULL,
jr_def_id integer NOT NULL,
jr_montant numeric(20,4) NOT NULL,
jr_comment text,
@@ -178,7 +768,7 @@ CREATE TABLE jrn (
);
COMMENT ON TABLE jrn IS 'Journal: content one line for a group of accountancy writing';
CREATE TABLE jrn_action (
- ja_id integer DEFAULT nextval('s_jrnaction'::text) NOT NULL,
+ ja_id integer DEFAULT nextval(('s_jrnaction'::text)::regclass) NOT NULL,
ja_name text NOT NULL,
ja_desc text,
ja_url text NOT NULL,
@@ -188,7 +778,7 @@ CREATE TABLE jrn_action (
);
COMMENT ON TABLE jrn_action IS 'Possible action when we are in journal (menu)';
CREATE TABLE jrn_def (
- jrn_def_id integer DEFAULT nextval('s_jrn_def'::text) NOT NULL,
+ jrn_def_id integer DEFAULT nextval(('s_jrn_def'::text)::regclass) NOT NULL,
jrn_def_name text NOT NULL,
jrn_def_class_deb text,
jrn_def_class_cred text,
@@ -203,7 +793,7 @@ CREATE TABLE jrn_def (
);
COMMENT ON TABLE jrn_def IS 'Definition of a journal, his properties';
CREATE TABLE jrn_rapt (
- jra_id integer DEFAULT nextval('s_jrn_rapt'::text) NOT NULL,
+ jra_id integer DEFAULT nextval(('s_jrn_rapt'::text)::regclass) NOT NULL,
jr_id integer NOT NULL,
jra_concerned integer NOT NULL
);
@@ -214,7 +804,7 @@ CREATE TABLE jrn_type (
);
COMMENT ON TABLE jrn_type IS 'Type of journal (Sell, Buy, Financial...)';
CREATE TABLE jrnx (
- j_id integer DEFAULT nextval('s_jrn_op'::text) NOT NULL,
+ j_id integer DEFAULT nextval(('s_jrn_op'::text)::regclass) NOT NULL,
j_date date DEFAULT now(),
j_montant numeric(20,4) DEFAULT 0,
j_poste poste_comptable NOT NULL,
@@ -241,15 +831,15 @@ CREATE TABLE parm_code (
p_comment text
);
CREATE TABLE parm_money (
- pm_id integer DEFAULT nextval('s_currency'::text),
+ pm_id integer DEFAULT nextval(('s_currency'::text)::regclass),
pm_code character(3) NOT NULL,
pm_rate numeric(20,4)
);
COMMENT ON TABLE parm_money IS 'Currency conversion';
CREATE TABLE parm_periode (
- p_id integer DEFAULT nextval('s_periode'::text) NOT NULL,
+ p_id integer DEFAULT nextval(('s_periode'::text)::regclass) NOT NULL,
p_start date NOT NULL,
- p_end date,
+ p_end date NOT NULL,
p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
p_closed boolean DEFAULT false,
p_central boolean DEFAULT false,
@@ -257,10 +847,10 @@ CREATE TABLE parm_periode (
);
COMMENT ON TABLE parm_periode IS 'Periode definition';
CREATE TABLE quant_sold (
- qs_id integer DEFAULT nextval('s_quantity'::text) NOT NULL,
+ qs_id integer DEFAULT nextval(('s_quantity'::text)::regclass) NOT NULL,
qs_internal text NOT NULL,
qs_fiche integer NOT NULL,
- qs_quantite integer NOT NULL,
+ qs_quantite numeric(20,4) NOT NULL,
qs_price numeric(20,4),
qs_vat numeric(20,4),
qs_vat_code integer,
@@ -272,6 +862,18 @@ CREATE SEQUENCE s_attr_def
NO MAXVALUE
NO MINVALUE
CACHE 1;
+CREATE SEQUENCE s_cbc
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_central
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE SEQUENCE s_central_order
START WITH 1
INCREMENT BY 1
@@ -327,7 +929,6 @@ CREATE SEQUENCE s_idef
NO MINVALUE
CACHE 1;
CREATE SEQUENCE s_internal
- START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
@@ -348,6 +949,30 @@ CREATE SEQUENCE s_jrn
NO MAXVALUE
NO MINVALUE
CACHE 1;
+CREATE SEQUENCE s_jrn_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_4
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE SEQUENCE s_jrn_def
START WITH 5
INCREMENT BY 1
@@ -381,7 +1006,6 @@ CREATE SEQUENCE s_periode
NO MINVALUE
CACHE 1;
CREATE SEQUENCE s_quantity
- START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
@@ -401,22 +1025,71 @@ CREATE SEQUENCE s_user_jrn
NO MAXVALUE
NO MINVALUE
CACHE 1;
-CREATE SEQUENCE s_cbc
+CREATE SEQUENCE seq_doc_type_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_4
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_5
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_6
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_7
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_8
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_9
+ START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
-
CREATE TABLE stock_goods (
- sg_id integer DEFAULT nextval('s_stock_goods'::text) NOT NULL,
+ sg_id integer DEFAULT nextval(('s_stock_goods'::text)::regclass) NOT NULL,
j_id integer,
f_id integer NOT NULL,
sg_code text,
- sg_quantity integer DEFAULT 0,
+ sg_quantity numeric(8,4) DEFAULT 0,
sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
sg_date date,
sg_tech_date date DEFAULT now(),
sg_tech_user text,
+ sg_comment character varying(80),
+ sg_exercice character varying(4),
CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
);
COMMENT ON TABLE stock_goods IS 'About the goods';
@@ -445,12 +1118,12 @@ COMMENT ON COLUMN user_local_pref.user_id IS 'user''s login ';
COMMENT ON COLUMN user_local_pref.parameter_type IS 'the type of parameter ';
COMMENT ON COLUMN user_local_pref.parameter_value IS 'the value of parameter ';
CREATE TABLE user_sec_act (
- ua_id integer DEFAULT nextval('s_user_act'::text) NOT NULL,
+ ua_id integer DEFAULT nextval(('s_user_act'::text)::regclass) NOT NULL,
ua_login text,
ua_act_id integer
);
CREATE TABLE user_sec_jrn (
- uj_id integer DEFAULT nextval('s_user_jrn'::text) NOT NULL,
+ uj_id integer DEFAULT nextval(('s_user_jrn'::text)::regclass) NOT NULL,
uj_login text,
uj_jrn_id integer,
uj_priv text
@@ -473,581 +1146,29 @@ CREATE VIEW vw_poste_qcode AS
CREATE VIEW vw_supplier AS
SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 8);
CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
-
+CREATE UNIQUE INDEX fd_id_ad_id_x ON jnt_fic_attr USING btree (fd_id, ad_id);
CREATE INDEX fk_attr_value_jft_id ON attr_value USING btree (jft_id);
-
CREATE INDEX fk_centralized_c_jrn_def ON centralized USING btree (c_jrn_def);
-
CREATE INDEX fk_centralized_c_poste ON centralized USING btree (c_poste);
-
CREATE INDEX fk_fiche_def_frd_id ON fiche_def USING btree (frd_id);
-
CREATE INDEX fk_fiche_fd_id ON fiche USING btree (fd_id);
-
CREATE INDEX fk_form_fo_fr_id ON form USING btree (fo_fr_id);
-
CREATE INDEX fk_jrn_action_ja_jrn_type ON jrn_action USING btree (ja_jrn_type);
-
CREATE INDEX fk_jrn_def ON jrnx USING btree (j_jrn_def);
-
CREATE INDEX fk_jrnx_j_poste ON jrnx USING btree (j_poste);
-
CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
-
CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
-
CREATE INDEX fk_user_sec_act ON user_sec_act USING btree (ua_act_id);
-
CREATE INDEX fk_user_sec_jrn ON user_sec_jrn USING btree (uj_jrn_id);
-
CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
-
CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
-
CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
-
CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
-
CREATE UNIQUE INDEX x_act ON "action" USING btree (ac_description);
-
CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
-
+CREATE UNIQUE INDEX x_periode ON parm_periode USING btree (p_start, p_end);
CREATE INDEX x_poste ON jrnx USING btree (j_poste);
-
CREATE UNIQUE INDEX x_usr_jrn ON user_sec_jrn USING btree (uj_login, uj_jrn_id);
-
-CREATE FUNCTION account_add(p_id poste_comptable, p_name character varying) RETURNS void
- AS $$
-declare
- nParent tmp_pcmn.pcm_val_parent%type;
- nCount integer;
-begin
- select count(*) into nCount from tmp_pcmn where pcm_val=p_id;
- if nCount = 0 then
- nParent=account_parent(p_id);
- insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
- values (p_id, p_name,nParent);
- end if;
-return;
-end ;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.account_add(p_id poste_comptable, p_name character varying) OWNER TO phpcompta;
-CREATE FUNCTION account_auto(p_fd_id integer) RETURNS boolean
- AS $$
-declare
- l_auto bool;
-begin
- select fd_create_account into l_auto from fiche_def where fd_id=p_fd_id;
- if l_auto is null then
- l_auto:=false;
- end if;
- return l_auto;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.account_auto(p_fd_id integer) OWNER TO phpcompta;
-CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
- AS $$
-declare
- class_base poste_comptable;
- maxcode int8;
-begin
- select fd_class_base into class_base
- from
- fiche_def join fiche using (fd_id)
- where
- f_id=p_f_id;
- raise notice 'class base %',class_base;
- select max(pcm_val) into maxcode from tmp_pcmn where pcm_val = class_base;
- if maxcode = class_base then
- maxcode=class_base*1000+1;
- end if;
- raise notice 'Max code %',maxcode;
-return maxcode+1;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.account_compute(p_f_id integer) OWNER TO phpcompta;
-CREATE FUNCTION account_insert(p_f_id integer, p_account poste_comptable) RETURNS integer
- AS $$
-declare
-nParent tmp_pcmn.pcm_val_parent%type;
-sName varchar;
-nNew tmp_pcmn.pcm_val%type;
-bAuto bool;
-nFd_id integer;
-nCount integer;
-begin
-
- if length(trim(p_account)) != 0 then
- select * into nCount from tmp_pcmn where pcm_val=p_account;
- if nCount !=0 then
- select av_text into sName from
- attr_value join jnt_fic_att_value using (jft_id)
- where
- ad_id=1 and f_id=p_f_id;
- nParent:=account_parent(p_account);
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent)
- values (p_account,sName,nParent);
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
-
- end if;
- else
- select fd_id into nFd_id from fiche where f_id=p_f_id;
- bAuto:= account_auto(nFd_id);
- if bAuto = true then
- nNew:=account_compute(p_f_id);
-raise debug 'nNew %', nNew;
- select av_text into sName from
- attr_value join jnt_fic_att_value using (jft_id)
- where
- ad_id=1 and f_id=p_f_id;
- nParent:=account_parent(nNew);
- perform account_add (nNew,sName);
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
-
- else
- perform attribut_insert(p_f_id,5,null);
- end if;
- end if;
-
-return 0;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.account_insert(p_f_id integer, p_account poste_comptable) OWNER TO phpcompta;
-CREATE FUNCTION account_parent(p_account poste_comptable) RETURNS poste_comptable
- AS $$
-declare
- nParent tmp_pcmn.pcm_val_parent%type;
- sParent varchar;
- nCount integer;
-begin
- sParent:=to_char(p_account,'9999999999999999');
- sParent:=trim(sParent);
- nParent:=0;
- while nParent = 0 loop
- select count(*) into nCount
- from tmp_pcmn
- where
- pcm_val = to_number(sParent,'9999999999999999');
- if nCount != 0 then
- nParent:=to_number(sParent,'9999999999999999');
- end if;
- sParent:= substr(sParent,1,length(sParent)-1);
- if length(sParent) <= 0 then
- raise exception 'Impossible de trouver le compte parent pour %',p_account;
- end if;
- end loop;
- return nParent;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.account_parent(p_account poste_comptable) OWNER TO phpcompta;
-CREATE FUNCTION account_update(p_f_id integer, p_account poste_comptable) RETURNS integer
- AS $$
-declare
-nMax fiche.f_id%type;
-nCount integer;
-nParent tmp_pcmn.pcm_val_parent%type;
-sName varchar;
-nJft_id attr_value.jft_id%type;
-begin
-
- if length(trim(p_account)) != 0 then
- select count(*) into nCount from tmp_pcmn where pcm_val=p_account;
- if nCount = 0 then
- select av_text into sName from
- attr_value join jnt_fic_att_value using (jft_id)
- where
- ad_id=1 and f_id=p_f_id;
- nParent:=fiche_account_parent(p_f_id);
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
- end if;
- end if;
- select jft_id into njft_id from jnt_fic_att_value where f_id=p_f_id and ad_id=5;
- update attr_value set av_text=p_account where jft_id=njft_id;
-
-return njft_id;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.account_update(p_f_id integer, p_account poste_comptable) OWNER TO phpcompta;
-CREATE FUNCTION attribut_insert(p_f_id integer, p_ad_id integer, p_value character varying) RETURNS void
- AS $$
-declare
- n_jft_id integer;
-begin
- select nextval('s_jnt_fic_att_value') into n_jft_id;
- insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
- insert into attr_value (jft_id,av_text) values (n_jft_id,p_value);
-return;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.attribut_insert(p_f_id integer, p_ad_id integer, p_value character varying) OWNER TO phpcompta;
-CREATE FUNCTION card_class_base(p_f_id integer) RETURNS fiche_def.fd_class_base%type
- AS $$
-declare
- n_poste fiche_def.fd_class_base%type;
-begin
- select fd_class_base into n_poste from fiche_def join fiche using (fd_id)
- where f_id=p_f_id;
- if not FOUND then
- raise exception 'Invalid fiche card_class_base(%)',p_f_id;
- end if;
-return nposte;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.card_class_base(p_f_id integer) OWNER TO phpcompta;
-CREATE FUNCTION check_balance(p_grpt integer) RETURNS numeric
- AS $$
-declare
- amount_jrnx_debit numeric;
- amount_jrnx_credit numeric;
- amount_jrn numeric;
-begin
- select sum (j_montant) into amount_jrnx_credit
- from jrnx
- where
- j_grpt=p_grpt
- and j_debit=false;
- select sum (j_montant) into amount_jrnx_debit
- from jrnx
- where
- j_grpt=p_grpt
- and j_debit=true;
- select jr_montant into amount_jrn
- from jrn
- where
- jr_grpt_id=p_grpt;
- if ( amount_jrnx_debit != amount_jrnx_credit )
- then
- return abs(amount_jrnx_debit-amount_jrnx_credit);
- end if;
- if ( amount_jrn != amount_jrnx_credit)
- then
- return -1*abs(amount_jrn - amount_jrnx_credit);
- end if;
- return 0;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.check_balance(p_grpt integer) OWNER TO phpcompta;
-CREATE FUNCTION fiche_account_parent(p_f_id integer) RETURNS poste_comptable
- AS $$
-declare
-ret poste_comptable;
-begin
- select fd_class_base into ret from fiche_def join fiche using (fd_id) where f_id=p_f_id;
- if not FOUND then
- raise exception '% N''existe pas',p_f_id;
- end if;
- return ret;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.fiche_account_parent(p_f_id integer) OWNER TO phpcompta;
-CREATE FUNCTION insert_jrnx(p_date character varying, p_montant numeric, p_poste integer, p_grpt integer, p_jrn_def integer, p_debit boolean, p_tech_user text, p_tech_per integer, p_qcode text) RETURNS void
- AS $$
-declare
- sCode varchar;
- nCount_qcode integer;
-begin
- sCode=trim(p_qcode);
- if length(sCode) = 0 or p_qcode is null then
- select count(*) into nCount_qcode
- from vw_poste_qcode where j_poste=p_poste;
- if nCount_qcode = 1 then
- select j_qcode into sCode
- from vw_poste_qcode where j_poste=p_poste;
- else
- sCode=NULL;
- end if;
-
- end if;
- if p_montant = 0.0 then
- return;
- end if;
- insert into jrnx
- (
- j_date,
- j_montant,
- j_poste,
- j_grpt,
- j_jrn_def,
- j_debit,
- j_tech_user,
- j_tech_per,
- j_qcode
- ) values
- (
- to_date(p_date,'DD.MM.YYYY'),
- p_montant,
- p_poste,
- p_grpt,
- p_jrn_def,
- p_debit,
- p_tech_user,
- p_tech_per,
- sCode
- );
-return;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.insert_jrnx(p_date character varying, p_montant numeric, p_poste integer, p_grpt integer, p_jrn_def integer, p_debit boolean, p_tech_user text, p_tech_per integer, p_qcode text) OWNER TO phpcompta;
-CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
- AS $$
-declare
- fid_client integer;
- fid_good integer;
-begin
- select f_id into fid_client from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_client;
- select f_id into fid_good from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_fiche;
- insert into quant_sold
- (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
- values
- (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
- return;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) OWNER TO phpcompta;
-CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
- AS $$
- declare
- ns integer;
- nExist integer;
- tText text;
- begin
- tText := upper(trim(tav_text));
- tText := replace(tText,' ','');
-
- loop
- select nextval('s_jnt_fic_att_value') into ns;
- if length (tText) = 0 or tText is null then
- tText := 'FID'||ns;
- end if;
- select count(*) into nExist
- from jnt_fic_att_value join attr_value using (jft_id)
- where
- ad_id=23 and av_text=upper(tText);
- if nExist = 0 then
- exit;
- end if;
- tText:='FID'||ns;
- end loop;
- insert into jnt_fic_att_value values (ns,nf_id,23);
- insert into attr_value values (ns,upper(tText));
- return ns;
- end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.insert_quick_code(nf_id integer, tav_text text) OWNER TO phpcompta;
-CREATE FUNCTION proc_check_balance() RETURNS "trigger"
- AS $$
-declare
- diff numeric;
- tt integer;
-begin
- if TG_OP = 'INSERT' then
- tt=NEW.jr_grpt_id;
- diff:=check_balance(tt);
- if diff != 0 then
- raise exception 'balance error %',diff ;
- end if;
- return NEW;
- end if;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.proc_check_balance() OWNER TO phpcompta;
-CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
- AS $$
- BEGIN
- execute 'create sequence seq_doc_type_'||NEW.dt_id;
-raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
- RETURN NEW;
- END;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.t_document_type_insert() OWNER TO phpcompta;
-CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
- AS $$
- BEGIN
- execute 'create sequence s_jrn_'||NEW.jrn_def_id;
-raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
- RETURN NEW;
- END;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.t_jrn_def_sequence() OWNER TO phpcompta;
-CREATE FUNCTION trim_cvs_quote() RETURNS "trigger"
- AS $$
-declare
- modified import_tmp%ROWTYPE;
-begin
- modified:=NEW;
- modified.devise=replace(new.devise,'"','');
- modified.poste_comptable=replace(new.poste_comptable,'"','');
- modified.compte_ordre=replace(NEW.COMPTE_ORDRE,'"','');
- modified.detail=replace(NEW.DETAIL,'"','');
- modified.num_compte=replace(NEW.NUM_COMPTE,'"','');
- return modified;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.trim_cvs_quote() OWNER TO phpcompta;
-CREATE FUNCTION trim_space_format_csv_banque() RETURNS "trigger"
- AS $$
-declare
- modified format_csv_banque%ROWTYPE;
-begin
- modified.name=trim(NEW.NAME);
- modified.include_file=trim(new.include_file);
- if ( length(modified.name) = 0 ) then
- modified.name=null;
- end if;
- if ( length(modified.include_file) = 0 ) then
- modified.include_file=null;
- end if;
- return modified;
-end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.trim_space_format_csv_banque() OWNER TO phpcompta;
-CREATE FUNCTION tva_delete(integer) RETURNS void
- AS $_$
-declare
- p_tva_id alias for $1;
- nCount integer;
-begin
- nCount=0;
- select count(*) into nCount from quant_sold where qs_vat_code=p_tva_id;
- if nCount = 0 then
- delete from tva_rate where tva_id=p_tva_id;
- end if;
- return;
-end;
-$_$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.tva_delete(integer) OWNER TO phpcompta;
-CREATE FUNCTION tva_insert(integer, text, numeric, text, text) RETURNS integer
- AS $_$
-declare
-p_tva_id alias for $1;
-p_tva_label alias for $2;
-p_tva_rate alias for $3;
-p_tva_comment alias for $4;
-p_tva_poste alias for $5;
-debit text;
-credit text;
-nCount integer;
-begin
-if length(trim(p_tva_label)) = 0 then
- return 3;
-end if;
-select count(*) into nCount from tva_rate
- where tva_id=p_tva_id;
-if nCount != 0 then
- return 5;
-end if;
-if length(trim(p_tva_poste)) != 0 then
- if position (',' in p_tva_poste) = 0 then return 4; end if;
- debit = split_part(p_tva_poste,',',1);
- credit = split_part(p_tva_poste,',',2);
- select count(*) into nCount from tmp_pcmn where pcm_val=debit;
- if nCount = 0 then return 4; end if;
- select count(*) into nCount from tmp_pcmn where pcm_val=credit;
- if nCount = 0 then return 4; end if;
-
-end if;
-insert into tva_rate(tva_id,tva_label,tva_rate,tva_comment,tva_poste)
- values (p_tva_id,p_tva_label,p_tva_rate,p_tva_comment,p_tva_poste);
-return 0;
-end;
-$_$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.tva_insert(integer, text, numeric, text, text) OWNER TO phpcompta;
-CREATE FUNCTION tva_modify(integer, text, numeric, text, text) RETURNS integer
- AS $_$declare
-p_tva_id alias for $1;
-p_tva_label alias for $2;
-p_tva_rate alias for $3;
-p_tva_comment alias for $4;
-p_tva_poste alias for $5;
-debit text;
-credit text;
-nCount integer;
-begin
-if length(trim(p_tva_label)) = 0 then
- return 3;
-end if;
-if length(trim(p_tva_poste)) != 0 then
- if position (',' in p_tva_poste) = 0 then return 4; end if;
- debit = split_part(p_tva_poste,',',1);
- credit = split_part(p_tva_poste,',',2);
- select count(*) into nCount from tmp_pcmn where pcm_val=debit;
- if nCount = 0 then return 4; end if;
- select count(*) into nCount from tmp_pcmn where pcm_val=credit;
- if nCount = 0 then return 4; end if;
-
-end if;
-update tva_rate set tva_label=p_tva_label,tva_rate=p_tva_rate,tva_comment=p_tva_comment,tva_poste=p_tva_poste
- where tva_id=p_tva_id;
-return 0;
-end;
-$_$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.tva_modify(integer, text, numeric, text, text) OWNER TO phpcompta;
-CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS integer
- AS $$
- declare
- ns integer;
- nExist integer;
- tText text;
- old_qcode varchar;
- begin
- select av_text into old_qcode from attr_value where jft_id=njft_id;
- if tav_text = upper( trim(old_qcode)) then
- return 0;
- end if;
-
- tText := trim(upper(tav_text));
- tText := replace(tText,' ','');
- if length ( tText) = 0 or tText is null then
- return 0;
- end if;
-
- ns := njft_id;
- loop
- select count(*) into nExist
- from jnt_fic_att_value join attr_value using (jft_id)
- where
- ad_id=23 and av_text=upper(tText);
- if nExist = 0 then
- exit;
- end if;
- if tText = 'FID'||ns then
- select nextval('s_jnt_fic_att_value') into ns;
- end if;
- tText :='FID'||ns;
-
- end loop;
- update attr_value set av_text = tText where jft_id=njft_id;
- update jrnx set j_qcode=tText where j_qcode = old_qcode;
- return ns;
- end;
-$$
- LANGUAGE plpgsql;
-ALTER FUNCTION public.update_quick_code(njft_id integer, tav_text text) OWNER TO phpcompta;
-SET default_tablespace = '';
-SET default_with_oids = true;
CREATE TRIGGER tr_jrn_check_balance
AFTER INSERT ON jrn
FOR EACH ROW
@@ -1068,4 +1189,7 @@ CREATE TRIGGER trim_space
BEFORE INSERT OR UPDATE ON format_csv_banque
FOR EACH ROW
EXECUTE PROCEDURE trim_space_format_csv_banque();
-
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
diff --git a/html/admin/sql/dossier1/sequence.sql b/html/admin/sql/dossier1/sequence.sql
index 6f9664983..5ef596611 100644
--- a/html/admin/sql/dossier1/sequence.sql
+++ b/html/admin/sql/dossier1/sequence.sql
@@ -1,15 +1,25 @@
CREATE SEQUENCE document_seq
- START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
+CREATE SEQUENCE s_jnt_id
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE SEQUENCE s_attr_def
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
+CREATE SEQUENCE s_cbc
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE SEQUENCE s_central
START WITH 1
INCREMENT BY 1
@@ -71,7 +81,6 @@ CREATE SEQUENCE s_idef
NO MINVALUE
CACHE 1;
CREATE SEQUENCE s_internal
- START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
@@ -149,7 +158,6 @@ CREATE SEQUENCE s_periode
NO MINVALUE
CACHE 1;
CREATE SEQUENCE s_quantity
- START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
@@ -169,3 +177,56 @@ CREATE SEQUENCE s_user_jrn
NO MAXVALUE
NO MINVALUE
CACHE 1;
+CREATE SEQUENCE seq_doc_type_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_4
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_5
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_6
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_7
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_8
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_9
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
diff --git a/html/admin/sql/dossier1/table.sql b/html/admin/sql/dossier1/table.sql
index 1280ee1af..d210d5ebb 100644
--- a/html/admin/sql/dossier1/table.sql
+++ b/html/admin/sql/dossier1/table.sql
@@ -1,3 +1,4 @@
+CREATE DOMAIN poste_comptable AS numeric(25,0);
CREATE TABLE "action" (
ac_id integer NOT NULL,
ac_description text NOT NULL
@@ -15,7 +16,7 @@ CREATE TABLE action_gestion (
ag_ref text
);
CREATE TABLE attr_def (
- ad_id integer DEFAULT nextval('s_attr_def'::text) NOT NULL,
+ ad_id integer DEFAULT nextval(('s_attr_def'::text)::regclass) NOT NULL,
ad_text text
);
CREATE TABLE attr_min (
@@ -27,7 +28,7 @@ CREATE TABLE attr_value (
av_text text
);
CREATE TABLE centralized (
- c_id integer DEFAULT nextval('s_centralized'::text) NOT NULL,
+ c_id integer DEFAULT nextval(('s_centralized'::text)::regclass) NOT NULL,
c_j_id integer,
c_date date NOT NULL,
c_internal text NOT NULL,
@@ -68,23 +69,23 @@ CREATE TABLE document_type (
dt_value character varying(80)
);
CREATE TABLE fiche (
- f_id integer DEFAULT nextval('s_fiche'::text) NOT NULL,
+ f_id integer DEFAULT nextval(('s_fiche'::text)::regclass) NOT NULL,
fd_id integer
);
CREATE TABLE fiche_def (
- fd_id integer DEFAULT nextval('s_fdef'::text) NOT NULL,
+ fd_id integer DEFAULT nextval(('s_fdef'::text)::regclass) NOT NULL,
fd_class_base poste_comptable,
fd_label text NOT NULL,
fd_create_account boolean DEFAULT false,
frd_id integer NOT NULL
);
CREATE TABLE fiche_def_ref (
- frd_id integer DEFAULT nextval('s_fiche_def_ref'::text) NOT NULL,
+ frd_id integer DEFAULT nextval(('s_fiche_def_ref'::text)::regclass) NOT NULL,
frd_text text,
frd_class_base integer
);
CREATE TABLE form (
- fo_id integer DEFAULT nextval('s_form'::text) NOT NULL,
+ fo_id integer DEFAULT nextval(('s_form'::text)::regclass) NOT NULL,
fo_fr_id integer,
fo_pos integer,
fo_label text,
@@ -95,7 +96,7 @@ CREATE TABLE format_csv_banque (
include_file text NOT NULL
);
CREATE TABLE formdef (
- fr_id integer DEFAULT nextval('s_formdef'::text) NOT NULL,
+ fr_id integer DEFAULT nextval(('s_formdef'::text)::regclass) NOT NULL,
fr_label text
);
CREATE TABLE import_tmp (
@@ -108,26 +109,29 @@ CREATE TABLE import_tmp (
detail text,
num_compte text,
poste_comptable text,
- ok boolean DEFAULT false,
+ status character varying(1) DEFAULT 'n'::character varying NOT NULL,
bq_account integer NOT NULL,
- jrn integer NOT NULL
+ jrn integer NOT NULL,
+ jr_rapt text,
+ CONSTRAINT import_tmp_status_check CHECK ((((((status)::text = 't'::text) OR ((status)::text = 'd'::text)) OR ((status)::text = 'w'::text)) OR ((status)::text = 'n'::text)))
);
CREATE TABLE invoice (
- iv_id integer DEFAULT nextval('s_invoice'::text) NOT NULL,
+ iv_id integer DEFAULT nextval(('s_invoice'::text)::regclass) NOT NULL,
iv_name text NOT NULL,
iv_file oid
);
CREATE TABLE jnt_fic_att_value (
- jft_id integer DEFAULT nextval('s_jnt_fic_att_value'::text) NOT NULL,
+ jft_id integer DEFAULT nextval(('s_jnt_fic_att_value'::text)::regclass) NOT NULL,
f_id integer,
ad_id integer
);
CREATE TABLE jnt_fic_attr (
fd_id integer,
- ad_id integer
+ ad_id integer,
+ jnt_id bigint DEFAULT nextval('s_jnt_id'::regclass) NOT NULL
);
CREATE TABLE jrn (
- jr_id integer DEFAULT nextval('s_jrn'::text) NOT NULL,
+ jr_id integer DEFAULT nextval(('s_jrn'::text)::regclass) NOT NULL,
jr_def_id integer NOT NULL,
jr_montant numeric(20,4) NOT NULL,
jr_comment text,
@@ -147,7 +151,7 @@ CREATE TABLE jrn (
jr_pj_type text
);
CREATE TABLE jrn_action (
- ja_id integer DEFAULT nextval('s_jrnaction'::text) NOT NULL,
+ ja_id integer DEFAULT nextval(('s_jrnaction'::text)::regclass) NOT NULL,
ja_name text NOT NULL,
ja_desc text,
ja_url text NOT NULL,
@@ -156,7 +160,7 @@ CREATE TABLE jrn_action (
ja_jrn_type character(3)
);
CREATE TABLE jrn_def (
- jrn_def_id integer DEFAULT nextval('s_jrn_def'::text) NOT NULL,
+ jrn_def_id integer DEFAULT nextval(('s_jrn_def'::text)::regclass) NOT NULL,
jrn_def_name text NOT NULL,
jrn_def_class_deb text,
jrn_def_class_cred text,
@@ -170,7 +174,7 @@ CREATE TABLE jrn_def (
jrn_def_code text NOT NULL
);
CREATE TABLE jrn_rapt (
- jra_id integer DEFAULT nextval('s_jrn_rapt'::text) NOT NULL,
+ jra_id integer DEFAULT nextval(('s_jrn_rapt'::text)::regclass) NOT NULL,
jr_id integer NOT NULL,
jra_concerned integer NOT NULL
);
@@ -179,7 +183,7 @@ CREATE TABLE jrn_type (
jrn_desc text
);
CREATE TABLE jrnx (
- j_id integer DEFAULT nextval('s_jrn_op'::text) NOT NULL,
+ j_id integer DEFAULT nextval(('s_jrn_op'::text)::regclass) NOT NULL,
j_date date DEFAULT now(),
j_montant numeric(20,4) DEFAULT 0,
j_poste poste_comptable NOT NULL,
@@ -205,39 +209,41 @@ CREATE TABLE parm_code (
p_comment text
);
CREATE TABLE parm_money (
- pm_id integer DEFAULT nextval('s_currency'::text),
+ pm_id integer DEFAULT nextval(('s_currency'::text)::regclass),
pm_code character(3) NOT NULL,
pm_rate numeric(20,4)
);
CREATE TABLE parm_periode (
- p_id integer DEFAULT nextval('s_periode'::text) NOT NULL,
+ p_id integer DEFAULT nextval(('s_periode'::text)::regclass) NOT NULL,
p_start date NOT NULL,
- p_end date,
+ p_end date NOT NULL,
p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
p_closed boolean DEFAULT false,
p_central boolean DEFAULT false,
CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
);
CREATE TABLE quant_sold (
- qs_id integer DEFAULT nextval('s_quantity'::text) NOT NULL,
+ qs_id integer DEFAULT nextval(('s_quantity'::text)::regclass) NOT NULL,
qs_internal text NOT NULL,
qs_fiche integer NOT NULL,
- qs_quantite integer NOT NULL,
+ qs_quantite numeric(20,4) NOT NULL,
qs_price numeric(20,4),
qs_vat numeric(20,4),
qs_vat_code integer,
qs_client integer NOT NULL
);
CREATE TABLE stock_goods (
- sg_id integer DEFAULT nextval('s_stock_goods'::text) NOT NULL,
+ sg_id integer DEFAULT nextval(('s_stock_goods'::text)::regclass) NOT NULL,
j_id integer,
f_id integer NOT NULL,
sg_code text,
- sg_quantity integer DEFAULT 0,
+ sg_quantity numeric(8,4) DEFAULT 0,
sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
sg_date date,
sg_tech_date date DEFAULT now(),
sg_tech_user text,
+ sg_comment character varying(80),
+ sg_exercice character varying(4),
CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
);
CREATE TABLE tmp_pcmn (
@@ -259,12 +265,12 @@ CREATE TABLE user_local_pref (
parameter_value text
);
CREATE TABLE user_sec_act (
- ua_id integer DEFAULT nextval('s_user_act'::text) NOT NULL,
+ ua_id integer DEFAULT nextval(('s_user_act'::text)::regclass) NOT NULL,
ua_login text,
ua_act_id integer
);
CREATE TABLE user_sec_jrn (
- uj_id integer DEFAULT nextval('s_user_jrn'::text) NOT NULL,
+ uj_id integer DEFAULT nextval(('s_user_jrn'::text)::regclass) NOT NULL,
uj_login text,
uj_jrn_id integer,
uj_priv text
diff --git a/html/admin/sql/make-sql b/html/admin/sql/make-sql
new file mode 100755
index 000000000..f5615f2de
--- /dev/null
+++ b/html/admin/sql/make-sql
@@ -0,0 +1,6 @@
+for i in account_repository dossier1 mod1 mod2;do
+echo "In the folder $i"
+cd $i
+./make-sql
+cd ..
+done
diff --git a/html/admin/sql/mod1/comment.sql b/html/admin/sql/mod1/comment.sql
index e2b4f1eae..4ec562048 100644
--- a/html/admin/sql/mod1/comment.sql
+++ b/html/admin/sql/mod1/comment.sql
@@ -1,5 +1,7 @@
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
COMMENT ON SCHEMA public IS 'Standard public schema';
+-- Name: FUNCTION correct_sequence(p_sequence text, p_col text, p_table text); Type: COMMENT; Schema: public; Owner: phpcompta
+COMMENT ON FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) IS ' Often the primary key is a sequence number and sometimes the value of the sequence is not synchronized with the primary key ( p_sequence : sequence name, p_col : col of the pk,p_table : concerned table';
-- Name: TABLE "action"; Type: COMMENT; Schema: public; Owner: phpcompta
COMMENT ON TABLE "action" IS 'The different privileges';
-- Name: TABLE action_gestion; Type: COMMENT; Schema: public; Owner: phpcompta
diff --git a/html/admin/sql/mod1/constraint.sql b/html/admin/sql/mod1/constraint.sql
index e996c99cb..b7b4acc2c 100644
--- a/html/admin/sql/mod1/constraint.sql
+++ b/html/admin/sql/mod1/constraint.sql
@@ -1,88 +1,7 @@
-ALTER TABLE public."action" OWNER TO phpcompta;
-ALTER TABLE public.action_gestion OWNER TO phpcompta;
-ALTER TABLE public.attr_def OWNER TO phpcompta;
-ALTER TABLE public.attr_min OWNER TO phpcompta;
-ALTER TABLE public.attr_value OWNER TO phpcompta;
-ALTER TABLE public.centralized OWNER TO phpcompta;
-ALTER TABLE public.document OWNER TO phpcompta;
-ALTER TABLE public.document_modele OWNER TO phpcompta;
-ALTER TABLE public.document_seq OWNER TO phpcompta;
-ALTER TABLE public.document_state OWNER TO phpcompta;
-ALTER TABLE public.document_type OWNER TO phpcompta;
-ALTER TABLE public.fiche OWNER TO phpcompta;
-ALTER TABLE public.fiche_def OWNER TO phpcompta;
-ALTER TABLE public.fiche_def_ref OWNER TO phpcompta;
-ALTER TABLE public.form OWNER TO phpcompta;
-ALTER TABLE public.format_csv_banque OWNER TO phpcompta;
-ALTER TABLE public.formdef OWNER TO phpcompta;
-ALTER TABLE public.import_tmp OWNER TO phpcompta;
-ALTER TABLE public.invoice OWNER TO phpcompta;
-ALTER TABLE public.jnt_fic_att_value OWNER TO phpcompta;
-ALTER TABLE public.jnt_fic_attr OWNER TO phpcompta;
-ALTER TABLE public.jrn OWNER TO phpcompta;
-ALTER TABLE public.jrn_action OWNER TO phpcompta;
-ALTER TABLE public.jrn_def OWNER TO phpcompta;
-ALTER TABLE public.jrn_rapt OWNER TO phpcompta;
-ALTER TABLE public.jrn_type OWNER TO phpcompta;
-ALTER TABLE public.jrnx OWNER TO phpcompta;
-ALTER TABLE public.parameter OWNER TO phpcompta;
-ALTER TABLE public.parm_code OWNER TO phpcompta;
-ALTER TABLE public.parm_money OWNER TO phpcompta;
-ALTER TABLE public.parm_periode OWNER TO phpcompta;
-ALTER TABLE public.quant_sold OWNER TO phpcompta;
-ALTER TABLE public.s_attr_def OWNER TO phpcompta;
-ALTER TABLE public.s_central OWNER TO phpcompta;
-ALTER TABLE public.s_central_order OWNER TO phpcompta;
-ALTER TABLE public.s_centralized OWNER TO phpcompta;
-ALTER TABLE public.s_currency OWNER TO phpcompta;
-ALTER TABLE public.s_fdef OWNER TO phpcompta;
-ALTER TABLE public.s_fiche OWNER TO phpcompta;
-ALTER TABLE public.s_fiche_def_ref OWNER TO phpcompta;
-ALTER TABLE public.s_form OWNER TO phpcompta;
-ALTER TABLE public.s_formdef OWNER TO phpcompta;
-ALTER TABLE public.s_grpt OWNER TO phpcompta;
-ALTER TABLE public.s_idef OWNER TO phpcompta;
-ALTER TABLE public.s_internal OWNER TO phpcompta;
-ALTER TABLE public.s_invoice OWNER TO phpcompta;
-ALTER TABLE public.s_isup OWNER TO phpcompta;
-ALTER TABLE public.s_jnt_fic_att_value OWNER TO phpcompta;
-ALTER TABLE public.s_jrn OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_1 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_2 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_3 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_4 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_def OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_op OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_rapt OWNER TO phpcompta;
-ALTER TABLE public.s_jrnaction OWNER TO phpcompta;
-ALTER TABLE public.s_jrnx OWNER TO phpcompta;
-ALTER TABLE public.s_periode OWNER TO phpcompta;
-ALTER TABLE public.s_quantity OWNER TO phpcompta;
-ALTER TABLE public.s_stock_goods OWNER TO phpcompta;
-ALTER TABLE public.s_user_act OWNER TO phpcompta;
-ALTER TABLE public.s_user_jrn OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_1 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_2 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_3 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_4 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_5 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_6 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_7 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_8 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_9 OWNER TO phpcompta;
-ALTER TABLE public.stock_goods OWNER TO phpcompta;
-ALTER TABLE public.tmp_pcmn OWNER TO phpcompta;
-ALTER TABLE public.tva_rate OWNER TO phpcompta;
-ALTER TABLE public.user_local_pref OWNER TO phpcompta;
-ALTER TABLE public.user_sec_act OWNER TO phpcompta;
-ALTER TABLE public.user_sec_jrn OWNER TO phpcompta;
-ALTER TABLE public.version OWNER TO phpcompta;
-ALTER TABLE public.vw_client OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_attr OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_def OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_min OWNER TO phpcompta;
-ALTER TABLE public.vw_poste_qcode OWNER TO phpcompta;
-ALTER TABLE public.vw_supplier OWNER TO phpcompta;
+ SET client_encoding = 'LATIN1';
+ SET check_function_bodies = false;
+ SET client_min_messages = warning;
+SET search_path = public, pg_catalog;
ALTER TABLE ONLY action_gestion
ADD CONSTRAINT action_gestion_pkey PRIMARY KEY (ag_id);
ALTER TABLE ONLY "action"
@@ -135,10 +54,10 @@ ALTER TABLE ONLY parm_code
ADD CONSTRAINT parm_code_pkey PRIMARY KEY (p_code);
ALTER TABLE ONLY parm_money
ADD CONSTRAINT parm_money_pkey PRIMARY KEY (pm_code);
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_p_start_key UNIQUE (p_start);
ALTER TABLE ONLY parm_periode
ADD CONSTRAINT parm_periode_pkey PRIMARY KEY (p_id);
+ALTER TABLE ONLY jnt_fic_attr
+ ADD CONSTRAINT pk_jnt_fic_attr PRIMARY KEY (jnt_id);
ALTER TABLE ONLY user_local_pref
ADD CONSTRAINT pk_user_local_pref PRIMARY KEY (user_id, parameter_type);
ALTER TABLE ONLY quant_sold
diff --git a/html/admin/sql/mod1/data.sql b/html/admin/sql/mod1/data.sql
index 6b6dd94d9..365159861 100644
--- a/html/admin/sql/mod1/data.sql
+++ b/html/admin/sql/mod1/data.sql
@@ -50,6 +50,13 @@ SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_state', 's_
SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_type', 'dt_id'), 10, false);
+--
+-- Name: s_jnt_id; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jnt_id', 53, true);
+
+
--
-- Name: s_attr_def; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -57,6 +64,13 @@ SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_type', 'dt_
SELECT pg_catalog.setval('s_attr_def', 27, true);
+--
+-- Name: s_cbc; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_cbc', 1, false);
+
+
--
-- Name: s_central; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -159,7 +173,7 @@ SELECT pg_catalog.setval('s_isup', 1, false);
-- Name: s_jnt_fic_att_value; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_jnt_fic_att_value', 165, true);
+SELECT pg_catalog.setval('s_jnt_fic_att_value', 366, false);
--
@@ -169,6 +183,33 @@ SELECT pg_catalog.setval('s_jnt_fic_att_value', 165, true);
SELECT pg_catalog.setval('s_jrn', 1, false);
+--
+-- Name: s_jrn_1; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_1', 1, false);
+
+
+--
+-- Name: s_jrn_2; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_2', 1, false);
+
+
+--
+-- Name: s_jrn_3; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_3', 1, false);
+
+
+--
+-- Name: s_jrn_4; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_4', 1, false);
+
--
-- Name: s_jrn_def; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
@@ -240,6 +281,68 @@ SELECT pg_catalog.setval('s_user_act', 1, false);
SELECT pg_catalog.setval('s_user_jrn', 1, false);
+--
+-- Name: seq_doc_type_1; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_1', 1, false);
+
+
+--
+-- Name: seq_doc_type_2; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_2', 1, false);
+
+
+--
+-- Name: seq_doc_type_3; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_3', 1, false);
+
+
+--
+-- Name: seq_doc_type_4; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_4', 1, false);
+
+
+--
+-- Name: seq_doc_type_5; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_5', 1, false);
+
+
+--
+-- Name: seq_doc_type_6; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_6', 1, false);
+
+
+--
+-- Name: seq_doc_type_7; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_7', 1, false);
+
+
+--
+-- Name: seq_doc_type_8; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_8', 1, false);
+
+
+--
+-- Name: seq_doc_type_9; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_9', 1, false);
+
--
-- Data for Name: action; Type: TABLE DATA; Schema: public; Owner: phpcompta
@@ -293,7 +396,6 @@ INSERT INTO attr_def (ad_id, ad_text) VALUES (11, 'Montant initial');
INSERT INTO attr_def (ad_id, ad_text) VALUES (12, 'Personne de contact ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (13, 'numéro de tva ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (14, 'Adresse ');
-INSERT INTO attr_def (ad_id, ad_text) VALUES (15, 'code postal ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (16, 'pays ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (17, 'téléphone ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (18, 'email ');
@@ -306,6 +408,7 @@ INSERT INTO attr_def (ad_id, ad_text) VALUES (24, 'Ville');
INSERT INTO attr_def (ad_id, ad_text) VALUES (25, 'Société');
INSERT INTO attr_def (ad_id, ad_text) VALUES (26, 'Fax');
INSERT INTO attr_def (ad_id, ad_text) VALUES (27, 'GSM');
+INSERT INTO attr_def (ad_id, ad_text) VALUES (15, 'code postal');
--
@@ -353,31 +456,24 @@ INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 19);
INSERT INTO attr_min (frd_id, ad_id) VALUES (14, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 4);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 10);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 12);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 4);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 10);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 12);
INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 12);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 12);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 12);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 9);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 1);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 8);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 9);
INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 10);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 5);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 11);
INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 11);
INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 15);
@@ -408,6 +504,7 @@ INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 18);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 25);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 26);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 27);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 23);
--
@@ -709,6 +806,7 @@ INSERT INTO format_csv_banque (name, include_file) VALUES ('ING', 'ing_be.inc.ph
INSERT INTO format_csv_banque (name, include_file) VALUES ('CBC', 'cbc_be.inc.php');
INSERT INTO format_csv_banque (name, include_file) VALUES ('Argenta Belgique', 'argenta_be.inc.php');
INSERT INTO format_csv_banque (name, include_file) VALUES ('CBC Belgique', 'cbc_be.inc.php');
+INSERT INTO format_csv_banque (name, include_file) VALUES ('Dexia', 'dexia_be.inc.php');
--
@@ -905,59 +1003,58 @@ INSERT INTO jnt_fic_att_value (jft_id, f_id, ad_id) VALUES (365, 20, 23);
-- Data for Name: jnt_fic_attr; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 6);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 13);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 3);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 4);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 13);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 12);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 13);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 14);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 15);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 16);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 17);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 18);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 5);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 1);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 2);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 6);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 7);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 19);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (1, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (3, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (5, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (6, 23);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 24);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (4, 24);
-INSERT INTO jnt_fic_attr (fd_id, ad_id) VALUES (2, 24);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 5, 1);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 1, 2);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 2, 3);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 6, 4);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 7, 5);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 5, 6);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 1, 7);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 12, 8);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 13, 9);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 14, 10);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 15, 11);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 16, 12);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 17, 13);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 18, 14);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 5, 15);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 1, 16);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 3, 17);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 4, 18);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 12, 19);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 13, 20);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 14, 21);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 15, 22);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 16, 23);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 17, 24);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 18, 25);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 5, 26);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 1, 27);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 12, 28);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 13, 29);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 14, 30);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 15, 31);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 16, 32);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 17, 33);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 18, 34);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 5, 35);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 1, 36);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 2, 37);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 7, 38);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 5, 39);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 1, 40);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 2, 41);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 6, 42);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 7, 43);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 19, 44);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 23, 45);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 23, 46);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 23, 47);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 23, 48);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 23, 49);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 23, 50);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 24, 51);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 24, 52);
--
@@ -1042,7 +1139,7 @@ INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('VIREMENT_INTERNE', '
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('COMPTE_COURANT', '56', 'Poste comptable pour le compte courant');
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('CAISSE', '57', 'Poste comptable pour la caisse');
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('TVA_DNA', '6740', 'Tva non déductible s');
-INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('TVA_DED_IMPOT', '64012', 'Tva déductible par l''impôt');
+INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('TVA_DED_IMPOT', '619000', 'Tva déductible par l''impôt');
INSERT INTO parm_code (p_code, p_value, p_comment) VALUES ('VENTE', '70', 'Poste comptable de base pour les ventes');
@@ -1451,7 +1548,6 @@ INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (637
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (6371, 'Reprises(-)', 637, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (64, 'Autres charges d''exploitation', 6, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (640, 'Charges fiscales d''exploitation', 64, 'BE');
-INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (64012, 'Tva récupérable par l''impôt', 64, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (641, 'Moins-values sur réalisations courantes d''immobilisations corporelles', 64, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (642, 'Moins-value sur réalisation de créances commerciales', 64, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (643, 'Charges d''exploitations', 64, 'BE');
@@ -1605,7 +1701,7 @@ INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (700
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (7000001, 'Prestation', 700, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (7000003, 'Déplacement', 700, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (101, 'Capital non appelé', 10, 'BE');
-
+INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (6190, 'TVA récupérable par l''impôt', 61, 'BE');
INSERT INTO tmp_pcmn (pcm_val, pcm_lib, pcm_val_parent, pcm_country) VALUES (6740, 'Dépense non admise', 67, 'BE');
@@ -1617,6 +1713,8 @@ INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUE
INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUES (2, '12%', 0.1200, 'Tva ', '4112,4512');
INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUES (3, '6%', 0.0600, 'Tva applicable aux journaux et livres', '4113,4513');
INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUES (4, '0%', 0.0000, 'Tva applicable lors de vente/achat intracommunautaire', '4114,4514');
+INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUES (5, '0%', 0.0000, 'Pas soumis à la TVA', NULL);
+INSERT INTO tva_rate (tva_id, tva_label, tva_rate, tva_comment, tva_poste) VALUES (5, '0%', 0.0000, 'Pas soumis à la TVA', NULL);
--
@@ -1642,506 +1740,10 @@ INSERT INTO user_local_pref (user_id, parameter_type, parameter_value) VALUES ('
-- Data for Name: version; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO version (val) VALUES (15);
+INSERT INTO version (val) VALUES (28);
--
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+-- PostgreSQL database dump complete
--
---
--- Name: action_gestion_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY action_gestion
- ADD CONSTRAINT action_gestion_pkey PRIMARY KEY (ag_id);
-
-
-
-
---
--- Name: action_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY "action"
- ADD CONSTRAINT action_pkey PRIMARY KEY (ac_id);
-
-
-
-
---
--- Name: attr_def_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY attr_def
- ADD CONSTRAINT attr_def_pkey PRIMARY KEY (ad_id);
-
-
-
-
---
--- Name: centralized_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT centralized_pkey PRIMARY KEY (c_id);
-
-
-
-
---
--- Name: document_modele_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY document_modele
- ADD CONSTRAINT document_modele_pkey PRIMARY KEY (md_id);
-
-
-
-
---
--- Name: document_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY document
- ADD CONSTRAINT document_pkey PRIMARY KEY (d_id);
-
-
-
-
---
--- Name: document_state_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY document_state
- ADD CONSTRAINT document_state_pkey PRIMARY KEY (s_id);
-
-
-
-
---
--- Name: document_type_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY document_type
- ADD CONSTRAINT document_type_pkey PRIMARY KEY (dt_id);
-
-
-
-
---
--- Name: fiche_def_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY fiche_def
- ADD CONSTRAINT fiche_def_pkey PRIMARY KEY (fd_id);
-
-
-
-
---
--- Name: fiche_def_ref_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY fiche_def_ref
- ADD CONSTRAINT fiche_def_ref_pkey PRIMARY KEY (frd_id);
-
-
-
-
---
--- Name: fiche_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY fiche
- ADD CONSTRAINT fiche_pkey PRIMARY KEY (f_id);
-
-
-
-
---
--- Name: form_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY form
- ADD CONSTRAINT form_pkey PRIMARY KEY (fo_id);
-
-
-
-
---
--- Name: format_csv_banque_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY format_csv_banque
- ADD CONSTRAINT format_csv_banque_pkey PRIMARY KEY (name);
-
-
-
-
---
--- Name: formdef_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY formdef
- ADD CONSTRAINT formdef_pkey PRIMARY KEY (fr_id);
-
-
-
-
---
--- Name: invoice_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY invoice
- ADD CONSTRAINT invoice_pkey PRIMARY KEY (iv_id);
-
-
-
-
---
--- Name: jnt_fic_att_value_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT jnt_fic_att_value_pkey PRIMARY KEY (jft_id);
-
-
-
-
---
--- Name: jrn_action_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrn_action
- ADD CONSTRAINT jrn_action_pkey PRIMARY KEY (ja_id);
-
-
-
-
---
--- Name: jrn_def_jrn_def_name_key; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT jrn_def_jrn_def_name_key UNIQUE (jrn_def_name);
-
-
-
-
---
--- Name: jrn_def_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT jrn_def_pkey PRIMARY KEY (jrn_def_id);
-
-
-
-
---
--- Name: jrn_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrn
- ADD CONSTRAINT jrn_pkey PRIMARY KEY (jr_id, jr_def_id);
-
-
-
-
---
--- Name: jrn_rapt_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrn_rapt
- ADD CONSTRAINT jrn_rapt_pkey PRIMARY KEY (jra_id);
-
-
-
-
---
--- Name: jrn_type_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrn_type
- ADD CONSTRAINT jrn_type_pkey PRIMARY KEY (jrn_type_id);
-
-
-
-
---
--- Name: jrnx_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT jrnx_pkey PRIMARY KEY (j_id);
-
-
-
-
---
--- Name: parameter_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY parameter
- ADD CONSTRAINT parameter_pkey PRIMARY KEY (pr_id);
-
-
-
-
---
--- Name: parm_code_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY parm_code
- ADD CONSTRAINT parm_code_pkey PRIMARY KEY (p_code);
-
-
-
-
---
--- Name: parm_money_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY parm_money
- ADD CONSTRAINT parm_money_pkey PRIMARY KEY (pm_code);
-
-
-
-
---
--- Name: parm_periode_p_start_key; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_p_start_key UNIQUE (p_start);
-
-
-
-
---
--- Name: parm_periode_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_pkey PRIMARY KEY (p_id);
-
-
-
-
---
--- Name: pk_user_local_pref; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY user_local_pref
- ADD CONSTRAINT pk_user_local_pref PRIMARY KEY (user_id, parameter_type);
-
-
-
-
---
--- Name: qs_id_pk; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY quant_sold
- ADD CONSTRAINT qs_id_pk PRIMARY KEY (qs_id);
-
-
-
-
---
--- Name: stock_goods_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY stock_goods
- ADD CONSTRAINT stock_goods_pkey PRIMARY KEY (sg_id);
-
-
-
-
---
--- Name: tmp_pcmn_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY tmp_pcmn
- ADD CONSTRAINT tmp_pcmn_pkey PRIMARY KEY (pcm_val);
-
-
-
-
---
--- Name: user_sec_act_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY user_sec_act
- ADD CONSTRAINT user_sec_act_pkey PRIMARY KEY (ua_id);
-
-
-
-
---
--- Name: user_sec_jrn_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
---
-
-ALTER TABLE ONLY user_sec_jrn
- ADD CONSTRAINT user_sec_jrn_pkey PRIMARY KEY (uj_id);
-
-
-
-
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT "$1" FOREIGN KEY (jrn_def_type) REFERENCES jrn_type(jrn_type_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY form
- ADD CONSTRAINT "$1" FOREIGN KEY (fo_fr_id) REFERENCES formdef(fr_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT "$1" FOREIGN KEY (c_jrn_def) REFERENCES jrn_def(jrn_def_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY user_sec_jrn
- ADD CONSTRAINT "$1" FOREIGN KEY (uj_jrn_id) REFERENCES jrn_def(jrn_def_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY user_sec_act
- ADD CONSTRAINT "$1" FOREIGN KEY (ua_act_id) REFERENCES "action"(ac_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jrn_action
- ADD CONSTRAINT "$1" FOREIGN KEY (ja_jrn_type) REFERENCES jrn_type(jrn_type_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY fiche_def
- ADD CONSTRAINT "$1" FOREIGN KEY (frd_id) REFERENCES fiche_def_ref(frd_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY attr_min
- ADD CONSTRAINT "$1" FOREIGN KEY (frd_id) REFERENCES fiche_def_ref(frd_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY fiche
- ADD CONSTRAINT "$1" FOREIGN KEY (fd_id) REFERENCES fiche_def(fd_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT "$1" FOREIGN KEY (f_id) REFERENCES fiche(f_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY attr_value
- ADD CONSTRAINT "$1" FOREIGN KEY (jft_id) REFERENCES jnt_fic_att_value(jft_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jnt_fic_attr
- ADD CONSTRAINT "$1" FOREIGN KEY (fd_id) REFERENCES fiche_def(fd_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jrn
- ADD CONSTRAINT "$1" FOREIGN KEY (jr_def_id) REFERENCES jrn_def(jrn_def_id);
-
-
---
--- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT "$1" FOREIGN KEY (j_poste) REFERENCES tmp_pcmn(pcm_val);
-
-
---
--- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT "$2" FOREIGN KEY (j_jrn_def) REFERENCES jrn_def(jrn_def_id);
-
-
---
--- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY attr_min
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-
-
---
--- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-
-
---
--- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY jnt_fic_attr
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-
-
---
--- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT "$2" FOREIGN KEY (c_poste) REFERENCES tmp_pcmn(pcm_val);
-
-
---
--- Name: md_type; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
---
-
-ALTER TABLE ONLY document_modele
- ADD CONSTRAINT md_type FOREIGN KEY (md_type) REFERENCES document_type(dt_id);
-
-
diff --git a/html/admin/sql/mod1/function.sql b/html/admin/sql/mod1/function.sql
index 0499b21e0..cd1c910f5 100644
--- a/html/admin/sql/mod1/function.sql
+++ b/html/admin/sql/mod1/function.sql
@@ -1,9 +1,3 @@
-CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
- AS '$libdir/plpgsql', 'plpgsql_call_handler'
- LANGUAGE c;
-CREATE FUNCTION plpgsql_validator(oid) RETURNS void
- AS '$libdir/plpgsql', 'plpgsql_validator'
- LANGUAGE c;
CREATE FUNCTION account_add(p_id poste_comptable, p_name character varying) RETURNS void
AS $$
declare
@@ -37,22 +31,27 @@ $$
CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
AS $$
declare
- class_base poste_comptable;
- maxcode int8;
+ class_base poste_comptable;
+ maxcode poste_comptable;
begin
- -- Get the class base
- select fd_class_base into class_base
- from
- fiche_def join fiche using (fd_id)
- where
- f_id=p_f_id;
- raise notice 'class base %',class_base;
- select max(pcm_val) into maxcode from tmp_pcmn where pcm_val = class_base;
- if maxcode = class_base then
- maxcode=class_base*1000+1;
- end if;
- raise notice 'Max code %',maxcode;
-return maxcode+1;
+ select fd_class_base into class_base
+ from
+ fiche_def join fiche using (fd_id)
+ where
+ f_id=p_f_id;
+ raise notice 'account_compute class base %',class_base;
+ select count (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ if maxcode = 0 then
+ maxcode:=class_base;
+ else
+ select max (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ end if;
+ if maxcode = class_base then
+ maxcode:=class_base*1000;
+ end if;
+ maxcode:=maxcode+1;
+ raise notice 'account_compute Max code %',maxcode;
+ return maxcode;
end;
$$
LANGUAGE plpgsql;
@@ -67,51 +66,50 @@ nFd_id integer;
nCount integer;
begin
- -- if p_value empty
if length(trim(p_account)) != 0 then
- -- does the account exist ?
+ raise notice 'p_account is not empty';
select * into nCount from tmp_pcmn where pcm_val=p_account;
if nCount !=0 then
- -- retrieve name
+ raise notice 'this account exists in tmp_pcmn ';
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+ else
+ -- account doesn't exist, create it
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
- -- get parent
+
nParent:=account_parent(p_account);
- -- account doesn't exist we need to add id
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent)
- values (p_account,sName,nParent);
- -- insert as card's attribute
- attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
end if;
else
+ raise notice 'p_account is empty';
select fd_id into nFd_id from fiche where f_id=p_f_id;
bAuto:= account_auto(nFd_id);
-
if bAuto = true then
- -- create automatically the account
- -- compute the next account
+ raise notice 'account generated automatically';
nNew:=account_compute(p_f_id);
-raise debug 'nNew %', nNew;
- -- retrieve name
+ raise notice 'nNew %', nNew;
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
-
- -- get parent
nParent:=account_parent(nNew);
- -- account doesn't exist we need to add id
perform account_add (nNew,sName);
- -- insert as card's attribute
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
else
- perform attribut_insert(p_f_id,5,null);
+ -- if there is an account_base then it is the default
+ select fd_class_base into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if nNew is null or length(trim(nNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+ end if;
end if;
-
end if;
return 0;
@@ -140,9 +138,8 @@ begin
if length(sParent) <= 0 then
raise exception 'Impossible de trouver le compte parent pour %',p_account;
end if;
-
end loop;
-
+ raise notice 'account_parent : Parent is %',nParent;
return nParent;
end;
$$
@@ -189,25 +186,25 @@ declare
begin
select nextval('s_jnt_fic_att_value') into n_jft_id;
insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
- insert into attr_value (jft_id,av_text) values (n_jft_id,p_value);
+ insert into attr_value (jft_id,av_text) values (n_jft_id,trim(p_value));
return;
end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION card_class_base(p_f_id integer) RETURNS poste_comptable
AS $$
-
declare
n_poste fiche_def.fd_class_base%type;
begin
- select fd_class_base into n_poste from fiche_def join fiche using (fd_id)
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
where f_id=p_f_id;
if not FOUND then
raise exception 'Invalid fiche card_class_base(%)',p_f_id;
end if;
-return;
-end;
+return n_poste;
+end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION check_balance(p_grpt integer) RETURNS numeric
@@ -244,6 +241,49 @@ begin
end if;
return 0;
end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) RETURNS integer
+ AS $$
+declare
+last_sequence int8;
+max_sequence int8;
+n integer;
+begin
+ select count(*) into n from pg_class where relkind='S' and relname=lower(p_sequence);
+ if n = 0 then
+ raise exception ' Unknow sequence % ',p_sequence;
+ end if;
+ select count(*) into n from pg_class where relkind='r' and relname=lower(p_table);
+ if n = 0 then
+ raise exception ' Unknow table % ',p_table;
+ end if;
+
+ execute 'select last_value from '||p_sequence into last_sequence;
+ raise notice 'Last value of the sequence is %', last_sequence;
+
+ execute 'select max('||p_col||') from '||p_table into max_sequence;
+ if max_sequence is null then
+ max_sequence := 0;
+ end if;
+ raise notice 'Max value of the sequence is %', max_sequence;
+ max_sequence:= max_sequence +1;
+ execute 'alter sequence '||p_sequence||' restart with '||max_sequence;
+return 0;
+
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION drop_it(p_constraint character varying) RETURNS void
+ AS $$
+declare
+ nCount integer;
+begin
+ select count(*) into nCount from pg_constraint where conname=p_constraint;
+ if nCount = 1 then
+ execute 'alter table parm_periode drop constraint '||p_constraint ;
+ end if;
+end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION fiche_account_parent(p_f_id integer) RETURNS poste_comptable
@@ -313,26 +353,26 @@ return;
end;
$$
LANGUAGE plpgsql;
-CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
+CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
AS $$
-declare
- fid_client integer;
- fid_good integer;
+declare
+ fid_client integer;
+ fid_good integer;
begin
- select f_id into fid_client from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_client;
+ select f_id into fid_client from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
- select f_id into fid_good from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_fiche;
+ select f_id into fid_good from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
- insert into quant_sold
- (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
- values
- (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
- return;
-end;
-$$
+ insert into quant_sold
+ (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
+ values
+ (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
+ return;
+end;
+ $$
LANGUAGE plpgsql;
CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
AS $$
@@ -388,18 +428,29 @@ $$
LANGUAGE plpgsql;
CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id;
+if nCounter = 0 then
execute 'create sequence seq_doc_type_'||NEW.dt_id;
raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
+
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.jrn_def_id;
+if nCounter = 0 then
execute 'create sequence s_jrn_'||NEW.jrn_def_id;
-raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+ raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+end if;
RETURN NEW;
END;
$$
@@ -409,18 +460,12 @@ CREATE FUNCTION trim_cvs_quote() RETURNS "trigger"
declare
modified import_tmp%ROWTYPE;
begin
- modified.code=new.code;
- modified.montant=new.montant;
- modified.date_exec=new.date_exec;
- modified.date_valeur=new.date_valeur;
- modified.devise=replace(new.devise,'"','');
- modified.poste_comptable=replace(new.poste_comptable,'"','');
+ modified:=NEW;
+ modified.devise=replace(new.devise,'"','');
+ modified.poste_comptable=replace(new.poste_comptable,'"','');
modified.compte_ordre=replace(NEW.COMPTE_ORDRE,'"','');
modified.detail=replace(NEW.DETAIL,'"','');
modified.num_compte=replace(NEW.NUM_COMPTE,'"','');
- modified.bq_account=NEW.bq_account;
- modified.jrn=NEW.jrn;
- modified.ok=new.ok;
return modified;
end;
$$
@@ -553,7 +598,7 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
select count(*) into nExist
from jnt_fic_att_value join attr_value using (jft_id)
where
- ad_id=23 and av_text=upper(tText);
+ ad_id=23 and av_text=tText;
if nExist = 0 then
exit;
@@ -566,6 +611,15 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
end loop;
update attr_value set av_text = tText where jft_id=njft_id;
+
+ -- update also the contact
+ update attr_value set av_text = tText
+ where jft_id in
+ ( select jft_id
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where ad_id=25 and av_text=old_qcode);
+
+
update jrnx set j_qcode=tText where j_qcode = old_qcode;
return ns;
end;
diff --git a/html/admin/sql/mod1/index.sql b/html/admin/sql/mod1/index.sql
index e5310bab7..785b17022 100644
--- a/html/admin/sql/mod1/index.sql
+++ b/html/admin/sql/mod1/index.sql
@@ -1,61 +1,22 @@
-ALTER INDEX public.action_gestion_pkey OWNER TO phpcompta;
-ALTER INDEX public.action_pkey OWNER TO phpcompta;
-ALTER INDEX public.attr_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.centralized_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_modele_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_state_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_type_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_def_ref_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_pkey OWNER TO phpcompta;
-ALTER INDEX public.form_pkey OWNER TO phpcompta;
-ALTER INDEX public.format_csv_banque_pkey OWNER TO phpcompta;
-ALTER INDEX public.formdef_pkey OWNER TO phpcompta;
-ALTER INDEX public.invoice_pkey OWNER TO phpcompta;
-ALTER INDEX public.jnt_fic_att_value_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_action_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_def_jrn_def_name_key OWNER TO phpcompta;
-ALTER INDEX public.jrn_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_rapt_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_type_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrnx_pkey OWNER TO phpcompta;
-ALTER INDEX public.parameter_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_code_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_money_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_periode_p_start_key OWNER TO phpcompta;
-ALTER INDEX public.parm_periode_pkey OWNER TO phpcompta;
-ALTER INDEX public.pk_user_local_pref OWNER TO phpcompta;
-ALTER INDEX public.qs_id_pk OWNER TO phpcompta;
-ALTER INDEX public.stock_goods_pkey OWNER TO phpcompta;
-ALTER INDEX public.tmp_pcmn_pkey OWNER TO phpcompta;
-ALTER INDEX public.user_sec_act_pkey OWNER TO phpcompta;
-ALTER INDEX public.user_sec_jrn_pkey OWNER TO phpcompta;
-- Name: attr_value_jft_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
-ALTER INDEX public.attr_value_jft_id OWNER TO phpcompta;
+-- Name: fd_id_ad_id_x; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+CREATE UNIQUE INDEX fd_id_ad_id_x ON jnt_fic_attr USING btree (fd_id, ad_id);
-- Name: fk_stock_goods_f_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
-ALTER INDEX public.fk_stock_goods_f_id OWNER TO phpcompta;
-- Name: fk_stock_goods_j_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
-ALTER INDEX public.fk_stock_goods_j_id OWNER TO phpcompta;
-- Name: idx_case; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
-ALTER INDEX public.idx_case OWNER TO phpcompta;
-- Name: idx_qs_internal; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
-ALTER INDEX public.idx_qs_internal OWNER TO phpcompta;
-- Name: ix_iv_name; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
-ALTER INDEX public.ix_iv_name OWNER TO phpcompta;
-- Name: k_ag_ref; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
-ALTER INDEX public.k_ag_ref OWNER TO phpcompta;
-- Name: x_jrn_jr_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
-ALTER INDEX public.x_jrn_jr_id OWNER TO phpcompta;
+-- Name: x_periode; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+CREATE UNIQUE INDEX x_periode ON parm_periode USING btree (p_start, p_end);
-- Name: x_poste; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
CREATE INDEX x_poste ON jrnx USING btree (j_poste);
-ALTER INDEX public.x_poste OWNER TO phpcompta;
diff --git a/html/admin/sql/mod1/make-sql b/html/admin/sql/mod1/make-sql
index 4b00761f6..66a5e3650 100755
--- a/html/admin/sql/mod1/make-sql
+++ b/html/admin/sql/mod1/make-sql
@@ -1,12 +1,23 @@
pg_dump -O -U phpcompta -s mod1 > schema.sql
awk '/SEQUENCE/,/;/ { print $0;}' < schema.sql > sequence.sql
-awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE DOMAIN/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql >> table.sql
awk '/CREATE VIEW/,/;/ { print $0;}' < schema.sql > view.sql
awk '/INDEX/,/;/ { print $0;}' < schema.sql > index.sql
-awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql > constraint.sql
+(
+echo " SET client_encoding = 'LATIN1';"
+echo " SET check_function_bodies = false;"
+echo " SET client_min_messages = warning;"
+echo "SET search_path = public, pg_catalog;"
+)> constraint.sql
+
+
+awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql >> constraint.sql
awk '/CREATE FUNCTION/,/LANGUAGE/ { print $0;}' < schema.sql > function.sql
awk '/COMMENT/,/;/ {print $0;}' < schema.sql > comment.sql
+sed -i -e "/ALTER TABLE.*/d" -e "/ADD CONSTRAINT/d" -e "/CREATE PROCEDURAL/d" schema.sql
+
grep setval schema.sql >> sequence.sql
pg_dump -O -U phpcompta -D -a -O mod1 > data.sql
diff --git a/html/admin/sql/mod1/schema.sql b/html/admin/sql/mod1/schema.sql
index 56592ae05..27f5a8511 100644
--- a/html/admin/sql/mod1/schema.sql
+++ b/html/admin/sql/mod1/schema.sql
@@ -6,7 +6,20 @@ SET client_encoding = 'LATIN1';
SET check_function_bodies = false;
SET client_min_messages = warning;
+--
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
+--
+COMMENT ON SCHEMA public IS 'Standard public schema';
+
+
+--
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner:
+--
+
+
+
+SET search_path = public, pg_catalog;
--
-- Name: poste_comptable; Type: DOMAIN; Schema: public; Owner: phpcompta
@@ -19,1359 +32,6 @@ CREATE DOMAIN poste_comptable AS numeric(25,0);
-- Name: account_add(poste_comptable, character varying); Type: FUNCTION; Schema: public; Owner: phpcompta
--
-SET default_tablespace = '';
-
-SET default_with_oids = true;
-
---
--- Name: action; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE "action" (
- ac_id integer NOT NULL,
- ac_description text NOT NULL
-);
-
-
-
-
---
--- Name: TABLE "action"; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE "action" IS 'The different privileges';
-
-
---
--- Name: action_gestion; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE action_gestion (
- ag_id serial NOT NULL,
- ag_type integer,
- f_id_dest integer NOT NULL,
- f_id_exp integer NOT NULL,
- ag_title character varying(70),
- ag_timestamp timestamp without time zone DEFAULT now(),
- ag_cal character(1) DEFAULT 'C'::bpchar,
- ag_ref_ag_id integer,
- ag_comment text,
- ag_ref text
-);
-
-
-
-
---
--- Name: TABLE action_gestion; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE action_gestion IS 'Action for Managing';
-
-
---
--- Name: attr_def; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE attr_def (
- ad_id integer DEFAULT nextval('s_attr_def'::text) NOT NULL,
- ad_text text
-);
-
-
-
-
---
--- Name: TABLE attr_def; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
-
-
---
--- Name: attr_min; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE attr_min (
- frd_id integer,
- ad_id integer
-);
-
-
-
-
---
--- Name: TABLE attr_min; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE attr_min IS 'The value of attributs for the cards';
-
-
---
--- Name: attr_value; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE attr_value (
- jft_id integer,
- av_text text
-);
-
-
-
-
---
--- Name: centralized; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE centralized (
- c_id integer DEFAULT nextval('s_centralized'::text) NOT NULL,
- c_j_id integer,
- c_date date NOT NULL,
- c_internal text NOT NULL,
- c_montant numeric(20,4) NOT NULL,
- c_debit boolean DEFAULT true,
- c_jrn_def integer NOT NULL,
- c_poste poste_comptable,
- c_description text,
- c_grp integer NOT NULL,
- c_comment text,
- c_rapt text,
- c_periode integer,
- c_order integer
-);
-
-
-
-
---
--- Name: TABLE centralized; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE centralized IS 'The centralized journal';
-
-
---
--- Name: document; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE document (
- d_id serial NOT NULL,
- ag_id integer NOT NULL,
- d_lob oid,
- d_number bigint NOT NULL,
- d_filename text,
- d_mimetype text,
- d_state integer
-);
-
-
-
-
---
--- Name: TABLE document; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE document IS 'This table contains all the documents : summary and lob files';
-
-
---
--- Name: document_modele; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE document_modele (
- md_id serial NOT NULL,
- md_name text NOT NULL,
- md_lob oid,
- md_type integer NOT NULL,
- md_filename text,
- md_mimetype text
-);
-
-
-
-
---
--- Name: TABLE document_modele; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE document_modele IS ' contains all the template for the documents';
-
-
---
--- Name: document_seq; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE document_seq
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: SEQUENCE document_seq; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
-
-
---
--- Name: document_state; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE document_state (
- s_id serial NOT NULL,
- s_value character varying(50) NOT NULL
-);
-
-
-
-
---
--- Name: TABLE document_state; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE document_state IS 'State of the document';
-
-
---
--- Name: document_type; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE document_type (
- dt_id serial NOT NULL,
- dt_value character varying(80)
-);
-
-
-
-
---
--- Name: TABLE document_type; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE document_type IS 'Type of document : meeting, invoice,...';
-
-
---
--- Name: fiche; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE fiche (
- f_id integer DEFAULT nextval('s_fiche'::text) NOT NULL,
- fd_id integer
-);
-
-
-
-
---
--- Name: TABLE fiche; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE fiche IS 'Cards';
-
-
---
--- Name: fiche_def; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE fiche_def (
- fd_id integer DEFAULT nextval('s_fdef'::text) NOT NULL,
- fd_class_base poste_comptable,
- fd_label text NOT NULL,
- fd_create_account boolean DEFAULT false,
- frd_id integer NOT NULL
-);
-
-
-
-
---
--- Name: TABLE fiche_def; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE fiche_def IS 'Cards definition';
-
-
---
--- Name: fiche_def_ref; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE fiche_def_ref (
- frd_id integer DEFAULT nextval('s_fiche_def_ref'::text) NOT NULL,
- frd_text text,
- frd_class_base integer
-);
-
-
-
-
---
--- Name: TABLE fiche_def_ref; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
-
-
---
--- Name: form; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE form (
- fo_id integer DEFAULT nextval('s_form'::text) NOT NULL,
- fo_fr_id integer,
- fo_pos integer,
- fo_label text,
- fo_formula text
-);
-
-
-
-
---
--- Name: TABLE form; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE form IS 'Forms content';
-
-
---
--- Name: format_csv_banque; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE format_csv_banque (
- name text NOT NULL,
- include_file text NOT NULL
-);
-
-
-
-
---
--- Name: formdef; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE formdef (
- fr_id integer DEFAULT nextval('s_formdef'::text) NOT NULL,
- fr_label text
-);
-
-
-
-
---
--- Name: import_tmp; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE import_tmp (
- code text,
- date_exec date,
- date_valeur date,
- montant text,
- devise text,
- compte_ordre text,
- detail text,
- num_compte text,
- poste_comptable text,
- status varchar(1) default 'n' not null check (status in ('n','t','d','w')),
- bq_account integer NOT NULL,
- jrn integer NOT NULL
-
-);
-
-
-
-
---
--- Name: invoice; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE invoice (
- iv_id integer DEFAULT nextval('s_invoice'::text) NOT NULL,
- iv_name text NOT NULL,
- iv_file oid
-);
-
-
-
-
---
--- Name: jnt_fic_att_value; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jnt_fic_att_value (
- jft_id integer DEFAULT nextval('s_jnt_fic_att_value'::text) NOT NULL,
- f_id integer,
- ad_id integer
-);
-
-
-
-
---
--- Name: TABLE jnt_fic_att_value; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jnt_fic_att_value IS 'join between the card and the attribut definition';
-
-
---
--- Name: jnt_fic_attr; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jnt_fic_attr (
- fd_id integer,
- ad_id integer
-);
-
-
-
-
---
--- Name: TABLE jnt_fic_attr; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jnt_fic_attr IS 'join between the family card and the attribut definition';
-
-
---
--- Name: jrn; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jrn (
- jr_id integer DEFAULT nextval('s_jrn'::text) NOT NULL,
- jr_def_id integer NOT NULL,
- jr_montant numeric(20,4) NOT NULL,
- jr_comment text,
- jr_date date,
- jr_grpt_id integer NOT NULL,
- jr_internal text,
- jr_tech_date timestamp without time zone DEFAULT now() NOT NULL,
- jr_tech_per integer NOT NULL,
- jrn_ech date,
- jr_ech date,
- jr_rapt text,
- jr_valid boolean DEFAULT true,
- jr_opid integer,
- jr_c_opid integer,
- jr_pj oid,
- jr_pj_name text,
- jr_pj_type text
-);
-
-
-
-
---
--- Name: TABLE jrn; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jrn IS 'Journal: content one line for a group of accountancy writing';
-
-
---
--- Name: jrn_action; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jrn_action (
- ja_id integer DEFAULT nextval('s_jrnaction'::text) NOT NULL,
- ja_name text NOT NULL,
- ja_desc text,
- ja_url text NOT NULL,
- ja_action text NOT NULL,
- ja_lang text DEFAULT 'FR'::text,
- ja_jrn_type character(3)
-);
-
-
-
-
---
--- Name: TABLE jrn_action; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jrn_action IS 'Possible action when we are in journal (menu)';
-
-
---
--- Name: jrn_def; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jrn_def (
- jrn_def_id integer DEFAULT nextval('s_jrn_def'::text) NOT NULL,
- jrn_def_name text NOT NULL,
- jrn_def_class_deb text,
- jrn_def_class_cred text,
- jrn_def_fiche_deb text,
- jrn_def_fiche_cred text,
- jrn_deb_max_line integer DEFAULT 1,
- jrn_cred_max_line integer DEFAULT 1,
- jrn_def_ech boolean DEFAULT false,
- jrn_def_ech_lib text,
- jrn_def_type character(3) NOT NULL,
- jrn_def_code text NOT NULL
-);
-
-
-
-
---
--- Name: TABLE jrn_def; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jrn_def IS 'Definition of a journal, his properties';
-
-
---
--- Name: jrn_rapt; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jrn_rapt (
- jra_id integer DEFAULT nextval('s_jrn_rapt'::text) NOT NULL,
- jr_id integer NOT NULL,
- jra_concerned integer NOT NULL
-);
-
-
-
-
---
--- Name: TABLE jrn_rapt; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jrn_rapt IS 'Rapprochement between operation';
-
-
---
--- Name: jrn_type; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jrn_type (
- jrn_type_id character(3) NOT NULL,
- jrn_desc text
-);
-
-
-
-
---
--- Name: TABLE jrn_type; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jrn_type IS 'Type of journal (Sell, Buy, Financial...)';
-
-
---
--- Name: jrnx; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE jrnx (
- j_id integer DEFAULT nextval('s_jrn_op'::text) NOT NULL,
- j_date date DEFAULT now(),
- j_montant numeric(20,4) DEFAULT 0,
- j_poste poste_comptable NOT NULL,
- j_grpt integer NOT NULL,
- j_rapt text,
- j_jrn_def integer NOT NULL,
- j_debit boolean DEFAULT true,
- j_text text,
- j_centralized boolean DEFAULT false,
- j_internal text,
- j_tech_user text NOT NULL,
- j_tech_date timestamp without time zone DEFAULT now() NOT NULL,
- j_tech_per integer NOT NULL,
- j_qcode text
-);
-
-
-
-
---
--- Name: TABLE jrnx; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE jrnx IS 'Journal: content one line for each accountancy writing';
-
-
---
--- Name: parameter; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE parameter (
- pr_id text NOT NULL,
- pr_value text
-);
-
-
-
-
---
--- Name: parm_code; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE parm_code (
- p_code text NOT NULL,
- p_value text,
- p_comment text
-);
-
-
-
-
---
--- Name: parm_money; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE parm_money (
- pm_id integer DEFAULT nextval('s_currency'::text),
- pm_code character(3) NOT NULL,
- pm_rate numeric(20,4)
-);
-
-
-
-
---
--- Name: TABLE parm_money; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE parm_money IS 'Currency conversion';
-
-
---
--- Name: parm_periode; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE parm_periode (
- p_id integer DEFAULT nextval('s_periode'::text) NOT NULL,
- p_start date NOT NULL,
- p_end date,
- p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
- p_closed boolean DEFAULT false,
- p_central boolean DEFAULT false,
- CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
-);
-
-
-
-
---
--- Name: TABLE parm_periode; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE parm_periode IS 'Periode definition';
-
-
---
--- Name: quant_sold; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE quant_sold (
- qs_id integer DEFAULT nextval('s_quantity'::text) NOT NULL,
- qs_internal text NOT NULL,
- qs_fiche integer NOT NULL,
- qs_quantite integer NOT NULL,
- qs_price numeric(20,4),
- qs_vat numeric(20,4),
- qs_vat_code integer,
- qs_client integer NOT NULL
-);
-
-
-
-
---
--- Name: TABLE quant_sold; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE quant_sold IS 'Contains about invoice for customer';
-
-
---
--- Name: s_attr_def; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_attr_def
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_cbc
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
---
--- Name: s_central; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_central
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_central_order; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_central_order
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_centralized; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_centralized
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_currency; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_currency
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_fdef; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_fdef
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_fiche; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_fiche
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_fiche_def_ref; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_fiche_def_ref
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_form; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_form
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_formdef; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_formdef
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_grpt; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_grpt
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_idef; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_idef
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_internal; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_internal
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_invoice; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_invoice
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_isup; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_isup
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_jnt_fic_att_value; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jnt_fic_att_value
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_jrn; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jrn
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
-
---
--- Name: s_jrn_def; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jrn_def
- START WITH 5
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_jrn_op; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jrn_op
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_jrn_rapt; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jrn_rapt
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_jrnaction; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jrnaction
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_jrnx; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_jrnx
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_periode; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_periode
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_quantity; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_quantity
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_stock_goods; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_stock_goods
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_user_act; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_user_act
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
---
--- Name: s_user_jrn; Type: SEQUENCE; Schema: public; Owner: phpcompta
---
-
-CREATE SEQUENCE s_user_jrn
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-
-
-
-
-
-
---
--- Name: stock_goods; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE stock_goods (
- sg_id integer DEFAULT nextval('s_stock_goods'::text) NOT NULL,
- j_id integer,
- f_id integer NOT NULL,
- sg_code text,
- sg_quantity integer DEFAULT 0,
- sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
- sg_date date,
- sg_tech_date date DEFAULT now(),
- sg_tech_user text,
- CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
-);
-
-
-
-
---
--- Name: TABLE stock_goods; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE stock_goods IS 'About the goods';
-
-
---
--- Name: tmp_pcmn; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE tmp_pcmn (
- pcm_val poste_comptable NOT NULL,
- pcm_lib text,
- pcm_val_parent poste_comptable DEFAULT 0,
- pcm_country character(2) DEFAULT 'BE'::bpchar NOT NULL
-);
-
-
-
-
---
--- Name: TABLE tmp_pcmn; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE tmp_pcmn IS 'Plan comptable minimum normalisé';
-
-
---
--- Name: tva_rate; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE tva_rate (
- tva_id integer NOT NULL,
- tva_label text NOT NULL,
- tva_rate numeric(8,4) DEFAULT 0.0 NOT NULL,
- tva_comment text,
- tva_poste text
-);
-
-
-
-
---
--- Name: TABLE tva_rate; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE tva_rate IS 'Rate of vat';
-
-
---
--- Name: user_local_pref; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE user_local_pref (
- user_id text NOT NULL,
- parameter_type text NOT NULL,
- parameter_value text
-);
-
-
-
-
---
--- Name: TABLE user_local_pref; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON TABLE user_local_pref IS 'The user''s local parameter ';
-
-
---
--- Name: COLUMN user_local_pref.user_id; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON COLUMN user_local_pref.user_id IS 'user''s login ';
-
-
---
--- Name: COLUMN user_local_pref.parameter_type; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON COLUMN user_local_pref.parameter_type IS 'the type of parameter ';
-
-
---
--- Name: COLUMN user_local_pref.parameter_value; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON COLUMN user_local_pref.parameter_value IS 'the value of parameter ';
-
-
---
--- Name: user_sec_act; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE user_sec_act (
- ua_id integer DEFAULT nextval('s_user_act'::text) NOT NULL,
- ua_login text,
- ua_act_id integer
-);
-
-
-
-
---
--- Name: user_sec_jrn; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE user_sec_jrn (
- uj_id integer DEFAULT nextval('s_user_jrn'::text) NOT NULL,
- uj_login text,
- uj_jrn_id integer,
- uj_priv text
-);
-
-
-
-
---
--- Name: version; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE TABLE version (
- val integer
-);
-
-
-
-
---
--- Name: vw_client; Type: VIEW; Schema: public; Owner: phpcompta
---
-
-CREATE VIEW vw_client AS
- SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 9);
-
-
-
-
---
--- Name: vw_fiche_attr; Type: VIEW; Schema: public; Owner: phpcompta
---
-
-CREATE VIEW vw_fiche_attr AS
- SELECT a.f_id, a.fd_id, a.av_text AS vw_name, b.av_text AS vw_sell, c.av_text AS vw_buy, d.av_text AS tva_code, tva_rate.tva_id, tva_rate.tva_rate, tva_rate.tva_label, e.av_text AS vw_addr, f.av_text AS vw_cp, j.av_text AS quick_code, fiche_def.frd_id FROM (((((((((SELECT fiche.f_id, fiche.fd_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 6)) b ON ((a.f_id = b.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 7)) c ON ((a.f_id = c.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 2)) d ON ((a.f_id = d.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 14)) e ON ((a.f_id = e.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 15)) f ON ((a.f_id = f.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 23)) j ON ((a.f_id = j.f_id))) LEFT JOIN tva_rate ON ((d.av_text = (tva_rate.tva_id)::text))) JOIN fiche_def USING (fd_id));
-
-
-
-
---
--- Name: vw_fiche_def; Type: VIEW; Schema: public; Owner: phpcompta
---
-
-CREATE VIEW vw_fiche_def AS
- SELECT jnt_fic_attr.fd_id, jnt_fic_attr.ad_id, attr_def.ad_text, attr_value.av_text, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def.frd_id FROM (((((jnt_fic_att_value JOIN attr_value USING (jft_id)) JOIN fiche USING (f_id)) JOIN jnt_fic_attr USING (fd_id)) JOIN attr_def ON ((attr_def.ad_id = jnt_fic_attr.ad_id))) JOIN fiche_def USING (fd_id));
-
-
-
-
---
--- Name: VIEW vw_fiche_def; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON VIEW vw_fiche_def IS 'all the attributs for card family';
-
-
---
--- Name: vw_fiche_min; Type: VIEW; Schema: public; Owner: phpcompta
---
-
-CREATE VIEW vw_fiche_min AS
- SELECT attr_min.frd_id, attr_min.ad_id, attr_def.ad_text, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base FROM ((attr_min JOIN attr_def USING (ad_id)) JOIN fiche_def_ref USING (frd_id));
-
-
-
-
---
--- Name: VIEW vw_fiche_min; Type: COMMENT; Schema: public; Owner: phpcompta
---
-
-COMMENT ON VIEW vw_fiche_min IS 'minimum attribut for reference card';
-
-
---
--- Name: vw_poste_qcode; Type: VIEW; Schema: public; Owner: phpcompta
---
-
-CREATE VIEW vw_poste_qcode AS
- SELECT a.f_id, a.av_text AS j_poste, b.av_text AS j_qcode FROM ((SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) a JOIN (SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) b USING (f_id));
-
-
-
-
---
--- Name: vw_supplier; Type: VIEW; Schema: public; Owner: phpcompta
---
-
-CREATE VIEW vw_supplier AS
- SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 8);
-
-
-
-
---
--- Name: attr_value_jft_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
-
-
-
-
---
--- Name: fk_stock_goods_f_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
-
-
-
-
---
--- Name: fk_stock_goods_j_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
-
-
-
-
---
--- Name: idx_case; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
-
-
-
-
---
--- Name: idx_qs_internal; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
-
-
-
-
---
--- Name: ix_iv_name; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
-
-
-
-
---
--- Name: k_ag_ref; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
-
-
-
-
---
--- Name: x_jrn_jr_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
-
-
-
-
---
--- Name: x_poste; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
---
-
-CREATE INDEX x_poste ON jrnx USING btree (j_poste);
-
-
CREATE FUNCTION account_add(p_id poste_comptable, p_name character varying) RETURNS void
AS $$
declare
@@ -1390,8 +50,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: account_auto(integer); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1412,8 +70,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: account_compute(integer); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1421,29 +77,32 @@ $$
CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
AS $$
declare
- class_base poste_comptable;
- maxcode int8;
+ class_base poste_comptable;
+ maxcode poste_comptable;
begin
- -- Get the class base
- select fd_class_base into class_base
- from
- fiche_def join fiche using (fd_id)
- where
- f_id=p_f_id;
- raise notice 'class base %',class_base;
- select max(pcm_val) into maxcode from tmp_pcmn where pcm_val = class_base;
- if maxcode = class_base then
- maxcode=class_base*1000+1;
- end if;
- raise notice 'Max code %',maxcode;
-return maxcode+1;
+ select fd_class_base into class_base
+ from
+ fiche_def join fiche using (fd_id)
+ where
+ f_id=p_f_id;
+ raise notice 'account_compute class base %',class_base;
+ select count (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ if maxcode = 0 then
+ maxcode:=class_base;
+ else
+ select max (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ end if;
+ if maxcode = class_base then
+ maxcode:=class_base*1000;
+ end if;
+ maxcode:=maxcode+1;
+ raise notice 'account_compute Max code %',maxcode;
+ return maxcode;
end;
$$
LANGUAGE plpgsql;
-
-
--
-- Name: account_insert(integer, poste_comptable); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1459,51 +118,50 @@ nFd_id integer;
nCount integer;
begin
- -- if p_value empty
if length(trim(p_account)) != 0 then
- -- does the account exist ?
+ raise notice 'p_account is not empty';
select * into nCount from tmp_pcmn where pcm_val=p_account;
if nCount !=0 then
- -- retrieve name
+ raise notice 'this account exists in tmp_pcmn ';
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+ else
+ -- account doesn't exist, create it
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
- -- get parent
+
nParent:=account_parent(p_account);
- -- account doesn't exist we need to add id
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent)
- values (p_account,sName,nParent);
- -- insert as card's attribute
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
end if;
else
+ raise notice 'p_account is empty';
select fd_id into nFd_id from fiche where f_id=p_f_id;
bAuto:= account_auto(nFd_id);
-
if bAuto = true then
- -- create automatically the account
- -- compute the next account
+ raise notice 'account generated automatically';
nNew:=account_compute(p_f_id);
-raise debug 'nNew %', nNew;
- -- retrieve name
+ raise notice 'nNew %', nNew;
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
-
- -- get parent
nParent:=account_parent(nNew);
- -- account doesn't exist we need to add id
perform account_add (nNew,sName);
- -- insert as card's attribute
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
else
- perform attribut_insert(p_f_id,5,null);
+ -- if there is an account_base then it is the default
+ select fd_class_base into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if nNew is null or length(trim(nNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+ end if;
end if;
-
end if;
return 0;
@@ -1512,8 +170,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: account_parent(poste_comptable); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1540,17 +196,14 @@ begin
if length(sParent) <= 0 then
raise exception 'Impossible de trouver le compte parent pour %',p_account;
end if;
-
end loop;
-
+ raise notice 'account_parent : Parent is %',nParent;
return nParent;
end;
$$
LANGUAGE plpgsql;
-
-
--
-- Name: account_update(integer, poste_comptable); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1592,8 +245,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: attribut_insert(integer, integer, character varying); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1605,39 +256,35 @@ declare
begin
select nextval('s_jnt_fic_att_value') into n_jft_id;
insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
- insert into attr_value (jft_id,av_text) values (n_jft_id,p_value);
+ insert into attr_value (jft_id,av_text) values (n_jft_id,trim(p_value));
return;
end;
$$
LANGUAGE plpgsql;
-
-
--
-- Name: card_class_base(integer); Type: FUNCTION; Schema: public; Owner: phpcompta
--
-CREATE FUNCTION card_class_base(p_f_id integer) RETURNS fiche_def.fd_class_base%type
+CREATE FUNCTION card_class_base(p_f_id integer) RETURNS poste_comptable
AS $$
-
declare
n_poste fiche_def.fd_class_base%type;
begin
- select fd_class_base into n_poste from fiche_def join fiche using (fd_id)
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
where f_id=p_f_id;
if not FOUND then
raise exception 'Invalid fiche card_class_base(%)',p_f_id;
end if;
-return nposte;
-end;
+return n_poste;
+end;
$$
LANGUAGE plpgsql;
-
-
--
-- Name: check_balance(integer); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1680,6 +327,66 @@ $$
LANGUAGE plpgsql;
+--
+-- Name: correct_sequence(text, text, text); Type: FUNCTION; Schema: public; Owner: phpcompta
+--
+
+CREATE FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) RETURNS integer
+ AS $$
+declare
+last_sequence int8;
+max_sequence int8;
+n integer;
+begin
+ select count(*) into n from pg_class where relkind='S' and relname=lower(p_sequence);
+ if n = 0 then
+ raise exception ' Unknow sequence % ',p_sequence;
+ end if;
+ select count(*) into n from pg_class where relkind='r' and relname=lower(p_table);
+ if n = 0 then
+ raise exception ' Unknow table % ',p_table;
+ end if;
+
+ execute 'select last_value from '||p_sequence into last_sequence;
+ raise notice 'Last value of the sequence is %', last_sequence;
+
+ execute 'select max('||p_col||') from '||p_table into max_sequence;
+ if max_sequence is null then
+ max_sequence := 0;
+ end if;
+ raise notice 'Max value of the sequence is %', max_sequence;
+ max_sequence:= max_sequence +1;
+ execute 'alter sequence '||p_sequence||' restart with '||max_sequence;
+return 0;
+
+end;
+$$
+ LANGUAGE plpgsql;
+
+
+--
+-- Name: FUNCTION correct_sequence(p_sequence text, p_col text, p_table text); Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) IS ' Often the primary key is a sequence number and sometimes the value of the sequence is not synchronized with the primary key ( p_sequence : sequence name, p_col : col of the pk,p_table : concerned table';
+
+
+--
+-- Name: drop_it(character varying); Type: FUNCTION; Schema: public; Owner: phpcompta
+--
+
+CREATE FUNCTION drop_it(p_constraint character varying) RETURNS void
+ AS $$
+declare
+ nCount integer;
+begin
+ select count(*) into nCount from pg_constraint where conname=p_constraint;
+ if nCount = 1 then
+ execute 'alter table parm_periode drop constraint '||p_constraint ;
+ end if;
+end;
+$$
+ LANGUAGE plpgsql;
--
@@ -1701,8 +408,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: insert_jrnx(character varying, numeric, integer, integer, integer, boolean, text, integer, text); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1763,37 +468,33 @@ $$
LANGUAGE plpgsql;
-
-
--
--- Name: insert_quant_sold(text, character varying, integer, numeric, numeric, integer, character varying); Type: FUNCTION; Schema: public; Owner: phpcompta
+-- Name: insert_quant_sold(text, character varying, numeric, numeric, numeric, integer, character varying); Type: FUNCTION; Schema: public; Owner: phpcompta
--
-CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
+CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
AS $$
-declare
- fid_client integer;
- fid_good integer;
+declare
+ fid_client integer;
+ fid_good integer;
begin
- select f_id into fid_client from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_client;
+ select f_id into fid_client from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
- select f_id into fid_good from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_fiche;
+ select f_id into fid_good from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
- insert into quant_sold
- (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
- values
- (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
- return;
-end;
-$$
+ insert into quant_sold
+ (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
+ values
+ (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
+ return;
+end;
+ $$
LANGUAGE plpgsql;
-
-
--
-- Name: insert_quick_code(integer, text); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1835,8 +536,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: proc_check_balance(); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1860,42 +559,47 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: t_document_type_insert(); Type: FUNCTION; Schema: public; Owner: phpcompta
--
CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id;
+if nCounter = 0 then
execute 'create sequence seq_doc_type_'||NEW.dt_id;
raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
-
-
--
-- Name: t_jrn_def_sequence(); Type: FUNCTION; Schema: public; Owner: phpcompta
--
CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
+
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.jrn_def_id;
+if nCounter = 0 then
execute 'create sequence s_jrn_'||NEW.jrn_def_id;
-raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+ raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
-
-
--
-- Name: trim_cvs_quote(); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1917,8 +621,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: trim_space_format_csv_banque(); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1943,8 +645,6 @@ $$
LANGUAGE plpgsql;
-
-
--
-- Name: tva_delete(integer); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -1966,8 +666,6 @@ $_$
LANGUAGE plpgsql;
-
-
--
-- Name: tva_insert(integer, text, numeric, text, text); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -2010,8 +708,6 @@ $_$
LANGUAGE plpgsql;
-
-
--
-- Name: tva_modify(integer, text, numeric, text, text); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -2049,8 +745,6 @@ $_$
LANGUAGE plpgsql;
-
-
--
-- Name: update_quick_code(integer, text); Type: FUNCTION; Schema: public; Owner: phpcompta
--
@@ -2083,7 +777,7 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
select count(*) into nExist
from jnt_fic_att_value join attr_value using (jft_id)
where
- ad_id=23 and av_text=upper(tText);
+ ad_id=23 and av_text=tText;
if nExist = 0 then
exit;
@@ -2096,6 +790,15 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
end loop;
update attr_value set av_text = tText where jft_id=njft_id;
+
+ -- update also the contact
+ update attr_value set av_text = tText
+ where jft_id in
+ ( select jft_id
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where ad_id=25 and av_text=old_qcode);
+
+
update jrnx set j_qcode=tText where j_qcode = old_qcode;
return ns;
end;
@@ -2103,8 +806,1589 @@ $$
LANGUAGE plpgsql;
+SET default_tablespace = '';
+
+SET default_with_oids = true;
+
+--
+-- Name: action; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE "action" (
+ ac_id integer NOT NULL,
+ ac_description text NOT NULL
+);
+--
+-- Name: TABLE "action"; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE "action" IS 'The different privileges';
+
+
+--
+-- Name: action_gestion; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE action_gestion (
+ ag_id serial NOT NULL,
+ ag_type integer,
+ f_id_dest integer NOT NULL,
+ f_id_exp integer NOT NULL,
+ ag_title character varying(70),
+ ag_timestamp timestamp without time zone DEFAULT now(),
+ ag_cal character(1) DEFAULT 'C'::bpchar,
+ ag_ref_ag_id integer,
+ ag_comment text,
+ ag_ref text
+);
+
+
+--
+-- Name: TABLE action_gestion; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE action_gestion IS 'Action for Managing';
+
+
+--
+-- Name: attr_def; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE attr_def (
+ ad_id integer DEFAULT nextval(('s_attr_def'::text)::regclass) NOT NULL,
+ ad_text text
+);
+
+
+--
+-- Name: TABLE attr_def; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
+
+
+--
+-- Name: attr_min; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE attr_min (
+ frd_id integer,
+ ad_id integer
+);
+
+
+--
+-- Name: TABLE attr_min; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE attr_min IS 'The value of attributs for the cards';
+
+
+--
+-- Name: attr_value; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE attr_value (
+ jft_id integer,
+ av_text text
+);
+
+
+--
+-- Name: centralized; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE centralized (
+ c_id integer DEFAULT nextval(('s_centralized'::text)::regclass) NOT NULL,
+ c_j_id integer,
+ c_date date NOT NULL,
+ c_internal text NOT NULL,
+ c_montant numeric(20,4) NOT NULL,
+ c_debit boolean DEFAULT true,
+ c_jrn_def integer NOT NULL,
+ c_poste poste_comptable,
+ c_description text,
+ c_grp integer NOT NULL,
+ c_comment text,
+ c_rapt text,
+ c_periode integer,
+ c_order integer
+);
+
+
+--
+-- Name: TABLE centralized; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE centralized IS 'The centralized journal';
+
+
+--
+-- Name: document; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE document (
+ d_id serial NOT NULL,
+ ag_id integer NOT NULL,
+ d_lob oid,
+ d_number bigint NOT NULL,
+ d_filename text,
+ d_mimetype text,
+ d_state integer
+);
+
+
+--
+-- Name: TABLE document; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE document IS 'This table contains all the documents : summary and lob files';
+
+
+--
+-- Name: document_modele; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE document_modele (
+ md_id serial NOT NULL,
+ md_name text NOT NULL,
+ md_lob oid,
+ md_type integer NOT NULL,
+ md_filename text,
+ md_mimetype text
+);
+
+
+--
+-- Name: TABLE document_modele; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE document_modele IS ' contains all the template for the documents';
+
+
+--
+-- Name: document_seq; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE document_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: SEQUENCE document_seq; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
+
+
+--
+-- Name: document_state; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE document_state (
+ s_id serial NOT NULL,
+ s_value character varying(50) NOT NULL
+);
+
+
+--
+-- Name: TABLE document_state; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE document_state IS 'State of the document';
+
+
+--
+-- Name: document_type; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE document_type (
+ dt_id serial NOT NULL,
+ dt_value character varying(80)
+);
+
+
+--
+-- Name: TABLE document_type; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE document_type IS 'Type of document : meeting, invoice,...';
+
+
+--
+-- Name: fiche; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE fiche (
+ f_id integer DEFAULT nextval(('s_fiche'::text)::regclass) NOT NULL,
+ fd_id integer
+);
+
+
+--
+-- Name: TABLE fiche; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE fiche IS 'Cards';
+
+
+--
+-- Name: fiche_def; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE fiche_def (
+ fd_id integer DEFAULT nextval(('s_fdef'::text)::regclass) NOT NULL,
+ fd_class_base poste_comptable,
+ fd_label text NOT NULL,
+ fd_create_account boolean DEFAULT false,
+ frd_id integer NOT NULL
+);
+
+
+--
+-- Name: TABLE fiche_def; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE fiche_def IS 'Cards definition';
+
+
+--
+-- Name: fiche_def_ref; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE fiche_def_ref (
+ frd_id integer DEFAULT nextval(('s_fiche_def_ref'::text)::regclass) NOT NULL,
+ frd_text text,
+ frd_class_base integer
+);
+
+
+--
+-- Name: TABLE fiche_def_ref; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
+
+
+--
+-- Name: form; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE form (
+ fo_id integer DEFAULT nextval(('s_form'::text)::regclass) NOT NULL,
+ fo_fr_id integer,
+ fo_pos integer,
+ fo_label text,
+ fo_formula text
+);
+
+
+--
+-- Name: TABLE form; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE form IS 'Forms content';
+
+
+--
+-- Name: format_csv_banque; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE format_csv_banque (
+ name text NOT NULL,
+ include_file text NOT NULL
+);
+
+
+--
+-- Name: formdef; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE formdef (
+ fr_id integer DEFAULT nextval(('s_formdef'::text)::regclass) NOT NULL,
+ fr_label text
+);
+
+
+--
+-- Name: import_tmp; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE import_tmp (
+ code text,
+ date_exec date,
+ date_valeur date,
+ montant text,
+ devise text,
+ compte_ordre text,
+ detail text,
+ num_compte text,
+ poste_comptable text,
+ status character varying(1) DEFAULT 'n'::character varying NOT NULL,
+ bq_account integer NOT NULL,
+ jrn integer NOT NULL,
+ jr_rapt text,
+ CONSTRAINT import_tmp_status_check CHECK ((((((status)::text = 'n'::text) OR ((status)::text = 't'::text)) OR ((status)::text = 'd'::text)) OR ((status)::text = 'w'::text)))
+);
+
+
+--
+-- Name: invoice; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE invoice (
+ iv_id integer DEFAULT nextval(('s_invoice'::text)::regclass) NOT NULL,
+ iv_name text NOT NULL,
+ iv_file oid
+);
+
+
+--
+-- Name: jnt_fic_att_value; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jnt_fic_att_value (
+ jft_id integer DEFAULT nextval(('s_jnt_fic_att_value'::text)::regclass) NOT NULL,
+ f_id integer,
+ ad_id integer
+);
+
+
+--
+-- Name: TABLE jnt_fic_att_value; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jnt_fic_att_value IS 'join between the card and the attribut definition';
+
+
+--
+-- Name: s_jnt_id; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jnt_id
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: jnt_fic_attr; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jnt_fic_attr (
+ fd_id integer,
+ ad_id integer,
+ jnt_id bigint DEFAULT nextval('s_jnt_id'::regclass) NOT NULL
+);
+
+
+--
+-- Name: TABLE jnt_fic_attr; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jnt_fic_attr IS 'join between the family card and the attribut definition';
+
+
+--
+-- Name: jrn; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jrn (
+ jr_id integer DEFAULT nextval(('s_jrn'::text)::regclass) NOT NULL,
+ jr_def_id integer NOT NULL,
+ jr_montant numeric(20,4) NOT NULL,
+ jr_comment text,
+ jr_date date,
+ jr_grpt_id integer NOT NULL,
+ jr_internal text,
+ jr_tech_date timestamp without time zone DEFAULT now() NOT NULL,
+ jr_tech_per integer NOT NULL,
+ jrn_ech date,
+ jr_ech date,
+ jr_rapt text,
+ jr_valid boolean DEFAULT true,
+ jr_opid integer,
+ jr_c_opid integer,
+ jr_pj oid,
+ jr_pj_name text,
+ jr_pj_type text
+);
+
+
+--
+-- Name: TABLE jrn; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jrn IS 'Journal: content one line for a group of accountancy writing';
+
+
+--
+-- Name: jrn_action; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jrn_action (
+ ja_id integer DEFAULT nextval(('s_jrnaction'::text)::regclass) NOT NULL,
+ ja_name text NOT NULL,
+ ja_desc text,
+ ja_url text NOT NULL,
+ ja_action text NOT NULL,
+ ja_lang text DEFAULT 'FR'::text,
+ ja_jrn_type character(3)
+);
+
+
+--
+-- Name: TABLE jrn_action; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jrn_action IS 'Possible action when we are in journal (menu)';
+
+
+--
+-- Name: jrn_def; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jrn_def (
+ jrn_def_id integer DEFAULT nextval(('s_jrn_def'::text)::regclass) NOT NULL,
+ jrn_def_name text NOT NULL,
+ jrn_def_class_deb text,
+ jrn_def_class_cred text,
+ jrn_def_fiche_deb text,
+ jrn_def_fiche_cred text,
+ jrn_deb_max_line integer DEFAULT 1,
+ jrn_cred_max_line integer DEFAULT 1,
+ jrn_def_ech boolean DEFAULT false,
+ jrn_def_ech_lib text,
+ jrn_def_type character(3) NOT NULL,
+ jrn_def_code text NOT NULL
+);
+
+
+--
+-- Name: TABLE jrn_def; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jrn_def IS 'Definition of a journal, his properties';
+
+
+--
+-- Name: jrn_rapt; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jrn_rapt (
+ jra_id integer DEFAULT nextval(('s_jrn_rapt'::text)::regclass) NOT NULL,
+ jr_id integer NOT NULL,
+ jra_concerned integer NOT NULL
+);
+
+
+--
+-- Name: TABLE jrn_rapt; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jrn_rapt IS 'Rapprochement between operation';
+
+
+--
+-- Name: jrn_type; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jrn_type (
+ jrn_type_id character(3) NOT NULL,
+ jrn_desc text
+);
+
+
+--
+-- Name: TABLE jrn_type; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jrn_type IS 'Type of journal (Sell, Buy, Financial...)';
+
+
+--
+-- Name: jrnx; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE jrnx (
+ j_id integer DEFAULT nextval(('s_jrn_op'::text)::regclass) NOT NULL,
+ j_date date DEFAULT now(),
+ j_montant numeric(20,4) DEFAULT 0,
+ j_poste poste_comptable NOT NULL,
+ j_grpt integer NOT NULL,
+ j_rapt text,
+ j_jrn_def integer NOT NULL,
+ j_debit boolean DEFAULT true,
+ j_text text,
+ j_centralized boolean DEFAULT false,
+ j_internal text,
+ j_tech_user text NOT NULL,
+ j_tech_date timestamp without time zone DEFAULT now() NOT NULL,
+ j_tech_per integer NOT NULL,
+ j_qcode text
+);
+
+
+--
+-- Name: TABLE jrnx; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE jrnx IS 'Journal: content one line for each accountancy writing';
+
+
+--
+-- Name: parameter; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE parameter (
+ pr_id text NOT NULL,
+ pr_value text
+);
+
+
+--
+-- Name: parm_code; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE parm_code (
+ p_code text NOT NULL,
+ p_value text,
+ p_comment text
+);
+
+
+--
+-- Name: parm_money; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE parm_money (
+ pm_id integer DEFAULT nextval(('s_currency'::text)::regclass),
+ pm_code character(3) NOT NULL,
+ pm_rate numeric(20,4)
+);
+
+
+--
+-- Name: TABLE parm_money; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE parm_money IS 'Currency conversion';
+
+
+--
+-- Name: parm_periode; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE parm_periode (
+ p_id integer DEFAULT nextval(('s_periode'::text)::regclass) NOT NULL,
+ p_start date NOT NULL,
+ p_end date NOT NULL,
+ p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
+ p_closed boolean DEFAULT false,
+ p_central boolean DEFAULT false,
+ CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
+);
+
+
+--
+-- Name: TABLE parm_periode; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE parm_periode IS 'Periode definition';
+
+
+--
+-- Name: quant_sold; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE quant_sold (
+ qs_id integer DEFAULT nextval(('s_quantity'::text)::regclass) NOT NULL,
+ qs_internal text NOT NULL,
+ qs_fiche integer NOT NULL,
+ qs_quantite numeric(20,4) NOT NULL,
+ qs_price numeric(20,4),
+ qs_vat numeric(20,4),
+ qs_vat_code integer,
+ qs_client integer NOT NULL
+);
+
+
+--
+-- Name: TABLE quant_sold; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE quant_sold IS 'Contains about invoice for customer';
+
+
+--
+-- Name: s_attr_def; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_attr_def
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_cbc; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_cbc
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_central; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_central
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_central_order; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_central_order
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_centralized; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_centralized
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_currency; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_currency
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_fdef; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_fdef
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_fiche; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_fiche
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_fiche_def_ref; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_fiche_def_ref
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_form; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_form
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_formdef; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_formdef
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_grpt; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_grpt
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_idef; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_idef
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_internal; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_internal
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_invoice; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_invoice
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_isup; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_isup
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jnt_fic_att_value; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jnt_fic_att_value
+ START WITH 366
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_1; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_2; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_3; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_4; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_4
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_def; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_def
+ START WITH 5
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_op; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_op
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrn_rapt; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrn_rapt
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrnaction; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrnaction
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_jrnx; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_jrnx
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_periode; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_periode
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_quantity; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_quantity
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_stock_goods; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_stock_goods
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_user_act; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_user_act
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: s_user_jrn; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE s_user_jrn
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_1; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_2; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_3; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_4; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_4
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_5; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_5
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_6; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_6
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_7; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_7
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_8; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_8
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: seq_doc_type_9; Type: SEQUENCE; Schema: public; Owner: phpcompta
+--
+
+CREATE SEQUENCE seq_doc_type_9
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+--
+-- Name: stock_goods; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE stock_goods (
+ sg_id integer DEFAULT nextval(('s_stock_goods'::text)::regclass) NOT NULL,
+ j_id integer,
+ f_id integer NOT NULL,
+ sg_code text,
+ sg_quantity numeric(8,4) DEFAULT 0,
+ sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
+ sg_date date,
+ sg_tech_date date DEFAULT now(),
+ sg_tech_user text,
+ sg_comment character varying(80),
+ sg_exercice character varying(4),
+ CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
+);
+
+
+--
+-- Name: TABLE stock_goods; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE stock_goods IS 'About the goods';
+
+
+--
+-- Name: tmp_pcmn; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE tmp_pcmn (
+ pcm_val poste_comptable NOT NULL,
+ pcm_lib text,
+ pcm_val_parent poste_comptable DEFAULT 0,
+ pcm_country character(2) DEFAULT 'BE'::bpchar NOT NULL
+);
+
+
+--
+-- Name: TABLE tmp_pcmn; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE tmp_pcmn IS 'Plan comptable minimum normalisé';
+
+
+--
+-- Name: tva_rate; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE tva_rate (
+ tva_id integer NOT NULL,
+ tva_label text NOT NULL,
+ tva_rate numeric(8,4) DEFAULT 0.0 NOT NULL,
+ tva_comment text,
+ tva_poste text
+);
+
+
+--
+-- Name: TABLE tva_rate; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE tva_rate IS 'Rate of vat';
+
+
+--
+-- Name: user_local_pref; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE user_local_pref (
+ user_id text NOT NULL,
+ parameter_type text NOT NULL,
+ parameter_value text
+);
+
+
+--
+-- Name: TABLE user_local_pref; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON TABLE user_local_pref IS 'The user''s local parameter ';
+
+
+--
+-- Name: COLUMN user_local_pref.user_id; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON COLUMN user_local_pref.user_id IS 'user''s login ';
+
+
+--
+-- Name: COLUMN user_local_pref.parameter_type; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON COLUMN user_local_pref.parameter_type IS 'the type of parameter ';
+
+
+--
+-- Name: COLUMN user_local_pref.parameter_value; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON COLUMN user_local_pref.parameter_value IS 'the value of parameter ';
+
+
+--
+-- Name: user_sec_act; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE user_sec_act (
+ ua_id integer DEFAULT nextval(('s_user_act'::text)::regclass) NOT NULL,
+ ua_login text,
+ ua_act_id integer
+);
+
+
+--
+-- Name: user_sec_jrn; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE user_sec_jrn (
+ uj_id integer DEFAULT nextval(('s_user_jrn'::text)::regclass) NOT NULL,
+ uj_login text,
+ uj_jrn_id integer,
+ uj_priv text
+);
+
+
+--
+-- Name: version; Type: TABLE; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE TABLE version (
+ val integer
+);
+
+
+--
+-- Name: vw_client; Type: VIEW; Schema: public; Owner: phpcompta
+--
+
+CREATE VIEW vw_client AS
+ SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 9);
+
+
+--
+-- Name: vw_fiche_attr; Type: VIEW; Schema: public; Owner: phpcompta
+--
+
+CREATE VIEW vw_fiche_attr AS
+ SELECT a.f_id, a.fd_id, a.av_text AS vw_name, b.av_text AS vw_sell, c.av_text AS vw_buy, d.av_text AS tva_code, tva_rate.tva_id, tva_rate.tva_rate, tva_rate.tva_label, e.av_text AS vw_addr, f.av_text AS vw_cp, j.av_text AS quick_code, fiche_def.frd_id FROM (((((((((SELECT fiche.f_id, fiche.fd_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 6)) b ON ((a.f_id = b.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 7)) c ON ((a.f_id = c.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 2)) d ON ((a.f_id = d.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 14)) e ON ((a.f_id = e.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 15)) f ON ((a.f_id = f.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 23)) j ON ((a.f_id = j.f_id))) LEFT JOIN tva_rate ON ((d.av_text = (tva_rate.tva_id)::text))) JOIN fiche_def USING (fd_id));
+
+
+--
+-- Name: vw_fiche_def; Type: VIEW; Schema: public; Owner: phpcompta
+--
+
+CREATE VIEW vw_fiche_def AS
+ SELECT jnt_fic_attr.fd_id, jnt_fic_attr.ad_id, attr_def.ad_text, attr_value.av_text, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def.frd_id FROM (((((jnt_fic_att_value JOIN attr_value USING (jft_id)) JOIN fiche USING (f_id)) JOIN jnt_fic_attr USING (fd_id)) JOIN attr_def ON ((attr_def.ad_id = jnt_fic_attr.ad_id))) JOIN fiche_def USING (fd_id));
+
+
+--
+-- Name: VIEW vw_fiche_def; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON VIEW vw_fiche_def IS 'all the attributs for card family';
+
+
+--
+-- Name: vw_fiche_min; Type: VIEW; Schema: public; Owner: phpcompta
+--
+
+CREATE VIEW vw_fiche_min AS
+ SELECT attr_min.frd_id, attr_min.ad_id, attr_def.ad_text, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base FROM ((attr_min JOIN attr_def USING (ad_id)) JOIN fiche_def_ref USING (frd_id));
+
+
+--
+-- Name: VIEW vw_fiche_min; Type: COMMENT; Schema: public; Owner: phpcompta
+--
+
+COMMENT ON VIEW vw_fiche_min IS 'minimum attribut for reference card';
+
+
+--
+-- Name: vw_poste_qcode; Type: VIEW; Schema: public; Owner: phpcompta
+--
+
+CREATE VIEW vw_poste_qcode AS
+ SELECT a.f_id, a.av_text AS j_poste, b.av_text AS j_qcode FROM ((SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) a JOIN (SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) b USING (f_id));
+
+
+--
+-- Name: vw_supplier; Type: VIEW; Schema: public; Owner: phpcompta
+--
+
+CREATE VIEW vw_supplier AS
+ SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 8);
+
+
+--
+-- Name: action_gestion_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: action_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: attr_def_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: centralized_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: document_modele_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: document_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: document_state_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: document_type_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: fiche_def_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: fiche_def_ref_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: fiche_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: form_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: format_csv_banque_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: formdef_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: invoice_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jnt_fic_att_value_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrn_action_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrn_def_jrn_def_name_key; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrn_def_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrn_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrn_rapt_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrn_type_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: jrnx_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: parameter_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: parm_code_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: parm_money_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: parm_periode_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: pk_jnt_fic_attr; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: pk_user_local_pref; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: qs_id_pk; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: stock_goods_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: tmp_pcmn_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: user_sec_act_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: user_sec_jrn_pkey; Type: CONSTRAINT; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+
+
+--
+-- Name: attr_value_jft_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
+
+
+--
+-- Name: fd_id_ad_id_x; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX fd_id_ad_id_x ON jnt_fic_attr USING btree (fd_id, ad_id);
+
+
+--
+-- Name: fk_stock_goods_f_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
+
+
+--
+-- Name: fk_stock_goods_j_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
+
+
+--
+-- Name: idx_case; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
+
+
+--
+-- Name: idx_qs_internal; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
+
+
+--
+-- Name: ix_iv_name; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
+
+
+--
+-- Name: k_ag_ref; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
+
+
+--
+-- Name: x_jrn_jr_id; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
+
+
+--
+-- Name: x_periode; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE UNIQUE INDEX x_periode ON parm_periode USING btree (p_start, p_end);
+
+
+--
+-- Name: x_poste; Type: INDEX; Schema: public; Owner: phpcompta; Tablespace:
+--
+
+CREATE INDEX x_poste ON jrnx USING btree (j_poste);
--
@@ -2156,3 +2440,138 @@ CREATE TRIGGER trim_space
FOR EACH ROW
EXECUTE PROCEDURE trim_space_format_csv_banque();
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: md_type; Type: FK CONSTRAINT; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/html/admin/sql/mod1/sequence.sql b/html/admin/sql/mod1/sequence.sql
index b2964dcdd..510425d18 100644
--- a/html/admin/sql/mod1/sequence.sql
+++ b/html/admin/sql/mod1/sequence.sql
@@ -7,12 +7,25 @@ CREATE SEQUENCE document_seq
CACHE 1;
-- Name: SEQUENCE document_seq; Type: COMMENT; Schema: public; Owner: phpcompta
COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
+-- Name: s_jnt_id; Type: SEQUENCE; Schema: public; Owner: phpcompta
+CREATE SEQUENCE s_jnt_id
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
-- Name: s_attr_def; Type: SEQUENCE; Schema: public; Owner: phpcompta
CREATE SEQUENCE s_attr_def
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
+-- Name: s_cbc; Type: SEQUENCE; Schema: public; Owner: phpcompta
+CREATE SEQUENCE s_cbc
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
-- Name: s_central; Type: SEQUENCE; Schema: public; Owner: phpcompta
CREATE SEQUENCE s_central
START WITH 1
@@ -108,6 +121,7 @@ CREATE SEQUENCE s_isup
CACHE 1;
-- Name: s_jnt_fic_att_value; Type: SEQUENCE; Schema: public; Owner: phpcompta
CREATE SEQUENCE s_jnt_fic_att_value
+ START WITH 366
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
diff --git a/html/admin/sql/mod1/table.sql b/html/admin/sql/mod1/table.sql
index 1280ee1af..51e4f7c87 100644
--- a/html/admin/sql/mod1/table.sql
+++ b/html/admin/sql/mod1/table.sql
@@ -1,3 +1,4 @@
+CREATE DOMAIN poste_comptable AS numeric(25,0);
CREATE TABLE "action" (
ac_id integer NOT NULL,
ac_description text NOT NULL
@@ -15,7 +16,7 @@ CREATE TABLE action_gestion (
ag_ref text
);
CREATE TABLE attr_def (
- ad_id integer DEFAULT nextval('s_attr_def'::text) NOT NULL,
+ ad_id integer DEFAULT nextval(('s_attr_def'::text)::regclass) NOT NULL,
ad_text text
);
CREATE TABLE attr_min (
@@ -27,7 +28,7 @@ CREATE TABLE attr_value (
av_text text
);
CREATE TABLE centralized (
- c_id integer DEFAULT nextval('s_centralized'::text) NOT NULL,
+ c_id integer DEFAULT nextval(('s_centralized'::text)::regclass) NOT NULL,
c_j_id integer,
c_date date NOT NULL,
c_internal text NOT NULL,
@@ -68,23 +69,23 @@ CREATE TABLE document_type (
dt_value character varying(80)
);
CREATE TABLE fiche (
- f_id integer DEFAULT nextval('s_fiche'::text) NOT NULL,
+ f_id integer DEFAULT nextval(('s_fiche'::text)::regclass) NOT NULL,
fd_id integer
);
CREATE TABLE fiche_def (
- fd_id integer DEFAULT nextval('s_fdef'::text) NOT NULL,
+ fd_id integer DEFAULT nextval(('s_fdef'::text)::regclass) NOT NULL,
fd_class_base poste_comptable,
fd_label text NOT NULL,
fd_create_account boolean DEFAULT false,
frd_id integer NOT NULL
);
CREATE TABLE fiche_def_ref (
- frd_id integer DEFAULT nextval('s_fiche_def_ref'::text) NOT NULL,
+ frd_id integer DEFAULT nextval(('s_fiche_def_ref'::text)::regclass) NOT NULL,
frd_text text,
frd_class_base integer
);
CREATE TABLE form (
- fo_id integer DEFAULT nextval('s_form'::text) NOT NULL,
+ fo_id integer DEFAULT nextval(('s_form'::text)::regclass) NOT NULL,
fo_fr_id integer,
fo_pos integer,
fo_label text,
@@ -95,7 +96,7 @@ CREATE TABLE format_csv_banque (
include_file text NOT NULL
);
CREATE TABLE formdef (
- fr_id integer DEFAULT nextval('s_formdef'::text) NOT NULL,
+ fr_id integer DEFAULT nextval(('s_formdef'::text)::regclass) NOT NULL,
fr_label text
);
CREATE TABLE import_tmp (
@@ -108,26 +109,29 @@ CREATE TABLE import_tmp (
detail text,
num_compte text,
poste_comptable text,
- ok boolean DEFAULT false,
+ status character varying(1) DEFAULT 'n'::character varying NOT NULL,
bq_account integer NOT NULL,
- jrn integer NOT NULL
+ jrn integer NOT NULL,
+ jr_rapt text,
+ CONSTRAINT import_tmp_status_check CHECK ((((((status)::text = 'n'::text) OR ((status)::text = 't'::text)) OR ((status)::text = 'd'::text)) OR ((status)::text = 'w'::text)))
);
CREATE TABLE invoice (
- iv_id integer DEFAULT nextval('s_invoice'::text) NOT NULL,
+ iv_id integer DEFAULT nextval(('s_invoice'::text)::regclass) NOT NULL,
iv_name text NOT NULL,
iv_file oid
);
CREATE TABLE jnt_fic_att_value (
- jft_id integer DEFAULT nextval('s_jnt_fic_att_value'::text) NOT NULL,
+ jft_id integer DEFAULT nextval(('s_jnt_fic_att_value'::text)::regclass) NOT NULL,
f_id integer,
ad_id integer
);
CREATE TABLE jnt_fic_attr (
fd_id integer,
- ad_id integer
+ ad_id integer,
+ jnt_id bigint DEFAULT nextval('s_jnt_id'::regclass) NOT NULL
);
CREATE TABLE jrn (
- jr_id integer DEFAULT nextval('s_jrn'::text) NOT NULL,
+ jr_id integer DEFAULT nextval(('s_jrn'::text)::regclass) NOT NULL,
jr_def_id integer NOT NULL,
jr_montant numeric(20,4) NOT NULL,
jr_comment text,
@@ -147,7 +151,7 @@ CREATE TABLE jrn (
jr_pj_type text
);
CREATE TABLE jrn_action (
- ja_id integer DEFAULT nextval('s_jrnaction'::text) NOT NULL,
+ ja_id integer DEFAULT nextval(('s_jrnaction'::text)::regclass) NOT NULL,
ja_name text NOT NULL,
ja_desc text,
ja_url text NOT NULL,
@@ -156,7 +160,7 @@ CREATE TABLE jrn_action (
ja_jrn_type character(3)
);
CREATE TABLE jrn_def (
- jrn_def_id integer DEFAULT nextval('s_jrn_def'::text) NOT NULL,
+ jrn_def_id integer DEFAULT nextval(('s_jrn_def'::text)::regclass) NOT NULL,
jrn_def_name text NOT NULL,
jrn_def_class_deb text,
jrn_def_class_cred text,
@@ -170,7 +174,7 @@ CREATE TABLE jrn_def (
jrn_def_code text NOT NULL
);
CREATE TABLE jrn_rapt (
- jra_id integer DEFAULT nextval('s_jrn_rapt'::text) NOT NULL,
+ jra_id integer DEFAULT nextval(('s_jrn_rapt'::text)::regclass) NOT NULL,
jr_id integer NOT NULL,
jra_concerned integer NOT NULL
);
@@ -179,7 +183,7 @@ CREATE TABLE jrn_type (
jrn_desc text
);
CREATE TABLE jrnx (
- j_id integer DEFAULT nextval('s_jrn_op'::text) NOT NULL,
+ j_id integer DEFAULT nextval(('s_jrn_op'::text)::regclass) NOT NULL,
j_date date DEFAULT now(),
j_montant numeric(20,4) DEFAULT 0,
j_poste poste_comptable NOT NULL,
@@ -205,39 +209,41 @@ CREATE TABLE parm_code (
p_comment text
);
CREATE TABLE parm_money (
- pm_id integer DEFAULT nextval('s_currency'::text),
+ pm_id integer DEFAULT nextval(('s_currency'::text)::regclass),
pm_code character(3) NOT NULL,
pm_rate numeric(20,4)
);
CREATE TABLE parm_periode (
- p_id integer DEFAULT nextval('s_periode'::text) NOT NULL,
+ p_id integer DEFAULT nextval(('s_periode'::text)::regclass) NOT NULL,
p_start date NOT NULL,
- p_end date,
+ p_end date NOT NULL,
p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
p_closed boolean DEFAULT false,
p_central boolean DEFAULT false,
CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
);
CREATE TABLE quant_sold (
- qs_id integer DEFAULT nextval('s_quantity'::text) NOT NULL,
+ qs_id integer DEFAULT nextval(('s_quantity'::text)::regclass) NOT NULL,
qs_internal text NOT NULL,
qs_fiche integer NOT NULL,
- qs_quantite integer NOT NULL,
+ qs_quantite numeric(20,4) NOT NULL,
qs_price numeric(20,4),
qs_vat numeric(20,4),
qs_vat_code integer,
qs_client integer NOT NULL
);
CREATE TABLE stock_goods (
- sg_id integer DEFAULT nextval('s_stock_goods'::text) NOT NULL,
+ sg_id integer DEFAULT nextval(('s_stock_goods'::text)::regclass) NOT NULL,
j_id integer,
f_id integer NOT NULL,
sg_code text,
- sg_quantity integer DEFAULT 0,
+ sg_quantity numeric(8,4) DEFAULT 0,
sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
sg_date date,
sg_tech_date date DEFAULT now(),
sg_tech_user text,
+ sg_comment character varying(80),
+ sg_exercice character varying(4),
CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
);
CREATE TABLE tmp_pcmn (
@@ -259,12 +265,12 @@ CREATE TABLE user_local_pref (
parameter_value text
);
CREATE TABLE user_sec_act (
- ua_id integer DEFAULT nextval('s_user_act'::text) NOT NULL,
+ ua_id integer DEFAULT nextval(('s_user_act'::text)::regclass) NOT NULL,
ua_login text,
ua_act_id integer
);
CREATE TABLE user_sec_jrn (
- uj_id integer DEFAULT nextval('s_user_jrn'::text) NOT NULL,
+ uj_id integer DEFAULT nextval(('s_user_jrn'::text)::regclass) NOT NULL,
uj_login text,
uj_jrn_id integer,
uj_priv text
diff --git a/html/admin/sql/mod2/comment.sql b/html/admin/sql/mod2/comment.sql
index 1e6c54aad..5078e0a98 100644
--- a/html/admin/sql/mod2/comment.sql
+++ b/html/admin/sql/mod2/comment.sql
@@ -1,8 +1,10 @@
COMMENT ON SCHEMA public IS 'Standard public schema';
-COMMENT ON TABLE "action" IS 'The different privileges';
-COMMENT ON TABLE action_gestion IS 'Action for Managing';
+COMMENT ON FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) IS ' Often the primary key is a sequence number and sometimes the value of the sequence is not synchronized with the primary key ( p_sequence : sequence name, p_col : col of the pk,p_table : concerned table';
COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
COMMENT ON TABLE attr_min IS 'The value of attributs for the cards';
+COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
+COMMENT ON TABLE "action" IS 'The different privileges';
+COMMENT ON TABLE action_gestion IS 'Action for Managing';
COMMENT ON TABLE centralized IS 'The centralized journal';
COMMENT ON TABLE document IS 'This table contains all the documents : summary and lob files';
COMMENT ON TABLE document_modele IS ' contains all the template for the documents';
@@ -11,7 +13,6 @@ COMMENT ON TABLE document_state IS 'State of the document';
COMMENT ON TABLE document_type IS 'Type of document : meeting, invoice,...';
COMMENT ON TABLE fiche IS 'Cards';
COMMENT ON TABLE fiche_def IS 'Cards definition';
-COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
COMMENT ON TABLE form IS 'Forms content';
COMMENT ON TABLE jnt_fic_att_value IS 'join between the card and the attribut definition';
COMMENT ON TABLE jnt_fic_attr IS 'join between the family card and the attribut definition';
diff --git a/html/admin/sql/mod2/constraint.sql b/html/admin/sql/mod2/constraint.sql
index c2b88c172..84824753d 100644
--- a/html/admin/sql/mod2/constraint.sql
+++ b/html/admin/sql/mod2/constraint.sql
@@ -1,88 +1,7 @@
-ALTER TABLE public."action" OWNER TO phpcompta;
-ALTER TABLE public.action_gestion OWNER TO phpcompta;
-ALTER TABLE public.attr_def OWNER TO phpcompta;
-ALTER TABLE public.attr_min OWNER TO phpcompta;
-ALTER TABLE public.attr_value OWNER TO phpcompta;
-ALTER TABLE public.centralized OWNER TO phpcompta;
-ALTER TABLE public.document OWNER TO phpcompta;
-ALTER TABLE public.document_modele OWNER TO phpcompta;
-ALTER TABLE public.document_seq OWNER TO phpcompta;
-ALTER TABLE public.document_state OWNER TO phpcompta;
-ALTER TABLE public.document_type OWNER TO phpcompta;
-ALTER TABLE public.fiche OWNER TO phpcompta;
-ALTER TABLE public.fiche_def OWNER TO phpcompta;
-ALTER TABLE public.fiche_def_ref OWNER TO phpcompta;
-ALTER TABLE public.form OWNER TO phpcompta;
-ALTER TABLE public.format_csv_banque OWNER TO phpcompta;
-ALTER TABLE public.formdef OWNER TO phpcompta;
-ALTER TABLE public.import_tmp OWNER TO phpcompta;
-ALTER TABLE public.invoice OWNER TO phpcompta;
-ALTER TABLE public.jnt_fic_att_value OWNER TO phpcompta;
-ALTER TABLE public.jnt_fic_attr OWNER TO phpcompta;
-ALTER TABLE public.jrn OWNER TO phpcompta;
-ALTER TABLE public.jrn_action OWNER TO phpcompta;
-ALTER TABLE public.jrn_def OWNER TO phpcompta;
-ALTER TABLE public.jrn_rapt OWNER TO phpcompta;
-ALTER TABLE public.jrn_type OWNER TO phpcompta;
-ALTER TABLE public.jrnx OWNER TO phpcompta;
-ALTER TABLE public.parameter OWNER TO phpcompta;
-ALTER TABLE public.parm_code OWNER TO phpcompta;
-ALTER TABLE public.parm_money OWNER TO phpcompta;
-ALTER TABLE public.parm_periode OWNER TO phpcompta;
-ALTER TABLE public.quant_sold OWNER TO phpcompta;
-ALTER TABLE public.s_attr_def OWNER TO phpcompta;
-ALTER TABLE public.s_central OWNER TO phpcompta;
-ALTER TABLE public.s_central_order OWNER TO phpcompta;
-ALTER TABLE public.s_centralized OWNER TO phpcompta;
-ALTER TABLE public.s_currency OWNER TO phpcompta;
-ALTER TABLE public.s_fdef OWNER TO phpcompta;
-ALTER TABLE public.s_fiche OWNER TO phpcompta;
-ALTER TABLE public.s_fiche_def_ref OWNER TO phpcompta;
-ALTER TABLE public.s_form OWNER TO phpcompta;
-ALTER TABLE public.s_formdef OWNER TO phpcompta;
-ALTER TABLE public.s_grpt OWNER TO phpcompta;
-ALTER TABLE public.s_idef OWNER TO phpcompta;
-ALTER TABLE public.s_internal OWNER TO phpcompta;
-ALTER TABLE public.s_invoice OWNER TO phpcompta;
-ALTER TABLE public.s_isup OWNER TO phpcompta;
-ALTER TABLE public.s_jnt_fic_att_value OWNER TO phpcompta;
-ALTER TABLE public.s_jrn OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_1 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_2 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_3 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_4 OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_def OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_op OWNER TO phpcompta;
-ALTER TABLE public.s_jrn_rapt OWNER TO phpcompta;
-ALTER TABLE public.s_jrnaction OWNER TO phpcompta;
-ALTER TABLE public.s_jrnx OWNER TO phpcompta;
-ALTER TABLE public.s_periode OWNER TO phpcompta;
-ALTER TABLE public.s_quantity OWNER TO phpcompta;
-ALTER TABLE public.s_stock_goods OWNER TO phpcompta;
-ALTER TABLE public.s_user_act OWNER TO phpcompta;
-ALTER TABLE public.s_user_jrn OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_1 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_2 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_3 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_4 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_5 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_6 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_7 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_8 OWNER TO phpcompta;
-ALTER TABLE public.seq_doc_type_9 OWNER TO phpcompta;
-ALTER TABLE public.stock_goods OWNER TO phpcompta;
-ALTER TABLE public.tmp_pcmn OWNER TO phpcompta;
-ALTER TABLE public.tva_rate OWNER TO phpcompta;
-ALTER TABLE public.user_local_pref OWNER TO phpcompta;
-ALTER TABLE public.user_sec_act OWNER TO phpcompta;
-ALTER TABLE public.user_sec_jrn OWNER TO phpcompta;
-ALTER TABLE public.version OWNER TO phpcompta;
-ALTER TABLE public.vw_client OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_attr OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_def OWNER TO phpcompta;
-ALTER TABLE public.vw_fiche_min OWNER TO phpcompta;
-ALTER TABLE public.vw_poste_qcode OWNER TO phpcompta;
-ALTER TABLE public.vw_supplier OWNER TO phpcompta;
+ SET client_encoding = 'LATIN1';
+ SET check_function_bodies = false;
+ SET client_min_messages = warning;
+SET search_path = public, pg_catalog;
ALTER TABLE ONLY action_gestion
ADD CONSTRAINT action_gestion_pkey PRIMARY KEY (ag_id);
ALTER TABLE ONLY "action"
@@ -135,10 +54,10 @@ ALTER TABLE ONLY parm_code
ADD CONSTRAINT parm_code_pkey PRIMARY KEY (p_code);
ALTER TABLE ONLY parm_money
ADD CONSTRAINT parm_money_pkey PRIMARY KEY (pm_code);
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_p_start_key UNIQUE (p_start);
ALTER TABLE ONLY parm_periode
ADD CONSTRAINT parm_periode_pkey PRIMARY KEY (p_id);
+ALTER TABLE ONLY jnt_fic_attr
+ ADD CONSTRAINT pk_jnt_fic_attr PRIMARY KEY (jnt_id);
ALTER TABLE ONLY user_local_pref
ADD CONSTRAINT pk_user_local_pref PRIMARY KEY (user_id, parameter_type);
ALTER TABLE ONLY quant_sold
diff --git a/html/admin/sql/mod2/data.sql b/html/admin/sql/mod2/data.sql
index a280404ce..6ed5d986d 100644
--- a/html/admin/sql/mod2/data.sql
+++ b/html/admin/sql/mod2/data.sql
@@ -50,6 +50,13 @@ SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_state', 's_
SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_type', 'dt_id'), 10, false);
+--
+-- Name: s_jnt_id; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jnt_id', 53, true);
+
+
--
-- Name: s_attr_def; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -57,6 +64,13 @@ SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('document_type', 'dt_
SELECT pg_catalog.setval('s_attr_def', 27, true);
+--
+-- Name: s_cbc; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_cbc', 1, false);
+
+
--
-- Name: s_central; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -159,7 +173,7 @@ SELECT pg_catalog.setval('s_isup', 1, false);
-- Name: s_jnt_fic_att_value; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
-SELECT pg_catalog.setval('s_jnt_fic_att_value', 168, true);
+SELECT pg_catalog.setval('s_jnt_fic_att_value', 1, false);
--
@@ -168,6 +182,35 @@ SELECT pg_catalog.setval('s_jnt_fic_att_value', 168, true);
SELECT pg_catalog.setval('s_jrn', 1, false);
+
+--
+-- Name: s_jrn_1; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_1', 1, false);
+
+
+--
+-- Name: s_jrn_2; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_2', 1, false);
+
+
+--
+-- Name: s_jrn_3; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_3', 1, false);
+
+
+--
+-- Name: s_jrn_4; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('s_jrn_4', 1, false);
+
+
--
-- Name: s_jrn_def; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
--
@@ -238,6 +281,69 @@ SELECT pg_catalog.setval('s_user_act', 1, false);
SELECT pg_catalog.setval('s_user_jrn', 4, true);
+--
+-- Name: seq_doc_type_1; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_1', 1, false);
+
+
+--
+-- Name: seq_doc_type_2; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_2', 1, false);
+
+
+--
+-- Name: seq_doc_type_3; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_3', 1, false);
+
+
+--
+-- Name: seq_doc_type_4; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_4', 1, false);
+
+
+--
+-- Name: seq_doc_type_5; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_5', 1, false);
+
+
+--
+-- Name: seq_doc_type_6; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_6', 1, false);
+
+
+--
+-- Name: seq_doc_type_7; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_7', 1, false);
+
+
+--
+-- Name: seq_doc_type_8; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_8', 1, false);
+
+
+--
+-- Name: seq_doc_type_9; Type: SEQUENCE SET; Schema: public; Owner: phpcompta
+--
+
+SELECT pg_catalog.setval('seq_doc_type_9', 1, false);
+
+
--
-- Data for Name: action; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
@@ -290,7 +396,6 @@ INSERT INTO attr_def (ad_id, ad_text) VALUES (11, 'Montant initial');
INSERT INTO attr_def (ad_id, ad_text) VALUES (12, 'Personne de contact ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (13, 'numéro de tva ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (14, 'Adresse ');
-INSERT INTO attr_def (ad_id, ad_text) VALUES (15, 'code postal');
INSERT INTO attr_def (ad_id, ad_text) VALUES (16, 'pays ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (17, 'téléphone ');
INSERT INTO attr_def (ad_id, ad_text) VALUES (18, 'email ');
@@ -303,27 +408,93 @@ INSERT INTO attr_def (ad_id, ad_text) VALUES (24, 'Ville');
INSERT INTO attr_def (ad_id, ad_text) VALUES (25, 'Société');
INSERT INTO attr_def (ad_id, ad_text) VALUES (26, 'Fax');
INSERT INTO attr_def (ad_id, ad_text) VALUES (27, 'GSM');
+INSERT INTO attr_def (ad_id, ad_text) VALUES (15, 'code postal');
--
-- Data for Name: attr_min; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 23);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 23);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (14, 23);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (15, 23);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 2);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 2);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (3, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (3, 2);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 3);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 4);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 13);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 14);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 15);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 16);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 17);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 18);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 13);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 14);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 15);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 16);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 17);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 18);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 13);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 14);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 16);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 17);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 18);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 6);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 7);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 6);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 7);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (3, 7);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 19);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 19);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (14, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 4);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 10);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 4);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 10);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 12);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 9);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 8);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 9);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 10);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 11);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 11);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 15);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 15);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (15, 1);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (15, 9);
INSERT INTO attr_min (frd_id, ad_id) VALUES (1, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (2, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (3, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (4, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (5, 23);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (10, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (11, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (12, 23);
-INSERT INTO attr_min (frd_id, ad_id) VALUES (6, 23);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (13, 23);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (14, 23);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (15, 23);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (7, 23);
INSERT INTO attr_min (frd_id, ad_id) VALUES (9, 24);
INSERT INTO attr_min (frd_id, ad_id) VALUES (8, 24);
INSERT INTO attr_min (frd_id, ad_id) VALUES (14, 24);
@@ -333,8 +504,37 @@ INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 18);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 25);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 26);
INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 27);
+INSERT INTO attr_min (frd_id, ad_id) VALUES (16, 23);
+--
+-- Data for Name: attr_value; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: centralized; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: document; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: document_modele; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: document_state; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
INSERT INTO document_state (s_id, s_value) VALUES (1, 'Envoyé');
INSERT INTO document_state (s_id, s_value) VALUES (2, 'Brouillon');
INSERT INTO document_state (s_id, s_value) VALUES (3, 'A envoyer');
@@ -356,6 +556,12 @@ INSERT INTO document_type (dt_id, dt_value) VALUES (8, 'Email');
INSERT INTO document_type (dt_id, dt_value) VALUES (9, 'Divers');
+--
+-- Data for Name: fiche; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
--
-- Data for Name: fiche_def; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
@@ -368,7 +574,6 @@ INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id
INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, frd_id) VALUES (1, 607, 'Marchandises', true, 2);
-
--
-- Data for Name: fiche_def_ref; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
@@ -391,63 +596,100 @@ INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (6, 'Pr
INSERT INTO fiche_def_ref (frd_id, frd_text, frd_class_base) VALUES (16, 'Contact', NULL);
+--
+-- Data for Name: form; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: format_csv_banque; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+INSERT INTO format_csv_banque (name, include_file) VALUES ('Dexia', 'dexia_be.inc.php');
+
+
+--
+-- Data for Name: formdef; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: import_tmp; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: invoice; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
+--
+-- Data for Name: jnt_fic_att_value; Type: TABLE DATA; Schema: public; Owner: phpcompta
+--
+
+
+
--
-- Data for Name: jnt_fic_attr; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO jnt_fic_attr VALUES (1, 5);
-INSERT INTO jnt_fic_attr VALUES (1, 1);
-INSERT INTO jnt_fic_attr VALUES (1, 2);
-INSERT INTO jnt_fic_attr VALUES (1, 6);
-INSERT INTO jnt_fic_attr VALUES (1, 7);
-INSERT INTO jnt_fic_attr VALUES (2, 5);
-INSERT INTO jnt_fic_attr VALUES (2, 1);
-INSERT INTO jnt_fic_attr VALUES (2, 12);
-INSERT INTO jnt_fic_attr VALUES (2, 13);
-INSERT INTO jnt_fic_attr VALUES (2, 14);
-INSERT INTO jnt_fic_attr VALUES (2, 15);
-INSERT INTO jnt_fic_attr VALUES (2, 16);
-INSERT INTO jnt_fic_attr VALUES (2, 17);
-INSERT INTO jnt_fic_attr VALUES (2, 18);
-INSERT INTO jnt_fic_attr VALUES (3, 5);
-INSERT INTO jnt_fic_attr VALUES (3, 1);
-INSERT INTO jnt_fic_attr VALUES (3, 3);
-INSERT INTO jnt_fic_attr VALUES (3, 4);
-INSERT INTO jnt_fic_attr VALUES (3, 12);
-INSERT INTO jnt_fic_attr VALUES (3, 13);
-INSERT INTO jnt_fic_attr VALUES (3, 14);
-INSERT INTO jnt_fic_attr VALUES (3, 15);
-INSERT INTO jnt_fic_attr VALUES (3, 16);
-INSERT INTO jnt_fic_attr VALUES (3, 17);
-INSERT INTO jnt_fic_attr VALUES (3, 18);
-INSERT INTO jnt_fic_attr VALUES (4, 5);
-INSERT INTO jnt_fic_attr VALUES (4, 1);
-INSERT INTO jnt_fic_attr VALUES (4, 12);
-INSERT INTO jnt_fic_attr VALUES (4, 13);
-INSERT INTO jnt_fic_attr VALUES (4, 14);
-INSERT INTO jnt_fic_attr VALUES (4, 15);
-INSERT INTO jnt_fic_attr VALUES (4, 16);
-INSERT INTO jnt_fic_attr VALUES (4, 17);
-INSERT INTO jnt_fic_attr VALUES (4, 18);
-INSERT INTO jnt_fic_attr VALUES (5, 5);
-INSERT INTO jnt_fic_attr VALUES (5, 1);
-INSERT INTO jnt_fic_attr VALUES (5, 2);
-INSERT INTO jnt_fic_attr VALUES (5, 7);
-INSERT INTO jnt_fic_attr VALUES (6, 5);
-INSERT INTO jnt_fic_attr VALUES (6, 1);
-INSERT INTO jnt_fic_attr VALUES (6, 2);
-INSERT INTO jnt_fic_attr VALUES (6, 6);
-INSERT INTO jnt_fic_attr VALUES (6, 7);
-INSERT INTO jnt_fic_attr VALUES (6, 19);
-INSERT INTO jnt_fic_attr VALUES (5, 23);
-INSERT INTO jnt_fic_attr VALUES (6, 23);
-INSERT INTO jnt_fic_attr VALUES (2, 23);
-INSERT INTO jnt_fic_attr VALUES (4, 23);
-INSERT INTO jnt_fic_attr VALUES (3, 23);
-INSERT INTO jnt_fic_attr VALUES (1, 23);
-INSERT INTO jnt_fic_attr VALUES (2, 24);
-INSERT INTO jnt_fic_attr VALUES (4, 24);
-INSERT INTO jnt_fic_attr VALUES (2, 24);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 5, 1);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 1, 2);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 2, 3);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 6, 4);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 7, 5);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 5, 6);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 1, 7);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 12, 8);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 13, 9);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 14, 10);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 15, 11);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 16, 12);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 17, 13);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 18, 14);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 5, 15);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 1, 16);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 3, 17);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 4, 18);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 12, 19);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 13, 20);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 14, 21);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 15, 22);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 16, 23);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 17, 24);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 18, 25);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 5, 26);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 1, 27);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 12, 28);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 13, 29);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 14, 30);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 15, 31);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 16, 32);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 17, 33);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 18, 34);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 5, 35);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 1, 36);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 2, 37);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 7, 38);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 5, 39);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 1, 40);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 2, 41);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 6, 42);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 7, 43);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 19, 44);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (5, 23, 45);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (6, 23, 46);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 23, 47);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 23, 48);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (3, 23, 49);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (1, 23, 50);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (2, 24, 51);
+INSERT INTO jnt_fic_attr (fd_id, ad_id, jnt_id) VALUES (4, 24, 52);
+
--
-- Data for Name: jrn; Type: TABLE DATA; Schema: public; Owner: phpcompta
@@ -1608,152 +1850,10 @@ INSERT INTO user_sec_jrn (uj_id, uj_login, uj_jrn_id, uj_priv) VALUES (4, 'phpco
-- Data for Name: version; Type: TABLE DATA; Schema: public; Owner: phpcompta
--
-INSERT INTO version (val) VALUES (15);
+INSERT INTO version (val) VALUES (28);
--
-- PostgreSQL database dump complete
--
-
-ALTER TABLE ONLY action_gestion
- ADD CONSTRAINT action_gestion_pkey PRIMARY KEY (ag_id);
-
-ALTER TABLE ONLY "action"
- ADD CONSTRAINT action_pkey PRIMARY KEY (ac_id);
-
-ALTER TABLE ONLY attr_def
- ADD CONSTRAINT attr_def_pkey PRIMARY KEY (ad_id);
-
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT centralized_pkey PRIMARY KEY (c_id);
-
-ALTER TABLE ONLY document_modele
- ADD CONSTRAINT document_modele_pkey PRIMARY KEY (md_id);
-
-ALTER TABLE ONLY document
- ADD CONSTRAINT document_pkey PRIMARY KEY (d_id);
-
-ALTER TABLE ONLY document_state
- ADD CONSTRAINT document_state_pkey PRIMARY KEY (s_id);
-
-ALTER TABLE ONLY document_type
- ADD CONSTRAINT document_type_pkey PRIMARY KEY (dt_id);
-
-ALTER TABLE ONLY fiche_def
- ADD CONSTRAINT fiche_def_pkey PRIMARY KEY (fd_id);
-
-ALTER TABLE ONLY fiche_def_ref
- ADD CONSTRAINT fiche_def_ref_pkey PRIMARY KEY (frd_id);
-
-ALTER TABLE ONLY fiche
- ADD CONSTRAINT fiche_pkey PRIMARY KEY (f_id);
-
-ALTER TABLE ONLY form
- ADD CONSTRAINT form_pkey PRIMARY KEY (fo_id);
-
-ALTER TABLE ONLY format_csv_banque
- ADD CONSTRAINT format_csv_banque_pkey PRIMARY KEY (name);
-
-ALTER TABLE ONLY formdef
- ADD CONSTRAINT formdef_pkey PRIMARY KEY (fr_id);
-
-ALTER TABLE ONLY invoice
- ADD CONSTRAINT invoice_pkey PRIMARY KEY (iv_id);
-
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT jnt_fic_att_value_pkey PRIMARY KEY (jft_id);
-
-ALTER TABLE ONLY jrn_action
- ADD CONSTRAINT jrn_action_pkey PRIMARY KEY (ja_id);
-
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT jrn_def_jrn_def_name_key UNIQUE (jrn_def_name);
-
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT jrn_def_pkey PRIMARY KEY (jrn_def_id);
-
-ALTER TABLE ONLY jrn
- ADD CONSTRAINT jrn_pkey PRIMARY KEY (jr_id, jr_def_id);
-
-ALTER TABLE ONLY jrn_rapt
- ADD CONSTRAINT jrn_rapt_pkey PRIMARY KEY (jra_id);
-
-ALTER TABLE ONLY jrn_type
- ADD CONSTRAINT jrn_type_pkey PRIMARY KEY (jrn_type_id);
-
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT jrnx_pkey PRIMARY KEY (j_id);
-
-ALTER TABLE ONLY parameter
- ADD CONSTRAINT parameter_pkey PRIMARY KEY (pr_id);
-
-ALTER TABLE ONLY parm_code
- ADD CONSTRAINT parm_code_pkey PRIMARY KEY (p_code);
-
-ALTER TABLE ONLY parm_money
- ADD CONSTRAINT parm_money_pkey PRIMARY KEY (pm_code);
-
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_p_start_key UNIQUE (p_start);
-
-ALTER TABLE ONLY parm_periode
- ADD CONSTRAINT parm_periode_pkey PRIMARY KEY (p_id);
-
-ALTER TABLE ONLY user_local_pref
- ADD CONSTRAINT pk_user_local_pref PRIMARY KEY (user_id, parameter_type);
-
-ALTER TABLE ONLY quant_sold
- ADD CONSTRAINT qs_id_pk PRIMARY KEY (qs_id);
-
-ALTER TABLE ONLY stock_goods
- ADD CONSTRAINT stock_goods_pkey PRIMARY KEY (sg_id);
-
-ALTER TABLE ONLY tmp_pcmn
- ADD CONSTRAINT tmp_pcmn_pkey PRIMARY KEY (pcm_val);
-
-ALTER TABLE ONLY user_sec_act
- ADD CONSTRAINT user_sec_act_pkey PRIMARY KEY (ua_id);
-
-ALTER TABLE ONLY user_sec_jrn
- ADD CONSTRAINT user_sec_jrn_pkey PRIMARY KEY (uj_id);
-ALTER TABLE ONLY jrn_def
- ADD CONSTRAINT "$1" FOREIGN KEY (jrn_def_type) REFERENCES jrn_type(jrn_type_id);
-ALTER TABLE ONLY form
- ADD CONSTRAINT "$1" FOREIGN KEY (fo_fr_id) REFERENCES formdef(fr_id);
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT "$1" FOREIGN KEY (c_jrn_def) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY user_sec_jrn
- ADD CONSTRAINT "$1" FOREIGN KEY (uj_jrn_id) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY user_sec_act
- ADD CONSTRAINT "$1" FOREIGN KEY (ua_act_id) REFERENCES "action"(ac_id);
-ALTER TABLE ONLY jrn_action
- ADD CONSTRAINT "$1" FOREIGN KEY (ja_jrn_type) REFERENCES jrn_type(jrn_type_id);
-ALTER TABLE ONLY attr_min
- ADD CONSTRAINT "$1" FOREIGN KEY (frd_id) REFERENCES fiche_def_ref(frd_id);
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT "$1" FOREIGN KEY (f_id) REFERENCES fiche(f_id);
-ALTER TABLE ONLY attr_value
- ADD CONSTRAINT "$1" FOREIGN KEY (jft_id) REFERENCES jnt_fic_att_value(jft_id);
-ALTER TABLE ONLY jnt_fic_attr
- ADD CONSTRAINT "$1" FOREIGN KEY (fd_id) REFERENCES fiche_def(fd_id);
-ALTER TABLE ONLY jrn
- ADD CONSTRAINT "$1" FOREIGN KEY (jr_def_id) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY fiche
- ADD CONSTRAINT "$1" FOREIGN KEY (fd_id) REFERENCES fiche_def(fd_id);
-ALTER TABLE ONLY fiche_def
- ADD CONSTRAINT "$1" FOREIGN KEY (frd_id) REFERENCES fiche_def_ref(frd_id);
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT "$1" FOREIGN KEY (j_poste) REFERENCES tmp_pcmn(pcm_val);
-ALTER TABLE ONLY jrnx
- ADD CONSTRAINT "$2" FOREIGN KEY (j_jrn_def) REFERENCES jrn_def(jrn_def_id);
-ALTER TABLE ONLY attr_min
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-ALTER TABLE ONLY jnt_fic_att_value
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-ALTER TABLE ONLY jnt_fic_attr
- ADD CONSTRAINT "$2" FOREIGN KEY (ad_id) REFERENCES attr_def(ad_id);
-ALTER TABLE ONLY centralized
- ADD CONSTRAINT "$2" FOREIGN KEY (c_poste) REFERENCES tmp_pcmn(pcm_val);
-ALTER TABLE ONLY document_modele
- ADD CONSTRAINT md_type FOREIGN KEY (md_type) REFERENCES document_type(dt_id);
diff --git a/html/admin/sql/mod2/function.sql b/html/admin/sql/mod2/function.sql
index acf2f843b..8d165aa46 100644
--- a/html/admin/sql/mod2/function.sql
+++ b/html/admin/sql/mod2/function.sql
@@ -1,9 +1,3 @@
-CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
- AS '$libdir/plpgsql', 'plpgsql_call_handler'
- LANGUAGE c;
-CREATE FUNCTION plpgsql_validator(oid) RETURNS void
- AS '$libdir/plpgsql', 'plpgsql_validator'
- LANGUAGE c;
CREATE FUNCTION account_add(p_id poste_comptable, p_name character varying) RETURNS void
AS $$
declare
@@ -36,21 +30,27 @@ $$
CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
AS $$
declare
- class_base poste_comptable;
- maxcode int8;
+ class_base poste_comptable;
+ maxcode poste_comptable;
begin
- select fd_class_base into class_base
- from
- fiche_def join fiche using (fd_id)
- where
- f_id=p_f_id;
- raise notice 'class base %',class_base;
- select max(pcm_val) into maxcode from tmp_pcmn where pcm_val = class_base;
- if maxcode = class_base then
- maxcode=class_base*1000+1;
- end if;
- raise notice 'Max code %',maxcode;
-return maxcode+1;
+ select fd_class_base into class_base
+ from
+ fiche_def join fiche using (fd_id)
+ where
+ f_id=p_f_id;
+ raise notice 'account_compute class base %',class_base;
+ select count (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ if maxcode = 0 then
+ maxcode:=class_base;
+ else
+ select max (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ end if;
+ if maxcode = class_base then
+ maxcode:=class_base*1000;
+ end if;
+ maxcode:=maxcode+1;
+ raise notice 'account_compute Max code %',maxcode;
+ return maxcode;
end;
$$
LANGUAGE plpgsql;
@@ -66,34 +66,45 @@ nCount integer;
begin
if length(trim(p_account)) != 0 then
+ raise notice 'p_account is not empty';
select * into nCount from tmp_pcmn where pcm_val=p_account;
if nCount !=0 then
+ raise notice 'this account exists in tmp_pcmn ';
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+ else
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
nParent:=account_parent(p_account);
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent)
- values (p_account,sName,nParent);
- attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
end if;
else
+ raise notice 'p_account is empty';
select fd_id into nFd_id from fiche where f_id=p_f_id;
bAuto:= account_auto(nFd_id);
if bAuto = true then
+ raise notice 'account generated automatically';
nNew:=account_compute(p_f_id);
-raise debug 'nNew %', nNew;
+ raise notice 'nNew %', nNew;
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
nParent:=account_parent(nNew);
perform account_add (nNew,sName);
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
else
- perform attribut_insert(p_f_id,5,null);
+ select fd_class_base into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if nNew is null or length(trim(nNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+ end if;
end if;
end if;
@@ -124,6 +135,7 @@ begin
raise exception 'Impossible de trouver le compte parent pour %',p_account;
end if;
end loop;
+ raise notice 'account_parent : Parent is %',nParent;
return nParent;
end;
$$
@@ -163,7 +175,7 @@ declare
begin
select nextval('s_jnt_fic_att_value') into n_jft_id;
insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
- insert into attr_value (jft_id,av_text) values (n_jft_id,p_value);
+ insert into attr_value (jft_id,av_text) values (n_jft_id,trim(p_value));
return;
end;
$$
@@ -173,13 +185,14 @@ CREATE FUNCTION card_class_base(p_f_id integer) RETURNS poste_comptable
declare
n_poste fiche_def.fd_class_base%type;
begin
- select fd_class_base into n_poste from fiche_def join fiche using (fd_id)
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
where f_id=p_f_id;
if not FOUND then
raise exception 'Invalid fiche card_class_base(%)',p_f_id;
end if;
-return;
-end;
+return n_poste;
+end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION check_balance(p_grpt integer) RETURNS numeric
@@ -213,6 +226,46 @@ begin
end if;
return 0;
end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) RETURNS integer
+ AS $$
+declare
+last_sequence int8;
+max_sequence int8;
+n integer;
+begin
+ select count(*) into n from pg_class where relkind='S' and relname=lower(p_sequence);
+ if n = 0 then
+ raise exception ' Unknow sequence % ',p_sequence;
+ end if;
+ select count(*) into n from pg_class where relkind='r' and relname=lower(p_table);
+ if n = 0 then
+ raise exception ' Unknow table % ',p_table;
+ end if;
+ execute 'select last_value from '||p_sequence into last_sequence;
+ raise notice 'Last value of the sequence is %', last_sequence;
+ execute 'select max('||p_col||') from '||p_table into max_sequence;
+ if max_sequence is null then
+ max_sequence := 0;
+ end if;
+ raise notice 'Max value of the sequence is %', max_sequence;
+ max_sequence:= max_sequence +1;
+ execute 'alter sequence '||p_sequence||' restart with '||max_sequence;
+return 0;
+end;
+$$
+ LANGUAGE plpgsql;
+CREATE FUNCTION drop_it(p_constraint character varying) RETURNS void
+ AS $$
+declare
+ nCount integer;
+begin
+ select count(*) into nCount from pg_constraint where conname=p_constraint;
+ if nCount = 1 then
+ execute 'alter table parm_periode drop constraint '||p_constraint ;
+ end if;
+end;
$$
LANGUAGE plpgsql;
CREATE FUNCTION fiche_account_parent(p_f_id integer) RETURNS poste_comptable
@@ -276,23 +329,23 @@ return;
end;
$$
LANGUAGE plpgsql;
-CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
+CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
AS $$
-declare
- fid_client integer;
- fid_good integer;
+declare
+ fid_client integer;
+ fid_good integer;
begin
- select f_id into fid_client from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_client;
- select f_id into fid_good from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_fiche;
- insert into quant_sold
- (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
- values
- (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
- return;
-end;
-$$
+ select f_id into fid_client from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
+ select f_id into fid_good from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
+ insert into quant_sold
+ (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
+ values
+ (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
+ return;
+end;
+ $$
LANGUAGE plpgsql;
CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
AS $$
@@ -343,18 +396,28 @@ $$
LANGUAGE plpgsql;
CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id;
+if nCounter = 0 then
execute 'create sequence seq_doc_type_'||NEW.dt_id;
raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.jrn_def_id;
+if nCounter = 0 then
execute 'create sequence s_jrn_'||NEW.jrn_def_id;
-raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+ raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+end if;
RETURN NEW;
END;
$$
@@ -364,18 +427,12 @@ CREATE FUNCTION trim_cvs_quote() RETURNS "trigger"
declare
modified import_tmp%ROWTYPE;
begin
- modified.code=new.code;
- modified.montant=new.montant;
- modified.date_exec=new.date_exec;
- modified.date_valeur=new.date_valeur;
- modified.devise=replace(new.devise,'"','');
- modified.poste_comptable=replace(new.poste_comptable,'"','');
+ modified:=NEW;
+ modified.devise=replace(new.devise,'"','');
+ modified.poste_comptable=replace(new.poste_comptable,'"','');
modified.compte_ordre=replace(NEW.COMPTE_ORDRE,'"','');
modified.detail=replace(NEW.DETAIL,'"','');
modified.num_compte=replace(NEW.NUM_COMPTE,'"','');
- modified.bq_account=NEW.bq_account;
- modified.jrn=NEW.jrn;
- modified.ok=new.ok;
return modified;
end;
$$
@@ -502,7 +559,7 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
select count(*) into nExist
from jnt_fic_att_value join attr_value using (jft_id)
where
- ad_id=23 and av_text=upper(tText);
+ ad_id=23 and av_text=tText;
if nExist = 0 then
exit;
end if;
@@ -513,6 +570,11 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
end loop;
update attr_value set av_text = tText where jft_id=njft_id;
+ update attr_value set av_text = tText
+ where jft_id in
+ ( select jft_id
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where ad_id=25 and av_text=old_qcode);
update jrnx set j_qcode=tText where j_qcode = old_qcode;
return ns;
end;
diff --git a/html/admin/sql/mod2/index.sql b/html/admin/sql/mod2/index.sql
index ef5483e80..a336c988a 100644
--- a/html/admin/sql/mod2/index.sql
+++ b/html/admin/sql/mod2/index.sql
@@ -1,52 +1,11 @@
-ALTER INDEX public.action_gestion_pkey OWNER TO phpcompta;
-ALTER INDEX public.action_pkey OWNER TO phpcompta;
-ALTER INDEX public.attr_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.centralized_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_modele_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_state_pkey OWNER TO phpcompta;
-ALTER INDEX public.document_type_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_def_ref_pkey OWNER TO phpcompta;
-ALTER INDEX public.fiche_pkey OWNER TO phpcompta;
-ALTER INDEX public.form_pkey OWNER TO phpcompta;
-ALTER INDEX public.format_csv_banque_pkey OWNER TO phpcompta;
-ALTER INDEX public.formdef_pkey OWNER TO phpcompta;
-ALTER INDEX public.invoice_pkey OWNER TO phpcompta;
-ALTER INDEX public.jnt_fic_att_value_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_action_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_def_jrn_def_name_key OWNER TO phpcompta;
-ALTER INDEX public.jrn_def_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_rapt_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrn_type_pkey OWNER TO phpcompta;
-ALTER INDEX public.jrnx_pkey OWNER TO phpcompta;
-ALTER INDEX public.parameter_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_code_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_money_pkey OWNER TO phpcompta;
-ALTER INDEX public.parm_periode_p_start_key OWNER TO phpcompta;
-ALTER INDEX public.parm_periode_pkey OWNER TO phpcompta;
-ALTER INDEX public.pk_user_local_pref OWNER TO phpcompta;
-ALTER INDEX public.qs_id_pk OWNER TO phpcompta;
-ALTER INDEX public.stock_goods_pkey OWNER TO phpcompta;
-ALTER INDEX public.tmp_pcmn_pkey OWNER TO phpcompta;
-ALTER INDEX public.user_sec_act_pkey OWNER TO phpcompta;
-ALTER INDEX public.user_sec_jrn_pkey OWNER TO phpcompta;
CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
-ALTER INDEX public.attr_value_jft_id OWNER TO phpcompta;
+CREATE UNIQUE INDEX fd_id_ad_id_x ON jnt_fic_attr USING btree (fd_id, ad_id);
CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
-ALTER INDEX public.fk_stock_goods_f_id OWNER TO phpcompta;
CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
-ALTER INDEX public.fk_stock_goods_j_id OWNER TO phpcompta;
CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
-ALTER INDEX public.idx_case OWNER TO phpcompta;
CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
-ALTER INDEX public.idx_qs_internal OWNER TO phpcompta;
CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
-ALTER INDEX public.ix_iv_name OWNER TO phpcompta;
CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
-ALTER INDEX public.k_ag_ref OWNER TO phpcompta;
CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
-ALTER INDEX public.x_jrn_jr_id OWNER TO phpcompta;
+CREATE UNIQUE INDEX x_periode ON parm_periode USING btree (p_start, p_end);
CREATE INDEX x_poste ON jrnx USING btree (j_poste);
-ALTER INDEX public.x_poste OWNER TO phpcompta;
diff --git a/html/admin/sql/mod2/make-sql b/html/admin/sql/mod2/make-sql
index 16181e9e1..35b4ca11e 100755
--- a/html/admin/sql/mod2/make-sql
+++ b/html/admin/sql/mod2/make-sql
@@ -1,12 +1,22 @@
pg_dump -O -U phpcompta -s mod2 | awk '!/--/ {if ( ! /^$/) print $0;}' > schema.sql
awk '/SEQUENCE/,/;/ { print $0;}' < schema.sql > sequence.sql
-awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE DOMAIN/,/;/ { print $0;}' < schema.sql > table.sql
+awk '/CREATE TABLE/,/;/ { print $0;}' < schema.sql >> table.sql
+
awk '/CREATE VIEW/,/;/ { print $0;}' < schema.sql > view.sql
awk '/INDEX/,/;/ { print $0;}' < schema.sql > index.sql
-awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql > constraint.sql
+(
+echo " SET client_encoding = 'LATIN1';"
+echo " SET check_function_bodies = false;"
+echo " SET client_min_messages = warning;"
+echo "SET search_path = public, pg_catalog;"
+)> constraint.sql
+
+
+awk '/ALTER TABLE/,/;/ { print $0;}' < schema.sql >> constraint.sql
awk '/CREATE FUNCTION/,/LANGUAGE/ { print $0;}' < schema.sql > function.sql
awk '/COMMENT/,/;/ {print $0;}' < schema.sql > comment.sql
-
+sed -i -e "/ALTER TABLE.*/d" -e "/ADD CONSTRAINT/d" -e "/CREATE PROCEDURAL/d" schema.sql
grep setval schema.sql >> sequence.sql
pg_dump -O -U phpcompta -D -a -O mod2 > data.sql
diff --git a/html/admin/sql/mod2/schema.sql b/html/admin/sql/mod2/schema.sql
index f0a820608..5f1fd2206 100644
--- a/html/admin/sql/mod2/schema.sql
+++ b/html/admin/sql/mod2/schema.sql
@@ -1,583 +1,9 @@
-
+SET client_encoding = 'LATIN1';
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+COMMENT ON SCHEMA public IS 'Standard public schema';
+SET search_path = public, pg_catalog;
CREATE DOMAIN poste_comptable AS numeric(25,0);
-
-
-SET default_tablespace = '';
-SET default_with_oids = true;
-CREATE TABLE "action" (
- ac_id integer NOT NULL,
- ac_description text NOT NULL
-);
-
-COMMENT ON TABLE "action" IS 'The different privileges';
-CREATE TABLE action_gestion (
- ag_id serial NOT NULL,
- ag_type integer,
- f_id_dest integer NOT NULL,
- f_id_exp integer NOT NULL,
- ag_title character varying(70),
- ag_timestamp timestamp without time zone DEFAULT now(),
- ag_cal character(1) DEFAULT 'C'::bpchar,
- ag_ref_ag_id integer,
- ag_comment text,
- ag_ref text
-);
-
-COMMENT ON TABLE action_gestion IS 'Action for Managing';
-CREATE TABLE attr_def (
- ad_id integer DEFAULT nextval('s_attr_def'::text) NOT NULL,
- ad_text text
-);
-
-COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
-CREATE TABLE attr_min (
- frd_id integer,
- ad_id integer
-);
-
-COMMENT ON TABLE attr_min IS 'The value of attributs for the cards';
-CREATE TABLE attr_value (
- jft_id integer,
- av_text text
-);
-
-CREATE TABLE centralized (
- c_id integer DEFAULT nextval('s_centralized'::text) NOT NULL,
- c_j_id integer,
- c_date date NOT NULL,
- c_internal text NOT NULL,
- c_montant numeric(20,4) NOT NULL,
- c_debit boolean DEFAULT true,
- c_jrn_def integer NOT NULL,
- c_poste poste_comptable,
- c_description text,
- c_grp integer NOT NULL,
- c_comment text,
- c_rapt text,
- c_periode integer,
- c_order integer
-);
-
-COMMENT ON TABLE centralized IS 'The centralized journal';
-CREATE TABLE document (
- d_id serial NOT NULL,
- ag_id integer NOT NULL,
- d_lob oid,
- d_number bigint NOT NULL,
- d_filename text,
- d_mimetype text,
- d_state integer
-);
-
-COMMENT ON TABLE document IS 'This table contains all the documents : summary and lob files';
-CREATE TABLE document_modele (
- md_id serial NOT NULL,
- md_name text NOT NULL,
- md_lob oid,
- md_type integer NOT NULL,
- md_filename text,
- md_mimetype text
-);
-
-COMMENT ON TABLE document_modele IS ' contains all the template for the documents';
-CREATE SEQUENCE document_seq
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
-CREATE TABLE document_state (
- s_id serial NOT NULL,
- s_value character varying(50) NOT NULL
-);
-
-COMMENT ON TABLE document_state IS 'State of the document';
-CREATE TABLE document_type (
- dt_id serial NOT NULL,
- dt_value character varying(80)
-);
-
-COMMENT ON TABLE document_type IS 'Type of document : meeting, invoice,...';
-CREATE TABLE fiche (
- f_id integer DEFAULT nextval('s_fiche'::text) NOT NULL,
- fd_id integer
-);
-
-COMMENT ON TABLE fiche IS 'Cards';
-CREATE TABLE fiche_def (
- fd_id integer DEFAULT nextval('s_fdef'::text) NOT NULL,
- fd_class_base poste_comptable,
- fd_label text NOT NULL,
- fd_create_account boolean DEFAULT false,
- frd_id integer NOT NULL
-);
-
-COMMENT ON TABLE fiche_def IS 'Cards definition';
-CREATE TABLE fiche_def_ref (
- frd_id integer DEFAULT nextval('s_fiche_def_ref'::text) NOT NULL,
- frd_text text,
- frd_class_base integer
-);
-
-COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
-CREATE TABLE form (
- fo_id integer DEFAULT nextval('s_form'::text) NOT NULL,
- fo_fr_id integer,
- fo_pos integer,
- fo_label text,
- fo_formula text
-);
-
-COMMENT ON TABLE form IS 'Forms content';
-CREATE TABLE format_csv_banque (
- name text NOT NULL,
- include_file text NOT NULL
-);
-
-CREATE TABLE formdef (
- fr_id integer DEFAULT nextval('s_formdef'::text) NOT NULL,
- fr_label text
-);
-
-CREATE TABLE import_tmp (
- code text,
- date_exec date,
- date_valeur date,
- montant text,
- devise text,
- compte_ordre text,
- detail text,
- num_compte text,
- poste_comptable text,
- status varchar(1) default 'n' not null check (status in ('n','t','d','w')),
- bq_account integer NOT NULL,
- jrn integer NOT NULL
-);
-
-CREATE TABLE invoice (
- iv_id integer DEFAULT nextval('s_invoice'::text) NOT NULL,
- iv_name text NOT NULL,
- iv_file oid
-);
-
-CREATE TABLE jnt_fic_att_value (
- jft_id integer DEFAULT nextval('s_jnt_fic_att_value'::text) NOT NULL,
- f_id integer,
- ad_id integer
-);
-
-COMMENT ON TABLE jnt_fic_att_value IS 'join between the card and the attribut definition';
-CREATE TABLE jnt_fic_attr (
- fd_id integer,
- ad_id integer
-);
-
-COMMENT ON TABLE jnt_fic_attr IS 'join between the family card and the attribut definition';
-CREATE TABLE jrn (
- jr_id integer DEFAULT nextval('s_jrn'::text) NOT NULL,
- jr_def_id integer NOT NULL,
- jr_montant numeric(20,4) NOT NULL,
- jr_comment text,
- jr_date date,
- jr_grpt_id integer NOT NULL,
- jr_internal text,
- jr_tech_date timestamp without time zone DEFAULT now() NOT NULL,
- jr_tech_per integer NOT NULL,
- jrn_ech date,
- jr_ech date,
- jr_rapt text,
- jr_valid boolean DEFAULT true,
- jr_opid integer,
- jr_c_opid integer,
- jr_pj oid,
- jr_pj_name text,
- jr_pj_type text
-);
-
-COMMENT ON TABLE jrn IS 'Journal: content one line for a group of accountancy writing';
-CREATE TABLE jrn_action (
- ja_id integer DEFAULT nextval('s_jrnaction'::text) NOT NULL,
- ja_name text NOT NULL,
- ja_desc text,
- ja_url text NOT NULL,
- ja_action text NOT NULL,
- ja_lang text DEFAULT 'FR'::text,
- ja_jrn_type character(3)
-);
-
-COMMENT ON TABLE jrn_action IS 'Possible action when we are in journal (menu)';
-CREATE TABLE jrn_def (
- jrn_def_id integer DEFAULT nextval('s_jrn_def'::text) NOT NULL,
- jrn_def_name text NOT NULL,
- jrn_def_class_deb text,
- jrn_def_class_cred text,
- jrn_def_fiche_deb text,
- jrn_def_fiche_cred text,
- jrn_deb_max_line integer DEFAULT 1,
- jrn_cred_max_line integer DEFAULT 1,
- jrn_def_ech boolean DEFAULT false,
- jrn_def_ech_lib text,
- jrn_def_type character(3) NOT NULL,
- jrn_def_code text NOT NULL
-);
-
-COMMENT ON TABLE jrn_def IS 'Definition of a journal, his properties';
-CREATE TABLE jrn_rapt (
- jra_id integer DEFAULT nextval('s_jrn_rapt'::text) NOT NULL,
- jr_id integer NOT NULL,
- jra_concerned integer NOT NULL
-);
-
-COMMENT ON TABLE jrn_rapt IS 'Rapprochement between operation';
-CREATE TABLE jrn_type (
- jrn_type_id character(3) NOT NULL,
- jrn_desc text
-);
-
-COMMENT ON TABLE jrn_type IS 'Type of journal (Sell, Buy, Financial...)';
-CREATE TABLE jrnx (
- j_id integer DEFAULT nextval('s_jrn_op'::text) NOT NULL,
- j_date date DEFAULT now(),
- j_montant numeric(20,4) DEFAULT 0,
- j_poste poste_comptable NOT NULL,
- j_grpt integer NOT NULL,
- j_rapt text,
- j_jrn_def integer NOT NULL,
- j_debit boolean DEFAULT true,
- j_text text,
- j_centralized boolean DEFAULT false,
- j_internal text,
- j_tech_user text NOT NULL,
- j_tech_date timestamp without time zone DEFAULT now() NOT NULL,
- j_tech_per integer NOT NULL,
- j_qcode text
-);
-
-COMMENT ON TABLE jrnx IS 'Journal: content one line for each accountancy writing';
-CREATE TABLE parameter (
- pr_id text NOT NULL,
- pr_value text
-);
-
-CREATE TABLE parm_code (
- p_code text NOT NULL,
- p_value text,
- p_comment text
-);
-
-CREATE TABLE parm_money (
- pm_id integer DEFAULT nextval('s_currency'::text),
- pm_code character(3) NOT NULL,
- pm_rate numeric(20,4) NOT NULL
-);
-
-COMMENT ON TABLE parm_money IS 'Currency conversion';
-CREATE TABLE parm_periode (
- p_id integer DEFAULT nextval('s_periode'::text) NOT NULL,
- p_start date NOT NULL,
- p_end date,
- p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
- p_closed boolean DEFAULT false,
- p_central boolean DEFAULT false,
- CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
-);
-
-COMMENT ON TABLE parm_periode IS 'Periode definition';
-CREATE TABLE quant_sold (
- qs_id integer DEFAULT nextval('s_quantity'::text) NOT NULL,
- qs_internal text NOT NULL,
- qs_fiche integer NOT NULL,
- qs_quantite integer NOT NULL,
- qs_price numeric(20,4),
- qs_vat numeric(20,4),
- qs_vat_code integer,
- qs_client integer NOT NULL
-);
-
-COMMENT ON TABLE quant_sold IS 'Contains about invoice for customer';
-CREATE SEQUENCE s_attr_def
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_central
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-CREATE SEQUENCE s_cbc
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_central_order
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_centralized
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_currency
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_fdef
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_fiche
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_fiche_def_ref
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_form
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_formdef
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_grpt
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_idef
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_internal
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_invoice
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_isup
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_jnt_fic_att_value
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_jrn
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-
-CREATE SEQUENCE s_jrn_def
- START WITH 5
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_jrn_op
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_jrn_rapt
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_jrnaction
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_jrnx
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_periode
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_quantity
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_stock_goods
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_user_act
- START WITH 1
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE SEQUENCE s_user_jrn
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE TABLE stock_goods (
- sg_id integer DEFAULT nextval('s_stock_goods'::text) NOT NULL,
- j_id integer,
- f_id integer NOT NULL,
- sg_code text,
- sg_quantity integer DEFAULT 0,
- sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
- sg_date date,
- sg_tech_date date DEFAULT now(),
- sg_tech_user text,
- CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
-);
-
-COMMENT ON TABLE stock_goods IS 'About the goods';
-CREATE TABLE tmp_pcmn (
- pcm_val poste_comptable NOT NULL,
- pcm_lib text,
- pcm_val_parent poste_comptable DEFAULT 0,
- pcm_country character(2) DEFAULT 'BE'::bpchar NOT NULL
-);
-
-COMMENT ON TABLE tmp_pcmn IS 'Plan comptable minimum normalisé';
-CREATE TABLE tva_rate (
- tva_id integer NOT NULL,
- tva_label text NOT NULL,
- tva_rate numeric(6,4) DEFAULT 0.0 NOT NULL,
- tva_comment text,
- tva_poste text
-);
-
-COMMENT ON TABLE tva_rate IS 'Rate of vat';
-CREATE TABLE user_local_pref (
- user_id text NOT NULL,
- parameter_type text NOT NULL,
- parameter_value text
-);
-
-COMMENT ON TABLE user_local_pref IS 'The user''s local parameter ';
-COMMENT ON COLUMN user_local_pref.user_id IS 'user''s login ';
-COMMENT ON COLUMN user_local_pref.parameter_type IS 'the type of parameter ';
-COMMENT ON COLUMN user_local_pref.parameter_value IS 'the value of parameter ';
-CREATE TABLE user_sec_act (
- ua_id integer DEFAULT nextval('s_user_act'::text) NOT NULL,
- ua_login text,
- ua_act_id integer
-);
-
-CREATE TABLE user_sec_jrn (
- uj_id integer DEFAULT nextval('s_user_jrn'::text) NOT NULL,
- uj_login text,
- uj_jrn_id integer,
- uj_priv text
-);
-
-CREATE TABLE version (
- val integer
-);
-
-CREATE VIEW vw_client AS
- SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 9);
-
-CREATE VIEW vw_fiche_attr AS
- SELECT a.f_id, a.fd_id, a.av_text AS vw_name, b.av_text AS vw_sell, c.av_text AS vw_buy, d.av_text AS tva_code, tva_rate.tva_id, tva_rate.tva_rate, tva_rate.tva_label, e.av_text AS vw_addr, f.av_text AS vw_cp, j.av_text AS quick_code, fiche_def.frd_id FROM (((((((((SELECT fiche.f_id, fiche.fd_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 6)) b ON ((a.f_id = b.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 7)) c ON ((a.f_id = c.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 2)) d ON ((a.f_id = d.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 14)) e ON ((a.f_id = e.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 15)) f ON ((a.f_id = f.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 23)) j ON ((a.f_id = j.f_id))) LEFT JOIN tva_rate ON ((d.av_text = (tva_rate.tva_id)::text))) JOIN fiche_def USING (fd_id));
-
-CREATE VIEW vw_fiche_def AS
- SELECT jnt_fic_attr.fd_id, jnt_fic_attr.ad_id, attr_def.ad_text, attr_value.av_text, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def.frd_id FROM (((((jnt_fic_att_value JOIN attr_value USING (jft_id)) JOIN fiche USING (f_id)) JOIN jnt_fic_attr USING (fd_id)) JOIN attr_def ON ((attr_def.ad_id = jnt_fic_attr.ad_id))) JOIN fiche_def USING (fd_id));
-
-COMMENT ON VIEW vw_fiche_def IS 'all the attributs for card family';
-CREATE VIEW vw_fiche_min AS
- SELECT attr_min.frd_id, attr_min.ad_id, attr_def.ad_text, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base FROM ((attr_min JOIN attr_def USING (ad_id)) JOIN fiche_def_ref USING (frd_id));
-
-COMMENT ON VIEW vw_fiche_min IS 'minimum attribut for reference card';
-CREATE VIEW vw_poste_qcode AS
- SELECT a.f_id, a.av_text AS j_poste, b.av_text AS j_qcode FROM ((SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) a JOIN (SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) b USING (f_id));
-
-CREATE VIEW vw_supplier AS
- SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 8);
-
-CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
-
-CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
-
-CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
-
-CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
-
-CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
-
-CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
-
-CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
-
-CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
-
-CREATE INDEX x_poste ON jrnx USING btree (j_poste);
-
CREATE FUNCTION account_add(p_id poste_comptable, p_name character varying) RETURNS void
AS $$
declare
@@ -594,7 +20,6 @@ return;
end ;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION account_auto(p_fd_id integer) RETURNS boolean
AS $$
declare
@@ -608,43 +33,33 @@ begin
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION account_compute(p_f_id integer) RETURNS poste_comptable
AS $$
declare
- class_base poste_comptable;
- maxcode int8;
+ class_base poste_comptable;
+ maxcode poste_comptable;
begin
- select fd_class_base into class_base
- from
- fiche_def join fiche using (fd_id)
- where
- f_id=p_f_id;
- raise notice 'class base %',class_base;
- select max(pcm_val) into maxcode from tmp_pcmn where pcm_val = class_base;
- if maxcode = class_base then
- maxcode=class_base*1000+1;
- end if;
- raise notice 'Max code %',maxcode;
-return maxcode+1;
-end;
-$$
-LANGUAGE plpgsql;
-
-
-CREATE FUNCTION attribut_insert(p_f_id integer, p_ad_id integer, p_value character varying) RETURNS void
- AS $$
-declare
- n_jft_id integer;
-begin
- select nextval('s_jnt_fic_att_value') into n_jft_id;
- insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
- insert into attr_value (jft_id,av_text) values (n_jft_id,p_value);
-return;
+ select fd_class_base into class_base
+ from
+ fiche_def join fiche using (fd_id)
+ where
+ f_id=p_f_id;
+ raise notice 'account_compute class base %',class_base;
+ select count (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ if maxcode = 0 then
+ maxcode:=class_base;
+ else
+ select max (pcm_val) into maxcode from tmp_pcmn where pcm_val_parent = class_base;
+ end if;
+ if maxcode = class_base then
+ maxcode:=class_base*1000;
+ end if;
+ maxcode:=maxcode+1;
+ raise notice 'account_compute Max code %',maxcode;
+ return maxcode;
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION account_insert(p_f_id integer, p_account poste_comptable) RETURNS integer
AS $$
declare
@@ -657,42 +72,52 @@ nCount integer;
begin
if length(trim(p_account)) != 0 then
+ raise notice 'p_account is not empty';
select * into nCount from tmp_pcmn where pcm_val=p_account;
if nCount !=0 then
+ raise notice 'this account exists in tmp_pcmn ';
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
+ else
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
nParent:=account_parent(p_account);
- insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent)
- values (p_account,sName,nParent);
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values (p_account,sName,nParent);
+ perform attribut_insert(p_f_id,5,to_char(p_account,'999999999999999999999999'));
end if;
else
+ raise notice 'p_account is empty';
select fd_id into nFd_id from fiche where f_id=p_f_id;
bAuto:= account_auto(nFd_id);
if bAuto = true then
+ raise notice 'account generated automatically';
nNew:=account_compute(p_f_id);
-raise debug 'nNew %', nNew;
+ raise notice 'nNew %', nNew;
select av_text into sName from
attr_value join jnt_fic_att_value using (jft_id)
where
ad_id=1 and f_id=p_f_id;
nParent:=account_parent(nNew);
perform account_add (nNew,sName);
- perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999'));
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
else
- perform attribut_insert(p_f_id,5,null);
+ select fd_class_base into nNew from fiche_def join fiche using (fd_id) where f_id=p_f_id;
+ if nNew is null or length(trim(nNew)) = 0 then
+ raise notice 'count is null';
+ perform attribut_insert(p_f_id,5,null);
+ else
+ perform attribut_insert(p_f_id,5,to_char(nNew,'999999999999999999999999'));
+ end if;
end if;
end if;
return 0;
end;
$$
-LANGUAGE plpgsql;
-
+ LANGUAGE plpgsql;
CREATE FUNCTION account_parent(p_account poste_comptable) RETURNS poste_comptable
AS $$
declare
@@ -716,11 +141,11 @@ begin
raise exception 'Impossible de trouver le compte parent pour %',p_account;
end if;
end loop;
+ raise notice 'account_parent : Parent is %',nParent;
return nParent;
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION account_update(p_f_id integer, p_account poste_comptable) RETURNS integer
AS $$
declare
@@ -749,21 +174,33 @@ return njft_id;
end;
$$
LANGUAGE plpgsql;
-CREATE FUNCTION card_class_base(p_f_id integer) RETURNS fiche_def.fd_class_base%type
-AS $$
-declare
- n_poste fiche_def.fd_class_base%type;
+CREATE FUNCTION attribut_insert(p_f_id integer, p_ad_id integer, p_value character varying) RETURNS void
+ AS $$
+declare
+ n_jft_id integer;
begin
- select fd_class_base into n_poste from fiche_def join fiche using (fd_id)
- where f_id=p_f_id;
- if not FOUND then
- raise exception 'Invalid fiche card_class_base(%)',p_f_id;
- end if;
-return n_poste;
+ select nextval('s_jnt_fic_att_value') into n_jft_id;
+ insert into jnt_fic_att_value (jft_id,f_id,ad_id) values (n_jft_id,p_f_id,p_ad_id);
+ insert into attr_value (jft_id,av_text) values (n_jft_id,trim(p_value));
+return;
end;
$$
- LANGUAGE plpgsql;
-
+ LANGUAGE plpgsql;
+CREATE FUNCTION card_class_base(p_f_id integer) RETURNS poste_comptable
+ AS $$
+declare
+ n_poste fiche_def.fd_class_base%type;
+begin
+ select fd_class_base into n_poste from fiche_def join fiche using
+(fd_id)
+ where f_id=p_f_id;
+ if not FOUND then
+ raise exception 'Invalid fiche card_class_base(%)',p_f_id;
+ end if;
+return n_poste;
+end;
+$$
+ LANGUAGE plpgsql;
CREATE FUNCTION check_balance(p_grpt integer) RETURNS numeric
AS $$
declare
@@ -797,7 +234,47 @@ begin
end;
$$
LANGUAGE plpgsql;
-
+CREATE FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) RETURNS integer
+ AS $$
+declare
+last_sequence int8;
+max_sequence int8;
+n integer;
+begin
+ select count(*) into n from pg_class where relkind='S' and relname=lower(p_sequence);
+ if n = 0 then
+ raise exception ' Unknow sequence % ',p_sequence;
+ end if;
+ select count(*) into n from pg_class where relkind='r' and relname=lower(p_table);
+ if n = 0 then
+ raise exception ' Unknow table % ',p_table;
+ end if;
+ execute 'select last_value from '||p_sequence into last_sequence;
+ raise notice 'Last value of the sequence is %', last_sequence;
+ execute 'select max('||p_col||') from '||p_table into max_sequence;
+ if max_sequence is null then
+ max_sequence := 0;
+ end if;
+ raise notice 'Max value of the sequence is %', max_sequence;
+ max_sequence:= max_sequence +1;
+ execute 'alter sequence '||p_sequence||' restart with '||max_sequence;
+return 0;
+end;
+$$
+ LANGUAGE plpgsql;
+COMMENT ON FUNCTION correct_sequence(p_sequence text, p_col text, p_table text) IS ' Often the primary key is a sequence number and sometimes the value of the sequence is not synchronized with the primary key ( p_sequence : sequence name, p_col : col of the pk,p_table : concerned table';
+CREATE FUNCTION drop_it(p_constraint character varying) RETURNS void
+ AS $$
+declare
+ nCount integer;
+begin
+ select count(*) into nCount from pg_constraint where conname=p_constraint;
+ if nCount = 1 then
+ execute 'alter table parm_periode drop constraint '||p_constraint ;
+ end if;
+end;
+$$
+ LANGUAGE plpgsql;
CREATE FUNCTION fiche_account_parent(p_f_id integer) RETURNS poste_comptable
AS $$
declare
@@ -811,7 +288,6 @@ begin
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION insert_jrnx(p_date character varying, p_montant numeric, p_poste integer, p_grpt integer, p_jrn_def integer, p_debit boolean, p_tech_user text, p_tech_per integer, p_qcode text) RETURNS void
AS $$
declare
@@ -860,26 +336,24 @@ return;
end;
$$
LANGUAGE plpgsql;
-
-CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant integer, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
+CREATE FUNCTION insert_quant_sold(p_internal text, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_client character varying) RETURNS void
AS $$
-declare
- fid_client integer;
- fid_good integer;
+declare
+ fid_client integer;
+ fid_good integer;
begin
- select f_id into fid_client from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_client;
- select f_id into fid_good from
- attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=p_fiche;
- insert into quant_sold
- (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
- values
- (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
- return;
-end;
-$$
+ select f_id into fid_client from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
+ select f_id into fid_good from
+ attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
+ insert into quant_sold
+ (qs_internal,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client)
+ values
+ (p_internal,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client);
+ return;
+end;
+ $$
LANGUAGE plpgsql;
-
CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
AS $$
declare
@@ -910,7 +384,6 @@ CREATE FUNCTION insert_quick_code(nf_id integer, tav_text text) RETURNS integer
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION proc_check_balance() RETURNS "trigger"
AS $$
declare
@@ -928,27 +401,34 @@ begin
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION t_document_type_insert() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.dt_id;
+if nCounter = 0 then
execute 'create sequence seq_doc_type_'||NEW.dt_id;
raise notice 'Creating sequence seq_doc_type_%',NEW.dt_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION t_jrn_def_sequence() RETURNS "trigger"
AS $$
+declare
+nCounter integer;
BEGIN
+select count(*) into nCounter from pg_class where relname='seq_doc_type_'||NEW.jrn_def_id;
+if nCounter = 0 then
execute 'create sequence s_jrn_'||NEW.jrn_def_id;
-raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+ raise notice 'Creating sequence s_jrn_%',NEW.jrn_def_id;
+end if;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION trim_cvs_quote() RETURNS "trigger"
AS $$
declare
@@ -964,7 +444,6 @@ begin
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION trim_space_format_csv_banque() RETURNS "trigger"
AS $$
declare
@@ -982,7 +461,6 @@ begin
end;
$$
LANGUAGE plpgsql;
-
CREATE FUNCTION tva_delete(integer) RETURNS void
AS $_$
declare
@@ -998,7 +476,6 @@ begin
end;
$_$
LANGUAGE plpgsql;
-
CREATE FUNCTION tva_insert(integer, text, numeric, text, text) RETURNS integer
AS $_$
declare
@@ -1035,7 +512,6 @@ return 0;
end;
$_$
LANGUAGE plpgsql;
-
CREATE FUNCTION tva_modify(integer, text, numeric, text, text) RETURNS integer
AS $_$declare
p_tva_id alias for $1;
@@ -1066,7 +542,6 @@ return 0;
end;
$_$
LANGUAGE plpgsql;
-
CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS integer
AS $$
declare
@@ -1091,7 +566,7 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
select count(*) into nExist
from jnt_fic_att_value join attr_value using (jft_id)
where
- ad_id=23 and av_text=upper(tText);
+ ad_id=23 and av_text=tText;
if nExist = 0 then
exit;
end if;
@@ -1102,13 +577,604 @@ CREATE FUNCTION update_quick_code(njft_id integer, tav_text text) RETURNS intege
end loop;
update attr_value set av_text = tText where jft_id=njft_id;
+ update attr_value set av_text = tText
+ where jft_id in
+ ( select jft_id
+ from jnt_fic_att_value join attr_value using (jft_id)
+ where ad_id=25 and av_text=old_qcode);
update jrnx set j_qcode=tText where j_qcode = old_qcode;
return ns;
end;
$$
LANGUAGE plpgsql;
-
-
+SET default_tablespace = '';
+SET default_with_oids = true;
+CREATE TABLE attr_def (
+ ad_id integer DEFAULT nextval(('s_attr_def'::text)::regclass) NOT NULL,
+ ad_text text
+);
+COMMENT ON TABLE attr_def IS 'The available attributs for the cards';
+CREATE TABLE attr_min (
+ frd_id integer,
+ ad_id integer
+);
+COMMENT ON TABLE attr_min IS 'The value of attributs for the cards';
+CREATE TABLE fiche_def_ref (
+ frd_id integer DEFAULT nextval(('s_fiche_def_ref'::text)::regclass) NOT NULL,
+ frd_text text,
+ frd_class_base integer
+);
+COMMENT ON TABLE fiche_def_ref IS 'Family Cards definition';
+CREATE VIEW "Vw_attr_min" AS
+ SELECT a.frd_id, a.ad_id, attr_def.ad_text, fiche_def_ref.frd_text FROM ((attr_min a JOIN attr_def USING (ad_id)) JOIN fiche_def_ref USING (frd_id));
+CREATE TABLE "action" (
+ ac_id integer NOT NULL,
+ ac_description text NOT NULL
+);
+COMMENT ON TABLE "action" IS 'The different privileges';
+CREATE TABLE action_gestion (
+ ag_id serial NOT NULL,
+ ag_type integer,
+ f_id_dest integer NOT NULL,
+ f_id_exp integer NOT NULL,
+ ag_title character varying(70),
+ ag_timestamp timestamp without time zone DEFAULT now(),
+ ag_cal character(1) DEFAULT 'C'::bpchar,
+ ag_ref_ag_id integer,
+ ag_comment text,
+ ag_ref text
+);
+COMMENT ON TABLE action_gestion IS 'Action for Managing';
+CREATE TABLE attr_value (
+ jft_id integer,
+ av_text text
+);
+CREATE TABLE centralized (
+ c_id integer DEFAULT nextval(('s_centralized'::text)::regclass) NOT NULL,
+ c_j_id integer,
+ c_date date NOT NULL,
+ c_internal text NOT NULL,
+ c_montant numeric(20,4) NOT NULL,
+ c_debit boolean DEFAULT true,
+ c_jrn_def integer NOT NULL,
+ c_poste poste_comptable,
+ c_description text,
+ c_grp integer NOT NULL,
+ c_comment text,
+ c_rapt text,
+ c_periode integer,
+ c_order integer
+);
+COMMENT ON TABLE centralized IS 'The centralized journal';
+CREATE TABLE document (
+ d_id serial NOT NULL,
+ ag_id integer NOT NULL,
+ d_lob oid,
+ d_number bigint NOT NULL,
+ d_filename text,
+ d_mimetype text,
+ d_state integer
+);
+COMMENT ON TABLE document IS 'This table contains all the documents : summary and lob files';
+CREATE TABLE document_modele (
+ md_id serial NOT NULL,
+ md_name text NOT NULL,
+ md_lob oid,
+ md_type integer NOT NULL,
+ md_filename text,
+ md_mimetype text
+);
+COMMENT ON TABLE document_modele IS ' contains all the template for the documents';
+CREATE SEQUENCE document_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
+CREATE TABLE document_state (
+ s_id serial NOT NULL,
+ s_value character varying(50) NOT NULL
+);
+COMMENT ON TABLE document_state IS 'State of the document';
+CREATE TABLE document_type (
+ dt_id serial NOT NULL,
+ dt_value character varying(80)
+);
+COMMENT ON TABLE document_type IS 'Type of document : meeting, invoice,...';
+CREATE TABLE fiche (
+ f_id integer DEFAULT nextval(('s_fiche'::text)::regclass) NOT NULL,
+ fd_id integer
+);
+COMMENT ON TABLE fiche IS 'Cards';
+CREATE TABLE fiche_def (
+ fd_id integer DEFAULT nextval(('s_fdef'::text)::regclass) NOT NULL,
+ fd_class_base poste_comptable,
+ fd_label text NOT NULL,
+ fd_create_account boolean DEFAULT false,
+ frd_id integer NOT NULL
+);
+COMMENT ON TABLE fiche_def IS 'Cards definition';
+CREATE TABLE form (
+ fo_id integer DEFAULT nextval(('s_form'::text)::regclass) NOT NULL,
+ fo_fr_id integer,
+ fo_pos integer,
+ fo_label text,
+ fo_formula text
+);
+COMMENT ON TABLE form IS 'Forms content';
+CREATE TABLE format_csv_banque (
+ name text NOT NULL,
+ include_file text NOT NULL
+);
+CREATE TABLE formdef (
+ fr_id integer DEFAULT nextval(('s_formdef'::text)::regclass) NOT NULL,
+ fr_label text
+);
+CREATE TABLE import_tmp (
+ code text,
+ date_exec date,
+ date_valeur date,
+ montant text,
+ devise text,
+ compte_ordre text,
+ detail text,
+ num_compte text,
+ poste_comptable text,
+ status character varying(1) DEFAULT 'n'::character varying NOT NULL,
+ bq_account integer NOT NULL,
+ jrn integer NOT NULL,
+ jr_rapt text,
+ CONSTRAINT import_tmp_status_check CHECK ((((((status)::text = 'n'::text) OR ((status)::text = 't'::text)) OR ((status)::text = 'd'::text)) OR ((status)::text = 'w'::text)))
+);
+CREATE TABLE invoice (
+ iv_id integer DEFAULT nextval(('s_invoice'::text)::regclass) NOT NULL,
+ iv_name text NOT NULL,
+ iv_file oid
+);
+CREATE TABLE jnt_fic_att_value (
+ jft_id integer DEFAULT nextval(('s_jnt_fic_att_value'::text)::regclass) NOT NULL,
+ f_id integer,
+ ad_id integer
+);
+COMMENT ON TABLE jnt_fic_att_value IS 'join between the card and the attribut definition';
+CREATE SEQUENCE s_jnt_id
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE TABLE jnt_fic_attr (
+ fd_id integer,
+ ad_id integer,
+ jnt_id bigint DEFAULT nextval('s_jnt_id'::regclass) NOT NULL
+);
+COMMENT ON TABLE jnt_fic_attr IS 'join between the family card and the attribut definition';
+CREATE TABLE jrn (
+ jr_id integer DEFAULT nextval(('s_jrn'::text)::regclass) NOT NULL,
+ jr_def_id integer NOT NULL,
+ jr_montant numeric(20,4) NOT NULL,
+ jr_comment text,
+ jr_date date,
+ jr_grpt_id integer NOT NULL,
+ jr_internal text,
+ jr_tech_date timestamp without time zone DEFAULT now() NOT NULL,
+ jr_tech_per integer NOT NULL,
+ jrn_ech date,
+ jr_ech date,
+ jr_rapt text,
+ jr_valid boolean DEFAULT true,
+ jr_opid integer,
+ jr_c_opid integer,
+ jr_pj oid,
+ jr_pj_name text,
+ jr_pj_type text
+);
+COMMENT ON TABLE jrn IS 'Journal: content one line for a group of accountancy writing';
+CREATE TABLE jrn_action (
+ ja_id integer DEFAULT nextval(('s_jrnaction'::text)::regclass) NOT NULL,
+ ja_name text NOT NULL,
+ ja_desc text,
+ ja_url text NOT NULL,
+ ja_action text NOT NULL,
+ ja_lang text DEFAULT 'FR'::text,
+ ja_jrn_type character(3)
+);
+COMMENT ON TABLE jrn_action IS 'Possible action when we are in journal (menu)';
+CREATE TABLE jrn_def (
+ jrn_def_id integer DEFAULT nextval(('s_jrn_def'::text)::regclass) NOT NULL,
+ jrn_def_name text NOT NULL,
+ jrn_def_class_deb text,
+ jrn_def_class_cred text,
+ jrn_def_fiche_deb text,
+ jrn_def_fiche_cred text,
+ jrn_deb_max_line integer DEFAULT 1,
+ jrn_cred_max_line integer DEFAULT 1,
+ jrn_def_ech boolean DEFAULT false,
+ jrn_def_ech_lib text,
+ jrn_def_type character(3) NOT NULL,
+ jrn_def_code text NOT NULL
+);
+COMMENT ON TABLE jrn_def IS 'Definition of a journal, his properties';
+CREATE TABLE jrn_rapt (
+ jra_id integer DEFAULT nextval(('s_jrn_rapt'::text)::regclass) NOT NULL,
+ jr_id integer NOT NULL,
+ jra_concerned integer NOT NULL
+);
+COMMENT ON TABLE jrn_rapt IS 'Rapprochement between operation';
+CREATE TABLE jrn_type (
+ jrn_type_id character(3) NOT NULL,
+ jrn_desc text
+);
+COMMENT ON TABLE jrn_type IS 'Type of journal (Sell, Buy, Financial...)';
+CREATE TABLE jrnx (
+ j_id integer DEFAULT nextval(('s_jrn_op'::text)::regclass) NOT NULL,
+ j_date date DEFAULT now(),
+ j_montant numeric(20,4) DEFAULT 0,
+ j_poste poste_comptable NOT NULL,
+ j_grpt integer NOT NULL,
+ j_rapt text,
+ j_jrn_def integer NOT NULL,
+ j_debit boolean DEFAULT true,
+ j_text text,
+ j_centralized boolean DEFAULT false,
+ j_internal text,
+ j_tech_user text NOT NULL,
+ j_tech_date timestamp without time zone DEFAULT now() NOT NULL,
+ j_tech_per integer NOT NULL,
+ j_qcode text
+);
+COMMENT ON TABLE jrnx IS 'Journal: content one line for each accountancy writing';
+CREATE TABLE parameter (
+ pr_id text NOT NULL,
+ pr_value text
+);
+CREATE TABLE parm_code (
+ p_code text NOT NULL,
+ p_value text,
+ p_comment text
+);
+CREATE TABLE parm_money (
+ pm_id integer DEFAULT nextval(('s_currency'::text)::regclass),
+ pm_code character(3) NOT NULL,
+ pm_rate numeric(20,4) NOT NULL
+);
+COMMENT ON TABLE parm_money IS 'Currency conversion';
+CREATE TABLE parm_periode (
+ p_id integer DEFAULT nextval(('s_periode'::text)::regclass) NOT NULL,
+ p_start date NOT NULL,
+ p_end date NOT NULL,
+ p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
+ p_closed boolean DEFAULT false,
+ p_central boolean DEFAULT false,
+ CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
+);
+COMMENT ON TABLE parm_periode IS 'Periode definition';
+CREATE TABLE quant_sold (
+ qs_id integer DEFAULT nextval(('s_quantity'::text)::regclass) NOT NULL,
+ qs_internal text NOT NULL,
+ qs_fiche integer NOT NULL,
+ qs_quantite numeric(20,4) NOT NULL,
+ qs_price numeric(20,4),
+ qs_vat numeric(20,4),
+ qs_vat_code integer,
+ qs_client integer NOT NULL
+);
+COMMENT ON TABLE quant_sold IS 'Contains about invoice for customer';
+CREATE SEQUENCE s_attr_def
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_cbc
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_central
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_central_order
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_centralized
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_currency
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_fdef
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_fiche
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_fiche_def_ref
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_form
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_formdef
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_grpt
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_idef
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_internal
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_invoice
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_isup
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jnt_fic_att_value
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_4
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_def
+ START WITH 5
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_op
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrn_rapt
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrnaction
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_jrnx
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_periode
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_quantity
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_stock_goods
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_user_act
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE s_user_jrn
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_1
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_2
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_3
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_4
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_5
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_6
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_7
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_8
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE SEQUENCE seq_doc_type_9
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+CREATE TABLE stock_goods (
+ sg_id integer DEFAULT nextval(('s_stock_goods'::text)::regclass) NOT NULL,
+ j_id integer,
+ f_id integer NOT NULL,
+ sg_code text,
+ sg_quantity numeric(8,4) DEFAULT 0,
+ sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
+ sg_date date,
+ sg_tech_date date DEFAULT now(),
+ sg_tech_user text,
+ sg_comment character varying(80),
+ sg_exercice character varying(4),
+ CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
+);
+COMMENT ON TABLE stock_goods IS 'About the goods';
+CREATE TABLE tmp_pcmn (
+ pcm_val poste_comptable NOT NULL,
+ pcm_lib text,
+ pcm_val_parent poste_comptable DEFAULT 0,
+ pcm_country character(2) DEFAULT 'BE'::bpchar NOT NULL
+);
+COMMENT ON TABLE tmp_pcmn IS 'Plan comptable minimum normalisé';
+CREATE TABLE tva_rate (
+ tva_id integer NOT NULL,
+ tva_label text NOT NULL,
+ tva_rate numeric(6,4) DEFAULT 0.0 NOT NULL,
+ tva_comment text,
+ tva_poste text
+);
+COMMENT ON TABLE tva_rate IS 'Rate of vat';
+CREATE TABLE user_local_pref (
+ user_id text NOT NULL,
+ parameter_type text NOT NULL,
+ parameter_value text
+);
+COMMENT ON TABLE user_local_pref IS 'The user''s local parameter ';
+COMMENT ON COLUMN user_local_pref.user_id IS 'user''s login ';
+COMMENT ON COLUMN user_local_pref.parameter_type IS 'the type of parameter ';
+COMMENT ON COLUMN user_local_pref.parameter_value IS 'the value of parameter ';
+CREATE TABLE user_sec_act (
+ ua_id integer DEFAULT nextval(('s_user_act'::text)::regclass) NOT NULL,
+ ua_login text,
+ ua_act_id integer
+);
+CREATE TABLE user_sec_jrn (
+ uj_id integer DEFAULT nextval(('s_user_jrn'::text)::regclass) NOT NULL,
+ uj_login text,
+ uj_jrn_id integer,
+ uj_priv text
+);
+CREATE TABLE version (
+ val integer
+);
+CREATE VIEW vw_client AS
+ SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 9);
+CREATE VIEW vw_fiche_attr AS
+ SELECT a.f_id, a.fd_id, a.av_text AS vw_name, b.av_text AS vw_sell, c.av_text AS vw_buy, d.av_text AS tva_code, tva_rate.tva_id, tva_rate.tva_rate, tva_rate.tva_label, e.av_text AS vw_addr, f.av_text AS vw_cp, j.av_text AS quick_code, fiche_def.frd_id FROM (((((((((SELECT fiche.f_id, fiche.fd_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 6)) b ON ((a.f_id = b.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 7)) c ON ((a.f_id = c.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 2)) d ON ((a.f_id = d.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 14)) e ON ((a.f_id = e.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 15)) f ON ((a.f_id = f.f_id))) LEFT JOIN (SELECT fiche.f_id, attr_value.av_text FROM (((fiche JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) JOIN attr_def USING (ad_id)) WHERE (jnt_fic_att_value.ad_id = 23)) j ON ((a.f_id = j.f_id))) LEFT JOIN tva_rate ON ((d.av_text = (tva_rate.tva_id)::text))) JOIN fiche_def USING (fd_id));
+CREATE VIEW vw_fiche_def AS
+ SELECT jnt_fic_attr.fd_id, jnt_fic_attr.ad_id, attr_def.ad_text, attr_value.av_text, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def.frd_id FROM (((((jnt_fic_att_value JOIN attr_value USING (jft_id)) JOIN fiche USING (f_id)) JOIN jnt_fic_attr USING (fd_id)) JOIN attr_def ON ((attr_def.ad_id = jnt_fic_attr.ad_id))) JOIN fiche_def USING (fd_id));
+COMMENT ON VIEW vw_fiche_def IS 'all the attributs for card family';
+CREATE VIEW vw_fiche_min AS
+ SELECT attr_min.frd_id, attr_min.ad_id, attr_def.ad_text, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base FROM ((attr_min JOIN attr_def USING (ad_id)) JOIN fiche_def_ref USING (frd_id));
+COMMENT ON VIEW vw_fiche_min IS 'minimum attribut for reference card';
+CREATE VIEW vw_poste_qcode AS
+ SELECT a.f_id, a.av_text AS j_poste, b.av_text AS j_qcode FROM ((SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) a JOIN (SELECT jnt_fic_att_value.f_id, attr_value.av_text FROM (attr_value JOIN jnt_fic_att_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) b USING (f_id));
+CREATE VIEW vw_supplier AS
+ SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 8);
+CREATE UNIQUE INDEX attr_value_jft_id ON attr_value USING btree (jft_id);
+CREATE UNIQUE INDEX fd_id_ad_id_x ON jnt_fic_attr USING btree (fd_id, ad_id);
+CREATE INDEX fk_stock_goods_f_id ON stock_goods USING btree (f_id);
+CREATE INDEX fk_stock_goods_j_id ON stock_goods USING btree (j_id);
+CREATE UNIQUE INDEX idx_case ON format_csv_banque USING btree (upper(name));
+CREATE INDEX idx_qs_internal ON quant_sold USING btree (qs_internal);
+CREATE UNIQUE INDEX ix_iv_name ON invoice USING btree (upper(iv_name));
+CREATE UNIQUE INDEX k_ag_ref ON action_gestion USING btree (ag_ref);
+CREATE UNIQUE INDEX x_jrn_jr_id ON jrn USING btree (jr_id);
+CREATE UNIQUE INDEX x_periode ON parm_periode USING btree (p_start, p_end);
+CREATE INDEX x_poste ON jrnx USING btree (j_poste);
CREATE TRIGGER tr_jrn_check_balance
AFTER INSERT ON jrn
FOR EACH ROW
@@ -1129,4 +1195,7 @@ CREATE TRIGGER trim_space
BEFORE INSERT OR UPDATE ON format_csv_banque
FOR EACH ROW
EXECUTE PROCEDURE trim_space_format_csv_banque();
-
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
diff --git a/html/admin/sql/mod2/sequence.sql b/html/admin/sql/mod2/sequence.sql
index 0e47b60cc..a52f72df9 100644
--- a/html/admin/sql/mod2/sequence.sql
+++ b/html/admin/sql/mod2/sequence.sql
@@ -5,11 +5,22 @@ CREATE SEQUENCE document_seq
NO MINVALUE
CACHE 1;
COMMENT ON SEQUENCE document_seq IS 'Sequence for the sequence bound to the document modele';
+CREATE SEQUENCE s_jnt_id
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE SEQUENCE s_attr_def
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
+CREATE SEQUENCE s_cbc
+ START WITH 1
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
CREATE SEQUENCE s_central
START WITH 1
INCREMENT BY 1
@@ -90,6 +101,7 @@ CREATE SEQUENCE s_isup
NO MINVALUE
CACHE 1;
CREATE SEQUENCE s_jnt_fic_att_value
+ START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
diff --git a/html/admin/sql/mod2/table.sql b/html/admin/sql/mod2/table.sql
index 353a4b57c..e5a3875df 100644
--- a/html/admin/sql/mod2/table.sql
+++ b/html/admin/sql/mod2/table.sql
@@ -1,3 +1,17 @@
+CREATE DOMAIN poste_comptable AS numeric(25,0);
+CREATE TABLE attr_def (
+ ad_id integer DEFAULT nextval(('s_attr_def'::text)::regclass) NOT NULL,
+ ad_text text
+);
+CREATE TABLE attr_min (
+ frd_id integer,
+ ad_id integer
+);
+CREATE TABLE fiche_def_ref (
+ frd_id integer DEFAULT nextval(('s_fiche_def_ref'::text)::regclass) NOT NULL,
+ frd_text text,
+ frd_class_base integer
+);
CREATE TABLE "action" (
ac_id integer NOT NULL,
ac_description text NOT NULL
@@ -14,20 +28,12 @@ CREATE TABLE action_gestion (
ag_comment text,
ag_ref text
);
-CREATE TABLE attr_def (
- ad_id integer DEFAULT nextval('s_attr_def'::text) NOT NULL,
- ad_text text
-);
-CREATE TABLE attr_min (
- frd_id integer,
- ad_id integer
-);
CREATE TABLE attr_value (
jft_id integer,
av_text text
);
CREATE TABLE centralized (
- c_id integer DEFAULT nextval('s_centralized'::text) NOT NULL,
+ c_id integer DEFAULT nextval(('s_centralized'::text)::regclass) NOT NULL,
c_j_id integer,
c_date date NOT NULL,
c_internal text NOT NULL,
@@ -68,23 +74,18 @@ CREATE TABLE document_type (
dt_value character varying(80)
);
CREATE TABLE fiche (
- f_id integer DEFAULT nextval('s_fiche'::text) NOT NULL,
+ f_id integer DEFAULT nextval(('s_fiche'::text)::regclass) NOT NULL,
fd_id integer
);
CREATE TABLE fiche_def (
- fd_id integer DEFAULT nextval('s_fdef'::text) NOT NULL,
+ fd_id integer DEFAULT nextval(('s_fdef'::text)::regclass) NOT NULL,
fd_class_base poste_comptable,
fd_label text NOT NULL,
fd_create_account boolean DEFAULT false,
frd_id integer NOT NULL
);
-CREATE TABLE fiche_def_ref (
- frd_id integer DEFAULT nextval('s_fiche_def_ref'::text) NOT NULL,
- frd_text text,
- frd_class_base integer
-);
CREATE TABLE form (
- fo_id integer DEFAULT nextval('s_form'::text) NOT NULL,
+ fo_id integer DEFAULT nextval(('s_form'::text)::regclass) NOT NULL,
fo_fr_id integer,
fo_pos integer,
fo_label text,
@@ -95,7 +96,7 @@ CREATE TABLE format_csv_banque (
include_file text NOT NULL
);
CREATE TABLE formdef (
- fr_id integer DEFAULT nextval('s_formdef'::text) NOT NULL,
+ fr_id integer DEFAULT nextval(('s_formdef'::text)::regclass) NOT NULL,
fr_label text
);
CREATE TABLE import_tmp (
@@ -108,26 +109,29 @@ CREATE TABLE import_tmp (
detail text,
num_compte text,
poste_comptable text,
- ok boolean DEFAULT false,
+ status character varying(1) DEFAULT 'n'::character varying NOT NULL,
bq_account integer NOT NULL,
- jrn integer NOT NULL
+ jrn integer NOT NULL,
+ jr_rapt text,
+ CONSTRAINT import_tmp_status_check CHECK ((((((status)::text = 'n'::text) OR ((status)::text = 't'::text)) OR ((status)::text = 'd'::text)) OR ((status)::text = 'w'::text)))
);
CREATE TABLE invoice (
- iv_id integer DEFAULT nextval('s_invoice'::text) NOT NULL,
+ iv_id integer DEFAULT nextval(('s_invoice'::text)::regclass) NOT NULL,
iv_name text NOT NULL,
iv_file oid
);
CREATE TABLE jnt_fic_att_value (
- jft_id integer DEFAULT nextval('s_jnt_fic_att_value'::text) NOT NULL,
+ jft_id integer DEFAULT nextval(('s_jnt_fic_att_value'::text)::regclass) NOT NULL,
f_id integer,
ad_id integer
);
CREATE TABLE jnt_fic_attr (
fd_id integer,
- ad_id integer
+ ad_id integer,
+ jnt_id bigint DEFAULT nextval('s_jnt_id'::regclass) NOT NULL
);
CREATE TABLE jrn (
- jr_id integer DEFAULT nextval('s_jrn'::text) NOT NULL,
+ jr_id integer DEFAULT nextval(('s_jrn'::text)::regclass) NOT NULL,
jr_def_id integer NOT NULL,
jr_montant numeric(20,4) NOT NULL,
jr_comment text,
@@ -147,7 +151,7 @@ CREATE TABLE jrn (
jr_pj_type text
);
CREATE TABLE jrn_action (
- ja_id integer DEFAULT nextval('s_jrnaction'::text) NOT NULL,
+ ja_id integer DEFAULT nextval(('s_jrnaction'::text)::regclass) NOT NULL,
ja_name text NOT NULL,
ja_desc text,
ja_url text NOT NULL,
@@ -156,7 +160,7 @@ CREATE TABLE jrn_action (
ja_jrn_type character(3)
);
CREATE TABLE jrn_def (
- jrn_def_id integer DEFAULT nextval('s_jrn_def'::text) NOT NULL,
+ jrn_def_id integer DEFAULT nextval(('s_jrn_def'::text)::regclass) NOT NULL,
jrn_def_name text NOT NULL,
jrn_def_class_deb text,
jrn_def_class_cred text,
@@ -170,7 +174,7 @@ CREATE TABLE jrn_def (
jrn_def_code text NOT NULL
);
CREATE TABLE jrn_rapt (
- jra_id integer DEFAULT nextval('s_jrn_rapt'::text) NOT NULL,
+ jra_id integer DEFAULT nextval(('s_jrn_rapt'::text)::regclass) NOT NULL,
jr_id integer NOT NULL,
jra_concerned integer NOT NULL
);
@@ -179,7 +183,7 @@ CREATE TABLE jrn_type (
jrn_desc text
);
CREATE TABLE jrnx (
- j_id integer DEFAULT nextval('s_jrn_op'::text) NOT NULL,
+ j_id integer DEFAULT nextval(('s_jrn_op'::text)::regclass) NOT NULL,
j_date date DEFAULT now(),
j_montant numeric(20,4) DEFAULT 0,
j_poste poste_comptable NOT NULL,
@@ -205,39 +209,41 @@ CREATE TABLE parm_code (
p_comment text
);
CREATE TABLE parm_money (
- pm_id integer DEFAULT nextval('s_currency'::text),
+ pm_id integer DEFAULT nextval(('s_currency'::text)::regclass),
pm_code character(3) NOT NULL,
pm_rate numeric(20,4) NOT NULL
);
CREATE TABLE parm_periode (
- p_id integer DEFAULT nextval('s_periode'::text) NOT NULL,
+ p_id integer DEFAULT nextval(('s_periode'::text)::regclass) NOT NULL,
p_start date NOT NULL,
- p_end date,
+ p_end date NOT NULL,
p_exercice text DEFAULT to_char(now(), 'YYYY'::text) NOT NULL,
p_closed boolean DEFAULT false,
p_central boolean DEFAULT false,
CONSTRAINT parm_periode_check CHECK ((p_end >= p_start))
);
CREATE TABLE quant_sold (
- qs_id integer DEFAULT nextval('s_quantity'::text) NOT NULL,
+ qs_id integer DEFAULT nextval(('s_quantity'::text)::regclass) NOT NULL,
qs_internal text NOT NULL,
qs_fiche integer NOT NULL,
- qs_quantite integer NOT NULL,
+ qs_quantite numeric(20,4) NOT NULL,
qs_price numeric(20,4),
qs_vat numeric(20,4),
qs_vat_code integer,
qs_client integer NOT NULL
);
CREATE TABLE stock_goods (
- sg_id integer DEFAULT nextval('s_stock_goods'::text) NOT NULL,
+ sg_id integer DEFAULT nextval(('s_stock_goods'::text)::regclass) NOT NULL,
j_id integer,
f_id integer NOT NULL,
sg_code text,
- sg_quantity integer DEFAULT 0,
+ sg_quantity numeric(8,4) DEFAULT 0,
sg_type character(1) DEFAULT 'c'::bpchar NOT NULL,
sg_date date,
sg_tech_date date DEFAULT now(),
sg_tech_user text,
+ sg_comment character varying(80),
+ sg_exercice character varying(4),
CONSTRAINT stock_goods_sg_type CHECK (((sg_type = 'c'::bpchar) OR (sg_type = 'd'::bpchar)))
);
CREATE TABLE tmp_pcmn (
@@ -259,12 +265,12 @@ CREATE TABLE user_local_pref (
parameter_value text
);
CREATE TABLE user_sec_act (
- ua_id integer DEFAULT nextval('s_user_act'::text) NOT NULL,
+ ua_id integer DEFAULT nextval(('s_user_act'::text)::regclass) NOT NULL,
ua_login text,
ua_act_id integer
);
CREATE TABLE user_sec_jrn (
- uj_id integer DEFAULT nextval('s_user_jrn'::text) NOT NULL,
+ uj_id integer DEFAULT nextval(('s_user_jrn'::text)::regclass) NOT NULL,
uj_login text,
uj_jrn_id integer,
uj_priv text
diff --git a/html/admin/sql/mod2/view.sql b/html/admin/sql/mod2/view.sql
index 8623b5a36..1083ac64b 100644
--- a/html/admin/sql/mod2/view.sql
+++ b/html/admin/sql/mod2/view.sql
@@ -1,3 +1,5 @@
+CREATE VIEW "Vw_attr_min" AS
+ SELECT a.frd_id, a.ad_id, attr_def.ad_text, fiche_def_ref.frd_text FROM ((attr_min a JOIN attr_def USING (ad_id)) JOIN fiche_def_ref USING (frd_id));
CREATE VIEW vw_client AS
SELECT a.f_id, a.av_text AS name, a1.av_text AS quick_code, b.av_text AS tva_num, c.av_text AS poste_comptable, d.av_text AS rue, e.av_text AS code_postal, f.av_text AS pays, g.av_text AS telephone, h.av_text AS email FROM (((((((((SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 1)) a JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 13)) b USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 23)) a1 USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 5)) c USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 14)) d USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 15)) e USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 16)) f USING (f_id)) JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 17)) g USING (f_id)) LEFT JOIN (SELECT jnt_fic_att_value.jft_id, fiche.f_id, fiche_def.frd_id, fiche.fd_id, fiche_def.fd_class_base, fiche_def.fd_label, fiche_def.fd_create_account, fiche_def_ref.frd_text, fiche_def_ref.frd_class_base, jnt_fic_att_value.ad_id, attr_value.av_text FROM ((((fiche JOIN fiche_def USING (fd_id)) JOIN fiche_def_ref USING (frd_id)) JOIN jnt_fic_att_value USING (f_id)) JOIN attr_value USING (jft_id)) WHERE (jnt_fic_att_value.ad_id = 18)) h USING (f_id)) WHERE (a.frd_id = 9);
CREATE VIEW vw_fiche_attr AS