
ALTER  PROCEDURE [dbo].[sp_mb_XML_StokHarDurumUpdateDelphi]     
/* 2020 01 16 a.t güncelleme fatno*/
/*2021 07 17 a.t entegrator*/
 @IslemNo int,    
 @eFaturaGonderimTarihi DateTime,     
 @eFaturaDurumu nvarchar(20),    
 @UUID nvarchar(60),    
 @Efaturano nvarchar(60)='',
 @Entegrator int=0,
 @ProcessType int=1
AS     
update STK    
 set    
  UUID=@UUID,     
  eFaturaGonderimTarihi=@eFaturaGonderimTarihi,     
  eFaturaDurumu=@eFaturaDurumu  ,    
  eFaturaNo=case when @ProcessType<>3 then  @Efaturano   else '' end,
 IrsNo=	case when @ProcessType=3 then case when @Efaturano<>'' then @Efaturano else IrsNo end else IrsNo end
 ,FatSerNo=case when @ProcessType<>3 then case when @Efaturano<>'' then  convert(varchar(3),left(@Efaturano,3)) else FatSerNo end  else ''  end
 ,STK.FaturaNo=case when @ProcessType<>3 then  case when @Efaturano<>'' then  right (@eFaturaNo,10) else STK.FaturaNo end else '' end
 ,Entegrator=@Entegrator
 from STOKHARDETBAG STK

  where   (STK.IslemNo=@IslemNo OR STK.IslemNo3=@IslemNo);  
