Skip to Content
0
Jun 22, 2017 at 12:01 PM

Price property in Document Lines is ignored

326 Views

Hi everyone,

I'm facing a situation where the Price property of a document is completely ignored.

The item used in the code has a price configured but it should override it with the one I provide. Note that we are providing the Price, not the UnitPrice.

Before running the code, make sure that the price for your A00002 in the price list for C20000 is not 100, otherwise, it will seem it works.

Here is the code:

var invoice = (Documents)company.GetBusinessObject(BoObjectTypes.oInvoices);
var items = invoice.Lines;


invoice.CardCode = @"C20000";
items.ItemCode = @"A00002";
items.Price = 100;


int result = invoice.Add();
if (result != 0)
{
    throw new Exception(company.GetLastErrorDescription());
}
else
{
    application.StatusBar.SetSystemMessage(
        @"Operation completed successfully",
        BoMessageTime.bmt_Short,
        BoStatusBarMessageType.smt_Success);
}

Expected to have an invoice for C20000 with one item, A0002, with a price after discount equal to 100.

Actually got an invoice for C20000 with one item, A0002, with a price after discount equal to 138.38 (which is the same as the UnitPrice).

Any ideas?

Kind regards,

Pedro Magueija

LinkedIn | Twitter | Blog