Hi Shan,
Thanks for the response. We don't have that kind of setup for the items in our GP. In our old application using Econnect, we were setting the values for UnitCost, UnitPrice and ExtendedCost before we call
taSopLineIvcInsert_ItemsTaSopLineIvcInsert.
Now that we are shifting to the GP web service, we're unable to set the Unit Cost and the items just shows zero. Here's the code snippet for setting the invoice lines.
using (var client = new DynamicsGPClient())
{
foreach (var line in details)
{
gpItem = client.GetItemByKey(new ItemKey {Id = line.ItemNumber}, _gpContext);
var invoiceLine = new SalesInvoiceLine
{
Key = new SalesLineKey { LineSequenceNumber = (int)line.LineSequenceNumber }),
ItemKey = line.ItemNumber,
Quantity = line.QuantityShipped,
FulfillDate = line.RecordCreateDate,
UofM = line.uofM}
invoiceLine.UnitPrice = new MoneyAmount
{
Value = gpItem.CurrentCost.Value,
DecimalDigits = 5,
Currency = DefaultCurrency
};
}
SalesInvoiceLineList.Add(invoiceLine)
}
salesInvoice.Lines = SalesInvoiceLineList.ToArray();
using (var client = new DynamicsGPClient())
{
var policy = client.GetPolicyByOperation("CreateSalesInvoice", _gpContext);
client.CreateSalesInvoice(saleInvoiceModel, _gpContext, policy);
}