AX 2012

First and last date of last Week AX 2012

Posted on

Below job will return the First and Last day of last week static void LastWeekFirstandlast(Args _args) { FromDate fromDate; ToDate toDate; TransDate baseDate = systemDateGet(); ; toDate = dateStartWk(baseDate) – 1; fromDate = dateStartWk(toDate); info(strFmt(“%1 – %2”, fromDate, toDate)); }

AX 2012

First and last date of last month AX 2012

Posted on

code calculates the first and last date of the previous month static void EP_dateMonthInterval(Args _args) { date fromDate; date toDate; date baseDate = systemDateGet(); ; toDate = dateStartMth(baseDate) – 1; fromDate = dateStartMth(toDate); info(strFmt(“%1 – %2”, fromDate, toDate)); }

AX 2012

How to set autolog off / Automatic Shutdown to all Users in AX 2012

Posted on

Automatic shutdown timeout value is stored in UserInfo table. this job will set the timeout to 30 minutes for all users:static void Automatic_Shutdown(Args _args){    UserInfo    userInfo;    ;    ttsbegin;    while select forupdate *        from userInfo    {        userInfo.autoLogOff = 30;        userInfo.update();    }    ttscommit;}

AX 2012

Changing Phone Number Format AX 2012

Posted on

some times you need to change the phone number format according to your requirement through code so this job will help you for this, what this job does is it checks whether the phone number is in req format that is 923331234567 if it is thn ok other wise it changes the number to the […]

AX 2012

Create Customer By X++ With Address AX 2012

Posted on

public void CustomerImport(Name _Name,NameAlias _NameAlias,LogisticsAddressCityName _City,LogisticsAddressCountryRegionName _Country,DirPartyName _BusinessUnit,DirPartyName _CostCenter, CustGroupId _CustGroup,PaymTermId _PaymTermId,inventlocationid _InventLocation,NumberSequenceGroupId _numberSequenceGroup,LineOfBusinessId _LineOfBusinessId,InventSiteId _InventSiteId,smmSegmentId _SegmentId,str 100 _SalesMan, str 100 _salesManager){ DirPerson dirPerson;DirPersonName dirPersonName;LogisticsLocation logisticsLocation;LogisticsPostalAddress logisticsPostalAddress;LogisticsElectronicAddress logisticsElectronicAddress;CustTable custTable;DirOrganization dirOrganization;OMOperatingUnit OMOperatingUnitBuisnessUnit,OMOperatingUnitCostCenter;DirPerson SalesMan,SalesManager;InventLocation InventLocation;InventSite InventSite;PaymTerm PaymTerm;LineOfBusiness LineOfBusiness;NumberSequenceGroup NumberSequenceGroup;CustGroup CustGroup;smmBusRelSegmentGroup smmBusRelSegmentGroup;DirParty dirParty;//DirPartyPostalAddressView dirPartyPostalAddressView;DirPartyContactInfoView dirPartyContactInfo; try{ttsbegin; // valid the input data of business unit and cost centerselect OMOperatingUnitBuisnessUnit […]

AX 2012

Get Tax Value From Purchase Order AX 2012

Posted on

static void calculateTax(Args _args) { TmpTaxWorkTrans tmpTax; PurchTable purchTable; PurchTotals purchTotals; ; purchTable = PurchTable::find( ‘BRMF-000012’); purchTotals = purchTotals::newPurchTable(purchTable); // Calculate Tax purchTotals.calc(); // Load tmpTaxWorkTrans tmpTax.setTmpData(purchTotals.tax().tmpTaxWorkTrans()); // Showing taxes with tax value while select tmpTax { info( strFmt(‘%1 : %2’ , tmpTax.TaxCode, tmpTax.TaxAmount)); }}

AX 2012

AOT Complex Query with OR AND Multi Column

Posted on

static void b2bExecuteQuery(Args _args) {     QueryRun                queryRun;     QueryBuildRange         qbr,qbr1;     OTHB2BTransaction       transaction;     B2BView  B2BView;     Query q;// = new Query();     QueryRun qr;     QueryBuildDataSource qbd;     ;         […]