Hello all,
I am trying to modify a BPM (please note that I am not expert on BPMs and C#) I found here about gross margin to make it to work based on our requirements. the BPM is below:
decimal SC = 0m; //Standard Cost
decimal TOC = 0m; //Total Order Cost
decimal NM = 0m;
decimal V1 = 0m;
decimal V2 = 0m;
bool bFailedGM = false;
bool bOrderFailed = false;
bool BelowMargin = false;
bool BelowMarginApproved = false;
var OrdHed = (from r in ttOrderHed where r.Added() || r.Updated()
select r).FirstOrDefault();
if (OrdHed != null)
{ foreach (var OrdDtl_iterator in (from r in Db.OrderDtl where r.Company == Session.CompanyID && r.OrderNum == OrdHed.OrderNum
select r))
{ var OrdDtl = OrdDtl_iterator;
var Part = (from p in Db.Part
where p.Company == Session.CompanyID && p.PartNum == OrdDtl.PartNum
select p).FirstOrDefault();
if (Part != null)
{ SC=Part.TotalCost_c;
TOC = SC * OrdDtl.SellingQuantity; //7122
NM = (TOC - (OrdDtl.OrdBasedPrice * OrdDtl.SellingQuantity)) * -1 ; //
V1 = (OrdDtl.OrdBasedPrice * OrdDtl.SellingQuantity);
V2 = V1 - TOC;
InfoMessage.Publish("TOC = " + TOC , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
InfoMessage.Publish("OrdBasedPrice = " + OrdDtl.OrdBasedPrice , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
InfoMessage.Publish("NM = " + NM , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
InfoMessage.Publish("V2V1 = " + V2 + " " + V1, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
// InfoMessage.Publish("Total = " + OrdDtl.TotalPrice , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
bFailedGM=false;
//bBelowMarginApproved=false;
if ((V1-TOC) > -100);
{
if (OrdDtl.BelowMarginApproved_c==false)
{ bFailedGM=true;
//bOrderFailed=true;
InfoMessage.Publish("BelowMargin: " + OrdDtl.BelowMargin_c + "OrderHold: " + OrdHed.OrderHeld, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
OrdHed.OrderHeld=true; //bOrderFailed;
OrdDtl.BelowMargin_c = true;
InfoMessage.Publish("BelowMargin: " + OrdDtl.BelowMargin_c + "OrderHold: " + OrdHed.OrderHeld, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
}
else {
OrdHed.OrderHeld=false;
InfoMessage.Publish("Not Below Margin", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual);
}
}
// OrdHed.OrderHeld=false;
}
However, I get an error that:
System.Drawing.Bitmap CS1061 ‘OrderDtl’ does not contain a definition for ‘BelowMarginApproved_c’ and no extension method ‘BelowMarginApproved_c’ accepting a first argument of type ‘OrderDtl’ could be found (are you missing a using directive or an assembly reference?)
What am I missing or what am I doing wrong?
Please help. Thank you.