private void Costbrkbutton_Click(object sender, EventArgs e)
        {
            fromDate = Convert.ToString(Convert.ToDateTime(fromDateTimePicker.Text).ToShortDateString());
            toDate   = Convert.ToString(Convert.ToDateTime(toDateTimePicker.Text).ToShortDateString());

            EfficencyBLL  efficency = new EfficencyBLL();
            DataTable     dt        = new DataTable();
            BindingSource dataBind  = new BindingSource();

            dt = efficency.SampleCostBrakeDownReportForMail(fromDate, toDate, materialCostR1, overHeadCostR1, materialCostK2, overHeadCostK2);
            dataBind.DataSource = dt;
            sampleCostdataGridView.DataSource = dataBind;
            if (sampleCostdataGridView.Rows.Count > 0)
            {
                try
                {
                    // Bind table data to Stream Writer to export data to respective folder
                    StreamWriter wr = new StreamWriter(@"E:\\Sample_CostBreakdown_Reports.xls");
                    wr.Write("HIRDARAMANI APPARELS BANGLADESH");
                    wr.WriteLine();
                    wr.Write("Sample CostBreakdown Reports");
                    wr.WriteLine();
                    wr.WriteLine();
                    wr.WriteLine();
                    // Write Columns to excel file
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        wr.Write(dt.Columns[i].ToString().ToUpper() + "\t");
                    }
                    wr.WriteLine();
                    //write rows to excel file
                    for (int i = 0; i < (dt.Rows.Count); i++)
                    {
                        for (int j = 0; j < dt.Columns.Count; j++)
                        {
                            if (dt.Rows[i][j] != null)
                            {
                                wr.Write(Convert.ToString(dt.Rows[i][j]) + "\t");
                            }
                            else
                            {
                                wr.Write("\t");
                            }
                        }
                        wr.WriteLine();
                    }
                    wr.Close();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
        public void SampleCostBrakeDownReportForMail(string FromDate, string ToDate, double MaterialCostR1, double OverHeadCostR1, double MaterialCostK2, double OverHeadCostK2)
        {
            EfficencyBLL  efficency = new EfficencyBLL();
            DataTable     dt        = new DataTable();
            BindingSource dataBind  = new BindingSource();


            try
            {
                dt = efficency.SampleCostBrakeDownReportForMail(FromDate, ToDate, MaterialCostR1, OverHeadCostR1, MaterialCostK2, OverHeadCostK2);
                dataBind.DataSource = dt;
                sampleCostdataGridView.DataSource = dataBind;
            }
            catch (Exception ex)
            {
            }
        }