private void FrmMonthAccount_Load(object sender, EventArgs e) { try { for (int day = 1; day <= 31; day++) { cobAccountDay.Items.Add(day.ToString() + "号"); } cobAccountDay.Text = ConfigManager.GetAccountDay((int)_currentDept).ToString() + "号"; if (_belongSystem == ConfigManager.YF_SYSTEM) { btnYKMonthAccount.Enabled = false; ((YF_MonthBalance)_monthAccount).AccountHandler += new MonthAccountHandler(FrmMonthAccount_AccountHandler); } else { btnYFMonthAccount.Enabled = false; ((YK_MonthBalance)_monthAccount).AccountHandler += new MonthAccountHandler(FrmMonthAccount_AccountHandler); } _lastAccountHis = _accountQuery.GetLastAccountHis((int)_currentDept); if (_lastAccountHis != null) { cobBeginDate.Value = _lastAccountHis.BeginTime; cobEndDate.Value = _lastAccountHis.EndTime; } dgrdAccountHis.AutoGenerateColumns = false; dgrdAccountHis.DataSource = _accountQuery.GetActHisList((int)_currentDept); int currentActMonth = _lastAccountHis.AccountMonth == 12 ? 1 : _lastAccountHis.AccountMonth + 1; int currentActYear = _lastAccountHis.AccountMonth == 12 ? _lastAccountHis.AccountYear + 1 : _lastAccountHis.AccountYear; lblCurrentActMonth.Text = currentActYear + "年" + currentActMonth + "月"; } catch (Exception error) { MessageBox.Show(error.Message); } }