コード例 #1
0
        public void loadpnk(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string sql)
        {
            view.OptionsView.ColumnAutoWidth = true;
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số chứng từ", Type.GetType("System.String"));
            dt.Columns.Add("Ngày chứng từ", Type.GetType("System.DateTime"));
            dt.Columns.Add("Ngày hạch toán", Type.GetType("System.DateTime"));
            dt.Columns.Add("Nhà cung cấp", Type.GetType("System.String"));
            dt.Columns.Add("Lý do", Type.GetType("System.String"));
            dt.Columns.Add("Hóa đơn", Type.GetType("System.Boolean"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));
            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                dr[4] = temp.Rows[i][4].ToString();
                dr[5] = temp.Rows[i][5].ToString();
                if (temp.Rows[i][6].ToString() == "True")
                {
                    dr[6] = "True";
                }
                else
                {
                    dr[6] = "False";
                }

                dr[7] = temp.Rows[i][7].ToString();
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày chứng từ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày chứng từ"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày chứng từ"].Width = 100;
            view.Columns["Ngày chứng từ"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatType             = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatString           = "dd/MM/yyyy";
            view.Columns["Ngày hạch toán"].Width = 100;
            view.Columns["Ngày hạch toán"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.OptionsView.ShowFooter               = true;
            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Hóa đơn"].Width     = 100;
            view.Columns["Mã kho"].GroupIndex = 0;
            view.ExpandAllGroups();
        }
コード例 #2
0
        public void loadchinhsach(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string ngaychungtu)
        {
            string sql = "select PolicyID as 'ID',PolicyCode as 'Chính sách',b.InventoryItemName+'-'+a.InventoryItemCode as 'Nhà cung cấp',PolicyName as 'Nội dung',BeginDate as 'Ngày bắt đầu', EndDate as 'Ngày kết thúc',BeginQuantity as 'Từ sản lượng', EndQuantity as 'Đến sản lượng', Unit as 'Đơn vị tính', Discount as 'Chiết khấu', PolicyParent as 'Nhóm',Species as 'Theo',UserName as 'Người lập' from Policy a, InventoryItemSub b where substring(a.InventoryItemCode,1,3)=b.InventoryCategoryCode and substring(a.InventoryItemCode,5,2)=b.InventoryItemCode and (YEAR(BeginDate)='" + DateTime.Parse(ngaychungtu).Year + "' or YEAR(EndDate)='" + DateTime.Parse(ngaychungtu).Year + "')";

            view.Columns.Clear();
            DataTable temp = gen.GetTable(sql);

            lvpq.DataSource = temp;
            view.OptionsView.ShowGroupPanel = true;
            view.OptionsBehavior.Editable   = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày bắt đầu"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày bắt đầu"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày bắt đầu"].Width = 100;
            view.Columns["Ngày bắt đầu"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày kết thúc"].DisplayFormat.FormatType             = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày kết thúc"].DisplayFormat.FormatString           = "dd/MM/yyyy";
            view.Columns["Ngày kết thúc"].Width = 100;
            view.Columns["Ngày kết thúc"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Chiết khấu"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Chiết khấu"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Từ sản lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Từ sản lượng"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Đến sản lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Đến sản lượng"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Theo"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Theo"].Width = 50;

            view.OptionsView.ShowFooter = true;

            view.Columns["Chính sách"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Chính sách"].Width = 50;

            view.Columns["Nhóm"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Nhóm"].Width = 50;

            view.Columns["Theo"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Theo"].Width = 50;

            view.Columns["Nhà cung cấp"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Nhà cung cấp"].Width = 50;

            view.Columns["Người lập"].Width   = 100;
            view.Columns["Đơn vị tính"].Width = 100;

            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Nhà cung cấp"].GroupIndex = 0;
            view.Columns["Nhóm"].GroupIndex         = 1;
            view.ExpandAllGroups();
        }
コード例 #3
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            DataTable myTable = new DataTable();

            myTable.Columns.Add("CategoryID", typeof(int));
            myTable.Columns.Add("Selected", typeof(bool));
            myTable.Columns.Add("ItemDescription", typeof(string));

            myTable.Rows.Add(new object[] { 1, false, "A" });
            myTable.Rows.Add(new object[] { 1, false, "B" });
            myTable.Rows.Add(new object[] { 2, false, "C" });
            myTable.Rows.Add(new object[] { 2, false, "D" });
            gridControl1.DataSource = myTable;
            gridView1.ExpandAllGroups();
        }
コード例 #4
0
        public void loadpnhbtl(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string sql)
        {
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số chứng từ", Type.GetType("System.String"));
            dt.Columns.Add("Ngày chứng từ", Type.GetType("System.DateTime"));
            dt.Columns.Add("Ngày hạch toán", Type.GetType("System.DateTime"));
            dt.Columns.Add("Đối tượng", Type.GetType("System.String"));
            dt.Columns.Add("Người nộp", Type.GetType("System.String"));
            dt.Columns.Add("Lý do nộp", Type.GetType("System.String"));
            dt.Columns.Add("Số tiền", Type.GetType("System.Double"));
            dt.Columns.Add("Hủy", Type.GetType("System.Boolean"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][4].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                dr[4] = temp.Rows[i][6].ToString();
                dr[5] = temp.Rows[i][8].ToString();
                dr[6] = temp.Rows[i][9].ToString();

                if (temp.Rows[i][31].ToString() == "True")
                {
                    dr[7] = "0";
                    dr[8] = "True";
                }
                else
                {
                    if (temp.Rows[i][32].ToString() != "" && temp.Rows[i][32].ToString() != "0")
                    {
                        dr[7] = Double.Parse(temp.Rows[i][22].ToString()) + Double.Parse(temp.Rows[i][24].ToString());
                    }
                    else
                    {
                        dr[7] = temp.Rows[i][22].ToString();
                    }
                    dr[8] = "False";
                }
                string makho = gen.GetString("select StockCode from Stock where StockID='" + temp.Rows[i][25].ToString() + "'");
                dr[9] = makho;

                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày chứng từ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày chứng từ"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày chứng từ"].Width = 100;
            view.Columns["Ngày chứng từ"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatType             = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatString           = "dd/MM/yyyy";
            view.Columns["Ngày hạch toán"].Width = 100;
            view.Columns["Ngày hạch toán"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Số tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Số tiền"].DisplayFormat.FormatString = "{0:n0}";

            view.OptionsView.ShowFooter = true;
            view.Columns["Số tiền"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Số tiền"].SummaryItem.DisplayFormat = "{0:n0}";

            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";
            view.Columns["Hủy"].Width = 100;

            view.Columns["Mã kho"].GroupIndex = 0;
            view.ExpandAllGroups();
        }
コード例 #5
0
        public void loadhdbh(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string sql)
        {
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số chứng từ", Type.GetType("System.String"));
            dt.Columns.Add("Đối tượng", Type.GetType("System.String"));
            dt.Columns.Add("Ngày chứng từ", Type.GetType("System.DateTime"));
            dt.Columns.Add("Ngày hóa đơn", Type.GetType("System.DateTime"));
            dt.Columns.Add("Hạn nợ", Type.GetType("System.Double"));
            dt.Columns.Add("Hóa đơn", Type.GetType("System.String"));
            dt.Columns.Add("Thuế", Type.GetType("System.Double"));
            dt.Columns.Add("Cộng tiền hàng", Type.GetType("System.Double"));
            dt.Columns.Add("Tiền thuế", Type.GetType("System.Double"));
            dt.Columns.Add("Thành tiền", Type.GetType("System.Double"));
            dt.Columns.Add("Hủy", Type.GetType("System.Boolean"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));
            dt.Columns.Add("Mã kho xuất", Type.GetType("System.String"));
            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][5].ToString();
                dr[2] = temp.Rows[i][8].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                dr[4] = temp.Rows[i][14].ToString();
                dr[5] = temp.Rows[i][64].ToString();
                dr[6] = temp.Rows[i][69].ToString();
                dr[9] = Double.Parse(temp.Rows[i][42].ToString());

                if (temp.Rows[i][66].ToString() != "")
                {
                    dr[7] = Double.Parse(temp.Rows[i][66].ToString());
                }
                dr[8]  = Double.Parse(temp.Rows[i][38].ToString()) + Double.Parse(temp.Rows[i][46].ToString());
                dr[10] = (Double.Parse(temp.Rows[i][38].ToString()) + Double.Parse(temp.Rows[i][46].ToString()) + Double.Parse(temp.Rows[i][42].ToString())).ToString();

                dr[11] = "False";
                if (temp.Rows[i][63].ToString() == "True")
                {
                    dr[11] = "True";
                }
                try
                {
                    dr[12] = gen.GetString("select StockCode from Stock where StockID='" + temp.Rows[i][59].ToString() + "'");
                }
                catch { }
                try
                {
                    dr[13] = gen.GetString("select StockCode from Stock where StockID='" + temp.Rows[i][65].ToString() + "'");
                }
                catch { }
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày chứng từ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày chứng từ"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày chứng từ"].Width = 100;
            view.Columns["Ngày chứng từ"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày hóa đơn"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày hóa đơn"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày hóa đơn"].Width = 100;
            view.Columns["Ngày hóa đơn"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Thành tiền"].DisplayFormat.FormatType           = DevExpress.Utils.FormatType.Custom;
            view.Columns["Thành tiền"].DisplayFormat.FormatString         = "{0:n0}";
            view.Columns["Thành tiền"].SummaryItem.SummaryType            = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Thành tiền"].SummaryItem.DisplayFormat          = "{0:n0}";
            view.Columns["Hóa đơn"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Hóa đơn"].Width = 100;
            view.OptionsView.ShowFooter   = true;
            view.Columns["Tiền thuế"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Tiền thuế"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["Tiền thuế"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Tiền thuế"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Hạn nợ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Hạn nợ"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Hạn nợ"].Width = 50;
            view.Columns["Thuế"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Thuế"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Thuế"].Width = 50;

            view.Columns["Cộng tiền hàng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Cộng tiền hàng"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Cộng tiền hàng"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Cộng tiền hàng"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";
            view.Columns["Hủy"].Width = 100;
            view.Columns["Mã kho xuất"].GroupIndex = 0;
            view.Columns["Mã kho"].GroupIndex      = 1;

            view.ExpandAllGroups();
        }
コード例 #6
0
        public void loadhd(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string userid, string ngaychungtu)
        {
            string    sql  = "select ContractID,ContractCode,ContractName,c.AccountingObjectName,a.SignedDate,a.EffectiveDate,a.DebtLimit,a.LimitDate,a.NoPay,a.NoContract,a.Closed,c.AccountingObjectCode,Saved,b.StockCode+' - '+StockName,a.Inactive,a.DebtLimitMax from contractB a, Stock b, AccountingObject c where No=0 and a.StockID=b.StockID and a.AccountingObjectID=c.AccountingObjectID and b.StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') and Year(a.EffectiveDate)>= '" + DateTime.Parse(ngaychungtu).Year + "' order by a.ContractName,a.ContractCode";
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số hợp đồng", Type.GetType("System.String"));
            dt.Columns.Add("Loại hợp đồng", Type.GetType("System.String"));
            dt.Columns.Add("Khách hàng", Type.GetType("System.String"));
            dt.Columns.Add("Ngày ký", Type.GetType("System.DateTime"));
            dt.Columns.Add("Ngày hết hạn", Type.GetType("System.DateTime"));
            dt.Columns.Add("Hạn mức nợ", Type.GetType("System.Double"));
            dt.Columns.Add("Hạn mức tối đa", Type.GetType("System.Double"));
            dt.Columns.Add("Hạn nợ", Type.GetType("System.Double"));
            dt.Columns.Add("Hình thức", Type.GetType("System.String"));
            dt.Columns.Add("Hợp đồng", Type.GetType("System.String"));
            dt.Columns.Add("Mã khách", Type.GetType("System.String"));
            dt.Columns.Add("Nơi lưu", Type.GetType("System.String"));
            dt.Columns.Add("Đơn vị", Type.GetType("System.String"));
            dt.Columns.Add("Thanh lý", Type.GetType("System.Boolean"));
            dt.Columns.Add("Hiệu lực", Type.GetType("System.Boolean"));

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                dr[4] = temp.Rows[i][4].ToString();
                dr[5] = temp.Rows[i][5].ToString();
                dr[6] = Double.Parse(temp.Rows[i][6].ToString());
                dr[7] = Double.Parse(temp.Rows[i][15].ToString());
                dr[8] = Double.Parse(temp.Rows[i][7].ToString());

                if (temp.Rows[i][8].ToString() == "1")
                {
                    dr[9] = "Tiền mặt";
                }
                else if (temp.Rows[i][8].ToString() == "2")
                {
                    dr[9] = "Tín chấp";
                }
                else if (temp.Rows[i][8].ToString() == "3")
                {
                    dr[9] = "Bảo lãnh";
                }

                if (temp.Rows[i][9].ToString() == "1")
                {
                    dr[10] = "Nguyên tắc";
                }
                else if (temp.Rows[i][9].ToString() == "2")
                {
                    dr[10] = "Đơn hàng";
                }
                dr[11] = temp.Rows[i][11].ToString();
                dr[12] = temp.Rows[i][12].ToString();
                dr[13] = temp.Rows[i][13].ToString();
                dr[14] = "False";
                if (temp.Rows[i][10].ToString() == "1")
                {
                    dr[14] = "True";
                }
                dr[15] = "False";
                if (temp.Rows[i][14].ToString() == "1")
                {
                    dr[15] = "True";
                }
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày ký"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày ký"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày ký"].Width = 100;
            view.Columns["Ngày ký"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày hết hạn"].DisplayFormat.FormatType         = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày hết hạn"].DisplayFormat.FormatString       = "dd/MM/yyyy";
            view.Columns["Ngày hết hạn"].Width = 100;
            view.Columns["Ngày hết hạn"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Hạn mức nợ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Hạn mức nợ"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Hạn mức tối đa"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Hạn mức tối đa"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Hạn mức tối đa"].AppearanceCell.BackColor  = System.Drawing.Color.Salmon;
            view.Columns["Hạn mức tối đa"].AppearanceCell.BackColor2 = System.Drawing.Color.SeaShell;

            view.OptionsView.ShowFooter = true;
            view.Columns["Hình thức"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Hợp đồng"].AppearanceCell.TextOptions.HAlignment  = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Mã khách"].AppearanceCell.TextOptions.HAlignment  = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Nơi lưu"].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Hạn nợ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Hạn nợ"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Hạn nợ"].Width = 50;

            view.Columns["Khách hàng"].Width = 250;
            view.Columns["Thanh lý"].Width   = 50;
            view.Columns["Hiệu lực"].Width   = 50;

            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";
            view.Columns["Đơn vị"].GroupIndex         = 0;
            view.ExpandAllGroups();
            view.Columns["Số hợp đồng"].BestFit();
        }
コード例 #7
0
        public void loadtanggiam(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string sql)
        {
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Code", Type.GetType("System.String"));
            dt.Columns.Add("Diễn giải", Type.GetType("System.String"));
            dt.Columns.Add("Thời gian", Type.GetType("System.DateTime"));
            dt.Columns.Add("Tăng giảm phí", Type.GetType("System.Double"));
            dt.Columns.Add("Chi phí khác", Type.GetType("System.Double"));
            dt.Columns.Add("Ghi chú", Type.GetType("System.String"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                if (temp.Rows[i][7].ToString() == "0")
                {
                    dr[4] = temp.Rows[i][4].ToString();
                }
                else
                {
                    dr[5] = temp.Rows[i][4].ToString();
                }
                dr[6] = temp.Rows[i][5].ToString();
                dr[7] = temp.Rows[i][6].ToString();
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;

            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;
            view.Columns[1].Visible = false;

            view.Columns["Thời gian"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Thời gian"].DisplayFormat.FormatString = "MM/yyyy";
            view.Columns["Thời gian"].Width = 100;
            view.Columns["Thời gian"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Tăng giảm phí"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Tăng giảm phí"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Tăng giảm phí"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Tăng giảm phí"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Chi phí khác"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Chi phí khác"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Chi phí khác"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Chi phí khác"].SummaryItem.DisplayFormat  = "{0:n0}";


            view.OptionsView.ShowFooter = true;

            GridGroupSummaryItem item = new GridGroupSummaryItem();

            item.FieldName     = "Tăng giảm phí";
            item.DisplayFormat = "{0:n0}";
            item.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item);
            item.ShowInGroupColumnFooter = view.Columns["Tăng giảm phí"];

            GridGroupSummaryItem item1 = new GridGroupSummaryItem();

            item1.FieldName     = "Chi phí khác";
            item1.DisplayFormat = "{0:n0}";
            item1.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item1);
            item1.ShowInGroupColumnFooter = view.Columns["Chi phí khác"];

            view.Columns[2].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[2].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Mã kho"].GroupIndex = 0;
            view.ExpandAllGroups();
            view.Columns["Tăng giảm phí"].Width = 200;
            view.Columns["Chi phí khác"].Width  = 200;
            view.Columns["Diễn giải"].BestFit();
        }
コード例 #8
0
        public void loadkhauhao(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string sql)
        {
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Code", Type.GetType("System.String"));
            dt.Columns.Add("Tên tài sản", Type.GetType("System.String"));
            dt.Columns.Add("Sử dụng", Type.GetType("System.DateTime"));
            dt.Columns.Add("Thời gian", Type.GetType("System.Double"));
            dt.Columns.Add("Hết khấu hao", Type.GetType("System.DateTime"));
            dt.Columns.Add("Nguyên giá", Type.GetType("System.Double"));
            dt.Columns.Add("Khấu hao", Type.GetType("System.Double"));
            dt.Columns.Add("Giá trị còn lại", Type.GetType("System.Double"));
            dt.Columns.Add("Còn lại", Type.GetType("System.Double"));
            dt.Columns.Add("Thuế suất", Type.GetType("System.String"));
            dt.Columns.Add("Lãi vay", Type.GetType("System.Double"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));
            dt.Columns.Add("ID kho", Type.GetType("System.String"));
            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                if (temp.Rows[i][3].ToString() != "")
                {
                    dr[3] = temp.Rows[i][3].ToString();
                }
                if (temp.Rows[i][4].ToString() != "")
                {
                    dr[4] = temp.Rows[i][4].ToString();
                }
                if (temp.Rows[i][5].ToString() != "")
                {
                    dr[5] = temp.Rows[i][5].ToString();
                }
                dr[6] = temp.Rows[i][6].ToString();
                if (temp.Rows[i][5].ToString() != "")
                {
                    dr[7] = temp.Rows[i][7].ToString();
                }
                if (temp.Rows[i][8].ToString() != "")
                {
                    dr[8] = temp.Rows[i][8].ToString();
                }
                if (temp.Rows[i][9].ToString() != "")
                {
                    dr[9] = temp.Rows[i][9].ToString();
                }
                if (temp.Rows[i][10].ToString() != "")
                {
                    dr[10] = Double.Parse(temp.Rows[i][10].ToString()) + "%";
                }
                if (temp.Rows[i][11].ToString() != "")
                {
                    dr[11] = temp.Rows[i][11].ToString();
                }
                dr[12] = temp.Rows[i][12].ToString();
                dr[13] = temp.Rows[i][13].ToString();
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;

            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle      = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible  = false;
            view.Columns[1].Visible  = false;
            view.Columns[13].Visible = false;

            view.Columns["Sử dụng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Sử dụng"].DisplayFormat.FormatString = "MM/yyyy";
            view.Columns["Sử dụng"].Width = 100;
            view.Columns["Sử dụng"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Thời gian"].DisplayFormat.FormatType              = DevExpress.Utils.FormatType.Custom;
            view.Columns["Thời gian"].DisplayFormat.FormatString            = "{0:n0}";
            view.Columns["Thời gian"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Thời gian"].Width = 100;

            view.Columns["Hết khấu hao"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Hết khấu hao"].DisplayFormat.FormatString = "MM/yyyy";
            view.Columns["Hết khấu hao"].Width = 100;
            view.Columns["Hết khấu hao"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Nguyên giá"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Nguyên giá"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Nguyên giá"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Nguyên giá"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Khấu hao"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Khấu hao"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Khấu hao"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Khấu hao"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Giá trị còn lại"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Giá trị còn lại"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Giá trị còn lại"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Giá trị còn lại"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Còn lại"].DisplayFormat.FormatType              = DevExpress.Utils.FormatType.Custom;
            view.Columns["Còn lại"].DisplayFormat.FormatString            = "{0:n0}";
            view.Columns["Còn lại"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Còn lại"].Width = 100;

            view.Columns["Thuế suất"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Thuế suất"].Width = 100;

            view.Columns["Lãi vay"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Lãi vay"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Lãi vay"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Lãi vay"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.OptionsView.ShowFooter = true;

            GridGroupSummaryItem item = new GridGroupSummaryItem();

            item.FieldName     = "Nguyên giá";
            item.DisplayFormat = "{0:n0}";
            item.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item);
            item.ShowInGroupColumnFooter = view.Columns["Nguyên giá"];

            GridGroupSummaryItem item1 = new GridGroupSummaryItem();

            item1.FieldName     = "Khấu hao";
            item1.DisplayFormat = "{0:n0}";
            item1.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item1);
            item1.ShowInGroupColumnFooter = view.Columns["Khấu hao"];

            GridGroupSummaryItem item2 = new GridGroupSummaryItem();

            item2.FieldName     = "Giá trị còn lại";
            item2.DisplayFormat = "{0:n0}";
            item2.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item2);
            item2.ShowInGroupColumnFooter = view.Columns["Giá trị còn lại"];

            GridGroupSummaryItem item3 = new GridGroupSummaryItem();

            item3.FieldName     = "Lãi vay";
            item3.DisplayFormat = "{0:n0}";
            item3.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item3);
            item3.ShowInGroupColumnFooter = view.Columns["Lãi vay"];


            view.Columns[2].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[2].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Mã kho"].GroupIndex = 0;
            view.ExpandAllGroups();
            view.Columns["Tên tài sản"].BestFit();
        }
コード例 #9
0
        public void loadddh(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string ngaychungtu, string userid)
        {
            //string sql = "select RefID,RefNo,RefDate,PostedDate,AccountingObjectName,JournalMemo,StockCode,TotalAmount,TotalAmountOC,TotalAmount+TotalAmountOC,RefType,Cancel,IsImportPurchase,IsExport,CustomField2 from DDHNCC a, Stock b where a.StockID=b.StockID and Month(RefDate)='" + DateTime.Parse(ngaychungtu).Month.ToString() + "' and  Year(RefDate)='" + DateTime.Parse(ngaychungtu).Year.ToString() + "' and b.StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') order by RefNo";
            string sql = "select a.*,b.RefNo from (select RefID,RefNo,RefDate,PostedDate,AccountingObjectName,JournalMemo,StockCode,TotalAmount,TotalAmountOC,TotalAmount+TotalAmountOC as tien,RefType,Cancel,IsImportPurchase,IsExport,CustomField2 from DDHNCC a, Stock b where a.StockID=b.StockID and Month(RefDate)='" + DateTime.Parse(ngaychungtu).Month.ToString() + "' and  Year(RefDate)='" + DateTime.Parse(ngaychungtu).Year.ToString() + "' and b.StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "')) a left join INOutward b on a.RefNo=b.CustomField5 order by a.RefNo";

            view.OptionsView.ColumnAutoWidth = true;
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số chứng từ", Type.GetType("System.String"));
            dt.Columns.Add("Ngày chứng từ", Type.GetType("System.DateTime"));
            dt.Columns.Add("Ngày hạch toán", Type.GetType("System.DateTime"));
            dt.Columns.Add("Nhà cung cấp", Type.GetType("System.String"));
            dt.Columns.Add("Lý do", Type.GetType("System.String"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));
            dt.Columns.Add("Tiền hàng", Type.GetType("System.Double"));
            dt.Columns.Add("Tiền thuế", Type.GetType("System.Double"));
            dt.Columns.Add("Thành tiền", Type.GetType("System.Double"));
            dt.Columns.Add("Loại hàng", Type.GetType("System.String"));
            dt.Columns.Add("Thanh toán", Type.GetType("System.String"));
            dt.Columns.Add("Duyệt", Type.GetType("System.Boolean"));
            dt.Columns.Add("Hóa đơn", Type.GetType("System.Boolean"));
            dt.Columns.Add("Phiếu xuất", Type.GetType("System.String"));
            dt.Columns.Add("Người duyệt", Type.GetType("System.String"));

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                dr[4] = temp.Rows[i][4].ToString();
                dr[5] = temp.Rows[i][5].ToString();
                dr[6] = temp.Rows[i][6].ToString();

                dr[7] = temp.Rows[i][7].ToString();
                dr[8] = temp.Rows[i][8].ToString();
                dr[9] = temp.Rows[i][9].ToString();

                if (temp.Rows[i][10].ToString() == "0")
                {
                    dr[10] = "Hàng gửi";
                }
                else if (temp.Rows[i][10].ToString() == "1")
                {
                    dr[10] = "Nhập kho";
                }
                else if (temp.Rows[i][10].ToString() == "2")
                {
                    dr[10] = "Giao thẳng";
                }
                else if (temp.Rows[i][10].ToString() == "3")
                {
                    dr[10] = "Cắt hàng";
                }

                if (temp.Rows[i][11].ToString() == "True")
                {
                    dr[11] = "Trả ngay";
                }
                else
                {
                    dr[11] = "Trả chậm";
                }

                if (temp.Rows[i][12].ToString() == "True")
                {
                    dr[12] = "True";
                }
                else
                {
                    dr[12] = "False";
                }

                if (temp.Rows[i][13].ToString() == "True")
                {
                    dr[13] = "True";
                }
                else
                {
                    dr[13] = "False";
                }

                dr[14] = temp.Rows[i][15].ToString();
                dr[15] = temp.Rows[i][14].ToString();
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày chứng từ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày chứng từ"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày chứng từ"].Width = 100;
            view.Columns["Ngày chứng từ"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatType             = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatString           = "dd/MM/yyyy";
            view.Columns["Ngày hạch toán"].Width = 100;
            view.Columns["Ngày hạch toán"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Tiền hàng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Tiền hàng"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Tiền hàng"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Tiền hàng"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Tiền thuế"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Tiền thuế"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Tiền thuế"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Tiền thuế"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Thành tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Thành tiền"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Thành tiền"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Thành tiền"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Loại hàng"].AppearanceCell.TextOptions.HAlignment  = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Thanh toán"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.OptionsView.ShowFooter               = true;
            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Ngày hạch toán"].Caption = "Dự kiến nhận";

            view.Columns["Số chứng từ"].Width = 150;
            view.Columns["Loại hàng"].Width   = 100;
            view.Columns["Thanh toán"].Width  = 100;
            view.Columns["Duyệt"].Width       = 50;
            view.Columns["Hóa đơn"].Width     = 100;
            view.Columns["Mã kho"].GroupIndex = 0;
            view.ExpandAllGroups();
        }
コード例 #10
0
        public void loadsanluongtheoquy(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string branchid, string ngaychungtu, string tsbt)
        {
            view.OptionsView.ColumnAutoWidth = true;
            DataTable dt   = new DataTable();
            DataTable temp = gen.GetTable("bangketonghopbaocaonhanh '" + branchid + "','" + ngaychungtu + "','" + ngaychungtu + "','sanluongtheoquy'");

            view.Columns.Clear();

            dt.Columns.Add("Mã loại", Type.GetType("System.String"));
            dt.Columns.Add("Tên loại", Type.GetType("System.String"));
            dt.Columns.Add("Mặt hàng", Type.GetType("System.String"));
            dt.Columns.Add("Quý 01", Type.GetType("System.Double"));
            dt.Columns.Add("Quý 02", Type.GetType("System.Double"));
            dt.Columns.Add("Quý 03", Type.GetType("System.Double"));
            dt.Columns.Add("Quý 04", Type.GetType("System.Double"));

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();

                if (Double.Parse(temp.Rows[i][3].ToString()) != 0)
                {
                    dr[3] = temp.Rows[i][3].ToString();
                }
                if (Double.Parse(temp.Rows[i][4].ToString()) != 0)
                {
                    dr[4] = temp.Rows[i][4].ToString();
                }
                if (Double.Parse(temp.Rows[i][5].ToString()) != 0)
                {
                    dr[5] = temp.Rows[i][5].ToString();
                }
                if (Double.Parse(temp.Rows[i][6].ToString()) != 0)
                {
                    dr[6] = temp.Rows[i][6].ToString();
                }
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;

            view.Columns["Quý 01"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Quý 01"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Quý 01"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Quý 01"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Quý 02"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Quý 02"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Quý 02"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Quý 02"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Quý 03"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Quý 03"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Quý 03"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Quý 03"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Quý 04"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Quý 04"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Quý 04"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Quý 04"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns[2].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[2].SummaryItem.DisplayFormat = "Số dòng:   {0}";
            view.Columns[2].Width = 200;


            GridGroupSummaryItem item1 = new GridGroupSummaryItem();

            item1.FieldName     = "Quý 01";
            item1.DisplayFormat = "{0:n0}";
            item1.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item1);
            item1.ShowInGroupColumnFooter = view.Columns["Quý 01"];

            GridGroupSummaryItem item2 = new GridGroupSummaryItem();

            item2.FieldName     = "Quý 02";
            item2.DisplayFormat = "{0:n0}";
            item2.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item2);
            item2.ShowInGroupColumnFooter = view.Columns["Quý 02"];

            GridGroupSummaryItem item3 = new GridGroupSummaryItem();

            item3.FieldName     = "Quý 03";
            item3.DisplayFormat = "{0:n0}";
            item3.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item3);
            item3.ShowInGroupColumnFooter = view.Columns["Quý 03"];

            GridGroupSummaryItem item4 = new GridGroupSummaryItem();

            item4.FieldName     = "Quý 04";
            item4.DisplayFormat = "{0:n0}";
            item4.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item4);
            item4.ShowInGroupColumnFooter = view.Columns["Quý 04"];

            view.Columns[0].GroupIndex = 0;
            view.ExpandAllGroups();
        }
コード例 #11
0
        public void loadluutrutonkho(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string branchid, string ngaychungtu, string tsbt)
        {
            view.OptionsView.ColumnAutoWidth = true;
            DataTable dt   = new DataTable();
            DataTable temp = gen.GetTable("bangketonkhomathangtheongay '" + branchid + "','" + DateTime.Parse(ngaychungtu).Month + "','" + DateTime.Parse(ngaychungtu).Year + "','" + ngaychungtu + "','','',''");

            view.Columns.Clear();

            dt.Columns.Add("Loại", Type.GetType("System.String"));
            dt.Columns.Add("Mã hàng", Type.GetType("System.String"));
            dt.Columns.Add("Tên hàng", Type.GetType("System.String"));
            dt.Columns.Add("Số lượng", Type.GetType("System.Double"));
            dt.Columns.Add("Trọng lượng", Type.GetType("System.Double"));
            dt.Columns.Add("Số tiền", Type.GetType("System.Double"));
            dt.Columns.Add("0", Type.GetType("System.Double"));
            dt.Columns.Add("10", Type.GetType("System.Double"));
            dt.Columns.Add("30", Type.GetType("System.Double"));
            dt.Columns.Add("45", Type.GetType("System.Double"));
            dt.Columns.Add("60", Type.GetType("System.Double"));
            dt.Columns.Add("75", Type.GetType("System.Double"));
            dt.Columns.Add("90", Type.GetType("System.Double"));

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();

                if (Double.Parse(temp.Rows[i][3].ToString()) != 0)
                {
                    dr[3] = temp.Rows[i][3].ToString();
                }
                if (Double.Parse(temp.Rows[i][4].ToString()) != 0)
                {
                    dr[4] = temp.Rows[i][4].ToString();
                }
                if (Double.Parse(temp.Rows[i][5].ToString()) != 0)
                {
                    dr[5] = temp.Rows[i][5].ToString();
                }
                if (Double.Parse(temp.Rows[i][6].ToString()) != 0)
                {
                    dr[6] = temp.Rows[i][6].ToString();
                }
                if (Double.Parse(temp.Rows[i][7].ToString()) != 0)
                {
                    dr[7] = temp.Rows[i][7].ToString();
                }
                if (Double.Parse(temp.Rows[i][8].ToString()) != 0)
                {
                    dr[8] = temp.Rows[i][8].ToString();
                }
                if (Double.Parse(temp.Rows[i][9].ToString()) != 0)
                {
                    dr[9] = temp.Rows[i][9].ToString();
                }
                if (Double.Parse(temp.Rows[i][10].ToString()) != 0)
                {
                    dr[10] = temp.Rows[i][10].ToString();
                }
                if (Double.Parse(temp.Rows[i][11].ToString()) != 0)
                {
                    dr[11] = temp.Rows[i][11].ToString();
                }
                if (Double.Parse(temp.Rows[i][12].ToString()) != 0)
                {
                    dr[12] = temp.Rows[i][12].ToString();
                }
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;

            view.Columns["0"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["0"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["0"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["0"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["0"].Caption = "< 10 ngày";

            view.Columns["10"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["10"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["10"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["10"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["10"].Caption = "> 10 ngày";

            view.Columns["30"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["30"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["30"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["30"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["30"].Caption = "> 30 ngày";

            view.Columns["45"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["45"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["45"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["45"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["45"].Caption = "> 45 ngày";

            view.Columns["60"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["60"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["60"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["60"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["60"].Caption = "> 60 ngày";

            view.Columns["75"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["75"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["75"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["75"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["75"].Caption = "> 75 ngày";

            view.Columns["90"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["90"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["90"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["90"].SummaryItem.DisplayFormat  = "{0:n0}";
            view.Columns["90"].Caption = "> 90 ngày";

            view.Columns["Số lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Số lượng"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Số lượng"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Số lượng"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Trọng lượng"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Trọng lượng"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Trọng lượng"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Trọng lượng"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns["Số tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Số tiền"].DisplayFormat.FormatString = "{0:n0}";
            view.Columns["Số tiền"].SummaryItem.SummaryType    = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Số tiền"].SummaryItem.DisplayFormat  = "{0:n0}";

            view.Columns[2].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[2].SummaryItem.DisplayFormat = "Số dòng:   {0}";
            view.Columns[2].Width = 200;


            GridGroupSummaryItem item1 = new GridGroupSummaryItem();

            item1.FieldName     = "0";
            item1.DisplayFormat = "{0:n0}";
            item1.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item1);
            item1.ShowInGroupColumnFooter = view.Columns["0"];

            GridGroupSummaryItem item2 = new GridGroupSummaryItem();

            item2.FieldName     = "10";
            item2.DisplayFormat = "{0:n0}";
            item2.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item2);
            item2.ShowInGroupColumnFooter = view.Columns["10"];

            GridGroupSummaryItem item3 = new GridGroupSummaryItem();

            item3.FieldName     = "30";
            item3.DisplayFormat = "{0:n0}";
            item3.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item3);
            item3.ShowInGroupColumnFooter = view.Columns["30"];

            GridGroupSummaryItem item4 = new GridGroupSummaryItem();

            item4.FieldName     = "45";
            item4.DisplayFormat = "{0:n0}";
            item4.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item4);
            item4.ShowInGroupColumnFooter = view.Columns["45"];

            GridGroupSummaryItem item5 = new GridGroupSummaryItem();

            item5.FieldName     = "60";
            item5.DisplayFormat = "{0:n0}";
            item5.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item5);
            item5.ShowInGroupColumnFooter = view.Columns["60"];

            GridGroupSummaryItem item6 = new GridGroupSummaryItem();

            item6.FieldName     = "75";
            item6.DisplayFormat = "{0:n0}";
            item6.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item6);
            item6.ShowInGroupColumnFooter = view.Columns["75"];

            GridGroupSummaryItem item7 = new GridGroupSummaryItem();

            item7.FieldName     = "90";
            item7.DisplayFormat = "{0:n0}";
            item7.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item7);
            item7.ShowInGroupColumnFooter = view.Columns["90"];

            GridGroupSummaryItem item8 = new GridGroupSummaryItem();

            item8.FieldName     = "Số lượng";
            item8.DisplayFormat = "{0:n0}";
            item8.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item8);
            item8.ShowInGroupColumnFooter = view.Columns["Số lượng"];

            GridGroupSummaryItem item9 = new GridGroupSummaryItem();

            item9.FieldName     = "Trọng lượng";
            item9.DisplayFormat = "{0:n0}";
            item9.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item9);
            item9.ShowInGroupColumnFooter = view.Columns["Trọng lượng"];

            GridGroupSummaryItem item10 = new GridGroupSummaryItem();

            item10.FieldName     = "Số tiền";
            item10.DisplayFormat = "{0:n0}";
            item10.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.GroupSummary.Add(item10);
            item10.ShowInGroupColumnFooter = view.Columns["Số tiền"];

            view.Columns[0].GroupIndex = 0;
            view.ExpandAllGroups();
        }
コード例 #12
0
        public void loadaccount(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view)
        {
            view.OptionsView.ColumnAutoWidth = true;
            DataTable temp = new DataTable();
            DataTable dt   = new DataTable();

            view.Columns.Clear();
            string sql  = "select * from Account where Grade='" + 1 + "' order by AccountNumber";
            string max  = gen.GetString("select max(Grade) from Account");
            int    maxi = int.Parse(max);

            temp = gen.GetTable(sql);
            int count = temp.Rows.Count;

            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số tài khoản", Type.GetType("System.String"));
            dt.Columns.Add("Tên tài khoản", Type.GetType("System.String"));
            dt.Columns.Add("Tên tiếng anh", Type.GetType("System.String"));
            dt.Columns.Add("Nhóm tài khoản", Type.GetType("System.String"));
            dt.Columns.Add("Tính chất", Type.GetType("System.String"));
            dt.Columns.Add("Ngừng theo dõi", Type.GetType("System.Boolean"));
            for (int i = 0; i < count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][17].ToString();
                dr[4] = temp.Rows[i][7].ToString();
                if (temp.Rows[i][8].ToString() == "0")
                {
                    dr[5] = "Dư nợ";
                }
                else if (temp.Rows[i][8].ToString() == "1")
                {
                    dr[5] = "Dư có";
                }
                else if (temp.Rows[i][8].ToString() == "2")
                {
                    dr[5] = "Lưỡng tính";
                }
                else
                {
                    dr[5] = "Không có số dư";
                }
                dr[6] = temp.Rows[i][13].ToString();
                dt.Rows.Add(dr);
                if (temp.Rows[i][6].ToString() == "True")
                {
                    string kc = "";
                    dequy(1, maxi, dt, temp.Rows[i][0].ToString(), kc);
                }
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Nhóm tài khoản"].GroupIndex = 0;
            view.ExpandAllGroups();

            /*GridGroupSummaryItem item = new GridGroupSummaryItem();
             * item.FieldName = "ProductName";
             * item.DisplayFormat = "  Số dòng {0:n0}";
             * item.SummaryType = DevExpress.Data.SummaryItemType.Count;
             * view.GroupSummary.Add(item);
             * item.ShowInGroupColumnFooter = view.Columns["Tính chất"];*/
        }
コード例 #13
0
        public void loadpnk(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string userid, string ngaychungtu)
        {
            string sql = "select RefID,RefNo,RefDate,PostedDate,AccountingObjectName,JournalMemo,TotalAmount,DocumentIncluded,StockCode from INInwardLPG a, Stock b where a.StockID=b.StockID and Month(RefDate)='" + DateTime.Parse(ngaychungtu).Month.ToString() + "' and  Year(RefDate)='" + DateTime.Parse(ngaychungtu).Year.ToString() + "' and b.StockID in (select StockID from MSC_UserJoinStock where UserID='" + userid + "') order by RefNo";

            view.OptionsView.ColumnAutoWidth = true;
            DataTable dt   = new DataTable();
            DataTable temp = new DataTable();

            view.Columns.Clear();
            temp = gen.GetTable(sql);
            dt.Columns.Add("ID", Type.GetType("System.String"));
            dt.Columns.Add("Số chứng từ", Type.GetType("System.String"));
            dt.Columns.Add("Ngày chứng từ", Type.GetType("System.DateTime"));
            dt.Columns.Add("Ngày hạch toán", Type.GetType("System.DateTime"));
            dt.Columns.Add("Nhà cung cấp", Type.GetType("System.String"));
            dt.Columns.Add("Lý do", Type.GetType("System.String"));
            dt.Columns.Add("Số tiền", Type.GetType("System.Double"));
            dt.Columns.Add("Chứng từ gốc", Type.GetType("System.String"));
            dt.Columns.Add("Mã kho", Type.GetType("System.String"));
            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = temp.Rows[i][0].ToString();
                dr[1] = temp.Rows[i][1].ToString();
                dr[2] = temp.Rows[i][2].ToString();
                dr[3] = temp.Rows[i][3].ToString();
                dr[4] = temp.Rows[i][4].ToString();
                dr[5] = temp.Rows[i][5].ToString();
                dr[6] = temp.Rows[i][6].ToString();
                dr[7] = temp.Rows[i][7].ToString();
                dr[8] = temp.Rows[i][8].ToString();
                dt.Rows.Add(dr);
            }
            lvpq.DataSource = dt;
            view.OptionsBehavior.Editable = false;
            view.OptionsSelection.EnableAppearanceFocusedCell = false;
            view.FocusRectStyle     = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
            view.Columns[0].Visible = false;

            view.Columns["Ngày chứng từ"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày chứng từ"].DisplayFormat.FormatString = "dd/MM/yyyy";
            view.Columns["Ngày chứng từ"].Width = 100;
            view.Columns["Ngày chứng từ"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatType             = DevExpress.Utils.FormatType.DateTime;
            view.Columns["Ngày hạch toán"].DisplayFormat.FormatString           = "dd/MM/yyyy";
            view.Columns["Ngày hạch toán"].Width = 100;
            view.Columns["Ngày hạch toán"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Chứng từ gốc"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

            view.Columns["Số tiền"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Custom;
            view.Columns["Số tiền"].DisplayFormat.FormatString = "{0:n0}";

            view.Columns["Số tiền"].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Sum;
            view.Columns["Số tiền"].SummaryItem.DisplayFormat = "{0:n0}";

            view.OptionsView.ShowFooter               = true;
            view.Columns[1].SummaryItem.SummaryType   = DevExpress.Data.SummaryItemType.Count;
            view.Columns[1].SummaryItem.DisplayFormat = "Số dòng:   {0}";

            view.Columns["Chứng từ gốc"].Width = 100;
            view.Columns["Mã kho"].GroupIndex  = 0;
            view.ExpandAllGroups();
        }