D365 常用方法
方法
curUserId(); //当前用户
XUserInfo::find(false, curUserId()).name;//当前用户名。
HcmWorker::worker2Name(HcmWorker::userId2Worker( curUserId()));;//当前Worker名。
curEXT();//当前帐套,等价于 Ledger.Name
appl.ttsLevel() //事务层数;
TablePName(tb) //table label;
fieldPName(tb,field) //field label;
Global_CN::numeralsToTxt(totalAmount, NoYes::No, NoYes::Yes,(strLen(num2str(totalAmount, 1, 0, 1, 0)) + 1 + #DecimalNum));//中文数字大写;
获取logisticPostalAddress
LogisticsElectronicAddress locationAddressTb;
select firstonly locationAddressTb order by locationAddressTb.IsPrimary desc
exists join DirPartyLocation
where locationAddressTb.Location == DirPartyLocation.Location
&& DirPartyLocationTb.Party == tb.Party
&& DirPartyLocationTb.IsPrimary == NoYes::No;
Math
- roundDown(real x,real 最小位);
数字toString:
num2str ( moneyReal, -1, // Minimum number of characters to output into the string. -1 means infinite number of characters -1, // Required number of digits to the right of the decimal. -1 means infinite number of digitis DecimalSeparator::(Auto, Dot, Comma), // 1 ThousandSeparator::(Auto, None, Dot, Comma, Apostrophe, Space) // 2 );
date
当前date
客户端日期
DateTimeUtil::getSystemDate( DateTimeUtil::getClientMachineTimeZone() );
时间间隔
intvNo( fromDate, toDate,IntvScale::Day);//弃用
Date2Num(toDate) - Date2Num(fromDate);
日期展示
date2Str(date date, int sequence, int day, int SeparatorBtwM&D, int month, int SeparatorBtwY&M, int year); // separator顺序不对,恶心心。
第一天
dateStartMth(date)
dateStartQtr(date)
dateStartWk(date)
dateStartYr(date)
其中对应枚举类为:
- DateSeparator:: Auto, None, Space, Dot, Hyphen, Slash; 99, 0, 1, 2, 3, 4;
- DateDay:: Auto, None, Digits1or2, Digits2; 99, 0, 1, 2;
- DateMonth:: Auto, None, Digits1or2, Digits2, Short, Long; 99,0,1,2,3,4;
- DateYear:: Auto, None, Digitis2, Digits4; 99, 0, 2, 4;
- 19990101 date2Str(date, 321,2,0,2,0,4)
- 199901 date2Str(date, 321,0,0,2,0,4)
- 1999 date2Str(date, 321,0,0,0,0,4)
- 1999-01-01 date2Str(date, 321,2,3,2,3,4)
- 1999-01 date2Str(date, 321,0,0,2,3,4)
类型转换
date 2 datetime :
DateTimeUtil::newDateTime(_Date, 0, DateTimeUtil::getCompanyTimeZone())
复制记录:
Global::buf2buf(tbFrom,tbTo);
tb.data(tbFrom);