コード例 #1
0
        private void GetProductTransportReportData(DateTime date, int customerzone)
        {
            string ReportName = ((KeyValuePair <string, string>)ddlReportName.SelectedItem).Value;
            string driver     = ((KeyValuePair <string, string>)ddlCustomer.SelectedItem).Value;

            using (var dailydb = new OrderEntities())
            {
                var ds = dailydb.GetProductTransport(date, customerzone).ToList();

                if (ds.Count() > 0)
                {
                    string          datestring = HelperCS.DateTextThai(date, "TH", "dd MMM yyyy");
                    string          day        = HelperCS.daythai[(int)date.DayOfWeek - 1];
                    ReportParameter p1         = new ReportParameter("Date", datestring);
                    //ReportParameter p1 = new ReportParameter("Date", date.ToString("yyyy-MM-dd"));
                    ReportParameter p2 = new ReportParameter("Zone", driver);
                    ReportParameter p3 = new ReportParameter("ReportName", ReportName);
                    ReportParameter p4 = new ReportParameter("Day", day);
                    reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4 });
                    OrderBindingSource.DataSource = HelperCS.ToDataTable(ds);
                    ReportDataSource rtpsource1 = new ReportDataSource("DataSet1", OrderBindingSource);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource1);
                }
                else
                {
                    OrderBindingSource.DataSource = null;
                }
            }
        }
コード例 #2
0
        private void GetCustomerTransportTofuReportData(DateTime date)
        {
            string ReportName = ((KeyValuePair <string, string>)ddlReportName.SelectedItem).Value;

            using (var dailydb = new OrderEntities())
            {
                List <GetCustomerTransportTofu_Result> ds = null;
                ds = dailydb.GetCustomerTransportTofu(date).ToList();

                if (ds.Count() > 0)
                {
                    string          datestring = HelperCS.DateTextThai(date, "TH", "dd MMM yyyy");
                    string          day        = HelperCS.daythai[(int)date.DayOfWeek - 1];
                    ReportParameter p1         = new ReportParameter("Date", datestring);
                    ReportParameter p2         = new ReportParameter("ReportName", ReportName);
                    ReportParameter p3         = new ReportParameter("Day", day);
                    reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3 });
                    OrderBindingSource.DataSource = HelperCS.ToDataTable(ds);
                    ReportDataSource rtpsource1 = new ReportDataSource("DataSet1", OrderBindingSource);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource1);
                }
                else
                {
                    OrderBindingSource.DataSource = null;
                }
            }
        }
コード例 #3
0
        private void GetInvoiceReportData(DateTime date, int customer)
        {
            string ReportName = ((KeyValuePair <string, string>)ddlReportName.SelectedItem).Value;

            using (var dailydb = new OrderEntities())
            {
                var ds1 = (from x in dailydb.vwCustomerDetail
                           where x.CustomerID == customer
                           select x).ToList();
                var ds2 = dailydb.GetOrderbyDay(date, customer).ToList();
                if (ds1.Count() > 0 && ds2.Count() > 0)
                {
                    ReportParameter p1 = new ReportParameter("ReportType", ReportName);
                    ReportParameter p2 = new ReportParameter("Date", RptDatePicker.Value.ToLongDateString());
                    ReportParameter p3 = new ReportParameter("DocumentNo", "INV");
                    ReportParameter p4 = new ReportParameter("BahtText", BahtToText(ds2));

                    reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4 });

                    CustomerBindingSource.DataSource = HelperCS.ToDataTable(ds1);
                    OrderBindingSource.DataSource    = HelperCS.ToDataTable(ds2);
                    ReportDataSource rtpsource1 = new ReportDataSource("DataSet1", CustomerBindingSource);
                    ReportDataSource rtpsource2 = new ReportDataSource("DataSet2", OrderBindingSource);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource1);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource2);
                }
                else
                {
                    OrderBindingSource.DataSource = null;
                }
            }
        }
コード例 #4
0
        //private void LoadReport()
        //{
        //    reportViewer1.ProcessingMode = ProcessingMode.Local;

        //    //string date = "16/11/2017";
        //    //DateTime dt = Convert.ToDateTime(date);

        //    //GetSalesOrderData(dt,  3);
        //}

        #region GET REPORT DATA
        private void GetSalesOrderData(DateTime date, int customer)
        {
            using (var dailydb = new OrderEntities())
            {
                // Get result from Stored Procedure
                var ds = dailydb.GetOrderbyDay(date, customer).ToList();
                //OrderUC orderUC = new OrderUC();
                if (ds.Count() > 0)
                {
                    OrderBindingSource.DataSource = HelperCS.ToDataTable(ds);
                    ReportDataSource rtpsource = new ReportDataSource("DataSet1", OrderBindingSource);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource);
                }
                else
                {
                    OrderBindingSource.DataSource = null;
                }
            }
        }
コード例 #5
0
        private DataTable DataEntity()
        {
            using (var dailydb = new OrderEntities())
            {
                // Get result from Stored Procedure

                var ds = dailydb.GetDailyOrder("Monday", 1).ToList();

                // if found item rows
                if (ds.Count() > 0)
                {
                    return(HelperCS.ToDataTable(ds));
                }
                else
                {
                    return(new DataTable());
                }
            }
        }
コード例 #6
0
        private DataTable DataEntityProduct()
        {
            using (var db = new OrderEntities())
            {
                // Get result from Stored Procedure
                //db.sims.Where(x => x.has_been_modified).ToList();
                var ds = (from x in db.Product
                          select x).ToList();

                // if found item rows
                if (ds.Count() > 0)
                {
                    return(HelperCS.ToDataTable(ds));
                }
                else
                {
                    return(new DataTable());
                }
            }
        }
コード例 #7
0
        private void GetInvoiceReportData(DateTime date, int customer)
        {
            string ReportName = ((KeyValuePair <string, string>)ddlReportName.SelectedItem).Value;

            using (var dailydb = new OrderEntities())
            {
                //var ds1 = (from x in dailydb.vwCustomerDetail
                //           where x.CustomerID == customer
                //           select x).ToList();
                List <GetOrderCustomer_Result> ds1 = null;
                List <GetOrderbyDay_Result>    ds2 = null;
                ds1 = dailydb.GetOrderCustomer(date, customer, "INV").ToList();
                ds2 = dailydb.GetOrderbyDay(date, customer).ToList();
                if (ds1.Count() > 0 && ds2.Count() > 0)
                {
                    string          docid      = (from c in ds1 select(string) c.DocumentID).FirstOrDefault();
                    string          datestring = HelperCS.DateTextThai(date, "TH", "dd MMM yyyy");
                    ReportParameter p1         = new ReportParameter("ReportType", ReportName);
                    //ReportParameter p2 = new ReportParameter("Date", RptDatePicker.Value.ToLongDateString());
                    ReportParameter p2 = new ReportParameter("Date", datestring);
                    ReportParameter p3 = new ReportParameter("BahtText", BahtToText(ds2.Sum(item => item.OrderTotal)));
                    ReportParameter p4 = new ReportParameter("DocumentID", docid);

                    reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4 });
                    CustomerBindingSource.DataSource = null;
                    OrderBindingSource.DataSource    = null;
                    CustomerBindingSource.DataSource = HelperCS.ToDataTable(ds1);
                    OrderBindingSource.DataSource    = HelperCS.ToDataTable(ds2);
                    ReportDataSource rtpsource1 = new ReportDataSource("DataSet1", CustomerBindingSource);
                    ReportDataSource rtpsource2 = new ReportDataSource("DataSet2", OrderBindingSource);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource1);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource2);
                }
                else
                {
                    CustomerBindingSource.DataSource = null;
                    OrderBindingSource.DataSource    = null;
                }
            }
        }
コード例 #8
0
        private void GetReceiveWeeklyReportData(DateTime date, int customer, bool showprice)
        {
            string ReportName = ((KeyValuePair <string, string>)ddlReportName.SelectedItem).Value;

            using (var dailydb = new OrderEntities())
            {
                List <GetOrderCustomer_Result>      ds1 = null;
                List <GetReceiveWeeklyPrice_Result> ds2 = null;
                List <GetReceiveWeekly_Result>      ds3 = null;
                ds1 = dailydb.GetOrderCustomer(date, customer, "RCD").ToList();
                bool      rowno    = false;
                string    bahttext = "";
                DataTable dtorder;
                if (showprice)
                {
                    ds2      = dailydb.GetReceiveWeeklyPrice(date, customer).ToList();
                    rowno    = ds2.Count() > 0 ? true : false;
                    bahttext = rowno ? BahtToText(ds2.Sum(item => item.total)) : "";
                    dtorder  = HelperCS.ToDataTable(ds2);
                }
                else
                {
                    ds3      = dailydb.GetReceiveWeekly(date, customer).ToList();
                    rowno    = ds3.Count() > 0 ? true : false;
                    bahttext = rowno ? BahtToText(ds3.Sum(item => item.total)) : "";
                    dtorder  = HelperCS.ToDataTable(ds3);
                }
                //string datestring = HelperCS.DateTextThai(RptDatePicker.Value,"TH","dd MMM yyyy");
                string datestring = HelperCS.DateTextThai(DateTime.Now, "TH", "dd MMM yyyy");

                if (ds1.Count() > 0 && rowno)
                {
                    CustomerBindingSource.DataSource = HelperCS.ToDataTable(ds1);
                    OrderBindingSource.DataSource    = dtorder;

                    //string sunday =  dt.Rows[i].Field<int>(j);
                    DateTime startdate = (from c in ds1 select(DateTime) c.OrderStartDate).FirstOrDefault();
                    string   docid     = (from c in ds1 select(string) c.DocumentID).FirstOrDefault();

                    ReportParameter p1 = new ReportParameter("ReportType", ReportName);
                    ReportParameter p2 = new ReportParameter("Date", datestring);
                    ReportParameter p3 = new ReportParameter("BahtText", bahttext);

                    ReportParameter p4  = new ReportParameter("suntext", HelperCS.DateTextThai(startdate, "TH", "dd-MMM"));
                    ReportParameter p5  = new ReportParameter("montext", HelperCS.DateTextThai(startdate.AddDays(1), "TH", "dd-MMM"));
                    ReportParameter p6  = new ReportParameter("tuetext", HelperCS.DateTextThai(startdate.AddDays(2), "TH", "dd-MMM"));
                    ReportParameter p7  = new ReportParameter("wedtext", HelperCS.DateTextThai(startdate.AddDays(3), "TH", "dd-MMM"));
                    ReportParameter p8  = new ReportParameter("thrtext", HelperCS.DateTextThai(startdate.AddDays(4), "TH", "dd-MMM"));
                    ReportParameter p9  = new ReportParameter("fritext", HelperCS.DateTextThai(startdate.AddDays(5), "TH", "dd-MMM"));
                    ReportParameter p10 = new ReportParameter("sattext", HelperCS.DateTextThai(startdate.AddDays(6), "TH", "dd-MMM"));

                    ReportParameter p11 = new ReportParameter("DocumentID", docid);
                    reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 });


                    ReportDataSource rtpsource1 = new ReportDataSource("DataSet1", CustomerBindingSource);
                    ReportDataSource rtpsource2 = new ReportDataSource("DataSet2", OrderBindingSource);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource1);
                    reportViewer1.LocalReport.DataSources.Add(rtpsource2);
                }
                else
                {
                    CustomerBindingSource.DataSource = null;
                    OrderBindingSource.DataSource    = null;
                }
            }
        }