Sales Details Form

Hello Team,

I have developed a Form in AX 2009 for Sales Details. I have written a code at CustInvoiceTrans table in insert method. I am not able to get Customer Name, Customer Account Number, Tax Amount posted against each line present against a Sales Invoice. I am refering TaxTrans Table, TaxTrans_IN Table, CustInvoiceTrans Table and CustInvoiceJour Table.
I tried to fetch differenet fields from different tables so that if anyone clicks i get all the details from Same Table. Code written in CustInvoiceTrans table is also below:

public void insert()
{
SalesDetails SalesDetails;
CustInvoiceJour custInvoiceJour;
CustTable CustTable;
super();
//UCC SY Sales Details Form
SalesDetails.initValue();
SalesDetails.CustAccount = this.CustomerAccount();
SalesDetails.CustName = this.CustName();
SalesDetails.InvoiceId = this.InvoiceId;
SalesDetails.InvoiceDate = this.InvoiceDate;
SalesDetails.ItemId = this.ItemId;
SalesDetails.Qty = this.Qty;
SalesDetails.SalesPrice = this.SalesPrice;
SalesDetails.LineAmount = this.LineAmount;
SalesDetails.TaxAmount = this.SalesTaxAmount();
SalesDetails.TaxCode = this.TaxItemGroup;
SalesDetails.InvoiceAmount = this.LineAmount + this.SalesTaxAmount();
//SalesDetails.DlvMode = custInvoiceJour.DlvMode;
//SalesDetails.DlvTerm = custInvoiceJour.DlvTerm;
//SalesDetails.CustName = this.Name;
SalesDetails.write();
}

public Real SalesTaxAmount()
{
TaxTrans taxtrans;
Real val_gst;
Select TaxAmount from TaxTrans
where TaxTrans.TaxCode like '*GST*'
//&& TaxTrans.InventTransId== this.InventTransId
&& taxtrans.Voucher == this.InvoiceId;
val_gst=taxtrans.TaxAmount;
return -(val_gst);
}

public String30 CustomerAccount()
{
CustInvoiceJour custinv;
String30 cusAcc;
Select OrderAccount from custinv
where custinv.InvoiceId == this.InvoiceId;
cusAcc = custinv.OrderAccount;
return cusAcc;
}

public Str CustName()
{
TaxTrans_IN taxtrans_1;
Str custname;
Select CustomerName from taxtrans_1
where taxTrans_1.InvoiceId == this.InvoiceId
&& taxtrans_1.ItemId == this.ItemId ;
custname =taxtrans_1.CustomerName;
return custname;
}

Can you please let me know, where i am going wrong. Thank You.

Parents
No Data
Reply
  • What about something like this?

    custTable = this.custInvoiceJour().custTable_InvoiceAccount(); // or custTable_OrderAccount()
    salesDetails.CustAccount = custTable.AccountNum;
    salesDetails.CustName = custTable.Name;


    I hope that these methods exist in AX 2009; I'm looking into D365FO.

Children
Related
Recommended