;----------- This Update After 4.1.1 Version -------------------
Declare
	@ExcRun Nvarchar(Max)
;------- Update Ordinal Type-----------------------------------------
Update [dbo].[tbl_DitasCodedList]
	Set Name = 'منفی (-)'
	where code='0'
Update [dbo].[tbl_DitasCodedList]
	Set Name='خفیف (+)'
	where code='1'
Update [dbo].[tbl_DitasCodedList]
	Set Name='متوسط (++)'
	where code='2'
Update [dbo].[tbl_DitasCodedList]
	Set Name='شدید (+++)'
	where code='3'
Update [dbo].[tbl_DitasCodedList]
	Set Name='بسیار شدید (++++)'
	where code='4'
;------Create Table ----------------------------------------
If [dbo].[Fn_GetExists_Object]('Rasa_InsuranceLists') = 0
Begin
Create Table
	[dbo].[Rasa_InsuranceLists](
		[Id] [smallint] IDENTITY(1,1) NOT NULL,
		[InsuranceCode] [varchar](100) NOT NULL,
		[InsuranceName] [nvarchar](150) NOT NULL,
 CONSTRAINT [PK_Rasa_InsuranceLists] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
End

IF [dbo].[Fn_GetExistsColumnInTable]('tblReception','mOnlineRecNoTakmili') = 0
Begin
Alter Table [dbo].[tblReception] Add [mOnlineRecNoTakmili] Varchar(50) Null
End
IF [dbo].[Fn_GetExistsColumnInTable]('tblRecItems','RepeatTest') = 0
Begin
Alter Table [dbo].[tblRecItems] Add [RepeatTest] Int Null
End

;----------------------------------------------------
Alter Table [dbo].[tblUsers] Alter Column [mCanPatientInfo] Bit Null

;-------------------- Drop Fuction ---------------------------------------------------------------------------
If [dbo].[Fn_GetExists_Object]('Fn_TaminPrescriptionOld_GetReceptionId') = 1
begin
	Drop Function dbo.Fn_TaminPrescriptionOld_GetReceptionId
End
If [dbo].[Fn_GetExists_Object]('Fn_TaminPrescriptionOld_GetRow') = 1
begin
	Drop Function dbo.Fn_TaminPrescriptionOld_GetRow
End
If [dbo].[Fn_GetExists_Object]('Fn_RasaInsuranceLists_GetTable') = 1
begin
	Drop Function dbo.Fn_RasaInsuranceLists_GetTable
End
If [dbo].[Fn_GetExists_Object]('Fn_Reception_GetRow') = 1
begin
	Drop Function dbo.Fn_Reception_GetRow
End
If [dbo].[Fn_GetExists_Object]('Format') = 1
begin
	Drop Function dbo.Format
End
If [dbo].[Fn_GetExists_Object]('Fn_Reception_GetTableDitasLoags') = 1
begin
	Drop Function dbo.Fn_Reception_GetTableDitasLoags
End

If [dbo].[Fn_GetExists_Object]('Fn_Insures2_GetTable') = 1
begin
	Drop Function dbo.Fn_Insures2_GetTable
End
If [dbo].[Fn_GetExists_Object]('Fn_RecItems_GetItemsGroupBy') = 1
begin
	Drop Function dbo.Fn_RecItems_GetItemsGroupBy
End

;------------------- Drop Proc -------------------------------------------------------------------------------
If [dbo].[Fn_GetExists_Object]('Pr_Reception_GetHistoryColumn') = 1
begin
	Drop Procedure dbo.Pr_Reception_GetHistoryColumn
End
If [dbo].[Fn_GetExists_Object]('Pr_TaminPrescriptionOld_SetReceptionId') = 1
begin
	Drop Procedure dbo.Pr_TaminPrescriptionOld_SetReceptionId
End
If [dbo].[Fn_GetExists_Object]('Pr_Options_UpdateNameAndValue') = 1
begin
	Drop Procedure dbo.Pr_Options_UpdateNameAndValue
End
If [dbo].[Fn_GetExists_Object]('Pr_Reception_SetOnlineRecNoTakmili') = 1
begin
	Drop Procedure dbo.Pr_Reception_SetOnlineRecNoTakmili
End
If [dbo].[Fn_GetExists_Object]('Pr_Insures2_InsertOrUpdate') = 1
begin
	Drop Procedure dbo.Pr_Insures2_InsertOrUpdate
End
If [dbo].[Fn_GetExists_Object]('Pr_Insures2_Delete') = 1
begin
	Drop Procedure dbo.Pr_Insures2_Delete
End
If [dbo].[Fn_GetExists_Object]('Pr_Doctors_UpdateDitas') = 1
begin
	Drop Procedure dbo.Pr_Doctors_UpdateDitas
End



