How to close Job Card when first-stage semi-finished goods are rejected by QC and become scrap?

We have a pharmaceutical manufacturing company where BOMs are set up with Track Semi-Finished Goods.

Sometimes during production, the gel produced in the first stage is rejected by QC and the entire batch becomes scrap/waste.

In this scenario, how should we properly close the Job Card?

The raw materials have already been consumed and their cost needs to be charged to the scrap.

Currently, the Job Card doesn’t allow saving with Completed Quantity = 0 while entering Actual Time. I’m forced to enter 1 and then delete the production row in the Manufacture Stock Entry, which doesn’t feel like the correct process.

Any advice would be appreciated.

Hi Danial, I reproduced this on a v16 test site (ERPNext 16.34.2): a BOM with Track Semi Finished Goods, a first-stage gel operation, raw materials transferred to WIP, then the whole gel batch rejected. (Screenshots use a dot as the thousands separator, so 1.000 = 1,000.)

Why the Job Card won’t close

Submitting the Job Card with nothing completed is blocked:

The Complete Job dialog does have a Process Loss Quantity field, but Completed Quantity is mandatory and 0 counts as empty. So Completed = 0 with Process Loss = the full batch is rejected:

So on this release a Job Card can’t record a 100% loss by itself. Entering 1 and deleting the row gets you past the form, but leaves a Manufacture entry that doesn’t match what happened.

What worked on the same site

  1. Write the materials off with a Material Issue. New Stock Entry, type Material Issue, Source Warehouse = the WIP warehouse the gel materials were transferred to, the consumed raw-material quantities, and the Difference Account on each row set to a dedicated expense account (I used Production Loss - QC Rejection). Put the Work Order, batch and QC reference in Remarks.

    The GL is then Dr Production Loss - QC Rejection / Cr Stock for the full raw-material value, and the WIP warehouse is back to zero.
  2. Stop the Work Order (Status → Stop). It shows Manufactured Qty 0, which is what really happened, and nothing more can be booked against it.
  3. Leave the first-stage Job Card as a draft. It can’t be deleted once a material transfer is linked to it, and the draft keeps the operator’s time log on record. Job Cards for later operations that never started can be deleted.
  4. Raise a new Work Order for the replacement batch.

The dedicated expense account gives you the cost of rejected batches in the GL, and Work Orders with status Stopped and Manufactured Qty 0 give you the count.

One note for after your next update: on the current version-16 branch, Completed Quantity in the Complete Job dialog is no longer mandatory, and the Process Loss you enter there is kept. Once that reaches your site, Completed 0 + Process Loss = full batch should become the direct way. I haven’t tested that release yet.

Hi my friend,
I am currently using ERPNext version 16.37.0 and plan to upgrade to version 16.50 soon.
Thank you for the answer you gave me.

In my opinion, the idea of using Material Issue for the materials consumed in the WIP warehouse is incorrect, because Material Issue is expense-oriented in nature.

However, the Manufacture document is designed in such a way that it allocates the cost of the consumed items to the cost of the produced item or the produced scrap. That is actually what I expect.

The whole issue I have is this: when I have produced a gel that for whatever reason has been rejected and is going to become scrap, the materials I consumed for it should have their costs transferred and sit on the produced scrap gel.

If I also want to handle this story through Issue and Receipt and create the documents manually, my Adjustment accounts get involved. In the end their debit and credit may balance, but in any case they appear in my General Ledger, and from an accounting point of view this is incorrect.

And another very interesting thing I discovered — I don’t know whether it is a bug or something the developers intentionally did — is that on the Job Card, when you use the Start and Stop buttons, you can manually enter the numbers for Completed Quantity, Pending, and Process Loss.

But if a user wants to enter the production report manually in the Actual Time table, they do not have access to fill in Process Loss and Pending Quantity and can only enter Completed Quantity.

This whole matter has become a bit of a challenge for me, because in the pharmaceutical and food industries it happens very often that a batch is rejected and entirely becomes scrap and we have no good production.

Hi Danial, my bad, I misunderstood what you were after at first. I read “charge the cost to scrap” as writing it off to an expense, but you want the cost to stay in stock on the scrap gel. You’re right, Material Issue doesn’t do that.

So I went back to my test site (ERPNext 16.34, synthetic data, numbers in VND with a dot as the thousands separator) and tried to rebuild your case as closely as I could: BOM with Track Semi Finished Goods, a first-stage gel operation, a batch-tracked raw material, and since it’s pharma I assumed you run a Quality Inspection on the gel, so the first-stage Job Card has an In Process QI marked Rejected.

1. The QI blocks the Job Card

With the default Stock Settings (Action if Quality Inspection is rejected = Stop), the Job Card can’t be submitted once its QI is rejected

So anything that goes through the Job Card and the semi-finished Manufacture entry is closed off. That’s another reason the “complete 1 and delete the row” trick feels wrong.

2. What worked: Repack straight out of WIP

Setup once: a scrap item (I used “Gel - rejected”, batch-tracked) and a warehouse like “QC Rejected”.

Then for the rejected batch, one Stock Entry of type Repack:

  • source rows: the raw materials that were transferred to WIP for this batch (here 2 kg of the active ingredient from batch API-00001, plus 8 kg gelatin)
  • target row: the scrap item into QC Rejected
  • Additional Costs tab: the operating cost of the gel step, if you want that on the scrap too (I put 1 h on the mixing vessel = 500.000)

Repack values the output at the cost of what it consumed plus the additional costs. So the scrap gel came in at 3.600.000 of materials + 500.000 operating cost = 4.100.000. The consumed raw-material batch was picked automatically (FIFO), and the scrap item got its own new batch:

3. What it does to the GL

The raw-material part posted nothing, because WIP and QC Rejected use the same stock account on my site. If yours use different stock accounts you’ll see a stock-to-stock movement, still nothing on adjustment or expense.

The operating cost part posts Dr stock / Cr the account you choose in Additional Costs:

That’s the same treatment a normal Manufacture entry gives operating cost. I’d use your company’s Default Operating Cost Account there, so it lands where your regular production does (on my test company that was empty, so I used Expenses Included In Valuation).

4. Closing it out

Stop the Work Order so the next operation doesn’t wait for the gel. The first-stage Job Card stays a draft, with the operator’s time log and the rejected QI linked, and I put the WO, Job Card and QI numbers in the Repack remarks. That gave me a clean trail from the QI to the scrap batch.

If you’d rather go through a real Manufacture entry

That works too, but only after you change that Stock Setting to Warn. Then the Job Card submits with a warning. Set its Target Warehouse to QC Rejected first, and the Manufacture entry puts the gel there with its full cost (raw materials and operating cost from the Job Card). A Repack then turns the gel into the scrap item:

I tested that path as well, but the setting is global, so it also turns the QI block into a warning for receipts and deliveries. The Job Card will also show the batch as completed. That’s why I’d go with the Repack from WIP.

About the Actual Time table

You’re right, and it looks intentional in the code rather than a bug. The time log row only has Completed Qty. Pending and Process Loss live on the Job Card itself, and you can only set them from the Complete Job dialog or the Pending Qty field, which won’t take a value until something is completed. So a 100% loss can’t go in through the table. For pharma and food that’s a real gap, and I think a GitHub issue would be worth it.

When you move to 16.50, have a look at the Complete Job dialog first. In the latest v16 code, Completed Quantity isn’t mandatory there anymore and the Process Loss you type is kept, so Completed 0 + Process Loss = full batch might work directly. I haven’t tested that version myself though, and with a rejected QI the Job Card submit could still be blocked by the Stop setting.

Hope this is closer to what you need. Try it on a copy of your site first, since I’ve only checked it on 16.34.

Hello again,
Thank you for explaining everything so nicely and completely, and for the effort you put into this community.
The suggestions you gave are excellent, and I forgot to mention one point — sorry about that.

The ERPNext QC module is a bit less than what we need for the pharmaceutical industry, and we are currently developing it. We are still not using the default module on the Job Cards.

The idea of the Repack document is very good, but from day one my preference has been to use Repack as little as possible in the system, because of batch tracking and financial issues, and I have put a very strict workflow on it.

But I will probably use the last suggestion you gave and tell them to enter the final quantity in Completed Quantity and simply send it to their Reject warehouse.
The only concern is the cleanliness of future reports, because this Job Card will show as completed while in reality it is a complete deviation.

I haven’t had time to test version 16.50 myself yet, but I will definitely test the point you mentioned.
And if the issue is still not resolved, I will definitely create an issue on GitHub.

Overall, thank you very much for the time you spent and for helping me find alternative solutions.