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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.10.2010, 13:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
axhelper: WorkCalendarSched
Источник: http://feedproxy.google.com/~r/AxHel...ndarsched.html
==============

When programming Dynamics AX it is very easy to add days to a date. You can take todays date and just add an integer of five to get the date five days from now. But because this is easy to do it doesn’t mean that this always is the right way to go about this date business.

If you look closer at how the dates are calculated on the sales order lines or the purchase order lines in Dynamics AX you see that a class called WorkCalendarSched is used. This is because deliveries are dependant on when the company using Dynamics AX actually can send the order. Not all companies work on weekends.

This is when WorkCalendarSched comes in handy, with this class and the class method “shedDate” you can make sure that the delivery is set to a day when the company actually is going to be able deliver.

This is a basic job that uses the class WorkCalendarSched and the method “shedDate”:

X++:
static void FO_stepCalendar(Args _args)
{
SchedDate schedDate;
date fromDate = systemDateGet(),
testDate;
WorkCalendarSched workCalendarSched;
int days2step = 4;
boolean calendarDays = false;
CustTable cust = CustTable::find("4000");
;

// Without using schedDate.
testDate = fromDate + days2step;

workCalendarSched = new WorkCalendarSched();

schedDate = workCalendarSched.schedDate(
SchedDirection::Forward,
fromDate,
days2step,
calendarDays,
cust.SalesCalendarId,
CompanyInfo::find().ShippingCalendarId);

print strFmt("From date: %1", fromDate);
print strFmt("Test date: %1", testDate);
print strFmt("Scheddate: %1", schedDate);
print strFmt("%1", workCalendarSched.isDateOpen(
CompanyInfo::find().ShippingCalendarId,
testDate));
print strFmt("%1", workCalendarSched.isDateOpen(
CompanyInfo::find().ShippingCalendarId,
schedDate));
pause;
}
Источник: http://feedproxy.google.com/~r/AxHel...ndarsched.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axhelper: Add Fields to a table, using code_not the AOT In Dynamics Ax Blog bot DAX Blogs 0 04.10.2010 11:05
axhelper: How to Use Temporary tables in reports Blog bot DAX Blogs 0 29.09.2010 18:05
axhelper: Working with Temporary Tables in forms Reports and Runtime Blog bot DAX Blogs 0 29.09.2010 12:05
axhelper: Using DictTable Blog bot DAX Blogs 0 28.09.2010 03:12
axhelper: Write EXCEL Document, export data to excel with X++ Blog bot DAX Blogs 0 28.09.2010 03:12

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

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

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