![]() |
#9 |
Moderator
|
Цитата:
Сообщение от Napalm
![]() Общеизвестно, что для работы разработчиком Dynamics AX не обязательно знать X++ или уметь программировать.
Пример из LedgerJournalEngine\projQtyModified (AX 2012): X++: // This switch handles the normal(default) case and 2 other special cases switch(true) { case _ledgerJournalTrans_Project.Qty == 0: _ledgerJournalTrans.AmountCurCredit = 0; _ledgerJournalTrans.AmountCurDebit = 0; break; // If Credit/Debit Amounts are both 0, the Cost Price would be incorrectly set to 0 in the normal case // Handle this case separately case !_ledgerJournalTrans.AmountCurDebit && !_ledgerJournalTrans.AmountCurCredit && _ledgerJournalTrans_Project.CostPrice: this.projRecalcAmountCurDebitCredit(_ledgerJournalTrans, _ledgerJournalTrans_Project); break; default: // this.amount gets the debit amount or the negative credit amount offsetFactor = this.projOffsetFactor(_ledgerJournalTrans, _ledgerJournalTrans_Project); _ledgerJournalTrans_Project.CostPrice = Currency::price((offsetFactor * _ledgerJournalTrans.amount())/_ledgerJournalTrans_Project.Qty); // Cost Price should always be positive if (_ledgerJournalTrans_Project.CostPrice < 0) _ledgerJournalTrans_Project.CostPrice = - _ledgerJournalTrans_Project.CostPrice; // Cost Price have changed, recalc debit and credit amounts to avoid rounding diff this.projRecalcAmountCurDebitCredit(_ledgerJournalTrans, _ledgerJournalTrans_Project); break; } Для раздумья о нелегкой судьбе оператора switch() в различных языках программирования, рекомендую прочитать: Duff's device |
|
|
![]() |
||||
Тема | Ответов | |||
Бага в Query update(true) | 5 | |||
Не срабатывает skipDatabaseLog(true) | 14 | |||
visible(true) и курсор | 6 | |||
recordLevelSecurity(true) | 12 |
Опции темы | Поиск в этой теме |
Опции просмотра | |
|