Showing posts with label SalesParmUpdate. Show all posts
Showing posts with label SalesParmUpdate. Show all posts

Wednesday, July 20, 2011

Create Electronic Invoice to Text File Format - Ax 2009 -

 The following code is to create a company country specific requirement. In addition, the logic is specific to the needs of my customer, but I'm sure you will be able to find great examples on how to create directories with WinApi and manipulate text files with the TextIO function.

The project flow is as follow:

1- The user posts an invoice
2- After the invoice has been posted, the KMN_eInvoiceCreation class is called with parameters  (This call is not posted here)
3- The class has several methods from creating the path file name, to writing a very specific logic into a text file.
4- The class saves the file into a specific location

The project produces the following text file contents:

DC|3.0|||15/07/2011|Pago en una sola exhibición||150.22|||||270.02||I
EM|KIE9512187VA|Compania de Ventanas S.A.

DF|Juytyu|130|Piso 7 y 8, Desp.801|Lostre|||MiguelHidalgo|DF|Mexico|999
RC|TORE621221HP9|Elizabeth Araya Reyes
DM|Teaneck|308||Warrrr|||Guadalupe|NL|Mexico|986589

CN|1.00|||Libro de Respuestas 3A/2A/A|25.00|25.00
CN|1.00|||Diploma de Finalización 7A|2.61|2.61
CN|1.00|||Diploma de Finalización 6A|2.61|2.61
CN|1.00|||Flashcards 1-50|120.00|120.00
IA|102433660003476|08/10/2010|Laredo
IT|IVA|33.80|16.00
TI||33.80


This project uses a custom table to store all the SalesParmTable data as we needed to provide a way for the user to re-run a posted invoice.

The following are the base enums I'm using.

Thursday, March 10, 2011

Email Invoices based on customer setup options - Microsoft Dynamics Ax 2009

Today I had a requirement that said to add a CheckBox control to the Customer Form to decide weather to print or email an invoice automatically.


NOTE: I will no go over the actual logic on how to email the invoice as I have already written a post about it, you can find it here http://axwonders.blogspot.com/2011/02/save-microsoft-dynamics-ax-2009-report_23.html


The following is the new control added to the CustTable form under the setup Tab:





 Now the logic is very simple. If the a customer account has this checkbox checked then set the Document destination value automatically to Email. Otherwise set the value of the control to Printer. In the picture above we can see that this specific customer has the checkbox checked.


Then the expected result will be to see the Document destination value to Email when a sales order record needs to be invoiced or acknowledged.


Please see the following sequence: