<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ARMaster.ascx.cs" Inherits="Pwc_ARMaster" %>
<style type="text/css">
.style1
{
width: 71px;
}
#datepicker
{
margin-left: 1px;
}
</style>
<table>
<tr>
<td class="style1">
<asp:Label runat="server" ID="LblFromDate" Text="From Date" Width="74px" Font-Bold="true"></asp:Label>
</td>
<td>
<asp:TextBox ID="TxtFromDate" runat="server" ReadOnly="true" Width="220px"></asp:TextBox>
</td>
<td align="left">
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="CatVendorDate" TargetControlId="TxtFromDate" ID="axDPExpirationDate"
runat="server" />
</td>
<td class="style1">
<asp:Label runat="server" ID="LblToDate" Text="To Date" Width="74px" Font-Bold="true"></asp:Label>
</td>
<td>
<asp:TextBox ID="TxtToDate" runat="server" ReadOnly="true" Width="220px"></asp:TextBox>
</td>
<td align="left">
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="CatVendorDate" TargetControlId="TxtToDate" ID="axDPExpirationDatelocal"
runat="server" />
</td>
<td>
<asp:Button runat="server" ID="BtnSubmitlocal" Text="Submit" onclick="BtnSubmitlocal_Click"/>
</td>
<td>
</td>
</tr>
</table>
-------------------------------------------------------------------------------------
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using System.Data;
using System.Collections;
using Microsoft.Dynamics.Framework.BusinessConnector.Adapter;
using Microsoft.Dynamics.AX.Framework.Portal.Data;
using System.Globalization;
using Microsoft.Dynamics.Framework.Portal.UI;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using BCProxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
public partial class ARMaster : System.Web.UI.UserControl
{
BCProxy.Info infoLog;
DateTime fromDate;
DateTime toDate;
private AxValueFormatter DateValueFormatter
{
get
{
IAxContext axContext = AxContextHelper.FindIAxContext(this);
ExtendedDataTypeMetadata fDate = MetadataCache.GetExtendedDataTypeMetadata(ExtendedDataTypeMetadata.TypeNum(this.AxSession, "CatVendorDate"));
return AxValueFormatterFactory.CreateFormatter(this.AxSession.SessionInfo, fDate, axContext.CultureInfo);
}
}
private DateTime Today
{
get
{
return AxDateTimeHelper.GetUserNow(this.AxSession).Date;
}
}
private ISession AxSession
{
get
{
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
return webpart == null ? null : webpart.Session;
}
}
protected void Page_Load(object sender, EventArgs e)
{
var yr = DateTime.Today.Year;
var mth = DateTime.Today.Month;
var firstday = new DateTime(yr,mth,1).AddMonths(-1);
var lastday =new DateTime(yr,mth,1).AddDays(-1);
if (!this.IsPostBack)
{
this.TxtFromDate.Text = firstday.ToShortDateString();
this.TxtToDate.Text = lastday.ToShortDateString();
DateTime fromDate = DateTime.Parse(this.TxtFromDate.Text);
DateTime todate = DateTime.Parse(this.TxtToDate.Text);
}
}
protected void BtnSubmitlocal_Click(object sender, EventArgs e)
{
if (TxtToDate.Text == "" || TxtFromDate.Text == "")
{
string alertScript = "<script type=\"text/javascript\"> alert('Please provide date filters to proceed.');</script>";
ScriptManager.RegisterStartupScript(this, GetType(), "FilterAlert", alertScript, false);
return;
}
DateTime fromDate = DateTime.Parse(TxtFromDate.Text);
DateTime toDate = DateTime.Parse(TxtToDate.Text);
if (fromDate > toDate)
{
string alertScript = "<script type=\"text/javascript\"> alert('From date should be less than to date.');</script>";
ScriptManager.RegisterStartupScript(this, GetType(), "FilterAlert", alertScript, false);
return;
}
}
}
____________________________________________________________________________
New:-
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ARMaster.ascx.cs" Inherits="ARMaster" %>
<%@ Register Assembly="Microsoft.Dynamics.Framework.Portal, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Dynamics.Framework.Portal.UI.WebControls" TagPrefix="dynamics" %>
<dynamics:AxMultiSection ID="EPARRegionMultiSection" runat="server">
<dynamics:AxSection ID="EPARRegionSection" runat="server">
<table>
<tr>
<td style="padding-left:19px;" align="right">
<asp:Label ID="lblFromDate" runat="server" AssociatedControlID="tbFromDate"
Text="<%$Axlabel:@SYS5209%>"></asp:Label>
<dynamics:AxValueFormatValidator ID="axVFVEffectiveDate" runat="server" ControlToValidate="tbFromDate"
DisplayErrorInInfolog="true" ValidateEmptyText="True" ValidationGroup="Error"
ExtendedDataType="TransDate" SetFocusOnError="True" ErrorMessage="<%$Axlabel:@SYS100987%>"
Display="Dynamic">
</dynamics:AxValueFormatValidator>
</td>
<td align="right">
<asp:TextBox class="AxInputField" ID="tbFromDate" Width="100%" ToolTip="<%$Axlabel:@SYS191513%>" runat="server" ReadOnly="False" Enabled="True"></asp:TextBox>
</td>
<td>
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="FromDate" TargetControlId="tbFromDate" ID="axButtonFromDate" runat="server" />
</td>
<td width="75px" align="right">
<asp:Label ID="lblToDate" runat="server" AssociatedControlID="tbToDate"
Text="<%$Axlabel:@SYS14656%>"></asp:Label>
<dynamics:AxValueFormatValidator ID="axVFVExpirationDate" runat="server" ControlToValidate="tbToDate"
DisplayErrorInInfolog="true" ErrorMessage="<%$Axlabel:@SYS100987%>" ExtendedDataType="TransDate"
SetFocusOnError="True" ValidateEmptyText="True" ValidationGroup="Error" Display="Dynamic">
</dynamics:AxValueFormatValidator>
</td>
<td align="right">
<asp:TextBox class="AxInputField" ID="tbToDate" Width="100%" ToolTip="<%$Axlabel:@SYS191513%>" runat="server" ReadOnly="False" Enabled="True"></asp:TextBox>
</td>
<td>
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="ToDate" TargetControlId="tbToDate" ID="axButtonToDate" runat="server" />
</td>
<td>
<asp:Button runat="server" ID="ViewReportButton"
Text="<%$ AxLabel:@SYS334714 %>" onclick="ViewReportButton_Click1" />
</td>
</tr>
</table>
</dynamics:AxSection>
</dynamics:AxMultiSection>
<p>
<dynamics:AxReportViewer runat="server" ID="SalesByRegion" MenuItemName="ARCustomerStatement" />
_______________________________________________________________________
using System;
using System.Collections.Generic;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using Microsoft.Dynamics.AX.Framework.Reporting.Shared;
using Microsoft.Dynamics.Framework.Portal.UI;
using BCProxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
public partial class ARMaster : System.Web.UI.UserControl
{
protected void ViewReportButton_Click1(object sender, EventArgs e)
{
}
}
<style type="text/css">
.style1
{
width: 71px;
}
#datepicker
{
margin-left: 1px;
}
</style>
<table>
<tr>
<td class="style1">
<asp:Label runat="server" ID="LblFromDate" Text="From Date" Width="74px" Font-Bold="true"></asp:Label>
</td>
<td>
<asp:TextBox ID="TxtFromDate" runat="server" ReadOnly="true" Width="220px"></asp:TextBox>
</td>
<td align="left">
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="CatVendorDate" TargetControlId="TxtFromDate" ID="axDPExpirationDate"
runat="server" />
</td>
<td class="style1">
<asp:Label runat="server" ID="LblToDate" Text="To Date" Width="74px" Font-Bold="true"></asp:Label>
</td>
<td>
<asp:TextBox ID="TxtToDate" runat="server" ReadOnly="true" Width="220px"></asp:TextBox>
</td>
<td align="left">
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="CatVendorDate" TargetControlId="TxtToDate" ID="axDPExpirationDatelocal"
runat="server" />
</td>
<td>
<asp:Button runat="server" ID="BtnSubmitlocal" Text="Submit" onclick="BtnSubmitlocal_Click"/>
</td>
<td>
</td>
</tr>
</table>
-------------------------------------------------------------------------------------
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using System.Data;
using System.Collections;
using Microsoft.Dynamics.Framework.BusinessConnector.Adapter;
using Microsoft.Dynamics.AX.Framework.Portal.Data;
using System.Globalization;
using Microsoft.Dynamics.Framework.Portal.UI;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using BCProxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
public partial class ARMaster : System.Web.UI.UserControl
{
BCProxy.Info infoLog;
DateTime fromDate;
DateTime toDate;
private AxValueFormatter DateValueFormatter
{
get
{
IAxContext axContext = AxContextHelper.FindIAxContext(this);
ExtendedDataTypeMetadata fDate = MetadataCache.GetExtendedDataTypeMetadata(ExtendedDataTypeMetadata.TypeNum(this.AxSession, "CatVendorDate"));
return AxValueFormatterFactory.CreateFormatter(this.AxSession.SessionInfo, fDate, axContext.CultureInfo);
}
}
private DateTime Today
{
get
{
return AxDateTimeHelper.GetUserNow(this.AxSession).Date;
}
}
private ISession AxSession
{
get
{
AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
return webpart == null ? null : webpart.Session;
}
}
protected void Page_Load(object sender, EventArgs e)
{
var yr = DateTime.Today.Year;
var mth = DateTime.Today.Month;
var firstday = new DateTime(yr,mth,1).AddMonths(-1);
var lastday =new DateTime(yr,mth,1).AddDays(-1);
if (!this.IsPostBack)
{
this.TxtFromDate.Text = firstday.ToShortDateString();
this.TxtToDate.Text = lastday.ToShortDateString();
DateTime fromDate = DateTime.Parse(this.TxtFromDate.Text);
DateTime todate = DateTime.Parse(this.TxtToDate.Text);
}
}
protected void BtnSubmitlocal_Click(object sender, EventArgs e)
{
if (TxtToDate.Text == "" || TxtFromDate.Text == "")
{
string alertScript = "<script type=\"text/javascript\"> alert('Please provide date filters to proceed.');</script>";
ScriptManager.RegisterStartupScript(this, GetType(), "FilterAlert", alertScript, false);
return;
}
DateTime fromDate = DateTime.Parse(TxtFromDate.Text);
DateTime toDate = DateTime.Parse(TxtToDate.Text);
if (fromDate > toDate)
{
string alertScript = "<script type=\"text/javascript\"> alert('From date should be less than to date.');</script>";
ScriptManager.RegisterStartupScript(this, GetType(), "FilterAlert", alertScript, false);
return;
}
}
}
____________________________________________________________________________
New:-
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ARMaster.ascx.cs" Inherits="ARMaster" %>
<%@ Register Assembly="Microsoft.Dynamics.Framework.Portal, Version=6.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Dynamics.Framework.Portal.UI.WebControls" TagPrefix="dynamics" %>
<dynamics:AxMultiSection ID="EPARRegionMultiSection" runat="server">
<dynamics:AxSection ID="EPARRegionSection" runat="server">
<table>
<tr>
<td style="padding-left:19px;" align="right">
<asp:Label ID="lblFromDate" runat="server" AssociatedControlID="tbFromDate"
Text="<%$Axlabel:@SYS5209%>"></asp:Label>
<dynamics:AxValueFormatValidator ID="axVFVEffectiveDate" runat="server" ControlToValidate="tbFromDate"
DisplayErrorInInfolog="true" ValidateEmptyText="True" ValidationGroup="Error"
ExtendedDataType="TransDate" SetFocusOnError="True" ErrorMessage="<%$Axlabel:@SYS100987%>"
Display="Dynamic">
</dynamics:AxValueFormatValidator>
</td>
<td align="right">
<asp:TextBox class="AxInputField" ID="tbFromDate" Width="100%" ToolTip="<%$Axlabel:@SYS191513%>" runat="server" ReadOnly="False" Enabled="True"></asp:TextBox>
</td>
<td>
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="FromDate" TargetControlId="tbFromDate" ID="axButtonFromDate" runat="server" />
</td>
<td width="75px" align="right">
<asp:Label ID="lblToDate" runat="server" AssociatedControlID="tbToDate"
Text="<%$Axlabel:@SYS14656%>"></asp:Label>
<dynamics:AxValueFormatValidator ID="axVFVExpirationDate" runat="server" ControlToValidate="tbToDate"
DisplayErrorInInfolog="true" ErrorMessage="<%$Axlabel:@SYS100987%>" ExtendedDataType="TransDate"
SetFocusOnError="True" ValidateEmptyText="True" ValidationGroup="Error" Display="Dynamic">
</dynamics:AxValueFormatValidator>
</td>
<td align="right">
<asp:TextBox class="AxInputField" ID="tbToDate" Width="100%" ToolTip="<%$Axlabel:@SYS191513%>" runat="server" ReadOnly="False" Enabled="True"></asp:TextBox>
</td>
<td>
<dynamics:AxDatePicker class="DynamicsDatePickerCalendarButton" ExtendedDataType="ToDate" TargetControlId="tbToDate" ID="axButtonToDate" runat="server" />
</td>
<td>
<asp:Button runat="server" ID="ViewReportButton"
Text="<%$ AxLabel:@SYS334714 %>" onclick="ViewReportButton_Click1" />
</td>
</tr>
</table>
</dynamics:AxSection>
</dynamics:AxMultiSection>
<p>
<dynamics:AxReportViewer runat="server" ID="SalesByRegion" MenuItemName="ARCustomerStatement" />
_______________________________________________________________________
using System;
using System.Collections.Generic;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls;
using Microsoft.Dynamics.AX.Framework.Services.Client;
using Microsoft.Dynamics.Framework.BusinessConnector.Session;
using Microsoft.Dynamics.Framework.Portal.UI.WebControls.WebParts;
using Microsoft.Dynamics.AX.Framework.Reporting.Shared;
using Microsoft.Dynamics.Framework.Portal.UI;
using BCProxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
public partial class ARMaster : System.Web.UI.UserControl
{
protected void ViewReportButton_Click1(object sender, EventArgs e)
{
}
}
No comments:
Post a Comment