avatax for dynamics ax 2012 r3 - avalara help centerapi/deki/files/5164/ax_avatax_install_r3... ·...

58
AvaTax for Dynamics AX 2012 R3 Code Change Document Version 1.0 Revision date: 6/18/14 Product release #: AvaTax for Microsoft Dynamics AX 2012 R3 Version AX 6.3.164.0.01.00 Avalara may have patents, patent applications, trademarks, copyrights, or other intellectual property rights governing the subject matter in this document. Except as expressly provided in any written license agreement from Avalara, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. © 2013 Avalara, Inc. All rights reserved. Avalara, AvaTax, AvaTax Calc, AvaTax Returns, AvaTax Certs, AvaTax Local, AvaLocal, AvaTax POS, AvaPOS, AvaRates, TrustFile, BPObridge, Laserbridge+, Sales Taxll, Sales TaxPC, SalestaxPC+, StatetaxII, and StatetaxPC are either registered trademarks or trademarks of Avalara, Inc. in the United States or other countries. All other trademarks are property of their respective owners.

Upload: vutu

Post on 30-Jan-2018

239 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

AvaTax for Dynamics AX 2012 R3

Code Change Document

Version 1.0

Revision date: 6/18/14

Product release #: AvaTax for Microsoft Dynamics AX 2012 R3 Version AX 6.3.164.0.01.00

Avalara may have patents, patent applications, trademarks, copyrights, or other intellectual property rights

governing the subject matter in this document. Except as expressly provided in any written license agreement

from Avalara, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

© 2013 Avalara, Inc. All rights reserved.

Avalara, AvaTax, AvaTax Calc, AvaTax Returns, AvaTax Certs, AvaTax Local, AvaLocal, AvaTax POS, AvaPOS, AvaRates, TrustFile, BPObridge, Laserbridge+, Sales Taxll, Sales TaxPC, SalestaxPC+,

StatetaxII, and StatetaxPC are either registered trademarks or trademarks of Avalara, Inc. in the United

States or other countries.

All other trademarks are property of their respective owners.

Page 2: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

2 | P a g e

Table of Contents 1. OVERVIEW ............................................................................................................................... 4 2. TABLES ..................................................................................................................................... 5

1. TaxData ................................................................................................................................... 5 2. TmpTaxWorkTrans................................................................................................................. 6 3. TaxOnItem .............................................................................................................................. 9 4. TaxGroupData......................................................................................................................... 9 5. TaxTable ............................................................................................................................... 10

6. TaxLedgerAccountGroup ..................................................................................................... 11 7. TaxReportPeriod ................................................................................................................... 11 8. TaxPeriodHead ..................................................................................................................... 12 9. TaxAuthorityAddress ............................................................................................................ 13

10. TaxGroupHeading............................................................................................................... 13 11. TaxItemGroupHeading ....................................................................................................... 14

12. SalesParameters .................................................................................................................. 14 13. LogisticsPostalAddress ....................................................................................................... 14 14. SalesTable ........................................................................................................................... 15

15. MarkupTrans ....................................................................................................................... 16 3. MAP .......................................................................................................................................... 17

1. LogisticsPostalAddressMap .................................................................................................. 17 4. CLASSES ................................................................................................................................. 19

1. SalesQuotationEditLinesForm_Sales_Confir ....................................................................... 19

2. SalesQuotationEditLinesForm_Sales_Send ......................................................................... 20 3. SalesInvoiceJournalPost ....................................................................................................... 20

4. CustPostInvoice .................................................................................................................... 21

5. SalesTotals_ParmTrans......................................................................................................... 22

6. SalesInvoiceJournalCreate .................................................................................................... 22 7. ApplicationVersion ............................................................................................................... 23

8. Tax ........................................................................................................................................ 23 9. SalesTableForm .................................................................................................................... 28 10. NumberSeqModuleSalesOrder ........................................................................................... 28

11. SalesTotals .......................................................................................................................... 29 12. SalesTableListPageInteraction ............................................................................................ 29

5. FORMS ..................................................................................................................................... 30 1. CustFreeInvoice .................................................................................................................... 30 2. SalesQuotationTable ............................................................................................................. 31 3. SalesTable ............................................................................................................................. 32

4. SalesTableListPage ............................................................................................................... 34 5. LogisticsPostalAddress ......................................................................................................... 35

6. CUSTTABLE ..................................................................................................................... 40

7. CUSTTABLELISTPAGE .................................................................................................. 41 6. Number Sequence ..................................................................................................................... 43 Ava_Head ..................................................................................................................................... 43 7. MENU ....................................................................................................................................... 44 8. TABLES (Project Integration) .................................................................................................. 46

1. ProjProposalJour ................................................................................................................... 46

Page 3: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

3 | P a g e

2. TmpTaxWorkTrans............................................................................................................... 47 9. CLASSES (Project Integration) ................................................................................................ 50

1. ProjInvoiceJournalCreate ...................................................................................................... 50 2. ProjInvoiceJournalPost ......................................................................................................... 51 3. TaxProj .................................................................................................................................. 51 4. SalesQuotationEditLinesForm_Proj_Send ........................................................................... 54 5. SalesQuotationEditLinesForm_Proj_Confir ......................................................................... 55

10. FORMS (Project Integration) ................................................................................................. 56 1. SalesQuotationProjTable ...................................................................................................... 56 2. ProjInvoiceProposalDetail .................................................................................................... 57 3. ProjInvoiceProposalListPage ................................................................................................ 57 4. ProjInvoiceTotals .................................................................................................................. 58

Page 4: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

4 | P a g e

1. OVERVIEW

To install the AvaTax connector for MS Dynamics AX 2012 R3

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 R3) 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 R3. 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 5: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

5 | P a g e

2. TABLES

AvaTax change the following tables:

S. No. Object ID Name

1. 429 TaxData

2. 550 TmpTaxWorkTrans

3. 434 TaxOnItem

4. 430 TaxGroupData

5. 439 TaxTable

6. 433 TaxLedgerAccountGroup

7. 437 TaxReportPeriod

8. 436 TaxPeriodHead

9. 427 TaxAuthorityAddress

10. 431 TaxGroupHeading

11. 432 TaxItemGroupHeading

12. 367 SalesParameters

13. 2941 LogisticsPostalAddress

14. 366 SalesTable

15. 230 MarkupTrans

1. TaxData

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; }

2. findTaxCode Create this new method with below code. /// <summary> /// Method finds tax code /// </summary> /// <param name="_taxCode"> /// TaxCode _taxCode /// </param> /// <param name="_forupdate">

Page 6: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

6 | P a g e

/// 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; }

2. TmpTaxWorkTrans

Method Name Modifications

showTaxValue

Insert the highlighted lines as specified hereunder:

// BP Deviation Documented

server display TaxValue showTaxValue()

{

TaxValue taxValue;

// @AVA +

TaxGroup taxGroup;

Container conAmtNumber;

Ava_taxEngine taxEngine = new Ava_taxEngine();

//BP Deviation Documented

int detailNumber = 3;

TaxCode prevTaxCode;

SysGlobalCache globalCache = Infolog.globalCache();

// @AVA -

// <GIN>

SalesPurchJournalLine_IN salesPurchJournalLine;

Page 7: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

7 | P a g e

// </GIN>

;

// @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);

}

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);

}

Page 8: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

8 | P a g e

if (this.SourceTableId ==

tablename2id(tablestr(projProposalEmpl)))

{

ConAmtNumber =

TaxEngine.projProposalEmplTaxDataUpdate(this.TaxCode,

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

}

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);

}

//BP Deviation Documented

TaxValue = Conpeek(ConAmtNumber,1);

//BP Deviation Documented

DetailNumber = Conpeek(ConAmtNumber,2);

//BP Deviation Documented

PrevTaxCode = Conpeek(ConAmtNumber,3);

//BP Deviation Documented

globalCache.set(#TmpTaxWorkTrans, 0,PrevTaxCode);

//BP Deviation Documented

globalCache.set(#TmpTaxWorkTrans, 1,int2str(DetailNumber));

}

else // @AVA -

if (this.TaxCode && this.TransDate)

{

// <GIN>

if (TaxParameters::checkTaxParameters_IN() &&

TaxTable::find(this.TaxCode).TaxType_IN != TaxType_IN::None)

{

salesPurchJournalLine =

Tax::getSalesPurchJournalLine_IN(this.SourceRecId,

this.SourceTableId);

taxValue = this.showTaxValue_IN(salesPurchJournalLine);

}

else

{

// </GIN>

taxValue = TaxData::percent(this.TaxCode,

Page 9: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

9 | P a g e

this.CalculationDate,

this.TaxBaseAmount);

// <GIN>

}

// </GIN>

}

return taxValue;

}

3. 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; }

4. TaxGroupData

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)

Page 10: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

10 | P a g e

/// </param>

server void initTaxGroupData(

TaxGroup _taxGroup,

TaxCode _taxCode)

{

;

this.TaxGroup = _taxGroup;

this.TaxCode = _taxCode;

}

5. 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,

TaxName _taxName,

TaxPeriod _taxPeriod,

TaxAccountGroup _taxAccountGroup,

TaxLimitBase _taxLimitBase,

CurrencyCode _currencyCode)

{

;

this.TaxCode = _taxCode;

this.TaxName = _taxName;

this.TaxPeriod = _taxPeriod;

Page 11: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

11 | P a g e

this.TaxAccountGroup = _taxAccountGroup;

this.TaxLimitBase = _taxLimitBase;

this.TaxCurrencyCode = _currencyCode;

}

6. 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;

}

7. 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">

/// TaxPeriodDate _fromDate

/// </param>

/// <param name="_toDate">

/// TaxPeriodDate _toDate

/// </param>

//@AVA +-

server void initTaxPeriod(

TaxPeriod _taxPeriod,

TaxPeriodDate _fromDate,

TaxPeriodDate _toDate)

{

Page 12: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

12 | P a g e

;

this.TaxPeriod = _taxPeriod;

this.FromDate = _fromDate;

this.ToDate = _toDate;

}

8. 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)

{

;

this.TaxPeriod = _taxPeriod;

this.TaxAuthority = _taxAuth;

this.Name = _name;

this.PeriodUnit = _periodUnit;

this.QtyUnit = _qty;

}

Page 13: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

13 | P a g e

9. 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>

/// <param name="_name">

/// Name _name

/// </param>

//@AVA +-

server void initTaxAuthCode(

TaxAuthority _taxAuth,

Name _name)

{

;

this.TaxAuthority = _taxAuth;

this.Name = _name;

}

10. 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)

{

;

Page 14: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

14 | P a g e

this.TaxGroup = _taxGrp;

this.TaxGroupName = _taxGrpName;

}

11. 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;

}

12. SalesParameters

Method Name Modifications

numRefAVANum

Create this new method with below code.

static client server NumberSequenceReference numRefAVANum()

{

return

NumberSeqReference::findReference(extendedTypeNum(AVA_HeaderId)

);

}

13. LogisticsPostalAddress

Method Name Modifications

initFromAVA_Ad

dressValidation

Create this new method with below code.

Page 15: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

15 | P a g e

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.parmLine1();

}

}

initFromAVA_tm

pValidAddress

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.Address1;

this.Address = _tmpValidAddress.Address;

}

14. 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-

Page 16: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

16 | P a g e

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-

15. 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 true;

else // @AVA -

Page 17: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

17 | P a g e

3. MAP

S. No. Object ID Name

1. 3110 LogisticsPostalAddressMap

1. LogisticsPostalAddressMap

Create mapping for AVA_tmpInputAddress as follows:

Page 18: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

18 | P a g e

Create mapping for AVA_tmpValidAddress as follows:

Page 19: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

19 | P a g e

4. CLASSES

S. No.

Object ID Name

1. 685 SalesQuotationEditLinesForm_Sales_Confir

2. 686 SalesQuotationEditLinesForm_Sales_Send

3. 1019307 SalesInvoiceJournalPost

4. 77 CustPostInvoice

5. 547 SalesTotals_ParmTrans

6. 1019305 SalesInvoiceJournalCreate

7. 758 ApplicationVersion

8. 583 Tax

9. 1235 SalesTableForm

10. 1018435 NumberSeqModuleSalesOrder

11. 546 SalesTotals

12. SalesTableListPageInteraction

1. 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 int Line = 1; // @AVA +- 2. Search the line “salesDeliverySchedule.insert(); }” and “// PBA Begin if (salesQuotationLineUpdate.ItemPBAId)” and insert the following code in between // @AVA + Line++;

Page 20: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

20 | P a g e

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

4. updateNow

1. Declare the following variable AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); // @AVA +- MarkupTrans markupTrans; 2. Search the line “this.createSalesLines(salesQuotationTable, salesTableCreated);” and “} } this.writeJournalLine();” and insert the following code in between // @AVA + while select RecId from markupTrans where markupTrans.TransTableId == salesTableCreated.TableId && markupTrans.TransRecId == salesTableCreated.RecId { line++; ArrLine [Line] = markupTrans.RecId; } // @AVA - TaxEngine.CopyAvaTables(salesQuotationTable.QuotationId, salesTableCreated.SalesId, ArrLine); // @AVA +-

2. SalesQuotationEditLinesForm_Sales_Send

Method Name Modifications

createJournal

1. Declare the following variable AVA_TaxEngine TaxEngine = New AVA_TaxEngine();// @AVA +- 2. Search the line “salesQuotationTotals.totalAmountCashDiscOnInvoice(true); }” and “this.tax(salesQuotationTotals.tax());” and insert the following code in between taxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA +-

3. SalesInvoiceJournalPost

Method Name Modifications

1. postJournalPost

1. Declare the following variable AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // AVA +- 2. Search the line “this.deleteFullyInvoiced();

Page 21: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

21 | P a g e

” and closing bracket “}” and insert the following code in between // @AVA + if (custInvoiceJour.InvoiceId && !this.isProforma()) AVA_TaxEngine.CommitTax(custInvoiceJour.InvoiceId, SalesParmTable.salesTable().TaxGroup, salesParmTable.salesTable().SalesType); // @AVA

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().SalesType); // @AVA -

4. CustPostInvoice

Method Name Modifications

runInternal 1. Declare the following variable AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +- 2. Search the line “voucher = custInvoiceTable.mcrLedgerVoucher; }” and “if (!voucher)” and insert the following code in between 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

taxEngine.CommitTax(invoiceId, custInvoiceTable.TaxGroup); // @AVA +-

Page 22: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

22 | P a g e

4.Search the line “sourceDocumentHeader.update();” and “ttscommit;” and insert the following code in between // @AVA + if(!isPostingOK) taxEngine.CancelTax(invoiceId, custInvoiceTable.TaxGroup); // @AVA -

5. SalesTotals_ParmTrans

Method Name Modifications

1. showTax 1. Declare the following variable AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // @AVA +- ; 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 +-

6. 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 the line “super();“ and insert the following code thereafter // @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 -

Page 23: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

23 | P a g e

7. 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; }

8. 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. allocateInTaxWorkTrans

1. Declare the following variable // @AVA + AVA_TaxEngine taxEngine = new Ava_TaxEngine(); TaxGroup taxGroup; // @AVA -

Page 24: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

24 | P a g e

2. Search the line “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, 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))) {

Page 25: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

25 | P a g e

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); } 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 ) {

Page 26: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

26 | P a g e

// 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) { 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

Page 27: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

27 | P a g e

sum(TaxBaseAmountMSTRaw), sum(TaxBaseAmountMST), sum(TaxAmountCur), sum(TaxAmountMST), sum(TaxInCostPrice), sum(TaxInCostPriceCur), sum(TaxInCostPriceMST), sum(TaxBaseQty), sum(SourceTaxAmountCur), 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 “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);” and replace the existing code with the below code } //@AVA+- this.allocateInTaxWorkTrans(tmpTax.TaxCode, tmpTax.TaxDirection, tmpTax.TaxAmountMST, tmpTax.TaxAmountCur, tmpTax.TaxInCostPrice,

Page 28: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

28 | P a g e

tmpTax.TaxInCostPriceMST, tmpTax.TaxInCostPriceCur, tmpTax.TaxBaseAmountMSTRaw, tmpTax.TaxBaseQty, tmpTax.SourceTaxAmountCur, tmpTax.SourceTaxAmountCurReal, NoYes::No, tmpTax.CalculationDate, tmpTax.Warning); //}//@AVA+-

9. SalesTableForm

Method Name Modifications

1. setTouched

Replace the below code. “If(_salesTable.Touched == NoYes::Yes) { return; }” with the highlighted code // @AVA+ if (!Ava_Configuration::find().DisableTaxCalculation) { _salesTable.Touched = NoYes::Yes; } else { // @AVA- if (_salesTable.Touched == NoYes::Yes) { return; } }

10. 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.parmWizardIsContinuous(true); datatype.parmWizardIsManual(NoYes::No); datatype.parmWizardIsChangeDownAllowed(NoYes::No); datatype.parmWizardIsChangeUpAllowed(NoYes::No);

Page 29: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

29 | P a g e

datatype.parmIsGroupEnabled(NoYes::Yes); datatype.parmSortField(66); datatype.addParameterType(NumberSeqParameterType::DataArea, true, false); this.create(datatype); // @AVA -

11. SalesTotals

Method Name Modifications

1. executeDisplayFieldsServer

1. Declare the following variable and macro as below: AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // @AVA +- 2. Search the line “else { salesTotals = SalesTotals::construct(_orderTable, _specQty); } ” and salesTotals.calc(); ” and insert the following code in between ava_TaxEngine.GetTax(salesParmTable.salesTable(), salesParmTable ? salesParmTable.Transdate : today(), True, salesParmTable ); // @AVA +-

12. SalesTableListPageInteraction

Method Name Modifications

1. setButtonSell

1. Declare the following macro as below: #AVA_Macro //@AVA+- 2. at the end of method add below code after condition “if (isConfigurationkeyEnabled(configurationKeyNum(Retail)))”: // @AVA + if(strscan(( AVA_Configuration::find().Services), #TaxService, 1, 100) && (AVA_Configuration::find().EnableTaxOverrideDate)) { this.listPage().actionPaneControlEnabled(formControlStr(salesTableListPage, AVA_TaxOverrideDate),true); } else { this.listPage().actionPaneControlEnabled(formControlStr(salesTableListPage,AVA_TaxOverrideDate),false); } // @AVA -

Page 30: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

30 | P a g e

5. FORMS

S. No. Name

1. CustFreeInvoice

2. SalesQuotationTable

3. SalesTable

4. SalesTableListPage

5. LogisticsPostalAddress

6. CustTable

7. CustTableListPage

1. CustFreeInvoice

Method: Code Changes

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 -

2. Data Source -CustInvoiceLine

-> written

1. Declare the following variable

AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine();

// @AVA +-

2. Add the following code at the end of method

// @ AVA +

if (custInvoiceLine.RecId &&

((subStr(custInvoiceTable.TaxGroup,1,6) ==

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

ava_TaxEngine.GetTax(custInvoiceTable,

custInvoiceTable.InvoiceDate);

// @ AVA -

Page 31: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

31 | P a g e

2. 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;

}

// @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;

Page 32: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

32 | P a g e

Datasources:

SalesQuotationTable 1. write

Datasources: SalesQuotationLine 1. write

}

// @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 just after that the following code

between these lines.

// @AVA +

taxEngine.GetTax(salesQuotationTable, systemDateGet());

if(SalesQuotationLine.RecId)

{

element.isCalcTax(false);

}

// @AVA -

1. At the end of method just before the code of //<GIN> //</GIN> add

following code

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

3. SalesTable

Create a MenuItemButton as mentioned below:

Page 33: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

33 | P a g e

Method: Code Changes

Datasources : SalesTable 1. write

1. Declare the following variable

AVA_TaxEngine AVA_TaxEngine= New

AVA_TaxEngine();

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

“ttscommit;” and insert the following code

between these lines, just before to “ttscommit”.

AVA_TaxEngine.GetTax(SalesTable,

systemDateGet()); // @AVA +-

Page 34: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

34 | P a g e

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);

}

4. SalesTableListPage

Create a MenuItemButton as mentioned below:

Page 35: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

35 | P a g e

5. LogisticsPostalAddress

Create a Button as mentioned below:

Page 36: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

36 | P a g e

Add static text as like below fig:

Page 37: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

37 | 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 parameters /// </summary> // @AVA+- void addressValidation() { AVA_AddressValidation addressValidation = new ava_AddressValidation(); ; addressValidation.validateAddress ( LogisticsPostalAddress.Street, LogisticsPostalAddress.City, LogisticsPostalAddress.State, LogisticsPostalAddress.Zipcode, LogisticsPostalAddress.CountryRegionId); LogisticsPostalAddress.initFromAVA_AddressValidation(addressValidation); LogisticsPostalAddress.update(); 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; LogisticsPostalAddress_ds.reread(); LogisticsPostalAddress_ds.refresh(); }

Page 38: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

38 | P a g e

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 +-

updateDesign Search the code “generalTabPageCtrl.visible(false);” and change the value to generalTabPageCtrl.visible(true); //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(); if (validatedAddress) addressValidation.UpdateTables(logisticsPostalAddress); super(); }

Override the method with the following code:

/// <summary> /// Address validation /// </summary> // @AVA+- void clicked() { super(); element.addressValidation(); }

Page 39: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

39 | P a g e

Change property value as following

Page 40: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

40 | P a g e

6. CUSTTABLE

Create a buttonGroup as mentioned below:

Page 41: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

41 | P a g e

Create a MenuItemButtons as mentioned below:

7. CUSTTABLELISTPAGE

Create a buttonGroup as mentioned below:

Page 42: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

42 | P a g e

Create a MenuItemButtons as mentioned below:

Page 43: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

43 | P a g e

6. 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; Continuous: 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 44: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

44 | P a g e

7. MENU

Modifications

To Import the Avatax menu please follow the following steps :

1. Go to Import window

2. Select “SharedProject_AvalaraAX.xpo

Page 45: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

45 | 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 46: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

46 | P a g e

AVATAX - AX PROJECT INTEGRATION

8. TABLES (Project Integration)

AvaTax Changed the following list of Table:

S. No. Object ID Name

1. 617 ProjProposalJour

2. 550 TmpTaxWorkTrans

1. 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">

/// boolean update = false

Page 47: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

47 | P a g e

/// </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;

}

2. TmpTaxWorkTrans

Method Name Modifications

1. showTaxValue 1. Declare the following:

// @AVA +

TaxGroup taxGroup;

Container conAmtNumber;

Ava_taxEngine taxEngine = new

Ava_taxEngine();

//BP Deviation Documented

int detailNumber = 3;

TaxCode prevTaxCode;

SysGlobalCache globalCache =

Infolog.globalCache();

// @AVA –

Search the line “if (this.TaxCode && this.TransDate)”

and prior to that insert the following lines // @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)))

{

Page 48: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

48 | P a g e

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); }

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);

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

{ ConAmtNumber = TaxEngine.projProposalRevenueTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True);

} if (this.SourceTableId == tablename2id(tablestr(projProposalCost))) {

Page 49: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

49 | P a g e

ConAmtNumber = TaxEngine.projProposalCostTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); }

//BP Deviation Documented TaxValue = Conpeek(ConAmtNumber,1); //BP Deviation Documented DetailNumber = Conpeek(ConAmtNumber,2); //BP Deviation Documented PrevTaxCode = Conpeek(ConAmtNumber,3);

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

1,int2str(DetailNumber)); }

else // @AVA -

Page 50: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

50 | P a g e

9. CLASSES (Project Integration)

AvaTax Changed the following list of Classes:

1. 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 “this.exchRateSet();” and insert the

following code above to this.

// @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 -

initTotals

1. Add the following variable

AVA_TaxEngine AVA_TaxEngine = new

AVA_TaxEngine(); // @AVA +-

2. Search the line “projProposalJour =

this.getProjProposalJour(projInvoiceParmTable,

true);” and

“if(isConfigurationkeyEnabled(configurationKeyNu

m(PSAARRetainage))” and insert the following

code in between

S. No. Object ID Name

1. 1017548 ProjInvoiceJournalCreate

2. 1017549 ProjInvoiceJournalPost

3. 1204 TaxProj

4. 683 SalesQuotationEditLinesForm_Proj_Send

5. 681 SalesQuotationEditLinesForm_Proj_Confir

Page 51: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

51 | P a g e

//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 -

2. 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.CommitTax(projInvoiceJour.ProjInvoiceId,

projProposalJour.TaxGroupId,

projProposalJour.InvoiceAmount < 0 ?

salesType::ReturnItem : salesType::Sales);

// @AVA -

3. TaxProj

Method Name Modifications

1. markup

1. Declare the following macro as below:

#AVA_Macro

2. Search the for the following code

“this.insertIntersection(salesCalcTax.markupTaxGroup(),

salesCalcTax.markupTaxItemGroup(),

_transId,

markupTrans.Txt,

taxDate);”

Page 52: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

52 | P a g e

and replace the following code above to this.

//@AVA+

/*

this.insertIntersection(salesCalcTax.markupTaxGroup(),

salesCalcTax.markupTaxItemGroup(),

_transId,

markupTrans.Txt,

taxDate);

*/

//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-

2. new 1. Declare the following macro as below:

#AVA_Macro

2. Search the for the following code “ this.insertIntersection(salesCalcTax.transTaxGroup(),

Page 53: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

53 | P a g e

And replace below code with this.

//@AVA+

/*this.insertIntersection(salesCalcTax.transTaxGroup(),

salesCalcTax.transTaxItemGroup(),

salesCalcTax.transTransId(),

salesCalcTax.transItemId(),

taxCalculationDate);*/

//BP Deviation Documented

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-

SalesQuotationEditLinesForm_Proj_Confir

Method Name Modifications

1. CreateJournal

1. Declare the following variable and macro as below:

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

2

Search for the following line of code “

Page 54: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

54 | P a g e

salesQuotationTotals.prepareQuantitiesCalculation();

And insert the following code after that.

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

SalesQuotationEditLinesForm_Proj_Send

Method Name Modifications

1. CreateJournal

1. Declare the following variable and macro as below:

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

2

Search for the following line of code “ salesQuotationTotals.prepareQuantitiesCalculation();

And insert the following code after that.

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

4. SalesQuotationEditLinesForm_Proj_Send

Method Name Modifications

createJournal 1. Declare the following variable

Page 55: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

55 | P a g e

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 -

5. 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 -

Page 56: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

56 | P a g e

10. FORMS (Project Integration)

AvaTax Changes are at the following list of Form:

S. No. Name

1. SalesQuotationProjTable

2. ProjInvoiceProposalDetail

3. ProjInvoiceProposalListPage

4. ProjInvoiceTotals

1. 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(TaxT

mpWorkSalesQuote), salesQuotationTable);” and insert

the following code above this line.

// @AVA +-

if (element.isCalcTax())

{

ttsbegin;

TaxEngine.GetTax(salesQuotationTable, Today());

ttscommit;

}

// @AVA +

Page 57: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

57 | P a g e

3. Search the lines

“SalesQuotationTotals::showTax(menuitemDisplayStr(T

axTmpWorkSalesQuote), 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 +-

}

2. 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.

AVA_TaxEngine.GetTax(projProposalJour,

projProposalJour.InvoiceDate); // @AVA +-

3. ProjInvoiceProposalListPage

Method / Properties Modification 1. Declare following variable.

Page 58: AvaTax for Dynamics AX 2012 R3 - Avalara Help Centerapi/deki/files/5164/AX_AvaTax_Install_R3... · AvaTax for Dynamics AX 2012 R3 Code Change Document ... Tax ... 230 MarkupTrans

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 <MS Dynamics AX Connector Build AX 6.3.164.0.01.00>

58 | P a g e

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 +-

4. 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 +-