/*pourquoi p?*/
update <PREFIXE_DW>DOCUMENTS  set DOC_ETAT_FINANCIER='P'
where EXISTS (select 1 from <PREFIXE_HA>FAC_LIG  where DOC_NUMERO_CDE=NUM_CDE )
and DOC_TYPE_TRANSACTION='CA' and DOC_ETAT_FINANCIER=' ' and DOC_DATEMODI>='<DATEMODIMIN>' and  DOC_DATEMODI<= '<DATEMODIMAX>'

<SEPARATEUR>
insert into <PREFIXE_DW>STATUTS_CA (STA_CODE_STATUT_CA )
select distinct DOC_STATUT_CDE from <PREFIXE_DW>DOCUMENTS where DOC_TYPE_TRANSACTION='CA' and DOC_STATUT_CDE not in (select STA_CODE_STATUT_CA from <PREFIXE_DW>STATUTS_CA)

<SEPARATEUR>
insert into <PREFIXE_DW>STATUTS_DA (STA_CODE_STATUT_DA )
select distinct DOC_STATUT_DA from <PREFIXE_DW>DOCUMENTS where DOC_TYPE_TRANSACTION='DA' and DOC_STATUT_DA not in (select STA_CODE_STATUT_DA from <PREFIXE_DW>STATUTS_DA)

<SEPARATEUR>
update <PREFIXE_DW>ETATS_CA set ETA_LIBELLE_ETAT_CA='A valider' where ETA_CODE_ETAT_CA='A'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_CA set ETA_LIBELLE_ETAT_CA='En cours' where ETA_CODE_ETAT_CA='E'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_CA set ETA_LIBELLE_ETAT_CA='Soldée Physiquement' where ETA_CODE_ETAT_CA='S'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_CA set ETA_LIBELLE_ETAT_CA='Validée' where ETA_CODE_ETAT_CA='V'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_CA set ETA_LIBELLE_ETAT_CA='Annulée' where ETA_CODE_ETAT_CA='Z'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_CA set ETA_LIBELLE_ETAT_CA='Livré partiellement' where ETA_CODE_ETAT_CA='L'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_FINANCIERS_CA set ETA_LIBELLE_ETAT_FINANCIER_CA='Facturée Partiellement'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_FINANCIERS_CA set ETA_LIBELLE_ETAT_FINANCIER_CA='Pas de facture' where ETA_CODE_ETAT_FINANCIER_CA=''

<SEPARATEUR>
update <PREFIXE_DW>ETATS_FINANCIERS_CA set ETA_LIBELLE_ETAT_FINANCIER_CA='Soldée Financierement' where ETA_CODE_ETAT_FINANCIER_CA='F'

<SEPARATEUR>
update <PREFIXE_DW>ETATS_FINANCIERS_CA set ETA_LIBELLE_ETAT_FINANCIER_CA='Facturée Partiellement' where ETA_CODE_ETAT_FINANCIER_CA='P'