using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
// Add these NameSpace
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
public partial class Module_BanquetHall_BanquitHallInvoice : System.Web.UI.Page
{
// Create the objects of your .xsd file which you already Created and Report document.
ViewBanquitHall bhxsd = new ViewBanquitHall(); // objects of your .xsd file
ReportDocument rd = new ReportDocument(); // objects of Report document.
public int hotelid;
public int halllistid;
// assign the report data to the Ctystal Report viewer which is saved into session in Page_Init for display // again while printing report using print button provided by report.
protected void Page_Init(object sender, EventArgs e)
{
try
{
if (Session["ReportData"] != null)
{
CrystalReportViewer1.ReportSource = Session["ReportData"];
}
}
catch (Exception ex)
{
throw ex;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToInt32(Session["BanquetHall"].ToString()) == 1)
{
halllistid = Convert.ToInt32(Request.QueryString["HallListID"]);
hotelid = Convert.ToInt32(Request.QueryString["HotelID"].ToString());
if (!IsPostBack)
{
fillreprtdata();
}
tblBanqInvoice1.Visible = true;
}
else
{
lblpermission.Text = "You have not Permission To View this Page.";
tblBanqInvoice1.Visible = false;
}
}
// Report Fill function in which dynamic code is there.
public void fillreprtdata()
{
// Load the Crystal Report document which you created into report document object
rd.Load(Server.MapPath(("~/") + "Invoice_Rpt" + "\\" + "BanquetHallInvoice.rpt"));
List objlist = new List();
DataTable dtban = objlist.queryList("SELECT tblBanquetHallList.HallListID, tblBanquetHallList.CustomerName, tblBanquetHallList.Address, tblBanquetHallList.PhoneNo,tblBanquetHallList.MobileNo, tblBanquetHallList.BanquetHallID, tblBanquetHallList.BanquetHallName, tblBanquetHallList.Discount,tblBanquetHallList.TotalAmount, tblBanquetHallList.CurrentDate, tblBanquetHallList.CustId, tblBanquetHallDetails.HallListID AS Expr1,tblBanquetHallList.HotelID, tblBanquetHallDetails.FacilityName, tblBanquetHallDetails.Rate, tblBanquetHallDetails.BookingDateFrom,tblBanquetHallDetails.GuestCount, tblBanquetHallDetails.BookingDateTo, tblBanquetHallDetails.BanquetHallID AS Expr2,tblBanquetHallDetails.BanquetHallName AS Expr3 FROM tblhoteldetails INNER JOIN tblBanquetHallList ON tblhoteldetails.HotelID = tblBanquetHallList.HotelID INNER JOIN tblBanquetHallDetails ON tblhoteldetails.HotelID = tblBanquetHallDetails.HotelID AND tblBanquetHallList.HallListID = tblBanquetHallDetails.HallListID WHERE (tblBanquetHallList.HotelID = "+hotelid+") AND (tblBanquetHallList.HallListID ="+halllistid+")");
if (dtban.Rows.Count > 0)
{
for (int i = 0; i < dtban.Rows.Count; i++)
{
List objhotel = new List();
DataTable dthotel = objhotel.queryList("select HotelName,Address,City,tblcountry.countryname,tblstate.statename from tblHotelDetails h left join tblcountry on tblcountry.countryid=h.countryid left join tblstate on tblstate.stateid=h.stateid where HotelID= '" + hotelid + "'");
//Create a New Datarow of the Datatable which is placed in your.xsd file and add row into that // Datatable.
DataRow dr = bhxsd.DTBanquitHall.NewRow();
dr["HotelName"] =dthotel.Rows[0]["HotelName"].ToString();
dr["HAddress"] = dthotel.Rows[0]["Address"].ToString();
dr["HCity"] = dthotel.Rows[0]["City"].ToString();
dr["HState"] = dthotel.Rows[0]["statename"].ToString();
dr["HCountry"] = dthotel.Rows[0]["countryname"].ToString();
dr["BanquitID"] = dtban.Rows[i]["HallListID"];
dr["BanquitName"] = dtban.Rows[i]["BanquetHallName"];
dr["CurrentDate"] = dtban.Rows[i]["CurrentDate"];
dr["HallName"] = dtban.Rows[i]["BanquetHallName"];
dr["Occassion"] = dtban.Rows[i]["FacilityName"];
dr["From"] = dtban.Rows[i]["BookingDateFrom"];
dr["To"] = dtban.Rows[i]["BookingDateTo"];
dr["Guest"] = dtban.Rows[i]["GuestCount"];
dr["Rate"] = dtban.Rows[i]["Rate"];
dr["Discount"] = dtban.Rows[i]["Discount"];
dr["TotalAmount"] = dtban.Rows[i]["TotalAmount"];
dr["CustName"] = dtban.Rows[i]["CustomerName"];
dr["CustAddress"] = dtban.Rows[i]["Address"];
dr["CustPhoneNo"] = dtban.Rows[i]["PhoneNo"];
dr["CustMobileNo"] = dtban.Rows[i]["MobileNo"];
bhxsd.DTBanquitHall.Rows.Add(dr);
}
rd.SetDataSource(bhxsd); //after filling Datatable of .xsd, give it as a source of the report document.
Session["ReportData"] = rd; // set the session for saving report Data.
CrystalReportViewer1.ReportSource = rd; // set rd as a source of Crystal report Viewer.
}
else
{
// lblerrormsg.Text = "Record Not Found.";
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
// Add these NameSpace
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
public partial class Module_BanquetHall_BanquitHallInvoice : System.Web.UI.Page
{
// Create the objects of your .xsd file which you already Created and Report document.
ViewBanquitHall bhxsd = new ViewBanquitHall(); // objects of your .xsd file
ReportDocument rd = new ReportDocument(); // objects of Report document.
public int hotelid;
public int halllistid;
// assign the report data to the Ctystal Report viewer which is saved into session in Page_Init for display // again while printing report using print button provided by report.
protected void Page_Init(object sender, EventArgs e)
{
try
{
if (Session["ReportData"] != null)
{
CrystalReportViewer1.ReportSource = Session["ReportData"];
}
}
catch (Exception ex)
{
throw ex;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToInt32(Session["BanquetHall"].ToString()) == 1)
{
halllistid = Convert.ToInt32(Request.QueryString["HallListID"]);
hotelid = Convert.ToInt32(Request.QueryString["HotelID"].ToString());
if (!IsPostBack)
{
fillreprtdata();
}
tblBanqInvoice1.Visible = true;
}
else
{
lblpermission.Text = "You have not Permission To View this Page.";
tblBanqInvoice1.Visible = false;
}
}
// Report Fill function in which dynamic code is there.
public void fillreprtdata()
{
// Load the Crystal Report document which you created into report document object
rd.Load(Server.MapPath(("~/") + "Invoice_Rpt" + "\\" + "BanquetHallInvoice.rpt"));
List objlist = new List();
DataTable dtban = objlist.queryList("SELECT tblBanquetHallList.HallListID, tblBanquetHallList.CustomerName, tblBanquetHallList.Address, tblBanquetHallList.PhoneNo,tblBanquetHallList.MobileNo, tblBanquetHallList.BanquetHallID, tblBanquetHallList.BanquetHallName, tblBanquetHallList.Discount,tblBanquetHallList.TotalAmount, tblBanquetHallList.CurrentDate, tblBanquetHallList.CustId, tblBanquetHallDetails.HallListID AS Expr1,tblBanquetHallList.HotelID, tblBanquetHallDetails.FacilityName, tblBanquetHallDetails.Rate, tblBanquetHallDetails.BookingDateFrom,tblBanquetHallDetails.GuestCount, tblBanquetHallDetails.BookingDateTo, tblBanquetHallDetails.BanquetHallID AS Expr2,tblBanquetHallDetails.BanquetHallName AS Expr3 FROM tblhoteldetails INNER JOIN tblBanquetHallList ON tblhoteldetails.HotelID = tblBanquetHallList.HotelID INNER JOIN tblBanquetHallDetails ON tblhoteldetails.HotelID = tblBanquetHallDetails.HotelID AND tblBanquetHallList.HallListID = tblBanquetHallDetails.HallListID WHERE (tblBanquetHallList.HotelID = "+hotelid+") AND (tblBanquetHallList.HallListID ="+halllistid+")");
if (dtban.Rows.Count > 0)
{
for (int i = 0; i < dtban.Rows.Count; i++)
{
List objhotel = new List();
DataTable dthotel = objhotel.queryList("select HotelName,Address,City,tblcountry.countryname,tblstate.statename from tblHotelDetails h left join tblcountry on tblcountry.countryid=h.countryid left join tblstate on tblstate.stateid=h.stateid where HotelID= '" + hotelid + "'");
//Create a New Datarow of the Datatable which is placed in your.xsd file and add row into that // Datatable.
DataRow dr = bhxsd.DTBanquitHall.NewRow();
dr["HotelName"] =dthotel.Rows[0]["HotelName"].ToString();
dr["HAddress"] = dthotel.Rows[0]["Address"].ToString();
dr["HCity"] = dthotel.Rows[0]["City"].ToString();
dr["HState"] = dthotel.Rows[0]["statename"].ToString();
dr["HCountry"] = dthotel.Rows[0]["countryname"].ToString();
dr["BanquitID"] = dtban.Rows[i]["HallListID"];
dr["BanquitName"] = dtban.Rows[i]["BanquetHallName"];
dr["CurrentDate"] = dtban.Rows[i]["CurrentDate"];
dr["HallName"] = dtban.Rows[i]["BanquetHallName"];
dr["Occassion"] = dtban.Rows[i]["FacilityName"];
dr["From"] = dtban.Rows[i]["BookingDateFrom"];
dr["To"] = dtban.Rows[i]["BookingDateTo"];
dr["Guest"] = dtban.Rows[i]["GuestCount"];
dr["Rate"] = dtban.Rows[i]["Rate"];
dr["Discount"] = dtban.Rows[i]["Discount"];
dr["TotalAmount"] = dtban.Rows[i]["TotalAmount"];
dr["CustName"] = dtban.Rows[i]["CustomerName"];
dr["CustAddress"] = dtban.Rows[i]["Address"];
dr["CustPhoneNo"] = dtban.Rows[i]["PhoneNo"];
dr["CustMobileNo"] = dtban.Rows[i]["MobileNo"];
bhxsd.DTBanquitHall.Rows.Add(dr);
}
rd.SetDataSource(bhxsd); //after filling Datatable of .xsd, give it as a source of the report document.
Session["ReportData"] = rd; // set the session for saving report Data.
CrystalReportViewer1.ReportSource = rd; // set rd as a source of Crystal report Viewer.
}
else
{
// lblerrormsg.Text = "Record Not Found.";
}
}
}
No comments:
Post a Comment