Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string ma = comboBox1.Text;
            string bd = dateTimePicker1.Text;
            string kt = dateTimePicker2.Text;

            if (ma != "" && bd != "" && kt != "")
            {
                dataGridView1.DataSource = bus.ThongKeDoanhThu(ma, bd, kt);
                int tong = 0;
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    tong = tong + Int32.Parse(dataGridView1.Rows[i].Cells["DOANHTHU"].Value.ToString());
                }
                textBox1.Text = tong.ToString();
            }
        }
Ejemplo n.º 2
0
    public void ThongKeDoanhThu()
    {
        // Xử lý request

        /*
         * int pageSize = 10;
         * if (Request["results"] != null)
         *  pageSize = int.Parse((string)Request["results"]);
         *
         * int pageNum = 1;
         * if (Request["startIndex"] != null)
         *  pageNum = (int.Parse((string)Request["startIndex"]) / pageSize) + 1;
         */
        String   hinhthuc    = Request["hinhthuc"];
        DateTime ngaybatdau  = DateTime.Parse(Request["ngaybatdau"].ToString());
        DateTime ngayketthuc = DateTime.Parse(Request["ngayketthuc"].ToString());

        ThongKeBUS bus   = new ThongKeBUS();
        ArrayList  arrKq = bus.ThongKeDoanhThu(hinhthuc, ngaybatdau, ngayketthuc);

        XL_THE        Kq         = new XL_THE("DANH_SACH");
        XL_THUOC_TINH Thuoc_tinh = new XL_THUOC_TINH("totalRecords", arrKq.Count.ToString());

        Kq.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

        foreach (ThongKeDoanhThu tk in arrKq)
        {
            XL_THE the = new XL_THE("Record");

            Thuoc_tinh = new XL_THUOC_TINH("NgayBatDau", tk.NgayBatDau.ToShortDateString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("NgayKetThuc", tk.NgayKetThuc.ToShortDateString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Thuoc_tinh = new XL_THUOC_TINH("DoanhThu", tk.DoanhThu.ToString());
            the.Danh_sach_thuoc_tinh.Add(Thuoc_tinh);

            Kq.Danh_sach_the.Add(the);
        }

        XL_CHUOI.XuatXML(Response, Kq.Chuoi());
    }