|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
<ROOT>
|
|
|
|
|
|
|
|
|
<NODE name="INIT" label="INITIALISATIONS">
|
|
|
|
|
|
<NODE label="Tables Articles">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM base.t_lpp
|
|
|
WHERE oid <> 0
|
|
|
', 'temp e_lpp'
|
|
|
);
|
|
|
|
|
|
INSERT INTO base.t_lpp(
|
|
|
code,
|
|
|
texte,
|
|
|
texte_court)
|
|
|
SELECT
|
|
|
code,
|
|
|
texte,
|
|
|
texte_court
|
|
|
FROM e_lpp
|
|
|
WHERE code NOT IN (SELECT code FROM base.t_lpp WHERE code IS NOT NULL);
|
|
|
|
|
|
DROP TABLE IF EXISTS c_lpp;
|
|
|
CREATE TEMP TABLE c_lpp AS
|
|
|
SELECT
|
|
|
e_lpp.oid AS from_oid,
|
|
|
COALESCE(t_lpp.oid,0) AS to_oid
|
|
|
FROM e_lpp
|
|
|
LEFT JOIN base.t_lpp ON e_lpp.code = t_lpp.code
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM base.t_ucd
|
|
|
WHERE oid <> 0
|
|
|
', 'temp e_ucd'
|
|
|
);
|
|
|
|
|
|
INSERT INTO base.t_ucd(
|
|
|
code,
|
|
|
texte,
|
|
|
texte_court,
|
|
|
laboratoire_texte,
|
|
|
conditionnement_texte,
|
|
|
atc_code,
|
|
|
atc_texte,
|
|
|
ephmra_code,
|
|
|
ephmra_texte,
|
|
|
prestation_defaut_id)
|
|
|
SELECT
|
|
|
code,
|
|
|
texte,
|
|
|
texte_court,
|
|
|
laboratoire_texte,
|
|
|
conditionnement_texte,
|
|
|
atc_code,
|
|
|
atc_texte,
|
|
|
ephmra_code,
|
|
|
ephmra_texte,
|
|
|
0
|
|
|
FROM e_ucd
|
|
|
WHERE code NOT IN (SELECT code FROM base.t_ucd WHERE code IS NOT NULL);
|
|
|
|
|
|
DROP TABLE IF EXISTS c_ucd;
|
|
|
CREATE TEMP TABLE c_ucd AS
|
|
|
SELECT
|
|
|
e_ucd.oid AS from_oid,
|
|
|
COALESCE(t_ucd.oid,0) AS to_oid
|
|
|
FROM e_ucd
|
|
|
LEFT JOIN base.t_ucd ON e_ucd.code = t_ucd.code
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_articles
|
|
|
', 'temp e_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_articles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_articles(
|
|
|
article_reference_cacic_code, article_reference_cacic_id, article_reference_cacic_section_code,
|
|
|
article_reference_cacic_section_id, article_reference_cacic_section_texte,
|
|
|
article_reference_cacic_texte, article_reference_cti_code, article_reference_cti_id,
|
|
|
article_reference_cti_section_code, article_reference_cti_section_id,
|
|
|
article_reference_cti_section_texte, article_reference_cti_texte,
|
|
|
categorie_code, categorie_id, categorie_section_code, categorie_section_id,
|
|
|
categorie_section_texte, categorie_texte, classification_atc_1_code,
|
|
|
classification_atc_1_id, classification_atc_1_texte, classification_atc_2_code,
|
|
|
classification_atc_2_id, classification_atc_2_texte, classification_atc_3_code,
|
|
|
classification_atc_3_id, classification_atc_3_texte, classification_atc_4_code,
|
|
|
classification_atc_4_id, classification_atc_4_texte, classification_atc_code,
|
|
|
classification_atc_id, classification_atc_section_code, classification_atc_section_id,
|
|
|
classification_atc_section_texte, classification_atc_texte, code,
|
|
|
code_original, compte_code, compte_id, compte_section_code, compte_section_id,
|
|
|
compte_section_texte, compte_texte, est_inactif, famille_code,
|
|
|
famille_id, famille_section_code, famille_section_id, famille_section_texte,
|
|
|
famille_texte, gere_en_stock, lpp_id, oid, ref_fournisseur_id,
|
|
|
ref_fournisseur_texte, section_code, section_id, section_texte,
|
|
|
sous_categorie_code, sous_categorie_id, sous_categorie_section_code,
|
|
|
sous_categorie_section_id, sous_categorie_section_texte, sous_categorie_texte,
|
|
|
sous_famille_code, sous_famille_id, sous_famille_section_code,
|
|
|
sous_famille_section_id, sous_famille_section_texte, sous_famille_texte,
|
|
|
texte, texte_court, type_code, type_id, type_prorata_tva, type_section_code,
|
|
|
type_section_id, type_section_texte, type_texte, type_valorisation_cti_stock,
|
|
|
ucd_id, unite_distribution_code, unite_distribution_id, unite_distribution_section_code,
|
|
|
unite_distribution_section_id, unite_distribution_section_texte,
|
|
|
unite_distribution_texte, unite_stockage_code, unite_stockage_id,
|
|
|
unite_stockage_section_code, unite_stockage_section_id, unite_stockage_section_texte,
|
|
|
unite_stockage_texte, fournisseur_principal_id, taux_tva_en_cours)
|
|
|
SELECT
|
|
|
article_reference_cacic_code, article_reference_cacic_id, article_reference_cacic_section_code,
|
|
|
article_reference_cacic_section_id, article_reference_cacic_section_texte,
|
|
|
article_reference_cacic_texte, article_reference_cti_code, article_reference_cti_id,
|
|
|
article_reference_cti_section_code, article_reference_cti_section_id,
|
|
|
article_reference_cti_section_texte, article_reference_cti_texte,
|
|
|
categorie_code, categorie_id, categorie_section_code, categorie_section_id,
|
|
|
categorie_section_texte, categorie_texte, classification_atc_1_code,
|
|
|
classification_atc_1_id, classification_atc_1_texte, classification_atc_2_code,
|
|
|
classification_atc_2_id, classification_atc_2_texte, classification_atc_3_code,
|
|
|
classification_atc_3_id, classification_atc_3_texte, classification_atc_4_code,
|
|
|
classification_atc_4_id, classification_atc_4_texte, classification_atc_code,
|
|
|
classification_atc_id, classification_atc_section_code, classification_atc_section_id,
|
|
|
classification_atc_section_texte, classification_atc_texte, code,
|
|
|
code_original, compte_code, compte_id, compte_section_code, compte_section_id,
|
|
|
compte_section_texte, compte_texte, est_inactif, famille_code,
|
|
|
famille_id, famille_section_code, famille_section_id, famille_section_texte,
|
|
|
famille_texte, gere_en_stock, COALESCE(c_lpp.to_oid,0) AS lpp_id, oid, ref_fournisseur_id,
|
|
|
ref_fournisseur_texte, section_code, section_id, section_texte,
|
|
|
sous_categorie_code, sous_categorie_id, sous_categorie_section_code,
|
|
|
sous_categorie_section_id, sous_categorie_section_texte, sous_categorie_texte,
|
|
|
sous_famille_code, sous_famille_id, sous_famille_section_code,
|
|
|
sous_famille_section_id, sous_famille_section_texte, sous_famille_texte,
|
|
|
texte, texte_court, type_code, type_id, type_prorata_tva, type_section_code,
|
|
|
type_section_id, type_section_texte, type_texte, type_valorisation_cti_stock,
|
|
|
COALESCE(c_ucd.to_oid,0) AS ucd_id, unite_distribution_code, unite_distribution_id, unite_distribution_section_code,
|
|
|
unite_distribution_section_id, unite_distribution_section_texte,
|
|
|
unite_distribution_texte, unite_stockage_code, unite_stockage_id,
|
|
|
unite_stockage_section_code, unite_stockage_section_id, unite_stockage_section_texte,
|
|
|
unite_stockage_texte, fournisseur_principal_id, taux_tva_en_cours
|
|
|
FROM e_articles
|
|
|
LEFT JOIN c_ucd ON ucd_id = c_ucd.from_oid
|
|
|
LEFT JOIN c_lpp ON lpp_id = c_lpp.from_oid
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_articles)
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_categories_articles
|
|
|
', 'temp e_categories_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_categories_articles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_categories_articles(code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_categories_articles
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_categories_articles)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_classification_atc
|
|
|
', 'temp e_classification_atc'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_classification_atc;
|
|
|
|
|
|
INSERT INTO eco.t_classification_atc(
|
|
|
classification_atc_1_code, classification_atc_1_id, classification_atc_1_texte,
|
|
|
classification_atc_2_code, classification_atc_2_id, classification_atc_2_texte,
|
|
|
classification_atc_3_code, classification_atc_3_id, classification_atc_3_texte,
|
|
|
classification_atc_4_code, classification_atc_4_id, classification_atc_4_texte,
|
|
|
code, code_original, est_atc, est_cladimed, oid, section_code,
|
|
|
section_id, section_texte, texte, texte_court)
|
|
|
SELECT
|
|
|
classification_atc_1_code, classification_atc_1_id, classification_atc_1_texte,
|
|
|
classification_atc_2_code, classification_atc_2_id, classification_atc_2_texte,
|
|
|
classification_atc_3_code, classification_atc_3_id, classification_atc_3_texte,
|
|
|
classification_atc_4_code, classification_atc_4_id, classification_atc_4_texte,
|
|
|
code, code_original, est_atc, est_cladimed, oid, section_code,
|
|
|
section_id, section_texte, texte, texte_court
|
|
|
FROM e_classification_atc
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_classification_atc)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_compte
|
|
|
', 'temp e_compte'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_compte;
|
|
|
|
|
|
INSERT INTO eco.t_compte(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte, type_prorata_tva)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte, type_prorata_tva
|
|
|
FROM e_compte
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_compte)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_familles_articles
|
|
|
', 'temp e_familles_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_familles_articles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_familles_articles(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_familles_articles
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_familles_articles)
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_gestionnaires
|
|
|
', 'temp e_gestionnaires'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_gestionnaires
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_gestionnaires(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_gestionnaires
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_gestionnaires)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_lieux
|
|
|
', 'temp e_lieux'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_lieux
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_lieux(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_lieux
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_lieux)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_sous_familles_articles
|
|
|
', 'temp e_sous_familles_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_sous_familles_articles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_sous_familles_articles(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_sous_familles_articles
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_sous_familles_articles)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_sous_categories_articles
|
|
|
', 'temp e_sous_categories_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_sous_categories_articles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_sous_categories_articles(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_sous_categories_articles
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_sous_categories_articles)
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_types_articles
|
|
|
', 'temp e_types_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_types_articles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_types_articles(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_types_articles
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_types_articles)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_unites
|
|
|
', 'temp e_unites'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_unites
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_unites(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_unites
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_unites)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_unites_fonctionnelles
|
|
|
', 'temp e_unites_fonctionnelles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_unites_fonctionnelles
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_unites_fonctionnelles(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_unites_fonctionnelles
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_unites_fonctionnelles)
|
|
|
;
|
|
|
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
<NODE label="Tables Fournisseurs">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_fournisseurs
|
|
|
', 'temp e_fournisseurs'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_fournisseurs
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_fournisseurs(
|
|
|
code, code_original, fournisseur_reference_cacic_code, fournisseur_reference_cacic_id,
|
|
|
fournisseur_reference_cacic_section_code, fournisseur_reference_cacic_section_id,
|
|
|
fournisseur_reference_cacic_section_texte, fournisseur_reference_cacic_texte,
|
|
|
fournisseur_reference_cti_code, fournisseur_reference_cti_id,
|
|
|
fournisseur_reference_cti_section_code, fournisseur_reference_cti_section_id,
|
|
|
fournisseur_reference_cti_section_texte, fournisseur_reference_cti_texte,
|
|
|
oid, section_code, section_id, section_texte, texte, texte_court,
|
|
|
type_code, type_id, type_section_code, type_section_id, type_section_texte,
|
|
|
type_texte)
|
|
|
SELECT
|
|
|
code, code_original, fournisseur_reference_cacic_code, fournisseur_reference_cacic_id,
|
|
|
fournisseur_reference_cacic_section_code, fournisseur_reference_cacic_section_id,
|
|
|
fournisseur_reference_cacic_section_texte, fournisseur_reference_cacic_texte,
|
|
|
fournisseur_reference_cti_code, fournisseur_reference_cti_id,
|
|
|
fournisseur_reference_cti_section_code, fournisseur_reference_cti_section_id,
|
|
|
fournisseur_reference_cti_section_texte, fournisseur_reference_cti_texte,
|
|
|
oid, section_code, section_id, section_texte, texte, texte_court,
|
|
|
type_code, type_id, type_section_code, type_section_id, type_section_texte,
|
|
|
type_texte
|
|
|
FROM e_fournisseurs
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_fournisseurs)
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_types_fournisseurs
|
|
|
', 'temp e_types_fournisseurs'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_types_fournisseurs
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_types_fournisseurs(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_types_fournisseurs
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_types_fournisseurs)
|
|
|
;
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
<NODE label="Poles">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM base.t_pole
|
|
|
', 'temp e_pole'
|
|
|
);
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_pole_rule
|
|
|
', 'temp e_pole_rule'
|
|
|
);
|
|
|
|
|
|
TRUNCATE base.t_pole;
|
|
|
INSERT INTO base.t_pole
|
|
|
(oid, code, texte, texte_court, section_id, section_code, section_texte)
|
|
|
SELECT oid, code, texte, texte_court, section_id, section_code, section_texte
|
|
|
FROM e_pole
|
|
|
;
|
|
|
TRUNCATE eco.t_pole;
|
|
|
INSERT INTO eco.t_pole
|
|
|
(oid, code, texte, texte_court, section_id, section_code, section_texte)
|
|
|
SELECT oid, code, texte, texte_court, section_id, section_code, section_texte
|
|
|
FROM e_pole
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_pole_rule;
|
|
|
|
|
|
INSERT INTO eco.t_pole_rule
|
|
|
(oid, code, texte, pole_id, priorite, liste_finess, liste_site, liste_unite_fonctionnelle)
|
|
|
SELECT oid, code, texte, pole_id, priorite, liste_finess, liste_site, liste_unite_fonctionnelle
|
|
|
FROM e_pole_rule
|
|
|
;
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
|
|
|
|
|
|
<NODE label="Autres tables">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_sites
|
|
|
WHERE code = ANY (string_to_array(''[ETAB]'','' '')) OR oid = 0
|
|
|
', 'temp e_sites'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.t_sites(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_sites
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_sites)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_types_mouvements
|
|
|
', 'temp e_types_mouvements'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_types_mouvements
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_types_mouvements(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_types_mouvements
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_types_mouvements)
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_centres_responsabilites
|
|
|
', 'temp e_centres_responsabilites'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_centres_responsabilites
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_centres_responsabilites(
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte)
|
|
|
SELECT
|
|
|
code, code_original, oid, texte_court, texte, section_code, section_id, section_texte
|
|
|
FROM e_centres_responsabilites
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_centres_responsabilites)
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_profils
|
|
|
', 'temp e_profils'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_profils
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_profils(
|
|
|
article_id, categorie_article_id, classification_atc_id, compte_id,
|
|
|
famille_article_id, fournisseur_id, gestionnaire_id, lieu_id,
|
|
|
sous_categorie_article_id, sous_famille_article_id, type_article_id,
|
|
|
unite_fonctionnelle_id)
|
|
|
SELECT
|
|
|
article_id, categorie_article_id, classification_atc_id, compte_id,
|
|
|
famille_article_id, fournisseur_id, gestionnaire_id, lieu_id,
|
|
|
sous_categorie_article_id, sous_famille_article_id, type_article_id,
|
|
|
unite_fonctionnelle_id
|
|
|
FROM e_profils
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_profils_comptables
|
|
|
', 'temp e_profils_comptables'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.t_profils_comptables
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_profils_comptables(
|
|
|
centre_responsabilite_code, centre_responsabilite_id, centre_responsabilite_section_code,
|
|
|
centre_responsabilite_section_id, centre_responsabilite_section_texte,
|
|
|
centre_responsabilite_texte, code_original, oid, unite_fonctionnelle_code,
|
|
|
unite_fonctionnelle_id, unite_fonctionnelle_section_code, unite_fonctionnelle_section_id,
|
|
|
unite_fonctionnelle_section_texte, unite_fonctionnelle_texte)
|
|
|
SELECT
|
|
|
centre_responsabilite_code, centre_responsabilite_id, centre_responsabilite_section_code,
|
|
|
centre_responsabilite_section_id, centre_responsabilite_section_texte,
|
|
|
centre_responsabilite_texte, code_original, oid, unite_fonctionnelle_code,
|
|
|
unite_fonctionnelle_id, unite_fonctionnelle_section_code, unite_fonctionnelle_section_id,
|
|
|
unite_fonctionnelle_section_texte, unite_fonctionnelle_texte
|
|
|
FROM e_profils_comptables
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_profils_comptables)
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_listes_tables
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_listes_tables
|
|
|
', 'temp e_listes_tables'
|
|
|
)
|
|
|
;
|
|
|
|
|
|
INSERT INTO eco.t_listes_tables
|
|
|
SELECT * FROM e_listes_tables
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_classes
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_classes
|
|
|
', 'temp e_classes'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.t_classes
|
|
|
SELECT * FROM e_classes
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_classes_sections
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_classes_sections
|
|
|
', 'temp e_classes_sections'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.t_classes_sections
|
|
|
SELECT * FROM e_classes_sections
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_classes_sections_elements
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_classes_sections_elements
|
|
|
', 'temp e_classes_sections_elements'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.t_classes_sections_elements
|
|
|
SELECT * FROM e_classes_sections_elements
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_listes
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_listes
|
|
|
', 'temp e_listes'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.t_listes
|
|
|
SELECT * FROM e_listes
|
|
|
WHERE oid NOT IN (SELECT oid FROM eco.t_listes)
|
|
|
;
|
|
|
|
|
|
TRUNCATE eco.t_listes_contenu
|
|
|
;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.t_listes_contenu
|
|
|
', 'temp e_listes_contenu'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.t_listes_contenu
|
|
|
SELECT * FROM e_listes_contenu
|
|
|
;
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
|
|
|
</NODE>
|
|
|
<NODE name="PROD" label="RECUPERATION DES DONNEES DE PRODUCTION">
|
|
|
|
|
|
<NODE label="Commandes">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_1');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_2');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_3');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_4');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_5');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_6');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_7');
|
|
|
SELECT base.cti_disable_index('eco', 'i_commandes_8');
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.p_commandes
|
|
|
WHERE site_id = ANY(SELECT oid FROM eco.t_sites WHERE code = ANY (string_to_array(''[ETAB] '','' '')))
|
|
|
', 'temp e_commandes'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.p_commandes;
|
|
|
|
|
|
INSERT INTO eco.p_commandes(
|
|
|
code_original, date_commande, date_engagement, date_livraison_prevue,
|
|
|
date_reception, etat_liquidation, etat_reception, fournisseur_id,
|
|
|
gestionnaire_id, lieu_commande_id, lieu_facturation_id, lieu_livraison_id,
|
|
|
montant_commande_ht, montant_commande_port, montant_commande_remise,
|
|
|
montant_commande_total, montant_commande_tva, montant_liquidation_ht,
|
|
|
montant_liquidation_port, montant_liquidation_remise, montant_liquidation_total,
|
|
|
montant_liquidation_tva, numero, objet, oid, provider_id, reference,
|
|
|
unite_fonctionnelle_id, site_id)
|
|
|
SELECT
|
|
|
code_original, date_commande, date_engagement, date_livraison_prevue,
|
|
|
date_reception, etat_liquidation, etat_reception, fournisseur_id,
|
|
|
gestionnaire_id, lieu_commande_id, lieu_facturation_id, lieu_livraison_id,
|
|
|
montant_commande_ht, montant_commande_port, montant_commande_remise,
|
|
|
montant_commande_total, montant_commande_tva, montant_liquidation_ht,
|
|
|
montant_liquidation_port, montant_liquidation_remise, montant_liquidation_total,
|
|
|
montant_liquidation_tva, numero, objet, oid, provider_id, reference,
|
|
|
unite_fonctionnelle_id, site_id
|
|
|
FROM e_commandes;
|
|
|
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_1');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_2');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_3');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_4');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_5');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_6');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_7');
|
|
|
SELECT base.cti_enable_index('eco', 'i_commandes_8');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT base.cti_disable_index('eco', 'i_ligne_commandes_1');
|
|
|
SELECT base.cti_disable_index('eco', 'i_ligne_commandes_2');
|
|
|
SELECT base.cti_disable_index('eco', 'i_ligne_commandes_3');
|
|
|
|
|
|
TRUNCATE eco.p_lignes_commandes;
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT p_lignes_commandes.*
|
|
|
FROM eco.p_lignes_commandes
|
|
|
JOIN eco.p_commandes ON p_lignes_commandes.commande_id = p_commandes.oid
|
|
|
WHERE site_id = ANY(SELECT oid FROM eco.t_sites WHERE code = ANY (string_to_array(''[ETAB] '','' '')))
|
|
|
', 'temp e_lignes_commandes'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.p_lignes_commandes(
|
|
|
article_id, article_texte_specifique, code_original, commande_id,
|
|
|
compte_id, etat_liquidation, etat_livraison, ligne_commande,
|
|
|
lpp_id, montant_commande_ht, montant_commande_port, montant_commande_remise,
|
|
|
montant_commande_ttc, montant_commande_tva, montant_liquidation_ht,
|
|
|
montant_liquidation_port, montant_liquidation_remise, montant_liquidation_ttc,
|
|
|
montant_liquidation_tva, montant_livraison_ht, montant_livraison_ttc,
|
|
|
montant_livraison_tva, multiplicateur_stockage, oid, prix_unitaire_approvisionnement,
|
|
|
prix_unitaire_stockage, quantite_approvisionnement, quantite_livraison_approvisionnement,
|
|
|
quantite_livraison_stockage, quantite_stockage, taux_prorata_tva,
|
|
|
texte, ucd_id, unite_approvisionnement_id, taux_tva)
|
|
|
SELECT
|
|
|
article_id, article_texte_specifique, code_original, commande_id,
|
|
|
compte_id, etat_liquidation, etat_livraison, ligne_commande,
|
|
|
COALESCE(c_lpp.to_oid,0) AS lpp_id, montant_commande_ht, montant_commande_port, montant_commande_remise,
|
|
|
montant_commande_ttc, montant_commande_tva, montant_liquidation_ht,
|
|
|
montant_liquidation_port, montant_liquidation_remise, montant_liquidation_ttc,
|
|
|
montant_liquidation_tva, montant_livraison_ht, montant_livraison_ttc,
|
|
|
montant_livraison_tva, multiplicateur_stockage, oid, prix_unitaire_approvisionnement,
|
|
|
prix_unitaire_stockage, quantite_approvisionnement, quantite_livraison_approvisionnement,
|
|
|
quantite_livraison_stockage, quantite_stockage, taux_prorata_tva,
|
|
|
texte, COALESCE(c_ucd.to_oid,0) AS ucd_id, unite_approvisionnement_id, taux_tva
|
|
|
FROM e_lignes_commandes
|
|
|
LEFT JOIN c_ucd ON ucd_id = c_ucd.from_oid
|
|
|
LEFT JOIN c_lpp ON lpp_id = c_lpp.from_oid
|
|
|
;
|
|
|
|
|
|
|
|
|
SELECT base.cti_enable_index('eco', 'i_ligne_commandes_1');
|
|
|
SELECT base.cti_enable_index('eco', 'i_ligne_commandes_2');
|
|
|
SELECT base.cti_enable_index('eco', 'i_ligne_commandes_3');
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
<NODE label="Mouvements">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_1');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_2');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_3');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_4');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_5');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_6');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_7');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_8');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_9');
|
|
|
SELECT base.cti_disable_index('eco', 'i_mouvements_articles_10');
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.p_mouvements_articles
|
|
|
WHERE site_id = ANY(SELECT oid FROM eco.t_sites WHERE code = ANY (string_to_array(''[ETAB] '','' '')))
|
|
|
', 'temp e_mouvements_articles'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.p_mouvements_articles;
|
|
|
|
|
|
INSERT INTO eco.p_mouvements_articles(
|
|
|
code_original, article_id, commande_id, compte_id, date, entree_montant, entree_montant_ht,
|
|
|
entree_quantite, fournisseur_id, gestionnaire_id, lieu_id, ligne_commande,
|
|
|
lpp_id, oid, prix_unitaire, prix_unitaire_calcule, profil_comptable_id,
|
|
|
provider_id, sens_mouvement, sortie_montant, sortie_montant_calcule,
|
|
|
sortie_montant_ht, sortie_montant_original_ht, sortie_montant_original_ttc,
|
|
|
sortie_quantite, stock_quantite_debut, stock_quantite_fin, taux_prorata_tva,
|
|
|
texte, type_mouvement_id, ucd_id, unite_fonctionnelle_id, site_id, pole_id,
|
|
|
date_fin, est_dernier_jour, est_premier_jour, medecin_reference_id,
|
|
|
no_patient, no_sejour, montant_ligne_facture, quantite_ligne_facture)
|
|
|
SELECT
|
|
|
e_mouvements_articles.code_original, article_id, commande_id, compte_id, date, entree_montant, entree_montant_ht,
|
|
|
entree_quantite, fournisseur_id, gestionnaire_id, lieu_id, ligne_commande,
|
|
|
COALESCE(c_lpp.to_oid,0) AS lpp_id, oid, prix_unitaire, prix_unitaire_calcule, profil_comptable_id,
|
|
|
provider_id, sens_mouvement, sortie_montant, sortie_montant_calcule,
|
|
|
sortie_montant_ht, sortie_montant_original_ht, sortie_montant_original_ttc,
|
|
|
sortie_quantite, stock_quantite_debut, stock_quantite_fin, taux_prorata_tva,
|
|
|
texte, type_mouvement_id, COALESCE(c_ucd.to_oid,0) AS ucd_id, unite_fonctionnelle_id, site_id, pole_id,
|
|
|
date_fin, est_dernier_jour, est_premier_jour, medecin_reference_id,
|
|
|
no_patient, no_sejour, montant_ligne_facture, quantite_ligne_facture
|
|
|
FROM e_mouvements_articles
|
|
|
LEFT JOIN c_ucd ON ucd_id = c_ucd.from_oid
|
|
|
LEFT JOIN c_lpp ON lpp_id = c_lpp.from_oid;
|
|
|
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_1');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_2');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_3');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_4');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_5');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_6');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_7');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_8');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_9');
|
|
|
SELECT base.cti_enable_index('eco', 'i_mouvements_articles_10');
|
|
|
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
|
|
|
<NODE label="Stocks">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
SELECT base.cti_disable_index('eco', 'i_stock_1');
|
|
|
SELECT base.cti_disable_index('eco', 'i_stock_2');
|
|
|
SELECT base.cti_disable_index('eco', 'i_stock_3');
|
|
|
SELECT base.cti_disable_index('eco', 'i_stock_4');
|
|
|
SELECT base.cti_disable_index('eco', 'i_stock_5');
|
|
|
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.p_stock
|
|
|
WHERE site_id = ANY(SELECT oid FROM eco.t_sites WHERE code = ANY (string_to_array(''[ETAB] '','' '')))
|
|
|
', 'temp e_stocks'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.p_stock;
|
|
|
|
|
|
INSERT INTO eco.p_stock(
|
|
|
article_id, compte_id, date_debut, date_fin, entree_montant,
|
|
|
entree_quantite, lieu_id, lpp_id, oid, provider_id, pump, sortie_montant,
|
|
|
sortie_quantite, stock_quantite_debut, stock_quantite_fin, stock_valeur_debut,
|
|
|
stock_valeur_fin, ucd_id, entree_montant_ttc, pump_ttc, site_id,
|
|
|
sortie_montant_ttc, stock_valeur_debut_ttc, stock_valeur_fin_ttc)
|
|
|
SELECT
|
|
|
article_id, compte_id, date_debut, date_fin, entree_montant,
|
|
|
entree_quantite, lieu_id, COALESCE(c_lpp.to_oid,0) AS lpp_id, oid, provider_id, pump, sortie_montant,
|
|
|
sortie_quantite, stock_quantite_debut, stock_quantite_fin, stock_valeur_debut,
|
|
|
stock_valeur_fin, COALESCE(c_ucd.to_oid,0) AS ucd_id, entree_montant_ttc, pump_ttc, site_id,
|
|
|
sortie_montant_ttc, stock_valeur_debut_ttc, stock_valeur_fin_ttc
|
|
|
FROM e_stocks
|
|
|
LEFT JOIN c_ucd ON ucd_id = c_ucd.from_oid
|
|
|
LEFT JOIN c_lpp ON lpp_id = c_lpp.from_oid;
|
|
|
|
|
|
|
|
|
SELECT base.cti_enable_index('eco', 'i_stock_1');
|
|
|
SELECT base.cti_enable_index('eco', 'i_stock_2');
|
|
|
SELECT base.cti_enable_index('eco', 'i_stock_3');
|
|
|
SELECT base.cti_enable_index('eco', 'i_stock_4');
|
|
|
SELECT base.cti_enable_index('eco', 'i_stock_5');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
|
|
|
|
|
|
|
|
|
<NODE label="Factures">
|
|
|
<sqlcmd><![CDATA[
|
|
|
|
|
|
|
|
|
SELECT base.cti_disable_index('eco', 'i_facture_1');
|
|
|
SELECT base.cti_disable_index('eco', 'i_facture_2');
|
|
|
SELECT base.cti_disable_index('eco', 'i_facture_3');
|
|
|
SELECT base.cti_disable_index('eco', 'i_facture_4');
|
|
|
SELECT base.cti_disable_index('eco', 'i_facture_5');
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT *
|
|
|
FROM eco.p_facture
|
|
|
WHERE site_id = ANY(SELECT oid FROM eco.t_sites WHERE code = ANY (string_to_array(''[ETAB] '','' '')))
|
|
|
', 'temp e_facture'
|
|
|
);
|
|
|
|
|
|
TRUNCATE eco.p_facture;
|
|
|
|
|
|
INSERT INTO eco.p_facture(
|
|
|
code_original, commande_id, date_facture, fournisseur_id, montant_facture_article_ht,
|
|
|
montant_facture_article_ttc, montant_facture_article_tva, montant_facture_ht,
|
|
|
montant_facture_port_ht, montant_facture_port_ttc, montant_facture_port_tva,
|
|
|
montant_facture_ttc, montant_facture_tva, no_facture, no_liquidation,
|
|
|
oid, provider_id, texte, date_reglement)
|
|
|
SELECT
|
|
|
code_original, commande_id, date_facture, fournisseur_id, montant_facture_article_ht,
|
|
|
montant_facture_article_ttc, montant_facture_article_tva, montant_facture_ht,
|
|
|
montant_facture_port_ht, montant_facture_port_ttc, montant_facture_port_tva,
|
|
|
montant_facture_ttc, montant_facture_tva, no_facture, no_liquidation,
|
|
|
oid, provider_id, texte, date_reglement
|
|
|
FROM e_facture;
|
|
|
|
|
|
|
|
|
SELECT base.cti_enable_index('eco', 'i_facture_1');
|
|
|
SELECT base.cti_enable_index('eco', 'i_facture_2');
|
|
|
SELECT base.cti_enable_index('eco', 'i_facture_3');
|
|
|
SELECT base.cti_enable_index('eco', 'i_facture_4');
|
|
|
SELECT base.cti_enable_index('eco', 'i_facture_5');
|
|
|
|
|
|
SELECT base.cti_disable_index('eco', 'i_lignes_facture_1');
|
|
|
SELECT base.cti_disable_index('eco', 'i_lignes_facture_2');
|
|
|
SELECT base.cti_disable_index('eco', 'i_lignes_facture_3');
|
|
|
SELECT base.cti_disable_index('eco', 'i_lignes_facture_4');
|
|
|
|
|
|
|
|
|
SELECT base.cti_copy_table('dbname=[DBNAME] port=[DBPORT] host=[DBHOST] user=[DBUSER] password=[DBPASSWORD]', '
|
|
|
SELECT p_lignes_facture.*
|
|
|
FROM eco.p_lignes_facture
|
|
|
JOIN eco.p_facture ON p_lignes_facture.facture_id = p_facture.oid
|
|
|
WHERE site_id = ANY(SELECT oid FROM eco.t_sites WHERE code = ANY (string_to_array(''[ETAB] '','' '')))
|
|
|
', 'temp e_lignes_facture'
|
|
|
);
|
|
|
|
|
|
INSERT INTO eco.p_lignes_facture(
|
|
|
article_id, code_original, compte_id, facture_id, ligne_commande,
|
|
|
ligne_commande_id, montant_facture_article_ht, montant_facture_article_ttc,
|
|
|
montant_facture_article_tva, montant_facture_ht, montant_facture_port_ht,
|
|
|
montant_facture_port_ttc, montant_facture_port_tva, montant_facture_ttc,
|
|
|
montant_facture_tva, no_liquidation, oid, taux_prorata_tva)
|
|
|
SELECT
|
|
|
article_id, code_original, compte_id, facture_id, ligne_commande,
|
|
|
ligne_commande_id, montant_facture_article_ht, montant_facture_article_ttc,
|
|
|
montant_facture_article_tva, montant_facture_ht, montant_facture_port_ht,
|
|
|
montant_facture_port_ttc, montant_facture_port_tva, montant_facture_ttc,
|
|
|
montant_facture_tva, no_liquidation, oid, taux_prorata_tva
|
|
|
FROM e_lignes_facture;
|
|
|
|
|
|
SELECT base.cti_enable_index('eco', 'i_lignes_facture_1');
|
|
|
SELECT base.cti_enable_index('eco', 'i_lignes_facture_2');
|
|
|
SELECT base.cti_enable_index('eco', 'i_lignes_facture_3');
|
|
|
SELECT base.cti_enable_index('eco', 'i_lignes_facture_4');
|
|
|
|
|
|
|
|
|
]]></sqlcmd>
|
|
|
</NODE>
|
|
|
</NODE>
|
|
|
|
|
|
|
|
|
</ROOT>
|