Okay checked the latest hotfix for SP2 and the code is changed so can just
change the if statement :)
Also noticed the parmDocument date code is also changed (but dont know if
that is linked to any other hotfix so wont be changing it)

Thanks for the listening ears :)

Code in Ax4sp2 with latest hotfix:
protected void  initLedgerVoucher(TransactionTxt  _transactionTxt)

{

    LedgerVoucherObject ledgerVoucherObject;

    ;

 

    if (! ledgerVoucherIsSet)

    {

 

        ledgerVoucher = LedgerVoucher::newLedgerPost(DetailSummary::Summary,

                                                     SysModule::Sales,

 
numberSeq.parmVoucherSequenceCode());

 

        ledgerVoucherObject = LedgerVoucherObject::newVoucher(voucher,

 
this.updateDate(),

 
SysModule::Sales,

 
LedgerTransType::Sales,

                                                              (creditNote ?
salesParmUpdate.Storno : NoYes::No));

 

        ledgerVoucherObject.parmDocument(

            salesParmTable.DocumentDate ? salesParmTable.DocumentDate :
salesParmTable.Transdate,

            number);

 

        if (this.tax())

            ledgerVoucherObject.parmTaxReference(this.tax().taxReference());

        ledgerVoucher.addVoucher(ledgerVoucherObject);

    }

 

 
ledgerVoucher.findLedgerVoucherObject(voucher).lastTransTxt(_transactionTxt.
txt());

}

 



________________________________

From: James Flavell [mailto:[EMAIL PROTECTED]
Sent: 02 June 2008 22:16
To: 'Axapta-Knowledge-Village@yahoogroups.com'
Subject: TaxRefId not working in AX4.0 SP2


Hi everyone I hope there is someone out there who can stop me going crazy ;)

I found in an upgraded customer that in Ax4.0 Sp2 the followling line of
code has been added to salesformletter.initLedgerVoucher():
        if(salesLine.SalesType == SalesType::ItemReq)
The full method code is below.

This line seems to break the link between TaxTrans records and LedgerTrans
records when posting Sales Invoices such that in teh LEdger trans report
when I tick to pritn the Tax Specifications there is never any tax info
given.

The reason seems to be a normal sales order will not get inside this IF
statement and so in TaxReference.getRefId() it uses the posting voucher
rather than voucher=1 (voucher=1 is what is used when the
TaxReference.createRefId() is run earlier on)

If I comment out this 1 line of IF statement so the code is back as like
Ax4.0 SP1 then it works fine as far as I can tell (voucher=1 in
TaxReference.getRefId() )

When would a sales line be of type Item Requirement??!!
Any ideas why this code was added in SP2???

Thanks
James


protected void  initLedgerVoucher(TransactionTxt  _transactionTxt)
{
    LedgerVoucherObject ledgerVoucherObject;
    ;

    if (! ledgerVoucherIsSet)
    {

        ledgerVoucher = LedgerVoucher::newLedgerPost(DetailSummary::Summary,
                                                     SysModule::Sales,
 
numberSeq.parmVoucherSequenceCode());

        ledgerVoucherObject = LedgerVoucherObject::newVoucher(voucher,
 
this.updateDate(),
 
SysModule::Sales,
 
LedgerTransType::Sales,
                                                              (creditNote ?
salesParmUpdate.Storno : NoYes::No));

        ledgerVoucherObject.parmDocument(salesParmTable.Transdate, number);
        if(salesLine.SalesType == SalesType::ItemReq) //damn this line of
code!!!!!!!!!!!!!
            ledgerVoucherObject.parmTaxReference(this.tax().taxReference());
        ledgerVoucher.addVoucher(ledgerVoucherObject);
    }

 
ledgerVoucher.findLedgerVoucherObject(voucher).lastTransTxt(_transactionTxt.
txt());
}



Reply via email to