on 07-04-2006 1:44 PM
Probably the way I'm doing it isn't right. I'm a little new in this.
I tried many way from the HELP way to MY way and I always get the same error.
-5002 Item no. is missing [IGN1.ItemCode]
Here's the latest attempt at doing it.
oGoodsReceipt.Lines.ItemCode = oDelivery.Lines.ItemCode;
oGoodsReceipt.Lines.ItemDescription = oDelivery.Lines.ItemDescription;
oGoodsReceipt.Lines.Quantity = oDelivery.Lines.Quantity;
oGoodsReceipt.Lines.Add();
int ErrCode;
string ErrMsg;
int retVal = oGoodsReceipt.Add();
if(retVal != 0)
{
oCompany.GetLastError(out ErrCode, out ErrMsg);
MessageBox.Show(ErrCode.ToString() + " " + ErrMsg);
}
Since the oDelivery got the right data (I tested it) I even tried to put data manually it should work.
I tried "Invoice Document - Add Method Sample"
No luck yet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi JP,
You shouldn't call the lines.Add() method in such way...
The document_lines object always has a default first line, so you call lines.add() only if you need to put an extra (2nd) line ( in this case you have to call SetCurrentLine(1) ). This makes sense of the error message you get (you add a second line to doc lines without setting the item code...
this is the correct sequence when adding lines to documents
SetCurrentLine(0) --- can be omitted, 1st line selected by default
doclines.ItemCode = ...
etc.
doclines.Add() --- here you add an empty line
doclines.ItemCode = ...
doc.add() --- here you add the doc
Hope this helps...
Hi Enrico.
Here my last attempt :
if(oGoodsReceipt.Lines.Count > 0)
{
oGoodsReceipt.Lines.Add();
oGoodsReceipt.Lines.SetCurrentLine(oGoodsReceipt.Lines.Count-1);
}
oGoodsReceipt.Lines.ItemCode = oDelivery.Lines.ItemCode;
oGoodsReceipt.Lines.ItemDescription = oDelivery.Lines.ItemDescription;
oGoodsReceipt.Lines.Quantity = oDelivery.Lines.Quantity;
oGoodsReceipt.Lines.UnitPrice = oDelivery.Lines.UnitPrice;
int ErrCode;
string ErrMsg;
int retVal = oGoodsReceipt.Add();
if(retVal != 0)
{
oCompany.GetLastError(out ErrCode, out ErrMsg);
rtfResults.Text += ErrCode.ToString() + " " + ErrMsg + "\n";
}
else
{
rtfResults.Text += oDelivery.Lines.ItemCode + " Succeeded...";
}
Still got the error. I tried other way too based on what you said and it doesn't work.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.