private void btnThongKe_Click(object sender, EventArgs e)
 {
     if (rbtnNhanVienSapNghiHuu.Checked == true)
         dgrThongKeSinhNhat.DataSource = ThongKeDAO.ThongKeNghiHuu(DateTime.Now);
     else
         dgrThongKeSinhNhat.DataSource = ThongKeDAO.ThongKeNVMoi(DateTime.Now);
 }
Beispiel #2
0
        private void LayDuLieuVaoGridView()
        {
            ThongKeDAO thongKeDAO = new ThongKeDAO();

            GridView1.DataSource = thongKeDAO.ThongKeTrongNgay(DateTime.Now.ToShortDateString());
            GridView1.DataBind();
        }
Beispiel #3
0
        public void tongdoanhthutrongngay()
        {
            ThongKeDAO thongKeDAO = new ThongKeDAO();
            int        tongtien   = thongKeDAO.GetTongTienTrongNgay(DateTime.Now.ToShortDateString());

            lblTongSoTien.Text = "Tổng số doanh thu là: " + tongtien.ToString() + " đồng";
        }
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            int idnv  = (int)cboNhanVien.SelectedValue;
            int thang = cboThang.SelectedIndex + 1;

            list.DataSource = ThongKeDAO.LoadChamCong(idnv, thang);
        }
 public static string DemNhanKhauTamTru(string column, string gioiHan = "", string giaTri = "", bool coCuTru = true)
 {
     gioiHan = string.IsNullOrEmpty(gioiHan) ? "" : " AND TIMESTAMPDIFF(MONTH, nhankhautamtru.tungay, CURDATE())<=" + gioiHan;
     //" AND MONTH(DATEDIFF(CURDATE(), nhankhautamtru.tungay))<=" + gioiHan;
     //" AND MONTH(nhankhautamtru.tungay)=MONTH(DATE_SUB(CURDATE(), INTERVAL -" + gioiHan + " MONTH)) AND YEAR(nhankhautamtru.tungay)=YEAR(DATE_SUB(CURDATE(), INTERVAL -" + gioiHan + " MONTH))";
     return(ThongKeDAO.demNhanKhauTamTru(column, gioiHan, giaTri, coCuTru));
 }
Beispiel #6
0
        public JsonResult ThongKe()
        {
            //int today = DateTime.Today.Day;

            //int month = DateTime.Today.Month;
            //int year = DateTime.Today.Year;

            string tenthongke = "Tháng " + DateTime.Now.Month.ToString();

            string thoigian = DateTime.Now.ToString("MM/dd/yyyy");

            var    dao     = new HoaDonDAO();
            double tongthu = 0;

            tongthu = dao.GetHoaDon_TongGia_TrangThaiChua();

            var daothongke = new ThongKeDAO();
            int result     = daothongke.CreateThongKe(tenthongke, thoigian, tongthu);

            if (result != 0)
            {
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #7
0
        private void LayDuLieuVaoGridView2()
        {
            string     ngaybatdau  = txtSelectDateFirst.Text;
            string     ngayketthuc = txtSelectDateLast.Text;
            ThongKeDAO thongKeDAO  = new ThongKeDAO();

            GridView1.DataSource = thongKeDAO.ThongKeTuyChon(ngaybatdau, ngayketthuc);
            GridView1.DataBind();
        }
Beispiel #8
0
        public void tongdoanhthutuychon()
        {
            string     ngaybatdau  = txtSelectDateFirst.Text;
            string     ngayketthuc = txtSelectDateLast.Text;
            ThongKeDAO thongKeDAO  = new ThongKeDAO();
            int        tongtien    = thongKeDAO.GetTongTienTuyChon(ngaybatdau, ngayketthuc);

            lblTongSoTien.Text = "Tổng số doanh thu là: " + tongtien.ToString() + " đồng";
        }
Beispiel #9
0
 public ucThongKeLuotThueTheoGio()
 {
     InitializeComponent();
     chartThongKe.DataSource = ThongKeDAO.ThongKeLuotThueTheoGio(GlobalVar.dateFrom, GlobalVar.dateTo);
     chartThongKe.ChartAreas["ChartArea1"].AxisX.Title = "Giờ";
     chartThongKe.ChartAreas["ChartArea1"].AxisY.Title = "Lượt thuê";
     chartThongKe.Series["Lượt thuê"].XValueMember     = "hour";
     chartThongKe.Series["Lượt thuê"].YValueMembers    = "LuotThue";
     //chartThongKe.ChartAreas[0].AxisY.Maximum = 20;
     chartThongKe.ChartAreas[0].AxisY.Minimum = 0;
 }
 private void btnThongKeChucVu_Click(object sender, EventArgs e)
 {
     try
     {
         int idcv = (int)cboChucVu.SelectedValue;
         dgrThongKeSinhNhat.DataSource = ThongKeDAO.ThongKeNVTheoChucVu(idcv);
     }
     catch
     {
         return;
     }
 }
 private void btnThongKePhongBan_Click(object sender, EventArgs e)
 {
     try
     {
         int idpb = (int)cboPhongBan.SelectedValue;
         dgrThongKeSinhNhat.DataSource = ThongKeDAO.ThongKeNVTheoPhongBan(idpb);
     }
     catch
     {
         return;
     }
 }
Beispiel #12
0
 private void cboThongKe_Click(object sender, EventArgs e)
 {
     try
     {
         int thang = (int)cboThang.SelectedIndex + 1;
         dgrThongKeSinhNhat.DataSource = ThongKeDAO.ThongKeSinhNhat(thang);
     }
     catch
     {
         return;
     }
 }
 public ucTKDT_TheoLoaiPhong()
 {
     InitializeComponent();
     chartThongKe.DataSource = ThongKeDAO.ThongKeDoanhThuTheoLoaiPhong(GlobalVar.dateFrom, GlobalVar.dateTo);
     //chartThongKe.ChartAreas["ChartArea1"].AxisX.Title = "Loại phòng";
     //chartThongKe.ChartAreas["ChartArea1"].AxisY.Title = "VND";
     //chartThongKe.Series["Doanh Thu (VND)"]["PixelPointWidth"] = "30";
     //chartThongKe.Series["Doanh Thu (VND)"].IsValueShownAsLabel = true;
     chartThongKe.Series["Doanh Thu (VND)"].XValueMember  = "TenLoai";
     chartThongKe.Series["Doanh Thu (VND)"].YValueMembers = "DoanhThu";
     chartThongKe.Series[0].Label = "#VALX: #VALY (#PERCENT{P0})";
     //chartThongKe.Series[0].Label = "#VALX";
 }
 private void cboNhanVien_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         int idnv  = (int)cboNhanVien.SelectedValue;
         int thang = cboThang.SelectedIndex + 1;
         list.DataSource = ThongKeDAO.LoadChamCong(idnv, thang);
     }
     catch
     {
         return;
     }
 }
Beispiel #15
0
        public void ThongKe_SanPhamBanChay(ThongKeDate tkDate)
        {
            List <SanPhamBanChay> results = new ThongKeDAO().getSanPhamBanChay(tkDate);

            cbx_spbc_fromYear.Text  = tkDate.fromYear.ToString();
            cbx_spbc_fromMonth.Text = tkDate.fromMonth.ToString();
            cbx_spbc_toYear.Text    = tkDate.toYear.ToString();
            cbx_spbc_toMonth.Text   = tkDate.toMonth.ToString();
            dgv_spbc.DataSource     = results;

            //GridView gv_spbc = dgv_spbc.MainView as GridView;
            //for (int i = 0; i < results.Count(); i++)
            //{
            //    gv_spbc.SetRowCellValue(i, "STT", (i+1).ToString());
            //}
        }
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         int idcc = Convert.ToInt32(grvChamCong.GetFocusedDataRow()["CHAMCONGID"].ToString());
         int idnv = (int)cboNhanVien.SelectedValue;
         if (ThongKeDAO.DeleteChamCong(idcc) == 1)
         {
             MessageBox.Show("thành công");
         }
         else
         {
             MessageBox.Show("thất bại");
         }
         list.DataSource = ThongKeDAO.LoadChamCong(idnv, cboThang.SelectedIndex + 1);
     }
     catch
     {
         return;
     }
 }
 private void btnThem_Click(object sender, EventArgs e)
 {
     try
     {
         int      idnv = (int)cboNhanVien.SelectedValue;
         DateTime ngay = dtpNgay.DateTime;
         int      loai = cboLoai.SelectedIndex;
         if (ThongKeDAO.InsertChamCong(idnv, ngay, loai) == 1)
         {
             MessageBox.Show("Thành công");
         }
         else
         {
             MessageBox.Show("Thất bại");
         }
         list.DataSource = ThongKeDAO.LoadChamCong(idnv, cboThang.SelectedIndex + 1);
     }
     catch
     {
         return;
     }
 }
Beispiel #18
0
        public void ThongKe_TheoNam(ThongKeDate tkDate)
        {
            List <THONGKE> tkList = new ThongKeDAO().getThongKe(tkDate);

            for (int i = 1; i <= 12; i++)
            {
                DateTime from = new DateTime(tkDate.toYear, i, 1);
                DateTime to;
                if (i < 12)
                {
                    to = new DateTime(tkDate.toYear, i + 1, 1);
                }
                else
                {
                    to = new DateTime(tkDate.toYear + 1, 1, 1);
                }
                int doanhthu = tkList.Where(p => p.NGAY >= from && p.NGAY < to).Select(p => p.DOANHTHU).ToList().Sum();
                int loinhuan = tkList.Where(p => p.NGAY >= from && p.NGAY < to).Select(p => p.LOINHUAN).ToList().Sum();
                //this.Controls["txt_dt" + i].Text = doanhthu.ToString();
                //this.Controls["txt_ln" + i].Text = loinhuan.ToString();
                this.Controls.Find("txt_dt" + i, true).FirstOrDefault().Text = string.Format("{0:0,0} VNĐ", doanhthu);
                this.Controls.Find("txt_ln" + i, true).FirstOrDefault().Text = string.Format("{0:0,0} VNĐ", loinhuan);
            }
        }
Beispiel #19
0
 public static double SumSL_theongay(PhieuNhapDTO pn1, PhieuNhapDTO pn2)
 {
     return(ThongKeDAO.SumSL_theongay(pn1, pn2));
 }
Beispiel #20
0
        private void btnPhanTich_Click(object sender, EventArgs e)
        {
            if (cboNam.Text == "" || cboXuatNhap.Text == "")
            {
                MessageBox.Show("Mời bạn nhập đủ thông tin");
                return;
            }
            chartThongKe.Series.Clear();
            var series = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name              = "Thang",
                Color             = Color.Green,
                IsVisibleInLegend = true,
                IsXValueIndexed   = true,
                ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column
            };

            chartThongKe.Series.Add(series);
            DataTable dt;

            string[] hang;
            if (cboXuatNhap.Text == "Xuất kho")
            {
                dt   = ThongKeDAO.TongTienXuatTungThang(int.Parse(cboNam.Text));
                hang = ThongKeDAO.HangHoaXuatNhieuItNhatNam(int.Parse(cboNam.Text)).Split('|');
            }
            else
            {
                dt   = ThongKeDAO.TongTienNhapTungThang(int.Parse(cboNam.Text));
                hang = ThongKeDAO.HangHoaNhapNhieuItNhatNam(int.Parse(cboNam.Text)).Split('|');
            }
            lblMatHangUaChuongNhat.Text = "Mặt hàng ưa chuộng nhất : " + hang[1];
            lblMatHangItQuanTam.Text    = "Mặt hàng ít được quan tâm nhất : " + hang[0];
            int[] thang = new int[13];
            int   sum   = 0;
            int   min   = int.MaxValue;
            int   max   = int.MinValue;
            int   imin  = 0;
            int   imax  = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int t     = int.Parse(dt.Rows[i][1].ToString());
                int index = int.Parse(dt.Rows[i][0].ToString());
                thang[index] = t;
                sum         += t;
                if (min > t)
                {
                    min  = t;
                    imin = index;
                }
                if (max < t)
                {
                    max  = t;
                    imax = index;
                }
            }
            for (int i = 0; i <= 12; i++)
            {
                series.Points.AddXY(i, thang[i]);
            }
            chartThongKe.Invalidate();
            lblTongTienNam.Text    += sum;
            lblThangNhieuNhat.Text += imax;
            lblThangThapNhat.Text  += imin;
        }
Beispiel #21
0
 public static DataTable Load_TheoNgayLapHD(HoaDonDTO hd1, HoaDonDTO hd2)
 {
     return(ThongKeDAO.Load_TheoNgayLapHD(hd1, hd2));
 }
Beispiel #22
0
 public static double SumGTHD()
 {
     return(ThongKeDAO.SumGTHD());
 }
Beispiel #23
0
 public static double SumGTHD_theongay(HoaDonDTO hd1, HoaDonDTO hd2)
 {
     return(ThongKeDAO.SumGTHD_theongay(hd1, hd2));
 }
 public static string Dem1bang(string column, string aTable, string aGioiHan)
 {
     return(ThongKeDAO.dem1Bang(column, aTable, aGioiHan));
 }
Beispiel #25
0
        public void BieuDo(ThongKeDate tkDate)
        {
            cbx_chart_fromMonth.Text = tkDate.fromMonth.ToString();
            cbx_chart_fromYear.Text  = tkDate.fromYear.ToString();
            cbx_chart_toMonth.Text   = tkDate.toMonth.ToString();
            cbx_chart_toYear.Text    = tkDate.toYear.ToString();

            List <THONGKE> tkList = new ThongKeDAO().getThongKe(tkDate);

            splitContainerControl2.Panel2.Controls.Clear();
            // Create a new chart.
            ChartControl lineChart = new ChartControl();
            // Create a line series.
            Series doanhthu_series = new Series("Doanh Thu", ViewType.Line);
            Series loinhuan_series = new Series("Lợi Nhuận", ViewType.Line);

            // Add points to it.
            for (int year = tkDate.fromYear; year <= tkDate.toYear; year++)
            {
                for (int month = 1; month <= 12; month++)
                {
                    DateTime from = new DateTime(tkDate.toYear, month, 1);
                    DateTime to;
                    if (month < 12)
                    {
                        to = new DateTime(tkDate.toYear, month + 1, 1);
                    }
                    else
                    {
                        to = new DateTime(tkDate.toYear + 1, 1, 1);
                    }
                    int doanhthu = tkList.Where(p => p.NGAY >= from && p.NGAY < to).Select(p => p.DOANHTHU).ToList().Sum();
                    int loinhuan = tkList.Where(p => p.NGAY >= from && p.NGAY < to).Select(p => p.LOINHUAN).ToList().Sum();
                    //this.Controls["txt_dt" + month].Text = doanhthu.ToString();
                    //this.Controls["txt_ln" + month].Text = loinhuan.ToString();
                    doanhthu_series.Points.Add(new SeriesPoint(new DateTime(year, month, 1), doanhthu));
                    loinhuan_series.Points.Add(new SeriesPoint(new DateTime(year, month, 1), loinhuan));
                }
            }

            // Add the series to the chart.
            lineChart.Series.Add(doanhthu_series);
            lineChart.Series.Add(loinhuan_series);

            // Set the numerical argument scale types for the series,
            // as it is qualitative, by default.
            doanhthu_series.ArgumentScaleType = ScaleType.DateTime;
            loinhuan_series.ArgumentScaleType = ScaleType.DateTime;

            // Access the view-type-specific options of the series.
            ((LineSeriesView)doanhthu_series.View).MarkerVisibility       = DevExpress.Utils.DefaultBoolean.True;
            ((LineSeriesView)doanhthu_series.View).LineMarkerOptions.Kind = MarkerKind.Circle;
            ((LineSeriesView)doanhthu_series.View).LineStyle.DashStyle    = DashStyle.Solid;
            ((LineSeriesView)loinhuan_series.View).MarkerVisibility       = DevExpress.Utils.DefaultBoolean.True;
            ((LineSeriesView)loinhuan_series.View).LineMarkerOptions.Kind = MarkerKind.Circle;
            ((LineSeriesView)loinhuan_series.View).LineStyle.DashStyle    = DashStyle.Solid;

            // Access the type-specific options of the diagram.
            ((XYDiagram)lineChart.Diagram).EnableAxisXZooming   = true;
            ((XYDiagram)lineChart.Diagram).EnableAxisXScrolling = true;

            // Set maximum and minimum range of AxisX
            ((XYDiagram)lineChart.Diagram).AxisX.WholeRange.MinValue = new DateTime(tkDate.fromYear, tkDate.fromMonth, 1);
            if (tkDate.toMonth < 12)
            {
                ((XYDiagram)lineChart.Diagram).AxisX.WholeRange.MaxValue = new DateTime(tkDate.toYear, tkDate.toMonth + 1, 1);
            }
            else
            {
                ((XYDiagram)lineChart.Diagram).AxisX.WholeRange.MaxValue = new DateTime(tkDate.toYear + 1, 1, 1);
            }

            // Set format of show value
            lineChart.SeriesTemplate.CrosshairLabelPattern         = "{S}: {V:F2}";
            ((XYDiagram)lineChart.Diagram).AxisY.Label.TextPattern = "{0:0,0} VNĐ";

            // Show the legend (if necessary).
            lineChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True;

            // Add a title to the chart (if necessary).
            lineChart.Titles.Add(new ChartTitle());
            lineChart.Titles[0].Text = "Biểu đồ thống kê";

            // Add the chart to the form.
            lineChart.Dock = DockStyle.Fill;
            splitContainerControl2.Panel2.Controls.Add(lineChart);
        }
Beispiel #26
0
 public static double SumCTPN_theoma(PhieuNhapDTO pn1)
 {
     return(ThongKeDAO.SumCTPN_TheoMa(pn1));
 }
 public static string DemNhanKhauThuongTru(string column, string gioiHan = "", string giaTri = "", bool coCuTru = true)
 {
     gioiHan = string.IsNullOrEmpty(gioiHan) ? "" : " AND TIMESTAMPDIFF(MONTH, sohokhau.ngaycap, CURDATE())<=" + gioiHan;
     return(ThongKeDAO.demNhanKhauThuongTru(column, gioiHan, giaTri, coCuTru));
 }
Beispiel #28
0
 public static double SumHD_theoma(HoaDonDTO hd)
 {
     return(ThongKeDAO.Sum_MaHD(hd));
 }
 public static string DemSoTamTru(string column, string gioiHan = "", bool coCuTru = true)
 {
     gioiHan = string.IsNullOrEmpty(gioiHan) ? "" : " AND TIMESTAMPDIFF(MONTH, sotamtru.ngaycap, CURDATE())<=" + gioiHan;
     return(ThongKeDAO.demSoTamTru(column, gioiHan, coCuTru));
 }
Beispiel #30
0
 public static double SumPDH_theoma(PhieuDatHangDTO pdh)
 {
     return(ThongKeDAO.SumPDH_TheoMa(pdh));
 }