web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Sales Details Form in AX

(0) ShareShare
ReportReport
Posted on by 492

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.

*This post is locked for comments

I have the same question (0)
  • nmaenpaa Profile Picture
    101,166 Moderator on at

    Please format your code next time before sharing it ("Use rich text formatting" -> "</>"). This time I will do it for you.

    I'm not sure what you are trying to achieve.

    First of all, you can use existing tables as data sources on your form so that you don't need to duplicate the data that already exists in CustInvoiceTrans or other tables.

    Also, your new methods for fetching some data don't make sense. Try to look what information and logic the standard tables already offer before writing your own logic.

    - If you want customer name, use CustInvoiceTrans.CustInvoiceJour().CustTable_OrderAccount().name() or custInvoiceTrans.CustInvoiceJour().InvoicingName

    - If you want tax amount, use CustInvoiceTrans.LineAmountTax

    - If you want customer account, use CustInvoiceTrans.CustInvoiceJour().OrderAccount.

  • Senthil Yadav Profile Picture
    492 on at

    Hello Thanks for your suggestion.  Tax Amount not fetched from CustInvoiceTrans.LineAmountTax.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans