--msg-num = -1  
--msg-num = -2 
--msg-num = -3 
--msg-num = -4 
--msg-num = -5 خطاي سيستم
-- اين پروسيجر يک کالا را به صورت کامل به تمپ حواله اضافه مي کند

CREATE    PROCEDURE [dbo].[Add_One_Kala_Drug]  @msg_num Numeric(18,0) OUTPUT, 
                                                                             @IdHavaleh Numeric(18,0), @Sender Varchar(5),
  				                          @Reciver Varchar(5),@HK_Code VarChar(15) ,  
				                          @HK_Qty Real, @Status Char(1),
				                          @Price_Forosh Money, @MainPrice Money,@TotDiffer Money,
                                                                             @Exp Bit , @Point Bit , @Serial Bit , @Takhfif Char(1), 
                                                                             @Hamrah Bit, @Make  Bit,@CtrMojodi  Char(1), @Radif Smallint , @Autoid Numeric(9), @bimarPercent real   As
				 
			                                                                      
-------------------------------------------------------------------------------------------------------------------------------------------

Begin Tran AddonKala


Insert Into Dbo.TmpDrugHavaleh (Id_Havaleh,Sender,Reciver,K_Code,K_Qty1,Price_Forosh,Exp_Flag, Point_Flag,Serial_Flag,Make_Flag,Hamrah_Flag,CtrMojodi, Status, Main_Price, Tot_Differ,Radif, Link_Record, BimarPercent)
                        Values (@IdHavaleh,@Sender,@Reciver,@HK_Code,@HK_Qty, @Price_Forosh,  @Exp, @Point, @Serial, @Make, @Hamrah  ,@CtrMojodi, @Status, @MainPrice, @TotDiffer,@Radif, @Autoid, @bimarPercent) 

 
If @@Error > 0  
Begin
    Set @msg_num=-5  
    ROLLBACK TRANSACTION AddonKala
    RETURN @msg_num
End
Else
 Commit tran AddonKala
