DEFINITION NUMTAB_860026361 1
DEFINITION ZONEMETRO_860026361 7
DEFINITION INST_ACLA_860026361 "ACLA"
DEFINITION C_Article_860026361 "Tta6dcZTA"
DEFINITION C_InstSYMP_860026361 "SYMP"
DEFINITION C_InstFE_860026361 "FE"
DEFINITION C_InstTRAFIC_860026361 "TRAFIC"
DEFINITION C_Tfe_860026361 "Tfe"
DEFINITION C_Tdelta_minute_860026361 "Tdelta_minute"
DEFINITION C_Ttrafic_860026361 "Ttrafic"
DEFINITION CCD_Internat_860026361 6
DEFINITION CPT_CPS_Loc_860026361 16
DEFINITION CPT_CPS_RI_860026361 17
DEFINITION C_DATCPS_860026361 "DATCPS" 
DEFINITION TD_SVA_860026361 9
DEFINITION C_INST_ALICE_860026361 "ALICE"
REGISTRE ENTIER instDM_860026361
REGISTRE ENTIER instTRAFIC_860026361
REGISTRE ENTIER instFE_860026361
REGISTRE ENTIER instSYMPHO_860026361
REGISTRE ENTIER T3nos_OK_860026361
REGISTRE ENTIER T3cab_OK_860026361
REGISTRE ENTIER T3sidr_OK_860026361
REGISTRE ENTIER T3cle_OK_860026361
REGISTRE ENTIER T3coca_OK_860026361
REGISTRE ENTIER T3cocav_OK_860026361
REGISTRE ENTIER T3idav_OK_860026361
REGISTRE ENTIER CCD_860026361
REGISTRE ENTIER INFNOS_860026361
REGISTRE ENTIER SUP_860026361
REGISTRE ENTIER CLE1_860026361
REGISTRE ENTIER TAP_860026361
REGISTRE ENTIER CAX_860026361
REGISTRE ENTIER INF_IDAV_860026361
REGISTRE ENTIER ddebut_860026361
REGISTRE ENTIER dduree_860026361
REGISTRE ENTIER tax_860026361
REGISTRE ENTIER res_860026361
REGISTRE ENTIER res1_860026361
REGISTRE ENTIER resFE_860026361
REGISTRE ENTIER erreur_860026361
REGISTRE ENTIER code_errone_860026361
REGISTRE ENTIER EFFICACE_860026361
REGISTRE ENTIER bitA_TAP_860026361
REGISTRE ENTIER bitC_TAP_860026361
REGISTRE ENTIER bitF_TAP_860026361
REGISTRE ENTIER bitG_TAP_860026361
REGISTRE ENTIER bitH_TAP_860026361
REGISTRE ENTIER ic_C_CSV1_860026361
REGISTRE ENTIER IEZLT_860026361
REGISTRE ENTIER ICAR_REL_860026361
REGISTRE ENTIER ICAR_ABS_860026361
REGISTRE ENTIER EPORTABILITE_860026361
REGISTRE ENTIER b_SPORTABILITE_860026361
REGISTRE ENTIER instECCTRAFIC_860026361
REGISTRE ENTIER SRP_PORTE_860026361
REGISTRE ENTIER TAXE_CAL_860026361
REGISTRE ENTIER TAXE_CAL_SYMP_860026361
REGISTRE ENTIER EPORTABILITE_SCP_860026361
REGISTRE ENTIER SPORTABILITE_SCP_860026361
REGISTRE ENTIER instACLA_860026361
REGISTRE ENTIER CCD_REEL_860026361
REGISTRE ENTIER bREDIST_860026361
REGISTRE ENTIER trait_ok_860026361
REGISTRE ENTIER INF_DEDE_TRAF_860026361
REGISTRE ENTIER gmt_date_860026361
REGISTRE ENTIER L_NDR_860026361
REGISTRE ENTIER pref_860026361
REGISTRE ENTIER nb_digit_860026361
REGISTRE ENTIER OPT_860026361
REGISTRE ENTIER ROC_860026361
REGISTRE ENTIER dizaine_860026361
REGISTRE ENTIER unite_860026361
REGISTRE ENTIER cfr_860026361
REGISTRE ENTIER ENVELOPPE_NOK_860026361
REGISTRE ENTIER Date_CPS_860026361
REGISTRE ENTIER instALICE_860026361 
REGISTRE ENTIER REJET_860026361
REGISTRE ENTIER longueur_860026361 
REGISTRE POINTEUR pt_NDR_860026361
REGISTRE POINTEUR pt_NUMNOS_860026361
REGISTRE POINTEUR pt_NDE_860026361
REGISTRE POINTEUR pt_BETA_860026361
REGISTRE POINTEUR pt_BETAV_860026361
REGISTRE POINTEUR pt_NUM_IDAV_860026361
REGISTRE POINTEUR pt_nomECCFact_860026361
REGISTRE POINTEUR pt_LIBELREDIST_860026361
REGISTRE POINTEUR pt_CODCIRDA_860026361
REGISTRE POINTEUR pt_CODCIRA_860026361
REGISTRE POINTEUR pt_BUF_860026361
REGISTRE POINTEUR pt_InfoCompl_860026361
REGISTRE POINTEUR pt_TRAF_FACT_860026361
REGISTRE POINTEUR pt_DM_860026361
REGISTRE POINTEUR pt_CodeOp_860026361
REGISTRE POINTEUR pt_CODESCP_860026361
REGISTRE POINTEUR pt_SGTQS_860026361
REGISTRE POINTEUR pt_MESSAGE_860026361
REGISTRE POINTEUR pt_CODE_TARIF_860026361 
REGISTRE POINTEUR pt_TYPE_EDIT_860026361 
REGISTRE POINTEUR pt_TEMP_860026361
REGISTRE POINTEUR pt_NORM_860026361
# ---------------------------------------------------------------------------
#
# FICHIER : Tta6dcZTA.src
#
# VERSION : %version: 19 %
#
# AUTEUR      : %created_by: loic %
#
# CREE le     : 13/03/02 15:05
#
# MODIFIE le  : %date_modified: 10/04/02 13:35 %
#
# DESCRIPTION :
#    Article detail de communication ZTA analogique efficace
#
# En entree :
#    Article : Tt6dcZTA.art
#
# En sortie :
#    FE
#    Delta_minute
#    TRAFIC
#    Symphonie
#
# HISTORIQUE :
#	21/03/2002 - CMI : FOEX500  	: NB_CSV si DEDE_NUM commence par 3212
#	10/04/2002 - LRA : FOEX559  	: NB_CSV si DEDE_NUM commence par 12
#	17/06/2002 - PSA : FO1510  	: Encapsulation pour le stockage en errone
#	19/06/2002 - PSA : FO1515  	: Dump des articles pour MSGA + integration de la redistribution
#	18/07/2002 - DRE : V4.5		: - Ajout variable EPORTABILITE et criteres pour FCT
#					  - Correction dans la mise au format FCT les cas DEDE=12 ou 3212
#					    des Complhments de Service sont supprimis.
#	15/10/2002 - PSA : FO18 et FO45 : modif format pour FOR
#			   FO55 : appel a CodeOperateur uniquement en cas portabilite entrante potentielle
#	28/10/2002 - RBE : specif.4.8 :Modif. CCD en fonction de la portabilite
#	14/10/2002 - RBE : MAJ champs CODCIR demandeur et demande
#		Ajout duplication metachamp (suppression dans dup_tab)
#	07/02/2003 - RBE - Envoi en redistrib. si pb acces fichiers de distrib.
#       11/02/2003 - MCH : GIR2C10 : bit d de INF_DEDE = 0 pour TRAFIC, FE, VTG_valo & DM
#	28/03/2003 - RBE - FO241 : envoi a symphonie si redist.
#	10/04/2003 - MCH - requete distri; date gmt + calcul longueur cle
#	22/07/2003 - DRE - Modif calcul gmt_date et codeoperateur
# 	03/09/2003 - DRE - FO392 : Initialisation des variables Pcode
#	08/09/2003 - MCH - G2R0CO: OPT + CODCIR
#	02/02/2004 - RBE - Ci: MAJ du chp TAX pour deltaminute
# 	18/03/2004 - RBE - FO585 : pas de MAJ de tax si AR appartient pas a 45S
# 	18/03/2004 - RBE - FO586 : filter pour FE le dede=A5
#	18/03/2004 - RBE - Suppression des verbes obsoletes ajout_tlv et retrait_tlv
#	23/03/2004 - RBE - FO591:si dede=A5 et si AR appartient a FE DC va pas a TRAFIC
# 	12/12/2003 - MCH - G2R0Ca : modif enveloppe - recup cfr pour c_libre de FE
#	27/05/2004 - RBE - FO688 : si ROC envoi a Symphonie et delta minute seulement
# 	11/06/2004 - NSA - G2R0Cl: integration des codes d erreurs
#	17/06/2004 - RBE - FO708 : Pour ROC envoi a DM incorrect
#	27/12/2004 - PKH-  G2R0Cbb :Identification des SCP entrant et sortant a partir du referentiel ACLA
#	31/01/2005 - PKH-  FO1079 DC TELEPHONE evolution du CCD_REEL sur SCP
#	15/02/2005 - PKH- Cbb 118XZ pour le 12
#       21/03/2005 - FAL - FO1164 Appel ACLA uniquement si necessaire
#       21/03/2005 - FAL - FO1171 reprise FO1079
#       09/05/2005 - FAL - FO1275 CS dans le cas du 12 et 118XYZ pour TRAFIC FE et DM
#	12/07/2005 - THE DRE FO 1385
#	13/07/2005 - DRE creation variable TAXE_CAL_SYMP
# 	15/09/2005 - DRE - FO1406 Retour Fonction i_LireInfoECC (doit etre != et non >)
#	02/05/2007 - FAL - G3R0Cr Suppression FCT , Prise en compte CCD  213 pour les SRP FT portes sortant
#	24/05/2007 - FAL - G3R0Cr FO2167 criteres DM
#	08/10/2007 - FAL - ParamFTSA-G3R3 lot2 FO2239 TAX de TRAFIC FE RPV DM ALLOFACT et CentaureVG
#	12/10/2011 - THE - VerfPcode
#	11/02/2013 - DRE - G4R02 : QC677, rechercher SCP-SRP uniquement si Dde non international
#	31/03/2014 - DRE - G4R6 : Lot2
#	25/04/2014 - DRE - G4R6 QC807
#
# ---------------------------------------------------------------------------

############################################################################
# Declarations
############################################################################
# Constantes
# VerifPcode
#DRE QC677

#DRE G4R6 lot2
#\DRE G4R6 lot2


# Variables entieres
# VerfPcode
# Numero d'instances
# Variables de presence de champ
# Variables associees a la valeur de champ
#DRE G4R6 lot2


# Variables pointeurs

# Variables utilisees pour la redistribution
# DRE G4R6 lot2


#IFDEF trace_niv1 = 1
trace( "__FILE__:__LINE__ : Debut pcode de distribution" )
#ENDIF


# Allocation memoire pour les pointeurs
pt_BUF_860026361		 ="04567890123456789012345678912312345"
pt_BETA_860026361		 ="001112345"
pt_BETAV_860026361		 ="112212345"
pt_NDR_860026361		 = "123456789012345"
pt_NUMNOS_860026361		 = "123456789012345678901234567812345"
pt_NDE_860026361		 = "1234567890123456789012345612345"
pt_NUM_IDAV_860026361	 = "12345678901234567890123412345"
pt_InfoCompl_860026361	 = "123412345"
pt_TRAF_FACT_860026361	 = "1234567812345"
pt_DM_860026361		 = "8765432112345"
pt_nomECCFact_860026361	 = "67676767676767"
pt_LIBELREDIST_860026361	 = "78901234567890123456789012345612345"
pt_SGTQS_860026361	 = "12345678901212345"
pt_CodeOp_860026361	 = "54567890123456789012345678912312345"
pt_CODESCP_860026361	 = "151515151515151515"
#SGTQS		 = "999999999999"
pt_CODCIRDA_860026361	 = "53453546"
pt_CODCIRA_860026361		 = "78474546"
# DRE G4R6 lot2
pt_MESSAGE_860026361 = "pt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGEpt_MESSAGE"
pt_LIBELREDIST_860026361	 = "pt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDIST"
pt_CODE_TARIF_860026361 	 = "pt_CODE_TARIFpt_CODE_TARIF"
pt_TYPE_EDIT_860026361	 = "pt_TYPE_EDIT"
pt_TEMP_860026361		 = "pt_TEMP9179179179179179179179179179179179171917"
pt_NORM_860026361		 = "pt_NORMpt_NORMpt_NORMpt_NORMpt_NORMpt_NORMpt_NO"


# Initialisation variables entieres
instSYMPHO_860026361	 = 0
instFE_860026361		 = 0
instTRAFIC_860026361	 = 0
instDM_860026361		 = 0
EPORTABILITE_860026361	 = 0
TAXE_CAL_860026361	 = 0
TAXE_CAL_SYMP_860026361	 = 0
SUP_860026361		 = 0
CCD_860026361		 = 255
bREDIST_860026361		 = 0
nb_digit_860026361	 = 0
pref_860026361		 =-1
OPT_860026361		 = 0
ROC_860026361		 = 0
EFFICACE_860026361	 = 1
b_SPORTABILITE_860026361	 = 0
instECCTRAFIC_860026361	 = 0
ENVELOPPE_NOK_860026361	 = -1
EPORTABILITE_SCP_860026361 = 0
SPORTABILITE_SCP_860026361 = 0
#DRE G4R6 lot2
Date_CPS_860026361 	 = 0
instALICE_860026361 	 = -1
tax_860026361 		 = 0
REJET_860026361    = 0
longueur_860026361 = 0
	


# Initialisation des pointeurs
i_strcpy(pt_nomECCFact_860026361,"")
i_strcpy(pt_CODESCP_860026361,"")
i_strcpy(pt_BUF_860026361,"")
i_strcpy(pt_NDR_860026361,"")
i_strcpy(pt_NUMNOS_860026361,"")
i_strcpy(pt_NDE_860026361,"")
i_strcpy(pt_BETA_860026361,"")
i_strcpy(pt_BETAV_860026361,"")
i_strcpy(pt_NUM_IDAV_860026361,"")
i_strcpy(pt_InfoCompl_860026361,"")
i_strcpy(pt_TRAF_FACT_860026361,"")
i_strcpy(pt_DM_860026361,"")
i_strcpy(pt_CodeOp_860026361,"")
i_strcpy(pt_SGTQS_860026361,"")
i_strcpy(pt_LIBELREDIST_860026361,"")
i_strcpy(pt_CODCIRDA_860026361,"")
i_strcpy(pt_CODCIRA_860026361,"")
# DRE G4R6 lot2
i_strcpy(pt_MESSAGE_860026361, "")
i_strcpy(pt_CODE_TARIF_860026361 , "    ")
i_strcpy(pt_TYPE_EDIT_860026361 , " ")
i_strcpy(pt_TEMP_860026361 , " ")
i_strcpy(pt_NORM_860026361 , "")


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

# ICAR_ABS et ICAR_REL
ICAR_ABS_860026361 = i_get_art_field(g_iartin,$DATE)
SI ( ICAR_ABS_860026361 == -1 )
ALORS
	code_errone_860026361 = 0xA080
	code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
	erreur_860026361 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026361, C_Article_860026361, "i_get_art_field/DATE" )
	SAUT DISTRI_ERR
FINSI

ICAR_REL_860026361 = i_date_locale(g_ieec,g_iartin,ICAR_ABS_860026361)
SI ( ICAR_REL_860026361 == -1 )
ALORS
	code_errone_860026361 = 0xA080
	code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
	erreur_860026361 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026361, C_Article_860026361, "i_date_locale/ICAR_ABS" )
	SAUT DISTRI_ERR
FINSI

# controle metachamps
ddebut_860026361=i_get_art_field(g_iartin,$ddebut)
SI (ddebut_860026361 == -1)
ALORS
	code_errone_860026361 = 0xA080
	code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
	erreur_860026361 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026361, C_Article_860026361, "i_get_art_field/ddebut" )
	SAUT DISTRI_ERR
FINSI

gmt_date_860026361 = i_DHgetCe2gTime(NUMTAB_860026361,ZONEMETRO_860026361,ddebut_860026361)
SI(i_get_art_field(g_iartin,$dfin) == -1)
ALORS
	code_errone_860026361 = 0xA080
	code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
	erreur_860026361 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026361, C_Article_860026361, "i_get_art_field/dfin" )
	SAUT DISTRI_ERR
FINSI

dduree_860026361=i_get_art_field(g_iartin,$dduree)
tax_860026361=i_get_art_field(g_iartin,$tax)

# CCD
SI (i_valid_field_n(g_iartin,$CCD))
ALORS
	CCD_860026361=i_get_art_field(g_iartin,$CCD)
FINSI
#trace1("CCD distribution =<%d>",CCD)
erreur_860026361=i_get_art_str(g_iartin,$NDE,pt_BUF_860026361)


#DRE G4R6 lot2
erreur_860026361 = i_cree_art("Conversion",g_iartout10)

## Variable fonctionnelle REJET:
SI (i_valid_field_n(g_iartin,$T4rejet))
ALORS
	REJET_860026361 = i_get_art_field(g_iartin,$REJET)
FINSI
#trace1("Valeur de REJET = <%d>",REJET)
#\DRE G4R6 lot2

###############
# DRE QC677 recuperation plus tot du TAXCAL calcule dans le traitement
SRP_PORTE_860026361 = 0

SI ( i_valid_field_n(g_iartin, $TAXCAL) )
ALORS
	SRP_PORTE_860026361 = 1
	TAXE_CAL_860026361 = i_get_art_field( g_iartin, $Tta6dcZTA::TAXCAL )
FINSI

#DRE QC677
SI CCD_860026361 != CCD_Internat_860026361
ALORS
	# Portabilite
	pt_CodeOp_860026361 = CodeOperateurTable6_860026233(gmt_date_860026361, pt_BUF_860026361,"45S")
	
	SI (!i_strcmp(pt_CodeOp_860026361, "84208"))
	ALORS
		EPORTABILITE_860026361 = 1
	SINON
		SI (pt_CodeOp_860026361 != g_inull)
		ALORS
			b_SPORTABILITE_860026361 = 1
		FINSI
	FINSI
	
	#trace1("EPORTABILITE=<%d>", EPORTABILITE)
	#trace1("CCD REEL = <%d>", CCD)
	
	######################## Portabiliti Entrante ou Sortante SCP (referentiel ACLA)#################################################
	#trace("------------RECHERCHE INSTANCE ACLA-------------")
	instACLA_860026361 = i_LireInstanceECC(INST_ACLA_860026361)
	
	SI (!instACLA_860026361)
	ALORS
		trace ("---------------------Pas d'instance pour ACLA------------------------------")
		erreur_860026361 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"ACLA",C_Article_860026361,g_ieec)
		SAUT DISTRI_ERR
	FINSI
	#trace1("-----------------------instACLA=<%d>-----------------------------",instACLA)
	
	##############################################################################
	# Envoi Requetes Table de Distribution ACLA
	##############################################################################
	
	erreur_860026361=i_get_art_str(g_iartin,$NDE,pt_BUF_860026361)
	pt_CODESCP_860026361= CodeOperateurTable6_860026233(gmt_date_860026361,pt_BUF_860026361,"ACLA")
	#trace2("--------------------Tta6dcZTA -resultat de pt_CODESCP : <%s>-------------------",pt_CODESCP,"")
	
	SI (!i_strcmp(pt_CODESCP_860026361, "84008"))
	ALORS
		EPORTABILITE_SCP_860026361 = 1
	
	SINON
		SI (i_strcmp(pt_CODESCP_860026361,"84008")!=0 && i_strcmp(pt_CODESCP_860026361,"")!=0)
		ALORS
			SPORTABILITE_SCP_860026361 = 1
		FINSI
	FINSI
FINSI
#FIN DRE QC677

#---------------------------------------------------------------------------
# Variable fonctionnelle CCD_REEL (FO 1079)
#---------------------------------------------------------------------------

SI (EPORTABILITE_860026361 == 1)
ALORS
	CCD_REEL_860026361 = 212
SINON
	SI (EPORTABILITE_SCP_860026361 == 1)
	ALORS
		CCD_REEL_860026361 = 218
	SINON
		SI (b_SPORTABILITE_860026361 == 1)
		ALORS
			CCD_REEL_860026361 = 213
		SINON
			SI (SPORTABILITE_SCP_860026361 == 1)
			ALORS
				CCD_REEL_860026361 = 219
			SINON
				CCD_REEL_860026361 = CCD_860026361
			FINSI
		FINSI
	FINSI
FINSI
#trace1("-Valeur de EPORTABILITE     =<%d>----",EPORTABILITE)
#trace1("-Valeur de EPORTABILITE_SCP =<%d>----",EPORTABILITE_SCP)
#trace1("-Valeur de SPORTABILITE_SCP =<%d>----",SPORTABILITE_SCP)
#trace1("-Valeur de CCD              =<%d>----",CCD)
#trace1("-Valeur de CCD_REEL         =<%d>----",CCD_REEL)

# CAX
SI (i_valid_field_n(g_iartin,$T3cap1))
ALORS
	T3cab_OK_860026361=0
	CAX_860026361=i_get_art_field(g_iartin,$CAX:0)
SINON
	T3cab_OK_860026361=1
	CAX_860026361=i_get_art_field(g_iartin,$CAX:1)
FINSI

#--------------------------
# ROC Rappel sur OCcupation DEDE=A5
#--------------------------
SI ((10*(i_get_art_fieldtab(g_iartin,$NDE,0))+i_get_art_fieldtab(g_iartin,$NDE,1)) == 105 )
ALORS
	ROC_860026361 = 1
FINSI

SI (i_valid_field_n(g_iartin,$ZLT))
ALORS
	IEZLT_860026361=i_get_art_field(g_iartin,$ZLT)
	# Test de presence obligatoire supprime (voir MAF)
FINSI
#trace1(" IEZLT : <%d>", IEZLT)

# COCA/COCAV
SI (i_valid_field_n(g_iartin,$BETAV))
ALORS
	T3cocav_OK_860026361 = 1
	erreur_860026361=i_get_art_str(g_iartin,$BETAV,pt_BETAV_860026361)
	nb_digit_860026361=i_strlen(pt_BETAV_860026361)
	SI (nb_digit_860026361>0)
	ALORS
		pref_860026361 = g_iartin.BETAV[nb_digit_860026361-1]
		SI (nb_digit_860026361>1)
		ALORS
			pref_860026361 = ( 10*(g_iartin.BETAV[nb_digit_860026361-2]) + pref_860026361 )
			SI (nb_digit_860026361>2)
			ALORS
				pref_860026361 = ( 100*(g_iartin.BETAV[nb_digit_860026361-3]) + pref_860026361 )
				SI (nb_digit_860026361>3)
				ALORS
					pref_860026361 = ( 1000*(g_iartin.BETAV[nb_digit_860026361-4]) + pref_860026361 )
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

SI ((pref_860026361 != 8) && (pref_860026361 != -1))
ALORS
	OPT_860026361 = 1
FINSI

# ---------------------------------------------------
# Identification de la provenance de l'article
# ---------------------------------------------------
trait_ok_860026361 = -1
# trait_ok : nb de passage en redistribution
trait_ok_860026361 = i_LireRedistCpt()

SI ( trait_ok_860026361 > 0 )
ALORS
	ENVELOPPE_NOK_860026361 = 0
FINSI
# ETLA G2R0CA

#DRE G4R6 lot2 lignes remontees
# NDE
res_860026361=i_get_art_str(g_iartin,$NDE,pt_NDE_860026361)

############################################################################
# Envoi requetes Table de Distribution
############################################################################

#DRE G4R6 lot2
#####################################################################
# 	              Traitement C+S (CPS)

#DRE G4R6 QC807
#SI (REJET==CPT_CPS_Loc)
SI (REJET_860026361==CPT_CPS_Loc_860026361 || REJET_860026361==CPT_CPS_RI_860026361)
ALORS
	i_strcpy(pt_TEMP_860026361, i_get_tab_field( "TDATCPS", gmt_date_860026361, C_DATCPS_860026361 ))

	erreur_860026361 = i_set_art_str (g_iartout10,$Conversion::DATE_STR,pt_TEMP_860026361)
	Date_CPS_860026361 = i_get_art_field(g_iartout10, $Conversion::DATE_ASC)
			
	SI ddebut_860026361 < Date_CPS_860026361
	ALORS
		erreur_860026361 = i_format_str2(pt_MESSAGE_860026361," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_NDE_860026361,pt_TEMP_860026361)
		code_errone_860026361 = 0xA080
		code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
		erreur_860026361 = i_PlvMessEmettre( 8599, 1, g_iartin,"", 3,code_errone_860026361, C_Article_860026361, pt_MESSAGE_860026361 )
		SAUT DISTRI_DIV
	SINON
		#######################################
		#  Soumission de la requete de consultation d'une table de distribution ALICE
		#######################################
		SI ( i_valid_field_n(g_iartin, $NORMAL ) )
		ALORS
			erreur_860026361 = i_get_art_str(g_iartin, $NORMAL, pt_NORM_860026361 )
		SINON
			SI ( i_valid_field_n(g_iartin, $NDE ) )
			ALORS
				erreur_860026361 = i_get_art_str(g_iartin, $NDE, pt_NORM_860026361)
			FINSI
		FINSI
		
		i_get_sub_str(pt_NORM_860026361, 0, 0, pt_BUF_860026361)
		
		SI (i_strcmp(pt_BUF_860026361, "0") == 0)
		ALORS
			i_get_sub_str(pt_NORM_860026361, 1, -1, pt_NORM_860026361)
		FINSI
		
		longueur_860026361 = i_conv_ascii_dcb (pt_NORM_860026361, pt_TEMP_860026361)
		SI (i_EnvoiReqConsTabDist( TD_SVA_860026361,gmt_date_860026361,pt_TEMP_860026361,longueur_860026361,0,1) != 0)
		ALORS
			#trace("Erreur i_EnvoiReqConsTabDist ALICE")
			bREDIST_860026361 = 1
			i_strcpy(pt_LIBELREDIST_860026361,"Echec sur i_EnvoiReqConsTabDistDouble ALICE ")
		FINSI
		
		#######################################
		# Recherche de l'instance ECC ALICE
		#######################################
		instALICE_860026361 = i_LireInstanceECC(C_INST_ALICE_860026361)
		SI (!instALICE_860026361)
		ALORS
			#trace("Pas d'instance pour ALICE !")
			erreur_860026361 = i_PlvMessEmettre(8501,1,g_iartin,"",3,C_INST_ALICE_860026361,C_Article_860026361,g_ieec)
			SAUT DISTRI_ERR
		FINSI
		#trace1("instALICE  =<%d>",instALICE)	

		#######################################
		# Lecture Resultat requete ALICE
		#######################################
		erreur_860026361 = i_LireReqConsTabDist()
		#trace1("RETOUR i_LireReqConsTabDist retour requette ALICE, erreur=<%d>",erreur)
		SI ( erreur_860026361 != 0 )
		ALORS
			#trace1( "Erreur i_LireReqConsTabDist ALICE: <%d>", erreur)
			bREDIST_860026361 = 1
			i_strcpy(pt_LIBELREDIST_860026361,"Echec sur i_LireReqConsTabDistDouble ALICE ")
		FINSI
		res_860026361 = i_LireInfoECC( instALICE_860026361, 0 )
		
		SI (res_860026361 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026361 = i_LireChaineInfo( res_860026361, 0, 4, pt_BUF_860026361 )
			SI i_strcmp(pt_BUF_860026361,"") != 0
			ALORS
				i_strcpy(pt_CODE_TARIF_860026361,pt_BUF_860026361)
			SINON
				# info complementaire CODE_TARIF vide
				bREDIST_860026361 = 1
				erreur_860026361 = i_format_str2(pt_LIBELREDIST_860026361," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NORM_860026361,0)
			FINSI
			
			erreur_860026361 = i_LireChaineInfo( res_860026361, 4, 1, pt_BUF_860026361 )
			SI i_strcmp(pt_BUF_860026361,"") != 0
			ALORS
				i_strcpy(pt_TYPE_EDIT_860026361,pt_BUF_860026361)
			SINON
				# info complementaire TYPE_EDIT vide
				bREDIST_860026361 = 1
				erreur_860026361 = i_format_str2(pt_LIBELREDIST_860026361," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NORM_860026361,0)
			FINSI
		SINON
			bREDIST_860026361 = 1
			erreur_860026361 = i_format_str2(pt_LIBELREDIST_860026361," AR <%s> non trouve dans ALICE",pt_NORM_860026361,0)
		FINSI
	FINSI
FINSI
#\DRE G4R6 lot2



L_NDR_860026361 = i_get_art_fieldlength(g_iartin,$NDR)
SI ( L_NDR_860026361 % 2 == 0 )
ALORS
	L_NDR_860026361 = L_NDR_860026361 / 2
SINON
	L_NDR_860026361 = L_NDR_860026361 / 2 + 1
FINSI
res_860026361=i_EnvoiReqConsTabDistDouble( TD_Fixe, TD_Inter, gmt_date_860026361,i_get_art_fieldptr(g_iartin,$NDR), L_NDR_860026361, L_NDR_860026361, 1, 0, 1)

SI ( res_860026361 !=0 )
ALORS
	#trace1("Erreur i_EnvoiReqConsTabDistDouble %d",res)
	#pLIBELREDIST = "i_EnvoiReqConsTabDistDouble"
	i_strcpy(pt_LIBELREDIST_860026361,"i_EnvoiReqConsTabDistDouble")
	bREDIST_860026361 = 1
FINSI

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

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

# SYMPHONIE
instSYMPHO_860026361=i_LireInstanceECC(C_InstSYMP_860026361)

SI !(instSYMPHO_860026361 > 0)
ALORS
	code_errone_860026361 = 0xA0B0
	code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
	erreur_860026361 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026361,C_InstSYMP_860026361,C_Article_860026361)
	SAUT DISTRI_ERR
FINSI

SI (!bREDIST_860026361)
ALORS
	# FE
	instFE_860026361=i_LireInstanceECC(C_InstFE_860026361)
	SI !(instFE_860026361 > 0)
	ALORS
		code_errone_860026361 = 0xA0B0
		code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
		erreur_860026361 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026361,C_InstFE_860026361,C_Article_860026361)
		SAUT DISTRI_ERR
	FINSI

	# TRAFIC
	instTRAFIC_860026361=i_LireInstanceECC(C_InstTRAFIC_860026361)
	SI !(instTRAFIC_860026361 > 0)
	ALORS
		code_errone_860026361 = 0xA0B0
		code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
		erreur_860026361 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026361,C_InstTRAFIC_860026361,C_Article_860026361)
		SAUT DISTRI_ERR
	FINSI
	
	# FCT
FINSI

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

# DRE G4R6 bloc deplace
SI (i_dup_art_id(g_iartin,g_iartout))
ALORS
	code_errone_860026361 = 0xA0D0
	code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
	erreur_860026361 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026361,"pour Symphonie",C_Article_860026361)

	SAUT DISTRI_ERR
FINSI
# \DRE G4R6 bloc deplace

# retrait du TLV T3ce si ajoute par le traitement
SI (i_valid_field_n(g_iartin,$T3ce))
ALORS
	erreur_860026361=i_get_art_str(g_iartin, $Tta6dcZTA::CODCIRDA,pt_CODCIRDA_860026361)

	SI (g_iartin.CODCIRDA[2] > 9)
	ALORS
		i_get_sub_str(pt_CODCIRDA_860026361,2,5,pt_CODCIRDA_860026361)
	SINON
		i_get_sub_str(pt_CODCIRDA_860026361,1,5,pt_CODCIRDA_860026361)
	FINSI

	erreur_860026361=i_get_art_str(g_iartin, $Tta6dcZTA::CODCIRA,pt_CODCIRA_860026361)

	SI (g_iartin.CODCIRA[2] > 9)
	ALORS
		i_get_sub_str(pt_CODCIRA_860026361,2,5,pt_CODCIRA_860026361)
	SINON
		i_get_sub_str(pt_CODCIRA_860026361,1,5,pt_CODCIRA_860026361)
	FINSI

	# DRE G4R6 Retrait T3ce dans g_iartout pour conserver g_iartin::T3ce en retour de redistri
	# retrait du TLV T3ce si ajoute par le traitement
	# erreur = i_supprChamp(g_iartin,"T3ce")
	erreur_860026361 = i_supprChamp(g_iartout,"T3ce")
FINSI

res_860026361=i_rename_art(g_iartout,"Tsymphta6ZTA")

# champ CCD
res_860026361=i_ajoutChampNum(g_iartout,$Tsymphta6ZTA::T4ccd,$Tsymphta6ZTA::CCD,0)

# SGTQS
res_860026361=i_ajoutChampNum(g_iartout,$Tsymphta6ZTA::T4sgtqs,$Tsymphta6ZTA::SGTQS,0)

# ECC_FACT
res_860026361=i_ajoutChampNum(g_iartout,$Tsymphta6ZTA::T4eccfact,$Tsymphta6ZTA::ECC_FACT,0)

# IEZLT
# Test de presence de IEZLT car si absent, pas d'IEZLT en sortie

SI (IEZLT_860026361 != -1)
ALORS
	res_860026361 = i_ajoutChampNum(g_iartout,$Tsymphta6ZTA::T4iezlt,$Tsymphta6ZTA::IEZLT,0)
FINSI

# TAXE
SI ( (SRP_PORTE_860026361 == 1) && (tax_860026361 == 0) )
ALORS
	TAXE_CAL_SYMP_860026361 = TAXE_CAL_860026361
SINON
	TAXE_CAL_SYMP_860026361 = tax_860026361
FINSI

SI (i_valid_field_n(g_iartin,$Tta6dcZTA::T3cap1))
ALORS
	erreur_860026361=i_set_art_field(g_iartout, $Tsymphta6ZTA::TAXE:0, TAXE_CAL_SYMP_860026361)
SINON
	erreur_860026361=i_set_art_field(g_iartout, $Tsymphta6ZTA::TAXE:1, TAXE_CAL_SYMP_860026361)
FINSI

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

SI (!bREDIST_860026361)
ALORS
	res_860026361=i_LireReqConsTabDist()

	SI ( res_860026361 != 0 )
	ALORS
		#trace1( "Erreur i_LireReqConsTabDist: <%d>", res)
		#pLIBELREDIST = "i_LireReqConsTabDist"
		i_strcpy(pt_LIBELREDIST_860026361,"i_LireReqConsTabDist")
		bREDIST_860026361 = 1
	FINSI
FINSI

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

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

#---------------------------------------------------------------------------
# Criteres communs
#---------------------------------------------------------------------------
resFE_860026361 =i_LireInfoECC(instFE_860026361,0)

#---------------------------------------------------------------------------
# FCT
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# FE
#---------------------------------------------------------------------------
SI ((resFE_860026361 != 0) && !OPT_860026361 && !bREDIST_860026361 && !ROC_860026361)
ALORS
	res1_860026361=i_AjouterCouranteECC(instFE_860026361)
FINSI

#---------------------------------------------------------------------------
# TRAFIC
#---------------------------------------------------------------------------
SI ((resFE_860026361 == 0) && !OPT_860026361 && !ROC_860026361 && !bREDIST_860026361)
ALORS
	res_860026361=i_LireInfoECC(instTRAFIC_860026361,0)

	SI (res_860026361 != 0)
	ALORS
		res1_860026361=i_LireChaineInfo(res_860026361,0,3,pt_InfoCompl_860026361)
		res1_860026361=i_format_str2(pt_TRAF_FACT_860026361,"TRAF%s",pt_InfoCompl_860026361,0)
		instECCTRAFIC_860026361=i_LireInstanceECC(pt_TRAF_FACT_860026361)

		SI (!instECCTRAFIC_860026361)
		ALORS
			code_errone_860026361 = 0xA0B0
			code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
			erreur_860026361 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026361,pt_TRAF_FACT_860026361,C_Article_860026361)

			SAUT DISTRI_ERR
		FINSI
		res_860026361=i_AjouterCouranteECC(instECCTRAFIC_860026361)
	SINON
		#pLIBELREDIST = "Indicatif inconnu de MAJ2G"
		i_strcpy(pt_LIBELREDIST_860026361,"Indicatif inconnu de MAJ2G")
		bREDIST_860026361 = 1
		SAUT AVANT_REDIST
	FINSI
FINSI


#---------------------------------------------------------------------------
# DM
#---------------------------------------------------------------------------
SI ( (resFE_860026361 != 0) || OPT_860026361 || ROC_860026361) && !bREDIST_860026361
ALORS
	res_860026361=i_LireInfoECC(instTRAFIC_860026361,0)

	SI (res_860026361 != 0)
	ALORS
		erreur_860026361=i_LireChaineInfo(res_860026361,0,3,pt_InfoCompl_860026361)
		erreur_860026361=i_format_str2(pt_DM_860026361,"DM%s",pt_InfoCompl_860026361,0)
		instDM_860026361=i_LireInstanceECC(pt_DM_860026361)
		SI (!instDM_860026361)
		ALORS
			code_errone_860026361 = 0xA0B0
			code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
			erreur_860026361 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026361,pt_DM_860026361,C_Article_860026361)
			SAUT DISTRI_ERR
		FINSI

		SI (resFE_860026361)
		ALORS
			# Recuperation du code CFR pour meta c_libre de FE
			dizaine_860026361 = i_LireEntierInfo(res_860026361,0,1)
			unite_860026361 = i_LireEntierInfo(res_860026361,1,1)
			cfr_860026361 = (dizaine_860026361 & 0x0F) * 10 + (unite_860026361 & 0x0F)

			SI ( ENVELOPPE_NOK_860026361 )
			ALORS
				#IFDEF trace_niv1 = 1
				trace("__FILE__:__LINE__ ======> Creation enveloppe CFR/FE")
				#ENDIF
				ENVELOPPE_NOK_860026361 = i_add_opt("E_Tta6dcZTA")
				erreur_860026361 = i_set_attr_val_n($E_Tta6dcZTA::T1,0x22)
				erreur_860026361 = i_set_attr_val_n($E_Tta6dcZTA::L1,0x07)
			FINSI
			erreur_860026361 = i_set_attr_val_n($E_Tta6dcZTA::CFR,cfr_860026361)
			#IFDEF trace_niv1 = 1
			trace1("__FILE__:__LINE__ ======> code CFR : <%d> ", cfr_860026361)
			trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK_860026361)
			#ENDIF
		FINSI
		erreur_860026361=i_AjouterCouranteECC(instDM_860026361)
	SINON
		#pLIBELREDIST = "Indicatif inconnu de MAJ2G"
		i_strcpy(pt_LIBELREDIST_860026361,"Indicatif inconnu de MAJ2G")
		bREDIST_860026361 = 1
		SAUT AVANT_REDIST
	FINSI
FINSI

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

res_860026361=i_ValiderListeECC(0,0,0,0)

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

#---------------------------------------------------------------------------
# Valeurs communes
#---------------------------------------------------------------------------

# Initialisation des variables de presence a l etat non present
T3nos_OK_860026361=0
T3sidr_OK_860026361=0
T3cle_OK_860026361=0
T3coca_OK_860026361=0
T3cocav_OK_860026361=0
T3idav_OK_860026361=0

# NDR
res_860026361=i_get_art_str(g_iartin,$NDR,pt_NDR_860026361)

# INFNOS,NUMNOS
SI (i_valid_field_n(g_iartin,$NUMNOS))
ALORS
	T3nos_OK_860026361=1
	INFNOS_860026361=i_get_art_field(g_iartin,$INFNOS)
	res_860026361=i_get_art_str(g_iartin,$NUMNOS,pt_NUMNOS_860026361)
FINSI

# SUP
SI T3cab_OK_860026361
ALORS
	SUP_860026361=i_get_art_field(g_iartin,$SUP)
FINSI

# T3sidr
SI (i_valid_field_n(g_iartin,$T3sidr))
ALORS
	T3sidr_OK_860026361=1
FINSI

# CLE1
SI (i_valid_field_n(g_iartin,$T3cle))
ALORS
	T3cle_OK_860026361=1
	CLE1_860026361=i_get_art_field(g_iartin,$CLE1)
FINSI

# TAP
SI T3cab_OK_860026361
ALORS
	TAP_860026361=i_get_art_field(g_iartin,$TAP:1)
SINON
	TAP_860026361=i_get_art_field(g_iartin,$TAP:0)
FINSI

bitA_TAP_860026361=(TAP_860026361 & 0x80) >>4
bitC_TAP_860026361=(TAP_860026361 & 0x20) >>4
bitF_TAP_860026361=(TAP_860026361 & 0x04)
bitG_TAP_860026361=(TAP_860026361 & 0x02)
bitH_TAP_860026361=(TAP_860026361 & 0x01)

# INF_IDAV, NUM_IDAV
SI (i_valid_field_n(g_iartin,$T3idav))
ALORS
	T3idav_OK_860026361=1
	INF_IDAV_860026361=i_get_art_field(g_iartin,$INF_IDAV)
	res_860026361=i_get_art_str(g_iartin,$NUM_IDAV,pt_NUM_IDAV_860026361)
FINSI

# BETA
SI (i_valid_field_n(g_iartin,$T3coca))
ALORS
	T3coca_OK_860026361=1
	res_860026361=i_get_art_str(g_iartin,$BETA,pt_BETA_860026361)
FINSI

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

SI !(i_ChercherCouranteECC(instFE_860026361)) && !bREDIST_860026361
ALORS
	# ECC_FACT
	# VerifPcode
	#nomECCFact="FE"
	i_strcpy(pt_nomECCFact_860026361,"FE")

	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout2,C_Tfe_860026361))
	ALORS
		code_errone_860026361 = 0xA0D0
		code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
		erreur_860026361 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026361,C_Tfe_860026361,C_Article_860026361)
		SAUT DISTRI_ERR
	FINSI


	# DATE
	res_860026361=i_set_art_field(g_iartout2,$Tfe::DATE,ICAR_REL_860026361)

	# SERVICE
	res_860026361=i_set_art_str(g_iartout2,$Tfe::SERVICE,"00")

	# IDUS_NUM
	i_replace_str(pt_NDR_860026361,"BCDE","AJSC",pt_NDR_860026361)
	res_860026361=i_set_art_str(g_iartout2,$Tfe::IDUS_NUM,pt_NDR_860026361)

	# DEDE_NUM
	i_replace_str(pt_NDE_860026361,"BC","*#",pt_NDE_860026361)
	res_860026361=i_set_art_str(g_iartout2,$Tfe::DEDE_NUM,pt_NDE_860026361)

	# Paliatif bit D DEDE_INF
	INF_DEDE_TRAF_860026361 = i_get_art_field(g_iartout2,$Tfe::DEDE_INF)
	INF_DEDE_TRAF_860026361 = INF_DEDE_TRAF_860026361 & 0xEF
	res_860026361 = i_set_art_field(g_iartout2,$Tfe::DEDE_INF,INF_DEDE_TRAF_860026361)

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

	# CAX
	res_860026361=i_set_art_field(g_iartout2,$Tfe::CAX,CAX_860026361)

	# NDS_INF,NDS_NUM
	SI T3nos_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout2,$Tfe::NDS_INF,INFNOS_860026361)
		res_860026361=i_set_art_str(g_iartout2,$Tfe::NDS_NUM,pt_NUMNOS_860026361)
	FINSI

	# SUP
	SI T3cab_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout2,$Tfe::SUP,SUP_860026361)
	FINSI

	#champ DUREE
	erreur_860026361=i_set_art_field(g_iartout2, $Tfe::DUREE, dduree_860026361)

	#champ TAX
#DRE G4R6 Lot2
	SI (REJET_860026361==CPT_CPS_Loc_860026361)
	ALORS
		erreur_860026361=i_set_art_field(g_iartout2, $Tfe::TAX, tax_860026361)
	SINON
		SI ( (SRP_PORTE_860026361 == 1) && (tax_860026361 == 0) )
		ALORS
			erreur_860026361=i_set_art_field(g_iartout2,$Tfe::TAX,TAXE_CAL_860026361)
		SINON
			erreur_860026361=i_set_art_field(g_iartout2,$Tfe::TAX,tax_860026361)
		FINSI
	FINSI
#\DRE G4R6 Lot2

	# CLASSDEST
	res_860026361=i_set_art_field(g_iartout2,$Tfe::CLASSDEST,CCD_REEL_860026361)

	# MES1
	res_860026361=i_set_art_field(g_iartout2,$Tfe::MES1,255)

	# MES2
	res_860026361=i_set_art_field(g_iartout2,$Tfe::MES2,255)

	# recuperation de l indice de C_CSV1 dans Tfe, pour l'algo suivant
	ic_C_CSV1_860026361=i_get_field_num(g_iartout2,"C_CSV1")

	# NB_CSV, C_CSV et OP_CSV
	res1_860026361=0
	#IFDEF trace_niv1 = 1
	trace2( "__FILE__:__LINE__ : NDE = <%s>", pt_NDE_860026361, "" )
	#ENDIF

	SI ( (i_strplcmp( pt_NDE_860026361, "12", 0, 2 ) ==0) || (i_strplcmp( pt_NDE_860026361, "118", 0, 3 )==0) )
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"H")
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"A")
	SINON
		SI !( i_strplcmp( pt_NDE_860026361, "3212", 0, 4 ) )
		ALORS
			#IFDEF trace_niv3 = 1
			trace2( "__FILE__:__LINE__ : Pour FE : NDE = <%s>", pt_NDE_860026361, "" )
			#ENDIF
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"Z")
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"A")
		FINSI
	FINSI
	SI T3sidr_OK_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"C")
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI
	SI (T3cle_OK_860026361 && (CLE1_860026361 == 0x0B))
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"30")
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI
	SI  bitA_TAP_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"T")
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI
	SI bitC_TAP_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"3")
		res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI
	SI  (res1_860026361<5)
	ALORS
		SI bitF_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"D")
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI
		SI bitG_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"N")
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI
		SI bitH_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1),"O")
			res_860026361=i_set_art_str(g_iartout2,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI
	FINSI
	res_860026361=i_set_art_field(g_iartout2,$Tfe::NB_CSV,res1_860026361)

	# COCA
	SI T3coca_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout2,$Tfe::COCA,pt_BETA_860026361)
	FINSI

	# COCAV
	SI T3cocav_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout2,$Tfe::COCAV,pt_BETAV_860026361)
	FINSI

	# IDAV_INF,IDAV_NUM
	SI T3idav_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout2,$Tfe::IDAV_INF,INF_IDAV_860026361)
		res_860026361=i_set_art_str(g_iartout2,$Tfe::IDAV_NUM,pt_NUM_IDAV_860026361)
	FINSI
# DRE G4R6 Lot2
	# TYPE_EDIT
	erreur_860026361=i_set_art_str(g_iartout2, $Tfe::TYPE_EDIT, pt_TYPE_EDIT_860026361)
	
	# CODE_TARIF
	erreur_860026361=i_set_art_str(g_iartout2, $Tfe::CODE_TARIF, pt_CODE_TARIF_860026361)
# \DRE G4R6 Lot2

FINSI

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

SI !(i_ChercherCouranteECC(instDM_860026361)) && !bREDIST_860026361
ALORS
	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout3,C_Tdelta_minute_860026361))
	ALORS
		code_errone_860026361 = 0xA0D0
		code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
		erreur_860026361 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026361,C_Tdelta_minute_860026361,C_Article_860026361)
		SAUT DISTRI_ERR
	FINSI

	# DATE
	res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::DATE,ICAR_REL_860026361)

	# DOMAINE
	SI ( (CCD_860026361 == 0x18) && !EPORTABILITE_860026361  )
	ALORS
		res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::DOMAINE,"96")
	SINON
		res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::DOMAINE,"05")
	FINSI

	# SERVICE
	res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::SERVICE,"00")

	# IDUS_NUM
	i_replace_str(pt_NDR_860026361,"BCDE","AJSC",pt_NDR_860026361)
	res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::IDUS_NUM,pt_NDR_860026361)

	# DEDE_NUM
	i_replace_str(pt_NDE_860026361,"BC","*#",pt_NDE_860026361)
	res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::DEDE_NUM,pt_NDE_860026361)

	# Paliatif bit D DEDE_INF
	INF_DEDE_TRAF_860026361 = i_get_art_field(g_iartout3,$Tdelta_minute::DEDE_INF)
	INF_DEDE_TRAF_860026361 = INF_DEDE_TRAF_860026361 & 0xEF
	res_860026361 = i_set_art_field(g_iartout3,$Tdelta_minute::DEDE_INF,INF_DEDE_TRAF_860026361)

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

	# CAX
	res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::CAX,CAX_860026361)

	#champ TAX
	erreur_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::TAX,tax_860026361)


	# NDS_NUM
	SI T3nos_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::NDS_NUM,pt_NUMNOS_860026361)
	FINSI

	# SUP
	SI T3cab_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::SUP,SUP_860026361)
	FINSI

	#champ DUREE
	erreur_860026361=i_set_art_field(g_iartout3, $Tdelta_minute::DUREE, dduree_860026361)

	#champ TAX
	SI ( (SRP_PORTE_860026361 == 1) && (tax_860026361 == 0) )
	ALORS
		erreur_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::TAX,TAXE_CAL_860026361)
	SINON
		erreur_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::TAX,tax_860026361)
	FINSI

	# CLASSDEST
	res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::CLASSDEST,CCD_REEL_860026361)

	# MES1
	res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::MES1,255)

	# MES2
	res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::MES2,255)

	# recuperation de l indice de C_CSV1 dans Tfe, pour l'algo suivant
	ic_C_CSV1_860026361=i_get_field_num(g_iartout3,"C_CSV1")

	# NB_CSV, C_CSV et OP_CSV
	res1_860026361=0
	#IFDEF trace_niv1 = 1
	trace2( "__FILE__:__LINE__ : NDE = <%s>", pt_NDE_860026361, "" )
	#ENDIF

	SI ( (i_strplcmp( pt_NDE_860026361, "12", 0, 2 ) ==0) || (i_strplcmp( pt_NDE_860026361, "118", 0, 3 )==0) )
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"H")
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"A")
	SINON
		SI !( i_strplcmp( pt_NDE_860026361, "3212", 0, 4 ) )
		ALORS
			#IFDEF trace_niv3 = 1
			trace2( "__FILE__:__LINE__ : Pour DM : NDE = <%s>", pt_NDE_860026361, "" )
			#ENDIF
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"Z")
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"A")
		FINSI
	FINSI

	SI T3sidr_OK_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"C")
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI (T3cle_OK_860026361 && (CLE1_860026361 == 0x0B))
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"30")
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI  bitA_TAP_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"T")
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI bitC_TAP_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"3")
		res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI  (res1_860026361<5)
	ALORS

		SI bitF_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"D")
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI

		SI bitG_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"N")
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI

		SI bitH_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1),"O")
			res_860026361=i_set_art_str(g_iartout3,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI
	FINSI
	res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::NB_CSV,res1_860026361)

	# STY
	res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::STY,"FF")

	# COCA
	SI T3coca_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::COCA,pt_BETA_860026361)
	FINSI

	# COCAV
	SI T3cocav_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::COCAV,pt_BETAV_860026361)
	FINSI

	# IDAV_INF,IDAV_NUM
	SI T3idav_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout3,$Tdelta_minute::IDAV_INF,INF_IDAV_860026361)
		res_860026361=i_set_art_str(g_iartout3,$Tdelta_minute::IDAV_NUM,pt_NUM_IDAV_860026361)
	FINSI

	#champ SGTQS
	res_860026361=i_set_art_str(g_iartout3, $Tdelta_minute::SGTQS,i_LireEECSGTQS(g_ieec) )
FINSI

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

SI !(i_ChercherCouranteECC(instECCTRAFIC_860026361)) && !bREDIST_860026361
ALORS
	# ECC_FACT
	# VerifPcode
	#nomECCFact=pt_TRAF_FACT
	i_strcpy(pt_nomECCFact_860026361,pt_TRAF_FACT_860026361)

	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout4,C_Ttrafic_860026361))
	ALORS
		code_errone_860026361 = 0xA0D0
		code_errone_860026361 = code_errone_860026361 + EFFICACE_860026361
		erreur_860026361 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026361,C_Ttrafic_860026361,C_Article_860026361)
		SAUT DISTRI_ERR
	FINSI

	# DATE
	res_860026361=i_set_art_field(g_iartout4,$Ttrafic::DATE,ICAR_REL_860026361)

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

	# SERVICE
	res_860026361=i_set_art_str(g_iartout4,$Ttrafic::SERVICE,"00")

	# IDUS_NUM
	i_replace_str(pt_NDR_860026361,"BCDE","AJSC",pt_NDR_860026361)
	res_860026361=i_set_art_str(g_iartout4,$Ttrafic::IDUS_NUM,pt_NDR_860026361)

	# DEDE_NUM
	i_replace_str(pt_NDE_860026361,"BC","*#",pt_NDE_860026361)
	res_860026361=i_set_art_str(g_iartout4,$Ttrafic::DEDE_NUM,pt_NDE_860026361)

	# Paliatif bit D DEDE_INF
	INF_DEDE_TRAF_860026361 = i_get_art_field(g_iartout4,$Ttrafic::DEDE_INF)
	INF_DEDE_TRAF_860026361 = INF_DEDE_TRAF_860026361 & 0xEF
	res_860026361 = i_set_art_field(g_iartout4,$Ttrafic::DEDE_INF,INF_DEDE_TRAF_860026361)

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

	# CAX
	res_860026361=i_set_art_field(g_iartout4,$Ttrafic::CAX,CAX_860026361)

	# NDS_NUM
	SI T3nos_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout4,$Ttrafic::NDS_NUM,pt_NUMNOS_860026361)
	FINSI

	# SUP
	SI T3cab_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout4,$Ttrafic::SUP,SUP_860026361)
	FINSI

	#champ DUREE
	erreur_860026361=i_set_art_field(g_iartout4, $Ttrafic::DUREE, dduree_860026361)

	#champ TAX
#DRE G4R6 Lot2
	SI (REJET_860026361==CPT_CPS_Loc_860026361)
	ALORS
		erreur_860026361=i_set_art_field(g_iartout4, $Ttrafic::TAX, tax_860026361)
	SINON
		SI ( (SRP_PORTE_860026361 == 1) && (tax_860026361 == 0) )
		ALORS
			erreur_860026361=i_set_art_field(g_iartout4, $Ttrafic::TAX,TAXE_CAL_860026361)
		SINON
			erreur_860026361=i_set_art_field(g_iartout4, $Ttrafic::TAX, tax_860026361)
		FINSI
	FINSI
#\DRE G4R6 Lot2

	# CLASSDEST
	res_860026361=i_set_art_field(g_iartout4,$Ttrafic::CLASSDEST,CCD_REEL_860026361)

	# MES1
	res_860026361=i_set_art_field(g_iartout4,$Ttrafic::MES1,255)

	# MES2
	res_860026361=i_set_art_field(g_iartout4,$Ttrafic::MES2,255)

	# recuperation de l indice de C_CSV1 dans Tfe, pour l'algo suivant
	ic_C_CSV1_860026361=i_get_field_num(g_iartout4,"C_CSV1")

	# NB_CSV, C_CSV et OP_CSV
	res1_860026361=0
	#IFDEF trace_niv1 = 1
	trace2( "__FILE__:__LINE__ : NDE = <%s>", pt_NDE_860026361, "" )
	#ENDIF

	SI ( (i_strplcmp( pt_NDE_860026361, "12", 0, 2 ) ==0) || (i_strplcmp( pt_NDE_860026361, "118", 0, 3 )==0) )
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"H")
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"A")
	SINON
		SI !( i_strplcmp( pt_NDE_860026361, "3212", 0, 4 ) )
		ALORS
			#IFDEF trace_niv3 = 1
			trace2( "__FILE__:__LINE__ : Pour TRAFIC : NDE = <%s>", pt_NDE_860026361, "" )
			#ENDIF
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"Z")
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"A")
		FINSI
	FINSI

	SI T3sidr_OK_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"C")
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI (T3cle_OK_860026361 && (CLE1_860026361 == 0x0B))
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"30")
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI  bitA_TAP_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"T")
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI bitC_TAP_860026361
	ALORS
		res1_860026361=res1_860026361+1
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"3")
		res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
	FINSI

	SI  (res1_860026361<5)
	ALORS
		SI bitF_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"D")
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI

		SI bitG_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"N")
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI

		SI bitH_TAP_860026361
		ALORS
			res1_860026361=res1_860026361+1
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1),"O")
			res_860026361=i_set_art_str(g_iartout4,ic_C_CSV1_860026361+2*(res1_860026361-1)+1,"U")
		FINSI
	FINSI
	res_860026361=i_set_art_field(g_iartout4,$Ttrafic::NB_CSV,res1_860026361)

	# STY
	res_860026361=i_set_art_str(g_iartout4,$Ttrafic::STY,"FF")

	# COCA
	SI T3coca_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout4,$Ttrafic::COCA,pt_BETA_860026361)
	FINSI

	# COCAV
	SI T3cocav_OK_860026361
	ALORS
		res_860026361=i_set_art_str(g_iartout4,$Ttrafic::COCAV,pt_BETAV_860026361)
	FINSI

	# IDAV_INF,IDAV_NUM
	SI T3idav_OK_860026361
	ALORS
		res_860026361=i_set_art_field(g_iartout4,$Ttrafic::IDAV_INF,INF_IDAV_860026361)
		res_860026361=i_set_art_str(g_iartout4,$Ttrafic::IDAV_NUM,pt_NUM_IDAV_860026361)
	FINSI

	#champ SGTQS
	res_860026361=i_set_art_str(g_iartout4, $Ttrafic::SGTQS,i_LireEECSGTQS(g_ieec) )
# DRE G4R6 Lot2
	# TAG
	erreur_860026361=i_set_art_str(g_iartout4, $Ttrafic::TAG, " ")
	
	# TYPE_EDIT
	erreur_860026361=i_set_art_str(g_iartout4, $Ttrafic::TYPE_EDIT, pt_TYPE_EDIT_860026361)
	
	# CODE_TARIF
	erreur_860026361=i_set_art_str(g_iartout4, $Ttrafic::CODE_TARIF, pt_CODE_TARIF_860026361)
# \DRE G4R6 Lot2

FINSI

#---------------------------------------------------------------------------
# FCT
#---------------------------------------------------------------------------

POINT AVANT_REDIST

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

	# CCD
	res_860026361= i_set_art_field(g_iartout,$Tsymphta6ZTA::CCD,CCD_REEL_860026361)

	# SGTQS
	res_860026361=i_set_art_str(g_iartout,$Tsymphta6ZTA::SGTQS,i_LireEECSGTQS(g_ieec))

	# ECC_FACT
	res_860026361=i_set_art_str(g_iartout,$Tsymphta6ZTA::ECC_FACT,pt_nomECCFact_860026361)

	# IEZLT
	SI (IEZLT_860026361 != -1)
	ALORS
		res_860026361= i_set_art_field(g_iartout,$Tsymphta6ZTA::IEZLT,IEZLT_860026361)
	FINSI

	# CODCIRDR
	erreur_860026361=i_ajoutChampNum( g_iartout, $Tsymphta6ZTA::T4codcirdr, $Tsymphta6ZTA::CODCIRDR, 0 )
	erreur_860026361=i_set_art_str( g_iartout, $Tsymphta6ZTA::CODCIRDR, pt_CODCIRDA_860026361 )

	# CODCIR
	erreur_860026361=i_ajoutChampNum( g_iartout, $Tsymphta6ZTA::T4codcir, $Tsymphta6ZTA::CODCIR, 0 )
	erreur_860026361=i_set_art_str( g_iartout, $Tsymphta6ZTA::CODCIR, pt_CODCIRA_860026361 )
	
# DRE G4R6 Lot2
	# TYPE_EDIT
	SI i_strcmp(pt_TYPE_EDIT_860026361," ") != 0
	ALORS
		erreur_860026361 = i_ajoutChampNum(g_iartout,$Tsymphta6ZTA::T4type_edit,$Tsymphta6ZTA::TYPE_EDIT,0)
		erreur_860026361=i_set_art_str(g_iartout, $Tsymphta6ZTA::TYPE_EDIT, pt_TYPE_EDIT_860026361)
	FINSI

	# CODE_TARIF
	SI i_strcmp(pt_CODE_TARIF_860026361,"    ") != 0
	ALORS
		erreur_860026361 = i_ajoutChampNum(g_iartout,$Tsymphta6ZTA::T4code_tarif,$Tsymphta6ZTA::CODE_TARIF,0)
		erreur_860026361=i_set_art_str(g_iartout, $Tsymphta6ZTA::CODE_TARIF, pt_CODE_TARIF_860026361)
	FINSI
# \DRE G4R6 Lot2


	#---------------------------------------------------------------------------
	# Symphonie
	#---------------------------------------------------------------------------
	SI !(i_ChercherCouranteECC(instSYMPHO_860026361))
	ALORS
		res_860026361=i_stocke_art_iecc(g_iartout,instSYMPHO_860026361)
	FINSI
FINSI

SI (bREDIST_860026361 == 1)
ALORS
	SAUT DISTRI_RDT
FINSI

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

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

SI !(i_ChercherCouranteECC(instFE_860026361))
ALORS
	res_860026361=i_stocke_art_iecc(g_iartout2,instFE_860026361)
FINSI

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

SI !(i_ChercherCouranteECC(instDM_860026361))
ALORS
	res_860026361=i_stocke_art_iecc(g_iartout3,instDM_860026361)
FINSI

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

SI !(i_ChercherCouranteECC(instECCTRAFIC_860026361))
ALORS
	res_860026361=i_stocke_art_iecc(g_iartout4,instECCTRAFIC_860026361)
FINSI

#---------------------------------------------------------------------------
# FCT
#---------------------------------------------------------------------------

RETOUR TRAIT_OK

############################################################################
# Envoi vers Recyclage
############################################################################

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

POINT DISTRI_ERR

res_860026361=i_make_art_rej(g_iartin, g_iartout, code_errone_860026361)
res_860026361=i_stocke_art(g_iartout,0,PT_ERRONE,0)

RETOUR TRAIT_OK

# DRE G4R6 Lot2
###########################################################################
# Stockage en elimine   
###########################################################################

POINT DISTRI_DIV

#IFDEF trace_niv1 = 1
trace( "__FILE__:__LINE__ : Fin du Pcode de distribution : Stockage en DIVERS" )
#ENDIF

res_860026361 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0 )

RETOUR TRAIT_OK
# \DRE G4R6 Lot2

############################################################################
# Stockage en Redistribution
############################################################################

POINT DISTRI_RDT

trace("Envoi en redistribution")

SI (trait_ok_860026361 == 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

	SI ( ENVELOPPE_NOK_860026361 )
	ALORS
		#IFDEF trace_niv1 = 1
		trace("__FILE__:__LINE__ =====> Creation enveloppe REDISTRI")
		#ENDIF
		ENVELOPPE_NOK_860026361 = i_add_opt( "E_Tta6dcZTA" )
		# champ T1 (=>  0x22 pour la reconnaissance de l'enveloppe,

		# Champ L1
	FINSI

	i_strcpy(pt_SGTQS_860026361,i_LireEECSGTQS(g_ieec))
	res_860026361 = i_set_attr_str_n( $E_Tta6dcZTA::Nom_EEC, pt_SGTQS_860026361)
	res_860026361 = i_get_attr_str_n($E_Tta6dcZTA::Nom_EEC, pt_SGTQS_860026361)
	erreur_860026361 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026361,"Tta6dcZTA",pt_SGTQS_860026361)
FINSI

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

RETOUR TRAIT_OK
