DEFINITION extraZLT_860026614 1
DEFINITION NUMTAB_860026614 1
DEFINITION ZONEMETRO_860026614 7
DEFINITION INST_ACLA_860026614 "ACLA"
DEFINITION national_860026614 1
DEFINITION international_860026614 2
DEFINITION special_860026614 3
DEFINITION C_Article_860026614 "Tcentrex"
DEFINITION C_InstCENTDC_860026614 "CENTAUREDC"
DEFINITION C_InstTRAFIC_860026614 "TRAFIC"
DEFINITION C_InstFE_860026614 "FE"
DEFINITION C_InstFERPV_860026614 "FERPV"
DEFINITION C_InstARAVIS_860026614 "ARAVIS"
DEFINITION C_InstSYMP_860026614 "SYMP"
DEFINITION C_TcentDC_860026614 "TcentaureDC"
DEFINITION C_Tfe_860026614 "Tfe"
DEFINITION C_Tfe_rpvRG_860026614 "Tfe_rpvRG"
DEFINITION C_Taravis_860026614 "Taravis"
DEFINITION C_Tdelta_minute_860026614 "Tdelta_minute"
DEFINITION C_Ttrafic_860026614 "Ttrafic"
DEFINITION C_InstCASPER_860026614 "CASPER"
DEFINITION C_Tcasper_860026614 "TcasperTcentrex"
DEFINITION CCD_Internat_860026614 6
DEFINITION CPT_CPS_Loc_860026614 16
DEFINITION CPT_CPS_RI_860026614 17
DEFINITION C_DATCPS_860026614 "DATCPS" 
DEFINITION TD_SVA_860026614 9
DEFINITION C_INST_ALICE_860026614 "ALICE"
REGISTRE ENTIER REJET_860026614
REGISTRE ENTIER CAX_860026614
REGISTRE ENTIER ADO_860026614
REGISTRE ENTIER EFFICACE_860026614
REGISTRE ENTIER CCD_860026614
REGISTRE ENTIER TRANSGROUPE_860026614
REGISTRE ENTIER RPV_860026614
REGISTRE ENTIER IEZLT_860026614
REGISTRE ENTIER vE_860026614
REGISTRE ENTIER CENTREX1_860026614
REGISTRE ENTIER CENTREX2_860026614
REGISTRE ENTIER DCCentrexIntragroupe_860026614
REGISTRE ENTIER TGPRI_860026614
REGISTRE ENTIER VTGRI_860026614
REGISTRE ENTIER ICAR_REL_860026614
REGISTRE ENTIER ICAR_ABS_860026614
REGISTRE ENTIER EPORTABILITE_SCP_860026614
REGISTRE ENTIER SPORTABILITE_SCP_860026614
REGISTRE ENTIER CCD_REEL_860026614
REGISTRE ENTIER CCD_REEL_FE_860026614
REGISTRE ENTIER VTGRI_3BPQ_860026614
REGISTRE ENTIER VTGRI_CAX_860026614
REGISTRE ENTIER EPORTABILITE_860026614
REGISTRE ENTIER SRP_PORTE_860026614
REGISTRE ENTIER TAXE_CAL_860026614
REGISTRE ENTIER bCENT_860026614
REGISTRE ENTIER bVTG_860026614
REGISTRE ENTIER bFE_860026614
REGISTRE ENTIER bFERPV_860026614
REGISTRE ENTIER bARAVIS_860026614
REGISTRE ENTIER bTRAFIC_860026614
REGISTRE ENTIER bREDIST_860026614
REGISTRE ENTIER instSYMP_860026614
REGISTRE ENTIER instDM_860026614
REGISTRE ENTIER instCENT_860026614
REGISTRE ENTIER instFE_860026614
REGISTRE ENTIER instFERPV_860026614
REGISTRE ENTIER instARAVIS_860026614
REGISTRE ENTIER instTRAFIC_860026614
REGISTRE ENTIER instVTG_860026614
REGISTRE ENTIER instACLA_860026614
REGISTRE ENTIER ddebut_860026614
REGISTRE ENTIER dduree_860026614
REGISTRE ENTIER tax_860026614
REGISTRE ENTIER dpivot_860026614
REGISTRE ENTIER preTrans_860026614
REGISTRE ENTIER erreur_860026614
REGISTRE ENTIER res_860026614
REGISTRE ENTIER indice_860026614
REGISTRE ENTIER num_champ_860026614
REGISTRE ENTIER bit_860026614
REGISTRE ENTIER crit_com_860026614
REGISTRE ENTIER bitAinfdede_860026614
REGISTRE ENTIER bitBinfdede_860026614
REGISTRE ENTIER bitDinfdede_860026614
REGISTRE ENTIER INF_DEDE_860026614
REGISTRE ENTIER TAP_860026614
REGISTRE ENTIER SUP_860026614
REGISTRE ENTIER ZA_860026614
REGISTRE ENTIER type_traf_860026614
REGISTRE ENTIER nb_digit_860026614
REGISTRE ENTIER trait_ok_860026614
REGISTRE ENTIER val_normal_860026614
REGISTRE ENTIER NVU_860026614
REGISTRE ENTIER comid_n1_860026614
REGISTRE ENTIER code_errone_860026614
REGISTRE ENTIER MINE_860026614
REGISTRE ENTIER ART_860026614
REGISTRE ENTIER APPLI_860026614
REGISTRE ENTIER DC_CAA_860026614
REGISTRE ENTIER ROC_860026614
REGISTRE ENTIER RPVI_DIRECT_860026614
REGISTRE ENTIER gmt_date_860026614
REGISTRE ENTIER L_NDR_860026614
REGISTRE ENTIER OPT_860026614
REGISTRE ENTIER GVPN_860026614
REGISTRE ENTIER dizaine_860026614
REGISTRE ENTIER unite_860026614
REGISTRE ENTIER cfr_860026614
REGISTRE ENTIER ENVELOPPE_NOK_860026614
REGISTRE ENTIER SRP_Sporta_SPN_860026614
REGISTRE ENTIER distri_symph_860026614
REGISTRE ENTIER val_INEF_860026614
REGISTRE ENTIER comid_num_860026614
REGISTRE ENTIER EEC_audit_860026614
REGISTRE ENTIER bloc_audit_860026614
REGISTRE ENTIER DC_audit_860026614
REGISTRE ENTIER instCASPER_860026614
REGISTRE ENTIER b_NSUC_860026614
REGISTRE ENTIER Date_CPS_860026614
REGISTRE ENTIER instALICE_860026614 
REGISTRE ENTIER longueur_860026614 
REGISTRE ENTIER b_Fact_CPS_Loc_860026614
REGISTRE ENTIER b_Fact_CPS_RI_860026614
REGISTRE ENTIER bREDISTALICE_860026614
REGISTRE POINTEUR pt_TEMP_860026614
REGISTRE POINTEUR pt_NORM_860026614
REGISTRE POINTEUR pt_nomEccFact_860026614
REGISTRE POINTEUR pt_EccCentaure_860026614
REGISTRE POINTEUR pt_InfoCompl_860026614
REGISTRE POINTEUR pt_Traf_860026614
REGISTRE POINTEUR pt_DM_860026614
REGISTRE POINTEUR pt_COCA_860026614
REGISTRE POINTEUR pt_COCAV_860026614
REGISTRE POINTEUR pt_BUF_860026614
REGISTRE POINTEUR pt_BUF1_860026614
REGISTRE POINTEUR pt_BUF2_860026614
REGISTRE POINTEUR pt_marque_audit_860026614
REGISTRE POINTEUR pt_CodeOp_860026614
REGISTRE POINTEUR pt_service_860026614
REGISTRE POINTEUR pt_STY_str_860026614
REGISTRE POINTEUR pt_LIBELREDIST_860026614
REGISTRE POINTEUR pt_SGTQS_860026614
REGISTRE POINTEUR pt_TCOMMUT_860026614
REGISTRE POINTEUR pt_INEF_STD_860026614
REGISTRE POINTEUR pt_INEF_COMMUT_860026614
REGISTRE POINTEUR pt_IDAV_DIST_N_860026614
REGISTRE POINTEUR pt_CODCIRDA_860026614
REGISTRE POINTEUR pt_CODCIRA_860026614
REGISTRE POINTEUR pt_nde_normal_860026614
REGISTRE POINTEUR pt_CODESCP_860026614
REGISTRE POINTEUR pt_NSUC_860026614
REGISTRE POINTEUR pt_MESSAGE_860026614
REGISTRE POINTEUR pt_CODE_TARIF_860026614 
REGISTRE POINTEUR pt_TYPE_EDIT_860026614 
############################################################################
# Pcode de DISTRIBUTION G2R1Ca (B151 avec G2R1Ch)
# Fichier:      Tcentrex.src (created 11/05/01)
#
# Version:      %version: 1.23 %
#
# Date:         %date_modified: 12/04/02 11:29 %
#
# Distribution:
#       Article detail de communication CENTREX
#       Tcentrex efficace et inefficace
#
# En entree:
#       Article:         Tcentrex.art
#
# En sortie:
#       DELTAMINUTE
#       FCT
#       FE
#       FE_RPV
#       CENT
#       SYMPHONIE
#       TRAFIC
#       VTG_VALO
#
#		FO1431: 12/04/2002 - LRA
#		bit B de STY vrai si FD/ICX/DSTX absent  et DEDE_INF.AB = 00
#	28/06/2002 - PSA : FO1510 : Encapsulation pour stockage en errone
#	28/06/2002 - PSA : FOPROD36 : Modif du stockage en elimine (REJET et CAX <> 3)
#	05/07/2002 - PSA : FO1515 : Modif de la redistribution
#	16/07/2002 - RBE : Modif. variable VTGRI + Modif. criteres VTG_Valo
#		Ajout variable EPORTABILITE et criteres pour FCT
#		Alimentaion de symphonie quand redistribution
#		FO20035 : Champ SUP et STY pour DM et champ SUP pour FCT
#	15/10/2002 - PSA : FO18 et FO45 : modif format pour FOR
#		FO55 : appel a CodeOperateur uniquement en cas portabilite entrante potentielle
#	23/10/2002 - PSA : FO66 : correction initialisation VTGRI_CAX (supp condition vE==8)
#	28/10/2002 - RBE : specif.4.8 : modif. CCD en fonction de la portabilite
#	25/11/2002 - MCH : FO99 : modif critere distri VTG_VALO
#	14/10/2002 - RBE : Ajout de l'envoie a APACHE
#	21/11/2002 - RBE : FO115 + Modif. alarme tables externes
#	21/01/2003 - MCH : GIR2C9 : FOR --> FORDC
#	07/02/2003 - RBE - Envoi en redistrib. si pb acces fichiers de distrib.
#	01/04/2003 - RBE : FO241 : envoi a Symp. si pb acces distri.
#	07/04/2003 - RBE : FO245 : recup. de MINE et APPLI si VN8(ART=4)
#	07/04/2003 - RBE : FO258 : modif. variable ADO
#	05/05/2003 - RBE : FO294 : Ajout de la variable RPVI_DIRECT pour aiguillage
#	19/06/2003 - MCH - Ajout FERPV
#	30/06/2003 - RBE : Suppression de la variable FCPV2
#		ICAR_ABS:date platine et ICAR_REL:date locale ou date article
#	16/07/2003 - MCH - FO 339 FERPV: SOURCE E NATAPPRI CANAL
#	16/07/2003 - MCH - FO 340 FERPV: EEC_FACT / symph
#	18/07/2003 - MCH - FO 341 FERPV: CFR de c_libre en ASCII
#	18/07/2003 - MCH - FO 342 FERPV: TYPEOFFRE en ASCII
#	22/07/2003 - DRE - Modif calcul gmt_date
#	25/07/2003 - MCH - Ajout ARAVIS
#	18/08/2003 - RBE - FO359 : init. de ACCEID en alpha ASCII
#	29/08/2003 - RBE - FO381 : FE et ARAVIS sont exclusives
#	02/09/2003 - RBE - FO392 : Initialisation des variables Pcode
#	08/09/2003 - MCH - G2R0CO: OPT + CODCIR
#	16/09/2003 - RBE - F0412 : modif variable GVPN
#	30/09/2003 - RBE - FO427 : NUMDDE a normaliser pour FERPV
#	21/10/2003 - RBE - FO437 : dede normalise pour aravis
#	04/12/2003 - PSA - Prise en compte offre DIAL (Cg)
#	15/12/2003 - PSA - Cg : FO517
#	21/01/2004 - PSA - Cg' : FO535
#	21/01/2004 - PSA - FO536 : Cg' : non envoi a FERPV si OPT
#	28/01/2004 - PSA - Cg' : modification du type de calcul de ZA
#	02/02/2004 - PSA - FO543 : Cg' : modification criteres pour ARAVIS
#	10/02/2004 - RBE - FO559 : COMID non unique pour ARAVIS 
#	04/03/2004 - RBE - Cp : stockage en DIVERS des DC double facture et ALLO
#	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
#	23/03/2004 - RBE - FO591:si dede=A5 et si AR appartient a FE DC va pas a TRAFIC
#	22/12/2003 - MCH - G2R0Ca : modif enveloppe - recup cfr pour c_libre de FE
#	05/01/2004 - MCH - Modif dupli SYMPH pour ajoutCE en redistri
#	27/05/2004 - RBE - FO688 : si ROC envoi a Symphonie et delta minute seulement
#	10/06/2004 - NSA - G2R0Cl: integration des codes d erreurs
#	17/06/2004 - RBE - FO708 : Pour ROC envoi a DM incorrect
#	08/07/2004 - DRE - FO 749 modif SGTQS= par i_strcpy(SGTQS,i_LireEECSGTQS( g_ieec ))
#	09/07/2004 - PSA - FO750 : gestion du controle rejet a 4 pour appel vers 3001
#	20/07/2004 - DRE - FO 763 : Modif test envoi vers FCT pour envoi vers DeltaMinute (cricom=2)
#	10/11/2004 - JLG - G2R0Cn : fusion Cm(G2R0C475) et Cr(G2R0C506) Modif:RPVI_DIRECT+champ service pour FERPV
#	25/11/2004 - THE - G2R0Cn : FO913 suppression du service @llo
#	04/10/2004 - THE - Modification pour Centaure en remplacement de FOR	
#	30/11/2004 - THE - FO939
#	24/01/2005 - RBE - G2R0Cnn : fusion Cn + Caa
#	11/02/2005 - PKH - G2R0Cbb : fusion Cbb + Cnn
#	21/02/2005 - RBE - FO1132 : correction indices
#	03/03/2005 - FAL - G2R0Cbbb :FO1136 retour arriere DC REJET telephone pour symphonie
#	18/03/2005 - FAL - FO1171 CCD_REEL avec 219 comme FO1079
#		- FO1164 moins d acces ACLA avec Optimisation
#	11/04/2005 - FAL - FO1228 CCD de FERPV et FE 
#	27/04/2005 - JLG - Ch REJET2 (REJET=2)
#	06/05/2005 - JLG - FO1276
#	30/05/2005 - JLG,THE - FO1320 1321
#	01/06/2005 - PKA - FO 1343
#	17/06/2005 - JLG DRE FO 1358
#	12/07/2005 - THE DRE FO 1385
#	21/07/2005 - PSA - Cj : inef speciaux
#	14/09/2005 - DRE - FO1406 Retour Fonction i_LireInfoECC (doit etre != et non >)
#	30/09/2005 - PSA - G2R1Co Envoi des doublons CAA du RI a Symphonie
#	25/11/2005 - PKH - G2R2Ca Evolution  envoie des DC inefficaces N0 URGENCE a Apache
#	28/09/2006 - JLG - G2R2Cv REJET3 (119 appel enfance maltraitee)
#	25/10/2006 - JLG - G2R2Cv modif pt_NORM car trop court
#	08/08/2007 - JLG - ParamFTSA-G3R3 lot2 Arret de FCT pour RTC
#	08/10/2007 - FAL - ParamFTSA-G3R3 lot2 FO2239 TAX de TRAFIC FE DM
#       06/11/2007 - PKH - G3R3Cv ajout REJET6 = 14 dans le cadre des appels 118 PTD & kiosque
#	28/04/2008 - JLG - G3R6 FO2378
#	20/03/2009 - THE - G3R12 Supp vtg valo
#	19/06/2009 - THE - G3R13Cy  Portabilite SRP
#	06/01/2010 - PKH - G3R15C13 QC321 Correction Beug parametrage Erreur suite au d?masquage des inefficaces 
# 	12/10/2010 - PKH - G3R18Cy ajout champ INFDDE dans Tfe_rpvRG
# 	08/11/2011 - RHE - G3R23 DC SU en depart pour CASPER
# 	02/12/2011 - RHE - G3R23 QC553 DC SU en deprt pour CASPER
# 	03/01/2012 - RHE - G3R23 DC SU en deprt pour CASPER (detection)
#	19/01/2012 - THE - VerifPcode
#	11/02/2013 - DRE - G4R02 : QC677, rechercher SCP-SRP uniquement si Dde non international
#	28/05/2013 - THE - G4R3 suppression envoi vers APACHE
#	25/03/2014 - DRE - G4R6 : Lot2 prise en compte des nouveaux Type Control envoy?s par la base (C+S )
#	24/04/2014 - DRE - G4R6 QC807
#	13/05/2014 - DRE - G4R6 QC817
#	19/06/2014 - DRE - G4R7 QC829
#	10/12/2014 - DRE - G4R8 QC862 : pb d'affichage du champ ECC_FACT sur l'ECC SYMPHONIE + envoi a CASPER au 1er tour de Redistribution 
# 
############################################################################

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

# VerifPcode
# Type de trafic:
#Constantes pour message d alarme
# VerifPcode
# G3R23
#DRE QC677
#DRE G4R6 lot2
#\DRE G4R6 lot2


# Variables fonctionnelles

# variables pour les metachamps obligatoires
# G3R23
#DRE G4R6 lot2
#DRE - G4R7 QC829
#QC862


# VerifPcode
# G3R23
# DRE G4R6 lot2


#-----------------#
# Initialisations #
#-----------------#

# Numeros d'instances
instSYMP_860026614	=-1
instDM_860026614		=-1
instCENT_860026614	=-1
instFE_860026614		=-1
instFERPV_860026614	=-1
instARAVIS_860026614	=-1
instTRAFIC_860026614	=-1
instVTG_860026614		=-1
#G4R3 instAPACHE	=-1
NVU_860026614		= 0
SPORTABILITE_SCP_860026614= 0
EPORTABILITE_SCP_860026614= 0
EPORTABILITE_860026614	= 0
CCD_REEL_860026614	= 0
#FO1228
CCD_REEL_FE_860026614	= 0
#bCONVERSION	= 0
TAXE_CAL_860026614	= 0

bREDIST_860026614		= 0
EFFICACE_860026614	= 2
REJET_860026614		= 0
TRANSGROUPE_860026614	= 0
RPV_860026614		= 0
ADO_860026614		= 0
IEZLT_860026614		=-1
CCD_860026614		= 0xFF
VTGRI_3BPQ_860026614	= 0
VTGRI_CAX_860026614	= 0
VTGRI_860026614		= 0
GVPN_860026614		= 0
ENVELOPPE_NOK_860026614	=-1
ART_860026614		= 0xFFFFFFFF
MINE_860026614		= 0xFFFFFFFF
APPLI_860026614		= 0xFFFFFFFF
DC_CAA_860026614		= 0
SUP_860026614		= 0
RPVI_DIRECT_860026614	= 0
OPT_860026614		= 0
ZA_860026614		= 0xFF
val_normal_860026614	= 0xFF
ROC_860026614		= 0
val_INEF_860026614	= 0
SRP_Sporta_SPN_860026614	= 0
#DRE G4R6 lot2
Date_CPS_860026614 	= 0
instALICE_860026614 	= -1
tax_860026614 		= 0
longueur_860026614	= 0
#DRE - G4R7 QC829
b_Fact_CPS_Loc_860026614 = 0
b_Fact_CPS_RI_860026614 = 0
#QC862
bREDISTALICE_860026614 = 0

#Allocation memoire pour buffer:
#G4R3 pt_URGENCE_APACHE	= "0569587521589478585865"
pt_NORM_860026614		= "389389389389389389389389389389389389389389389389389389"
# VerifPcode
#SGTQS		= "454545454545454545"
pt_TEMP_860026614		= "01234567890123456789012345678912345"
pt_nomEccFact_860026614	= "7171717171717171"
pt_EccCentaure_860026614	= "pt_EccCentaure44"
pt_InfoCompl_860026614	= "33312345"
pt_Traf_860026614		= "44444444412345"
pt_DM_860026614		= "5555555512345"
pt_COCA_860026614		= "666612345"
pt_COCAV_860026614	= "777712345"
pt_BUF_860026614 		= "02345678912345678912345612345"
pt_BUF1_860026614 	= "27272727272727272727272727272"
pt_BUF2_860026614 	= "56757456345345657876846312345"
pt_marque_audit_860026614	= "9876543210123456712345"
pt_CodeOp_860026614 	= "99999999999999999999999999999912345"
pt_service_860026614	= "6534"
pt_STY_str_860026614	= "11111111112345"
pt_LIBELREDIST_860026614	= "3232323232323232323232323232323232323232"
pt_SGTQS_860026614	= "222222222222123455"
pt_TCOMMUT_860026614	= "20202020202020202020202020202012345"
pt_INEF_STD_860026614	= "60606060606060606060606060606012345"
#G4R3 pt_CODE_APACHE	= "70707070707070707070707070707012345"
#G4R3 pt_INEF_APACHE	= "80808080808080808080808080808012345"
pt_INEF_COMMUT_860026614	= "90909090909090909090909090909012345"
pt_IDAV_DIST_N_860026614	= "09876543210987654321098765432109876"
pt_CODCIRDA_860026614	= "53453546"
pt_CODCIRA_860026614	= "78474546"
pt_nde_normal_860026614	= "1919143210123456712345343434"
pt_CODESCP_860026614	= "135132132135135135135135135135"
# G3R23
pt_NSUC_860026614		= "pt_NSUC1234567890123456789012345"
# DRE G4R6 lot2
pt_MESSAGE_860026614 = "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_860026614	 = "pt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDIST"
pt_CODE_TARIF_860026614 	 = "pt_CODE_TARIFpt_CODE_TARIF"
pt_TYPE_EDIT_860026614	 = "pt_TYPE_EDIT"


# Initialisation
#G4R3 i_strcpy(pt_URGENCE_APACHE, "")
i_strcpy(pt_NORM_860026614, "")
i_strcpy(pt_nomEccFact_860026614, "")
i_strcpy(pt_EccCentaure_860026614, "")
i_strcpy(pt_CODESCP_860026614 , "")
# VerifPcode
i_strcpy(pt_InfoCompl_860026614,"")
i_strcpy(pt_Traf_860026614,"")
i_strcpy(pt_DM_860026614,"")
i_strcpy(pt_COCA_860026614,"")
i_strcpy(pt_COCAV_860026614,"")
i_strcpy(pt_BUF1_860026614,"")
i_strcpy(pt_BUF2_860026614,"")
i_strcpy(pt_marque_audit_860026614,"")
i_strcpy(pt_CodeOp_860026614,"")
i_strcpy(pt_service_860026614,"")
i_strcpy(pt_STY_str_860026614,"")
i_strcpy(pt_LIBELREDIST_860026614,"")
i_strcpy(pt_SGTQS_860026614,"")
i_strcpy(pt_TCOMMUT_860026614,"")
i_strcpy(pt_INEF_STD_860026614,"")
#G4R3 i_strcpy(pt_CODE_APACHE,"")
#G4R3 i_strcpy(pt_INEF_APACHE,"")
i_strcpy(pt_INEF_COMMUT_860026614,"")
i_strcpy(pt_IDAV_DIST_N_860026614,"")
i_strcpy(pt_CODCIRDA_860026614,"")
i_strcpy(pt_CODCIRA_860026614,"")
i_strcpy(pt_nde_normal_860026614,"")
i_strcpy(pt_TEMP_860026614,"")
i_strcpy(pt_BUF_860026614,"")
# G3R23
i_strcpy(pt_NSUC_860026614,"")
# DRE G4R6 lot2
i_strcpy(pt_MESSAGE_860026614, "")
i_strcpy(pt_CODE_TARIF_860026614 , "    ")
i_strcpy(pt_TYPE_EDIT_860026614 , " ")


trace(" ######## DEBUT PCODE : __FILE__.DIST ######## ")
#trace("distribution - Tcentrex")


i_strcpy(pt_SGTQS_860026614,i_LireEECSGTQS(g_ieec) )
#trace2("Apres LireEECSGTQS=%s", pt_SGTQS, "")


# ICAR_ABS (date platine) et ICAR_REL (date locale=date de article)
ICAR_REL_860026614 = i_get_art_field(g_iartin,$DATE)
SI ( ICAR_REL_860026614 == -1 )
ALORS
	code_errone_860026614 = 0xA080
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026614, C_Article_860026614, "i_get_art_field/DATE" )
	SAUT DISTRI_ERR
FINSI

ICAR_ABS_860026614 = i_date_platine(g_ieec,g_iartin,ICAR_REL_860026614)
SI ( ICAR_ABS_860026614 == -1 )
ALORS
	code_errone_860026614 = 0xA080
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026614, C_Article_860026614, "i_date_platine/ICAR_REL" )
	SAUT DISTRI_ERR
FINSI

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

dduree_860026614 = i_get_art_field( g_iartin, $Tcentrex::dduree )
tax_860026614    = i_get_art_field( g_iartin, $Tcentrex::tax )
dpivot_860026614 = i_get_art_field( g_iartin, $Tcentrex::dpivot)

# Champs exclusifs frequemment utilises
SI ( i_valid_field_n(g_iartin,$Tcentrex::T3cap2 ) == 1 )
ALORS
	#trace("Parametre cap2 present !")
	TAP_860026614=i_get_art_field(g_iartin,$Tcentrex::TAP:0)
	SUP_860026614=i_get_art_field(g_iartin,$Tcentrex::SUP:0)
	CAX_860026614=i_get_art_field(g_iartin,$Tcentrex::CAX:0)
FINSI

SI ( i_valid_field_n(g_iartin,$Tcentrex::T3cab ) == 1 )
ALORS
	#trace("Parametre cab present !")
	TAP_860026614=i_get_art_field(g_iartin,$Tcentrex::TAP:1)
	SUP_860026614=i_get_art_field(g_iartin,$Tcentrex::SUP:1)
	CAX_860026614=i_get_art_field(g_iartin,$Tcentrex::CAX:1)
FINSI

erreur_860026614 = i_get_art_str( g_iartin, $Tcentrex::INEF, pt_INEF_COMMUT_860026614 )

# Recuperation du ZA de DEDE_DIST_N
# pour RPV, ADO et type_trafic:
SI ( i_valid_field_n( g_iartin, $NDE ) )
ALORS
	# Attention : on initialise ZA avec les valeurs du NDE (comme en G2R0C8)
	# Ce type d'initialisation est valable dans la plupart des cas (seuls les cas avec prefixe ne seront pas corrects)
	# Pour couvrir aussi ces cas particuliers, on recalcule si possible ZA avec NORMAL juste apres.
	ZA_860026614 = 10*( i_get_art_fieldtab( g_iartin, $NDE, 2 ) ) + i_get_art_fieldtab( g_iartin, $NDE, 3 )
SINON
	#trace( "Inefficace, NDE absent => seulement SYMPHONIE !" )
	SAUT DEV_SYMPHONIE
FINSI

SI ( i_valid_field_n( g_iartin, $NORMAL ) )
ALORS
	val_normal_860026614 = 10*( i_get_art_fieldtab( g_iartin, $NORMAL, 0 ) ) + i_get_art_fieldtab( g_iartin, $NORMAL, 1 )
	ZA_860026614 = 10*( i_get_art_fieldtab( g_iartin, $NORMAL, 1 ) ) + i_get_art_fieldtab( g_iartin, $NORMAL, 2 )
FINSI
#trace1("ZA=<%d>",ZA)

# Type de Trafic:
SI ( val_normal_860026614 != 0xFF )
ALORS
	SI ( !val_normal_860026614 )
	ALORS
		# Le Num. Demande normalise commence par 00:
		type_traf_860026614 = international_860026614
		# On verifie si c est un numero vert universel (NVU)
		SI ( ( i_get_art_fieldtab( g_iartin, $NORMAL, 2 ) == 8 )
		  && ( i_get_art_fieldtab( g_iartin, $NORMAL, 3 ) == 0 )
		  && ( i_get_art_fieldtab( g_iartin, $NORMAL, 4 ) == 0 ) )
		ALORS
			NVU_860026614 = 1
		FINSI
	SINON
		SI ( ( val_normal_860026614 ) && ( val_normal_860026614 < 10 ) )
		ALORS
			# LE Num.Demande normalise commence par 0X
			# avec X non nul:
			type_traf_860026614 = national_860026614
		SINON
			type_traf_860026614 = special_860026614
		FINSI
	FINSI
FINSI
#trace1("Type de trafic = <%d>", type_traf)

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

SI ( trait_ok_860026614 > 0 )
ALORS
	ENVELOPPE_NOK_860026614 = 0
FINSI

#      Initialisation des variables
#  issues des metachamps ddebut dduree tax

ddebut_860026614 = i_get_art_field (g_iartin,$Tcentrex::ddebut )

SI ( ddebut_860026614 == -1 )
ALORS
	code_errone_860026614 = 0xA080
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026614, C_Article_860026614, "i_get_art_field/ddebut" )
	SAUT DISTRI_ERR
FINSI

gmt_date_860026614 = i_DHgetCe2gTime (NUMTAB_860026614, ZONEMETRO_860026614, ddebut_860026614 )
dduree_860026614=i_get_art_field(g_iartin,$Tcentrex::dduree)
tax_860026614=i_get_art_field(g_iartin,$Tcentrex::tax)
#trace1("Pcode => ddebut=<%u>",ddebut)
#trace1("Pcode => dduree=<%d>",dduree)
#trace1("Pcode => tax=<%d>",tax)

#G3R23
# Ajout dpivot dans l'enveloppe
SI ( ENVELOPPE_NOK_860026614 )
ALORS
	ENVELOPPE_NOK_860026614 = i_add_opt( "E_Tcentrex" )
FINSI
erreur_860026614 = i_set_attr_val_n( $E_Tcentrex::DATE_P, dpivot_860026614)

############################################################################
# 	Variables Fonctionnelles
############################################################################

#--------------------------------------#
# 	EFFICACE
#--------------------------------------#
SI ( !( i_get_bit_val ( TAP_860026614, 7 ) ) )
ALORS
	EFFICACE_860026614 = 1
SINON
	EFFICACE_860026614 = 0
FINSI
#trace1("EFFICACE=%d",EFFICACE)

#--------------------------------------#
# 	CAX
#--------------------------------------#
#trace1("CAX=%d",CAX)

#--------------------------------------#
# 	REJET
#--------------------------------------#
SI ( i_valid_field_n ( g_iartin, $T4rejet ) )
ALORS
	REJET_860026614 = i_get_art_field(g_iartin,$REJET )
FINSI
#DRE - G4R7 QC829
SI REJET_860026614 == CPT_CPS_Loc_860026614
ALORS
	b_Fact_CPS_Loc_860026614 = 1
FINSI
SI REJET_860026614 == CPT_CPS_RI_860026614
ALORS
	b_Fact_CPS_RI_860026614 = 1
FINSI
#\DRE - G4R7 QC829
#trace1("REJET = %d",REJET)

INF_DEDE_860026614 = i_get_art_field(g_iartin,$Tcentrex::INF_DEDE)
bitDinfdede_860026614 = i_get_bit_val(INF_DEDE_860026614,5)

## Variable fonctionnelle ALLO:
# VerifPcode
#cle = i_verify_value( g_iartin, "T3cle", 0x18 )

SI ( i_valid_field_n (g_iartin,$NUM_IDAV ) )
ALORS
	res_860026614=i_get_art_str(g_iartin,$NUM_IDAV,pt_IDAV_DIST_N_860026614)
	i_get_sub_str(pt_IDAV_DIST_N_860026614,0,4,pt_TEMP_860026614)

	SI ( ( i_strcmp(pt_TEMP_860026614, "07997" ) == 0 )
	  || ( i_strcmp(pt_TEMP_860026614, "07998" ) == 0 )
	  || ( i_strcmp(pt_TEMP_860026614, "07999" ) == 0 )
	  || ( i_strcmp(pt_TEMP_860026614, "06997" ) == 0 )
	  || ( i_strcmp(pt_TEMP_860026614, "06998" ) == 0 ) )
	ALORS
		RPVI_DIRECT_860026614 = 1
	FINSI
	i_get_sub_str (pt_IDAV_DIST_N_860026614, 0, 2, pt_TEMP_860026614 )
	SI ( i_strcmp (pt_TEMP_860026614, "842") == 0 )
	ALORS
		i_get_sub_str(pt_IDAV_DIST_N_860026614,3,4,pt_TEMP_860026614)
		SI ( i_strcmp (pt_TEMP_860026614, "08") != 0 )
		ALORS
			SRP_Sporta_SPN_860026614 = 1
		FINSI
	FINSI
FINSI

SI ( ( i_verify_value( g_iartin, "T3cle", 0x47 ) ) && bitDinfdede_860026614 )
ALORS
	RPVI_DIRECT_860026614 = 1
FINSI
#trace1("RPVI_DIRECT : %d",RPVI_DIRECT)



SI ( i_valid_field_n(g_iartin, $NORMAL ) )
ALORS
	erreur_860026614 = i_get_art_str(g_iartin, $NORMAL, pt_NORM_860026614 )
SINON
	SI ( i_valid_field_n(g_iartin, $NDE ) )
	ALORS
		erreur_860026614 = i_get_art_str(g_iartin, $NDE, pt_NORM_860026614)
	FINSI
FINSI

#G3R23 QC553
i_get_sub_str(pt_NORM_860026614, 0, 0, pt_BUF_860026614)

SI (i_strcmp(pt_BUF_860026614, "0") == 0)
ALORS
#DRE G4R6 lot2
#	i_get_sub_str(pt_NORM, 1, -1, pt_BUF)
	i_get_sub_str(pt_NORM_860026614, 1, -1, pt_NORM_860026614)
#SINON
#	i_strcpy(pt_BUF, pt_NORM)
FINSI
	
#DRE G4R6 lot2
#i_strcpy(pt_NSUC, i_get_tab_field("TNSUC", gmt_date, pt_BUF))
i_strcpy(pt_NSUC_860026614, i_get_tab_field("TNSUC", gmt_date_860026614, pt_NORM_860026614))
SI (i_strcmp(pt_NSUC_860026614,"") != 0 )
	ALORS
	b_NSUC_860026614 = 1
	SI (i_strcmp(LCASE_860026233(pt_NSUC_860026614),"vide") == 0 )
		ALORS
		i_strcpy(pt_NSUC_860026614," ")
	FINSI
FINSI

trace2("Recherche NSUC - Dede   : <%s>", pt_NORM_860026614, "")
trace1("Recherche NSUC - b_NSUC : %x",b_NSUC_860026614)


val_INEF_860026614 = i_get_art_field(g_iartin, $Tcentrex::INEF)


#DRE G4R6 lot2
#####################################################################
# 	              Traitement C+S (CPS)
#DRE - G4R7 QC829
#SI (REJET==CPT_CPS_Loc)
SI b_Fact_CPS_Loc_860026614 || b_Fact_CPS_RI_860026614
ALORS
	i_strcpy(pt_TEMP_860026614, i_get_tab_field( "TDATCPS", gmt_date_860026614, C_DATCPS_860026614 ))

	erreur_860026614 = i_set_art_str (g_iartout10,$Conversion::DATE_STR,pt_TEMP_860026614)
	Date_CPS_860026614 = i_get_art_field(g_iartout10, $Conversion::DATE_ASC)
			
	SI ddebut_860026614 < Date_CPS_860026614
	ALORS
		erreur_860026614 = i_format_str2(pt_MESSAGE_860026614," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_NORM_860026614,pt_TEMP_860026614)
		code_errone_860026614 = 0xA080
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre( 8599, 1, g_iartin,"", 3,code_errone_860026614, C_Article_860026614, pt_MESSAGE_860026614 )
		SAUT DISTRI_DIV
	SINON
		#######################################
		#  Soumission de la requete de consultation d'une table de distribution ALICE
		#######################################
#DRE G4R6 QC807 pt_NDE Remplace par pt_NORM
#		i_strcpy(pt_NDE,pt_NORM)

		SI i_strplcmp (pt_NORM_860026614,"0",0,1) == 0
		ALORS
			i_get_sub_str(pt_NORM_860026614,1,-1,pt_NORM_860026614) 	
		FINSI
		longueur_860026614 = i_conv_ascii_dcb (pt_NORM_860026614, pt_TEMP_860026614)
		SI (i_EnvoiReqConsTabDist( TD_SVA_860026614,gmt_date_860026614,pt_TEMP_860026614,longueur_860026614,0,1) != 0)
		ALORS
			#trace("Erreur i_EnvoiReqConsTabDist ALICE")
#QC862
#			bREDIST = 1
			bREDISTALICE_860026614 = 1
			i_strcpy(pt_LIBELREDIST_860026614,"Echec sur i_EnvoiReqConsTabDistDouble ALICE ")
		FINSI
		
		#######################################
		# Recherche de l'instance ECC ALICE
		#######################################
		instALICE_860026614 = i_LireInstanceECC(C_INST_ALICE_860026614)
		SI (!instALICE_860026614)
		ALORS
			#trace("Pas d'instance pour ALICE !")
			erreur_860026614 = i_PlvMessEmettre(8501,1,g_iartin,"",3,C_INST_ALICE_860026614,C_Article_860026614,g_ieec)
			SAUT DISTRI_ERR
		FINSI
		#trace1("instALICE  =<%d>",instALICE)	

		#######################################
		# Lecture Resultat requete ALICE
		#######################################
		erreur_860026614 = i_LireReqConsTabDist()
		#trace1("RETOUR i_LireReqConsTabDist retour requette ALICE, erreur=<%d>",erreur)
		SI ( erreur_860026614 != 0 )
		ALORS
			#trace1( "Erreur i_LireReqConsTabDist ALICE: <%d>", erreur)
#QC862
#			bREDIST = 1
			bREDISTALICE_860026614 = 1
			i_strcpy(pt_LIBELREDIST_860026614,"Echec sur i_LireReqConsTabDistDouble ALICE ")
		FINSI
		res_860026614 = i_LireInfoECC( instALICE_860026614, 0 )
		
		SI (res_860026614 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026614 = i_LireChaineInfo( res_860026614, 0, 4, pt_BUF_860026614 )
			SI i_strcmp(pt_BUF_860026614,"") != 0
			ALORS
				i_strcpy(pt_CODE_TARIF_860026614,pt_BUF_860026614)
			SINON
				# info complementaire CODE_TARIF vide
#QC862
#				bREDIST = 1
				bREDISTALICE_860026614 = 1
				erreur_860026614 = i_format_str2(pt_LIBELREDIST_860026614," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NORM_860026614,0)
			FINSI
			
			erreur_860026614 = i_LireChaineInfo( res_860026614, 4, 1, pt_BUF_860026614 )
			SI i_strcmp(pt_BUF_860026614,"") != 0
			ALORS
				i_strcpy(pt_TYPE_EDIT_860026614,pt_BUF_860026614)
			SINON
				# info complementaire TYPE_EDIT vide
#QC862
#				bREDIST = 1
				bREDISTALICE_860026614 = 1
				erreur_860026614 = i_format_str2(pt_LIBELREDIST_860026614," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NORM_860026614,0)
			FINSI
		SINON
#QC862
#			bREDIST = 1
			bREDISTALICE_860026614 = 1
			erreur_860026614 = i_format_str2(pt_LIBELREDIST_860026614," AR <%s> non trouve dans ALICE",pt_NORM_860026614,0)
		FINSI
	FINSI
FINSI
#\DRE G4R6 lot2




#--------------------------------------#
# 	TRANSGROUPE
#--------------------------------------#
SI ( ( ( i_get_art_field(g_iartin,$Tcentrex::STY ) ) & 0x40 ) == 0x40 )
ALORS
	TRANSGROUPE_860026614 = 1
SINON
	TRANSGROUPE_860026614 = 0
FINSI
#trace1("TRANSGROUPE=%d",TRANSGROUPE)

#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
#trace2("Apres LireEECSGTQS=%s", pt_SGTQS, "")

#INEFF et la com est assurree par un CAA
SI ( !EFFICACE_860026614 )
ALORS
	# recuperation des champs APPLI MINE et ART de l'entete de bloc
	ART_860026614 = i_bloc_V1V2_recupererIdent(ART_BLOC_V1V2)
	SI (ART_860026614 == 4)
	ALORS
		MINE_860026614 = i_bloc_V1V2_recupererIdent(MINE_BLOC_V1V2)
		APPLI_860026614 = i_bloc_V1V2_recupererIdent(APPLI_BLOC_V1V2)
	FINSI

	#IFDEF trace_niv1 = 1
	trace1("champ ART : %x",ART_860026614)
	trace1("champ MINE : %x",MINE_860026614)
	trace1("champ APPLI : %x",APPLI_860026614)
	#ENDIF
	pt_TCOMMUT_860026614 = type_commut_860026233("APA1", pt_SGTQS_860026614, dpivot_860026614)
	SI ( pt_TCOMMUT_860026614 == g_inull )
	ALORS
		erreur_860026614 = i_format_str2(pt_TEMP_860026614," %s",pt_SGTQS_860026614,0)
		erreur_860026614 = i_PlvMessEmettre(8505,2,g_iartin,"",3,"Tcentrex/type_commut",pt_TEMP_860026614,g_ieec)
	SINON
		pt_INEF_STD_860026614 = inef_std_860026233("APA2", pt_TCOMMUT_860026614, pt_INEF_COMMUT_860026614, dpivot_860026614)
		SI ( pt_INEF_STD_860026614 == g_inull)
		ALORS
			#trace("Code inef absent dans la table")
			erreur_860026614 = i_format_str2(pt_TEMP_860026614," %s",pt_INEF_COMMUT_860026614,0)
			erreur_860026614 = i_PlvMessEmettre(8505,2,g_iartin,"",3,"Tcentrex/inef_std",pt_TEMP_860026614,g_ieec)
		SINON
			DC_CAA_860026614=1
		FINSI
	FINSI
	#trace2(" Type de commutateur <%s>", pt_TCOMMUT, "")
	#trace2(" Code inefficace standard <%s>", pt_INEF_STD, "")
FINSI

#--------------------------------------#
# 	CENTREX1
#--------------------------------------#
bitAinfdede_860026614 = i_get_bit_val(INF_DEDE_860026614,8)
bitBinfdede_860026614 = i_get_bit_val(INF_DEDE_860026614,7)

SI ((!bitAinfdede_860026614)&&(bitBinfdede_860026614==1))
ALORS
	CENTREX1_860026614 = 1
SINON
	CENTREX1_860026614 = 0
FINSI
#trace1("CENTREX1=%d",CENTREX1)

#--------------------------------------#
# 	CENTREX2
#--------------------------------------#
SI ( (!bitAinfdede_860026614) && (!bitBinfdede_860026614) )
ALORS
	CENTREX2_860026614 = 1
SINON
	CENTREX2_860026614 = 0
FINSI
#trace1("CENTREX2=%d",CENTREX2)

#--------------------------------------#
# 	DC Centrex intra-groupe
#--------------------------------------#
DCCentrexIntragroupe_860026614 = 0
SI ( i_get_art_field(g_iartin, $Tcentrex::DESTINX) == 00 )
ALORS
	DCCentrexIntragroupe_860026614=1
SINON
	SI ( ( i_get_art_field(g_iartin, $Tcentrex::DESTINX) == 255 ) && ( ( bitAinfdede_860026614 == 1 ) && !bitBinfdede_860026614 ) )
	ALORS
		DCCentrexIntragroupe_860026614=1
	SINON
		DCCentrexIntragroupe_860026614=0
	FINSI
FINSI
#trace1("DC Centrex intra-groupe : %d",DCCentrexIntragroupe)

SI ( val_normal_860026614 == 0 ) && ( NVU_860026614 == 0 )
ALORS
	# Demande de type international non Libre Appel
	GVPN_860026614=1
FINSI

#--------------------------------------#
# 	RPV
#--------------------------------------#
SI ( type_traf_860026614 == national_860026614 )
ALORS
	SI ( ZA_860026614==85 )
	ALORS
		RPV_860026614 = 1
	SINON
		RPV_860026614 = 0
	FINSI
FINSI
#trace1("RPV=%d",RPV)

# 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_860026614 = 1
FINSI

#--------------------------------------#
# 	ADO
#--------------------------------------#
SI ( ( TRANSGROUPE_860026614 == 1 ) && ( CAX_860026614==6 ) && !vE_860026614 && !( ( ZA_860026614>>4 ) & 0xF) 
  && ( ( i_get_art_field(g_iartin, $Tcentrex::DESTINX) == 2 ) 
  || ( ( i_get_art_field(g_iartin, $Tcentrex::DESTINX) == 255 ) && !bitAinfdede_860026614 && !bitBinfdede_860026614 ) ) )
ALORS
	ADO_860026614 = 1
	SI ( ( i_get_art_fieldtab(g_iartin, $NDE, 0 ) == 0 ) 
	  && ( i_get_art_fieldtab(g_iartin, $NDE, 1 ) == 0 ) 
	  && ( i_get_art_fieldtab(g_iartin, $NDE, 2 ) == 8 ) 
	  && ( i_get_art_fieldtab(g_iartin, $NDE, 3 ) == 0 ) 
	  && ( i_get_art_fieldtab(g_iartin, $NDE, 4 ) == 0 ) )
	ALORS
		ADO_860026614 = 0
	FINSI
FINSI
#trace1("ADO=%d",ADO)

#--------------------------------------#
# 	IEZLT
#--------------------------------------#
SI ( i_valid_field_n(g_iartin, $Tcentrex::T4ZLT ) == 1 )
ALORS
	IEZLT_860026614=i_get_art_field(g_iartin,$ZLT)
FINSI
#trace1("IEZLT=%d",IEZLT)

#--------------------------------------#
# 	CCD
#--------------------------------------#
SI ( i_valid_field_n(g_iartin, $Tcentrex::CCD ) == 1 )
ALORS
	CCD_860026614 = i_get_art_field(g_iartin,$Tcentrex::CCD)
FINSI
#trace1("CCD=%d",CCD)

#--------------------------------------#
# 	COCA / COCAV
#--------------------------------------#
SI ( i_valid_field_n(g_iartin, $BETAV ) )
ALORS
	erreur_860026614 = i_get_art_str(g_iartin, $BETAV, pt_COCAV_860026614)
FINSI

SI ( i_valid_field_n(g_iartin, $BETA ) )
ALORS
	erreur_860026614 = i_get_art_str (g_iartin, $BETA, pt_COCA_860026614)
FINSI
preTrans_860026614 =-1
nb_digit_860026614 = 0

SI ( ( preTrans_860026614 == -1 ) && ( i_valid_field_n(g_iartin, $BETAV ) ) )
ALORS
	nb_digit_860026614=i_strlen(pt_COCAV_860026614)
	SI ( nb_digit_860026614 > 0 )
	ALORS
		preTrans_860026614 = g_iartin.BETAV[nb_digit_860026614-1]
		SI ( nb_digit_860026614 > 1 )
		ALORS
			preTrans_860026614 = ( 10* (g_iartin.BETAV[nb_digit_860026614-2] ) + preTrans_860026614 )
			SI ( nb_digit_860026614 > 2 )
			ALORS
				preTrans_860026614 = ( 100* (g_iartin.BETAV[nb_digit_860026614-3] ) + preTrans_860026614 )
				SI ( nb_digit_860026614 > 3 )
				ALORS
					preTrans_860026614 = ( 1000* (g_iartin.BETAV[nb_digit_860026614-4] ) + preTrans_860026614 )
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

#trace1("prefixe transport.=<%d>",preTrans)
SI ( ( preTrans_860026614 != 8 ) && ( preTrans_860026614 != -1 ) )
ALORS
	OPT_860026614 = 1
FINSI

#--------------------------------------#
# 	E 
#--------------------------------------#
vE_860026614=-1
#trace("Appel Extraction_STP")
vE_860026614 = Extraction_STP_860026233( g_iartin, $NDE, TRANSGROUPE_860026614, CENTREX1_860026614, CENTREX2_860026614, preTrans_860026614, $NDR)
#trace1("E apres extraction_STP= %d",vE)

#--------------------------------------#
# 	VTG RI
#--------------------------------------#
SI (    i_get_art_fieldtab(g_iartin,$NDE,0)==3  &&
i_get_art_fieldtab(g_iartin,$NDE,1)==0  &&
i_get_art_fieldtab(g_iartin,$NDE,2)==4  &&
i_get_art_fieldtab(g_iartin,$NDE,3)==8     )
ALORS
	VTGRI_860026614=1
	VTGRI_3BPQ_860026614=1
FINSI

SI ( ( ( vE_860026614 != 8 ) || ( CAX_860026614 != 7 ) ) && (IEZLT_860026614==extraZLT_860026614) 
  && ( type_traf_860026614!=special_860026614 ) && ( preTrans_860026614 == 8 ) && ( CAX_860026614 == 1 ) )
ALORS
	VTGRI_860026614 = 1
	VTGRI_CAX_860026614 = 1
FINSI
#trace1("VTGRI=<%d>",VTGRI)
#trace1("VTGRI_CAX=<%d>",VTGRI_CAX)
#trace1("VTGRI_3BPQ=<%d>",VTGRI_3BPQ)
erreur_860026614 =i_get_art_str(g_iartin,$NDE,pt_BUF_860026614 )

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

#DRE QC677
SI CCD_860026614 != CCD_Internat_860026614
ALORS
	# Portabilite
	pt_CodeOp_860026614 = CodeOperateurTable6_860026233(gmt_date_860026614, pt_BUF_860026614, "45S" )
	
	SI ( !i_strcmp(pt_CodeOp_860026614, "84208") )
	ALORS
		EPORTABILITE_860026614 = 1
	FINSI
	
	#trace1("EPORTABILITE=<%d>", EPORTABILITE)
	
	######################## Portabilite Entrante ou Sortante SCP (referentiel ACLA)#############################################
	# optimise par la fonction CodeOperateurTable6
	trace(" ------------ RECHERCHE INSTANCE ACLA ------------- ")
	instACLA_860026614  = i_LireInstanceECC(INST_ACLA_860026614 )
	
	SI (!instACLA_860026614 )
	ALORS
		trace ("---------------------Pas d'instance pour ACLA------------------------------")
		erreur_860026614  = i_PlvMessEmettre(8501,2,g_iartin,"",3,"ACLA",C_Article_860026614 ,g_ieec)
		SAUT DISTRI_ERR
	FINSI
	#trace1(" ------------ instACLA=<%d> ------------ ",instACLA )
	
	erreur_860026614 =i_get_art_str(g_iartin,$NDE,pt_BUF_860026614 )
	pt_CODESCP_860026614 = CodeOperateurTable6_860026233(gmt_date_860026614, pt_BUF_860026614, "ACLA")
	trace2(" ------------ Tcentrex -resultat de pt_CODESCP : <%s> ------------ ",pt_CODESCP_860026614  ,"")
	
	SI ( !i_strcmp(pt_CODESCP_860026614 , "84008" ) )
	ALORS
		EPORTABILITE_SCP_860026614  = 1
	SINON
		SI ( i_strcmp(pt_CODESCP_860026614, "84008" ) != 0 && i_strcmp(pt_CODESCP_860026614, "") != 0 )
		ALORS
			SPORTABILITE_SCP_860026614 = 1
		FINSI
	FINSI
FINSI
#FIN DRE QC677



SI (EPORTABILITE_860026614 ==1)
ALORS
	CCD_REEL_860026614  = 212
SINON
	SI ( EPORTABILITE_SCP_860026614 == 1 )
	ALORS
		CCD_REEL_860026614  = 218
	SINON
		SI (SPORTABILITE_SCP_860026614 == 1)
		ALORS
			CCD_REEL_860026614  = 219
		SINON
			CCD_REEL_860026614  = CCD_860026614
		FINSI
	FINSI
FINSI

#trace1 ("-----------EPORTABILITE       =<%d>-------",EPORTABILITE )
#trace1 ("-----------EPORTABILITE_SCP   =<%d>-------",EPORTABILITE_SCP )
#trace1 ("-----------SPORTABILITE_SCP   =<%d>-------",SPORTABILITE_SCP )
#trace1 ("-----------Valeur de CCD      =<%d>-------",CCD)
#trace1 ("-----------Valeur de CCD_REEL =<%d>-------",CCD_REEL )

#--------------------------------------#
# 	TGPRI
#--------------------------------------#
# Appel de l'algo-metachamp vTCENTREX_TGPRI.src
TGPRI_860026614 = i_get_art_field(g_iartin,$vTGPRI )
#trace1("TGPRI=<%d>",TGPRI)

#-------------------------------------------------
# TRAITEMENT pour STY ( Trafic, DM et Vtg_valo ) :
#-------------------------------------------------

# Recuperation du champ STY :
# VerifPcode
#STY_hex = i_get_art_field( g_iartin,$STY )
# Gestion de Tcentrex.STY.B=1 avec DSTX present et Tcentrex.INF_DEDE.AB=00 :
SI ( !i_valid_field_n( g_iartin, $T4dstx )  && !(i_get_art_field( g_iartin,$INF_DEDE ) & 0xC0 ) )
ALORS
	erreur_860026614 = i_transformer_bits( g_iartin, ($STY & 0x40) , "FV", pt_STY_str_860026614 )
SINON
	erreur_860026614 = i_transformer_bits( g_iartin, $STY, "FV", pt_STY_str_860026614 )
FINSI

#--------------------------------------#
# 	Stockage explicite
#--------------------------------------#
# la condition sur le REJET ne provoque plus l envoi en ELIMINE mais une distribution a Symphonie
# Rappel : les DC Mayotte Expe sont elimines explicitement au traitement
SI ( ( ( REJET_860026614 == 1 && !SRP_Sporta_SPN_860026614 ) || REJET_860026614 == 2 || REJET_860026614 == 3 || REJET_860026614 == 14 ) && ( CAX_860026614 != 3 ) )
ALORS
	#trace("stockage uniquement vers Symphonie")
	distri_symph_860026614 = 1
	SAUT DEV_SYMPHONIE
FINSI

#------------------------------------- #
#  Criteres de distrib. vers CENTAURE  #
#--------------------------------------#
instCENT_860026614 = i_LireInstanceECC(C_InstCENTDC_860026614)
SI (!instCENT_860026614)
ALORS
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstCENTDC_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI
#trace1("instCENT=<%d>",instCENT)

crit_com_860026614=0
SI ( EFFICACE_860026614 && ( CAX_860026614 != 9 ) )
ALORS
	crit_com_860026614 = 1
	#trace("Les criteres communs sont verifies !")

	SI ( ( instCENT_860026614 > 0 ) && ( CAX_860026614 == 3) && ( REJET_860026614 != 2 ) && ( REJET_860026614 != 3 ) )
	ALORS
		bCENT_860026614=1
		# Ajout de l'ECC Centaure a la liste courante des ECC:
		res_860026614 = i_AjouterCouranteECC(instCENT_860026614)
		# Saut vers les criteres et la mise au format de symphonie
		# sans requete de consultation a la table de distribution:
		SAUT DEV_SYMPHONIE
	SINON
		bCENT_860026614 = 0
		#trace("Pas de mise au format Centaure")
	FINSI
SINON
	bCENT_860026614 = 0
	crit_com_860026614 = 0
	#trace("Criteres communs non-verifies !!")
FINSI

############################################################################
# 	Envoi Requetes Table de Distribution
############################################################################
L_NDR_860026614 = i_get_art_fieldlength(g_iartin,$NDR)
SI ( L_NDR_860026614 % 2 == 0 )
ALORS
	L_NDR_860026614 = L_NDR_860026614 / 2
SINON
	L_NDR_860026614 = L_NDR_860026614 / 2 + 1
FINSI
res_860026614 = (i_EnvoiReqConsTabDistDouble( TD_Fixe, TD_Inter, gmt_date_860026614, i_get_art_fieldptr(g_iartin, $NDR), L_NDR_860026614, L_NDR_860026614, 1, 0, 1))

SI ( res_860026614 !=0 )
ALORS
	#trace1("Erreur i_EnvoiReqConsTabDistDouble %d", res)
	i_strcpy(pt_LIBELREDIST_860026614,"i_EnvoiReqConsTabDistDouble")
	bREDIST_860026614 = 1
	SAUT DEV_SYMPHONIE
FINSI

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

############################################################################
# 	Recherche des instances des ECC
############################################################################

# TRAFIC
instTRAFIC_860026614 = i_LireInstanceECC(C_InstTRAFIC_860026614)
SI (!instTRAFIC_860026614)
ALORS
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstTRAFIC_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI
#trace1("instTRAFIC=<%d>",instTRAFIC)

# FE
instFE_860026614 = i_LireInstanceECC(C_InstFE_860026614)
SI (!instFE_860026614)
ALORS
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstFE_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI
#trace1("instFE=<%d>",instFE)

# FERPV
instFERPV_860026614 = i_LireInstanceECC(C_InstFERPV_860026614)
SI (!instFERPV_860026614)
ALORS
	#trace("Pas d'instance pour FERPV !")
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstFERPV_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI
#trace1("instFERPV=<%d>",instFERPV)

# ARAVIS
instARAVIS_860026614 = i_LireInstanceECC(C_InstARAVIS_860026614)
SI (!instARAVIS_860026614)
ALORS
	#trace("Pas d'instance pour ARAVIS !")
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstARAVIS_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI
#trace1("instARAVIS=<%d>",instARAVIS)

# FCT supprimee

# VTG

# DM
# meme instance que pour Trafic

POINT DEV_SYMPHONIE

# SYMP
instSYMP_860026614=i_LireInstanceECC(C_InstSYMP_860026614)
SI (!instSYMP_860026614)
ALORS
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstSYMP_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI
#trace1("instSYMP=<%d>",instSYMP)

#G3R23
# CASPER
instCASPER_860026614 = i_LireInstanceECC(C_InstCASPER_860026614)
SI (!instCASPER_860026614)
ALORS
	#trace("Pas d'instance pour CASPER")
	code_errone_860026614 = 0xA0B0
	code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
	erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,C_InstCASPER_860026614,C_Article_860026614)
	SAUT DISTRI_ERR
FINSI

############################################################################
# 	Duplication Symphonie
############################################################################
# ce qui n'est pas elimine va a symphonie
SI ( instSYMP_860026614 > 0 )
ALORS
	# Ajout de l'ECC SYMPHONIE a la liste courante des ECC:
	res_860026614 = i_AjouterCouranteECC(instSYMP_860026614)

	SI ( i_dup_art_id(g_iartin,g_iartout2) )
	ALORS
		#trace("ERREUR de duplication vers SYMPHONIE")
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,"pour Symphonie",C_Article_860026614)
		SAUT DISTRI_ERR
	FINSI

	# Retrait tlv
	SI ( i_valid_field_n(g_iartout2,$Tcentrex::T3ce) )
	ALORS
		#trace("Avant i_retrait_TLV T3ce")
		# VerifPcode
		#CODCIRDR=i_get_art_field(g_iartout2, $Tcentrex::CODCIRDR)
		#CODCIR=i_get_art_field(g_iartout2, $Tcentrex::CODCIR)
		erreur_860026614=i_get_art_str(g_iartout2, $Tcentrex::CODCIRDA,pt_CODCIRDA_860026614)

		SI (g_iartout2.CODCIRDA[2] > 9)
		ALORS
			i_get_sub_str(pt_CODCIRDA_860026614,2,5,pt_CODCIRDA_860026614)
		SINON
			i_get_sub_str(pt_CODCIRDA_860026614,1,5,pt_CODCIRDA_860026614)
		FINSI
		erreur_860026614=i_get_art_str(g_iartout2, $Tcentrex::CODCIRA,pt_CODCIRA_860026614)

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

		SI ( i_valid_field_n( g_iartout2, $NORMAL ) )
		ALORS
			erreur_860026614 = i_get_art_str(g_iartout2, $Tcentrex::NORMAL, pt_nde_normal_860026614)
			#trace2("recup de NDE normalise : %s",pt_nde_normal,"")
		FINSI

		#erreur = i_retrait_tlv(g_iartout2,"T3ce","")
		erreur_860026614 = i_supprChamp(g_iartout2,"T3ce")
	FINSI

	# Duplication article en entree
	trace("Mise au format SYMPHONIE")

	SI ( i_dup_art_id(g_iartout2,g_iartout) )
	ALORS
		#trace("ERREUR de duplication vers SYMPHONIE")
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,"pour Symphonie",C_Article_860026614)
		SAUT DISTRI_ERR
	FINSI

	SI (EFFICACE_860026614)
	ALORS
		# Renommage en Tsymtcentrex
		res_860026614 = i_rename_art(g_iartout,"Tsymtcentrex")
	SINON
		# Renommage en Tsymtctrexinef
		res_860026614 = i_rename_art(g_iartout,"Tsymtctrexinef")
	FINSI
FINSI

SI (distri_symph_860026614==1)
ALORS
	SAUT APRES_CRITERES
FINSI
#
# Cas d'un envoi vers Centaure
#
#trace1("bCENT=<%d>",bCENT)
SI(bCENT_860026614==1)
ALORS
	SAUT APRES_CRITERES
FINSI

############################################################################
# 	Attente requete Table de Distribution
############################################################################

erreur_860026614 = i_LireReqConsTabDist()
#trace1("RETOUR i_LireReqConsTabDist, erreur=<%d>",erreur)
SI ( erreur_860026614 != 0 )
ALORS
	i_strcpy(pt_LIBELREDIST_860026614,"i_LireReqConsTabDist")
	bREDIST_860026614 = 1
	SAUT AVANT_REDIST
FINSI

SI ( instFE_860026614 > 0 )
ALORS
	res_860026614 = i_LireInfoECC(instFE_860026614, 0)
	#trace1("Retour de i_LireInfoECC -  FE: <%d>",res)

	SI (res_860026614 != 0)
	ALORS
		#trace( "FE appartient a la table DISTRI")
		bFE_860026614=1
	SINON
		#trace( "FE n'est pas dans la table DISTRI")
		bFE_860026614=0
	FINSI
FINSI
#trace1("bFE=%d",bFE)

## FERPV:
SI ( instFERPV_860026614 > 0 )
ALORS
	res_860026614 = i_LireInfoECC(instFERPV_860026614, 0)
	#trace1("Retour de i_LireInfoECC -  FERPV: <%d>",res)

	SI (res_860026614 != 0)
	ALORS
		#trace( "FERPV appartient a la table DISTRI")
		bFERPV_860026614=1
		erreur_860026614 = i_LireChaineInfo(res_860026614,0,1,pt_InfoCompl_860026614)
		SI (!i_strcmp(pt_InfoCompl_860026614,"1"))
		ALORS
			i_strcpy(pt_service_860026614,"1")
		SINON
			SI (!i_strcmp(pt_InfoCompl_860026614,"2"))
			ALORS
				i_strcpy(pt_service_860026614,"2")
			SINON
				i_strcpy(pt_service_860026614,"4")
			FINSI
		FINSI
	SINON
		bFERPV_860026614=0
	FINSI
FINSI

# ARAVIS
SI ( instARAVIS_860026614 > 0 )
ALORS
	res_860026614 = i_LireInfoECC(instARAVIS_860026614, 0)
	#trace1("Retour de i_LireInfoECC -  ARAVIS: <%d>",res)

	SI (res_860026614 != 0)
	ALORS
		bARAVIS_860026614=1
	SINON
		#trace( "ARAVIS n'est pas dans la table DISTRI")
		bARAVIS_860026614=0
	FINSI
FINSI
#trace1("bARAVIS=%d",bARAVIS)

############################################################################
# 	Criteres de distribution (sauf Centaure)
############################################################################

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

#G4R6 QC807
#SI ( ( crit_com == 1 ) && ( REJET == 0 ||  REJET && SRP_Sporta_SPN ) && ( CAX != 3 ) && !ADO && !DCCentrexIntragroupe && !TGPRI )
#DRE G4R6 QC817
#SI ( ( crit_com == 1 ) && ( REJET == 0 || (REJET && REJET != CPT_CPS_RI) ||  (REJET && SRP_Sporta_SPN) ) && ( CAX != 3 ) && !ADO && !DCCentrexIntragroupe && !TGPRI )
#DRE - G4R7 QC829
#SI ( ( crit_com == 1 ) && ( REJET == 0 ||  REJET && SRP_Sporta_SPN ) && (REJET != CPT_CPS_RI || (REJET == CPT_CPS_RI &&  SRP_Sporta_SPN)) && ( CAX != 3 ) && !ADO && !DCCentrexIntragroupe && !TGPRI )
SI ( ( crit_com_860026614 == 1 ) && ( REJET_860026614 != 1 ||  REJET_860026614 == 1 && SRP_Sporta_SPN_860026614 ) && (!b_Fact_CPS_RI_860026614 || (b_Fact_CPS_RI_860026614 &&  SRP_Sporta_SPN_860026614)) && ( CAX_860026614 != 3 ) && !ADO_860026614 && !DCCentrexIntragroupe_860026614 && !TGPRI_860026614 )
ALORS
	crit_com_860026614 = 2
FINSI
trace1("G3R0Cr###### 2 ########## crit_com=<%d>",crit_com_860026614)

#--------------------------------------#
# 	VTG_VALO
#--------------------------------------#
bVTG_860026614=0
SI ( ( crit_com_860026614 == 2 ) && !RPV_860026614 && !RPVI_DIRECT_860026614 && !VTGRI_3BPQ_860026614 && ( instVTG_860026614 > 0 ) && ( ( CAX_860026614 != 7 ) || ( vE_860026614 != 8 ) ) && !ROC_860026614 )
ALORS
	## Voir specs v3.2: Traitement des DC / DEA.
	## FD/COCA ou FD/COCAV=' ' =>  COCA/COCAV absents => preTrans=-1.
	## E=' ' => type_traf=special => num.demande normalise special.
	# Resultat de VTG_TRANSCCD
	res_860026614=VTG_TRANSCCD_860026233(instVTG_860026614,vE_860026614,CCD_860026614)
	#trace1("Valeur de VTG_TRANSCCD = <%d>",res)
	#trace1("valeur de IEZLT : <%d>", IEZLT)
	#trace1("valeur de type_traf : <%d>", type_traf)
	#trace1("valeur de preTrans : <%d>", preTrans)
	#trace1("valeur de CAX : <%d>", CAX)
	#trace1("valeur de E : <%d>", E)

	SI ( ( ( IEZLT_860026614 == 0 ) && ( ( preTrans_860026614 == -1 ) || ( preTrans_860026614 == 8 ) ) && res_860026614 )
	  || ( ( IEZLT_860026614 == 1 ) && ( type_traf_860026614 == special_860026614 ) && res_860026614 )
	  || ( ( IEZLT_860026614 == 1 ) && ( type_traf_860026614 != special_860026614 ) && ( preTrans_860026614 == -1 ) && res_860026614 )
	  || ( ( IEZLT_860026614 == 1 ) && ( type_traf_860026614 != special_860026614 ) && res_860026614 && ( ( vE_860026614 == 8 ) || ( preTrans_860026614 == 8 ) ) && ( CAX_860026614 != 1 ) ) )
	ALORS
		erreur_860026614=i_AjouterCouranteECC(instVTG_860026614)
		bVTG_860026614 = 1
	FINSI
FINSI
#trace1("bVTG=%d",bVTG)

#--------------------------------------#
# 	ARAVIS
#--------------------------------------#
SI ( ( crit_com_860026614 == 2 ) && bARAVIS_860026614 && !RPVI_DIRECT_860026614 && !bVTG_860026614 && !VTGRI_860026614  && !OPT_860026614 && ( GVPN_860026614 == 1 ) && !ROC_860026614 )
ALORS
	erreur_860026614=i_AjouterCouranteECC(instARAVIS_860026614)

	SI ( ENVELOPPE_NOK_860026614 )
	ALORS
		#IFDEF trace_niv1 = 1
		trace("__FILE__:__LINE__ ======> Creation enveloppe CFR/ARAVIS")
		#ENDIF
		ENVELOPPE_NOK_860026614 = i_add_opt( "E_Tcentrex" )
		#G3R23
		#erreur = i_set_attr_val_n( $E_Tcentrex::T1, 0x13 )
		#erreur = i_set_attr_val_n( $E_Tcentrex::L1, 0x11 )
	FINSI
	erreur_860026614 = i_set_attr_val_n( $E_Tcentrex::DATE_M, ICAR_ABS_860026614)
	erreur_860026614 = i_set_attr_val_n( $E_Tcentrex::DATE_L, ICAR_REL_860026614)
	#IFDEF trace_niv1 = 1
	trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK_860026614)
	#ENDIF
SINON
	bARAVIS_860026614 = 0
FINSI
#trace1("bARAVIS=%d",bARAVIS)

#--------------------------------------#
# 	FERPV
#--------------------------------------#
SI ( ( crit_com_860026614 == 2 ) && !RPV_860026614 && !RPVI_DIRECT_860026614 && !bARAVIS_860026614 && !bVTG_860026614 && bFERPV_860026614 && !OPT_860026614 && !ROC_860026614 )
ALORS
	erreur_860026614=i_AjouterCouranteECC(instFERPV_860026614)
	# Recup du code CFR
	res_860026614 = i_LireInfoECC( instTRAFIC_860026614, 0 )

	SI ( res_860026614 != 0 )
	ALORS
		dizaine_860026614 = i_LireEntierInfo(res_860026614,0,1)
		unite_860026614 = i_LireEntierInfo(res_860026614,1,1)
		cfr_860026614 = (dizaine_860026614 & 0x0F) * 10 + (unite_860026614 & 0x0F)

		SI ( ENVELOPPE_NOK_860026614 )
		ALORS
			#IFDEF trace_niv1 = 1
			trace("__FILE__:__LINE__ ======> Creation enveloppe CFR/FERPV")
			#ENDIF
			ENVELOPPE_NOK_860026614 = i_add_opt( "E_Tcentrex" )
			#G3R23
			#erreur = i_set_attr_val_n( $E_Tcentrex::T1, 0x13 )
			#erreur = i_set_attr_val_n( $E_Tcentrex::L1, 0x11 )
		FINSI
		erreur_860026614 = i_set_attr_val_n( $E_Tcentrex::CFR, cfr_860026614)
		erreur_860026614 = i_set_attr_val_n( $E_Tcentrex::DATE_M, ICAR_ABS_860026614)
		erreur_860026614 = i_set_attr_val_n( $E_Tcentrex::DATE_L, ICAR_REL_860026614)
		#IFDEF trace_niv1 = 1
		trace1("__FILE__:__LINE__ ======> code CFR : <%d> ", cfr_860026614)
		trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK_860026614)
		#ENDIF
	FINSI
SINON
	bFERPV_860026614=0
FINSI

#--------------------------------------#
# 	FE
#--------------------------------------#
SI ( ( crit_com_860026614 == 2 ) && !RPV_860026614 && !RPVI_DIRECT_860026614 && !bARAVIS_860026614 && !bVTG_860026614 && ( bFE_860026614 == 1 ) && ( instFE_860026614 > 0) && !OPT_860026614 && !bFERPV_860026614 && !ROC_860026614 )
ALORS
	res_860026614 = i_AjouterCouranteECC(instFE_860026614)
SINON
	bFE_860026614 = 0
FINSI
#trace1("bFE=%d",bFE)

#--------------------------------------#
# 	TRAFIC
#--------------------------------------#
bTRAFIC_860026614=0
SI ( ( crit_com_860026614 == 2 )&& !RPV_860026614 && !RPVI_DIRECT_860026614 && !bARAVIS_860026614 && !bVTG_860026614 && !bFE_860026614 && !VTGRI_860026614 && ( instTRAFIC_860026614 > 0 ) && !OPT_860026614 && !bFERPV_860026614 && !ROC_860026614 )
ALORS
	res_860026614 = i_LireInfoECC(instTRAFIC_860026614, 0)
	#trace1("Retour de i_LireInfoECC -  TRAF: <%d>",res)

	SI (res_860026614 != 0)
	ALORS
		erreur_860026614 = i_LireChaineInfo( res_860026614, 0, 3, pt_InfoCompl_860026614)
		#trace2(" resultat de i_LireChaineInfo : <%s>", pt_InfoCompl, "")
		erreur_860026614 = i_format_str2(pt_Traf_860026614, "TRAF%s", pt_InfoCompl_860026614,0)
		#trace2("Concatenation de TRAF avec info.compl: <%s>", pt_Traf, "")

		instTRAFIC_860026614 = i_LireInstanceECC(pt_Traf_860026614)
		SI (!instTRAFIC_860026614)
		ALORS
			code_errone_860026614 = 0xA0B0
			code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
			erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,pt_Traf_860026614,C_Article_860026614)
			SAUT DISTRI_ERR
		FINSI
		#trace1("Nouvelle instTRAFIC=<%d>",instTRAFIC)
		bTRAFIC_860026614=1
		res_860026614 = i_AjouterCouranteECC(instTRAFIC_860026614)
	SINON
		i_strcpy(pt_LIBELREDIST_860026614,"Indicatif inconnu de MAJ2G")
		bREDIST_860026614 = 1
		SAUT AVANT_REDIST
	FINSI
FINSI
#trace1("bTRAFIC=%d",bTRAFIC)

#--------------------------------------#
# 	DELTAMINUTE
#--------------------------------------#
SI ( ( ( crit_com_860026614 == 2 ) && !bTRAFIC_860026614 ) && ( ( bFE_860026614 == 1 ) || ( RPV_860026614 == 1 ) || ( bVTG_860026614 == 1 ) || ( VTGRI_860026614 == 1 ) || OPT_860026614 || ROC_860026614 ) )
ALORS
	res_860026614 = i_LireInfoECC(instTRAFIC_860026614, 0)
	#trace1("Retour de i_LireInfoECC -  DM: <%d>",res)

	SI (res_860026614 != 0)
	ALORS
		erreur_860026614 = i_LireChaineInfo( res_860026614, 0, 3, pt_InfoCompl_860026614)
		#trace2(" resultat de i_LireChaineInfo : <%s>", pt_InfoCompl, "")
		erreur_860026614 = i_format_str2(pt_DM_860026614, "DM%s", pt_InfoCompl_860026614,0)
		#trace2("Concatenation de DM avec info.compl: <%s>", pt_DM, "")

		instDM_860026614 = i_LireInstanceECC(pt_DM_860026614)
		SI (!instDM_860026614)
		ALORS
			code_errone_860026614 = 0xA0B0
			code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
			erreur_860026614 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026614,pt_DM_860026614,C_Article_860026614)
			SAUT DISTRI_ERR
		FINSI
		#trace1("Nouvelle instDM=<%d>",instDM)
		erreur_860026614=i_AjouterCouranteECC(instDM_860026614)

		SI (bFE_860026614)
		ALORS
			dizaine_860026614 = i_LireEntierInfo(res_860026614,0,1)
			unite_860026614 = i_LireEntierInfo(res_860026614,1,1)
			cfr_860026614 = (dizaine_860026614 & 0x0F) * 10 + (unite_860026614 & 0x0F)

			SI ( ENVELOPPE_NOK_860026614 )
			ALORS
				#IFDEF trace_niv1 = 1
				trace("__FILE__:__LINE__ ======> Creation enveloppe CFR/FE")
				#ENDIF
				ENVELOPPE_NOK_860026614 = i_add_opt("E_Tcentrex")
				#G3R23
				#erreur = i_set_attr_val_n($E_Tcentrex::T1,0x13)
				#erreur = i_set_attr_val_n($E_Tcentrex::L1,0x11)
			FINSI
			erreur_860026614 = i_set_attr_val_n($E_Tcentrex::CFR,cfr_860026614)
			#IFDEF trace_niv1 = 1
			trace1("__FILE__:__LINE__ ======> code CFR : <%d> ", cfr_860026614)
			trace1("__FILE__:__LINE__ ======> ENVELOPPE_NOK : <%d> ", ENVELOPPE_NOK_860026614)
			#ENDIF
		FINSI
	SINON
		i_strcpy(pt_LIBELREDIST_860026614,"Indicatif inconnu de MAJ2G")
		bREDIST_860026614 = 1

		SAUT AVANT_REDIST
	FINSI
FINSI

# Pour eviter les appels a la table de distrib.
# dans le cas ou Centaure est present:

POINT APRES_CRITERES

#G4R8 QC862 Paragraphe deplace pour envoi a casper au 1er tour de redistribution
##G3R23
##-------------------
##  CASPER
##-------------------
#SI (b_NSUC == 1) && (trait_ok == 0)
#ALORS
#	erreur=i_AjouterCouranteECC(instCASPER)
#FINSI
#

############################################################################
# 	Controle de consolidation
############################################################################
# modification sur le test EFFICACE (teste le contenu et non la <> 0)
SI ( EFFICACE_860026614 == 1 && !OPT_860026614 && !ROC_860026614 && ( CAX_860026614 != 9 )
&& ( !RPV_860026614 && !RPVI_DIRECT_860026614 && !ADO_860026614 && !VTGRI_CAX_860026614 && !VTGRI_3BPQ_860026614 && !VTGRI_860026614 && !DCCentrexIntragroupe_860026614 && !TGPRI_860026614 )
&& !bCENT_860026614 && !bVTG_860026614 && !bARAVIS_860026614 && !bFE_860026614 && !bTRAFIC_860026614 && !bFERPV_860026614 && ( REJET_860026614 == 0 || REJET_860026614 && SRP_Sporta_SPN_860026614 ) )
ALORS
	trace("Controles en erreur !")
#DRE - G4R7 QC829
	SI (i_strcmp(pt_LIBELREDIST_860026614,"") == 0 )
	ALORS
		i_strcpy(pt_LIBELREDIST_860026614,"Incoherence sur les controles")
	FINSI
	bREDIST_860026614 = 1

	SAUT AVANT_REDIST
FINSI

############################################################################
# 	Validation de la liste des ECCs destinataires
############################################################################
erreur_860026614 = i_ValiderListeECC( 0, 0, 0, 0)

############################################################################
# 	Mise au format
############################################################################

#--------------------------------------#
# 	CENTAUREDC
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instCENT_860026614) )
ALORS
	trace("Mise au format CENTAUREDC")

	i_strcpy(pt_EccCentaure_860026614, "CENTAURE")
	# Duplication de l'article
	SI ( i_dup_art_dest(g_iartin,g_iartout2,C_TcentDC_860026614) )
	ALORS
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_TcentDC_860026614,C_Article_860026614)
		#trace1("Erreur de i_dup_art_dest: <%d>",res)
		SAUT  DISTRI_ERR
	FINSI

	#T1
	erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::T1,25)

	#T2
	erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::T2,2)

	#champ SCT
	#trace("initialisation des SCT")
	#trace("Appel de i_transformer_bits")
	res_860026614 = i_transformer_bits(g_iartin,$SCT,"FV",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::SCT,pt_TEMP_860026614)

	#champs TAP
	#trace("initialisation des TAP")
	SI (i_valid_field_n(g_iartin,$Tcentrex::T3cab)==1)
	ALORS
		res_860026614 = i_transformer_bits(g_iartin,$Tcentrex::TAP:1,"FV",pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::TAP,pt_TEMP_860026614)
	FINSI

	SI (i_valid_field_n(g_iartin,$Tcentrex::T3cap2)==1)
	ALORS
		res_860026614 = i_transformer_bits(g_iartin,$Tcentrex::TAP:0,"FV",pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::TAP,pt_TEMP_860026614)
	FINSI

	#champ STY
	res_860026614 = i_transformer_bits(g_iartin,$STY,"FV",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::STY,pt_TEMP_860026614)

	# champ ICAR
	erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::DATE, ICAR_REL_860026614)

	# Champ NIDUS
	erreur_860026614=i_get_art_str(g_iartin, $NDR, pt_TEMP_860026614)
	#trace2("NDR= <%s>",pt_TEMP,"")
	i_replace_str(pt_TEMP_860026614,"BCDE","AJSC",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::NIDUS, pt_TEMP_860026614)

	# Champ NDEDE
	erreur_860026614=i_get_art_str(g_iartin, $NDE, pt_TEMP_860026614)
	#trace2("NDE= <%s>",pt_TEMP,"")
	i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::NDEDE, pt_TEMP_860026614)

	#champ DUREE
	erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::DUREE, dduree_860026614)

	#champ TAX
	tax_860026614 = i_get_art_field( g_iartin, $Tcentrex::tax )
	erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::TAX, tax_860026614)

	#champ CDSGTQS
	#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
	#trace2("SGTQS=<%s>",pt_SGTQS,"")
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::CDSGTQS, pt_SGTQS_860026614)

	# Champs definis par defaut

	#champ INDEX
	SI (i_valid_field_n(g_iartin, $Tcentrex::INDEX)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::INDEX)
		SI (res_860026614 == -1)
		ALORS
			code_errone_860026614 = 0xA080
			code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
			erreur_860026614 = i_PlvMessEmettre( 8600, 2, g_iartin,"", 3,code_errone_860026614, C_Article_860026614, "i_get_art_field/INDEX" )
			SAUT DISTRI_ERR
		FINSI
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::INDEX,res_860026614)
	FINSI

	#champ ALINK (<=> champ APPEL)
	SI( i_valid_field_n(g_iartin, $Tcentrex::APPEL) )
	ALORS
		erreur_860026614 = i_get_art_str( g_iartin, $Tcentrex::APPEL, pt_TEMP_860026614 )
		erreur_860026614 = i_set_art_str( g_iartout2,$TcentaureDC::ALINK, pt_TEMP_860026614 )
	FINSI

	#champ NLINK (<=> champ NOEUD)
	SI( i_valid_field_n(g_iartin, $Tcentrex::NOEUD) )
	ALORS
		erreur_860026614 = i_get_art_str( g_iartin, $Tcentrex::NOEUD, pt_TEMP_860026614 )
		erreur_860026614 = i_set_art_str( g_iartout2, $TcentaureDC::NLINK, pt_TEMP_860026614 )
	FINSI

	#champs IIDAV et NIDAV
	SI (i_valid_field_n(g_iartin, $Tcentrex::INF_IDAV)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$INF_IDAV)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::IIDAV,res_860026614)
	FINSI
	SI (i_valid_field_n(g_iartin, $Tcentrex::NUM_IDAV)==1)
	ALORS
		erreur_860026614=i_get_art_str(g_iartin, $Tcentrex::NUM_IDAV,pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::NIDAV,pt_TEMP_860026614)
	FINSI

	#champs NOS
	SI (i_valid_field_n(g_iartin, $Tcentrex::INFNOS)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$INFNOS)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::INOS,res_860026614)
	FINSI

	#trace("Avant NUMNOS")
	SI (i_valid_field_n(g_iartin, $Tcentrex::NUMNOS)==1)
	ALORS
		erreur_860026614 = i_get_art_str( g_iartin, $Tcentrex::NUMNOS, pt_TEMP_860026614 )
		erreur_860026614 = i_set_art_str( g_iartout2, $TcentaureDC::NNOS, pt_TEMP_860026614)
	FINSI

	#champ REF
	SI (i_valid_field_n(g_iartin, $Tcentrex::REF)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::REF)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::REF,res_860026614)
	FINSI

	#champ DUSEL
	SI (i_valid_field_n(g_iartin, $Tcentrex::DUSEL)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$DUSEL)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::DUSEL,res_860026614)
	FINSI

	#champ DUSON
	SI (i_valid_field_n(g_iartin, $Tcentrex::DUSON)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::DUSON)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::DUSON,res_860026614)
	FINSI

	#champ TTX et SIDR
	SI ( i_valid_field_n(g_iartin, $Tcentrex::T3ttx)==1 )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::TTX, "V")
	SINON
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::TTX, "F")
	FINSI
	SI ( i_valid_field_n(g_iartin, $Tcentrex::T3sidr)==1 )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::SIDR, "V")
	SINON
		erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::SIDR, "F")
	FINSI

	#champ MES1 et MES2
	SI ( i_valid_field_n(g_iartin, $Tcentrex::MES1)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin, $MES1)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::MES1,res_860026614)
	FINSI

	SI ( i_valid_field_n(g_iartin, $Tcentrex::MES2)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin, $MES2)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::MES2,res_860026614)
	FINSI

	#Champ INEF
	SI ( i_valid_field_n(g_iartin, $Tcentrex::INEF)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::INEF)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::INEF,res_860026614)
		#trace1("Valeur de INEF = <%d>",res)
	FINSI

	#champs COCA et COCAV
	SI ( i_valid_field_n(g_iartin, $Tcentrex::BETA)==1 )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout2,$TcentaureDC::COCA,pt_COCA_860026614)
	FINSI

	SI ( i_valid_field_n(g_iartin, $Tcentrex::BETAV)==1 )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout2,$TcentaureDC::COCAV,pt_COCAV_860026614)
	FINSI

	#champ SUP
	erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::SUP, SUP_860026614)

	#CLEi
	SI (i_valid_field_n(g_iartin, $Tcentrex::CLE1)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::CLE1)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::CLE1,res_860026614)
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::CLE2)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::CLE2)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::CLE2,res_860026614)
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::CLE3)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::CLE3)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::CLE3,res_860026614)
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::CLE4)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::CLE4)
		erreur_860026614=i_set_art_field(g_iartout2,$TcentaureDC::CLE4,res_860026614)
	FINSI

	#champ INVOCATION
	SI ( i_valid_field_n(g_iartin, $Tcentrex::INVOC)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::INVOC)
		#trace1("Valeur de INVOCATION=<%d>",res)
		erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::INVOCATION, res_860026614)
	FINSI

	#champ MERE, MENV et ECHO
	SI ( i_valid_field_n(g_iartin, $Tcentrex::MERE)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$MERE)
		erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::MERE, res_860026614)
	FINSI
	SI ( i_valid_field_n(g_iartin, $Tcentrex::MENV)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$MENV)
		erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::MENV, res_860026614)
	FINSI
	SI ( i_valid_field_n(g_iartin, $Tcentrex::ECHO)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$ECHO)
		erreur_860026614=i_set_art_field(g_iartout2, $TcentaureDC::ECHO, res_860026614)
	FINSI
# DRE G4R6 Lot2
	# TYPE_EDIT
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::TYPE_EDIT, pt_TYPE_EDIT_860026614)
	
	# CODE_TARIF
	erreur_860026614=i_set_art_str(g_iartout2, $TcentaureDC::CODE_TARIF, pt_CODE_TARIF_860026614)
# \DRE G4R6 Lot2

	#FIN
	erreur_860026614 = i_set_art_field(g_iartout2, $TcentaureDC::FIN, 0x0A )
FINSI

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

#--------------------------------------#
# 	VTG_VALO
#--------------------------------------#

#--------------------------------------#
# 	FE
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instFE_860026614) )
ALORS
	trace("Mise au format FE")
	i_strcpy(pt_nomEccFact_860026614, "FE")
	SI ( i_dup_art_dest(g_iartin,g_iartout6,C_Tfe_860026614) )
	ALORS
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_Tfe_860026614,C_Article_860026614)
		#trace1("Erreur de i_dup_art_dest: <%d>",res)
		SAUT  DISTRI_ERR
	FINSI

	#SERVICE
	erreur_860026614=i_set_art_str(g_iartout6,$Tfe::SERVICE,"25")

	# Champ IDUS_NUM
	erreur_860026614=i_get_art_str(g_iartin,$Tcentrex::NDR,pt_TEMP_860026614)
	#trace2("NDR= <%s>",pt_TEMP,"")
	i_replace_str(pt_TEMP_860026614,"BCDE","AJSC",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout6,$Tfe::IDUS_NUM,pt_TEMP_860026614)


	# Champs DEDE_INF et DEDE_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::T4dstx)==1 )
	ALORS
		SI (g_iartin.DESTINX==0x01)
		ALORS
			erreur_860026614=i_get_art_str(g_iartin, $NUM_IDAV, pt_TEMP_860026614)
			#trace2("NUM_IDAV= <%s>",pt_TEMP,"")
			i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
			erreur_860026614=i_set_art_str(g_iartout6, $Tfe::DEDE_NUM, pt_TEMP_860026614)

			res_860026614=i_get_art_field(g_iartin,$Tcentrex::INF_IDAV)
			erreur_860026614=i_set_art_field(g_iartout6,$Tfe::DEDE_INF,res_860026614)
		SINON
			SI (g_iartin.DESTINX==0x02)
			ALORS
				erreur_860026614=i_get_art_str(g_iartin, $NDE, pt_TEMP_860026614)
				#trace2("NDE= <%s>",pt_TEMP,"")
				i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
				erreur_860026614=i_set_art_str(g_iartout6, $Tfe::DEDE_NUM, pt_TEMP_860026614)
				erreur_860026614=i_set_art_field(g_iartout6,$Tfe::DEDE_INF,0)
			FINSI
		FINSI
	SINON
		SI (CENTREX2_860026614 == 1)
		ALORS
			erreur_860026614=i_set_art_field(g_iartout6,$Tfe::DEDE_INF,0)

			#trace("CONVERSION TRANSGROUPE: formatage de DEDE_NUM")
			erreur_860026614=i_get_art_str(g_iartin,$Tcentrex::NDE, pt_TEMP_860026614)
			#trace2("#NDE# <%s>", pt_TEMP,"")
			SI ( ConvTransgrp_860026233($Tcentrex::NDE,g_iartout6,$Tfe::DEDE_NUM) )
			ALORS
				#trace("Retour NOK pour ConvTransgrp")
				SAUT DISTRI_ERR
			FINSI
		FINSI
	FINSI

	# DATE
	erreur_860026614=i_set_art_field(g_iartout6, $Tfe::DATE, ICAR_REL_860026614)

	# CAX
	erreur_860026614=i_set_art_field(g_iartout6,$Tfe::CAX,CAX_860026614)

	#champ DUREE
	erreur_860026614=i_set_art_field(g_iartout6,$Tfe::DUREE,dduree_860026614)

	#champ TAX
#DRE G4R6 Lot2
#DRE - G4R7 QC829
#	SI (REJET==CPT_CPS_Loc)
	SI b_Fact_CPS_Loc_860026614
	ALORS
		erreur_860026614=i_set_art_field(g_iartout6, $Tfe::TAX, tax_860026614)
	SINON
		SI ( (SRP_PORTE_860026614 == 1) && (tax_860026614 == 0) )
		ALORS
			erreur_860026614=i_set_art_field(g_iartout6,$Tfe::TAX,TAXE_CAL_860026614)
		SINON
			erreur_860026614=i_set_art_field(g_iartout6,$Tfe::TAX,tax_860026614)
		FINSI
	FINSI
#\DRE G4R6 Lot2

	# NDS_INF
	SI ( i_valid_field_n(g_iartin, $Tcentrex::INFNOS)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::INFNOS)
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NDS_INF,res_860026614)
	FINSI

	# NDS_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::NUMNOS)==1 )
	ALORS
		erreur_860026614=i_get_art_str(g_iartin,$Tcentrex::NUMNOS,pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,$Tfe::NDS_NUM,pt_TEMP_860026614)
	FINSI

	# SUP
	erreur_860026614=i_set_art_field(g_iartout6,$Tfe::SUP,SUP_860026614)

	# CCD
	erreur_860026614=i_set_art_field( g_iartout6,$Tfe::CLASSDEST, CCD_REEL_860026614)

	# MES1 et MES2
	SI ( i_valid_field_n(g_iartin, $Tcentrex::MES1)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::MES1)
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::MES1,res_860026614)
	FINSI

	SI ( i_valid_field_n(g_iartin, $Tcentrex::MES2)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::MES2)
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::MES2,res_860026614)
	FINSI

	# Gestion des champ NB_CSV, C_CSVI et OP_CSVI

	#trace("Traitement des CSV")
	indice_860026614=0
	erreur_860026614=i_set_art_field(g_iartout6, $Tfe::NB_CSV, indice_860026614)
	num_champ_860026614=$Tfe::NB_CSV+1
	#trace1("numero du champ C_CSV1=<%d>",num_champ)

	SI ( (i_valid_field_n(g_iartin, $Tcentrex::T3sidr))==1 )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"C")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::T3cle)==1)
	ALORS
		SI (g_iartin.CLE1==0x0b)
		ALORS
			indice_860026614=indice_860026614+1
			erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
			erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"30")
			num_champ_860026614=num_champ_860026614+2
		FINSI
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 8)
	SI (bit_860026614 == 1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"T")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 6)
	SI (bit_860026614 == 1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"3")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 3)
	SI (bit_860026614 == 1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"D")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 2)
	SI ( (bit_860026614 == 1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"N")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 1)
	SI ( (bit_860026614 == 1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout6,$Tfe::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout6,num_champ_860026614,"O")
	FINSI

	# Initialisation des champs OP_CSVI
	num_champ_860026614=$Tfe::NB_CSV+2
	res_860026614=0
	POINT DEB_BOUC4
	SI ( (res_860026614<indice_860026614)&&(res_860026614<5) )
	ALORS
		res_860026614=res_860026614+1
		erreur_860026614=i_memset_field_n(g_iartout6,num_champ_860026614,0xE4)
		num_champ_860026614=num_champ_860026614+2
		SAUT DEB_BOUC4
	FINSI

	# # #

	#champ COCA et COCAV
	SI (i_valid_field_n(g_iartin, $Tcentrex::BETA)==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout6, $Tfe::COCA,pt_COCA_860026614 )
	FINSI
	SI (i_valid_field_n(g_iartin, $Tcentrex::BETAV)==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout6, $Tfe::COCAV,pt_COCAV_860026614)
	FINSI

	#champ IDAV_INF et IDAV_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::INF_IDAV)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::INF_IDAV)
		erreur_860026614=i_set_art_field(g_iartout6, $Tfe::IDAV_INF, res_860026614)
	FINSI
	SI (i_valid_field_n(g_iartin, $Tcentrex::NUM_IDAV)==1)
	ALORS
		erreur_860026614=i_get_art_str(g_iartin, $Tcentrex::NUM_IDAV,pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout6, $Tfe::IDAV_NUM,pt_TEMP_860026614)
	FINSI
# DRE G4R6 Lot2
	# TAG
	erreur_860026614=i_set_art_str(g_iartout6, $Tfe::TAG, " ")
	
	# TYPE_EDIT
	erreur_860026614=i_set_art_str(g_iartout6, $Tfe::TYPE_EDIT, pt_TYPE_EDIT_860026614)
	
	# CODE_TARIF
	erreur_860026614=i_set_art_str(g_iartout6, $Tfe::CODE_TARIF, pt_CODE_TARIF_860026614)
# \DRE G4R6 Lot2

FINSI

#--------------------------------------#
# 	FERPV
#--------------------------------------#
SI (!i_ChercherCouranteECC(instFERPV_860026614))
ALORS
	#trace("Stockage vers FERPV")

	i_strcpy(pt_nomEccFact_860026614, "FE")
	# Duplication article en entree
	SI (i_dup_art_dest( g_iartin, g_iartout11, C_Tfe_rpvRG_860026614))
	ALORS
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_Tfe_rpvRG_860026614,C_Article_860026614)
		SAUT DISTRI_ERR
	FINSI

	# SERVICE
	erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::SERVICE,pt_service_860026614)

	# SOURCE
	erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::SOURCE,"03")

	# NUMDDR
	erreur_860026614=i_get_art_str(g_iartin,$NDR,pt_BUF_860026614)
	i_replace_str(pt_BUF_860026614,"BCDE","AJSC",pt_BUF_860026614)
	erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::NUMDDR,pt_BUF_860026614)

	# NUMDDE
	SI (!TRANSGROUPE_860026614)
	ALORS
		erreur_860026614=i_get_art_str(g_iartin,$Tcentrex::NDE, pt_TEMP_860026614)
		i_replace_str(pt_TEMP_860026614,"ABC","A*#",pt_TEMP_860026614)
		erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::NUMDDE,pt_TEMP_860026614)
	SINON
		#trace("CONVERSION TRANSGROUPE: formatage de DEDE_NUM")
		erreur_860026614=i_get_art_str(g_iartin,$Tcentrex::NDE, pt_TEMP_860026614)
		i_replace_str(pt_TEMP_860026614,"ABC","A*#",pt_TEMP_860026614)
		#trace2("NDE= <%s>", pt_TEMP,"")
		SI ( ConvTransgrp_860026233($Tcentrex::NDE,g_iartout11,$Tfe_rpvRG::NUMDDE) )
		ALORS
			#trace("Retour NOK pour ConvTransgrp")
			SAUT DISTRI_ERR
		FINSI
	FINSI

	# DEBUT
	erreur_860026614 = i_set_art_field(g_iartout11,$Tfe_rpvRG::DEBUT,ICAR_REL_860026614)

	# DUREE
	erreur_860026614 = i_set_art_field(g_iartout11,$Tfe_rpvRG::DUREE,dduree_860026614)

	# NBUT
	erreur_860026614 = i_set_art_field(g_iartout11,$Tfe_rpvRG::NBUT,tax_860026614)

	# CANAL FO1132
	SI (i_valid_field_n(g_iartin, $Tcentrex::REF))
	ALORS
		res_860026614=i_get_art_field(g_iartin,$REF)
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::CANAL,res_860026614)
	FINSI

	# Gestion des champ NBCOD, C_CSVI et OP_CSVI

	#trace("Traitement des C_CSV et OP_CSV")
	indice_860026614=0
	erreur_860026614=i_set_art_field(g_iartout11, $Tfe_rpvRG::NBCOD, indice_860026614)
	num_champ_860026614=$Tfe_rpvRG::NBCOD+1
	#trace1("numero du champ C_CSV1=<%d>",num_champ)

	SI (    i_get_art_fieldtab(g_iartin,$NDE,0)==0xB &&
	i_get_art_fieldtab(g_iartin,$NDE,1)==0x2 &&
	i_get_art_fieldtab(g_iartin,$NDE,2)==0x1 &&
	i_get_art_fieldtab(g_iartin,$NDE,3)==0xB )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"T2")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( (i_valid_field_n(g_iartin, $Tcentrex::T3sidr)) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"C")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::T3cle))
	ALORS
		SI (g_iartin.CLE1==0x0b)
		ALORS
			indice_860026614=indice_860026614+1
			erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
			erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"30")
			num_champ_860026614=num_champ_860026614+2
		FINSI
	FINSI

	SI (i_get_bit_val(TAP_860026614, 8)==1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"T")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI (i_get_bit_val(TAP_860026614, 6)==1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"3")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( (i_get_bit_val(TAP_860026614, 3)==1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"D")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( (i_get_bit_val(TAP_860026614, 2)==1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"N")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( (i_get_bit_val(TAP_860026614, 1)==1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::NBCOD,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout11,num_champ_860026614,"O")
	FINSI

	# Initialisation des champs OP_CSVI
	num_champ_860026614=$Tfe_rpvRG::NBCOD+2
	res_860026614=0

	POINT DEB_BOUC6
	SI ( (res_860026614<indice_860026614)&&(res_860026614<5) )
	ALORS
		res_860026614=res_860026614+1
		erreur_860026614=i_memset_field_n(g_iartout11,num_champ_860026614,0xE4)
		num_champ_860026614=num_champ_860026614+2
		SAUT DEB_BOUC6
	FINSI

	SI (    i_get_art_fieldtab(g_iartin,$NDE,0)==0xB &&
	i_get_art_fieldtab(g_iartin,$NDE,1)==0x2 &&
	i_get_art_fieldtab(g_iartin,$NDE,2)==0x1 &&
	i_get_art_fieldtab(g_iartin,$NDE,3)==0xB )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout11,$Tfe_rpvRG::OP_CSV1,"A")
	FINSI

	# TYPACCRI
	erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::TYPACCRI," ")

	# SUPPORT
	SI ((SUP_860026614 == 0x01) || (SUP_860026614 == 0xFF))
	ALORS
		erreur_860026614 = i_set_art_field(g_iartout11,$Tfe_rpvRG::SUPPORT,0)
	FINSI
	SI (SUP_860026614 == 0x02)
	ALORS
		erreur_860026614 = i_set_art_field(g_iartout11,$Tfe_rpvRG::SUPPORT,2)
	FINSI
	SI (SUP_860026614 == 0x03)
	ALORS
		erreur_860026614 = i_set_art_field(g_iartout11,$Tfe_rpvRG::SUPPORT,4)
	FINSI

	# NOORIG
	SI ( i_valid_field_n(g_iartin,$Tcentrex::NUMNOS) )
	ALORS
		erreur_860026614 = i_get_art_str(g_iartin,$NUMNOS, pt_BUF_860026614)
		erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::NOORIG,pt_BUF_860026614)
	FINSI

	CCD_REEL_FE_860026614 = CCD_REEL_860026614
	CCD_REEL_FE_860026614 = CCD_REEL_FE_860026614 + 1000

#DRE G4R6 Lot2 creation article remontee
#	SI (bCONVERSION == 0 )
#	ALORS
#		erreur = i_cree_art("Conversion",g_iartout10)
#		bCONVERSION = 1
#	FINSI
#\DRE G4R6 Lot2

	erreur_860026614 = i_set_art_field(g_iartout10,$Conversion::CCD,CCD_REEL_FE_860026614 )
	erreur_860026614 = i_conv_field("CCD",g_iartout10, 2, g_iartout11, 4,0)
	erreur_860026614 = i_get_art_str(g_iartout11,$Tfe_rpvRG::CCD,pt_BUF1_860026614)
	i_get_sub_str(pt_BUF1_860026614,1,3,pt_BUF2_860026614)
	erreur_860026614 = i_set_art_str(g_iartout11,$Tfe_rpvRG::CCD,pt_BUF2_860026614)
	#trace2(" CCD_REEL_xx <%s> ", pt_BUF1, "")
	#trace2(" CCD_REEL_FE <%s> ", pt_BUF2, "")

	#champ INFDDE
	SI ( i_valid_field_n(g_iartin, $Tcentrex::T4dstx)==1 )
	ALORS
		SI (g_iartin.DESTINX==0x01)
		ALORS
			res_860026614=i_get_art_field(g_iartin,$Tcentrex::INF_IDAV)
			erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::INFDDE,res_860026614)
		SINON
			SI (g_iartin.DESTINX==0x02)
			ALORS
				erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::INFDDE,0)
			FINSI
		FINSI
	SINON
		SI  (CENTREX2_860026614 == 1)
		ALORS
			erreur_860026614=i_set_art_field(g_iartout11,$Tfe_rpvRG::INFDDE,0)
		FINSI
	FINSI
# DRE G4R6 Lot2
	# TAG
	erreur_860026614=i_set_art_str(g_iartout11, $Tfe_rpvRG::TAG, " ")
	
	# TYPE_EDIT
	erreur_860026614=i_set_art_str(g_iartout11, $Tfe_rpvRG::TYPE_EDIT, pt_TYPE_EDIT_860026614)
	
	# CODE_TARIF
	erreur_860026614=i_set_art_str(g_iartout11, $Tfe_rpvRG::CODE_TARIF, pt_CODE_TARIF_860026614)
# \DRE G4R6 Lot2

FINSI

#--------------------------------------#
# 	ARAVIS
#--------------------------------------#
SI (!i_ChercherCouranteECC(instARAVIS_860026614))
ALORS
	#trace("Stockage vers ARAVIS")

	i_strcpy(pt_nomEccFact_860026614, "ARAVIS")
	SI (i_cree_art(C_Taravis_860026614, g_iartout12 ))
	ALORS
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_Taravis_860026614,C_Article_860026614)
		SAUT DISTRI_ERR
	FINSI

	# ACCEID
	erreur_860026614 = i_memset_field_n(g_iartout12,$Taravis::ACCEID,0x30)

	# NDDR
	erreur_860026614=i_get_art_str(g_iartin,$NDR,pt_BUF_860026614)
	i_replace_str(pt_BUF_860026614,"BCDE","AJSC",pt_BUF_860026614)
	erreur_860026614 = i_format_str2(pt_BUF2_860026614,"%s%s","0",pt_BUF_860026614)
	erreur_860026614 = i_set_art_str(g_iartout12,$Taravis::NDDR,pt_BUF2_860026614)

	# DEBCUM
	erreur_860026614 = i_set_art_field(g_iartout12,$Taravis::DEBCUM,ICAR_REL_860026614)

	# DUREE
	erreur_860026614 = i_set_art_field(g_iartout12,$Taravis::DUREE,dduree_860026614)

	# TYPE
	erreur_860026614 = i_set_art_str(g_iartout12,$Taravis::TYPE,"2")

	# SUPPORT
	erreur_860026614 = i_set_art_str(g_iartout12,$Taravis::SUPPORT,"1")

	# DEDE
	i_replace_str(pt_nde_normal_860026614,"ABC","A*#",pt_BUF_860026614)

	i_get_sub_str(pt_BUF_860026614,0,1,pt_TEMP_860026614)
	SI (i_strcmp(pt_TEMP_860026614, "00") == 0)
	ALORS
		i_get_sub_str(pt_BUF_860026614,2,-1,pt_BUF_860026614)
	FINSI

	erreur_860026614 = i_set_art_str(g_iartout12,$Taravis::DEDE,pt_BUF_860026614)

	#COMID_ID
	erreur_860026614 = i_set_art_field(g_iartout12, $Taravis::COMID_ID,2)

	# COMID_NUM
	#
	# Remarque : etant donne que le processing travaille en entier signe, on ne peut travailler
	# que sur des valeurs numeriques codees sur 31 bits. En consequence, on se limite a 15 bits
	# (soit 32767 max) pour le codage du numero de bloc

	# Recuperation de l identifiant d audit (voir ME_PCODE pour le detail de sa structure)
	pt_marque_audit_860026614=i_LireMarqueAudit()

	# Recuperation de l'horadatage
	comid_n1_860026614 = (i_strtab(pt_marque_audit_860026614,2)*256 + i_strtab(pt_marque_audit_860026614,3)) & 0x1FFF
	#trace1("comid_n1 : %d",comid_n1)
	erreur_860026614 = i_set_art_field(g_iartout12, $Taravis::COMID_N1, comid_n1_860026614 )


	# Recuperation identifiant EEC (6eme octet) EEC
	# Masquage des 6 bits de poids faible
	EEC_audit_860026614 = i_strtab(pt_marque_audit_860026614, 5) & 0x3f
	#trace1("EEC_audit : %d", EEC_audit)

	# Recuperation identifiant de bloc (7 et 8eme octet)
	# Masquage des 15 bits de poids faible
	bloc_audit_860026614 =  ( ( i_strtab(pt_marque_audit_860026614, 6) * 256 ) + i_strtab(pt_marque_audit_860026614, 7) ) & 0x7fff
	# trace1("bloc_audit : %d", bloc_audit)

	# Recuperation identifiant du DC (11 et 12eme octet)
	# Masquage des 10 bits de poids faible
	DC_audit_860026614 = ( ( i_strtab(pt_marque_audit_860026614, 10) * 256 ) + i_strtab(pt_marque_audit_860026614, 11) ) & 0x3ff
	#trace1("DC_audit : %d", DC_audit)

	# Mise en forme pour ARAVIS COMID_NUM
	# On realise les masquages/concatenation par multiplication
	# Coefficients : 00000010000000000000000000000000 soit 2e25 soit 33554432
	#                00000000000000000000010000000000 soit 2e10 soit 1024
	comid_num_860026614 = (EEC_audit_860026614 * 33554432) + (bloc_audit_860026614 * 1024) + DC_audit_860026614
	trace1("comid_num : %u", comid_num_860026614)

	erreur_860026614 = i_set_art_field(g_iartout12, $Taravis::COMID_NUM, comid_num_860026614 )

	# TYPSRV
	erreur_860026614 = i_set_art_field(g_iartout12,$Taravis::TYPSRV, 1)
FINSI

#--------------------------------------#
# 	DELTAMINUTE
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instDM_860026614) )
ALORS
	trace("Mise au format DELTA MINUTE")
	#trace(g_iartin!NOM[])
	SI ( i_dup_art_dest(g_iartin,g_iartout4,C_Tdelta_minute_860026614) )
	ALORS
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_Tdelta_minute_860026614,C_Article_860026614)
		#trace1("Erreur de i_dup_art_dest: <%d>",res)
		SAUT  DISTRI_ERR
	FINSI

	#champ DOMAINE

	# Valeur par defaut:
	erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::DOMAINE,"05")
	SI (RPV_860026614==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::DOMAINE,"95")
	FINSI
	#G3R0Cr
	#SI (bFCT==1)
	SI (CCD_860026614 == 0x18 && EPORTABILITE_860026614 == 0)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::DOMAINE,"96")
	FINSI
	SI (bVTG_860026614==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::DOMAINE,"92")
	FINSI
	SI (VTGRI_860026614==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::DOMAINE,"94")
	FINSI

	# SERVICE
	erreur_860026614=i_set_art_str(g_iartout4, $Tdelta_minute::SERVICE, "25")

	# Champ NIDUS
	erreur_860026614=i_get_art_str(g_iartin, $NDR, pt_TEMP_860026614)
	#trace2("NDR= <%s>",pt_TEMP,"")
	i_replace_str(pt_TEMP_860026614,"BCDE","AJSC",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout4, $Tdelta_minute::IDUS_NUM, pt_TEMP_860026614)

	# Champs DEDE_INF et DEDE_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::T4dstx)==1 )
	ALORS
		SI (g_iartin.DESTINX==0x01)
		ALORS
			erreur_860026614=i_get_art_str(g_iartin, $NUM_IDAV, pt_TEMP_860026614)
			#trace2("NUM_IDAV= <%s>",pt_TEMP,"")
			i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
			erreur_860026614=i_set_art_str(g_iartout4, $Tdelta_minute::DEDE_NUM, pt_TEMP_860026614)

			res_860026614=i_get_art_field(g_iartin,$Tcentrex::INF_IDAV)
			erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::DEDE_INF,res_860026614)

		SINON
			SI (g_iartin.DESTINX==0x02)
			ALORS
				erreur_860026614=i_get_art_str(g_iartin, $NDE, pt_TEMP_860026614)
				#trace2("NDE= <%s>",pt_TEMP,"")
				i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
				erreur_860026614=i_set_art_str(g_iartout4, $Tdelta_minute::DEDE_NUM, pt_TEMP_860026614)

				erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::DEDE_INF, 0)
			FINSI
		FINSI
	SINON
		SI (CENTREX2_860026614 == 1)
		ALORS
			erreur_860026614=i_get_art_str(g_iartin, $NDE, pt_TEMP_860026614)
			#trace2("NDE= <%s>",pt_TEMP,"")
			i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
			erreur_860026614=i_set_art_str(g_iartout4, $Tdelta_minute::DEDE_NUM, pt_TEMP_860026614)

			erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::DEDE_INF,0)
		FINSI
	FINSI

	# DATE
	erreur_860026614=i_set_art_field(g_iartout4, $Tdelta_minute::DATE, ICAR_REL_860026614)

	#champ DUREE
	erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::DUREE,dduree_860026614)

	#champ CAX
	erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::CAX,CAX_860026614)

	#champ TAX
	# FO1385 FO2239 SI SRP_PORTE == 1
	SI ( (SRP_PORTE_860026614 == 1) && (tax_860026614 == 0) )
	ALORS
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::TAX,TAXE_CAL_860026614)
	SINON
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::TAX,tax_860026614)
	FINSI

	#champ NDS_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::NUMNOS)==1 )
	ALORS
		erreur_860026614=i_get_art_str(g_iartin,$Tcentrex::NUMNOS,pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::NDS_NUM,pt_TEMP_860026614)
	FINSI

	#champ SUP
	erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::SUP,SUP_860026614)

	#champs MES1 et MES2
	SI ( i_valid_field_n(g_iartin, $Tcentrex::MES1)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::MES1)
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::MES1,res_860026614)
	FINSI
	SI ( i_valid_field_n(g_iartin, $Tcentrex::MES2)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::MES2)
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::MES2,res_860026614)
	FINSI

	#
	# Gestion des champ NB_CSV, C_CSVI et OP_CSVI
	#

	#trace("Traitement des CSV")
	indice_860026614=0
	erreur_860026614=i_set_art_field(g_iartout4, $Tdelta_minute::NB_CSV, indice_860026614)
	num_champ_860026614=$Tdelta_minute::NB_CSV+1
	#trace1("numero du champ C_CSV1=<%d>",num_champ)

	SI ( (i_valid_field_n(g_iartin, $Tcentrex::T3sidr))==1 )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"C")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::T3cle)==1)
	ALORS
		SI (g_iartin.CLE1==0x0b)
		ALORS
			indice_860026614=indice_860026614+1
			erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
			erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"30")
			num_champ_860026614=num_champ_860026614+2
		FINSI
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 8)
	SI (bit_860026614 == 1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"T")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 6)
	SI (bit_860026614 == 1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"3")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 3)
	SI (bit_860026614 == 1)
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"D")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 2)
	SI ( (bit_860026614 == 1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"N")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	bit_860026614 = i_get_bit_val(TAP_860026614, 1)
	SI ( (bit_860026614 == 1)&&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout4,num_champ_860026614,"O")
	FINSI

	# Initialisation des champs OP_CSVI
	num_champ_860026614=$Tdelta_minute::NB_CSV+2
	res_860026614=0
	POINT DEB_BOUC1
	SI ( (res_860026614<indice_860026614)&&(res_860026614<5) )
	ALORS
		res_860026614=res_860026614+1
		erreur_860026614=i_memset_field_n(g_iartout4,num_champ_860026614,0xE4)
		num_champ_860026614=num_champ_860026614+2
		SAUT DEB_BOUC1
	FINSI

	# # #

	## Champ STY: modif.avec FO1431
	erreur_860026614 = i_set_art_str( g_iartout4, $Tdelta_minute::STY, pt_STY_str_860026614)

	#champ COCA et COCAV
	SI ( i_valid_field_n(g_iartin, $Tcentrex::BETA)==1 )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::COCA,pt_COCA_860026614)
	FINSI

	SI ( i_valid_field_n(g_iartin, $Tcentrex::BETAV)==1 )
	ALORS
		erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::COCAV,pt_COCAV_860026614)
	FINSI

	#champ IDAV_INF et IDAV_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::INF_IDAV)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin,$Tcentrex::INF_IDAV)
		erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::IDAV_INF,res_860026614)
	FINSI
	SI (i_valid_field_n(g_iartin, $Tcentrex::NUM_IDAV)==1)
	ALORS
		erreur_860026614=i_get_art_str(g_iartin, $Tcentrex::NUM_IDAV,pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout4, $Tdelta_minute::IDAV_NUM,pt_TEMP_860026614)
	FINSI

	#champ SGTQS
	#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
	#trace2("SGTQS=<%s>",pt_SGTQS,"")
	erreur_860026614=i_set_art_str(g_iartout4,$Tdelta_minute::SGTQS,pt_SGTQS_860026614)

	#champ CLASSDEST
	erreur_860026614=i_set_art_field(g_iartout4,$Tdelta_minute::CLASSDEST,CCD_REEL_860026614)
FINSI

#--------------------------------------#
# 	TRAFIC
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instTRAFIC_860026614) )
ALORS
	trace("Mise au format TRAFIC")
	i_strcpy(pt_nomEccFact_860026614, pt_Traf_860026614)
	SI ( i_dup_art_dest(g_iartin,g_iartout7,C_Ttrafic_860026614) )
	ALORS
		code_errone_860026614 = 0xA0D0
		code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
		erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_Ttrafic_860026614,C_Article_860026614)
		#trace1("Erreur de i_dup_art_dest: <%d>",res)
		SAUT  DISTRI_ERR
	FINSI

	#trace("initialisation de DOMAINE et SERVICE")
	# DOMAINE
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::DOMAINE, "05")

	# SERVICE
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::SERVICE, "25")


	# Champ NIDUS
	erreur_860026614=i_get_art_str(g_iartin, $NDR, pt_TEMP_860026614)
	#trace2("NDR= <%s>",pt_TEMP,"")
	i_replace_str(pt_TEMP_860026614,"BCDE","AJSC",pt_TEMP_860026614)
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::IDUS_NUM, pt_TEMP_860026614)

	# Champs DEDE_INF et DEDE_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::T4dstx)==1 )
	ALORS
		SI (g_iartin.DESTINX==0x01)
		ALORS
			erreur_860026614=i_get_art_str(g_iartin, $NUM_IDAV, pt_TEMP_860026614)
			#trace2("NUM_IDAV= <%s>",pt_TEMP,"")
			i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
			erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::DEDE_NUM, pt_TEMP_860026614)

			res_860026614=i_get_art_field(g_iartin,$Tcentrex::INF_IDAV)
			erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::DEDE_INF,res_860026614)

		SINON
			SI (g_iartin.DESTINX==0x02)
			ALORS
				erreur_860026614=i_get_art_str(g_iartin, $NDE, pt_TEMP_860026614)
				#trace2("NDE= <%s>",pt_TEMP,"")
				i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
				erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::DEDE_NUM, pt_TEMP_860026614)

				erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::DEDE_INF, 0)
			FINSI
		FINSI
	SINON
		SI (CENTREX2_860026614 == 1)
		ALORS
			erreur_860026614=i_get_art_str(g_iartin, $NDE, pt_TEMP_860026614)
			#trace2("NDE= <%s>",pt_TEMP,"")
			i_replace_str(pt_TEMP_860026614,"BC","*#",pt_TEMP_860026614)
			erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::DEDE_NUM, pt_TEMP_860026614)

			erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::DEDE_INF,0)
		FINSI
	FINSI

	# DATE
	erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::DATE, ICAR_REL_860026614)

	#champ CAX
	erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::CAX, CAX_860026614)

	#champ NDS_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::NUMNOS)==1 )
	ALORS
		erreur_860026614=i_get_art_str(g_iartin, $NUMNOS, pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::NDS_NUM, pt_TEMP_860026614)
	FINSI

	#champ DUREE
	erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::DUREE, dduree_860026614)

	#champ TAX
#DRE G4R6 Lot2
#DRE - G4R7 QC829
#	SI (REJET==CPT_CPS_Loc)
	SI b_Fact_CPS_Loc_860026614
	ALORS
		erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::TAX, tax_860026614)
	SINON
		SI ( (SRP_PORTE_860026614 == 1) && (tax_860026614 == 0) )
		ALORS
			erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::TAX,TAXE_CAL_860026614)
		SINON
			erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::TAX, tax_860026614)
		FINSI
	FINSI
#\DRE G4R6 Lot2
	

	# Gestion des champ NB_CSV, C_CSVI et OP_CSVI
	#trace("Traitement des CSV")

	indice_860026614=0
	erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::NB_CSV, indice_860026614)
	num_champ_860026614=$Ttrafic::NB_CSV+1
	#trace1("numero du champ C_CSV1=<%d>",num_champ)

	SI ( (i_valid_field_n(g_iartin, $Tcentrex::T3sidr))==1 )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"C")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::T3cle)==1)
	ALORS
		SI (g_iartin.CLE1==0x0b)
		ALORS
			indice_860026614=indice_860026614+1
			erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
			erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"30")
			num_champ_860026614=num_champ_860026614+2
		FINSI
	FINSI

	SI ( i_get_bit_val(TAP_860026614, 8) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"T")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( i_get_bit_val(TAP_860026614, 6) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"3")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( i_get_bit_val(TAP_860026614, 3) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"D")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( i_get_bit_val(TAP_860026614, 2) &&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"N")
		num_champ_860026614=num_champ_860026614+2
	FINSI

	SI ( i_get_bit_val(TAP_860026614, 1) &&(indice_860026614 < 5) )
	ALORS
		indice_860026614 = indice_860026614+1
		erreur_860026614=i_set_art_field(g_iartout7,$Ttrafic::NB_CSV,indice_860026614)
		erreur_860026614=i_set_art_str(g_iartout7,num_champ_860026614,"O")
	FINSI

	# Initialisation des champs OP_CSVI
	num_champ_860026614=$Ttrafic::NB_CSV+2
	res_860026614=0
	POINT DEB_BOUC3
	SI ( (res_860026614<indice_860026614)&&(res_860026614<5) )
	ALORS
		res_860026614=res_860026614+1
		erreur_860026614=i_memset_field_n(g_iartout7,num_champ_860026614,0xE4)
		num_champ_860026614=num_champ_860026614+2
		SAUT DEB_BOUC3
	FINSI
	#trace("Fin CSV")

	#champ SUP
	erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::SUP, SUP_860026614)

	#champ COCA et COCAV
	SI (i_valid_field_n(g_iartin, $Tcentrex::BETA)==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::COCA,pt_COCA_860026614)
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::BETAV)==1)
	ALORS
		erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::COCAV,pt_COCAV_860026614)
	FINSI

	#champ IDAV_INF et IDAV_NUM
	SI ( i_valid_field_n(g_iartin, $Tcentrex::INF_IDAV)==1 )
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::INF_IDAV)
		erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::IDAV_INF, res_860026614)
	FINSI

	SI (i_valid_field_n(g_iartin, $Tcentrex::NUM_IDAV)==1)
	ALORS
		erreur_860026614=i_get_art_str(g_iartin, $Tcentrex::NUM_IDAV,pt_TEMP_860026614)
		erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::IDAV_NUM,pt_TEMP_860026614)
	FINSI

	## Champ STY: modif.avec FO1431
	erreur_860026614 = i_set_art_str( g_iartout7, $Ttrafic::STY, pt_STY_str_860026614)

	#MESSAGES
	SI (i_valid_field_n(g_iartin,$MES1)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::MES1)
		erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::MES1, res_860026614)
	FINSI
	SI (i_valid_field_n(g_iartin,$MES2)==1)
	ALORS
		res_860026614=i_get_art_field(g_iartin, $Tcentrex::MES2)
		erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::MES2, res_860026614)
	FINSI

	#champ SGTQS
	#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::SGTQS, pt_SGTQS_860026614)

	#champ CLASSDEST
	erreur_860026614=i_set_art_field(g_iartout7, $Ttrafic::CLASSDEST, CCD_REEL_860026614)

# DRE G4R6 Lot2
	# TAG
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::TAG, " ")
	
	# TYPE_EDIT
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::TYPE_EDIT, pt_TYPE_EDIT_860026614)
	
	# CODE_TARIF
	erreur_860026614=i_set_art_str(g_iartout7, $Ttrafic::CODE_TARIF, pt_CODE_TARIF_860026614)
# \DRE G4R6 Lot2

FINSI

#QC862 test remonte pour prendre en compte CASPER
POINT AVANT_REDIST
SI (trait_ok_860026614 == 0)
ALORS
	#G4R8 QC862 Paragraphe deplace pour envoi a casper au 1er tour de redistribution
	#G3R23
	#-------------------
	#  CASPER
	#-------------------
	SI (b_NSUC_860026614 == 1) 
	ALORS
		erreur_860026614=i_AjouterCouranteECC(instCASPER_860026614)
	FINSI

	#G3R23
	#-----------------------------------------------------------------------
	# CASPER
	#-----------------------------------------------------------------------
	
	SI ( !i_ChercherCouranteECC(instCASPER_860026614) )
	ALORS
		trace("Stockage vers CASPER")
		SI ( i_dup_art_id(g_iartin,g_iartout5) )
		ALORS
			code_errone_860026614 = 0xA0D0
			code_errone_860026614 = code_errone_860026614 + EFFICACE_860026614
			erreur_860026614 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026614,C_Tcasper_860026614,C_Article_860026614)
			SAUT DISTRI_ERR
		FINSI
		
		SI ( i_valid_field_n(g_iartout5,$Tcentrex::T3ce) )
		ALORS
			erreur_860026614 = i_supprChamp(g_iartout5,"T3ce")
		FINSI
		
		res_860026614 = i_rename_art(g_iartout5, C_Tcasper_860026614)
	
		# COMPLEMENTS CASPER (SGTQS NSUC)
	
		#champ SGTQS
		erreur_860026614 = i_ajoutChampNum(g_iartout5,$TcasperTcentrex::T4sgtqs,$TcasperTcentrex::SGTQS,0)
		#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
		#trace2("SGTQS=<%s>",pt_SGTQS,"")
		erreur_860026614 = i_set_art_str(g_iartout5, $TcasperTcentrex::SGTQS, pt_SGTQS_860026614)
	
		#champ NSUC
		erreur_860026614 = i_ajoutChampNum(g_iartout5,$TcasperTcentrex::T4nsuc,$TcasperTcentrex::NSUC,0)
		erreur_860026614 = i_set_art_str(g_iartout5,$TcasperTcentrex::NSUC,pt_NSUC_860026614)
		res_860026614 = i_strlen(pt_NSUC_860026614)
		erreur_860026614 = i_resize_tlv(g_iartout5, "T4nsuc", "NSUC", res_860026614)
	FINSI
	
	#--------------------------------------#

#QC862 test remonte pour prendre en compte CASPER
#POINT AVANT_REDIST
#SI (trait_ok == 0)
#ALORS
#
	#--------------------------------------#
	# Complements Symphonie (SGTQS + CCD)
	#--------------------------------------#
	SI ( !i_ChercherCouranteECC(instSYMP_860026614) )
	ALORS
		SI (EFFICACE_860026614)
		ALORS
			#champ CCD
			erreur_860026614=i_ajoutChampNum(g_iartout,$Tsymtcentrex::T4ccd,$Tsymtcentrex::CCD,0)
			erreur_860026614=i_set_art_field(g_iartout,$Tsymtcentrex::CCD, CCD_REEL_860026614)

			#champ SGTQS
			erreur_860026614 = i_ajoutChampNum(g_iartout,$Tsymtcentrex::T4sgtqs,$Tsymtcentrex::SGTQS,0)
			#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
			#trace2("SGTQS=<%s>",pt_SGTQS,"")
			erreur_860026614 = i_set_art_str(g_iartout, $Tsymtcentrex::SGTQS, pt_SGTQS_860026614)

			#champ ECC_FACT
			#FO2378
			erreur_860026614=i_ajoutChampNum(g_iartout,$Tsymtcentrex::T4eccfact,$Tsymtcentrex::ECC_FACT,0)
#QC862			
			erreur_860026614=i_set_art_str( g_iartout, $Tsymtcentrex::ECC_FACT, " ")
			SI bREDISTALICE_860026614 == 0
			ALORS			
				SI (REJET_860026614 != 2 && REJET_860026614 != 3)
				ALORS
					SI (i_strcmp(pt_nomEccFact_860026614,"") != 0)
					ALORS
	
						erreur_860026614=i_set_art_str(g_iartout, $Tsymtcentrex::ECC_FACT,pt_nomEccFact_860026614)
					SINON
						SI (i_strcmp(pt_EccCentaure_860026614,"") != 0)
						ALORS
							erreur_860026614=i_set_art_str(g_iartout, $Tsymtcentrex::ECC_FACT,pt_EccCentaure_860026614)
	#					SINON
	#						erreur=i_set_art_str( g_iartout, $Tsymtcentrex::ECC_FACT, " ")
						FINSI
					FINSI
	#			SINON
	#				erreur=i_set_art_str( g_iartout, $Tsymtcentrex::ECC_FACT, " ")
				FINSI
			FINSI
#\QC862
			#champ IEZLT
			# Test de presence de IEZLT car si absent, pas d'IEZLT en sortie
			SI (IEZLT_860026614 != -1)
			ALORS
				erreur_860026614=i_ajoutChampNum(g_iartout,$Tsymtcentrex::T4iezlt,$Tsymtcentrex::IEZLT,0)
				erreur_860026614=i_set_art_field(g_iartout,$Tsymtcentrex::IEZLT, IEZLT_860026614)
			FINSI
			SI (CAX_860026614 != 9)
			ALORS
				# CODCIRDR
				erreur_860026614=i_ajoutChampNum( g_iartout, $Tsymtcentrex::T4codcirdr, $Tsymtcentrex::CODCIRDR, 0 )
				erreur_860026614=i_set_art_str( g_iartout, $Tsymtcentrex::CODCIRDR, pt_CODCIRDA_860026614 )

				# CODCIR
				erreur_860026614=i_ajoutChampNum( g_iartout, $Tsymtcentrex::T4codcir, $Tsymtcentrex::CODCIR, 0 )
				erreur_860026614=i_set_art_str( g_iartout, $Tsymtcentrex::CODCIR, pt_CODCIRA_860026614 )
			FINSI

			SI (!bCENT_860026614)
			ALORS
				SI ( (SRP_PORTE_860026614 == 1) && (tax_860026614 == 0) )
				ALORS
					tax_860026614 = TAXE_CAL_860026614
				FINSI
				SI (i_valid_field_n(g_iartin,$Tcentrex::T3cap2))
				ALORS
					erreur_860026614=i_set_art_field(g_iartout, $Tsymtcentrex::TAXE:0, tax_860026614)
				SINON
					erreur_860026614=i_set_art_field(g_iartout, $Tsymtcentrex::TAXE:1, tax_860026614)
				FINSI
			FINSI
# DRE G4R6 Lot2
			# TYPE_EDIT
			SI i_strcmp(pt_TYPE_EDIT_860026614," ") != 0
			ALORS
				erreur_860026614 = i_ajoutChampNum(g_iartout,$Tsymtcentrex::T4type_edit,$Tsymtcentrex::TYPE_EDIT,0)
				erreur_860026614=i_set_art_str(g_iartout, $Tsymtcentrex::TYPE_EDIT, pt_TYPE_EDIT_860026614)
			FINSI
		
			# CODE_TARIF
			SI i_strcmp(pt_CODE_TARIF_860026614,"    ") != 0
			ALORS
				erreur_860026614 = i_ajoutChampNum(g_iartout,$Tsymtcentrex::T4code_tarif,$Tsymtcentrex::CODE_TARIF,0)
				erreur_860026614=i_set_art_str(g_iartout, $Tsymtcentrex::CODE_TARIF, pt_CODE_TARIF_860026614)
			FINSI
# \DRE G4R6 Lot2

		SINON
			#champ CCD
			erreur_860026614=i_ajoutChampNum(g_iartout,$Tsymtctrexinef::T4ccd,$Tsymtctrexinef::CCD,0)
			erreur_860026614=i_set_art_field(g_iartout, $Tsymtctrexinef::CCD, 255)

			#champ SGTQS
			erreur_860026614 = i_ajoutChampNum(g_iartout,$Tsymtctrexinef::T4sgtqs,$Tsymtctrexinef::SGTQS,0)
			#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
			#trace2("SGTQS=<%s>",pt_SGTQS,"")
			erreur_860026614 = i_set_art_str(g_iartout, $Tsymtctrexinef::SGTQS, pt_SGTQS_860026614)

			#champ ECC_FACT
			erreur_860026614=i_ajoutChampNum(g_iartout,$Tsymtctrexinef::T4eccfact,$Tsymtctrexinef::ECC_FACT,0)
			SI (i_strcmp(pt_nomEccFact_860026614,"") != 0)
			ALORS
				res_860026614=i_set_art_str(g_iartout, $Tsymtctrexinef::ECC_FACT, pt_nomEccFact_860026614)
			SINON
				SI (i_strcmp(pt_EccCentaure_860026614,"") != 0)
				ALORS
					erreur_860026614=i_set_art_str(g_iartout, $Tsymtctrexinef::ECC_FACT,pt_EccCentaure_860026614)
				SINON
					erreur_860026614=i_set_art_str(g_iartout, $Tsymtctrexinef::ECC_FACT, " ")
				FINSI
			FINSI

			#champ IEZLT
			# Test de presence de IEZLT car si absent, pas d'IEZLT en sortie
			SI (IEZLT_860026614 != -1)
			ALORS
				erreur_860026614=i_ajoutChampNum(g_iartout,$Tsymtctrexinef::T4iezlt,$Tsymtctrexinef::IEZLT,0)
				erreur_860026614=i_set_art_field(g_iartout,$Tsymtctrexinef::IEZLT, IEZLT_860026614)
			FINSI
			
# DRE G4R6 Lot2
			# TYPE_EDIT
			SI i_strcmp(pt_TYPE_EDIT_860026614," ") != 0
			ALORS
				erreur_860026614 = i_ajoutChampNum(g_iartout,$Tsymtctrexinef::T4type_edit,$Tsymtctrexinef::TYPE_EDIT,0)
				erreur_860026614=i_set_art_str(g_iartout, $Tsymtctrexinef::TYPE_EDIT, pt_TYPE_EDIT_860026614)
			FINSI
		
			# CODE_TARIF
			SI i_strcmp(pt_CODE_TARIF_860026614,"    ") != 0
			ALORS
				erreur_860026614 = i_ajoutChampNum(g_iartout,$Tsymtctrexinef::T4code_tarif,$Tsymtctrexinef::CODE_TARIF,0)
				erreur_860026614=i_set_art_str(g_iartout, $Tsymtctrexinef::CODE_TARIF, pt_CODE_TARIF_860026614)
			FINSI
# \DRE G4R6 Lot2

		FINSI
	FINSI

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

	#--------------------------------------#
	# 	SYMPHONIE
	#--------------------------------------#
	SI( !i_ChercherCouranteECC(instSYMP_860026614) )
	ALORS
		res_860026614 = i_stocke_art_iecc(g_iartout, instSYMP_860026614)
		trace("Emission vers SYMPHONIE")
	FINSI

	#G4R8 QC862 Paragraphe remonte pour envoi a casper au 1er tour de redistribution
	#G3R23
	#-------------------------------------------------------------------------
	# CASPER
	#-------------------------------------------------------------------------
	SI ( !i_ChercherCouranteECC(instCASPER_860026614) )
	ALORS
		#trace( "Emission vers CASPER" )
		res_860026614 = i_stocke_art_iecc(g_iartout5, instCASPER_860026614)
	FINSI


FINSI

#QC862
#SI (bREDIST == 1 )
SI (bREDIST_860026614 == 1 || bREDISTALICE_860026614 == 1)
ALORS
	SAUT DISTRI_RDT
FINSI

#--------------------------------------#
# 	CENTAUREDC
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instCENT_860026614) )
ALORS
	res_860026614 = i_stocke_art_iecc(g_iartout2, instCENT_860026614)
	trace("Emission vers CENTAUREDC")
FINSI


#--------------------------------------#
# 	DELTAMINUTE
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instDM_860026614) )
ALORS
	res_860026614 = i_stocke_art_iecc(g_iartout4, instDM_860026614)
	trace("Emission vers DM")
FINSI


#--------------------------------------#
# 	FE
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instFE_860026614) )
ALORS
	res_860026614 = i_stocke_art_iecc(g_iartout6, instFE_860026614)
	trace("Emission vers FE")
FINSI

#--------------------------------------#
# 	FERPV
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instFERPV_860026614) )
ALORS
	#IFDEF trace_niv1 = 1
	trace( "__FILE__: Emission vers FERPV" )
	#ENDIF
	res_860026614 = i_stocke_art_iecc(g_iartout11, instFERPV_860026614)
FINSI

#--------------------------------------#
# 	ARAVIS
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instARAVIS_860026614) )
ALORS
	#IFDEF trace_niv1 = 1
	trace( "__FILE__: Emission vers ARAVIS" )
	#ENDIF
	res_860026614 = i_stocke_art_iecc(g_iartout12, instARAVIS_860026614)
FINSI

#--------------------------------------#
# 	TRAFIC
#--------------------------------------#
SI ( !i_ChercherCouranteECC(instTRAFIC_860026614) )
ALORS
	trace1(" instance TRAFIC a l'envoi : %d", instTRAFIC_860026614)
	res_860026614 = i_stocke_art_iecc(g_iartout7, instTRAFIC_860026614)
	trace("Emission vers TRAFIC")
FINSI

#G4R8 QC862 Paragraphe remonte pour envoi a casper au 1er tour de redistribution
##G3R23
##-------------------------------------------------------------------------
## CASPER
##-------------------------------------------------------------------------
#SI ( !i_ChercherCouranteECC(instCASPER) )
#ALORS
#	#trace( "Emission vers CASPER" )
#	res = i_stocke_art_iecc(g_iartout5, instCASPER)
#FINSI

SAUT DISTRI_FIN

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

POINT DISTRI_ERR

trace( "Stockage en errone de distribution")
res_860026614=i_make_art_rej(g_iartin, g_iartout, code_errone_860026614)
res_860026614=i_stocke_art(g_iartout,0,PT_ERRONE,0)

RETOUR TRAIT_OK

############################################################################
# 	Stockage en elimine
############################################################################

POINT DISTRI_DIV

trace( "Stockage en divers")
res_860026614 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0)

RETOUR TRAIT_OK

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

POINT DISTRI_RDT

trace( "envoi en redistribution")

SI (trait_ok_860026614 == 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_860026614 )
	ALORS
		#IFDEF trace_niv1 = 1
		trace("__FILE__:__LINE__ =====> Creation enveloppe REDISTRI")
		#ENDIF
		ENVELOPPE_NOK_860026614 = i_add_opt( "E_Tcentrex" )
		# champ T1 (=>  0x13 pour la reconnaissance de l'enveloppe,
		# par l'arbre de reconnaissance Dopt )
		#G3R23
		#res = i_set_attr_val_n( $E_Tcentrex::T1, 0x13 )

		# Champ L1
		#res = i_set_attr_val_n( $E_Tcentrex::L1, 0x11 )
	FINSI

	#i_strcpy(pt_SGTQS,i_LireEECSGTQS(g_ieec) )
	res_860026614 = i_set_attr_str_n( $E_Tcentrex::Nom_EEC, pt_SGTQS_860026614)
	res_860026614 = i_get_attr_str_n($E_Tcentrex::Nom_EEC, pt_SGTQS_860026614)
	erreur_860026614 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026614,C_Article_860026614,pt_SGTQS_860026614)
FINSI

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

RETOUR TRAIT_OK

POINT DISTRI_FIN

#trace("Fin du Pcode de distribution Tcentrex")

RETOUR TRAIT_OK

#-------------- fin Tcentrex_dis.src -------------------------------------------------------
