

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,
	@price_kharid MONEY
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,
    Price_Forosh_O,
	Price_Kharid
)
VALUES
(@IdHavaleh, @Sender, @Reciver, @HK_Code, @HK_Qty, @Price_Forosh, @Exp, @Point, '1', @Make, @Hamrah, @CtrMojodi,
 @Status, @MainPrice, @TotDiffer, @Radif, @Autoid, @bimarPercent, @Price_Forosh,@price_kharid);


IF @@Error > 0
BEGIN
    SET @msg_num = -5;
    ROLLBACK TRANSACTION AddonKala;
    RETURN @msg_num;
END;
ELSE
    COMMIT TRAN AddonKala;
