Problem with code

mkpjsrmkpjsr Member Posts: 587
Hi experts,

we have implemented job work module using Sales Order and Purchase Order as we dont have license for subcontracting orders.

Here Sales order is being used to create orders and items is received from the customer using Purchase Order and finally items are sent back to customer using Sales Order.

Here i have created a Table called "RC Details" that is updated when item is received and invoiced using purchase order and also when the item is sent back using Sales Order.

This table contains follwing fields:
RC. No. // updated when item is received using purchase order
Customer No. // updated when item is received using purchase order
Item No. // updated when item is received using purchase order
Quantity Received // updated when item is received using purchase order
Quantity Supplied // updated when item is sent back using Sales order
Balance Quantity // updated when item is sent back using Sales order

Now, i am getting a problem.

Suppose if an order is created for 100 items and at a time 50 items are received from the customer that means now only 50 quantity can be sent back (using Sales Order) but it was not happening so i wrote the following code

:
 SalesHeader.SETRANGE(SalesHeader."No.",RecSalesLine."Document No.");
 IF RecRcDetail.GET(RecSalesLine."Rc. No.") THEN BEGIN
   IF (RecRcDetail."Balance Qty">0 ) AND (RecSalesLine."Qty. to Ship" <=RecRcDetail."Balance Qty") THEN
    
    ERROR('RC. No. %1 has Insufficient Quantity Left!!', RecSalesLine."Rc. No.");
    EXIT
    END

I am not finding the exact place to write this code, as i guess i should write this code under
code unit "Sales-Post (Yes/No)" or Sales-Post.

Can anybody suggest me.

Comments

Sign In or Register to comment.