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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.12.2013, 10:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Pawan's Ax blog: How to update sales price for already created sales orders by applying latest trade agreements using x++ code
Источник: http://pawansaxblog.blogspot.com/201...r-already.html
==============

In one of implementation project. I got a requirement in this Client wants to update sales orders that were created in past.Requirement was to update sales price by applying new trade agreements that were created later in system after the sales order creation.

I used the following code to update the sales price.

private void updateSalesPrice()
{
SalesLine salesLine;
PriceDiscPolicyCheckPolicy checkPolicy;
str text;
SysOperationProgress operationProgress;
boolean salesLineFound;
#AviFiles
// 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price -->
Dialog dialog;
DialogField dfStartDate;
DialogText dialogText;
TransDate startDate;
// 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price
;

operationProgress = new SysOperationProgress();
operationProgress.setCaption("@DTD849");
operationProgress.setAnimation(#AviUpdate);

// 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price -->
dialog = new Dialog("@DTD847");
dfStartDate = dialog.addField(extendedTypeStr(TransDate), "@DTD1042");
dfStartDate.value(dateNull());

text = "@DTD845" + '\n\n' +"@DTD846" ;

dialogText = dialog.addText(text);
dialogText.displayHeight(4);
dialogText.displayLengthValue(50);

if (dialog.run())
{
startDate = dfStartDate.value();
// 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price
ttsBegin;
while select forUpdate salesLine
where salesLine.SalesType == SalesType::Sales
&& salesLine.SalesStatus = startDate || startDate == dateNull()) // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price
{
salesLine.ManualEntryChangepolicy = 0; //optimisation dkos 2013-09-25
// 2013-02-18 #20169 csek: Job to update SOprice -->
salesLine.SystemEntryChangePolicy = 0; //optimisation dkos 2013-09-25
// 2013-02-18 #20169 csek: Job to update SOprice

checkPolicy = PriceDiscPolicyCheckPolicy::newFromParm(salesLine.PriceDiscResultFields::parmPriceDiscResultFields());
salesLine.salesPurchLine::resetPriceAgreement();
salesLine.setPriceAgreement(salesLine.inventDim(), null ,false,true);// 2013-02-07 #20169 csek: Job to update SOprice
salesLine.LineAmount = salesLine.calcLineAmountForced(salesLine.SalesQty, checkPolicy);
operationProgress.setText(strFmt("@DTD850",salesLine.SalesId));
salesLine.update();

salesLineFound = true;
}
ttsCommit;
}
if (salesLineFound)
{
info("@DTD1041"); // 2013-09-25 #23667_DA0374 dkos: Update Sales Order Unit Price
}
}


Источник: http://pawansaxblog.blogspot.com/201...r-already.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Pawan's Ax blog: How to release item using x++code in ax2012 Blog bot DAX Blogs 0 09.12.2013 13:11
Pawan's Ax blog: Code to copy data from one table to another even though the tables are different provided the field names are same. in Ax2012 Blog bot DAX Blogs 0 09.12.2013 00:14
amer-ax: It was a great day! Blog bot DAX Blogs 3 29.12.2012 01:02
dynamicsaxtraining: Sales Blog bot DAX Blogs 0 25.04.2012 03:18
Pawan's Ax blog: How to identify unused labels in application Blog bot DAX Blogs 3 15.03.2011 10:14

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

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

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