if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TD_TotPrice]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[TD_TotPrice]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TI_TotPrice]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[TI_TotPrice]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TU_TotPrice]') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
drop trigger [dbo].[TU_TotPrice]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SearchKhordehForoshi]') and xtype in (N'FN', N'IF', N'TF'))
drop function [dbo].[SearchKhordehForoshi]


IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sodor_Factor]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sodor_Factor]


IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sp_SodorFactor_Retail]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sp_SodorFactor_Retail]



IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sp_CalcTotPriceFactor]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sp_CalcTotPriceFactor]


IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[CheckMandeh10000]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[CheckMandeh10000]

IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sodor_Over_Under]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sodor_Over_Under]


IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sodor_Vajeh]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sodor_Vajeh]

IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sp_RepSalesStatus]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sp_RepSalesStatus]


IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'[dbo].[Sp_RepReturnSalesStatus]')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 )
    DROP PROCEDURE [dbo].[Sp_RepReturnSalesStatus]


