
In ax 2012 there is no way to post the VAT transactions in batch mode. The only possible mode is the interactive one which can last several hours and blocks the user’s PC who is unable to work.
So we decided to modify the procedure in order to give the user the possibility to launch it in batch mode
To do this we need to make some small but essential changes to two classes. The TaxReport and the TaxReport_IT (this is because in my case I have to launch it with the italian localizations)
First of all access the TaxReport class and insert a new variable called batchScheduled of type NoYes in the class declaration
TaxReport class

class TaxReport extends RunBaseBatch
{
.......
// Convert class in Batch for italian localizations
NoYes batchScheduled;
.......
}
Add the new method “canRunBatch” on TaxReport class

// Convert class in Batch for italian localizations
public boolean canRunBatch()
{
return true;
}
Add the new method “InitializeBatch” on TaxReport class

// Convert class in Batch for italian localizations
protected BatchHeader initializeBatch()
{
BatchInfo batchInformation = this.batchInfo();
BatchHeader batch = batchInformation.parmBatchHeader();
batch.clearAllAlerts();
batch.addUserAlerts(curUserId(),
NoYes::Yes, // ended
NoYes::Yes, // error
NoYes::Yes, // cancelled
NoYes::Yes, // pop-up
NoYes::No); // email
batch.parmCaption(strFmt("@ERM3447", this.taxPeriod(), this.fromDate(), this.transDate()));
batch.addTask(this);
return batch;
}
Add the new method “parmBatchScheduled” on TaxReport class

// Convert class in Batch for italian localizations
protected NoYes parmBatchScheduled(NoYes _batchScheduled = batchScheduled)
{
batchScheduled = _batchScheduled;
return batchScheduled;
}
Add the new method “runBatch” on TaxReport class

// Convert class in Batch for italian localizations
public void runBatch()
{
BatchHeader batch = this.initializeBatch();
batch.save();
this.parmBatchScheduled(NoYes::Yes);
info(strFmt("@SYS73254", batch.parmCaption()));
}
Add the new method “executePreRunOperations” on TaxReport class without nothing inside

// Convert class in Batch for italian localizations
public void executePreRunOperations()
{
}
Add this code into “Main” method of TaxReport class

server static void main(Args _args)
{
......
if (taxReport is TaxReport_IT)
{
// Convert class in Batch for italian localizations
taxReport.executePreRunOperations();
if (taxReport.canRunBatch())
{
taxReport.runBatch();
}
}
......
}
TaxReport_IT class
Go to TaxReport_IT class and add these variables in the classdeclaration method.

class TaxReport_IT extends TaxReport
{
......
// Convert class in Batch for italian localizations
boolean dialogPaymentIsOK;
#localMacro.CurrentListIT
salesVATRounded,
purchaseVATRounded,
prevVATCredit,
prevVATDebit,
vatCompensation,
vatPrePayment,
paymentDate,
vatPaymentAmount,
bankAccountId,
bankRef1,
bankRef2,
taxPeriod,
fromDate,
toDate
#endMacro
........
}
Add the new method “executePreRunOperations” on TaxReport_IT class

// Convert class in Batch for italian localizations
public void executePreRunOperations()
{
super();
dialogPaymentIsOK = this.dialogPayment();
}
Add the new method “canRunBatch” on TaxReport_IT class

// Convert class in Batch for italian localizations
public boolean canRunBatch()
{
return super() && dialogPaymentIsOK;
}
Add this code into the “Run” method on TaxReport_IT class

public void run()
{
................
// Convert class in Batch for italian localizations
//if (this.dialogPayment()) //Comment existing line
dialogPaymentIsOK = true;
if (dialogPaymentIsOK)
{
................
}
Now you can submit the Sales tax Payments in batch mode
Excellent
LikeLike