using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CofeeShop
{
    public partial class frmRptTotalSaleRate : Form
    {
        public frmRptTotalSaleRate()
        {
            InitializeComponent();
        }

        private void frmRptTotalSaleRate_Load(object sender, EventArgs e)
        {

        }

        private void Btn_ViewReport_Click(object sender, EventArgs e)
        {
            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 50;

            LSC_CofeeShopDataContext db = new LSC_CofeeShopDataContext();
            var Query = from Row in db.xtblTotalSaleRates_SelectAll()
                        where ((int.Parse(Row.FactorShDate.ToString().Replace("/", "")) >= int.Parse(MTxt_StartDate.Text.Trim().Replace("/", ""))) && (int.Parse(Row.FactorShDate.ToString().Replace("/", "")) <= int.Parse(MTxt_EndDate.Text.Trim().Replace("/", ""))))
                        select new
                        {
                            Row.FactorShDate,
                            Row.QuantirySaleRate,
                            Row.TotalSaleRate
                        };
            Microsoft.Reporting.WinForms.ReportParameter StartDating = new Microsoft.Reporting.WinForms.ReportParameter("StartDating", MTxt_StartDate.Text.Trim());
            Microsoft.Reporting.WinForms.ReportParameter EndDating = new Microsoft.Reporting.WinForms.ReportParameter("EndDating", MTxt_EndDate.Text.Trim());
            reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter[] { StartDating, EndDating });
            xtblTotalSaleRates_SelectAllResultBindingSource.DataSource = Query;
            this.reportViewer1.RefreshReport();
        }
    }
}
