Example #1
0
        private void thongKeChiThu(object sender, EventArgs e)
        {
            if (rdNam.Checked)
            {
                int nam = int.Parse(cbxtknamNam.SelectedItem.ToString());
                tblThongKe.DataSource = hd.thongKeNam(nam);
            }
            else if (rdQuy.Checked)
            {
                string quy = cbxtkquyQuy.SelectedItem.ToString();
                int    nam = int.Parse(cbxtkquyNam.SelectedItem.ToString());
                tblThongKe.DataSource = hd.thongKeQuy(quy, nam);
            }
            else if (rdThang.Checked)
            {
                int thang = int.Parse(cbxtkthangThang.SelectedItem.ToString());
                int nam   = int.Parse(cbxtkthangNam.SelectedItem.ToString());
                tblThongKe.DataSource = hd.thongKeThang(thang, nam);
            }
            double tongThuTienPhong  = 0;
            double tongThuTienDichVu = 0;

            for (int i = 0; i < tblThongKe.RowCount; i++)
            {
                tongThuTienPhong  += double.Parse(tblThongKe.Rows[i].Cells[3].Value.ToString().Trim());
                tongThuTienDichVu += double.Parse(tblThongKe.Rows[i].Cells[4].Value.ToString().Trim());
            }
            lblTongThuDichVu.Text    = tongThuTienDichVu + ".00 VNĐ";
            lblTongThuTienPhong.Text = tongThuTienPhong + ".00 VNĐ";
            lblTongChiThu.Text       = (tongThuTienDichVu + tongThuTienPhong) + ".00 VNĐ";
        }