I am attempting to create a method directive on ReceiptsFromMFG as a preprocess that will flag the user entering the transaction qty if the trans qty + previous qtys > Job Production Qty.
I need assistance creating a sum for previous transactions.
I have thus far came up with the following custom code that should do exactly what I’m after:
foreach (var PartTran_iterator in (from r in ttPartTran where r.Added() || r.Updated() select r))
{
if(PartTran_iterator!=null)
{
decimal QtyReceived = 0;
decimal ProdQty = 0;
var Job = (from s in Db.JobHead where s.Company == Session.CompanyID && s.JobNum == PartTran_iterator.JobNum select s).FirstOrDefault();
if (Job != null)
{
ProdQty = Job.ProdQty;
foreach (var PartTran2_iterator in (from v in Db.PartTran where v.Company == Session.CompanyID && v.JobNum == Job.ToString() && v.TranType == "MFG-STK" select v))
{
QtyReceived = QtyReceived + PartTran2_iterator.TranQty;
}
if((QtyReceived + PartTran_iterator.TranQty) > ProdQty)
{
asdf = 1;
}
}
}
}
Credit Here:
However, when I go to receive the job to inventory I get the following message:
I am unsure as to why I am receiving this message and would like some assistance troubleshooting. Additionally, I would like the custom code to prompt the user for a yes or no to a continue anyway ststement. Has anyone accomplished this before?
Ended up just making another custom code module to assign scalar values to the call context there and added in the call context to the message on the form.