Exemplo n.º 1
0
        private void gridView1_MouseDown(object sender, MouseEventArgs e)
        {
            GridView    view    = sender as GridView;
            GridHitInfo hitInfo = view.CalcHitInfo(e.Location);

            if (hitInfo.InRowCell)
            {
                view.FocusedRowHandle = hitInfo.RowHandle;
                view.FocusedColumn    = hitInfo.Column;
                DXMouseEventArgs.GetMouseArgs(e).Handled = true;
                if (e.Clicks == 2 && e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    if (view.FocusedColumn == gridView1.Columns["MAHOADON"] || view.FocusedColumn == gridView1.Columns["TONGTIEN"] || view.FocusedColumn == gridView1.Columns["CHIETKHAU"] || view.FocusedColumn == gridView1.Columns["KHACHHANG"] || view.FocusedColumn == gridView1.Columns["THUNGAN"])
                    {
                    }
                    else
                    {
                        view.ShowEditor();
                    }
                }
                if (e.Clicks == 1)
                {
                    btnXuat.Enabled = true;
                    btnXuat.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Primary;
                    int[] selectedRowHandles = view.GetSelectedRows();
                    MaHD = view.GetRowCellValue(selectedRowHandles[0], "MAHOADON").ToString();
                    string maPT = busHD.GetMaPhieuTiemFromHD(MaHD);
                    gridVC.DataSource = busPT.GetVCFromPHIEUTIEM(maPT);
                }
            }
        }
Exemplo n.º 2
0
        public bool PopulateDataset()
        {
            #region PhieuTiemInfo

            string ngayTiem, thangTiem, namTiem, maKH, tenKH, ngaySinh, gioiTinh, tieuSu, tenBS;

            DataTable dt = busPT.GetReportInfo(MaPT);

            if (dt.Rows.Count > 0)
            {
                ngayTiem  = dt.Rows[0]["NGAYTIEM"].ToString().Substring(0, 2);
                thangTiem = dt.Rows[0]["NGAYTIEM"].ToString().Substring(3, 2);
                namTiem   = dt.Rows[0]["NGAYTIEM"].ToString().Substring(6, 4);
                maKH      = dt.Rows[0]["MAKH"].ToString();
                tenKH     = dt.Rows[0]["TENKH"].ToString();
                ngaySinh  = dt.Rows[0]["NGAYSINH"].ToString().Substring(0, 10);
                gioiTinh  = dt.Rows[0]["GIOITINH"].ToString();
                tieuSu    = dt.Rows[0]["TIEUSU"].ToString();
                tenBS     = dt.Rows[0]["TENBS"].ToString();
            }
            else //Có bug trên DB
            {
                return(false);
            }

            ds.PhieuTiem.Rows.Add(new Object[] { MaPT, ngayTiem, maKH, tenKH, ngaySinh, gioiTinh, tieuSu, tenBS, thangTiem, namTiem });

            #endregion

            #region VaccineList

            string MaVC, TenVC, LieuLuong, DonGia;

            DataTable dtVC = busPT.GetVCFromPHIEUTIEM(MaPT);

            if (dtVC.Rows.Count > 0)
            {
                for (int i = 0; i < dtVC.Rows.Count; i++)
                {
                    MaVC      = dtVC.Rows[i]["MAVACCINE"].ToString();
                    TenVC     = dtVC.Rows[i]["TENVACCINE"].ToString();
                    LieuLuong = dtVC.Rows[i]["LIEULUONG"].ToString();
                    DonGia    = dtVC.Rows[i]["DONGIA"].ToString();

                    ds.Vaccine.Rows.Add(new Object[] { MaVC, TenVC, LieuLuong, DonGia });
                }
            }
            else //Có bug trên DB
            {
                return(false);
            }

            #endregion

            return(true);
        }
Exemplo n.º 3
0
        private void tbMaPT_Leave(object sender, EventArgs e)
        {
            if (tbMaPT.Text == "")
            {
                return;
            }

            int tongTien = 0;

            //listVC = busPT.GetVCFromPHIEUTIEM(tbMaPT.Text);
            //DataTable dtb = new DataTable();
            //dtb.Columns.Add("MAVACCINE");
            //dtb.Columns.Add("TENVACCINE");
            //dtb.Columns.Add("NHASX");
            //dtb.Columns.Add("LOAIVC");
            //dtb.Columns.Add("DONGIA");
            //for (int i = 0; i < listVC.Count; i++)
            //{
            //    DataRow dr = dtb.NewRow();
            //    dr["MAVACCINE"] = listVC[i].MAVACCINE;
            //    dr["TENVACCINE"] = listVC[i].TENVACCINE;
            //    dr["NHASX"] = listVC[i].NHASX;
            //    dr["LOAIVC"] = listVC[i].LOAIVACCINE;
            //    dr["DONGIA"] = listVC[i].DONGIA;
            //    dtb.Rows.Add(dr);
            //    tongTien += listVC[i].DONGIA;
            //}

            listVC = busPT.GetVCFromPHIEUTIEM(tbMaPT.Text);
            for (int i = 0; i < listVC.Rows.Count; i++)
            {
                tongTien += Convert.ToInt32(listVC.Rows[i][7]) * (int)Math.Ceiling(Convert.ToDouble(listVC.Rows[i][5])); // cot 7 la DONGIA, cot 5 la LIEULUONG
            }

            gridVC.DataSource = busPT.GetVCFromPHIEUTIEM(tbMaPT.Text);
            gridView1.BestFitColumns();
            tbTenKH.Text = busPT.GetTenKHFromPHIEUTIEM(tbMaPT.Text);

            tbTongTien.Text = tongTien.ToString();
        }
Exemplo n.º 4
0
        private void GridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            tbMaPT.Text      = gridView1.GetRowCellValue(e.RowHandle, "MAPHIEUTIEM").ToString().Trim();
            tbMaKH.Text      = gridView1.GetRowCellValue(e.RowHandle, "MAKH").ToString().Trim();
            tbTenKH.Text     = gridView1.GetRowCellValue(e.RowHandle, "TENKH").ToString().Trim();
            dtpNgaySinh.Text = gridView1.GetRowCellValue(e.RowHandle, "NGAYSINH").ToString().Substring(0, 10);
            cbGioiTinh.Text  = gridView1.GetRowCellValue(e.RowHandle, "GIOITINH").ToString();
            tbTienSu.Text    = gridView1.GetRowCellValue(e.RowHandle, "TIEUSU").ToString().Trim();

            int datiem = (int)gridView1.GetRowCellValue(e.RowHandle, "DATIEM");

            if (datiem == 1)
            {
                gcVaccine.Enabled  = false;
                btnXacNhan.Enabled = false;
            }
            else
            {
                gcVaccine.Enabled  = true;
                btnXacNhan.Enabled = true;
            }

            listCTT.Clear();
            DataTable dt = busPhieuTiem.GetVCFromPHIEUTIEM(gridView1.GetRowCellValue(e.RowHandle, "MAPHIEUTIEM").ToString());

            dt.Columns.Remove("LOAIVACCINE");
            dt.Columns.Remove("NHASX");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string          maVC        = dt.Rows[i]["MAVACCINE"].ToString().Trim();
                int             muiThu      = (int)dt.Rows[i]["MUITHU"];
                string          ngayNhacLai = Convert.ToDateTime(dt.Rows[i]["NGAYTIEMNHACLAI"]).ToString("yyyy-MM-dd");
                double          lieuLuong   = (double)dt.Rows[i]["LIEULUONG"];
                DTO_ChiTietTiem ctt         = new DTO_ChiTietTiem(tbMaPT.Text, maVC, busVC.getVCPrice(maVC), muiThu, ngayNhacLai, lieuLuong);
                listCTT.Add(ctt);
            }
            gridVaccine.DataSource = dt;

            //gridVaccine.DataSource =
        }