Exemple #1
0
        public void LoadData()
        {
            DateTime fromdate = DateTime.Today;
            DateTime todate   = fromdate.AddDays(1).AddMinutes(-1);

            if (!String.IsNullOrEmpty(Request.QueryString["fromdate"]))
            {
                fromdate = Convert.ToDateTime(Request.QueryString["fromdate"]);
            }

            if (!String.IsNullOrEmpty(Request.QueryString["todate"]))
            {
                todate = Convert.ToDateTime(Request.QueryString["todate"]).AddDays(1).AddMinutes(-1);
            }

            rFromDate.SelectedDate = fromdate;
            rToDate.SelectedDate   = todate;

            int day = Convert.ToInt32((todate - fromdate).TotalDays);

            int TotalSales = 0;
            var order      = OrderDetailController.Report(fromdate.ToString(), todate.ToString());

            if (order != null)
            {
                foreach (var item in order)
                {
                    TotalSales += Convert.ToInt32(item.Quantity);
                }
            }

            int TotalRefund = 0;
            var refund      = RefundGoodController.TotalRefund(fromdate.ToString(), todate.ToString());

            if (refund.Count() > 0)
            {
                foreach (var vl in refund)
                {
                    TotalRefund += Convert.ToInt32(vl.TotalQuantity);
                }
            }

            ltrTotalRemain.Text        = (TotalSales - TotalRefund).ToString() + " cái";
            ltrAverageTotalRemain.Text = ((TotalSales - TotalRefund) / day).ToString() + " cái / ngày";
            ltrTotalSales.Text         = TotalSales.ToString() + " cái";
            ltrAverageTotalSales.Text  = (TotalSales / day).ToString() + " cái / ngày";
            ltrTotalRefund.Text        = TotalRefund.ToString() + " cái";
            ltrAverageTotalRefund.Text = (TotalRefund / day).ToString() + " cái / ngày";
        }
Exemple #2
0
        public void LoadData()
        {
            string fromdate = "";
            string todate   = "";

            if (Request.QueryString["fromdate"] != null)
            {
                fromdate = Request.QueryString["fromdate"];
            }
            if (Request.QueryString["todate"] != null)
            {
                todate = Request.QueryString["todate"];
            }
            DateTime now   = DateTime.Now;
            var      start = new DateTime(now.Year, now.Month, 1, 0, 0, 0);

            if (!string.IsNullOrEmpty(fromdate))
            {
                rFromDate.SelectedDate = Convert.ToDateTime(fromdate);
            }
            else
            {
                fromdate = start.ToString();
            }
            if (!string.IsNullOrEmpty(todate))
            {
                rToDate.SelectedDate = Convert.ToDateTime(todate);
            }

            var refund = RefundGoodController.TotalRefund(fromdate, todate);

            if (refund != null)
            {
                int total = 0;
                int kt    = 0;
                int ct    = 0;
                foreach (var item in refund)
                {
                    var refundg = RefundGoodDetailController.GetByRefundGoodsID(item.ID);
                    if (refundg != null)
                    {
                        foreach (var temp in refundg)
                        {
                            total += Convert.ToInt32(temp.Quantity);
                            if (temp.RefundType == 2)
                            {
                                ct += Convert.ToInt32(temp.Quantity);
                            }
                            else
                            {
                                kt += Convert.ToInt32(temp.Quantity);
                            }
                        }
                    }
                }
                ltrList.Text += "<tr>";
                ltrList.Text += "<td style=\"text-align:center;\">" + total + "</td>";
                ltrList.Text += "<td>" + ct + "</td>";
                ltrList.Text += "<td>" + kt + "</td>";


                ltrList.Text += "</tr>";
            }
        }