Look in table 37, you will find two functions, one that sets the Qty to receive and one that sets the qty to invoice. Take a look at how they work and play around with ways to get it to do what you need.
As to sharing the coding, that is not the thing to do, don’t be lazy. Start the coding yourself and when you have errors ask for more help, but don’t simply expect us to do your work for you unless you also expect us to get paid for it instead of you.
I will give you a hint though. The starting place is to go to the Sales & Receivables Setup table and add a new field “Default Qty To Rec. To Zero”::Boolean.
Small correction: he’s talking about purchasing, so that would be table 39 (Purchase Line), and the boolean would go into Purchases & Payables Setup.
Be careful with those functions though, and test them back, forth and from side to side. It is very important to get the quantity functions right, and it is really easy to screw them up completely (I speak from personal experience :)).
The “field always blank” works great for the situation you describe, but what about the case where the supplier send 49 of the 50 items?
I agree with the"…start the coding yourself…" comment above, but also believe in the saying “don’t reinvent the wheel”. What you are describing is a standard feature of newer NAV versions. Look at how MS has approached this and let it guide your design. This could make upgrading easier when the time comes.