Hi everyone,
We have a requirement of getting the Total Gross Weight of the Sales Order based on the parts added on the Sales Order.
Added UD field Grossweight under OrderHed.
Gross weight will be coming from part detail table.
I have an error (The name ‘OrderNum’ does not exist in the current context’ when compiling the code below:
var CalcWeight = (from orderDtl in Db.OrderDtl
join part in Db.Part on orderDtl.PartNum equals part.PartNum
where orderDtl.OrderNum == OrderNum
select orderDtl.OrderQty * part.GrossWeight
).ToList().Sum();
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
foreach (var OrderHed in (from OrderHedRow in Db.OrderHed
where OrderHedRow.Company == Session.CompanyID
&& OrderHedRow.OrderNum == OrderNum
select OrderHedRow))
{
TotalWeight = Convert.ToDecimal(CalcWeight);
OrderHed.GrossWeight_c = Convert.ToDecimal(CalcWeight);
}
Db.Validate();
txScope.Complete();
}
Help please.
