on 08-11-2010 3:59 PM
I am trying to check if the item is discontinued and in stock. If the item is discontinued and not in stock then it should block the user from entering a sales order, but the SP only checks fro the discontinued item. Can some one tell me what is wrong with this query?
If (@Object_Type='17') and (@Transaction_Type='A'or @Transaction_Type='U')
Begin
If exists (Select T1.LineNum from RDR1 T1 INNER JOIN ORDR T0 ON
T0.DocENtry = T1.DocEntry inner join OITM t2 on t1.itemcode=t2.itemcode
inner join OitW T3 on T2.itemcode=t3.itemcode where T1.linestatus='o'
and t2.U_discontinuedDate is not null and T3.OnHand =0 and T0.DocEntry= @list_of_cols_val_tab_del)
Begin
set @Error='910'
Set @error_message='Item on this order has been discontinued '
End
End
Thank you
Chintan
try this code
If (@Object_Type='17') and (@Transaction_Type='A'or @Transaction_Type='U')
Begin
If exists (Select T1.LineNum from RDR1 T1 INNER JOIN ORDR T0 ON
T0.DocENtry = T1.DocEntry inner join OITM t2 on t1.itemcode=t2.itemcode
inner join OitW T3 on T2.itemcode=t3.itemcode where T1.linestatus='o'
and t2.U_discontinuedDate is not null
and (T3.OnHand+T3.OnOrder-T3.IsCommited) <= 0
and T1.WhsCode = T3.WhsCode
and T0.DocEntry= @list_of_cols_val_tab_del)
Begin
set @Error='910'
Set @error_message='Item on this order has been discontinued '
End
End
Krishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
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.