Friday, 25 September 2020
Customer/Vendor JE+Outgoing Payment+Incomeing Payment with SP Notification
------------------------- JE BP Transaction Blocked--------------------------------------------------------------------------
IF @object_type = N'30' AND @transaction_type IN ('A', 'U')
BEGIN
If exists
(
Select T0.TransId
From Ojdt T0
left join jdt1 t1 on t0.TransId = t1.TransId
left join ocrd t2 on t1.ShortName = t2.CardCode
Where T0.TransId = @list_of_cols_val_tab_del and t2.GlblLocNum = 'N'
)
BEGIN
SELECT @Error = 10
SELECT @error_message = 'BLOCK FOR PAYMENT -GST NOT UPLODED IN PORTAL'
END
END
-----------------------------------------
---------------------------JE BP TransactionBlocked---------------------------------------
IF @object_type = N'46' AND @transaction_type IN ('A', 'U')
BEGIN
If exists
(
Select T0.DocEntry
From Ovpm T0
inner join ocrd t2 on t0.cardcode = t2.CardCode
Where T0.DocEntry = @list_of_cols_val_tab_del and t2.GlblLocNum = 'N'
)
BEGIN
SELECT @Error = 10
SELECT @error_message = 'BLOCK FOR PAYMENT -GST NOT UPLODED IN PORTAL'
END
END
--------------------------------------------------------------------------------------------------------------------------------
------------------------Purchase Document-----------(290000)---------------------
-- ADD YOUR CODE HERE
IF( @object_type = '22' and @transaction_type in ('A','U'))
BEGIN
IF Exists (SELECT ITEMCODE FROM POR1
WHERE DOCENTRY=@list_of_cols_val_tab_del
and ITEMCODE NOT IN (SELECT CODE FROM ITT1)
AND (ITEMCODE LIKE 'G%' OR ITEMCODE LIKE 'L%' OR ITEMCODE LIKE 'N%'))
BEGIN
Begin
Select @error = 290001, @error_message = 'ITEM CODE DOES NOT EXIST IN BILL OF MATERIAL'
End
END
END
------------------------------------------Purchase Order only One item code Require-----(290000)---------------------------------------------------------------------------------
IF (@Object_type = '22') AND @transaction_type IN ('A', 'U')
begin
if exists ( SELECT T0.ItemCode,count(*) from DBO.POR1 T0
WHERE T0.DOCENTRY = @list_of_cols_val_tab_del
GROUP BY T0.ItemCode HAVING count(*) > 1)
begin
select @Error = 290002,
@error_message = 'Duplicate Item Code Not Allowed In Purchase Order'
end
END
---------------------------------------------- GRPO not add without PO ----(290000)-------------------------------------------------------
IF @object_type = '20' AND @transaction_type IN (N'A', N'U')
BEGIN
----DECLARE @UserSign AS INT, @UserSign2 AS INT
---SELECT @UserSign = UserSign, @UserSign2 = UserSign2 FROM OPDN WHERE DocEntry = @list_of_cols_val_tab_del
---If ((@transaction_type = 'A' AND @UserSign in (5,6,7)) OR (@transaction_type = 'U' AND @UserSign2 in (5,6,7)))
BEGIN
IF exists (Select ItemCode from dbo.PDN1 T0 Where T0.BaseType <> 22
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 290002,
@error_message = 'GRPO without Purchase Order! is Not Allowed For this User'
End
END
END
------------------------------------Without GRPO,A/P INV Not Allowed!!-------------------------
IF @object_type = '18' AND @transaction_type IN (N'A', N'U')
BEGIN
BEGIN
IF exists (Select ItemCode from dbo.PCH1 T0 Where T0.BaseType <> 20
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 290003,
@error_message = 'A/P INVOICE NOT ALLOWED, WITHOUT GRPO!! '
End
END
END
-----------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------Sale Order-------------(130000)------------------------------------------------
-------------------------------------StyleNo------------------------
IF @object_type = N'17' AND (@transaction_type = N'A' OR @transaction_type = N'U')
BEGIN
If exists
(
Select U_StyleNo
From ORDR
Where DocEntry =@list_of_cols_val_tab_del and isnull(U_StyleNo,'') =''
)
BEGIN
SELECT @Error = 130000
SELECT @error_message = 'StyleNo cannot be blank!'
END
END
-----------------------------------Season-------------------------------------------------------
IF @object_type = N'17' AND (@transaction_type = N'A' OR @transaction_type = N'U')
BEGIN
If exists
(
Select U_Season
From ORDR
Where DocEntry =@list_of_cols_val_tab_del and isnull(U_Season,'') = ''
)
BEGIN
SELECT @Error = 130001
SELECT @error_message = 'Season cannot be blank!'
END
END
----------------------------------------------Sales Size Quantity -----------------------------------
IF @object_type = N'17' AND (@transaction_type = N'A' OR @transaction_type = N'U')
BEGIN
If exists
(
SELECT T1.[Quantity]
FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
WHERE T0.DocEntry=@list_of_cols_val_tab_del AND
(
T1.[Quantity] = (ISNULL(T0.U_SizQt1,0)+ISNULL(T0.U_SizQt2,0)+ISNULL(T0.U_SizQt3,0)+ISNULL(T0.U_SizQt4,0)+
ISNULL(T0.U_SizQt5,0)))
)
BEGIN
SELECT @Error = 2
SELECT @error_message = 'SIZE QUANTITY NOT EQUAL TO SALE QUANTITY'
END
END
------------------------------------------------Sale Order Only One Item Code Allow ---------------------------------------------------------------------------
if @object_type='17' and (@transaction_type ='A' OR @transaction_type ='U')
begin
if exists(Select * FROM ORDR T WHERE T."DocEntry" = @list_of_cols_val_tab_del
and (select count(*) from RDR1 T0 where T0."DocEntry"=T."DocEntry") >1)
begin
Select @error = 130002,
@error_message ='More Than One Item-Code Not Allowed!!!!'
end
end
-----------------------------------------Sale Delivery NOT Allowed, Without SO-----------------------
IF @object_type = '15' AND @transaction_type IN (N'A', N'U')
BEGIN
BEGIN
IF exists (Select ItemCode from dbo.DLN1 T0 Where T0.BaseType <> 17
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 130003,
@error_message = 'Sale Delivery NOT Allowed, Without SO'
End
END
END
--------------------------------------------------------------------------------------------------------------------------
-----------------------------------A/R Inv Not Allowed, Without Sales Delivery-----------------------------------------------------
IF @object_type = '13' AND @transaction_type IN (N'A', N'U')
BEGIN
BEGIN
IF exists (Select ItemCode from dbo.DLN1 T0 Where T0.BaseType <> 15
AND T0.DocEntry=@list_of_cols_val_tab_del)
Begin
SELECT @error = 17,
@error_message = 'A/R Inv Not Allowed, Without Sales Delivery'
End
END
END
------------------------------------------------------------------------------------------------------------------------------
-------------------------------------Bill Of Materila ----------------------------------------------------------------------------------------------------------
IF @object_type = N'66' AND (@transaction_type = N'A' OR @transaction_type = N'U')
BEGIN
If exists
(
Select U_Salesorder
From OITT
Where Code =@list_of_cols_val_tab_del and isnull(U_Salesorder,'') = ''
)
BEGIN
SELECT @Error = 66
SELECT @error_message = 'Sales Order cannot be blank!'
END
END
-----------------------------------------------------------------------------------------------------------------------------------
-------------------------------------Production Order ----------------------------------------------------------------------------------------------------------
IF @object_type = N'202' AND (@transaction_type = N'A' OR @transaction_type = N'U')
BEGIN
If exists
(
Select OriginNum
From OWOR
Where DocEntry =@list_of_cols_val_tab_del and isnull(OriginNum,'') = ''
)
BEGIN
SELECT @Error = 202
SELECT @error_message = 'Sales Order cannot be blank!'
END
END
--------------------------------------------------------------------------------------------------------------------------------
Friday, 4 September 2020
Subscribe to:
Comments
(
Atom
)