AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 16.08.2015, 19:17   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: How to link the Purchase order line with a Vendor invoice line in the AIF VendVendInvoiceService service.
Источник: http://blogs.msdn.com/b/axsupport/ar...e-service.aspx
==============

I have seen this issue come up several times so I thought a little blog article would be helpful to the Dynamics AX developers working with this AIF service.

When creating a Vendor Invoice using the VendVendInvoiceService service, you may have a business requirement to associate the Vendor invoice line with a Purchase order line. The service is not going to automatically retrieve or know which line to use based on just the Purchase Order number that you provide. So you need to provide the ID for that Purchase order line which is the InventTransId property. The InventTransId on the VendInvoiceInfoLine table matches the InventTransId of the PurchLine table.

C# Example

This Console Application example shows how to reference the Purchase order line. I had created a Receipt for this Purchase order so I am referencing the Receipt in the VendInvoiceInfoSubLine also:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VendServiceTester.AccountsPayableServices;




namespace VendServiceTester
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("starting");


VendVendInvoiceServiceClient client = new VendVendInvoiceServiceClient();
CallContext context = new CallContext();
context.Company = "USRT";




AxdVendInvoice vendInvoice = new AxdVendInvoice();
AxdEntity_VendInvoiceInfoTable vendInvoiceInfoTable = new AxdEntity_VendInvoiceInfoTable();




vendInvoiceInfoTable.CurrencyCode = "USD";
vendInvoiceInfoTable.InvoiceAccount = "1001";
vendInvoiceInfoTable.OrderAccount = "1001";
vendInvoiceInfoTable.Num = "AIF412";
vendInvoiceInfoTable.PaymMode = "USAUSD_CHK";
vendInvoiceInfoTable.PurchId = "001568";
/* Setting a PO number for an associated PO for PurchId creates an error
* if vendInvoiceInfoLine.InventTransId is not set below.
* INVENTTRANSID in vendInvoiceInfoLine matches to the PURCHLINE.INVENTTRANSID value
*/




AxdEntity_VendInvoiceInfoSubTable vendInvoiceInfoSubTable = new AxdEntity_VendInvoiceInfoSubTable();
AxdEntity_VendInvoiceInfoLine vendInvoiceInfoLine = new AxdEntity_VendInvoiceInfoLine();
AxdEntity_VendInvoiceInfoSubLine vendInvoiceInfoSubLine = new AxdEntity_VendInvoiceInfoSubLine();





vendInvoiceInfoLine.OrderAccount = "1001"; // Vendor account
vendInvoiceInfoLine.ItemId = "0001"; // Inventory Item
vendInvoiceInfoLine.PurchInvoiceLineType = AxdEnum_PurchInvoiceLineType.Standard;
vendInvoiceInfoLine.PurchInvoiceLineTypeSpecified = true;
vendInvoiceInfoLine.ReceiveNow = 1; // QTY in AX Form
vendInvoiceInfoLine.PurchPrice = 41.99M; //Unit Price in AX Form
vendInvoiceInfoLine.PurchPriceSpecified = true;
vendInvoiceInfoLine.InventTransId = "00161642_068";




// VendInfoInfoSub Tables...
vendInvoiceInfoLine.VendInvoiceInfoSubLine = new AxdEntity_VendInvoiceInfoSubLine[1] { vendInvoiceInfoSubLine };
vendInvoiceInfoSubLine.DocumentId = "RCT000412"; // Receipt Number
vendInvoiceInfoSubLine.ReceiveNow = 1;




vendInvoiceInfoSubTable.VendInvoiceInfoLine = new AxdEntity_VendInvoiceInfoLine[1] { vendInvoiceInfoLine };
vendInvoiceInfoSubTable.OrigPurchId = "000412";
vendInvoiceInfoTable.VendInvoiceInfoSubTable = new AxdEntity_VendInvoiceInfoSubTable[1] { vendInvoiceInfoSubTable };
vendInvoice.VendInvoiceInfoTable = new AxdEntity_VendInvoiceInfoTable[1] { vendInvoiceInfoTable };




try
{
client.create(context, vendInvoice);
Console.WriteLine("success");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}






If you do not set the InventTransId property when passing in a Purchase order number value, you may receive AIF exceptions like these returned:

Item 0001 on invoice AIF412 line is different from purchase order line item .

The item's inventory model policy must be not stocked.






Источник: http://blogs.msdn.com/b/axsupport/ar...e-service.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
atinkerersnotebook: Using Service Management to Track Service Orders Blog bot DAX Blogs 1 25.08.2013 19:16
AIF: Microsoft Dynamics AX Services and Windows Azure Service Bus Blog bot DAX Blogs 0 24.07.2013 03:13
dynamicsaxtraining: Vendor returns Blog bot DAX Blogs 0 11.10.2012 00:11
dynamicsaxtraining: Purchase Blog bot DAX Blogs 0 11.03.2012 05:25
dynamicsaxtraining: Create purchase order Blog bot DAX Blogs 0 14.12.2009 14:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 05:11.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.