示例#1
0
        protected void AccountList_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                XPQuery <Account> accountQuery = session.Query <Account>();
                Account           account      = (from c in accountQuery
                                                  where c.Code == e.OldValues["Code"]
                                                  select c).FirstOrDefault();
                AccountingBO accountBO = new AccountingBO();
                double       _Balance  = Double.Parse(e.NewValues["Balance"].ToString());

                AccountingPeriod _accountingPeriod = session.GetObjectByKey <AccountingPeriod>(Guid.Parse(cboAccountPeriod.Value.ToString()));

                if (_accountingPeriod == null)
                {
                    throw new Exception("Chưa chọn kỳ kế toán !");
                }

                AccountingPeriod accountPeriod = _accountingPeriod;

                accountBO.UpdateBalanceForwardTransaction(session, account.AccountId, _Balance);
                ASPxGridView grid = (ASPxGridView)sender;
                grid.CancelEdit();
                List <NAS.BO.Accounting.AccountingBO.AccountingEntity> rs = accountBO.getInitBalanceForward(session, _accountingPeriod);
                AccountList.DataSource = rs;
                AccountList.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                e.Cancel = true;
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AccountingBO accountBO = new AccountingBO();

            //try
            //{
            //    accountBO.InitBalanceForward(session, AccountingPeriodBO.getCurrentAccountingPeriod(session));

            //    lbAccountingPeriod.Text = AccountingPeriodBO.getCurrentAccountingPeriod(session).Code;
            //    lbAccountingPeriodStartdate.Text = AccountingPeriodBO.getCurrentAccountingPeriod(session).FromDateTime.ToShortDateString();
            //    lbAccountingPeriodEnddate.Text = AccountingPeriodBO.getCurrentAccountingPeriod(session).ToDateTime.Date.ToShortDateString();
            //}
            //catch
            //{
            //    cpMessageBox.JSProperties.Clear();
            //    MessageBox1.Message.Text = String.Format("Chưa tạo chu kỳ tháng {0} năm {1}", DateTime.Now.Month, DateTime.Now.Year);
            //    cpMessageBox.JSProperties.Add("cpWarning", "Chưa tạo chu kỳ tháng " + DateTime.Now.Month.ToString());
            //}

            List <NAS.BO.Accounting.AccountingBO.AccountingEntity> rs = accountBO.getInitBalanceForward(session, AccountingPeriodBO.getCurrentAccountingPeriod(session));

            AccountList.DataSource = rs;
            AccountList.DataBind();
            AccountList.Focus();

            NAS.DAL.Accounting.Currency.Currency currency;

            if (cboBalanceInitCurrency.Value == null)
            {
                CriteriaOperator _filter = new GroupOperator(GroupOperatorType.And,
                                                             new BinaryOperator("IsDefault", 1, BinaryOperatorType.Equal),
                                                             new BinaryOperator("CurrencyTypeId.IsMaster", 1, BinaryOperatorType.Equal));
                currency = session.FindObject <NAS.DAL.Accounting.Currency.Currency>(_filter);
                if (currency != null)
                {
                    cboBalanceInitCurrency.Value = currency.CurrencyId;
                }
            }

            currency = session.GetObjectByKey <NAS.DAL.Accounting.Currency.Currency>(Guid.Parse(cboBalanceInitCurrency.Value.ToString()));
            if (currency != null)
            {
                int    i  = 0;
                string _p = GetDecimals(currency.Coefficient, i).ToString();

                if (Int32.Parse(_p) <= 0)
                {
                    m_FormatNumber = m_FormatNumber.Replace('6', '0');
                }
                else
                {
                    m_FormatNumber = m_FormatNumber.Replace('6', char.Parse(_p));
                }
            }


            BalanceLineSetData();
            tgrdAccountBalance.ExpandToLevel(1);

            (tgrdAccountBalance.Columns["Debit"] as TreeListDataColumn).PropertiesEdit.DisplayFormatString  = m_FormatNumber;
            (tgrdAccountBalance.Columns["Credit"] as TreeListDataColumn).PropertiesEdit.DisplayFormatString = m_FormatNumber;

            if (!Page.IsPostBack)
            {
                refreshSummaryFooter();
            }
        }