on 04-14-2010 12:38 PM
Hi,
I am working on an requirement.
we need to stop adding of outgoing/incoming payments when the cash payment is more than 20000.
i tried to solve this using notification procedures.
here is a sample code of mine
if (@object_type='46' and @transaction_type in ('A','U'))
BEGIN
--set @sum= (SELECT sum(T0.[CashSum]) FROM OVPM T0 WHERE T0.[DocDate] =(SELECT T0.[DocDate] FROM OVPM T0 WHERE T0.[DocNum]=@list_of_cols_val_tab_del) and T0.[CardCode] =(SELECT T0.[CardCode] FROM OVPM T0 WHERE T0.[DocNum]=@list_of_cols_val_tab_del))
--set @tot= (SELECT T0.[CashSum] FROM OVPM T0 WHERE T0.[DocNum]=@list_of_cols_val_tab_del)
if exists(SELECT [DocTotal] FROM [dbo].OVPM T0 WHERE T0.[DocTotal] > 100 and T0.[DocEntry]=@list_of_cols_val_tab_del)
begin
set @error = '-500'
set @error_message = 'Cash Payments should not exceed 20000, Payemnts Done for '
end
END
it is not working can u please help me to solve the problem.
Thanks,
Mahi
Try tis one:
IF @Object_type = N'46'
Begin
If (select CashSum from OVPM
where DocEntry=@list_of_cols_val_tab_del)>20000
Select @error = 22,
@error_message = N'Cash payment should not exceed 20000 !'
End
(Insert this in your SBO_SP_TransactionNotification stored procedure after the line
-- ADD YOUR CODE HERE )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
Try this
IF (@object_type = '46' AND @transaction_type in (N'A', N'U') )
BEGIN
IF EXISTS (SELECT T0.[DocTotal] FROM OVPM T0
WHERE ( T0.[DocTotal] < 20000) AND T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
Set @error =1
set @error_message = ''Cash Payments should not exceed 20000, Payemnts Done for '
SELECT @error , @error_message
END
END
Thanks
Kevin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kevin
Thanks for the reply. the query that i mentioned above involes the sum of payments for the vendor and other details .
i even tried your query.. these are working fine when the document id updating.. but not working when the document id adding..
i.. tried with out any query as below..
if (@object_type='46' and @transaction_type ='A')
BEGIN
select @error = '-500'
select @error_message = @list_of_cols_val_tab_del
--end
END
this has to be triggered when the document is adding.. but unable.. where as the same logic works fine for othe documents like PO, GRPO, Invoice..
Can u check this once..
Thanks,
Mahi.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.