Пример #1
0
        private void FillGrid()
        {
            Accounts.Refresh();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Type"), 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Description"), 170);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Balance"), 80, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Bank Number"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableChartOfAccounts", "Inactive"), 70, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            if (textDate.errorProvider1.GetError(textDate) != "")            //error
            {
                table = Accounts.GetFullList(DateTime.Today, checkInactive.Checked);
            }
            else
            {
                table = Accounts.GetFullList(PIn.PDate(textDate.Text), checkInactive.Checked);
            }
            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(table.Rows[i]["type"].ToString());
                row.Cells.Add(table.Rows[i]["Description"].ToString());
                row.Cells.Add(table.Rows[i]["balance"].ToString());
                row.Cells.Add(table.Rows[i]["BankNumber"].ToString());
                row.Cells.Add(table.Rows[i]["inactive"].ToString());
                if (i < table.Rows.Count - 1 &&        //if not the last row
                    table.Rows[i]["type"].ToString() != table.Rows[i + 1]["type"].ToString())
                {
                    row.ColorLborder = Color.Black;
                }
                row.ColorBackG = Color.FromArgb(PIn.PInt(table.Rows[i]["color"].ToString()));
                gridMain.Rows.Add(row);
            }

            /*for(int i=0;i<Accounts.ListLong.Length;i++){
             *      if(!checkInactive.Checked && Accounts.ListLong[i].Inactive){
             *              continue;
             *      }
             *      row=new ODGridRow();
             *      row.Cells.Add(Lan.g("enumAccountType",Accounts.ListLong[i].AcctType.ToString()));
             *      row.Cells.Add(Accounts.ListLong[i].Description);
             *      if(Accounts.ListLong[i].AcctType==AccountType.Asset){
             *              row.Cells.Add(Accounts.GetBalance(Accounts.ListLong[i].AccountNum,Accounts.ListLong[i].AcctType).ToString("n"));
             *      }
             *      else{
             *              row.Cells.Add("");
             *      }
             *      row.Cells.Add(Accounts.ListLong[i].BankNumber);
             *      if(Accounts.ListLong[i].Inactive){
             *              row.Cells.Add("X");
             *      }
             *      else{
             *              row.Cells.Add("");
             *      }
             *      if(i<Accounts.ListLong.Length-1//if not the last row
             *              && Accounts.ListLong[i].AcctType != Accounts.ListLong[i+1].AcctType){
             *              row.ColorLborder=Color.Black;
             *      }
             *      row.Tag=Accounts.ListLong[i].Copy();
             *      row.ColorBackG=Accounts.ListLong[i].AccountColor;
             *      gridMain.Rows.Add(row);
             * }*/
            gridMain.EndUpdate();
        }