Upload
doanh
View
315
Download
2
Embed Size (px)
Citation preview
AvaTax for
Dynamics AX 2012 R2 CU6
Code Change Document
Version 1.0
Revision date: 6/10/16 Product release #: AvaTax for Microsoft Dynamics AX 2012 R2 CU6 Version AX
6.2.1000.1437.03.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.
© 2016 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.
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
2 | P a g e
Table of Contents 1. OVERVIEW ............................................................................................................................... 4 2. TABLES ..................................................................................................................................... 5
1. TmpTaxWorkTrans................................................................................................................. 5 2. SalesParameters ...................................................................................................................... 7 3. LogisticsPostalAddress ........................................................................................................... 7 4. SalesTable ............................................................................................................................... 8 5 - MarkupTable ......................................................................................................................... 9
6 – CustTable ............................................................................................................................ 10 7 - CustInvoiceTable ................................................................................................................. 10
3. MAP .......................................................................................................................................... 11 1. LogisticsPostalAddressMap .................................................................................................. 11
4. CLASSES ................................................................................................................................. 13 1. SalesQuotationEditLinesForm_Sales_Confir ....................................................................... 13
2. SalesQuotationEditLinesForm_Sales_Send ......................................................................... 14 3. SalesInvoiceJournalPost ....................................................................................................... 15 4. CustPostInvoice .................................................................................................................... 15
5. SalesTotals_ParmTrans......................................................................................................... 16 6. SalesInvoiceJournalCreate .................................................................................................... 16
7. ApplicationVersion ............................................................................................................... 17 8. Tax ........................................................................................................................................ 17 9. SalesTableForm .................................................................................................................... 22
10. NumberSeqModuleSalesOrder ........................................................................................... 23 11. SalesTotals .......................................................................................................................... 23
12. SalesTableListPageInteraction ............................................................................................ 24 13. FormletterJournalCreate ..................................................................................................... 24
14. SalesQuotationController .................................................................................................... 24 15. FormletterService ................................................................................................................ 25
5. FORMS ..................................................................................................................................... 25 1. CustFreeInvoice .................................................................................................................... 26 2. SalesQuotationTable ............................................................................................................. 28
3. SalesTable ............................................................................................................................. 30 4. SalesTableListPage ............................................................................................................... 32
5. LogisticsPostalAddress ......................................................................................................... 33 6. CUSTTABLE ....................................................................................................................... 39 7. CUSTTABLELISTPAGE..................................................................................................... 41
8. MarkupTrans ......................................................................................................................... 43 6. Number Sequence ..................................................................................................................... 44 Ava_Head ..................................................................................................................................... 44 7. MENU ....................................................................................................................................... 45
8. TABLES (Project Integration) .................................................................................................. 47 1. ProjProposalJour ................................................................................................................... 47 2. TmpTaxWorkTrans............................................................................................................... 48
9. CLASSES (Project Integration) ................................................................................................ 51 1. ProjInvoiceJournalCreate ...................................................................................................... 51 2. ProjInvoiceJournalPost ......................................................................................................... 52
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
3 | P a g e
3. TaxProj .................................................................................................................................. 52 4. SalesQuotationEditLinesForm_Proj_Send ........................................................................... 54
5. SalesQuotationEditLinesForm_Proj_Confir ......................................................................... 55 10. FORMS (Project Integration) ................................................................................................. 56
1. SalesQuotationProjTable ...................................................................................................... 56 2. ProjInvoiceProposalDetail .................................................................................................... 57 3. ProjInvoiceProposalListPage ................................................................................................ 57
4. ProjInvoiceTotals .................................................................................................................. 58 5. ProjInvoiceProposal .............................................................................................................. 58
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
4 | P a g e
1. OVERVIEW
To install the AvaTax connector for MS Dynamics AX 2012 R2 CU6.
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 R2 CU6) 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 R2 CU6. 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.
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
5 | P a g e
2. TABLES
AvaTax change the following tables:
S. No. Object ID Name
1. 550 TmpTaxWorkTrans
2. 367 SalesParameters
3. 2941 LogisticsPostalAddress
4. 366 SalesTable
5. 229 MarkupTable
6. 77 CustTable
7. 1209 CustInvoiceTable
1. TmpTaxWorkTrans
Method Name Modifications
showTaxValue
Insert the highlighted lines as specified hereunder: // BP Deviation Documented server display TaxValue showTaxValue() { TaxValue taxValue; // @AVA + TaxGroup taxGroup; Container conAmtNumber; Ava_taxEngine taxEngine = new Ava_taxEngine(); //BP Deviation Documented int detailNumber = 3; TaxCode prevTaxCode; SysGlobalCache globalCache = Infolog.globalCache(); // @AVA - // <GIN> SalesPurchJournalLine_IN salesPurchJournalLine; // </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)))
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
6 | P a g e
{ ConAmtNumber = TaxEngine.SalesTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(CustInvoiceLine))) { ConAmtNumber = TaxEngine.CustInvoiceTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(MarkupTrans))) { ConAmtNumber = TaxEngine.MarkupTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(SalesQuotationLine))) { ConAmtNumber = TaxEngine.SalesQuotationTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalOnAcc))) { ConAmtNumber = TaxEngine.projProposalOnAccTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalItem))) { ConAmtNumber = TaxEngine.projProposalItemTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalEmpl))) { ConAmtNumber = TaxEngine.projProposalEmplTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalRevenue))) { ConAmtNumber = TaxEngine.projProposalRevenueTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalCost))) { 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);
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
7 | P a g e
//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; }
2. SalesParameters
Method Name Modifications
numRefAVANum
Create this new method with below code. static client server NumberSequenceReference numRefAVANum() { return NumberSeqReference::findReference(extendedTypeNum(AVA_HeaderId)); }
3. LogisticsPostalAddress
Method Name Modifications
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
8 | P a g e
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 (); } }
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; }
4. 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-
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
9 | P a g e
2. setEstimate
Search the line “hasEstimatedChanged = (this.Estimate != estimatedOld); }}” and “this.Touched = NoYes::No;” and insert the following code in between
// @AVA+ if (!Ava_Configuration::find().DisableTaxCalculation) { this.Touched = NoYes::Yes; } else // @AVA-
5 - 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
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
10 | P a g e
6 – CustTable
Method Name Modifications
MarkupTable->DeleteActions
Add delete action with AVA_EntityUseCodeMapping table with following properties
7 - CustInvoiceTable
Method Name Modifications
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)))) { ava_TaxEngine.GetTax(this, this.InvoiceDate); } //AVA-
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
11 | P a g e
3. MAP
S. No. Object ID Name
1. 3110 LogisticsPostalAddressMap
1. LogisticsPostalAddressMap
Create mapping for AVA_tmpInputAddress as follows:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
12 | P a g e
Create mapping for AVA_tmpValidAddress as follows:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
13 | 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. 101368 FormletterService
1. SalesQuotationEditLinesForm_Sales_Confir
Method Name Modifications
1. Class Declaration Declare the following variable // @AVA + int64 ArrLine []; int line;
// @AVA -
2. createJournal
1. Declare the following variable AVA_TaxEngine TaxEngine = New AVA_TaxEngine(); //@AVA +- 2. Search the line “salesQuotationTotals.prepareQuantitiesCalculation();” and “this.tax(salesQuotationTotals.tax());” and insert the following code in between
TaxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA +-
3. createSalesLines
1. Declare the following variable MarkupTrans markupTrans; //@AVA+-
2.Search the line “salesDeliverySchedule.insert(); }” and “// PBA Begin if (salesQuotationLineUpdate.ItemPBAId)” and insert the following code in between
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
14 | 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
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
15 | P a g e
TaxEngine.GetTax(salesQuotationTable, systemDateGet()); // @AVA +-
3. SalesInvoiceJournalPost
Method Name Modifications
postFailed
1. Declare the following variable AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +- 2. Search the line “super(_logText);” and closing bracket “}” and insert the following code in between // @AVA + if (custInvoiceJour.InvoiceId && !this.isProforma()) taxEngine.CancelTax(custInvoiceJour.InvoiceId, SalesParmTable.salesTable().TaxGroup,SalesParmTable.salesTable().SalesType); // @AVA
4. CustPostInvoice
Method Name Modifications
run 1. Declare the following variable AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +- 2. Search the line ““[invoiceId, voucher] = numberSeq.numAndVoucher(); //<GEEU> }” 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 - 3. search the line “isPostingOK = true;” and “TradeBLWIFormCodes::initclassFromCust(custInvoiceJour, TradeBLWITypeOfForm::CustInvoiceJour, TradeBLWITypeOfForm::CustFreeInvoice);” and insert the following code in between // @AVA + if(custInvoiceTable.ForInterestAdjustment == NoYes::No) { taxEngine.CommitTax(invoiceId, custInvoiceTable.TaxGroup);
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
16 | P a g e
} // @AVA 4.Search the line “sourceDocumentHeader.update();” and “ttscommit;” and insert the following code in between // @AVA + if (!isPostingOK && custInvoiceTable.ForInterestAdjustment== NoYes::No) { taxEngine.CancelTax(invoiceId, custInvoiceTable.TaxGroup); } // @AVA -
5. SalesTotals_ParmTrans
Method Name Modifications
1. showTax 1. Declare the following variable AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // @AVA +- ; 2. Search the line “salesTotals = SalesTotals::construct(_salesParmTable.salesTable(), _specQty, AccountOrder::None, _salesParmTable.ParmId, '',_salesParmTable.Ordering);” and “salesTotals.calc();” and insert the following code ava_TaxEngine.GetTax(_salesParmTable.salesTable(), _salesParmTable.Transdate, true, _salesParmTable); // @AVA +-
6. SalesInvoiceJournalCreate
Method Name Modifications
1. initJournalHeader
1. Add the following variable and macro declaration: // @AVA + AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine(); #AVA_Macro ; // @AVA - 2. Search the line “super();“ and insert the following code thereafter // @AVA + if (!salesParmTable.salesTable().ProjId) {
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
17 | P a g e
if (salesParmUpdate.Proforma) ava_TaxEngine.GetTax(salesParmTable.salesTable(), salesParmTable.Transdate, true, salesParmTable); else AVA_TaxEngine.GetTax(salesTable, salesParmTable.Transdate, false, salesParmTable, ava_DocumentType::SalesInvoice, custInvoiceJour.InvoiceId); } // @AVA -
7. ApplicationVersion
Method Name Modifications
AVA_BuildNo
Create this new method with below code. /// <summary> /// Returns the version number of the Avatax connector in the layer where this method is defined. /// </summary> /// <returns> /// The version number. /// </returns> /// <remarks> /// The version number is displayed in the About box. Even when it is overlayered. /// </remarks> static client str AVA_BuildNo() { #AVA_Macro return #ConnectorVersion; }
8. Tax
Method Name Modifications
1. Class Declaration
Declare the following variable // @AVA + Int detailNumber; Container conAmtNumber; TaxCode prevTaxCode; InvoiceId AVA_invoiceId; SysGlobalCache globalCacheInvoiceId; // @AVA -
2. allocateInTaxWorkTrans
1. Declare the following variable // @AVA + AVA_TaxEngine taxEngine = new Ava_TaxEngine(); TaxGroup taxGroup;
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
18 | P a g e
// @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))) {
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
19 | 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);
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
20 | P a g e
taxWorkTrans.SourceTaxAmountCurReal = Conpeek(ConAmtNumber,4)*(-1); taxWorkTrans.TaxAmountCur = taxWorkTrans.TaxAmount; } } // @AVA - 3. Insert the highlighted lines as specified hereunder: if ((AVA_Configuration::find().TaxGroupId != TaxGroup ) && (substr(AVA_Configuration::find().TaxGroupId,1,6) != substr(TaxGroup,1,6))) // @AVA +- { if (savedTax != taxAmount || savedTaxCur != taxAmountCur || savedSourceTaxCurReal != sourceTaxAmountCurReal || savedTaxInCostPrice != taxInCostPrice || savedTaxInCostPriceMST != taxInCostPriceMST || savedTaxInCostPriceCur != taxInCostPriceCur || savedSourceTaxCur != sourceTaxAmountCur ) { // If a tax amount must be allocated and there are no other lines with tax, use the first line // to place the tax on. if (taxAmount && !taxWorkTransRecId) taxWorkTransRecId = taxWorkTransRecIdFirst; select firstonly forupdate taxWorkTrans where taxWorkTrans.RecId == taxWorkTransRecId; if (taxWorkTrans) { 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;
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
21 | P a g e
if (savedSourceTaxCur != sourceTaxAmountCur) taxWorkTrans.SourceTaxAmountCur += sourceTaxAmountCur - savedSourceTaxCur; if (savedSourceTaxCurReal != sourceTaxAmountCurReal) taxWorkTrans.SourceTaxAmountCurReal += sourceTaxAmountCurReal - savedSourceTaxCurReal; taxWorkTrans.update(this.ignoreCalculatedSalesTax()); } } }
3. distributeTotalTax
1. Declare the following variable and macro as below: // @AVA + anytype AVA_invoiceIdTemp; #AVA_Macro // @AVA - 2. Search the code “while select sum(TaxBaseAmountMSTRaw), sum(TaxBaseAmountMST), sum(TaxAmountCur), sum(TaxAmountMST), sum(TaxInCostPrice), sum(TaxInCostPriceCur), sum(TaxInCostPriceMST), sum(TaxBaseQty), sum(SourceTaxAmountCur), 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 -
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
22 | P a g e
3. Search the line “this.allocateInTaxWorkTrans(tmpTax.TaxCode, tmpTax.TaxDirection, tmpTax.TaxAmountMST, tmpTax.TaxAmountCur, tmpTax.TaxInCostPrice, tmpTax.TaxInCostPriceMST, tmpTax.TaxInCostPriceCur, tmpTax.TaxBaseAmountMSTRaw, tmpTax.TaxBaseQty, tmpTax.SourceTaxAmountCur, tmpTax.SourceTaxAmountCurReal, NoYes::No, tmpTax.CalculationDate, tmpTax.Warning);” and replace the existing code with the below code } //@AVA+- this.allocateInTaxWorkTrans(tmpTax.TaxCode, tmpTax.TaxDirection, tmpTax.TaxAmountMST, tmpTax.TaxAmountCur, tmpTax.TaxInCostPrice, 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
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
23 | P a g e
{ // @AVA- if (_salesTable.Touched == NoYes::Yes) { return; } }
10. NumberSeqModuleSalesOrder
Method Name Modifications
1. loadModule
Insert the following code at the end and just before the last bracket (NOTE: The value of “numRef.SortField” should be higher than the existing maximum value of numRef.SortField in this method )
// @AVA + datatype.parmDatatypeId(extendedtypenum(AVA_HeaderId)); datatype.parmReferenceHelp(literalstr("@AVA534")); datatype.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
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 +-
3. Search the line “else { salesTotals = SalesTotals::construct(_orderTable, _specQty); } ” and salesTotals.calc(); ” and insert the following code in between
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
24 | P a g e
salesTable = _orderTable; if (salesTable.SalesStatus != SalesStatus::Invoiced) { ava_TaxEngine.GetTax(salesTable, systemDateGet()); // @AVA +- }
12. SalesTableListPageInteraction
Method Name Modifications
1. setButtonSell
1. Declare the following macro as below: #AVA_Macro //@AVA+- 2. at the end of method add below code after condition “if (isConfigurationkeyEnabled(configurationKeyNum(Retail)))”: // @AVA + if(strscan(( AVA_Configuration::find().Services), #TaxService, 1, 100) && (AVA_Configuration::find().EnableTaxOverrideDate)) { this.listPage().actionPaneControlEnabled(formControlStr(salesTableListPage, AVA_TaxOverrideDate),true); } else { this.listPage().actionPaneControlEnabled(formControlStr(salesTableListPage,AVA_TaxOverrideDate),false); } // @AVA -
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’
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
25 | P a g e
15. FormletterService
Method Name
Modifications
run
1. Declare the following variable // @AVA + AVA_TaxEngine taxEngine = new AVA_TaxEngine(); CustInvoiceJour custInvoiceJourLoc; SalesParmTable salesParmTableLoc; SalesParmLine salesParmLineLoc; AVA_Header ava_HeaderLoc; // @AVA -
2. Search the line “ttscommit;” and “if (printout == Printout::Current) ” and insert the following code in between //AVA + if (!AVA_Configuration::find().DisableTaxCalculation) { if (journal.TableId == tableNum(custInvoiceJour) && this.parmFormletterType() == FormletterType::Sales) { custInvoiceJourLoc = journal; salesParmTableLoc = formletterParmTable; if (custInvoiceJourLoc.InvoiceId && !Proforma) { taxEngine.CommitTax(custInvoiceJourLoc.InvoiceId , salesParmTableLoc.salesTable().TaxGroup, salesParmTableLoc.salesTable().SalesType); } select RemainAfter from salesParmLineLoc where salesParmLineLoc.ParmId == salesParmTableLoc.ParmId && salesParmLineLoc.TableRefId == salesParmTableLoc.TableRefId; if(salesParmLineLoc.RemainAfter != 0) { taxEngine.getTax(salesParmTableLoc.salesTable(),systemDateGet()); } else { delete_from ava_HeaderLoc where ava_HeaderLoc.DocNumber == custInvoiceJourLoc.SalesId; } } } //AVA -
5. FORMS
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
26 | P a g e
S. No. Name
1. CustFreeInvoice
2. SalesQuotationTable
3. SalesTable
4. SalesTableListPage
5. LogisticsPostalAddress
6. CustTable
7. CustTableListPage
8. MarkupTrans
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-
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
27 | 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); 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); 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'
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
28 | P a g e
&& 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); 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); 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); isHeaderAddressChanged = false; } }
2. SalesQuotationTable
Method: Code Changes
Methods: 1. ClassDeclaration
1. Declare the following variable
boolean isCalcTax; // @AVA +-
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
29 | P a g e
2. init 3. isCalcTax
1. Add following code at the end of method
this.isCalcTax(true); // @AVA +- 1. Create new method as follows
public boolean isCalcTax(boolean _isCalcTax = isCalcTax) { isCalcTax = _isCalcTax; return isCalcTax; }
1. Override “clicked” method as follows:
void clicked() { // @AVA +- AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // ; if (element.isCalcTax()) { ttsbegin; TaxEngine.GetTax(salesQuotationTable, today());
ttscommit; } // @AVA +- super(); element.isCalcTax(false); // @AVA +- }
2. Override “clicked” method as follows: void clicked() { AVA_TaxEngine taxEngine = new AVA_TaxEngine(); // @AVA +- ; // @AVA +- if (element.isCalcTax()) { ttsbegin;
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
30 | P a g e
Datasources: SalesQuotationTable 1. write Datasources: SalesQuotationLine 1. write
taxEngine.GetTax(salesQuotationTable, today()); ttscommit; } // @AVA +- SalesQuotationTotals::showTax(menuitemDisplayStr(TaxTmpWorkSalesQuote), salesQuotationTable); element.isCalcTax(false); // @AVA +- } 1. Declare the following variable AVA_TaxEngine TaxEngine= New AVA_TaxEngine();
2. Search the lines “super();” and insert just after that the following code between these lines.
// @AVA + taxEngine.GetTax(salesQuotationTable, systemDateGet()); if(SalesQuotationLine.RecId) { element.isCalcTax(false); } // @AVA - 1. At the end of method just before the code of //<GIN>
//</GIN> add following code
element.isCalcTax(true); // @AVA +-
3. SalesTable
Create a MenuItemButton as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
31 | P a g e
Method: Code Changes
Datasources : SalesTable 1. write
1. Declare the following variable AVA_TaxEngine AVA_TaxEngine= New AVA_TaxEngine();
2. Search the lines “ mustReread = true }” and “ttscommit;” and insert the following code between these lines, just before to “ttscommit”.
AVA_TaxEngine.GetTax(SalesTable, systemDateGet()); //@AVA+-
init
1. Add the following macro before variable declaration #AVA_Macro
2.Search the line “if (isUnrealizedVATEnabled) { this.updateDesignForUnrealizedVAT();
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
32 | P a g e
}” 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()); //@AVA+- element.automaticTotalDiscount(); SalesTotals::showTaxLine(menuitemDisplayStr (TaxTmpWorkSalesOrder), salesTable,salesLine,element);
}
4. SalesTableListPage
Create a MenuItemButton as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
33 | P a g e
5. LogisticsPostalAddress
Create a Button as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
34 | P a g e
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
35 | 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,
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
36 | 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()
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
37 | P a g e
{ AVA_AddressValidation addressValidation = new ava_AddressValidation(); AVA_EntityUseCodeMapping entityUseCode; if (validatedAddress) 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
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
38 | P a g e
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
39 | P a g e
6. CUSTTABLE
Create a buttonGroup as mentioned below:
Create a MenuItemButtons as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
40 | P a g e
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
41 | P a g e
7. CUSTTABLELISTPAGE
Create a buttonGroup as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
42 | P a g e
Create a MenuItemButtons as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
43 | 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 -
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
44 | 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).
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
45 | 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
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
46 | 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.
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
47 | 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>
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
48 | P a g e
/// projProposalJour findAVA_RecId /// </returns> static projProposalJour findAVA_RecId( RecId recId, boolean update = false) { ProjProposalJour projProposalJour; ; projProposalJour.selectForUpdate(update); select firstonly projProposalJour index hint recid Where projProposalJour. RecId == recId; return projProposalJour; }
2. TmpTaxWorkTrans
Method Name Modifications
1. showTaxValue 1. Declare the following: // @AVA + TaxGroup taxGroup; Container conAmtNumber; Ava_taxEngine taxEngine = new Ava_taxEngine(); //BP Deviation Documented int detailNumber = 3; TaxCode prevTaxCode; SysGlobalCache globalCache = Infolog.globalCache(); // @AVA – Search the line “if (this.TaxCode && this.TransDate)” and prior to that insert the following lines // @AVA + #AVA_Macro //BP Deviation Documented if ((AVA_Configuration::find().TaxGroupId == this.TaxGroup ) || (substr(AVA_Configuration::find().TaxGroupId,1,6) == substr(this.TaxGroup,1,6))) { TaxGroup = this.TaxGroup; if (this.SourceTableId == tablename2id(tablestr(SalesLine))) { ConAmtNumber = TaxEngine.SalesTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(CustInvoiceLine))) {
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
49 | P a g e
ConAmtNumber = TaxEngine.CustInvoiceTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(MarkupTrans))) { ConAmtNumber = TaxEngine.MarkupTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(SalesQuotationLine))) { ConAmtNumber = TaxEngine.SalesQuotationTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalOnAcc))) { ConAmtNumber = TaxEngine.projProposalOnAccTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalItem))) { ConAmtNumber = TaxEngine.projProposalItemTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalEmpl))) { ConAmtNumber = TaxEngine.projProposalEmplTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalRevenue))) { ConAmtNumber = TaxEngine.projProposalRevenueTaxDataUpdate(this.TaxCode, this.SourceRecId, DetailNumber, '', PrevTaxCode, True); } if (this.SourceTableId == tablename2id(tablestr(projProposalCost))) { 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));
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
50 | P a g e
} else // @AVA -
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
51 | P a g e
9. CLASSES (Project Integration)
AvaTax Changed the following list of Classes:
1. ProjInvoiceJournalCreate
Method Name Modifications
initJournalHeader
1. Declare the following variable and Macro declaration // @AVA + AVA_TaxEngine ava_TaxEngine = New AVA_TaxEngine(); #AVA_Macro // @AVA -
2. Search the line “this.exchRateSet();” and insert the following
code above to this. // @AVA + if (projInvoiceJour.isProforma()) ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, true, null); else ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, false, null ,ava_DocumentType::SalesInvoice, projInvoiceJour.ProjInvoiceId); // @AVA -
initTotals
1. Add the following variable AVA_TaxEngine AVA_TaxEngine = new AVA_TaxEngine(); // @AVA +-
2. Search the line “projProposalJour =
this.getProjProposalJour(projInvoiceParmTable, true);” and “if(isConfigurationkeyEnabled(configurationKeyNum(PSAARRetainage))” and insert the following code in between
//AVA+ if (projInvoiceJour.isProforma())
S. No. Object ID Name
1. 1017548 ProjInvoiceJournalCreate
2. 1017549 ProjInvoiceJournalPost
3. 1204 TaxProj
4. 683 SalesQuotationEditLinesForm_Proj_Send
5. 681 SalesQuotationEditLinesForm_Proj_Confir
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
52 | P a g e
ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate); else ava_TaxEngine.GetTax(projProposalJour, projInvoiceParmTable.InvoiceDate, false, null ,ava_DocumentType::SalesInvoice, projInvoiceJour.ProjInvoiceId); // @AVA -
2. ProjInvoiceJournalPost
Method Name Modifications
postJournalPost
Override this method and add the following code:
1. Add the following variable declaration:
AVA_TaxEngine ava_TaxEngine = new AVA_TaxEngine(); // @AVA +-
2. Insert the following code after the “Super()” call
// @AVA + if ((!projInvoiceJour.isProforma()) && (AVA_TaxEngine.isProjPrepayment(projProposalJour))) AVA_TaxEngine.CommitTax(projInvoiceJour.ProjInvoiceId, projProposalJour.TaxGroupId); // @AVA -
3. TaxProj
Method Name Modifications
1. markup
1. Declare the following macro as below: #AVA_Macro 2. Search the for the following code “this.insertIntersection(salesCalcTax.markupTaxGroup(), salesCalcTax.markupTaxItemGroup(), _transId, markupTrans.Txt, taxDate);” and replace the following code above to this. //@AVA+ /*
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
53 | P a g e
this.insertIntersection(salesCalcTax.markupTaxGroup(), salesCalcTax.markupTaxItemGroup(), _transId, markupTrans.Txt, taxDate); */ //BP Deviation Documented if ((substr(salesCalcTax.parmProjProposalJour().TaxGroupId,1,6) != substr(AVA_Configuration::find().TaxGroupId,1,6)) || (AVA_Configuration::find().DisableTaxCalculation)) { this.insertIntersection(salesCalcTax.markupTaxGroup(), salesCalcTax.markupTaxItemGroup(), _transId, markupTrans.Txt, taxDate); } else { if (salesCalcTax.markupTaxItemGroup()) { this.insertIntersection(Ava_configuration::find().TaxGroupId, salesCalcTax.markupTaxItemGroup(), _transId, markupTrans.Txt, taxDate); } else { this.insertIntersection(Ava_configuration::find().TaxGroupId, #All, _transId, markupTrans.Txt, taxDate); } } //@AVA-
2. new 1. Declare the following macro as below: #AVA_Macro 2. Search the for the following code “ this.insertIntersection(salesCalcTax.transTaxGroup(), ” And replace below code with this. //@AVA+ /*this.insertIntersection(salesCalcTax.transTaxGroup(), salesCalcTax.transTaxItemGroup(), salesCalcTax.transTransId(),
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
54 | P a g e
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-
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()); // @AVA +-
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
55 | P a g e
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()); // @AVA +-
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
56 | P a g e
10. FORMS (Project Integration)
AvaTax Changes are at the following list of Form:
S. No. Name
1. SalesQuotationProjTable
2. ProjInvoiceProposalDetail
3. ProjInvoiceProposalListPage
4. ProjInvoiceTotals
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()); ttscommit; } // @AVA +
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
57 | P a g e
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()); ttscommit; } // @AVA +-
super(); element.isCalcTax(false); // @AVA +- }
2. ProjInvoiceProposalDetail
Method / Properties Modification
1. Declare following variable. AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +- 2. Search the line “projProposalTotals = new
ProjProposalTotals(projProposalJour);” and insert the following lines after this line.
AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate); // @AVA +-
3. ProjInvoiceProposalListPage
Method / Properties Modification 1. Declare following variable.
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
58 | P a g e
AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +- 2.Search the line “projProposalTotals = new ProjProposalTotals(projProposalJour);” and insert the following lines after this line. AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate); // @AVA +-
4. ProjInvoiceTotals
Method / Properties Modification
calcTotals 1. Declare following variable. AVA_TaxEngine AVA_TaxEngine = New AVA_TaxEngine();// @AVA +- 2. Search the line “displayFieldsProj = ProjProposalTotals::displayFieldsServer(projProposalJourLocal.RecId);” and insert the following lines before this line.
AVA_TaxEngine.GetTax(projProposalJour, projProposalJour.InvoiceDate); // @AVA +-
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); // @AVA +-
Init 1. Declare the following macro as below: #AVA_Macro //@AVA+-
Create a MenuItemButton as mentioned below:
Install Document AvaTax Connector for MS Dynamics AX 2012 R2 CU6 <MS Dynamics AX Connector Build AX 6.2.1000.1437.03.00>
59 | P a g e