Exemplo n.º 1
0
 private void grvSoPhieu_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     if (grvSoPhieu.FocusedRowHandle >= 0)
     {
         drSoPhieu             = grvSoPhieu.GetDataRow(grvSoPhieu.FocusedRowHandle);
         grdChiTiet.DataSource = oBTC_BienLaiThuTien.GetChiTiet(int.Parse(drSoPhieu["TC_BienLaiThuTienID"].ToString()));
     }
     else
     {
         grdChiTiet.DataSource = null;
     }
 }
        private void LoadThongTin()
        {
            pSV_SinhVienNhapTruongInfo.SV_SinhVienNhapTruongID = SV_SinhVienID;
            DataTable dtTemp = oBSV_SinhVienNhapTruong.Get(pSV_SinhVienNhapTruongInfo);

            if (Sua == false)
            {
                lbTotal.Text = "0";
            }
            if (dtTemp != null && dtTemp.Rows.Count > 0)
            {
                txtHoVaTen.Text = dtTemp.Rows[0]["HoVaTenTS"].ToString();

                DataTable dtData;
                double    TongTien = 0;

                DataTable dtDuLieu = LoadLoaiThuChi();
                dtDuLieu.DefaultView.RowFilter  = "KhoanThu = 1";
                repositoryLoaiThuChi.DataSource = dtDuLieu.DefaultView;

                if (Sua == true)
                {
                    dtData = oBTC_DinhMucThuSinhVien.GetBy_SinhVien(0, Program.IDNamHoc, Program.HocKy, 1, 1, SV_SinhVienID);
                    //   repositoryLoaiThuChi.DataSource = dtData;
                    if (dtData.Rows.Count > 0)
                    {
                        TC_BienLaiThuTienID = int.Parse("0" + dtData.Rows[0]["TC_BienLaiThuTienID"].ToString());
                    }
                    pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID = TC_BienLaiThuTienID;
                    dtLoaiThuChi = oBTC_BienLaiThuTien.GetChiTiet(pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID);

                    //  repositoryLoaiThuChi.DataSource = oBTC_DinhMucThuSinhVien.GetBy_SinhVien(0, Program.IDNamHoc, Program.HocKy, 1, 0, SV_SinhVienID);
                }
                else
                {
                    dtData = oBTC_DinhMucThuSinhVien.GetBy_SinhVien(0, Program.IDNamHoc, Program.HocKy, 1, 0, SV_SinhVienID);
                    pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID = 0;
                    dtLoaiThuChi = dtData;// oBTC_DinhMucThuSinhVien.GetBy_SinhVien(0, Program.IDNamHoc, Program.HocKy, 1, 0, SV_SinhVienID);
                }

                for (int i = 0; i < dtLoaiThuChi.Rows.Count; i++)
                {
                    TongTien += double.Parse("0" + dtLoaiThuChi.Rows[i]["SoTien"]);
                }
                grdLoaiThuChi.DataSource = dtLoaiThuChi;
                lbTotal.Text             = TongTien.ToString("N0");
                pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID = 0;
            }
        }
        private void LoadThongTin()
        {
            pSV_SinhVienInfo.SV_SinhVienID = SV_SinhVienID;
            DataTable dtTemp = oBSV_SinhVien.Get(pSV_SinhVienInfo);

            if (Sua == false)
            {
                lbTotal.Text = "0";
            }
            if (dtTemp != null && dtTemp.Rows.Count > 0)
            {
                txtTenLop.Text  = dtTemp.Rows[0]["TenLop"].ToString();
                txtHoVaTen.Text = dtTemp.Rows[0]["HoVaTen"].ToString();

                repositoryLoaiThuChi.DataSource = oBTC_DinhMucThuSinhVien.GetBy_SinhVien(SV_SinhVienID, Program.IDNamHoc,
                                                                                         Program.HocKy, int.Parse(rdThuChi.EditValue.ToString()), 0, 0);

                //if (Sua == false)
                //{
                //    dtLoaiThuChi = oBTC_DinhMucThuSinhVien.GetBy_SinhVien(SV_SinhVienID, Program.IDNamHoc, Program.HocKy, int.Parse(rdThuChi.EditValue.ToString()));
                //    grdLoaiThuChi.DataSource = dtLoaiThuChi;
                //}
                //else
                //{
                if (Sua == true)
                {
                    pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID = int.Parse("0" + dr["TC_BienLaiThuTienID"].ToString());
                    dtLoaiThuChi             = oBTC_BienLaiThuTien.GetChiTiet(pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID);
                    grdLoaiThuChi.DataSource = dtLoaiThuChi;
                }
                else
                {
                    double TongTien = 0;
                    pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID = 0;
                    dtLoaiThuChi = oBTC_DinhMucThuSinhVien.GetBy_SinhVien(SV_SinhVienID,
                                                                          Program.IDNamHoc, Program.HocKy, int.Parse(rdThuChi.EditValue.ToString()), 1, 0);
                    TongTien = SumColumnValue(dtLoaiThuChi, "SoTien");
                    grdLoaiThuChi.DataSource = dtLoaiThuChi;

                    lbTotal.Text = TongTien.ToString("N0");
                }
                pTC_BienLaiThuTienInfo.TC_BienLaiThuTienID = 0;
                // }
            }
        }