1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Update AMIELEC_MSCRM.dbo.AccountBase
SET AccountCategoryCode=@catcomptaInt,TerritoryId=@conv_pays,DefaultPriceLevelId=@id_tarif,
OwningUser=@id_utilisateur,AccountNumber=@numpayeur,Description=@intitule,WebSiteURL=@site,EMailAddress1=@mail,
Telephone1=@telephone,Fax=@fax,ParentAccountId=@idnom_parent,StatusCode=1,StateCode=0,DeletionStateCode=0
where Name=@Num
Print('maj du client'+@num)
if @@rowcount=0
BEGIN
--INSERTION DANS LES TABLES DE LA CRM
insert into AMIELEC_MSCRM.dbo.AccountBase(AccountId,OwningBusinessUnit,AccountCategoryCode,TerritoryId,DefaultPriceLevelId,
CustomerSizeCode,PreferredContactMethodCode,PreferredAppointmentDayCode,PreferredAppointmentTimeCode,CustomerTypeCode,AccountRatingCode,IndustryCode,TerritoryCode,
AccountClassificationCode,BusinessTypeCode,OwningUser,OriginatingLeadId,PrimaryContactId,Name,AccountNumber,Revenue,NumberOfEmployees,Description,SIC,OwnershipCode,MarketCap,
SharesOutstanding,TickerSymbol,StockExchange,WebSiteURL,FtpSiteURL,EMailAddress1,EMailAddress2,EMailAddress3,Telephone1,DoNotPhone,DoNotFax,DoNotEMail,DoNotSendMM,DoNotPostalMail,DoNotBulkEMail,DoNotBulkPostalMail,
Telephone2,Fax,Telephone3,CreditLimit,CreditOnHold,ParentAccountId,StatusCode,StateCode,DeletionStateCode)
values(NEWID(),@businness_unit,@catcomptaInt,@conv_pays,@id_tarif,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,@id_utilisateur,
Null,Null,@num,@numpayeur,Null,Null,@intitule,Null,Null,Null,Null,Null,Null,@site,Null,@mail,Null,Null,@telephone,0,0,0,0,0,0,Null,Null,@fax,Null,Null,Null,@idnom_parent,1,0,0)
Print('insert du client'+@num)
print(@@IDENTITY)
END
Update AMIELEC_MSCRM.dbo.AccountExtensionBase
SET New_Identifiant=@identifiant_client,New_TypePersonne=@type_pers_char,New_categorie_comptable=@catcomptaChar,
New_representant=@un_representant,New_contacts=@contact,New_descriptif=@intitule
where New_societe=@Num
Print('maj du client'+@num)
if @@rowcount=0
BEGIN
insert into AMIELEC_MSCRM.dbo.AccountExtensionBase(AccountId,New_Identifiant,New_TypePersonne,New_categorie_comptable,New_representant,New_prenom_representant,New_nom_representant,New_contacts,New_societe,New_descriptif)
values(NEWID(),@identifiant_client,@type_pers_char,@catcomptaChar,@un_representant,null,null,@contact,@num,@intitule)
Print('insert du client'+@num)
END |
Partager