Exemplo n.º 1
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang         KH  = new DTO_KhachHang();

            KH.HOTEN    = txtHoTen.Text;
            KH.GIOITINH = txtGioiTinh.Text;
            KH.LOAIKH   = txtLoaiThe.Text;
            KH.NGSINH   = DateChange.ToString(dateNgSinh.DateTime);
            KH.NGDK     = DateChange.ToString(dateNgDK.DateTime);
            //KH.NGSINH = TranDateFormat.Trans(dateNgSinh.Text);
            //KH.NGDK = TranDateFormat.Trans(dateNgDK.Text);
            KH.MAKH   = MaKH;
            KH.DIACHI = txtDiaChi.Text;
            KH.DIEMTL = DTL;

            if (bus.suaData(KH))
            {
                PushNoti noti = new PushNoti("Success", "Bạn đã cập nhật thành công");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
            }
            else
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra, cập nhật không thành công!");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
            }
        }
Exemplo n.º 2
0
        private void CbxThoiGian_SelectedIndexChanged(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            switch (cbxThoiGian.SelectedIndex)
            {
            case 0:
                labelBangDoanhThu.Text = "DOANH THU THUẦN HÔM NAY";
                labelDoanhThuLon.Text  = bus.doanhThuTheoNgay(DateChange.ToString(DateTime.Today)) + " VND";
                break;

            case 1:
                labelBangDoanhThu.Text = "DOANH THU THUẦN HÔM QUA";
                labelDoanhThuLon.Text  = bus.doanhThuTheoNgay(DateChange.ToString(DateTime.Today.AddDays(-1))) + " VND";
                break;

            case 2:
                labelBangDoanhThu.Text = "DOANH THU THUẦN THÁNG NÀY";
                labelDoanhThuLon.Text  = bus.doanhThuTheoThang(DateTime.Today.Month.ToString(), DateTime.Today.Year.ToString()) + " VND";
                break;

            case 3:
                labelBangDoanhThu.Text = "DOANH THU THUẦN THÁNG TRƯỚC";
                labelDoanhThuLon.Text  = bus.doanhThuTheoThang(DateTime.Today.AddMonths(-1).Month.ToString(), DateTime.Today.AddMonths(-1).Year.ToString()) + " VND";
                break;
            }
        }
Exemplo n.º 3
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            //string Ngsinh = TranDateFormat.Trans(dateNgSinh.Text);
            //string NgVaoLam = TranDateFormat.Trans(dateNgVaoLam.Text);
            string       Ngsinh   = DateChange.ToString(dateNgSinh.DateTime);
            string       NgVaoLam = DateChange.ToString(dateNgVaoLam.DateTime);
            DTO_NhanVien NV       = new DTO_NhanVien(txtMaNV.Text, txtHoTen.Text, Ngsinh, comboBoxChucVu.SelectedItem.ToString(),
                                                     NgVaoLam, txtGioiTinh.Text, txtLuong.Text, "0", "0");

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.suaData(NV) == false)
            {
                //MessageBox.Show("Có lỗi xảy ra! Không thành công");
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra! Sửa không thành công!");
                noti.Width  = 800;
                noti.Height = 30;
                this.labelControl.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            else
            {
                PushNoti noti1 = new PushNoti("Success", "Cập nhật thông tin thành công!");
                noti1.Width  = 800;
                noti1.Height = 30;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                //MessageBox.Show("Bạn đã cập nhật thành công");
            }
            //Close();
        }
Exemplo n.º 4
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang         KH  = new DTO_KhachHang();

            KH.HOTEN    = txtHoTen.Text;
            KH.MAKH     = txtMaKH.Text;
            KH.GIOITINH = cbxGioiTinh.Text;
            KH.LOAIKH   = cbxLoaiThe.Text;
            //KH.NGDK = TranDateFormat.Trans(dateNgDK.Text);
            //KH.NGSINH = TranDateFormat.Trans(dateNgSinh.Text);
            KH.NGDK   = DateChange.ToString(dateNgDK.DateTime);
            KH.NGSINH = DateChange.ToString(dateNgSinh.DateTime);
            KH.DIACHI = txtDiaChi.Text;
            KH.DIEMTL = txtDiemTL.Text;

            if (bus.themData(KH) == false)
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra, thêm khách hàng không thành công!");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            MaKH         = KH.MAKH;
            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 5
0
        private void Pic_UpdateNCC_Click(object sender, EventArgs e)
        {
            string         NGHT = DateChange.ToString(dateHT.DateTime);
            DTO_NhaCungCap NCC  = new DTO_NhaCungCap(lbl_MaDN.Text, TbTenNCC.Text, NGHT, TbDiaChi.Text, TbSdt.Text, TbMucDo.Text, TbTrangThai.Text);

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.suaData(NCC) == false)
            {
                //MessageBox.Show("Có lỗi xảy ra! Không thành công");
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra! Sửa không thành công!");
                noti.Width  = this.Width;
                noti.Height = 30;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            else
            {
                PushNoti noti1 = new PushNoti("Success", "Cập nhật thông tin thành công!");
                noti1.Width  = this.Width;
                noti1.Height = 30;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                //MessageBox.Show("Bạn đã cập nhật thành công");
            }
        }
Exemplo n.º 6
0
 private void UserControlDoanhThuCuoiNgay_Load(object sender, EventArgs e)
 {
     dateNgHD.DateTime = DateTime.Today;
     Init_Today_Panel();
     Init("", "", "", DateChange.ToString(dateNgHD.DateTime));
     Init_Chart();
 }
Exemplo n.º 7
0
        private void Init_Today_Panel()
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DateTime dt = DateTime.Today;

            label3.Text = bus.doanhThuTheoNgay(DateChange.ToString(dt)) + " VND";
            label4.Text = bus.soLuongTheoNgay(DateChange.ToString(dt));
        }
Exemplo n.º 8
0
 private void PicSearch_Click(object sender, EventArgs e)
 {
     if (dateNgHD.Text == "")
     {
         Init(txtMaHD.Text, txtMaKH.Text, txtMaNV.Text, "");
         return;
     }
     Init(txtMaHD.Text, txtMaKH.Text, txtMaNV.Text, DateChange.ToString(dateNgHD.DateTime));
 }
Exemplo n.º 9
0
        public void Load_Grid()
        {
            string date = "";

            try
            {
                date = DateChange.ToString(dateNgDD.DateTime);
            }
            catch (Exception ex)
            {
                dateNgDD.DateTime = DateTime.Today;
                date = DateChange.ToString(dateNgDD.DateTime);
            }
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            gridDiemDanh.DataSource = bus.timKiemNhanhDiemDanh(date);
            foreach (DataGridViewTextBoxColumn col in this.gridDiemDanh.Columns)
            {
                switch (col.HeaderText)
                {
                case "MANV":
                    col.HeaderText = "Mã nhân viên";
                    break;

                case "HOTEN":
                    col.HeaderText = "Họ tên";
                    break;

                case "NGSINH":
                    col.HeaderText = "Ngày sinh";
                    break;

                case "CHUCVU":
                    col.HeaderText = "Chức vụ";
                    break;

                case "NGAYVL":
                    col.HeaderText = "Ngày vào làm";
                    break;

                case "GIOITINH":
                    col.HeaderText = "Giới tính";
                    break;

                case "LUONG":
                    col.HeaderText = "Lương";
                    break;

                case "SLHD":
                    col.HeaderText = "Số lượng hoá đơn";
                    break;

                case "DOANHTHU":
                    col.HeaderText = "Doanh thu";
                    break;
                }
            }
        }
Exemplo n.º 10
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang         KH  = new DTO_KhachHang();

            KH.HOTEN    = txtHoTen.Text;
            KH.MAKH     = txtMaKH.Text;
            KH.GIOITINH = cbxGioiTinh.Text;
            KH.LOAIKH   = cbxLoaiThe.Text;
            //KH.NGDK = TranDateFormat.Trans(dateNgDK.Text);
            //KH.NGSINH = TranDateFormat.Trans(dateNgSinh.Text);
            KH.NGDK   = DateChange.ToString(dateNgDK.DateTime);
            KH.NGSINH = DateChange.ToString(dateNgSinh.DateTime);
            KH.DIACHI = txtDiaChi.Text;
            KH.DIEMTL = txtDiemTL.Text;
            string error = CheckThongTin.check_Nhap(KH);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (bus.themData(KH) == false)
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra, thêm khách hàng không thành công!");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            string desAnh = Application.StartupPath + "/HinhKhachHang/" + KH.MAKH + ".jpg";

            if (fileAnh != "")
            {
                if (File.Exists(desAnh))
                {
                    File.Delete(desAnh);
                }
                File.Copy(fileAnh, desAnh);
            }
            if (txtMatKhau.Text == "")
            {
                txtMatKhau.Text = "111111";
            }
            DTO_TaiKhoan tk = new DTO_TaiKhoan(KH.MAKH, txtMatKhau.Text);

            bus.themData(tk);
            MaKH         = KH.MAKH;
            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 11
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (dataGridView1.Rows.Count == 0)
            {
                PushNoti noti1 = new PushNoti("Error", "Chưa có chi tiết phiếu nhập!");
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
            }
            DTO_PhieuNhap PN    = new DTO_PhieuNhap(txtMaPN.Text, txtMaNCC.Text, DateChange.ToString(dateNgNhap.DateTime), "0", "0", richTextBox1.Text);
            string        error = CheckThongTin.check_Nhap(PN);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (bus.themData(PN) == false)
            {
                PushNoti noti1 = new PushNoti("Error", "Thêm phiếu nhập không thành công!");
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            int SL = 0;
            int GT = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                DTO_CTPhieuNhap ctpn = new DTO_CTPhieuNhap(PN.MAPN, row.Cells[0].Value.ToString(), row.Cells[2].Value.ToString(), row.Cells[3].Value.ToString());
                SL += int.Parse(row.Cells[2].Value.ToString());
                GT += int.Parse(row.Cells[3].Value.ToString());
                DTO_SanPham[] sp = bus.search_SANPHAM(row.Cells[0].Value.ToString());
                sp[0].SLUONG = (int.Parse(sp[0].SLUONG) + int.Parse(row.Cells[2].Value.ToString())).ToString();
                bus.suaData(sp[0]);
                bus.themData(ctpn);
            }
            PN.TONGSL   = SL.ToString();
            PN.TONGTIEN = GT.ToString();
            bus.suaData(PN);
            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 12
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_DiemDanh          dd  = new DTO_DiemDanh(ThongTinDangNhap.Username, DateChange.ToString(DateTime.Today));
            string error = CheckThongTin.check_Nhap(dd);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.panel15.Width;
                this.panel15.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (bus.themData(dd))
            {
                PushNoti noti1 = new PushNoti("Success", "Điểm danh thành công!");
                noti1.Width = this.panel15.Width;
                this.panel15.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
            }
        }
Exemplo n.º 13
0
        private void picTaoHoaDon_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            string str = bus.getThongTinHD(0, bus.getDataTable("HOADON").Rows.Count - 1);

            str = str.Remove(0, 2);
            str = (Convert.ToInt32(str) + 1).ToString();
            string mahd = "HD0000000000";

            mahd  = mahd.Remove(mahd.Length - str.Length);
            mahd += str;
            DTO_HoaDon hd = new DTO_HoaDon(mahd, ThongTinDangNhap.Username, txtMaKH.Text, DateChange.ToString(dateNgHD.DateTime), lblTongTienHang.Text, txtGiamGia.Text, lblThanhTien.Text);

            bus.themData(hd);
            foreach (UserControlPanelSanPham sp in flowGioHang.Controls)
            {
                sp.ThemData(mahd);
            }
            Bill bill = new Bill();

            bill.DataSource = new Stelia_BUS.Stelia_BUS().InHoaDon(mahd);
            bill.ShowPreviewDialog();
            bill.PrintDialog();
            if (ThongTinDangNhap.Username == "admin")
            {
                return;
            }
            DTO_NhanVien[] nv = new Stelia_BUS.Stelia_BUS().search_NhanVien(ThongTinDangNhap.Username);
            nv[0].DOANHTHU += ThanhTien;
            nv[0].SLHD     += 1;
            bus.suaData(nv[0]);
        }
Exemplo n.º 14
0
        private void picTaoHoaDon_Click(object sender, EventArgs e)
        {
            if (flowGioHang.Controls.Count < 1)
            {
                PushNoti noti = new PushNoti("Warning", "Thêm hàng hoá vào giỏ hàng trước khi in hoá đơn!");
                noti.Width = this.Width;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            string mahd = "";

            if (bus.getDataTable("HOADON") == null)
            {
                mahd = "HD0000000001";
                return;
            }
            string str = bus.getThongTinHD(0, bus.getDataTable("HOADON").Rows.Count - 1);

            str = str.Remove(0, 2);
            int temp = str.Length;

            str = (Convert.ToInt32(str) + 1).ToString();
            while (str.Length < temp)
            {
                str = "0" + str;
            }
            mahd  = "HD";
            mahd += str;
            DTO_HoaDon hd = new DTO_HoaDon(mahd, ThongTinDangNhap.Username, txtMaKH.Text, DateChange.ToString(dateNgHD.DateTime), lblTongTienHang.Text, txtGiamGia.Text, lblThanhTien.Text);

            bus.themData(hd);
            foreach (UserControlPanelSanPham sp in flowGioHang.Controls)
            {
                sp.ThemData(mahd);
            }
            Bill bill = new Bill();

            bill.DataSource = new Stelia_BUS.Stelia_BUS().InHoaDon(mahd);
            bill.ShowPreviewDialog();
            if (txtMaKH.Text != "")
            {
                DTO_KhachHang[] kh = new Stelia_BUS.Stelia_BUS().search_KhachHang(txtMaKH.Text);
                foreach (DTO_KhachHang k in kh)
                {
                    if (k.MAKH == txtMaKH.Text)
                    {
                        k.DIEMTL = (Convert.ToDouble(kh[0].DIEMTL) + Convert.ToDouble(ThanhTien / 100)).ToString();
                        bus.suaData(k);
                    }
                }
            }
            if (ThongTinDangNhap.Username == "admin")
            {
                ResetAfterPrint();
                return;
            }
            DTO_NhanVien[] nv = new Stelia_BUS.Stelia_BUS().search_NhanVien(ThongTinDangNhap.Username);
            nv[0].DOANHTHU = (Convert.ToDouble(nv[0].DOANHTHU) + Convert.ToDouble(ThanhTien)).ToString();
            nv[0].SLHD     = (Convert.ToInt32(nv[0].SLHD) + 1).ToString();
            bus.suaData(nv[0]);
            ResetAfterPrint();
        }
Exemplo n.º 15
0
 private void Init_Chart()
 {
     chartControl1.DataSource = new Stelia_BUS.Stelia_BUS().top5_maSP_BanChayTheoDoanhThu(DateChange.ToString(dateNgHD.DateTime));
 }
Exemplo n.º 16
0
 private void dateNgHD_EditValueChanged(object sender, EventArgs e)
 {
     Init_Today_Panel();
     Init("", "", "", DateChange.ToString(dateNgHD.DateTime));
     Init_Chart();
 }
Exemplo n.º 17
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            //string Ngsinh = TranDateFormat.Trans(dateNgSinh.Text);
            //string NgVaoLam = TranDateFormat.Trans(dateNgVaoLam.Text);
            string Ngsinh   = DateChange.ToString(dateNgSinh.DateTime);
            string NgVaoLam = DateChange.ToString(dateNgVaoLam.DateTime);

            if ((comboBoxChucVu.Text == "Quản lí" || comboBoxChucVu.Text == "Quản lí nhân sự") && ThongTinDangNhap.ChucVu == "Quản lí nhân sự")
            {
                PushNoti noti1 = new PushNoti("Error", "Bạn không có quyền tạo nhân viên với chức vụ này. Vui lòng sử dụng một tài khoản cấp cao hơn");
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            if (comboBoxChucVu.Text == "Quản lí" && ThongTinDangNhap.ChucVu == "Quản lí")
            {
                PushNoti noti1 = new PushNoti("Error", "Bạn không có quyền tạo nhân viên với chức vụ này. Vui lòng sử dụng một tài khoản cấp cao hơn");
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            DTO_NhanVien NV = new DTO_NhanVien(txtMaNV.Text, txtHoTen.Text, Ngsinh, comboBoxChucVu.SelectedItem.ToString(),
                                               NgVaoLam, txtGioiTinh.Text, txtLuong.Text, "0", "0");

            string error = CheckThongTin.check_Nhap(NV);

            if (error != "")
            {
                PushNoti noti1 = new PushNoti("Error", error);
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.themData(NV) == false)
            {
                PushNoti noti1 = new PushNoti("Error", "Thêm nhân viên không thành công!");
                noti1.Width = this.Width;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                return;
            }
            else
            {
            }
            string desAnh = Application.StartupPath + "/HinhNhanVien/" + txtMaNV.Text + ".jpg";

            if (fileAnh != "")
            {
                if (File.Exists(desAnh))
                {
                    File.Delete(desAnh);
                }
                File.Copy(fileAnh, desAnh);
            }
            DialogResult = DialogResult.OK;
            Close();
        }