DEFINITION NUMTAB_860026359 1
DEFINITION ZONEMETRO_860026359 7
DEFINITION INST_ACLA_860026359 "ACLA"
DEFINITION C_Article_860026359 "Tns6dcZTA"
DEFINITION C_InstSYMP_860026359 "SYMP"
DEFINITION C_InstFE_860026359 "FE"
DEFINITION C_InstTRAFIC_860026359 "TRAFIC"
DEFINITION C_Tfe_860026359 "Tfe"
DEFINITION C_Tdelta_minute_860026359 "Tdelta_minute"
DEFINITION C_Ttrafic_860026359 "Ttrafic"
DEFINITION CCD_Internat_860026359 6
DEFINITION CPT_CPS_Loc_860026359 16
DEFINITION CPT_CPS_RI_860026359 17
DEFINITION C_DATCPS_860026359 "DATCPS" 
DEFINITION TD_SVA_860026359 9
DEFINITION C_INST_ALICE_860026359 "ALICE"
REGISTRE ENTIER instDM_860026359
REGISTRE ENTIER instTRAFIC_860026359
REGISTRE ENTIER instFE_860026359
REGISTRE ENTIER instSYMPHO_860026359
REGISTRE ENTIER T3nos_OK_860026359
REGISTRE ENTIER T3cab_OK_860026359
REGISTRE ENTIER T3sidr_OK_860026359
REGISTRE ENTIER T3cle_OK_860026359
REGISTRE ENTIER T3coca_OK_860026359
REGISTRE ENTIER T3cocav_OK_860026359
REGISTRE ENTIER T3idav_OK_860026359
REGISTRE ENTIER Mes1_ok_860026359
REGISTRE ENTIER Mes2_ok_860026359
REGISTRE ENTIER IEZLT_860026359
REGISTRE ENTIER CCD_860026359
REGISTRE ENTIER ICAR_REL_860026359
REGISTRE ENTIER ICAR_ABS_860026359
REGISTRE ENTIER EPORTABILITE_860026359
REGISTRE ENTIER b_SPORTABILITE_860026359
REGISTRE ENTIER instECCTRAFIC_860026359
REGISTRE ENTIER SRP_PORTE_860026359
REGISTRE ENTIER TAXE_CAL_860026359
REGISTRE ENTIER TAXE_CAL_SYMP_860026359
REGISTRE ENTIER EPORTABILITE_SCP_860026359
REGISTRE ENTIER SPORTABILITE_SCP_860026359
REGISTRE ENTIER instACLA_860026359
REGISTRE ENTIER CCD_REEL_860026359
REGISTRE ENTIER SUP_860026359
REGISTRE ENTIER INFNOS_860026359
REGISTRE ENTIER CLE1_860026359
REGISTRE ENTIER TAP_860026359
REGISTRE ENTIER CAX_860026359
REGISTRE ENTIER INF_IDAV_860026359
REGISTRE ENTIER ddebut_860026359
REGISTRE ENTIER dduree_860026359
REGISTRE ENTIER tax_860026359
REGISTRE ENTIER MES1_860026359
REGISTRE ENTIER MES2_860026359
REGISTRE ENTIER res_860026359
REGISTRE ENTIER res1_860026359
REGISTRE ENTIER resFE_860026359
REGISTRE ENTIER erreur_860026359
REGISTRE ENTIER bitA_TAP_860026359
REGISTRE ENTIER bitC_TAP_860026359
REGISTRE ENTIER bitF_TAP_860026359
REGISTRE ENTIER bitG_TAP_860026359
REGISTRE ENTIER bitH_TAP_860026359
REGISTRE ENTIER ic_C_CSV1_860026359
REGISTRE ENTIER trait_ok_860026359
REGISTRE ENTIER bREDIST_860026359
REGISTRE ENTIER INF_DEDE_TRAF_860026359
REGISTRE ENTIER gmt_date_860026359
REGISTRE ENTIER L_NDR_860026359
REGISTRE ENTIER pref_860026359
REGISTRE ENTIER nb_digit_860026359
REGISTRE ENTIER OPT_860026359
REGISTRE ENTIER ROC_860026359
REGISTRE ENTIER EFFICACE_860026359
REGISTRE ENTIER code_errone_860026359
REGISTRE ENTIER dizaine_860026359
REGISTRE ENTIER unite_860026359
REGISTRE ENTIER cfr_860026359
REGISTRE ENTIER ENVELOPPE_NOK_860026359
REGISTRE ENTIER Date_CPS_860026359
REGISTRE ENTIER instALICE_860026359 
REGISTRE ENTIER REJET_860026359
REGISTRE ENTIER longueur_860026359 
REGISTRE POINTEUR pt_BETA_860026359
REGISTRE POINTEUR pt_BETAV_860026359
REGISTRE POINTEUR pt_NDR_860026359
REGISTRE POINTEUR pt_NUMNOS_860026359
REGISTRE POINTEUR pt_NDE_860026359
REGISTRE POINTEUR pt_NUM_IDAV_860026359
REGISTRE POINTEUR pt_LIBELREDIST_860026359
REGISTRE POINTEUR pt_nomECCFact_860026359
REGISTRE POINTEUR pt_CODCIRDA_860026359
REGISTRE POINTEUR pt_CODCIRA_860026359
REGISTRE POINTEUR pt_BUF_860026359
REGISTRE POINTEUR pt_InfoCompl_860026359
REGISTRE POINTEUR pt_TRAF_FACT_860026359
REGISTRE POINTEUR pt_DM_860026359
REGISTRE POINTEUR pt_SGTQS_860026359
REGISTRE POINTEUR pt_CodeOp_860026359
REGISTRE POINTEUR pt_CODESCP_860026359
REGISTRE POINTEUR pt_MESSAGE_860026359
REGISTRE POINTEUR pt_CODE_TARIF_860026359 
REGISTRE POINTEUR pt_TYPE_EDIT_860026359 
REGISTRE POINTEUR pt_TEMP_860026359
REGISTRE POINTEUR pt_NORM_860026359
# ---------------------------------------------------------------------------
#
# FICHIER : Tns6dcZTA.src
#
# VERSION : %version: 19 %
#
# AUTEUR      : %created_by: loic %
#
# CREE le     : 13/03/02 15:05
#
# MODIFIE le  : %date_modified: 10/04/02 15:10 %
#
# 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
#	21/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 Complements de Service sont supprimes.
#	10/20/2002 - MCH : FO48 	: Ajout condition !EPORTABILITE pour FCT
#	15/10/2002 - PSA : FO18 et FO45 : modif format pour FOR
#			   FO55 : appel a CodeOperateur uniquement en cas portabilite entrante potentielle
#	24/10/2002 - PSA : FO48 : initialisation de EPORTABILITE
#	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 copie de metachamps (suppression dans dup_tab)
#	10/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 - FO240 : 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
# 	22/10/2003 - DRE - FO452 : champ cocav pour DM
#	04/12/2003 - PSA - Prise en compte offre DIAL (Cg)
#	30/01/2004 - RBE - Ci : filtrer vers FE les dede=A5(Rappel sur OCcupation)
# 	18/03/2004 - RBE - FO568 : Pour FOR garder le champ tax d entree
# 	18/03/2004 - RBE - FO585 : pas de MAJ de tax si AR appartient pas a 45S
#	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
#       17/03/2005 - FAL - G2R0Cbbb :FO1171 CCD_REEL incorrect pour SPORTABILITE_SCP
#       21/03/2005 - FAL - G2R0Cbbb :FO1164
#       09/05/2005 - FAL - FO1275 CS dans le cas du 12 et 118XYZ pour 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 >)
#	08/08/2007 - JLG - ParamFTSA-G3R3 lot2 Arret de FCT pour RTC
#	08/10/2007 - FAL - ParamFTSA-G3R3 lot2 FO2239 TAX de TRAFIC FE RPV DM ALLOFACT et CentaureVG
#	03/10/2011 - THE - VerifPcode
#	11/02/2013 - DRE - G4R02 : QC677, rechercher SCP-SRP uniquement si Dde non international
#	31/03/2014 - DRE - G4R6 : Lot2 prise en compte des nouveaux Type Control envoy?s par la base (C+S )
#	25/04/2014 - DRE - G4R6 QC807
#
# ---------------------------------------------------------------------------


############################################################################
# Declarations
############################################################################
# VerifPcode
#DRE QC677
#DRE G4R6 lot2
#\DRE G4R6 lot2


# Variables fonctionnelles
# VerifPcode
# Numero d'instances
# Variables de presence de champ
# Variables associees a la valeur de champ
# Variables utilisees pour la redistribution
#DRE G4R6 lot2


# Pointeurs
# VerifPcode

# DRE G4R6 lot2

# Initialisation des pointeurs
pt_BUF_860026359		= "04567890123456789012345678912312345"
#pt_BUF1	= "27272727272727272727272727272727272"
pt_BETA_860026359		= "001112345"
pt_BETAV_860026359		= "112212345"
pt_NDR_860026359		= "123456789012345"
pt_NUMNOS_860026359		= "123456789012345678901234567812345"
pt_NDE_860026359		= "1234567890123456789012345612345"
pt_NUM_IDAV_860026359	= "12345678901234567890123412345"
pt_InfoCompl_860026359	= "123412345"
pt_TRAF_FACT_860026359	= "1234567812345"
pt_DM_860026359		= "8765432112345"
pt_LIBELREDIST_860026359	= "78901234567890123456789012345612345"
pt_SGTQS_860026359	= "12345678901212345"
pt_CodeOp_860026359	= "54567890123456789012345678912312345"
pt_nomECCFact_860026359	= "67676767676767"
#SGTQS		= "9999999999999"
pt_CODCIRDA_860026359	= "53453546"
pt_CODCIRA_860026359		= "78474546"
pt_CODESCP_860026359	= "15151515151515151515151515"
# DRE G4R6 lot2
pt_MESSAGE_860026359 = "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_860026359	 = "pt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDIST"
pt_CODE_TARIF_860026359 	 = "pt_CODE_TARIFpt_CODE_TARIF"
pt_TYPE_EDIT_860026359	 = "pt_TYPE_EDIT"
pt_TEMP_860026359		 = "pt_TEMP9179179179179179179179179179179179171917"
pt_NORM_860026359		 = "pt_NORMpt_NORMpt_NORMpt_NORMpt_NORMpt_NORMpt_NO"

# Initialisation
i_strcpy(pt_nomECCFact_860026359,"")
i_strcpy(pt_CODESCP_860026359,"")
# VerifPcode
i_strcpy(pt_BUF_860026359,"")
i_strcpy(pt_BETA_860026359,"")
i_strcpy(pt_BETAV_860026359,"")
i_strcpy(pt_NDR_860026359,"")
i_strcpy(pt_NUMNOS_860026359,"")
i_strcpy(pt_NDE_860026359,"")
i_strcpy(pt_NUM_IDAV_860026359,"")
i_strcpy(pt_InfoCompl_860026359,"")
i_strcpy(pt_TRAF_FACT_860026359,"")
i_strcpy(pt_DM_860026359,"")
i_strcpy(pt_LIBELREDIST_860026359,"")
i_strcpy(pt_SGTQS_860026359,"")
i_strcpy(pt_CodeOp_860026359,"")
i_strcpy(pt_CODCIRDA_860026359,"")
i_strcpy(pt_CODCIRA_860026359,"")
# DRE G4R6 lot2
i_strcpy(pt_MESSAGE_860026359, "")
i_strcpy(pt_CODE_TARIF_860026359 , "    ")
i_strcpy(pt_TYPE_EDIT_860026359 , " ")
i_strcpy(pt_TEMP_860026359 , " ")
i_strcpy(pt_NORM_860026359 , "")



# Variables entieres
instSYMPHO_860026359	= 0
instFE_860026359		= 0
instTRAFIC_860026359	= 0
instDM_860026359		= 0
TAXE_CAL_860026359	= 0
TAXE_CAL_SYMP_860026359	= 0
EFFICACE_860026359	= 1
bREDIST_860026359		= 0
nb_digit_860026359	= 0
pref_860026359		= -1
OPT_860026359		= 0
ROC_860026359		= 0
ENVELOPPE_NOK_860026359	= -1
b_SPORTABILITE_860026359	= 0
EPORTABILITE_860026359 = 0
EPORTABILITE_SCP_860026359 = 0
SPORTABILITE_SCP_860026359 = 0
#DRE G4R6 lot2
Date_CPS_860026359 	 = 0
instALICE_860026359 	 = -1
tax_860026359 		 = 0
REJET_860026359    = 0
longueur_860026359 = 0


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

ddebut_860026359=i_get_art_field(g_iartin,$ddebut)
SI ( ddebut_860026359 == -1)
ALORS
	code_errone_860026359 = 0xA080
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026359, C_Article_860026359, "i_get_art_field/ddebut" )
	SAUT DISTRI_ERR
FINSI
gmt_date_860026359 = i_DHgetCe2gTime(NUMTAB_860026359,ZONEMETRO_860026359,ddebut_860026359)

# ICAR_ABS et ICAR_REL
ICAR_ABS_860026359 = i_get_art_field(g_iartin,$DATE)

SI ( ICAR_ABS_860026359 == -1 )
ALORS
	code_errone_860026359 = 0xA080
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026359, C_Article_860026359, "i_get_art_field/DATE" )
	SAUT DISTRI_ERR
FINSI
ICAR_REL_860026359 = i_date_locale(g_ieec,g_iartin,ICAR_ABS_860026359)

SI ( ICAR_REL_860026359 == -1 )
ALORS
	code_errone_860026359 = 0xA080
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026359, C_Article_860026359, "i_date_locale/ICAR_ABS" )
	SAUT DISTRI_ERR
FINSI

dduree_860026359=i_get_art_field(g_iartin,$dduree)
tax_860026359=i_get_art_field(g_iartin,$tax)

# Variable fonctionnelle IEZLT:
#Recuperation de la valeur de IEZLT
IEZLT_860026359=-1
SI (i_valid_field_n(g_iartin,$T4ZLT))
ALORS
	IEZLT_860026359 = i_get_art_field(g_iartin,$ZLT)
FINSI
#trace1("IEZLT=<%d>",IEZLT)

# CCD
CCD_860026359=255
SI (i_valid_field_n(g_iartin,$CCD))
ALORS
	CCD_860026359=i_get_art_field(g_iartin,$CCD)
FINSI

# DRE QC677 recuperation plus tot de TAXCAL calcule dans le traitement
SRP_PORTE_860026359 = 0
SI ( i_valid_field_n(g_iartin, $TAXCAL) )
ALORS
	SRP_PORTE_860026359 = 1
	TAXE_CAL_860026359 = i_get_art_field( g_iartin, $Tns6dcZTA::TAXCAL )
FINSI

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

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


#DRE QC677
SI CCD_860026359 != CCD_Internat_860026359
ALORS

	# Portabilite
	erreur_860026359=i_get_art_str(g_iartin,$NDE,pt_BUF_860026359)
	pt_CodeOp_860026359 = CodeOperateurTable6_860026233(gmt_date_860026359, pt_BUF_860026359, "45S")
	SI (!i_strcmp(pt_CodeOp_860026359, "84208"))
	ALORS
		EPORTABILITE_860026359 = 1
	SINON
		SI (pt_CodeOp_860026359 != g_inull)
		ALORS
			b_SPORTABILITE_860026359 = 1
		FINSI
	FINSI
	
	
	#trace1("EPORTABILITE=<%d>", EPORTABILITE)
	#trace1("CCD REEL = <%d>", CCD)
	
	######################## Portabiliti Entrante ou Sortante SCP (referentiel ACLA)###########################
	
	#trace("------------RECHERCHE INSTANCE ACLA-------------")
	instACLA_860026359 = i_LireInstanceECC(INST_ACLA_860026359)
	
	SI (!instACLA_860026359)
	ALORS
		trace ("---------------------Pas d'instance pour ACLA------------------------------")
		erreur_860026359 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"ACLA",C_Article_860026359,g_ieec)
		SAUT DISTRI_ERR
	FINSI
	#trace1("--------------- instACLA= <%d> -----------------",instACLA)
	
	##############################################################################
	# Envoi Requetes Table de Distribution ACLA
	##############################################################################
	
	#FO1164
	erreur_860026359=i_get_art_str(g_iartin,$NDE,pt_BUF_860026359)
	pt_CODESCP_860026359 = CodeOperateurTable6_860026233(gmt_date_860026359, pt_BUF_860026359,"ACLA")
	#trace2(" ----- Tns6dcZTA -resultat pt_CODESCP : <%s> ----- ",pt_CODESCP,"")
	
	SI (!i_strcmp(pt_CODESCP_860026359, "84008"))
	ALORS
		EPORTABILITE_SCP_860026359 = 1
	SINON
		SI (i_strcmp(pt_CODESCP_860026359,"84008")!=0 && i_strcmp(pt_CODESCP_860026359,"")!=0)
		ALORS
			SPORTABILITE_SCP_860026359 = 1
		FINSI
	FINSI
FINSI
#FIN DRE QC677

#---------------------------------------------------------------------------
# Variable fonctionnelle CCD_REEL
#---------------------------------------------------------------------------

SI (EPORTABILITE_860026359 == 1)
ALORS
	CCD_REEL_860026359 = 212
SINON
	SI (EPORTABILITE_SCP_860026359 == 1)
	ALORS
		CCD_REEL_860026359 = 218
	SINON
		SI (b_SPORTABILITE_860026359 == 1)
		ALORS
			CCD_REEL_860026359 = 213
		SINON
			SI (SPORTABILITE_SCP_860026359 == 1)
			ALORS
				CCD_REEL_860026359 = 219
			SINON
				CCD_REEL_860026359 = CCD_860026359
			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,$T3cap2))
ALORS
	T3cab_OK_860026359=0
	CAX_860026359=i_get_art_field(g_iartin,$CAX:0)
SINON
	T3cab_OK_860026359=1
	CAX_860026359=i_get_art_field(g_iartin,$CAX:1)
FINSI

# COCA/COCAV
T3cocav_OK_860026359 = 0
SI (i_valid_field_n(g_iartin,$BETAV))
ALORS
	T3cocav_OK_860026359 = 1
	erreur_860026359=i_get_art_str(g_iartin,$BETAV,pt_BETAV_860026359)
	nb_digit_860026359=i_strlen(pt_BETAV_860026359)
	SI (nb_digit_860026359>0)
	ALORS
		pref_860026359 = g_iartin.BETAV[nb_digit_860026359-1]
		SI (nb_digit_860026359>1)
		ALORS
			pref_860026359 = ( 10*(g_iartin.BETAV[nb_digit_860026359-2]) + pref_860026359 )
			SI (nb_digit_860026359>2)
			ALORS
				pref_860026359 = ( 100*(g_iartin.BETAV[nb_digit_860026359-3]) + pref_860026359 )
				SI (nb_digit_860026359>3)
				ALORS
					pref_860026359 = ( 1000*(g_iartin.BETAV[nb_digit_860026359-4]) + pref_860026359 )
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

SI ((pref_860026359 != 8) && (pref_860026359 != -1))
ALORS
	OPT_860026359 = 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_860026359 = 1
FINSI

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

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

SI ( trait_ok_860026359 > 0 )
ALORS
	ENVELOPPE_NOK_860026359 = 0
FINSI

# NDE
SI ( i_valid_field_n(g_iartin, $NDE ) )
ALORS
	erreur_860026359 = i_get_art_str(g_iartin, $NDE, pt_NDE_860026359)
FINSI


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

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

#DRE G4R6 QC807
#SI (REJET==CPT_CPS_Loc)
SI (REJET_860026359==CPT_CPS_Loc_860026359 || REJET_860026359==CPT_CPS_RI_860026359)
ALORS
	i_strcpy(pt_TEMP_860026359, i_get_tab_field( "TDATCPS", gmt_date_860026359, C_DATCPS_860026359 ))

	erreur_860026359 = i_set_art_str (g_iartout10,$Conversion::DATE_STR,pt_TEMP_860026359)
	Date_CPS_860026359 = i_get_art_field(g_iartout10, $Conversion::DATE_ASC)
			
	SI ddebut_860026359 < Date_CPS_860026359
	ALORS
		erreur_860026359 = i_format_str2(pt_MESSAGE_860026359," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_NDE_860026359,pt_TEMP_860026359)
		code_errone_860026359 = 0xA080
		code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
		erreur_860026359 = i_PlvMessEmettre( 8599, 1, g_iartin,"", 3,code_errone_860026359, C_Article_860026359, pt_MESSAGE_860026359 )
		SAUT DISTRI_DIV
	SINON
		SI ( i_valid_field_n(g_iartin, $NORMAL ) )
		ALORS
			erreur_860026359 = i_get_art_str(g_iartin, $NORMAL, pt_NORM_860026359 )
		SINON
			SI ( i_valid_field_n(g_iartin, $NDE ) )
			ALORS
				erreur_860026359 = i_get_art_str(g_iartin, $NDE, pt_NORM_860026359)
			FINSI
		FINSI
		
		i_get_sub_str(pt_NORM_860026359, 0, 0, pt_BUF_860026359)
		
		SI (i_strcmp(pt_BUF_860026359, "0") == 0)
		ALORS
			i_get_sub_str(pt_NORM_860026359, 1, -1, pt_NORM_860026359)
		FINSI
		
		#######################################
		#  Soumission de la requete de consultation d'une table de distribution ALICE
		#######################################
		longueur_860026359 = i_conv_ascii_dcb (pt_NORM_860026359, pt_TEMP_860026359)
		SI (i_EnvoiReqConsTabDist( TD_SVA_860026359,gmt_date_860026359,pt_TEMP_860026359,longueur_860026359,0,1) != 0)
		ALORS
			#trace("Erreur i_EnvoiReqConsTabDist ALICE")
			bREDIST_860026359 = 1
			i_strcpy(pt_LIBELREDIST_860026359,"Echec sur i_EnvoiReqConsTabDistDouble ALICE ")
		FINSI
		
		#######################################
		# Recherche de l'instance ECC ALICE
		#######################################
		instALICE_860026359 = i_LireInstanceECC(C_INST_ALICE_860026359)
		SI (!instALICE_860026359)
		ALORS
			#trace("Pas d'instance pour ALICE !")
			erreur_860026359 = i_PlvMessEmettre(8501,1,g_iartin,"",3,C_INST_ALICE_860026359,C_Article_860026359,g_ieec)
			SAUT DISTRI_ERR
		FINSI
		#trace1("instALICE  =<%d>",instALICE)	

		#######################################
		# Lecture Resultat requete ALICE
		#######################################
		erreur_860026359 = i_LireReqConsTabDist()
		#trace1("RETOUR i_LireReqConsTabDist retour requette ALICE, erreur=<%d>",erreur)
		SI ( erreur_860026359 != 0 )
		ALORS
			#trace1( "Erreur i_LireReqConsTabDist ALICE: <%d>", erreur)
			bREDIST_860026359 = 1
			i_strcpy(pt_LIBELREDIST_860026359,"Echec sur i_LireReqConsTabDistDouble ALICE ")
		FINSI
		res_860026359 = i_LireInfoECC( instALICE_860026359, 0 )
		
		SI (res_860026359 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026359 = i_LireChaineInfo( res_860026359, 0, 4, pt_BUF_860026359 )
			SI i_strcmp(pt_BUF_860026359,"") != 0
			ALORS
				i_strcpy(pt_CODE_TARIF_860026359,pt_BUF_860026359)
			SINON
				# info complementaire CODE_TARIF vide
				bREDIST_860026359 = 1
				erreur_860026359 = i_format_str2(pt_LIBELREDIST_860026359," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NDE_860026359,0)
			FINSI
			
			erreur_860026359 = i_LireChaineInfo( res_860026359, 4, 1, pt_BUF_860026359 )
			SI i_strcmp(pt_BUF_860026359,"") != 0
			ALORS
				i_strcpy(pt_TYPE_EDIT_860026359,pt_BUF_860026359)
			SINON
				# info complementaire TYPE_EDIT vide
				bREDIST_860026359 = 1
				erreur_860026359 = i_format_str2(pt_LIBELREDIST_860026359," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NDE_860026359,0)
			FINSI
		SINON
			bREDIST_860026359 = 1
			erreur_860026359 = i_format_str2(pt_LIBELREDIST_860026359," AR <%s> non trouve dans ALICE",pt_NDE_860026359,0)
		FINSI
	FINSI
FINSI
#\DRE G4R6 lot2


L_NDR_860026359 = i_get_art_fieldlength(g_iartin,$NDR)

SI ( L_NDR_860026359 % 2 == 0 )
ALORS
	L_NDR_860026359 = L_NDR_860026359 / 2
SINON
	L_NDR_860026359 = L_NDR_860026359 / 2 + 1
FINSI
res_860026359 = i_EnvoiReqConsTabDistDouble( TD_Fixe, TD_Inter, gmt_date_860026359,i_get_art_fieldptr(g_iartin,$NDR), L_NDR_860026359, L_NDR_860026359, 1, 0, 1)

SI (res_860026359 != 0)
ALORS
	#trace1("Erreur i_EnvoiReqConsTabDistDouble %d",res)
	# VerifPcode
	#pt_LIBELREDIST = "i_EnvoiReqConsTabDistDouble"
	i_strcpy(pt_LIBELREDIST_860026359,"i_EnvoiReqConsTabDistDouble")
	bREDIST_860026359=1
FINSI

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


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

# SYMPHONIE
instSYMPHO_860026359 = i_LireInstanceECC(C_InstSYMP_860026359)
SI !(instSYMPHO_860026359 > 0)
ALORS
	code_errone_860026359 = 0xA0B0
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026359,C_InstSYMP_860026359,C_Article_860026359)
	SAUT DISTRI_ERR
FINSI

# FE
instFE_860026359 = i_LireInstanceECC(C_InstFE_860026359)
SI !(instFE_860026359 > 0)
ALORS
	code_errone_860026359 = 0xA0B0
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026359,C_InstFE_860026359,C_Article_860026359)
	SAUT DISTRI_ERR
FINSI

# TRAFIC
instTRAFIC_860026359 = i_LireInstanceECC(C_InstTRAFIC_860026359)
SI !(instTRAFIC_860026359 > 0)
ALORS
	code_errone_860026359 = 0xA0B0
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026359,C_InstTRAFIC_860026359,C_Article_860026359)
	SAUT DISTRI_ERR
FINSI

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

# DRE G4R6 bloc deplace
SI (i_dup_art_id(g_iartin,g_iartout))
ALORS
	code_errone_860026359 = 0xA0D0
	code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
	erreur_860026359 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026359,"pour Symphonie",C_Article_860026359)
	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_860026359=i_get_art_str(g_iartin, $Tns6dcZTA::CODCIRDA,pt_CODCIRDA_860026359)

	SI (g_iartin.CODCIRDA[2] > 9)
	ALORS
		i_get_sub_str(pt_CODCIRDA_860026359,2,5,pt_CODCIRDA_860026359)
	SINON
		i_get_sub_str(pt_CODCIRDA_860026359,1,5,pt_CODCIRDA_860026359)
	FINSI
	erreur_860026359=i_get_art_str(g_iartin, $Tns6dcZTA::CODCIRA,pt_CODCIRA_860026359)

	SI (g_iartin.CODCIRA[2] > 9)
	ALORS
		i_get_sub_str(pt_CODCIRA_860026359,2,5,pt_CODCIRA_860026359)
	SINON
		i_get_sub_str(pt_CODCIRA_860026359,1,5,pt_CODCIRA_860026359)
	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_860026359 = i_supprChamp(g_iartout,"T3ce")
FINSI

res_860026359 = i_rename_art(g_iartout,"TsymphTnZTA")

# CCD
res_860026359 = i_ajoutChampNum(g_iartout,$TsymphTnZTA::T4ccd,$TsymphTnZTA::CCD,0)

# SGTQST symphTnZTA
res_860026359 = i_ajoutChampNum(g_iartout,$TsymphTnZTA::T4sgtqs,$TsymphTnZTA::SGTQS,0)

# EEC_FACT
res_860026359 = i_ajoutChampNum(g_iartout,$TsymphTnZTA::T4eccfact,$TsymphTnZTA::ECC_FACT,0)

# IEZLT (si Transgroupe onnet, IEZLT = sans objet)
# Test de presence de IEZLT car si absent, pas d'IEZLT en sortie
SI (IEZLT_860026359 != -1)
ALORS
	res_860026359 = i_ajoutChampNum(g_iartout,$TsymphTnZTA::T4iezlt,$TsymphTnZTA::IEZLT,0)
FINSI

# CODCIRDR
erreur_860026359=i_ajoutChampNum( g_iartout, $TsymphTnZTA::T4codcirdr, $TsymphTnZTA::CODCIRDR, 0 )
erreur_860026359=i_set_art_str( g_iartout, $TsymphTnZTA::CODCIRDR, pt_CODCIRDA_860026359 )

# CODCIR
erreur_860026359=i_ajoutChampNum( g_iartout, $TsymphTnZTA::T4codcir, $TsymphTnZTA::CODCIR, 0 )
erreur_860026359=i_set_art_str( g_iartout, $TsymphTnZTA::CODCIR, pt_CODCIRA_860026359 )

# TAXE
SI ( (SRP_PORTE_860026359 == 1) && (tax_860026359 == 0) )
ALORS
	TAXE_CAL_SYMP_860026359 = TAXE_CAL_860026359
SINON
	TAXE_CAL_SYMP_860026359 = tax_860026359
FINSI

SI (i_valid_field_n(g_iartin,$Tns6dcZTA::T3cap2))
ALORS
	erreur_860026359=i_set_art_field(g_iartout, $TsymphTnZTA::TAXE:0, TAXE_CAL_SYMP_860026359)
SINON
	erreur_860026359=i_set_art_field(g_iartout, $TsymphTnZTA::TAXE:1, TAXE_CAL_SYMP_860026359)
FINSI

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

SI (!bREDIST_860026359)
ALORS
	res_860026359 = i_LireReqConsTabDist()
	SI ( res_860026359 != 0 )
	ALORS
		#trace1( "Erreur i_LireReqConsTabDist: <%d>", res)
		# VerifPcode
		#pt_LIBELREDIST = "i_LireReqConsTabDist"
		i_strcpy(pt_LIBELREDIST_860026359,"i_LireReqConsTabDist")
		bREDIST_860026359=1
	FINSI
FINSI

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

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

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

resFE_860026359 = i_LireInfoECC(instFE_860026359,0)

#---------------------------------------------------------------------------
# FCT supprimee
#---------------------------------------------------------------------------

#---------------------------------------------------------------------------
# FE
#---------------------------------------------------------------------------
SI ((resFE_860026359 != 0) && !OPT_860026359 && (CAX_860026359!=9) && !ROC_860026359)
ALORS
	res1_860026359 = i_AjouterCouranteECC(instFE_860026359)
FINSI

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

SI ((resFE_860026359 != 0) || OPT_860026359 || ROC_860026359) && !bREDIST_860026359 && (CAX_860026359!=9)
ALORS
	res1_860026359=i_LireInfoECC(instTRAFIC_860026359,0)
	SI (res1_860026359 != 0)
	ALORS
		res_860026359=i_LireChaineInfo(res1_860026359,0,3,pt_InfoCompl_860026359)
		res_860026359=i_format_str2(pt_DM_860026359,"DM%s",pt_InfoCompl_860026359,0)
		instDM_860026359=i_LireInstanceECC(pt_DM_860026359)

		SI (!instDM_860026359)
		ALORS
			code_errone_860026359 = 0xA0B0
			code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
			erreur_860026359 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026359,pt_DM_860026359,C_Article_860026359)
			SAUT DISTRI_ERR
		FINSI
		res_860026359=i_AjouterCouranteECC(instDM_860026359)

		SI ( resFE_860026359)
		ALORS
			# Recuperation du code CFR pour meta c_libre de FE
			dizaine_860026359 = i_LireEntierInfo(res1_860026359,0,1)
			unite_860026359 = i_LireEntierInfo(res1_860026359,1,1)
			cfr_860026359 = (dizaine_860026359 & 0x0F) * 10 + (unite_860026359 & 0x0F)
			SI ( ENVELOPPE_NOK_860026359 )
			ALORS
				#IFDEF trace_niv1 = 1
				trace("__FILE__:__LINE__ ======> Creation enveloppe CFR/FE")
				#ENDIF
				ENVELOPPE_NOK_860026359 = i_add_opt("E_Tns6dcZTA")
				erreur_860026359 = i_set_attr_val_n($E_Tns6dcZTA::T1,0x19)
				erreur_860026359 = i_set_attr_val_n($E_Tns6dcZTA::L1,0x07)
			FINSI
			erreur_860026359 = i_set_attr_val_n($E_Tns6dcZTA::CFR,cfr_860026359)
			#IFDEF trace_niv1 = 1
			trace1("__FILE__:__LINE__ ======> code CFR : <%d> ", cfr_860026359)
			trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK_860026359)
			#ENDIF
		FINSI
	SINON
		# VerifPcode
		#pt_LIBELREDIST = "Indicatif inconnu de MAJ2G"
		i_strcpy(pt_LIBELREDIST_860026359,"Indicatif inconnu de MAJ2G")
		bREDIST_860026359=1
		SAUT AVANT_REDIST
	FINSI
FINSI

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

SI ((resFE_860026359 == 0) && !OPT_860026359 && !bREDIST_860026359 && (CAX_860026359!=9) && !ROC_860026359)
ALORS
	res_860026359=i_LireInfoECC(instTRAFIC_860026359,0)
	SI (res_860026359 != 0)
	ALORS
		res1_860026359=i_LireChaineInfo(res_860026359,0,3,pt_InfoCompl_860026359)
		res1_860026359=i_format_str2(pt_TRAF_FACT_860026359,"TRAF%s",pt_InfoCompl_860026359,0)
		instECCTRAFIC_860026359=i_LireInstanceECC(pt_TRAF_FACT_860026359)

		SI (!instECCTRAFIC_860026359)
		ALORS
			code_errone_860026359 = 0xA0B0
			code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
			erreur_860026359 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026359,pt_TRAF_FACT_860026359,C_Article_860026359)
			SAUT DISTRI_ERR
		FINSI
		res_860026359 = i_AjouterCouranteECC(instECCTRAFIC_860026359)
	SINON
		# VerifPcode
		#pt_LIBELREDIST = "Indicatif inconnu de MAJ2G"
		i_strcpy(pt_LIBELREDIST_860026359,"Indicatif inconnu de MAJ2G")
		SAUT AVANT_REDIST
	FINSI
FINSI

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

res_860026359 = i_ValiderListeECC(0,0,0,0)

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

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

# Initialisation des variables de presence a l etat non present
T3nos_OK_860026359=0
T3sidr_OK_860026359=0
T3cle_OK_860026359=0
T3coca_OK_860026359=0
T3idav_OK_860026359=0
Mes1_ok_860026359=0
Mes2_ok_860026359=0

#MES1 et MES2
SI ( i_valid_field_n(g_iartin, $Tns6dcZTA::MES1) )
ALORS
	Mes1_ok_860026359=1
	MES1_860026359=i_get_art_field(g_iartin,$MES1)
FINSI

SI ( i_valid_field_n(g_iartin, $Tns6dcZTA::MES2) )
ALORS
	Mes2_ok_860026359=1
	MES2_860026359=i_get_art_field(g_iartin,$MES2)
FINSI

# NDR
res_860026359=i_get_art_str(g_iartin,$NDR,pt_NDR_860026359)

# INFNOS,NUMNOS
SI (i_valid_field_n(g_iartin,$NUMNOS))
ALORS
	T3nos_OK_860026359=1
	INFNOS_860026359=i_get_art_field(g_iartin,$INFNOS)
	res_860026359=i_get_art_str(g_iartin,$NUMNOS,pt_NUMNOS_860026359)
FINSI

# SUP
SI T3cab_OK_860026359
ALORS
	SUP_860026359=i_get_art_field(g_iartin,$SUP:1)
SINON
	SUP_860026359=i_get_art_field(g_iartin,$SUP:0)
FINSI

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

# CLE1
SI (i_valid_field_n(g_iartin,$T3cle))
ALORS
	T3cle_OK_860026359=1
	CLE1_860026359=i_get_art_field(g_iartin,$CLE1)
FINSI

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

bitA_TAP_860026359=(TAP_860026359 & 0x80) >>4
bitC_TAP_860026359=(TAP_860026359 & 0x20) >>4
bitF_TAP_860026359=(TAP_860026359 & 0x04)
bitG_TAP_860026359=(TAP_860026359 & 0x02)
bitH_TAP_860026359=(TAP_860026359 & 0x01)

# INF_IDAV, NUM_IDAV
SI (i_valid_field_n(g_iartin,$T3idav))
ALORS
	T3idav_OK_860026359=1
	INF_IDAV_860026359=i_get_art_field(g_iartin,$INF_IDAV)
	res_860026359=i_get_art_str(g_iartin,$NUM_IDAV,pt_NUM_IDAV_860026359)
FINSI

# BETA
SI (i_valid_field_n(g_iartin,$T3coca))
ALORS
	T3coca_OK_860026359=1
	res_860026359=i_get_art_str(g_iartin,$BETA,pt_BETA_860026359)
FINSI

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

SI !(i_ChercherCouranteECC(instFE_860026359)) && !bREDIST_860026359
ALORS
	# ECC_FACT
	# VerifPcode
	#pt_nomECCFact="FE"
	i_strcpy(pt_nomECCFact_860026359,"FE")

	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout2,C_Tfe_860026359))
	ALORS
		code_errone_860026359 = 0xA0D0
		code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
		erreur_860026359 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026359,C_Tfe_860026359,C_Article_860026359)
		SAUT DISTRI_ERR
	FINSI

	# DATE
	res_860026359=i_set_art_field(g_iartout2,$Tfe::DATE,ICAR_REL_860026359)

	# SERVICE
	res_860026359=i_set_art_str(g_iartout2,$Tfe::SERVICE,"02")

	# IDUS_NUM
	i_replace_str(pt_NDR_860026359,"BCDE","AJSC",pt_NDR_860026359)
	res_860026359=i_set_art_str(g_iartout2,$Tfe::IDUS_NUM,pt_NDR_860026359)

	# DEDE_NUM
	i_replace_str(pt_NDE_860026359,"BC","*#",pt_NDE_860026359)
	res_860026359=i_set_art_str(g_iartout2,$Tfe::DEDE_NUM,pt_NDE_860026359)

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

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

	# CAX
	res_860026359=i_set_art_field(g_iartout2,$Tfe::CAX,CAX_860026359)

	# NDS_INF,NDS_NUM
	SI T3nos_OK_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout2,$Tfe::NDS_INF,INFNOS_860026359)
		res_860026359=i_set_art_str(g_iartout2,$Tfe::NDS_NUM,pt_NUMNOS_860026359)
	FINSI

	#champ DUR
	erreur_860026359=i_set_art_field(g_iartout2,$Tfe::DUREE,dduree_860026359)

	#champ TAX
#DRE G4R6 Lot2
	SI (REJET_860026359==CPT_CPS_Loc_860026359)
	ALORS
		erreur_860026359=i_set_art_field(g_iartout2, $Ttrafic::TAX, tax_860026359)
	SINON
		SI ( (SRP_PORTE_860026359 == 1) && (tax_860026359 == 0) )
		ALORS
			erreur_860026359=i_set_art_field(g_iartout2,$Tfe::TAX,TAXE_CAL_860026359)
		SINON
			erreur_860026359=i_set_art_field(g_iartout2,$Tfe::TAX,tax_860026359)
		FINSI
	FINSI
#\DRE G4R6 Lot2
	
	# SUP
	res_860026359=i_set_art_field(g_iartout2,$Tfe::SUP,SUP_860026359)

	# CLASSDEST
	res_860026359=i_set_art_field(g_iartout2,$Tfe::CLASSDEST,CCD_REEL_860026359)

	# MES1
	SI Mes1_ok_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout2,$Tfe::MES1,MES1_860026359)
	FINSI

	# MES2
	SI Mes2_ok_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout2,$Tfe::MES2,MES2_860026359)
	FINSI

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

	# NB_CSV, C_CSV et OP_CSV
	res1_860026359=0
	SI ( (i_strplcmp( pt_NDE_860026359, "12", 0, 2 ) ==0) || (i_strplcmp( pt_NDE_860026359, "118", 0, 3 )==0) )
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"H")
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"A")
	SINON
		SI !( i_strplcmp( pt_NDE_860026359, "3212", 0, 4 ) )
		ALORS
			#IFDEF trace_niv3 = 1
			trace2( "__FILE__:__LINE__ : Pour FE : pt_NDE = <%s>", pt_NDE_860026359, "" )
			#ENDIF
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"Z")
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"A")
		FINSI
	FINSI

	# MES1 et MES2
	SI (Mes1_ok_860026359 && Mes2_ok_860026359)
	ALORS
		SI ((MES1_860026359 ==0x00)&&(MES1_860026359 == MES2_860026359))
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"F")
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
		SI ( (MES1_860026359 == MES2_860026359)&&(MES1_860026359 != 0xFF) )
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"P")
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
	FINSI

	SI T3sidr_OK_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"C")
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI (T3cle_OK_860026359 && (CLE1_860026359 == 0x0B))
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"30")
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI  bitA_TAP_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"T")
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI bitC_TAP_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"3")
		res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI  (res1_860026359<5)
	ALORS
		SI bitF_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"D")
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI

		SI bitG_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"N")
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI

		SI bitH_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1),"O")
			res_860026359=i_set_art_str(g_iartout2,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
	FINSI
	res_860026359=i_set_art_field(g_iartout2,$Tfe::NB_CSV,res1_860026359)

	# COCA
	SI T3coca_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout2,$Tfe::COCA,pt_BETA_860026359)
	FINSI

	# COCAV
	SI T3cocav_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout2,$Tfe::COCAV,pt_BETAV_860026359)
	FINSI

	# IDAV_INF,IDAV_NUM
	SI T3idav_OK_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout2,$Tfe::IDAV_INF,INF_IDAV_860026359)
		res_860026359=i_set_art_str(g_iartout2,$Tfe::IDAV_NUM,pt_NUM_IDAV_860026359)
	FINSI
# DRE G4R6 Lot2
	# TAG
	erreur_860026359=i_set_art_str(g_iartout2, $Tfe::TAG, " ")
	
	# TYPE_EDIT
	erreur_860026359=i_set_art_str(g_iartout2, $Tfe::TYPE_EDIT, pt_TYPE_EDIT_860026359)
	
	# CODE_TARIF
	erreur_860026359=i_set_art_str(g_iartout2, $Tfe::CODE_TARIF, pt_CODE_TARIF_860026359)
# \DRE G4R6 Lot2

FINSI

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

SI !(i_ChercherCouranteECC(instDM_860026359)) && !bREDIST_860026359
ALORS
	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout3,C_Tdelta_minute_860026359))
	ALORS
		code_errone_860026359 = 0xA0D0
		code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
		erreur_860026359 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026359,C_Tdelta_minute_860026359,C_Article_860026359)
		SAUT DISTRI_ERR
	FINSI

	# DATE
	res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::DATE,ICAR_REL_860026359)

	# DOMAINE
	SI ( (CCD_860026359 == 0x18) && !EPORTABILITE_860026359  )
	ALORS
		res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::DOMAINE,"96")
	SINON
		res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::DOMAINE,"05")
	FINSI

	# SERVICE
	res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::SERVICE,"02")

	# IDUS_NUM
	i_replace_str(pt_NDR_860026359,"BCDE","AJSC",pt_NDR_860026359)
	res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::IDUS_NUM,pt_NDR_860026359)

	# DEDE_NUM
	i_replace_str(pt_NDE_860026359,"BC","*#",pt_NDE_860026359)
	res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::DEDE_NUM,pt_NDE_860026359)

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

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

	# CAX
	res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::CAX,CAX_860026359)

	# NDS_NUM
	SI T3nos_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::NDS_NUM,pt_NUMNOS_860026359)
	FINSI

	#champ DUREE
	erreur_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::DUREE,dduree_860026359)

	#champ CAX
	erreur_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::CAX,CAX_860026359)

	#champ TAX
	SI ( (SRP_PORTE_860026359 == 1) && (tax_860026359 == 0) )
	ALORS
		erreur_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::TAX,TAXE_CAL_860026359)
	SINON
		erreur_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::TAX,tax_860026359)
	FINSI

	# SUP
	res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::SUP,SUP_860026359)

	# CLASSDEST
	res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::CLASSDEST,CCD_REEL_860026359)

	# MES1
	SI Mes1_ok_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::MES1,MES1_860026359)
	FINSI

	# MES2
	SI Mes2_ok_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::MES2,MES2_860026359)
	FINSI

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

	# NB_CSV, C_CSV et OP_CSV
	res1_860026359=0
	SI ( (i_strplcmp( pt_NDE_860026359, "12", 0, 2 ) ==0) || (i_strplcmp( pt_NDE_860026359, "118", 0, 3 )==0) )
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"H")
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"A")
	SINON
		SI !( i_strplcmp( pt_NDE_860026359, "3212", 0, 4 ) )
		ALORS
		#IFDEF trace_niv3 = 1
			trace2( "__FILE__:__LINE__ : Pour DM : pt_NDE = <%s>", pt_NDE_860026359, "" )
			#ENDIF
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"Z")
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"A")
		FINSI
	FINSI

	#MES1 et MES2
	SI (Mes1_ok_860026359 && Mes2_ok_860026359)
	ALORS
		SI ((MES1_860026359 ==0x00)&&(MES1_860026359 == MES2_860026359))
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"F")
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
		SI ( (MES1_860026359 == MES2_860026359)&&(MES1_860026359 != 0xFF) )
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"P")
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
	FINSI

	SI T3sidr_OK_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"C")
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI (T3cle_OK_860026359 && (CLE1_860026359 == 0x0B))
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"30")
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI  bitA_TAP_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"T")
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI bitC_TAP_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"3")
		res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI  (res1_860026359<5)
	ALORS
		SI bitF_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"D")
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI

		SI bitG_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"N")
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI

		SI bitH_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1),"O")
			res_860026359=i_set_art_str(g_iartout3,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
	FINSI
	res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::NB_CSV,res1_860026359)

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

	# COCA
	SI T3coca_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::COCA,pt_BETA_860026359)
	FINSI

	# COCAV
	SI T3cocav_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::COCAV,pt_BETAV_860026359)
	FINSI

	# IDAV_INF,IDAV_NUM
	SI T3idav_OK_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout3,$Tdelta_minute::IDAV_INF,INF_IDAV_860026359)
		res_860026359=i_set_art_str(g_iartout3,$Tdelta_minute::IDAV_NUM,pt_NUM_IDAV_860026359)
	FINSI

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

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

SI !(i_ChercherCouranteECC(instECCTRAFIC_860026359)) && !bREDIST_860026359
ALORS
	# ECC_FACT
	# VerifPcode
	#pt_nomECCFact=pt_TRAF_FACT
	i_strcpy(pt_nomECCFact_860026359,pt_TRAF_FACT_860026359)

	# utilisation de la table de duplication
	SI (i_dup_art_dest(g_iartin,g_iartout4,C_Ttrafic_860026359))
	ALORS
		code_errone_860026359 = 0xA0D0
		code_errone_860026359 = code_errone_860026359 + EFFICACE_860026359
		erreur_860026359 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026359,C_Ttrafic_860026359,C_Article_860026359)
		SAUT DISTRI_ERR
	FINSI

	# DATE
	res_860026359=i_set_art_field(g_iartout4,$Ttrafic::DATE,ICAR_REL_860026359)

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

	# SERVICE
	res_860026359=i_set_art_str(g_iartout4,$Ttrafic::SERVICE,"02")

	# IDUS_NUM
	i_replace_str(pt_NDR_860026359,"BCDE","AJSC",pt_NDR_860026359)
	res_860026359=i_set_art_str(g_iartout4,$Ttrafic::IDUS_NUM,pt_NDR_860026359)

	# DEDE_NUM
	i_replace_str(pt_NDE_860026359,"BC","*#",pt_NDE_860026359)
	res_860026359=i_set_art_str(g_iartout4,$Ttrafic::DEDE_NUM,pt_NDE_860026359)

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

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

	# CAX
	res_860026359=i_set_art_field(g_iartout4,$Ttrafic::CAX,CAX_860026359)

	# NDS_NUM
	SI T3nos_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout4,$Ttrafic::NDS_NUM,pt_NUMNOS_860026359)
	FINSI

	#champ DUREE
	erreur_860026359=i_set_art_field(g_iartout4, $Ttrafic::DUREE, dduree_860026359)

	#champ TAX
#DRE G4R6 Lot2
	SI (REJET_860026359==CPT_CPS_Loc_860026359)
	ALORS
		erreur_860026359=i_set_art_field(g_iartout2, $Ttrafic::TAX, tax_860026359)
	SINON
		SI ( (SRP_PORTE_860026359 == 1) && (tax_860026359 == 0) )
		ALORS
			erreur_860026359=i_set_art_field(g_iartout4, $Ttrafic::TAX,TAXE_CAL_860026359)
		SINON
			erreur_860026359=i_set_art_field(g_iartout4, $Ttrafic::TAX, tax_860026359)
		FINSI
	FINSI
#\DRE G4R6 Lot2

	# SUP
	res_860026359=i_set_art_field(g_iartout4,$Ttrafic::SUP,SUP_860026359)

	# CLASSDEST
	res_860026359=i_set_art_field(g_iartout4,$Ttrafic::CLASSDEST,CCD_REEL_860026359)

	# MES1
	SI Mes1_ok_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout4,$Ttrafic::MES1,MES1_860026359)
	FINSI

	# MES2
	SI Mes2_ok_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout4,$Ttrafic::MES2,MES2_860026359)
	FINSI

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

	# NB_CSV, C_CSV et OP_CSV
	res1_860026359=0
	SI !( i_strplcmp( pt_NDE_860026359, "12", 0, 2 ) )
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"H")
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"A")
	SINON
		SI !( i_strplcmp( pt_NDE_860026359, "3212", 0, 4 ) )
		ALORS
			#IFDEF trace_niv3 = 1
			trace2( "__FILE__:__LINE__ : Pour TRAFIC : pt_NDE = <%s>", pt_NDE_860026359, "" )
			#ENDIF
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"Z")
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"A")
		FINSI
	FINSI

	#MES1 et MES2
	SI (Mes1_ok_860026359 && Mes2_ok_860026359)
	ALORS
		SI ((MES1_860026359 ==0x00)&&(MES1_860026359 == MES2_860026359))
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"F")
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
		SI ( (MES1_860026359 == MES2_860026359)&&(MES1_860026359 != 0xFF) )
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"P")
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
	FINSI

	SI T3sidr_OK_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"C")
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI (T3cle_OK_860026359 && (CLE1_860026359 == 0x0B))
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"30")
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI  bitA_TAP_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"T")
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI bitC_TAP_860026359
	ALORS
		res1_860026359=res1_860026359+1
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"3")
		res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
	FINSI

	SI  (res1_860026359<5)
	ALORS
		SI bitF_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"D")
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI

		SI bitG_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"N")
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI

		SI bitH_TAP_860026359
		ALORS
			res1_860026359=res1_860026359+1
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1),"O")
			res_860026359=i_set_art_str(g_iartout4,ic_C_CSV1_860026359+2*(res1_860026359-1)+1,"U")
		FINSI
	FINSI
	res_860026359=i_set_art_field(g_iartout4,$Ttrafic::NB_CSV,res1_860026359)

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

	# COCA
	SI T3coca_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout4,$Ttrafic::COCA,pt_BETA_860026359)
	FINSI

	# COCAV
	SI T3cocav_OK_860026359
	ALORS
		res_860026359=i_set_art_str(g_iartout4,$Ttrafic::COCAV,pt_BETAV_860026359)
	FINSI

	# IDAV_INF,IDAV_NUM
	SI T3idav_OK_860026359
	ALORS
		res_860026359=i_set_art_field(g_iartout4,$Ttrafic::IDAV_INF,INF_IDAV_860026359)
		res_860026359=i_set_art_str(g_iartout4,$Ttrafic::IDAV_NUM,pt_NUM_IDAV_860026359)
	FINSI

	#champ SGTQS
	res_860026359=i_set_art_str(g_iartout4, $Ttrafic::SGTQS,i_LireEECSGTQS(g_ieec) )
# DRE G4R6 Lot2
	# TAG
	erreur_860026359=i_set_art_str(g_iartout4, $Ttrafic::TAG, " ")
	
	# TYPE_EDIT
	erreur_860026359=i_set_art_str(g_iartout4, $Ttrafic::TYPE_EDIT, pt_TYPE_EDIT_860026359)
	
	# CODE_TARIF
	erreur_860026359=i_set_art_str(g_iartout4, $Ttrafic::CODE_TARIF, pt_CODE_TARIF_860026359)
# \DRE G4R6 Lot2

FINSI

#---------------------------------------------------------------------------
# FCT supprimee
#---------------------------------------------------------------------------

POINT AVANT_REDIST

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

	# CCD
	res_860026359 = i_set_art_field(g_iartout,$TsymphTnZTA::CCD,CCD_REEL_860026359 )

	# SGTQS
	res_860026359 = i_set_art_str(g_iartout,$TsymphTnZTA::SGTQS,i_LireEECSGTQS(g_ieec))

	# ECC_FACT
	res_860026359 = i_set_art_str(g_iartout,$TsymphTnZTA::ECC_FACT,pt_nomECCFact_860026359)

	# IEZLT
	SI (IEZLT_860026359 != -1)
	ALORS
		res_860026359= i_set_art_field(g_iartout,$TsymphTnZTA::IEZLT,IEZLT_860026359)
	FINSI
# DRE G4R6 Lot2
	# TYPE_EDIT
	SI i_strcmp(pt_TYPE_EDIT_860026359," ") != 0
	ALORS
		erreur_860026359 = i_ajoutChampNum(g_iartout,$TsymphTnZTA::T4type_edit,$TsymphTnZTA::TYPE_EDIT,0)
		erreur_860026359=i_set_art_str(g_iartout, $TsymphTnZTA::TYPE_EDIT, pt_TYPE_EDIT_860026359)
	FINSI

	# CODE_TARIF
	SI i_strcmp(pt_CODE_TARIF_860026359,"    ") != 0
	ALORS
		erreur_860026359 = i_ajoutChampNum(g_iartout,$TsymphTnZTA::T4code_tarif,$TsymphTnZTA::CODE_TARIF,0)
		erreur_860026359=i_set_art_str(g_iartout, $TsymphTnZTA::CODE_TARIF, pt_CODE_TARIF_860026359)
	FINSI
# \DRE G4R6 Lot2

	#---------------------------------------------------------------------------
	# Symphonie
	#---------------------------------------------------------------------------
	SI !(i_ChercherCouranteECC(instSYMPHO_860026359))
	ALORS
		res_860026359=i_stocke_art_iecc(g_iartout,instSYMPHO_860026359)
	FINSI
FINSI

SI (bREDIST_860026359 == 1)
ALORS
	SAUT DISTRI_RDT
FINSI

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

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

SI !(i_ChercherCouranteECC(instFE_860026359))
ALORS
	res_860026359=i_stocke_art_iecc(g_iartout2,instFE_860026359)
FINSI

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

SI !(i_ChercherCouranteECC(instDM_860026359))
ALORS
	res_860026359=i_stocke_art_iecc(g_iartout3,instDM_860026359)
FINSI

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

SI !(i_ChercherCouranteECC(instECCTRAFIC_860026359))
ALORS
	res_860026359=i_stocke_art_iecc(g_iartout4,instECCTRAFIC_860026359)
FINSI

#---------------------------------------------------------------------------
# FCT supprimee
#---------------------------------------------------------------------------

# Fin distri normale

RETOUR TRAIT_OK

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


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

POINT DISTRI_ERR

res_860026359=i_make_art_rej(g_iartin, g_iartout,code_errone_860026359)
res_860026359=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_860026359 = 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_860026359 == 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_860026359 )
	ALORS
		#IFDEF trace_niv1 = 1
		trace("__FILE__:__LINE__ =====> Creation enveloppe REDISTRI")
		#ENDIF
		ENVELOPPE_NOK_860026359 = i_add_opt( "E_Tns6dcZTA" )
		# champ T1 (=>  0x19 pour la reconnaissance de l'enveloppe,
		# par l'arbre de reconnaissance Dopt )
		#res = i_set_attr_val_n( $E_Tns6dcZTA::T1, 0x19 )
		# Champ L1
		#res = i_set_attr_val_n( $E_Tns6dcZTA::L1, 0x07 )
	FINSI
	i_strcpy(pt_SGTQS_860026359, i_LireEECSGTQS(g_ieec))
	res_860026359 = i_set_attr_str_n( $E_Tns6dcZTA::Nom_EEC, pt_SGTQS_860026359)
	res_860026359 = i_get_attr_str_n($E_Tns6dcZTA::Nom_EEC, pt_SGTQS_860026359)
	erreur_860026359 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026359,"Tns6dcZTA",pt_SGTQS_860026359)
FINSI

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

RETOUR TRAIT_OK

#-------------------------- Fin Tns6dcZTA_dis.src -----------------------------------------------------------
