DEFINITION C_Article_860026420 "Tbticsip"
DEFINITION BASE_860026420 1
DEFINITION MILEURODR_860026420 110
DEFINITION UTCDR_860026420 100
DEFINITION RES_CODCIR_860026420 3
DEFINITION RES_CODCIRDR_860026420 5
DEFINITION RES_UNITE_860026420 6
DEFINITION RES_TYPCTR_860026420 2
DEFINITION RES_TYPCOM_860026420 0
DEFINITION UTC_860026420 0
DEFINITION NUMTABSEL_860026420 1
DEFINITION NUMTAB_860026420 1
DEFINITION ZONE_METROPOLE_860026420 7
DEFINITION C_phone_860026420 ";phone-context=+33"
DEFINITION CATEG_860026420 0
DEFINITION CODE_ARTICLE_860026420 3
DEFINITION RES_CCD_860026420 1
DEFINITION CTR_REJET_860026420 11
DEFINITION CTR_REJET2_860026420 10
DEFINITION CTR_REJET3_860026420 12
DEFINITION CTR_REJET5_860026420 9
DEFINITION modulo_860026420 1000
DEFINITION C_Inst45S_860026420 "45S"
DEFINITION C_InstACLA_860026420 "ACLA"
DEFINITION C_Tferpv_860026420 "Tfe_rpv"
DEFINITION C_InstFERPV_860026420 "FERPV"
DEFINITION C_InstSYMP_860026420 "SYMP"
DEFINITION C_InstSPOT_860026420 "SPOT_IMS"
DEFINITION C_InstAFDB_860026420 "AFDB_BTIC"
DEFINITION C_TsymTbticsip_860026420 "TsymTbticsip"
DEFINITION C_Tspot_860026420 "TspotTbticsip"
DEFINITION C_Tafdb_860026420 "TafdbBticsip"
DEFINITION C_NDIPRESTACLIP_860026420 "NDIPrestaCLIP"
DEFINITION CTR_CPSRI_860026420 17
DEFINITION CTR_CPSLOC_860026420 16
DEFINITION TD_ALICE_860026420 9
DEFINITION C_instALICE_860026420 "ALICE"
REGISTRE ENTIER DATE_GMT_860026420
REGISTRE ENTIER Indicator_860026420
REGISTRE ENTIER RoleNode_860026420
REGISTRE ENTIER erreur_860026420
REGISTRE ENTIER code_rejet_860026420
REGISTRE ENTIER b_TERMINATING_860026420
REGISTRE ENTIER b_ORIGINATING_860026420
REGISTRE ENTIER EFFICACE_860026420
REGISTRE ENTIER FACTURABLE_860026420
REGISTRE ENTIER IDUS_INF_860026420
REGISTRE ENTIER NUMZONE_860026420
REGISTRE ENTIER LONGUEUR_860026420
REGISTRE ENTIER HLAHM1_860026420
REGISTRE ENTIER DEDE_INF_860026420
REGISTRE ENTIER Duree_860026420
REGISTRE ENTIER CODCIRDR_860026420
REGISTRE ENTIER CODCIR_860026420
REGISTRE ENTIER TYPCTR_860026420
REGISTRE ENTIER CCD_860026420
REGISTRE ENTIER TYPCOM_860026420
REGISTRE ENTIER NB_CSV_860026420
REGISTRE ENTIER inst45S_860026420
REGISTRE ENTIER ICID_CONVERTI_860026420
REGISTRE ENTIER res_860026420
REGISTRE ENTIER ZonTrav_860026420
REGISTRE ENTIER SomZonTrav_860026420
REGISTRE ENTIER I_860026420
REGISTRE ENTIER V_Inter_BTICSIP_860026420
REGISTRE ENTIER MEVO_860026420
REGISTRE ENTIER ASCallType_860026420
REGISTRE ENTIER NDI_INF_860026420
REGISTRE ENTIER ICAR_ABS_860026420
REGISTRE ENTIER DEDE_INTERNAT_860026420
REGISTRE ENTIER retour_BNC_860026420
REGISTRE ENTIER vc_860026420
REGISTRE ENTIER UNITE_860026420
REGISTRE ENTIER EPORTABILITE_SRP_860026420
REGISTRE ENTIER SPORTABILITE_SRP_860026420
REGISTRE ENTIER EPORTABILITE_SCP_860026420
REGISTRE ENTIER SPORTABILITE_SCP_860026420
REGISTRE ENTIER CCD_REEL_860026420
REGISTRE ENTIER instACLA_860026420
REGISTRE ENTIER lg_860026420
REGISTRE ENTIER Num1_860026420
REGISTRE ENTIER APPEL_MEVO_860026420
REGISTRE ENTIER b_Emessage_IP_860026420
REGISTRE ENTIER instFERPV_860026420
REGISTRE ENTIER instSYMP_860026420
REGISTRE ENTIER instSPOT_860026420
REGISTRE ENTIER instAFDB_860026420
REGISTRE ENTIER b_DEDE_absent_860026420
REGISTRE ENTIER b_SRP_TIERS_PTD_860026420
REGISTRE ENTIER b_118_TIERS_PTD_860026420
REGISTRE ENTIER DEDE_PRIVE_860026420
REGISTRE ENTIER IDUS_PRIVE_860026420
REGISTRE ENTIER b_Fact_CPS_Loc_860026420
REGISTRE ENTIER b_Fact_CPS_RI_860026420
REGISTRE ENTIER b_Fact_CPS_Act_860026420
REGISTRE ENTIER b_ALICE_860026420
REGISTRE ENTIER instALICE_860026420
REGISTRE ENTIER CPT_RDT_860026420
REGISTRE ENTIER bREDIST_860026420
REGISTRE ENTIER date_table_860026420
REGISTRE ENTIER code_errone_860026420
REGISTRE POINTEUR pt_BUF1_860026420
REGISTRE POINTEUR pt_IDUS_NUM_860026420
REGISTRE POINTEUR pt_DEDE_NUM1_860026420
REGISTRE POINTEUR pt_DEDE_NUM_860026420
REGISTRE POINTEUR pt_CALL_TYPE_860026420
REGISTRE POINTEUR pt_Info7_860026420
REGISTRE POINTEUR pt_NDI_860026420
REGISTRE POINTEUR pt_NDI_NUM_860026420
REGISTRE POINTEUR pt_Z_860026420
REGISTRE POINTEUR pt_ZABx_860026420
REGISTRE POINTEUR pt_IDUS_N2_860026420
REGISTRE POINTEUR pt_temp_860026420
REGISTRE POINTEUR pt_temp2_860026420
REGISTRE POINTEUR pt_C_CSV_860026420
REGISTRE POINTEUR pt_OP_CSV_860026420
REGISTRE POINTEUR pt_EccFact_860026420
REGISTRE POINTEUR pt_sgtqs_860026420
REGISTRE POINTEUR pt_CODESRP_860026420
REGISTRE POINTEUR pt_CODESCP_860026420
REGISTRE POINTEUR pt_debChamp1_860026420
REGISTRE POINTEUR pt_Num_860026420
REGISTRE POINTEUR pt_Num1_860026420
REGISTRE POINTEUR pt_DEDE_INF_860026420
REGISTRE POINTEUR pt_NOORIG_860026420
REGISTRE POINTEUR pt_DEDE_NUM_FAC_860026420
REGISTRE POINTEUR pt_SiteId_860026420
REGISTRE POINTEUR pt_MessageNDI_860026420
REGISTRE POINTEUR pt_datCPLUSS_860026420
REGISTRE POINTEUR pt_TARIF_860026420
REGISTRE POINTEUR pt_EDIT_860026420
REGISTRE POINTEUR pt_LIBELREDIST_860026420
#####################################################################
# DISTRIBUTION Tbticsip : DC de facturation transmises par la PF CGW-IMS
###########################################################################################
# ENTREE :
# 	Tbticsip	g_iartin
# 	Tbticsip	g_iartout
#
###########################################################################################
# SORTIE :
# 	TFERPV 		($Tfe_rpv		 g_iartout4)
# 	SYMPHONIE 	($TsymTbticsip	 g_iartout5)
#	SPOT  		(TspotTbticsip	 g_iartout6)
#	AFDB    	($TafdBticsip	 g_iartout7)	
# 	DISTRI_ERR	(DISTRI_ERR		 g_iartout8)
#
###########################################################################################
# HISTORIQUE
# 20/06/11 - DRE - RHE - G3R21 Creation
# 04/08/11 - THE - G3R22 QC497 QC498 + Allongement pointeur suite QC508
# 26/08/11 - DRE - G3R22 QC513
# 01/09/11 - DRE - G3R22 QC512 Modification de la valorisation du champ Demande envoye aux applications de facturation S0F5
# 01/12/11 - THE - G3R22C6 QC554 Valorisation DEDE_INF
# 05/12/11 - DRE - G3R23 QC555 modif initialisation pt_call_type
# 10/01/2012 - THE - VerifPcode G3R22C998 (pt_DEDE_NUM1)
# 10/02/2012 - DRE - G3R23 QC575 suppression trace ajout champ pour AFDB (champ CALL_TYPE)
# 21/03/2012 - DRE - G3R24 : nouveau palier tarifaire 0898PQ : SRP Tiers Deterministe
# 19/09/2012 - DRE - G4R1C1 lot2 Renvoi MEVO ou APPEL_MEVO par l'intermediaire de la table externe INTER (INm)
# 19/09/2012 - DRE - G4R1C1 lot2 Recherche de NDI dans la table externe TNDIPRESTACLIP avec le champ FD/T3Computeinfo12/SiteId
# 24/09/2012 - DRE - G4R1C1 lot2 QC638 Evolution : pas d'appel a la BNC pour les appels utilisant la numerotation privee
# 03/10/2012 - DRE - G4R1C2 lot2 QC645 Modification prefixe MEVO dans la table externe INTER (INn)
# 09/10/2012 - DRE - G4R1C2 lot2 QC649 Nature du NDI (NDI_INF) = 0x80 pour une valorisation du NDI via la table externe TNDIPRESTACLIP
# 15/10/2012 - DRE - G4R1C2 lot2 QC647 DC BTIC SIP entrant, num appelant plan prive
# 24/10/2012 - DRE - G4R1 lot2 Reprise QC647 pour num plan prive DC entrant et sortant
# 30/11/2012 - DRE - G4R1C5 QC668 Modification du nom de table externe TNDIPRESTACLIP en NDIPrestaCLIP 
# 03/12/2012 - DRE - G4R1C6 QC670 Modification du format des NDI dans la table NDIPrestaCLIP  
# 25/02/2013 - DRE - G4R2 QC686 Distinguer la cause de l'absence du NDI (Ajout de la cause dans pt_MessageNDI)
# 25/04/2013 - DRE - G4R3 lot1 Modification de la prise en compte de la notion d'interfonctionnement
# 31/05/2013 - DRE - Mise en conformit? Pcodes suite recompil Pdistribution (suppression suffixe fonctions)
# 30/08/2013 - DRE - G4R3C5 QC744 : Conversion %23 en # avant suppression
# 17/12/2013 - DRE - G4R5 QC772 Suppression des caracteres a partir de ";" au lieu de ";phone-context=+33"
# 25/03/2014 - THE - G4R6 Lot2  Creation C+S 
# 24/04/2014 - THE - G4R6 Lot3 ##### G4R6 QC808 #####
# 24/06/2014 - THE - G4R7 Lot1 ##### Appel ACLA avec tous les dde
# 25/07/2014 - THE - #G4R7 Lot3 QC834 envoi en redist si IC ALICE vide
#
###########################################################################################

# Constantes
#QC668
#G4R6 Lot2 


###########################################################################################
# Variables fonctionnelles
# DRE G3R24
# G3R22C6 QC554
#G3R24
#DRE G4R1C1 lot2
#G4R6 Lot2 


###########################################################################################
# DECLARATION POINTEUR
# VerifPcode
#DRE - G3R22 QC512
# DRE - G4R1 lot2
# DRE QC686
#G4R6 Lot2 


###########################################################################################
#Affectation Pointeur
pt_Info7_860026420	= "pt_Info71234567890"
pt_BUF1_860026420		= "pt_BUF2525252525252522552255225252525252552525225252552252525255252552525525255252552525252552525252525252525552525252525252525252525252525"
pt_IDUS_NUM_860026420 	= "pt_IDUS_NUM12312312312312312312312312132132131231231231231231231231231231231231213213123121312131213121312131213121311012345678901234567890"
#G3R22C998
pt_DEDE_NUM1_860026420	= "pt_DEDE_NUM13333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"
pt_DEDE_NUM_860026420	= "pt_DEDE_NUM2828828228282828282828282828282828282828282882828828282882828228288282282828828228822828282828822828282828822"
pt_CALL_TYPE_860026420	= "pt_CALL_TYPE"
pt_NDI_860026420		= "pt_NDI12121212121212121211212121212121212121212121212121212121212121212121212112121212121212121"
pt_NDI_NUM_860026420	= "pt_NDI_NUM19191919191919191919191191919191911919191919191919191919191919191919191919191911991191991191919"
pt_Z_860026420		= "pt_Z99999999"
pt_ZABx_860026420		= "pt_ZABx94949494"
pt_IDUS_N2_860026420	= "pt_IDUS_N2213121321312132131121321312131211312131213121312131213121321"
pt_temp_860026420		= "pt_temp178917891789178917891789178917899178917891789179178917917917917917197187"
pt_temp2_860026420	= "pt_temp21781781781781781781781781781718718178171817181781171817811781171817181718171817181781718"
#pt_DEDE_N	= "pt_DEDE_N1974197419741974197419741974197419741974197419543209876543456788990898765654334556778899000098765432"
pt_C_CSV_860026420	= "pt_C_CSV9898"
pt_OP_CSV_860026420	= "OP_CSV07070707"
pt_EccFact_860026420	= "pt_EccFact17617617617616176176"
pt_sgtqs_860026420	= "pt_sgtqs7777777497507597407694876"
pt_CODESRP_860026420	= "pt_CODESRP91791791791917917917917917917917917"
pt_CODESCP_860026420	= "pt_CODESCP32132132132132132132132132132132113"
pt_debChamp1_860026420	= "pt_debChamp179797979797979797979797979797979797979797979797979797979797979797979797979797"
pt_Num_860026420		= "pt_Num325999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234\
99991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123459999999991234599991234599999999912345999912345999999999123459999123555555554"
pt_Num1_860026420		= "99999999912345999912"
pt_DEDE_INF_860026420 	= "pt_DEDE_INF"
pt_NOORIG_860026420 	= "pt_NOORIG5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"
#DRE - G3R22 QC512
pt_DEDE_NUM_FAC_860026420	= "pt_DEDE_NUM_FAC08888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888"
# DRE - G4R1 lot2
pt_SiteId_860026420	= "pt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteId\
pt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteIdpt_SiteId"
#DRE QC686
pt_MessageNDI_860026420	= "pt_MessageNDI9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
#G4R6 Lot2 
pt_datCPLUSS_860026420 = "pt_datCPLUSS98765432109876543210"
pt_TARIF_860026420 = "pt_TARIF0123456789"
pt_EDIT_860026420 = "pt_EDIT0123456789"
pt_LIBELREDIST_860026420 = "pt_LIBELREDIST123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"


###########################################################################################
# Initialisation
Indicator_860026420	 = -1
#Status		 = -1
RoleNode_860026420	 = -1
erreur_860026420		 = 0
code_rejet_860026420	 = 0
b_ORIGINATING_860026420	 = 0
b_TERMINATING_860026420	 = 0
EFFICACE_860026420	 = 0
FACTURABLE_860026420	 = 0
IDUS_INF_860026420	 = 0
NUMZONE_860026420		 = -1
LONGUEUR_860026420	 = 0
DATE_GMT_860026420	 = 0
HLAHM1_860026420		 = -1
DEDE_INF_860026420	 = 0
Duree_860026420		 = -1
NB_CSV_860026420		 = 0
ASCallType_860026420	 = 0
ICID_CONVERTI_860026420	 = 0
res_860026420		 = 0
NDI_INF_860026420		 = 0
ICAR_ABS_860026420	 = 0
DEDE_INTERNAT_860026420	 = 0
retour_BNC_860026420	 = 0
vc_860026420		 = 0
UNITE_860026420		 = -1
Num1_860026420		 = 0
ZonTrav_860026420		 = 0
APPEL_MEVO_860026420	 = 0
EPORTABILITE_SRP_860026420 = 0
SPORTABILITE_SRP_860026420 = 0
EPORTABILITE_SCP_860026420 = 0
SPORTABILITE_SCP_860026420 = 0
b_Emessage_IP_860026420	 = 0
instFERPV_860026420	 = -1
instSYMP_860026420	 = -1
instSPOT_860026420	 = -1
instAFDB_860026420	 = -1
# G3R22C6 QC554
b_DEDE_absent_860026420	 = 0
#DRE G4R1C1 lot2
DEDE_PRIVE_860026420=0
IDUS_PRIVE_860026420=0
CODCIRDR_860026420=-1
CODCIR_860026420=-1
TYPCTR_860026420=-1
CCD_860026420 = 0xFF
TYPCOM_860026420 = 0xFF
#G4R6 Lot2 
b_Fact_CPS_Act_860026420 = 0
b_Fact_CPS_Loc_860026420 = 0
b_Fact_CPS_RI_860026420 = 0
b_ALICE_860026420 = 0
date_table_860026420 = 0


###########################################################################################
i_strcpy (pt_Info7_860026420,"" )
i_strcpy (pt_BUF1_860026420,"")
i_strcpy (pt_IDUS_NUM_860026420,"")
i_strcpy (pt_DEDE_NUM1_860026420,"")
i_strcpy (pt_DEDE_NUM_860026420,"")
#DRE QC555
#i_strcpy (pt_CALL_TYPE,"")
i_strcpy (pt_CALL_TYPE_860026420,"0")
i_strcpy(pt_NDI_860026420,"")
i_strcpy (pt_NDI_NUM_860026420,"")
i_strcpy (pt_Z_860026420,"")
i_strcpy (pt_ZABx_860026420,"")
i_strcpy (pt_IDUS_N2_860026420,"")
i_strcpy (pt_temp_860026420,"")
i_strcpy (pt_temp2_860026420,"")
#i_strcpy (pt_DEDE_N,"")
i_strcpy (pt_C_CSV_860026420,"")
i_strcpy (pt_OP_CSV_860026420," ")
i_strcpy (pt_sgtqs_860026420,"")
i_strcpy (pt_EccFact_860026420,"")
i_strcpy (pt_CODESRP_860026420,"")
i_strcpy (pt_CODESCP_860026420,"")
i_strcpy (pt_debChamp1_860026420,"")
i_strcpy (pt_Num_860026420,"")
i_strcpy (pt_Num1_860026420,"")
i_strcpy (pt_DEDE_INF_860026420,"")
i_strcpy (pt_NOORIG_860026420,"")
#DRE - G3R22 QC512
i_strcpy (pt_DEDE_NUM_FAC_860026420,"")
# DRE - G4R1 lot2
i_strcpy (pt_SiteId_860026420,"")
#DRE QC686
i_strcpy (pt_MessageNDI_860026420,"")
#G4R6 Lot2 
i_strcpy (pt_datCPLUSS_860026420,"")
i_strcpy(pt_TARIF_860026420,"    ")
i_strcpy(pt_EDIT_860026420," ")
i_strcpy(pt_LIBELREDIST_860026420," ")


###########################################################################################
#============================================================
trace("## Debut Distribution -  [ __FILE__ ] ")
#============================================================

#G4R1 DRE
erreur_860026420 = i_dup_art_id(g_iartin, g_iartout)

# Creation  article Conversion
erreur_860026420 = i_cree_art("Conversion",g_iartout10)

########################################################################
# SGTQS
########################################################################

i_strcpy(pt_sgtqs_860026420, i_LireEECSGTQS(g_ieec))

################################
# champ RoleNode
# RoleNode = 0 appel sortant (ORIGINATING)
# RoleNode = 1 appel entrant (TERMINATING)
################################
RoleNode_860026420 = i_get_art_field(g_iartout, $Tbticsip::RoleNode)
SI (RoleNode_860026420 == 0)
ALORS
	b_ORIGINATING_860026420 = 1
SINON
	b_TERMINATING_860026420 = 1
FINSI

########################################################################
# ICAR_ABS
########################################################################
# DATE_GMT UTC
DATE_GMT_860026420 = i_get_art_field(g_iartout, $Tbticsip::StartTime_SDATE)

# Metropole
ICAR_ABS_860026420 = i_DHgetLocalTime(NUMTAB_860026420,ZONE_METROPOLE_860026420,DATE_GMT_860026420)

################################
#EFFICACITE
################################

SI (i_valid_field_n(g_iartout,$Tbticsip::ASCallType))
ALORS
	SI i_get_art_field(g_iartout, $Tbticsip::ASCallType) != 7
	ALORS
		SI (i_valid_field_n(g_iartout,$Tbticsip::AnswerIndicator))
		ALORS
			Indicator_860026420 = i_get_art_field(g_iartout, $Tbticsip::AnswerIndicator)

			SI (Indicator_860026420 == 0x00 || Indicator_860026420 == 0x02)
			ALORS
				SI (i_valid_field_n(g_iartout, $Tbticsip::CallDuration))
				ALORS
					Duree_860026420 = i_get_art_field(g_iartout, $Tbticsip::CallDuration)

					SI (Duree_860026420 > 0x00)
					ALORS
						SI (i_valid_field_n(g_iartout, $Tbticsip::CORLStatus))
						ALORS
							erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::CORLStatus,pt_Info7_860026420)
							SI (i_strcmp(pt_Info7_860026420,"6") != 0)
							ALORS
								EFFICACE_860026420 = 1
							FINSI
						FINSI
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
FINSI


# -------------------------------------------------------------
# Identification de la provenance de l'article (redistribution)
# -------------------------------------------------------------
# CPT_RDT : nb de passage en redistribution
CPT_RDT_860026420 = -1
CPT_RDT_860026420 = i_LireRedistCpt()
#trace1(" ============= nb de passage en redistribution Cpt = <%d> ===",CPT_RDT)


#G4R1 QC638 DRE
# DRE G4R1C1 lot2 calcul remonte
########################################################################
# V_Inter_BTICSIP
########################################################################
V_Inter_BTICSIP_860026420 = 0
SI (i_valid_field_n(g_iartout, $Tbticsip::VirtOnNetType))
ALORS
	i_strcpy (pt_BUF1_860026420,"")
	erreur_860026420 = i_get_art_str(g_iartout, $Tbticsip::VirtOnNetType,pt_BUF1_860026420)

#25/04/2013 DRE G4R3 lot1
#	SI ( (i_get_art_field(g_iartout, $Tbticsip::ASCallType) == 0x03) && (i_strcmp(pt_BUF1,"BTIP") == 0) )
#	ALORS
#		Inter_BTICSIP_BTIPSIP = 1
#	FINSI

	SI ( (i_get_art_field(g_iartout, $Tbticsip::ASCallType) == 0x03) )
	ALORS
		#Chercher dans la table Inter : Cle = INo+VirtOnNetType
		erreur_860026420 = i_format_str2( pt_temp_860026420, "%s%s", "INo", pt_BUF1_860026420 )
		SI i_strcmp(i_get_tab_field( "Inter", DATE_GMT_860026420, pt_temp_860026420 ),"1") == 0 
		ALORS 
			V_Inter_BTICSIP_860026420 = 1
		FINSI
	FINSI
#\25/04/2013 DRE G4R3 lot1

FINSI
# DRE G4R1C1 lot2 calcul remonte
#\G4R1 QC638 DRE


##########################################################################################################
#G4R6 Lot2 TDATCPS
#-----------------------------------------------------------
# DATCPS : Determine si la Tv2oip::DATE est egale ou posteriereure a celle
# retournee par la table TDATCPS
#------------------------------------------------------------
i_strcpy (pt_datCPLUSS_860026420,i_get_tab_field("TDATCPS", DATE_GMT_860026420, "DATCPS"))
erreur_860026420 = i_set_art_str (g_iartout10,$Conversion::DATE_STR,pt_datCPLUSS_860026420)
date_table_860026420 = i_get_art_field(g_iartout10, $Conversion::DATE_ASC)

SI DATE_GMT_860026420 >= date_table_860026420
ALORS
	b_Fact_CPS_Act_860026420 = 1
FINSI

########################################################################
#NB_CSV
#pt_C_CSV
#pt_OP_CSV
########################################################################

SI (i_valid_field_n(g_iartout, $Tbticsip::RedirecNb))
ALORS
	NB_CSV_860026420 = 1
	i_strcpy (pt_C_CSV_860026420,"T")
	i_strcpy (pt_OP_CSV_860026420,"U")
FINSI

################################
#Normalisation Numero Demandeur
################################

i_strcpy (pt_IDUS_NUM_860026420,"")
SI (i_valid_field_n(g_iartout, $Tbticsip::RedirecNb))
ALORS
	erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::RedirecNb,pt_IDUS_NUM_860026420)
SINON
	SI (i_valid_field_n(g_iartout, $Tbticsip::CallingPart02))
	ALORS
		erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::CallingPart02,pt_IDUS_NUM_860026420)
	SINON
		SI (i_valid_field_n(g_iartout, $Tbticsip::Computeinfo05))
		ALORS
			erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::Computeinfo05,pt_IDUS_NUM_860026420)
		FINSI
	FINSI
FINSI

SI i_strcmp(pt_IDUS_NUM_860026420,"") != 0
ALORS
	LONGUEUR_860026420 = i_strlen(pt_IDUS_NUM_860026420)
	erreur_860026420 = i_recupererValeur(pt_IDUS_NUM_860026420,pt_BUF1_860026420,LONGUEUR_860026420,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_IDUS_NUM = %s ======= pt_BUF1 = %s ====",pt_IDUS_NUM,pt_BUF1)

	res_860026420 = 0
	SI (i_strplcmp(pt_BUF1_860026420,"sip:+",0,5) == 0 || i_strplcmp(pt_BUF1_860026420,"tel:+",0,5) == 0 )
	ALORS
		res_860026420 = res_860026420 + 5
	FINSI

	SI (i_strplcmp(pt_BUF1_860026420,"+",0,1) == 0)
	ALORS
		res_860026420 = res_860026420 + 1
	FINSI
	i_get_sub_str(pt_BUF1_860026420,res_860026420,-1,pt_IDUS_NUM_860026420)
	
#DRE QC647
	########################################################################
	# IDUS_PRIVE
	########################################################################
	SI (i_strplcmp(pt_IDUS_NUM_860026420,"P",0,1) == 0)
	ALORS
		LONGUEUR_860026420 = i_strlen(pt_IDUS_NUM_860026420)
		erreur_860026420 = i_recupererValeur(pt_IDUS_NUM_860026420,pt_BUF1_860026420,LONGUEUR_860026420,'_')
		LONGUEUR_860026420 = i_strlen(pt_IDUS_NUM_860026420)
#QC647
	FINSI
	SI LONGUEUR_860026420 < 9
	ALORS
		IDUS_PRIVE_860026420 = 1
	FINSI
#QC647
#	FINSI

	SI IDUS_PRIVE_860026420 == 1
	ALORS
		IDUS_INF_860026420 = 0x80
	SINON
# \DRE QC647
		res_860026420 = 0
		SI ( i_strplcmp(pt_IDUS_NUM_860026420,"33",0,2)==0 )
		ALORS
			res_860026420 = 2
		FINSI
		SI ( i_strplcmp(pt_IDUS_NUM_860026420,"262",0,3) == 0 || i_strplcmp(pt_IDUS_NUM_860026420,"269",0,3) == 0
		  || i_strplcmp(pt_IDUS_NUM_860026420,"590",0,3) == 0 || i_strplcmp(pt_IDUS_NUM_860026420,"594",0,3) == 0
		  || i_strplcmp(pt_IDUS_NUM_860026420,"596",0,3) == 0 || i_strplcmp(pt_IDUS_NUM_860026420,"508",0,3) == 0 )
		ALORS
			res_860026420 = 3
		FINSI
	
		# IDUS_INF international
		IDUS_INF_860026420 = 0xC0
		# Si national : IDUS_INF=0x80 et pt_IDUS_NUM
		SI res_860026420 > 0
		ALORS
			i_get_sub_str(pt_IDUS_NUM_860026420,res_860026420,-1,pt_IDUS_NUM_860026420)
			#national
			IDUS_INF_860026420 = 0x80
		FINSI
	FINSI
FINSI

# pt_NOORIG pour FERPV NOORIG
i_strcpy(pt_NOORIG_860026420,pt_IDUS_NUM_860026420)


################################
#Normalisation NDI
################################

#DRE G4R1C1 lot2  
# Si FD/T3Computeinfo06/NDI absent et FD/T3Computeinfo12/SiteId present alors
#	  Recherche de NDI dans la table externe NDIPrestaCLIP avec le champ FD/T3Computeinfo12/SiteId
#
SI ! (i_valid_field_n(g_iartout, $Tbticsip::NDI))
ALORS
	SI (i_valid_field_n(g_iartout, $Tbticsip::SiteId))
	ALORS
		i_strcpy(pt_NDI_NUM_860026420,"")
		erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::SiteId,pt_SiteId_860026420)
# DRE G4R1C5 QC668
#		i_strcpy( pt_NDI_NUM, i_get_tab_field( "TNDIPRESTACLIP", DATE_GMT, pt_SiteId ))
		i_strcpy( pt_NDI_NUM_860026420, i_get_tab_field( C_NDIPRESTACLIP_860026420, DATE_GMT_860026420, pt_SiteId_860026420 ))
		SI (i_strcmp(pt_NDI_NUM_860026420, g_inull) != 0 )
		ALORS
			# G4R1 QC649
			erreur_860026420 = i_ajoutChampNum( g_iartout,$Tbticsip::T3ComputeInfo06,$Tbticsip::NDI,0 )
			erreur_860026420 = i_set_art_str( g_iartout, $Tbticsip::NDI,pt_NDI_NUM_860026420 )
			erreur_860026420 = i_resize_tlv ( g_iartout, "T3ComputeInfo06","NDI", i_strlen(pt_NDI_NUM_860026420) )
# DRE G4R1C6 QC670
#			NDI_INF = 0x80
#			SAUT SUITE_NDI
# DRE QC686
		SINON
			erreur_860026420 = i_format_str2(pt_MessageNDI_860026420,"DC facturant champ SITEID <%s> non trouve dans la table <%s>",pt_SiteId_860026420,C_NDIPRESTACLIP_860026420)
		FINSI
	SINON
		# DC facturant champ NDI et SITEID absents
		i_strcpy(pt_MessageNDI_860026420,"DC facturant champ NDI et SITEID absents")
	FINSI
FINSI
			

#FD/svcCompinfo06/Computeinfo06 (NDI)
i_strcpy(pt_NDI_NUM_860026420,"")
i_strcpy(pt_NDI_860026420,"")

SI (i_valid_field_n(g_iartout, $Tbticsip::NDI))
ALORS
	erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::NDI,pt_NDI_860026420)
	LONGUEUR_860026420 = i_strlen(pt_NDI_860026420)
	erreur_860026420 = i_recupererValeur(pt_NDI_860026420,pt_BUF1_860026420,LONGUEUR_860026420,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_NDIAscii = %s ======= pt_BUF1 = %s ====",pt_NDIAscii,pt_BUF1)


	res_860026420 = 0
	SI (i_strplcmp(pt_BUF1_860026420,"sip:",0,4) == 0 || i_strplcmp(pt_BUF1_860026420,"tel:",0,4) == 0 )
	ALORS
		res_860026420 = res_860026420 + 4
	FINSI
	# G3R22 QC498 SI (i_strplcmp(pt_BUF1,"+",0,1) == 0)
	SI (i_strplcmp(pt_BUF1_860026420,"+",res_860026420,1) == 0)
	ALORS
		res_860026420 = res_860026420 + 1
# DRE G4R1C6 QC670
#	FINSI
	SINON
		SI (i_strplcmp(pt_BUF1_860026420,"00",res_860026420,2) == 0)
		ALORS
			res_860026420 = res_860026420 + 2
		FINSI
	FINSI
# \DRE G4R1C6 QC670

	SI (i_strplcmp(pt_BUF1_860026420,"33",res_860026420,2)==0)
	ALORS
		res_860026420 = res_860026420 + 2
		#national
		NDI_INF_860026420 = 0x80
	SINON
		SI ( i_strplcmp(pt_BUF1_860026420,"262",res_860026420,3) == 0 || i_strplcmp(pt_BUF1_860026420,"269",res_860026420,3) == 0
		  || i_strplcmp(pt_BUF1_860026420,"590",res_860026420,3) == 0 || i_strplcmp(pt_BUF1_860026420,"594",res_860026420,3) == 0
		  || i_strplcmp(pt_BUF1_860026420,"596",res_860026420,3) == 0 || i_strplcmp(pt_BUF1_860026420,"508",res_860026420,3) == 0 )
		ALORS
			res_860026420 = res_860026420 + 3
			#national
			NDI_INF_860026420 = 0x80
		SINON
			#international
			NDI_INF_860026420 = 0xC0
		FINSI
	FINSI

	########################################################################
	#Mise au format numero demandeur NDI_NUM
	#pt_NDI_NUM
	########################################################################

	i_get_sub_str(pt_BUF1_860026420,res_860026420,-1,pt_NDI_NUM_860026420)
	#trace2(">>>__LINE__>>>====== pt_NDI = %s ======= pt_NDI_NUM = %s ====",pt_NDI,pt_NDI_NUM)
POINT SUITE_NDI	
	SI (b_ORIGINATING_860026420)
	ALORS
		#cas appel sortant
		IDUS_INF_860026420 = NDI_INF_860026420
		i_strcpy(pt_IDUS_NUM_860026420,pt_NDI_NUM_860026420)
#DRE QC647
		IDUS_PRIVE_860026420 = 0
	FINSI
FINSI
#trace1 (">>>__LINE__>>>=======NDI_INF = 0x%x =========",NDI_INF)


################################
# FACTURABLE
################################
SI (EFFICACE_860026420 && b_ORIGINATING_860026420 && IDUS_INF_860026420 == 0x80)
ALORS
	FACTURABLE_860026420 = 1
FINSI

################################################################
#
#	Controle croises
#
################################################################
#
SI FACTURABLE_860026420 == 1
ALORS
	SI i_valid_field_n(g_iartout, $Tbticsip::NDI) == 0
	ALORS
		#E.TBTICSIP.TC20
		code_rejet_860026420 = 0x5041
# DRE QC686
#		erreur = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet,C_Article,"DC Facturable, il manque le champ NDI")
		erreur_860026420 = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,pt_MessageNDI_860026420)
		SAUT DISTRI_ERR
	FINSI

	SI i_valid_field_n(g_iartout, $Tbticsip::CalledNumber) == 0 && i_valid_field_n(g_iartout, $Tbticsip::AsCalledPartyAd) == 0
	ALORS
		#E.TBTICSIP.TC21
		code_rejet_860026420 = 0x5041
		erreur_860026420 = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,"DC Facturable, il manque le champ CalledNumber ou le champ AsCalledPartyAd")
		SAUT DISTRI_ERR
	FINSI

	SI i_valid_field_n(g_iartout, $Tbticsip::ICID) == 0
	ALORS
		#E.TBTICSIP.TC22
		code_rejet_860026420 = 0x5041
		erreur_860026420 = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,"DC Facturable, il manque le champ ICID")
		SAUT DISTRI_ERR
	FINSI

	SI i_valid_field_n(g_iartout, $Tbticsip::RedirecNb) == 0 && i_valid_field_n(g_iartout, $Tbticsip::CallingPart02) == 0 && i_valid_field_n(g_iartout, $Tbticsip::Computeinfo05) == 0
	ALORS
		#E.TBTICSIP.TC23
		code_rejet_860026420 = 0x5041
		erreur_860026420 = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,"DC Facturable, il manque le champ RedirecNb ou le champ CallingPart02 ou le champ Computeinfo05")
		SAUT DISTRI_ERR
	FINSI

	SI i_valid_field_n(g_iartout, $Tbticsip::CallDuration) == 0
	ALORS
		#E.TBTICSIP.TC24
		code_rejet_860026420 = 0x5041
		erreur_860026420 = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,"DC Facturable, il manque le champ CallDuration")
		SAUT DISTRI_ERR
	FINSI
FINSI


######################
#  HLAHM1
######################
SI (IDUS_INF_860026420 == 0x80)
ALORS
	LONGUEUR_860026420 = i_conv_ascii_dcb(pt_IDUS_NUM_860026420, pt_BUF1_860026420)
	erreur_860026420 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_BUF1_860026420, LONGUEUR_860026420)
	NUMZONE_860026420 = i_DHgetZoneID(NUMTABSEL_860026420, g_iartout10)
	HLAHM1_860026420 = i_DHgetLocalTime(NUMTAB_860026420,NUMZONE_860026420,DATE_GMT_860026420)
FINSI

# DRE QC647
SI ( IDUS_PRIVE_860026420 == 0 )
ALORS
	########################################################################
	# Normalisation du demandeur 	IDUS_N2
	########################################################################
	
	# Demandeur national
	#trace2("<<<__LINE__<<< avant normalisation  pt_IDUS_NUM = %s=====",pt_IDUS_NUM,"")
	i_get_sub_str(pt_IDUS_NUM_860026420,0,0,pt_Z_860026420)
	
	SI (IDUS_INF_860026420 == 0x80)
	ALORS
		SI (( i_strcmp("0",pt_Z_860026420) == 0 || i_strcmp("6", pt_Z_860026420) == 0 || i_strcmp("7", pt_Z_860026420) == 0) && FACTURABLE_860026420)
		ALORS
			#trace(">>>__LINE__>>> erreur de normalisateur du demandeur")
			erreur_860026420 = i_format_str2(pt_BUF1_860026420,"%s","Erreur de normalisateur du demandeur : ",pt_IDUS_NUM_860026420)
			code_rejet_860026420 = 0xA011
			erreur_860026420 = i_PlvMessEmettre(8612,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,pt_BUF1_860026420)
			SAUT DISTRI_ERR
		FINSI
	
		SI (i_strcmp("6", pt_Z_860026420) == 0 || i_strcmp("7", pt_Z_860026420) == 0 || i_strcmp("8", pt_Z_860026420) == 0 || i_strcmp("9", pt_Z_860026420) == 0 )
		ALORS
			erreur_860026420 = i_format_str2(pt_IDUS_N2_860026420,"%s%s","0*",pt_IDUS_NUM_860026420)
		FINSI
	
		SI (i_strcmp("1", pt_Z_860026420) == 0 || i_strcmp("2", pt_Z_860026420)== 0 || i_strcmp("3", pt_Z_860026420) == 0 || i_strcmp("4", pt_Z_860026420)== 0 || i_strcmp("5", pt_Z_860026420) == 0)
		ALORS
			erreur_860026420 = i_format_str2(pt_IDUS_N2_860026420,"%s%s","0",pt_IDUS_NUM_860026420)
		FINSI
	
		# Demandeur DOM
	
		i_get_sub_str(pt_IDUS_NUM_860026420,0,3,pt_ZABx_860026420)
		SI (i_strcmp(pt_ZABx_860026420,"9760")==0 || i_strcmp(pt_ZABx_860026420,"9761")==0 || i_strcmp(pt_ZABx_860026420,"9762")==0 || i_strcmp(pt_ZABx_860026420,"9763")==0 || i_strcmp(pt_ZABx_860026420,"9764")==0 || i_strcmp(pt_ZABx_860026420,"9765")==0
		||i_strcmp(pt_ZABx_860026420,"9766")==0 || i_strcmp(pt_ZABx_860026420,"9767")==0 || i_strcmp(pt_ZABx_860026420,"9768")==0 )
		ALORS
			erreur_860026420 = i_format_str2(pt_IDUS_N2_860026420,"%s%s","0*",pt_ZABx_860026420)
		FINSI
	FINSI
	#trace2("<<<__LINE__ apres normalisation pt_IDUS_N2 = %s========",pt_IDUS_N2,"")
	
	# Demandeur international
	
	SI (IDUS_INF_860026420 == 0xC0)
	ALORS
		#trace(">>>__LINE__>>>IDUS international normalisation pas de changement")
		i_strcpy(pt_IDUS_N2_860026420,pt_IDUS_NUM_860026420)
	FINSI
	
	
	LONGUEUR_860026420 = i_strlen(pt_IDUS_N2_860026420)
	SI LONGUEUR_860026420 > 10
	ALORS
		i_get_sub_str(pt_IDUS_N2_860026420,0,9,pt_IDUS_N2_860026420)
		erreur_860026420 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, pt_IDUS_N2_860026420,11)
	SINON
		erreur_860026420 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, pt_IDUS_N2_860026420,LONGUEUR_860026420+1)
		#trace2(">>>__LINE__>>> Tcopo::NDR =%s",pt_IDUS_BNC,"")
	FINSI
	#trace2 ("<<<<__LINE__ <<<<< pt_IDUS_N2 = %s ===========",pt_IDUS_N2,"")
FINSI

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

########################################################################
#DEDE_NUM1
########################################################################

i_strcpy (pt_DEDE_NUM1_860026420,"")
i_strcpy (pt_BUF1_860026420,"")

SI b_TERMINATING_860026420
ALORS
	SI (i_valid_field_n(g_iartout, $Tbticsip::NDI))
	ALORS
		erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::NDI,pt_DEDE_NUM1_860026420)
	SINON
		b_DEDE_absent_860026420 = 1
	FINSI
SINON
	SI (i_valid_field_n(g_iartout, $Tbticsip::CalledNumber))
	ALORS
		erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::CalledNumber,pt_DEDE_NUM1_860026420)
	SINON
		SI (i_valid_field_n(g_iartout, $Tbticsip::AsCalledPartyAd))
		ALORS
			erreur_860026420 = i_get_art_str(g_iartout,$Tbticsip::AsCalledPartyAd,pt_DEDE_NUM1_860026420)
		SINON
			b_DEDE_absent_860026420 = 1
		FINSI
	FINSI
FINSI

SI i_strcmp(pt_DEDE_NUM1_860026420,"") != 0
ALORS
	LONGUEUR_860026420 = i_strlen(pt_DEDE_NUM1_860026420)
	erreur_860026420 = i_recupererValeur(pt_DEDE_NUM1_860026420,pt_BUF1_860026420,LONGUEUR_860026420,'@')
	#trace1(">>>__LINE__>>>====== Longueur = %d ===========", LONGUEUR)
	#trace2(">>>__LINE__>>>====== pt_DEDE_NUM1 = %s ======= pt_BUF1 = %s ====",pt_DEDE_NUM1,pt_BUF1)

	res_860026420 = 0
	SI (i_strplcmp(pt_BUF1_860026420,"sip:",0,4) == 0 || i_strplcmp(pt_BUF1_860026420,"tel:",0,4) == 0 )
	ALORS
		res_860026420 = res_860026420 + 4
	FINSI

	SI (i_strplcmp(pt_BUF1_860026420,"847",0,3) == 0)
	ALORS
		res_860026420 = res_860026420 + 3
	FINSI

	i_get_sub_str(pt_BUF1_860026420,res_860026420,-1,pt_DEDE_NUM1_860026420)


# G4R5 QC772
	## suppression de la chaine C_phone (voir constante)
	#i_strcpy(pt_DEDE_NUM1,REMPLACE_CHAINE(pt_DEDE_NUM1, C_phone, ""))
	#
	
	# Si ? ; ? present, suppression des caracteres a partir de ? ; ?
	i_strcpy (pt_BUF1_860026420,pt_DEDE_NUM1_860026420)
	erreur_860026420 = i_recupererValeur(pt_BUF1_860026420, pt_DEDE_NUM1_860026420, i_strlen(pt_BUF1_860026420),';')
#\G4R5 QC772

# DRE QC744 Conversion avant suppression
	# remplacement de %23 par #
	erreur_860026420 = i_adequation_chaine_expreg (pt_DEDE_NUM1_860026420, "%23")
	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)
	SI erreur_860026420 == 0
	ALORS
		i_strcpy(pt_DEDE_NUM1_860026420,REMPLACE_CHAINE_860026233(pt_DEDE_NUM1_860026420,"%23","#"))
	FINSI

	# suppression du "#" de fin
	i_get_sub_str(pt_DEDE_NUM1_860026420, -1, -1, pt_temp_860026420)
	SI i_strcmp(pt_temp_860026420, "#") == 0
	ALORS
		i_get_sub_str(pt_DEDE_NUM1_860026420, 0, -2, pt_DEDE_NUM1_860026420)
	FINSI

#	# remplacement de %23 par #
#	erreur = i_adequation_chaine_expreg (pt_DEDE_NUM1, "%23")
#	#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)
#	SI erreur == 0
#	ALORS
#		i_strcpy(pt_DEDE_NUM1,REMPLACE_CHAINE(pt_DEDE_NUM1,"%23","#"))
#	FINSI

	#Remplacer * par B et # par C
	i_replace_str(pt_DEDE_NUM1_860026420,"*#","BC",pt_DEDE_NUM1_860026420)
FINSI


########################################################################
#DEDE_INTERNAT
########################################################################

#QC513 DRE
SI ( i_strplcmp(pt_DEDE_NUM1_860026420,"+",0,1) == 0 )
ALORS
	SI ( i_strplcmp(pt_DEDE_NUM1_860026420,"33",1,2) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"262",1,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"594",1,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"596",1,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"590",1,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"508",1,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"2696",1,4) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"2692",1,4) != 0 )
	ALORS
		DEDE_INTERNAT_860026420 = 1
	FINSI
FINSI

SI (i_strplcmp(pt_DEDE_NUM1_860026420,"00",0,2) == 0 )
ALORS
	SI ( i_strplcmp(pt_DEDE_NUM1_860026420,"33",2,2) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"262",2,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"594",2,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"596",2,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"590",2,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"508",2,3) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"2696",2,4) != 0
	  && i_strplcmp(pt_DEDE_NUM1_860026420,"2692",2,4) != 0 )
	ALORS
		DEDE_INTERNAT_860026420 = 1
	FINSI
FINSI
#\QC513 DRE


########################################################################
# Modification DEDE_NUM
########################################################################

#QC513 DRE
i_strcpy (pt_DEDE_NUM_860026420,pt_DEDE_NUM1_860026420)

SI ( i_strplcmp(pt_DEDE_NUM_860026420,"+",0,1) == 0 )
ALORS
	i_get_sub_str(pt_DEDE_NUM_860026420,1,-1,pt_DEDE_NUM_860026420)
SINON
	SI (i_strplcmp(pt_DEDE_NUM_860026420,"00",0,2) == 0 )
	ALORS
		i_get_sub_str(pt_DEDE_NUM_860026420,2,-1,pt_DEDE_NUM_860026420)
	FINSI
FINSI

# QC647 deplacement du calcul du DEDE_PRIVE ICI
#G4R1 QC638 DRE
########################################################################
# DEDE_PRIVE
########################################################################

LONGUEUR_860026420 = i_strlen(pt_DEDE_NUM_860026420)
SI (LONGUEUR_860026420 < 9)
ALORS
	SI i_valid_field_n(g_iartout, $Tbticsip::ASCallType)
	ALORS
		ASCallType_860026420 = i_get_art_field(g_iartout, $Tbticsip::ASCallType)
		SI ASCallType_860026420 == 0x01 || ASCallType_860026420 == 0x02 || V_Inter_BTICSIP_860026420 == 1
		ALORS
			DEDE_PRIVE_860026420 = 1
		FINSI
	FINSI
FINSI
#\G4R1 QC638 DRE
# fin QC647 deplacement du calcul du DEDE_PRIVE ICI

#QC647
SI DEDE_PRIVE_860026420 == 0
ALORS
	SI (i_strplcmp(pt_DEDE_NUM_860026420,"33",0,2)==0)
	ALORS
		i_get_sub_str(pt_DEDE_NUM_860026420,2,-1,pt_DEDE_NUM_860026420)
	SINON
		SI ( i_strplcmp(pt_DEDE_NUM_860026420,"262",0,3) == 0 || i_strplcmp(pt_DEDE_NUM_860026420,"594",0,3) == 0 
		  || i_strplcmp(pt_DEDE_NUM_860026420,"596",0,3) == 0 || i_strplcmp(pt_DEDE_NUM_860026420,"590",0,3) == 0 )
		ALORS
			i_get_sub_str(pt_DEDE_NUM_860026420,3,-1,pt_DEDE_NUM_860026420)
		FINSI
	FINSI

	SI DEDE_INTERNAT_860026420 != 1
	ALORS
		SI (i_strplcmp(pt_DEDE_NUM_860026420,"0",0,1)==0  && i_strplcmp(pt_DEDE_NUM_860026420,"0",1,1) != 0)
		ALORS
			i_get_sub_str(pt_DEDE_NUM_860026420,1,-1,pt_DEDE_NUM_860026420)
		FINSI
	FINSI
	#\QC513 DRE
#QC647
FINSI

# QC647 deplacement du calcul du DEDE_PRIVE au-dessus
##G4R1 QC638 DRE
#########################################################################
## DEDE_PRIVE
#########################################################################
#
#LONGUEUR = i_strlen(pt_DEDE_NUM)
#SI (LONGUEUR < 9)
#ALORS
#	SI i_valid_field_n(g_iartout, $Tbticsip::ASCallType)
#	ALORS
#		ASCallType = i_get_art_field(g_iartout, $Tbticsip::ASCallType)
#		SI ASCallType == 0x01 || ASCallType == 0x02 || Inter_BTICSIP_BTIPSIP == 1
#		ALORS
#			DEDE_PRIVE = 1
#		FINSI
#	FINSI
#FINSI
##\G4R1 QC638 DRE
# fin QC647 deplacement du calcul du DEDE_PRIVE au-dessus

##############################################################################
# DEDE_INF (0x80: national, 0x40: special, 0xC0: international)
##############################################################################

# G3R22C6 QC554
#G4R1 QC638 DRE
SI b_DEDE_absent_860026420 || DEDE_PRIVE_860026420
ALORS
	DEDE_INF_860026420 = 0x00
SINON
	SI  DEDE_INTERNAT_860026420
	ALORS
		#International
		DEDE_INF_860026420 = 0xC0
		i_strcpy(pt_DEDE_INF_860026420 , "C0")
	SINON
		SI (i_strlen(pt_DEDE_NUM_860026420)< 7)
		ALORS
			#numero special
			DEDE_INF_860026420 = 0x40
			i_strcpy(pt_DEDE_INF_860026420 , "40")
		SINON
			#National
			DEDE_INF_860026420 = 0x80
			i_strcpy(pt_DEDE_INF_860026420 , "80")
		FINSI
	FINSI
FINSI
# \G3R22C6 QC554

#G4R1 QC638 DRE
SI DEDE_PRIVE_860026420 || IDUS_PRIVE_860026420
ALORS
	SAUT SUITE_NUM_PRIVE
FINSI
#\G4R1 QC638 DRE
#=================================================================#

##############################################################################
# elimination prefixe 150PQ ou VWXY
##############################################################################
#QC513 DRE
SI (DEDE_INF_860026420 == 0x80)
ALORS
	LONGUEUR_860026420 = i_strlen(pt_DEDE_NUM_860026420)
	SI (LONGUEUR_860026420 > 9)
	ALORS
		SI (i_strplcmp(pt_DEDE_NUM_860026420, "150", 0, 3) == 0)
		ALORS
			i_get_sub_str(pt_DEDE_NUM_860026420, 5, -1, pt_DEDE_NUM_860026420)
		SINON
			i_get_sub_str(pt_DEDE_NUM_860026420, 4, -1, pt_DEDE_NUM_860026420)
		FINSI
	FINSI
FINSI
#\QC513 DRE

########################################################################
#Normalisation du demande
########################################################################
# G3R22C6 QC554
SI b_DEDE_absent_860026420 == 0
ALORS
	erreur_860026420 = i_format_str2(pt_Num_860026420,"%s%s",pt_DEDE_INF_860026420,pt_DEDE_NUM_860026420)
	#trace2("<<<<__LINE__ <<<<<############# pt_Num = <%s> ###########################",pt_Num,"")
	LONGUEUR_860026420 = i_conv_ascii_dcb(pt_Num_860026420, pt_BUF1_860026420)
	#trace1("######### Longueur pt_Num = <%d> ############ ",LONGUEUR)
	erreur_860026420 = i_memcpy_art_field_n(g_iartout10, $Conversion::NOS, pt_BUF1_860026420, LONGUEUR_860026420)
	erreur_860026420 = i_normal(g_iartout10, $Conversion::NOS, $Conversion::NOS, g_icopo, $Tcopo::NDE ,$Tcopo::NDE ,3 , "BIDON", "BTIC_NDE")
	erreur_860026420 = i_get_art_str(g_icopo,$Tcopo::NDE,pt_Num_860026420)
	LONGUEUR_860026420 = i_conv_ascii_dcb(pt_Num_860026420, pt_BUF1_860026420)

	SI LONGUEUR_860026420 > 10
	ALORS
		i_get_sub_str(pt_BUF1_860026420, 0, 9, pt_Num_860026420)
		erreur_860026420 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_Num_860026420, 11)
	FINSI

	#QC512 01/09/2011 DRE  suppression du 00 ou du 0
	######## pt_DEDE_NUM_FAC ########
	i_strcpy(pt_DEDE_NUM_FAC_860026420,pt_BUF1_860026420)

	SI (i_strplcmp(pt_DEDE_NUM_FAC_860026420,"00",0,2) == 0 )
	ALORS
		i_get_sub_str(pt_DEDE_NUM_FAC_860026420,2,-1,pt_DEDE_NUM_FAC_860026420)
	SINON
		SI (i_strplcmp(pt_DEDE_NUM_FAC_860026420,"0",0,1) == 0 )
		ALORS
			i_get_sub_str(pt_DEDE_NUM_FAC_860026420,1,-1,pt_DEDE_NUM_FAC_860026420)
		FINSI
	FINSI
FINSI
# \G3R22C6 QC554

#\QC512 DRE

########################################################################
# Appel a la BNC
########################################################################
# critere de valorisation

#trace1("######### EFFICACE = <%d> ############ ",EFFICACE)
#trace1("######### IDUS_INF = <%d> ############ ",IDUS_INF)
#trace2 ("<<<<__LINE__ <<<<< pt_DEDE_NUM1 = %s ===========",pt_DEDE_NUM1,"")

SI (EFFICACE_860026420 == 1 && IDUS_INF_860026420 == 0x80 && i_strcmp(pt_DEDE_NUM1_860026420,"") != 0)
ALORS
#	trace (">>>__LINE___>> appel a la base de comptage ")
	g_icopo.TAXE   = 0
	g_icopo.CREDIT = 0
	erreur_860026420 = i_set_art_date(g_icopo,HLAHM1_860026420)
	g_icopo.DUREE  = Duree_860026420
	g_icopo.CODE   = CODE_ARTICLE_860026420
	g_icopo.CATEG  = CATEG_860026420
	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[5] = 0
	g_icopo.SUP[6] = 0
	g_icopo.SUP[7] = 0

	#erreur = i_comptage(g_icopo,BASE,HLAHM1)
	retour_BNC_860026420 = i_comptage(g_icopo,BASE_860026420,HLAHM1_860026420)

	# Erreur retour base de comptage
	SI (retour_BNC_860026420 == -1 && FACTURABLE_860026420)
	ALORS
		#trace1(">>>__LINE__>>> Erreur retour BNC erreur=%d",retour_BNC)
		code_rejet_860026420 = 0xA020 + EFFICACE_860026420
		erreur_860026420 = i_PlvMessEmettre(8507,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,g_ierrno)
		SAUT DISTRI_ERR
	FINSI
	#CCD
	SI retour_BNC_860026420 == 0
	ALORS
		SI FACTURABLE_860026420
		ALORS
			TYPCOM_860026420 = g_icopo.SUP[RES_TYPCOM_860026420]
		FINSI

		CCD_860026420 = g_icopo.SUP[RES_CCD_860026420]

		CODCIRDR_860026420 = g_icopo.SUP[RES_CODCIRDR_860026420]
		CODCIR_860026420 = g_icopo.SUP[RES_CODCIR_860026420]

		############################################
		# Controle sur l'unite renvoyee par la BNC
		# COEFF=94 MILEURO=10 MILEURODR=110
		# NbUT=vcUT UTC=0 UTCDR=100
		############################################
		vc_860026420 = g_icopo.TAXE
		UNITE_860026420 = g_icopo.SUP[RES_UNITE_860026420]
		SI UNITE_860026420 != UTC_860026420 && UNITE_860026420 != MILEURODR_860026420 && UNITE_860026420 != UTCDR_860026420
		ALORS
			#trace(">>>__LINE__>>> Erreur retour BNC")
			code_rejet_860026420 = 0xA020
			code_rejet_860026420 = code_rejet_860026420 + EFFICACE_860026420
			erreur_860026420 = i_PlvMessEmettre(8506,2,g_iartout,"",3,code_rejet_860026420,C_Article_860026420,UNITE_860026420)
			SAUT DISTRI_ERR
		FINSI
		TYPCTR_860026420 = g_icopo.SUP[RES_TYPCTR_860026420]
	FINSI
FINSI


##########################################################################################################
#G4R6 Lot2 Verif DATE
SI ( TYPCTR_860026420 == CTR_CPSLOC_860026420 || TYPCTR_860026420 == CTR_CPSRI_860026420 ) && !b_Fact_CPS_Act_860026420
ALORS
	# message dalarme AR <DEDE_NUM> C+S avec date DC <ICAR_UTC> inferieure a la date d'activation de la facturation C+S < Date_CPS> 
	erreur_860026420 = i_format_str2(pt_LIBELREDIST_860026420," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_DEDE_NUM_860026420,pt_datCPLUSS_860026420)
	code_errone_860026420 = 0xA080
	code_errone_860026420 = code_errone_860026420 + EFFICACE_860026420
	erreur_860026420 = i_PlvMessEmettre( 8599, 1, g_iartin,"", 3,code_errone_860026420, C_Article_860026420, pt_LIBELREDIST_860026420 )
	SAUT ELIMINE_EXP
SINON
	SI TYPCTR_860026420 == CTR_CPSLOC_860026420 && b_Fact_CPS_Act_860026420
	ALORS
		b_Fact_CPS_Loc_860026420 =1
	SINON
		SI TYPCTR_860026420 == CTR_CPSRI_860026420 && b_Fact_CPS_Act_860026420
		ALORS
			b_Fact_CPS_RI_860026420 = 1
		FINSI
	FINSI
FINSI


########################################################################
# Portabilite Entrante SRP (referentiel 45S "SKITEL")#####
########################################################################
# EPORTABILITE_SRP

SI i_strcmp(pt_DEDE_NUM_860026420,"") != 0
ALORS
	#----------  Appel de la table 45S  ---------  #
	#trace(">>>__LINE__>>> ------------RECHERCHE INSTANCE 45S-------------")
	inst45S_860026420 = i_LireInstanceECC(C_Inst45S_860026420)

	SI (!inst45S_860026420)
	ALORS
		#trace (">>>__LINE__>>> --------Pas d'instance pour 45S------------------------------")
		code_rejet_860026420 = 0xA0B0
		code_rejet_860026420 = code_rejet_860026420 + EFFICACE_860026420
		erreur_860026420   = i_PlvMessEmettre(8601,2,g_iartout,"",3,code_rejet_860026420,C_Inst45S_860026420,C_Article_860026420)
		SAUT DISTRI_ERR
	FINSI

	#trace1(">>>__LINE__>>> -------inst45S=<%d>-----------------------------",inst45S  )

	# Envoi Requetes Table de Distribution 45S
	i_strcpy(pt_BUF1_860026420,pt_DEDE_NUM_860026420)
	#trace2(">>>__LINE__>>> ------ envoi 45S avec pt_DEDE_NUM= pt_BUF1 <%s>---------",pt_BUF1,"")
	# G3R22 QC498
	pt_CODESRP_860026420 = CodeOperateurTable6_860026233(DATE_GMT_860026420,pt_BUF1_860026420,"45S")
	#trace2(">>>__LINE__>>> ------ resultat de pt_CODESRP : <%s>---------",pt_CODESRP   ,"")

	SI i_strcmp(pt_CODESRP_860026420  , "84208") == 0
	ALORS
		#trace("******** EPORTABILITE_SRP   = 1 car pt_CODESRP  84208")
		EPORTABILITE_SRP_860026420   = 1
	SINON
		EPORTABILITE_SRP_860026420   = 0
		SI (i_strcmp(pt_CODESRP_860026420,"84208")!=0 && i_strcmp(pt_CODESRP_860026420,"")!=0)
		ALORS
			SPORTABILITE_SRP_860026420 = 1
		SINON
			SPORTABILITE_SRP_860026420 = 0
		FINSI
	FINSI
	#trace(">>>__LINE__>>> pas d appel 45S parceque DEDE_NUM vide ")
FINSI


########################################################################
# Portabilite Entrante ou Sortante SCP (referentiel ACLA) #
########################################################################

# EPORTABILITE_SCP, SPORTABILITE_SCP
# G3R22 QC498 remplacement pt_DEDE_N par pt_DEDE_NUM
#G4R7 Lot1
#i_get_sub_str(pt_DEDE_NUM,0,0,pt_debChamp1)
LONGUEUR_860026420 = i_strlen(pt_DEDE_NUM_860026420)

#G3R22 QC498 SI ( (i_strcmp(pt_debChamp1,"8") == 0 || i_strcmp(pt_debChamp1,"3") == 0 ) && LONGUEUR == 4 )
#SI ( i_strcmp(pt_debChamp1,"8") == 0 || ( i_strcmp(pt_debChamp1,"3") == 0 && LONGUEUR == 4 ) )
SI i_strcmp(pt_DEDE_NUM_860026420,"") != 0
ALORS
	# ----------  Appel de la table ACLA  --------- #
	instACLA_860026420 = i_LireInstanceECC(C_InstACLA_860026420)

	SI (!instACLA_860026420)
	ALORS
		#trace (">>>__LINE__>>> --------Pas d'instance pour ACLA------------------------------")
		code_rejet_860026420 = 0xA0B0
		code_rejet_860026420 = code_rejet_860026420 + EFFICACE_860026420
		erreur_860026420   = i_PlvMessEmettre(8601,2,g_iartout,"",3,code_rejet_860026420,C_InstACLA_860026420,C_Article_860026420)
		SAUT DISTRI_ERR
	FINSI
	#trace1(">>>__LINE__>>> -------instACLA=<%d>-----------------------------",instACLA  )

	# Envoi Requetes Table de Distribution ACLA
	i_strcpy(pt_BUF1_860026420,pt_DEDE_NUM_860026420)
	#trace2(">>>__LINE__>>> ------ envoi ACLA avec pt_DEDE_NUM= pt_BUF1 <%s>---------",pt_BUF1,"")

	# G3R22 QC498
	pt_CODESCP_860026420 = CodeOperateurTable6_860026233(DATE_GMT_860026420,pt_BUF1_860026420,"ACLA")
	#trace2(">>>__LINE__>>> ------ resultat de pt_CODESCP : <%s>---------",pt_CODESCP   ,"")

	EPORTABILITE_SCP_860026420   = 0
	SPORTABILITE_SCP_860026420   = 0

	SI i_strcmp(pt_CODESCP_860026420  , "84008") == 0
	ALORS
		#trace(" ACLA pt_CODESCP=84008  EPORTABILITE_SCP   = 1")
		EPORTABILITE_SCP_860026420   = 1
	SINON
		SI i_strcmp(pt_CODESCP_860026420  ,"")!=0
		ALORS
			SPORTABILITE_SCP_860026420   = 1
		FINSI
	FINSI
FINSI

#---------------FIN ACLA----------------------#
#trace1(">>>__LINE__>>> SPORTABILITE_SCP=%d",SPORTABILITE_SCP)

# DRE G3R24
	#########################################################################
	##SRP_TIERS
	#########################################################################
	#SRP_TIERS = 0
	#
	#SI ( CCD == 0x18 ) 
	#&& ( TYPCOM ==0x52 || TYPCOM ==0x58 || TYPCOM ==0x59 || TYPCOM ==0x5A || TYPCOM ==0x5B || TYPCOM ==0x5C || TYPCOM ==0x62 )
	#ALORS
	#	SRP_TIERS = 1
	#FINSI
	#
	#########################################################################
	## SRP_PTD
	#########################################################################
	#SRP_PTD = 0
	#
	#SI (TYPCOM == 0x4E)
	#ALORS
	#	SRP_PTD = 1
	#FINSI


#G4R1 QC638 DRE
POINT SUITE_NUM_PRIVE
#=================================================================#

########################################################################
#b_SRP_TIERS_PTD
########################################################################
b_SRP_TIERS_PTD_860026420 = 0
SI ( (CCD_860026420 == 0x18) && (TYPCTR_860026420 == 3) )
ALORS
	b_SRP_TIERS_PTD_860026420 = 1
FINSI

########################################################################
# b_118_TIERS_PTD
########################################################################
b_118_TIERS_PTD_860026420 = 0

SI (CCD_860026420 == 0x1B)
ALORS
	b_118_TIERS_PTD_860026420 = 1
FINSI

# \DRE G3R24

########################################################################
#b_e-message_IP
########################################################################

SI CCD_860026420 == 0x17
ALORS
	b_Emessage_IP_860026420 = 1
FINSI

########################################################################
# CCD_REEL
########################################################################

SI EPORTABILITE_SRP_860026420
ALORS
	CCD_REEL_860026420 = 212
SINON
	SI SPORTABILITE_SRP_860026420
	ALORS
		CCD_REEL_860026420 = 213
	SINON
		SI EPORTABILITE_SCP_860026420
		ALORS
			CCD_REEL_860026420 = 218
		SINON
			SI SPORTABILITE_SCP_860026420
			ALORS
				CCD_REEL_860026420 = 219
			SINON
				SI CCD_860026420 != -1
				ALORS
					CCD_REEL_860026420 = CCD_860026420
				SINON
					CCD_REEL_860026420 = 255
				FINSI
			FINSI
		FINSI
	FINSI
FINSI

########################################################################
#ICID_CONVERTI
########################################################################

erreur_860026420 = i_get_art_str(g_iartout, $Tbticsip::ICID,pt_Num_860026420)

SomZonTrav_860026420 = 0
I_860026420 = 0
lg_860026420 = 4

POINT DEB_Boucle1

SI I_860026420 < i_strlen(pt_Num_860026420)
ALORS
	SI I_860026420 + lg_860026420 > i_strlen(pt_Num_860026420)
	ALORS
		lg_860026420 = i_strlen(pt_Num_860026420) - I_860026420
	FINSI
	i_get_sub_str(pt_Num_860026420,I_860026420,I_860026420+lg_860026420-1,pt_Num1_860026420)
	erreur_860026420 = i_set_art_str(g_iartout10,$Conversion::ValASCII,pt_Num1_860026420)
	Num1_860026420 = i_get_art_field(g_iartout10,$Conversion::ValHEX)
	ZonTrav_860026420 = Num1_860026420 % modulo_860026420
	SomZonTrav_860026420 = SomZonTrav_860026420 + ZonTrav_860026420
	I_860026420 = I_860026420 + lg_860026420
	SAUT DEB_Boucle1
FINSI

ICID_CONVERTI_860026420 = SomZonTrav_860026420 % modulo_860026420

# DRE G4R1C1 lot2 calcul remonte
#########################################################################
## Inter_BTICSIP_BTIPSIP
#########################################################################
#Inter_BTICSIP_BTIPSIP = 0
#erreur = i_get_art_str(g_iartout, $Tbticsip::VirtOnNetType,pt_BUF1)
#
#SI ( (i_get_art_field(g_iartout, $Tbticsip::ASCallType) == 0x03) && (i_strcmp(pt_BUF1,"BTIP") == 0) )
#ALORS
#	Inter_BTICSIP_BTIPSIP = 1
#FINSI
# \DRE G4R1C1 calcul remonte

# DRE - G4R1C1  lot2
########################################################################
# APPEL_MEVO et MEVO
########################################################################

MEVO_860026420 = 0
APPEL_MEVO_860026420 = 0
#G4R1 QC645
#erreur = i_format_str2( pt_temp, "%s%s", "INm", pt_DEDE_NUM )
erreur_860026420 = i_format_str2( pt_temp_860026420, "%s%s", "INn", pt_DEDE_NUM_860026420 )
i_strcpy(pt_temp2_860026420,i_get_tab_field ( "Inter", DATE_GMT_860026420, pt_temp_860026420 ))
SI i_strcmp ( pt_temp2_860026420, "1") == 0
ALORS
	MEVO_860026420 = 1
FINSI
SI i_strcmp ( pt_temp2_860026420, "2") == 0
ALORS
	APPEL_MEVO_860026420 = 1
FINSI

# \DRE - G4R1C1  lot2
########################################################################
# CALL_TYPE
########################################################################

SI i_valid_field_n(g_iartout, $Tbticsip::ASCallType)
ALORS
	ASCallType_860026420 = i_get_art_field(g_iartout, $Tbticsip::ASCallType)
	SI ASCallType_860026420 == 0x01 || ASCallType_860026420 == 0x07
	ALORS
		i_strcpy (pt_CALL_TYPE_860026420,"1")
	SINON
		SI ASCallType_860026420 == 0x02
		ALORS
			i_strcpy (pt_CALL_TYPE_860026420,"2")
		SINON
			SI ASCallType_860026420 == 0x03
			ALORS
				SI b_TERMINATING_860026420 == 1 && MEVO_860026420 == 1
				ALORS
					i_strcpy (pt_CALL_TYPE_860026420,"8")
				SINON
					SI b_TERMINATING_860026420 == 1
					ALORS
						i_strcpy (pt_CALL_TYPE_860026420,"6")
					SINON
						SI b_ORIGINATING_860026420 == 1
						ALORS
							SI ( i_valid_field_n(g_iartout, $Tbticsip::CalledNumber) 
							  || i_valid_field_n(g_iartout, $Tbticsip::AsCalledPartyAd) )
							ALORS
								# G3R22 QC497
								SI MEVO_860026420
								ALORS
									i_strcpy (pt_CALL_TYPE_860026420,"4")
								SINON
									##### G4R6 QC808 #####
									SI ( TYPCTR_860026420 == CTR_REJET_860026420 
									  || TYPCTR_860026420 == CTR_REJET2_860026420 
									  || TYPCTR_860026420 == CTR_REJET3_860026420 
									  || TYPCTR_860026420 == CTR_REJET5_860026420 
									  || b_Fact_CPS_RI_860026420 )
									ALORS
										i_strcpy (pt_CALL_TYPE_860026420,"7")
									SINON
										i_strcpy (pt_CALL_TYPE_860026420,"5")
									FINSI
								FINSI
							FINSI
						FINSI
					FINSI
				FINSI
			FINSI
		FINSI
	FINSI
FINSI


##########################################################################################################
#G4R6 Lot2 Interro Ref ALICE

SI b_Fact_CPS_Loc_860026420
ALORS
	lg_860026420 = i_conv_ascii_dcb(pt_DEDE_NUM_FAC_860026420, pt_temp_860026420)
	SI ( i_EnvoiReqConsTabDist( TD_ALICE_860026420, DATE_GMT_860026420, pt_temp_860026420, lg_860026420, 0, 1) != 0 )
	ALORS
		code_errone_860026420 = 0xA0C0
		code_errone_860026420 = code_errone_860026420 + EFFICACE_860026420
		erreur_860026420 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026420,C_instALICE_860026420,C_Article_860026420)
		SAUT DISTRI_ERR
	FINSI

	instALICE_860026420 = i_LireInstanceECC(C_instALICE_860026420)

	SI (!instALICE_860026420)
	ALORS
		erreur_860026420 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "ALICE", C_Article_860026420, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026420 = i_LireReqConsTabDist()

	SI erreur_860026420 == 0
	ALORS
		#erreur = i_LireChaineECCv(instALICE, pt_ECCv)
		#instECCv = i_LireEntierECCv( instALICE )
		res_860026420 = i_LireInfoECC( instALICE_860026420, 0 )

#G4R7 Lot3 QC834
		SI ( res_860026420 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026420 = i_LireChaineInfo( res_860026420, 0, 4, pt_temp_860026420 )
			SI i_strcmp(pt_temp_860026420, "" ) != 0
			ALORS
				i_strcpy(pt_TARIF_860026420, pt_temp_860026420 )
				b_ALICE_860026420 = 1
			SINON
				# info complementaire CODE_TARIF vide
				bREDIST_860026420 = 1
				erreur_860026420 = i_format_str2(pt_LIBELREDIST_860026420," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_DEDE_NUM_860026420,0)
			FINSI
			
			erreur_860026420 = i_LireChaineInfo( res_860026420, 4, 1, pt_temp_860026420 )
			SI i_strcmp(pt_temp_860026420, "" ) != 0
			ALORS
				i_strcpy(pt_EDIT_860026420, pt_temp_860026420 )
				b_ALICE_860026420 = 1
			SINON
				# info complementaire TYPE_EDIT vide
				bREDIST_860026420 = 1
				erreur_860026420 = i_format_str2(pt_LIBELREDIST_860026420," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_DEDE_NUM_860026420,0)
			FINSI
		SINON
			erreur_860026420 = i_format_str2(pt_LIBELREDIST_860026420," AR <%s> non trouve dans ALICE",pt_DEDE_NUM_860026420,0)
			bREDIST_860026420 = 1
		FINSI
	FINSI
FINSI

#---------------------------------------------------
##############################################################################
#DATE_M enveloppe E_RPV
##############################################################################

erreur_860026420 = i_add_opt( "E_RPV" )
erreur_860026420 = i_set_attr_val_n( $E_RPV::DATE_M, HLAHM1_860026420 + Duree_860026420 )

####################################################################
# DISTRIBUTION
####################################################################

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

########################################################################
#  Recherche instance FERPV
########################################################################

instFERPV_860026420 = i_LireInstanceECC(C_InstFERPV_860026420)
#trace1("instFERPV=<%d>",instFERPV)
SI (!instFERPV_860026420)
ALORS
	#trace( "instance FERPV nulle! (ou erreur)=> envoi vers cette ECC impossible" )
	erreur_860026420 = i_PlvMessEmettre(8501,2,g_iartout,"",3,"FERPV",C_Article_860026420,g_ieec)
	SAUT DISTRI_ERR
FINSI

########################################################################
#  Recherche instance SYMPHONIE
########################################################################

instSYMP_860026420 =i_LireInstanceECC(C_InstSYMP_860026420)
#trace1("instSYMP=<%d>",instSYMP)
SI (!instSYMP_860026420)
ALORS
	#trace("pas d instance SYMPHONIE")
	erreur_860026420 = i_PlvMessEmettre(8501,2,g_iartout,"",3,"SYMPH",C_Article_860026420,g_ieec)
	SAUT DISTRI_ERR
FINSI

########################################################################
# SYMPHONIE  : tous les DC vont a Symphonie
########################################################################

#G4R6 Lot2 
SI CPT_RDT_860026420 == 2 || bREDIST_860026420 == 0
ALORS
	erreur_860026420=i_AjouterCouranteECC(instSYMP_860026420)
	#trace(">>>__LINE__>>> AjouterCouranteECC instSYMP")
FINSI

########################################################################
# RERECHERCHE instance SPOT
########################################################################

instSPOT_860026420=i_LireInstanceECC(C_InstSPOT_860026420)

SI (!instSPOT_860026420)
ALORS
	erreur_860026420 = i_PlvMessEmettre(8501,2,g_iartout,"",3,"SPOT",C_Article_860026420,g_ieec)
	SAUT DISTRI_ERR
FINSI

########################################################################
# SPOT : tous les DC vont a SPOT
########################################################################

#G4R6 Lot2 
SI CPT_RDT_860026420 == 2 || bREDIST_860026420 == 0
ALORS
	erreur_860026420=i_AjouterCouranteECC(instSPOT_860026420)
	#trace(">>>__LINE__>>> AjouterCouranteECC instSPOT")
FINSI


########################################################################
# RERECHERCHE instance AFDB
########################################################################

instAFDB_860026420=i_LireInstanceECC(C_InstAFDB_860026420)
SI (!instAFDB_860026420)
ALORS
	erreur_860026420 = i_PlvMessEmettre(8501,2,g_iartout,"",3,"AFDB",C_Article_860026420,g_ieec)
	SAUT DISTRI_ERR
FINSI

########################################################################
# AFDB : tous les DC vont a AFDB
########################################################################

#G4R6 Lot2 
SI CPT_RDT_860026420 == 2 || bREDIST_860026420 == 0
ALORS
	erreur_860026420=i_AjouterCouranteECC(instAFDB_860026420)
	#trace(">>>__LINE__>>> AjouterCouranteECC instAFDB")
FINSI

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

SI FACTURABLE_860026420
ALORS
	#G4R6 Lot2 
	#SI ( ( TYPCTR != CTR_REJET && TYPCTR != CTR_REJET2 && TYPCTR != CTR_REJET3 && TYPCTR!= CTR_REJET5 ) 
	SI ( !( TYPCTR_860026420 == CTR_REJET_860026420 || TYPCTR_860026420 == CTR_REJET2_860026420 || TYPCTR_860026420 == CTR_REJET3_860026420 || TYPCTR_860026420 == CTR_REJET5_860026420 || b_Fact_CPS_RI_860026420 || ( b_Fact_CPS_Loc_860026420 && !b_ALICE_860026420 ) )
	  && !SPORTABILITE_SRP_860026420 && !MEVO_860026420 && !APPEL_MEVO_860026420 )
	ALORS
		res_860026420=i_AjouterCouranteECC(instFERPV_860026420)
		i_strcpy(pt_EccFact_860026420,"FERPV")
	FINSI
FINSI

##################################################################################
# Validation de la liste des ECCs destinataires
##################################################################################

erreur_860026420=i_ValiderListeECC( 0, 0, 0, 0)

########################################################################
# FERPV	Tfe_rpv, g_iartout4
########################################################################

SI (!i_ChercherCouranteECC(instFERPV_860026420))
ALORS
	#trace1("<<<__LINE__:__FILE__<<< dup instFERPV <%d>",instFERPV)
	SI (i_dup_art_dest(g_iartout, g_iartout4, C_Tferpv_860026420))
	ALORS
		code_rejet_860026420 = 0xA0D0
		code_rejet_860026420 = code_rejet_860026420 + EFFICACE_860026420
		erreur_860026420 = i_PlvMessEmettre(8602, 2, g_iartout, "", 3, code_rejet_860026420, C_Tferpv_860026420, C_Article_860026420)
		SAUT DISTRI_ERR
	FINSI

	#SERVICE -> fichier de duplication (valeur: 3)
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::SERVICE, "3")

	#SOURCE
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::SOURCE, "08")

	#TYPCOM -> fichier de duplication (valeur: ' ')
#25/04/2013 DRE G4R3 lot1 mise en conformite avec spec
	SI ( i_strcmp(pt_CALL_TYPE_860026420,"1") == 0 || i_strcmp(pt_CALL_TYPE_860026420,"2") == 0 || V_Inter_BTICSIP_860026420 == 1 )
	ALORS
		erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::TYPCOM, " ")
	SINON
#\25/04/2013 DRE G4R3 lot1
		SI ( i_strcmp(pt_CALL_TYPE_860026420,"5") == 0 || i_strcmp(pt_CALL_TYPE_860026420,"7") == 0 || i_strcmp(pt_CALL_TYPE_860026420,"0") == 0 )
		ALORS
			erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::TYPCOM, "4")
		FINSI
	FINSI

	# NUMDDR
	erreur_860026420 = i_format_str2(pt_BUF1_860026420, "%s%s", "0", pt_NDI_NUM_860026420)
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDR, pt_BUF1_860026420)

	# NUMDDE
#QC512 01/09/2011 DRE pt_DEDE_NUM_FAC = Numero normalise sans 0 devant (00 ou 0)
#	erreur = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDE,pt_DEDE_NUM)

# DRE G4R1C1 lot2
	SI DEDE_PRIVE_860026420
	ALORS
		erreur_860026420 = i_format_str2( pt_Num_860026420, "%s%s", "IP", pt_DEDE_NUM_860026420)
		erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDE,pt_Num_860026420)
	SINON
		erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::NUMDDE,pt_DEDE_NUM_FAC_860026420)
	FINSI
#\QC512 DRE suppression du 00 ou du 0

	# DEBUT
	erreur_860026420 = i_set_art_field(g_iartout4, $Tfe_rpv::DEBUT,HLAHM1_860026420)

	# DUREE
	erreur_860026420 = i_set_art_field(g_iartout4, $Tfe_rpv::DUREE,Duree_860026420)

	# NBUT
	# DRE G3R24
	#SI (SRP_TIERS == 1 || SRP_PTD == 1 || b_Emessage_IP == 1 )
	#G4R6 Lot2 
	#SI (b_SRP_TIERS_PTD == 1 || b_118_TIERS_PTD == 1 || b_Emessage_IP == 1)
	SI ( b_SRP_TIERS_PTD_860026420 == 1 || b_118_TIERS_PTD_860026420 == 1 || b_Emessage_IP_860026420 == 1 ) && !b_Fact_CPS_Loc_860026420
	ALORS
		erreur_860026420 = i_set_art_field(g_iartout4, $Tfe_rpv::NBUT,vc_860026420)
	SINON
		erreur_860026420 = i_set_art_field(g_iartout4, $Tfe_rpv::NBUT,0)
	FINSI

	# MTHSTD
	erreur_860026420 = i_set_art_field(g_iartout4, $Tfe_rpv::MTHSTD,0)

	#CANAL
	erreur_860026420 = i_set_art_field(g_iartout4,$Tfe_rpv::CANAL, ICID_CONVERTI_860026420)

	# NBCOD
	erreur_860026420 = i_set_art_field(g_iartout4, $Tfe_rpv::NBCOD, NB_CSV_860026420)

	#C_CSV1
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::C_CSV1, pt_C_CSV_860026420)

	# OP_CSV1
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::OP_CSV1, pt_OP_CSV_860026420)

	#SUPPORT (mis a '0' dans table de dup)
	SI ( i_strcmp(pt_CALL_TYPE_860026420,"1") == 0 || i_strcmp(pt_CALL_TYPE_860026420,"2") == 0 || V_Inter_BTICSIP_860026420 == 1 )
	ALORS
		erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::SUPPORT, "6")
	FINSI

	# CCD
	erreur_860026420 = i_set_art_field(g_iartout10, $Conversion::CCD, CCD_REEL_860026420)
	erreur_860026420 = i_get_art_str( g_iartout10, $Conversion::CCD, pt_temp_860026420 )
	#trace2("__LINE__ CCD ASCII  <%s>",pt_temp, "")
	erreur_860026420 = i_format_str2( pt_temp2_860026420, "%s%s", "000", pt_temp_860026420)
	i_get_sub_str (pt_temp2_860026420, -3, -1,pt_temp2_860026420)
	#trace2("__LINE__ CCD ASCII 3 dig  <%s>",pt_temp2, "")
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::CCD, pt_temp2_860026420)

	#NOORIG
	SI i_strlen(pt_NOORIG_860026420)
	ALORS
		erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::NOORIG,pt_NOORIG_860026420)
	FINSI

	#INFDEDE
	i_strcpy (pt_temp2_860026420,"000")
	SI DEDE_INF_860026420 != 0x40
	ALORS
		erreur_860026420 = i_set_art_field(g_iartout10, $Conversion::INF, DEDE_INF_860026420)
		erreur_860026420 = i_get_art_str( g_iartout10, $Conversion::INF, pt_temp_860026420)
		erreur_860026420 = i_format_str2( pt_temp2_860026420, "%s%s", "000", pt_temp_860026420)
		i_get_sub_str (pt_temp2_860026420, -3, -1,pt_temp2_860026420)
	FINSI
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::INFDDE, pt_temp2_860026420)
	
	#G4R6 Lot2 
	#CODE_TARIF
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::CODE_TARIF,pt_TARIF_860026420 )

	#TYPE_EDIT
	erreur_860026420 = i_set_art_str(g_iartout4, $Tfe_rpv::TYPE_EDIT,pt_EDIT_860026420 )

FINSI

#Fin FERPV

########################################################################
# SPOT  TspotTbticsip, g_iartout6
########################################################################

#G4R6 Lot2
#SI ( instSPOT )
SI( !i_ChercherCouranteECC(instSPOT_860026420))
ALORS
	# Ajout de SPOT a la liste courante des ECC:
	erreur_860026420=i_AjouterCouranteECC(instSPOT_860026420)

	#trace("Duplication vers SPOT")

	SI (i_dup_art_id(g_iartout, g_iartout6))
	ALORS
		erreur_860026420 = i_PlvMessEmettre(8502, 2, g_iartout, "", 3, "pour Spot", C_Article_860026420, pt_sgtqs_860026420)
		SAUT DISTRI_ERR
	FINSI

	SI (i_rename_art(g_iartout6, C_Tspot_860026420))
	ALORS
		erreur_860026420 = i_PlvMessEmettre(8502, 2, g_iartout, "", 3, "pour Spot", C_Article_860026420, pt_sgtqs_860026420)
		SAUT DISTRI_ERR
	FINSI

	# Champ SGTQS
	erreur_860026420 = i_ajoutChampNum(g_iartout6,$TspotTbticsip::T4SGTQS,$TspotTbticsip::SGTQS,0)
	erreur_860026420=i_set_art_str(g_iartout6,$TspotTbticsip::SGTQS, pt_sgtqs_860026420)

	# Champ CALLTYPE
	erreur_860026420 = i_ajoutChampNum(g_iartout6,$TspotTbticsip::T4CALLTYPE,$TspotTbticsip::CALLTYPE,0)
	erreur_860026420=i_set_art_str(g_iartout6,$TspotTbticsip::CALLTYPE, pt_CALL_TYPE_860026420)
FINSI

########################################################################
# AFDB    TafdbBticsip, g_iartout7
########################################################################

SI( !i_ChercherCouranteECC(instAFDB_860026420))
ALORS

	erreur_860026420 = i_dup_art_id(g_iartout, g_iartout7)

	SI (erreur_860026420)
	ALORS
		#trace1(">>>__LINE__>>>__FILE__>>> ERREUR de duplication vers SYMPHONIE : %d",erreur)
		code_rejet_860026420 = 0xA0D0
		code_rejet_860026420 = code_rejet_860026420 + EFFICACE_860026420
		erreur_860026420 = i_PlvMessEmettre(8602,2,g_iartout,"",3,code_rejet_860026420,C_Tafdb_860026420,C_Article_860026420)
		SAUT DISTRI_ERR
	FINSI

	SI (i_rename_art(g_iartout7, C_Tafdb_860026420))
	ALORS
		erreur_860026420 = i_PlvMessEmettre(8502, 2, g_iartout, "", 3, "pour AFDB", C_Article_860026420, pt_sgtqs_860026420)
		SAUT DISTRI_ERR
	FINSI

	# Champ SGTQS
	erreur_860026420 = i_ajoutChampNum(g_iartout7,$TafdbBticsip::T4SGTQS,$TafdbBticsip::SGTQS,0)
	erreur_860026420=i_set_art_str(g_iartout7,$TafdbBticsip::SGTQS, pt_sgtqs_860026420)

	# Champ CALLTYPE
	# QC555 QC575
	#erreur = i_ajoutChampNum(g_iartout7,$TafdbBticsip::T4CALLTYPE,$TafdbBticsip::CALLTYPE,0)
	erreur_860026420=i_set_art_str(g_iartout7,$TafdbBticsip::CALLTYPE, pt_CALL_TYPE_860026420)
FINSI

########################################################################
# Symphonie TsymTbticsip, g_iartout5
########################################################################

SI( !i_ChercherCouranteECC(instSYMP_860026420))
ALORS
	#trace(">>>__LINE__>>> Duplication vers SYMPHONIE")
	erreur_860026420 = i_dup_art_id(g_iartout,g_iartout5)

	SI (erreur_860026420)
	ALORS
		#trace1(">>>__LINE__>>>__FILE__>>> ERREUR de duplication vers SYMPHONIE : %d",erreur)
		code_rejet_860026420 = 0xA0D0
		code_rejet_860026420 = code_rejet_860026420 + EFFICACE_860026420
		erreur_860026420 = i_PlvMessEmettre(8602,2,g_iartout, "", 3, code_rejet_860026420, C_TsymTbticsip_860026420, C_Article_860026420)
		SAUT DISTRI_ERR
	FINSI

	res_860026420 = i_rename_art(g_iartout5, C_TsymTbticsip_860026420)

	# ajout de tous les champs de T3ce
	erreur_860026420 = i_ajoutChampNum(g_iartout5, $TsymTbticsip::T4ccd,$TsymTbticsip::CCD,6)

	#  HLAHM1 (DATE_LOCALE)**********
	SI HLAHM1_860026420 != -1
	ALORS
		erreur_860026420 = i_set_art_field(g_iartout5,$TsymTbticsip::DATE_LOCALE,HLAHM1_860026420)
	SINON
		erreur_860026420 = i_supprChamp(g_iartout5, "T4date_locale")
	FINSI

	# ************** SGTQS *****************
	erreur_860026420=i_set_art_str(g_iartout5,$TsymTbticsip::SGTQS,pt_sgtqs_860026420)

	# ************** ECC_FACT *****************
	SI (i_strcmp("", pt_EccFact_860026420) != 0)
	ALORS
		erreur_860026420=i_set_art_str(g_iartout5, $TsymTbticsip::ECC_FACT,pt_EccFact_860026420)
	SINON
		erreur_860026420=i_set_art_str(g_iartout5, $TsymTbticsip::ECC_FACT," ")
	FINSI

	# ************** CCD *****************
	SI CCD_860026420 != -1
	ALORS
		erreur_860026420 = i_set_art_field(g_iartout5,$TsymTbticsip::CCD,CCD_REEL_860026420)
	SINON
		erreur_860026420 = i_set_art_field(g_iartout5,$TsymTbticsip::CCD,255)
	FINSI

	# ************** CODCIRDR (g_iartout10, $Conversion num hexa /tab hexa) *****************
	SI CODCIRDR_860026420 != -1
	ALORS
		#trace(">>>__LINE__>>>CODCIRDR est valide")
		i_strcpy(pt_BUF1_860026420, " ")
		erreur_860026420 = i_set_art_field(g_iartout10,$Conversion::CODCIRDR,CODCIRDR_860026420)
		erreur_860026420 = i_get_art_str(g_iartout10, $Conversion::CODCIRDA,pt_BUF1_860026420)
		SI  g_iartout10.CODCIRDA[2] > 9
		ALORS
			i_get_sub_str(pt_BUF1_860026420,2,5,pt_BUF1_860026420)
		SINON
			i_get_sub_str(pt_BUF1_860026420,1,5,pt_BUF1_860026420)
		FINSI
		erreur_860026420=i_set_art_str(g_iartout5, $TsymTbticsip::CODCIRDR, pt_BUF1_860026420)
	SINON
		erreur_860026420=i_supprChamp(g_iartout5,"T4codcirdr")
	FINSI

	# ***************** CODCIR (g_iartout10, $Conversion num hexa /tab hexa) *****************
	SI CODCIR_860026420 != -1
	ALORS
		#trace(">>>__LINE__>>>CODCIR est valide")
		i_strcpy(pt_BUF1_860026420, "")
		erreur_860026420 = i_set_art_field(g_iartout10,$Conversion::CODCIRDR,CODCIR_860026420)
		erreur_860026420 = i_get_art_str(g_iartout10, $Conversion::CODCIRDA,pt_BUF1_860026420)
		SI (g_iartout10.CODCIRDA[2] > 9)
		ALORS
			i_get_sub_str(pt_BUF1_860026420,2,5,pt_BUF1_860026420)
		SINON
			i_get_sub_str(pt_BUF1_860026420,1,5,pt_BUF1_860026420)
		FINSI
		erreur_860026420=i_set_art_str(g_iartout5, $TsymTbticsip::CODCIR, pt_BUF1_860026420)
	SINON
		erreur_860026420=i_supprChamp(g_iartout5,"T4codcir")
	FINSI

	# ************** IDUS_INF *****************
	erreur_860026420 = i_set_art_field(g_iartout5,$TsymTbticsip::IDUS_INF,IDUS_INF_860026420)

	# ************** DETR_INF *****************
	# G3R22C6 QC554
	SI ( DEDE_INF_860026420 == 0x40 )
	ALORS
		DEDE_INF_860026420 = 0x00
	FINSI
	erreur_860026420 = i_set_art_field(g_iartout5,$TsymTbticsip::DEDE_INF,DEDE_INF_860026420)

	# ************** EFFICACITE *****************
	erreur_860026420 = i_set_art_field(g_iartout5,$TsymTbticsip::EFFICACE,EFFICACE_860026420)

	# ************** CALLTYPE *****************
	erreur_860026420=i_set_art_str(g_iartout5, $TsymTbticsip::CALLTYPE, pt_CALL_TYPE_860026420)

	#G4R6 Lot2 
	SI b_ALICE_860026420
	ALORS
		erreur_860026420 = i_set_art_str(g_iartout5, $TsymTbticsip::CODE_TARIF,pt_TARIF_860026420 )
		erreur_860026420 = i_set_art_str(g_iartout5, $TsymTbticsip::TYPE_EDIT,pt_EDIT_860026420 )
	SINON
		erreur_860026420 = i_supprChamp(g_iartout5, "T4code_tarif")
		erreur_860026420 = i_supprChamp(g_iartout5, "T4type_edit")
	FINSI

FINSI

#Fin SYMPHONIE

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

########################################################################
# SYMPHONIE ($TsymTbticsip, g_iartout5)
########################################################################

SI (! i_ChercherCouranteECC(instSYMP_860026420))
ALORS
	erreur_860026420  = i_stocke_art_iecc(g_iartout5,instSYMP_860026420)
	#trace("__FILE__:__LINE__ ## emission vers Symphonie")
FINSI

########################################################################
# TFERPV ($Tfe_rpv, g_iartout4)
########################################################################

SI (! i_ChercherCouranteECC(instFERPV_860026420))
ALORS
	erreur_860026420  = i_stocke_art_iecc(g_iartout4,instFERPV_860026420)
	#trace("__FILE__:__LINE__ ## emission vers FERPV")
FINSI

########################################################################
#AFDB    ($TafdBticsip g_iartout7)
########################################################################

SI( !i_ChercherCouranteECC( instAFDB_860026420 ) )
ALORS
	res_860026420 = i_stocke_art_iecc(g_iartout7, instAFDB_860026420)
	#trace1("__FILE__:__LINE__ ## retour de i_stocke_art_iecc pour AFDB : %d",res)
FINSI

########################################################################
#SPOT  (TspotTbticsip g_iartout6)
########################################################################

SI( !i_ChercherCouranteECC( instSPOT_860026420 ) )
ALORS
	res_860026420 = i_stocke_art_iecc(g_iartout6, instSPOT_860026420)
	#trace1("__FILE__:__LINE__ ## retour de i_stocke_art_iecc pour SPOT : %d",res)
FINSI

#G4R6 Lot2
SI bREDIST_860026420 == 1
ALORS
	SAUT DISTRI_REDIST
FINSI

RETOUR TRAIT_OK

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

POINT DISTRI_ERR

#trace( ">>>__LINE__>>> Stockage en errone de distribution")
res_860026420 = i_make_art_rej(g_iartin, g_iartout8, code_rejet_860026420)
res_860026420 = i_stocke_art( g_iartout8, 0, PT_ERRONE, 0)

RETOUR TRAIT_OK

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

POINT ELIMINE_EXP

#trace( ">>>__LINE__>>> Stockage en elimine explicite")
res_860026420 = i_stocke_art( g_iartin, 0, PT_DIVERS, 0 )

RETOUR TRAIT_OK

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

POINT DISTRI_REDIST

#  Enregistrement du champ Nom_EEC dans l'ENVELOPPE Optionelle de redistribution
#res = i_add_opt( "EnomEEC" )
#res = i_set_attr_str_n($EnomEEC::Nom_EEC, pt_sgtqs)

#trace( ">>>__LINE__>>>  Fin du Pcode de distribution : Stockage en REDISTRIBUTION" )
SI (CPT_RDT_860026420 == 0) 
ALORS
	erreur_860026420 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026420,C_Article_860026420,pt_sgtqs_860026420)
FINSI

res_860026420 = i_stocke_art( g_iartin, 0, PT_REDIST, 0 )

RETOUR TRAIT_OK


#--------------Fin Pcode Distribution Tbticsip_dis.src------------------------
