private void MyBind()
        {
            DataTable saleDT  = orderBll.Report_SelByDate(Convert.ToDateTime(STime.ToString("yyyy/MM/01")), Convert.ToDateTime(ETime.ToString("yyyy/MM/" + DateTime.DaysInMonth(ETime.Year, ETime.Month))));
            DataTable monthDT = new DataTable();

            monthDT.Columns.Add("date", typeof(string));
            monthDT.Columns.Add("total", typeof(double));
            monthDT.Columns.Add("pay_online", typeof(double));
            monthDT.Columns.Add("pay_purse", typeof(double));

            for (DateTime s = STime; s <= ETime; s = s.AddMonths(1))
            {
                DataRow month = monthDT.NewRow();
                //DateTime sdate = Convert.ToDateTime("{0}/{1}/{2} 00:00:00");
                string sdate = s.ToString("#yyyy/MM/01 00:00:00#"), edate = s.AddMonths(1).ToString("#yyyy/MM/01 00:00:00#");
                saleDT.DefaultView.RowFilter = "PayTime>= " + sdate + " AND PayTime< " + edate;
                month["date"]       = s.ToString("yyyy-MM");
                month["total"]      = 0;
                month["pay_online"] = 0;
                month["pay_purse"]  = 0;
                foreach (DataRow dr in saleDT.DefaultView.ToTable().Rows)
                {
                    month["Total"] = DataConvert.CDouble(month["Total"]) + DataConvert.CDouble(dr["OrdersAmount"]);
                    if (Convert.ToInt32(dr["PayPlatID"]) == 0)
                    {
                        month["pay_purse"] = DataConvert.CDouble(month["pay_purse"]) + DataConvert.CDouble(dr["OrdersAmount"]);
                    }
                    else
                    {
                        month["pay_online"] = DataConvert.CDouble(month["pay_online"]) + DataConvert.CDouble(dr["OrdersAmount"]);
                    }
                }
                monthDT.Rows.Add(month);
            }
            Day_RPT.DataSource = monthDT;
            Day_RPT.DataBind();
            PayOnline_L.Text = DataConvert.CDouble(monthDT.Compute("SUM(pay_online)", "")).ToString("F2");
            PayPurse_L.Text  = DataConvert.CDouble(monthDT.Compute("SUM(pay_purse)", "")).ToString("F2");
            TotalSale_L.Text = DataConvert.CDouble(monthDT.Compute("SUM(total)", "")).ToString("F2");
        }
Пример #2
0
        private void MyBind()
        {
            DataTable saleDT = orderBll.Report_SelByDate(STime, ETime);
            DataTable dayDT  = new DataTable();

            dayDT.Columns.Add("date", typeof(string));
            dayDT.Columns.Add("total", typeof(double));
            dayDT.Columns.Add("pay_online", typeof(double));
            dayDT.Columns.Add("pay_purse", typeof(double));
            for (DateTime s = STime; s <= ETime; s = s.AddDays(1))
            {
                DataRow day = dayDT.NewRow();
                //DateTime sdate = Convert.ToDateTime("{0}/{1}/{2} 00:00:00");
                string sdate = s.ToString("#yyyy/MM/dd 00:00:00#"), edate = s.ToString("#yyyy/MM/dd 23:59:59#");
                saleDT.DefaultView.RowFilter = "PayTime>= " + sdate + " AND PayTime<= " + edate;
                day["date"]       = s.ToString("yyyy-MM-dd");
                day["total"]      = 0;
                day["pay_online"] = 0;
                day["pay_purse"]  = 0;
                foreach (DataRow dr in saleDT.DefaultView.ToTable().Rows)
                {
                    day["Total"] = DataConvert.CDouble(day["Total"]) + DataConvert.CDouble(dr["OrdersAmount"]);
                    if (Convert.ToInt32(dr["PayPlatID"]) == 0)
                    {
                        day["pay_purse"] = DataConvert.CDouble(day["pay_purse"]) + DataConvert.CDouble(dr["OrdersAmount"]);
                    }
                    else
                    {
                        day["pay_online"] = DataConvert.CDouble(day["pay_online"]) + DataConvert.CDouble(dr["OrdersAmount"]);
                    }
                }
                dayDT.Rows.Add(day);
            }
            Day_RPT.DataSource = dayDT;
            Day_RPT.DataBind();
            PayOnline_L.Text = DataConvert.CDouble(dayDT.Compute("SUM(pay_online)", "")).ToString("F2");
            PayPurse_L.Text  = DataConvert.CDouble(dayDT.Compute("SUM(pay_purse)", "")).ToString("F2");
            TotalSale_L.Text = DataConvert.CDouble(dayDT.Compute("SUM(total)", "")).ToString("F2");
        }