table of contentsss - help.avalara.comapi/deki/files/10892/ax_avatax_install... · table of...

62
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00> 1 | Page Table of Contentsss 1. OVERVIEW ............................................................................................................................ 3 2. TABLES .................................................................................................................................. 4 429 - Tax Data ............................................................................................................................ 4 550 - TmpTaxWorkTrans ........................................................................................................... 5 434 - TaxOnItem ......................................................................................................................... 7 430 - TaxGroupData ................................................................................................................... 7 439 TaxTable ........................................................................................................................... 8 433 TaxLedgerAccountGroup ................................................................................................. 9 437 TaxReportPeriod ............................................................................................................... 9 436 TaxPeriodHead ............................................................................................................... 10 431 TaxGroupHeading........................................................................................................... 11 427 TaxAuthorityAddress...................................................................................................... 11 432 TaxItemGroupHeading ................................................................................................... 12 367 SalesParameters .............................................................................................................. 12 2941 LogisticsPostalAddress ................................................................................................. 13 366 SalesTable ....................................................................................................................... 14 230 - MarkupTrans ................................................................................................................... 14 229 - MarkupTable ................................................................................................................... 15 77 CustTable .......................................................................................................................... 15 3. MAP....................................................................................................................................... 16 3110 - LogisticsPostalAddressMap .......................................................................................... 16 4. CLASSES .............................................................................................................................. 17 685 - SalesQuotationEditLinesForm_Sales_Confir .................................................................. 18 686 - SalesQuotationEditLinesForm_Sales_Send .................................................................... 20 1019307 - SalesInvoiceJournalPost .......................................................................................... 20 77 CustPostInvoice ................................................................................................................ 20 547 - SalesTotals_ParmTrans ................................................................................................... 21 1019305 SalesInvoiceJournalCreate ...................................................................................... 22 758 ApplicationVersion ......................................................................................................... 22 583 Tax .................................................................................................................................. 23 1235 SalesTableForm ............................................................................................................ 28 1018435 NumberSeqModuleSalesOrder ............................................................................... 28 546 SalesTotals ....................................................................................................................... 29 1018419 SalesTableListPageInteraction................................................................................. 29 1013343 FormLetterJournalCreate ......................................................................................... 30 SalesQuotationController .......................................................................................................... 31 FormletterService...................................................................................................................... 31 4. FORMS.................................................................................................................................. 32 CustFreeInvoice ........................................................................................................................ 32 SalesQuotationTable ................................................................................................................. 33 SalesTable ................................................................................................................................. 35 SalesTableListPage ................................................................................................................... 36 LogisticsPostalAddress ............................................................................................................. 37

Upload: docong

Post on 30-Jan-2018

219 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

1 | P a g e

Table of Contentsss 1. OVERVIEW ............................................................................................................................ 3

2. TABLES .................................................................................................................................. 4

429 - Tax Data ............................................................................................................................ 4

550 - TmpTaxWorkTrans ........................................................................................................... 5

434 - TaxOnItem ......................................................................................................................... 7

430 - TaxGroupData ................................................................................................................... 7

439 – TaxTable ........................................................................................................................... 8

433 – TaxLedgerAccountGroup ................................................................................................. 9

437 – TaxReportPeriod ............................................................................................................... 9

436 – TaxPeriodHead ............................................................................................................... 10

431 – TaxGroupHeading........................................................................................................... 11

427 – TaxAuthorityAddress ...................................................................................................... 11

432 – TaxItemGroupHeading ................................................................................................... 12

367 – SalesParameters .............................................................................................................. 12

2941 – LogisticsPostalAddress ................................................................................................. 13

366 – SalesTable ....................................................................................................................... 14

230 - MarkupTrans ................................................................................................................... 14

229 - MarkupTable ................................................................................................................... 15

77 – CustTable .......................................................................................................................... 15

3. MAP....................................................................................................................................... 16

3110 - LogisticsPostalAddressMap .......................................................................................... 16

4. CLASSES .............................................................................................................................. 17

685 - SalesQuotationEditLinesForm_Sales_Confir .................................................................. 18

686 - SalesQuotationEditLinesForm_Sales_Send .................................................................... 20

1019307 - SalesInvoiceJournalPost .......................................................................................... 20

77 – CustPostInvoice ................................................................................................................ 20

547 - SalesTotals_ParmTrans ................................................................................................... 21

1019305 – SalesInvoiceJournalCreate ...................................................................................... 22

758 – ApplicationVersion ......................................................................................................... 22

583 – Tax .................................................................................................................................. 23

1235 – SalesTableForm ............................................................................................................ 28

1018435 – NumberSeqModuleSalesOrder ............................................................................... 28

546 –SalesTotals ....................................................................................................................... 29

1018419 –SalesTableListPageInteraction ................................................................................. 29

1013343 –FormLetterJournalCreate ......................................................................................... 30

SalesQuotationController .......................................................................................................... 31

FormletterService ...................................................................................................................... 31

4. FORMS .................................................................................................................................. 32

CustFreeInvoice ........................................................................................................................ 32

SalesQuotationTable ................................................................................................................. 33

SalesTable ................................................................................................................................. 35

SalesTableListPage ................................................................................................................... 36

LogisticsPostalAddress ............................................................................................................. 37

Page 2: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

2 | P a g e

CustTable .................................................................................................................................. 43

CustTableListPage .................................................................................................................... 44

5. Number Sequence .................................................................................................................. 46

Ava_Head ..................................................................................................................................... 46

6. MENU ................................................................................................................................... 47

7. TABLES (Project Integration) ............................................................................................... 49

617- ProjProposalJour ............................................................................................................... 49

550 - TmpTaxWorkTrans ......................................................................................................... 50

8. CLASSES (Project Integration) ............................................................................................. 51

1019305 - SalesInvoiceJournalCreate ....................................................................................... 51

1018730 – ProjInvoiceJournalPost ........................................................................................... 52

1204 - TaxProj .......................................................................................................................... 52

583 – Tax .................................................................................................................................. 54

683 - SalesQuotationEditLinesForm_Proj_Send ...................................................................... 55

681 - SalesQuotationEditLinesForm_Proj_Confir ................................................................... 56

1018729 – ProjInvoiceJournalCreate ........................................................................................ 56

9. FORMS (Project Integration) ................................................................................................ 58

SalesQuotationProjTable .......................................................................................................... 58

ProjInvoiceProposalDetail ........................................................................................................ 59

ProjInvoiceProposalListPage .................................................................................................... 60

ProjInvoiceTotals ...................................................................................................................... 60

ProjInvoiceProposal .................................................................................................................. 60

10. Number Sequence (Project Integration) ............................................................................. 62

Ava_Head ..................................................................................................................................... 62

Page 3: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

3 | P a g e

1. OVERVIEW

To install the AvaTax connector for MS Dynamics AX 2012 R2 CU7

The process is divided into sections as per the AOT. Standard followed in the AvaTax connector-

1. Any code changes / addition to the core product (MS Dynamics AX 2012) is within ‘//@AVA +‘ & ‘//@AVA -’

2. While looking for any AvaTax connector code within native code one should

search for ‘AVA’ and proceed. 3. Try looking for a single commented lines (especially the END; statements) they

are mentioned by a ‘//@AVA -’ All objects/global includes the three alphabets ‘AVA’ in their version List in order to

recognize that this global object is being used by AvaTax code

Common step for all the following lists 1. Open MS Dynamics AX 2012. point to the database which has a backup copy

2. Warning: Do not point to a live database / SQL instance. Any loss to critical data

because of the following integration process shall be on the client’s risk if the data is live/production.

3. Open the AOT for making any changes to the native AX related to the connector

Note: This document is divided into two parts; first part represents code changes

related to AR integration and second part represents code changes related to Project integration.

Page 4: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

4 | P a g e

2. TABLES

ID Name

429 Tax Data

550 TmpTaxWorkTrans

434 TaxOnItem

430 TaxGroupData

439 TaxTable

433 TaxLedgerAccountGroup

437 TaxReportPeriod

436 TaxPeriodHead

427 TaxAuthorityAddress

431 TaxGroupHeading

432 TaxItemGroupHeading

367 SalesParameters

2941 LogisticsPostalAddress

366 SalesTable

230 MarkupTrans

229 MarkupTable

77 CustTable

429 - Tax Data

Method Name Modifications

1. initTaxData

Create this new method with below code. /// <summary> /// Initialization of taxData table /// </summary> /// <param name="_taxCode"> /// TaxCode _taxCode /// </param> server void initTaxData(TaxCode _taxCode) { ; this.taxCode = _taxCode;

Page 5: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

5 | P a g e

}

2. findTaxCode Create this new method with below code.

/// <summary> /// Method finds tax code

/// </summary> /// <param name="_taxCode">

/// TaxCode _taxCode /// </param>

/// <param name="_forupdate">

/// boolean _forupdate = false /// </param>

/// <param name="_concurrencyModel"> /// ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto

/// </param> /// <returns>

/// TaxData taxData /// </returns>

public static TaxData findTaxCode( TaxCode _taxCode,

boolean _forupdate = false, ConcurrencyModel _concurrencyModel =

ConcurrencyModel::Auto) {

TaxData taxData; ;

if(_taxCode) {

taxData.selectForUpdate(_forupdate);

if (_forupdate && _concurrencyModel != ConcurrencyModel::Auto) {

taxData.concurrencyModel(_concurrencyModel); }

select firstonly taxData

where taxData.TaxCode == _taxCode; }

return taxData;

}

550 - TmpTaxWorkTrans

Method Name Modifications

showTaxValue

Insert the highlighted lines as specified hereunder:

// BP Deviation Documented

server display TaxValue showTaxValue()

{ TaxValue taxValue;

Page 6: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

6 | P a g e

// @AVA + TaxGroup taxGroup;

Container conAmtNumber; Ava_taxEngine taxEngine = new Ava_taxEngine();

//BP Deviation Documented int detailNumber = 3;

TaxCode prevTaxCode; SysGlobalCache globalCache = Infolog.globalCache();

// @AVA – ;

// @AVA +

#AVA_Macro

//BP Deviation Documented if ((AVA_Configuration::find().TaxGroupId == this.TaxGroup ) ||

(substr(AVA_Configuration::find().TaxGroupId,1,6) ==

substr(this.TaxGroup,1,6))) {

TaxGroup = this.TaxGroup;

if (this.SourceTableId == tablename2id(tablestr(SalesLine))) {

ConAmtNumber = TaxEngine.SalesTaxDataUpdate(this.TaxCode, this.SourceRecId,

DetailNumber, '', PrevTaxCode, True);

} if (this.SourceTableId == tablename2id(tablestr(CustInvoiceLine)))

{ ConAmtNumber =

TaxEngine.CustInvoiceTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True);

} if (this.SourceTableId == tablename2id(tablestr(MarkupTrans)))

{

ConAmtNumber = TaxEngine.MarkupTaxDataUpdate(this.TaxCode, this.SourceRecId,

DetailNumber, '', PrevTaxCode, True); }

if (this.SourceTableId == tablename2id(tablestr(SalesQuotationLine)))

{ ConAmtNumber =

TaxEngine.SalesQuotationTaxDataUpdate(this.TaxCode,

this.SourceRecId, DetailNumber, '', PrevTaxCode, True); }

//BP Deviation Documented TaxValue = Conpeek(ConAmtNumber,1);

//BP Deviation Documented DetailNumber = Conpeek(ConAmtNumber,2);

//BP Deviation Documented

Page 7: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

7 | P a g e

PrevTaxCode = Conpeek(ConAmtNumber,3);

//BP Deviation Documented globalCache.set(#TmpTaxWorkTrans, 0,PrevTaxCode);

//BP Deviation Documented globalCache.set(#TmpTaxWorkTrans, 1,DetailNumber);

}

else // @AVA -

{ if (this.TaxCode && this.TransDate)

{ taxValue = TaxData::percent(this.TaxCode,

this.CalculationDate, this.TaxBaseAmount);

}

} return taxValue;

}

434 - TaxOnItem

Method Name Modifications

initTaxOnItem

Create this new method with below code.

/// <summary> /// Initialization tax on item table /// </summary> /// <param name="_taxItemGroup"> /// TaxItemGroup _taxItemGroup /// </param> /// <param name="_taxCode"> /// TaxCode _taxCod /// </param> server void initTaxOnItem( TaxItemGroup _taxItemGroup, TaxCode _taxCode) { ; this.TaxItemGroup = _taxItemGroup; this.TaxCode = _taxCode; }

430 - TaxGroupData

Page 8: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

8 | P a g e

Method Name Modifications

initTaxGroupData Create this new method with below code.

/// <summary> /// Initialization of the taxGroupData table

/// </summary> /// <param name="_taxGroup">

/// TaxGroup _taxGroup /// </param>

/// <param name="_taxCode">

/// TaxCode _taxCode) /// </param>

server void initTaxGroupData( TaxGroup _taxGroup,

TaxCode _taxCode) {

;

this.TaxGroup = _taxGroup;

this.TaxCode = _taxCode; }

439 – TaxTable

Method Name Modifications

initTaxTable Create this new method with below code.

/// <summary> /// Initialization fileds on the taxTable table

/// </summary> /// <param name="_taxCode">

/// TaxCode _taxCode /// </param>

/// <param name="_taxName"> /// TaxName _taxName

/// </param>

/// <param name="_taxPeriod"> /// TaxPeriod _taxPeriod

/// </param> /// <param name="_taxAccountGroup">

/// TaxAccountGroup _taxAccountGroup /// </param>

/// <param name="_taxLimitBase"> /// TaxLimitBase _taxLimitBase

/// </param>

/// <param name="_currencyCode"> /// CurrencyCode _currencyCode

/// </param> server void initTaxTable(

TaxCode _taxCode,

Page 9: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

9 | P a g e

TaxName _taxName, TaxPeriod _taxPeriod,

TaxAccountGroup _taxAccountGroup, TaxLimitBase _taxLimitBase,

CurrencyCode _currencyCode) {

;

this.TaxCode = _taxCode;

this.TaxName = _taxName; this.TaxPeriod = _taxPeriod;

this.TaxAccountGroup = _taxAccountGroup; this.TaxLimitBase = _taxLimitBase;

this.TaxCurrencyCode = _currencyCode; }

433 – TaxLedgerAccountGroup

Method Name Modifications

initTaxLedgerAcc

ount

Create this new method with below code.

/// <summary>

/// Method added value into TaxLedgerAccountGroup table, field taxAccountGroup

/// </summary> /// <param name="_taxAccountGroup">

/// TaxAccountGroup _taxAccountGroup)

/// </param> //@AVA +-

server void initTaxLedgerAccount(TaxAccountGroup _taxAccountGroup) {

;

this.TaxAccountGroup = _TaxAccountGroup; }

437 – TaxReportPeriod

Method Name Modifications

initTaxPeriod Create this new method with below code.

/// <summary>

/// Method added values into taxReportPeriod table

/// </summary> /// <param name="_taxPeriod">

/// TaxPeriod _taxPeriod /// </param>

/// <param name="_fromDate">

Page 10: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

10 | P a g e

/// TaxPeriodDate _fromDate /// </param>

/// <param name="_toDate"> /// TaxPeriodDate _toDate

/// </param> //@AVA +-

server void initTaxPeriod( TaxPeriod _taxPeriod,

TaxPeriodDate _fromDate,

TaxPeriodDate _toDate) {

;

this.TaxPeriod = _taxPeriod; this.FromDate = _fromDate;

this.ToDate = _toDate; }

436 – TaxPeriodHead

Method Name Modifications

initTaxPeriodHead

Create this new method with below code.

/// <summary> /// Method added values into taxPeriodHead table

/// </summary>

/// <param name="_taxPeriod"> /// TaxPeriod _taxPeriod

/// </param> /// <param name="_taxAuth">

/// TaxAuthority _taxAuth /// </param>

/// <param name="_name"> /// Name _name

/// </param>

/// <param name="_periodUnit"> /// PeriodUnit _periodUnit

/// </param> /// <param name="_qty">

/// Days _qty /// </param>

//@AVA +- server void initTaxPeriodHead(

TaxPeriod _taxPeriod,

TaxAuthority _taxAuth, Name _name,

PeriodUnit _periodUnit, Days _qty)

{

Page 11: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

11 | P a g e

;

this.TaxPeriod = _taxPeriod; this.TaxAuthority = _taxAuth;

this.Name = _name; this.PeriodUnit = _periodUnit;

this.QtyUnit = _qty; }

431 – TaxGroupHeading

Method Name Modifications

initTaxGrpCode Create this new method with below code.

/// <summary> /// Method added values into taxGroupHeading table

/// </summary> /// <param name="_taxGrp">

/// TaxGroup _taxGrp /// </param>

/// <param name="_taxGrpName"> /// TaxGroupName _taxGrpName

/// </param>

//@AVA +- server void initTaxGrpCode(

TaxGroup _taxGrp, TaxGroupName _taxGrpName)

{ ;

this.TaxGroup = _taxGrp;

this.TaxGroupName = _taxGrpName;

}

427 – TaxAuthorityAddress

Method Name Modifications

initTaxAuthCode Create this new method with below code.

/// <summary>

/// Method added values into taxAuthorityAddress table /// </summary>

/// <param name="_taxAuth"> /// TaxAuthority _taxAuth

/// </param>

Page 12: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

12 | P a g e

/// <param name="_name"> /// Name _name

/// </param> //@AVA +-

server void initTaxAuthCode( TaxAuthority _taxAuth,

Name _name) {

;

this.TaxAuthority = _taxAuth;

this.Name = _name; }

432 – TaxItemGroupHeading

Method Name Modifications

initTaxItemGrpC

ode

Create this new method with below code.

/// <summary>

/// Method added values into taxItemGroupHeading table /// </summary>

/// <param name="_taxItemGrp"> /// TaxItemGroup _taxItemGrp

/// </param> /// <param name="_name">

/// Name _name

/// </param> //@AVA +-

server void initTaxItemGrpCode( TaxItemGroup _taxItemGrp,

Name _name) {

;

this.TaxItemGroup = _taxItemGrp;

this.Name =_name; }

367 – SalesParameters

Method Name Modifications

numRefAVANum

Create this new method with below code.

static client server NumberSequenceReference numRefAVANum()

{

Page 13: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

13 | P a g e

return NumberSeqReference::findReference(extendedTypeNum(AVA_HeaderId)

); }

2941 – LogisticsPostalAddress

Method Name Modifications

initFromAVA_Ad

dressValidation

Create this new method with below code.

server void initFromAVA_AddressValidation (AVA_AddressValidation

_addressValidation) {

if (_addressValidation.parmAddressing()) {

this.Address = _addressValidation.parmAddressing();

this.City = _addressValidation.parmCity(); this.State = _addressValidation.parmState();

this.CountryRegionId = _addressValidation.parmCountry(); this.County = _addressValidation.parmCounty();

this.Zipcode = _addressValidation.parmZip(); this.Street = _addressValidation. parmStreet();

} }

initFromAVA_tmpValidAddress

Create this new method with below code.

/// <summary>

/// Initialization of Address table /// </summary>

/// <param name="_tmpValidAddress"> /// AVA_tmpValidAddress _tmpValidAddress

/// </param> // @AVA +-

server void initFromAVA_tmpValidAddress(AVA_tmpValidAddress _tmpValidAddress)

{

;

this.City = _tmpValidAddress.City; this.State = _tmpValidAddress.State;

this.CountryRegionId = _tmpValidAddress.Country; this.County = _tmpValidAddress.County;

this.Zipcode = _tmpValidAddress.Zipcode; this.Street = _tmpValidAddress. Street;

this.Address = _tmpValidAddress.Address;

}

Page 14: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

14 | P a g e

366 – SalesTable

Method Name Modifications

1. checkAgainst

CreditLimit

Search the line “this.Touched = NoYes::No; }” and “return ret;” and

insert the following code in between

// @AVA+ if (!Ava_Configuration::find().DisableTaxCalculation)

{ this.Touched = NoYes::Yes;

}

//@AVA-

2. setEstimate

Search the line “hasEstimatedChanged = (this.Estimate !=

estimatedOld); }}” and “this.Touched = NoYes::No;” and insert the

following code in between

// @AVA+

if (!Ava_Configuration::find().DisableTaxCalculation)

{ this.Touched = NoYes::Yes;

} else

// @AVA-

230 - MarkupTrans

Method Name Modifications

taxCombinationA

llowed

Search the line “if (markupTable.CustType == MarkupType::CustVend ||

markupTable.VendType == MarkupType::CustVend)

return true;” and “return !Tax::potentialSalesTax(this.TaxGroup, this.TaxItemGroup, systemdateget(), this.taxModuleType());” and insert

the following code in between

// @AVA + if ((this.TaxGroup == AVA_Configuration::find().TaxGroupId) ||

(substr(AVA_Configuration::find().TaxGroupId,1,6) == substr(this.TaxGroup,1,6)))

return false;

else // @AVA -

Page 15: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

15 | P a g e

229 - MarkupTable

Method Name Modifications

MarkupTable->DeleteActions

Add delete action with AVA_ShippingCodeMapping table with following properties

MarkupTable-

>DeleteActions

Add delete action with AVA_MiscchargeMapping table with following properties

77 – CustTable

Method Name Modifications

MarkupTable-

>DeleteActions

Add delete action with AVA_EntityUseCodeMapping table with following properties

Page 16: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

16 | P a g e

3. MAP

ID Name

3110 LogisticsPostalAddressMap

3110 - LogisticsPostalAddressMap

Create mapping for AVA_tmpInputAddress as follows

Create mapping for AVA_tmpValidAddress as follows

Page 17: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

17 | P a g e

4. CLASSES

ID Name

685 SalesQuotationEditLinesForm_Sales_Confir

686 SalesQuotationEditLinesForm_Sales_Send

1019307 SalesInvoiceJournalPost

77 CustPostInvoice

547 SalesTotals_ParmTrans

1019305 SalesInvoiceJournalCreate

758 ApplicationVersion

583 Tax

1235 SalesTableForm

1018435 NumberSeqModuleSalesOrder

546 SalesTotals

1013343 FormLetterJournalCreate

1018292 SalesQuotationController

101368 FormletterService

Page 18: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

18 | P a g e

685 - SalesQuotationEditLinesForm_Sales_Confir

Method Name Modifications

1. Class Declaration

Declare the following variable

//@AVA+ int64 ArrLine [];

int line; //AVA-

2. createJournal

1. Declare the following variable

AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); //@AVA +-

2. Search the line “salesQuotationTotals.prepareQuantitiesCalculation();” and

“this.tax(salesQuotationTotals.tax());” and insert the following code in between

TaxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA +-

3. createSalesLines

1. Declare the following variable

MarkupTrans markupTrans; //@AVA+-

2. Search the line “salesDeliverySchedule.insert(); }” and “// PBA Begin if

(salesQuotationLineUpdate.ItemPBAId)” and insert the following code in between

// @AVA + ArrLine [Line] = salesLine.RecId;

Line++; // @AVA –

3. Search for the Line “Markup::copy(false, salesQuotationLineUpdate,

salesLine); }” and “mapEnumerator = mapOfOrderLinesWithMultipleDeliveries.getEnumerator();”

Add following code

// @AVA +

while select RecId from markupTrans

where markupTrans.TransTableId == salesLine.TableId && markupTrans.TransRecId == salesLine.RecId

{ ArrLine [Line] = markupTrans.RecId;

line++; }

// @AVA-

Page 19: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

19 | P a g e

4. updateNow

1. Declare the following variable

AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); // @AVA +- MarkupTrans markupTrans; // @AVA +-

2. Search the line “Markup::copy(false,

salesQuotationTable, this.parmSalesTableCreated());” and

“this.createSalesLines(salesQuotationTable, salesTableCreated);” and insert the following code in between

// @AVA + line = 1;

while select RecId from markupTrans where markupTrans.TransTableId == salesTableCreated.TableId &&

markupTrans.TransRecId == salesTableCreated.RecId {

ArrLine [Line] = markupTrans.RecId; line++;

}

// @AVA -

3. Search the line “this.createSalesLines(salesQuotationTable, salesTableCreated);” and

add following code after

// @AVA + TaxEngine.CopyAvaTables(salesQuotationTable.QuotationId,

salesTableCreated.SalesId, ArrLine); // @AVA –

Page 20: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

20 | P a g e

686 - SalesQuotationEditLinesForm_Sales_Send

Method Name Modifications

createJournal

1. Declare the following variable

AVA_TaxEngine TaxEngine = New AVA_TaxEngine();// @AVA +-

2. Search the line “salesQuotationTotals.prepareQuantitiesCalculation();”

and “this.tax(salesQuotationTotals.tax());” and insert the following code in between

taxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA +-

1019307 - SalesInvoiceJournalPost

Method Name Modifications

2. postFailed

1. Declare the following variable

AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA

+-

2. Search the line “super(_logText);” and closing bracket “}” and insert the following code in between

// @AVA +

if (custInvoiceJour.InvoiceId && !this.isProforma()) taxEngine.CancelTax(custInvoiceJour.InvoiceId,

SalesParmTable.salesTable().TaxGroup, SalesParmTable.salesTable().DefaultDimension);

77 – CustPostInvoice

Method Name Modifications

run 1. Declare the following variable

AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +-

2. Search the line “[invoiceId, voucher] =

numberSeq.numAndVoucher();” and “if (!voucher)” and insert the following code in between

//AVA+

Page 21: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

21 | P a g e

if (custInvoiceTable.ForInterestAdjustment== NoYes::No) {

TaxEngine.GetTax(CustInvoiceTable, CustInvoiceTable.InvoiceDate, False, NULL,

Ava_documentType::SalesInvoice, InvoiceId); }

//AVA-

3.search the line “isPostingOK = true;” and “TradeBLWIFormCodes::initclassFromCust(custInvoiceJour,

TradeBLWITypeOfForm::CustInvoiceJour, TradeBLWITypeOfForm::CustFreeInvoice);” and insert the following

code in between

// @AVA + if (custInvoiceTable.ForInterestAdjustment== NoYes::No)

{

taxEngine.CommitTax(invoiceId, custInvoiceTable.TaxGroup); }

// @AVA -

4.Search the line “sourceDocumentHeader.update();” and “ttscommit;”

and insert the following code in between // @AVA +

if (!isPostingOK && custInvoiceTable.ForInterestAdjustment==

NoYes::No) {

taxEngine.CancelTax(invoiceId, custInvoiceTable.TaxGroup); }

// @AVA -

547 - SalesTotals_ParmTrans

Method Name Modifications

1. showTax 1. Declare the following variable

AVA_TaxEngine AVA_TaxEngine= New AVA_TaxEngine();

2. Search the line “salesTotals = SalesTotals::construct(_salesParmTable.salesTable(), _specQty,

AccountOrder::None, _salesParmTable.ParmId,

'',_salesParmTable.Ordering);” and “salesTotals.calc();” and insert the following code

AVA_TaxEngine.GetTax(_salesParmTable.salesTable(),

_salesParmTable.Transdate, True, _salesParmTable ); // @AVA +-

Page 22: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

22 | P a g e

1019305 – SalesInvoiceJournalCreate

Method Name Modifications

1. initJournalHeader

1. Add the following variable and macro declaration:

// @AVA + AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine();

#AVA_Macro // @AVA -

2. Search for “super();” and add following code after

// @AVA +

if (!salesParmTable.salesTable().ProjId) {

if (salesParmUpdate.Proforma) ava_TaxEngine.GetTax(salesParmTable.salesTable(),

salesParmTable.Transdate, true, salesParmTable); else

AVA_TaxEngine.GetTax(salesTable,

salesParmTable.Transdate, false, salesParmTable, ava_DocumentType::SalesInvoice, custInvoiceJour.InvoiceId);

} // @AVA -

758 – ApplicationVersion

Method Name Modifications

AVA_BuildNo

Create this new method with below code.

/// <summary> /// Returns the version number of the Avatax connector in the layer where this

method is defined. /// </summary> /// <returns>

/// The version number. /// </returns> /// <remarks> /// The version number is displayed in the About box. Even when it is

overlayered. /// </remarks> static client str AVA_BuildNo()

{ #AVA_Macro return #ConnectorVersion;

}

Page 23: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

23 | P a g e

583 – Tax

Method Name Modifications

1. Class Declaration

Declare the following variable

// @AVA + Int detailNumber;

Container conAmtNumber; TaxCode prevTaxCode;

InvoiceId AVA_invoiceId;

SysGlobalCache globalCacheInvoiceId; // @AVA -

2. allocateInTaxWor

kTrans

1. Declare the following variable

// @AVA + AVA_TaxEngine taxEngine = new Ava_TaxEngine();

TaxGroup taxGroup; // @AVA -

2. Search for “taxWorkTrans.SourceBaseAmountCur =

sourceCurrency.amount_Instance(taxWorkTrans.SourceBaseAmountCur);} // </GBR> }” and “ } taxWorkTrans.TaxInCostPrice

= sourceCurrency.amount_Instance(taxWorkTrans.TaxInCostPrice);” and insert the following code in between

// @AVA +

if ((ava_Configuration::find().TaxGroupId ==

taxWorkTrans.TaxGroup ) || (substr(ava_Configuration::find().TaxGroupId,1,6) ==

substr(taxWorkTrans.TaxGroup,1,6))) {

taxGroup = taxWorkTrans.TaxGroup;

if (taxWorkTrans.SourceTableId == tablename2id(tablestr(SalesLine)))

{

ConAmtNumber = TaxEngine.SalesTaxDataUpdate(taxWorkTrans.TaxCode,

taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode);

} if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(custInvoiceLine))) {

ConAmtNumber =

TaxEngine.CustInvoiceTaxDataUpdate(taxWorkTrans.TaxCode,

Page 24: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

24 | P a g e

taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode);

} if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(MarkupTrans))) {

ConAmtNumber = TaxEngine.MarkupTaxDataUpdate(taxWorkTrans.TaxCode,

taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId,

PrevTaxCode); }

if (taxWorkTrans.SourceTableId == tablename2id(tablestr(SalesQuotationLine)))

{ ConAmtNumber =

TaxEngine.SalesQuotationTaxDataUpdate(taxWorkTrans.TaxCode, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId,

PrevTaxCode);

} if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(projProposalOnAcc))) {

ConAmtNumber = TaxEngine.projProposalOnAccTaxDataUpdate(taxWorkTrans.TaxCode

, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode);

}

if (taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalItem)))

{ ConAmtNumber =

TaxEngine.projProposalItemTaxDataUpdate(taxWorkTrans.TaxCode, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId,

PrevTaxCode); }

if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(projProposalEmpl))) {

ConAmtNumber = TaxEngine.projProposalEmplTaxDataUpdate(taxWorkTrans.TaxCode,

taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode);

} if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(projProposalRevenue)))

{ ConAmtNumber =

TaxEngine.projProposalRevenueTaxDataUpdate(taxWorkTrans.TaxCode, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId,

PrevTaxCode); }

Page 25: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

25 | P a g e

if (taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalCost)))

{ ConAmtNumber =

TaxEngine.projProposalCostTaxDataUpdate(taxWorkTrans.TaxCode, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId,

PrevTaxCode); }

taxWorkTrans.TaxAmount =

Conpeek(ConAmtNumber,1)*(-1); DetailNumber =

Conpeek(ConAmtNumber,2); PrevTaxCode =

Conpeek(ConAmtNumber,3);

taxWorkTrans.SourceTaxAmountCur = Conpeek(ConAmtNumber,4)*(-1);

taxWorkTrans.SourceTaxAmountCurReal =

Conpeek(ConAmtNumber,4)*(-1); taxWorkTrans.TaxAmountCur =

taxWorkTrans.TaxAmount; }

// @AVA -

3. Insert the highlighted lines as specified hereunder:

if ((AVA_Configuration::find().TaxGroupId != TaxGroup ) &&

(substr(AVA_Configuration::find().TaxGroupId,1,6) != substr(TaxGroup,1,6))) // @AVA +-

{ if (savedTax != taxAmount ||

savedTaxCur != taxAmountCur || savedSourceTaxCurReal != sourceTaxAmountCurReal ||

savedTaxInCostPrice != taxInCostPrice ||

savedTaxInCostPriceMST != taxInCostPriceMST || savedTaxInCostPriceCur != taxInCostPriceCur ||

savedSourceTaxCur != sourceTaxAmountCur )

{ // If a tax amount must be allocated and there are no other

lines with tax, use the first line // to place the tax on.

if (taxAmount && !taxWorkTransRecId)

taxWorkTransRecId = taxWorkTransRecIdFirst;

select firstonly forupdate taxWorkTrans where taxWorkTrans.RecId == taxWorkTransRecId;

if (taxWorkTrans)

{

Page 26: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

26 | P a g e

if (savedTax != taxAmount) taxWorkTrans.TaxAmount += taxAmount - savedTax;

if (savedTaxCur != taxAmountCur)

taxWorkTrans.TaxAmountCur += taxAmountCur - savedTaxCur;

if (savedTaxInCostPrice != taxInCostPrice)

taxWorkTrans.TaxInCostPrice += taxInCostPrice -

savedTaxInCostPrice;

if (savedTaxInCostPriceMST != taxInCostPriceMST) taxWorkTrans.TaxInCostPriceMST +=

taxInCostPriceMST - savedTaxInCostPriceMST;

if (savedTaxInCostPriceCur != taxInCostPriceCur) taxWorkTrans.TaxInCostPriceCur +=

taxInCostPriceCur - savedTaxInCostPriceCur;

if (savedSourceTaxCur != sourceTaxAmountCur)

taxWorkTrans.SourceTaxAmountCur += sourceTaxAmountCur - savedSourceTaxCur;

if (savedSourceTaxCurReal != sourceTaxAmountCurReal)

taxWorkTrans.SourceTaxAmountCurReal += sourceTaxAmountCurReal - savedSourceTaxCurReal;

taxWorkTrans.update(this.ignoreCalculatedSalesTax()); }

} }

3. distributeTotalTax

1. Declare the following variable and macro as below:

// @AVA +

anytype AVA_invoiceIdTemp;

#AVA_Macro

// @AVA -

2. Search the code “while select

sum(TaxBaseAmountMSTRaw), sum(TaxBaseAmountMST),

sum(TaxAmountCur), sum(TaxAmountMST),

sum(TaxInCostPrice),

sum(TaxInCostPriceCur), sum(TaxInCostPriceMST),

sum(TaxBaseQty), sum(SourceTaxAmountCur),

Page 27: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

27 | P a g e

sum(SourceTaxAmountCurReal) from tmpTax

group by TaxCode, TaxDirection, CalculationDate, Warning where

tmpTax.TaxCalculationOrder == _taxCalculationOrder ” and insert the following code just above that

// @AVA + //BP Deviation Documented

DetailNumber = 3; globalCacheInvoiceId = Infolog.globalCache();

if (globalCacheInvoiceId.get(#TaxWorkTransInvoice, 0, '')) AVA_invoiceIdTemp =

globalCacheInvoiceId.get(#TaxWorkTransInvoice, 0, ''); else

AVA_invoiceIdTemp = '';

AVA_invoiceId = AVA_invoiceIdTemp ; // @AVA -

3. Search the line “if (taxWorkTrans.TaxBaseAmountRaw != tmpTax.TaxBaseAmountMSTRaw &&

!onTaxCode) this.allocateBaseInTaxWorkTrans(tmpTax.TaxCode,

tmpTax.TaxDirection,

taxWorkTrans.TaxBaseAmountRaw, tmpTax.TaxBaseAmountMST,

tmpTax.TaxBaseAmountMSTRaw, tmpTax.CalculationDate);”

and “} }” and replace the existing code with the below code

// @AVA +

//if (tmpTax.TaxAmountMST || tmpTax.Warning != TaxWarning::NoWarning)

//{ this.allocateInTaxWorkTrans(tmpTax.TaxCode,

tmpTax.TaxDirection, tmpTax.TaxAmountMST,

tmpTax.TaxAmountCur, tmpTax.TaxInCostPrice,

tmpTax.TaxInCostPriceMST,

tmpTax.TaxInCostPriceCur, tmpTax.TaxBaseAmountMSTRaw,

tmpTax.TaxBaseQty, tmpTax.SourceTaxAmountCur,

tmpTax.SourceTaxAmountCurReal, NoYes::No,

tmpTax.CalculationDate, tmpTax.Warning);

//}

// @AVA -

Page 28: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

28 | P a g e

} }

1235 – SalesTableForm

Method Name Modifications

1. setTouched

Insert the highlighted lines as specified hereunder:

void setTouched(SalesTable _salesTable) {

// @AVA+

if (!Ava_Configuration::find().DisableTaxCalculation)

{ _salesTable.Touched = NoYes::Yes;

} // @AVA-

else {

if

(_salesTable.custTable_CustAccount().shouldEstimateBeCalculated())

{ _salesTable.Touched = NoYes::Yes;

} }

}

1018435 – NumberSeqModuleSalesOrder

Method Name Modifications

1. loadModule

Insert the following code at the end and just before the last bracket

(NOTE: The value of “numRef.SortField” should be higher than the existing maximum value of numRef.SortField in this method )

// @AVA + datatype.parmDatatypeId(extendedtypenum(AVA_HeaderId));

datatype.parmReferenceHelp(literalstr("@AVA534")); datatype.parmWizardIsManual(NoYes::No);

datatype.parmWizardIsChangeDownAllowed(NoYes::No); datatype.parmWizardIsChangeUpAllowed(NoYes::No);

datatype.parmIsGroupEnabled(NoYes::Yes);

Page 29: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

29 | P a g e

datatype.parmSortField(18);

datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);

this.create(datatype); // @AVA -

546 –SalesTotals

Method Name Modifications

1. executeDisplayFiel

dsServer

1. Declare the following variable and macro as below:

AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // @AVA +-

SalesTable salesTable; //AVA +-

2. Search the line

“salesTotals.calcMarkupForTable(salesParmTable.ParmId, salesParmTable.SalesId);“ and add following code after line

ava_TaxEngine.GetTax(salesParmTable.salesTable(), salesParmTable ?

salesParmTable.Transdate : systemDateGet(), True, salesParmTable ); // @AVA +-

3. Search the line “else

{

salesTotals = SalesTotals::construct(_orderTable, _specQty); }

” and salesTotals.calc(); ” and insert the following code in between

salesTable = _orderTable;

ava_TaxEngine.GetTax(salesTable, systemDateGet() ); // @AVA +-

1018419 –SalesTableListPageInteraction

Method Name Modifications

1. setButtonSell

1. Declare the following macro as below:

#AVA_Macro

2. at the end of method add below code:

// @AVA + if(strscan(( AVA_Configuration::find().Services), #TaxService, 1, 100)

&& (AVA_Configuration::find().EnableTaxOverrideDate)) {

Page 30: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

30 | P a g e

this.listPage().actionPaneControlEnabled(formControlStr(salesTableListPa

ge, AVA_TaxOverrideDate),true); }

else {

this.listPage().actionPaneControlEnabled(formControlStr(salesTableListPa

ge,AVA_TaxOverrideDate),false);

} // @AVA -

1013343 –FormLetterJournalCreate

Method Name Modifications

createJournal()

Search for “if (this.check())”. Existing code snippet:

if (this.check())

this.initJournalHeader(); //@AVA +-

Replace it with:

this.initJournalHeader();

if (this.check())

// this.initJournalHeader(); //@AVA +-

Page 31: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

31 | P a g e

SalesQuotationController

Property Code Changes

RunOn Change the property ‘RunOn’ to ’Client’

FormletterService

Method Name Modifications

run

1. Declare the following variable

// @AVA + AVA_TaxEngine taxEngine = new AVA_TaxEngine();

CustInvoiceJour custInvoiceJourLoc; SalesParmTable salesParmTableLoc;

SalesParmLine salesParmLineLoc; AVA_Header ava_HeaderLoc;

// @AVA –

2. Search the line “ttscommit;” and “if (printout == Printout::Current)

” and insert the following code in between

//AVA + if (!AVA_Configuration::find().DisableTaxCalculation)

{ if (journal.TableId == tableNum(custInvoiceJour) &&

this.parmFormletterType() == FormletterType::Sales)

Page 32: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

32 | P a g e

{ custInvoiceJourLoc = journal;

salesParmTableLoc = formletterParmTable;

if (custInvoiceJourLoc.InvoiceId && !Proforma) {

taxEngine.CommitTax(custInvoiceJourLoc.InvoiceId , salesParmTableLoc.salesTable().TaxGroup,

salesParmTableLoc.salesTable().SalesType);

}

select RemainAfter from salesParmLineLoc where salesParmLineLoc.ParmId ==

salesParmTableLoc.ParmId && salesParmLineLoc.TableRefId ==

salesParmTableLoc.TableRefId; if(salesParmLineLoc.RemainAfter != 0)

{

taxEngine.getTax(salesParmTableLoc.salesTable(),systemDateGet());

} else

{ delete_from ava_HeaderLoc where

ava_HeaderLoc.DocNumber == custInvoiceJourLoc.SalesId; }

}

} //AVA -

4. FORMS

CustFreeInvoice

SalesQuotationTable

SalesTable

SalesTableListPage LogisticsPostalAddress

CustTable

CustTableListPage

MarkupTrans

CustFreeInvoice

Method: Code Changes

Page 33: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

33 | P a g e

1. Data Source -CustInvoiceTable -> written

1. Declare the following variable

AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine();

// @AVA +-

2. Search the lines “super();” and “ttscommit;” and insert the following code between these lines.

// @ AVA +

if (custInvoiceLine.RecId && ((subStr(custInvoiceTable.TaxGroup,1,6) ==

subStr(AVA_Configuration::find().TaxGroupId,1,6))))

ava_TaxEngine.GetTax(custInvoiceTable, custInvoiceTable.InvoiceDate);

// @ AVA -

SalesQuotationTable

Method: Code Changes

Methods: 1. ClassDeclaration

2. init

3. isCalcTax

1. Declare the following variable

boolean isCalcTax; // @AVA +-

1. Add following code at the end of method

this.isCalcTax(true); // @AVA +- 1. Create new method as follows

public boolean isCalcTax(boolean _isCalcTax = isCalcTax) {

isCalcTax = _isCalcTax;

return isCalcTax; }

1. Override “clicked” method as follows:

void clicked() {

// @AVA +- AVA_TaxEngine taxEngine = new AVA_TaxEngine(); //

;

if (element.isCalcTax())

{ ttsbegin;

TaxEngine.GetTax(salesQuotationTable, today()); ttscommit;

}

Page 34: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

34 | P a g e

Datasources: SalesQuotationTable

1. write

// @AVA +- super();

element.isCalcTax(false); // @AVA +- }

2. Override “clicked” method as follows:

void clicked()

{ AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +-

;

// @AVA +-

if (element.isCalcTax()) {

ttsbegin; taxEngine.GetTax(salesQuotationTable, today());

ttscommit; }

// @AVA +-

SalesQuotationTotals::showTax(menuitemDisplayStr(TaxTmpWorkSalesQuote),

salesQuotationTable); element.isCalcTax(false); // @AVA +-

}

1. Declare the following variable

AVA_TaxEngine TaxEngine= New AVA_TaxEngine();

2. Search the lines “super();”and insert the following code between these

lines.

// @AVA + taxEngine.GetTax(salesQuotationTable, systemDateGet());

if(SalesQuotationLine.RecId) {

element.isCalcTax(false); }

// @AVA -

Page 35: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

35 | P a g e

Datasources:

SalesQuotationLine

1. write

1. At the end of method add following code

element.isCalcTax(true); // @AVA +-

SalesTable

Create a MenuItemButton as mentioned below:

Method: Code Changes

Datasources : SalesTable

1. write

1. Declare the following variable

Page 36: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

36 | P a g e

AVA_TaxEngine AVA_TaxEngine= New AVA_TaxEngine();

2. Search the lines “ mustReread = true }” and

“ttscommit;” and insert the following code between these lines.

AVA_TaxEngine.GetTax(SalesTable,

systemDateGet()); // @AVA +-

init

1. Add the following macro before variable declaration #AVA_Macro

2.Search the line “if (isUnrealizedVATEnabled)

{ this.updateDesignForUnrealizedVAT(); }” and insert the following code thereafter

// @AVA +

AVA_TaxOverrideDate.enabled(strscan(( AVA_Configuration::find().Services), #TaxService,

1, 100) && (AVA_Configuration::find().EnableTaxOverrideDate)?

true : false);

// @AVA -

Change this method as highlighted below:

void clicked()

{

AVA_TaxEngine taxEngine = new AVA_TaxEngine();

taxEngine.GetTax(salesTable, systemDateGet()); // @AVA +-

element.automaticTotalDiscount();

SalesTotals::showTaxLine(menuitemDisplayStr

(TaxTmpWorkSalesOrder), salesTable,salesLine,element);

}

SalesTableListPage

Create a MenuItemButton as mentioned below:

Page 37: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

37 | P a g e

LogisticsPostalAddress

Create a Button as mentioned below:

Page 38: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

38 | P a g e

Add static text as like below fig:

Page 39: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

39 | P a g e

Method: Code Changes

ClassDeclaration

Add the following variable declaration as below:

boolean validatedAddress; // @AVA+-

addressValidation

Create a new method with the following code:

/// <summary> /// Method validates address instead of parametars /// </summary> // @AVA+- void addressValidation() { AVA_AddressValidation addressValidation = new ava_AddressValidation(); ; addressValidation.validateAddress( strLine(LogisticsPostalAddress.Street, 0), strLine(LogisticsPostalAddress.Street, 1), strLine(LogisticsPostalAddress.Street, 2), LogisticsPostalAddress.City, LogisticsPostalAddress.State, LogisticsPostalAddress.Zipcode, LogisticsPostalAddress.CountryRegionId);

Page 40: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

40 | P a g e

if(!ava_Configuration::find().DisableAddressValidation) { if (addressValidation.parmErrorMessage() != '') { errorMessage.visible(true); errorMessage.text("@SYS8500"+": "+addressValidation.parmErrorMessage()); } else { errorMessage.visible(true); errorMessage.text("@AVA550"); } } if ( addressValidation.parmResultCode() == 0 ) validatedAddress = true; else validatedAddress = false; }

Init 1. Add the following macro before variable declaration #AVA_Macro

2. Search the line “deliveryTab.visible(false); }” and insert the following code thereafter // @AVA + AVA_ValidAddress.enabled(strscan(( AVA_Configuration::find().Services), #AddressService, 1, 100) ? true : false); validatedAddress = false; // @AVA +-

DataSource Method:

LogisticsPostalAddress -> ValidateWrite:

Search the line “ret = ret && postalAddressForm.validatePostalAddress(postalAddressOrig, logisticsPostalAddress);” and “return ret;” and insert the following code in between

validatedAddress = false; // @AVA +-

Override this method with the following code:

/// <summary>

/// This method updates the records in Ava_ValidAddress table /// </summary> // @AVA +-

void clicked() { AVA_AddressValidation addressValidation = new ava_AddressValidation();

AVA_EntityUseCodeMapping entityUseCode; if (validatedAddress)

{ //addressValidation.UpdateTables(logisticsPostalAddress);

Page 41: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

41 | P a g e

addressValidation.UpdateTables(logisticsPostalAddress,DateTimeUtil::utcNow()); } ttsBegin;

select forUpdate entityUseCode

where entityUseCode.LogisticsPostalAddressRecId == logisticsPostalAddress.Location;

if(entityUseCode) { entityUseCode.DeliveryName = LogisticsLocation.Description;

entityUseCode.Address = logisticsPostalAddress.Address; entityUseCode.update(); } ttsCommit;

super();

}

Override the method with the following code: /// <summary> /// Address validation /// </summary> // @AVA+- void clicked() { if(ava_Configuration::find().DisableAddressValidation) { error("@AVA496"); } else { super(); } }

Change property value as following

Page 42: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

42 | P a g e

Page 43: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

43 | P a g e

CustTable

Create a buttonGroup as mentioned below:

Create a MenuItemButtons as mentioned below:

Page 44: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

44 | P a g e

CustTableListPage

Create a buttonGroup as mentioned below:

Create a MenuItemButtons as mentioned below:

Page 45: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

45 | P a g e

MarkupTrans Method: Code Changes

1. Data Source -MarkupTrans ->

write

3. Declare the following variable

Object callerFormObject; //AVA+-

4. Add following code before last closing brackets.

//AVA +

callerFormObject = element.args().caller(); if (callerFormObject && callerFormObject.name() ==

formStr(SalesQuotationTable) && formHasMethod(callerFormObject,

identifierStr(isCalcTax))) {

callerFormObject.isCalcTax(true); }

//AVA -

Page 46: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

46 | P a g e

5. Number Sequence

AvaTax Created the following Number Sequence:

Number Sequence Code

Path Change

Ava_Head

Organization administration ->

Common -> Number Sequences -> Number Sequences

Create a new number sequence with the following properties:

Number Sequence code: Ava_Head Name: Header id

Scope Parameters: Scope: Company

Company: Name of the company Segments: Segment: Alphanumeric

value: ######## length: 8 Format: ########

References:

Area: Sales

Reference: Header id

Manual: false; Contineous: false;

Smallest: 1 Largest: 99999999 Next: This value should be higher

than the maximum value of the “TaxHeaderID” (field) of the “Ava_Header” (Table).

Page 47: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

47 | P a g e

6. MENU

Modifications

To Import the Avatax menu please follow the following steps :

1. Go to Import window 2. Select “SharedProject_AvalaraAX.xpo

Page 48: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

48 | P a g e

3. Click on the Show Details check box

4. Deselect all the items by unchecked AOT 5. Select only the Menus check box

6. Click on Ok

7. One confirmation window will appear. Click on Yes.

Page 49: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

49 | P a g e

AVATAX - AX PROJECT INTEGRATION

7. TABLES (Project Integration)

AvaTax Changed the following list of Table:

ID Name

617 ProjProposalJour

550 TmpTaxWorkTrans

617- ProjProposalJour

Method Name Modifications

1. insert 1. Declare the following variable

DialogButton diagBut;

2. Search the line “if (isConfigurationkeyEnabled(configurationkeynum(Project3))

&& (this.InvoiceDate == dateNull()))” and “super();” and insert the following code in between

// @AVA +

//BP Deviation Documented if ((!AVA_Configuration::find().DisableTaxCalculation) && (

(substr(this.TaxGroupId,1,6) !=

substr(AVA_Configuration::find().TaxGroupId,1,6)))) {

diagBut = box::yesNo("@AVA398"+ this.TaxGroupId +"@AVA399" + AVA_Configuration::find().TaxGroupId + '\n'+

"@AVA400" + AVA_Configuration::find().TaxGroupId + "@AVA401",

DialogButton::Yes); if (diagBut == DialogButton::Yes)

{

this.TaxGroupId = AVA_Configuration::find().TaxGroupId;

} }

// @AVA -

2. findAVA_RecId Create this new method with below code.

/// <summary> /// Methods gets record from projProposalJour table based on

recId /// </summary>

/// <param name="recId">

/// RecId recId /// </param>

/// <param name="update">

Page 50: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

50 | P a g e

/// boolean update = false /// </param>

/// <returns> /// projProposalJour findAVA_RecId

/// </returns> static projProposalJour findAVA_RecId(

RecId recId, boolean update = false)

{

ProjProposalJour projProposalJour; ;

projProposalJour.selectForUpdate(update);

select firstonly projProposalJour

index hint recid where projProposalJour.RecId == recId;

return projProposalJour; }

550 - TmpTaxWorkTrans

Method Name Modifications

1. showTaxValue Search the line “ConAmtNumber = TaxEngine.SalesQuotationTaxDataUpdate(this.TaxCode,

this.SourceRecId, DetailNumber, '', PrevTaxCode, True); }” and “ TaxValue =

Conpeek(ConAmtNumber,1);” and insert the following lines

in between

if (this.SourceTableId == tablename2id(tablestr(projProposalOnAcc)))

{ ConAmtNumber =

TaxEngine.projProposalOnAccTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True);

}

if (this.SourceTableId == tablename2id(tablestr(projProposalItem)))

{ ConAmtNumber =

TaxEngine.projProposalItemTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True);

} if (this.SourceTableId ==

tablename2id(tablestr(projProposalEmpl)))

{ ConAmtNumber =

TaxEngine.projProposalEmplTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True);

Page 51: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

51 | P a g e

} if (this.SourceTableId ==

tablename2id(tablestr(projProposalRevenue))) {

ConAmtNumber = TaxEngine.projProposalRevenueTaxDataUpdate(this.TaxCode,

this.SourceRecId, DetailNumber, '', PrevTaxCode, True); }

if (this.SourceTableId ==

tablename2id(tablestr(projProposalCost))) {

ConAmtNumber = TaxEngine.projProposalCostTaxDataUpdate(this.TaxCode,

this.SourceRecId, DetailNumber, '', PrevTaxCode, True); }

8. CLASSES (Project Integration)

AvaTax Changed the following list of Classes:

1019305 - SalesInvoiceJournalCreate

Method Name Modifications

initJournalHeader Search for “super();” and add following after

// @AVA +

if (!salesParmTable.salesTable().ProjId) {

if (salesParmUpdate.Proforma)

ava_TaxEngine.GetTax(salesParmTable.salesTable(), salesParmTable.Transdate, true, salesParmTable);

else AVA_TaxEngine.GetTax(salesTable,

salesParmTable.Transdate, false, salesParmTable,

ava_DocumentType::SalesInvoice, custInvoiceJour.InvoiceId);

}

ID Name

1019305 SalesInvoiceJournalCreate

1018730 ProjInvoiceJournalPost

1204 TaxProj

583 Tax

683 SalesQuotationEditLinesForm_Proj_Send

681 SalesQuotationEditLinesForm_Proj_Confir

1018729 ProjInvoiceJournalCreate

Page 52: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

52 | P a g e

// @AVA -

1018730 – ProjInvoiceJournalPost

Method Name Modifications

postJournalPost

Override this method and add the following code:

1. Add the following variable declaration: AVA_TaxEngine ava_TaxEngine = new

AVA_TaxEngine(); // @AVA +-

2. Insert the following code after the “Super()” call

// @AVA +

if ((!projInvoiceJour.isProforma()) && (AVA_TaxEngine.isProjPrepayment(projProposalJour))) AVA_TaxEngine.CommitTax(projInvoiceJour.ProjInvoiceId,

projProposalJour.TaxGroupId, projProposalJour.DefaultDimension,

projProposalJour.InvoiceAmount < 0 ? salesType::ReturnItem : salesType::Sales);

1204 - TaxProj

Method Name Modifications

1. new 1. Add the following macro after variable declaration #AVA_Macro

Search the line “lineRecId = SalesCalcTax.transRecId();” and “if (! this.checkTaxCodesByLine()) {“ and replace the existing

code with the following code.

//@AVA+ /*

this.insertIntersection(salesCalcTax.transTaxGroup(), salesCalcTax.transTaxItemGroup(),

salesCalcTax.transTransId(),

salesCalcTax.transItemId(), taxCalculationDate);

*/ //BP Deviation Documented

Page 53: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

53 | P a g e

if ((substr(salesCalcTax.parmProjProposalJour().TaxGroupId,1,6)

!= substr(AVA_Configuration::find().TaxGroupId,1,6)) || (AVA_Configuration::find().DisableTaxCalculation))

{ this.insertIntersection(salesCalcTax.transTaxGroup(),

salesCalcTax.transTaxItemGroup(), salesCalcTax.transTransId(),

salesCalcTax.transItemId(),

taxCalculationDate); }

else {

if (salesCalcTax.markupTaxItemGroup()) {

this.insertIntersection(Ava_configuration::find().TaxGroupId,

salesCalcTax.transTaxItemGroup(), salesCalcTax.transTransId(),

salesCalcTax.transItemId(), taxCalculationDate);

} else

{

this.insertIntersection(Ava_configuration::find().TaxGroupId,

#All, salesCalcTax.transTransId(),

salesCalcTax.transItemId(), taxCalculationDate);

} }

//@AVA-

2. markup 1. Add the following macro #AVA_Macro

2. Search the line “markupAdminister = NoYes::Yes;”

and “if (! this.checkTaxCodesByLine()) “ and replace the existing code with following code.

//@AVA+ /*

this.insertIntersection(salesCalcTax.markupTaxGroup(),

salesCalcTax.markupTaxItemGroup(), _transId,

markupTrans.Txt, taxDate);

*/

Page 54: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

54 | P a g e

//BP Deviation Documented if

((substr(salesCalcTax.parmProjProposalJour().TaxGroupId,1,6) != substr(AVA_Configuration::find().TaxGroupId,1,6)) ||

(AVA_Configuration::find().DisableTaxCalculation)) {

this.insertIntersection(salesCalcTax.markupTaxGroup(),

salesCalcTax.markupTaxItemGroup(), _transId,

markupTrans.Txt, taxDate);

} else

{ if (salesCalcTax.markupTaxItemGroup())

{

this.insertIntersection(Ava_configuration::find().TaxGroupId,

salesCalcTax.markupTaxItemGroup(),

_transId, markupTrans.Txt,

taxDate); }

else

{

this.insertIntersection(Ava_configuration::find().TaxGroupId, #All,

_transId, markupTrans.Txt,

taxDate); }

}

//@AVA-

583 – Tax

Method Name Modifications

1. allocateInTaxWorkTrans

Search the line “ConAmtNumber = TaxEngine.SalesQuotationTaxDataUpdate(taxWorkTrans.TaxCo

de, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode); }” and “taxWorkTrans.TaxAmount =

Page 55: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

55 | P a g e

Conpeek(ConAmtNumber,1)*(-1);” and insert the following code in between

if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(projProposalOnAcc))) {

ConAmtNumber = TaxEngine.projProposalOnAccTaxDataUpdate(taxWorkTrans.Ta

xCode, taxWorkTrans.SourceRecId, DetailNumber,

AVA_invoiceId, PrevTaxCode); }

if (taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalItem)))

{ ConAmtNumber =

TaxEngine.projProposalItemTaxDataUpdate(taxWorkTrans.TaxCode, taxWorkTrans.SourceRecId, DetailNumber,

AVA_invoiceId, PrevTaxCode);

} if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(projProposalEmpl))) {

ConAmtNumber = TaxEngine.projProposalEmplTaxDataUpdate(taxWorkTrans.Tax

Code, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode);

}

if (taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalRevenue)))

{ ConAmtNumber =

TaxEngine.projProposalRevenueTaxDataUpdate(taxWorkTrans.TaxCode, taxWorkTrans.SourceRecId, DetailNumber,

AVA_invoiceId, PrevTaxCode); }

if (taxWorkTrans.SourceTableId ==

tablename2id(tablestr(projProposalCost))) {

ConAmtNumber = TaxEngine.projProposalCostTaxDataUpdate(taxWorkTrans.TaxC

ode, taxWorkTrans.SourceRecId, DetailNumber, AVA_invoiceId, PrevTaxCode);

}

683 - SalesQuotationEditLinesForm_Proj_Send

Method Name Modifications

createJournal 1. Declare the following variable

AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); // @AVA +-

Page 56: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

56 | P a g e

2. Search the line

“salesQuotationTotals.prepareQuantitiesCalculation();” and “this.tax(salesQuotationTotals.tax());”

and insert the following code in between

// @AVA + taxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA -

681 - SalesQuotationEditLinesForm_Proj_Confir

Method Name Modifications

createJournal 1. Declare the following variable

AVA_TaxEngine TaxEngine = New

AVA_TaxEngine(); // @AVA +- ;

2. Search the line “salesQuotationTotals.prepareQuantitiesCalculation();”

and “this.tax(salesQuotationTotals.tax());” and insert the following code in between

// @AVA +- taxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA -

1018729 – ProjInvoiceJournalCreate

Method Name Modifications

initJournalHeader

1. Declare the following variable and Macro

declaration

// @AVA +

AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine();

#AVA_Macro

// @AVA -

2. Search the line EInvoiceCFDIPostValidation_MX::construct(projInvoice

Jour.InvoiceDate);

}} //</GMX>”

and “this.exchRateSet();” and insert the following

code in between

// @AVA + if (projInvoiceJour.isProforma())

Page 57: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

57 | P a g e

ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, true, null);

else ava_TaxEngine.GetTax(projProposalJour,

projInvoiceParmTable.InvoiceDate, false, null ,ava_DocumentType::SalesInvoice,

projInvoiceJour.ProjInvoiceId); // @AVA -

initTotals

1. Declare the variables and add call of GetTax

as highlighted below { PSACustomerRetention psaCustomerRetention; AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine(); #AVA_Macro ; projProposalJour = this.getProjProposalJour(projInvoiceParmTable, true); //AVA+ if (projInvoiceJour.isProforma()) ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, true, null); else ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, false, null ,ava_DocumentType::SalesInvoice, projInvoiceJour.ProjInvoiceId); // @AVA - if (isConfigurationkeyEnabled(configurationKeyNum(PSAARRetainage)) && !this.proforma()) { psaCustomerRetention = new PSACustomerRetention(); psaCustomerRetention.parmProjProposalJour(projProposalJour); psaCustomerRetention.initParmDefault(); psaCustomerRetention.parmQueryRevenueTrans(true); psaCustomerRetention.run(); } projProposalJour.InvoiceDate = projInvoiceParmTable.InvoiceDate; projProposalTotals = new ProjProposalTotals(projProposalJour, parmId); projProposalTotals.projInvoiceParmTable(projInvoiceParmTable); projProposalTotals.calc(); // update projproposaljour while posting project invoice proposal if (projProposalJour && !projProposalJour.InvoiceAmount) { projProposalJour.selectForUpdate(true); projProposalJour.InvoiceAmount = projProposalTotals.projInvoiceTotalAmount(); projProposalJour.update(); }

Page 58: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

58 | P a g e

this.parmTax(projProposalTotals.tax()); if (projProposalTotals.projInvoiceTotalAmount() < 0) creditNote = NoYes::Yes; else creditNote = NoYes::No; }

9. FORMS (Project Integration)

AvaTax Changes are at the following list of Form:

SalesQuotationProjTable

ProjInvoiceProposalDetail

ProjInvoiceProposalListPage

ProjInvoiceTotals

ProjInvoiceProposal

SalesQuotationProjTable

Method: Code Changes

ClassDeclaration

isCalcTax

Datasource-> SalesQuotationTable -> Write

Datasource->

SalesQuotationLine -> Write

1. Declare the following variable boolean isCalcTax; // @AVA +-

1. Create new method as follows public boolean isCalcTax(boolean _isCalcTax = isCalcTax)

{ isCalcTax = _isCalcTax; return isCalcTax;

}

1. Search line “salesQuotationTable.update();}” and

“ttscommit” and insert the following in between

element.isCalcTax(true); // @AVA +-

1. Add following at the end of method element.isCalcTax(true); // @AVA +-

1. Declare the following variable

AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); //

@AVA +-

2. 2. Search the lines

“SalesQuotationTotals::showTax(menuitemDisplayStr(TaxTmpWorkSalesQuote), salesQuotationTable);” and insert

the following code above this line.

Page 59: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

59 | P a g e

// @AVA +-

if (element.isCalcTax()) {

ttsbegin; TaxEngine.GetTax(salesQuotationTable, Today());

ttscommit; }

// @AVA + 3. Search the lines

“SalesQuotationTotals::showTax(menuitemDisplayStr(TaxTmpWorkSalesQuote), salesQuotationTable);” and

insert the following code below this line.

element.isCalcTax(false); // @AVA +-

1. Override clicked method as follows

void clicked()

{ // @AVA +-

AVA_TaxEngine TaxEngine = New

AVA_TaxEngine(); //

if (element.isCalcTax()) {

ttsbegin; TaxEngine.GetTax(salesQuotationTable, Today());

// Docdate needs to be calculate ttscommit;

}

// @AVA +-

super();

element.isCalcTax(false); // @AVA +- }

ProjInvoiceProposalDetail

Method / Properties Modification

1. Declare following variable.

AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +-

2.Search the line “projProposalTotals = new ProjProposalTotals(projProposalJour);” and insert the

following lines after this line.

Page 60: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

60 | P a g e

AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate); // @AVA +-

ProjInvoiceProposalListPage

Method / Properties Modification

1. Declare following variable.

AVA_TaxEngine AVA_TaxEngine = New

AVA_TaxEngine();// @AVA +-

2.Search the line “projProposalTotals = new

ProjProposalTotals(projProposalJour);” and insert the following lines after this line.

AVA_TaxEngine.GetTax(projProposalJour,

projProposalJour.InvoiceDate); // @AVA +-

ProjInvoiceTotals

Method / Properties Modification

calcTotals

1. Declare following variable.

AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +-

2.Search the line “displayFieldsProj =

ProjProposalTotals::displayFieldsServer(projProposalJourLocal.RecId);” and insert the following lines before this line.

AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate); // @AVA +-

ProjInvoiceProposal

Create a menu button as mentioned below

Page 61: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

61 | P a g e

Method / Properties Modification

init 1. Declare Micro as following.

#AVA_Macro //AVA+-

Page 62: Table of Contentsss - help.avalara.comapi/deki/files/10892/AX_AvaTax_Install... · Table of Contentsss 1. ... 429 - Tax Data ... 230 MarkupTrans 229 MarkupTable 77 CustTable 429 -

Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU7 <MS Dynamics AX Connector Build 6.2.1000.4051.03.00>

62 | P a g e

getShowTax 1. Declare following variable.

AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +-

2. Search for “projProposalTotals = new

ProjProposalTotals(projProposalJour);” and “ projProposalTotals.calc();” and add following code in between

AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate); // @AVA +-

10. Number Sequence (Project Integration)

AvaTax created the following Number Sequence: Number Sequence Code

Path Change

Ava_Head

Organization administration ->

Common -> Number Sequences -> Number Sequences

Create a new number sequence with the following properties:

Number Sequence code: Ava_Head Name: Header id Scope Parameters: Scope: Company

Company: Name of the company Segments: Segment: Alphanumeric

value: ######## length: 8 Format: ########

References: Area: Sales Reference: Header id

Manual: false; Contineous: false; Smallest: 1

Largest: 99999999 Next: This value should be higher than the maximum value of the “TaxHeaderID” (field) of

the “Ava_Header” (Table).