// GET: Admin/QuanLy
        public ActionResult Index()
        {
            BaoCaoModel baocao = new BaoCaoModel();
            int         day    = DateTime.Now.Day;
            int         month  = DateTime.Now.Month;
            int         year   = DateTime.Now.Year;

            //Lay so sp da ban
            int soSPDaBanHomNay = baocao.GetSoSPBanTaiQuanTrongNgay(day, month, year) + baocao.GetSoSPBanOnlineTrongNgay(day, month, year);

            ViewBag.SoSPDaBanHomNay = soSPDaBanHomNay;

            //Lay doanh thu 1 ngay
            ViewBag.TongThuHomNay = baocao.GetTongThu1Ngay(day, month, year);
            ViewBag.TongChiHomNay = baocao.GetTongChi1Ngay(day, month, year);

            int soDonChuaXacNhan = baocao.GetSoDDHChuaXacNhanTrongNgay(day, month, year);

            ViewBag.SoDonChuaXacNhan = soDonChuaXacNhan;

            ViewBag.SoTienThuTaiQuan = baocao.GetTongThuTaiQuan1Ngay(day, month, year);
            ViewBag.SoTienThuOnline  = baocao.GetTongThuOnline1Ngay(day, month, year);
            ViewBag.SoTienThuKhac    = baocao.GetTongThuKhac1Ngay(day, month, year);

            ViewBag.TongThuBuoiTrua = baocao.GetTongThuBuoiTrua1Ngay(day, month, year);
            ViewBag.TongThuBuoiToi  = baocao.GetTongThuBuoiToi1Ngay(day, month, year);

            ViewBag.ChiNhapNguyenLieu   = baocao.GetChiNhapNguyenLieu1Ngay(day, month, year);
            ViewBag.ChiNhapDungCu       = baocao.GetChiNhapDungCu1Ngay(day, month, year);
            ViewBag.ChiNhapNuocGiaiKhat = baocao.GetChiNhapNuocGiaiKhat1Ngay(day, month, year);
            ViewBag.ChiTraLuongNhanVien = baocao.GetChiTraLuongNhanVien1Ngay(day, month, year);
            ViewBag.ChiKhac             = baocao.GetChiKhac1Ngay(day, month, year);
            return(View());
        }
        // GET: Admin/BaoCaoThuChi
        public ActionResult Index(string thang, string nam)
        {
            int month;
            int year;

            try
            {
                month = Int32.Parse(thang);
                year  = Int32.Parse(nam);
            }
            catch { return(null); }

            //Viewbag
            List <int> dataChiThang      = new List <int>();
            List <int> dataThuThang      = new List <int>();
            List <int> dataDoanhThuThang = new List <int>();
            //Lay du lieu tung ngay
            BaoCaoModel baocao = new BaoCaoModel();

            for (int i = 1; i <= DateTime.DaysInMonth(year, month); i++)
            {
                int chi = -baocao.GetTongChi1Ngay(i, month, year);
                int thu = baocao.GetTongThu1Ngay(i, month, year);
                dataChiThang.Add(chi);
                dataThuThang.Add(thu);
                dataDoanhThuThang.Add(thu + chi);
            }
            ViewBag.BaoCaoChiThang      = dataChiThang;
            ViewBag.BaoCaoThuThang      = dataThuThang;
            ViewBag.BaoCaoDoanhThuThang = dataDoanhThuThang;

            ViewBag.Thang = thang;
            ViewBag.Nam   = nam;
            //LAY so ngay can hien thi
            int soNgayCanHienThi = 1;

            if (month == DateTime.Now.Month && year == DateTime.Now.Year)
            {
                soNgayCanHienThi = DateTime.Now.Day;
            }
            else
            {
                soNgayCanHienThi = DateTime.DaysInMonth(year, month);
            }
            ViewBag.SoNgayCanHienThi = soNgayCanHienThi;


            //Lay bao cao tong doanh thu
            ViewBag.ThuBanHangTaiQuan = baocao.GetTongThuBanHangTaiQuan1Thang(month, year);
            ViewBag.ThuBanHangTrenWeb = baocao.GetTongThuBanHangTrenWeb1Thang(month, year);
            ViewBag.ThuKhac           = baocao.GetTongThuKhac(month, year);

            ViewBag.ChiNhapNguyenLieu   = baocao.GetTongChiNhapNguyenLieu(month, year);
            ViewBag.ChiNhapDungCu       = baocao.GetTongChiNhapDungCu(month, year);
            ViewBag.ChiNhapNuocGiaiKhat = baocao.GetTongChiNhapNuocGiaiKhat(month, year);
            ViewBag.ChiTraLuongNhanVien = baocao.GetTongChiTraLuongNhanVien(month, year);
            ViewBag.ChiKhac             = baocao.GetTongChiKhac(month, year);
            return(View());
        }
        // GET: Admin/BaoCaoBanHang
        public ActionResult Index(string thang, string nam)
        {
            int month;
            int year;

            try
            {
                month = Int32.Parse(thang);
                year  = Int32.Parse(nam);
            }
            catch { return(null); }
            List <int>  dataSanPhamDaBanOnline  = new List <int>(); //Lay du lieu tung ngay
            List <int>  dataSanPhamDaBanTaiQuan = new List <int>(); //Lay du lieu tung ngay
            List <int>  dataTongSanPhamDaBan    = new List <int>(); //Lay du lieu tung ngay
            BaoCaoModel baocao = new BaoCaoModel();

            for (int i = 1; i <= DateTime.DaysInMonth(year, month); i++)
            {
                int soSPBanOnline  = baocao.GetSoSPBanOnlineTrongNgay(i, month, year);
                int soSPBanTaiQuan = baocao.GetSoSPBanTaiQuanTrongNgay(i, month, year);
                dataSanPhamDaBanOnline.Add(soSPBanOnline);
                dataSanPhamDaBanTaiQuan.Add(soSPBanTaiQuan);
                dataTongSanPhamDaBan.Add(soSPBanOnline + soSPBanTaiQuan);
            }
            ViewBag.BaoCaoSoSanPhamBanOnlineCuaThang  = dataSanPhamDaBanOnline;
            ViewBag.BaoCaoSoSanPhamBanTaiQuanCuaThang = dataSanPhamDaBanTaiQuan;
            ViewBag.BaoCaoSoSanPhamDaBanCuaThang      = dataTongSanPhamDaBan;
            ViewBag.Thang = thang;
            ViewBag.Nam   = nam;
            //LAY so ngay can hien thi
            int soNgayCanHienThi = 1;

            if (month == DateTime.Now.Month && year == DateTime.Now.Year)
            {
                soNgayCanHienThi = DateTime.Now.Day;
            }
            else
            {
                soNgayCanHienThi = DateTime.DaysInMonth(year, month);
            }
            ViewBag.SoNgayCanHienThi = soNgayCanHienThi;

            //Lay BXH MONAN TRONG THANG
            //ViewBag.BXHMONAN = baocao.GetBXHMONANTrongThang(month,year);
            //ViewBag.BXHNGK = baocao.GetBXHNGKTrongThang(month, year);
            //LAY BXH NUOCGIAIKHAT TRONG THANG
            return(View());
        }
Beispiel #4
0
        // GET: Admin/BaoCaoHangNgay
        public ActionResult Index(string ngay, string thang, string nam)
        {
            int day;
            int month;
            int year;

            try
            {
                day   = Int32.Parse(ngay);
                month = Int32.Parse(thang);
                year  = Int32.Parse(nam);
            }
            catch { return(null); }

            BaoCaoModel baocao = new BaoCaoModel();
            //Lay so sp da ban
            int soSPDaBanHomNay = baocao.GetSoSPBanTaiQuanTrongNgay(day, month, year) + baocao.GetSoSPBanOnlineTrongNgay(day, month, year);

            ViewBag.SoSPDaBanHomNay = soSPDaBanHomNay;

            //Lay doanh thu 1 ngay
            ViewBag.TongThuHomNay = baocao.GetTongThu1Ngay(day, month, year);
            ViewBag.TongChiHomNay = baocao.GetTongChi1Ngay(day, month, year);

            int soDonChuaXacNhan = baocao.GetSoDDHChuaXacNhanTrongNgay(day, month, year);

            ViewBag.SoDonChuaXacNhan = soDonChuaXacNhan;

            ViewBag.SoTienThuTaiQuan = baocao.GetTongThuTaiQuan1Ngay(day, month, year);
            ViewBag.SoTienThuOnline  = baocao.GetTongThuOnline1Ngay(day, month, year);
            ViewBag.SoTienThuKhac    = baocao.GetTongThuKhac1Ngay(day, month, year);

            ViewBag.TongThuBuoiTrua = baocao.GetTongThuBuoiTrua1Ngay(day, month, year);
            ViewBag.TongThuBuoiToi  = baocao.GetTongThuBuoiToi1Ngay(day, month, year);

            ViewBag.ChiNhapNguyenLieu   = baocao.GetChiNhapNguyenLieu1Ngay(day, month, year);
            ViewBag.ChiNhapDungCu       = baocao.GetChiNhapDungCu1Ngay(day, month, year);
            ViewBag.ChiNhapNuocGiaiKhat = baocao.GetChiNhapNuocGiaiKhat1Ngay(day, month, year);
            ViewBag.ChiTraLuongNhanVien = baocao.GetChiTraLuongNhanVien1Ngay(day, month, year);
            ViewBag.ChiKhac             = baocao.GetChiKhac1Ngay(day, month, year);
            ViewBag.Ngay  = ngay;
            ViewBag.Thang = thang;
            ViewBag.Nam   = nam;
            return(View());
        }
Beispiel #5
0
        public void loadDataQuy(Int32 current)
        {
            var y = txtNam.Text;
            var q = txtQuy.SelectedItem.ToString().ToQuy(y);

            currentModel.startTime = q.StartTime;
            currentModel.endTime   = q.EndTime;
            currentModel           = controller.GetData(current, currentModel);
            //-------------------------------
            dataGridView.DataSource = new BindingSource {
                DataSource = currentModel.Hoadonnhap
            };
            dataGridView.Columns["ID"].Display(false);
            dataGridView.Columns["NhaCungCapID"].Display(false);
            dataGridView.Columns["NhaCungCap"].Display(false);
            dataGridView.Columns["NhanVienID"].Display(false);
            dataGridView.Columns["NhanVien"].Display(false);
        }
Beispiel #6
0
        public BaoCaoView(IBaoCaoController <BaoCaoModel> value)
        {
            controller = value;
            InitializeComponent();
            bntLuaChon.Enabled = false;
            bntXoa.Enabled     = false;
            var a = new List <DropdownList>
            {
                new DropdownList {
                    ID = 0, Value = "..Lựa chọn báo cáo..."
                },
                new DropdownList {
                    ID = 1, Value = "Sản phẩm tồn kho"
                },
                new DropdownList {
                    ID = 2, Value = "Tổng tiền nhập hàng theo quý"
                },
                new DropdownList {
                    ID = 3, Value = "Tổng tiền bán hàng của một nhân viên"
                },
                new DropdownList {
                    ID = 4, Value = "Tổng tiền 3 khách hàng mua nhiều nhất"
                }
            };

            currentModel = new BaoCaoModel();
            var b = new BindingSource();

            b.DataSource                    = a;
            cbbBaoCao.DataSource            = b;
            cbbBaoCao.DisplayMember         = "Value";
            cbbBaoCao.ValueMember           = "ID";
            cbbBaoCao.SelectedValueChanged += new System.EventHandler(comboBox1_SelectedValueChanged);

            label1.Visible        = false;
            label2.Visible        = false;
            label3.Visible        = false;
            txtNam.Visible        = false;
            txtQuy.Visible        = false;
            txtMaNhanVien.Visible = false;
            txtNam.Text           = "2016";
        }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbbBaoCao.SelectedValue != null)
            {
                var current = cbbBaoCao.SelectedValue.ToInt32();
                dataGridView.Columns.Clear();



                if (current == 1)
                {
                    // todo: Sản phẩm tồn kho
                    currentModel            = controller.GetData(current, currentModel);
                    dataGridView.DataSource = new BindingSource {
                        DataSource = currentModel.Sanpham
                    };

                    dataGridView.Columns["ID"].Display(false);
                    dataGridView.Columns["TheLoaiID"].Display(false);
                    dataGridView.Columns["KichCoID"].Display(false);
                    dataGridView.Columns["ChatLieuID"].Display(false);
                    dataGridView.Columns["MauID"].Display(false);
                    dataGridView.Columns["DoiTuongID"].Display(false);
                    dataGridView.Columns["MuaID"].Display(false);
                    dataGridView.Columns["NuocSanXuatID"].Display(false);

                    dataGridView.Columns["TheLoai"].Display(false);
                    dataGridView.Columns["KichCo"].Display(false);
                    dataGridView.Columns["ChatLieu"].Display(false);
                    dataGridView.Columns["Mau"].Display(false);
                    dataGridView.Columns["DoiTuong"].Display(false);
                    dataGridView.Columns["Mua"].Display(false);
                    dataGridView.Columns["NuocSanXuat"].Display(false);
                }
                else if (current == 2)
                {
                    // todo: Tổng tiền nhập hàng theo quý
                    loadDataQuy(current);
                }
                else if (current == 3)
                {
                    // todo: Tổng tiền bán hàng của một nhân viên
                    currentModel.MaNhanVien = txtMaNhanVien.Text;
                    currentModel            = controller.GetData(current, currentModel);
                    //------
                    dataGridView.DataSource = new BindingSource {
                        DataSource = currentModel.Hoadonban
                    };
                    dataGridView.Columns["ID"].Display(false);
                    dataGridView.Columns["KhachHangID"].Display(false);
                    dataGridView.Columns["KhachHang"].Display(false);
                    dataGridView.Columns["NhanVienID"].Display(false);
                    dataGridView.Columns["NhanVien"].Display(false);
                }
                else if (current == 4)
                {
                    // todo: Tổng tiền 3 khách hàng mua nhiều nhất
                    currentModel.TopBuy = 3;
                    currentModel        = controller.GetData(current, currentModel);

                    //------
                    dataGridView.DataSource = new BindingSource {
                        DataSource = currentModel.Hoadonban
                    };
                    dataGridView.Columns["ID"].Display(false);
                    dataGridView.Columns["KhachHangID"].Display(false);
                    dataGridView.Columns["KhachHang"].Display(false);
                    dataGridView.Columns["NhanVienID"].Display(false);
                    dataGridView.Columns["NhanVien"].Display(false);
                    dataGridView.Columns["MaNV"].Display(false);
                    dataGridView.Columns["SoHDB"].Display(false);

                    if (dataGridView.Columns["MaKhach"] != null)
                    {
                        dataGridView.Columns["MaKhach"].DisplayIndex = 0;
                    }
                    if (dataGridView.Columns["TongTien"] != null)
                    {
                        dataGridView.Columns["TongTien"].DisplayIndex = 1;
                    }
                }
                else
                {
                    // todo: clear
                }
                dataGridView.ClearSelection();
                dataGridView.CurrentCell = null;
            }
        }