Hey there,
I have a method directive on Quote.Update that adds new quote rows and then sets essential fields like part number, price, etc. All fields but price update okay.
I can DMT a price in by using something like:
|Company|QuoteNum|QuoteLine|DocDspExpUnitPrice|
|COMP|16894|2|484|
But I can’t make the change stick in the BPM code.
I’ve run traces of the DMT update and the BPM update, and they don’t look much different. They both run through Quote.Update.
Here’s the stripped-down version of the code, excluding the BAQ for the source data, new rows, etc. It teis to update the price on QuoteDtl and also on QuoteQty. I’ve tried updating either and both. I get the unit price stored in QuoteQty, but it doesn’t update QuoteDtl.
Any ideas, experience?
Thanks,
Joe
// quote bo for temp dataset get/update
Erp.Contracts.QuoteSvcContract boQuote = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.QuoteSvcContract>(this.Db);
dsTemp = boQuote.GetByID(quoteNumber);
foreach (DataRow row in dtResults.Rows)
{
string prodCode = row[“Calculated_ProdGroupDtl”].ToString();
string prodDesc = row[“Calculated_ProdDesc”].ToString();
// set price in quotedtl & quoteqty
var QuoteDtl2_xRow = (from QuoteDtl_Row in dsTemp.QuoteDtl
where QuoteDtl_Row.Company == Session.CompanyID &&
QuoteDtl_Row.QuoteNum == quoteNumber &&
QuoteDtl_Row.PartNum == prodCode + " LineAdded"
select QuoteDtl_Row).FirstOrDefault();
if (QuoteDtl2_xRow != null)
{
decimal unitPrice = Convert.ToDecimal(row["Calculated_TotalProdRev"]);
QuoteDtl2_xRow.PartNum = prodCode + " " + QuoteDtl2_xRow.QuoteLine.ToString();
QuoteDtl2_xRow["ParentLine_c"] = Convert.ToInt32(QuoteDtl2_xRow.QuoteLine);
**QuoteDtl2_xRow.DocDspExpUnitPrice = unitPrice;**
QuoteDtl2_xRow.RowMod = "U";
dirty = true;
//boQuote.ChangeDocOrderUnitPrice(unitPrice, ref dsTemp); // no other change price method listed
//tried updating only QuoteDtl, only QuoteQty, and both
// update
try
{
boQuote.Update(ref dsTemp);
dirty = false;
}
catch (Exception ex)
{
this.PublishInfoMessage("Error updating " + ex.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}
// get ds again
dsTemp = boQuote.GetByID(quoteNumber);
// set price in quote qty
var QuoteQty = (from QuoteQty_Row in dsTemp.QuoteQty
where QuoteQty_Row.Company == QuoteDtl2_xRow.Company &&
QuoteQty_Row.QuoteNum == QuoteDtl2_xRow.QuoteNum &&
QuoteQty_Row.QuoteLine == QuoteDtl2_xRow.QuoteLine &&
QuoteQty_Row.QtyNum == 1
select QuoteQty_Row).FirstOrDefault();
if (QuoteQty != null)
{
QuoteQty.DocUnitPrice = unitPrice;
QuoteQty.UnitPrice = unitPrice;
QuoteQty.RowMod = "U";
//QuoteQty.UserChangedUnitPrice = true;
dirty = true;
}
// update
try
{
boQuote.Update(ref dsTemp);
dirty = false;
}
catch (Exception ex)
{
this.PublishInfoMessage("Error updating " + ex.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}
// get ds again
dsTemp = boQuote.GetByID(quoteNumber);
}
}