DEFINITION C_Article_860026294 "Tpcv7g4dc"
DEFINITION C_InstSYMP_860026294 "SYMP"
DEFINITION C_InstFE_860026294 "FE"
DEFINITION C_InstTRAFIC_860026294 "TRAFIC"
DEFINITION C_Tsymphopcv7g4_860026294 "Tsymphopcv7g4"
DEFINITION C_Tfe_860026294 "Tfe"
DEFINITION C_Tdelta_minute_860026294 "Tdelta_minute"
DEFINITION C_Ttrafic_860026294 "Ttrafic"
DEFINITION C_InstCENTVG_860026294 "CENTAUREVG"
DEFINITION C_TcentaureVG_860026294 "TcentaureVG"
DEFINITION NUMTAB_860026294 1
DEFINITION ZONEMETRO_860026294 7
DEFINITION TD_VGA1_860026294 7
DEFINITION TD_VGA2_860026294 2
DEFINITION INST_VGA_860026294 "VGA"
DEFINITION C_InstFERPV_860026294 "FERPV"
DEFINITION C_Tferpv_860026294 "Tfe_rpv"
REGISTRE ENTIER gmt_date_860026294
REGISTRE ENTIER L_NDR_860026294
REGISTRE ENTIER NBCOD_860026294
REGISTRE ENTIER instDM_860026294
REGISTRE ENTIER instTRAFIC_860026294
REGISTRE ENTIER instFE_860026294
REGISTRE ENTIER instSYMPHO_860026294
REGISTRE ENTIER EFFICACE_860026294
REGISTRE ENTIER instCENTAUREVG_860026294
REGISTRE ENTIER instVGA_860026294
REGISTRE ENTIER NUMNOS_OK_860026294
REGISTRE ENTIER date_locale_860026294
REGISTRE ENTIER ETAP_860026294
REGISTRE ENTIER CAX_860026294
REGISTRE ENTIER SUP_860026294
REGISTRE ENTIER ddebut_860026294
REGISTRE ENTIER code_errone_860026294
REGISTRE ENTIER res_860026294
REGISTRE ENTIER f3BPQ_OK_860026294
REGISTRE ENTIER bREDIST_860026294
REGISTRE ENTIER trait_ok_860026294
REGISTRE ENTIER val_860026294
REGISTRE ENTIER bCENTVG_860026294
REGISTRE ENTIER VGA_860026294
REGISTRE ENTIER bTRAFIC_860026294
REGISTRE ENTIER dizaine_860026294
REGISTRE ENTIER unite_860026294
REGISTRE ENTIER cfr_860026294
REGISTRE ENTIER ENVELOPPE_NOK_860026294
REGISTRE ENTIER erreur_860026294
REGISTRE ENTIER bVGTplus_860026294
REGISTRE ENTIER b_CodOperVG_860026294
REGISTRE ENTIER b_OperNBE_860026294
REGISTRE ENTIER instFERPV_860026294
REGISTRE POINTEUR pt_NDE_860026294
REGISTRE POINTEUR pt_NDR_860026294
REGISTRE POINTEUR pt_NUMNOS_860026294
REGISTRE POINTEUR pt_buffer_860026294
REGISTRE POINTEUR pt_buffer2_860026294
REGISTRE POINTEUR pt_nomECCFact_860026294
REGISTRE POINTEUR pt_LIBELREDIST_860026294
REGISTRE POINTEUR pt_OP_CSV1_860026294
REGISTRE POINTEUR pt_C_CSV1_860026294
REGISTRE POINTEUR pt_VGA_OP_860026294
REGISTRE POINTEUR pt_VGA_OF_860026294
REGISTRE POINTEUR pt_InfoCompl_860026294
REGISTRE POINTEUR pt_TRAF_DM_860026294
REGISTRE POINTEUR pt_SGTQS_860026294
REGISTRE POINTEUR pt_SGTQS2_860026294
REGISTRE POINTEUR pt_BUFFER1_860026294
REGISTRE POINTEUR pt_OFFRE_860026294
REGISTRE POINTEUR pt_OPERA_860026294
REGISTRE POINTEUR pt_RES1_860026294
REGISTRE POINTEUR pt_VGTplus_OP_860026294
REGISTRE POINTEUR pt_VGTplus_OF_860026294
REGISTRE POINTEUR pt_CodOperVG_860026294
REGISTRE POINTEUR pt_TEMP1_860026294
REGISTRE POINTEUR pt_DEDE_NUM_860026294
############################################################################
#
# Fichier : Tpcv7g4dc.src
#
# Version : %version: 11 %
#
# Date    : %date_modified: 06/12/01 17:20 %
#
# Distribution :
#	Article detail de communication efficace DCE Tpcv7g4dc
#	pour l' application PCV
#
# En entree :
#	Article : Tpcv7g4dc.art
#
# En sortie :
#	TRAFIC
#	FE
#	Delta_Minute
#	ALLOFACT
#	Symphonie
#
# HISTORIQUE :
#	17/06/2002 - DRE : IMPREVISTO V4.4: Ajout de l'ECC Allofact_FDE avec sa mise au format
#	26/06/2002 - PSA : Correction FO1510
#	17/07/2002 - NSA : Enrichissement des alarmes et suppression d'envoi en redist sur i_validerListe
#	21/10/2002 - PSA - FO50 : traduction du B et C pour le demande
#	13/11/2002 - MCH: FO109 - DEDE_DIST_N pour FE et DM
#	09/12/2002 - NSA: FO134 - si ETAP = 0xBE alors MNEMO="****"
#	13/01/2003 - RBE : FO167 - champ REF pour Trafic, FE et DM
#	27/01/2003 - RBE : FO181 - champ SUP pour Trafic, FE et DM
#	10/02/2003 - RBE - Envoi en redistri. si pb acces fichiers de distrib.
#	28/03/2003 - RBE - FO240 : envoi a symphonie si redist.
#	18/04/2003 - RBE - FO274 : Envoi a SC si envoi a 1 appli. de facturation
#	22/04/2003 - RBE - FO282 : envoi en redistri
#	10/04/2003 - MCH - requete distri; date gmt + calcul longueur cle
#	17/06/2003 - PSA - Envoi SC vers TallofactNodes
#	22/07/2003 - DRE - Modif calcul gmt_date
# 	12/12/2003 - MCH - G2R0Ca : modif enveloppe - recup cfr pour c_libre de FE
# 	02/06/2004 - NSA - G2R0Cl: integration des codes d erreurs
# 	14/01/2005 - RBE - G2R0Cn : Modif. format TallofactNodes avec ajout CS1
#	11/02/2005 - PKH - G2R0Cnn fusion Cbb + Cnn
#	12/04/2005 - FAL - FO1237 pas de NBCOD et CS pour symphonie si INEF
#	27/07/2005 - PKH - G2R0Cq: facturation du trafic hors priselection par l'opirateur VGA
#	06/08/2005 - PKH - G2R1CQ : MODIFICATION de spec Creation des 2 tables de distributions
#				    VGA1->table8 (VGA_OFF), VGA3->table3(VGA_OPE)
#	20/09/2005 - PKH - G2R1Cq : MODIFICATION de l appel des tables VGA VGA1->table8 VGA2->table3
#	28/09/2005 - PSA - G2R1Co : fusion Cj sur Cq (prise en compte de la FO1406 sur la Cq)
#	21/10/2005 - PSA - G2R2Co : FO 1530, 1531
#	01/12/2005 - PSA - G2R2Co : FO 1607 (eligibilite VGA)
#	29/12/2005 - PKH - G2R2Ca : FO1628 Evolution eligibilite VGA
#	24/01/2006 - PKH - G2R2Ca : FO1694  retirer le critere sur le demande hors preselection
#				    pour considerer eligible le dc a  VGA.
#	08/06/2006 - THE FAL - G2R2Cu VGTplus et table ext
# 	01/02/2010 - DRE - G3R16 Menage e-bill (Allofact)
#	10/05/2010 - PKH - G3R17lot2 Item NBE
#	10/05/2010 - PKH - QC 362 Valorisation du champ service de FERPV a 8 Item NBE
#	12/10/2010 - PKH - G3R18Cy valorisation du champ DEDE_NUM pour fe et fe_rpv ajout par duplication dans Tfe_rpv des champs INFDDE et FILLLER
#	04/10/2011 - THE - VerifPcode
#
############################################################################

############################################################################
# Declarations
############################################################################

#Constantes pour message d alarme


# Variables fonctionnelles
# Numero d'instances

# initialisation des variables
instDM_860026294=0
instTRAFIC_860026294=0
instFE_860026294=0
instSYMPHO_860026294=0
NBCOD_860026294 =0
bREDIST_860026294=0
ENVELOPPE_NOK_860026294 = -1
val_860026294 = 0
VGA_860026294 = 0
bCENTVG_860026294 = 0
bTRAFIC_860026294 = 0
bVGTplus_860026294 = 0
b_CodOperVG_860026294 = 0
b_OperNBE_860026294 = 0


# POINTEURS
# VerifPcode


# Allocation de memoire pour le buffeur
pt_NDR_860026294		="543211234512345"
pt_NDE_860026294		="112231234512345"
pt_NUMNOS_860026294	="123451234512345123451234512312345"
pt_buffer2_860026294	="1234567890123412345"
pt_InfoCompl_860026294	="023412345"
pt_TRAF_DM_860026294	="1234567812345"
pt_nomECCFact_860026294	="67676767676767"
#REF		="1212345"
pt_LIBELREDIST_860026294	="78901234567890123456789012345612345"
pt_SGTQS_860026294	="5432167890123456712345"
pt_SGTQS2_860026294	="8678576563933456712345"
pt_BUFFER1_860026294	="19191919191919191919191919191"
pt_OP_CSV1_860026294	="7171717171"
pt_C_CSV1_860026294	="9494949494949"
pt_OFFRE_860026294 	= "02350235023502356959552325"
pt_VGA_OF_860026294 	= "265265265265256745825852"
pt_OPERA_860026294 	= "69696969695218978145875814265"
pt_VGA_OP_860026294 	= "8268268826826826826826826828628"
pt_RES1_860026294 	="39830258701235097390144569852"
pt_VGTplus_OP_860026294 	= "504754564754564754564"
pt_VGTplus_OF_860026294 	= "464754564754564754564"
pt_CodOperVG_860026294 	="pt_CodOperVG72727277272727727272772727272722772772772277272"
pt_buffer_860026294 	= "pt_buffer15151551515151515151515151515151515155151511515151551515151515151511515"
pt_TEMP1_860026294 	= "pt_TEMP19797979797979797979797979779>79797979797979797979797979797999997979797779"
pt_DEDE_NUM_860026294 	= "pt_DEDE_NUM297297929729727626262525225545455454554545454554545544554554545454545445"

# Initialisation
i_strcpy(pt_nomECCFact_860026294,"")
i_strcpy(pt_OFFRE_860026294,"")
i_strcpy(pt_VGA_OF_860026294," ")
i_strcpy(pt_OPERA_860026294,"")
i_strcpy(pt_VGA_OP_860026294," ")
i_strcpy(pt_RES1_860026294,"")
i_strcpy(pt_buffer_860026294,"")
i_strcpy(pt_NDR_860026294,"")
i_strcpy(pt_buffer2_860026294,"")
i_strcpy(pt_VGTplus_OP_860026294," ")
i_strcpy(pt_VGTplus_OF_860026294," ")
i_strcpy(pt_BUFFER1_860026294," ")
#i_strcpy(REF,"")
i_strcpy(pt_NDE_860026294,"")
i_strcpy(pt_NUMNOS_860026294,"")
i_strcpy(pt_InfoCompl_860026294,"")
i_strcpy(pt_TRAF_DM_860026294,"")
i_strcpy(pt_LIBELREDIST_860026294,"")
i_strcpy(pt_SGTQS_860026294,"")
i_strcpy(pt_SGTQS2_860026294,"")
i_strcpy(pt_OP_CSV1_860026294,"")
i_strcpy(pt_C_CSV1_860026294,"")
i_strcpy(pt_CodOperVG_860026294,"")
i_strcpy(pt_TEMP1_860026294,"")
i_strcpy(pt_DEDE_NUM_860026294," ")


# ---------------------------------------------------
# Identification de la provenance de l'article
# ---------------------------------------------------

trait_ok_860026294 = -1
# trait_ok : nb de passage en redistribution
trait_ok_860026294 = i_LireRedistCpt()

SI ( trait_ok_860026294 > 0 )
ALORS
	ENVELOPPE_NOK_860026294 = 0
FINSI

############################################################################
# Variables Fonctionnelles Globales
############################################################################

SI  ( !(i_get_art_field(g_iartin,$Tpcv7g4dc::TAP))  || !(i_get_art_field(g_iartin,$Tpcv7g4dc::TAP2)) )
ALORS
	EFFICACE_860026294=1
SINON
	EFFICACE_860026294=0
FINSI

f3BPQ_OK_860026294=0

############################################################################
# Envoi requetes Table de Distribution
############################################################################
ddebut_860026294=i_get_art_field(g_iartin,$ddebut)

SI (ddebut_860026294 == -1)
ALORS
	code_errone_860026294 = 0xA080
	code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
	erreur_860026294 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026294, C_Article_860026294, "i_get_art_field/ddebut" )
	SAUT DISTRI_ERR
FINSI
gmt_date_860026294 = i_DHgetCe2gTime(NUMTAB_860026294,ZONEMETRO_860026294,ddebut_860026294)

SI EFFICACE_860026294
ALORS
	#Recuperation de la date en secondes
	L_NDR_860026294 = i_get_art_fieldlength(g_iartin,$NDR)
	SI ( L_NDR_860026294 % 2 == 0 )
	ALORS
		L_NDR_860026294 = L_NDR_860026294 / 2
	SINON
		L_NDR_860026294 = L_NDR_860026294 / 2 + 1
	FINSI

	################################################################################
	#Appelle table VGA
	###################################################################################
	instVGA_860026294 = i_LireInstanceECC(INST_VGA_860026294)

	SI (!instVGA_860026294)
	ALORS
		trace("Pas d'instance pour VGA!")
		erreur_860026294 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"VGA",C_Article_860026294,g_ieec)
		SAUT DISTRI_ERR
	FINSI
	trace1("instVGA =<%d>",instVGA_860026294)

	##############################################################################
	# Envoi Requetes Table de Distribution VGA
	#############################################################################
	# le DEDE est de la forme ZABPQMCDU : on ne teste que le Z pour determiner la preselection
	# retirer le critere de filtre sur le dede hors preselection pour rendre le DC eligible a l'offre VGA

	SI (i_EnvoiReqConsTabDist( TD_VGA1_860026294,gmt_date_860026294,i_get_art_fieldptr(g_iartin,$NDR),L_NDR_860026294,0,1) != 0)
	ALORS
		#trace("Erreur i_EnvoiReqConsTabDist VGA1")
		SAUT DISTRI_ERR
	FINSI
	erreur_860026294 = i_LireReqConsTabDist()
	#trace1("RETOUR i_LireReqConsTabDist retour requette VGA1, erreur=<%d>",erreur)

	SI ( erreur_860026294 != 0 )
	ALORS
		#trace1( "Erreur i_LireReqConsTabDist VGA1: <%d>", erreur)
		SAUT DISTRI_ERR
	FINSI
	val_860026294 = i_LireInfoECC( instVGA_860026294, 0 )
	# test redist OK apres 1ER passage SI ( res > 0 && trait_ok !=0 )

	SI ( val_860026294 != 0 )
	ALORS
		erreur_860026294 = i_LireChaineInfo( val_860026294, 0, 6, pt_OFFRE_860026294 )
		#trace2(" pt_OFFRE <%s> ", pt_OFFRE,"")
		erreur_860026294 = i_format_str2( pt_BUFFER1_860026294, "%s%s", "INj", pt_OFFRE_860026294)
		i_strcpy(pt_RES1_860026294, i_get_tab_field("Inter", gmt_date_860026294, pt_BUFFER1_860026294))
		#trace2(" pt_RES1  <%s> ", pt_RES1,"")

		SI (i_strcmp(pt_RES1_860026294,"VGT+")==0)
		ALORS
			bVGTplus_860026294 =1
			VGA_860026294 = 0
			i_strcpy(pt_VGTplus_OF_860026294 ,pt_OFFRE_860026294)
		SINON
			SI (i_strcmp(pt_RES1_860026294,"VGA")==0)
			ALORS
				VGA_860026294 = 1
				i_strcpy(pt_VGA_OF_860026294 ,pt_OFFRE_860026294)
			FINSI
		FINSI
	FINSI
	#trace2(" Resultat de i_LireChaineInfo pour la table VGA1 (table 8) : <%s>", pt_OFFRE, "")

	SI (i_EnvoiReqConsTabDist( TD_VGA2_860026294,gmt_date_860026294,i_get_art_fieldptr(g_iartin,$NDR),L_NDR_860026294,0,1) != 0)
	ALORS
		#trace("Erreur i_EnvoiReqConsTabDist VGA2")
		SAUT DISTRI_ERR
	FINSI
	erreur_860026294 = i_LireReqConsTabDist()
	#trace1("RETOUR i_LireReqConsTabDist retour requette VGA2, erreur=<%d>",erreur)

	SI ( erreur_860026294 != 0 )
	ALORS
		#trace1( "Erreur i_LireReqConsTabDist VGA2: <%d>", erreur)
		SAUT DISTRI_ERR
	FINSI
	val_860026294= 0
	val_860026294 = i_LireInfoECC( instVGA_860026294, 0 )

	SI (val_860026294 != 0)
	ALORS
		erreur_860026294 = i_LireChaineInfo( val_860026294, 0, 6, pt_OPERA_860026294)
		SI (i_strcmp (pt_OPERA_860026294,g_inull))
		ALORS
			i_strcpy(pt_CodOperVG_860026294,pt_OPERA_860026294)
			b_CodOperVG_860026294 = 1

			SI (VGA_860026294 || bVGTplus_860026294)
			ALORS
				SI (bVGTplus_860026294)
				ALORS
					i_strcpy(pt_VGTplus_OP_860026294, pt_OPERA_860026294)
				SINON
					SI (VGA_860026294)
					ALORS
						i_strcpy(pt_VGA_OP_860026294,pt_OPERA_860026294)
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI

	SI (b_CodOperVG_860026294)
	ALORS
		i_strcpy(pt_TEMP1_860026294,"")
		erreur_860026294 = i_format_str2( pt_TEMP1_860026294, "%s%s", "INm", pt_CodOperVG_860026294)

		SI ( i_strcmp( i_get_tab_field("Inter", gmt_date_860026294, pt_TEMP1_860026294),g_inull) != 0 )
		ALORS
			b_OperNBE_860026294 = 1
		FINSI
	FINSI

	#trace2(" Resultat de i_LireChaineInfo pour VGA2 (table3) : <%s> ", pt_OPERA, "")

	#trace2(" G2R2Cu pt_NDR : <%s>", pt_NDR, "")
	#trace2(" G2R2Cu de i_LireChaineInfo pour VGA1 (table8) : <%s>", pt_OFFRE, "")
	#trace2(" G2R2Cu pt_RES1 resultat table ext CodeOffre  <%s>", pt_RES1, "")
	#trace2(" G2R2Cu de i_LireChaineInfo pour VGA2 (table3) : <%s>", pt_OPERA, "")
	#trace1(" G2R2Cu bVGTplus <%d>", bVGTplus)
	#trace1(" G2R2Cu VGA      <%d>", VGA)
	#trace2(" G2R2Cu pt_VGTplus_OF : <%s>", pt_VGTplus_OF, "")
	#trace2(" G2R2Cu pt_VGA_OF        : <%s>", pt_VGA_OF, "")
	#trace2(" G2R2Cu pt_VGTplus_OP : <%s>", pt_VGTplus_OP, "")
	#trace2(" G2R2Cu pt_VGA_OP        : <%s>", pt_VGA_OP, "")

	#######################		FIN AJOUT VGA 		####################
	############################################################################

	res_860026294=i_EnvoiReqConsTabDistDouble( TD_Fixe, TD_Inter, gmt_date_860026294,i_get_art_fieldptr(g_iartin, $NDR), L_NDR_860026294, L_NDR_860026294, 1, 0, 1)
	SI ( res_860026294 != TRAIT_OK )
	ALORS
		#trace1("Erreur i_EnvoiReqConsTabDistDouble: %d", res)
		bREDIST_860026294 = 1
		i_strcpy(pt_LIBELREDIST_860026294,"i_EnvoiReqConsTabDistDouble")
	FINSI
FINSI

############################################################################
# Controles
############################################################################

############################################################################
# Recherche Instances des ECC
############################################################################

# SYMPHONIE

instSYMPHO_860026294=i_LireInstanceECC(C_InstSYMP_860026294)
SI !(instSYMPHO_860026294 > 0)
ALORS
	code_errone_860026294 = 0xA0B0
	code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
	erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,C_InstSYMP_860026294,C_Article_860026294)
	SAUT DISTRI_ERR
FINSI

SI EFFICACE_860026294 && !bREDIST_860026294
ALORS
	# FE

	instFE_860026294=i_LireInstanceECC(C_InstFE_860026294)
	SI !(instFE_860026294 > 0)
	ALORS
		code_errone_860026294 = 0xA0B0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,C_InstFE_860026294,C_Article_860026294)
		SAUT DISTRI_ERR
	FINSI

	# TRAFIC

	instTRAFIC_860026294=i_LireInstanceECC(C_InstTRAFIC_860026294)
	SI !(instTRAFIC_860026294 > 0)
	ALORS
		code_errone_860026294 = 0xA0B0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,C_InstTRAFIC_860026294,C_Article_860026294)
		SAUT DISTRI_ERR
	FINSI

	#FERPV

	instFERPV_860026294=i_LireInstanceECC(C_InstFERPV_860026294)
	SI !(instFERPV_860026294 > 0)
	ALORS
		code_errone_860026294 = 0xA0B0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,C_InstFERPV_860026294,C_Article_860026294)
		SAUT DISTRI_ERR
	FINSI

	# suppression ECC : ALLOFACT (SERVICE CONSO)

	#---------------------------------------------------------------------------
	#CENTAUREVG
	#---------------------------------------------------------------------------

	SI VGA_860026294 || bVGTplus_860026294
	ALORS
		instCENTAUREVG_860026294= i_LireInstanceECC(C_InstCENTVG_860026294)
		#trace1("instCENTAUREVG=<%d>",instCENTAUREVG)
		SI (!instCENTAUREVG_860026294)
		ALORS
			# trace("Pas d'instance pour CENTAUREVG!")
			bCENTVG_860026294=0
			code_errone_860026294 = 0xA0B0
			code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
			erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,C_InstCENTVG_860026294,C_Article_860026294)
			SAUT DISTRI_ERR
		SINON
			bCENTVG_860026294=1
		FINSI
	FINSI
FINSI

############################################################################
# Duplication Symphonie
############################################################################

SI (i_dup_art_id(g_iartin,g_iartout))
ALORS
	code_errone_860026294 = 0xA0D0
	code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
	erreur_860026294 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026294,C_Tsymphopcv7g4_860026294,C_Article_860026294)
	SAUT DISTRI_ERR
FINSI
res_860026294=i_rename_art(g_iartout,C_Tsymphopcv7g4_860026294)

# CCD
res_860026294=i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4ccd,$Tsymphopcv7g4::CCD,0)

# SGTQS
res_860026294=i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4sgtqs,$Tsymphopcv7g4::SGTQS,0)

# EEC_FACT
res_860026294=i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4eccfact,$Tsymphopcv7g4::ECC_FACT,0)

# Champs optionnels OPE_VGA et OFF_VGA
SI bVGTplus_860026294
ALORS
	# Champ OPE_VGA
	erreur_860026294 = i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4OPEVGA,$Tsymphopcv7g4::OPE_VGA,0)
	erreur_860026294 = i_set_art_str(g_iartout,$Tsymphopcv7g4::OPE_VGA,pt_VGTplus_OP_860026294)

	# Champ OFF_VGA
	erreur_860026294 = i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4OFFVGA,$Tsymphopcv7g4::OFF_VGA,0)
	erreur_860026294 = i_set_art_str(g_iartout,$Tsymphopcv7g4::OFF_VGA,pt_VGTplus_OF_860026294)
SINON
	SI VGA_860026294
	ALORS
		# Champ OPE_VGA
		erreur_860026294 = i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4OPEVGA,$Tsymphopcv7g4::OPE_VGA,0)
		erreur_860026294 = i_set_art_str(g_iartout,$Tsymphopcv7g4::OPE_VGA,pt_VGA_OP_860026294)

		# Champ OFF_VGA
		erreur_860026294 = i_ajoutChampNum(g_iartout,$Tsymphopcv7g4::T4OFFVGA,$Tsymphopcv7g4::OFF_VGA,0)
		erreur_860026294 = i_set_art_str(g_iartout,$Tsymphopcv7g4::OFF_VGA,pt_VGA_OF_860026294)
	FINSI
FINSI

# IEZLT

############################################################################
# Attente requetes Table de Distribution
############################################################################

SI EFFICACE_860026294 && !bREDIST_860026294
ALORS
	res_860026294=i_LireReqConsTabDist()
	SI ( res_860026294 != TRAIT_OK )
	ALORS
		#trace1( "Erreur i_LireReqConsTabDist: %d", res)
		i_strcpy(pt_LIBELREDIST_860026294,"i_LireReqConsTabDist")
		bREDIST_860026294 = 1
	FINSI
FINSI

############################################################################
# Critere de distribution
############################################################################

# ajout de l'EEC SYMPHONIE a la liste courante des EEC
res_860026294=i_AjouterCouranteECC(instSYMPHO_860026294)

#---------------------------------------------------------------------------
# Criteres communs
#---------------------------------------------------------------------------

SI EFFICACE_860026294 && !bREDIST_860026294
ALORS
	res_860026294=i_LireInfoECC(instFE_860026294,0)

	#---------------------------------------------------------------------------
	# FE
	#---------------------------------------------------------------------------
	SI ( (res_860026294 != 0) && !VGA_860026294 && !bVGTplus_860026294)
	ALORS
		res_860026294=i_AjouterCouranteECC(instFE_860026294)
		#---------------------------------------------------------------------------
		# DM
		#---------------------------------------------------------------------------
		res_860026294=i_LireInfoECC(instTRAFIC_860026294,0)
		SI (res_860026294 != 0)
		ALORS
			erreur_860026294=i_LireChaineInfo(res_860026294,0,3,pt_InfoCompl_860026294)
			erreur_860026294=i_format_str2(pt_TRAF_DM_860026294,"DM%s",pt_InfoCompl_860026294,0)
			instDM_860026294=i_LireInstanceECC(pt_TRAF_DM_860026294)

			SI (!instDM_860026294)
			ALORS
				code_errone_860026294 = 0xA0B0
				code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
				erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,pt_TRAF_DM_860026294,C_Article_860026294)
				SAUT DISTRI_ERR
			FINSI

			# Recuperation du code CFR pour meta c_libre de FE
			dizaine_860026294 = i_LireEntierInfo(res_860026294,0,1)
			unite_860026294 = i_LireEntierInfo(res_860026294,1,1)
			cfr_860026294 = (dizaine_860026294 & 0x0F) * 10 + (unite_860026294 & 0x0F)

			SI ( ENVELOPPE_NOK_860026294 )
			ALORS
				#IFDEF trace_niv1 = 1
				trace("__FILE__:__LINE__ ======> Creation enveloppe CFR/FE")
				#ENDIF
				ENVELOPPE_NOK_860026294 = i_add_opt("E_Tpcv7g4dc")
				#mise en conformite de la gestion de l'enveloppe
			FINSI
			res_860026294 = i_set_attr_val_n($E_Tpcv7g4dc::CFR,cfr_860026294)
			#IFDEF trace_niv1 = 1
			trace1("__FILE__:__LINE__ ======> code CFR : <%d> ", cfr_860026294)
			trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK_860026294)
			#ENDIF
			erreur_860026294=i_AjouterCouranteECC(instDM_860026294)
		SINON
			i_strcpy(pt_LIBELREDIST_860026294,"Indicatif inconnu de MAJ2G")
			bREDIST_860026294 = 1
			SAUT AVANT_REDIST
		FINSI

		#---------------------------------------------------------------------------
		# TRAFIC
		#---------------------------------------------------------------------------
	SINON
		res_860026294=i_LireInfoECC(instTRAFIC_860026294,0)

		SI (res_860026294 != 0)
		ALORS
			res_860026294=i_LireChaineInfo(res_860026294,0,3,pt_InfoCompl_860026294)
			res_860026294=i_format_str2(pt_TRAF_DM_860026294,"TRAF%s",pt_InfoCompl_860026294,0)
			instTRAFIC_860026294=i_LireInstanceECC(pt_TRAF_DM_860026294)

			SI (!instTRAFIC_860026294)
			ALORS
				code_errone_860026294 = 0xA0B0
				code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
				erreur_860026294 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026294,pt_TRAF_DM_860026294,C_Article_860026294)
				SAUT DISTRI_ERR
			FINSI
			res_860026294=i_AjouterCouranteECC(instTRAFIC_860026294)
			bTRAFIC_860026294 = 1
		SINON
			i_strcpy(pt_LIBELREDIST_860026294,"Indicatif inconnu de MAJ2G")
			bREDIST_860026294 = 1
			SAUT AVANT_REDIST
		FINSI

		SI (bTRAFIC_860026294 == 1 && b_OperNBE_860026294 && bVGTplus_860026294)
		ALORS
			res_860026294 = i_AjouterCouranteECC(instFERPV_860026294)
		FINSI
	FINSI

	# suppression ECC : ALLOFACT

	#----------------------------------------------------------------------------
	# Ajout de CENTAUREVG
	#----------------------------------------------------------------------------

	SI ( (VGA_860026294 == 1 || bVGTplus_860026294 == 1) && (bTRAFIC_860026294 == 1) )
	ALORS
		SI (i_AjouterCouranteECC(instCENTAUREVG_860026294)<0)
		ALORS
			trace("Retour de i_AjouterCouranteECC en erreur pour CENTAUREVG!")
			SAUT DISTRI_ERR
		FINSI
	FINSI
FINSI

############################################################################
# Validation de la liste des ECCs destinatrices
############################################################################

res_860026294=i_ValiderListeECC(0,0,0,0)

############################################################################
# Mises au format
############################################################################

#---------------------------------------------------------------------------
# Valeurs communes
#---------------------------------------------------------------------------
SI EFFICACE_860026294  && !bREDIST_860026294
ALORS
	# Initialisation des variables de presence a l etat non present
	NUMNOS_OK_860026294=0

	# NDR
	res_860026294=i_get_art_str(g_iartin,$NDR,pt_NDR_860026294)
	i_replace_str(pt_NDR_860026294,"BCDE","AJSC",pt_NDR_860026294)

	# NDE
	res_860026294=i_get_art_str(g_iartin,$NDE,pt_NDE_860026294)
	i_replace_str(pt_NDE_860026294,"BCDE","AJSC",pt_NDE_860026294)

	SI ( i_strlen(pt_NDE_860026294) == 10 )
	ALORS
		i_get_sub_str( pt_NDE_860026294,1,-1,pt_NDE_860026294)
	FINSI
	SI ((i_get_art_fieldtab(g_iartin,$NDE,0) == 3 ) && (i_strlen(pt_NDE_860026294) == 4))
	ALORS
		f3BPQ_OK_860026294=1
	FINSI

	# date_locale
	res_860026294=i_get_art_field(g_iartin,$DATE)

	SI (res_860026294 == -1)
	ALORS
		code_errone_860026294 = 0xA080
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026294, C_Article_860026294, "i_get_art_field/DATE" )
		SAUT DISTRI_ERR
	FINSI
	date_locale_860026294=i_date_locale(g_ieec,g_iartin,res_860026294)

	SI (date_locale_860026294 == -1)
	ALORS
		code_errone_860026294 = 0xA080
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026294, C_Article_860026294, "i_date_locale/DATE" )
		SAUT DISTRI_ERR
	FINSI

	# CAX
	SI i_valid_field_n(g_iartin,$T3cap1)
	ALORS
		CAX_860026294=i_get_art_field(g_iartin,$CAX)
	SINON
		CAX_860026294=i_get_art_field(g_iartin,$CAX2)
	FINSI

	# NUMNOS
	SI i_valid_field_n(g_iartin, $NUMNOS)
	ALORS
		NUMNOS_OK_860026294=1
		res_860026294=i_get_art_str(g_iartin,$NUMNOS,pt_NUMNOS_860026294)
	FINSI

	# ETAP
	ETAP_860026294=i_get_art_field(g_iartin,$ETAP)

	SI (ETAP_860026294==0xBC)
	ALORS
		i_strcpy(pt_C_CSV1_860026294, "P2")
	SINON
		i_strcpy(pt_C_CSV1_860026294, "10")
	FINSI
	i_strcpy(pt_OP_CSV1_860026294,"U")

	# SUP
	SI i_valid_field_n(g_iartin,$T3cap2)
	ALORS
		SUP_860026294 = i_get_art_field(g_iartin,$SUP2)
	SINON
		SUP_860026294 = 0
	FINSI

	SI ( f3BPQ_OK_860026294 == 1)
	ALORS
		i_strcpy(pt_DEDE_NUM_860026294,pt_NDE_860026294)
	SINON
		res_860026294=i_format_str2(pt_DEDE_NUM_860026294,"0%s",pt_NDE_860026294,0)
		#res=i_set_art_str(g_iartout2,$Tfe::DEDE_NUM, pt_buffer2)
	FINSI
FINSI

#---------------------------------------------------------------------------
# FE
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instFE_860026294))  && !bREDIST_860026294
ALORS
	# ECC_FACT
	#i_strcpy(pt_nomECCFact,"FE")
	i_strcpy(pt_nomECCFact_860026294,"FE")

	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout2,C_Tfe_860026294))
	ALORS
		code_errone_860026294 = 0xA0D0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026294,C_Tfe_860026294,C_Article_860026294)
		SAUT DISTRI_ERR
	FINSI

	# SERVICE
	res_860026294=i_set_art_str(g_iartout2,$Tfe::SERVICE, "55")

	# E
	res_860026294=i_set_art_str(g_iartout2,$Tfe::E,"0")

	# IDUS_NUM
	res_860026294=i_set_art_str(g_iartout2,$Tfe::IDUS_NUM,pt_NDR_860026294)

	# DEDE_NUM
	res_860026294=i_set_art_str(g_iartout2,$Tfe::DEDE_NUM, pt_DEDE_NUM_860026294)

	# DATE
	res_860026294=i_set_art_field(g_iartout2,$Tfe::DATE,date_locale_860026294)

	# CAX
	res_860026294=i_set_art_field(g_iartout2,$Tfe::CAX,CAX_860026294)

	# NDS_INF
	SI (i_valid_field_n(g_iartin, $Tpcv7g4dc::INFNOS))
	ALORS
		res_860026294=i_get_art_field(g_iartin,$INFNOS)
		res_860026294=i_set_art_field(g_iartout2,$Tfe::NDS_INF,res_860026294)
	FINSI

	# NDS_NUM
	SI NUMNOS_OK_860026294
	ALORS
		res_860026294=i_set_art_str(g_iartout2,$Tfe::NDS_NUM,pt_NUMNOS_860026294)
	FINSI

	# SUP
	res_860026294=i_set_art_field(g_iartout2, $Tfe::SUP, SUP_860026294)

	# REF
	SI i_valid_field_n(g_iartin,$REF)
	ALORS
		res_860026294=i_get_art_field(g_iartin,$REF)
		res_860026294=i_set_art_field(g_iartout2,$Tfe::REF,res_860026294)
	FINSI

	# C_CSV1, OP_CSV1
	res_860026294=i_set_art_str(g_iartout2,$Tfe::C_CSV1,pt_C_CSV1_860026294)
	res_860026294=i_set_art_str(g_iartout2,$Tfe::OP_CSV1,pt_OP_CSV1_860026294)

	# MNEMO
	SI ((ETAP_860026294 == 0x10)||(ETAP_860026294 == 0x11)||(ETAP_860026294 == 0xBE))
	ALORS
		res_860026294=i_set_art_str(g_iartout2,$Tfe::MNEMO,"****")
	FINSI
FINSI

#-------------------------------------------------------------------------------------
# FERPV 
#-------------------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instFERPV_860026294) )
ALORS
	SI (i_dup_art_dest(g_iartin,g_iartout8,C_Tferpv_860026294))
	ALORS
		#trace(">>>__LINE__>>>**********Erreur duplication Tv2oip vers FERPV")
		code_errone_860026294 = 0xA0D0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026294,C_Tferpv_860026294,C_Article_860026294)
		SAUT  DISTRI_ERR
	FINSI

	# ajout et enrichissement enveloppe
	erreur_860026294 = i_add_opt("E_RPV")
	res_860026294 = i_get_art_field(g_iartin, $Tpcv7g3dc::dfin)
	erreur_860026294 = i_set_attr_val_n( $E_RPV::DATE_M, res_860026294)
	res_860026294 = i_get_art_field(g_iartin, $Tpcv7g3dc::DATE)
	erreur_860026294 = i_set_attr_val_n( $E_RPV::DATE_L, res_860026294)

	#SERVICE
	SI (b_OperNBE_860026294 && bVGTplus_860026294)
	ALORS
		erreur_860026294 = i_set_art_str(g_iartout8, $Tfe_rpv::SERVICE, "8")
	SINON
		erreur_860026294 = i_set_art_str(g_iartout8, $Tfe_rpv::SERVICE, "4")
	FINSI

	#SOURCE
	SI (b_OperNBE_860026294 && bVGTplus_860026294)
	ALORS
		erreur_860026294 = i_set_art_str(g_iartout8, $Tfe_rpv::SOURCE, "19")
	FINSI

	#TYPCOM duplicat : ""

	#NUMDDR
	erreur_860026294 = i_format_str2(pt_buffer_860026294,"%s%s","0",pt_NDR_860026294)
	erreur_860026294 = i_set_art_str(g_iartout8,$Tfe_rpv::NUMDDR,pt_buffer_860026294)

	#NUMDDE
	res_860026294 = i_set_art_str(g_iartout8, $Tfe_rpv::NUMDDE, pt_DEDE_NUM_860026294)

	#DEDUT
	res_860026294 = i_set_art_field(g_iartout8, $Tfe_rpv::DEBUT,date_locale_860026294)

	#DUREE
	res_860026294=i_set_art_field(g_iartout8,$Tfe_rpv::DUREE,i_get_art_field(g_iartin,$dduree))

	#NBUT
	res_860026294=i_set_art_field(g_iartout8,$Tfe_rpv::NBUT,i_get_art_field(g_iartin,$tax))

	#MTHSTD duplicat : "0"

	#CANAL duplicat : "000"

	#C_CSV1 OP_CSV1
	res_860026294 = i_set_art_str(g_iartout8, $Tfe_rpv::C_CSV1,pt_C_CSV1_860026294)
	res_860026294 = i_set_art_str(g_iartout8, $Tfe_rpv::OP_CSV1,pt_OP_CSV1_860026294)

	#INFDDE en duplication = 000
	#FILLER en dupliction = " "
FINSI

#---------------------------------------------------------------------------
# DM
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instDM_860026294))  && !bREDIST_860026294
ALORS
	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout3,C_Tdelta_minute_860026294))
	ALORS
		code_errone_860026294 = 0xA0D0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026294,C_Tdelta_minute_860026294,C_Article_860026294)
		SAUT DISTRI_ERR
	FINSI

	# DOMAINE
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::DOMAINE,"05")

	# SERVICE
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::SERVICE, "55")

	# E
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::E,"0")

	# IDUS_NUM
	res_860026294=i_set_art_str(g_iartout3, $Tdelta_minute::IDUS_NUM,pt_NDR_860026294)

	# DEDE_NUM
	SI ( f3BPQ_OK_860026294 == 1)
	ALORS
		res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::DEDE_NUM,pt_NDE_860026294)
	SINON
		res_860026294=i_format_str2(pt_buffer2_860026294,"0%s",pt_NDE_860026294,0)
		res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::DEDE_NUM, pt_buffer2_860026294)
	FINSI

	# DATE
	res_860026294=i_set_art_field(g_iartout3,$Tdelta_minute::DATE,date_locale_860026294)

	# CAX
	res_860026294=i_set_art_field(g_iartout3,$Tdelta_minute::CAX,CAX_860026294)

	# NDS_NUM
	SI NUMNOS_OK_860026294
	ALORS
		res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::NDS_NUM,pt_NUMNOS_860026294)
	FINSI

	# SUP
	res_860026294=i_set_art_field(g_iartout3, $Tdelta_minute::SUP, SUP_860026294)

	# REF
	SI i_valid_field_n(g_iartin,$REF)
	ALORS
		res_860026294=i_get_art_field(g_iartin,$REF)
		res_860026294=i_set_art_field(g_iartout3,$Tdelta_minute::REF,res_860026294)
	FINSI

	# C_CSV1, OP_CSV1
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::C_CSV1,pt_C_CSV1_860026294)
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::OP_CSV1,pt_OP_CSV1_860026294)

	# STY
	res_860026294=i_transformer_bits(g_iartin,$STY,"FV",pt_buffer_860026294)
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::STY,pt_buffer_860026294)

	# SGTQS
	res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::SGTQS,i_LireEECSGTQS(g_ieec))

	# MNEMO
	SI ((ETAP_860026294 == 0x10)||(ETAP_860026294 == 0x11) ||(ETAP_860026294 == 0xBE))
	ALORS
		res_860026294=i_set_art_str(g_iartout3,$Tdelta_minute::MNEMO,"****")
	FINSI
FINSI

#---------------------------------------------------------------------------
# TRAFIC
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instTRAFIC_860026294))  && !bREDIST_860026294
ALORS
	# ECC_FACT
	pt_nomECCFact_860026294=pt_TRAF_DM_860026294

	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout4,C_Ttrafic_860026294))
	ALORS
		code_errone_860026294 = 0xA0D0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026294,C_Ttrafic_860026294,C_Article_860026294)
	FINSI

	# DOMAINE
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::DOMAINE,"05")

	# SERVICE
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::SERVICE,"55")

	# E
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::E,"0")

	# IDUS_NUM
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::IDUS_NUM,pt_NDR_860026294)

	# DEDE_NUM
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::DEDE_NUM,pt_NDE_860026294)

	# DATE
	res_860026294=i_set_art_field(g_iartout4,$Ttrafic::DATE,date_locale_860026294)

	# CAX
	res_860026294=i_set_art_field(g_iartout4,$Ttrafic::CAX,CAX_860026294)

	# NDS_NUM
	SI NUMNOS_OK_860026294
	ALORS
		res_860026294=i_set_art_str(g_iartout4,$Ttrafic::NDS_NUM,pt_NUMNOS_860026294)
	FINSI

	# SUP
	res_860026294=i_set_art_field(g_iartout4, $Ttrafic::SUP, SUP_860026294)

	# REF
	SI i_valid_field_n(g_iartin,$REF)
	ALORS
		res_860026294=i_get_art_field(g_iartin,$REF)
		res_860026294=i_set_art_field(g_iartout4,$Ttrafic::REF,res_860026294)
	FINSI

	# C_CSV1, OP_CSV1
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::C_CSV1,pt_C_CSV1_860026294)
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::OP_CSV1,pt_OP_CSV1_860026294)

	# STY
	res_860026294=i_transformer_bits(g_iartin,$STY,"FV",pt_buffer_860026294)
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::STY,pt_buffer_860026294)

	# SGTQS
	res_860026294=i_set_art_str(g_iartout4,$Ttrafic::SGTQS,i_LireEECSGTQS(g_ieec))

	# MNEMO
	SI ((ETAP_860026294 == 0x10)||(ETAP_860026294 == 0x11) ||(ETAP_860026294 == 0xBE))
	ALORS
		res_860026294=i_set_art_str(g_iartout4,$Ttrafic::MNEMO,"****")
	FINSI

	# champ OFFRE et champ OPERATEUR
	SI (bVGTplus_860026294)
	ALORS
		erreur_860026294=i_set_art_str(g_iartout4, $Ttrafic::OFFRE, pt_VGTplus_OF_860026294)
		trace2("OFFRE=<%s>",pt_VGTplus_OF_860026294,"")
		erreur_860026294=i_set_art_str(g_iartout4, $Ttrafic::OPERATEUR, pt_VGTplus_OP_860026294)
		trace2("OPERATEUR=<%s>",pt_VGTplus_OP_860026294,"")
	SINON
		SI (VGA_860026294)
		ALORS
			erreur_860026294=i_set_art_str(g_iartout4, $Ttrafic::OFFRE, pt_VGA_OF_860026294)
			trace2("OFFRE=<%s>",pt_VGA_OF_860026294,"")
			erreur_860026294=i_set_art_str(g_iartout4, $Ttrafic::OPERATEUR, pt_VGA_OP_860026294)
			trace2("OPERATEUR=<%s>",pt_VGA_OP_860026294,"")
		FINSI
	FINSI
FINSI

#-------------------------------------------------------------------------
# CENTAUREVG
#-------------------------------------------------------------------------

SI ( !i_ChercherCouranteECC(instCENTAUREVG_860026294))
ALORS
	trace("Stockage vers CENTAUREVG")

	# Duplication de l article
	#-----------------------------
	trace("Duplication vers CENTAUREVG")
	SI ( i_dup_art_dest(g_iartin,g_iartout7,C_TcentaureVG_860026294) )
	ALORS
		trace("Erreur de i_dup_art_dest")
		code_errone_860026294 = 0xA0D0
		code_errone_860026294 = code_errone_860026294 + EFFICACE_860026294
		erreur_860026294 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026294,C_TcentaureVG_860026294,C_Article_860026294)
		SAUT  DISTRI_ERR
	FINSI
	# Mise au format
	#------------------------------
	trace("initialisation de DOMAINE et SERVICE")

	# DOMAINE
	erreur_860026294=i_set_art_str(g_iartout7, $TcentaureVG::DOMAINE, "05")

	# SERVICE
	erreur_860026294=i_set_art_str(g_iartout7, $TcentaureVG::SERVICE, "55")

	# IDUS_NUM
	res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::IDUS_NUM,pt_NDR_860026294)

	# DEDE_NUM
	res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::DEDE_NUM,pt_NDE_860026294)

	# DATE
	res_860026294=i_set_art_field(g_iartout7,$TcentaureVG::ICAR,date_locale_860026294)

	# CAX
	res_860026294=i_set_art_field(g_iartout7,$TcentaureVG::CAX,CAX_860026294)

	# NDS_NUM
	SI NUMNOS_OK_860026294
	ALORS
		res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::NDS_NUM,pt_NUMNOS_860026294)

	SINON
		res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::NDS_NUM," ")

	FINSI

	# SUP
	res_860026294=i_set_art_field(g_iartout7, $TcentaureVG::SUP, SUP_860026294)

	# REF
	SI i_valid_field_n(g_iartin,$REF)
	ALORS
		res_860026294=i_get_art_field(g_iartin,$REF)
		res_860026294=i_set_art_field(g_iartout7,$TcentaureVG::REF,res_860026294)
	FINSI

	# C_CSV1, OP_CSV1
	res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::C_CSV1,pt_C_CSV1_860026294)
	res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::OP_CSV1,pt_OP_CSV1_860026294)

	# STY
	res_860026294=i_transformer_bits(g_iartin,$STY,"FV",pt_buffer_860026294)
	res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::STY,pt_buffer_860026294)

	# SGTQS
	res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::SGTQS,i_LireEECSGTQS(g_ieec))

	#MNEMO
	SI ((ETAP_860026294 == 0x10)||(ETAP_860026294 == 0x11) ||(ETAP_860026294 == 0xBE))
	ALORS
		res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::MNEMO,"****")
	SINON
		res_860026294=i_set_art_str(g_iartout7,$TcentaureVG::MNEMO," ")
	FINSI

	# champ OFFRE et champ OPERATEUR
	SI (bVGTplus_860026294)
	ALORS
		erreur_860026294=i_set_art_str(g_iartout7, $TcentaureVG::OFFRE, pt_VGTplus_OF_860026294)
		trace2("OFFRE=<%s>",pt_VGTplus_OF_860026294,"")
		erreur_860026294=i_set_art_str(g_iartout7, $TcentaureVG::OPERATEUR, pt_VGTplus_OP_860026294)
		trace2("OPERATEUR=<%s>",pt_VGTplus_OP_860026294,"")
	SINON
		SI (VGA_860026294)
		ALORS
			erreur_860026294=i_set_art_str(g_iartout7, $TcentaureVG::OFFRE, pt_VGA_OF_860026294)
			trace2("OFFRE=<%s>",pt_VGA_OF_860026294,"")
			erreur_860026294=i_set_art_str(g_iartout7, $TcentaureVG::OPERATEUR, pt_VGA_OP_860026294)
			trace2("OPERATEUR=<%s>",pt_VGA_OP_860026294,"")
		FINSI
	FINSI
FINSI

# suppression ECC : ALLOFACT

POINT AVANT_REDIST

SI (trait_ok_860026294 == 0)
ALORS
	#---------------------------------------------------------------------------
	# Complements Symphonie
	#---------------------------------------------------------------------------

	# CCD
	res_860026294=i_set_art_field(g_iartout,$Tsymphopcv7g4::CCD,204)

	# SGTQS
	res_860026294=i_set_art_str(g_iartout,$Tsymphopcv7g4::SGTQS,i_LireEECSGTQS(g_ieec))

	# ECC_FACT
	res_860026294=i_set_art_str(g_iartout,$Tsymphopcv7g4::ECC_FACT,pt_nomECCFact_860026294)

	#NBCOD  et FO1237
	SI (EFFICACE_860026294 == 1 )
	ALORS
		SI (i_valid_field_n(g_iartin,$Tpcv7g4dc::ETAP))
		ALORS
			NBCOD_860026294 =1
		FINSI
		erreur_860026294  = i_ajoutChamp(g_iartout,"T4NBCOD","NBCOD",0x00)
		res_860026294 =i_set_art_field(g_iartout,$Tsymphopcv7g4::NBCOD,NBCOD_860026294 )

		#CS-1
		erreur_860026294  = i_ajoutChamp(g_iartout,"T4CSV","CSV",0x00)
		erreur_860026294  = i_format_str2(pt_BUFFER1_860026294 ,"%s%s",pt_C_CSV1_860026294  ,pt_OP_CSV1_860026294 )
		erreur_860026294  = i_set_art_str( g_iartout,$Tsymphopcv7g4::CSV,pt_BUFFER1_860026294 )
	FINSI

	#---------------------------------------------------------------------
	# Symphonie
	#---------------------------------------------------------------------

	SI !(i_ChercherCouranteECC(instSYMPHO_860026294))
	ALORS
		res_860026294=i_stocke_art_iecc(g_iartout,instSYMPHO_860026294)
	FINSI
FINSI

SI (bREDIST_860026294 == 1)
ALORS
	SAUT DISTRI_RDT
FINSI

############################################################################
# Envoi vers IECC
############################################################################

#---------------------------------------------------------------------------
# FE
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instFE_860026294))
ALORS
	res_860026294=i_stocke_art_iecc(g_iartout2,instFE_860026294)
FINSI

#---------------------------------------------------------------------------
# FERPV
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instFERPV_860026294))
ALORS
	res_860026294 = i_stocke_art_iecc(g_iartout8, instFERPV_860026294)
FINSI

#---------------------------------------------------------------------------
# DM
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instDM_860026294))
ALORS
	res_860026294=i_stocke_art_iecc(g_iartout3,instDM_860026294)
FINSI

#---------------------------------------------------------------------------
# TRAFIC
#---------------------------------------------------------------------------

SI !(i_ChercherCouranteECC(instTRAFIC_860026294))
ALORS
	res_860026294=i_stocke_art_iecc(g_iartout4,instTRAFIC_860026294)
FINSI

# suppression ECC : ALLOFACT

#--------------------------------------------------------
# Envoi sur CENTAUREVG
#-------------------------------------------------------

SI (!i_ChercherCouranteECC(instCENTAUREVG_860026294) )
ALORS
	res_860026294 = i_stocke_art_iecc(g_iartout7, instCENTAUREVG_860026294)
	trace ("Emission vers CENTAUREVG")
FINSI

RETOUR TRAIT_OK

###########################################################################
# Stockage pour redistribution
###########################################################################

POINT DISTRI_RDT

SI (trait_ok_860026294 == 0)
ALORS
	#---------------------
	#  Creation de l'ENVELOPPE Optionelle:
	# Contient le nom de l'EEC necessaire au message d'erreur de la redistribution
	# Nom_EEC
	# Creation de l'enveloppe
	# ICI G2R0CA
	SI ( ENVELOPPE_NOK_860026294 )
	ALORS
		#IFDEF trace_niv1 = 1
		trace("__FILE__:__LINE__ =====> Creation enveloppe REDISTRI")
		#ENDIF
		ENVELOPPE_NOK_860026294 = i_add_opt( "E_Tpcv7g4dc" )
		# mise en conformite de la gestion de l'enveloppe
	FINSI

	i_strcpy(pt_SGTQS2_860026294,i_LireEECSGTQS(g_ieec))
	res_860026294 = i_set_attr_str_n( $E_Tpcv7g4dc::Nom_EEC, pt_SGTQS2_860026294)
	res_860026294 = i_get_attr_str_n($E_Tpcv7g4dc::Nom_EEC, pt_SGTQS_860026294)
	res_860026294 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026294,"Tpcv7g4dc",pt_SGTQS_860026294)
FINSI

res_860026294 = i_stocke_art(g_iartin,0,PT_REDIST|RD_TABLE5,0)

RETOUR TRAIT_OK

############################################################################
# Stockage en Errone
############################################################################

POINT DISTRI_ERR

res_860026294=i_make_art_rej(g_iartin, g_iartout, code_errone_860026294)
res_860026294 = i_stocke_art( g_iartout, 0, PT_ERRONE,0)

RETOUR TRAIT_OK

############################################################################
