Hello, all
While the Price field in any Document's lines (for example, Purchase order) can be easily updated through the user interface, I can't seem to find a way of doing it via DIApi. I can update Currency (which is the unit of measure of the Price field!), Quantity, but not Price itself... Here's a short examle to reproduce the problem:
const int docEntry = 12;
const int lineNum = 0;
Documents order = (Documents)Git_DIApi.VCmp.GetBusinessObject(BoObjectTypes.oPurchaseOrders);
order.GetByKey(docEntry); //Presuming such a document exists!
Document_Lines lines = order.Lines;
lines.SetCurrentLine(lineNum);
double priceOld = lines.Price; //Remember the old value for later comparison
lines.Price = priceOld * 1.1;
int updError = order.Update();
if(updError == 0)
{ order.GetByKey(docEntry);
lines = order.Lines;
lines.SetCurrentLine(lineNum);
double priceWhat = lines.Price; //What's the result?
if(priceWhat == priceOld)
{ //There! According to the DIApi the document has been updated,
//while the price has remained the same!
//ReportError()
}
}
Can you please suggest a solution?
Thank you in advance,
Anton