Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2806

Re: Stored Procedure for delivery quantity more than A/R reserve invoice quantity

$
0
0

Hi,

 

Try this:

 

IF @transaction_type IN (N'A', N'U') AND

(@Object_type = N'15')

begin

if exists (SELECT T0.BaseEntry, SUM(T0.Quantity)

FROM dbo.DLN1 T0 INNER

JOIN dbo.INV1 T1 ON T1.DOCENTRY =

T0.BASEENTRY inner join dbo.OINV T2 on T2.docentry = T1.docentry

WHERE T0.BaseType = 17 AND T0.ItemCode =

T1.ItemCode AND T0.BaseLine = T1.LineNum  and T2.[isIns] = 'y'

and T0.DOCENTRY = @list_of_cols_val_tab_del

GROUP BY T0.BaseEntry

HAVING (SUM(T0.Quantity) > SUM(T1.Quantity)) or sum(t0.quantity) >

sum(t0.BaseOpnQty))

begin

select @Error = 10, @error_message = 'Delivery quantity is greater than Reserve qty.'

 

Thanks


Viewing all articles
Browse latest Browse all 2806

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>