Exemplo n.º 1
0
        private void Init()
        {
            txtPass.Properties.UseSystemPasswordChar    = true;
            txtXacNhan.Properties.UseSystemPasswordChar = true;

            //Khởi tạo nhân viên bán hàng
            leNhanVien.Properties.TextEditStyle = TextEditStyles.Standard;
            leNhanVien.Properties.BestFitMode   = BestFitMode.BestFit;
            SetDataSource(leNhanVien, BUS_NhanVien.LayNhanVienDonGian(), "EMPLOYEE_Name", "EMPLOYEE_ID");
            leNhanVien.Properties.Columns[0].FieldName = "EMPLOYEE_Name";
            leNhanVien.Properties.Columns[1].FieldName = "EMPLOYEE_ID";

            //Khởi tạo vai trò
            leVaiTro.Properties.TextEditStyle = TextEditStyles.Standard;
            leVaiTro.Properties.BestFitMode   = BestFitMode.BestFit;
            SetDataSource(leVaiTro, BUS_PhanQuyen.LoadPermision(), "Description", "ID");
            leVaiTro.Properties.Columns[0].FieldName = "ID";
            leVaiTro.Properties.Columns[1].FieldName = "Description";


            if (add == true)
            {
                phatSinhMa();
            }
            else
            {
                LoadDuLieuBP();
            }
        }
Exemplo n.º 2
0
        private void Init()
        {
            if (PThu == true)
            {
                table = BUS_CongNo.LoadPhieuThu();
            }
            else
            {
                table = BUS_CongNo.LoadPhieuChi();
            }

            gleNhanVien.Properties.DataSource    = BUS_NhanVien.LayNhanVienDonGian();
            gleNhanVien.Properties.ValueMember   = "EMPLOYEE_ID";
            gleNhanVien.Properties.DisplayMember = "EMPLOYEE_Name";
            gleNhanVien.EditValue = ((DataTable)gleNhanVien.Properties.DataSource).Rows[0]["EMPLOYEE_ID"];

            txtPhieu.Enabled = false;
            PhatSinhMa();
            LoadDuLieu();
        }
Exemplo n.º 3
0
        private void Init()
        {
            leNguoiQL.Properties.DataSource    = BUS_NhanVien.LayNhanVienDonGian();
            leNguoiQL.Properties.DisplayMember = "EMPLOYEE_Name";
            leNguoiQL.Properties.ValueMember   = "EMPLOYEE_ID";
            LookUpColumnInfo col  = new LookUpColumnInfo("EMPLOYEE_ID", "Mã");
            LookUpColumnInfo col1 = new LookUpColumnInfo("EMPLOYEE_Name", "Tên");

            leNguoiQL.Properties.Columns.Add(col1);
            leNguoiQL.Properties.Columns.Add(col);

            if (add == true)
            {
                phatSinhMa();
            }
            else
            {
                LoadDuLieuKho();
            }
        }
Exemplo n.º 4
0
        private void Init()
        {
            LoadDataBP();
            gleBoPhan.Properties.DisplayMember     = "Department_Name";
            gleBoPhan.Properties.ValueMember       = "Department_ID";
            gleBoPhan.Properties.Buttons[1].Click += btnThemBP_ThemNhanVien_Click;

            gleQuanLy.Properties.DataSource        = BUS_NhanVien.LayNhanVienDonGian();
            gleQuanLy.Properties.DisplayMember     = "EMPLOYEE_Name";
            gleQuanLy.Properties.ValueMember       = "EMPLOYEE_ID";
            gleQuanLy.Properties.Buttons[1].Click += btnThemNV_ThemNhanVien_Click;

            if (add == true)
            {
                phatSinhMa();
            }
            else
            {
                LoadDuLieuNV();
            }
        }
Exemplo n.º 5
0
        private void Init()
        {
            //Khởi tạo nhân viên bán hàng
            leNhanVienBH.Properties.TextEditStyle = TextEditStyles.Standard;
            leNhanVienBH.Properties.BestFitMode   = BestFitMode.BestFit;
            SetDataSource(leNhanVienBH, BUS_NhanVien.LayNhanVienDonGian(), "EMPLOYEE_Name", "EMPLOYEE_ID");
            leNhanVienBH.Properties.Columns[0].FieldName = "EMPLOYEE_Name";
            leNhanVienBH.Properties.Columns[1].FieldName = "EMPLOYEE_ID";
            //leNhanVienBH.EditValue = ((DataTable)leNhanVienBH.Properties.DataSource).Rows[0]["EMPLOYEE_ID"];

            //Khởi tạo kho xuất
            leKhoXuat.Properties.TextEditStyle = TextEditStyles.Standard;
            leKhoXuat.Properties.BestFitMode   = BestFitMode.BestFit;
            SetDataSource(leKhoXuat, BUS_KhoXuat.LayKhoDonGian(), "STOCK_Name", "STOCK_ID");
            leKhoXuat.Properties.Columns[0].FieldName = "STOCK_Name";
            leKhoXuat.Properties.Columns[1].FieldName = "STOCK_ID";
            //leKhoXuat.EditValue = ((DataTable)leKhoXuat.Properties.DataSource).Rows[0]["STOCK_ID"];

            //Khởi tạo các DateEdit
            deHanTT.EditValue    = DateTime.Today.ToShortDateString();
            deNgayGiao.EditValue = DateTime.Today.ToShortDateString();
            deNgay.EditValue     = DateTime.Today.ToShortDateString();

            //Khởi tạo GridviewControl
            gvMain.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;
            CreateDataSource();
            gvcMain.DataSource       = dsGcMain.Tables[0];
            gvMain.CellValueChanged += GvMain_CellValueChanged;
            //gvMain.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect;

            //Khởi tạo đơn vị tính
            leDonVi.NullText       = "(Chọn)";
            leDonVi.TextEditStyle  = TextEditStyles.Standard;
            leMaHang.TextEditStyle = TextEditStyles.Standard;
            leMaHang.BestFitMode   = BestFitMode.BestFit;
            SetDataSource(leDonVi, BUS_DonViTinh.GetDVTDonGian(), "UNIT_Name", "UNIT_ID");
            leDonVi.Columns.Add(new LookUpColumnInfo("UNIT_Name", "ĐVT"));

            //Khởi tạo Mã hàng
            leMaHang.NullText = "(Chọn)";
            SetDataSource(leMaHang, BUS_HangHoa.LayHangHoaLookupEdit(), "Product_ID", "Product_ID");
            leMaHang.Columns.Add(new LookUpColumnInfo("Product_ID", "Mã hàng"));
            leMaHang.Columns.Add(new LookUpColumnInfo("Product_Name", "Tên hàng"));
            leMaHang.Columns.Add(new LookUpColumnInfo("Quantity", "Tồn kho"));
            leMaHang.Columns.Add(new LookUpColumnInfo("Stock_Name", "Kho hàng"));
            leMaHang.Columns.Add(new LookUpColumnInfo("Unit", "Đơn vị tính"));
            leMaHang.PopupFormMinSize = new System.Drawing.Size(600, 350);

            //Khởi tạo Tên hàng
            leTenHang.NullText = "(Chọn)";
            SetDataSource(leTenHang, BUS_HangHoa.LayHangHoaLookupEdit(), "Product_Name", "Product_ID");
            leTenHang.Columns.Add(new LookUpColumnInfo("Product_ID", "Mã hàng"));
            leTenHang.Columns.Add(new LookUpColumnInfo("Product_Name", "Tên hàng"));
            leTenHang.Columns.Add(new LookUpColumnInfo("Quantity", "Tồn kho"));
            leTenHang.Columns.Add(new LookUpColumnInfo("Stock_Name", "Kho hàng"));
            leTenHang.Columns.Add(new LookUpColumnInfo("Unit", "Đơn vị tính"));
            leTenHang.PopupFormMinSize = new System.Drawing.Size(600, 350);

            calceSoLuong.NullText        = "0";
            calceSoLuong.MaxLength       = 10;
            calceDonGia.NullText         = "0";
            calceDonGia.MaxLength        = 10;
            calceChietKhauTiLe.NullText  = "0";
            calceChietKhauTiLe.MaxLength = 10;
            calceChietKhau.NullText      = "0";
            calceChietKhau.MaxLength     = 10;
            calceThanhToan.NullText      = "0";
            calceThanhToan.MaxLength     = 10;

            List <object> listDKTT = new List <object>
            {
                new { name = "Công nợ" },
                new { name = "Thanh toán ngay" }
            };

            gleDKTT.Properties.DataSource    = listDKTT;
            gleDKTT.Properties.ValueMember   = "name";
            gleDKTT.Properties.DisplayMember = "name";
            LookUpColumnInfo col_t = new LookUpColumnInfo("name", "");

            gleDKTT.Properties.Columns.Add(col_t);
            gleDKTT.EditValue = "Công nợ";

            List <object> listHTTT = new List <object>
            {
                new { ID = 0, name = "Tiền mặt" },
                new { ID = 1, name = "Chuyển khoản" }
            };

            gleHTTT.Properties.DataSource    = listHTTT;
            gleHTTT.Properties.ValueMember   = "name";
            gleHTTT.Properties.DisplayMember = "name";
            col_t = new LookUpColumnInfo("name", "");
            gleHTTT.Properties.Columns.Add(col_t);
            gleHTTT.EditValue = "Tiền mặt";

            //Xử lý

            if (isSale == true)
            {
                //Khởi tạo KH
                leKH.Properties.TextEditStyle = TextEditStyles.Standard;
                leKH.Properties.BestFitMode   = BestFitMode.BestFit;
                SetDataSource(leKH, BUS_KhachHang.LayKhachHangDonGian(), "CustomerName", "Customer_ID");
                leKH.Properties.Columns[0].FieldName = "CustomerName";
                leKH.Properties.Columns[1].FieldName = "Customer_ID";
                leKH.Properties.Buttons[1].Click    += btnThemKH_BaseMH_BH_Click;

                //Khởi tạo Mã KH
                leMaKH.Properties.TextEditStyle = TextEditStyles.Standard;
                leMaKH.Properties.BestFitMode   = BestFitMode.BestFit;
                SetDataSource(leMaKH, BUS_KhachHang.LayKhachHangDonGian(), "Customer_ID", "Customer_ID");
                leMaKH.Properties.Columns[1].FieldName = "CustomerName";
                leMaKH.Properties.Columns[0].FieldName = "Customer_ID";

                //Gán sự kiện cho KH và Mã KH
                leKH.EditValueChanged   += GeKH_EditValueChanged;
                leMaKH.EditValueChanged += GeMaKH_EditValueChanged;

                Text = "Phiếu xuất hàng";
            }
            else
            {
                lcITen.Text            = "Tên NCC";
                lcIMa.Text             = "Mã NCC";
                lcINgayGiao.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                //Khởi tạo NCC
                leKH.Properties.NullText      = "Chọn tên Nhà cung cấp ...";
                leKH.Properties.TextEditStyle = TextEditStyles.Standard;
                leKH.Properties.BestFitMode   = BestFitMode.BestFit;
                SetDataSource(leKH, BUS_NhaCungCap.LayNhaCC(), "CustomerName", "Customer_ID");
                leKH.Properties.Columns[0].FieldName = "CustomerName";
                leKH.Properties.Columns[1].FieldName = "Customer_ID";
                leKH.Properties.Buttons[1].Click    += btnThenNCC_BaseMH_BH_Click;

                //Khởi tạo Mã NCC
                leMaKH.Properties.NullText      = "Chọn mã Nhà cung cấp ...";
                leMaKH.Properties.TextEditStyle = TextEditStyles.Standard;
                leMaKH.Properties.BestFitMode   = BestFitMode.BestFit;
                SetDataSource(leMaKH, BUS_NhaCungCap.LayNhaCC(), "Customer_ID", "Customer_ID");
                leMaKH.Properties.Columns[1].FieldName = "CustomerName";
                leMaKH.Properties.Columns[0].FieldName = "Customer_ID";

                //Gán sự kiện cho NCC và Mã NCC
                leKH.EditValueChanged   += GeKH_EditValueChanged;
                leMaKH.EditValueChanged += GeMaKH_EditValueChanged;

                Text = "Phiếu nhập hàng";

                deNgayGiao.Visible = false;
                lcIKho.Text        = "Kho nhập";
                gvMain.Columns["colChietKhauTiLe"].Visible = false;
                gvMain.Columns["colChietKhau"].Visible     = false;
                gvMain.Columns["colThanhToan"].Visible     = false;
            }
            table = BUS_KhoXuat.GetTonKhoLookup();
            if (add == true)
            {
                phatSinhMa();
            }
            else
            {
                LoadDuLieu();
            }
        }