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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.11.2012, 21:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
ax-erp: Processing Business Tasks - Posting sales orders
Источник: http://microsoft-dynamics-ax-erp.blo...ing-sales.html
==============


Sales order posting is also done in a very similar way to posting a purchase order. The posting function can be executed from code and can be integrated into various customizations.In this recipe, we will use a standard Dynamics AX API to post and print a sales packing slip document from code. As an example, we will post and print a packing slip for the sales order created in the previous recipe.
<h4 class="docSection2Title" id="title-ID0ENUAI">How to do it...</h4>
  1. 1. In AOT, create a new class called SalesOrderPost with the following code (replace SO-100160 with your number):
    class SalesOrderPost
    {
    }
    public static void main(Args _args)
    {
    SalesFormLetter salesFormLetter;
    salesTable salesTable;
    ;
    salesTable = SalesTable::find('SO-100160');
    salesFormLetter = SalesFormLetter::construct(
    DocumentStatus::PackingSlip);
    salesFormLetter.update(
    salesTable,
    systemdateget(),
    SalesUpdate::All,
    AccountOrder::None,
    NoYes::No,
    NoYes::Yes);
    }


  2. 2. Run the class to create a packing slip for the specified sales order and display the Packing slip document on the screen:
  1. 3. Open Accounts receivable | Sales Order Details, select the previously specified sales order, the clickInquiries button, and choose Packing slip to view results:

<h4 class="docSection2Title" id="title-ID0EHYAI">How it works...</h4>First, we create a new class named SalesOrderPost with a main() method.
The method starts with finding sales order SO-100160, which we created in the previous recipe. Here, we would normally replace this code with user input or an output from another source.
Next, we call construct() on the SalesFormLetter class to create a new salesFormLetter instance. The method accepts an argument of type DocumentStatus, which defines the type of posting. Here, we use DocumentStatus::PackingSlip for sales packing slip posting. construct() also accepts a second optional boolean argument, which controls whether a new SalesParmUpdate record, used for sales order posting grouping, should be created. The default is true.
And finally, we call update() on salesFormLetter, which does actual posting. It accepts a number of arguments:
  • The sales order header record, i.e. SalesTable.
  • The transaction date. The default is system date.
  • The quantity to be posted. The default is SalesUpdate::All.
  • This argument is not used. The default is AccountOrder::None.
  • A boolean value defining should preview or actual posting be done.
  • A boolean value defining should document be printed.
  • A boolean value specifying should printing management be used. The default is false.
  • Keep the remaining quantity on order; otherwise it is set to zero. This argument is used when posting credit notes.
  • A container of a number of TmpFrmVirtual records. This argument is optional and is used only when posting sales invoices.
<h4 class="docSection2Title" id="title-ID0EU3AI">There's more...</h4>SalesFormLetter could also do other types of posting, like order confirmation, picking list, or invoice. For example, to invoice for the sales order, replace the code:
salesFormLetter = SalesFormLetter::construct(
DocumentStatus::PackingSlip);


with:
salesFormLetter = SalesFormLetter::construct(
DocumentStatus::Invoice);


Run the class and notice that now the sales order was invoiced:

Open Accounts receivable | Sales Order Details, select the previously specified sales order, click theInquiries button, and choose Invoice to view the results:






Источник: http://microsoft-dynamics-ax-erp.blo...ing-sales.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Posting Invoice from Sales order/ Purchase order. Blog bot DAX Blogs 0 06.11.2012 15:11
ax-erp: Processing Business Tasks - Building a Display dimensions dialog Blog bot DAX Blogs 0 13.07.2012 16:11
dynamicsaxtraining: Sales Blog bot DAX Blogs 0 25.04.2012 03:18
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:44.