I’m trying to get RcvDtl.Ourunitcost to update through a function.
I’ve tried just about every way I can think of via code, here is what I’ve done so far:
decimal proposedDocUnit = decimal.Round(newUnitPrice / dtl.OurQty, 4);
dtl.AllowUpdSuppPrice = true;
dtl.RowMod = “U”;
string msg;
rcvBO.CheckSupplierPrice(ref rcvTS, vendor, PurPoint ?? "", PackSlip, (int)dtl.PackLine, proposedDocUnit, out msg);
string q = "", s = "", lc = "", pc = "";
rcvBO.CheckDtlBeforeUpdate(rcvTS, vendor, PurPoint ?? "", (int)dtl.PackLine, PackSlip, out q, out s, out lc, out pc);
anyChanges = true;
bool requiresUserInput = false;
rcvBO.PreUpdate(ref rcvTS, out requiresUserInput);
rcvBO.Update(ref rcvTS);
This seems to do nothing, this was my attempt at following the trace log when updating supplier price, it automatically changed ourunitcost.
This was my other attempt, manually setting it.
dtl.AllowUpdSuppPrice = true;
dtl.DocInVendorUnitCost = priceperPart;
dtl.DocUnitCost = priceperPart;
dtl.DocVendorUnitCost = priceperPart;
dtl.OurUnitCost = priceperPart;
dtl.RowMod = “U”;
string q = “”, s = “”, lc = “”, pc = “”;
rcvBO.CheckSupplierPrice(ref rcvTS, vendor, PurPoint ?? “”, PackSlip, (int)dtl.PackLine, priceperPart, out q);
rcvBO.CheckDtlBeforeUpdate(rcvTS, vendor, PurPoint ?? “”, (int)dtl.PackLine, PackSlip, out q, out s, out lc, out pc);
anyChanges = true;
bool requiresUserInput = false;
rcvBO.PreUpdate(ref rcvTS, out requiresUserInput);
rcvBO.Update(ref rcvTS);
This changed all otehr variables, like docvendorunitcost, docunitcost, etc to the right price, but left ourunitcost alone.
No matter what, I cant seem to get it to change, has anyone had success?