75
AvaTax for Dynamics AX 2012 R3 CU9 Code Change Document Version 1.0 Revision date: 2/8/16 Product release #: AvaTax for Microsoft Dynamics AX 2012 R3 CU9 Version AX 6.3.2000.326.02.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.

AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

Embed Size (px)

Citation preview

Page 1: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

AvaTax for

Dynamics AX 2012 R3 CU9

Code Change Document

Version 1.0

Revision date: 2/8/16 Product release #: AvaTax for Microsoft Dynamics AX 2012 R3 CU9 Version AX

6.3.2000.326.02.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 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

2 | P a g e

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

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

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

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

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

15. MarkupTrans ....................................................................................................................... 16 229 - MarkupTable ................................................................................................................... 16

77 – CustTable .......................................................................................................................... 17 1209 - CustInvoiceTable ........................................................................................................... 17

3. MAP .......................................................................................................................................... 19

1. LogisticsPostalAddressMap .................................................................................................. 19 4. CLASSES ................................................................................................................................. 21

1. SalesQuotationEditLinesForm_Sales_Confir ....................................................................... 21 2. SalesQuotationEditLinesForm_Sales_Send ......................................................................... 22

3. SalesInvoiceJournalPost ....................................................................................................... 23 4. CustPostInvoice .................................................................................................................... 23

5. SalesTotals_ParmTrans......................................................................................................... 24 6. SalesInvoiceJournalCreate .................................................................................................... 24 7. ApplicationVersion ............................................................................................................... 25

8. Tax ........................................................................................................................................ 25 9. SalesTableForm .................................................................................................................... 30

10. NumberSeqModuleSalesOrder ........................................................................................... 31 11. SalesTotals .......................................................................................................................... 31 12. SalesTableListPageInteraction ............................................................................................ 32

13. FormletterJournalCreate ..................................................................................................... 32 14. SalesQuotationController .................................................................................................... 32 15. FormletterService ................................................................................................................ 32 16. PurchInvoiceJournalPost..................................................................................................... 34

5. FORMS ..................................................................................................................................... 34 1. CustFreeInvoice .................................................................................................................... 35 2. SalesQuotationTable ............................................................................................................. 38 3. SalesTable ............................................................................................................................. 40 4. SalesTableListPage ............................................................................................................... 41 5. LogisticsPostalAddress ......................................................................................................... 42

Page 3: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

3 | P a g e

6. CUSTTABLE ....................................................................................................................... 48 7. CUSTTABLELISTPAGE..................................................................................................... 50

8. MarkupTrans ......................................................................................................................... 52 9. VendTable ............................................................................................................................. 53 11. VendEditInvoice ................................................................................................................. 57 12. VendEditInvoicePostDropDialog ....................................................................................... 60

6. Number Sequence ..................................................................................................................... 61

Ava_Head ..................................................................................................................................... 61 7. MENU ....................................................................................................................................... 62 8. TABLES (Project Integration) .................................................................................................. 64

1. ProjProposalJour ................................................................................................................... 64 2. TmpTaxWorkTrans............................................................................................................... 65

9. CLASSES (Project Integration) ................................................................................................ 67 1. ProjInvoiceJournalCreate ...................................................................................................... 67 2. ProjInvoiceJournalPost ......................................................................................................... 68

3. TaxProj .................................................................................................................................. 68

4. SalesQuotationEditLinesForm_Proj_Send ........................................................................... 71 5. SalesQuotationEditLinesForm_Proj_Confir ......................................................................... 71

10. FORMS (Project Integration) ................................................................................................. 72

1. SalesQuotationProjTable ...................................................................................................... 72 2. ProjInvoiceProposalDetail .................................................................................................... 73

3. ProjInvoiceProposalListPage ................................................................................................ 74 4. ProjInvoiceTotals .................................................................................................................. 74 5. ProjInvoiceProposal .............................................................................................................. 74

Page 4: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

4 | P a g e

1. OVERVIEW

To install the AvaTax connector for MS Dynamics AX 2012 R3 CU9.

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 CU9) 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 CU9. 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 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

Install Document AvaTax Connector for MS Dynamics AX 2012 R3 CU9 <MS Dynamics AX Connector Build AX 6.3.2000.326.02.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

16. 229 MarkupTable

17. 77 CustTable

18 1209 CustInvoiceTable

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>

Page 6: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

6 | P a g e

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

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

Page 7: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

7 | P a g e

// @AVA - // <GIN> SalesPurchJournalLine_IN salesPurchJournalLine; // </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); } if (this.SourceTableId == tablename2id(tablestr(projProposalEmpl))) { ConAmtNumber = TaxEngine.projProposalEmplTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalRevenue))) {

Page 8: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

8 | P a g e

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, this.CalculationDate, this.TaxBaseAmount); // <GIN> } // </GIN> } return taxValue; }

3. TaxOnItem

Page 9: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

9 | P a g e

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) /// </param> server void initTaxGroupData( TaxGroup _taxGroup, TaxCode _taxCode) { ; this.TaxGroup = _taxGroup; this.TaxCode = _taxCode; }

Page 10: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

10 | P a g e

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; this.TaxAccountGroup = _taxAccountGroup; this.TaxLimitBase = _taxLimitBase; this.TaxCurrencyCode = _currencyCode; }

6. TaxLedgerAccountGroup

Method Name Modifications

initTaxLedgerAccount

Create this new method with below code.

Page 11: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

11 | P a g e

/// <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) { ; this.TaxPeriod = _taxPeriod; this.FromDate = _fromDate; this.ToDate = _toDate; }

8. TaxPeriodHead

Method Name Modifications

Page 12: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

12 | P a g e

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

9. TaxAuthorityAddress

Method Name Modifications

initTaxAuthCode Create this new method with below code. /// <summary> /// Method added values into taxAuthorityAddress table /// </summary> /// <param name="_taxAuth">

Page 13: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

13 | P a g e

/// 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) { ; this.TaxGroup = _taxGrp; this.TaxGroupName = _taxGrpName; }

11. TaxItemGroupHeading

Method Name Modifications

initTaxItemGrpCode Create this new method with below code. /// <summary> /// Method added values into taxItemGroupHeading table

Page 14: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

14 | P a g e

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

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

Page 15: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

15 | P a g e

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

14. SalesTable

Method Name Modifications

1. checkAgainstCreditLimit

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-

Page 16: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

16 | P a g e

15. MarkupTrans

Method Name Modifications

taxCombinationAllowed

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 -

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

Page 17: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

17 | P a g e

77 – CustTable

Method Name Modifications

MarkupTable->DeleteActions

Add delete action with AVA_EntityUseCodeMapping table with following properties

1209 - CustInvoiceTable

Methods: Code Changes

ValidateWrite

1. Add the following code in the declaration: AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // @AVA +-

2. Search for the following code ret = ret && this.checkCreditLimit();

add following code before it: //AVA+ if (((subStr(this.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)))) {

Page 18: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

18 | P a g e

ava_TaxEngine.GetTax(this, this.InvoiceDate,false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::FreeText); } //AVA-

Page 19: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

19 | P a g e

3. MAP

S. No. Object ID Name

1. 3110 LogisticsPostalAddressMap

1. LogisticsPostalAddressMap

Create mapping for AVA_tmpInputAddress as follows:

Page 20: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

20 | P a g e

Create mapping for AVA_tmpValidAddress as follows:

Page 21: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

21 | P a g e

4. CLASSES

S. No.

Object ID Name

1. 685 SalesQuotationEditLinesForm_Sales_Confir

2. 686 SalesQuotationEditLinesForm_Sales_Send

3. 1019195 SalesInvoiceJournalPost

4. 77 CustPostInvoice

5. 547 SalesTotals_ParmTrans

6. 1019192 SalesInvoiceJournalCreate

7. 758 ApplicationVersion

8. 583 Tax

9. 1235 SalesTableForm

10. 1016487 NumberSeqModuleSalesOrder

11. 546 SalesTotals

12. 1019381 SalesTableListPageInteraction

13. 1013833 FormletterJournalCreate

14. 1018292 SalesQuotationController

15. 1013859 FormletterService

16. 1018148 PurchInvoiceJournalPost

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(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::SalesQuotation); // @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

Page 22: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

22 | P a g e

// @AVA + ArrLine [Line] = salesLine.RecId; Line++; // @AVA – 3.Search the line “Markup::copy(false,salesQuotationLineUpdate,salesLine);” and insert following code after

// @AVA + while select RecId from markupTrans where markupTrans.TransTableId == salesLine.TableId && markupTrans.TransRecId == salesLine.RecId { ArrLine [Line] = markupTrans.RecId; line++; } // @AVA -

4. updateNow

1. Declare the following variable AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); // @AVA +- MarkupTrans markupTrans; 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

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

Page 23: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

23 | P a g e

TaxEngine.GetTax(salesQuotationTable, systemDateGet(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::SalesQuotation); // @AVA +-

3. 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().SalesType,AVA_ConnSource::SalesInvoice); // @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 //AVA+ if (custInvoiceTable.ForInterestAdjustment== NoYes::No) { TaxEngine.GetTax(CustInvoiceTable, CustInvoiceTable.InvoiceDate, False, NULL, Ava_documentType::SalesInvoice, InvoiceId,AVA_ConnSource::FreeTextInvoice); } //AVA- 3. search the line “isPostingOK = true;” and “TradeBLWIFormCodes::initclassFromCust(custInvoiceJour, TradeBLWITypeOfForm::CustInvoiceJour, TradeBLWITypeOfForm::CustFreeInvoice);” and insert the following code in between // @AVA +

Page 24: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

24 | P a g e

if (custInvoiceTable.ForInterestAdjustment== NoYes::No) { taxEngine.CommitTax(invoiceId, custInvoiceTable.TaxGroup,salesType::Sales,AVA_ConnSource::FreeTextInvoice); } // @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,salesType::Sales,AVA_ConnSource::FreeTextInvoice); } // @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_DocumentType::SalesOrder,'',_salesParmTable.salesTable().SalesType == SalesType::ReturnItem ? AVA_ConnSource::ReturnOrder : AVA_ConnSource::SalesOrder ); // @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 -

Page 25: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

25 | P a g e

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,ava_DocumentType::SalesOrder,'', salesParmTable.salesTable().SalesType == SalesType::ReturnItem ? AVA_ConnSource::ReturnOrder : AVA_ConnSource::SalesOrder); else AVA_TaxEngine.GetTax(salesTable, salesParmTable.Transdate, false, salesParmTable, ava_DocumentType::SalesInvoice, journalNumber,salesParmTable.salesTable().SalesType == SalesType::ReturnItem ? AVA_ConnSource::ReturnInvoice : AVA_ConnSource::SalesInvoice); } // @AVA -

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;

Page 26: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

26 | P a g e

InvoiceId AVA_invoiceId; SysGlobalCache globalCacheInvoiceId; // @AVA -

2. allocateInTaxWorkTrans

1. Declare the following variable // @AVA + AVA_TaxEngine taxEngine = new Ava_TaxEngine(); TaxGroup taxGroup; // @AVA - 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)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(custInvoiceLine)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(MarkupTrans)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(SalesQuotationLine)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalOnAcc)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalItem)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalEmpl)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalRevenue)) || taxWorkTrans.SourceTableId == tablename2id(tablestr(projProposalCost))) { 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)))

Page 27: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

27 | P a g e

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

Page 28: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

28 | P a g e

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

Page 29: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

29 | P a g e

} }

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

Page 30: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

30 | P a g e

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

Page 31: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

31 | P a g e

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.parmWizardIsManual(NoYes::No); datatype.parmWizardIsChangeDownAllowed(NoYes::No); datatype.parmWizardIsChangeUpAllowed(NoYes::No); 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 +- 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_DocumentType::SalesOrder,'', salesParmTable.salesTable().SalesType == SalesType::ReturnItem ? AVA_ConnSource::ReturnOrder :AVA_ConnSource::SalesOrder ); // @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(),false,null,AVA_DocumentType::SalesOrder,'',salesParmTable.salesTable().SalesType == SalesType::ReturnItem ? AVA_ConnSource::ReturnOrder : AVA_ConnSource::SalesOrder ); // @AVA +-

Page 32: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

32 | P a g e

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 -

13. FormletterJournalCreate

Method Name Modifications

createJournal

1. Declare the line “this.initJournalHeader();” and comment line

// this.initJournalHeader();

2. Search the line “this.initRecordList();” and add following code after this.initJournalHeader();

14. SalesQuotationController

Property Code Changes

RunOn Change the property ‘RunOn’ to ’Client’

15. FormletterService

Method Name Modifications

run

1. Declare the following variable // @AVA + AVA_TaxEngine taxEngine = new AVA_TaxEngine(); CustInvoiceJour custInvoiceJourLoc; SalesParmTable salesParmTableLoc;

Page 33: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

33 | P a g e

SalesParmLine salesParmLineLoc; AVA_Header ava_HeaderLoc; vendInvoiceJour vendInvoiceJourLoc; AVA_ConsumerUseTaxBatch consumerUsetaxBatch; AVA_ConsumerUseTaxJourPost consumerUseTaxJourPost = new AVA_ConsumerUseTaxJourPost(); Args args = new Args(); // @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) { custInvoiceJourLoc = journal; salesParmTableLoc = formletterParmTable; if (custInvoiceJourLoc.InvoiceId && !Proforma) { taxEngine.CommitTax(custInvoiceJourLoc.InvoiceId , salesParmTableLoc.salesTable().TaxGroup, salesParmTableLoc.salesTable().SalesType, salesParmTableLoc.salesTable().SalesType == SalesType::ReturnItem ? AVA_ConnSource::ReturnInvoice : AVA_ConnSource::SalesInvoice);

} select RemainAfter from salesParmLineLoc where salesParmLineLoc.ParmId == salesParmTableLoc.ParmId && salesParmLineLoc.TableRefId == salesParmTableLoc.TableRefId; if(salesParmLineLoc.RemainAfter != 0) { taxEngine.getTax(salesParmTableLoc.salesTable(),systemDateGet(),false,null, ava_DocumentType::SalesOrder,'',AVA_ConnSource::SalesOrder); } else { delete_from ava_HeaderLoc where ava_HeaderLoc.DocNumber == custInvoiceJourLoc.SalesId; } } } if ( isConfigurationkeyEnabled(configurationKeyNum(AVAAccountPayable)) && !AVA_configuration::find().DisableTaxCalculation && AVA_configuration::find().UseVendTaxCalculation && journal.TableId == tableNum(vendInvoiceJour) && this.parmFormletterType() == FormletterType::Purchase) { vendInvoiceJourLoc = journal;

Page 34: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

34 | P a g e

consumerUseTaxBatch = AVA_ConsumerUseTaxBatch::find(vendInvoiceJourLoc.InvoiceId); if(consumerUseTaxBatch.ToAccrue) { Args.record(consumerUseTaxBatch); args.caller(this); AVA_ConsumerUseTaxJourPost::main(Args); //Post Tax with Commit true TaxEngine.postTax_VendInvoice(vendInvoiceJourLoc.InvoiceId, vendInvoiceJourLoc.InvoiceDate); } } //AVA -

16. PurchInvoiceJournalPost

Method name Modifications postFailed 1. Declare the following variable

AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +- 2. Add the following code at the end of the method // @AVA + if ((isConfigurationkeyEnabled(configurationKeyNum(AVAAccountPayable))) && (AVA_configuration::find().UseVendTaxCalculation) && (!AVA_configuration::find().DisableTaxCalculation) && vendInvoiceInfoTable.Num) { taxEngine.cancelTax_VendInvoice(vendInvoiceInfoTable.Num, vendInvoiceJour.PurchaseType,AVA_ConnSource::PurchaseInvoice); } // @AVA -

5. FORMS

S. No. Name

1. CustFreeInvoice

2. SalesQuotationTable

3. SalesTable

4. SalesTableListPage

5. LogisticsPostalAddress

6. CustTable

7. CustTableListPage

Page 35: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

35 | P a g e

8. MarkupTrans

9. VendTable

10. VendTableListPage

11. VendEditInvoice

12. VendEditInvoicePostDropDialog

1. CustFreeInvoice

Methods: Code Changes

ClasssDeclaration Declare variable as below boolean isHeaderAddressChanged;//AVA+-

Data Sources ->CustInvoiceTable -> CheckFieldsAreChanged

Add following code at the end //AVA+ isHeaderAddressChanged =false; if ((subStr(custInvoiceTable.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)) && !AVA_Configuration::find().DisableTaxCalculation) { if(custInvoiceTable.PostalAddress != originalInvoice.PostalAddress) { recreateTax = true; isHeaderAddressChanged = true; } } //AVA-

Page 36: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

36 | P a g e

\Forms\CustFreeInvoice\Designs\Design\[ActionPane:ActionPane]\[ActionPaneTab:InvoiceActionsTab]\[ButtonGroup:DetailsAction]\MenuItemButton:CustInvoiceTableTotals\Methods\clicked

Create new method clicked as below: void clicked() { WorkflowTable workflowTableFieldList; AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); ; select DefaultConfiguration from workflowTableFieldList where workflowTableFieldList.TemplateName == 'CustFreeTextInvoiceTemplate' && workflowTableFieldList.DefaultConfiguration == NoYes::Yes; if ((WorkflowTable::findActiveTemplate('CustFreeTextInvoiceTemplate') || workflowTableFieldList.DefaultConfiguration)) { if (custInvoiceLine.RecId && ((subStr(custInvoiceTable.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)))) ava_TaxEngine.GetTax(custInvoiceTable, custInvoiceTable.InvoiceDate,false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::FreeText); custInvoiceLine_ds.research(true); } if (custInvoiceLine.RecId && (subStr(custInvoiceTable.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)) && !AVA_Configuration::find().DisableTaxCalculation) { if(isHeaderAddressChanged) { ava_TaxEngine.GetTax(custInvoiceTable, custInvoiceTable.InvoiceDate,false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::FreeText); isHeaderAddressChanged = false; } } super(); }

\Forms\CustFreeInvoice\Designs\Design\[ActionPane:ActionPane]\[ActionPaneTab:InvoiceActionsTab]\[ButtonGroup:DetailsAction]\MenuItemButton:TaxTransSource\Methods\clicked

1. Add the following code in the declaration: //AVA + WorkflowTable workflowTableFieldList; AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); //AVA -

2. Search for the code custFreeInvoiceCalcTotals = new CustFreeInvoiceCalcTotals(custInvoiceTable);

Add the following code before it: //AVA+ select DefaultConfiguration from workflowTableFieldList where workflowTableFieldList.TemplateName == 'CustFreeTextInvoiceTemplate' && workflowTableFieldList.DefaultConfiguration == NoYes::Yes; if ((WorkflowTable::findActiveTemplate('CustFreeTextInvoiceTemplate') || workflowTableFieldList.DefaultConfiguration)) { if (custInvoiceLine.RecId && ((subStr(custInvoiceTable.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)))) ava_TaxEngine.GetTax(custInvoiceTable, custInvoiceTable.InvoiceDate,false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::FreeText);

Page 37: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

37 | P a g e

custInvoiceLine_ds.research(true); } if (custInvoiceLine.RecId && (subStr(custInvoiceTable.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)) && !AVA_Configuration::find().DisableTaxCalculation) { if(isHeaderAddressChanged) { ava_TaxEngine.GetTax(custInvoiceTable, custInvoiceTable.InvoiceDate,false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::FreeText); isHeaderAddressChanged = false; } } //AVA –

\Forms\CustFreeInvoice\Designs\Design\[ActionPane:ActionPane]\[ActionPaneTab:InvoiceActionsTab]\[ButtonGroup:PostAction]\MenuItemButton:ButtonCustPostInvoiceJob

Declare following variable AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); //AVA+- Add following code before “super();” if (custInvoiceLine.RecId && (subStr(custInvoiceTable.TaxGroup,1,6) == subStr(AVA_Configuration::find().TaxGroupId,1,6)) && !AVA_Configuration::find().DisableTaxCalculation) { if(isHeaderAddressChanged) { ava_TaxEngine.GetTax(custInvoiceTable, custInvoiceTable.InvoiceDate,false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::FreeText); isHeaderAddressChanged = false; } }

Page 38: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

38 | 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(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::SalesQuotation);

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

2. Override “clicked” method as follows:

Page 39: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

39 | P a g e

Datasources: SalesQuotationTable 1. write Datasources: SalesQuotationLine 1. write

void clicked() { AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +- ; // @AVA +- if (element.isCalcTax()) { ttsbegin; taxEngine.GetTax(salesQuotationTable, today(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::SalesQuotation); 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 just after that the following code between these lines.

// @AVA + taxEngine.GetTax(salesQuotationTable, systemDateGet(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::SalesQuotation); 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 +-

Page 40: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

40 | P a g e

3. SalesTable

Create a MenuItemButton as mentioned below:

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(),false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::SalesOrder); //@AVA+-

Page 41: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

41 | 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(); AVA_TaxEngine.GetTax(SalesTable, systemDateGet(),false,null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::SalesOrder); //@AVA+- element.automaticTotalDiscount(); SalesTotals::showTaxLine(menuitemDisplayStr (TaxTmpWorkSalesOrder), salesTable,salesLine,element);

}

4. SalesTableListPage

Create a MenuItemButton as mentioned below:

Page 42: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

42 | P a g e

5. LogisticsPostalAddress

Create a Button as mentioned below:

Page 43: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

43 | P a g e

Page 44: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

44 | P a g e

Add static text as like below fig:

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,

Page 45: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

45 | P a g e

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

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(); AVA_EntityUseCodeMapping entityUseCode; if (validatedAddress)

Page 46: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

46 | 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 47: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

47 | P a g e

Page 48: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

48 | P a g e

6. CUSTTABLE

Create a buttonGroup as mentioned below:

Create a MenuItemButtons as mentioned below:

Page 49: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

49 | P a g e

Page 50: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

50 | P a g e

7. CUSTTABLELISTPAGE

Create a buttonGroup as mentioned below:

Page 51: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

51 | P a g e

Create a MenuItemButtons as mentioned below:

Page 52: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

52 | P a g e

8. MarkupTrans

Method: Code Changes

1. Data Source -MarkupTrans -> write

1. Declare the following variable Object callerFormObject; //AVA+-

2. 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 53: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

53 | P a g e

9. VendTable

Create new tab as below:

Page 54: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

54 | P a g e

Page 55: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

55 | P a g e

10. VendTableListpage. Add new tab as below:

Page 56: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

56 | P a g e

Page 57: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

57 | P a g e

11. VendEditInvoice

Add new tab as below:

Page 58: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

58 | P a g e

Page 59: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

59 | P a g e

Page 60: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

60 | P a g e

12. VendEditInvoicePostDropDialog

Method: Code Changes

Add the following code after the declaration and before the super() as below: //@AVA + AVA_ConsumerUseTaxJourPost AVA_ConsumerUseTaxJourPost = new AVA_ConsumerUseTaxJourPost(); AVA_TaxEngine taxengine = new AVA_TaxEngine(); if (isConfigurationkeyEnabled(configurationKeyNum(PublicSector)) && isConfigurationKeyEnabled(configurationkeynum(AVAAccountPayable)) && AVA_configuration::find().UseVendTaxCalculation && !AVA_configuration::find().DisableTaxCalculation && callerForm.name() == formStr(VendEditInvoice)) { vendInvoiceInfoTable = element.args().record(); if(AVA_ConsumerUseTaxMapping::vendorEnable(vendInvoiceInfoTable.InvoiceAccount) && vendInvoiceInfoTable.Num != '') { AVA_ConsumerUseTaxJourPost::main(element.args()); } } //@AVA -

Page 61: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

61 | 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 62: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

62 | 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 63: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

63 | 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 64: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

64 | 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; Search the line “(this.InvoiceDate == dateNull())” and “ } this.CustBankAccountId = CustTable::find(this.InvoiceAccount).BankAccount;” 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))) { this.InvoiceDate = today(); 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 /// </param> /// <returns> /// projProposalJour findAVA_RecId /// </returns> static projProposalJour findAVA_RecId( RecId recId,

Page 65: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

65 | P a g e

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

Page 66: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

66 | P a g e

{ 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))) { 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 67: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

67 | 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,ava_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectSalesOrder); else ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, false, null ,ava_DocumentType::SalesInvoice, projInvoiceJour.ProjInvoiceId,AVA_ConnSource::ProjectInvoiceProposal); // @AVA -

initTotals

1. Add the following variable // @AVA + AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine(); #AVA_Macro // @AVA -

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 68: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

68 | P a g e

2. Search the line “projProposalJour = this.getProjProposalJour(projInvoiceParmTable, true);” and “if(isConfigurationkeyEnabled(configurationKeyNum(PSAARRetainage))” and insert the following code in between

//AVA+ if (projInvoiceJour.isProforma()) ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, true, null,ava_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectSalesOrder);//TODO: Connector else ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, false, null ,ava_DocumentType::SalesInvoice, projInvoiceJour.ProjInvoiceId,AVA_ConnSource::ProjectInvoiceProposal); // @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.isProjPrepayment(projProposalJour))) AVA_TaxEngine.CommitTax(projInvoiceJour.ProjInvoiceId, projProposalJour.TaxGroupId, projProposalJour.InvoiceAmount < 0 ? salesType::ReturnItem : salesType::Sales,AVA_ConnSource::ProjectInvoiceProposal); // @AVA

3. TaxProj

Method Name Modifications

Page 69: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

69 | P a g e

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

Page 70: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

70 | P a g e

2. new 1. Declare the following macro as below: #AVA_Macro 2. Search the for the following code “ this.insertIntersection(salesCalcTax.transTaxGroup(), ” 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-

Page 71: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

71 | P a g e

4. SalesQuotationEditLinesForm_Proj_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(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectQuotation); // @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 taxEngine.GetTax(salesQuotationTable, systemDateGet(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectQuotation); // @AVA +-

Page 72: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

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

5. ProjInvoiceProposal

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(TaxTmpWorkSalesQuote), salesQuotationTable);” and insert the following code above this line. // @AVA +- if (element.isCalcTax()) { ttsbegin; TaxEngine.GetTax(salesQuotationTable, Today(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectQuotation); ttscommit;

Page 73: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

73 | P a g e

} // @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(),false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectQuotation); // 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,false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectInvoiceProposal); // @AVA +-

Page 74: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

74 | P a g e

3. 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,false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectInvoiceProposal); // @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,false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectInvoiceProposal); // @AVA +-

5. ProjInvoiceProposal

Method / Properties Modification

getShowTax

1. Declare following variable. AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +-

2. Search the Line “projProposalTotals.calc();” and insert the following lines before this line.

AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate,false,null,AVA_DocumentType::SalesOrder,'',AVA_ConnSource::ProjectInvoiceProposal); // @AVA +-

Page 75: AvaTax for Dynamics AX 2012 R3 U9 - Avalara Help Centerapi/deki/files/14059/AX_AvaTax_Install_R... · AvaTax for Dynamics AX 2012 R3 U9 Code Change Document ... MarkupTrans ... salesPurchJournalLine

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

75 | P a g e

Init 1. Declare the following macro as below: #AVA_Macro //@AVA+-

Create a MenuItemButton as mentioned below: