How to Open Browser Form in Ax 2012

How to Open Browser Form in Ax 2012

Description:-

In this Form we will see How to Open Browser in Ax from using ActiveX.

Step 1: Now Create Form Node and Design your form like below.
  • Expand AOT Node.
  • Select Form Node and Right Click Select New Form and Name it “A_OpenBrowser”.
  • Now Drag and Drop Table in Form DataSource.
  • Select Design Node Right Click and Select New Controls and Add Grid Controls in Design Node.
Step 2: Now Right click the Design node of form and add ActiveX control.
Step 3: Select Microsoft Web Browser from ActiveX control window list.
Step 4: Now override init Method of Form Method and Code for Navigate ActiveX Control where you want to Navigate.

ActiveX.Navigate ("www.google.com");

ActiveX Control is the Name of the Control

Step 5: Now run your form and check output.
find in container OR how to use confind() in dynamics ax

find in container OR how to use confind() in dynamics ax

Description:-

In this Article we will see about container in ax. There are more functionality in container to do in ax it’s like array to store data in container and read it from container. A container can be stored in the database as a dataBasecoloumn created through AOT especially used to store images/files as a blob. For example assignment of a container to another container variable and container functions such as conIns(), conDel(), conPoke(), += etc. are actually creating a new copy of the container. Here is the demo Example of container in Ax.

confind:- Use confind to locate a sequence of items in a container.

EX:-  int conFind (container container, anytype element,... )

static void conFindExample(Args _args)
{
    container c = ["item1", "item2", "item3"];
    int i;
    int j;
    ; 
    i = conFind(c, "item2");
    j = conFind(c, "item4");
    print "Position of 'item2' in container is " + int2Str(i);
    print "Position of 'item4' in container is " + int2Str(j);
    pause;
}

Create HTML using HtmlTextWriter class in dynamics ax


Description:-

HtmlTextWriter class is used to output properly formed HTMLinto a web page.  TheHtmlTextWriter allows the developer to code attributes, style attributes, andtags etc.

The HtmlTextWriter class permits the developer to generatepage output in a non-browser specific way; that is to say, the burden ofdeveloping alternative Markup is typically removed by using theHtmlTextWriter.  The HtmlTextWriter class exposes properties, fields, andmethods that permit the developer to format HTML 4.0 compliant output. 

For example, in the job below i added static string and  an image using the HtmlTextWriter class. 

Code:-

static void HTMLTextWriter(Args _args)
{
    HTMLTextWriterhtw = new HTMLTextWriter();
    TextBuffer     txtBuffer = new TextBuffer();
    CCHTMLString   staticString;
    ;
    staticString = @'At Solugenix we know our success results from taking a long term view in all our relationships: clients, employees, industries and technologies.;   
    htw.renderBeginTag(HtmlTextWriterTag::table());   
    htw.renderBeginTag(HtmlTextWriterTag::tr());   
    htw.write(staticString);   
    htw.addAttribute(HtmlTextWriterAttribute::class_Attribute(), 'ms-vb');   
    htw.addStyleAttribute(HtmlTextWriterStyle::width(), '26px');   
    htw.addStyleAttribute(HtmlTextWriterStyle::padding_top(), '3px');   
    htw.renderBeginTag(HtmlTextWriterTag::td());   
    htw.addAttribute(HtmlTextWriterAttribute::src(), 'http://www.holidayegreetingssite.com/index_files/image3121.jpg’);//getthe image from web   
    htw.addStyleAttribute(HtmlTextWriterStyle::width(), '100');   
    htw.addStyleAttribute(HtmlTextWriterStyle::height(), '50');   
    htw.renderBeginTag(HtmlTextWriterTag::img(), true);
    htw.renderEndTag();
    //close <Td>
    htw.renderEndTag();
    //close <Table>   
    txtBuffer.setText(htw.getHtmlString());   
    txtBuffer.toFile('f:\\DynamicsAX.html'); //please provide your path to save thefile
}

How to read an Excel file in asp.net

How to read an Excel file in asp.net

Description:-

The following program illustrates how to open an existing Excel spreadsheet in C# using .NET Framework COM interop capability. Also you can see how to find Named Ranges in Excel and get the range of occupied cells (Used area) in excel sheet.

The following C# source code using Microsoft Excel 12.0 Object Library for reading an Excel file. In the previous section we saw how to import Microsoft Excel 12.0 Object Library in the CSharp project.

Source Code:-

using System;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel; 

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Excel.Application xlApp ;
            Excel.Workbook xlWorkBook ;
            Excel.Worksheet xlWorkSheet ;
            Excel.Range range ;
            string str;
            int rCnt = 0;
            int cCnt = 0;
            xlApp = new Excel.Application();
            xlWorkBook = xlApp.Workbooks.Open("csharp.net-informations.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
            range = xlWorkSheet.UsedRange;
            for (rCnt = 1; rCnt <= range.Rows.Count; rCnt++)
            {
                for (cCnt = 1; cCnt <= range.Columns.Count; cCnt++)
                {
                    str = (string)(range.Cells[rCnt, cCnt] as Excel.Range).Value2 ;
                    MessageBox.Show(str);
                }
            }

            xlWorkBook.Close(true, null, null);
            xlApp.Quit();

            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);
        }

        private void releaseObject(object obj)
        {
            try
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                obj = null;
            }
            catch (Exception ex)
            {
                obj = null;
                MessageBox.Show("Unable to release the Object " + ex.ToString());
            }
            finally
            {
                GC.Collect();
            }
        } 
    }
}

How to add row in gridview dynamically in Asp.net

Description:-

This article talks about a small project that presents the idea of having a GridView which facilitates the add rows dynamically at run time. In this article, I'm going to wrap up everything into one for easy reference. The following are the main features that you will see:

  • Adding rows of TextBox, DropDownlist, Radio button and Checkbox.
  • Retain TextBox values and DropDownlist selected values across Postback.
  • Ability to remove rows.
  •     Save all values at once. 
To get started fire up Visual Studio and then add a new Web Form page. Add a GridView control to the page. Here's the GridView HTML markup:

Default.aspx:-

<div>
<asp:GridView ID="Gridview1" runat="server" ShowFooter="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical">
  <AlternatingRowStyle BackColor="#CCCCCC" />
    <Columns>
      <asp:BoundField DataField="RowNumber" HeaderText="Row Number" />
        <asp:TemplateField HeaderText="First Name">
          <ItemTemplate>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Last Name">
          <ItemTemplate>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Gender">
          <ItemTemplate>
            <asp:RadioButtonList ID="RBLGender" runat="server"RepeatDirection="Horizontal">
              <asp:ListItem Value="M">Male</asp:ListItem>
              <asp:ListItem Value="F">Female</asp:ListItem>
            </asp:RadioButtonList>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Status">
          <ItemTemplate>
            <asp:CheckBoxList ID="Status" runat="server"RepeatDirection="Horizontal">
              <asp:ListItem>Single</asp:ListItem>
              <asp:ListItem>Married</asp:ListItem>
            </asp:CheckBoxList>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Qualification">
          <ItemTemplate>
            <asp:DropDownList ID="drpQualification" runat="server">
              <asp:ListItem Value="G">Graduate</asp:ListItem>
              <asp:ListItem Value="P">Post Graduate</asp:ListItem>
            </asp:DropDownList>
          </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Grade">
          <ItemTemplate>
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
          </ItemTemplate>
          <FooterStyle HorizontalAlign="Right" />
          <FooterTemplate>
            <asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="ButtonAdd_Click" />
          </FooterTemplate>
        </asp:TemplateField>
      </Columns>
      <FooterStyle BackColor="#CCCCCC" />
      <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
      <PagerStyle BackColor="#999999" ForeColor="Black"HorizontalAlign="Center" />
      <SelectedRowStyle BackColor="#000099" Font-Bold="True"ForeColor="White" />
      <SortedAscendingCellStyle BackColor="#F1F1F1" />
      <SortedAscendingHeaderStyle BackColor="#808080" />
      <SortedDescendingCellStyle BackColor="#CAC9C9" />
      <SortedDescendingHeaderStyle BackColor="#383838" />
  </asp:GridView>
</div>

Default.aspx.cs:-

protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
  {
    SetInitialRow();
  }
}

private void SetInitialRow()
{
  DataTable dt = new DataTable();
  DataRow dr = null;
  dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
  dt.Columns.Add(new DataColumn("Column1", typeof(string)));
  dt.Columns.Add(new DataColumn("Column2", typeof(string)));
  dt.Columns.Add(new DataColumn("Column3", typeof(string)));
  dt.Columns.Add(new DataColumn("Column4", typeof(string)));
  dt.Columns.Add(new DataColumn("Column5", typeof(string)));
  dt.Columns.Add(new DataColumn("Column6", typeof(string)));

  dr = dt.NewRow();
  dr["RowNumber"] = 1;
  dr["Column1"] = string.Empty;
  dr["Column2"] = string.Empty;
  dr["Column3"] = string.Empty;
  dr["Column4"] = string.Empty;
  dr["Column5"] = string.Empty;
  dr["Column6"] = string.Empty;

  dt.Rows.Add(dr);
  //dr = dt.NewRow();
  //Store the DataTable in ViewState
  ViewState["CurrentTable"] = dt;
  Gridview1.DataSource = dt;
  Gridview1.DataBind();
}

private void AddNewRowToGrid()
{
  int rowIndex = 0;
  if (ViewState["CurrentTable"] != null)
  {
    DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
    DataRow drCurrentRow = null;
    if (dtCurrentTable.Rows.Count> 0)
    {
      for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
      {
        //extract the TextBox values
        TextBox box1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1");
        TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox2");
        TextBox box3 = (TextBox)Gridview1.Rows[rowIndex].Cells[3].FindControl("TextBox3");
        RadioButtonList box4 = (RadioButtonList)Gridview1.Rows[rowIndex].Cells[3].FindControl("RBLGender");
        DropDownList box5 = (DropDownList)Gridview1.Rows[rowIndex].Cells[5].FindControl("drpQualification");
        CheckBoxList box6 = (CheckBoxList)Gridview1.Rows[rowIndex].Cells[6].FindControl("Status");
        drCurrentRow = dtCurrentTable.NewRow();
        drCurrentRow["RowNumber"] = i + 1;
        dtCurrentTable.Rows[i - 1]["Column1"] = box1.Text;
        dtCurrentTable.Rows[i - 1]["Column2"] = box2.Text;
        dtCurrentTable.Rows[i - 1]["Column3"] = box3.Text;
        dtCurrentTable.Rows[i - 1]["Column4"] = box4.SelectedValue;
        dtCurrentTable.Rows[i - 1]["Column5"] = box5.SelectedValue;
        dtCurrentTable.Rows[i - 1]["Column6"] = box6.SelectedValue;
        rowIndex++;
      }
      dtCurrentTable.Rows.Add(drCurrentRow);
      ViewState["CurrentTable"] = dtCurrentTable;
      Gridview1.DataSource = dtCurrentTable;
      Gridview1.DataBind();
    }
  }
  else
  {
    Response.Write("ViewState is null");
  }
  //Set Previous Data on Postbacks
  SetPreviousData();
}

private void SetPreviousData()
{
  int rowIndex = 0;
  if (ViewState["CurrentTable"] != null)
  {
    DataTable dt = (DataTable)ViewState["CurrentTable"];
    if (dt.Rows.Count> 0)
    {
      for (int i = 0; i <dt.Rows.Count; i++)
      {
        TextBox box1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1");
        TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox2");
        TextBox box3 = (TextBox)Gridview1.Rows[rowIndex].Cells[3].FindControl("TextBox3");
        RadioButtonList box4 = (RadioButtonList)Gridview1.Rows[rowIndex].Cells[4].FindControl("RBLGender");
        DropDownList box5 = (DropDownList)Gridview1.Rows[rowIndex].Cells[5].FindControl("drpQualification");
        CheckBoxList box6 = (CheckBoxList)Gridview1.Rows[rowIndex].Cells[6].FindControl("Status");
        box1.Text = dt.Rows[i]["Column1"].ToString();
        box2.Text = dt.Rows[i]["Column2"].ToString();
        box3.Text = dt.Rows[i]["Column3"].ToString();
        box4.SelectedValue = dt.Rows[i]["Column4"].ToString();
        box5.SelectedValue = dt.Rows[i]["Column5"].ToString();
        box6.SelectedValue = dt.Rows[i]["Column6"].ToString();
        rowIndex++;
      }
    }
  }
}

protected void ButtonAdd_Click(object sender, EventArgs e)
{
  AddNewRowToGrid();
}

How to confirm sales order through code in Ax 2012


Description:-

In this post I have create code for sales order confirmation, here we will see how to confirm sales order through code in dynamics ax 2012.This code is straight forward and simple. It has been very useful to me, because we made a lot of changes to the Sales Life cycle of Axapta.
Copy and paste below code and fill you sales order number which you want to confirm.

static void SalesOrderConfirmation(Args _args)
{
    SalesTable salesTable;
    SalesFormLetter salesFormLetter;      
    SalesTable = SalesTable::find(SalesOrderNumber');
    salesFormLetter = SalesFormLetter::construct(DocumentStatus::Confirmation);
    salesFormLetter.update(salesTable);
}

Here I have also written code for sales order confirmation through class, you can create method in class and confirm sales order, by passing the sales order number in this method you can confirm sales order.

public boolean confirmSalesOrder(SalesId _salesId)
{
    SalesFormletter SalesFormletter;
    SalesTable SalesTable;
    ;
    SalesFormletter = SalesFormletter::construct(DocumentStatus::Confirmation,true);
    SalesTable.clear();
    SalesTable = SalesTable::find(_salesId);
    SalesFormletter.update(SalesTable,systemDateGet(),SalesUpdate::All,AccountOrder::None,false,false);
}

What I did was create a Class that contained different methods for taking sales orders through the sales life cycle.
SQL Query for get sales invoice GST Tax in ax 2012

SQL Query for get sales invoice GST Tax in ax 2012

Description:-

In this article we will see about how to get GST Tax Rate and Tax amount through SQL Query.
Here I have given sample demonstration to get sales invoice GST Tax rate and Tax Amount in Ax 2012. Using SQL query you can check GST tax rate and tax amount.

Here I have create SQL Query for get Sales tax, Voucher, Currency Code, Exchange Rate, Item Number, item Quantity, Sales Price, Line Amount, Discount Amount, Charges Amount, Discount Percentage, GST Rate and Tax Amount.

Here also you can get Tax Registration Number by party Name in Ax 2012. Intermediate table for DirPartyTable and taxRegistration is DirPartyLocation and registrationNumber is the field to get value of tax registration Number.

You can also get Line Amount in INR also if you’re sales order in foreign currency. If you get IGST Amount then here I have also get IGST in INR.

SELECT
       CUSTINVOICEJOUR.SALESID AS 'SALES ORDER NUMBER',
       CUSTINVOICEJOUR.INVOICEACCOUNT AS VENDACCOUNT,
       DIRPARTYTABLE.NAME AS 'CUSTOMER NAME',
       TAXREGISTRATIONNUMBERS_IN.REGISTRATIONNUMBER AS GSTIN,
       HSNCODETABLE_IN.CODE AS 'HSN CODE',
       CUSTINVOICEJOUR.INVOICEID AS INVOICEID,
       CUSTINVOICEJOUR.LEDGERVOUCHER AS VOUCHER,
       CAST(CUSTINVOICEJOUR.SUMTAX AS DECIMAL(10,2)) AS 'SALES TAX',
       CUSTINVOICEJOUR.CURRENCYCODE AS CURRENCY,
       CAST(CUSTINVOICEJOUR.EXCHRATE/100 AS DECIMAL(10,2)) AS 'EXCHANGE RATE',
       TAXTRANS.SOURCERECID AS 'CUSTINVOICETRANS (RECID)',   
       CAST(CUSTINVOICETRANS.LINENUM AS DECIMAL(10,2)) AS 'LINE NUMBER',
       CUSTINVOICETRANS.ITEMID AS ITEMID,
       CUSTINVOICETRANS.NAME AS 'ITEM NAME',
       CAST(CUSTINVOICETRANS.QTY AS DECIMAL(10,2)) AS QUANTITY,
       CAST(CUSTINVOICETRANS.PRICEUNIT AS DECIMAL(10,2)) AS 'PRICE UNIT',
       CAST(CUSTINVOICETRANS.LINEAMOUNT AS DECIMAL(10,2)) AS 'LINE AMOUNT',
       CAST(CUSTINVOICETRANS.LINEAMOUNTMST AS DECIMAL(10,2)) AS 'LINE AMOUNT (INR)',
       CAST(CUSTINVOICETRANS.DISCAMOUNT AS DECIMAL(10,2)) AS DICOUNT,
       CAST(CUSTINVOICETRANS.DISCAMOUNT * CUSTINVOICEJOUR.EXCHRATE/100 AS DECIMAL(10,2)) AS 'DICOUNT (INR)',
       CAST(CUSTINVOICETRANS.DISCPERCENT AS DECIMAL(10,2)) AS 'DISCOUNT PERCENTAGE',    
       CAST(MARKUPTRANS.CALCULATEDAMOUNT AS DECIMAL(10,2)) AS 'TOTAL CHARGES',
       CAST(MARKUPTRANS.CALCULATEDAMOUNT * CUSTINVOICEJOUR.EXCHRATE/100 AS DECIMAL(10,2)) AS 'TOTAL CHARGES (INR)',
       TAXTRANS.TAXCODE AS 'TAX CODE',
       TAXTRANS.TAXACCOUNTTYPE,
       CAST(TAXTRANS.TAXVALUE AS DECIMAL(10,2)) AS 'RATE',
       CAST(TAXTRANS.SOURCEREGULATEAMOUNTCUR AS DECIMAL(10,2)) AS 'TAX AMOUNT',
       CAST(TAXTRANS.TAXAMOUNT AS DECIMAL(10,2)) AS 'TAX AMOUNT (INR)',    
       CAST(CUSTINVOICEJOUR.INVOICEAMOUNT AS DECIMAL(10,2)) AS 'INVOICE AMOUNT',
       CAST(CUSTINVOICEJOUR.INVOICEAMOUNTMST AS DECIMAL(10,2)) AS 'INVOICE AMOUNT (INR)'
       --CAST((TAXWITHHOLDTRANS_IN.TAXWITHHOLDAMOUNTCUR * -1)  AS DECIMAL(10,2)) AS 'TCS AMOUNT'
       FROM CUSTINVOICETRANS
JOIN CUSTINVOICEJOUR ON CUSTINVOICEJOUR.INVOICEID = CUSTINVOICETRANS.INVOICEID   
       AND CUSTINVOICEJOUR.SALESID = CUSTINVOICETRANS.SALESID
       AND CUSTINVOICEJOUR.NUMBERSEQUENCEGROUP = CUSTINVOICETRANS.NUMBERSEQUENCEGROUP
       AND CUSTINVOICEJOUR.INVOICEDATE = CUSTINVOICETRANS.INVOICEDATE
--LEFT OUTER JOIN TAXWITHHOLDTRANS_IN ON TAXWITHHOLDTRANS_IN.VOUCHER = CUSTINVOICEJOUR.LEDGERVOUCHER
LEFT OUTER JOIN TAXTRANS ON TAXTRANS.SOURCERECID = CUSTINVOICETRANS.RECID
       AND    TAXTRANS.VOUCHER = CUSTINVOICEJOUR.LEDGERVOUCHER
       AND TAXTRANS.TRANSDATE = CUSTINVOICEJOUR.INVOICEDATE
       --AND TAXTRANS.TAXACCOUNTTYPE = 1
       AND TAXTRANS.TAXCODE IN ('IGST','CGST','SGST')--,'BCD','ECESS C','IGST CUS','SHECESS C')
LEFT OUTER JOIN MARKUPTRANS ON MARKUPTRANS.TRANSRECID = CUSTINVOICETRANS.RECID   
LEFT OUTER JOIN VENDTABLE ON VENDTABLE.ACCOUNTNUM = CUSTINVOICEJOUR.INVOICEACCOUNT
LEFT OUTER JOIN DIRPARTYTABLE ON DIRPARTYTABLE.RECID = VENDTABLE.PARTY
LEFT OUTER JOIN TAXINFORMATION_IN ON TAXINFORMATION_IN.REGISTRATIONLOCATION = DIRPARTYTABLE.PRIMARYADDRESSLOCATION
       AND TAXINFORMATION_IN.ISPRIMARY = 1
LEFT OUTER JOIN TAXREGISTRATIONNUMBERS_IN ON TAXREGISTRATIONNUMBERS_IN.RECID = TAXINFORMATION_IN.GSTIN
LEFT OUTER JOIN INVENTTABLE ON INVENTTABLE.ITEMID = CUSTINVOICETRANS.ITEMID
LEFT OUTER JOIN HSNCODETABLE_IN ON HSNCODETABLE_IN.RECID = INVENTTABLE.HSNCODETABLE_IN
where CUSTINVOICEJOUR.SALESID = 'SalesOrderNumber'
GROUP BY
       --TAXWITHHOLDTRANS_IN.TAXWITHHOLDAMOUNTCUR,
       TAXTRANS.TAXCODE,
       TAXTRANS.TAXACCOUNTTYPE,
       TAXTRANS.TAXAMOUNT,
       TAXTRANS.SOURCEREGULATEAMOUNTCUR,
       CUSTINVOICEJOUR.INVOICEID,
       CUSTINVOICEJOUR.SALESID,
       CUSTINVOICEJOUR.INVOICEACCOUNT,
       TAXTRANS.SOURCERECID,
       TAXTRANS.TAXVALUE,  
       DIRPARTYTABLE.NAME,
       DIRPARTYTABLE.PRIMARYADDRESSLOCATION,
       TAXREGISTRATIONNUMBERS_IN.REGISTRATIONNUMBER,
       TAXINFORMATION_IN.GSTIN,
       TAXINFORMATION_IN.REGISTRATIONLOCATION,
       HSNCODETABLE_IN.CODE,
       VENDTABLE.PARTY,
       VENDTABLE.ACCOUNTNUM,     
       MARKUPTRANS.CALCULATEDAMOUNT,
       MARKUPTRANS.TRANSRECID,
       CUSTINVOICETRANS.ITEMID,
       CUSTINVOICETRANS.NAME,
       CUSTINVOICETRANS.LINEAMOUNT,
       CUSTINVOICETRANS.LINEAMOUNTMST,
       CUSTINVOICETRANS.RECID,
       CUSTINVOICEJOUR.INVOICEAMOUNT,
       CUSTINVOICEJOUR.INVOICEAMOUNTMST,
       CUSTINVOICEJOUR.INVOICEACCOUNT,
       CUSTINVOICEJOUR.CURRENCYCODE,
       CUSTINVOICEJOUR.EXCHRATE,
       CUSTINVOICEJOUR.LEDGERVOUCHER,
       CUSTINVOICEJOUR.SUMTAX,
       CUSTINVOICETRANS.QTY,
       CUSTINVOICETRANS.PRICEUNIT,
       CUSTINVOICETRANS.DISCAMOUNT,
       CUSTINVOICETRANS.DISCPERCENT,
       CUSTINVOICETRANS.LINENUM
ORDER BY
       CUSTINVOICEJOUR.INVOICEID ASC

How to Create Enum Parameter in SSRS Report in ax 2012

Description:-

When you use Enum as a parameter in reports, it works well within the AX client. However, to deploy it to the Enterprise Portal (EP), the parameter lookup must be built through the AX Enum provider. This recipe will discuss how an Enum provider can be added to a report and used in parameters.

This topic provides the steps to use an Enum type as a report parameter. The collection of enumeration values can then be referenced by the report. For example, from the Facility Management sample for Microsoft Dynamics AX, the room type is stored as an enumeration type. You can add a dataset that binds to the ‘Enum name’ enumeration and restrict the report to display a specific room type, such as Cubicle. You will create the dataset as an AX Enum Provider data source type so that the Enum parameter can be accessed from Enterprise Portal in addition to the Microsoft Dynamics AX client.

Creating an Enum Type Parameter
To create a parameter of type Enum, you must have the following:
  • Create ENUM from Data Dictionary Node.
  • Give style property to Radio button.
  • Give UseEnumValue Property to Yes.
Now create Contract class and create Enum parameter method for pass parameter value to ssrs report like below.
I have create SalesInvoiceRegister Enum value and Add following Element in SalesInvoiceRegister Enum and set above property in SalesInvoiceRegister Enum.
  • All
  • Customer
  • Sales Category
After I have used SalesInvoiceRegister Enum in Contract class like below.

Public SalesInvoiceRegister ParmSalesInvoiceRegister (SalesInvoiceRegister _ SalesInvoiceRegister = SalesInvoiceRegister)
{
    SalesInvoiceRegister = _ SalesInvoiceRegister;
    Return SalesInvoiceRegister;
}

  • Create Data Procedure class for assign your logic.
  • Create SSRS Report design and deployed it.
  • You’re Enum Parameter will look like below in SSRS Report.
Get client browser details in asp.net

Get client browser details in asp.net

Description:-

Here is one more example to read client browser detail using HttpContext.Current.Request.Browser. Here I have read Client browser detail through code and display information on webpage to see which client come from which browser or else we can store client browser information in our database to keep in touch that’s coming more than one time. Here is the demo example to read browser detail in dot net.

Default.aspx.cs:-

protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
  {
    Response.Write(GetBrowserDetails());
  }
}

public static string GetBrowserDetails()
{
  string browserDetails = string.Empty;
  System.Web.HttpBrowserCapabilities browser = HttpContext.Current.Request.Browser;
  browserDetails =
    "Name = " + browser.Browser + ",<br/>"
    + "Type = " + browser.Type + ",<br/>"
    + "Version = " + browser.Version + ",<br/>"
    + "Major Version = " + browser.MajorVersion + ",<br/>"
    + "Minor Version = " + browser.MinorVersion + ",<br/>"
    + "Platform = " + browser.Platform + ",<br/>"
    + "Is Beta = " + browser.Beta + ",<br/>"
    + "Is Crawler = " + browser.Crawler + ",<br/>"
    + "Is AOL = " + browser.AOL + ",<br/>"
    + "Is Win16 = " + browser.Win16 + ",<br/>"
    + "Is Win32 = " + browser.Win32 + ",<br/>"
    + "Supports Frames = " + browser.Frames + ",<br/>"
    + "Supports Tables = " + browser.Tables + ",<br/>"
    + "Supports Cookies = " + browser.Cookies + ",<br/>"
    + "Supports VBScript = " + browser.VBScript + ",<br/>"
    + "Supports JavaScript = " + "," + browser.EcmaScriptVersion.ToString() + ",<br/>"
    + "Supports Java Applets = " + browser.JavaApplets + ",<br/>"
    + "Supports ActiveX Controls = " + browser.ActiveXControls + ",<br/>"
    + "Supports JavaScript Version = " + browser["JavaScriptVersion"];
  return browserDetails;
}