on 01-29-2016 11:40 PM
When using the Service layer, i need to create an invoice from a delivery, but placed within the line 0 sends me the error, but the other lines work fine:
"{
"error" : {
"code" : -10,
"message" : {
"lang" : "en-us",
"value" : "No matching records found (ODBC -2028)"
}
}
}
"
Part of my code is this.
Dim NewLine as New DocumentLine
newLine.BaseEntry= order1.DocEntry
newLine.BaseLine= lin.LineNum
newLine.BaseType= 15 ' Object delivery
The order1 is the Document to delivery.
I guess you may miss the CardCode or something else.
A complete payload to create an invoice based on a delivery should be like this:
POST /b1s/v1/Invoices
{
"DocDate": "2016-02-23",
"DocDueDate": "2016-02-23",
"CardCode": "bp004",
"DocumentLines": [
{
"BaseType": 15,
"BaseEntry": 14,
"BaseLine": 0,
"TaxCode": "x1"
},
{
"BaseType": 15,
"BaseEntry": 14,
"BaseLine": 1,
"TaxCode": "x1"
}
]
}
By the way, why use VB? Personally, C# with WCF is preferred. Sample code:
public static void AddInvoice(ServiceLayer slContext)
{
try
{
Document oInvoice = new Document();
oInvoice.DocDate = DateTime.Today;
oInvoice.DocDueDate = DateTime.Today;
oInvoice.CardCode = "bp004";
for (int i = 0; i < DOCUMENT_LINES_COUNT; ++i)
{
DocumentLine line = new DocumentLine();
line.BaseType = 15;
line.BaseEntry = 14;
line.BaseLine = i;
line.TaxCode = "X1";
oInvoice.DocumentLines.Add(line);
}
slContext.AddToInvoices(oInvoice);
slContext.SaveChanges();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
106 | |
12 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.