Get invoice Id in settlement table of sales order in MSD Axapta

You can Get invoice Id in settlement table of sales order in Microsoft dynamics axapta . CustTrans is a axapta table which stored posted transactions of customers. You can use account number ,voucher and record id field to retrieve invoice account.

 display str InvoiceAccount()  
 {  
   str   InvoiceId;  
   CustTrans CustTrans1;  
   ;  
  select * from custTrans1 where custTrans1.AccountNum == this.AccountNum && custTrans1.Voucher==this.OffsetTransVoucher  
  ;// && custTrans1.RecId == this.TransRecId;  
  return custTrans1.Invoice;  
 }