$1 PROCEDURE [dbo].[FastSell_v2_STOK_BEDEN_HAREKET_EKLE]
@sth_guid varchar(42),
@barkod varchar(40),
@miktar float
AS
DECLARE @beden_no int,@renk_pntr tinyint,@beden_pntr tinyint
SELECT @beden_pntr=bar_bedenpntr,@renk_pntr=bar_renkpntr FROM BARKOD_TANIMLARI WHERE bar_kodu=@barkod
if @renk_pntr > 0 AND @beden_pntr>0
			set @beden_no=(((@renk_pntr -1) * 4) * 10) + @beden_pntr
		else if @beden_pntr>0
			set @beden_no=@beden_pntr
		else if @renk_pntr>0
		BEGIN
		IF @renk_pntr=1
		BEGIN
		set @beden_no=1
		END
		ELSE
			set @beden_no=(((@renk_pntr-1)*4 )* 10) +1
		END

IF EXISTS(SELECT     BdnHar_Guid  FROM         BEDEN_HAREKETLERI  WHERE     (BdnHar_Har_uid = @sth_Guid) AND (BdnHar_BedenNo = @beden_no))
			UPDATE  BEDEN_HAREKETLERI SET BdnHar_HarGor=@Miktar WHERE (BdnHar_Har_uid = @sth_Guid) AND (BdnHar_BedenNo = @beden_no)
INSERT INTO BEDEN_HAREKETLERI
                         (BdnHar_Guid, BdnHar_DBCno, BdnHar_Spec_Rec_no, BdnHar_iptal, BdnHar_fileid, BdnHar_hidden, BdnHar_kilitli, BdnHar_degisti, BdnHar_checksum, BdnHar_create_user, BdnHar_create_date, BdnHar_lastup_user, 
                         BdnHar_lastup_date, BdnHar_special1, BdnHar_special2, BdnHar_special3, BdnHar_Tipi, BdnHar_Har_uid, BdnHar_BedenNo, BdnHar_HarGor, BdnHar_KnsIsGor, BdnHar_KnsFat, BdnHar_TesMik, 
                         BdnHar_rezervasyon_miktari, BdnHar_rezerveden_teslim_edilen)
VALUES        (NEWID(), 0, 0, 0, 113, 0, 0, 0, 0, 1, GETDATE(), 1, GETDATE(), N'', N'', N'', 11,@sth_guid,@beden_no,@miktar, 0, 0, 0, 0, 0)
