private void gvListSanPham_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            try
            {
                if (e.RowHandle < 0)
                {
                    return;
                }
                BangGiaBanChiTietBCInfor ct = (BangGiaBanChiTietBCInfor)gvListSanPham.GetRow(e.RowHandle);

                if (ct != null)// && now.CompareTo(ct.NgayCapNhatCuoi) > 60*60*24*1000)
                {
                    TimeSpan tmp = lastSync - ct.NgayCapNhatCuoi;
                    if (tmp.TotalDays > 1)
                    {
                        return;
                    }
                    if (ct.DonGiaCoVAT > ct.DonGiaCoVATOld)//tang gia
                    {
                        e.Appearance.BackColor = tsslTangGia.BackColor;
                        e.Appearance.ForeColor = tsslTangGia.ForeColor;
                        e.Appearance.Font      = new Font("Arial", 9, FontStyle.Bold);
                    }
                    else//giam gia
                    {
                        e.Appearance.BackColor = tsslGiamGia.BackColor;
                        e.Appearance.ForeColor = tsslGiamGia.ForeColor;
                        e.Appearance.Font      = new Font("Arial", 9, FontStyle.Bold);
                    }
                }
            }
            catch
            {
            }
        }
        private void LichSuThayDoiGia_Click(object sender, EventArgs e)
        {
            BangGiaBanChiTietBCInfor bgInfor = (BangGiaBanChiTietBCInfor)gvListSanPham.GetFocusedRow();

            if (bgInfor != null)
            {
                frmBH_BangGiaBanHang_LichSu frm = new frmBH_BangGiaBanHang_LichSu(bgInfor.IdTrungTam, bgInfor.IdSanPham);
                frm.ShowDialog();
            }
        }
        private void TonChiTiet_Click(object sender, EventArgs e)
        {
            BangGiaBanChiTietBCInfor bgInfor = (BangGiaBanChiTietBCInfor)gvListSanPham.GetFocusedRow();

            if (bgInfor != null)
            {
                frmBH_BangGiaBanHang_TonCTiet frm = new frmBH_BangGiaBanHang_TonCTiet(bgInfor);
                frm.ShowDialog();
            }
        }
Пример #4
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            BangGiaBanChiTietBCInfor sp = BangGiaDataProvider.Instance.
                                          GetSanPham(((DMSanPhamInfo)bteSanPham.Tag).MaSanPham, ((DMTrungTamInfor)bteTrungTam.Tag).MaTrungTam);

            int idDKMua = 0;

            double tienKhuyenMai = CommonFuns.Instance.GetTienKhuyenMai(sp.IdTrungTam, sp.IdSanPham,
                                                                        sp.MaSanPham, sp.DonGiaCoVAT,
                                                                        sp.DonGiaCoVAT, sp.TyLeVAT, ref idDKMua);

            MessageBox.Show(String.Format("Trung tâm {0} \n Mã sản phẩm {1} \n Khuyến mại {2}",
                                          ((DMTrungTamInfor)bteTrungTam.Tag).MaTrungTam, sp.MaSanPham, tienKhuyenMai));
        }
Пример #5
0
        private void kiemTraGiaVaChietKhauBan(object sender, EventArgs e)
        {
            var info = (LichSuGiaBanInfor)gvListLichSuGia.GetFocusedRow();

            BangGiaBanChiTietBCInfor sp = BangGiaDataProvider.Instance.GetSanPham(info.MaSanPham, info.MaTrungTam);

            int idDKMua = 0;

            double tienKhuyenMai = CommonFuns.Instance.GetTienKhuyenMai(sp.IdTrungTam, sp.IdSanPham,
                                                                        sp.MaSanPham, sp.DonGiaCoVAT,
                                                                        sp.DonGiaCoVAT, sp.TyLeVAT, ref idDKMua);

            MessageBox.Show(String.Format("Trung tâm {0} \n Mã sản phẩm {1} \n Khuyến mại {2}",
                                          info.MaTrungTam, sp.MaSanPham, tienKhuyenMai));
        }
        private void TonChiTiet_Click(object sender, EventArgs e)
        {
            SanPhamKhongCoGiaBCInfor sp      = (SanPhamKhongCoGiaBCInfor)gvListSanPham.GetFocusedRow();
            BangGiaBanChiTietBCInfor bgInfor = new BangGiaBanChiTietBCInfor()
            {
                IdSanPham    = sp.IdSanPham,
                MaSanPham    = sp.MaSanPham,
                TenSanPham   = sp.TenSanPham,
                MaDonViTinh  = sp.MaDonViTinh,
                TenDonViTinh = sp.TenSanPham
            };

            if (bgInfor != null)
            {
                frmBH_BangGiaBanHang_TonCTiet frm = new frmBH_BangGiaBanHang_TonCTiet(bgInfor);
                frm.ShowDialog();
            }
        }
Пример #7
0
        private void ChinhSachApDung_Click(object sender, EventArgs e)
        {
            BangGiaBanChiTietBCInfor bgInfor = (BangGiaBanChiTietBCInfor)gvListSanPham.GetFocusedRow();

            if (bgInfor != null)
            {
                int idTrungTam = bteTrungTam.Tag != null
                                     ? ((DMTrungTamInfor)bteTrungTam.Tag).IdTrungTam
                                     : Declare.IdTrungTam;
                DateTime ngayLap = CommonProvider.Instance.GetSysDate();

                List <BangGiaChinhSachInfor> liCSachs =
                    ChinhSachDataProvider.Instance.GetAllChinhSachDaApDung(idTrungTam, bgInfor.MaSanPham, ngayLap);
                List <BangGiaChinhSachInfor> liChinhSach = new List <BangGiaChinhSachInfor>();
                foreach (BangGiaChinhSachInfor cs in liCSachs)
                {
                    string lstMatHangKhongAD = String.Format(",{0},", cs.MatHangKhongApDung);//khong nam trong danh sach ko duoc ap dung
                    if (!lstMatHangKhongAD.Contains(String.Format(",{0},", bgInfor.IdSanPham)))
                    {
                        liChinhSach.Add(cs);
                    }
                }
                //List<BangGiaChinhSachInfor> liChinhSach =
                //    ChinhSachDataProvider.Instance.GetAllChinhSachDaApDung(bgInfor.IdTrungTam, bgInfor.MaSanPham,
                //                                                           CommonProvider.Instance.GetSysDate());

                if (liChinhSach != null && liChinhSach.Count > 0)
                {
                    BangGiaChiTietInfor bgct = new BangGiaChiTietInfor()
                    {
                        MaSanPham   = bgInfor.MaSanPham,
                        TenSanPham  = bgInfor.TenSanPham,
                        DonViTinh   = bgInfor.TenDonViTinh,
                        DonGiaCoVAT = bgInfor.DonGiaCoVAT
                    };
                    frmCS_BangGia_ViewKhuyenMai frm = new frmCS_BangGia_ViewKhuyenMai(liChinhSach, bgct);
                    frm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Không có chính sách giá cho sản phẩm này!");
                }
            }
        }
Пример #8
0
 public frmBH_BangGiaBanHang_TonCTiet(BangGiaBanChiTietBCInfor bgInfor)
 {
     InitializeComponent();
     Common.LoadStyle(this);
     this.bgInfor = bgInfor;
 }