DEFINITION C_Article_860026625 "Tri2g118HP"
DEFINITION C_Conversion_860026625 "Conversion"
DEFINITION C_FU_860026625 "U"
DEFINITION C_INST_VGA_860026625 "VGA"
DEFINITION C_INST_OPEN_860026625 "OPEN"
DEFINITION C_INST_VGAIP_860026625 "VGAIP"
DEFINITION C_Inst42L_860026625 "42L"
DEFINITION C_InstBSS_860026625 "BSS"
DEFINITION C_InstCENTVG_860026625 "CENTAUREVG"
DEFINITION C_InstFE_860026625 "FE"
DEFINITION C_InstFERPV_860026625 "FERPV"
DEFINITION C_InstNPF_860026625 "NPF"
DEFINITION C_InstSC_860026625 "SC"
DEFINITION C_InstSIP_860026625 "SIP"
DEFINITION C_InstSYMP_860026625 "SYMP"
DEFINITION C_InstTRAFBSS1_860026625 "TRAFBSS1"
DEFINITION C_InstTRAFBSS2_860026625 "TRAFBSS2"
DEFINITION C_InstTRAFIC_860026625 "TRAFIC"
DEFINITION C_pref_cle_860026625 "INi"
DEFINITION C_PREF_MLV87_860026625 "87"
DEFINITION C_PREF_MLV9_860026625 "9"
DEFINITION C_REF42L_860026625 "42L"
DEFINITION C_TcentaureVG_860026625 "TcentaureVG"
DEFINITION C_Tdelta_minute_860026625 "Tdelta_minute"
DEFINITION C_Tfe_860026625 "Tfe"
DEFINITION C_Tferpv_860026625 "Tfe_rpv"
DEFINITION C_TRAFBSS_860026625 "TtrafBSS"
DEFINITION C_TRAFBSS1FACT_860026625 "TRAFBSS1"
DEFINITION C_TRAFBSS2FACT_860026625 "TRAFBSS2"
DEFINITION C_Tsc_860026625 "TscTri2g118C"
DEFINITION C_Tsymphonie_860026625 "Tsymtri2g118"
DEFINITION C_Ttrafic_860026625 "TtraficN"
DEFINITION BASE_12_860026625 1
DEFINITION CATEG_12_860026625 8
DEFINITION CODE_12_860026625 1
DEFINITION IDUS_12_860026625 "**00"
DEFINITION bEFFICACE_860026625 2
DEFINITION NUMTAB_860026625 2
DEFINITION NUMTABSEL_860026625 0
DEFINITION RES_CLDEST_860026625 1
DEFINITION RES_CODCIR_860026625 3
DEFINITION RES_TYPCOM_860026625 0
DEFINITION TD_BSS_860026625 6
DEFINITION TD_NPF_860026625 3
DEFINITION TD_VGA1_860026625 7
DEFINITION TD_VGA2_860026625 2
DEFINITION ZONEMETRO_860026625 7
DEFINITION C_InstCENTDEA_860026625 "CENTAUREDEA"
DEFINITION C_TcentaureDEA_860026625 "TcentaureDEA"
DEFINITION C_instOPT_860026625 "OPT"
DEFINITION C_CASCORR_860026625 "118_CORR"
DEFINITION NUMTAB1_860026625 1
DEFINITION C_INST_COME_860026625 "COME"
DEFINITION C_INST_ELIGIBLE_860026625 "ELIGIBLE"
DEFINITION C_TAB_CSV_COME_860026625 "CSV_COME"
DEFINITION C_Tcome_860026625 "Tcome"
DEFINITION C_INST_COME_ELIGIBLE_860026625 "COME_ELIGIBLE"
DEFINITION NUMTABSEL1_860026625 1
DEFINITION RES_TYPCPT_860026625 2
DEFINITION CPT_CPS_Loc_860026625 16
DEFINITION CPT_CPS_RI_860026625 17
DEFINITION C_DATCPS_860026625 "DATCPS" 
DEFINITION TD_SVA_860026625 9
DEFINITION C_INST_ALICE_860026625 "ALICE"
REGISTRE ENTIER b_IDUS_NDIP_860026625
REGISTRE ENTIER b_NPF_SIP_860026625
REGISTRE ENTIER b_TETRIS_FU_860026625
REGISTRE ENTIER b_TETRIS_TRAFBSS_860026625
REGISTRE ENTIER b_TRAFBSScritCOM_860026625
REGISTRE ENTIER bCENTVG_860026625
REGISTRE ENTIER arFE_860026625
REGISTRE ENTIER bFE_860026625
REGISTRE ENTIER arFERPV_860026625
REGISTRE ENTIER bFERPV_860026625
REGISTRE ENTIER bIDUS_NUM_860026625
REGISTRE ENTIER bRDIP_SVTR_860026625
REGISTRE ENTIER bSC_860026625
REGISTRE ENTIER bTRAFIC_860026625
REGISTRE ENTIER CATDC_860026625
REGISTRE ENTIER CAX_860026625
REGISTRE ENTIER CCD_860026625
REGISTRE ENTIER CCD_REEL_860026625
REGISTRE ENTIER CODCIR_860026625
REGISTRE ENTIER code_CFR_860026625
REGISTRE ENTIER code_errone_860026625
REGISTRE ENTIER CPT_REDIST_860026625
REGISTRE ENTIER DATE_GMT_860026625
REGISTRE ENTIER DATE_GMT_HDEB_860026625
REGISTRE ENTIER DATE_LOCALE_860026625
REGISTRE ENTIER DATE_LOCALE_HDEB_860026625
REGISTRE ENTIER ddebut_860026625
REGISTRE ENTIER dduree_860026625
REGISTRE ENTIER DECO_INF_860026625
REGISTRE ENTIER DECO_TRAF_860026625
REGISTRE ENTIER dpivot_860026625
REGISTRE ENTIER EPORTABILITE_860026625
REGISTRE ENTIER EPORTABILITE_SCP_860026625
REGISTRE ENTIER erreur_860026625
REGISTRE ENTIER bFACTURABLE_860026625
REGISTRE ENTIER GCOM_NAD_860026625
REGISTRE ENTIER ICAR_P_860026625
REGISTRE ENTIER ICAR_REF_860026625
REGISTRE ENTIER ICAR_S_860026625
REGISTRE ENTIER IDUS_TOPE_860026625
REGISTRE ENTIER IDUS_TRAF_860026625
REGISTRE ENTIER index_860026625
REGISTRE ENTIER inst42L_860026625
REGISTRE ENTIER instBSS_860026625
REGISTRE ENTIER instCENTVG_860026625
REGISTRE ENTIER instDM_860026625
REGISTRE ENTIER instECCv_860026625
REGISTRE ENTIER instFE_860026625
REGISTRE ENTIER instFERPV_860026625
REGISTRE ENTIER instNPF_860026625
REGISTRE ENTIER instSC_860026625
REGISTRE ENTIER instSIP_860026625
REGISTRE ENTIER instSYMPH_860026625
REGISTRE ENTIER instTRAFBSS1_860026625
REGISTRE ENTIER instTRAFBSS2_860026625
REGISTRE ENTIER instTRAFIC_860026625
REGISTRE ENTIER instVGA_860026625
REGISTRE ENTIER instOPEN_860026625
REGISTRE ENTIER instVGAIP_860026625
REGISTRE ENTIER L_COMPTE_NPF_860026625
REGISTRE ENTIER L_NDR_860026625
REGISTRE ENTIER lg_dede_860026625
REGISTRE ENTIER MER_860026625
REGISTRE ENTIER NB_CSV_860026625
REGISTRE ENTIER numzone_860026625
REGISTRE ENTIER RDIP_SVTR_1_860026625
REGISTRE ENTIER REF_860026625
REGISTRE ENTIER res_860026625
REGISTRE ENTIER SCATDC_860026625
REGISTRE ENTIER SERVICE_860026625
REGISTRE ENTIER SPORTABILITE_860026625
REGISTRE ENTIER SPORTABILITE_SCP_860026625
REGISTRE ENTIER SUP_860026625
REGISTRE ENTIER TRAA_DCONV_860026625
REGISTRE ENTIER TRAA_HDEB_860026625
REGISTRE ENTIER TRAA_NUTC_860026625
REGISTRE ENTIER TRAA_NUTR_860026625
REGISTRE ENTIER TREP_DURCONV_860026625
REGISTRE ENTIER TYPAR_Etelephonie_860026625
REGISTRE ENTIER TYPAR_FE_860026625
REGISTRE ENTIER TYPCOM_860026625
REGISTRE ENTIER V1S_860026625
REGISTRE ENTIER val_860026625
REGISTRE ENTIER VGA_860026625
REGISTRE ENTIER TYPAR_SIPFE_860026625
REGISTRE ENTIER NM3_860026625
REGISTRE ENTIER TYPCOM_fct_860026625
REGISTRE ENTIER b_arretfct_centaure_860026625
REGISTRE ENTIER instCENTDEA_860026625
REGISTRE ENTIER bCENTDEA_860026625
REGISTRE ENTIER b_NPF_OPT_860026625
REGISTRE ENTIER instOPT_860026625
REGISTRE ENTIER SIP_Fibre_860026625
REGISTRE ENTIER RETOUR_CORR_860026625
REGISTRE ENTIER CORR_118ALADUREE_860026625
REGISTRE ENTIER ID_CORR_860026625
REGISTRE ENTIER nelem_860026625
REGISTRE ENTIER TYPAR_BIV_SIP_860026625
REGISTRE ENTIER b_CodOperVG_860026625
REGISTRE ENTIER b_FFMV2_860026625
REGISTRE ENTIER b_FFMV3_860026625
REGISTRE ENTIER b_OperNBE_860026625
REGISTRE ENTIER b_FERPV_860026625
REGISTRE ENTIER b_FERPV_NBE_860026625
REGISTRE ENTIER date_table_860026625
REGISTRE ENTIER DATE_AUDIT_GMT_860026625
REGISTRE ENTIER DATE_AUDIT_860026625
REGISTRE ENTIER instCOME_860026625
REGISTRE ENTIER instELIGIBLE_860026625
REGISTRE ENTIER b_InfoC_COME_NDI_860026625
REGISTRE ENTIER b_InfoC_ELIGIBLE_NDI_860026625
REGISTRE ENTIER b_COME_860026625
REGISTRE ENTIER b_ELIGIBLE_860026625
REGISTRE ENTIER Valeur_860026625
REGISTRE ENTIER Nbut_COME_860026625
REGISTRE ENTIER b_FERPV_COME_860026625
REGISTRE ENTIER instCOME_ELIGIBLE_860026625
REGISTRE ENTIER b_BANIP_860026625
REGISTRE ENTIER longueur_860026625
REGISTRE ENTIER Date_CPS_860026625
REGISTRE ENTIER instALICE_860026625 
REGISTRE ENTIER typ_ctr_860026625
REGISTRE ENTIER bREDIST_SVA_860026625
REGISTRE ENTIER b_TRAFBSS1_860026625
REGISTRE ENTIER b_TRAFBSS2_860026625
REGISTRE POINTEUR pt_basTRAFIC_860026625
REGISTRE POINTEUR pt_BUF_860026625
REGISTRE POINTEUR pt_C_CSV1_860026625
REGISTRE POINTEUR pt_CATDC_860026625
REGISTRE POINTEUR pt_CLE_860026625
REGISTRE POINTEUR pt_CODE_DEUR_860026625
REGISTRE POINTEUR pt_CODE_FU_860026625
REGISTRE POINTEUR pt_CodeOp_860026625
REGISTRE POINTEUR pt_CodeOp_SCP_860026625
REGISTRE POINTEUR pt_COMPTE_NPF_860026625
REGISTRE POINTEUR pt_CSV_860026625
REGISTRE POINTEUR pt_DECO_DIST_NUM_860026625
REGISTRE POINTEUR pt_DECO_NUM_860026625
REGISTRE POINTEUR pt_DECO_TEMP_860026625
REGISTRE POINTEUR pt_DEDE_DIST_N_860026625
REGISTRE POINTEUR pt_DEDE_NUM_860026625
REGISTRE POINTEUR pt_ECCFACT_860026625
REGISTRE POINTEUR pt_GCOM_IDRSG_860026625
REGISTRE POINTEUR pt_GCOM_PALNUM_860026625
REGISTRE POINTEUR pt_IDCORREL_860026625
REGISTRE POINTEUR pt_IDSRT_860026625
REGISTRE POINTEUR pt_IDUS_NDRTC_860026625
REGISTRE POINTEUR pt_IDUS_NUM_860026625
REGISTRE POINTEUR pt_InfoCompl_860026625
REGISTRE POINTEUR pt_instDM_860026625
REGISTRE POINTEUR pt_instTRAFIC_860026625
REGISTRE POINTEUR pt_LIBELREDIST_860026625
REGISTRE POINTEUR pt_BANIP_RTC_860026625
REGISTRE POINTEUR pt_NDS_NUM_860026625
REGISTRE POINTEUR pt_NUM_860026625
REGISTRE POINTEUR pt_NUMDDR_860026625
REGISTRE POINTEUR pt_OFFRE_860026625
REGISTRE POINTEUR pt_OP_CSV1_860026625
REGISTRE POINTEUR pt_OPERA_860026625
REGISTRE POINTEUR pt_RDIP_SVTR_860026625
REGISTRE POINTEUR pt_REF_860026625
REGISTRE POINTEUR pt_RES1_860026625
REGISTRE POINTEUR pt_SCATDC_860026625
REGISTRE POINTEUR pt_SERVICE_860026625
REGISTRE POINTEUR pt_SGTQS_860026625
REGISTRE POINTEUR pt_SIP_ECC_860026625
REGISTRE POINTEUR pt_TARIF_860026625
REGISTRE POINTEUR pt_temp_860026625
REGISTRE POINTEUR pt_temp2_860026625
REGISTRE POINTEUR pt_TETRIS_compte_860026625
REGISTRE POINTEUR pt_TETRIS_RTC_860026625
REGISTRE POINTEUR pt_TRAFIC_860026625
REGISTRE POINTEUR pt_TYPOFFRE_860026625
REGISTRE POINTEUR pt_VGA_OF_860026625
REGISTRE POINTEUR pt_VGA_OP_860026625
REGISTRE POINTEUR pt_NM3_OP_860026625
REGISTRE POINTEUR pt_NM3_OF_860026625
REGISTRE POINTEUR pt_OPT_RTC_860026625
REGISTRE POINTEUR pt_OPT_ECC_860026625
REGISTRE POINTEUR pt_buffer_860026625
REGISTRE POINTEUR pt_Support_860026625
REGISTRE POINTEUR pt_REPONSE_860026625
REGISTRE POINTEUR pt_CodOperVG_860026625
REGISTRE POINTEUR pt_CodOffreVG_860026625
REGISTRE POINTEUR pt_TEMP_860026625
REGISTRE POINTEUR pt_datODEBI_860026625
REGISTRE POINTEUR pt_NDI_860026625
REGISTRE POINTEUR pt_CallType_860026625
REGISTRE POINTEUR pt_TeleService_860026625
REGISTRE POINTEUR pt_ECCv_860026625
REGISTRE POINTEUR pt_RTC_MAY_860026625
REGISTRE POINTEUR pt_MESSAGE_860026625
REGISTRE POINTEUR pt_CODE_TARIF_860026625 
REGISTRE POINTEUR pt_TYPE_EDIT_860026625 
REGISTRE POINTEUR pt_NORM_860026625
#############################################################################
#
# Fichier : Tri2g118HP_dist.src (avec correlation)
#
# Distribution :
#    Article Tri2g118HP
#
# En entree :
#    Article : Tri2g118HP
#
# En sortie :
#	TRAFIC, FE, FERPV
#	SuiviConso, SYMPHONIE, DELTAMINUTE, CENTVG
#	COME, ELIGIBLE, RACOME(duplication via l'IECC)

#	g_iartout2, Conversion
#	g_iartout3, DISTRI_ERR
#	g_iartout4, TtrafBSS
#	g_iartout5, TscTri2g118C
#	g_iartout6, TtraficN
#	g_iartout7, TcentaureVG
#	g_iartout8, Tfe
#	g_iartout9, Tdelta_minute FE
#	g_iartout10, TcentaureDEA
#	g_iartout11, Correlation
#	g_iartout12, Tsymtri2g118
#	g_iartout13, Tfe_rpv
#	g_iartout14, Tcome pour COME et COME_ELIGIBLE
#
#
#
# HISTORIQUE :
# 14/08/2012 - THE - Creation
# 15/10/2012 - DRE - G1R1 Activation de la ligne i_initialiserPrmCorr pour CorrelHP
# 22/01/2013 - THE - G4R2 Referentiel OPEN
# 12/02/2013 - DRE - G4R02 Envoi a COME
# 04/03/2013 - DRE - G4R02 QC693 Ajout ECC COME_ELIGIBLE
# 11/03/2013 - DRE - G4R2 QC695 1) Revoir valorisation MSISDN, + modif crit?res de distribution COME et COME_ELIGIBLE, 2) revoir calcul DUREE, 4)Revoir les controles de distribution pour FERPV, Trafic
# 25/03/2013 - DRE - G4R2 QC701 Remplace "BEAM" par "OPEN"
# 23/04/2013 - DRE - G4R2 QC717 correction valeur champ V3t1.3 (idemet) + Distribuer en errone tout DC dont le CSV est inconnu dans la table TCSV_COME 	
# 23/04/2013 - DRE - G4R2 QC717 correction valeur champ V3t1.3 (idemet) + Distribuer en errone tout DC a destination de COME dont le CSV est inconnu dans la table TCSV_COME + Ne pas distribuer ces DC a COME_ELLIGIBLE
# 11/10/2013 - THE - G4R4 QC756 correction  mise au format GASCII pour COME 
# 07/01/2014 - THE - G4R5 Lot2 Supp date odebi + HLAHM1 DOM
# 31/01/2014 - DRE - G4R5 QC783 NDS_NUM pour Trafic
# 04/02/2014 - DRE - G4R5 LOT2 Criteres d'envoi a symphonie
# 16/04/2014 - DRE - G4R6 : Lot3
# 13/05/2014 - DRE - G4R6 QC816
# 06/06/2014 - DRE - G4R6 QC824
# 07/01/2015 - DRE - G4R9 : Lot1
#
###########################################################################

###################################
# constantes
#G4R2

#DRE - G4R02 Envoi a COME 
# G4R5 Lot2
#DRE G4R6 Lot3
#\DRE G4R6 lot3


###################################
# Variables entieres
#G4R2
#DRE - G4R02 Envoi a COME 
# G4R5 Lot2 
#DRE G4R6 Lot3


###################################
# Variables Pointeurs
#DRE - G4R02 Envoi a COME 
# G4R5 Lot2 
# DRE G4R6 lot3


# Initialisations
b_IDUS_NDIP_860026625	    	= 0
b_NPF_SIP_860026625	    	= 0
b_TETRIS_FU_860026625	    	= 0
b_TETRIS_TRAFBSS_860026625 	= 0
b_TRAFBSScritCOM_860026625 	= 0
bCENTVG_860026625		    	= 0
bCENTDEA_860026625	    	= 0
arFE_860026625		    	= 0
arFERPV_860026625		    	= 0
bFE_860026625			= 0
bFERPV_860026625		    	= 0
bIDUS_NUM_860026625	    	= 0
bRDIP_SVTR_860026625	    	= 0
bSC_860026625			= 0
bTRAFIC_860026625		    	= 0
CATDC_860026625		    	= 0
CAX_860026625			= 0
CCD_860026625			= 0
CCD_REEL_860026625	    	= 0
CODCIR_860026625		    	= 0
code_CFR_860026625	    	= 0
code_errone_860026625	    	= 0
CPT_REDIST_860026625	    	= 0
DATE_GMT_860026625	    	= 0
DATE_GMT_HDEB_860026625   	= 0
DATE_LOCALE_860026625	    	= 0
DATE_LOCALE_HDEB_860026625 	= 0
ddebut_860026625		    	= 0
dduree_860026625		    	= 0
DECO_INF_860026625	    	= 0
DECO_TRAF_860026625	    	= 0
dpivot_860026625		    	= 0
EPORTABILITE_860026625    	= 0
EPORTABILITE_SCP_860026625 	= 0
erreur_860026625		    	= 0
bFACTURABLE_860026625	    	= 0
GCOM_NAD_860026625	    	= 0
ICAR_P_860026625		    	= 0
ICAR_REF_860026625	    	= 0
ICAR_S_860026625		    	= 0
IDUS_TOPE_860026625	    	= 0
IDUS_TRAF_860026625	    	= 0
inst42L_860026625		    	= 0
instBSS_860026625		    	= 0
instCENTVG_860026625	    	= 0
instDM_860026625		    	= 0
instECCv_860026625	    	= 0
instFE_860026625		    	= 0
instFERPV_860026625	    	= 0
instNPF_860026625		    	= 0
instSC_860026625		    	= 0
instSYMPH_860026625	    	= 0
instTRAFBSS1_860026625    	= 0
instTRAFBSS2_860026625    	= 0
instTRAFIC_860026625	    	= 0
instVGA_860026625		    	= 0
#G4R2
instOPEN_860026625	    	= 0
instVGAIP_860026625	    	= 0
L_COMPTE_NPF_860026625    	= 0
L_NDR_860026625		    	= 0
lg_dede_860026625		    	= 0
MER_860026625			= 0
NB_CSV_860026625		    	= 0
numzone_860026625		    	= 0
RDIP_SVTR_1_860026625	    	= 0
REF_860026625			= 0
res_860026625			= 0
SCATDC_860026625		    	= 0
SERVICE_860026625		    	= 0
SPORTABILITE_860026625    	= 0
SPORTABILITE_SCP_860026625 	= 0
SUP_860026625			= 0
TRAA_DCONV_860026625	    	= 0
TRAA_HDEB_860026625	    	= 0
TRAA_NUTC_860026625	    	= 0
TRAA_NUTR_860026625	    	= 0
TREP_DURCONV_860026625    	= 0
TYPAR_Etelephonie_860026625 	= 0
TYPAR_FE_860026625	    	= 0
TYPCOM_860026625		    	= 0
V1S_860026625			= 0
val_860026625			= 0
VGA_860026625			= 0
TYPAR_SIPFE_860026625	    	= 0
TYPCOM_fct_860026625	    	= 0
b_arretfct_centaure_860026625 	= 0
instCENTDEA_860026625	   	= 0
SIP_Fibre_860026625	   	= 0
RETOUR_CORR_860026625	    	= 0
CORR_118ALADUREE_860026625 	= 0
ID_CORR_860026625		    	= 0
nelem_860026625		    	= 0
TYPAR_BIV_SIP_860026625		= 0
b_CodOperVG_860026625	    	= 0
b_FFMV2_860026625		    	= 0
b_FFMV3_860026625		    	= 0
b_OperNBE_860026625	    	= 0
b_FERPV_860026625		    	= 0
b_FERPV_NBE_860026625	    	= 0
date_table_860026625	    	= 0
# G4R5 Lot2 b_ODEBI	= 0

#DRE - G4R02 Envoi a COME 
instCOME_860026625		= 0
instELIGIBLE_860026625		= 0
b_InfoC_COME_NDI_860026625	= 0
b_InfoC_ELIGIBLE_NDI_860026625 	= 0
b_COME_860026625		    	= 0
b_ELIGIBLE_860026625	    	= 0
Valeur_860026625 			= 0
Nbut_COME_860026625		= 0
b_FERPV_COME_860026625		= 0
instCOME_ELIGIBLE_860026625	= 0
# G4R5 Lot2 
b_BANIP_860026625 		= 0
#DRE G4R6 Lot3
Date_CPS_860026625 		= 0
instALICE_860026625 		= -1
longueur_860026625 		= 0
b_FERPV_860026625 		= 0
typ_ctr_860026625			= 0
bREDIST_SVA_860026625		= 0
b_TRAFBSS1_860026625 		= 0
b_TRAFBSS2_860026625 		= 0


# Allocation de memoire pour le buffeur
pt_basTRAFIC_860026625	 = "345678901234567890123456789012"
pt_BUF_860026625			 = "pt_BUF666666123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890666666123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
pt_C_CSV1_860026625		 = "32568985478"
pt_CATDC_860026625		 = "923"
pt_CLE_860026625			 = "852369515182"
pt_CODE_DEUR_860026625	 = "434F44455F444555520000000000000000000000000000000"
pt_CODE_FU_860026625		 = "2525"
pt_CodeOp_860026625		 = "12554911111111111111"
pt_CodeOp_SCP_860026625	 = "62488522222222222222"
pt_COMPTE_NPF_860026625	 ="232323232323232323232323232323232323232323232323232333333333333"
pt_CSV_860026625			 = "24567457424167433546121657446574151245754857"
pt_DECO_DIST_NUM_860026625 = "145698745632100000000000000000000000000000000000000"
pt_DECO_NUM_860026625		 = "745856932561444444444444444444444444444444444444444"
pt_DECO_TEMP_860026625	 = "101020303536411111111111111111111111111111111111111"
pt_DEDE_DIST_N_860026625	 = "102581256946211111111111111111111111111111111111111"
pt_DEDE_NUM_860026625		 = "942568418552222222222222222222222222222222222222222"
pt_ECCFACT_860026625		 = "687128512128555225254532585"
pt_GCOM_IDRSG_860026625	 = "9562487441878417846416666666666"
pt_GCOM_PALNUM_860026625	 = "632"
pt_IDCORREL_860026625		 = "13812882345858265841389129888888888888888888888888888888888888"
pt_IDSRT_860026625		 = "4585745845786248772261111111111111111111111111111111"
pt_IDUS_NDRTC_860026625	 = "748174817481748174817481748174817481748174817481748174817481748174817481748174817481748174817481"
pt_IDUS_NUM_860026625		 = "62819756812568568422385841277777777777777777777777777777777777"
pt_InfoCompl_860026625	 = "5682145578445496325855411"
pt_instDM_860026625		 = "80156532530145"
pt_instTRAFIC_860026625	 = "325415897"
pt_LIBELREDIST_860026625	 = "pt_LIBELREDIST7890123456789012345678901234"
pt_BANIP_RTC_860026625		 = "56565656565656565656353535353535353535353535353535353535353535353535353535353535353535353535353535"
pt_NDS_NUM_860026625		 = "5682463844"
pt_NUM_860026625			 = "125674100886324786521478652222886321748752698412354"
pt_NUMDDR_860026625		 = "3541284752247855114785114522584118521154852202585215"
pt_OFFRE_860026625		 = "314159265358979285625851178636"
pt_OP_CSV1_860026625		 = "98336541185"
pt_OPERA_860026625		 = "299792510818563228565332124741"
pt_RDIP_SVTR_860026625	 = "271828182800000000000000000000"
pt_REF_860026625			 = "65289"
pt_RES1_860026625			 = "3578357835783578357835783578357835783578"
pt_SCATDC_860026625		 = "566"
pt_SERVICE_860026625		 = "6767"
pt_SGTQS_860026625		 = "6284569821355"
pt_SIP_ECC_860026625		 = "3164852"
pt_TARIF_860026625		 = "4444444444444444444444444444444444444444444444444444444444444"
pt_temp_860026625			 = "3258271185105882785296963298619746713207547914608971"
pt_temp2_860026625		 = "5827118510588278529696329861974671320754791460897133"
pt_TETRIS_compte_860026625 = "776677667766776677667766776677667766"
pt_TETRIS_RTC_860026625	 = "2828282828282828282828282828"
pt_TRAFIC_860026625		 = "55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"
pt_TYPOFFRE_860026625		 = "98200000000000000000"
pt_VGA_OF_860026625		 = "147852369852149456784524987648"
pt_VGA_OP_860026625		 = "326598458715798746878745454457"
pt_NM3_OP_860026625		 = "504E4D334F504E4D334F50"
pt_NM3_OF_860026625		 = "464E4D334F464E4D334F46"
pt_OPT_RTC_860026625		 = "pt_OPT_RTC333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"
pt_OPT_ECC_860026625		 = "pt_OPT_ECC4321"
pt_buffer_860026625		 = "pt_buffer123"
pt_Support_860026625		 = "pt_Suppory23413214"
#pt_cascorr		 = "pt_cascorr1234567890"
pt_REPONSE_860026625		 = "pt_REPONSE99999999999999999999999"
pt_CodOperVG_860026625	 = "pt_CodOperVG97197197179991791797197197197190971917917"
pt_CodOffreVG_860026625	 = "pt_CodOffreVG 8618681681686186186186186186816816816816"
pt_TEMP_860026625		 = "pt_TEMP097097609765096549765409129129129129129129192991299129912991928912899129918291291"
pt_datODEBI_860026625		 = "pt_datODEBI93459345934593457654398767854875634357365332489263323432"
#DRE - G4R02 Envoi a COME 
pt_NDI_860026625			 = "pt_NDI792510818563228565332124741"
pt_CallType_860026625		 = "pt_CallType123"
pt_TeleService_860026625	 = "pt_TeleService"
# G4R5 Lot2 
pt_ECCv_860026625		 = "2121212121212121212121212121212121212121"
pt_RTC_MAY_860026625		 = "pt_RTC_MAY09876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321"
# DRE G4R6 lot3
pt_MESSAGE_860026625 = "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_860026625	 = "pt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDISTpt_LIBELREDIST"
pt_CODE_TARIF_860026625 	 = "pt_CODE_TARIFpt_CODE_TARIF"
pt_TYPE_EDIT_860026625	 = "pt_TYPE_EDIT"
pt_NORM_860026625		 = "389389389389389389996200258997115447999945899"



# Initialisations
i_strcpy(pt_basTRAFIC_860026625, "")
i_strcpy(pt_BUF_860026625 , "")
i_strcpy(pt_C_CSV1_860026625, "")
i_strcpy(pt_CATDC_860026625, "")
i_strcpy(pt_CLE_860026625, "")
i_strcpy(pt_CODE_DEUR_860026625 , " ")
i_strcpy(pt_CODE_FU_860026625, "")
i_strcpy(pt_CodeOp_860026625, "")
i_strcpy(pt_CodeOp_SCP_860026625, "")
i_strcpy(pt_COMPTE_NPF_860026625, "")
i_strcpy(pt_CSV_860026625, "")
i_strcpy(pt_DECO_DIST_NUM_860026625, "")
i_strcpy(pt_DECO_NUM_860026625, "")
i_strcpy(pt_DECO_TEMP_860026625, "")
i_strcpy(pt_DEDE_DIST_N_860026625, "")
i_strcpy(pt_DEDE_NUM_860026625, "")
i_strcpy(pt_ECCFACT_860026625, "")
i_strcpy(pt_GCOM_IDRSG_860026625, "")
i_strcpy(pt_GCOM_PALNUM_860026625, "")
i_strcpy(pt_IDCORREL_860026625, "")
i_strcpy(pt_IDSRT_860026625, "")
i_strcpy(pt_IDUS_NDRTC_860026625, " ")
i_strcpy(pt_IDUS_NUM_860026625, "")
i_strcpy(pt_InfoCompl_860026625, " ")
i_strcpy(pt_instDM_860026625, "")
i_strcpy(pt_instTRAFIC_860026625, "")
i_strcpy(pt_BANIP_RTC_860026625, " ")
i_strcpy(pt_NDS_NUM_860026625, "")
i_strcpy(pt_NUM_860026625, "")
i_strcpy(pt_NUMDDR_860026625, "")
i_strcpy(pt_OFFRE_860026625, "")
i_strcpy(pt_OP_CSV1_860026625, "")
i_strcpy(pt_OPERA_860026625, "")
i_strcpy(pt_RDIP_SVTR_860026625, "")
i_strcpy(pt_REF_860026625, "")
i_strcpy(pt_RES1_860026625, "")
i_strcpy(pt_SCATDC_860026625, "")
i_strcpy(pt_SERVICE_860026625, "")
i_strcpy(pt_SGTQS_860026625, "")
i_strcpy(pt_SIP_ECC_860026625, "")
i_strcpy(pt_TARIF_860026625, "")
i_strcpy(pt_temp_860026625, "")
i_strcpy(pt_temp2_860026625, "")
i_strcpy(pt_TETRIS_compte_860026625, " ")
i_strcpy(pt_TETRIS_RTC_860026625, " ")
i_strcpy(pt_TRAFIC_860026625, "")
i_strcpy(pt_TYPOFFRE_860026625, "")
i_strcpy(pt_VGA_OF_860026625, "")
i_strcpy(pt_VGA_OP_860026625, "")
i_strcpy(pt_NM3_OP_860026625, "")
i_strcpy(pt_NM3_OF_860026625, "")
i_strcpy(pt_OPT_RTC_860026625," ")
i_strcpy(pt_OPT_ECC_860026625, "")
i_strcpy(pt_buffer_860026625, "     ")
i_strcpy(pt_Support_860026625, "")
i_strcpy(pt_CodOperVG_860026625, "")
i_strcpy(pt_CodOffreVG_860026625, "")
i_strcpy(pt_TEMP_860026625, "")
i_strcpy(pt_datODEBI_860026625," ")
# VerifPcode
i_strcpy(pt_LIBELREDIST_860026625," ")
#i_strcpy(pt_cascorr," ")
i_strcpy(pt_REPONSE_860026625,"")
#DRE - G4R02 Envoi a COME 
i_strcpy(pt_NDI_860026625, "")
i_strcpy(pt_CallType_860026625, "")
i_strcpy(pt_TeleService_860026625, "")
# G4R5 Lot2 
i_strcpy(pt_ECCv_860026625, "")
i_strcpy(pt_RTC_MAY_860026625, "")
# DRE G4R6 lot3
i_strcpy(pt_MESSAGE_860026625, "")
i_strcpy(pt_CODE_TARIF_860026625 , "    ")
i_strcpy(pt_TYPE_EDIT_860026625 , " ")
i_strcpy(pt_LIBELREDIST_860026625,"")
i_strcpy(pt_NORM_860026625,"")


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

erreur_860026625 = i_cree_art(C_Conversion_860026625, g_iartout2)
CPT_REDIST_860026625 = i_LireRedistCpt()

#trace(" *********** pcode de distri Tri2g118HPB ************")

############################################################################
# 	Variables fonctionnelles
############################################################################

dduree_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::dduree)
ddebut_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::ddebut)
dpivot_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::dpivot)

# Init de numzone si IDUS_NUM ABSENT
numzone_860026625 = 7
numzone_860026625 = i_DHgetZoneID(NUMTABSEL_860026625, g_iartin)

# SGTQS
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDPCS, pt_SGTQS_860026625)

# Test retour de correlation Param FTSA-G3R12Cx
#trace1("__FILE__:__LINE__ #### DIST: GIPT: <%d>", g_ipt)
SI (g_ipt == PT_CORRELE)
ALORS
	RETOUR_CORR_860026625 = 1
	trace("__FILE__:__LINE__ ##### RETOUR_CORR ###### ")
FINSI
#trace1("<<<__FILE__:__LINE__>>> #### Valeur de : RETOUR_CORR: <%d>", RETOUR_CORR)

# Pointeur pt_DEDE_NUM (NUMNAS)
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DEDE_NUM_860026625)

#DRE - G4R02 Envoi a COME 
# Recuperation de la date d audit pour envoi a COME
DATE_AUDIT_GMT_860026625 = i_date_audit()
DATE_AUDIT_860026625 = i_DHgetLocalTime(NUMTAB1_860026625, ZONEMETRO_860026625, DATE_AUDIT_GMT_860026625)

# DATE_GMT
DATE_GMT_860026625 = i_DHgetCe2gTime(NUMTAB_860026625, ZONEMETRO_860026625, ddebut_860026625)

# DATE_LOCALE
DATE_LOCALE_860026625 = i_DHgetLocalTime(NUMTAB_860026625, numzone_860026625, ddebut_860026625)
SI (DATE_LOCALE_860026625 == 0)
ALORS
	code_errone_860026625 = 0xA080
	erreur_860026625 = i_PlvMessEmettre(8600, 2, g_iartin, "", 3, code_errone_860026625, C_Article_860026625, "i_DHgetLocalTime/DATE LOCALE")
	SAUT DISTRI_ERR
FINSI

# DATE_GMT_HDEB et DATE_LOCALE_HDEB
SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_HDEB) == 1)
ALORS
	TRAA_HDEB_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_HDEB)
	SI TRAA_HDEB_860026625 == -1
	ALORS
		# Cree pour envoi en correl a supprimer
		erreur_860026625 = i_supprChamp(g_iartin, "T3TRAA_HDEB")
	SINON
		DATE_LOCALE_HDEB_860026625 = i_DHgetLocalTime(NUMTAB_860026625, numzone_860026625, TRAA_HDEB_860026625)
		SI (DATE_LOCALE_HDEB_860026625 == 0)
		ALORS
			code_errone_860026625 = 0xA080
			erreur_860026625 = i_PlvMessEmettre(8600, 2, g_iartin, "", 3, code_errone_860026625, C_Article_860026625, "i_DHgetLocalTime/DATE LOCALE TRAA_HDEB")
			SAUT DISTRI_ERR
		FINSI
		DATE_GMT_HDEB_860026625 = i_DHgetCe2gTime(NUMTAB_860026625, ZONEMETRO_860026625, TRAA_HDEB_860026625)
	FINSI
FINSI

# FACTURABLE
IDUS_TOPE_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::IDUS_TOPE)

SI (i_valid_field_n(g_iartin, $Tri2g118HP::RDIP_SVTR) == 1)
ALORS
	bRDIP_SVTR_860026625 = 1
	erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::RDIP_SVTR, pt_RDIP_SVTR_860026625)
	res_860026625= i_strlen(pt_RDIP_SVTR_860026625)
	index_860026625 = 0
	RDIP_SVTR_1_860026625 = 0
	POINT P_FACT

	SI index_860026625 < res_860026625 && index_860026625 < 2
	ALORS
		i_get_sub_str(pt_RDIP_SVTR_860026625, index_860026625, index_860026625, pt_BUF_860026625)
		val_860026625 = i_get_val_num(pt_BUF_860026625, 1, 1)

		SI val_860026625 >= 0x30 && val_860026625 <= 0x39
		ALORS
			val_860026625 = val_860026625 - 0x30
		FINSI

		SI val_860026625 >= 0x41 && val_860026625 <= 0x46
		ALORS
			val_860026625 = val_860026625 - 0x37
		FINSI

		SI val_860026625 >= 0x61 && val_860026625 <= 0x66
		ALORS
			val_860026625 = val_860026625 - 0x57
		FINSI

		SI index_860026625 == 0 && res_860026625 > 1
		ALORS
			val_860026625 = val_860026625 * 0x10
		FINSI
		RDIP_SVTR_1_860026625 = RDIP_SVTR_1_860026625 + val_860026625
		index_860026625 = index_860026625 + 1
		SAUT P_FACT
	FINSI
SINON
	bRDIP_SVTR_860026625 = 0
FINSI

SI ( ( (IDUS_TOPE_860026625 == 1) && (bRDIP_SVTR_860026625 == 1) && (RDIP_SVTR_1_860026625 == 0x16) ) || ( (IDUS_TOPE_860026625 == 1) && (bRDIP_SVTR_860026625 == 0) ) )
ALORS
	bFACTURABLE_860026625 = 1
SINON
	bFACTURABLE_860026625 = 0
FINSI

#  Si non FACTURABLE on distribue a SYMPHONIE uniquement
SI !bFACTURABLE_860026625
ALORS
	CCD_REEL_860026625 = 20
	i_strcpy(pt_ECCFACT_860026625, " ")
	i_strcpy(pt_VGA_OF_860026625, " ")
	i_strcpy(pt_VGA_OP_860026625, " ")
	i_strcpy(pt_C_CSV1_860026625, " ")
	i_strcpy(pt_OP_CSV1_860026625, " ")
	SAUT P_SYMPH
FINSI

# G4R5 Lot2 
##-----------------------------------------------------------
## Determine si la DATE_GMT est egale ou posteriereure a celle
## retournee par la table TDATODEBI
##------------------------------------------------------------
##trace1 ("<<__LINE__ >> date_GMT = %d ---------",DATE_GMT)
#i_strcpy (pt_datODEBI,i_get_tab_field("TDATODEBI", DATE_GMT, "ODEBI"))
#erreur = i_set_art_str (g_iartout2,$Conversion::DATE_STR,pt_datODEBI)
#date_table = i_get_art_field(g_iartout2, $Conversion::DATE_ASC)
##trace2 ("<< __LINE__>> pt_datODEBI = %s --------",pt_datODEBI,"")
##trace1 ("<< __LINE__>>  date_table = %d ----------",date_table)
#
#SI DATE_GMT >= date_table
#ALORS
#	b_ODEBI = 1
#FINSI

#  MER  Mise en Relation si (CATDC = 0 ou 1) et SCATDC = 2
CATDC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::CATDC)
SCATDC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::SCATDC)

SI ( ( (CATDC_860026625 == 0) || (CATDC_860026625 == 1) ) && (SCATDC_860026625 == 2) )
ALORS
	MER_860026625 = 1
SINON
	MER_860026625 = 0
FINSI

# Presence de IDUS.NUM : en l'absence de IDUS_NUM, l'article n'est distribue qu'a SYMPHONIE
SI ( i_valid_field_n(g_iartin, $Tri2g118HP::IDUS_NUM) == 1 )
ALORS
	bIDUS_NUM_860026625 = 1
SINON
	bIDUS_NUM_860026625 = 0
FINSI

# Rejet si FACTURABLE et IDUS_NUM absent
SI ( bFACTURABLE_860026625 && !bIDUS_NUM_860026625 )
ALORS
	code_errone_860026625 = 0xA080
	erreur_860026625 = i_PlvMessEmettre(8600, 2, g_iartin, "", 3, code_errone_860026625, C_Article_860026625, "FACTURABLE et IDUS_NUM absent")
	SAUT DISTRI_ERR
FINSI

erreur_860026625  = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DEDE_NUM_860026625 )

SI bFACTURABLE_860026625
ALORS
	erreur_860026625  = i_format_str2(pt_temp_860026625 , "%s%s", "RI2G", pt_DEDE_NUM_860026625 )
	i_strcpy(pt_REPONSE_860026625 , i_get_tab_field("118ALADUREE", DATE_GMT_860026625 , pt_temp_860026625 ))

	SI (i_strcmp(pt_REPONSE_860026625 , "") != 0)
	ALORS
		SI ( CATDC_860026625  == 1 )
		ALORS
			CORR_118ALADUREE_860026625  = 1
		FINSI
	FINSI
FINSI
#trace1(">>>__FILE__:__LINE__>>> #### Valeur de : CORR_118ALADUREE : <%d>", CORR_118ALADUREE)

#  Si IDUS_NUM present
SI ( bIDUS_NUM_860026625 == 1 )
ALORS
	erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM, pt_temp_860026625)
	i_get_sub_str(pt_temp_860026625, 0, 1, pt_temp_860026625)
	i_get_sub_str(pt_temp_860026625, 0, 0, pt_temp2_860026625)
	SI ( (i_strcmp(pt_temp_860026625, C_PREF_MLV87_860026625) == 0) || (i_strcmp(pt_temp2_860026625, C_PREF_MLV9_860026625) == 0) )
	ALORS
		b_IDUS_NDIP_860026625 = 1
	SINON
		b_IDUS_NDIP_860026625 = 0
	FINSI

	# Ajout d'une enveloppe E_RPV
	erreur_860026625 = i_add_opt("E_RPV")
	erreur_860026625 = i_set_attr_val_n($E_RPV::CFR, 0)
	erreur_860026625 = i_set_attr_val_n($E_RPV::DATE_M, ddebut_860026625)
	erreur_860026625 = i_set_attr_val_n($E_RPV::TRAI_DDUREE, dduree_860026625)

	# L_NDR longueur de IDUS_NUM
	L_NDR_860026625 = i_get_art_fieldlength(g_iartin, $Tri2g118HP::IDUS_NUM)
	SI (L_NDR_860026625 % 2 == 0)
	ALORS
		L_NDR_860026625 = L_NDR_860026625 / 2
	SINON
		L_NDR_860026625 = L_NDR_860026625 / 2 + 1
	FINSI
	erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM, pt_IDUS_NUM_860026625)

	# VGA impossible si IP
	# Controle presence et recuperation de l'instance du referentiel VGA
	instVGA_860026625 = i_LireInstanceECC(C_INST_VGA_860026625)

	SI (instVGA_860026625 == 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "VGA", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	#G4R2
	# Controle presence et recuperation de l'instance du referentiel OPEN
	instOPEN_860026625 = i_LireInstanceECC(C_INST_OPEN_860026625)

	SI (instOPEN_860026625 == 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "OPEN", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	#/G4R2

	# Controle presence et recuperation de l'instance du referentiel VGAIP
	instVGAIP_860026625 = i_LireInstanceECC(C_INST_VGAIP_860026625)

	SI (instVGAIP_860026625 == 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "VGAIP", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	
#DRE - G4R02 Envoi a COME 
	# Controle presence et recuperation de l'instance du referentiel COME
	instCOME_860026625 = i_LireInstanceECC(C_INST_COME_860026625)

	SI (instCOME_860026625 == 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "COME", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	# Controle presence et recuperation de l'instance du referentiel ELIGIBLE
	instELIGIBLE_860026625 = i_LireInstanceECC(C_INST_ELIGIBLE_860026625)

	SI (instELIGIBLE_860026625 == 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Referentiel ELIGIBLE", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	
	# Controle presence et recuperation de l'instance de l'ECC COME_ELIGIBLE
	instCOME_ELIGIBLE_860026625 = i_LireInstanceECC(C_INST_COME_ELIGIBLE_860026625)

	SI (instCOME_ELIGIBLE_860026625 == 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "ECC COME_ELIGIBLE", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	
#\DRE - G4R02 Envoi a COME 

	# VGA + VGA_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)
	SI (i_EnvoiReqConsTabDist(TD_VGA1_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM) , L_NDR_860026625, 0, 1) != 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026625 = i_LireReqConsTabDist()

	SI erreur_860026625
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	val_860026625 = i_LireInfoECC(instVGA_860026625, 0)

	SI val_860026625
	ALORS
		erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OFFRE_860026625)

		# recuperation de code offre dans pt_CodOffreVG
		SI ( i_strcmp(pt_OFFRE_860026625, g_inull) )
		ALORS
			i_strcpy (pt_CodOffreVG_860026625,pt_OFFRE_860026625)
			erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", "INj", pt_OFFRE_860026625)
			i_strcpy( pt_RES1_860026625, i_get_tab_field("Inter", DATE_GMT_860026625, pt_temp_860026625) )

			SI (i_strcmp(pt_RES1_860026625, "NM3") == 0)
			ALORS
				NM3_860026625 = 1
				i_strcpy(pt_NM3_OF_860026625, pt_OFFRE_860026625)
			SINON
				SI !b_IDUS_NDIP_860026625
				ALORS
					SI (i_strcmp(pt_RES1_860026625, "VGT") != 0)
					ALORS
						VGA_860026625 = 1
						i_strcpy(pt_VGA_OF_860026625, pt_OFFRE_860026625)
					SINON
						VGA_860026625 = 0
						i_strcpy(pt_VGA_OF_860026625, " ")
					FINSI
				SINON
					VGA_860026625 = 0
					i_strcpy(pt_VGA_OF_860026625, " ")
				FINSI
			FINSI
		SINON
			VGA_860026625 = 0
			i_strcpy(pt_VGA_OF_860026625, " ")
		FINSI
	SINON
		VGA_860026625 = 0
		i_strcpy(pt_VGA_OF_860026625, " ")
	FINSI

	SI (i_EnvoiReqConsTabDist(TD_VGA2_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1) != 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026625 = i_LireReqConsTabDist()

	SI erreur_860026625
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	val_860026625 = i_LireInfoECC(instVGA_860026625, 0)
	SI val_860026625
	ALORS
		erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OPERA_860026625)
		SI i_strcmp(pt_OPERA_860026625,g_inull)
		ALORS
			# Valorisation de b_CodOperVG et de pt_CodOperVG
			b_CodOperVG_860026625 = 1
			i_strcpy(pt_CodOperVG_860026625,pt_OPERA_860026625)
			SI (VGA_860026625 || NM3_860026625)
			ALORS
				SI NM3_860026625
				ALORS
					i_strcpy(pt_NM3_OP_860026625, pt_OPERA_860026625)
				SINON
					SI VGA_860026625
					ALORS
						i_strcpy(pt_VGA_OP_860026625, pt_OPERA_860026625)
					SINON
						i_strcpy(pt_VGA_OP_860026625, "")
					FINSI
				FINSI
			SINON
				i_strcpy(pt_VGA_OP_860026625, "")
			FINSI
		FINSI
	FINSI

#G4R2
	# instance OPEN si pas d'instance VGA
	#################################################
	SI (b_CodOperVG_860026625 == 0)
	ALORS
		# VGA	+ VGA_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)

		SI (i_EnvoiReqConsTabDist(TD_VGA1_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM) , L_NDR_860026625, 0, 1) != 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		erreur_860026625 = i_LireReqConsTabDist()

		SI erreur_860026625
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		val_860026625 = i_LireInfoECC(instOPEN_860026625, 0)

		SI val_860026625
		ALORS
			erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OFFRE_860026625)
			# recuperation de code offre dans pt_CodOffreVG
			SI (i_strcmp(pt_OFFRE_860026625, g_inull))
			ALORS
				i_strcpy (pt_CodOffreVG_860026625,pt_OFFRE_860026625)
				erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", "INj", pt_OFFRE_860026625)
				i_strcpy(pt_RES1_860026625, i_get_tab_field("Inter", DATE_GMT_860026625, pt_temp_860026625))

				SI (i_strcmp(pt_RES1_860026625, "NM3") == 0)
				ALORS
					NM3_860026625 = 1
					i_strcpy(pt_NM3_OF_860026625, pt_OFFRE_860026625)
				SINON
					SI !b_IDUS_NDIP_860026625
					ALORS
						SI (i_strcmp(pt_RES1_860026625, "VGT") != 0)
						ALORS
							VGA_860026625 = 1
							i_strcpy(pt_VGA_OF_860026625, pt_OFFRE_860026625)
						SINON
							VGA_860026625 = 0
							i_strcpy(pt_VGA_OF_860026625, " ")
						FINSI
					SINON
						VGA_860026625 = 0
						i_strcpy(pt_VGA_OF_860026625, " ")
					FINSI
				FINSI
			SINON
				VGA_860026625 = 0
				i_strcpy(pt_VGA_OF_860026625, " ")
			FINSI
		SINON
			VGA_860026625 = 0
			i_strcpy(pt_VGA_OF_860026625, " ")
		FINSI

		SI (i_EnvoiReqConsTabDist(TD_VGA2_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1) != 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		erreur_860026625 = i_LireReqConsTabDist()

		SI erreur_860026625
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		val_860026625 = i_LireInfoECC(instOPEN_860026625, 0)

		SI val_860026625
		ALORS
			erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OPERA_860026625)

			SI i_strcmp(pt_OPERA_860026625,g_inull)
			ALORS
				# Valorisation de b_CodOperVG et de pt_CodOperVG
				b_CodOperVG_860026625 = 1
				i_strcpy(pt_CodOperVG_860026625,pt_OPERA_860026625)

				SI (VGA_860026625 || NM3_860026625)
				ALORS
					SI NM3_860026625
					ALORS
						i_strcpy(pt_NM3_OP_860026625, pt_OPERA_860026625)
					SINON
						SI VGA_860026625
						ALORS
							i_strcpy(pt_VGA_OP_860026625, pt_OPERA_860026625)
						SINON
							i_strcpy(pt_VGA_OP_860026625, "")
						FINSI
					FINSI
				SINON
					i_strcpy(pt_VGA_OP_860026625, "")
				FINSI
			FINSI
		FINSI
	FINSI

	# valorisation de FFMV2 - FFMV3
	SI b_CodOperVG_860026625
	ALORS
		erreur_860026625 = i_format_str2( pt_TEMP_860026625, "%s%s", "INj", pt_CodOffreVG_860026625)

		SI ( i_strcmp( i_get_tab_field("Inter", DATE_GMT_860026625, pt_TEMP_860026625),"VGT+") == 0 )
		ALORS
			b_FFMV2_860026625 = 1
		SINON
			SI (i_strcmp( i_get_tab_field("Inter", DATE_GMT_860026625, pt_TEMP_860026625),"FFMV3") == 0 )
			ALORS
				b_FFMV3_860026625 = 1
			FINSI
		FINSI
	FINSI

	# valorisation de b_OperNBE indique si operateur eligible au NBE
	SI b_CodOperVG_860026625
	ALORS
		i_strcpy(pt_TEMP_860026625,"")
		erreur_860026625 = i_format_str2( pt_TEMP_860026625, "%s%s", "INm", pt_CodOperVG_860026625)
		SI ( i_strcmp( i_get_tab_field("Inter", DATE_GMT_860026625, pt_TEMP_860026625),g_inull) != 0 )
		ALORS
			b_OperNBE_860026625 = 1
		FINSI
	FINSI
#/G4R2

	# instance VGAIP si pas d'instance OPEN
	#################################################
	SI (b_CodOperVG_860026625 == 0)
	ALORS
		# VGA	+ VGA_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)

		SI (i_EnvoiReqConsTabDist(TD_VGA1_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM) , L_NDR_860026625, 0, 1) != 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		erreur_860026625 = i_LireReqConsTabDist()

		SI erreur_860026625
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		val_860026625 = i_LireInfoECC(instVGAIP_860026625, 0)

		SI val_860026625
		ALORS
			erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OFFRE_860026625)
			# recuperation de code offre dans pt_CodOffreVG
			SI (i_strcmp(pt_OFFRE_860026625, g_inull))
			ALORS
				i_strcpy (pt_CodOffreVG_860026625,pt_OFFRE_860026625)
				erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", "INj", pt_OFFRE_860026625)
				i_strcpy(pt_RES1_860026625, i_get_tab_field("Inter", DATE_GMT_860026625, pt_temp_860026625))

				SI (i_strcmp(pt_RES1_860026625, "NM3") == 0)
				ALORS
					NM3_860026625 = 1
					i_strcpy(pt_NM3_OF_860026625, pt_OFFRE_860026625)
				SINON
					SI !b_IDUS_NDIP_860026625
					ALORS
						SI (i_strcmp(pt_RES1_860026625, "VGT") != 0)
						ALORS
							VGA_860026625 = 1
							i_strcpy(pt_VGA_OF_860026625, pt_OFFRE_860026625)
						SINON
							VGA_860026625 = 0
							i_strcpy(pt_VGA_OF_860026625, " ")
						FINSI
					SINON
						VGA_860026625 = 0
						i_strcpy(pt_VGA_OF_860026625, " ")
					FINSI
				FINSI
			SINON
				VGA_860026625 = 0
				i_strcpy(pt_VGA_OF_860026625, " ")
			FINSI
		SINON
			VGA_860026625 = 0
			i_strcpy(pt_VGA_OF_860026625, " ")
		FINSI

		SI (i_EnvoiReqConsTabDist(TD_VGA2_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1) != 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		erreur_860026625 = i_LireReqConsTabDist()

		SI erreur_860026625
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		val_860026625 = i_LireInfoECC(instVGAIP_860026625, 0)

		SI val_860026625
		ALORS
			erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OPERA_860026625)

			SI i_strcmp(pt_OPERA_860026625,g_inull)
			ALORS
				# Valorisation de b_CodOperVG et de pt_CodOperVG
				b_CodOperVG_860026625 = 1
				i_strcpy(pt_CodOperVG_860026625,pt_OPERA_860026625)

				SI (VGA_860026625 || NM3_860026625)
				ALORS
					SI NM3_860026625
					ALORS
						i_strcpy(pt_NM3_OP_860026625, pt_OPERA_860026625)
					SINON
						SI VGA_860026625
						ALORS
							i_strcpy(pt_VGA_OP_860026625, pt_OPERA_860026625)
						SINON
							i_strcpy(pt_VGA_OP_860026625, "")
						FINSI
					FINSI
				SINON
					i_strcpy(pt_VGA_OP_860026625, "")
				FINSI
			FINSI
		FINSI
	FINSI

	# valorisation de FFMV2 - FFMV3
	SI b_CodOperVG_860026625
	ALORS
		erreur_860026625 = i_format_str2( pt_TEMP_860026625, "%s%s", "INj", pt_CodOffreVG_860026625)

		SI ( i_strcmp( i_get_tab_field("Inter", DATE_GMT_860026625, pt_TEMP_860026625),"VGT+") == 0 )
		ALORS
			b_FFMV2_860026625 = 1
		SINON
			SI (i_strcmp( i_get_tab_field("Inter", DATE_GMT_860026625, pt_TEMP_860026625),"FFMV3") == 0 )
			ALORS
				b_FFMV3_860026625 = 1
			FINSI
		FINSI
	FINSI

	# valorisation de b_OperNBE indique si operateur eligible au NBE
	SI b_CodOperVG_860026625
	ALORS
		i_strcpy(pt_TEMP_860026625,"")
		erreur_860026625 = i_format_str2( pt_TEMP_860026625, "%s%s", "INm", pt_CodOperVG_860026625)
		SI ( i_strcmp( i_get_tab_field("Inter", DATE_GMT_860026625, pt_TEMP_860026625),g_inull) != 0 )
		ALORS
			b_OperNBE_860026625 = 1
		FINSI
	FINSI




	# Determination si ddeur est client SIP E//
	L_NDR_860026625 = i_conv_ascii_dcb(pt_IDUS_NUM_860026625, pt_temp2_860026625)

	# Envoi requette pour COME, ELIGIBLE, FERPV et FE
	SI (i_EnvoiReqConsTabDist(TD_Fixe, DATE_GMT_860026625, pt_temp2_860026625, L_NDR_860026625, 0, 1) != 0)
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_Fixe", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI


	# FERPV
	instFERPV_860026625 = i_LireInstanceECC(C_InstFERPV_860026625)

	SI (!instFERPV_860026625)
	ALORS
		code_errone_860026625 = 0xA0B0
		code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstFERPV_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	# FE
	instFE_860026625 = i_LireInstanceECC(C_InstFE_860026625)

	SI (!instFE_860026625)
	ALORS
		code_errone_860026625 = 0xA0B0
		code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstFE_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026625 = i_LireReqConsTabDist()

	SI erreur_860026625
	ALORS
		erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist TD_Fixe ", C_Article_860026625, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	#################################################
	#DRE G4R02
	# instance COME si pas d'instance VGAIP
	#################################################
	SI (b_CodOperVG_860026625 == 0)
	ALORS
		val_860026625 = i_LireInfoECC(instCOME_860026625, 0)

		SI val_860026625
		ALORS
# 11/03/13 - DRE - G4R2 QC695 (1)
#			erreur = i_LireChaineInfo(val, 0, 6, pt_NDI)
			erreur_860026625 = i_LireImsiInfo(val_860026625, 0, 6, pt_NDI_860026625)

			SI i_strcmp(pt_NDI_860026625,g_inull) == 0
			ALORS
				code_errone_860026625 = 0xA0B0
				code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
				
				pt_TEMP_860026625 = " trouve dans LAR COME mais aucun NDI associe"
				erreur_860026625 = i_format_str2(pt_BUF_860026625, "AR %s%s",pt_IDUS_NUM_860026625,pt_TEMP_860026625)
				erreur_860026625 = i_PlvMessEmettre(8612, 2, g_iartin, "", 3, code_errone_860026625,C_Article_860026625, pt_BUF_860026625)
				SAUT DISTRI_ERR
			SINON
				b_InfoC_COME_NDI_860026625 = 1
			FINSI	
		FINSI
		
		SI b_InfoC_COME_NDI_860026625 == 0
		ALORS
			val_860026625 = i_LireInfoECC(instELIGIBLE_860026625, 0)
	
			SI val_860026625
			ALORS
# 11/03/13 - DRE - G4R2 QC695 (1)
#				erreur = i_LireChaineInfo(val, 0, 6, pt_NDI)
				erreur_860026625 = i_LireImsiInfo(val_860026625, 0, 6, pt_NDI_860026625)
	
				SI i_strcmp(pt_NDI_860026625,g_inull) == 0
				ALORS
					code_errone_860026625 = 0xA0B0
					code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
					
					pt_TEMP_860026625 = " trouve dans LAR ELIGIBLE mais aucun NDI associe"
					erreur_860026625 = i_format_str2(pt_BUF_860026625, "AR %s%s",pt_IDUS_NUM_860026625,pt_TEMP_860026625)
					erreur_860026625 = i_PlvMessEmettre(8612, 2, g_iartin, "", 3, code_errone_860026625,C_Article_860026625, pt_BUF_860026625)
					SAUT DISTRI_ERR
				FINSI
				b_InfoC_ELIGIBLE_NDI_860026625 = 1
			FINSI
		FINSI
	FINSI
#\DRE G4R02
################################################

	# FERPV			
	val_860026625 = i_LireInfoECC(instFERPV_860026625, 0)
	i_strcpy(pt_InfoCompl_860026625, " ")
	i_strcpy(pt_TYPOFFRE_860026625, " ")
	erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 1, pt_TYPOFFRE_860026625)
	erreur_860026625 = i_LireChaineInfo(val_860026625, 1, 2, pt_InfoCompl_860026625)

	SI (i_strcmp(pt_InfoCompl_860026625,"25") == 0 && i_strcmp(pt_TYPOFFRE_860026625,"6") == 0)
	ALORS
		TYPAR_BIV_SIP_860026625 = 1
	FINSI

	SI ( (i_strcmp(pt_InfoCompl_860026625, "23") == 0) && !b_FFMV3_860026625 )
	ALORS
		TYPAR_SIPFE_860026625 = 1
		 trace1("TYPAR_SIPFE dans FERPV=%d",TYPAR_SIPFE_860026625)
		trace2("valeur de IC = %s",pt_InfoCompl_860026625,"")
		SAUT SIPFE
	SINON
		val_860026625 = i_LireInfoECC(instFE_860026625,0)
		i_strcpy(pt_InfoCompl_860026625, " ")
		erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 2, pt_InfoCompl_860026625)

		SI ( (i_strcmp(pt_InfoCompl_860026625, "23") == 0) && !b_FFMV3_860026625 )
		ALORS
			TYPAR_SIPFE_860026625 = 1
			trace1("TYPAR_SIPFE dans FE=%d",TYPAR_SIPFE_860026625)
			trace2("valeur de IC = %s",pt_InfoCompl_860026625,"")
			SAUT SIPFE
		FINSI
	FINSI

	# NPF_SIP: Determination si demandeur SIP premiere ligne
	instSIP_860026625 = i_LireInstanceECC(C_InstSIP_860026625)

	SI (!instSIP_860026625)
	ALORS
		trace("Pas d'instance pour referentiel SIP")
		code_errone_860026625 = 0xA0B1
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstSIP_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	instOPT_860026625 = i_LireInstanceECC(C_instOPT_860026625)
	SI (!instOPT_860026625)
	ALORS
		trace("Pas d'instance pour referentiel OPT")
		code_errone_860026625 = 0xA0B1
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_instOPT_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	SI (i_EnvoiReqConsTabDist(TD_NPF_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1) != 0)
	ALORS
		trace("Erreur i_EnvoiReqConsTabDist NPF")
		code_errone_860026625 = 0xA0C1
		erreur_860026625 = i_PlvMessEmettre(8607, 2, g_iartin, "", 3, code_errone_860026625, "Erreur i_EnvoiReqConsTabDist NPF ", C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026625 = i_LireReqConsTabDist()
	SI erreur_860026625
	ALORS
		trace1("Erreur i_LireReqConsTabDist NPF: <%d>", erreur_860026625)
		code_errone_860026625 = 0xA0C1
		erreur_860026625 = i_PlvMessEmettre(8607, 2, g_iartin, "", 3, code_errone_860026625, "Erreur i_LireReqConsTabDist NPF", C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	instECCv_860026625 = i_LireEntierECCv(instSIP_860026625)

	res_860026625 = i_LireInfoECC(instSIP_860026625, instECCv_860026625)
	SI (res_860026625 != 0)
	ALORS
		b_NPF_SIP_860026625 = 1
		erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::BassinFacN, instECCv_860026625)
		erreur_860026625 = i_get_art_str(g_iartout2, $Conversion::BassinFacA, pt_SIP_ECC_860026625)
		erreur_860026625 = i_format_str2(pt_CLE_860026625, "%s%s", C_pref_cle_860026625, pt_SIP_ECC_860026625)
		i_strcpy(pt_basTRAFIC_860026625, i_get_tab_field("Inter", dpivot_860026625, pt_CLE_860026625))
		erreur_860026625 = i_set_attr_val_n($E_RPV::CFR, instECCv_860026625)
	SINON
		instECCv_860026625 = i_LireEntierECCv(instOPT_860026625)
		res_860026625 = i_LireInfoECC(instOPT_860026625, instECCv_860026625)
		SI (res_860026625 != 0)
		ALORS
			SI (!b_FFMV3_860026625)
			ALORS
				b_NPF_OPT_860026625 = 1
			FINSI
			erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::BassinFacN, instECCv_860026625)
			erreur_860026625 = i_get_art_str(g_iartout2, $Conversion::BassinFacA, pt_OPT_ECC_860026625)
			erreur_860026625 = i_format_str2(pt_CLE_860026625, "%s%s", C_pref_cle_860026625, pt_OPT_ECC_860026625)
			i_strcpy(pt_basTRAFIC_860026625, i_get_tab_field("Inter", dpivot_860026625, pt_CLE_860026625))
			erreur_860026625 = i_set_attr_val_n($E_RPV::CFR, instECCv_860026625)
			erreur_860026625 = i_LireImsiInfo( res_860026625, 0, 5, pt_OPT_RTC_860026625 )
			i_strcpy(pt_IDUS_NDRTC_860026625, pt_OPT_RTC_860026625)
			#trace2("<<__LINE__>> Resultat de i_LireImsiInfo pt_OPT_RTC : <%s>", pt_OPT_RTC, "")
		FINSI
	FINSI

	SI b_NPF_SIP_860026625
	ALORS
		b_TETRIS_TRAFBSS_860026625 = 0
		i_strcpy(pt_TETRIS_compte_860026625, " ")
		b_TETRIS_FU_860026625 = 0
		i_strcpy(pt_TETRIS_RTC_860026625, " ")
		b_IDUS_NDIP_860026625 = 0
		erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM, pt_IDUS_NDRTC_860026625)
		# G4R5 Lot2
		i_strcpy(pt_BANIP_RTC_860026625," ")
		i_strcpy(pt_CODE_DEUR_860026625 ," ")
		V1S_860026625 = 0
	SINON
		SI b_NPF_OPT_860026625
		ALORS
			i_strcpy(pt_TETRIS_compte_860026625,"" )
			# TETRIS_woo faux -> b_TETRIS_TRAFBSS = 0
			b_TETRIS_TRAFBSS_860026625 = 0
			b_TETRIS_FU_860026625  = 0
			i_strcpy(pt_TETRIS_RTC_860026625, " ")
			# G4R5 Lot2
			i_strcpy(pt_BANIP_RTC_860026625, " ")
			i_strcpy(pt_IDUS_NDRTC_860026625, pt_OPT_RTC_860026625)
			V1S_860026625 = 0
		SINON
			b_TETRIS_TRAFBSS_860026625 = 0
			i_strcpy(pt_TETRIS_compte_860026625, " ")
			SI (!NM3_860026625 && !b_FFMV3_860026625)
			ALORS
				instBSS_860026625 = i_LireInstanceECC(C_InstBSS_860026625)
				SI (!instBSS_860026625)
				ALORS
					code_errone_860026625 = 0xA0B1
					erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstBSS_860026625, C_Article_860026625)
					SAUT DISTRI_ERR
				SINON
					# pt_TETRIS_compte
					SI (i_EnvoiReqConsTabDist( TD_BSS_860026625, DATE_GMT_860026625,i_get_art_fieldptr(g_iartin,$Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1)!= 0)
					ALORS
						trace("Erreur i_EnvoiReqConsTabDist BSS")
						SAUT DISTRI_ERR
					FINSI

					# Recherche instance NPF
					instNPF_860026625 = i_LireInstanceECC(C_InstNPF_860026625)
					SI (!instNPF_860026625)
					ALORS
						code_errone_860026625 = 0xA0B1
						erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstNPF_860026625, C_Article_860026625)
						SAUT DISTRI_ERR
					FINSI

					erreur_860026625 = i_LireReqConsTabDist()
					SI ( erreur_860026625 != 0 )
					ALORS
						trace1("Erreur i_LireReqConsTabDist BSS: <%d>", erreur_860026625)
						SAUT DISTRI_ERR
					FINSI

					res_860026625 = i_LireInfoECC(instBSS_860026625, 0)
					SI (res_860026625 != 0)
					ALORS
						b_TETRIS_TRAFBSS_860026625 = 1
						erreur_860026625 = i_LireImsiInfo(res_860026625, 0, 8, pt_TETRIS_compte_860026625)
						L_COMPTE_NPF_860026625 = i_conv_ascii_dcb(pt_TETRIS_compte_860026625, pt_COMPTE_NPF_860026625)

						SI (L_COMPTE_NPF_860026625 > 0)
						ALORS
							res_860026625 = i_EnvoiReqConsTabDist(TD_NPF_860026625, DATE_GMT_860026625, pt_COMPTE_NPF_860026625, L_COMPTE_NPF_860026625, 0, 1)

							SI (res_860026625 !=0)
							ALORS
								code_errone_860026625 = 0xA080
								erreur_860026625 = i_PlvMessEmettre(8600, 2, g_iartin, "", 3, code_errone_860026625, C_Article_860026625, "i_EnvoiReqConsTabDist NPF")
								SAUT DISTRI_ERR
							SINON
								res_860026625 = i_LireReqConsTabDist()
								instECCv_860026625 = i_LireEntierECCv(instNPF_860026625)
								res_860026625 = i_LireInfoECC(instNPF_860026625, instECCv_860026625)

								SI (res_860026625 != 0)
								ALORS
									# FU et TETRIS_RTC
									erreur_860026625=i_LireChaineInfo(res_860026625, 5, 1, pt_CODE_FU_860026625)

									SI !i_strcmp(pt_CODE_FU_860026625, C_FU_860026625)
									ALORS
										b_TETRIS_FU_860026625 = 1
									FINSI
									erreur_860026625 = i_LireImsiInfo(res_860026625, 0, 5, pt_TETRIS_RTC_860026625)
									i_strcpy(pt_IDUS_NDRTC_860026625, pt_TETRIS_RTC_860026625)
								SINON
									erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM, pt_IDUS_NDRTC_860026625)
								FINSI
							FINSI
						FINSI
					FINSI
				FINSI
			FINSI

			# TRAFBSS1 ou TRAFBSS2 destinataire
			SI (bFACTURABLE_860026625 && b_TETRIS_TRAFBSS_860026625 && !b_TETRIS_FU_860026625 && !NM3_860026625 && !b_FFMV3_860026625 && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625) )
			ALORS
				instTRAFBSS1_860026625 = i_LireInstanceECC(C_InstTRAFBSS1_860026625)

				SI (!instTRAFBSS1_860026625)
				ALORS
					code_errone_860026625 = 0xA0B1
					erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstTRAFBSS1_860026625, C_Article_860026625)
					SAUT DISTRI_ERR
				FINSI
				instTRAFBSS2_860026625 = i_LireInstanceECC(C_InstTRAFBSS2_860026625)

				SI (!instTRAFBSS2_860026625)
				ALORS
					code_errone_860026625 = 0xA0B1
					erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstTRAFBSS2_860026625, C_Article_860026625)
					SAUT DISTRI_ERR
				FINSI
				b_TRAFBSScritCOM_860026625 = 1

				SI(i_strplcmp(pt_TETRIS_compte_860026625, "1", 0, 1) == 0)
				ALORS
					i_strcpy(pt_ECCFACT_860026625, C_TRAFBSS1FACT_860026625)
#DRE G4R6 QC816
					b_TRAFBSS1_860026625 = 1
#					erreur = i_AjouterCouranteECC(instTRAFBSS1)
				SINON
					i_strcpy(pt_ECCFACT_860026625, C_TRAFBSS2FACT_860026625)
#DRE G4R6 QC816
					b_TRAFBSS2_860026625 = 1
#					erreur =  i_AjouterCouranteECC( instTRAFBSS2)
				FINSI
			FINSI
			#trace2("__LINE__ pt_ECCFACT apres <%s>", pt_ECCFACT)

			inst42L_860026625 = i_LireInstanceECC(C_Inst42L_860026625)
			SI (!inst42L_860026625)
			ALORS
				code_errone_860026625 = 0xA0B1
				erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_Inst42L_860026625, C_Article_860026625)
				SAUT DISTRI_ERR
			FINSI

			SI (i_EnvoiReqConsTabDist(TD_42L, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin,$Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1)!= 0)
			ALORS
				code_errone_860026625 = 0xA0C1
				erreur_860026625 = i_PlvMessEmettre(8607, 2, g_iartin, "", 3, code_errone_860026625, C_REF42L_860026625, C_Article_860026625)
				trace("Erreur i_EnvoiReqConsTabDist")
				SAUT DISTRI_ERR
			FINSI

			erreur_860026625 = i_LireReqConsTabDist()
			SI erreur_860026625
			ALORS
				code_errone_860026625 = 0xA0C1
				erreur_860026625 = i_PlvMessEmettre(8607, 2, g_iartin, "", 3, code_errone_860026625, C_REF42L_860026625, C_Article_860026625)
				SAUT DISTRI_ERR
			FINSI

			erreur_860026625 = i_LireChaineECCv(inst42L_860026625, pt_CODE_DEUR_860026625)
			SI erreur_860026625
			ALORS
				i_strcpy(pt_CODE_DEUR_860026625, "D")
			SINON
				SI (i_strcmp(pt_CODE_DEUR_860026625,"M")!= 0)
				ALORS
					V1S_860026625 = 1
				FINSI
			FINSI

			instECCv_860026625 = i_LireEntierECCv(inst42L_860026625)
			res_860026625 = i_LireInfoECC(inst42L_860026625, instECCv_860026625)

			# NDRTC
			SI b_TETRIS_TRAFBSS_860026625 == 0
			ALORS
				SI (res_860026625 != 0)
				ALORS
					# G4R5 Lot2
					erreur_860026625 = i_LireImsiInfo(res_860026625, 0, 5, pt_BANIP_RTC_860026625)
					i_strcpy(pt_IDUS_NDRTC_860026625, pt_BANIP_RTC_860026625)
					b_BANIP_860026625 = 1

					erreur_860026625 = i_LireChaineInfo(res_860026625, 5, 1, pt_Support_860026625)
					SI (i_strplcmp(pt_Support_860026625 ,"F",0,1) == 0)
					ALORS
						SIP_Fibre_860026625 = 1
					FINSI
				SINON
					SI (b_IDUS_NDIP_860026625 == 1)
					ALORS
						code_errone_860026625 = 0xA0B1
						i_strcpy(pt_LIBELREDIST_860026625, "IDUS_NUM IP inconnu de BANIP")
						# G4R5 Lot2
						i_strcpy(pt_BANIP_RTC_860026625, " ")
						SAUT REDIST
					SINON
						erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM, pt_IDUS_NDRTC_860026625)
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI

	# SUP
	SI ( (V1S_860026625 ==1) || b_TETRIS_FU_860026625 )
	ALORS
		SUP_860026625 = 6
	SINON
		SUP_860026625 = 0
	FINSI

	# VGA impossible si IP
	SI !b_IDUS_NDIP_860026625
	ALORS
		# Controle presence et recuperation de l'instance du referentiel VGA
		instVGA_860026625 = i_LireInstanceECC(C_INST_VGA_860026625)

		SI (instVGA_860026625 == 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "VGA", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		# VGA	+ VGA_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)

		SI (i_EnvoiReqConsTabDist(TD_VGA1_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM) , L_NDR_860026625, 0, 1) != 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		erreur_860026625 = i_LireReqConsTabDist()
		SI erreur_860026625
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		val_860026625 = i_LireInfoECC(instVGA_860026625, 0)
		SI val_860026625
		ALORS
			erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OFFRE_860026625)

			SI (i_strcmp(pt_OFFRE_860026625, g_inull))
			ALORS
				erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", "INj", pt_OFFRE_860026625)
				i_strcpy(pt_RES1_860026625, i_get_tab_field("Inter", DATE_GMT_860026625, pt_temp_860026625))

				SI (i_strcmp(pt_RES1_860026625, "VGT") != 0)
				ALORS
					VGA_860026625 = 1
					i_strcpy(pt_VGA_OF_860026625, pt_OFFRE_860026625)
				SINON
					VGA_860026625 = 0
					i_strcpy(pt_VGA_OF_860026625, " ")
				FINSI
			SINON
				VGA_860026625 = 0
				i_strcpy(pt_VGA_OF_860026625, " ")
			FINSI
		SINON
			VGA_860026625 = 0
			i_strcpy(pt_VGA_OF_860026625, " ")
		FINSI

		# VGA_OP dans la table VGA2 (SI VGA)
		SI VGA_860026625
		ALORS
			SI (i_EnvoiReqConsTabDist(TD_VGA2_860026625, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin, $Tri2g118HP::IDUS_NUM), L_NDR_860026625, 0, 1) != 0)
			ALORS
				erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026625, g_ieec)
				SAUT DISTRI_ERR
			FINSI
			erreur_860026625 = i_LireReqConsTabDist()
			SI erreur_860026625
			ALORS
				erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026625, g_ieec)
				SAUT DISTRI_ERR
			FINSI
			val_860026625 = i_LireInfoECC(instVGA_860026625, 0)
			SI val_860026625
			ALORS
				erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 6, pt_OPERA_860026625)
				i_strcpy(pt_VGA_OP_860026625, pt_OPERA_860026625)
			SINON
				i_strcpy(pt_VGA_OP_860026625, "")
			FINSI
		SINON
			i_strcpy(pt_VGA_OP_860026625, "")
		FINSI

	SINON
		VGA_860026625 = 0
		i_strcpy(pt_VGA_OF_860026625, " ")
		i_strcpy(pt_VGA_OP_860026625, "")
	FINSI
	#trace2("     **************           pt_VGA_OF = %s", pt_VGA_OF, "")
	#trace2("     **************           pt_VGA_OP = %s", pt_VGA_OP, "")

	# Recherche Instances des ECC (sauf Symphonie)

	# Trafic

	instTRAFIC_860026625 = i_LireInstanceECC(C_InstTRAFIC_860026625)
	SI (!instTRAFIC_860026625)
	ALORS
		code_errone_860026625 = 0xA0B0
		code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstTRAFIC_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	# DELTA MINUTE = instTRAFIC

	#CENTAUREVG

	SI VGA_860026625 || NM3_860026625 || b_FFMV3_860026625
	ALORS
		instCENTVG_860026625= i_LireInstanceECC(C_InstCENTVG_860026625)
		SI (!instCENTVG_860026625)
		ALORS
			bCENTVG_860026625 = 0
			code_errone_860026625 = 0xA0B0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstCENTVG_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI
	FINSI

	#CENTAUREDEA

	instCENTDEA_860026625= i_LireInstanceECC(C_InstCENTDEA_860026625)
	SI (!instCENTDEA_860026625)
	ALORS
		bCENTDEA_860026625 = 0
		code_errone_860026625 = 0xA0B0
		code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstCENTDEA_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	# reprendre ici si TYPAR_SIPFE = 1
	POINT SIPFE

	# SC

	instSC_860026625 = i_LireInstanceECC(C_InstSC_860026625)
	SI (!instSC_860026625)
	ALORS
		code_errone_860026625 = 0xA0B0
		code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
		erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstSC_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI

	SI b_NPF_SIP_860026625 || b_NPF_OPT_860026625
	ALORS
		arFERPV_860026625 = 0
		arFE_860026625 = 0
		# instance reelle TRAFIC
		instTRAFIC_860026625 = i_LireInstanceECC(pt_basTRAFIC_860026625)
		SI (!instTRAFIC_860026625)
		ALORS
			code_errone_860026625 = 0xA0B0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, pt_instTRAFIC_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI
		i_strcpy(pt_ECCFACT_860026625, pt_basTRAFIC_860026625)
	SINON
		L_NDR_860026625 = i_conv_ascii_dcb(pt_IDUS_NDRTC_860026625, pt_temp2_860026625)
		SI (i_EnvoiReqConsTabDistDouble(TD_Fixe, TD_Inter, DATE_GMT_860026625, pt_temp2_860026625, L_NDR_860026625, L_NDR_860026625, 1, 0, 1) != 0)
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_Fixe & TD_Inter", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI

		# Fin recherche instances ECC

		erreur_860026625 = i_LireReqConsTabDist()
		SI erreur_860026625
		ALORS
			erreur_860026625 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist TD_Fixe & TD_Inter", C_Article_860026625, g_ieec)
			SAUT DISTRI_ERR
		FINSI
		val_860026625 = i_LireInfoECC(instFERPV_860026625, 0)

		SI ( val_860026625 && !V1S_860026625 && !b_TETRIS_TRAFBSS_860026625 && !VGA_860026625)
		ALORS
			arFERPV_860026625 = 1
			erreur_860026625 = i_LireChaineInfo(val_860026625, 0, 1, pt_TYPOFFRE_860026625)
			i_strcpy(pt_InfoCompl_860026625, " ")
			erreur_860026625 = i_LireChaineInfo(val_860026625, 1, 2, pt_InfoCompl_860026625)

			SI ((i_strcmp(pt_InfoCompl_860026625, "20") == 0 || i_strcmp(pt_InfoCompl_860026625, "25") == 0 ) && !b_FFMV3_860026625)
			ALORS
				TYPAR_Etelephonie_860026625 = 1
			FINSI

		SINON
			val_860026625 = i_LireInfoECC(instFE_860026625, 0)

			SI ( val_860026625 && !V1S_860026625 && !b_TETRIS_TRAFBSS_860026625 && !VGA_860026625 )
			ALORS
				arFE_860026625 = 1
				i_strcpy(pt_BUF_860026625, " ")
				erreur_860026625=i_LireChaineInfo(val_860026625,0,2,pt_BUF_860026625)

				SI (( i_strcmp(pt_BUF_860026625,"20") == 0 || i_strcmp(pt_BUF_860026625,"25") == 0) && !b_FFMV3_860026625)
				ALORS
					TYPAR_FE_860026625=1
				FINSI
			FINSI
		FINSI
		SI (i_strcmp(pt_TYPOFFRE_860026625, "1") == 0)
		ALORS
			SERVICE_860026625 = 1
			i_strcpy(pt_SERVICE_860026625, "1")
		SINON
			SI (i_strcmp(pt_TYPOFFRE_860026625, "2") == 0)
			ALORS
				SERVICE_860026625 = 2
				i_strcpy(pt_SERVICE_860026625, "2")
			SINON
				SERVICE_860026625 = 4
				i_strcpy(pt_SERVICE_860026625, "4")
			FINSI
		FINSI
		val_860026625 = i_LireInfoECC(instSC_860026625, 0)
		SI val_860026625
		ALORS
			bSC_860026625 = 1
		FINSI

		#Traitement du code CFR:
		# G4R5 Lot2
		SI  (!TYPAR_SIPFE_860026625  && (!b_IDUS_NDIP_860026625 || (b_IDUS_NDIP_860026625 && b_TETRIS_FU_860026625) || (i_strcmp(pt_BANIP_RTC_860026625," ")!=0 && i_strcmp(pt_BANIP_RTC_860026625,"")!=0)))
		ALORS
			res_860026625 = i_LireInfoECC(instTRAFIC_860026625, 0)
			SI (res_860026625 != 0)
			ALORS
				i_strcpy(pt_InfoCompl_860026625, " ")
				erreur_860026625 = i_LireChaineInfo(res_860026625, 0, 3, pt_InfoCompl_860026625)

				# code CFR
				code_CFR_860026625 = ((i_LireEntierInfo(res_860026625,0,1) & 0x0F) * 10) + (i_LireEntierInfo(res_860026625,1,1) & 0x0F)
				erreur_860026625 = i_set_attr_val_n( $E_RPV::CFR, code_CFR_860026625)
				# instance reelle TRAFIC
				erreur_860026625 = i_format_str2(pt_instTRAFIC_860026625, "TRAF%s", pt_InfoCompl_860026625,0)
				instTRAFIC_860026625 = i_LireInstanceECC(pt_instTRAFIC_860026625)
				# ECC_FACT est alimente ici si pas NPF_SIP

				SI (!b_TRAFBSScritCOM_860026625)
				ALORS
					i_strcpy(pt_ECCFACT_860026625, pt_instTRAFIC_860026625)
				FINSI

				SI (!instTRAFIC_860026625)
				ALORS
					code_errone_860026625 = 0xA0B0
					code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
					erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, pt_instTRAFIC_860026625, C_Article_860026625)
					SAUT DISTRI_ERR
				FINSI
			SINON
				SI (CPT_REDIST_860026625 < 2 && IDUS_TOPE_860026625 == 1)
				ALORS
					SI !b_TRAFBSScritCOM_860026625
					ALORS
						i_strcpy(pt_LIBELREDIST_860026625, "Indicatif inconnu de MAJ2G")
						SAUT REDIST
					FINSI
				SINON
					SAUT P_SYMPH
				FINSI
			FINSI

			SI !b_TRAFBSScritCOM_860026625
			ALORS
				# instance reelle DELTA MINUTE
				erreur_860026625 = i_format_str2(pt_instDM_860026625, "DM%s", pt_InfoCompl_860026625, 0)
				instDM_860026625 = i_LireInstanceECC(pt_instDM_860026625)
				SI (!instDM_860026625)
				ALORS
					code_errone_860026625 = 0xA0B0
					code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
					erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, pt_instDM_860026625, C_Article_860026625)
					SAUT DISTRI_ERR
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

#trace1("<<<__LINE__:__FILE__<<< bFACTURABLE <%d>", bFACTURABLE)
#trace1("<<<__LINE__:__FILE__<<< b_TETRIS_TRAFBSS <%d>", b_TETRIS_TRAFBSS)
#trace1("<<<__LINE__:__FILE__<<< b_TETRIS_FU <%d>", b_TETRIS_FU)
#trace2("<<<__LINE__:__FILE__<<< pt_TETRIS_compte <%s>", pt_TETRIS_compte , "" )
#trace2("<<<__LINE__:__FILE__<<< pt_ECCFACT avant <%s>", pt_ECCFACT , "" )

# DECO_NUM
SI MER_860026625
ALORS
	SI (i_valid_field_n(g_iartin, $Tri2g118HP::DECO_NUM) == 1)
	ALORS
		erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::DECO_NUM, pt_DECO_NUM_860026625)
	SINON
		erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DECO_NUM_860026625)
	FINSI
SINON
	erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DECO_NUM_860026625)
FINSI

# DECO_INF
SI MER_860026625
ALORS
	DECO_TRAF_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::DECO_TRAF)
	SI ((DECO_TRAF_860026625 == 1) || ( (DECO_TRAF_860026625 == 2) && (i_strlen(pt_DECO_NUM_860026625) > 6 )) || (DECO_TRAF_860026625 == 4) || (DECO_TRAF_860026625 == 6))
	ALORS
		DECO_INF_860026625 = 0x80
	SINON
		SI (DECO_TRAF_860026625 == 5)
		ALORS
			DECO_INF_860026625 =  0xC0
		SINON
			SI (DECO_TRAF_860026625 == 3 || ( (DECO_TRAF_860026625 == 2) && (i_strlen(pt_DECO_NUM_860026625) <= 6)) )
			ALORS
				DECO_INF_860026625 = 0x00
			SINON
				DECO_INF_860026625 = 0x00
			FINSI
		FINSI
	FINSI
FINSI

#DECO_DIST_NUM
SI MER_860026625
ALORS
	SI (DECO_INF_860026625 == 0xC0)
	ALORS
		erreur_860026625 = i_format_str2( pt_DECO_DIST_NUM_860026625, "%s%s", "00", pt_DECO_NUM_860026625)
	SINON
		SI (DECO_INF_860026625 ==0x80)
		ALORS
			erreur_860026625 = i_format_str2( pt_DECO_DIST_NUM_860026625, "%s%s", "0", pt_DECO_NUM_860026625)
		SINON
			i_strcpy(pt_DECO_DIST_NUM_860026625,pt_DECO_NUM_860026625)
		FINSI
	FINSI
SINON
	erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DECO_DIST_NUM_860026625)
FINSI

# EPORTABILITE (Portabilite Entrante SRP) et SPORTABILITE (Portabiliti Sortante SRP) referentiel 45S
SI MER_860026625
ALORS
	i_strcpy(pt_DECO_TEMP_860026625, pt_DECO_NUM_860026625)
	pt_CodeOp_860026625 = CodeOperateurTable6_860026233(DATE_GMT_860026625, pt_DECO_TEMP_860026625, "45S")
	SI (i_strcmp(pt_CodeOp_860026625, "84208") == 0)
	ALORS
		EPORTABILITE_860026625 = 1
		SPORTABILITE_860026625 = 0
	SINON
		EPORTABILITE_860026625 = 0
		SI (pt_CodeOp_860026625 != g_inull)
		ALORS
			SPORTABILITE_860026625 = 1
		SINON
			SPORTABILITE_860026625 = 0
		FINSI
	FINSI
SINON
	EPORTABILITE_860026625 = 0
	SPORTABILITE_860026625 = 0
FINSI

# EPORTABILITE_SCP et SPORTABILITE_SCP
SI MER_860026625
ALORS
	i_strcpy(pt_DECO_TEMP_860026625, pt_DECO_NUM_860026625)
	pt_CodeOp_SCP_860026625 = CodeOperateurTable6_860026233(DATE_GMT_860026625, pt_DECO_TEMP_860026625, "ACLA")
	SI (i_strcmp(pt_CodeOp_SCP_860026625, "84008") == 0)
	ALORS
		EPORTABILITE_SCP_860026625 = 1
		SPORTABILITE_SCP_860026625 = 0
	SINON
		EPORTABILITE_SCP_860026625=0
		SI (pt_CodeOp_SCP_860026625 != g_inull)
		ALORS
			SPORTABILITE_SCP_860026625 = 1
		SINON
			SPORTABILITE_SCP_860026625 = 0
		FINSI
	FINSI
FINSI

# CCD
erreur_860026625 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, IDUS_12_860026625, 5)
lg_dede_860026625 = i_strlen(pt_DECO_DIST_NUM_860026625)
erreur_860026625 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_DECO_DIST_NUM_860026625, lg_dede_860026625 + 1)
g_icopo.TAXE   = 0
g_icopo.CREDIT = 0
erreur_860026625 = i_set_art_date(g_icopo, i_get_art_field(g_iartin, $Tri2g118HP::ddebut))
g_icopo.DUREE  = dduree_860026625
g_icopo.CODE   = CODE_12_860026625
g_icopo.CATEG  = CATEG_12_860026625
g_icopo.SUP[0] = 0
g_icopo.SUP[1] = 0
g_icopo.SUP[2] = 0
g_icopo.SUP[3] = 0
g_icopo.SUP[4] = 0
g_icopo.SUP[RES_CLDEST_860026625] = 0xff
erreur_860026625 = i_comptage(g_icopo, BASE_12_860026625, DATE_LOCALE_860026625)
SI (erreur_860026625 == 0)
ALORS
	CCD_860026625 = g_icopo.SUP[RES_CLDEST_860026625]
	TYPCOM_860026625 = g_icopo.SUP[RES_TYPCOM_860026625]
#DRE G4R6 Lot3
	typ_ctr_860026625 = g_icopo.SUP[RES_TYPCPT_860026625]
	
	SI (pt_TETRIS_compte_860026625 != " ")
	ALORS
		CODCIR_860026625 = g_icopo.SUP[RES_CODCIR_860026625]
	SINON
		CODCIR_860026625 = -1
	FINSI
SINON
	CCD_860026625 = 0
	CODCIR_860026625 = 0
	TYPCOM_860026625 = 0
FINSI

#####################################################################
# 	              Traitement C+S (CPS) table ALICE
#####################################################################
#DRE G4R6 lot3 
#SI (typ_ctr==CPT_CPS_Loc)
#DRE G4R6 QC816
#SI ( typ_ctr==CPT_CPS_RI && (CORR_118ALADUREE == 0 || (CORR_118ALADUREE ==  1 && MER == 0)) )
#DRE G4R6 QC824
SI ( typ_ctr_860026625==CPT_CPS_RI_860026625 && (CORR_118ALADUREE_860026625 == 0 || (CORR_118ALADUREE_860026625 ==  1 && MER_860026625 == 0) || RETOUR_CORR_860026625 ) )
ALORS
	i_strcpy(pt_NORM_860026625,pt_DECO_DIST_NUM_860026625)
	
	i_strcpy(pt_TEMP_860026625, i_get_tab_field( "TDATCPS", DATE_GMT_860026625, C_DATCPS_860026625 ))

	erreur_860026625 = i_set_art_str (g_iartout2,$Conversion::DATE_STR,pt_TEMP_860026625)
	Date_CPS_860026625 = i_get_art_field(g_iartout2, $Conversion::DATE_ASC)
			
	SI ddebut_860026625 < Date_CPS_860026625
	ALORS
		erreur_860026625 = i_format_str2(pt_MESSAGE_860026625," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_NORM_860026625,pt_TEMP_860026625)
		code_errone_860026625 = 0xA082
		erreur_860026625 = i_PlvMessEmettre( 8599, 1, g_iartout,"", 3,code_errone_860026625, C_Article_860026625, pt_MESSAGE_860026625 )
		SAUT ELIMINE_EXP
	SINON
		#######################################
		#  Soumission de la requete de consultation d'une table de distribution ALICE
		#######################################
		SI i_strplcmp (pt_NORM_860026625,"0",0,1) == 0
		ALORS
			i_get_sub_str(pt_NORM_860026625,1,-1,pt_NORM_860026625) 	
		FINSI
		longueur_860026625 = i_conv_ascii_dcb (pt_NORM_860026625, pt_TEMP_860026625)
		SI (i_EnvoiReqConsTabDist( TD_SVA_860026625,DATE_GMT_860026625,pt_TEMP_860026625,longueur_860026625,0,1) != 0)
		ALORS
			#trace("Erreur i_EnvoiReqConsTabDist ALICE")
			bREDIST_SVA_860026625 = 1
			i_strcpy(pt_LIBELREDIST_860026625,"Echec sur i_EnvoiReqConsTabDistDouble ALICE ")
		FINSI
		
		#######################################
		# Recherche de l'instance ECC ALICE
		#######################################
		instALICE_860026625 = i_LireInstanceECC(C_INST_ALICE_860026625)
		SI (!instALICE_860026625)
		ALORS
			#trace("Pas d'instance pour ALICE !")
			erreur_860026625 = i_PlvMessEmettre(8501,1,g_iartout,"",3,C_INST_ALICE_860026625,C_Article_860026625,g_ieec)
			SAUT DISTRI_ERR
		FINSI
		#trace1("instALICE  =<%d>",instALICE)	

		#######################################
		# Lecture Resultat requete ALICE
		#######################################
		erreur_860026625 = i_LireReqConsTabDist()
		#trace1("RETOUR i_LireReqConsTabDist retour requette ALICE, erreur=<%d>",erreur)
		SI ( erreur_860026625 != 0 )
		ALORS
			#trace1( "Erreur i_LireReqConsTabDist ALICE: <%d>", erreur)
			bREDIST_SVA_860026625 = 1
			i_strcpy(pt_LIBELREDIST_860026625,"Echec sur i_LireReqConsTabDistDouble ALICE ")
		FINSI
		val_860026625 = i_LireInfoECC( instALICE_860026625, 0 )
		
		i_strcpy(pt_TEMP_860026625,"")
		SI (val_860026625 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026625 = i_LireChaineInfo( val_860026625, 0, 4, pt_TEMP_860026625 )
			SI i_strcmp(pt_TEMP_860026625,"") != 0
			ALORS
				i_strcpy(pt_CODE_TARIF_860026625,pt_TEMP_860026625)
			SINON
				# info complementaire CODE_TARIF vide
				bREDIST_SVA_860026625 = 1
				erreur_860026625 = i_format_str2(pt_LIBELREDIST_860026625," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NORM_860026625,0)
			FINSI
			
			erreur_860026625 = i_LireChaineInfo( val_860026625, 4, 1, pt_TEMP_860026625 )
			SI i_strcmp(pt_TEMP_860026625,"") != 0
			ALORS
				i_strcpy(pt_TYPE_EDIT_860026625,pt_TEMP_860026625)
			SINON
				# info complementaire TYPE_EDIT vide
				bREDIST_SVA_860026625 = 1
				erreur_860026625 = i_format_str2(pt_LIBELREDIST_860026625," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_NORM_860026625,0)
			FINSI
		SINON
			bREDIST_SVA_860026625 = 1
			erreur_860026625 = i_format_str2(pt_LIBELREDIST_860026625," AR <%s> non trouve dans ALICE",pt_NORM_860026625,0)
		FINSI
	FINSI
FINSI

#DRE G4R6 QC816
#SI bREDIST_SVA == 1
#ALORS
#	SAUT P_SYMPH
#FINSI

#\DRE G4R6 lot3


# TARIF et TRAFIC
SI b_TRAFBSScritCOM_860026625
ALORS
	# TARIF pour BSS avec TYPCOM sans distinction de MER
	erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::BNC_SUP, TYPCOM_860026625)
	erreur_860026625 = i_get_art_str(g_iartout2, $Conversion::BNC_SUP, pt_BUF_860026625)
	i_strcpy(pt_TARIF_860026625, i_get_tab_field("ft_tar_ccd", DATE_GMT_860026625, pt_BUF_860026625))
	#trace2("**************** TARIF  = %s", pt_TARIF, "")

	SI CODCIR_860026625 != -1
	ALORS
		#trace1("**************** CODCIR = %d", CODCIR)
		erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::CODCIRDR, CODCIR_860026625)
		erreur_860026625 = i_get_art_str(g_iartout2, $Conversion::CODCIRDA, pt_BUF_860026625)
		SI (g_iartout2.CODCIRDA[0] == 0)
		ALORS
			SI (g_iartout2.CODCIRDA[1] == 0)
			ALORS
				i_get_sub_str(pt_BUF_860026625,2, 5, pt_BUF_860026625)
			SINON
				i_get_sub_str(pt_BUF_860026625, 1, 5, pt_BUF_860026625)
			FINSI
		SINON
			i_get_sub_str(pt_BUF_860026625, 0, 5, pt_BUF_860026625)
		FINSI
		i_strcpy(pt_TRAFIC_860026625, i_get_tab_field("ft_lib_ct", DATE_GMT_860026625, pt_BUF_860026625))
		#trace2("**************** TRAFIC  = %s", pt_TRAFIC, "")
	SINON
		i_strcpy(pt_TRAFIC_860026625, " ")
	FINSI
FINSI

# CCD_REEL
SI (EPORTABILITE_860026625 == 1)
ALORS
	CCD_REEL_860026625 = 212
SINON
	SI (EPORTABILITE_SCP_860026625 == 1)
	ALORS
		CCD_REEL_860026625 = 218
	SINON
		SI SPORTABILITE_860026625
		ALORS
			CCD_REEL_860026625 = 213
		SINON
			SI  (SPORTABILITE_SCP_860026625 == 1)
			ALORS
				CCD_REEL_860026625 = 219
			SINON
				SI (CCD_860026625 == 0x18)
				ALORS
					CCD_REEL_860026625 = CCD_860026625
				SINON
					CCD_REEL_860026625 = 20
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

# DEDE_DIST_N
SI (MER_860026625 == 0)
ALORS
	erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DEDE_DIST_N_860026625)
SINON
	SI (!VGA_860026625 && (SPORTABILITE_860026625 || (CCD_860026625 == 0x18 && !EPORTABILITE_860026625)))
	ALORS
		erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DEDE_DIST_N_860026625)
	SINON
		SI (i_valid_field_n(g_iartin, $Tri2g118HP::DECO_NUM) == 1)
		ALORS
			erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::DECO_NUM, pt_DEDE_DIST_N_860026625)
		SINON
			erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::NUMNAS, pt_DEDE_DIST_N_860026625)
		FINSI
	FINSI
FINSI

# CAX
IDUS_TRAF_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::IDUS_TRAF)
SI (IDUS_TRAF_860026625 == 0x06)
ALORS
	CAX_860026625 = 2
SINON
	SI (IDUS_TRAF_860026625 == 0x03)
	ALORS
		CAX_860026625 = 3
	SINON
		CAX_860026625 = 1
	FINSI
FINSI

# G4R5 Lot2
SI numzone_860026625 == 4 && ( i_adequation_chaine_expreg (pt_IDUS_NUM_860026625, "^976") == 0 )
ALORS
	SI !b_BANIP_860026625
	ALORS
		inst42L_860026625 = i_LireInstanceECC(C_Inst42L_860026625)
		SI (!inst42L_860026625)
		ALORS
			code_errone_860026625 = 0xA0B1
			erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_Inst42L_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# interrogation de BANIP
		SI (i_EnvoiReqConsTabDist( TD_42L, DATE_GMT_860026625, i_get_art_fieldptr(g_iartin,$Tri2g118::IDUS_NUM), L_NDR_860026625, 0, 1)!=0)
		ALORS
			code_errone_860026625 = 0xA0C0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8607, 2, g_iartin, "", 3, code_errone_860026625, C_REF42L_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI
		erreur_860026625 = i_LireReqConsTabDist()

		SI erreur_860026625 == 0
		ALORS
			# NDRTC
			instECCv_860026625 = i_LireEntierECCv( inst42L_860026625 )
			res_860026625 = i_LireInfoECC( inst42L_860026625, instECCv_860026625 )

			SI ( res_860026625 != 0)
			ALORS
				erreur_860026625 = i_LireImsiInfo( res_860026625, 0, 5, pt_RTC_MAY_860026625 )
			FINSI
		FINSI
	FINSI

	SI b_BANIP_860026625
	ALORS
		res_860026625 = i_conv_ascii_dcb (pt_BANIP_RTC_860026625, pt_TEMP_860026625)
		SI res_860026625 > 1
		ALORS
			erreur_860026625 = i_memcpy_art_field_n(g_iartout2, $Conversion::NDR, pt_TEMP_860026625, res_860026625)
			numzone_860026625 = i_DHgetZoneID(NUMTABSEL1_860026625, g_iartout2)
			erreur_860026625 = i_set_attr_val_n($E_RPV::numzone, numzone_860026625)
		FINSI
	SINON
		res_860026625 = i_conv_ascii_dcb (pt_RTC_MAY_860026625, pt_TEMP_860026625)
		SI res_860026625 > 1
		ALORS
			erreur_860026625 = i_memcpy_art_field_n(g_iartout2, $Conversion::NDR, pt_TEMP_860026625, res_860026625)
			numzone_860026625 = i_DHgetZoneID(NUMTABSEL1_860026625, g_iartout2)
			erreur_860026625 = i_set_attr_val_n($E_RPV::numzone, numzone_860026625)
		FINSI
	FINSI

	SI numzone_860026625 == 5
	ALORS
		DATE_LOCALE_860026625 = i_DHgetLocalTime(NUMTAB_860026625,numzone_860026625,ddebut_860026625)
		DATE_LOCALE_HDEB_860026625 = i_DHgetLocalTime(NUMTAB_860026625, numzone_860026625, TRAA_HDEB_860026625)
	FINSI
FINSI

# ICAR_S
SI (MER_860026625 && !SPORTABILITE_860026625 && (CCD_860026625 != 0x18 || EPORTABILITE_860026625))
ALORS
	SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_HDEB) == 1)
	ALORS
		ICAR_S_860026625 = DATE_LOCALE_HDEB_860026625
	SINON
		ICAR_S_860026625 = DATE_LOCALE_860026625
	FINSI
SINON
	ICAR_S_860026625 = DATE_LOCALE_860026625
FINSI

# ICAR_P
SI (MER_860026625 && (SPORTABILITE_860026625 ||(CCD_860026625 == 0x18 && !EPORTABILITE_860026625)))
ALORS
	SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_HDEB) == 1)
	ALORS
		ICAR_P_860026625 = DATE_LOCALE_HDEB_860026625
	SINON
		ICAR_P_860026625 = DATE_LOCALE_860026625
	FINSI
SINON
	ICAR_P_860026625 = DATE_LOCALE_860026625
FINSI

# ICAR_REF
SI MER_860026625
ALORS
	SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_HDEB) == 1)
	ALORS
		ICAR_REF_860026625 = DATE_GMT_HDEB_860026625
	SINON
		ICAR_REF_860026625 = DATE_GMT_860026625
	FINSI
SINON
	ICAR_REF_860026625 = DATE_GMT_860026625
FINSI

# NB_CSV
SI bFACTURABLE_860026625
ALORS
	NB_CSV_860026625 = 1
SINON
	NB_CSV_860026625 = 0
FINSI

# C_CSV1 et OP_CSV1
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDSRT, pt_IDSRT_860026625)
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::CATDC, pt_CATDC_860026625)
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::SCATDC, pt_SCATDC_860026625)
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::GCOM_IDRSG, pt_GCOM_IDRSG_860026625)
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::GCOM_PALNUM, pt_GCOM_PALNUM_860026625)

SI RETOUR_CORR_860026625
ALORS
	i_strcpy (pt_SCATDC_860026625,"1")
	i_strcpy (pt_GCOM_IDRSG_860026625, "duree" )
FINSI

erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", pt_IDSRT_860026625 , pt_CATDC_860026625)
erreur_860026625 = i_format_str2(pt_NUM_860026625, "%s%s", pt_temp_860026625 , pt_SCATDC_860026625)
erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", pt_NUM_860026625 , pt_GCOM_IDRSG_860026625)
erreur_860026625 = i_format_str2(pt_NUM_860026625, "%s%s", pt_temp_860026625 , pt_GCOM_PALNUM_860026625)
i_strcpy(pt_C_CSV1_860026625, C_CSV_860026233("118a", pt_NUM_860026625, i_get_art_field(g_iartin, $Tri2g118HP::dpivot)))
i_strcpy(pt_OP_CSV1_860026625, OP_CSV_860026233("118a", pt_NUM_860026625, i_get_art_field(g_iartin, $Tri2g118HP::dpivot)))


SI (pt_C_CSV1_860026625 == g_inull)
ALORS
        i_strcpy(pt_C_CSV1_860026625, " ")
FINSI

SI (pt_OP_CSV1_860026625 == g_inull)
ALORS
        i_strcpy(pt_OP_CSV1_860026625, " ")
FINSI

#DRE G4R02
erreur_860026625 = i_format_str2(pt_CSV_860026625, "%s%s", pt_C_CSV1_860026625 , pt_OP_CSV1_860026625)

#Recherche TeleService et CallType
#SI i_strcmp(pt_C_CSV1, " ") != 0 && i_strcmp(pt_OP_CSV1, " ") != 0
SI i_strcmp(pt_CSV_860026625, "  ") != 0
ALORS
#	erreur = i_format_str2(pt_temp, "%s%s", pt_C_CSV1 , pt_OP_CSV1)
	i_strcpy (pt_TeleService_860026625,i_get_tab_field(C_TAB_CSV_COME_860026625, DATE_GMT_860026625, pt_CSV_860026625))
	SI ( i_strcmp( pt_TeleService_860026625,g_inull) != 0 )
	ALORS
		erreur_860026625 = i_recupererValeur(pt_TeleService_860026625, pt_CallType_860026625, i_strlen(pt_TeleService_860026625),'_' )
	FINSI
FINSI


#Nbut_COME
Nbut_COME_860026625 = 0
SI MER_860026625
ALORS
	SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
	ALORS
		TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
		TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
		Nbut_COME_860026625 = TRAA_NUTC_860026625 + TRAA_NUTR_860026625
	FINSI
SINON
	SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
	ALORS
		Nbut_COME_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT)
	FINSI
FINSI


#\DRE G4R02


# REF
erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDCORREL, pt_IDCORREL_860026625)
i_get_sub_str(pt_IDCORREL_860026625, -3, -1, pt_REF_860026625)
REF_860026625 = i_get_val_num(pt_REF_860026625, 3, 12)

SI ( TYPCOM_860026625 == 83 || TYPCOM_860026625 == 98)
ALORS
	TYPCOM_fct_860026625 = 1
FINSI

SI ((TYPCOM_fct_860026625 && CCD_860026625 == 24) || CCD_REEL_860026625 == 213 )
ALORS
	b_arretfct_centaure_860026625 = 1
FINSI

SI (!VGA_860026625 && !NM3_860026625 && bFACTURABLE_860026625 && !V1S_860026625 && !b_TETRIS_TRAFBSS_860026625 && !b_NPF_SIP_860026625 && !b_IDUS_NDIP_860026625 && pt_IDUS_NDRTC_860026625 != " " && !b_TETRIS_TRAFBSS_860026625 )
ALORS
	b_FERPV_COME_860026625 = 1
FINSI

SI (!VGA_860026625 && !NM3_860026625 && bFACTURABLE_860026625 && !V1S_860026625 && !b_TETRIS_TRAFBSS_860026625 && !b_NPF_SIP_860026625 && (arFERPV_860026625 || TYPAR_SIPFE_860026625)&& !b_IDUS_NDIP_860026625 && pt_IDUS_NDRTC_860026625 != " " && !b_TETRIS_TRAFBSS_860026625 )
ALORS
	b_FERPV_860026625 = 1
FINSI

SI(bFACTURABLE_860026625 && b_OperNBE_860026625 && (b_FFMV2_860026625 || b_FFMV3_860026625))
ALORS
	b_FERPV_NBE_860026625 = 1
FINSI

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

SI (bIDUS_NUM_860026625 == 1)
ALORS
# DRE G4R6 QC816  bREDIST_SVA envoi en redistribution et a certaines applis clientes (DM EBILL TRAFBSS1 et 2)
	SI bREDIST_SVA_860026625 == 0
	ALORS
	################ Applis clientes dependantes de la recherche dans ALICE (TRAFIC CENTDEA CENTVG FE COME COME_ELLIGIBLE FERPV TRAFBSS1 et 2)  #########
# \DRE G4R6 QC816

	#DRE G4R02
		# COME
	# 11/03/13 - DRE - G4R2 QC695 (1)
	#	SI b_FERPV_COME && b_InfoC_COME_NDI && Nbut_COME > 0 && i_strcmp(pt_OP_CSV1, "A") != 0 && (!CORR_118ALADUREE || RETOUR_CORR)
		SI b_FERPV_COME_860026625 && b_InfoC_COME_NDI_860026625 && (Nbut_COME_860026625 > 0 || i_strcmp(pt_OP_CSV1_860026625, "A") != 0) && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625)
		ALORS
	# 23/04/13 - DRE - G4R2 QC717 Distribuer en errone tout DC dont le CSV est inconnu dans la table TCSV_COME 
			SI i_strcmp(pt_CallType_860026625,g_inull) == 0 || i_strcmp(pt_TeleService_860026625,g_inull) == 0
			ALORS
				code_errone_860026625 = 0xA0A1
				erreur_860026625 = i_format_str2(pt_BUF_860026625," pour non distribution a COME. Cause : Teleservice ou CallType absent de ta table CSV_COME : Cle CSV_COME = <%s>, Cle Table csv = <%s>",pt_CSV_860026625,pt_NUM_860026625)
				erreur_860026625 = i_PlvMessEmettre(8612, 2, g_iartin, "", 3, code_errone_860026625,C_Article_860026625, pt_BUF_860026625)
				SAUT DISTRI_ERR
			FINSI
	# \ 23/04/13 - DRE - G4R2 QC717
			b_COME_860026625 = 1
			erreur_860026625=i_AjouterCouranteECC(instCOME_860026625)
			i_strcpy(pt_ECCFACT_860026625, "COME")
		FINSI
		
		# COME_ELIGIBLE
	# 11/03/13 - DRE - G4R2 QC695 (1)
	#	SI b_FERPV_COME && b_InfoC_ELIGIBLE_NDI && Nbut_COME > 0 && i_strcmp(pt_OP_CSV1, "A") != 0 && (!CORR_118ALADUREE || RETOUR_CORR)
		SI b_FERPV_COME_860026625 && b_InfoC_ELIGIBLE_NDI_860026625 && (Nbut_COME_860026625 > 0 || i_strcmp(pt_OP_CSV1_860026625, "A") != 0) && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625)
		ALORS
	# 23/04/13 - DRE - G4R2 QC717 Ne pas envoyer a COME_ELLIGIBLE tout DC dont le CSV est inconnu dans la table TCSV_COME 
			SI i_strcmp(pt_CallType_860026625,g_inull) == 0 || i_strcmp(pt_TeleService_860026625,g_inull) == 0
			ALORS
				code_errone_860026625 = 0xA0A1
				erreur_860026625 = i_format_str2(pt_BUF_860026625, " Non distribution a COME_ELLIGIBLE. Cause : Teleservice ou CallType absent de ta table CSV_COME : Cle CSV_COME = <%s>, Cle Table csv = <%s>",pt_CSV_860026625,pt_NUM_860026625)
				erreur_860026625 = i_PlvMessEmettre(8614, 2, g_iartin, "", 3, code_errone_860026625,C_Article_860026625, pt_BUF_860026625)
			SINON
				b_ELIGIBLE_860026625 = 1
				erreur_860026625=i_AjouterCouranteECC(instCOME_ELIGIBLE_860026625)
			FINSI
	# \ 23/04/13 - DRE - G4R2 QC717
		FINSI
	#\DRE G4R02
	
	
	
		# FERPV
		#SI (!VGA && !NM3 && bFACTURABLE && !V1S && !b_TETRIS_TRAFBSS && !b_NPF_SIP && (arFERPV || TYPAR_SIPFE) && (!CORR_118ALADUREE || RETOUR_CORR) && (!b_IDUS_NDIP || pt_IDUS_NDRTC != " " || b_TETRIS_TRAFBSS) )
	#DRE G4R02
	#	SI ((b_FERPV || b_FERPV_NBE) && (!CORR_118ALADUREE || RETOUR_CORR))
	#DRE - G4R2 QC695 (4)
	#	SI (!b_COME && (b_FERPV || b_FERPV_NBE || b_ELIGIBLE) && (!CORR_118ALADUREE || RETOUR_CORR))
		SI (!b_InfoC_COME_NDI_860026625 
		    && (b_FERPV_860026625 || b_FERPV_NBE_860026625 || b_InfoC_ELIGIBLE_NDI_860026625) 
		    && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625))
		ALORS
			bFERPV_860026625 = 1
			erreur_860026625 = i_AjouterCouranteECC(instFERPV_860026625)
	#DRE G4R02
	#		SI (b_FERPV)
	#DRE - G4R2 QC695 (4)
	#		SI (b_FERPV || b_ELIGIBLE) && !b_FERPV_NBE
			SI (b_FERPV_860026625 || b_InfoC_ELIGIBLE_NDI_860026625) && !b_FERPV_NBE_860026625
			ALORS
				i_strcpy(pt_ECCFACT_860026625, "FERPV")
			FINSI
		FINSI
	
		# Modification des criterees de distribution pour FE ajout de !TYPAR_BIV_SIP
		# FE
		SI ( !VGA_860026625 && !NM3_860026625 && !b_FFMV3_860026625 && bFACTURABLE_860026625 && !V1S_860026625 && !b_TETRIS_TRAFBSS_860026625 && !b_NPF_SIP_860026625 && !TYPAR_SIPFE_860026625 && !TYPAR_BIV_SIP_860026625 && arFE_860026625 
		&& ( !CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625 ) && ( !b_IDUS_NDIP_860026625 || pt_IDUS_NDRTC_860026625 != " " || b_TETRIS_TRAFBSS_860026625 ) && !bFERPV_860026625 )
		ALORS
			bFE_860026625 = 1
			erreur_860026625 = i_AjouterCouranteECC(instFE_860026625)
			i_strcpy(pt_ECCFACT_860026625, "FE")
		FINSI
	
		# TRAFIC
	#DRE G4R02
	#	SI ( ( bFACTURABLE  && !( b_IDUS_NDIP && i_strcmp(pt_IDUS_NDRTC," ")==0 && !b_TETRIS_TRAFBSS ) && !b_TRAFBSScritCOM && !bFE && !b_FERPV && (!CORR_118ALADUREE || RETOUR_CORR) )
	#DRE - G4R2 QC695 (4)
	#	SI ( ( bFACTURABLE  && !( b_IDUS_NDIP && i_strcmp(pt_IDUS_NDRTC," ")==0 && !b_TETRIS_TRAFBSS ) && !b_TRAFBSScritCOM && !bFE && !b_COME && !b_ELIGIBLE && !b_FERPV && (!CORR_118ALADUREE || RETOUR_CORR) )
	#	|| (b_FERPV_NBE && (!CORR_118ALADUREE || RETOUR_CORR) ) 		)
		SI ( 
			( bFACTURABLE_860026625  
			&& !( b_IDUS_NDIP_860026625 && i_strcmp(pt_IDUS_NDRTC_860026625," ")==0 && !b_TETRIS_TRAFBSS_860026625 ) 
			&& !b_TRAFBSScritCOM_860026625 && !bFE_860026625 && !b_InfoC_COME_NDI_860026625 && !b_InfoC_ELIGIBLE_NDI_860026625 && !b_FERPV_860026625 
			&& ( !CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625) 
			)
			|| ( b_FERPV_NBE_860026625 && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625) )
		   )
	
		ALORS
			bTRAFIC_860026625 = 1
			erreur_860026625 = i_AjouterCouranteECC(instTRAFIC_860026625)
		FINSI
	
		#DRE G4R6 QC816 paragraphe remonte
		# CENTDEA
		#pour CentaureDEA maintenant on controle bRDIP_SVTR et RDIP_SVTR_1  S6F4 25/02 on enleve RDIP_SVTR et on utilse bFACTURABLE
		SI (bEFFICACE_860026625 && bFACTURABLE_860026625 && b_arretfct_centaure_860026625 && !RETOUR_CORR_860026625)
		ALORS
			bCENTDEA_860026625 = 1
			erreur_860026625 = i_AjouterCouranteECC(instCENTDEA_860026625)
		FINSI
	
		# CENTVG : VGA et TRAFIC destinataire
		SI (bTRAFIC_860026625 && (VGA_860026625 || NM3_860026625 || b_FFMV3_860026625))
		ALORS
			bCENTVG_860026625 = 1
			erreur_860026625 = i_AjouterCouranteECC(instCENTVG_860026625)
		FINSI
#DRE G4R6 QC816  
#DRE G4R9 lot1 Envoi dependant d'Alice, paragraphe deplace
		SI b_TRAFBSS1_860026625 == 1
		ALORS 
			erreur_860026625 = i_AjouterCouranteECC(instTRAFBSS1_860026625)
		FINSI
	
		SI b_TRAFBSS2_860026625 == 1
		ALORS 
			erreur_860026625 = i_AjouterCouranteECC(instTRAFBSS2_860026625)
		FINSI
# \DRE G4R9 lot1	
	FINSI

	################ Applis clientes independantes de la recherche dans ALICE (DM EBILL) #########

	# Delta Minute 
	SI ( !VGA_860026625 && !NM3_860026625 && !b_FFMV3_860026625)
	ALORS
		SI bFE_860026625 && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625)
		ALORS
			erreur_860026625=i_AjouterCouranteECC(instDM_860026625)
		FINSI
	FINSI

	# Allofact (SC) : bFACTURABLE et non VGA et Allofact dans TableDistri(Fixe, DATE_GMT, IDUS_N)
	SI (bFACTURABLE_860026625 && b_TRAFBSScritCOM_860026625 && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625) )
	ALORS
		erreur_860026625 = i_AjouterCouranteECC(instSC_860026625)
	FINSI

#G4R9 lot1 Envoi dependant d'Alice, paragraphe deplace
#	SI b_TRAFBSS1 == 1
#	ALORS 
#		erreur = i_AjouterCouranteECC(instTRAFBSS1)
#	FINSI
#
#	SI b_TRAFBSS2 == 1
#	ALORS 
#		erreur = i_AjouterCouranteECC(instTRAFBSS2)
#	FINSI

#DRE G4R6 QC816 paragraphe remonte
#	# CENTDEA
#	#pour CentaureDEA maintenant on controle bRDIP_SVTR et RDIP_SVTR_1  S6F4 25/02 on enleve RDIP_SVTR et on utilse bFACTURABLE
#	SI (bEFFICACE && bFACTURABLE && b_arretfct_centaure && !RETOUR_CORR)
#	ALORS
#		bCENTDEA = 1
#		erreur = i_AjouterCouranteECC(instCENTDEA)
#	FINSI

	### CORRELATION ####
	SI  ( CORR_118ALADUREE_860026625 && !RETOUR_CORR_860026625 )
	ALORS
		trace("__FILE__:__LINE__ #### ENVOI EN CORRELATION #### ")
		erreur_860026625 = i_dup_art_id(g_iartin, g_iartout11)

		## Calcul ID_CORR
		#nelem = g_iartout11.IDUS_NUM!NELEM
		#val = g_iartout11.IDUS_NUM[nelem-1]
		##trace1("__FILE__:__LINE__ ======> code val : <%d> ", val)
		#SI (val ==15 )
		#ALORS
		#	nelem = nelem - 1
		#FINSI
		#nelem=nelem - 1

		## Correction calcul ID_CORR
		#ID_CORR = (g_iartout11.IDUS_NUM[nelem-1]) + (g_iartout11.IDUS_NUM[nelem-2] * 10) + 65536 *( (g_iartout11.IDUS_NUM[nelem-3]) + (g_iartout11.IDUS_NUM[nelem-4])* 10 )
		##trace1("__FILE__:__LINE__ ======> Valeur de ID_CORR : <%d> ", ID_CORR)
		##trace("preparation Envoi en Correlation 118_CORR")

		SI !i_valid_field_n(g_iartout11, $Tri2g118HP::DECO_NUM)
		ALORS
			erreur_860026625 = i_ajoutChampNum(g_iartout11, $Tri2g118HP::T3DECO_NUM,$Tri2g118HP::DECO_NUM,1)
		FINSI

		nelem_860026625 = g_iartout11.NUMNAS!NELEM
		nelem_860026625 = nelem_860026625 * 4
		erreur_860026625 = i_resize_tlv(g_iartout11, "T3DECO_NUM", "DECO_NUM", nelem_860026625)

		SI !i_valid_field_n(g_iartout11, $Tri2g118HP::TRAA_HDEB)
		ALORS
			erreur_860026625 = i_ajoutChampNum(g_iartout11, $Tri2g118HP::T3TRAA_HDEB,$Tri2g118HP::TRAA_HDEB,1)
		FINSI

		#i_strcpy(pt_cascorr, C_CASCORR)
		erreur_860026625 = i_initialiserPrmCorr(g_iartout11)
		#erreur = i_ajouterPrmCorr(g_iartout11, pt_cascorr, ID_CORR)
		erreur_860026625 = i_stocke_art_corr(g_iartout11, C_CASCORR_860026625)
		#erreur = i_stocke_art(g_iartout11, 0, PT_CORRELE, 0)
	FINSI

FINSI

############################################################################
# Consolidation des applications destinatrices
############################################################################

#trace1("<<<__LINE__:__FILE__<<< bIDUS_NUM<%d>",bIDUS_NUM)
#trace1("<<<__LINE__:__FILE__<<< bFACTURABLE <%d>",bFACTURABLE)
#trace1("<<<__LINE__:__FILE__<<< bFE <%d>",bFE)
#trace1("<<<__LINE__:__FILE__<<< bTRAFIC <%d>",bTRAFIC)
#trace1("<<<__LINE__:__FILE__<<< bFERPV <%d>",bFERPV)
#trace1("<<<__LINE__:__FILE__<<< b_TRAFBSScritCOM<%d>",b_TRAFBSScritCOM)
#trace1("<<<__LINE__:__FILE__<<< CPT_REDIST<%d>",CPT_REDIST)

#DRE G4R6 QC816
#SI (bIDUS_NUM == 1)
#ALORS
##DRE G4R02
##	SI (bFACTURABLE && !bFE && !bTRAFIC && !bFERPV && !b_TRAFBSScritCOM) && (!CORR_118ALADUREE || RETOUR_CORR)
#	SI (bFACTURABLE && !bFE && !bTRAFIC && !bFERPV && !b_TRAFBSScritCOM && !b_COME) && (!CORR_118ALADUREE || RETOUR_CORR)
#	ALORS
#		SI (CPT_REDIST < 2 && IDUS_TOPE == 1)
#		ALORS
#			i_strcpy(pt_LIBELREDIST, "Facturable et pas de ECC de facturation")
#			SAUT REDIST
#		SINON
#			SAUT P_SYMPH
#		FINSI
#	FINSI
#FINSI
#
SI (bIDUS_NUM_860026625 == 1)
ALORS
	# test si Redistri suite recherche SVA
	SI bREDIST_SVA_860026625 == 0 
	ALORS
		# cas normal
		SI (bFACTURABLE_860026625 && !bFE_860026625 && !bTRAFIC_860026625 && !bFERPV_860026625 && !b_TRAFBSScritCOM_860026625 && !b_COME_860026625) && (!CORR_118ALADUREE_860026625 || RETOUR_CORR_860026625)
		ALORS
			SI (CPT_REDIST_860026625 < 2 && IDUS_TOPE_860026625 == 1)
			ALORS
				i_strcpy(pt_LIBELREDIST_860026625, "Facturable et pas de ECC de facturation")
				SAUT REDIST
			SINON
				SAUT P_SYMPH
			FINSI
		FINSI
	SINON 
		# cas redist SVA
		SI ( CPT_REDIST_860026625 < 2 )
		ALORS
			SAUT REDIST
		SINON
			SAUT P_SYMPH
		FINSI
	FINSI
FINSI

#\DRE G4R6 QC816


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

SI (bIDUS_NUM_860026625 == 1)
ALORS
	# *************************** Trafic ***************************
	############################################################################

	SI (!i_ChercherCouranteECC(instTRAFIC_860026625))
	ALORS
		#trace1("<<<__LINE__:__FILE__<<< dup instTRAFIC <%d>",instTRAFIC)
		SI (i_dup_art_dest(g_iartin, g_iartout6, C_Ttrafic_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026625,C_Ttrafic_860026625,C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# DOMAINE
		SI (V1S_860026625 || b_TETRIS_FU_860026625 || b_NPF_SIP_860026625 || b_NPF_OPT_860026625)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::DOMAINE, "10")
		SINON
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::DOMAINE, "33")
		FINSI

		# SERVICE
		SI (V1S_860026625 || b_TETRIS_FU_860026625 || b_NPF_SIP_860026625 || b_NPF_OPT_860026625)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::SERVICE, "06")
		SINON
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::SERVICE, "86")
		FINSI

		# IDUS_NUM
		# G4R5 Lot2 
		#SI (b_NPF_SIP || SIP_Fibre || (V1S && b_ODEBI ))
		SI ( b_NPF_SIP_860026625 || SIP_Fibre_860026625 || V1S_860026625 )
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::IDUS_NUM, pt_IDUS_NUM_860026625)
		SINON
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::IDUS_NUM, pt_IDUS_NDRTC_860026625)
		FINSI

		# DEDE_INF
		erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::DEDE_INF, DECO_INF_860026625)

		# DEDE_NUM
		erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::DEDE_NUM, pt_DECO_NUM_860026625)

		# ICAR (DATE)
		erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::DATE, ICAR_S_860026625)

		# DUR (DUREE)
		SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::DUREE, TRAA_DCONV_860026625)
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::DUREE, TREP_DURCONV_860026625)
		FINSI

		# CAX
		erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::CAX, CAX_860026625)

		# TAX
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout6,$TtraficN::TAX, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::TAX, 0)
			FINSI
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout6,$TtraficN::TAX,i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout6,$TtraficN::TAX, 0)
			FINSI
		FINSI

		# NDS_NUM
		# G4R5 Lot2 
		#SI (b_TETRIS_FU || (V1S && b_ODEBI == 0) || b_NPF_OPT)
# G4R5 QC783 
#		SI ( b_TETRIS_FU || V1S || b_NPF_OPT)
		SI ( b_TETRIS_FU_860026625 || b_NPF_OPT_860026625)
		ALORS
			i_get_sub_str(pt_IDUS_NUM_860026625, 0, 8, pt_NDS_NUM_860026625)
			#trace2 ("test: pt_IDUS_NUM=<%s>, pt_NDS_NUM=<%s>", pt_IDUS_NUM, pt_NDS_NUM)
		SINON
			i_strcpy(pt_NDS_NUM_860026625, " ")
		FINSI
		erreur_860026625 = i_set_art_str(g_iartout6,$TtraficN::NDS_NUM, pt_NDS_NUM_860026625)

		#SUP
		SI (V1S_860026625 || b_TETRIS_FU_860026625 || b_NPF_SIP_860026625 || b_NPF_OPT_860026625)
		ALORS
			erreur_860026625 = i_set_art_field(g_iartout6,$TtraficN::SUP, 6)
		SINON
			erreur_860026625 = i_set_art_field(g_iartout6,$TtraficN::SUP, 0)
		FINSI

		# REF
		erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::REF, REF_860026625)

		#  NB_CSV
		erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::NB_CSV, NB_CSV_860026625)

		#C_CSV1
		erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::C_CSV1, pt_C_CSV1_860026625)

		# OP_CSV1
		erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::OP_CSV1, pt_OP_CSV1_860026625)

		# SGTQS
		erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::SGTQS, pt_SGTQS_860026625)

		# Champ CLASSDEST CCD
		erreur_860026625 = i_set_art_field(g_iartout6, $TtraficN::CLASSDEST, CCD_REEL_860026625)

		# champ OFFRE et champ OPERATEUR
		SI b_CodOperVG_860026625
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::OFFRE, pt_CodOffreVG_860026625)
			erreur_860026625 = i_set_art_str(g_iartout6, $TtraficN::OPERATEUR, pt_CodOperVG_860026625)
		FINSI
		
		# DRE G4R6 Lot3

		# TYPE_EDIT
		erreur_860026625=i_set_art_str(g_iartout6, $TtraficN::TYPE_EDIT, pt_TYPE_EDIT_860026625)
		
		# CODE_TARIF
		erreur_860026625=i_set_art_str(g_iartout6, $TtraficN::CODE_TARIF, pt_CODE_TARIF_860026625)
		# \DRE G4R6 lot3

	FINSI

	# *************************** CENTVG ***************************
	############################################################################

	SI (!i_ChercherCouranteECC(instCENTVG_860026625))
	ALORS
		#trace1("<<<__LINE__:__FILE__<<< dup instCENTVG <%d>",instCENTVG)
		SI (i_dup_art_dest(g_iartin, g_iartout7, C_TcentaureVG_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_TcentaureVG_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# DOMAINE
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::DOMAINE, "33")

		# SERVICE
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::SERVICE, "86")

		# IDUS_NUM
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::IDUS_NUM, pt_IDUS_NUM_860026625)

		# DEDE_INF FO2238
		erreur_860026625 = i_set_art_field(g_iartout7,  $TcentaureVG::DEDE_INF, DECO_INF_860026625)

		# DEDE_NUM FO1955 FO2238
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::DEDE_NUM, pt_DECO_NUM_860026625)

		# ICAR (DATE)
		erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::ICAR, ICAR_S_860026625)

		# DUR (DUREE) FO1955 FO2238
		SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::DUR, TRAA_DCONV_860026625)
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::DUR, TREP_DURCONV_860026625)
		FINSI

		# CAX
		erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::CAX, CAX_860026625)

		# TAX
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout7,$TcentaureVG::TAX, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout7,$TcentaureVG::TAX, 0)
			FINSI
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout7,$TcentaureVG::TAX,i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout7,$TcentaureVG::TAX, 0)
			FINSI
		FINSI

		#  NB_CSV
		erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::nb_csv, NB_CSV_860026625)

		#C_CSV1
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::C_CSV1, pt_C_CSV1_860026625)

		#REF
		erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::REF, REF_860026625)

		# OP_CSV1
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::OP_CSV1, pt_OP_CSV1_860026625)

		# SGTQS
		erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::SGTQS, pt_SGTQS_860026625)

		# Champ CLASSDEST CCD
		erreur_860026625 = i_set_art_field(g_iartout7, $TcentaureVG::CLASSDEST, CCD_REEL_860026625)

		# champ OFFRE et champ OPERATEUR
		SI b_CodOperVG_860026625
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::OFFRE, pt_CodOffreVG_860026625)
			erreur_860026625 = i_set_art_str(g_iartout7, $TcentaureVG::OPERATEUR, pt_CodOperVG_860026625)
		FINSI
	# DRE G4R6 Lot3
	
		# TYPE_EDIT
		erreur_860026625=i_set_art_str(g_iartout7, $TcentaureVG::TYPE_EDIT, pt_TYPE_EDIT_860026625)
		
		# CODE_TARIF
		erreur_860026625=i_set_art_str(g_iartout7, $TcentaureVG::CODE_TARIF, pt_CODE_TARIF_860026625)
	# \DRE G4R6 lot3
	
	FINSI

	# *************************** FE ***************************
	############################################################################

	SI (!i_ChercherCouranteECC(instFE_860026625))
	ALORS
		#trace1("<<<__LINE__:__FILE__<<< dup instFE <%d>",instFE)
		SI (i_dup_art_dest(g_iartin, g_iartout8, C_Tfe_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_Tfe_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# SERVICE
		erreur_860026625 = i_set_art_str(g_iartout8, $Tfe::SERVICE, "86")

		# IDUS_NUM
		erreur_860026625 = i_set_art_str(g_iartout8, $Tfe::IDUS_NUM, pt_IDUS_NUM_860026625)

		# DEDE_INF
		erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::DEDE_INF, DECO_INF_860026625)

		# DEDE_NUM
		erreur_860026625 = i_set_art_str(g_iartout8, $Tfe::DEDE_NUM, pt_DECO_NUM_860026625)

		# ICAR (DATE)
		erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::DATE, ICAR_S_860026625)

		# DUR (DUREE)
		SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::DUREE, TRAA_DCONV_860026625)
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::DUREE, TREP_DURCONV_860026625)
		FINSI

		# CAX
		erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::CAX, CAX_860026625)

		# TAX
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::TAX, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::TAX, 0)
			FINSI
			# le champ TREP_NBUTACT est optionnel donc il faut s'assurer de sa validite.
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout8,$Tfe::TAX, i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::TAX, 0)
			FINSI
		FINSI

		# SUP
		GCOM_NAD_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::GCOM_NAD)
		SI ((GCOM_NAD_860026625 & 0x07) == 1)
		ALORS
			erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::SUP, 1)
		SINON
			SI ((GCOM_NAD_860026625 & 0x07) ==  3)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::SUP, 2)
			SINON
				erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::SUP, 0)
			FINSI
		FINSI

		#  NB_CSV
		erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::NB_CSV, NB_CSV_860026625)

		#C_CSV1
		erreur_860026625 = i_set_art_str(g_iartout8, $Tfe::C_CSV1, pt_C_CSV1_860026625)

		# OP_CSV1
		erreur_860026625 = i_set_art_str(g_iartout8, $Tfe::OP_CSV1, pt_OP_CSV1_860026625)

		# Champ CLASSDEST CCD
		erreur_860026625 = i_set_art_field(g_iartout8, $Tfe::CLASSDEST, CCD_REEL_860026625)
	# DRE G4R6 Lot3
	
		# TYPE_EDIT
		erreur_860026625=i_set_art_str(g_iartout8, $Tfe::TYPE_EDIT, pt_TYPE_EDIT_860026625)
		
		# CODE_TARIF
		erreur_860026625=i_set_art_str(g_iartout8, $Tfe::CODE_TARIF, pt_CODE_TARIF_860026625)
	# \DRE G4R6 lot3

	FINSI

	# *************************** DM ***************************
	############################################################################

	SI (!i_ChercherCouranteECC(instDM_860026625))
	ALORS
		SI (i_dup_art_dest(g_iartin, g_iartout9, C_Tdelta_minute_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_Tdelta_minute_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# DOMAINE
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::DOMAINE, "33")

		# SERVICE
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::SERVICE, "86")

		# IDUS_NUM
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::IDUS_NUM, pt_IDUS_NUM_860026625)

		# DEDE_INF
		erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::DEDE_INF, DECO_INF_860026625)

		# DEDE_NUM
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::DEDE_NUM, pt_DECO_NUM_860026625)

		# ICAR (DATE)
		erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::DATE, ICAR_S_860026625)

		# DUR (DUREE)
		SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::DUREE, TRAA_DCONV_860026625)
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::DUREE, TREP_DURCONV_860026625)
		FINSI

		# CAX
		erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::CAX,CAX_860026625)

		# TAX
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout9,$Tdelta_minute::TAX, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::TAX,0)
			FINSI
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::TAX, i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::TAX, 0)
			FINSI
		FINSI

		# NB_CSV
		erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::NB_CSV, NB_CSV_860026625)

		# C_CSV1
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::C_CSV1, pt_C_CSV1_860026625)

		# OP_CSV1
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::OP_CSV1, pt_OP_CSV1_860026625)

		# SGTQS
		erreur_860026625 = i_set_art_str(g_iartout9, $Tdelta_minute::SGTQS, pt_SGTQS_860026625)

		# Champ CLASSDEST CCD
		erreur_860026625 = i_set_art_field(g_iartout9, $Tdelta_minute::CLASSDEST, CCD_REEL_860026625)
	FINSI

	# *************************** FCT => Supprimee ***************************
	############################################################################

	# *************************** SC ***************************
	############################################################################

	SI (!i_ChercherCouranteECC(instSC_860026625))
	ALORS
		#trace1("<<<__LINE__:_FILE__<<< dup instSC <%d>",instSC)
		SI (i_dup_art_dest(g_iartin, g_iartout5, C_Tsc_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_Tsc_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# T1
		# remplie dans table de duplication:       6:56:1:$T1 #T1=0x56

		# L1
		# remplie dans table de duplication:       6:6C:1:$L1      0x6C

		#1:$TREP_DURCONV:$DURCONV	# TREP_DURCONV  DURCONV
		#1:$NUMNAS:$NUM_RECO		# NUMNAS   NUM_RECO
		#6:32:2:$SUP			# 22       SUP valeur defaut
		#6:30:5:$CODESERV		# 00000    CODESERV valeur defaut
		#6:30:6:$DCONV			# 000000   DCONV valeur defaut
		#6:30:6:$NUTC			# 000000   NUTC valeur defaut
		#6:20:17:$NUM_DECO		# "    "   NUM_DECO valeur defaut

		# IDUS_NUM : ILAS [IDUS]
		SI (b_TRAFBSScritCOM_860026625 || b_NPF_SIP_860026625)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::IDUS_NUM, pt_IDUS_NUM_860026625)
		SINON
			erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::IDUS_NUM, pt_IDUS_NDRTC_860026625)
		FINSI

		# DATE : ICAR [DATE_LOCALE]
		erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::DATE, DATE_LOCALE_860026625)

		# DURCONV
		# remplie dans table de duplication:       1:$TREP_DURCONV:$DURCONV

		# NBUT
		SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
		ALORS
			erreur_860026625 = i_set_art_field(g_iartout5,$TscTri2g118C::NBUT,i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
		SINON
			erreur_860026625 = i_set_art_field(g_iartout5,$TscTri2g118C::NBUT, 0)
		FINSI

		# INF_DECO : INF [DECO]
		erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::INF_DECO, DECO_INF_860026625)

		# NUM_RECO
		# remplie dans table de duplication:       1:$NUMNAS:$NUM_RECO

		# SUP  valeur defaut remplie dans table de duplication: 6:32:2:$SUP   ="22"
		SI (b_TETRIS_FU_860026625 || V1S_860026625 || b_TRAFBSScritCOM_860026625 || b_NPF_SIP_860026625 || b_NPF_OPT_860026625)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::SUP, "6")
		FINSI

		# CODESERV  valeur defaut remplie dans table de duplication: 6:30:5:$CODESERV   ="00000"
		SI MER_860026625 == 1 && CATDC_860026625 != 0
		ALORS
			erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::CODESERV, 32768)
		FINSI

		# DCONV [TRAA]  valeur defaut remplie dans table de duplication: 6:30:6:$DCONV    ="000000"
		SI MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::DCONV, TRAA_DCONV_860026625)
		FINSI

		# NUTC [TRAA]  valeur defaut remplie dans table de duplication: 6:30:6:$NUTC    ="000000"
		SI MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC))
		ALORS
			TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
			erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::NUTC, TRAA_NUTC_860026625)
		FINSI

		# NUM_DECO
		SI MER_860026625
		ALORS
			SI (DECO_INF_860026625 == 0x80)
			ALORS
				erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", "0", pt_DECO_NUM_860026625)
			SINON
				i_strcpy(pt_temp_860026625, pt_DECO_NUM_860026625)
			FINSI
		SINON
			i_strcpy(pt_temp_860026625, " ")
		FINSI
		erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::NUM_DECO, pt_temp_860026625)

		# REF
		erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::REF, REF_860026625)

		# CCD
		erreur_860026625 = i_set_art_field(g_iartout5, $TscTri2g118C::CCD, CCD_REEL_860026625)

		# CS1
#		erreur = i_format_str2(pt_CSV, "%s%s", pt_C_CSV1, pt_OP_CSV1)
		erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::CS1, pt_CSV_860026625)

		# NDS_NUM
		SI (b_TETRIS_FU_860026625 || V1S_860026625 || b_NPF_OPT_860026625)
		ALORS
			i_strcpy(pt_NDS_NUM_860026625, pt_IDUS_NUM_860026625)
		SINON
			i_strcpy(pt_NDS_NUM_860026625, " ")
		FINSI
		erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::NDS_NUM, pt_NDS_NUM_860026625)

		# ECC_FACT
#DRE G4R02
#		SI (!bFE && !bFERPV && !bTRAFIC && !b_TRAFBSScritCOM )
		SI (!bFE_860026625 && !bFERPV_860026625 && !bTRAFIC_860026625 && !b_TRAFBSScritCOM_860026625 && !b_COME_860026625 )
		ALORS
			i_strcpy(pt_ECCFACT_860026625, "")
		SINON
			SI b_NPF_OPT_860026625
			ALORS
				i_strcpy(pt_ECCFACT_860026625, "TRAFOPT")
			FINSI
		FINSI
		erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::ECC_FACT, pt_ECCFACT_860026625)

		#CCNDE
		SI CODCIR_860026625 != -1
		ALORS
			erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::CODCIRDR, CODCIR_860026625)
			erreur_860026625=i_get_art_str(g_iartout2, $Conversion::CODCIRDA,pt_buffer_860026625)
			SI (g_iartout2.CODCIRDA[2] > 9)
			ALORS
				i_get_sub_str(pt_buffer_860026625,2,5,pt_buffer_860026625)
			SINON
				i_get_sub_str(pt_buffer_860026625,1,5,pt_buffer_860026625)
			FINSI
			erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::CCNDE, pt_buffer_860026625)
		SINON
			erreur_860026625 = i_set_art_str(g_iartout5, $TscTri2g118C::CCNDE, "     ")
		FINSI

	FINSI

	# *************************** FERPV ***************************
	############################################################################

	SI (!i_ChercherCouranteECC(instFERPV_860026625))
	ALORS
		#trace1("<<<__LINE__:__FILE__<<< dup instFERPV <%d>",instFERPV)
		SI (i_dup_art_dest(g_iartin, g_iartout13, C_Tferpv_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_Tferpv_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# SERVICE FO1947  reprise le 08 09 2006
		SI (b_OperNBE_860026625 && (b_FFMV2_860026625 || b_FFMV3_860026625))
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SERVICE, "8")
		SINON
			SI ((TYPAR_SIPFE_860026625 == 1) || (TYPAR_BIV_SIP_860026625 == 1))
			ALORS
				erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SERVICE, "6")
			SINON
				erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SERVICE, pt_SERVICE_860026625)
			FINSI
		FINSI

		# SOURCE 
		SI (b_OperNBE_860026625 && (b_FFMV2_860026625 || b_FFMV3_860026625))
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SOURCE, "19")
		SINON
			SI (TYPAR_SIPFE_860026625 == 1)
			ALORS
				erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SOURCE, "16")
			SINON
				SI (TYPAR_Etelephonie_860026625 == 1 && TYPAR_BIV_SIP_860026625 == 0)
				ALORS
					erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SOURCE, "08")
				SINON
					SI (TYPAR_BIV_SIP_860026625)
					ALORS
						erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SOURCE, "18")
					SINON
						erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::SOURCE, "03")
					FINSI
				FINSI
			FINSI
		FINSI

		# NUMDDR
		erreur_860026625 = i_format_str2(pt_NUMDDR_860026625, "%s%s", "0", pt_IDUS_NUM_860026625)
		erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::NUMDDR, pt_NUMDDR_860026625)

		# NUMDDE G3R3 lot2
		i_strcpy(pt_temp2_860026625,pt_DECO_NUM_860026625)

		# Suppression des eventuels Zeros de tete
		POINT Boucle1
		i_get_sub_str(pt_temp2_860026625,0,0,pt_temp_860026625)
		SI (i_strcmp(pt_temp_860026625,"0") == 0)
		ALORS
			i_get_sub_str(pt_temp2_860026625,1,-1,pt_temp2_860026625)
			SAUT Boucle1
		FINSI
		i_strcpy(pt_temp_860026625,pt_temp2_860026625)

		erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::NUMDDE, pt_temp_860026625)

		# DEBUT
		erreur_860026625 = i_set_art_field(g_iartout13, $Tfe_rpv::DEBUT, ICAR_S_860026625)

		# DUREE
		SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout13, $Tfe_rpv::DUREE, TRAA_DCONV_860026625)
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout13, $Tfe_rpv::DUREE, TREP_DURCONV_860026625)
		FINSI

		# NBUT
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout13,$Tfe_rpv::NBUT, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout13, $Tfe_rpv::NBUT,0)
			FINSI
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout13,$Tfe_rpv::NBUT,i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout13,$Tfe_rpv::NBUT, 0)
			FINSI
		FINSI

		#CANAL
		erreur_860026625 = i_set_art_field(g_iartout13,$Tfe_rpv::CANAL, REF_860026625)

		#TYPACCRI
		SI (TYPAR_SIPFE_860026625 == 1)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::TYPACCRI,"1")
		SINON
			erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::TYPACCRI,"")
		FINSI

		#NATAPPRI
		SI (TYPAR_SIPFE_860026625 == 1)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::NATAPPRI,"1")
		SINON
			erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::NATAPPRI,"0")
		FINSI

		#  NBCOD
		erreur_860026625 = i_set_art_field(g_iartout13, $Tfe_rpv::NBCOD, NB_CSV_860026625)

		#C_CSV1
		erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::C_CSV1, pt_C_CSV1_860026625)

		# OP_CSV1
		erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::OP_CSV1, pt_OP_CSV1_860026625)

		# CCD
		erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::CCD, CCD_REEL_860026625)
		erreur_860026625 = i_get_art_str( g_iartout2, $Conversion::CCD, pt_temp_860026625 )
		#trace2("__LINE__ CCD ASCII  <%s>",pt_temp, "")
		erreur_860026625 = i_format_str2( pt_temp2_860026625, "%s%s", "000", pt_temp_860026625)
		i_get_sub_str (pt_temp2_860026625, -3, -1,pt_temp2_860026625)
		#trace2("__LINE__ CCD ASCII 3 dig  <%s>",pt_temp2, "")
		erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::CCD, pt_temp2_860026625)

		# ajout par duplication pour ls champs:
		# PREF_PORT = ''
		# TAG = ''
		# FILLER = ''

		# INFDDE = DECO_INF
		erreur_860026625 = i_set_art_field(g_iartout2, $Conversion::INF, DECO_INF_860026625)
		erreur_860026625 = i_get_art_str( g_iartout2, $Conversion::INF, pt_temp_860026625 )
		#trace2("__LINE__ CCD ASCII  <%s>",pt_temp, "")
		erreur_860026625 = i_format_str2( pt_temp2_860026625, "%s%s", "000", pt_temp_860026625)
		i_get_sub_str (pt_temp2_860026625, -3, -1,pt_temp2_860026625)
		#trace2("__LINE__ CCD ASCII 3 dig  <%s>",pt_temp2, "")
		erreur_860026625 = i_set_art_str(g_iartout13, $Tfe_rpv::INFDDE, pt_temp2_860026625)

	# DRE G4R6 Lot3
	
		# TYPE_EDIT
		erreur_860026625=i_set_art_str(g_iartout13, $Tfe_rpv::TYPE_EDIT, pt_TYPE_EDIT_860026625)
		
		# CODE_TARIF
		erreur_860026625=i_set_art_str(g_iartout13, $Tfe_rpv::CODE_TARIF, pt_CODE_TARIF_860026625)
	# \DRE G4R6 lot3


	FINSI

	# ********************* TRAFBSS ****************************
	############################################################################

	SI (( !i_ChercherCouranteECC(instTRAFBSS1_860026625) ) || ( !i_ChercherCouranteECC(instTRAFBSS2_860026625) ))
	ALORS
		# Duplication de l article
		#---------------------------
		# trace("Duplication vers TRAFBSS 1 ou 2")
		SI ( i_dup_art_dest(g_iartin, g_iartout4,C_TRAFBSS_860026625) )
		ALORS
			#trace("Erreur de i_dup_art_dest")
			code_errone_860026625 = 0xA0D1
			erreur_860026625 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026625,C_TRAFBSS_860026625,C_Article_860026625)
			SAUT  DISTRI_ERR
		FINSI

		#DOMAINE
		erreur_860026625 = i_set_art_str(g_iartout4, $TtrafBSS::DOMAINE, "10")

		#SERVICE
		erreur_860026625 = i_set_art_str(g_iartout4, $TtrafBSS::SERVICE, "86")

		#IDUS_INF
		#champ E par fic dup

		#champ IDUS_NUM
		erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM,pt_BUF_860026625)
		erreur_860026625 = i_set_art_str(g_iartout4, $TtrafBSS::IDUS_NUM, pt_BUF_860026625)

		# Champ DEDE_INF
		# fic

		#champ DEDE_NUM
		erreur_860026625=i_set_art_str(g_iartout4,$TtrafBSS::DEDE_NUM,pt_DECO_NUM_860026625)

		# Champ ICAR
		erreur_860026625 = i_set_art_field(g_iartout4,$TtrafBSS::DATE,ICAR_S_860026625)

		# DUR (DUREE)
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1)
			ALORS
				TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
				erreur_860026625 = i_set_art_field(g_iartout4, $TtrafBSS::DUREE, TRAA_DCONV_860026625)
			SINON
				TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
				erreur_860026625 = i_set_art_field(g_iartout4, $TtrafBSS::DUREE, TREP_DURCONV_860026625)
			FINSI
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout4, $TtrafBSS::DUREE, TREP_DURCONV_860026625)
		FINSI

		# CAX: dans fic

		# TAX
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout4,$TtrafBSS::TAX, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout4,$TtrafBSS::TAX, 0)
			FINSI
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout4,$TtrafBSS::TAX,i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout4,$TtrafBSS::TAX, 0)
			FINSI
		FINSI

		# NDS_NUM
		erreur_860026625 = i_set_art_str(g_iartout4,$TtrafBSS::NDS_NUM,pt_TETRIS_RTC_860026625)

		#SUP: fic

		#REF, MES1, MES2: fic

		# Champ NB_CSV
		erreur_860026625 = i_set_art_field(g_iartout4, $TtrafBSS::NB_CSV, NB_CSV_860026625)

		# Champ C_CSV1 et OP_CSV1
		SI ( NB_CSV_860026625 > 0)
		ALORS
			erreur_860026625 = i_set_art_str(g_iartout4,  $TtrafBSS::C_CSV1,pt_C_CSV1_860026625 )
			erreur_860026625 = i_set_art_str(g_iartout4,  $TtrafBSS::OP_CSV1,pt_OP_CSV1_860026625 )
		FINSI

		#champ STY par fic dup
		#champ COCA par fic dup
		#champ COCAV par fic dup
		#champ IDAV_INF par fic dup
		#champ IDAV_NUM par fic dup

		# Champ SGTQS
		erreur_860026625=i_set_art_str(g_iartout4, $TtrafBSS::SGTQS, pt_SGTQS_860026625)

		#Champ MNEMO: espace (info VM))

		#champ CLASSDEST  avec CCD_REEL
		erreur_860026625=i_set_art_field(g_iartout4, $TtrafBSS::CLASSDEST,CCD_REEL_860026625)

		# champs OFFRE et OPERATEUR: fic

		#champ COMPTWANA
		erreur_860026625=i_set_art_str(g_iartout4, $TtrafBSS::COMPTWANA, pt_TETRIS_compte_860026625)

		#champ TYPETRAFIC
		erreur_860026625=i_set_art_str(g_iartout4, $TtrafBSS::TYPETRAFIC, pt_TRAFIC_860026625)

		#champ TYPETARIF
		erreur_860026625=i_set_art_str(g_iartout4, $TtrafBSS::TYPETARIF, pt_TARIF_860026625)
		
		# DRE G4R9 lot1
		# CODE_TARIF
		erreur_860026625=i_set_art_str(g_iartout4, $TtrafBSS::CODE_TARIF, pt_CODE_TARIF_860026625)
		# \DRE G4R9 lot1


		#champ ZONE1 par fic dup
		#champ ZONE2 par fic dup
	FINSI

	# **************** CENTAUREDEA **************************************
	############################################################################

	SI (!i_ChercherCouranteECC(instCENTDEA_860026625))
	ALORS
		#trace1("<<<__LINE__:__FILE__<<< dup instCENTVG <%d>",instCENTVG)
		SI (i_dup_art_dest(g_iartin, g_iartout10, C_TcentaureDEA_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_TcentaureDEA_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI

		# Champ DATE
		erreur_860026625 = i_set_art_field(g_iartout10, $TcentaureDEA::DATE, ICAR_S_860026625)

		# champ IIDUS

		# champ NIDUS
		erreur_860026625 = i_get_art_str(g_iartin, $Tri2g118HP::IDUS_NUM,pt_BUF_860026625)
		erreur_860026625 = i_set_art_str(g_iartout10, $TcentaureDEA::NIDUS, pt_BUF_860026625)

		# champ IDEDE
		erreur_860026625 = i_set_art_field(g_iartout10,  $TcentaureDEA::IDEDE, DECO_INF_860026625)

		# champ NDEDE
		erreur_860026625 = i_set_art_str(g_iartout10, $TcentaureDEA::NDEDE, pt_DECO_NUM_860026625)

		# champ NIDAV
		SI SPORTABILITE_860026625
		ALORS
			SI (i_strplcmp(pt_DECO_NUM_860026625 ,"842",0,3)!=0)
			ALORS
				erreur_860026625= i_format_str2( pt_BUF_860026625, "%s%s", pt_CodeOp_860026625, pt_DECO_NUM_860026625)
				erreur_860026625 = i_set_art_str(g_iartout10, $TcentaureDEA::NIDAV,pt_BUF_860026625)
			SINON
				erreur_860026625 = i_set_art_str(g_iartout10, $TcentaureDEA::NIDAV,pt_DECO_NUM_860026625)
			FINSI
		SINON
			erreur_860026625 = i_set_art_str(g_iartout10, $TcentaureDEA::NIDAV,pt_DECO_NUM_860026625)
		FINSI

		# champ NICOM
		erreur_860026625 = i_set_art_str(g_iartout10, $TcentaureDEA::NICOM,"SVAITX")

		# champ REF
		erreur_860026625 = i_set_art_field(g_iartout10, $TcentaureDEA::REF, REF_860026625)

		# champ DUR (DUREE)
		SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
		ALORS
			TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
			erreur_860026625 = i_set_art_field(g_iartout10, $TcentaureDEA::DUREE, TRAA_DCONV_860026625)
		SINON
			TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
			erreur_860026625 = i_set_art_field(g_iartout10, $TcentaureDEA::DUREE, TREP_DURCONV_860026625)
		FINSI

		# champ TAX
		SI MER_860026625
		ALORS
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTC) &&  i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_NUTR))
			ALORS
				TRAA_NUTC_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTC)
				TRAA_NUTR_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_NUTR)
				erreur_860026625 = i_set_art_field(g_iartout10,$TcentaureDEA::TAX, (TRAA_NUTC_860026625 + TRAA_NUTR_860026625))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout10,$TcentaureDEA::TAX, 0)
			FINSI
		SINON
			SI (i_valid_field_n(g_iartin, $Tri2g118HP::TREP_NBUTACT) == 1)
			ALORS
				erreur_860026625 = i_set_art_field(g_iartout10,$TcentaureDEA::TAX,i_get_art_field(g_iartin, $Tri2g118HP::TREP_NBUTACT))
			SINON
				erreur_860026625 = i_set_art_field(g_iartout10,$TcentaureDEA::TAX, 0)
			FINSI
		FINSI

		# champ CDSGTQS
		erreur_860026625=i_set_art_str(g_iartout10, $TcentaureDEA::CDSGTQS, pt_SGTQS_860026625)
		
		# DRE G4R6 Lot3
		
		# TYPE_EDIT
		erreur_860026625=i_set_art_str(g_iartout10, $TcentaureDEA::TYPE_EDIT, pt_TYPE_EDIT_860026625)
		
		# CODE_TARIF
		erreur_860026625=i_set_art_str(g_iartout10, $TcentaureDEA::CODE_TARIF, pt_CODE_TARIF_860026625)
		# \DRE G4R6 lot3
	
	

	FINSI

#DRE - G4R02 Envoi a COME 
	
	# *************************** COME et COME_ELIGIBLE ***************************

	SI (!i_ChercherCouranteECC(instCOME_860026625) || !i_ChercherCouranteECC(instCOME_ELIGIBLE_860026625) )
	ALORS
		#trace1("<<<__LINE__:__FILE__<<< dup instFERPV <%d>",instFERPV)
#		SI (i_dup_art_dest(g_iartin, g_iartout14, C_Tcome))
		SI (i_dup_art_tab(g_iartin, g_iartout14, C_Tcome_860026625))
		ALORS
			code_errone_860026625 = 0xA0D0
			code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
			erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_Tcome_860026625, C_Article_860026625)
			SAUT DISTRI_ERR
		FINSI
		
		#CallType : type V3t1.1
		SI i_strcmp(pt_CallType_860026625,g_inull) != 0
		ALORS
			nelem_860026625 = i_conv_ascii_dcb(pt_CallType_860026625, pt_BUF_860026625)
			erreur_860026625 = i_memcpy_art_field_n(g_iartout14,$Tcome::type,pt_BUF_860026625, nelem_860026625)
		FINSI
		
		#idemet V3t1.3
# 23/04/13 - DRE - G4R2 QC717 correction valeur champ V3t1.3 (idemet)	
#		# Conversion ascii vers DCB de "33009100001FFFFFFF" #
#		nelem = i_conv_ascii_dcb("33009100001FFFFFFF", pt_BUF)
		# Conversion ascii vers DCB de "33009100003FFFFFFF" #
		nelem_860026625 = i_conv_ascii_dcb("33009100003FFFFFFF", pt_BUF_860026625)
		erreur_860026625 = i_memcpy_art_field_n(g_iartout14,$Tcome::idemet,pt_BUF_860026625, nelem_860026625)
#		erreur = i_resize_tlv( g_iartout14, "T3t1", "idemet", nelem *8 )

		#IMSI V3t1.4
		# Conversion ascii vers DCB de "444444444444444F" #
		nelem_860026625 = i_conv_ascii_dcb("444444444444444F", pt_BUF_860026625)
		erreur_860026625 = i_memcpy_art_field_n(g_iartout14,$Tcome::IMSI,pt_BUF_860026625, nelem_860026625)
#		erreur = i_resize_tlv( g_iartout14, "T3t1", "IMSI", nelem *8 )
		
		#DUREE V3t1.6   
# 11/03/13 - DRE - G4R2 QC695 (2)	 	
#		erreur = i_set_art_field(g_iartout14, $Tcome::DUREE, Nbut_COME)
		SI i_strcmp(pt_CallType_860026625,"AF") == 0
		ALORS
			erreur_860026625 = i_set_art_field(g_iartout14, $Tcome::DUREE,1)
		SINON
			SI (MER_860026625 && (i_valid_field_n(g_iartin, $Tri2g118HP::TRAA_DCONV) == 1))
			ALORS
				TRAA_DCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TRAA_DCONV)
				erreur_860026625 = i_set_art_field(g_iartout14, $Tcome::DUREE, TRAA_DCONV_860026625)
			SINON
				TREP_DURCONV_860026625 = i_get_art_field(g_iartin, $Tri2g118HP::TREP_DURCONV)
				erreur_860026625 = i_set_art_field(g_iartout14, $Tcome::DUREE, TREP_DURCONV_860026625)
			FINSI
		FINSI
		
		
		#TeleService : tlserv  V3t1.8
		
		SI i_strcmp(pt_TeleService_860026625,g_inull) != 0
		ALORS
			nelem_860026625 = i_conv_ascii_dcb(pt_TeleService_860026625, pt_BUF_860026625)
			erreur_860026625 = i_memcpy_art_field_n(g_iartout14,$Tcome::tlserv,pt_BUF_860026625, nelem_860026625)
		FINSI
		
		#nbUT V3t1.16 = Nbut_COME
		erreur_860026625 = i_set_art_field(g_iartout14,$Tcome::nbUT, Nbut_COME_860026625)

		#idpart V3t2
		SI (i_strplcmp (pt_DECO_NUM_860026625,"33",0,2) != 0)
		ALORS
			erreur_860026625 = i_format_str2( pt_BUF_860026625, "%s%s", "33", pt_DECO_NUM_860026625 )		
			i_strcpy(pt_DECO_NUM_860026625, pt_BUF_860026625)
		FINSI
		# Conversion ascii vers DCB de pt_DECO_NUM #
		nelem_860026625 = i_conv_ascii_dcb(pt_DECO_NUM_860026625, pt_BUF_860026625)
		erreur_860026625 = i_memcpy_art_field_n(g_iartout14,$Tcome::idpart,pt_BUF_860026625, nelem_860026625)
		erreur_860026625 = i_resize_tlv( g_iartout14, "T3t2", "idpart", nelem_860026625 *8 )

		#NDI : MSISDN V3t4
		SI (i_strplcmp (pt_NDI_860026625,"33",0,2) != 0)
		ALORS
			erreur_860026625 = i_format_str2( pt_BUF_860026625, "%s%s", "33", pt_NDI_860026625 )		
			i_strcpy(pt_NDI_860026625, pt_BUF_860026625)
		FINSI
		# Conversion ascii vers DCB de pt_NDI #
		nelem_860026625 = i_conv_ascii_dcb(pt_NDI_860026625, pt_BUF_860026625)
		erreur_860026625 = i_memcpy_art_field_n(g_iartout14,$Tcome::MSISDN,pt_BUF_860026625, nelem_860026625)
		erreur_860026625 = i_resize_tlv( g_iartout14, "T3t4", "MSISDN", nelem_860026625 *8 )

		#SDA : MailMsOrEntity V3t24
		SI (i_strplcmp (pt_IDUS_NUM_860026625,"33",0,2) != 0)
		ALORS
			erreur_860026625 = i_format_str2( pt_BUF_860026625, "%s%s", "33", pt_IDUS_NUM_860026625 )		
			i_strcpy(pt_IDUS_NUM_860026625, pt_BUF_860026625)
		FINSI
		erreur_860026625 = i_set_art_str(g_iartout14, $Tcome::MailMsOrEntity, pt_IDUS_NUM_860026625)
		nelem_860026625 = i_strlen(pt_IDUS_NUM_860026625)
		erreur_860026625 = i_resize_tlv(g_iartout14, "T3t24", "MailMsOrEntity", nelem_860026625)

		#Daudit : timeInCE  V4t30.1  date d'audit metropole
		erreur_860026625 = i_set_art_field(g_iartout14,$Tcome::timeInCE, DATE_AUDIT_860026625)
		
		#C_CSV1+OP_CSV1	: GASCII  V3t58
		#G4R4 QC756
		SI (pt_C_CSV1_860026625 == g_inull)
		ALORS
			i_strcpy(pt_C_CSV1_860026625, "   ")
		SINON
			erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", pt_C_CSV1_860026625,"   ")
			i_get_sub_str(pt_temp_860026625, 0, 2, pt_C_CSV1_860026625)
			trace2("__FILE__:__LINE__ ## TEST ## ======> pt_C_CSV1 <%s> #### ",pt_C_CSV1_860026625 ,"")
		FINSI
		
		SI (pt_OP_CSV1_860026625 == g_inull)
		ALORS
			i_strcpy(pt_OP_CSV1_860026625, "  ")
		SINON
			erreur_860026625 = i_format_str2(pt_temp_860026625, "%s%s", pt_OP_CSV1_860026625,"  ")
			i_get_sub_str(pt_temp_860026625, 0, 1, pt_OP_CSV1_860026625)
			trace2("__FILE__:__LINE__ ## TEST ## ======> pt_OP_CSV1 <%s> #### ",pt_OP_CSV1_860026625 ,"")
		FINSI
		
#		erreur = i_format_str2(pt_CSV, "%s%s", pt_C_CSV1 , pt_OP_CSV1)
		erreur_860026625 = i_format_str2(pt_TEMP_860026625, "%s%s", pt_C_CSV1_860026625 , pt_OP_CSV1_860026625)

		erreur_860026625 = i_set_art_str(g_iartout14, $Tcome::GASCII, pt_TEMP_860026625)
		nelem_860026625 = i_strlen(pt_TEMP_860026625)
		erreur_860026625 = i_resize_tlv(g_iartout14, "T3t58", "GASCII", nelem_860026625)

	# DRE G4R6 Lot3 + QC824
	
		# TYPE_EDIT
		SI i_strcmp(pt_TYPE_EDIT_860026625," ") != 0
		ALORS
			erreur_860026625=i_set_art_str(g_iartout14, $Tcome::TYPE_EDIT, pt_TYPE_EDIT_860026625)
		SINON
			erreur_860026625 = i_supprChamp(g_iartout14, "T3t72")
		FINSI
		
		# CODE_TARIF
		SI i_strcmp(pt_CODE_TARIF_860026625,"    ") != 0
		ALORS
			erreur_860026625=i_set_art_str(g_iartout14, $Tcome::CODE_TARIF, pt_CODE_TARIF_860026625)
		SINON
			erreur_860026625 = i_supprChamp(g_iartout14, "T3t73")
		FINSI
	# \DRE G4R6 lot3 + QC824

	FINSI
	#\DRE - G4R02 Envoi a COME 
FINSI

POINT P_SYMPH

# *************************** SYMPHONIE ***************************
############################################################################

instSYMPH_860026625 = i_LireInstanceECC(C_InstSYMP_860026625)
SI (!instSYMPH_860026625)
ALORS
	code_errone_860026625 = 0xA0B0
	code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
	erreur_860026625 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026625, C_InstSYMP_860026625, C_Article_860026625)
	SAUT DISTRI_ERR
FINSI

# G4R5 Lot2
#SI ( !RETOUR_CORR && (b_IDUS_NDIP == 0 || pt_BANIP_RTC != " " || CPT_REDIST == 2) )
# G4R5 LOT2 Criteres d'envoi a symphonie
SI ( !RETOUR_CORR_860026625 && (b_IDUS_NDIP_860026625 == 0 || i_strcmp(pt_IDUS_NDRTC_860026625," ")!=0 || CPT_REDIST_860026625 == 2) )
ALORS
	erreur_860026625 = i_AjouterCouranteECC(instSYMPH_860026625)
FINSI

SI !(i_ChercherCouranteECC(instSYMPH_860026625))
ALORS
	SI (i_dup_art_id(g_iartin, g_iartout12) != 0)
	ALORS
		code_errone_860026625 = 0xA0D0
		code_errone_860026625 = code_errone_860026625 + bEFFICACE_860026625
		erreur_860026625 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026625, C_Tsymphonie_860026625, C_Article_860026625)
		SAUT DISTRI_ERR
	FINSI
	erreur_860026625 = i_rename_art(g_iartout12, C_Tsymphonie_860026625)
	erreur_860026625 = i_ajoutChamp(g_iartout12, "T4CCD", "CCD", 0x02)

	# SGTQS
	erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::SGTQS, pt_SGTQS_860026625)

	# ECC_FACT
#DRE G4R02
#	SI (!bFE && !bFERPV && !bTRAFIC && !b_TRAFBSScritCOM )
	SI (!bFE_860026625 && !bFERPV_860026625 && !bTRAFIC_860026625 && !b_TRAFBSScritCOM_860026625 && !b_COME_860026625 )
	ALORS
		i_strcpy(pt_ECCFACT_860026625, "")
	SINON
		SI b_NPF_OPT_860026625
		ALORS
			i_strcpy(pt_ECCFACT_860026625, "TRAFOPT")
		FINSI
	FINSI
	erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::ECC_FACT, pt_ECCFACT_860026625)

	# CCD
	erreur_860026625 = i_set_art_field(g_iartout12, $Tsymtri2g118::CCD, CCD_REEL_860026625)

	# VGA_OP et VGA_OF
	SI b_CodOperVG_860026625
	ALORS
		erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::OPE_VGA, pt_CodOperVG_860026625)
		erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::OFF_VGA, pt_CodOffreVG_860026625)

	SINON
		erreur_860026625 = i_supprChamp(g_iartout12, "T4OPE_VGA")
		erreur_860026625 = i_supprChamp(g_iartout12, "T4OFF_VGA")
	FINSI

	# NBCOD
	erreur_860026625 = i_set_art_field(g_iartout12, $Tsymtri2g118::NBCOD, 1)

	# CSV
#	erreur = i_format_str2(pt_CSV, "%s%s", pt_C_CSV1, pt_OP_CSV1)
	erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::CSV, pt_CSV_860026625)

	# ND_RTC_42L
	SI (i_strcmp (pt_TETRIS_RTC_860026625, " ") != 0)
	ALORS
		erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::ND_RTC_42L, pt_TETRIS_RTC_860026625)
	SINON
		SI b_NPF_OPT_860026625
		ALORS
			SI (i_strcmp (pt_OPT_RTC_860026625, " ") != 0)
			ALORS
				erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::ND_RTC_42L, pt_OPT_RTC_860026625)
			SINON
				erreur_860026625 = i_supprChamp(g_iartout12, "T4ND_RTC_42L")
			FINSI
		SINON
			# G4R5 Lot2
			SI (i_strcmp (pt_BANIP_RTC_860026625, " ") != 0)
			ALORS
				# G4R5 Lot2
				erreur_860026625 = i_set_art_str(g_iartout12, $Tsymtri2g118::ND_RTC_42L, pt_BANIP_RTC_860026625)
			SINON
				erreur_860026625 = i_supprChamp(g_iartout12, "T4ND_RTC_42L")
			FINSI
		FINSI
	FINSI

	# DATE_LOCALE
	#trace(" ***** Ajout date locale pour symphonie ***** ")
	#trace1("__FILE__:__LINE__ ======> ***** ICAR_S : <%d> ***** ", ICAR_S)
	SI (ICAR_S_860026625 != 0)
	ALORS
		erreur_860026625 = i_set_art_field(g_iartout12, $Tsymtri2g118::DATE_LOCALE, ICAR_S_860026625)
	SINON
		erreur_860026625 = i_supprChamp(g_iartout12, "T4DATELOCALE")
	FINSI
	
# DRE G4R6 Lot3
	# TYPE_EDIT
	SI i_strcmp(pt_TYPE_EDIT_860026625," ") != 0
	ALORS
		erreur_860026625 = i_ajoutChampNum(g_iartout12, $Tsymtri2g118::T4type_edit,$Tsymtri2g118::TYPE_EDIT,0)
		erreur_860026625=i_set_art_str(g_iartout12, $Tsymtri2g118::TYPE_EDIT, pt_TYPE_EDIT_860026625)
	SINON
		erreur_860026625 = i_supprChamp(g_iartout12, "T4type_edit")
	FINSI

	# CODE_TARIF
	SI i_strcmp(pt_CODE_TARIF_860026625,"    ") != 0
	ALORS
		erreur_860026625 = i_ajoutChampNum(g_iartout12, $Tsymtri2g118::T4code_tarif,$Tsymtri2g118::CODE_TARIF,0)
		erreur_860026625=i_set_art_str(g_iartout12, $Tsymtri2g118::CODE_TARIF, pt_CODE_TARIF_860026625)
	SINON
		erreur_860026625 = i_supprChamp(g_iartout12, "T4code_tarif")
	FINSI
# \DRE G4R6 Lot3
	
FINSI

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

SI !(i_ChercherCouranteECC(instSYMPH_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout12,instSYMPH_860026625)
FINSI

SI CPT_REDIST_860026625 == 2
ALORS
	i_strcpy(pt_LIBELREDIST_860026625, "Indicatif inconnu de MAJ2G")
	SAUT REDIST
FINSI

SI (!i_ChercherCouranteECC(instTRAFIC_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout6, instTRAFIC_860026625)
FINSI

SI (!i_ChercherCouranteECC(instFE_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout8, instFE_860026625)
FINSI

SI (!i_ChercherCouranteECC(instSC_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout5, instSC_860026625)
FINSI

SI (!i_ChercherCouranteECC(instFERPV_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout13, instFERPV_860026625)
FINSI

SI (!i_ChercherCouranteECC(instDM_860026625))
ALORS
	SI (!i_ChercherCouranteECC(instFE_860026625))
	ALORS
		res_860026625 = i_stocke_art_iecc(g_iartout9, instDM_860026625)
	FINSI
FINSI

SI (!i_ChercherCouranteECC(instCENTVG_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout7, instCENTVG_860026625)
FINSI

SI (!i_ChercherCouranteECC(instTRAFBSS1_860026625) )
ALORS
	res_860026625 = i_stocke_art_iecc( g_iartout4, instTRAFBSS1_860026625 )
FINSI

SI (!i_ChercherCouranteECC(instTRAFBSS2_860026625) )
ALORS
	res_860026625 = i_stocke_art_iecc( g_iartout4, instTRAFBSS2_860026625 )
FINSI

SI (!i_ChercherCouranteECC(instCENTDEA_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout10, instCENTDEA_860026625)
FINSI

#DRE - G4R02 Envoi a COME 
SI (!i_ChercherCouranteECC(instCOME_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout14, instCOME_860026625)
FINSI

SI (!i_ChercherCouranteECC(instCOME_ELIGIBLE_860026625))
ALORS
	res_860026625 = i_stocke_art_iecc(g_iartout14, instCOME_ELIGIBLE_860026625)
FINSI
#\DRE - G4R02 Envoi a COME 


#DRE G4R6 QC816
SI bREDIST_SVA_860026625 == 1
ALORS
	SAUT REDIST
FINSI



RETOUR TRAIT_OK

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

POINT DISTRI_ERR

res_860026625 = i_make_art_rej(g_iartin, g_iartout3, code_errone_860026625)
res_860026625 = i_stocke_art(g_iartout3, 0, PT_ERRONE, 0)

RETOUR TRAIT_OK

############################################################################
# Stockage en REDISTRIBUTION
############################################################################

POINT REDIST

# On emet le message d erreur uniquement au 1er passage
SI (CPT_REDIST_860026625 == 0)
ALORS
	erreur_860026625 = i_PlvMessEmettre(8503, 2, g_iartin, "", 3, pt_LIBELREDIST_860026625, C_Article_860026625, pt_SGTQS_860026625)
FINSI

res_860026625 = i_stocke_art(g_iartin, 0, PT_REDIST|RD_TABLE1, 0)

RETOUR TRAIT_OK

# DRE G4R6 lot3
###################################################################################
########    Stockage en ELIMINE EXPLICITE  (REJET3 = 1 ex: cas DC 119)    #########
###################################################################################

POINT ELIMINE_EXP

trace( "Stockage en elimine explicite")
res_860026625 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0 )

RETOUR TRAIT_OK

# \DRE G4R6 lot3

#---------------------------Fin Tri2g118HP_dist.src-------------------------------
