on 07-08-2015 8:42 AM
Good Day Experts,
It is possible that the minimum price of item in A/R Invoice will not below the price of item purchased in A/P invoice? It will not transact the A/R invoice if the price of item is below of purchased price in A/P invoice.
Regards Thanks.
Hi Romel,
This kind of validations are only effective for serial / Batch numbered items.
Otherwise, we can't track actual Purchase price of AR Invoice item.
Another Option,
If you are using moving average price, then you can put a transaction notification validation or Approval procedure based on moving average item cost and sales Price.
Thanks
Unnikrishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You need to execute one query in SQL.
If you don't have technical knowledge, you should take help of system admin / Service partner, while doing this.
and do this in test database first.
You can try below script for this
SQL > Database > Select database > Store procedure > Store procedure transaction notifications > Paste this script "Below add your code here"
---
If @object_type = '13' And @transaction_type in ('A')
Begin
If Exists(Select T0.DocEntry
From OINV T0 Inner Join INV1 T1 On T0.DocEntry = T1.DocEntry
Where T0.DocEntry = @list_of_cols_val_tab_del And T1.Price<T1.ItemCost)
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Itemcost'
End
---
Thanks
Unnikrishnan
Hi Romel,
Please try below query for approval procedure.
-- AR Invoice
Declare @LastPurprice numeric(19,6), @InvPrice numeric(19,6)
Set @LastPurprice = (Select T0.LastPurPrc FROM OITM T0 WHERE T0.ItemCode = $[$38.1.0])
Set @InvPrice = $[$38.17.Number]
Select Distinct 'True' Where @LastPurprice > @InvPrice
Save this Query in Query manager,
and use the same in approval templates.
Thanks
Unnikrishnan
Hi Sir,
Why in the code i cant create A/P transaction?
"If Exists(Select T0.DocEntry
From OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
Where T0.DocEntry = @list_of_cols_val_tab_del And T1.Price< T2.[LastPurPrc] )
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Last Purchased Price'
End"
sorry. I thought i already solved my problem, but all transaction i will entry always appear an error " Sales Price is Less than Purchased Price" in this code.
If Exists(Select T0.DocEntry
From OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
Where T0.DocEntry = @list_of_cols_val_tab_del And T1.Price< T2.[LastPurPrc] )
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Last Purchased Price'
End
Hi i used the code below and it's okay now. is this correct?
If @object_type = '13' And @transaction_type in ('A')
If Exists(Select T0.DocEntry
From OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
Where T0.DocEntry = @list_of_cols_val_tab_del And T1.Price< T2.[LastPurPrc] )
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Last Purchased Price'
End
Hi Ramasamy,
Do you include Object Type in your query??
If no, Please use below query
------------------
If @object_type = '13' and @transaction_type in ( 'A')
BEGIN
If Exists(Select T0.DocEntry
From OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
Where T0.DocEntry = @list_of_cols_val_tab_del And T1.Price< T2.[LastPurPrc] )
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Last Purchased Price'
End
END
-----------
Thanks
Unnikrishnan
Hi Romel,
It will block document, even if its approved.
But we can add one more condition in "Where" clause to skip approved document.
Field Name to identify authorization statu is WddStatus.
Please try below query
If @object_type = '13' And @transaction_type in ('A')
If Exists(Select T0.DocEntry
From OINV T0
INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
Where T0.DocEntry = @list_of_cols_val_tab_del
and T0.WddStatus <>'P' -- to skip approved document from validation
And T1.Price< T2.[LastPurPrc] )
Begin
SET @error=@list_of_cols_val_tab_del--@object_type;
SET @error_message = 'Sales Price is less than Last Purchased Price'
End
Thanks
Unnikrishnan
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.