DEFINITION NUMTABSEL_860026567 0
DEFINITION NUMTABSEL1_860026567 1
DEFINITION NUMTAB_860026567 1
DEFINITION BASE_860026567 1
DEFINITION CODE_ARTICLE_860026567 1
DEFINITION CATEG_860026567 16
DEFINITION RES_TYPCOM_860026567 0
DEFINITION RES_CCD_860026567 1
DEFINITION RES_TYPCTR_860026567 2
DEFINITION RES_CODCIR_860026567 3
DEFINITION RES_CODCIRDR_860026567 5
DEFINITION RES_UNITE_860026567 6
DEFINITION UTC_860026567 0
DEFINITION UTCDR_860026567 100
DEFINITION MILEURODR_860026567 110
DEFINITION CTR_REJET_860026567 11
DEFINITION CTR_REJET2_860026567 10
DEFINITION CTR_REJET3_860026567 12
DEFINITION CTR_REJET5_860026567 9
DEFINITION C_Article_860026567 "Tv2oip"
DEFINITION C_Conversion_860026567 "Conversion"
DEFINITION C_instTRAF_860026567 "TRAFIC"
DEFINITION C_InstACLA_860026567 "ACLA"
DEFINITION C_Inst45S_860026567 "45S"
DEFINITION C_TtraficN_860026567 "TtraficN"
DEFINITION C_InstSYMP_860026567 "SYMP"
DEFINITION C_TsymTv2oip_860026567 "TsymTv2oip"
DEFINITION C_Message1_860026567 "Indicatif inconnu dans la table DISTRI 42L"
DEFINITION C_Message2_860026567 "Indicatif inconnu dans la table DISTRI MAJ2G - AR: "
DEFINITION C_Inst42L_860026567 "42L"
DEFINITION C_instSIP_860026567 "SIP"
DEFINITION C_pref_CLE_860026567 "INi"
DEFINITION TD_SIP_860026567 3
DEFINITION C_instCASPER_860026567 "CASPER"
DEFINITION C_TcasperTv2oip_860026567 "TcasperTv2oip"
DEFINITION C_INST_VGA_860026567 "VGA"
DEFINITION C_INST_VGAIP_860026567 "VGAIP"
DEFINITION C_INST_OPEN_860026567 "OPEN"
DEFINITION C_InstCENTVG_860026567 "CENTAUREVG"
DEFINITION C_TcentaureVG_860026567 "TcentaureVG"
DEFINITION TD_VGA1_860026567 7
DEFINITION TD_VGA2_860026567 2
DEFINITION C_SIP_FE_860026567 "SIP ou Fixe"
DEFINITION C_instFEIP_860026567 "FEIP"
DEFINITION C_Tfeip_860026567 "Tfeip"
DEFINITION C_strSIP_860026567 "V1S"
DEFINITION C_str00_860026567 "00"
DEFINITION C_instFERPV_860026567 "FERPV"
DEFINITION C_Tferpv_860026567 "Tfe_rpv"
DEFINITION T_PPORTA_860026567 "PPORTA"
DEFINITION C_phone_860026567 ";phone-context=+33"
DEFINITION C_instDQD_860026567 "DQD"
DEFINITION C_TdqdTv2oip_860026567 "TdqdTv2oip"
DEFINITION CTR_CPSRI_860026567 17
DEFINITION CTR_CPSLOC_860026567 16
DEFINITION TD_ALICE_860026567 9
DEFINITION C_instALICE_860026567 "ALICE"
REGISTRE ENTIER b_EFFICACE_860026567
REGISTRE ENTIER numzone_860026567
REGISTRE ENTIER ICAR_ABS_860026567
REGISTRE ENTIER date_GMT_860026567
REGISTRE ENTIER HLAHM1_860026567
REGISTRE ENTIER duree_860026567
REGISTRE ENTIER taille_860026567
REGISTRE ENTIER roleofnode_860026567
REGISTRE ENTIER b_FACTURABLE_860026567
REGISTRE ENTIER idus_inf_860026567
REGISTRE ENTIER dede_inf_860026567
REGISTRE ENTIER indice_860026567
REGISTRE ENTIER code_errone_860026567
REGISTRE ENTIER res_860026567
REGISTRE ENTIER erreur_860026567
REGISTRE ENTIER val_860026567
REGISTRE ENTIER type_ctr_860026567
REGISTRE ENTIER vc_860026567
REGISTRE ENTIER unite_860026567
REGISTRE ENTIER CCD_860026567
REGISTRE ENTIER CCD_REEL_860026567
REGISTRE ENTIER CODCIR_860026567
REGISTRE ENTIER CODCIRDR_860026567
REGISTRE ENTIER TYPCOM_860026567
REGISTRE ENTIER SRP_ITX_860026567
REGISTRE ENTIER EPORTABILITE_SRP_860026567
REGISTRE ENTIER SPORTABILITE_SRP_860026567
REGISTRE ENTIER EPORTABILITE_SCP_860026567
REGISTRE ENTIER SPORTABILITE_SCP_860026567
REGISTRE ENTIER instACLA_860026567
REGISTRE ENTIER inst45S_860026567
REGISTRE ENTIER instTRAFIC_860026567
REGISTRE ENTIER instSYMP_860026567
REGISTRE ENTIER instECCv_860026567
REGISTRE ENTIER bREDIST_860026567
REGISTRE ENTIER bTRAFIC_860026567
REGISTRE ENTIER inst42L_860026567
REGISTRE ENTIER lg_ND_RTC_860026567
REGISTRE ENTIER lg_IDUS_NUM_860026567
REGISTRE ENTIER lg_DEDE_NUM_860026567
REGISTRE ENTIER CPT_RDT_860026567
REGISTRE ENTIER nb_csv_860026567
REGISTRE ENTIER index_860026567
REGISTRE ENTIER ASFACResult_860026567
REGISTRE ENTIER ASService_860026567
REGISTRE ENTIER Trap_860026567
REGISTRE ENTIER asservicename_860026567
REGISTRE ENTIER b_SRP_TIERS_PTD_860026567
REGISTRE ENTIER retour_BNC_860026567
REGISTRE ENTIER b_Visio_mobile_860026567
REGISTRE ENTIER b_NPF_SIP_860026567
REGISTRE ENTIER instSIP_860026567
REGISTRE ENTIER instCASPER_860026567
REGISTRE ENTIER b_DTMF_860026567
REGISTRE ENTIER b_DTMF_transmis_860026567
REGISTRE ENTIER b_DEDE_INTERNAT_860026567
REGISTRE ENTIER instCENTVG_860026567
REGISTRE ENTIER instVGA_860026567
REGISTRE ENTIER instVGAIP_860026567
REGISTRE ENTIER instOPEN_860026567
REGISTRE ENTIER NM3_860026567
REGISTRE ENTIER b_TYPAR_FE_860026567
REGISTRE ENTIER instFEIP_860026567
REGISTRE ENTIER b_FEIP_860026567
REGISTRE ENTIER b_118_TIERS_PTD_860026567
REGISTRE ENTIER b_absAnserIndicator_860026567
REGISTRE ENTIER FLS_860026567
REGISTRE ENTIER DUR_860026567
REGISTRE ENTIER DUR2_860026567
REGISTRE ENTIER Entier_flsduree_860026567
REGISTRE ENTIER SIP_Fibre_860026567
REGISTRE ENTIER ICID_CONVERTI_860026567
REGISTRE ENTIER ValZ_860026567
REGISTRE ENTIER b_FFMV3_860026567
REGISTRE ENTIER b_CodOperVG_860026567
REGISTRE ENTIER b_OperNBE_860026567
REGISTRE ENTIER instFERPV_860026567
REGISTRE ENTIER flag_CENTAUREVG_860026567
REGISTRE ENTIER flag_FERPV_860026567
REGISTRE ENTIER flag_FEIP_860026567
REGISTRE ENTIER flag_TRAFIC_860026567
REGISTRE ENTIER flag_CASPER_860026567
REGISTRE ENTIER flag_SYMP_860026567
REGISTRE ENTIER date_table_860026567
REGISTRE ENTIER b_T3G_portabilite_860026567
REGISTRE ENTIER d_util_porta_860026567
REGISTRE ENTIER dede_inf_porta_860026567
REGISTRE ENTIER b_DEDE_INTERNAT_PORTA_860026567
REGISTRE ENTIER len_prefixe_portabilite_860026567
REGISTRE ENTIER b_Emessage_IP_860026567
REGISTRE ENTIER longueur_860026567
REGISTRE ENTIER instDQD_860026567
REGISTRE ENTIER flag_DQD_860026567
REGISTRE ENTIER TYPCOM_SYMPHONIE_860026567
REGISTRE ENTIER HLAHM1_C_860026567
REGISTRE ENTIER b_BANIP_860026567
REGISTRE ENTIER b_Fact_CPS_Loc_860026567
REGISTRE ENTIER b_Fact_CPS_RI_860026567
REGISTRE ENTIER b_Fact_CPS_Act_860026567
REGISTRE ENTIER b_ALICE_860026567
REGISTRE ENTIER instALICE_860026567
REGISTRE POINTEUR pt_debChamp1_860026567
REGISTRE POINTEUR pt_debChamp2_860026567
REGISTRE POINTEUR pt_debChamp3_860026567
REGISTRE POINTEUR pt_BUF1_860026567
REGISTRE POINTEUR pt_BUF2_860026567
REGISTRE POINTEUR pt_BUF3_860026567
REGISTRE POINTEUR pt_BUF4_860026567
REGISTRE POINTEUR pt_BUF5_860026567
REGISTRE POINTEUR pt_DTMF_860026567
REGISTRE POINTEUR pt_IDUS_NUM_860026567
REGISTRE POINTEUR pt_IDUS_BNC_860026567
REGISTRE POINTEUR pt_DEDE_BNC_860026567
REGISTRE POINTEUR pt_DEDE_NUM_860026567
REGISTRE POINTEUR pt_CODESRP_860026567
REGISTRE POINTEUR pt_CODESCP_860026567
REGISTRE POINTEUR pt_EccFact_860026567
REGISTRE POINTEUR pt_InfoCompl_860026567
REGISTRE POINTEUR pt_inst_860026567
REGISTRE POINTEUR pt_ECCv_860026567
REGISTRE POINTEUR pt_LIBELREDIST_860026567
REGISTRE POINTEUR pt_sgtqs_860026567
REGISTRE POINTEUR pt_OP_CSVi_860026567
REGISTRE POINTEUR pt_C_CSVi_860026567
REGISTRE POINTEUR pt_csv_860026567
REGISTRE POINTEUR pt_indic_860026567
REGISTRE POINTEUR pt_NM3_OF_860026567
REGISTRE POINTEUR pt_NM3_OP_860026567
REGISTRE POINTEUR pt_OFFRE_860026567
REGISTRE POINTEUR pt_OPERA_860026567
REGISTRE POINTEUR pt_RES1_860026567
REGISTRE POINTEUR pt_AnswerIndicator_860026567
REGISTRE POINTEUR pt_redirectReason_860026567
REGISTRE POINTEUR pt_flsduree_860026567
REGISTRE POINTEUR pt_SIP_ECC_860026567
REGISTRE POINTEUR pt_CLE_860026567
REGISTRE POINTEUR pt_DEDE_NUM1_860026567
REGISTRE POINTEUR pt_chiffres_860026567
REGISTRE POINTEUR pt_adr_NDRTC_860026567
REGISTRE POINTEUR pt_CLEcsv_860026567
REGISTRE POINTEUR pt_Support_860026567
REGISTRE POINTEUR pt_CodOffreVG_860026567
REGISTRE POINTEUR pt_CodOperVG_860026567
REGISTRE POINTEUR pt_TEMP_860026567
REGISTRE POINTEUR pt_datODEBI_860026567
REGISTRE POINTEUR pt_T3G_prefixe_portabilite_860026567
REGISTRE POINTEUR pt_DEDE_NUM_PORTA_860026567
REGISTRE POINTEUR pt_len_prefixe_portabilite_860026567
REGISTRE POINTEUR pt_pporta_860026567
REGISTRE POINTEUR pt_BANIP_RTC_860026567
REGISTRE POINTEUR pt_TEMP1_860026567
REGISTRE POINTEUR pt_RTC_MAY_860026567
REGISTRE POINTEUR pt_datCPLUSS_860026567
REGISTRE POINTEUR pt_TARIF_860026567
REGISTRE POINTEUR pt_EDIT_860026567
##############################################################################
# DISTRIBUTION
#  Tv2oip: DC plateforme SIP
#  Creation JLG 02/06/2006
#
# ENTREE :
# Tv2oip	g_iartin
# Tv2oip	g_iartout
#
# REFERENTIELS :
# TD_VGA1 (-8-FA)
# TD_VGA2 (-3-FA)
# 45S "SKITEL" (-7-FD)
# 45S "ACLA" (-7-FB)
# TD_Fixe FE (-1-4C), FERPV (-1-4B)
# TD_SIP, TD_OPT (-4- F7, F6)
# TD_42L (-6-FC)
# TD_Inter "MAJ2G" (-5-FE)
#
# SORTIE :
# ECC distribuees + conversion + erronees
# 	REDHAWK		(TrhawkTv2oip	, g_iartout2)		supprime en G3R19Cx
# 	WOOFACT		(Twoofact		, g_iartout5) 		Supprime en G3R16
# 	FEIP		(Tfeip			, g_iartout3)
# 	SYMPHONIE	(TsymTv2oip		, g_iartout6)
# 	CENTVG		(TcentaureVG	, g_iartout7)
# 	DISTRI_ERR	(DISTRI_ERR		, g_iartout8)
# 	TRAFIC		(TtraficN		, g_iartout9)
# 	Conversion	(Conversion		, g_iartout10)
# 	CASPER		(TcasperTv2oip	, g_iartout11)		(G3R15C1)
#G3R17lot2
# 	FERPV		(Tfe_rpv		, g_iartout12)
# 	DQD			(TdqdTv2oip		, g_iartout4) 		(G3R24)
#
# G4R8 Modif Valeur bREDIST
#	bREDIST = 0 Initialisation
#	bREDIST positif = Envoi d'un message 8503 au 1er passage et envoi en anomalie de redistribution au 3ieme passage
#	bREDIST negatif = Pas de message 8503 et envoi a DQD au 3ieme passage 
#		bREDIST = -1 Redistribution IP (non trouve dans BANIP 42L)
#		bREDIST =  1 Redistribution ALICE (non trouve dans ALICE)
#		bREDIST =  2 Redistribution MAJ2G (non trouve dans MAJ2G)
#
##############################################################################
#  HISTORIQUE
# 16/06/06 JLG Nlle spec S0F4, FO 1815,1816,1817,1818,1819,1820,1821,1822,1823
# 20/06/06 JLG FO 1828, 1829, 1831, 1832, 1833, 1835
# 22/06/06 JLG FO 1845, 1846
# 09/08/06 PKH FO 1912, modif. de l'interrogation table CSV et du calcul du boolien FACTURABLE
# 04/09/06 PKH FO 1941, Correction controle presence champ ChargeIndicator avant de le lire
# 11/09/06 JLG FO 1954, modif table externe CSV
# 19/10/06 THE FO 2000, G2R2CbNH absence de CSV si REJET
# 20/10/06 THE FO 2014, G2R2CbNH N0 demande avec DTMF "*" unique
# 14/11/06 THE FO 2026, G2R2CbNH N0 demande remplacement de %23 par #
# 17/11/06 THE FO 2035, 36, G2R2CbNH ChargingId OPT , si ERR BNC et Non Facturable CTN
# 21/11/06 THE FO 2046, 47 G2R2CbNH Nouvelles alarmes+ Norm IDUS
# 23/11/06 THE FO 2051 G2R2CbNH CCD si Pas d'erreur BNC
# 23/11/06 THE Integration G2R2CzNH
# 05/12/06 THE FO 2062, 2063 et 2064
# 13/12/06 BEA G2R2CcNH
# 12/01/07 BEA FO 2087 G2R2CcNH critere DTMF sur DEDE_INF pour TRAFIC
# 25/01/07 THE G2R2CcNH: FO 2104 et FO 2105
# 31/01/07 BEA G2R2CtNH - Le CCD correspondant au SRT_ITX est retire de la variable SRP_TIERS qui entrainait en solution intermediaire une facturation avec valorisation
# 06/02/07 BEA G2R2CtNH V2oip_S3F4.doc filtrage des 118_ITX par typeControle= 9  REJET5
# 22/02/07 BEA G2R2CtNH V2oip_S3F5.doc  maintien du CCD = 0x62 dans variable SRP_TIERS pour que la solution intermediaire soit valable jusqua mise en REJET5
# 12/04/07 BEA G2R2CdNH V2oip_S4F1.doc FO 2145 et 2147, integration V2oip_S3F7b.doc DEDE_INTERNAT oubliee Sifac
# 22/05/07 JLG Param NH-G2R5 : ajout de l'Offre Net et Mobile phase3 (NM3) realisee dans la G2R2CxNH
# 24/05/07 JLG Param NH-G2R5 : ajout de G2R2CuNH
# 05/06/07 JLG Param NH-G2R5 : resolution pb FEIP si pas 42L
# 06/06/07 JLG Param NH-G2R5 : FO2174 ( si AR ` la fois FEIP & NM3, prioriti ` NM3)
# 20/06/07 JLG Param NH-G2R5 : FO2186 pb enveloppe E_NOVAH et celle de redistribution en cas de redistribution
# 20/06/07 FAL Param NH-G2R5 : FO2203 RDT
# 20/06/07 FAL THE Param NH-G2R5 : FO2205 FACTURABLE
# 04/09/07 JLG Param NH-G2R5 : FO2220 report de G2R4 : variable CalledNb_DCB : CalledNb peut commencer par tel:
# 14/09/07 FAL Param NH-G2R5 : FO2228
# 05/11/07 BEA Param NH-G2R5 V2oip_S7F0..doc et FO 2233 message 8612
# 12/11/07 - THE - ParamFTSA-G3R4 Delestage NH
# 28/11/07 - THE - Correction Pb Alarmes et retour CSV
# 07/12/07 - THE - ParamFTSA-G3R4 FO 2277 Erreur spec: Les champs CODCIR & CODCIRDR doivent toujours etre fournis a Calinette meme vides
# 11/01/08 - PKH - FO 2274 remplacer TtraficNS par TtraficN
# 28/01/08 - JLG - ParamFTSA-G3R6 fusion G3R5C4 avec la G3R4Cz(G3R4C999),palier de facturation NBH S4D1(Reprise G2R6Cz)
# 25/03/08 - JLG - ParamFTSA-G3R6 FO2358 evol spec S11F2
# 25/03/08 - JLG - ParamFTSA-G3R6 correction Suivi Conso Calcul de IDUS_NUM avec NDRTC
# 21/04/08 - THE - Param FTSA-G3R7 modif champ TAX pour E_bill
# 02/09/08 - THE/DRE - Param FTSA-G3R9 champ TAX pour E_bill QC77
# 07/01/09 - BEA - Param FTSA-G3R11Cy V2oip_S15F1.doc (Z=7)
# 23/03/09 - PKH - ParamFTSA - G3R13 offre FLS
# 24/03/09 - PKH - ParamFTSA - G3R13 prise en compte FTTH fibre SIP
# 28/07/09 - THE - Param FTSA-G3R14 QC272 (pb specs FLS )
# 11/08/09 - DRE - Param FTSA-G3R14 Complement QC272 mettre "Yes-PostRedirection" au lieu de "Yes-Postredirection"
# 02/10/09 - JLG - Param FTSA-G3R14Cy Service Multicom Residentiel (eviter les faux-doublons avec ICID_CONVERTI)
# 26/10/09 - BEA - Param FTSA-G3R15C1 Casper V2oip_S18F1.doc
# 26/10/09 - THE - Param FTSA-G3R15C4 Correction QC 305
# 13/12/09 - THE - Param FTSA-G3R15C5 Correction QC 306 307
# 17/11/09 - THE - Param FTSA-G3R15C6 Modif QC 306 (Spec V2oip_S18F4.doc)
# 03/02/10 - DRE - Param FTSA-G3R16 : QC336 Renseigner le NDRTC dans le cas d'une offre Optimale
# 04/02/10 - DRE - G3R16 Menage e-bill (Allofact) +  Fusion des BdC (bases de comptage) Wanadoo et TPH
#							(inversion RES_TYCOM et RES_CCD)
# 10/05/10 - PKH - G3R17lot2 Item NBE2 2etape
# 10/05/10 - PKH - QC362 Valorisation du champ SERVICE de FERPV a 8
# 11/05/10 - BEA - G3R17 lot2 T3G 3131 V6S
# 31/05/10 - PSA - QC366 : ajout FERPV
# 02/06/10 - THE DRE - QC372 : Manque l'appel a la BNC avec le champ FD/TransledNb (+ le 10/06/2010 pour la version C6)
# 10/06/10 - PKH - QC366 : reprise de la QC deplacement de la lecture de instance FERPV en amont
# 11/06/10 - PKH - QC378 : distribution aux ECCs par flag et non par la liste des ECCs a cause de la limitation a 5 ECCs
# 11/06/10 - PKH - QC377 : evolution suppression de FFMV2 et modification de la valorisation de OFFRE et OPERATEUR dans Symph,Trafic,CentVG
# 15/06/2010 - PKH - QC366 correction calcul NBCOD
# 16/06/2010 - PKH - QC382 utilisation d'un buffer intermediaire pt_BUF4 pour enrichir les champs OFF_VGA et OPE_VGA de sympT2voip
# 13/07/2010 - PKH - G3R18 ODEBI arret substitution du NDIP par le NDRTC pour TRAFIC
# 13/07/2010 - DRE - QC400 Pb FLS G3R18 (replacer les parentheses )
# 24/09/2010 - THE - QC418 FTSA PRM G3R18 : Envoi NDS_NUM pour TRAFIC
# 29/09/2010 - DRE THE - QC421 FTSA PRM G3R18 : Item 3131
# 13/10/2010 - DRE THE - FTSA PRM G3R18Cx
# 18/10/2010 - PKH - FTSA G3R18Cy Ajout nature du numero demande dans la mise au format FERPV et normalisation du demande
# 21/10/2010 - PKH - FTSA G3R18Cy Correction partiel de la QC427 pour DEDE_NUM de TRAFIC et CENTAUREVG
# 27/10/2010 - THE DRE - FTSA G3R18Cy Correction de la QC427
# 28/10/2010 - PKH - FTSA G3R18Cy Correction de la QC428
#  3/11/2010 - PKH - G3R18Cy QC428 Correction format de INFDDE pour ferpv
#  8/11/2010 - PKH - G3R19C1 QC427 Correction valorisation de NUMDDE pour FERPV
# 20/01/2011 - DRE - G3R19Cx suppression de l'ECC Calinette (RADHAWK)
# 08/04/2011 - RHE - G3R21 portabilite directe SIP Ericson (recherche prefixe portabilite dans table PPORTA)
# 22/04/2011 - RHE - G3R21/QC469 modif sur champ NUMMDDE pour FERPV
# 26/04/2011 - RHE - G3R21 lot2 : Facturation Open , evol LAR VIO
# 13/07/2011 - THE - G3R21Cy : Item messagerie IP + QC 483
# 08/08/2011 - THE - G3R22 QC508 Allongement pointeur
# 31/08/2011 - DRE - G3R22 QC514 Reprise item E-MessagesIP + Reprise de la QC483 oublie lors de la fusion
# 16/11/2011 - THE - G3R22C5 QC547 Suppression de ";phone-context=+33" dans Called et Translated
# 18/11/2011 - RHE - G3R23 lot2 table PPORTA avec categorie
# 23/01/2012 - THE - VerifPcode
# 09/03/2012 - RHE - G3R24 Errones IP vers DQD
# 21/03/2012 - RHE - G3R24 nouveau palier tarifaire 0898PQ : SRP Tiers Deterministe
# 26/03/2012 - RHE - G3R24 Errones IP vers DQD  + alarme 8503 pour MAJ2G
# 03/04/2012 - RHE - G3R24 QC587 suppression T3ace vers DQD
# 22/06/2012 - DRE - FTSA PRM G3R24 QC602 alimentation provisoire du CCD de SYMPHONIE avec le champ TYPCOM + ajout champ TYPCOM pour SYMPHONIE
# 24/08/2012 - THE - G4R1 QC607 CCD_SYMPHONIE = TYPCOM_SYMPHONIE
# 24/08/2012 - THE - G4R2 Integration du lar OPEN
# 25/03/2013 - DRE - G4R2 QC701 Remplace "BEAM" par "OPEN"
# 29/05/2013 - DRE - G4R3 lot2: Secret Permanent, Codes ARCEP Prise en compte des nouveaux codes FAC (3170,3171, 3173)	Mise en place de la table externe CodeFAC dans Inter INp
# 29/08/2013 - DRE - G4R3 QC742 : si le DTMF de lappele est incomplet, envoyer le DC en errone uniquement si facturable
# 29/08/2013 - DRE - G4R3 QC742 : pas d'appel aux referentiels si (roleofnode != 0x00 || idus_inf != 0x80)
# 17/12/2013 - DRE - G4R5 QC772 Suppression des caracteres a partir de ";" au lieu de ";phone-context=+33"
# 03/01/2014 - THE - G4R5 Lot2
# 03/01/2014 - THE - G4R5 QC782 Apres Redist Date locale incorrecte pour Symphonie
# 31/01/2014 - THE - G4R5 QC784 Pb # fin Dtmf
# 05/02/2014 - DRE - G4R5 QC789 Formatage de numeros demandeur geographique IP DOM 
# 25/03/2014 - THE - G4R6 Lot2  Creation C+S 
# 24/06/2014 - THE - #G4R7 Lot1 modification de l interrogation de ACLA
# 25/07/2014 - THE - #G4R7 Lot3 QC833 Envoi alarme 8503 en redist
# 25/07/2014 - THE - #G4R7 Lot3 QC834 envoi en redist si IC ALICE vide
# 27/08/2014 - THE - G4R7 traitement CallingNB et RedirectingNB Idem
# 27/11/2014 - DRE - G4R8 QC861 : Pour les redistribution BANIP, ne pas afficher l'erreur 8503, ne pas envoyer en anomalie de redistribution mais envoyer ? DQD 
#
##############################################################################

# G4R5 Lot2
#G4R6 Lot2 


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

#G4R8 QC861
# G4R5 Lot2
#G4R6 Lot2 


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

#G4R6 Lot2 


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

b_Visio_mobile_860026567	 = 0
b_NPF_SIP_860026567	 = 0
bREDIST_860026567		 = 0
#G4R8 QC861
#bREDISTMAJ2G = 0
b_DTMF_860026567		 = 0
b_DTMF_transmis_860026567	 = 1
SPORTABILITE_SRP_860026567 = 0
b_DEDE_INTERNAT_860026567	 = 0
instTRAFIC_860026567	 = 0
b_118_TIERS_PTD_860026567	 = 0
b_absAnserIndicator_860026567 = 0
FLS_860026567		 = 0
DUR_860026567		 = 0
DUR2_860026567		 = 0
Entier_flsduree_860026567	 = 0
ValZ_860026567		 = 0
SIP_Fibre_860026567	 = 0
b_FFMV3_860026567		 = 0
b_CodOperVG_860026567	 = 0
b_OperNBE_860026567	 = 0
instFERPV_860026567	 = 0
flag_CENTAUREVG_860026567	 = 0
flag_FERPV_860026567	 = 0
flag_FEIP_860026567	 = 0
flag_TRAFIC_860026567	 = 0
flag_CASPER_860026567	 = 0
flag_SYMP_860026567	 = 0
date_table_860026567	 = 0
# G4R5 Lot2 b_DATODEBI	 = 0
b_T3G_portabilite_860026567 = 0
d_util_porta_860026567	 = 0
b_DEDE_INTERNAT_PORTA_860026567 = 0
dede_inf_porta_860026567	 = 0
len_prefixe_portabilite_860026567 = 0
b_Emessage_IP_860026567 	= 0
longueur_860026567 = 0
#QC602 CCD_SYMPHONIE = -1
# QC607
TYPCOM_SYMPHONIE_860026567 = -1
# G4R5 Lot2 
b_BANIP_860026567 = 0
#G4R6 Lot2 
b_Fact_CPS_Act_860026567 = 0
b_Fact_CPS_Loc_860026567 = 0
b_Fact_CPS_RI_860026567 = 0
b_ALICE_860026567 = 0


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

# Initialisations pt
pt_debChamp1_860026567 = "111111111111111111111111"
pt_debChamp2_860026567 = "222222222222222222222222"
pt_debChamp3_860026567 = "333333333333333333333333"
pt_BUF1_860026567		 = "pt_BUF1_555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"
pt_BUF2_860026567		 = "pt_BUF2_222666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666601234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
#VerifPcode
pt_BUF3_860026567		 = "pt_BUF3_333666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666"
pt_BUF5_860026567		 = "pt_BUF5_222666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666677777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"
#\VerifPcode
pt_BUF4_860026567		 = "76667612345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"
pt_DTMF_860026567		 = "33333333336666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666"
pt_IDUS_NUM_860026567	 = "000000000000001717171717171717171717171717171717171717171717171717171717171717171717171717171717171711714141"
pt_IDUS_BNC_860026567	 = "1111111111111117171717171717171717171717171717171717171717171717171717171717171717171717171717171717117"
pt_DEDE_BNC_860026567	 = "8888888888888817171717171717171717171717171717171717171717171717171717171717171717171717171717171717117"
pt_DEDE_NUM_860026567	 = "9999999999999917171717171717171717171717171717171717171717171717171717171717171717171717171717171717117"
pt_CODESRP_860026567	 = "8888888888888888888888888888888888888888"
pt_CODESCP_860026567	 = "9999999999999999999999999999999999999999"
pt_EccFact_860026567	 = "13131313131313"
pt_InfoCompl_860026567 = "00999999"
pt_inst_860026567		 = "12345678901234"
pt_ECCv_860026567		 = "2121212121212121212121212121212121212121"
pt_LIBELREDIST_860026567	 ="22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"
pt_sgtqs_860026567	 = "00000000000000000000"
pt_C_CSVi_860026567	 = "000012345"
pt_OP_CSVi_860026567	 = "0012345"
pt_csv_860026567		 = "555555555555555555555555555555555555"
pt_indic_860026567	 = "777777777777777"
pt_DEDE_NUM1_860026567 = "7171717171717171717179999999999999917171717171717171711717171717171717171717171717171717171717171717117"
pt_chiffres_860026567	 = "5863214717171717179999999999999917171717171717171711717171717171717171717171717171717171717171717117"
pt_SIP_ECC_860026567	 = "231"
pt_CLE_860026567		 = "2654685435"
pt_NM3_OF_860026567	 = "147852369852149456784524987648"
pt_NM3_OP_860026567 	 = "326598458715798746878745454457"
pt_OFFRE_860026567 	 = "314159265358979285625851178636"
pt_OPERA_860026567 	 = "299792510818563228565332124741"
pt_RES1_860026567 	 = "35789"
#G4R6 Lot1 pt_OPT_RTC	 = "pt_OPT_RTC333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"
pt_adr_NDRTC_860026567 = "pt_adr_NDRTC444444444444444444444444444444444444433333333333333333333333333333333333333333333333333333333333333333333"
pt_CLEcsv_860026567	 = "pt_CLEcsv443163166"
#G4R6 Lot1 pt_OPT_ECC	 = "pt_OPT_ECC"
pt_AnswerIndicator_860026567 = "pt_AnswerIndicator98989898989899898989989898989"
pt_redirectReason_860026567 = "pt_redirectReason19191919191919191919191919191919"
pt_flsduree_860026567	 = "pt_flsduree45345434534543453453453"
pt_Support_860026567	 = "pt_Support525252525252525252525252525"
pt_CodOffreVG_860026567	 = "pt_CodOffreVG929292929929299292929299292929292929292992929299292929292929"
pt_TEMP_860026567		 = "pt_TEMP8678678678678678678676876866768676867686768676867686678667867686768686780123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
pt_TEMP1_860026567	 = "pt_TEMP1987654321098765432109876543210987654321098765432109876543210987654321012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012"
pt_CodOperVG_860026567 = "pt_CodOperVG9090909090909009090090900990900909909099099090909909909990990900"
pt_datODEBI_860026567	 = "pt_datODEBI93459345934593457654398767854875634357365332489263323432"
pt_T3G_prefixe_portabilite_860026567 = "T3G_prefixe_portabilite"
pt_DEDE_NUM_PORTA_860026567= "pt_DEDE_NUM_PORTA11111111111111111111111111111111111111111111111111111111111111111111111111111111111111110123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"
pt_len_prefixe_portabilite_860026567 = "pt_len_prefixe_portabilite123"
pt_pporta_860026567 = "pt_pporta01234567890123456789"
#G4R5 Lot2 pt_NDRTC	 = "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333"
pt_BANIP_RTC_860026567 = "pt_BANIP_RTC0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
pt_RTC_MAY_860026567	 = "pt_RTC_MAY1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
#G4R6 Lot2 
pt_datCPLUSS_860026567 = "pt_datCPLUSS98765432109876543210"
pt_TARIF_860026567 = "pt_TARIF0123456789"
pt_EDIT_860026567 = "pt_EDIT0123456789"


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

i_strcpy (pt_indic_860026567,"")
i_strcpy (pt_SIP_ECC_860026567,"")
i_strcpy (pt_DEDE_NUM1_860026567,"")
i_strcpy (pt_chiffres_860026567,"")
#G4R6 Lot1 i_strcpy (pt_OPT_RTC," ")
#G4R6 Lot1 i_strcpy (pt_OPT_ECC," ")
i_strcpy (pt_adr_NDRTC_860026567," ")
i_strcpy (pt_AnswerIndicator_860026567," ")
i_strcpy (pt_redirectReason_860026567," ")
i_strcpy (pt_flsduree_860026567," ")
i_strcpy (pt_Support_860026567, " ")
i_strcpy (pt_debChamp1_860026567,"")
i_strcpy (pt_debChamp2_860026567,"")
i_strcpy (pt_debChamp3_860026567,"")
i_strcpy (pt_BUF1_860026567,"")
i_strcpy (pt_BUF2_860026567,"")
i_strcpy (pt_BUF3_860026567,"")
i_strcpy (pt_BUF4_860026567,"")
i_strcpy (pt_BUF5_860026567,"")
i_strcpy (pt_CODESRP_860026567,"")
i_strcpy (pt_CODESCP_860026567,"")
i_strcpy (pt_InfoCompl_860026567,"")
i_strcpy (pt_inst_860026567,"")
i_strcpy (pt_ECCv_860026567,"")
i_strcpy (pt_LIBELREDIST_860026567,"")
i_strcpy (pt_sgtqs_860026567,"")
i_strcpy (pt_OFFRE_860026567,"")
i_strcpy (pt_OPERA_860026567,"")
i_strcpy (pt_RES1_860026567,"")
i_strcpy (pt_CLE_860026567,"")
i_strcpy (pt_CodOffreVG_860026567,"")
i_strcpy (pt_TEMP_860026567,"")
i_strcpy (pt_CodOperVG_860026567,"")
i_strcpy (pt_datODEBI_860026567," ")
i_strcpy (pt_T3G_prefixe_portabilite_860026567," ")
i_strcpy (pt_DEDE_NUM_PORTA_860026567," ")
i_strcpy (pt_len_prefixe_portabilite_860026567," ")
i_strcpy(pt_pporta_860026567,"")
# G4R5 Lot2
i_strcpy(pt_BANIP_RTC_860026567, "")
i_strcpy (pt_TEMP1_860026567,"")
i_strcpy (pt_RTC_MAY_860026567, "")
#G4R6 Lot2 
i_strcpy (pt_datCPLUSS_860026567,"")
i_strcpy(pt_TARIF_860026567,"    ")
i_strcpy(pt_EDIT_860026567," ")


##############################################################################
# Creation article Conversion (utilise a plusieurs endroits)
##############################################################################

erreur_860026567 = i_cree_art(C_Conversion_860026567,g_iartout10)

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

SI i_valid_field_n(g_iartin, $Tv2oip::ChargingId)
ALORS
	erreur_860026567 = i_get_art_str(g_iartin, $Tv2oip::ChargingId, pt_BUF1_860026567)
	indice_860026567 = i_strlen(pt_BUF1_860026567) - 1
	index_860026567 = 0
	val_860026567 = 0

	POINT BOUCLE_ICID

	res_860026567 = i_strtab( pt_BUF1_860026567, indice_860026567)
	val_860026567 = val_860026567 + res_860026567 * (0x100 ** index_860026567)

	SI (indice_860026567 == 0 || index_860026567==3)
	ALORS
		ICID_CONVERTI_860026567 = ICID_CONVERTI_860026567 + (val_860026567 % 1000)
		index_860026567 = -1
		val_860026567 = 0
	FINSI
	indice_860026567 = indice_860026567 -1

	SI (indice_860026567 != -1)
	ALORS
		index_860026567 = index_860026567 +1
		SAUT BOUCLE_ICID
	FINSI
FINSI

ICID_CONVERTI_860026567 = ICID_CONVERTI_860026567 % 1000
#trace1("__FILE__:__LINE__ ## ICID_CONVERTI final = <%d>",ICID_CONVERTI)

##############################################################################
# ECC de facturation
##############################################################################

i_strcpy(pt_EccFact_860026567," ")

##############################################################################
# Variables calculables suite a appel BNC
##############################################################################

i_strcpy(pt_IDUS_NUM_860026567, " ")

b_FACTURABLE_860026567 = 1

#################### DEBUT v2oip #############################################

#trace("__FILE__:__LINE__ ## ******* Debut Pcode distribution - Tv2oip")
roleofnode_860026567 =i_get_art_field(g_iartin, $Tv2oip::roleOfNode)

SI (roleofnode_860026567 != 0x00 )
ALORS
	b_FACTURABLE_860026567 = 0
FINSI

# -------------------------------------------------------------
# Identification de la provenance de l'article (redistribution)
# -------------------------------------------------------------

# CPT_RDT : nb de passage en redistribution
CPT_RDT_860026567 = -1
CPT_RDT_860026567 = i_LireRedistCpt()
#trace1(" ============= nb de passage en redistribution Cpt = <%d> ===",CPT_RDT)

##############################################################################
# modification methode de calcul pour EFFICACE
##############################################################################

b_EFFICACE_860026567 = 0
duree_860026567 = 0
duree_860026567=i_get_art_field(g_iartin, $Tv2oip::DUREE)

SI ( duree_860026567 != 0 )
ALORS
	b_EFFICACE_860026567 = 1
SINON
	b_FACTURABLE_860026567 = 0
FINSI

#################### condition presence ASServiceName et ASFacResult = 0x01
index_860026567 = -1
ASService_860026567 = 0

POINT BOUCLE_1
index_860026567 = index_860026567 + 1

SI index_860026567 < 5
ALORS
	SI (i_valid_field_n(g_iartin, $Tv2oip::ASServiceName + 8*index_860026567))
	ALORS
		ASFACResult_860026567 = i_get_art_field(g_iartin, $Tv2oip::ASFacResult + 8*index_860026567)
		SI (ASFACResult_860026567 == 0x01)
		ALORS
			ASService_860026567 = 1
		FINSI
	FINSI
	SAUT BOUCLE_1
FINSI

SI (i_valid_field_n(g_iartin, $Tv2oip::ChargeIndicator))
ALORS
	erreur_860026567 = i_get_art_str(g_iartin, $Tv2oip::ChargeIndicator,pt_indic_860026567)
FINSI

SI (i_valid_field_n(g_iartin, $Tv2oip::AnswerIndicator))
ALORS
	erreur_860026567 = i_get_art_str(g_iartin, $Tv2oip::AnswerIndicator,pt_AnswerIndicator_860026567)
SINON
	b_absAnserIndicator_860026567 = 1
FINSI

# si pt_AnswerIndicator = "No" => b_absAnserIndicator = 0
SI ( ASService_860026567 != 1 && i_strcmp(pt_indic_860026567,"y") != 0 || i_strcmp(pt_AnswerIndicator_860026567,"No") == 0 )
ALORS
	b_FACTURABLE_860026567 = 0
FINSI

#################### DATE_GMT ################################################

date_GMT_860026567 = i_get_art_field(g_iartin, $Tv2oip::DATE)

#-----------------------------------------------------------
# ODEBI : Determine si la Tv2oip::DATE est egale ou posteriereure a celle
# retournee par la table TDATODEBI
#------------------------------------------------------------

# G4R5 Lot2
#trace1 ("__FILE__:__LINE__ ##  date_GMT = %d ---------",date_GMT)
#i_strcpy (pt_datODEBI,i_get_tab_field("TDATODEBI", date_GMT, "ODEBI"))
#erreur = i_set_art_str (g_iartout10,$Conversion::DATE_STR,pt_datODEBI)
#date_table = i_get_art_field(g_iartout10, $Conversion::DATE_ASC)
#trace2 ("__FILE__:__LINE__ ##  pt_datODEBI = %s --------",pt_datODEBI,"")
#trace1 ("__FILE__:__LINE__ ##   date_table = %d ----------",date_table)
#
#SI date_GMT >= date_table
#ALORS
#	b_DATODEBI = 1
#FINSI
#trace1 ("__FILE__:__LINE__ ## b_DATODEBI = %d --------",b_DATODEBI)

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

SI date_GMT_860026567 >= date_table_860026567
ALORS
	b_Fact_CPS_Act_860026567 = 1
FINSI

##############################################################################
# IDUS_NUM, IDUS_INF
##############################################################################

#################### IDUS_NUM choix entre RedirectingNb et CallingNb #########

erreur_860026567 = i_dup_art_id(g_iartin, g_iartout)
erreur_860026567 = i_ajoutChampNum(g_iartout, $Tv2oip::T4idus,$Tv2oip::IDUS_NUM,6)
taille_860026567=0

#################### IDUS_NUM choix entre RedirectingNb et CallingNb #########

erreur_860026567 = i_dup_art_id(g_iartin, g_iartout)
erreur_860026567 = i_ajoutChampNum(g_iartout, $Tv2oip::T4idus,$Tv2oip::IDUS_NUM,6)
taille_860026567=0

SI (i_valid_field_n(g_iartin, $Tv2oip::RedirectingNb))
ALORS
	erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::RedirectingNb,pt_BUF1_860026567)
	#trace2("__FILE__:__LINE__ ## IDUS_NUM=RedirectingNb = %s",pt_BUF1,"")
SINON
	erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::CallingNb,pt_BUF1_860026567)
	#trace2("__FILE__:__LINE__ ## IDUS_NUM=CallingNb = %s",pt_BUF1,"")
FINSI

#################### IDUS_NUM detection et suppression de tel:+ ou sip:+ #####

i_get_sub_str(pt_BUF1_860026567, 0, 3, pt_debChamp2_860026567)
taille_860026567 = i_strlen(pt_BUF1_860026567)

SI ( i_strcmp("tel:", pt_debChamp2_860026567) == 0) || ( i_strcmp("sip:", pt_debChamp2_860026567) == 0)
ALORS
	# on enleve le sip: ou tel: eventuel en debut de IDUS_NUM
	#trace2("__FILE__:__LINE__ ## IDUS_NUM avec en-tete sip: ou tel: = %s",pt_BUF1,"")
	i_get_sub_str(pt_BUF1_860026567, 4, -1, pt_BUF1_860026567)
FINSI
#trace2("__FILE__:__LINE__ ## IDUS_NUM  en-tete sip: ou tel: eventuel enleve = %s",pt_BUF2,"")

#################### Suppression de "+" si present au debut du champ RedirectingNB

i_get_sub_str(pt_BUF1_860026567, 0, 0, pt_debChamp2_860026567)
taille_860026567 = i_strlen(pt_BUF1_860026567)

SI ( i_strcmp("+", pt_debChamp2_860026567) == 0 )
ALORS
	i_get_sub_str(pt_BUF1_860026567, 1, -1, pt_BUF1_860026567)
	taille_860026567 = i_strlen(pt_BUF1_860026567)
FINSI

#################### pt CallingNb_DCB, suppression partie apres @ ############

taille_860026567 = i_strlen(pt_BUF1_860026567)
erreur_860026567 = i_recupererValeur(pt_BUF1_860026567, pt_BUF2_860026567, taille_860026567, '@')

SI erreur_860026567 == -1 && b_FACTURABLE_860026567
ALORS
	#trace("__FILE__:__LINE__ ## erreur IDUS_NUM vide")
	code_errone_860026567 = 0xA070
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8611,2,g_iartin,"",3,code_errone_860026567,C_Article_860026567,pt_BUF2_860026567)
	SAUT DISTRI_ERR
FINSI

#trace2("__FILE__:__LINE__ ## IDUS_NUM sans @xxx = %s",pt_BUF2,"")
# pt CallingNb_DCB = pt_BUF2
# nouvelle taille de pt_BUF2 : IDUS_NUM
taille_860026567 = i_strlen(pt_BUF2_860026567)

#################### calcul idus_inf et suppression de 33 eventuel RES=pt_IDUS_NUM

SI i_strplcmp(pt_BUF2_860026567,"33",0,2) == 0
ALORS
	#trace2("__FILE__:__LINE__ ## IDUS_NUM avec 33  = %s",pt_BUF2,"")
	idus_inf_860026567 = 0x80
	i_get_sub_str(pt_BUF2_860026567, 2, -1, pt_BUF1_860026567)
	i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
	taille_860026567 = i_strlen(pt_BUF2_860026567)
	#trace2("__FILE__:__LINE__ ## IDUS_NUM avec 33 et suppresion de 33 = %s",pt_BUF2,"")
SINON
	# G4R5 Lot2
	#SI ( ( i_strplcmp(pt_BUF2,"262",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"269",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"590",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"594",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"596",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"508",0,3) == 0 ) )
	SI ( ( i_strplcmp(pt_BUF2_860026567,"262",0,3) == 0 ) || ( i_strplcmp(pt_BUF2_860026567,"590",0,3) == 0 ) 
	  || ( i_strplcmp(pt_BUF2_860026567,"594",0,3) == 0 ) || ( i_strplcmp(pt_BUF2_860026567,"596",0,3) == 0 ) )
	ALORS
		idus_inf_860026567 = 0x80
		i_get_sub_str(pt_BUF2_860026567, 3, -1, pt_BUF1_860026567)
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
		taille_860026567 = i_strlen(pt_BUF2_860026567)
	SINON
		idus_inf_860026567 = 0xC0
		b_FACTURABLE_860026567=0
	FINSI
FINSI
#trace1("__FILE__:__LINE__ ## IDUS_INF = %x",idus_inf)
i_strcpy(pt_IDUS_NUM_860026567,pt_BUF2_860026567)


#SI (i_valid_field_n(g_iartin, $Tv2oip::RedirectingNb))
#ALORS
#	erreur = i_get_art_str(g_iartout,$Tv2oip::RedirectingNb,pt_BUF1)
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM=RedirectingNb = %s",pt_BUF1,"")
#SINON
#	erreur = i_get_art_str(g_iartout,$Tv2oip::CallingNb,pt_BUF1)
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM=CallingNb = %s",pt_BUF1,"")
#FINSI
#
##################### IDUS_NUM detection et suppression de tel:+ ou sip:+ #####
#
#i_get_sub_str(pt_BUF1, 0, 4, pt_debChamp2)
#taille = i_strlen(pt_BUF1)
#
#SI ( i_strcmp("tel:+", pt_debChamp2) == 0) || ( i_strcmp("sip:+", pt_debChamp2) == 0)
#ALORS
#	Trap = 1
#	# on enleve le sip:+ ou tel:+ eventuel en debut de IDUS_NUM
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM avec en-tete sip: ou tel: = %s",pt_BUF1,"")
#	i_get_sub_str(pt_BUF1, 5, -1, pt_BUF2)
#SINON
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM sans en-tete sip: ou tel: = %s",pt_BUF1,"")
#	i_strcpy(pt_BUF2,pt_BUF1)
#FINSI
##trace2("__FILE__:__LINE__ ## IDUS_NUM  en-tete sip: ou tel: eventuel enleve = %s",pt_BUF2,"")
#
##################### Suppression de "+" si present au debut du champ RedirectingNB
#
#SI (i_valid_field_n(g_iartin, $Tv2oip::RedirectingNb) && Trap == 0 )
#ALORS
#	erreur = i_get_art_str(g_iartout,$Tv2oip::RedirectingNb,pt_BUF1)
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM=RedirectingNb = %s",pt_BUF1,"")
#	i_get_sub_str(pt_BUF1, 0, 0, pt_debChamp2)
#	taille = i_strlen(pt_BUF1)
#
#	SI ( i_strcmp("+", pt_debChamp2) == 0)
#	ALORS
#		# on enleve le + eventuel en debut de IDUS_NUM
#		#trace2("__FILE__:__LINE__ ## IDUS_NUM avec en-tete + : = %s",pt_BUF1,"")
#		i_get_sub_str(pt_BUF1, 1, -1, pt_BUF2)
#	SINON
#		#trace2("__FILE__:__LINE__ ## IDUS_NUM sans en-tete sip: ou tel: = %s",pt_BUF1,"")
#		i_strcpy(pt_BUF2,pt_BUF1)
#	FINSI
#FINSI
#
##################### pt CallingNb_DCB, suppression partie apres @ ############
#
#taille = i_strlen(pt_BUF2)
#indice = -1
#POINT DEB_BOUCLE0
#indice = indice + 1
#
#SI (indice < taille)
#ALORS
#	i_get_sub_str(pt_BUF2, indice, indice, pt_BUF3)
#	SI i_strcmp(pt_BUF3,"@") == 0
#	ALORS
#		SI indice > 1
#		ALORS
#			i_get_sub_str(pt_BUF2, 0, indice-1, pt_BUF1)
#			i_strcpy(pt_BUF2,pt_BUF1)
#		SINON
#			SI b_FACTURABLE
#			ALORS
#				#trace("__FILE__:__LINE__ ## erreur IDUS_NUM vide")
#				code_errone = 0xA070
#				code_errone = code_errone + b_EFFICACE
#				erreur = i_PlvMessEmettre(8611,2,g_iartin,"",3,code_errone,C_Article,pt_BUF2)
#				SAUT DISTRI_ERR
#			FINSI
#		FINSI
#		SAUT FIN_BOUCLE0
#	FINSI
#	SAUT DEB_BOUCLE0
#FINSI
#
#POINT FIN_BOUCLE0

#trace2("__FILE__:__LINE__ ## IDUS_NUM sans @xxx = %s",pt_BUF2,"")
# pt CallingNb_DCB = pt_BUF2
# nouvelle taille de pt_BUF2 : IDUS_NUM
#taille = i_strlen(pt_BUF2)

#################### calcul idus_inf et suppression de 33 eventuel RES=pt_IDUS_NUM

#SI i_strplcmp(pt_BUF2,"33",0,2) == 0
#ALORS
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM avec 33  = %s",pt_BUF2,"")
#	idus_inf = 0x80
#	i_get_sub_str(pt_BUF2, 2, -1, pt_BUF1)
#	i_strcpy(pt_BUF2,pt_BUF1)
#	taille = i_strlen(pt_BUF2)
#	#trace2("__FILE__:__LINE__ ## IDUS_NUM avec 33 et suppresion de 33 = %s",pt_BUF2,"")
#SINON
#	# G4R5 Lot2
#	#SI ( ( i_strplcmp(pt_BUF2,"262",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"269",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"590",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"594",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"596",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"508",0,3) == 0 ) )
#	SI ( ( i_strplcmp(pt_BUF2,"262",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"590",0,3) == 0 ) 
#	  || ( i_strplcmp(pt_BUF2,"594",0,3) == 0 ) || ( i_strplcmp(pt_BUF2,"596",0,3) == 0 ) )
#	ALORS
#		idus_inf = 0x80
#		i_get_sub_str(pt_BUF2, 3, -1, pt_BUF1)
#		i_strcpy(pt_BUF2,pt_BUF1)
#		taille = i_strlen(pt_BUF2)
#	SINON
#		idus_inf = 0xC0
#		b_FACTURABLE=0
#	FINSI
#FINSI
##trace1("__FILE__:__LINE__ ## IDUS_INF = %x",idus_inf)
#i_strcpy(pt_IDUS_NUM,pt_BUF2)

#################### Conversion ascii vers DCB de IDUS_NUM ###################

taille_860026567 = i_conv_ascii_dcb(pt_BUF2_860026567, pt_BUF3_860026567)
erreur_860026567 = i_memcpy_art_field_n(g_iartout,$Tv2oip::IDUS_NUM,pt_BUF3_860026567, taille_860026567)
erreur_860026567 = i_resize_tlv( g_iartout, "T4idus", "IDUS_NUM", taille_860026567 *8 )

#################### ICAR_ABS (date metropole) ###############################

ICAR_ABS_860026567 = i_get_art_field(g_iartin, $Tv2oip::ddebut)
# creation enveloppe E_NOVAH pour eviter pb en cas de redistribution
erreur_860026567 = i_add_opt( "E_V2OIP" )
erreur_860026567 = i_set_attr_val_n($E_V2OIP::DATE_M, ICAR_ABS_860026567 + duree_860026567)
res_860026567 = i_get_attr_val_n($E_V2OIP::DATE_M)
#trace1("****************** DATE_M enveloppe E_V20IP = %x",res)

#################### HLAHM1(date locale) NUMTABSEL=0, NUMTAB=1 ###############

SI (idus_inf_860026567==0x80)
ALORS
	numzone_860026567 = i_DHgetZoneID(NUMTABSEL_860026567, g_iartout)
	HLAHM1_C_860026567 = i_DHgetLocalTime(NUMTAB_860026567,numzone_860026567,date_GMT_860026567)
SINON
	HLAHM1_C_860026567 = -1
FINSI
# G4R5 QC882
HLAHM1_860026567 = HLAHM1_C_860026567

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

i_strcpy(pt_sgtqs_860026567, i_LireEECSGTQS(g_ieec))

##############################################################################
# DEDE_NUM_PORTA
##############################################################################

d_util_porta_860026567 = 1
erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::TranslatedNb,pt_DEDE_NUM_PORTA_860026567)

SI (i_adequation_chaine_expreg (pt_DEDE_NUM_PORTA_860026567, "^sip:") == 0) || (i_adequation_chaine_expreg (pt_DEDE_NUM_PORTA_860026567, "^tel:") == 0)
ALORS
	i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 4, -1, pt_DEDE_NUM_PORTA_860026567)
	SI (i_adequation_chaine_expreg (pt_DEDE_NUM_PORTA_860026567, "^847") == 0)
	ALORS
		i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 3, -1, pt_DEDE_NUM_PORTA_860026567)
	FINSI
FINSI

#################### pt TranslatedNb_DCB, suppression partie apres @ #############

taille_860026567 = i_strlen(pt_DEDE_NUM_PORTA_860026567)

# G4R5 Lot2
i_strcpy (pt_BUF3_860026567,pt_DEDE_NUM_PORTA_860026567)
erreur_860026567 = i_recupererValeur(pt_BUF3_860026567,pt_DEDE_NUM_PORTA_860026567,taille_860026567,'@')

#G4R5 QC772
## G3R22C5 QC547
## suppression de la chaine C_phone (voir constante)
#i_strcpy(pt_DEDE_NUM_PORTA,REMPLACE_CHAINE(pt_DEDE_NUM_PORTA, C_phone, ""))

# Si ; present, suppression des caracteres a partir de ; 
i_strcpy (pt_TEMP_860026567,pt_DEDE_NUM_PORTA_860026567)
erreur_860026567 = i_recupererValeur(pt_TEMP_860026567, pt_DEDE_NUM_PORTA_860026567, i_strlen(pt_TEMP_860026567),';')
#\G4R5 QC772

# pt TranslatedNb_DCB = pt_DEDE_NUM_PORTA

#################### remplacement de %23 par # ################

erreur_860026567 = i_adequation_chaine_expreg (pt_DEDE_NUM_PORTA_860026567, "%23")

SI erreur_860026567 == 0
ALORS
	i_strcpy(pt_BUF3_860026567,REMPLACE_CHAINE_860026233(pt_DEDE_NUM_PORTA_860026567,"%23","#"))
	i_strcpy(pt_DEDE_NUM_PORTA_860026567,pt_BUF3_860026567)
FINSI

# G4R5 Lot2
# suppression du "#" de fin
i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, -1, -1, pt_TEMP_860026567)
SI i_strcmp(pt_TEMP_860026567, "#") == 0
ALORS
	i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 0, -2, pt_DEDE_NUM_PORTA_860026567)
FINSI

#################### Suppression de digit[1]="+" ou digit[1,2] "00" eventuel

i_strcpy(pt_BUF5_860026567,pt_DEDE_NUM_PORTA_860026567)

taille_860026567 = i_strlen(pt_DEDE_NUM_PORTA_860026567)
i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 0, 0, pt_debChamp1_860026567)
i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 0, 1, pt_debChamp2_860026567)

SI ( i_strcmp("+", pt_debChamp1_860026567) == 0)
ALORS
	SI taille_860026567 > 1
	ALORS
		i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 1, taille_860026567-1, pt_BUF1_860026567)
		i_strcpy(pt_DEDE_NUM_PORTA_860026567,pt_BUF1_860026567)
	SINON
		d_util_porta_860026567 = 0
	FINSI
SINON
	SI ( i_strcmp("00", pt_debChamp2_860026567) == 0)
	ALORS
		SI taille_860026567 > 2
		ALORS
			i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 2, taille_860026567-1, pt_BUF1_860026567)
			i_strcpy(pt_DEDE_NUM_PORTA_860026567,pt_BUF1_860026567)
		SINON
			d_util_porta_860026567 = 0
		FINSI
	FINSI
FINSI

#################### suppression de 33 eventuel ###########

taille_860026567 = i_strlen(pt_DEDE_NUM_PORTA_860026567)
i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 0, 1, pt_debChamp1_860026567)
i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 0, 2, pt_debChamp2_860026567)

SI ( i_strcmp("33", pt_debChamp1_860026567) == 0)
ALORS
	SI taille_860026567 > 2
	ALORS
		i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 2, taille_860026567-1, pt_BUF1_860026567)
		i_strcpy(pt_DEDE_NUM_PORTA_860026567,pt_BUF1_860026567)
	SINON
		d_util_porta_860026567 = 0
	FINSI
SINON
	SI ( i_strcmp("262", pt_debChamp2_860026567) == 0 || i_strcmp("594", pt_debChamp2_860026567) == 0 ||  i_strcmp("596", pt_debChamp2_860026567) == 0 ||  i_strcmp("590", pt_debChamp2_860026567) == 0)
	ALORS
		SI taille_860026567 > 3
		ALORS
			i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 3, taille_860026567-1, pt_BUF1_860026567)
			i_strcpy(pt_DEDE_NUM_PORTA_860026567,pt_BUF1_860026567)
		SINON
			d_util_porta_860026567 = 0
		FINSI
	SINON
		#################### commencant par 0 et 2eme digit !=0 => numero national
		i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 0, 0, pt_debChamp1_860026567)
		i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 1, 1, pt_debChamp2_860026567)

		SI ( i_strcmp("0", pt_debChamp1_860026567) == 0 && i_strcmp("0", pt_debChamp2_860026567) != 0 )
		ALORS
			SI taille_860026567 > 1
			ALORS
				i_get_sub_str(pt_DEDE_NUM_PORTA_860026567, 1, -1, pt_BUF1_860026567)
				i_strcpy(pt_DEDE_NUM_PORTA_860026567,pt_BUF1_860026567)
			SINON
				d_util_porta_860026567 = 0
			FINSI
		SINON
			d_util_porta_860026567 = 0
		FINSI
	FINSI
FINSI

#################### DEDE_INTERNAT_PORTA ##################

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

SI (b_DEDE_INTERNAT_PORTA_860026567 == 1)
ALORS
	# G4R5 Lot2
	#SI ( ( i_strplcmp(pt_chiffres,"33",0,2) == 0 ) || ( i_strplcmp(pt_chiffres,"262",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"594",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"596",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"590",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"508",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"2696",0,4) == 0 ) || ( i_strplcmp(pt_chiffres,"2692",0,4) == 0 ) )
	SI ( ( i_strplcmp(pt_chiffres_860026567,"33",0,2) == 0 ) || ( i_strplcmp(pt_chiffres_860026567,"262",0,3) == 0 ) 
	  || ( i_strplcmp(pt_chiffres_860026567,"594",0,3) == 0 ) || ( i_strplcmp(pt_chiffres_860026567,"596",0,3) == 0 ) 
	  || ( i_strplcmp(pt_chiffres_860026567,"590",0,3) == 0 ) || ( i_strplcmp(pt_chiffres_860026567,"508",0,3) == 0 ) )
	ALORS
		b_DEDE_INTERNAT_PORTA_860026567 = 0
	FINSI
FINSI

##############################################################################
# DEDE_INF_PORTA (0x80 national, 0x40 special, 0xC0 international)
##############################################################################

SI (b_DEDE_INTERNAT_PORTA_860026567 != 0)
ALORS
	dede_inf_porta_860026567 = 0xC0
SINON
	SI (i_strlen(pt_DEDE_NUM_PORTA_860026567) < 7)
	ALORS
		dede_inf_porta_860026567 = 0x40
	SINON
		dede_inf_porta_860026567 = 0x80
	FINSI
FINSI
#trace1("__FILE__:__LINE__ ##  DEDE_INF = %x",dede_inf)

#################### TRANS_NUM : conversion ascii vers DCB ####################

SI d_util_porta_860026567
ALORS
	taille_860026567 = i_conv_ascii_dcb(pt_DEDE_NUM_PORTA_860026567, pt_BUF3_860026567)
	erreur_860026567 = i_memcpy_art_field_n(g_iartout,$Tv2oip::TRANS_NUM,pt_BUF3_860026567, taille_860026567)
	erreur_860026567 = i_resize_tlv( g_iartout, "T4trans", "TRANS_NUM", taille_860026567 *8 )

	#G3R21 appel BNC remplace par recherche prefixe portabilite dans table PPORTA

	ValZ_860026567 = g_iartout.IDUS_NUM[0]
	#trace(" ################## Condition de recherche prefixe portabilite dans table PPORTA :")
	#trace1("         ######### b_EFFICACE        : %d",b_EFFICACE)
	#trace2("         ######### pt_DEDE_NUM_PORTA : %s ",pt_DEDE_NUM_PORTA, "")


	#G3R23 table PPORTA avec categorie

	SI ( b_EFFICACE_860026567 && (i_strcmp(pt_DEDE_NUM_PORTA_860026567," ") != 0) )
	ALORS
		erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::TRANS_NUM,pt_BUF1_860026567)
		#trace(" ################## Recherche prefixe portabilite dans table PPORTA ###################")
		i_strcpy(pt_pporta_860026567, rechercheDicho_860026233(pt_BUF1_860026567,T_PPORTA_860026567 ,date_GMT_860026567))
		#trace2(" ################# Recherche prefixe portabilite dans table PPORTA : Cle passee = >%s<   resultat = >%s< ######",pt_BUF1,pt_len_prefixe_portabilite)

		SI(i_strcmp(pt_pporta_860026567,g_inull) != 0)
		ALORS
			b_T3G_portabilite_860026567 = 1
			longueur_860026567 = i_strlen(pt_pporta_860026567)
			erreur_860026567 = i_recupererValeur(pt_pporta_860026567, pt_len_prefixe_portabilite_860026567, longueur_860026567,'_')
			# resultat de i_recupererValeur: . longueur du prefixe -> partie avant "_" dans pt_len_prefixe_portabilite
			#                                . categorie           -> partie apres "_" dans pt_pporta
			len_prefixe_portabilite_860026567 = CONV_ASCIINUMDEC_INT_860026233(pt_len_prefixe_portabilite_860026567)
			i_get_sub_str(pt_BUF1_860026567, 0, len_prefixe_portabilite_860026567-1, pt_T3G_prefixe_portabilite_860026567)
			#trace("b_T3G_portabilite = 1")
			#trace1(" ################# Recherche prefixe portabilite dans table PPORTA : longueur du prefixe de portabilite                  = >%d<  ######", len_prefixe_portabilite)
			#trace2(" ################# Recherche prefixe portabilite dans table PPORTA : prefixe de portabilite (pt_T3G_prefixe_portabilite) = >%s<  ######", pt_T3G_prefixe_portabilite, "")
		FINSI
	FINSI
FINSI

##############################################################################
# DEDE_NUM
##############################################################################

#################### pt CalledNb_DCB suppression de sip:847 ou de sip: #######

i_strcpy(pt_BUF1_860026567," ")
i_strcpy(pt_BUF2_860026567," ")
erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::CalledNb,pt_BUF1_860026567)
#trace2(">>>__LINE__>>> ******** CalledNb = %s",pt_BUF1,"")
i_get_sub_str(pt_BUF1_860026567, 0, 3, pt_debChamp1_860026567)
i_get_sub_str(pt_BUF1_860026567, 0, 6, pt_debChamp2_860026567)
taille_860026567 = i_strlen(pt_BUF1_860026567)

SI  ( ( i_strcmp("sip:847", pt_debChamp2_860026567) == 0 ) || ( i_strcmp("tel:847", pt_debChamp2_860026567) == 0 ) )
ALORS
	b_Visio_mobile_860026567 = 1

	SI taille_860026567 > 7
	ALORS
		i_get_sub_str(pt_BUF1_860026567, 7, -1, pt_BUF2_860026567)
		#trace2(">>>__LINE__>>> CalledNb avec sip:847 enleve et taille > 7= %s",pt_BUF2,"")
	SINON
		i_strcpy (pt_DEDE_NUM1_860026567,"")
		#trace(">>>__LINE__>>>1 DEDE_NUM1 vide")
		i_strcpy(pt_DEDE_NUM_860026567," ")
		dede_inf_860026567 = 0x40
		SAUT FIN_DEDE
	FINSI
SINON
	b_Visio_mobile_860026567 = 0
	SI ( ( i_strcmp("sip:", pt_debChamp1_860026567) == 0 ) || ( i_strcmp("tel:", pt_debChamp1_860026567) == 0 ) )
	ALORS
		SI taille_860026567 > 4
		ALORS
			i_get_sub_str(pt_BUF1_860026567, 4, -1, pt_BUF2_860026567)
			#trace2(">>>__LINE__>>>2 CalledNb avec sip: enleve et taille > 4= %s",pt_BUF2,"")
		SINON
			i_strcpy (pt_DEDE_NUM1_860026567,"")
			#trace(">>>__LINE__>>>2 DEDE_NUM1 vide")
			i_strcpy(pt_DEDE_NUM_860026567," ")
			dede_inf_860026567 = 0x40
			SAUT FIN_DEDE
		FINSI
	SINON
		#trace(">>>__LINE__>>> CalledNb sans en-tete sip: ou sip:847")
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
	FINSI
FINSI
#trace2(">>>__LINE__>>> suppression de sip: ou sip:847 eventuel de CalledNb = %s",pt_BUF2,"")

#################### pt CalledNb_DCB, suppression partie apres @ #############

taille_860026567 = i_strlen(pt_BUF2_860026567)

# G4R5 Lot2
i_strcpy (pt_BUF3_860026567, pt_BUF2_860026567)
erreur_860026567 = i_recupererValeur(pt_BUF3_860026567, pt_BUF2_860026567 ,taille_860026567, '@' )
SI i_strlen(pt_BUF2_860026567) == 0
ALORS
	i_strcpy (pt_DEDE_NUM1_860026567,"")
	i_strcpy(pt_DEDE_NUM_860026567," ")
	dede_inf_860026567 = 0x40
	SAUT FIN_DEDE
FINSI


#G4R5 QC772
# suppression de la chaine C_phone (voir constante)
#i_strcpy(pt_BUF2,REMPLACE_CHAINE(pt_BUF2, C_phone, ""))

# Si ; present, suppression des caracteres a partir de ; 
i_strcpy (pt_TEMP_860026567,pt_BUF2_860026567)
erreur_860026567 = i_recupererValeur(pt_TEMP_860026567, pt_BUF2_860026567, i_strlen(pt_TEMP_860026567),';')
#\G4R5 QC772

#trace2(">>>__LINE__>>> suppression de @xxx  CalledNb = %s",pt_BUF2,"")

#################### remplacement de %23 par # ################

#trace2(">>>__LINE__>>> ******* CalledNb = %s *********** ",pt_BUF2,"")
erreur_860026567 = i_adequation_chaine_expreg (pt_BUF2_860026567, "%23")
#trace1(">>>__LINE__>>> ******** erreur = %x ******** ",erreur)

SI erreur_860026567 == 0
ALORS
	i_strcpy(pt_BUF3_860026567,REMPLACE_CHAINE_860026233(pt_BUF2_860026567,"%23","#"))
	i_strcpy(pt_BUF2_860026567,pt_BUF3_860026567)
FINSI
#trace2("[Retour Fonction] ******* Resultat = %s *********** ",pt_BUF3,"")

#DRE - G4R3 lot2
#################### debut extraction DTMF eventuel pour DEDE_NUM1 ###########

taille_860026567 = i_strlen(pt_BUF2_860026567)
indice_860026567 = 0
i_strcpy(pt_DTMF_860026567,"")
i_get_sub_str(pt_BUF2_860026567, 0, 0, pt_debChamp1_860026567)
i_get_sub_str(pt_BUF2_860026567, 0, 1, pt_debChamp2_860026567)
i_get_sub_str(pt_BUF2_860026567, 0, 3, pt_debChamp3_860026567)

######################################################################################
SI ( i_strcmp("*", pt_debChamp1_860026567) == 0) || ( i_strcmp("#", pt_debChamp1_860026567) == 0)
ALORS
	b_DTMF_860026567 = 1
	i_get_sub_str(pt_BUF2_860026567, 1, -1, pt_BUF3_860026567)
	indice_860026567 = RECHERCHE_CHAINE_860026233(pt_BUF3_860026567, "*")
	SI indice_860026567 < 0 
	ALORS
		indice_860026567 = RECHERCHE_CHAINE_860026233(pt_BUF3_860026567, "#")
		SI indice_860026567 < 0 
		ALORS
			# 29/08/2013 QC742 #
			SI b_FACTURABLE_860026567
			ALORS
				#trace (">>>__LINE__>>> -------- DTMF incorrect ---------------")
				code_errone_860026567 = 0xA070
				code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
				erreur_860026567 = i_PlvMessEmettre(6383,2,g_iartin,"",2,C_Article_860026567,pt_BUF2_860026567,0)
				SAUT DISTRI_ERR
			FINSI
		FINSI
	FINSI
	i_get_sub_str(pt_BUF2_860026567, 0, indice_860026567 + 1, pt_DTMF_860026567)
	SI (i_strcmp( pt_DTMF_860026567,"*92#") == 0 )
	ALORS
		b_DTMF_transmis_860026567 = 0
	FINSI
SINON
	
	erreur_860026567 = i_format_str2( pt_BUF3_860026567, "%s%s", "INp", pt_debChamp3_860026567)
	i_strcpy(pt_TEMP_860026567, i_get_tab_field("Inter", date_GMT_860026567, pt_BUF3_860026567))
	
	
	SI (i_strcmp( pt_TEMP_860026567,g_inull) != 0 )
	ALORS
		b_DTMF_860026567 = 1
		i_strcpy(pt_DTMF_860026567,pt_debChamp3_860026567)
		longueur_860026567 = 4
		SI (i_strcmp( pt_TEMP_860026567,"2") == 0 )
		ALORS
			b_DTMF_transmis_860026567 = 0
		FINSI
	FINSI
FINSI

longueur_860026567 = i_strlen(pt_DTMF_860026567)
SI longueur_860026567 > 0
ALORS
	SI longueur_860026567 < taille_860026567
	ALORS
		i_get_sub_str(pt_BUF2_860026567, longueur_860026567, -1, pt_BUF1_860026567)
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
	SINON
		i_strcpy (pt_DEDE_NUM1_860026567,"")
		#trace(">>>__LINE__>>>4 DEDE_NUM1 vide")
		i_strcpy (pt_BUF2_860026567," ")
		i_strcpy(pt_DEDE_NUM_860026567," ")
		dede_inf_860026567 = 0x40
#		SI ( (i_strcmp("3131", pt_debChamp3) != 0) && (i_strcmp("*92#", pt_debChamp3) != 0) )
		SI b_DTMF_transmis_860026567 == 1
		ALORS
			SAUT FIN_DEDE
		FINSI
	FINSI
FINSI

# G4R5 Lot2

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

#trace2(">>>__LINE__>>> DTMF  = %s",pt_DTMF,"")
#trace2(">>>__LINE__>>> pt_BUF2  = %s",pt_BUF2,"")

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

# pour champ DEDE_NUM1 test ASServiceName 4 champs apres T3ASService1
erreur_860026567 = i_get_art_str(g_iartout, $Tv2oip::AnswerIndicator , pt_BUF3_860026567 )

SI ((i_get_art_field(g_iartout, $Tv2oip::T3ASService1 + 4) == 20) && (i_strcmp(pt_BUF3_860026567,"Yes") == 0))
ALORS
	erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::TRANS_NUM,pt_BUF1_860026567)
	i_strcpy(pt_BUF2_860026567,pt_BUF5_860026567)

	SI b_T3G_portabilite_860026567
	ALORS
		taille_860026567 = i_strlen (pt_T3G_prefixe_portabilite_860026567)
		i_get_sub_str(pt_BUF1_860026567,taille_860026567,-1,pt_BUF2_860026567)
	FINSI
FINSI

i_strcpy(pt_DEDE_NUM1_860026567,pt_BUF2_860026567)

#################### DEDE_NUM1, Suppression de digit[1]="+" ou digit[1,2] "00" eventuel

taille_860026567 = i_strlen(pt_BUF2_860026567)
i_get_sub_str(pt_BUF2_860026567, 0, 0, pt_debChamp1_860026567)
i_get_sub_str(pt_BUF2_860026567, 0, 1, pt_debChamp2_860026567)

SI ( i_strcmp("+", pt_debChamp1_860026567) == 0)
ALORS
	SI taille_860026567 > 1
	ALORS
		i_get_sub_str(pt_BUF2_860026567, 1, taille_860026567-1, pt_BUF1_860026567)
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
	SINON
		#trace(">>>__LINE__>>>5 DEDE_NUM1 vide")
		i_strcpy(pt_DEDE_NUM_860026567," ")
		dede_inf_860026567 = 0x40
		SAUT FIN_DEDE
	FINSI
SINON
	SI ( i_strcmp("00", pt_debChamp2_860026567) == 0)
	ALORS
		SI taille_860026567 > 2
		ALORS
			i_get_sub_str(pt_BUF2_860026567, 2, taille_860026567-1, pt_BUF1_860026567)
			i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
		SINON
			#trace(">>>__LINE__>>>6 DEDE_NUM1 vide")
			i_strcpy(pt_DEDE_NUM_860026567," ")
			dede_inf_860026567 = 0x40
			SAUT FIN_DEDE
		FINSI
	FINSI
FINSI
#trace2(">>>__LINE__>>> DEDE_NUM1 = %s",pt_BUF2,"")

#################### DEDE_NUM : pt_BUF2 suppression de 33 eventuel ###########

taille_860026567 = i_strlen(pt_BUF2_860026567)
i_get_sub_str(pt_BUF2_860026567, 0, 1, pt_debChamp1_860026567)
i_get_sub_str(pt_BUF2_860026567, 0, 2, pt_debChamp2_860026567)

SI ( i_strcmp("33", pt_debChamp1_860026567) == 0)
ALORS
	SI taille_860026567 > 2
	ALORS
		i_get_sub_str(pt_BUF2_860026567, 2, taille_860026567-1, pt_BUF1_860026567)
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
		SAUT FIN_A
	SINON
		#trace(">>>__LINE__>>>7 DEDE_NUM vide")
		i_strcpy(pt_DEDE_NUM_860026567," ")
		dede_inf_860026567 = 0x40
		SAUT FIN_DEDE
	FINSI
FINSI

SI ( i_strcmp("262", pt_debChamp2_860026567) == 0 || i_strcmp("594", pt_debChamp2_860026567) == 0 
  || i_strcmp("596", pt_debChamp2_860026567) == 0 || i_strcmp("590", pt_debChamp2_860026567) == 0 )
ALORS
	SI taille_860026567 > 3
	ALORS
		i_get_sub_str(pt_BUF2_860026567, 3, taille_860026567-1, pt_BUF1_860026567)
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
		SAUT FIN_A
	SINON
		#trace(">>>__LINE__>>>8 DEDE_NUM vide")
		i_strcpy(pt_DEDE_NUM_860026567," ")
		dede_inf_860026567 = 0x40
		SAUT FIN_DEDE
	FINSI
FINSI
#trace2(">>>__LINE__>>> suppression 33 ou 262 594 596 590 DEDE_NUM = %s",pt_BUF2,"")

#################### DEDE_NUM commencant par 0 et 2eme digit !=0 => numero national

i_get_sub_str(pt_BUF2_860026567, 0, 0, pt_debChamp1_860026567)
i_get_sub_str(pt_BUF2_860026567, 1, 1, pt_debChamp2_860026567)

SI ( i_strcmp("0", pt_debChamp1_860026567) == 0 && i_strcmp("0", pt_debChamp2_860026567) != 0 )
ALORS
	SI taille_860026567 > 1
	ALORS
		i_get_sub_str(pt_BUF2_860026567, 1, -1, pt_BUF1_860026567)
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
	SINON
		#trace(">>>__LINE__>>>9 DEDE_NUM vide")
		i_strcpy(pt_DEDE_NUM_860026567," ")
		dede_inf_860026567 = 0x40
		SAUT FIN_DEDE
	FINSI
FINSI

POINT FIN_A

# pour champ DEDE_NUM1 test ASServiceName 4 champs apres T3ASService1
erreur_860026567 = i_get_art_str(g_iartout, $Tv2oip::AnswerIndicator , pt_BUF3_860026567 )
SI ((i_get_art_field(g_iartout, $Tv2oip::T3ASService1 + 4) == 20) && (i_strcmp(pt_BUF3_860026567,"Yes") == 0))
ALORS
	erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::TRANS_NUM,pt_BUF1_860026567)
	i_strcpy(pt_DEDE_NUM1_860026567,pt_BUF5_860026567)

	SI b_T3G_portabilite_860026567
	ALORS
		taille_860026567 = i_strlen (pt_T3G_prefixe_portabilite_860026567)
		i_get_sub_str(pt_BUF1_860026567,taille_860026567,-1,pt_BUF2_860026567)
	FINSI
FINSI

i_strcpy(pt_DEDE_NUM_860026567,pt_BUF2_860026567)

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

b_DEDE_INTERNAT_860026567 = 0

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

SI (b_DEDE_INTERNAT_860026567 == 1)
ALORS
	# G4R5 Lot2
	#SI ( ( i_strplcmp(pt_chiffres,"33",0,2) == 0 ) || ( i_strplcmp(pt_chiffres,"262",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"594",0,3) == 0 )  || ( i_strplcmp(pt_chiffres,"596",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"590",0,3) == 0 )  || ( i_strplcmp(pt_chiffres,"508",0,3) == 0 ) || ( i_strplcmp(pt_chiffres,"2696",0,4) == 0 ) || ( i_strplcmp(pt_chiffres,"2692",0,4) == 0 ) )
	SI ( ( i_strplcmp(pt_chiffres_860026567,"33",0,2) == 0 )  || ( i_strplcmp(pt_chiffres_860026567,"262",0,3) == 0 ) 
	  || ( i_strplcmp(pt_chiffres_860026567,"594",0,3) == 0 ) || ( i_strplcmp(pt_chiffres_860026567,"596",0,3) == 0 ) 
	  || ( i_strplcmp(pt_chiffres_860026567,"590",0,3) == 0 ) 
	  || ( i_strplcmp(pt_chiffres_860026567,"508",0,3) == 0 ) )
	ALORS
		b_DEDE_INTERNAT_860026567 = 0
	FINSI
FINSI

#################### DEDE_NUM : conversion ascii vers DCB ####################

taille_860026567 = i_strlen(pt_BUF2_860026567)

taille_860026567 = i_conv_ascii_dcb(pt_BUF2_860026567, pt_BUF3_860026567)
erreur_860026567 = i_memcpy_art_field_n(g_iartout,$Tv2oip::DEDE_NUM,pt_BUF3_860026567, taille_860026567)
erreur_860026567 = i_resize_tlv( g_iartout, "T4dede", "DEDE_NUM", taille_860026567 *8 )

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

POINT FIN_DEDE

SI (b_DEDE_INTERNAT_860026567 != 0)
ALORS
	dede_inf_860026567 = 0xC0
SINON
	SI (i_strlen(pt_DEDE_NUM_860026567) < 7)
	ALORS
		dede_inf_860026567 = 0x40
	SINON
		dede_inf_860026567 = 0x80
	FINSI
FINSI
#trace1(">>>__LINE__>>> DEDE_INF = %x",dede_inf)

#################### ICAR_ABS (date metropole) ###############################
# voir au dessus

#################### HLAHM1(date locale) NUMTABSEL=0, NUMTAB=1 ###############
# voir au dessus

#################### SGTQS ###################################################
# voir au dessus

#################### Normalisation du demandeur ##############################

i_strcpy(pt_IDUS_BNC_860026567," ")
erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::IDUS_NUM,pt_BUF1_860026567)
#trace2(">>>__LINE__>>> avant normalisation Tv2oip::IDUS_NUM =%s",pt_BUF1,"")

ValZ_860026567 = g_iartout.IDUS_NUM[0]
#trace1("__FILE__:__LINE__ #### Valeur de : ValZ : <%d>", ValZ)

SI ( ( ValZ_860026567 == 0 || ValZ_860026567 == 6 || ValZ_860026567 ==7 ) && b_FACTURABLE_860026567 )
ALORS
	#trace(">>>__LINE__>>>IDUS normalisation incorrecte")
	code_errone_860026567 = 0xA010
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8609,2,g_iartin,"",3,code_errone_860026567,C_Article_860026567,pt_BUF1_860026567)
	SAUT DISTRI_ERR
FINSI

SI idus_inf_860026567 == 0x80
ALORS
	SI ValZ_860026567 == 6 || ValZ_860026567 == 7 || ValZ_860026567 == 8 || ValZ_860026567 == 9
	ALORS
		erreur_860026567 = i_format_str2(pt_IDUS_BNC_860026567,"%s%s","0*",pt_BUF1_860026567)
	SINON
# DRE G4R5 QC789
		SI i_strplcmp(pt_BUF1_860026567,"262",0,3) == 0 || i_strplcmp(pt_BUF1_860026567,"269",0,3) == 0 
		|| i_strplcmp(pt_BUF1_860026567,"590",0,3) == 0 || i_strplcmp(pt_BUF1_860026567,"594",0,3) == 0 || i_strplcmp(pt_BUF1_860026567,"596",0,3) == 0
		ALORS
			erreur_860026567 = i_format_str2(pt_IDUS_BNC_860026567,"%s%s","0*",pt_BUF1_860026567)
		SINON
# \DRE G4R5 QC789
			SI ValZ_860026567 == 1 || ValZ_860026567 == 2 || ValZ_860026567 == 3 || ValZ_860026567 == 4 || ValZ_860026567 == 5
			ALORS
				erreur_860026567 = i_format_str2(pt_IDUS_BNC_860026567,"%s%s","0",pt_BUF1_860026567)
			FINSI
		FINSI
	FINSI
FINSI

SI idus_inf_860026567 == 0xC0
ALORS
	#trace(">>>__LINE__>>>IDUS international normalisation pas de changement")
	i_strcpy(pt_IDUS_BNC_860026567,pt_BUF1_860026567)
FINSI

taille_860026567 = i_strlen(pt_IDUS_BNC_860026567)

SI taille_860026567 > 10
ALORS
	i_get_sub_str(pt_IDUS_BNC_860026567,0,9,pt_BUF2_860026567)
	erreur_860026567 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, pt_BUF2_860026567,11)
	#trace2(">>>__LINE__>>> Tcopo::NDR =%s",pt_BUF2,"")
SINON
	erreur_860026567 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDR, pt_IDUS_BNC_860026567,taille_860026567+1)
	#trace2(">>>__LINE__>>> Tcopo::NDR =%s",pt_IDUS_BNC,"")
FINSI

#################### Normalisation du demande ################################

i_strcpy(pt_DEDE_BNC_860026567," ")

SI i_strcmp(pt_DEDE_NUM_860026567," ") != 0
ALORS
	erreur_860026567 = i_get_art_str(g_iartout,$Tv2oip::DEDE_NUM,pt_BUF1_860026567)
	#trace2(">>>__LINE__>>> avant normalisation Tv2oip::DEDE_NUM =%s",pt_BUF1,"")

	i_get_sub_str(pt_BUF1_860026567, 0, 0, pt_debChamp1_860026567)
	i_get_sub_str(pt_BUF1_860026567, 0, 2, pt_debChamp2_860026567)
	i_get_sub_str(pt_BUF1_860026567, 0, 3, pt_debChamp3_860026567)

	SI dede_inf_860026567 == 0x80
	ALORS
		SI (i_strcmp(pt_debChamp1_860026567,"1") >= 0 && i_strcmp(pt_debChamp1_860026567,"9") <= 0)
		ALORS
			#trace(">>>__LINE__>>>DEDE national  normalisation ajout 0")
			erreur_860026567 = i_format_str2(pt_DEDE_BNC_860026567,"%s%s","0",pt_BUF1_860026567)
		SINON
			SI b_FACTURABLE_860026567
			ALORS
				#trace(">>>__LINE__>>>DEDE normalisation incorrecte")
				code_errone_860026567 = 0xA010
				code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
				erreur_860026567 = i_PlvMessEmettre(8610,2,g_iartin,"",3,code_errone_860026567,C_Article_860026567,pt_BUF1_860026567)
				SAUT DISTRI_ERR
			FINSI
		FINSI
	FINSI

	SI dede_inf_860026567 == 0x40
	ALORS
		i_strcpy(pt_DEDE_BNC_860026567,pt_BUF1_860026567)
		#trace2(">>>__LINE__>>>DEDE service special normalisation pasdechangt pt_DEDE_BNC=%s",pt_DEDE_BNC,"")
	FINSI

	SI dede_inf_860026567 == 0xC0
	ALORS
		# G4R5 Lot2
		#SI i_strcmp(pt_debChamp3,"2692") == 0 || i_strcmp(pt_debChamp3,"2696") == 0 || i_strcmp(pt_debChamp2,"508" ) == 0 || i_strplcmp(pt_BUF1,"262",0,3) == 0 || i_strplcmp(pt_BUF1,"590",0,3) == 0 || i_strplcmp(pt_BUF1,"594",0,3) == 0 || i_strplcmp(pt_BUF1,"596",0,3) == 0
		SI i_strplcmp(pt_BUF1_860026567,"262",0,3) == 0 || i_strplcmp(pt_BUF1_860026567,"590",0,3) == 0 
		|| i_strplcmp(pt_BUF1_860026567,"594",0,3) == 0 || i_strplcmp(pt_BUF1_860026567,"596",0,3) == 0
		ALORS
			erreur_860026567 = i_format_str2(pt_DEDE_BNC_860026567,"%s%s","0",pt_BUF1_860026567)
			#trace2(">>>__LINE__>>> DEDE Mayotte ou St Pierre et Miquelon normalisation ajout 0 pt_DEDE_BNC=%s",pt_DEDE_BNC,"")
		SINON
			erreur_860026567 = i_format_str2(pt_DEDE_BNC_860026567,"%s%s","00",pt_BUF1_860026567)
			#trace2(">>>__LINE__>>> DEDE international dont comores normalisation ajout 00 pt_DEDE_BNC=%s",pt_DEDE_BNC,"")
		FINSI
	FINSI

	taille_860026567 = i_strlen(pt_DEDE_BNC_860026567)

	SI taille_860026567 > 10
	ALORS
		i_get_sub_str(pt_DEDE_BNC_860026567,0,9,pt_BUF2_860026567)
		erreur_860026567 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_BUF2_860026567,11)
		#trace2(">>>__LINE__>>> si >10 Tcopo::NDE(pt_DEDE_BNC de 0 a 9) =%s",pt_BUF2,"")
	SINON
		erreur_860026567 = i_memcpy_art_field_n(g_icopo, $Tcopo::NDE, pt_DEDE_BNC_860026567,taille_860026567+1)
		#trace2(">>>__LINE__>>> si <= 10 Tcopo::NDE(pt_DEDE_BNC en entier) =%s",pt_DEDE_BNC,"")
	FINSI
	#trace(">>>__LINE__>>> pas de normalisation de DEDE_NUM parceque vide ")
FINSI

#################### Appel Base de comptage  ################################

CODCIRDR_860026567=-1
CODCIR_860026567=-1
type_ctr_860026567=-1
unite_860026567=-1
TYPCOM_860026567=-1
vc_860026567=-1
SRP_ITX_860026567 = 0
CCD_860026567 = 0xFF

SI ( b_EFFICACE_860026567 && idus_inf_860026567 == 0x80 && ValZ_860026567 != 0 && ( i_strcmp(pt_DEDE_NUM_860026567," ") != 0 ) 
  && ( i_strcmp(pt_DTMF_860026567, "*610*") != 0 ) )
ALORS
	#trace(">>>__LINE__>>> passage BNC")
	g_icopo.TAXE   = 0
	g_icopo.CREDIT = 0
	erreur_860026567 = i_set_art_date(g_icopo,HLAHM1_C_860026567)
	g_icopo.DUREE  = duree_860026567
	g_icopo.CODE   = CODE_ARTICLE_860026567
	g_icopo.CATEG  = CATEG_860026567
	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_860026567 = i_comptage(g_icopo,BASE_860026567,HLAHM1_C_860026567)

	# Erreur retour base de comptage #
	SI (retour_BNC_860026567 && b_FACTURABLE_860026567)
	ALORS
		#trace1(">>>__LINE__>>> Erreur retour BNC erreur=%d",retour_BNC)
		code_errone_860026567 = 0xA020 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8507,2,g_iartin,"",3,code_errone_860026567,C_Article_860026567,g_ierrno)
		SAUT DISTRI_ERR
	FINSI

	#CCD
	SI b_FACTURABLE_860026567
	ALORS
		SI retour_BNC_860026567 == 0
		ALORS
			# Fusion base Woo et TPH invers? pour Woo dans base FR
			# Attention, TYPCOM et CCD sont inverse pour Wanadoo dans base TPH categ 16
			CCD_860026567 = g_icopo.SUP[RES_CCD_860026567]

			#CODCIRDR, CODCIR, RES_TYPCTR (REJET, REJET2, REJET3)
			############################################
			# Controle sur l'unite renvoyee par la BNC
			# COEFF=94 MILEURO=10 MILEURODR=110
			# NbUT=vcUT UTC=0 UTCDR=100
			############################################
			#UNITE, VC
			vc_860026567 = g_icopo.TAXE
			unite_860026567 = g_icopo.SUP[RES_UNITE_860026567]

			SI unite_860026567 != UTC_860026567 && unite_860026567 != MILEURODR_860026567 && unite_860026567 != UTCDR_860026567
			ALORS
				#trace(">>>__LINE__>>> Erreur retour BNC")
				code_errone_860026567 = 0xA020
				code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
				erreur_860026567 = i_PlvMessEmettre(8506,2,g_iartin,"",3,code_errone_860026567,C_Article_860026567,unite_860026567)
				SAUT DISTRI_ERR
			FINSI
			type_ctr_860026567 = g_icopo.SUP[RES_TYPCTR_860026567]

			#VC
			vc_860026567 = g_icopo.TAXE

			#TYPCOM
			TYPCOM_860026567 = g_icopo.SUP[RES_TYPCOM_860026567]
			#QC602 Ajout CCD_Symphonie
			#CCD_SYMPHONIE = TYPCOM
			#QC607 Ajout TYPCOM_Symphonie
			TYPCOM_SYMPHONIE_860026567 = TYPCOM_860026567
		FINSI
	FINSI

	SI b_EFFICACE_860026567
	ALORS
		SI retour_BNC_860026567 == 0
		ALORS
			CODCIRDR_860026567 = g_icopo.SUP[RES_CODCIRDR_860026567]
			#trace1(">>>__LINE__>>>  *** CODCIRDR <%d>",CODCIRDR)
			CODCIR_860026567 = g_icopo.SUP[RES_CODCIR_860026567]
			#trace1(">>>__LINE__>>>  *** CODCIR <%d>",CODCIR)
		FINSI
	FINSI

	#################### SRP_ITX evol spec 0x53 au lieu de 0x18 #########

	SRP_ITX_860026567 = 0

	SI TYPCOM_860026567 == 0x53 && type_ctr_860026567 == 0
	ALORS
		SRP_ITX_860026567 = 1
	FINSI

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

	SI ( CCD_860026567 == 0x17 )
	ALORS
		b_Emessage_IP_860026567 = 1
	FINSI

	#G3R24############## SRP_TIERS Calcul du Booleen ####################


	#################### b118_PTD Calcul du Booleen ####################

	##################### b_SRP_TIERS_PTD Calcul du Booleen ##################
	b_SRP_TIERS_PTD_860026567 = 0

	SI ( (CCD_860026567 == 0x18) && (type_ctr_860026567 == 3) )
	ALORS
		b_SRP_TIERS_PTD_860026567 = 1
	FINSI

	#################### b_118_TIERS_PTD Calcul du Booleen ####################
	b_118_TIERS_PTD_860026567 = 0
	SI (CCD_860026567 == 0x1B)
	ALORS
		b_118_TIERS_PTD_860026567 = 1
	FINSI
	#/G3R24
	
	#trace(">>>__LINE__>>> pas d'appel a base de comptage")
FINSI

#G4R6 Lot2 Verif DATE
SI ( type_ctr_860026567 == CTR_CPSLOC_860026567 || type_ctr_860026567 == CTR_CPSRI_860026567 ) && !b_Fact_CPS_Act_860026567
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_860026567 = i_format_str2(pt_LIBELREDIST_860026567," AR <%s> avec date DC inferieure a la date d'activation <%s> de la facturation CPS",pt_DEDE_NUM_860026567,pt_datCPLUSS_860026567)
	code_errone_860026567 = 0xA080
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre( 8599, 1, g_iartin,"", 3,code_errone_860026567, C_Article_860026567, pt_LIBELREDIST_860026567 )
	SAUT ELIMINE_EXP
SINON
	SI type_ctr_860026567 == CTR_CPSLOC_860026567 && b_Fact_CPS_Act_860026567
	ALORS
		b_Fact_CPS_Loc_860026567 =1
	SINON
		SI type_ctr_860026567 == CTR_CPSRI_860026567 && b_Fact_CPS_Act_860026567
		ALORS
			b_Fact_CPS_RI_860026567 = 1
		FINSI
	FINSI
FINSI

# lg_IDUS_NUM
lg_IDUS_NUM_860026567 = 0
lg_IDUS_NUM_860026567 = (i_get_art_fieldlength(g_iartout, $Tv2oip::IDUS_NUM) + 1) / 2

# lg_DEDE_NUM
lg_DEDE_NUM_860026567 = 0
lg_DEDE_NUM_860026567 = (i_get_art_fieldlength(g_iartout, $Tv2oip::DEDE_NUM) + 1) / 2


########## 29/08/2013 QC742: Ne pas consulter les tables de distribution
SI ( roleofnode_860026567 != 0x00 || idus_inf_860026567 != 0x80 )
ALORS
	SAUT RECH_INSTANCE
FINSI


#################### (NM3 referentiel VIO "VGA1 et VGA2")#####
#					 (NBE referentiel VIO "VGA1 et VGA2")
# Controle presence et recuperation de l'instance du referentiel VGA

#G4R2
instOPEN_860026567 = i_LireInstanceECC(C_INST_OPEN_860026567)

SI (!instOPEN_860026567)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "OPEN", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI

instVGAIP_860026567 = i_LireInstanceECC(C_INST_VGAIP_860026567)

SI (!instVGAIP_860026567)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "VGAIP", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI

instVGA_860026567 = i_LireInstanceECC(C_INST_VGA_860026567)

SI (!instVGA_860026567)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "VGA", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI

# debut NBE2 Recherche code operateur dans VGA2 - valorisation de b_CodOperVG et pt_CodOperVG

SI (i_EnvoiReqConsTabDist(TD_VGA2_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout, $Tv2oip::IDUS_NUM) , lg_IDUS_NUM_860026567, 0, 1) != 0)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI

erreur_860026567 = i_LireReqConsTabDist()
SI (erreur_860026567 != 0)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI
res_860026567 = i_LireInfoECC(instOPEN_860026567, 0)

SI (res_860026567 != 0)
ALORS
	erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 6, pt_OPERA_860026567)
# - Si code operateur non chaine vide alors valorisation de b_CodOperVG
	SI ( i_strcmp(pt_OPERA_860026567,g_inull))
	ALORS
		i_strcpy(pt_CodOperVG_860026567,pt_OPERA_860026567)
		b_CodOperVG_860026567 = 1
	FINSI
FINSI
# Fin NBE2 Recherche code operateur dans VGA2 - valorisation de b_CodOperVG

# NM3	NM3_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)
# recuperation du code offre pour NBE2
SI (i_EnvoiReqConsTabDist(TD_VGA1_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout, $Tv2oip::IDUS_NUM) , lg_IDUS_NUM_860026567, 0, 1) != 0)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI

erreur_860026567 = i_LireReqConsTabDist()

SI (erreur_860026567 != 0)
ALORS
	erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "",3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026567, g_ieec)
	SAUT DISTRI_ERR
FINSI
res_860026567 = i_LireInfoECC(instOPEN_860026567, 0)
NM3_860026567=0
i_strcpy(pt_NM3_OF_860026567, " ")

SI (res_860026567 != 0)
ALORS
	erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 6, pt_OFFRE_860026567)
	# passer par la table Inj
	SI (i_strcmp(pt_OFFRE_860026567, g_inull))
	ALORS
		# recuperation le Code offre de VGA1 si b_CodOperVG est vrai
		SI b_CodOperVG_860026567
		ALORS
			i_strcpy (pt_CodOffreVG_860026567,pt_OFFRE_860026567)
		FINSI
		# passer par la table Inj pour valoriser NM3
		i_strcpy(pt_BUF1_860026567, " ")
		erreur_860026567 = i_format_str2(pt_BUF1_860026567, "%s%s", "INj", pt_OFFRE_860026567)
		i_strcpy(pt_RES1_860026567, i_get_tab_field("Inter", date_GMT_860026567, pt_BUF1_860026567))

		SI (i_strcmp(pt_RES1_860026567, "NM3") == 0)
		ALORS
			NM3_860026567 = 1
			i_strcpy(pt_NM3_OF_860026567, pt_OFFRE_860026567)
		FINSI
	FINSI
FINSI

# NM3_OP dans la table VGA2 (SI NM3)
i_strcpy(pt_NM3_OP_860026567, "")

SI (NM3_860026567 == 1)
ALORS
	SI ( i_strcmp(pt_OPERA_860026567,g_inull))
	ALORS
		i_strcpy(pt_NM3_OP_860026567, pt_OPERA_860026567)
	FINSI
FINSI
#/G4R2


# instance VGAIP si pas d'instance OPEN
SI (b_CodOperVG_860026567 == 0)
ALORS

# debut NBE2 Recherche code operateur dans VGA2 - valorisation de b_CodOperVG et pt_CodOperVG

	SI (i_EnvoiReqConsTabDist(TD_VGA2_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout, $Tv2oip::IDUS_NUM) , lg_IDUS_NUM_860026567, 0, 1) != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026567 = i_LireReqConsTabDist()
	SI (erreur_860026567 != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	res_860026567 = i_LireInfoECC(instVGAIP_860026567, 0)

	SI (res_860026567 != 0)
	ALORS
		erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 6, pt_OPERA_860026567)
# - Si code operateur non chaine vide alors valorisation de b_CodOperVG
		SI ( i_strcmp(pt_OPERA_860026567,g_inull))
		ALORS
			i_strcpy(pt_CodOperVG_860026567,pt_OPERA_860026567)
			b_CodOperVG_860026567 = 1
		FINSI
	FINSI
# Fin NBE2 Recherche code operateur dans VGA2 - valorisation de b_CodOperVG

# NM3	NM3_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)
# recupration du code offre pour NBE2
	SI (i_EnvoiReqConsTabDist(TD_VGA1_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout, $Tv2oip::IDUS_NUM) , lg_IDUS_NUM_860026567, 0, 1) != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026567 = i_LireReqConsTabDist()

	SI (erreur_860026567 != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "",3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	res_860026567 = i_LireInfoECC(instVGAIP_860026567, 0)
	NM3_860026567=0
	i_strcpy(pt_NM3_OF_860026567, " ")

	SI (res_860026567 != 0)
	ALORS
		erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 6, pt_OFFRE_860026567)
		# passer par la table Inj
		SI (i_strcmp(pt_OFFRE_860026567, g_inull))
		ALORS
			# recuperation le Code offre de VGA1 si b_CodOperVG est vrai
			SI b_CodOperVG_860026567
			ALORS
				i_strcpy (pt_CodOffreVG_860026567,pt_OFFRE_860026567)
			FINSI
			# passer par la table Inj pour valoriser NM3
			i_strcpy(pt_BUF1_860026567, " ")
			erreur_860026567 = i_format_str2(pt_BUF1_860026567, "%s%s", "INj", pt_OFFRE_860026567)
			i_strcpy(pt_RES1_860026567, i_get_tab_field("Inter", date_GMT_860026567, pt_BUF1_860026567))

			SI (i_strcmp(pt_RES1_860026567, "NM3") == 0)
			ALORS
				NM3_860026567 = 1
				i_strcpy(pt_NM3_OF_860026567, pt_OFFRE_860026567)
			FINSI
		FINSI
	FINSI

# NM3_OP dans la table VGA2 (SI NM3)
	i_strcpy(pt_NM3_OP_860026567, "")

	SI (NM3_860026567 == 1)
	ALORS
		SI ( i_strcmp(pt_OPERA_860026567,g_inull))
		ALORS
			i_strcpy(pt_NM3_OP_860026567, pt_OPERA_860026567)
		FINSI
	FINSI
FINSI

#-------------------------------------------------------------------------
# valorisation de FFMV2 - FFMV3 - QC377 suppression de FFMV2

SI b_CodOperVG_860026567
ALORS
	erreur_860026567 = i_format_str2( pt_TEMP_860026567, "%s%s", "INj", pt_CodOffreVG_860026567)

	SI (i_strcmp( i_get_tab_field("Inter", date_GMT_860026567, pt_TEMP_860026567),"FFMV3") == 0 )
	ALORS
		b_FFMV3_860026567 = 1
	FINSI
FINSI

# NBE2 :determine si operateur concerne par NBE
SI b_CodOperVG_860026567
ALORS
	i_strcpy(pt_TEMP_860026567,"")
	erreur_860026567 = i_format_str2( pt_TEMP_860026567, "%s%s", "INm", pt_CodOperVG_860026567)

	SI ( i_strcmp( i_get_tab_field("Inter", date_GMT_860026567, pt_TEMP_860026567), g_inull) != 0 )
	ALORS
		b_OperNBE_860026567 = 1
	FINSI
FINSI

# instance VGA si pas d'instance VGAIP
SI (b_CodOperVG_860026567 == 0)
ALORS

# debut NBE2 Recherche code operateur dans VGA2 - valorisation de b_CodOperVG et pt_CodOperVG

	SI (i_EnvoiReqConsTabDist(TD_VGA2_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout, $Tv2oip::IDUS_NUM) , lg_IDUS_NUM_860026567, 0, 1) != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Requete TD_VGA2", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026567 = i_LireReqConsTabDist()
	SI (erreur_860026567 != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "", 3, "Erreur i_LireReqConsTabDist VGA2", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	res_860026567 = i_LireInfoECC(instVGA_860026567, 0)

	SI (res_860026567 != 0)
	ALORS
		erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 6, pt_OPERA_860026567)
# - Si code operateur non chaine vide alors valorisation de b_CodOperVG
		SI ( i_strcmp(pt_OPERA_860026567,g_inull))
		ALORS
			i_strcpy(pt_CodOperVG_860026567,pt_OPERA_860026567)
			b_CodOperVG_860026567 = 1
		FINSI
	FINSI
# Fin NBE2 Recherche code operateur dans VGA2 - valorisation de b_CodOperVG

# NM3	NM3_OF dans la table VGA1 (si IDUS_NUM dans la table VGA1)
# recupration du code offre pour NBE2
	SI (i_EnvoiReqConsTabDist(TD_VGA1_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout, $Tv2oip::IDUS_NUM) , lg_IDUS_NUM_860026567, 0, 1) != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "Requete TD_VGA1", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026567 = i_LireReqConsTabDist()

	SI (erreur_860026567 != 0)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501, 2, g_iartin, "",3, "Erreur i_LireReqConsTabDist VGA1", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI
	res_860026567 = i_LireInfoECC(instVGA_860026567, 0)
	NM3_860026567=0
	i_strcpy(pt_NM3_OF_860026567, " ")

	SI (res_860026567 != 0)
	ALORS
		erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 6, pt_OFFRE_860026567)
		# passer par la table Inj
		SI (i_strcmp(pt_OFFRE_860026567, g_inull))
		ALORS
			# recuperation le Code offre de VGA1 si b_CodOperVG est vrai
			SI b_CodOperVG_860026567
			ALORS
				i_strcpy (pt_CodOffreVG_860026567,pt_OFFRE_860026567)
			FINSI
			# passer par la table Inj pour valoriser NM3
			i_strcpy(pt_BUF1_860026567, " ")
			erreur_860026567 = i_format_str2(pt_BUF1_860026567, "%s%s", "INj", pt_OFFRE_860026567)
			i_strcpy(pt_RES1_860026567, i_get_tab_field("Inter", date_GMT_860026567, pt_BUF1_860026567))

			SI (i_strcmp(pt_RES1_860026567, "NM3") == 0)
			ALORS
				NM3_860026567 = 1
				i_strcpy(pt_NM3_OF_860026567, pt_OFFRE_860026567)
			FINSI
		FINSI
	FINSI

# NM3_OP dans la table VGA2 (SI NM3)
	i_strcpy(pt_NM3_OP_860026567, "")

	SI (NM3_860026567 == 1)
	ALORS
		SI ( i_strcmp(pt_OPERA_860026567,g_inull))
		ALORS
			i_strcpy(pt_NM3_OP_860026567, pt_OPERA_860026567)
		FINSI
	FINSI
FINSI

#-------------------------------------------------------------------------
# valorisation de FFMV2 - FFMV3 - QC377 suppression de FFMV2

SI b_CodOperVG_860026567
ALORS
	erreur_860026567 = i_format_str2( pt_TEMP_860026567, "%s%s", "INj", pt_CodOffreVG_860026567)

	SI (i_strcmp( i_get_tab_field("Inter", date_GMT_860026567, pt_TEMP_860026567),"FFMV3") == 0 )
	ALORS
		b_FFMV3_860026567 = 1
	FINSI
FINSI

# NBE2 :determine si operateur concerne par NBE

SI b_CodOperVG_860026567
ALORS
	i_strcpy(pt_TEMP_860026567,"")
	erreur_860026567 = i_format_str2( pt_TEMP_860026567, "%s%s", "INm", pt_CodOperVG_860026567)

	SI ( i_strcmp( i_get_tab_field("Inter", date_GMT_860026567, pt_TEMP_860026567), g_inull) != 0 )
	ALORS
		b_OperNBE_860026567 = 1
	FINSI
FINSI

#-------------------------------------------------------

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

# EPORTABILITE_SRP
SI i_strcmp(pt_DEDE_NUM_860026567," ") != 0
ALORS
	#----------  Appel de la table 45S  ---------  #
	#trace(">>>__LINE__>>> ------------RECHERCHE INSTANCE 45S-------------")
	inst45S_860026567 = i_LireInstanceECC(C_Inst45S_860026567)

	SI (!inst45S_860026567)
	ALORS
		#trace (">>>__LINE__>>> --------Pas d'instance pour 45S------------------------------")
		code_errone_860026567 = 0xA0B0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567   = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026567,C_Inst45S_860026567,C_Article_860026567)
		SAUT DISTRI_ERR
	FINSI
	#trace1(">>>__LINE__>>> -------inst45S=<%d>-----------------------------",inst45S  )
	# Envoi Requetes Table de Distribution 45S
	i_strcpy(pt_BUF1_860026567,pt_DEDE_NUM_860026567)

# G4R5 Lot2 	pt_DEDE_BNC
	SI (i_adequation_chaine_expreg (pt_DEDE_NUM_860026567, "^*") != 0) || (i_adequation_chaine_expreg (pt_DEDE_NUM_860026567, "^#") != 0)
	ALORS
		i_replace_str(pt_DEDE_NUM_860026567,"*#+","BCD",pt_BUF1_860026567)
		#trace2(">>>__LINE__>>> ------ envoi 45S avec pt_DEDE_NUM= pt_BUF1 <%s>---------",pt_BUF1,"")
		pt_CODESRP_860026567 = CodeOperateurTable6_860026233(date_GMT_860026567,pt_BUF1_860026567,"45S")
		#trace2(">>>__LINE__>>> ------ resultat de pt_CODESRP : <%s>---------",pt_CODESRP   ,"")
	
		SI i_strcmp(pt_CODESRP_860026567  , "84208") == 0
		ALORS
			#trace("******** EPORTABILITE_SRP   = 1 car pt_CODESRP  84208")
			EPORTABILITE_SRP_860026567   = 1
		SINON
			EPORTABILITE_SRP_860026567   = 0
			SI (i_strcmp(pt_CODESRP_860026567,"84208")!=0 && i_strcmp(pt_CODESRP_860026567,"")!=0)
			ALORS
				SPORTABILITE_SRP_860026567 = 1
			SINON
				SPORTABILITE_SRP_860026567 = 0
			FINSI
		FINSI
		#trace(">>>__LINE__>>> pas d appel 45S parceque DEDE_NUM vide ")
	FINSI
FINSI
#---------------FIN 45S----------------------#

# Calcul de NPF_SIP variable fonctionnelle
SI roleofnode_860026567 == 0x00 && idus_inf_860026567 == 0x80
ALORS
	# TD_NPF dans la doc, remplace par TD_SIP interrogation aussi du LAR FEIP qui se trouve dans TD_Fixe

	SI (i_EnvoiReqConsTabDistDouble(TD_Fixe, TD_SIP_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout,$Tv2oip::IDUS_NUM), lg_IDUS_NUM_860026567, lg_IDUS_NUM_860026567, 1, 0, 1) != 0)
	ALORS
		#trace("Erreur i_EnvoiReqConsTabDist NPF")
		code_errone_860026567 = 0xA0C0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026567,C_SIP_FE_860026567,C_Article_860026567)
		SAUT DISTRI_ERR
	FINSI

	instFEIP_860026567 = i_LireInstanceECC(C_instFEIP_860026567)

	SI (!instFEIP_860026567)
	ALORS
		#trace2( ">>>__LINE__>>> Erreur i_LireInstanceECC: <%s>", C_instFEIP,"")
		erreur_860026567 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"FEIP",C_Article_860026567,g_ieec)
		SAUT DISTRI_ERR
	FINSI

	instSIP_860026567 = i_LireInstanceECC(C_instSIP_860026567)

	SI (!instSIP_860026567)
	ALORS
		#trace2( ">>>__LINE__>>> Erreur i_LireInstanceECC: <%s>", C_instSIP,"")
		erreur_860026567 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"SIP",C_Article_860026567,g_ieec)
		SAUT DISTRI_ERR
	FINSI

#G4R6 Lot1 	instOPT = i_LireInstanceECC(C_instOPT)

#G4R6 Lot1 	SI !instOPT
#G4R6 Lot1 	ALORS
#G4R6 Lot1 		#trace2( ">>>__LINE__>>> Erreur i_LireInstanceECC: <%s>", C_instOPT,"")
#G4R6 Lot1 		erreur = i_PlvMessEmettre(8501,2,g_iartin,"",3,"OPT",C_Article,g_ieec)
#G4R6 Lot1 		SAUT DISTRI_ERR
#G4R6 Lot1 	FINSI

	erreur_860026567 = i_LireReqConsTabDist()

	SI ( erreur_860026567 != 0 )
	ALORS
		#trace1( ">>>__LINE__>>> Erreur i_LireReqConsTabDist SIP: <%d>", erreur)
		code_errone_860026567 = 0xA0C0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8508,2,g_iartin,"",3,C_Article_860026567,"LireReqConsTabDist",C_instSIP_860026567)
		SAUT DISTRI_ERR
	FINSI

	# ajout de la condition!b_FFMV3
	SI (!NM3_860026567 && !b_FFMV3_860026567)
	ALORS
		res_860026567 = i_LireInfoECC(instFEIP_860026567, i_LireEntierECCv(instFEIP_860026567))
		SI (res_860026567 != 0)
		ALORS
			# TYPAR_FE
			erreur_860026567 = i_LireChaineInfo(res_860026567, 0, 2, pt_BUF4_860026567)
			SI (i_strcmp(pt_BUF4_860026567, "23") == 0)
			ALORS
				b_TYPAR_FE_860026567 = 1
			FINSI
		SINON
			b_TYPAR_FE_860026567 = 0
		FINSI
	SINON
		b_TYPAR_FE_860026567 = 0
	FINSI

	SI (!b_TYPAR_FE_860026567)
	ALORS
		instECCv_860026567 = i_LireEntierECCv(instSIP_860026567)
		res_860026567 = i_LireInfoECC(instSIP_860026567, instECCv_860026567)
		SI (res_860026567 != 0)
		ALORS
			b_NPF_SIP_860026567 = 1
			erreur_860026567 = i_set_art_field(g_iartout10, $Conversion::BassinFacN, instECCv_860026567)
			erreur_860026567 = i_get_art_str(g_iartout10, $Conversion::BassinFacA, pt_SIP_ECC_860026567 )
			erreur_860026567 = i_format_str2( pt_CLE_860026567, "%s%s", C_pref_CLE_860026567, pt_SIP_ECC_860026567)
			i_strcpy (pt_inst_860026567, i_get_tab_field("Inter", date_GMT_860026567, pt_CLE_860026567))

			SI (pt_inst_860026567 == "")
			ALORS
				#trace2( ">>>__LINE__>>> Erreur i_get_tab_field <%s> pas dans Inter", pt_CLE, "")
				code_errone_860026567 = 0xA0A0
				code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
				erreur_860026567 = i_PlvMessEmettre(8605,2,g_iartin,"",3,code_errone_860026567,"Inter",pt_CLE_860026567)
				SAUT DISTRI_ERR
			FINSI
		SINON
			b_NPF_SIP_860026567 = 0
			i_strcpy(pt_SIP_ECC_860026567," ")
		FINSI
	SINON
		b_NPF_SIP_860026567 = 0
		i_strcpy(pt_SIP_ECC_860026567," ")
	FINSI
FINSI
# G4R5 Lot2
#G4R6 Lot1 	b_NPF_OPT = 0
#trace1( ">>>__LINE__>>> valeur de b_NPF_SIP: <%d>", b_NPF_SIP)

#QC472
POINT RECH_INSTANCE

#G3R24
######  DQD
instDQD_860026567 = i_LireInstanceECC(C_instDQD_860026567)

SI (!instDQD_860026567)
ALORS
	#trace(">>>__LINE__>>> Pas d'instance pour DQD!")
	code_errone_860026567 = 0xA0B0
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026567,C_instDQD_860026567,C_Article_860026567)
	SAUT DISTRI_ERR
FINSI

######  SYMPHONIE
instSYMP_860026567 = i_LireInstanceECC(C_InstSYMP_860026567)

SI (!instSYMP_860026567)
ALORS
	#trace(">>>__LINE__>>> Pas d'instance pour SYMPHONIE!")
	code_errone_860026567 = 0xA0B0
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026567,C_InstSYMP_860026567,C_Article_860026567)
	SAUT DISTRI_ERR
FINSI

######  REDHAWK


######  CASPER
instCASPER_860026567 = i_LireInstanceECC(C_instCASPER_860026567)

SI (!instCASPER_860026567)
ALORS
	#trace(">>>__LINE__>>> Pas d'instance pour CASPER!")
	code_errone_860026567 = 0xA0B0
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026567,C_instCASPER_860026567,C_Article_860026567)
	SAUT DISTRI_ERR
FINSI

######  CENTVG
instCENTVG_860026567= i_LireInstanceECC(C_InstCENTVG_860026567)

SI (!instCENTVG_860026567)
ALORS
	code_errone_860026567 = 0xA0B0
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026567,C_InstCENTVG_860026567,C_Article_860026567)
	SAUT DISTRI_ERR
FINSI

#-----------------------------------------------------
# ajout ECC  FERPV Recherche instance FERPV
#-----------------------------------------------------
# deplacement en amont de la recuperation de l'intance FERPV

instFERPV_860026567 = i_LireInstanceECC(C_instFERPV_860026567)

SI (!instFERPV_860026567)
ALORS
	code_errone_860026567 = 0xA0B0
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8601, 2, g_iartin, "", 3, code_errone_860026567, C_instFERPV_860026567, C_Article_860026567)
	SAUT DISTRI_ERR
FINSI

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

SI b_Fact_CPS_Loc_860026567
ALORS
	SI ( i_EnvoiReqConsTabDist( TD_ALICE_860026567, date_GMT_860026567, i_get_art_fieldptr(g_iartout,$Tv2oip::DEDE_NUM), lg_DEDE_NUM_860026567, 0, 1) != 0 )
	ALORS
		code_errone_860026567 = 0xA0C0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026567,C_instALICE_860026567,C_Article_860026567)
		SAUT DISTRI_ERR
	FINSI

	instALICE_860026567 = i_LireInstanceECC(C_instALICE_860026567)

	SI (!instALICE_860026567)
	ALORS
		erreur_860026567 = i_PlvMessEmettre(8501,2, g_iartin, "", 3, "ALICE", C_Article_860026567, g_ieec)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026567 = i_LireReqConsTabDist()

	SI erreur_860026567 == 0
	ALORS
		#erreur = i_LireChaineECCv(instALICE, pt_ECCv)
		#instECCv = i_LireEntierECCv( instALICE )
		res_860026567 = i_LireInfoECC( instALICE_860026567, 0 )

#G4R7 Lot3 QC834
		SI ( res_860026567 != 0)
		ALORS
			# AR present dans ALICE
			erreur_860026567 = i_LireChaineInfo( res_860026567, 0, 4, pt_TEMP_860026567 )
			SI i_strcmp(pt_TEMP_860026567, "" ) != 0
			ALORS
				i_strcpy(pt_TARIF_860026567, pt_TEMP_860026567 )
				b_ALICE_860026567 = 1
			SINON
				# info complementaire CODE_TARIF vide
				bREDIST_860026567 = 1
				erreur_860026567 = i_format_str2(pt_LIBELREDIST_860026567," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_DEDE_NUM_860026567,0)
			FINSI
			
			erreur_860026567 = i_LireChaineInfo( res_860026567, 4, 1, pt_TEMP_860026567 )
			SI i_strcmp(pt_TEMP_860026567, "" ) != 0
			ALORS
				i_strcpy(pt_EDIT_860026567, pt_TEMP_860026567 )
				b_ALICE_860026567 = 1
			SINON
				# info complementaire TYPE_EDIT vide
				bREDIST_860026567 = 1
				erreur_860026567 = i_format_str2(pt_LIBELREDIST_860026567," AR <%s> trouve dans LAR ALICE mais aucune info complementaire valorisee",pt_DEDE_NUM_860026567,0)
			FINSI
		SINON
			erreur_860026567 = i_format_str2(pt_LIBELREDIST_860026567," AR <%s> non trouve dans ALICE",pt_DEDE_NUM_860026567,0)
			bREDIST_860026567 = 1
			SAUT AVANT_REDIST
		FINSI
	FINSI
FINSI

#############################################################################
# Recherche instances 42L BANIP
#############################################################################

inst42L_860026567 = i_LireInstanceECC(C_Inst42L_860026567)

SI (!inst42L_860026567)
ALORS
	#trace(">>>__LINE__>>> Pas d'instance pour 42L !")
	erreur_860026567 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"42L",C_Article_860026567,g_ieec)
	SAUT DISTRI_ERR
FINSI
#trace1(">>>__LINE__>>> inst42L=<%d>",inst42L)

#############################################################################
# Envoi Requetes Table de Distribution 42L  BANIP pour IDUS
#############################################################################

# G4R5 Lot2
#G4R6 Lot1
#SI roleofnode == 0x00 && idus_inf == 0x80 && !b_NPF_SIP && !b_TYPAR_FE && !b_NPF_OPT
SI roleofnode_860026567 == 0x00 && idus_inf_860026567 == 0x80 && !b_NPF_SIP_860026567 && !b_TYPAR_FE_860026567
ALORS
	#trace(">>>__LINE__>>> debut 42L pour IDUS")
	#NDRTC

	SI (i_EnvoiReqConsTabDist( TD_42L, date_GMT_860026567,i_get_art_fieldptr(g_iartout,$Tv2oip::IDUS_NUM), lg_IDUS_NUM_860026567, 0, 1)!=0)
	ALORS
		#trace(">>>__LINE__>>> Erreur i_EnvoiReqConsTabDist")
		code_errone_860026567 = 0xA0C0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026567,C_Inst42L_860026567,C_Article_860026567)
		SAUT DISTRI_ERR
	FINSI
	erreur_860026567 = i_LireReqConsTabDist()
	#trace1(">>>__LINE__>>> RETOUR i_LireReqConsTabDist, erreur=<%d>",erreur)

	SI ( erreur_860026567 != 0 )
	ALORS
		#trace1( ">>>__LINE__>>> Erreur i_LireReqConsTabDist: <%d>", erreur)
		code_errone_860026567 = 0xA0C0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8508,2,g_iartin,"",3,C_Article_860026567,"LireReqConsTabDist",C_Inst42L_860026567)
		SAUT DISTRI_ERR
	FINSI

	erreur_860026567 = i_LireChaineECCv(inst42L_860026567, pt_ECCv_860026567)
	#trace1(">>>__LINE__>>> Retour de i_LireChaineECCv = <%d>",erreur)

	SI ( erreur_860026567 != 0 )
	ALORS
		#trace1( ">>>__LINE__>>> Erreur i_LireChaineECCv : <%d>", erreur)
		i_strcpy(pt_ECCv_860026567,"D")
	FINSI
	#trace2(">>>__LINE__>>> ==== Resultat de pt_ECCv : <%s>", pt_ECCv, "")

	# NDRTC
	# utilisation de conv_ascii_dcb
	instECCv_860026567 = i_LireEntierECCv( inst42L_860026567 )
	res_860026567 = i_LireInfoECC( inst42L_860026567, instECCv_860026567 )

	i_strcpy(pt_BANIP_RTC_860026567," ")
	SI ( res_860026567 != 0)
	ALORS
		b_BANIP_860026567 = 1
		SI (!b_NPF_SIP_860026567)
		ALORS
			erreur_860026567 = i_LireImsiInfo( res_860026567, 0, 5, pt_BANIP_RTC_860026567 )
			erreur_860026567 = i_LireChaineInfo(res_860026567, 5, 1, pt_Support_860026567)
			SI (i_strcmp (pt_Support_860026567, "F") == 0)
			ALORS
				SIP_Fibre_860026567 = 1
			FINSI
		FINSI
		#trace2(">>>__LINE__>>> Resultat de i_LireImsiInfo pt_BANIP_RTC : <%s>", pt_BANIP_RTC, "")
	SINON
		#trace(">>>__LINE__>>> Envoi en redistribution absent dans 42L")
		i_strcpy(pt_LIBELREDIST_860026567, C_Message1_860026567)
#G4R8 QC861 envoi a DQD bREDIST negatif
#		bREDIST = 1
		bREDIST_860026567 = -1
		SAUT AVANT_REDIST
	FINSI
	erreur_860026567 = i_set_art_str( g_iartout,$Tv2oip::ND_RTC_42L,pt_BANIP_RTC_860026567)
SINON
	i_strcpy(pt_BANIP_RTC_860026567," ")
FINSI

# G4R5 Lot2
#################### HLAHM1 (date locale) NUMTABSEL=0, NUMTAB=1 ###############

SI ( idus_inf_860026567 != 0x80 )
ALORS
	HLAHM1_860026567 = -1
SINON
	#trace2("__FILE__:__LINE__ ## TEST ## ======> pt_IDUS_NUM <%s> #### ",pt_IDUS_NUM ,"")
	numzone_860026567 = i_DHgetZoneID(NUMTABSEL_860026567, g_iartout)
	HLAHM1_860026567 = i_DHgetLocalTime(NUMTAB_860026567,numzone_860026567,date_GMT_860026567)
	erreur_860026567 = i_set_attr_val_n($E_V2OIP::numzone, numzone_860026567)

	SI numzone_860026567 == 4 && ( i_adequation_chaine_expreg (pt_IDUS_NUM_860026567, "^976") == 0 )
	ALORS
		SI !b_BANIP_860026567
		ALORS
			# interrogation de BANIP
			SI (i_EnvoiReqConsTabDist( TD_42L, date_GMT_860026567,i_get_art_fieldptr(g_iartout,$Tv2oip::IDUS_NUM), lg_IDUS_NUM_860026567, 0, 1)!=0)
			ALORS
				code_errone_860026567 = 0xA0C0
				code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
				erreur_860026567 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026567,C_Inst42L_860026567,C_Article_860026567)
				SAUT DISTRI_ERR
			FINSI
			erreur_860026567 = i_LireReqConsTabDist()

			SI erreur_860026567 == 0
			ALORS
				erreur_860026567 = i_LireChaineECCv(inst42L_860026567, pt_ECCv_860026567)
				# NDRTC
				instECCv_860026567 = i_LireEntierECCv( inst42L_860026567 )
				res_860026567 = i_LireInfoECC( inst42L_860026567, instECCv_860026567 )

				i_strcpy(pt_RTC_MAY_860026567, " ")
				SI ( res_860026567 != 0)
				ALORS
					erreur_860026567 = i_LireImsiInfo( res_860026567, 0, 5, pt_RTC_MAY_860026567 )
				FINSI
			FINSI
		FINSI

		SI b_BANIP_860026567
		ALORS
			SI i_strcmp(pt_BANIP_RTC_860026567,g_inull) != 0 && i_strcmp(pt_BANIP_RTC_860026567," ") != 0
			ALORS
				taille_860026567 = i_conv_ascii_dcb (pt_BANIP_RTC_860026567, pt_TEMP1_860026567)
				erreur_860026567 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_TEMP1_860026567, taille_860026567)
				numzone_860026567 = i_DHgetZoneID(NUMTABSEL1_860026567, g_iartout10)
				erreur_860026567 = i_set_attr_val_n($E_V2OIP::numzone, numzone_860026567)
			FINSI
		SINON
			SI i_strcmp(pt_RTC_MAY_860026567,g_inull) != 0 && i_strcmp(pt_RTC_MAY_860026567," ") != 0
			ALORS
				taille_860026567 = i_conv_ascii_dcb (pt_RTC_MAY_860026567, pt_TEMP1_860026567)
				erreur_860026567 = i_memcpy_art_field_n(g_iartout10, $Conversion::NDR, pt_TEMP1_860026567, taille_860026567)
				numzone_860026567 = i_DHgetZoneID(NUMTABSEL1_860026567, g_iartout10)
				erreur_860026567 = i_set_attr_val_n($E_V2OIP::numzone, numzone_860026567)
			FINSI
		FINSI

		SI numzone_860026567 == 5
		ALORS
			HLAHM1_860026567 = i_DHgetLocalTime(NUMTAB_860026567,numzone_860026567,date_GMT_860026567)
		FINSI
	FINSI
FINSI

#trace1("__FILE__:__LINE__ ## TEST ## ======> Valeur de HLAHM1_C : <%d> #### ", HLAHM1_C)
#trace1("__FILE__:__LINE__ ## TEST ## ======> Valeur de HLAHM1 : <%d> #### ", HLAHM1)

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

# EPORTABILITE_SCP, SPORTABILITE_SCP
i_get_sub_str(pt_DEDE_NUM_860026567,0,0,pt_debChamp1_860026567)
taille_860026567 = i_strlen(pt_DEDE_NUM_860026567)
#trace2(">>>__LINE__>>> -------AVANT RECHERCHE INSTANCE ACLA---- pt_DEDE_NUM= %s --",pt_DEDE_NUM,"")
#trace2(">>>__LINE__>>> -------AVANT RECHERCHE INSTANCE ACLA---- pt_debChamp1= %s --",pt_debChamp1,"")
#trace1(">>>__LINE__>>> -------AVANT RECHERCHE INSTANCE ACLA---- taille=%d --",taille)

#G4R7 Lot1
#SI (i_strcmp(pt_debChamp1,"8") == 0 || (i_strcmp(pt_debChamp1,"3") == 0 && taille == 4))
SI i_strcmp(pt_DEDE_NUM_860026567," ") != 0
ALORS
	#----------  Appel de la table ACLA  ---------  #
	#trace(">>>__LINE__>>> -------RECHERCHE INSTANCE ACLA-------------")
	instACLA_860026567 = i_LireInstanceECC(C_InstACLA_860026567)

	SI (!instACLA_860026567)
	ALORS
		#trace (">>>__LINE__>>> --------Pas d'instance pour ACLA------------------------------")
		code_errone_860026567 = 0xA0B0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567   = i_PlvMessEmettre(8601,2,g_iartin,"",3,code_errone_860026567,C_InstACLA_860026567,C_Article_860026567)
		SAUT DISTRI_ERR
	FINSI

# G4R5 Lot2 	pt_DEDE_BNC
	SI ( i_adequation_chaine_expreg (pt_DEDE_NUM_860026567, "^*") != 0 ) || ( i_adequation_chaine_expreg (pt_DEDE_NUM_860026567, "^#") != 0 )
	ALORS
		#trace1(">>>__LINE__>>> -------instACLA=<%d>-----------------------------",instACLA  )
		# Envoi Requetes Table de Distribution ACLA
		i_strcpy(pt_BUF1_860026567,pt_DEDE_NUM_860026567)
		i_replace_str(pt_DEDE_NUM_860026567,"*#+","BCD",pt_BUF1_860026567)
		#trace2(">>>__LINE__>>> ------ envoi ACLA avec pt_DEDE_NUM= pt_BUF1 <%s>---------",pt_BUF1,"")
		pt_CODESCP_860026567 = CodeOperateurTable6_860026233(date_GMT_860026567,pt_BUF1_860026567,"ACLA")
		#trace2(">>>__LINE__>>> ------ resultat de pt_CODESCP : <%s>---------",pt_CODESCP   ,"")
	
		SI i_strcmp(pt_CODESCP_860026567  , "84008") == 0
		ALORS
			#trace(" ACLA pt_CODESCP=84008  EPORTABILITE_SCP   = 1")
			EPORTABILITE_SCP_860026567   = 1
		SINON
			EPORTABILITE_SCP_860026567   = 0
			SI i_strcmp(pt_CODESCP_860026567  ,"")!=0
			ALORS
				SPORTABILITE_SCP_860026567   = 1
			SINON
				SPORTABILITE_SCP_860026567   = 0
			FINSI
		FINSI
	FINSI
FINSI

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

######### CCD_REEL
# QC602 Ajout du CCD pour Symphonie (CCD_SYMPHONIE)

SI EPORTABILITE_SRP_860026567
ALORS
	CCD_REEL_860026567 = 212
	TYPCOM_SYMPHONIE_860026567 = 212
#607	CCD_SYMPHONIE = 212
SINON
	SI SPORTABILITE_SRP_860026567
	ALORS
		CCD_REEL_860026567 = 213
		TYPCOM_SYMPHONIE_860026567 = 213
#607		CCD_SYMPHONIE = 213
	SINON
		SI EPORTABILITE_SCP_860026567
		ALORS
			CCD_REEL_860026567 = 218
			TYPCOM_SYMPHONIE_860026567 = 218
#607			CCD_SYMPHONIE = 218
		SINON
			SI SPORTABILITE_SCP_860026567
			ALORS
				CCD_REEL_860026567 = 219
				TYPCOM_SYMPHONIE_860026567 = 219
#607				CCD_SYMPHONIE = 219
			SINON
				SI CCD_860026567 != -1
				ALORS
					CCD_REEL_860026567 = CCD_860026567
				SINON
					CCD_REEL_860026567 = 255
				FINSI
			FINSI
		FINSI
	FINSI
FINSI
#trace1(">>>__LINE__>>> CCD_REEL=%d",CCD_REEL)

# b_absAnserIndicator booleen indiquant l'absence du champ FD/AnswerIndicator/AnswerIndicator

## FLS
SI (b_absAnserIndicator_860026567 == 0)
ALORS
	erreur_860026567 = i_get_art_str(g_iartin, $Tv2oip::AnswerIndicator,pt_AnswerIndicator_860026567)
	SI (i_valid_field_n(g_iartin, $Tv2oip::redirectReason))
	ALORS
		erreur_860026567 = i_get_art_str(g_iartin, $Tv2oip::redirectReason,pt_redirectReason_860026567)
		SI ( ( i_strcmp(pt_AnswerIndicator_860026567,"Yes") == 0 ) 
		  || ( i_strcmp(pt_AnswerIndicator_860026567,"Yes-PostRedirection") == 0 ) )
		&& ( i_strcmp(pt_redirectReason_860026567,"follow-me")==0 )
		ALORS
			FLS_860026567 = 1
		FINSI
	FINSI
FINSI

## DUR2
i_strcpy (pt_flsduree_860026567, i_get_tab_field("FLSDUREE", date_GMT_860026567, "FLSDUREE"))
Entier_flsduree_860026567= CONV_ASCIINUMDEC_INT_860026233(pt_flsduree_860026567)

SI (duree_860026567 - Entier_flsduree_860026567 >=0)
ALORS
	DUR2_860026567 = duree_860026567 - Entier_flsduree_860026567
SINON
	DUR2_860026567 = 0
FINSI

## DUR
SI (FLS_860026567 == 0)
ALORS
	DUR_860026567=duree_860026567
SINON
	DUR_860026567=DUR2_860026567
FINSI

##############################################################################
# Envoi Requetes Table de Distribution MAJ2G (TD_Inter)
##############################################################################

SI b_TYPAR_FE_860026567
ALORS
	SAUT ETIQFEIP
FINSI

# Ajout test NPF_OPT
#G4R6 Lot1
#SI (b_NPF_SIP || b_NPF_OPT)
SI b_NPF_SIP_860026567
ALORS
	instTRAFIC_860026567 = i_LireInstanceECC(pt_inst_860026567)
	SAUT ETIQUETTE
SINON
	# traduction de NDRTC par i_conv_ascii

	SI (i_strcmp(pt_BANIP_RTC_860026567," " )!= 0)
	ALORS
		lg_ND_RTC_860026567  = i_conv_ascii_dcb(pt_BANIP_RTC_860026567 , pt_adr_NDRTC_860026567 )
	FINSI
	#trace2(">>>__LINE__>>> ********** ND_RTC =%s",pt_BUF1,"")
	#trace1(">>>__LINE__>>> ********** lg_ND_RTC =%d",lg_ND_RTC)
	# MAJ2G: 4 (TD_Inter)
	res_860026567 = i_EnvoiReqConsTabDist(TD_Inter, date_GMT_860026567, pt_adr_NDRTC_860026567, lg_ND_RTC_860026567, 0, 1)

	SI ( res_860026567 != 0 )
	ALORS
		#trace1(">>>__LINE__>>> Erreur i_EnvoiReqConsTabDist %d - alarme a emettre", res)
		code_errone_860026567 = 0xA0C0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8607,2,g_iartin,"",3,code_errone_860026567,"MAJ2G",C_Article_860026567)
		SAUT DISTRI_ERR
		#trace(">>>__LINE__>>> RETOUR ok DE  i_EnvoiReqConsTabDist ")
	FINSI
FINSI

##############################################################################
# Recherche instances
##############################################################################

####### SC

####### TRAFIC

instTRAFIC_860026567 = i_LireInstanceECC(C_instTRAF_860026567)

SI (!instTRAFIC_860026567)
ALORS
	#trace(">>>__LINE__>>> Pas d'instance pour TRAFIC !")
	erreur_860026567 = i_PlvMessEmettre(8501,2,g_iartin,"",3,"TRAFIC",C_Article_860026567,g_ieec)
	SAUT DISTRI_ERR
FINSI
#trace1(">>>__LINE__>>> instTRAFIC=<%d>",instTRAFIC)

##############################################################################
# Attente requete Table de Distribution TD_Fixe (MAJ2G)
##############################################################################

erreur_860026567 = i_LireReqConsTabDist()
#trace1(">>>__LINE__>>> RETOUR i_LireReqConsTabDist, erreur=<%d>",erreur)

SI ( erreur_860026567 != 0 )
ALORS
	#trace1( ">>>__LINE__>>> Erreur i_LireReqConsTabDist: <%d>", erreur)
	code_errone_860026567 = 0xA070
	code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
	erreur_860026567 = i_PlvMessEmettre(8508,2,g_iartin,"",3,C_Article_860026567,"LireReqConsTabDist","MAJ2G")
	SAUT DISTRI_ERR
FINSI

#######  TRAFIC

SI ( instTRAFIC_860026567 > 0 )
ALORS
	# Gestion du code CFR:
	res_860026567=i_LireInfoECC(instTRAFIC_860026567, 0)
	#trace1(">>>__LINE__>>> ============res i_LireInfoECC(instTRAFIC) = <%d>",res)

	SI ( res_860026567 != 0)
	ALORS
		erreur_860026567 = i_LireChaineInfo( res_860026567, 0, 3, pt_InfoCompl_860026567)
		POINT ETIQUETTE

		#G4R6 Lot1
		#SI ( ( (i_strcmp(pt_BANIP_RTC," ") != 0 ) || b_NPF_SIP || b_NPF_OPT )
		#SI ( ( (i_strcmp(pt_BANIP_RTC," ") != 0 ) || b_NPF_SIP ) && b_FACTURABLE && ( type_ctr != CTR_REJET ) && ( type_ctr != CTR_REJET2 ) && ( type_ctr != CTR_REJET3 ) && ( type_ctr != CTR_REJET5 ) && !SPORTABILITE_SRP && !b_FEIP ) 
		# G4R6 lot2
		SI ( ( ( i_strcmp(pt_BANIP_RTC_860026567," ") != 0 ) || b_NPF_SIP_860026567 )
		   && b_FACTURABLE_860026567 
		   && !( type_ctr_860026567 == CTR_REJET_860026567 || type_ctr_860026567 == CTR_REJET2_860026567 || type_ctr_860026567 == CTR_REJET3_860026567 || type_ctr_860026567 == CTR_REJET5_860026567 || b_Fact_CPS_RI_860026567 || ( b_Fact_CPS_Loc_860026567 && !b_ALICE_860026567 ) )
		   && !SPORTABILITE_SRP_860026567 && !b_FEIP_860026567 )
		ALORS
			# ajout NPF_OPT a la condition
			#G4R6 Lot1
			#SI (!b_NPF_SIP && !b_NPF_OPT)
			SI !b_NPF_SIP_860026567
			ALORS
				erreur_860026567 = i_format_str2(pt_inst_860026567, "TRAF%s", pt_InfoCompl_860026567,0)
				#trace2(">>>__LINE__>>> Concatenation de TRAF avec info.compl: <%s>", pt_inst, "")
				instTRAFIC_860026567 = i_LireInstanceECC(pt_inst_860026567)
				#trace1(">>>__LINE__>>> Instance de TRAFIC: instTRAFIC=<%d>",instTRAFIC)
				SI (!instTRAFIC_860026567)
				ALORS
					erreur_860026567 = i_PlvMessEmettre(8501,2,g_iartin,"",3,pt_inst_860026567,C_Article_860026567,g_ieec)
					SAUT DISTRI_ERR
				FINSI
			FINSI
			bTRAFIC_860026567=1
			flag_TRAFIC_860026567 = 1
			# ECC de facturation
			i_strcpy(pt_EccFact_860026567,pt_inst_860026567)
			#trace2(">>>__LINE__>>> ECC de facturation: <%s>", pt_EccFact, "")
		FINSI
	SINON
		# G4R5 Lot2
		SI (i_strcmp(pt_BANIP_RTC_860026567," ") != 0)
		ALORS
			#trace(">>>__LINE__>>> Envoi en redistribution absent dans Trafic")
			
			#G3R24 MAJ2G
			#i_strcpy(pt_LIBELREDIST, C_Message2)
			erreur_860026567 = i_format_str2(pt_LIBELREDIST_860026567,"%s%s", C_Message2_860026567, pt_BANIP_RTC_860026567)
#G4R8 QC861  pas d'envoi a DQD bREDIST positif
#			bREDIST = 1 
			bREDIST_860026567 = 2
#			bREDISTMAJ2G = 1
			
			SAUT AVANT_REDIST
		FINSI
	FINSI
FINSI

##############################################################################
# Criteres de distribution suite
##############################################################################

#----------------------------------------------------------------------------
# FEIP
#----------------------------------------------------------------------------

POINT ETIQFEIP

# G4R6 lot2
#SI b_FACTURABLE && type_ctr != CTR_REJET && type_ctr != CTR_REJET2 && type_ctr != CTR_REJET3 && type_ctr != CTR_REJET5 && !SPORTABILITE_SRP && b_TYPAR_FE && !b_FFMV3
SI b_FACTURABLE_860026567 && !( type_ctr_860026567 == CTR_REJET_860026567 || type_ctr_860026567 == CTR_REJET2_860026567 || type_ctr_860026567 == CTR_REJET3_860026567 || type_ctr_860026567 == CTR_REJET5_860026567 || b_Fact_CPS_RI_860026567 || ( b_Fact_CPS_Loc_860026567 && !b_ALICE_860026567 ) )
&& !SPORTABILITE_SRP_860026567 && b_TYPAR_FE_860026567 && !b_FFMV3_860026567
ALORS
	flag_FEIP_860026567 = 1
	#trace(">>>__LINE__>>>AjouterCouranteECC instFEIP")
	i_strcpy(pt_EccFact_860026567, "FEIP")
	b_FEIP_860026567 = 1
SINON
	b_FEIP_860026567 = 0
FINSI

#----------------------------------------------------------------------------
# ajout de FERPV - QC377 suppression de FFMV2
#----------------------------------------------------------------------------

SI ( bTRAFIC_860026567 == 1 && b_OperNBE_860026567 && b_FFMV3_860026567 == 1)
ALORS
	flag_FERPV_860026567 = 1
	#trace(">>>__LINE__>>>AjouterCouranteECC instFERPV")
FINSI

#----------------------------------------------------------------------------
# SC
#----------------------------------------------------------------------------

POINT AVANT_REDIST

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

#trace("********* Criteres distribution pour SYMPHONIE *********")

SI CPT_RDT_860026567 == 2 || bREDIST_860026567 == 0
ALORS
	flag_SYMP_860026567 = 1
	#trace(">>>__LINE__>>> AjouterCouranteECC instSYMP")
FINSI

#----------------------------------------------------------------------------
# Redhawk tous les DC vont a Redhawk,
# CASPER tous les DC vont a CASPER
#----------------------------------------------------------------------------

#trace(">>>__LINE__>>>********* Criteres distribution pour REDHAWCK *********")

SI CPT_RDT_860026567 == 2 || bREDIST_860026567 == 0
ALORS
	flag_CASPER_860026567 = 1
	#trace(">>>__LINE__>>>AjouterCouranteECC instCASPER")
FINSI

#----------------------------------------------------------------------------
# CENTVG Param NH-G2R5 (G2R2CxNH): trafic et NM3
#----------------------------------------------------------------------------
# ajout de la condition b_FFMV3
SI ( bTRAFIC_860026567 == 1 && (NM3_860026567 == 1 || b_FFMV3_860026567 == 1))
ALORS
	flag_CENTAUREVG_860026567 = 1
	#trace(">>>__LINE__>>>AjouterCouranteECC instCENTVG")
FINSI

#G3R24
#----------------------------------------------------------------------------
# DQD envoi si CPT_RDT == 2 
#----------------------------------------------------------------------------

#trace(">>>__LINE__>>>********* Criteres distribution pour DQD *********")

#G4R8 QC861 Envoi a DQD au 3ieme passage si redistribution IP (BANIP)
#SI (CPT_RDT == 2) && (bREDIST == 1)
SI (CPT_RDT_860026567 == 2) && (bREDIST_860026567 < 0)
ALORS
		flag_DQD_860026567 = 1
		bREDIST_860026567 = 0
		#trace(">>>__LINE__>>>AjouterCouranteECC instDQD")
FINSI


#----------------------------------------------------------------------------
# NB_CSV, OP_CSVi, C_CSVi (pt_csv concatene tout les C_CSVi et OP_CSVi)
# on le fait meme si non b_FACTURABLE pour SYMPHONIE, par contre on fait attention aux alarmes
#----------------------------------------------------------------------------

i_strcpy(pt_csv_860026567,"")
nb_csv_860026567 = 0

SI (i_valid_field_n(g_iartin, $Tv2oip::RedirectingNb))
ALORS
	nb_csv_860026567 = nb_csv_860026567 + 1
	i_strcpy(pt_csv_860026567,"T U")
FINSI

indice_860026567=-1

POINT BOUCLE6

indice_860026567 = indice_860026567 + 1

SI (indice_860026567 < 5 && nb_csv_860026567 < 5)
ALORS
	SI (i_valid_field_n(g_iartin, $Tv2oip::ASFacResult + (indice_860026567 * 8)))
	ALORS
		SI ( (i_valid_field_n(g_iartin, $Tv2oip::ASServiceName + (indice_860026567 * 8))) && (i_get_art_field(g_iartin, $Tv2oip::ASFacResult + (indice_860026567 * 8)) == 0x01) )
		ALORS
			#nb_csv = nb_csv + 1
			i_strcpy(pt_CLEcsv_860026567," ")
			# asservicename 1 octet ENTIER de 0x0 a 0xF et les cles sont ASCII V1S00 a V1S15
			# asservicename 1 octet ENTIER de 0x00 a 0xFF et les cles sont ASCII V1S00 a V1S99
			# le contrat d interface et le format ASN1 annoncent des valeurs sur 2 caracteres ce qui explique pourquoi on limite a 99
			asservicename_860026567 = 0
			asservicename_860026567 = i_get_art_field(g_iartin,$Tv2oip::ASServiceName + (indice_860026567 * 8))
			# valeur DASCII de asservicename
			erreur_860026567 = i_get_art_str(g_iartin,$Tv2oip::ASServiceName + (indice_860026567 * 8),pt_BUF1_860026567)
			erreur_860026567 = i_format_str2(pt_CLEcsv_860026567,"%s%s",C_str00_860026567,pt_BUF1_860026567)
			i_get_sub_str(pt_CLEcsv_860026567, -2, -1, pt_CLEcsv_860026567)

			SI ( asservicename_860026567 > 99 )
			ALORS
				SI b_FACTURABLE_860026567
				ALORS
					#trace( ">>>__LINE__>>> ERREUR table externe pour C_CSV => Envoi en erreur distri" )
					code_errone_860026567 = 0xA080
					code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
					erreur_860026567 = i_format_str2(pt_BUF2_860026567,"%s%s",C_strSIP_860026567, pt_BUF1_860026567)
					erreur_860026567 = i_PlvMessEmettre( 8605, 2, g_iartin,"", 3,code_errone_860026567, "Tv2oip/C_CSV la cle depasse 99 max", pt_BUF2_860026567)
					SAUT DISTRI_ERR
				SINON
					nb_csv_860026567 = 0
					i_strcpy(pt_csv_860026567,"")
					#trace(">>>__LINE__>>> non FACTURABLE mais cle depasse 99 => pas de C_CSV en sortie ")
					SAUT BOUCLE6FIN
				FINSI
			FINSI
			#trace2(">>__LINE__>> appel C_CSV cle  <OWL%s>",pt_CLEcsv,"")
# ---- new OP_CSV
			i_strcpy(pt_OP_CSVi_860026567,OP_CSV_860026233( C_strSIP_860026567, pt_CLEcsv_860026567, date_GMT_860026567 ))
			#trace2(">>__LINE__>>  OP_CSVi res  <%s>",pt_OP_CSVi,"")

			SI ( i_strcmp(pt_OP_CSVi_860026567,"")==0)
			ALORS
				SI b_FACTURABLE_860026567
				ALORS
					#trace( ">>>__LINE__>>> ERREUR lie a la table externe pour OP_CSV => Envoi en erreur distri" )
					code_errone_860026567 = 0xA080
					code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
					erreur_860026567 = i_format_str2(pt_BUF2_860026567,"%s%s",C_strSIP_860026567, pt_CLEcsv_860026567)
					erreur_860026567 = i_PlvMessEmettre( 8605, 2, g_iartin,"", 3,code_errone_860026567, "Tv2oip/OP_CSV", pt_BUF2_860026567)
					SAUT DISTRI_ERR
				SINON
					nb_csv_860026567 = 0
					i_strcpy(pt_csv_860026567,"")
					#trace(">>>__LINE__>>> non FACTURABLE mais ERREUR table externe => pas de C_CSV en sortie ")
					SAUT BOUCLE6FIN
				FINSI
			FINSI

			SI ( i_strlen(pt_OP_CSVi_860026567) < 1 )
			ALORS
				i_strcpy(pt_OP_CSVi_860026567," ")
			FINSI

			SI (i_strcmp(pt_OP_CSVi_860026567,"0")!=0)
			ALORS
				nb_csv_860026567 = nb_csv_860026567 + 1
			SINON
				SAUT BOUCLE6
			FINSI
# ---- Fin new OP_CSV
# ---- C_CSV
			i_strcpy(pt_C_CSVi_860026567,C_CSV_860026233( C_strSIP_860026567, pt_CLEcsv_860026567, date_GMT_860026567 ))
			#trace2(">>__LINE__>>	  C_CSVi res  <%s>",pt_C_CSVi,"")

			SI ( i_strcmp(pt_C_CSVi_860026567,"")==0)
			ALORS
				SI b_FACTURABLE_860026567
				ALORS
					#trace( ">>>__LINE__>>> ERREUR table externe pour C_CSV => Envoi en erreur distri" )
					code_errone_860026567 = 0xA080
					code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
					erreur_860026567 = i_format_str2(pt_BUF2_860026567,"%s%s",C_strSIP_860026567, pt_CLEcsv_860026567)
					erreur_860026567 = i_PlvMessEmettre( 8605, 2, g_iartin,"", 3,code_errone_860026567, "Tv2oip/C_CSV", pt_BUF2_860026567)
					SAUT DISTRI_ERR
				SINON
					nb_csv_860026567 = 0
					i_strcpy(pt_csv_860026567,"")
					#trace(">>>__LINE__>>> non FACTURABLE mais ERREUR table externe => pas de C_CSV en sortie ")
					SAUT BOUCLE6FIN
				FINSI
			FINSI
			taille_860026567 = i_strlen(pt_C_CSVi_860026567)

			SI ( taille_860026567 < 2 )
			ALORS
				#on ajoute un blanc a droite (cf CI E-BILL)
				erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s",pt_C_CSVi_860026567,"  ")
				i_get_sub_str(pt_BUF1_860026567, 0, 1, pt_C_CSVi_860026567)
			SINON
				i_get_sub_str(pt_C_CSVi_860026567, 0, 1, pt_C_CSVi_860026567)
			FINSI
# ---- Fin C_CSV
# ---- OP_CSV
# ---- Fin OP_CVS
			erreur_860026567 = i_format_str2(pt_BUF2_860026567,"%s%s",pt_csv_860026567,pt_C_CSVi_860026567)
			erreur_860026567 = i_format_str2(pt_csv_860026567,"%s%s",pt_BUF2_860026567,pt_OP_CSVi_860026567)
			#trace2(">>__LINE__>> ...pt_csv  <%s>",pt_csv,"")
		FINSI
	FINSI
	SAUT BOUCLE6
FINSI

POINT BOUCLE6FIN

#################### MISE AU FORMAT POUR ECC #################################

#------------------------------------------------------------------------------
# FEIP (Tfeip, g_iartout3)
#------------------------------------------------------------------------------

SI (flag_FEIP_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> Mise au format FEIP")
	# Duplication de l article

	SI (i_dup_art_dest(g_iartin,g_iartout3,C_Tfeip_860026567))
	ALORS
		#trace(">>>__LINE__>>>**********Erreur duplication Tv2oip vers FEIP")
		code_errone_860026567 = 0xA0D0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026567,C_Tfeip_860026567,C_Article_860026567)
		SAUT  DISTRI_ERR
	FINSI

	# SERVICE:	6 (artobj)

	# SOURCE
	erreur_860026567 = i_set_art_str(g_iartout3, $Tfeip::SOURCE, "16")

	# TYPCOM:	" "

	# NUMDDR
	erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s","0",pt_IDUS_NUM_860026567)
	erreur_860026567 = i_set_art_str(g_iartout3,$Tfeip::NUMDDR,pt_BUF1_860026567)

	# NUMDDE
	i_strcpy(pt_BUF1_860026567,pt_DEDE_BNC_860026567)
	i_replace_str(pt_BUF1_860026567,"BCD","*#+",pt_BUF1_860026567)

	SI (b_DTMF_860026567 != 0 && b_DTMF_transmis_860026567 == 1)
	ALORS
		i_strcpy(pt_BUF2_860026567,pt_BUF1_860026567)
		erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s",pt_DTMF_860026567,pt_BUF2_860026567)
	FINSI
	erreur_860026567 = i_set_art_str(g_iartout3,$Tfeip::NUMDDE,pt_BUF1_860026567)

	# DEBUT
	erreur_860026567=i_set_art_field(g_iartout3,$Tfeip::DEBUT,HLAHM1_860026567)

	# DUREE:	DUREE
	erreur_860026567=i_set_art_field(g_iartout3, $Tfeip::DUREE,DUR_860026567)

	# NBUT:	0 (artobj)
	#G4R6 Lot2 
	#SI (b_SRP_TIERS_PTD || b_118_TIERS_PTD)
	SI ( b_SRP_TIERS_PTD_860026567 || b_118_TIERS_PTD_860026567 ) && !b_Fact_CPS_Loc_860026567
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout3,$Tfeip::NBUT,vc_860026567)
	SINON
		erreur_860026567 = i_set_art_field(g_iartout3,$Tfeip::NBUT,0)
	FINSI

	# MTHSTD:	0 (dup)

	# CANAL:	0 (dup)

	erreur_860026567 = i_set_art_field(g_iartout3,$Tfeip::CANAL, ICID_CONVERTI_860026567)

	# NB_CSV, OP_CSVi, C_CSVi
	#trace(">>>__LINE__>>> Traitement des C_CSV et OP_CSV")

	erreur_860026567=i_set_art_field(g_iartout3, $Tfeip::NBCOD, nb_csv_860026567)
	#trace2(">>>__LINE__>>> *********** FEIP pt_csv=%s  *********",pt_csv,"")
	indice_860026567=0

	POINT BOUCLE10

	SI indice_860026567 < nb_csv_860026567
	ALORS
		i_strcpy(pt_C_CSVi_860026567," ")
		i_strcpy(pt_OP_CSVi_860026567," ")
		i_get_sub_str(pt_csv_860026567, indice_860026567 * 3, (indice_860026567 * 3) + 1, pt_C_CSVi_860026567 )
		i_get_sub_str(pt_csv_860026567, (indice_860026567 * 3) + 2, (indice_860026567 * 3) + 2 , pt_OP_CSVi_860026567 )
		#trace2(">>>__LINE__>>> *********** TRAF pt_csv pt_C_CSVi=%s  *********",pt_C_CSVi,"")
		#trace2(">>>__LINE__>>> *********** TRAF pt_csv pt_OP_CSVi=%s *********",pt_OP_CSVi,"")
		erreur_860026567=i_set_art_str( g_iartout3, $Tfeip::C_CSV1  + indice_860026567 * 2 ,pt_C_CSVi_860026567 )
		erreur_860026567=i_set_art_str( g_iartout3, $Tfeip::OP_CSV1 + indice_860026567 * 2 , pt_OP_CSVi_860026567)
		indice_860026567 = indice_860026567 + 1
		SAUT BOUCLE10
	FINSI
	#trace1( ">>>__LINE__>>> nb_csv = %d", nb_csv)

	# TYPACCRI:	1 (artobj)

	# SUPPORT:	0 (dup)
	SI (b_Visio_mobile_860026567 != 0)
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout3, $Tfeip::SUPPORT, "B")
	FINSI

	# NOCOMP:	" " (artobj)

	# NOORIG:	" " (artobj)

	# NATAPPRI:	1 (artobj)

	# CCD
	erreur_860026567 = i_set_art_field(g_iartout10, $Conversion::CCD, CCD_REEL_860026567)
	erreur_860026567 = i_get_art_str( g_iartout10, $Conversion::CCD, pt_BUF1_860026567 )
	#trace2(">>>__LINE__>>> CCD ASCII  <%s>",pt_BUF1, "")
	erreur_860026567 = i_format_str2( pt_BUF2_860026567, "%s%s", "000", pt_BUF1_860026567)
	i_get_sub_str (pt_BUF2_860026567, -3, -1,pt_BUF2_860026567)
	#trace2(">>>__LINE__>>> CCD ASCII 3 dig  <%s>",pt_BUF2, "")
	erreur_860026567 = i_set_art_str(g_iartout3,$Tfeip::CCD,pt_BUF2_860026567)

	# DDR_RMTA:	" " (artobj)

	#G4R6 Lot2 
	#CODE_TARIF
	erreur_860026567 = i_set_art_str(g_iartout3, $Tfeip::CODE_TARIF,pt_TARIF_860026567 )

	#TYPE_EDIT
	erreur_860026567 = i_set_art_str(g_iartout3, $Tfeip::TYPE_EDIT,pt_EDIT_860026567 )

FINSI

#------------
# FERV - G3R17lot2 ajout de FERPV,g_iartout12
#-------------

SI (flag_FERPV_860026567 == 1)
ALORS
	SI (i_dup_art_dest(g_iartin,g_iartout12,C_Tferpv_860026567))
	ALORS
		#trace(">>>__LINE__>>>**********Erreur duplication Tv2oip vers FERPV")
		code_errone_860026567 = 0xA0D0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8602,2,g_iartin,"",3,code_errone_860026567,C_Tferpv_860026567,C_Article_860026567)
		SAUT  DISTRI_ERR
	FINSI

	#SERVICE: 8 - QC362
	erreur_860026567 = i_set_art_str(g_iartout12, $Tfe_rpv::SERVICE, "8")

	# SOURCE
	erreur_860026567 = i_set_art_str(g_iartout12, $Tfe_rpv::SOURCE, "19")

	# TYPCOM:	" "

	# NUMDDR
	erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s","0",pt_IDUS_NUM_860026567)
	erreur_860026567 = i_set_art_str(g_iartout12,$Tfe_rpv::NUMDDR,pt_BUF1_860026567)

	# NUMDDE
	#------------------------------------------------------pk
	SI (b_DTMF_860026567 != 0 && b_DTMF_transmis_860026567 == 1)
	ALORS
		erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s",pt_DTMF_860026567,pt_DEDE_BNC_860026567)
	SINON
		SI (b_T3G_portabilite_860026567 == 1)
		ALORS
			erreur_860026567=i_get_art_str(g_iartout, $Tv2oip::AnswerIndicator , pt_BUF3_860026567 )
			SI (i_get_art_field(g_iartout, $Tv2oip::T3ASService1 + 4) == 20 && i_strcmp(pt_BUF3_860026567,"Yes") == 0)
			ALORS
				i_strcpy (pt_BUF1_860026567,pt_DEDE_BNC_860026567)
				i_get_sub_str(pt_DEDE_BNC_860026567,1,-1,pt_BUF1_860026567)
			SINON
				i_strcpy (pt_BUF1_860026567,pt_DEDE_NUM_860026567)
			FINSI
		SINON
			i_strcpy (pt_BUF1_860026567,pt_DEDE_NUM_860026567)
		FINSI
	FINSI
	erreur_860026567=i_set_art_str(g_iartout12,$Tfe_rpv::NUMDDE,pt_BUF1_860026567)

	# DEBUT
	erreur_860026567=i_set_art_field(g_iartout12,$Tfe_rpv::DEBUT,HLAHM1_860026567)

	# DUREE:	DUREE
	erreur_860026567=i_set_art_field(g_iartout12, $Tfe_rpv::DUREE,DUR_860026567)

	# NBUT:	0 (artobj)
	#G4R6 Lot2 
	#SI (b_SRP_TIERS_PTD || b_118_TIERS_PTD)
	SI ( b_SRP_TIERS_PTD_860026567 || b_118_TIERS_PTD_860026567 ) && !b_Fact_CPS_Loc_860026567
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout12,$Tfe_rpv::NBUT,vc_860026567)
	SINON
		erreur_860026567 = i_set_art_field(g_iartout12,$Tfe_rpv::NBUT,0)
	FINSI

	# MTHSTD:	0 (dup)

	# CANAL:	0 (dup)
	erreur_860026567 = i_set_art_field(g_iartout12,$Tfe_rpv::CANAL, ICID_CONVERTI_860026567)

	# NB_CSV, OP_CSVi, C_CSVi
	#trace(">>>__LINE__>>> Traitement des C_CSV et OP_CSV")

	erreur_860026567=i_set_art_field(g_iartout12, $Tfe_rpv::NBCOD, nb_csv_860026567)
	#trace2(">>>__LINE__>>> *********** FEIP pt_csv=%s  *********",pt_csv,"")
	indice_860026567=0

	POINT BOUCLE11

	SI indice_860026567 < nb_csv_860026567
	ALORS
		i_strcpy(pt_C_CSVi_860026567," ")
		i_strcpy(pt_OP_CSVi_860026567," ")
		i_get_sub_str(pt_csv_860026567, indice_860026567 * 3, (indice_860026567 * 3) + 1, pt_C_CSVi_860026567 )
		i_get_sub_str(pt_csv_860026567, (indice_860026567 * 3) + 2, (indice_860026567 * 3) + 2 , pt_OP_CSVi_860026567 )
		#trace2(">>>__LINE__>>> *********** TRAF pt_csv pt_C_CSVi=%s  *********",pt_C_CSVi,"")
		#trace2(">>>__LINE__>>> *********** TRAF pt_csv pt_OP_CSVi=%s *********",pt_OP_CSVi,"")
		erreur_860026567=i_set_art_str( g_iartout12, $Tfe_rpv::C_CSV1  + indice_860026567 * 2 ,pt_C_CSVi_860026567 )
		erreur_860026567=i_set_art_str( g_iartout12, $Tfe_rpv::OP_CSV1 + indice_860026567 * 2 , pt_OP_CSVi_860026567)
		indice_860026567 = indice_860026567 + 1
		SAUT BOUCLE11
	FINSI
	#trace1( ">>>__LINE__>>> nb_csv = %d", nb_csv)

	# TYPACCRI:	1 (artobj)

	# SUPPORT:	0 (dup)
	SI (b_Visio_mobile_860026567 != 0)
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout12, $Tfe_rpv::SUPPORT, "B")
	FINSI

	# NOCOMP:	" " (artobj)

	# NOORIG:	" " (artobj)

	# NATAPPRI:	1 (artobj)

	# CCD
	erreur_860026567 = i_set_art_field(g_iartout10, $Conversion::CCD, CCD_REEL_860026567)
	erreur_860026567 = i_get_art_str( g_iartout10, $Conversion::CCD, pt_BUF1_860026567 )
	#trace2(">>>__LINE__>>> CCD ASCII  <%s>",pt_BUF1, "")
	erreur_860026567 = i_format_str2( pt_BUF2_860026567, "%s%s", "000", pt_BUF1_860026567)
	i_get_sub_str (pt_BUF2_860026567, -3, -1,pt_BUF2_860026567)
	#trace2(">>>__LINE__>>> CCD ASCII 3 dig  <%s>",pt_BUF2, "")
	erreur_860026567 = i_set_art_str(g_iartout12,$Tfe_rpv::CCD,pt_BUF2_860026567)

	# DDR_RMTA:	" " (artobj)

	# ajout champ INFDDE : correction format de INFDDE
	SI (dede_inf_860026567 == 0x40 || (b_DTMF_860026567 != 0 && b_DTMF_transmis_860026567 == 1) )
	ALORS
		#erreur=i_set_art_field(g_iartout12, $Tfe_rpv::INFDDE,000)
		erreur_860026567=i_set_art_str(g_iartout12, $Tfe_rpv::INFDDE,"000")
	SINON
		erreur_860026567 = i_set_art_field(g_iartout10, $Conversion::INF, dede_inf_860026567)
		erreur_860026567 = i_get_art_str( g_iartout10, $Conversion::INF, pt_BUF1_860026567)
		erreur_860026567 = i_format_str2( pt_BUF2_860026567, "%s%s", "000", pt_BUF1_860026567)
		i_get_sub_str (pt_BUF2_860026567, -3, -1,pt_BUF2_860026567)
		erreur_860026567 = i_set_art_str(g_iartout12,$Tfe_rpv::INFDDE,pt_BUF2_860026567)
		#erreur=i_set_art_field(g_iartout12, $Tfe_rpv::INFDDE,dede_inf)
	FINSI

	#G4R6 Lot2 
	#CODE_TARIF
	erreur_860026567 = i_set_art_str(g_iartout12, $Tfe_rpv::CODE_TARIF,pt_TARIF_860026567 )

	#TYPE_EDIT
	erreur_860026567 = i_set_art_str(g_iartout12, $Tfe_rpv::TYPE_EDIT,pt_EDIT_860026567 )

FINSI

#------------------------------------------------------------------------------
# SC (Twoofact, g_iartout5) - G3R16 suppression ECC
#------------------------------------------------------------------------------

#----------------------------------------------------------------------------
# TRAFIC : (TtraficN, g_iartout9)
#----------------------------------------------------------------------------

SI (flag_TRAFIC_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> Mise au format Trafic")
	# Duplication de l article
	SI (i_dup_art_dest(g_iartin,g_iartout9,C_TtraficN_860026567))
	ALORS
		#trace(">>>__LINE__>>> Erreur de i_dup_art_dest pour TRAFIC")
		erreur_860026567 = i_PlvMessEmettre(8502,2,g_iartin,"",3,C_TtraficN_860026567,C_Article_860026567,g_ieec)
		SAUT  DISTRI_ERR
	FINSI

	#DOMAINE
	erreur_860026567=i_set_art_str(g_iartout9,$TtraficN::DOMAINE,"10")

	#SERVICE
	erreur_860026567=i_set_art_str(g_iartout9,$TtraficN::SERVICE,"06")

	#IDUS_INF
	erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::IDUS_INF,0x80)

	# E   (6:F0:1:$E  # E = 0)

	#IDUS_NUM et NDS_NUM
	i_strcpy(pt_BUF1_860026567, pt_IDUS_NUM_860026567)
	i_replace_str(pt_BUF1_860026567,"BCDF","*#+ ",pt_BUF1_860026567)

	#IDUS_NUM
	# G4R5 Lot2
	#SI ( ( SIP_Fibre == 0 ) && ( i_strcmp(pt_BANIP_RTC," ") != 0 ) && b_DATODEBI == 0 )
	#SI ( SIP_Fibre == 0 && i_strcmp(pt_BANIP_RTC," ") != 0 )
	#ALORS
	#	erreur=i_set_art_str(g_iartout9,$TtraficN::IDUS_NUM,pt_BANIP_RTC)
	#SINON
	#G4R6 Lot1
	#SI (i_strcmp(pt_OPT_RTC," ") != 0)
	#ALORS
	#	erreur=i_set_art_str(g_iartout9,$TtraficN::IDUS_NUM,pt_OPT_RTC)
	#SINON
	#	erreur=i_set_art_str(g_iartout9,$TtraficN::IDUS_NUM,pt_BUF1)
	#FINSI
	#FINSI
	erreur_860026567=i_set_art_str(g_iartout9,$TtraficN::IDUS_NUM,pt_BUF1_860026567)

	#NDS_NUM - ajout SIP_fibre
	# G4R5 Lot2
	#SI ( (SIP_Fibre == 0) && (i_strcmp(pt_BANIP_RTC," ") != 0 && b_DATODEBI == 0) || i_strcmp(pt_OPT_RTC," ") != 0 )
	#SI ( SIP_Fibre == 0 && i_strcmp(pt_BANIP_RTC," ") != 0 || i_strcmp(pt_OPT_RTC," ") != 0 )
	#G4R6 Lot1
	#SI ( i_strcmp(pt_OPT_RTC," ") != 0 )
	#ALORS
	#	erreur=i_set_art_str(g_iartout9,$TtraficN::NDS_NUM,pt_BUF1)
	#SINON
	#	erreur=i_set_art_str(g_iartout9,$TtraficN::NDS_NUM," ")
	#FINSI
	erreur_860026567=i_set_art_str(g_iartout9,$TtraficN::NDS_NUM," ")

	#DEDE_INF
	SI ( (dede_inf_860026567 == 0x40) || ( (b_DTMF_860026567 != 0) && (b_DTMF_transmis_860026567 == 1) ) )
	ALORS
		erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::DEDE_INF,0x00)
	SINON
		erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::DEDE_INF,dede_inf_860026567)
	FINSI

	#DEDE_NUM (pt_DTMF + pt_DEDE_NUM)
	SI (b_DTMF_860026567 != 0 && b_DTMF_transmis_860026567 == 1)
	ALORS
		erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s",pt_DTMF_860026567,pt_DEDE_BNC_860026567)
	SINON
		erreur_860026567 = i_get_art_str(g_iartout, $Tv2oip::AnswerIndicator , pt_BUF3_860026567 )
		SI b_T3G_portabilite_860026567 && ((i_get_art_field(g_iartout, $Tv2oip::T3ASService1 + 4) == 20) && (i_strcmp(pt_BUF3_860026567,"Yes") == 0))
		ALORS
			erreur_860026567 = i_get_art_str(g_iartout, $Tv2oip::DEDE_NUM,pt_BUF1_860026567)
			#erreur = i_set_art_str(g_iartout9,$TtraficN::DEDE_NUM,pt_BUF1)
		SINON
			i_strcpy(pt_BUF1_860026567,pt_DEDE_NUM_860026567)
		FINSI
	FINSI

	erreur_860026567 = i_set_art_str(g_iartout9,$TtraficN::DEDE_NUM,pt_BUF1_860026567)

	#ICAR
	erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::DATE,HLAHM1_860026567)

	#DUREE
	erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::DUREE,DUR_860026567)

	#CAX  (5:0:$CAX	#CAX = 0)

	#TAX
	#G4R6 Lot2 
	#SI (b_SRP_TIERS_PTD || b_118_TIERS_PTD || b_Emessage_IP == 1 )
	SI ( b_SRP_TIERS_PTD_860026567 || b_118_TIERS_PTD_860026567 || b_Emessage_IP_860026567 == 1 ) && !b_Fact_CPS_Loc_860026567
	ALORS
		#trace1(">>>__LINE__>>>********** TAX = vc=%d",vc)
		erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::TAX,vc_860026567)
	SINON
		#trace(">>>__LINE__>>>********** TAX nulle  = vc=0")
		erreur_860026567=i_set_art_field(g_iartout9,$TtraficN::TAX,0)
	FINSI

	#NDS_NUM

	#SUP (5:6:$SUP			#SUP = 6)

	# Test Visio_mobile pour G2R2CzNH
	SI (b_Visio_mobile_860026567 != 0)
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout9, $TtraficN::SUP, 4)
	FINSI

	#REF (5:0:$REF			#REF = 000)
	erreur_860026567 = i_set_art_field(g_iartout9, $TtraficN::REF, ICID_CONVERTI_860026567)

	#MES1 (5:0:$MES1		#MES1 = 000)

	#MES2 (5:0:$MES2		#MES2 = 000)

	# NB_CSV, OP_CSVi, C_CSVi
	#trace(">>>__LINE__>>> Traitement des C_CSV et OP_CSV")
	erreur_860026567=i_set_art_field(g_iartout9, $TtraficN::NB_CSV, nb_csv_860026567)
	#trace2(">>>__LINE__>>>*********** TRAF pt_csv=%s  *********",pt_csv,"")
	indice_860026567=0

	POINT BOUCLE7

	SI indice_860026567 < nb_csv_860026567
	ALORS
		i_strcpy(pt_C_CSVi_860026567," ")
		i_strcpy(pt_OP_CSVi_860026567," ")
		i_get_sub_str(pt_csv_860026567, indice_860026567 * 3, (indice_860026567 * 3) + 1, pt_C_CSVi_860026567 )
		i_get_sub_str(pt_csv_860026567, (indice_860026567 * 3) + 2, (indice_860026567 * 3) + 2 , pt_OP_CSVi_860026567 )
		#trace2(">>>__LINE__>>> *********** TRAF pt_csv pt_C_CSVi=%s  *********",pt_C_CSVi,"")
		#trace2(">>>__LINE__>>> *********** TRAF pt_csv pt_OP_CSVi=%s *********",pt_OP_CSVi,"")
		erreur_860026567=i_set_art_str( g_iartout9, $TtraficN::C_CSV1  + indice_860026567 * 2 ,pt_C_CSVi_860026567 )
		erreur_860026567=i_set_art_str( g_iartout9, $TtraficN::OP_CSV1 + indice_860026567 * 2 , pt_OP_CSVi_860026567)
		indice_860026567 = indice_860026567 + 1
		SAUT BOUCLE7
	FINSI
	#trace1( ">>>__LINE__>>> nb_csv = %d", nb_csv)

	#STY
	erreur_860026567=i_set_art_str(g_iartout9,$TtraficN::STY,"FF")

	#COCA (6:40:4:$COCA		#COCA = "    ")

	#COCAV (6:40:4:$COCAV		#COCAV = "    ")

	#IDAV_INF (6:F0:3:$IDAV_INF	#IDAV_INF = 000)

	#IDAV_NUM (6:40:20:$IDAV_NUM	#IDAV_NUM = "                    ")

	#SGTQS
	erreur_860026567=i_set_art_str(g_iartout9, $TtraficN::SGTQS, pt_sgtqs_860026567)

	#MNEMO (6:40:10:$MNEMO		#MNEMO = "          ")

	#CLASSDEST
	erreur_860026567=i_set_art_field(g_iartout9, $TtraficN::CLASSDEST, CCD_REEL_860026567)

	#OFFRE (6:40:6:$OFFRE		#OFFRE = "      ")
	#OPERATEUR (6:40:6:$OPERATEUR	#OPERATEUR = "      ")
	SI ((b_FFMV3_860026567 == 1) || (NM3_860026567 == 1))
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout9, $TtraficN::OFFRE,pt_CodOffreVG_860026567)
		erreur_860026567 = i_set_art_str(g_iartout9, $TtraficN::OPERATEUR,pt_CodOperVG_860026567)
	SINON
		erreur_860026567 = i_set_art_str(g_iartout9, $TtraficN::OFFRE,"      ")
		erreur_860026567 = i_set_art_str(g_iartout9, $TtraficN::OPERATEUR, "      ")
	FINSI

	#G4R6 Lot2 
	#CODE_TARIF
	erreur_860026567 = i_set_art_str(g_iartout9, $TtraficN::CODE_TARIF,pt_TARIF_860026567 )

	#TYPE_EDIT
	erreur_860026567 = i_set_art_str(g_iartout9, $TtraficN::TYPE_EDIT,pt_EDIT_860026567 )

FINSI

#FILLER (6:40:20:$FILLER		#FILLER = 14 blancs)

#----------------------------------------------------------------------------
# CENTVG : (TcentaureVG, g_iartout7)
#----------------------------------------------------------------------------

SI (flag_CENTAUREVG_860026567 == 1)
ALORS
	#trace1(">>>__LINE__>>> dup instCENTVG <%d>",instCENTVG)
	SI (i_dup_art_dest(g_iartin, g_iartout7, C_TcentaureVG_860026567))
	ALORS
		code_errone_860026567 = 0xA0D0
		code_errone_860026567 = code_errone_860026567 + b_EFFICACE_860026567
		erreur_860026567 = i_PlvMessEmettre(8602, 2, g_iartin, "", 3, code_errone_860026567, C_TcentaureVG_860026567, C_Article_860026567)
		SAUT DISTRI_ERR
	FINSI

	# DOMAINE
	erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::DOMAINE, "10")

	# SERVICE
	erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::SERVICE, "06")

	#IDUS_INF (5:000:$IDUS_INF)

	# IDUS_NUM
	erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::IDUS_NUM, pt_IDUS_NUM_860026567)

	# DEDE_INF (5:000:$DEDE_INF)
	SI (dede_inf_860026567 != 0x40 && (b_DTMF_860026567 != 1 || b_DTMF_transmis_860026567 !=1) )
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout7, $TcentaureVG::DEDE_INF, dede_inf_860026567)
	FINSI

	# DEDE_NUM (pt_DTMF + pt_DEDE_NUM)
	SI (b_DTMF_860026567 != 0 && b_DTMF_transmis_860026567 == 1)
	ALORS
		erreur_860026567 = i_format_str2(pt_BUF1_860026567,"%s%s",pt_DTMF_860026567,pt_DEDE_BNC_860026567)
	SINON
		erreur_860026567 = i_get_art_str(g_iartout, $Tv2oip::AnswerIndicator , pt_BUF3_860026567 )
		SI b_T3G_portabilite_860026567 && ((i_get_art_field(g_iartout, $Tv2oip::T3ASService1 + 4) == 20) && (i_strcmp(pt_BUF3_860026567,"Yes") == 0))
		ALORS
			erreur_860026567 = i_get_art_str(g_iartout, $Tv2oip::DEDE_NUM,pt_BUF1_860026567)
			#erreur = i_set_art_str(g_iartout7,$TcentaureVG::DEDE_NUM,pt_BUF1)
		SINON
			i_strcpy(pt_BUF1_860026567,pt_DEDE_NUM_860026567)
		FINSI
	FINSI

	erreur_860026567 = i_set_art_str(g_iartout7,$TcentaureVG::DEDE_NUM,pt_BUF1_860026567)

	# ICAR (DATE) HLAHM1
	erreur_860026567 = i_set_art_field(g_iartout7, $TcentaureVG::ICAR, HLAHM1_860026567)

	# DUR (DUREE)
	erreur_860026567 = i_set_art_field(g_iartout7, $TcentaureVG::DUR,DUR_860026567)

	# CAX
	erreur_860026567 = i_set_art_field(g_iartout7, $TcentaureVG::CAX,0)

	# TAX (vc)
	SI (b_SRP_TIERS_PTD_860026567 || b_118_TIERS_PTD_860026567)
	ALORS
		#trace1(">>>__LINE__>>>********** TAX = vc=%d",vc)
		erreur_860026567 = i_set_art_field(g_iartout7,$TcentaureVG::TAX,vc_860026567)
	SINON
		#trace(">>>__LINE__>>>**** TAX nulle  = vc=0")
		erreur_860026567 = i_set_art_field(g_iartout7,$TcentaureVG::TAX, 0)
	FINSI

	# NDS_NUM (6:20:1:$NDS_NUM)

	# SUP (6:36:1:$SUP)
	SI b_Visio_mobile_860026567
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout7,$TcentaureVG::SUP, 4)
	FINSI

	# REF (5:000:$REF)
	erreur_860026567 = i_set_art_field(g_iartout7,$TcentaureVG::REF, ICID_CONVERTI_860026567)

	# MES1 (5:000:$MES1)

	# MES2 (5:000:$MES2)

	# NB_CSV, OP_CSVi, C_CSVi
	#trace(">>>__LINE__>>> Traitement des C_CSV et OP_CSV")
	erreur_860026567 = i_set_art_field(g_iartout7, $TcentaureVG::nb_csv, nb_csv_860026567)
	#trace1( ">>>__LINE__>>> nb_csv = %d", nb_csv)
	#trace2(" >>>__LINE__>>>***** TCENTVG pt_csv=%s  *********",pt_csv,"")
	indice_860026567=0

	POINT BOUCLE8

	SI indice_860026567 < nb_csv_860026567
	ALORS
		i_strcpy(pt_C_CSVi_860026567," ")
		i_strcpy(pt_OP_CSVi_860026567," ")
		i_get_sub_str(pt_csv_860026567, indice_860026567 * 3, (indice_860026567 * 3) + 1, pt_C_CSVi_860026567 )
		i_get_sub_str(pt_csv_860026567, (indice_860026567 * 3) + 2, (indice_860026567 * 3) + 2 , pt_OP_CSVi_860026567 )
		#trace2(" >>>__LINE__>>>*** TCENTVG pt_csv pt_C_CSVi=%s  *********",pt_C_CSVi,"")
		#trace2(" >>>__LINE__>>>*** TCENTVG pt_csv pt_OP_CSVi=%s *********",pt_OP_CSVi,"")
		erreur_860026567=i_set_art_str( g_iartout7, $TcentaureVG::C_CSV1  + indice_860026567 * 2 ,pt_C_CSVi_860026567 )
		erreur_860026567=i_set_art_str( g_iartout7, $TcentaureVG::OP_CSV1 + indice_860026567 * 2 , pt_OP_CSVi_860026567)
		indice_860026567 = indice_860026567 + 1
		SAUT BOUCLE8
	FINSI

	# STY (6:46:2:$STY -> "FF")

	# COCA (6:20:1:$COCA)

	# COCAV (6:20:1:$COCAV)

	# IDAV_INF (5:000:$IDAV_INF)

	# IDAV_NUM
	i_strcpy(pt_BUF1_860026567," ")
	SI b_T3G_portabilite_860026567
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout7,$TcentaureVG::IDAV_NUM, pt_DEDE_NUM_PORTA_860026567 )
	SINON
		erreur_860026567 = i_set_art_str(g_iartout7,$TcentaureVG::IDAV_NUM, pt_BUF1_860026567 )
	FINSI

	# SGTQS
	erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::SGTQS, pt_sgtqs_860026567)

	# MNEMO (6:20:1:$MNEMO)
	# Champ CLASSDEST -> ' '

	# champ OFFRE
	# champ operateur
	SI ((b_FFMV3_860026567 == 1) || (NM3_860026567 == 1))
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::OFFRE,pt_CodOffreVG_860026567)
		erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::OPERATEUR,pt_CodOperVG_860026567)
	SINON
		erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::OFFRE,"      ")
		erreur_860026567 = i_set_art_str(g_iartout7,$TcentaureVG::OPERATEUR, "      ")
	FINSI

	# FILLER (6:20:21:$FILLER)

	#CODE_TARIF
	erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::CODE_TARIF,pt_TARIF_860026567 )

	#TYPE_EDIT
	erreur_860026567 = i_set_art_str(g_iartout7, $TcentaureVG::TYPE_EDIT,pt_EDIT_860026567 )
FINSI

#----------------------------------------------------------------------------
# Symphonie (TsymTv2oip, g_iartout6)
#----------------------------------------------------------------------------

SI (flag_SYMP_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> Duplication vers SYMPHONIE")
	erreur_860026567 = i_dup_art_id(g_iartin,g_iartout6)
	res_860026567 = i_rename_art(g_iartout6, C_TsymTv2oip_860026567)
	# ajout de tous les champs de T3ce
	erreur_860026567 = i_ajoutChampNum(g_iartout6, $TsymTv2oip::T4ccd,$TsymTv2oip::CCD,6)

	# ******* HLAHM1 (DATE_LOCALE)**********
	SI HLAHM1_860026567 != -1
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::DATE_LOCALE,HLAHM1_860026567)
	SINON
		erreur_860026567 = i_supprChamp(g_iartout6, "T4date_locale")
	FINSI

	# ************** SGTQS *****************
	erreur_860026567=i_set_art_str(g_iartout6,$TsymTv2oip::SGTQS,i_LireEECSGTQS( g_ieec ))

	# ************** ECC_FACT *****************
	#G4R6 Lot1
	#SI b_NPF_OPT
	#ALORS
	#	erreur=i_set_art_str(g_iartout6, $TsymTv2oip::ECC_FACT,"TRAFOPT")
	#SINON
	SI (i_strcmp(" ", pt_EccFact_860026567) != 0)
	ALORS
		erreur_860026567=i_set_art_str(g_iartout6, $TsymTv2oip::ECC_FACT,pt_EccFact_860026567)
	SINON
		erreur_860026567=i_set_art_str(g_iartout6, $TsymTv2oip::ECC_FACT," ")
	FINSI
	#FINSI

	# ************** CCD *****************
	# QC602 Modif provisoire du CCD pour Symphonie (CCD_SYMPHONIE)
	#SI CCD != -1
	SI TYPCOM_860026567 != -1
	ALORS
	#	erreur = i_set_art_field(g_iartout6,$TsymTv2oip::CCD,CCD_REEL)
	#QC607
	#	erreur = i_set_art_field(g_iartout6,$TsymTv2oip::CCD,CCD_SYMPHONIE)
		erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::CCD,TYPCOM_SYMPHONIE_860026567)
	SINON
		erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::CCD,255)
	FINSI

	# QC602 Ajout Champ TYPCOM pour Symphonie 
	# **************** TYPCOM ****************
	#QC607
	#	erreur = i_set_art_field(g_iartout6,$TsymTv2oip::TYPCOM,TYPCOM)
	erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::TYPCOM,TYPCOM_SYMPHONIE_860026567)
	# \QC602

	# champ OFF_VGA
	# champ OPE_VGA
	SI ( (b_FFMV3_860026567 == 1) || (NM3_860026567 == 1) )
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout6, $TsymTv2oip::OFF_VGA,pt_CodOffreVG_860026567)
		erreur_860026567 = i_set_art_str(g_iartout6, $TsymTv2oip::OPE_VGA,pt_CodOperVG_860026567)
	SINON
		erreur_860026567 = i_set_art_str(g_iartout6, $TsymTv2oip::OFF_VGA,"      ")
		erreur_860026567 = i_set_art_str(g_iartout6, $TsymTv2oip::OPE_VGA,"      ")
	FINSI

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

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

	# ***************** TAX1 UNITE1 *****************
	SI vc_860026567 != -1
	ALORS
		erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::TAX1,vc_860026567)
		erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::UNITE1,unite_860026567)
	SINON
		erreur_860026567=i_supprChamp(g_iartout6,"T4tax1")
	FINSI

	# ************** ND_RTC *****************
	# G4R5 Lot2 
	#G4R6 Lot1
	SI i_strcmp(pt_BANIP_RTC_860026567," ") != 0
	ALORS
		#trace2(">>>__LINE__>>> ND_RTC present pt_NDRTC = %s",pt_NDRTC,"")
		erreur_860026567=i_set_art_str(g_iartout6,$TsymTv2oip::ND_RTC_42L,pt_BANIP_RTC_860026567)
	SINON
		#trace2(">>>__LINE__>>> ND_RTC supprime pt_NDRTC = %s",pt_NDRTC,"")
		erreur_860026567 = i_supprChamp(g_iartout6, "T4ndrtc")
	FINSI

	# ************** IDUS_INF *****************
	erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::IDUS_INF,idus_inf_860026567)

	# ************** DETR_INF *****************
	erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::DETR_INF,dede_inf_860026567)

	# ************** EFFICACITE *****************
	erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::EFFICACITE,b_EFFICACE_860026567)

	# ************** NBCOD, CSV1, CSV2, CSV3, CSV4, CSV5, *****************
	#trace(">>>__LINE__>>> Traitement des CSVi  pour SYMPHONIE")
	#trace2(" *********** SYMPH pt_csv=%s  *********",pt_csv,"")
	erreur_860026567 = i_set_art_field(g_iartout6,$TsymTv2oip::NBCOD,nb_csv_860026567)
	indice_860026567 = 0

	POINT BOUCLE9

	SI indice_860026567 < nb_csv_860026567
	ALORS
		i_strcpy(pt_BUF1_860026567," ")
		i_get_sub_str( pt_csv_860026567, indice_860026567 * 3, (indice_860026567 * 3) + 2, pt_BUF1_860026567 )
		#trace2(" *********** SYMPH pt_csv pt_BUF1 =%s *********",pt_BUF1,"")
		erreur_860026567=i_set_art_str( g_iartout6, $TsymTv2oip::CSV1  + indice_860026567 * 3 ,pt_BUF1_860026567 )
		indice_860026567 = indice_860026567 + 1
		SAUT BOUCLE9
	FINSI

	SI nb_csv_860026567 < 1
	ALORS
		erreur_860026567 = i_supprChamp(g_iartout6, "T4nbcod")
		erreur_860026567 = i_supprChamp(g_iartout6, "T4csv1")
	FINSI

	SI nb_csv_860026567 < 2
	ALORS
		erreur_860026567 = i_supprChamp(g_iartout6, "T4csv2")
	FINSI

	SI nb_csv_860026567 < 3
	ALORS
		erreur_860026567 = i_supprChamp(g_iartout6, "T4csv3")
	FINSI

	SI nb_csv_860026567 < 4
	ALORS
		erreur_860026567 = i_supprChamp(g_iartout6, "T4csv4")
	FINSI

	SI nb_csv_860026567 < 5
	ALORS
		erreur_860026567 = i_supprChamp(g_iartout6, "T4csv5")
	FINSI
	# suppression T4idus, T4dede non voulus par Symphonie
	erreur_860026567 = i_supprChamp(g_iartout6, "T4idus")
	erreur_860026567 = i_supprChamp(g_iartout6, "T4dede")
	
	#G4R6 Lot2 
	SI b_ALICE_860026567
	ALORS
		erreur_860026567 = i_set_art_str(g_iartout6, $TsymTv2oip::CODE_TARIF,pt_TARIF_860026567 )
		erreur_860026567 = i_set_art_str(g_iartout6, $TsymTv2oip::TYPE_EDIT,pt_EDIT_860026567 )
	SINON
		erreur_860026567 = i_supprChamp(g_iartout6, "T4code_tarif")
		erreur_860026567 = i_supprChamp(g_iartout6, "T4type_edit")
	FINSI
FINSI

#----------------------------------------------------------------------------
# Readhawk (TrhawkTv2oip, g_iartout2)
#----------------------------------------------------------------------------


#----------------------------------------------------------------------------
# Casper (TcasperTv2oip, g_iartout11)
#----------------------------------------------------------------------------

SI (flag_CASPER_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> Duplication vers CASPER")
	erreur_860026567 = i_dup_art_id(g_iartin,g_iartout11)
	res_860026567 = i_rename_art(g_iartout11, C_TcasperTv2oip_860026567)
	# ajout de tous les champs de T3ce
	erreur_860026567 = i_ajoutChampNum(g_iartout11, $TcasperTv2oip::T4sgtqs,$TcasperTv2oip::SGTQS,6)

	# ************** SGTQS *****************
	erreur_860026567=i_set_art_str(g_iartout11,$TcasperTv2oip::SGTQS,i_LireEECSGTQS( g_ieec ))

	# ************** CODCIRDR (g_iartout10, $Conversion num hexa /tab hexa) *****************
	SI CODCIRDR_860026567 != -1
	ALORS
		#trace("[Tv2oip_dis]CODCIRDR est valide")
		i_strcpy(pt_BUF1_860026567, " ")
		erreur_860026567 = i_set_art_field(g_iartout10,$Conversion::CODCIRDR,CODCIRDR_860026567)
		erreur_860026567 = i_get_art_str(g_iartout10, $Conversion::CODCIRDA,pt_BUF1_860026567)
		SI  g_iartout10.CODCIRDA[2] > 9
		ALORS
			i_get_sub_str(pt_BUF1_860026567,2,5,pt_BUF1_860026567)
		SINON
			i_get_sub_str(pt_BUF1_860026567,1,5,pt_BUF1_860026567)
		FINSI
		erreur_860026567=i_set_art_str(g_iartout11, $TcasperTv2oip::CODCIRDR, pt_BUF1_860026567)
	SINON
		erreur_860026567=i_set_art_str(g_iartout11, $TcasperTv2oip::CODCIRDR, " ")
	FINSI

	# ***************** CODCIR (g_iartout10, $Conversion num hexa /tab hexa) *****************
	SI CODCIR_860026567 != -1
	ALORS
		#trace("[Tvoipvpn2_dis]CODCIR est valide")
		i_strcpy(pt_BUF2_860026567, " ")
		erreur_860026567 = i_set_art_field(g_iartout10,$Conversion::CODCIRDR,CODCIR_860026567)
		erreur_860026567 = i_get_art_str(g_iartout10, $Conversion::CODCIRDA,pt_BUF2_860026567)
		SI (g_iartout10.CODCIRDA[2] > 9)
		ALORS
			i_get_sub_str(pt_BUF2_860026567,2,5,pt_BUF2_860026567)
		SINON
			i_get_sub_str(pt_BUF2_860026567,1,5,pt_BUF2_860026567)
		FINSI
		erreur_860026567=i_set_art_str(g_iartout11, $TcasperTv2oip::CODCIR, pt_BUF2_860026567)
	SINON
		erreur_860026567=i_set_art_str(g_iartout11, $TcasperTv2oip::CODCIR, " ")
	FINSI

FINSI

#----------------------------------------------------------------------------
# DQD (TdqdTv2oip, g_iartout4)
#----------------------------------------------------------------------------

SI (flag_DQD_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> Duplication vers DQD")
	erreur_860026567 = i_dup_art_id(g_iartin,g_iartout4)
	res_860026567 = i_rename_art(g_iartout4, C_TdqdTv2oip_860026567)
	
	SI (i_valid_field_n(g_iartout4, $TdqdTv2oip::T3ce))
	ALORS
		erreur_860026567 = i_supprChamp(g_iartout4, "T3ce")
	FINSI
	
FINSI

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

#----------------------------------------------------------------------------
# SYMPHONIE (TsymTv2oip, g_iartout6)
#----------------------------------------------------------------------------

SI (flag_SYMP_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> emission vers Symphonie")
	erreur_860026567  = i_stocke_art_iecc(g_iartout6,instSYMP_860026567)
FINSI

#----------------------------------------------------------------------------
# REDHAWK (TrhawkTv2oip, g_iartout2)
#----------------------------------------------------------------------------


#----------------------------------------------------------------------------
# CASPER (TcasperTv2oip, g_iartout11)
#----------------------------------------------------------------------------

SI (flag_CASPER_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> emission vers Casper")
	erreur_860026567  = i_stocke_art_iecc(g_iartout11,instCASPER_860026567)
FINSI

#G3R24
#----------------------------------------------------------------------------
# DQD (TdqdTv2oip, g_iartout4)
#----------------------------------------------------------------------------

SI (flag_DQD_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> emission vers DQD")
	erreur_860026567  = i_stocke_art_iecc(g_iartout4,instDQD_860026567)
FINSI

#G4R8 QC861 bREDIST = 0 ==> pas de redistribution, bREDIST positif ou negatif ==> Redistribution
#SI bREDIST == 1
SI bREDIST_860026567 != 0
ALORS
	SAUT DISTRI_REDIST
FINSI

#---------------------------------------------------------------------------
# TRAFIC (TtraficN, g_iartout9)
#---------------------------------------------------------------------------

SI (flag_TRAFIC_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> emission vers TRAFIC")
	res_860026567 = i_stocke_art_iecc( g_iartout9, instTRAFIC_860026567 )
FINSI

#---------------------------------------------------------------------------
# FEIP (Tfeip, g_iartout3)
#---------------------------------------------------------------------------

SI (flag_FEIP_860026567 == 1)
ALORS
	#trace(">>>__LINE__>>> emission vers FEIP")
	res_860026567 = i_stocke_art_iecc( g_iartout3, instFEIP_860026567 )
FINSI

#---------------------------------------------------------------------------
# CENTVG (TCENTVG, g_iartout7)
#---------------------------------------------------------------------------

SI (flag_CENTAUREVG_860026567 == 1)
ALORS
	#trace1(">>>__LINE__>>> emission vers CENTVG instCENTVG=%d", instCENTVG)
	res_860026567 = i_stocke_art_iecc( g_iartout7, instCENTVG_860026567 )
FINSI

#----------------------------------------------------------------------------
# SC (Twoofact, g_iartout5) - G3R16 suppression ECC
#----------------------------------------------------------------------------


#---------------------------------------------------------------------------
# FERPV (Tferpv, g_iartout12) - QC366 : ajout FERPV
#---------------------------------------------------------------------------

SI (flag_FERPV_860026567 == 1)
ALORS
	res_860026567 = i_stocke_art_iecc( g_iartout12, instFERPV_860026567 )
FINSI

#trace(">>>__LINE__>>> Fin du Pcode de distribution Tv2oip")

RETOUR TRAIT_OK

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

POINT DISTRI_ERR

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

RETOUR TRAIT_OK

##############################################################################
# Envoi en recyclage
##############################################################################

POINT RECYCLE

#trace( ">>>__LINE__>>> Stockage de l'article Tv2oip en RECYCLAGE" )
res_860026567 = i_stocke_art( g_iartin, 0, PT_RECYCLE, 0 )

RETOUR TRAIT_OK

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

POINT ELIMINE_EXP

#trace( ">>>__LINE__>>> Stockage en elimine explicite")
res_860026567 = 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_860026567 = i_add_opt( "EnomEEC" )
res_860026567 = i_set_attr_str_n($EnomEEC::Nom_EEC, pt_sgtqs_860026567)
#G4R6 Lot2
#trace1( "__LINE__: Fin du Pcode de distribution : Stockage en REDISTRIBUTION CPT = : <%d> ", CPT_RDT_860025985 )
# On envoie l alarme 8503 uniquement pour la redistri Maj2G 
#G4R7 Lot3 QC833
#SI ( CPT_RDT == 0 )
#G4R8 QC861  Pas de message si redistribution IP (BANIP)
#SI ( ( CPT_RDT == 0 ) && ( bREDISTMAJ2G == 1 ) )
SI ( ( CPT_RDT_860026567 == 0 ) && ( bREDIST_860026567 > 0 ) )
ALORS
	erreur_860026567 = i_PlvMessEmettre(8503,2,g_iartin,"",3,pt_LIBELREDIST_860026567,C_Article_860026567,pt_sgtqs_860026567)
FINSI

res_860026567 = i_stocke_art( g_iartin, 0, PT_REDIST|RD_TABLE6, 0 )

RETOUR TRAIT_OK

#--------------Fin Pcode Distribution Tv2oip_dis.src------------------------
