예제 #1
0
        public void GetDonVi()
        {
            var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_donvi", new { option = 2 });

            cbo_donvi.Properties.DataSource    = dt;
            cbo_donvi.Properties.DisplayMember = "madonvi";
            cbo_donvi.Properties.ValueMember   = "madonvi";
        }
예제 #2
0
 private void btn_excel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     xtraSaveFileDialog1.Filter   = @"Excel files |*.xlsx";
     xtraSaveFileDialog1.FileName = "DanhMucTonKho_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss");
     if (xtraSaveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_tonkho", new { option = 2, thang = Convert.ToDateTime(txt_tungay.EditValue).Month, nam = Convert.ToDateTime(txt_tungay.EditValue).Year });
         ComicPro.ExportExcelFromDataTable(dt, xtraSaveFileDialog1.FileName);
     }
 }
예제 #3
0
 private void btn_excel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     xtraSaveFileDialog1.Filter   = @"Excel files |*.xlsx";
     xtraSaveFileDialog1.FileName = "DonVi_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss");
     if (xtraSaveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_donvi", new { option = 5 });
         ComicPro.ExportExcelFromDataTable(dt, xtraSaveFileDialog1.FileName);
     }
 }
예제 #4
0
        public void GetQuaTang()
        {
            var x  = grvViewQuaTang.FocusedRowHandle;
            var y  = grvViewQuaTang.TopRowIndex;
            var dt = ExecSQL.ExecProcedureDataAsDataTable("prottQuaTang", new { action = "GET_DATA" });

            grcQuaTang.DataSource           = dt;
            grvViewQuaTang.FocusedRowHandle = x;
            grvViewQuaTang.TopRowIndex      = y;
        }
예제 #5
0
        public void GetChiTietLichPhatHanh()
        {
            var x  = grvViewChiTietLichPhatHanh.FocusedRowHandle;
            var y  = grvViewChiTietLichPhatHanh.TopRowIndex;
            var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_ct_lichphathanh", new { malich = lbl_malich.Text });

            grcChiTietLichPhatHanh.DataSource = dt;

            grvViewChiTietLichPhatHanh.FocusedRowHandle = x;
            grvViewChiTietLichPhatHanh.TopRowIndex      = y;
        }
예제 #6
0
        private void mnu_giatri_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var tong = ExecSQL.ExecQuerySacalar("SELECT SUM(slnhap*dongia) AS tong FROM dbo.tbl_ct_phieunhapxuat");

            if (_flag == 1)
            {
                loaitruyen.Control.Controls[0].Controls.Clear();
                loaitruyen.Caption = @"Giá trị : " + string.Format("{0:#,##}", tong) + @" VND";
            }
            else if (_flag == 2)
            {
                giatri.Control.Controls[0].Controls.Clear();
                giatri.Caption = @"Giá trị : " + string.Format("{0:#,##}", tong) + @" VND";
            }

            var dataTable   = ExecSQL.ExecProcedureDataAsDataTable("pro_get_thongke_theothang");
            var chartGiaTri = new ChartControl();

            chartGiaTri.Dock       = DockStyle.Fill;
            chartGiaTri.DataSource = dataTable;

            Series seriesGiatri = new Series("Giá trị", ViewType.Line);

            seriesGiatri.LabelsVisibility = DefaultBoolean.True;

            // Add points to them, with their arguments different.
            foreach (DataRow dr in dataTable.Rows)
            {
                seriesGiatri.Points.Add(new SeriesPoint(dr["thangnam"], dr["thanhtien"]));
            }

            seriesGiatri.Label.TextPattern = "{V:#,##0}";

            chartGiaTri.Series.AddRange(new Series[] { seriesGiatri });
            chartGiaTri.Legend.Visibility = DefaultBoolean.True;

            Legend legend = chartGiaTri.Legend;

            // chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.Center
            legend.Margins.All         = 8;
            legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
            legend.AlignmentVertical   = LegendAlignmentVertical.Top;
            legend.Direction           = LegendDirection.LeftToRight;


            if (_flag == 1)
            {
                loaitruyen.Control.Controls[0].Controls.Add(chartGiaTri);
            }
            else if (_flag == 2)
            {
                giatri.Control.Controls[0].Controls.Add(chartGiaTri);
            }
        }
예제 #7
0
        public void GetLichPhatHanh()
        {
            var x  = grvViewLichPhatHanh.FocusedRowHandle;
            var y  = grvViewLichPhatHanh.TopRowIndex;
            var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_lichphathanh", new { action = "TATCA" });

            grcLichPhatHanh.DataSource = dt;
            lbl_malich.DataBindings.Clear();
            lbl_malich.DataBindings.Add("text", dt, "malich");
            grvViewLichPhatHanh.FocusedRowHandle = x;
            grvViewLichPhatHanh.TopRowIndex      = y;
        }
예제 #8
0
        private void btn_in_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ComicPro.DtReport = ExecSQL.ExecProcedureDataAsDataTable("pro_ct_phieunhapxuat", new { option = 1, maphieu = txt_maphieu.Text });
            if (ComicPro.DtReport.Rows.Count == 0)
            {
                Form1.Default.ShowMessageWarning("Không tìm thấy dữ liệu.");
                return;
            }
            ComicPro.Report = 4;
            FrmReport f = new FrmReport();

            f.Show();
        }
예제 #9
0
        private void btn_in_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ComicPro.DtReport = ExecSQL.ExecProcedureDataAsDataTable("pro_get_tonkho", new { option = 1, thang = Convert.ToDateTime(txt_tungay.EditValue).Month, nam = Convert.ToDateTime(txt_tungay.EditValue).Year });
            if (ComicPro.DtReport.Rows.Count == 0)
            {
                Form1.Default.ShowMessageWarning("Không tìm thấy dữ liệu.");
                return;
            }
            ComicPro.Report = 5;
            FrmReport f = new FrmReport();

            f.Show();
        }
예제 #10
0
        /// <summary>
        /// Create by Tri Minh, Date: 04/09/2020
        /// Function: Get phiếu nhập kho theo mã phiếu
        /// </summary>
        public void GetThongTin()
        {
            var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_phieunhapxuat", new { option = 3, maphieu = txt_maphieu.Text });

            if (dt.Rows.Count == 0)
            {
                return;
            }
            cbo_donvi.Text          = dt.Rows[0]["madonvi"].ToString();
            cbo_kho.EditValue       = dt.Rows[0]["makho"];
            cbo_loaiphieu.EditValue = dt.Rows[0]["idloaiphieunhapxuat"];
            txt_diengiai.Text       = dt.Rows[0]["diengiai"].ToString();
            txt_ngaynhap.EditValue  = dt.Rows[0]["ngaynhap"];
        }
예제 #11
0
        private void btn_danhsach_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (grvViewDanhMuc.SelectedRowsCount == 0)
            {
                Form1.Default.ShowMessageWarning("Bạn vui lòng chọn các mã truyện để thực hiện.");
                return;
            }
            var selectedRow = grvViewDanhMuc.GetSelectedRows();
            var strMatruyen = string.Join(",", from r in selectedRow where grvViewDanhMuc.IsDataRow(Convert.ToInt32(r)) select grvViewDanhMuc.GetRowCellValue(Convert.ToInt32(r), "matruyen"));

            ComicPro.DtReport = ExecSQL.ExecProcedureDataAsDataTable("pro_get_tentruyen", new { option = 2, matruyen = strMatruyen, duongdanfilehinh = "" });
            ComicPro.Report   = 2;
            FrmReport f = new FrmReport();

            f.Show();
        }
예제 #12
0
        private void btn_excel_ItemClick(object sender, ItemClickEventArgs e)
        {
            xtraSaveFileDialog1.Filter   = @"Excel files |*.xlsx";
            xtraSaveFileDialog1.FileName = "DanhMucTenTruyen_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss");
            if (xtraSaveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                var selectedRow  = grvViewDanhMuc.GetSelectedRows();
                var joinMaTruyen = string.Join(",",
                                               from r in selectedRow
                                               where grvViewDanhMuc.IsDataRow(Convert.ToInt32(r))
                                               select grvViewDanhMuc.GetRowCellValue(Convert.ToInt32(r), "matruyen"));

                var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_get_tentruyen", new { option = 3, matruyen = joinMaTruyen });
                ComicPro.ExportExcelFromDataTable(dt, xtraSaveFileDialog1.FileName);
            }
        }
예제 #13
0
        private void btn_xoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var i   = grvViewQuaTang.FocusedRowHandle;
            var dgr = HelperMessage.Instance.ShowMessageYesNo($"Bạn có muốn xóa tên quà tặng ({grvViewQuaTang.GetRowCellValue(i, "quatang")}) này không?", "Xác Nhận", SystemIcons.Question.ToBitmap());

            if (dgr != DialogResult.Yes)
            {
                return;
            }
            var dt = ExecSQL.ExecProcedureDataAsDataTable("prottQuaTang", new { action = "DELETE", maquatang = grvViewQuaTang.GetRowCellValue(i, "maquatang") });

            if (dt.Rows[0]["status"].ToString() == "NO")
            {
                XtraMessageBox.Show($"Tên quà tặng ({grvViewQuaTang.GetRowCellValue(i, "quatang")}) đã được sử dụng.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                GetQuaTang();
            }
        }
예제 #14
0
        private void UserGiaTri_Load(object sender, EventArgs e)
        {
            var tong = ExecSQL.ExecQuerySacalar("SELECT SUM(slnhap*dongia) AS tong FROM dbo.tbl_ct_phieunhapxuat");

            Text = @"Giá trị: " + string.Format("{0:#,##}", tong) + @" VND";
            var chartControl1 = new ChartControl();

            chartControl1.Dock = DockStyle.Fill;
            panelControl.Controls.Add(chartControl1);
            Task.Factory.StartNew(() =>
            {
                var dataTable            = ExecSQL.ExecProcedureDataAsDataTable("pro_get_thongke_theothang");
                chartControl1.DataSource = dataTable;
                chartControl1.BeginInvoke(new Action(() =>
                {
                    Series seriesGiatri           = new Series("Giá trị", ViewType.Line);
                    seriesGiatri.LabelsVisibility = DefaultBoolean.True;

                    foreach (DataRow dr in dataTable.Rows)
                    {
                        seriesGiatri.Points.Add(new SeriesPoint(dr["thangnam"], dr["thanhtien"]));
                    }

                    seriesGiatri.Label.TextPattern = "{V:#,##0}";

                    chartControl1.Series.AddRange(new[] { seriesGiatri });
                    chartControl1.Legend.Visibility = DefaultBoolean.True;

                    Legend legend = chartControl1.Legend;
                    // chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.Center
                    legend.Margins.All         = 8;
                    legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
                    legend.AlignmentVertical   = LegendAlignmentVertical.Top;
                    legend.Direction           = LegendDirection.LeftToRight;
                }));
            });
        }
예제 #15
0
        private void btn_excel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            xtraSaveFileDialog1.Filter   = @"Excel files |*.xlsx";
            xtraSaveFileDialog1.FileName = "PhieuNhap_" + DateTime.Now.ToString("dd-MM-yyyy hh-mm-ss");
            if (xtraTabControl1.SelectedTabPage == tab_phieunhap)
            {
                if (gridView1.SelectedRowsCount == 0)
                {
                    Form1.Default.ShowMessageSuccess("Bạn vui lòng chọn các mã phiếu để thực hiện.");
                    return;
                }
                if (xtraSaveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    var selectedRow = gridView1.GetSelectedRows();
                    var joinMaPhieu = string.Join(",", from r in selectedRow where gridView1.IsDataRow(Convert.ToInt32(r)) select gridView1.GetRowCellValue(Convert.ToInt32(r), "maphieu"));

                    var dt = ExecSQL.ExecProcedureDataAsDataTable("pro_ct_phieunhapxuat", new { option = 6, maphieu = joinMaPhieu });
                    ComicPro.ExportExcelFromDataTable(dt, xtraSaveFileDialog1.FileName);
                }
            }
            else
            {
                if (gridView6.SelectedRowsCount == 0)
                {
                    Form1.Default.ShowMessageSuccess("Bạn vui lòng chọn các mã phiếu để thực hiện.");
                    return;
                }
                if (xtraSaveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    var selectedRow = gridView6.GetSelectedRows();
                    var joinId      = string.Join(",", from r in selectedRow where gridView6.IsDataRow(Convert.ToInt32(r)) select gridView6.GetRowCellValue(Convert.ToInt32(r), "id"));
                    var dt          = ExecSQL.ExecProcedureDataAsDataTable("pro_ct_phieunhapxuat", new { option = 7, id = joinId });
                    ComicPro.ExportExcelFromDataTable(dt, xtraSaveFileDialog1.FileName);
                }
            }
        }