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