cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling Document Discount Field

Former Member
0 Kudos

Hi All

I want to disable the document the discount field on the sales order document.

How can I achieve this ? I don't want the users to be able to change the discount value in the document level.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bongani

You must use Form settings for this. Unfortunately each user that you want to remove it for must be logged on and you must do it in their session.

Kind regards

Peter Juby

Former Member
0 Kudos

Hi Peter

The document lines are fine .... I've disabled the fiels there the problem i'm having not is with the discount field just below the "Total before discount" .

thanks

former_member583013
Active Contributor
0 Kudos

The Discount field at the Document level CANNOT be disabled / hidden.

Suda

Former Member
0 Kudos

Hi Suda

Is there a work around for this , as this has course some major issues when orders are added on the system ?

Thanks

former_member583013
Active Contributor
0 Kudos

Probably using SDK.

Former Member
0 Kudos

Hi Suda

Can it be done via SBO_TransactionNotification ?

Former Member
0 Kudos

There is a way with SDK as Suda wrote or use transaction notification stored procedure - when the order has some value in discount field, dont allow insert order.

Former Member
0 Kudos

Hi Petr

Thanks, please assist me with regards to the transaction notification ....

this is my code

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

go

ALTER proc [dbo].[SBO_SP_TransactionNotification]

@object_type nvarchar(25), -- SBO Object Type

@transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose

@num_of_cols_in_key int,

@list_of_key_cols_tab_del nvarchar(255),

@list_of_cols_val_tab_del nvarchar(255)

AS

begin

-- Return values

declare @error int -- Result (0 for no error)

declare @error_message nvarchar (200) -- Error string to be displayed

select @error = 0

select @error_message = N'Ok'

IF @transaction_type = 'A'AND @object_type = '17'

BEGIN

If exists (SELECT T0.cardcode FROM ORDR T0 where T0.DiscPrcnt > 0 and T0.cardcode=@list_of_cols_val_tab_del)

begin

SET @error = 10

SET @error_message = N' Document can't be added, document discount must not be specified'

END

END

IF @transaction_type = 'A' AND @object_type = '2'

BEGIN

If exists (SELECT T0.cardcode FROM ocrd T0 where T0.FatherCard is null and T0.GroupNum = '1' and T0.cardcode=@list_of_cols_val_tab_del)

begin

SET @error = 10

SET @error_message = N'Consolidating BP not entered under accounting tab (Only cash customers)'

end

END

select @error, @error_message

END

Former Member
0 Kudos

add there

if @object_type = '17' and @transaction_type in (N'A', N'U')
begin
    if 1 = (select count(docentry) from ordr with(nolock) where docentry =@list_of_cols_val_tab_del and discsum > 0)
		begin
			select @error =1
		select @error_message = 'Discount is filled.'

		end

end

Answers (3)

Answers (3)

Former Member
0 Kudos

You can manage all fields visibility with the help of Softline Solutions add-on "Interface Extension"

keith_taylor2
Active Contributor
0 Kudos

You could easily hide this field using the Boyum IT product

Former Member
0 Kudos

Hi Bongani,

I have the same as matter about disable discount changing. I use set Form Setting and untick in active column. After that, please right on click to menu bar so user can not change this discount.

I hope it will work.

Regards,

Agung

Former Member
0 Kudos

Hi Agung

I'm not sure if I follow what you saying , please elaborate

Thanks

Bongani

former_member200818
Contributor
0 Kudos

I would request you to try the following options:

Option 1. Use Authorization:

Step1: Access Authorization window. To access the Authorizations window, choose Administration -> System Initialization -> Authorizations .

Step2: for users (who are not superusers), set Max Discount to 0.01 (as per your max decimal places configured in General Settings-> Display).

Max. Discount: Specify the maximum discount that the user is authorized to enter in customer master records or sales documents.

Please note, this option will not work for superusers and will restrict discount entry in all sales documents (not only sales order as you require).

Option 2. Use Stored Procedure:

Step1: Access Authorization window. To access the Authorizations window, choose Administration -> System Initialization -> Authorizations .

Step2: for users (who are not superusers), set Max Discount to 0.01 (as per your max decimal places configured in General Settings-> Display).

Max. Discount: Specify the maximum discount that the user is authorized to enter in customer master records or sales documents.

Please note, this option will not work for superusers and will restrict discount entry in all sales documents (not only in sales order as you require).

*Option 2. SBOSP_TransactionNotification*:_

IF(@object_type='17') -- Sales Order object value: 17

BEGIN

-- if transaction type is equal to 'add' (please note this line is sql comment)

IF(@transaction_type='A')

BEGIN

-- if current business partner master - website field is having null/ less than 3 characters, then show error (please note this line is sql comment)

IF Exists (SELECT T0.cardcode FROM ORDR T0 where (T0.DocEntry=@list_of_cols_val_tab_del) and (T0.DiscPrcnt > 0))

BEGIN

set @error = 2001

set @error_message = N'You are not authorized to edit/ enter discount.'

END

ELSE

-- show successful message (please note this line is sql comment)

BEGIN

set @error = 0

set @error_message = N'Ok'

END

END

END

Hope the information is helpful to resolve your issue.

Good Luck.

Thanks & Regards

Satish