コード例 #1
0
        public ActionResult Insert(MAccount viewModel, FormCollection formCollection)
        {
            MAccount mCompanyToInsert = new MAccount();

            TransferFormValuesTo(mCompanyToInsert, viewModel);
            mCompanyToInsert.AccountParentId = _mAccountRepository.Get(formCollection["ParentId"]);
            mCompanyToInsert.SetAssignedIdTo(viewModel.Id);
            mCompanyToInsert.CreatedDate = DateTime.Now;
            mCompanyToInsert.CreatedBy   = User.Identity.Name;
            mCompanyToInsert.DataStatus  = EnumDataStatus.New.ToString();
            _mAccountRepository.Save(mCompanyToInsert);

            try
            {
                _mAccountRepository.DbContext.CommitChanges();
            }
            catch (Exception e)
            {
                _mAccountRepository.DbContext.RollbackTransaction();

                //throw e.GetBaseException();
                return(Content(e.GetBaseException().Message));
            }

            return(Content("success"));
        }
コード例 #2
0
        public static MAccount AddAccount(MAccount account)
        {
            using (var db = DbConnection) {
                db.TraceListener = new DebugTraceListener();

                object[] parameters =
                {
                    account.Name,
                    account.ColorKey,
                    DateTimeHelper.DateTimeUtcNowString,
                    false,
                    account.GlobalId ?? (Dal.GetMaxRowId(typeof(MAccount)) + 1).NewGlobalIdFromLocal(),//SyncProperties.GetGlobalId(typeof(MAccount)),
                    (account as SubMAccount)?.BossAccountGlobalId
                };

                db.Execute(
                    "INSERT INTO " + typeof(MAccount).Name +
                    " (Name, ColorKey, LastModifed, IsDeleted, GlobalId, BossAccountGlobalId) VALUES(?,?,?,?,?,?)"
                    , parameters);

                account.LastModifed = parameters[2] as string;
                account.GlobalId    = parameters[4] as string;
                if (account is SubMAccount)
                {
                    ((SubMAccount)account).BossAccountGlobalId = parameters[5] as string;
                }

                return(account);
            }
        }
コード例 #3
0
        }       //	copyGL

        /// <summary>
        /// Copy Default
        /// </summary>
        /// <param name="targetAS">target</param>
        private void CopyDefault(MAcctSchema targetAS)
        {
            MAcctSchemaDefault source = MAcctSchemaDefault.Get(GetCtx(), _SourceAcctSchema_ID);
            MAcctSchemaDefault target = new MAcctSchemaDefault(GetCtx(), 0, Get_Trx());

            target.SetC_AcctSchema_ID(_TargetAcctSchema_ID);
            target.SetC_AcctSchema_ID(_TargetAcctSchema_ID);
            //ArrayList<KeyNamePair> list = source.getAcctInfo();
            List <KeyNamePair> list = source.GetAcctInfo();

            for (int i = 0; i < list.Count; i++)
            {
                //KeyNamePair pp = list.get(i);
                KeyNamePair pp = list[i];
                int         sourceC_ValidCombination_ID = pp.GetKey();
                String      columnName    = pp.GetName();
                MAccount    sourceAccount = MAccount.Get(GetCtx(), sourceC_ValidCombination_ID);
                MAccount    targetAccount = CreateAccount(targetAS, sourceAccount);
                target.SetValue(columnName, Utility.Util.GetValueOfInt(targetAccount.GetC_ValidCombination_ID()));
            }
            if (!target.Save())
            {
                throw new Exception("Could not Save Default");
            }
        }       //	copyDefault
コード例 #4
0
        private static MAccount GetDefaultAccount(EnumReferenceType referenceType)
        {
            IMAccountRepository mAccountRepository = new MAccountRepository();
            MAccount            account            = mAccountRepository.Get(Helper.CommonHelper.GetReference(referenceType).ReferenceValue);

            return(account);
        }
コード例 #5
0
        public async Task<IActionResult> Edit(long id, [Bind("AccountSeq,AccountType,Id,Pass,DatabaseName,UpdateDt,UpdateId,UpdateTer,CreateDt,CreateId,CreateTer,ConfigurationManagementSeq")] MAccount mAccount)
        {
            if (id != mAccount.AccountSeq)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mAccount);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MAccountExists(mAccount.AccountSeq))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(mAccount);
        }
コード例 #6
0
ファイル: MAccountBLL.cs プロジェクト: uvbs/tumumi
        /// <summary>
        /// 账户花销(包含写帐户日志)
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public bool AccountExpend(decimal orderId, string ip)
        {
            Bll.Order.TOrderBLL     obll  = new TMM.Service.Bll.Order.TOrderBLL();
            Bll.Order.AccountLogBLL albll = new TMM.Service.Bll.Order.AccountLogBLL();

            TOrder   o   = obll.Get(orderId);
            MAccount acc = GetByUserId(o.UserId);

            if (acc.Amount >= o.Total)
            {
                AccountLog accLog = new AccountLog()
                {
                    UserId     = o.UserId,
                    OrderId    = o.OrderId,
                    Amount     = -o.Total,
                    AccountWay = (int)AmountWay.Out,
                    Ip         = ip
                };

                albll.Insert(accLog);
                acc.Amount = acc.Amount - o.Total;
                return(Update(acc));
            }
            return(false);
        }
コード例 #7
0
ファイル: MAccountBLL.cs プロジェクト: uvbs/tumumi
        /// <summary>
        /// 账户充值 for 出售文档收入
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public bool AddAmount(int userId, decimal amount)
        {
            MAccount acc = GetByUserId(userId);

            acc.Amount = acc.Amount + amount;
            return(Update(acc));
        }
コード例 #8
0
        /// <summary>
        /// Load Invoice Line
        /// </summary>
        /// <param name="journal"></param>
        /// <returns>DocLine Array</returns>
        private DocLine[] LoadLines(MJournal journal)
        {
            List <DocLine> list = new List <DocLine>();

            MJournalLine[] lines = journal.GetLines(false);
            for (int i = 0; i < lines.Length; i++)
            {
                MJournalLine line    = lines[i];
                DocLine      docLine = new DocLine(line, this);
                //  --  Source Amounts
                docLine.SetAmount(line.GetAmtSourceDr(), line.GetAmtSourceCr());
                //  --  Converted Amounts
                docLine.SetConvertedAmt(_C_AcctSchema_ID, line.GetAmtAcctDr(), line.GetAmtAcctCr());
                //  --  Account
                MAccount account = line.GetAccount();
                docLine.SetAccount(account);
                //  -- Quantity
                docLine.SetQty(line.GetQty(), false);
                // -- Date
                docLine.SetDateAcct(journal.GetDateAcct());
                //	--	Organization of Line was set to Org of Account
                list.Add(docLine);
            }
            //	Return Array
            int size = list.Count;

            DocLine[] dls = new DocLine[size];
            dls = list.ToArray();
            return(dls);
        }
コード例 #9
0
        private async void EditButton_Click(object sender, RoutedEventArgs e)
        {
            object datacontext = (e.OriginalSource as FrameworkElement)?.DataContext;
            MAccountWithSubMAccounts  oldAccound = ((MAccountWithSubMAccounts)datacontext);
            EditMAccountContentDialog editMoneyAccountContentDialog = new EditMAccountContentDialog(oldAccound?.MAccount);
            ContentDialogResult       result = await editMoneyAccountContentDialog.ShowAsync();

            if (result != ContentDialogResult.Primary)
            {
                return;
            }

            MAccount editedAccound = editMoneyAccountContentDialog.EditedAccount;

            if (editedAccound is SubMAccount)
            {
                AccountToSubAccount(oldAccound, editedAccound as SubMAccount);
            }
            else
            {
                AccountToAccount(oldAccound, editedAccound);
            }

            /*
             * int index = Accounts.IndexOf(oldAccound); //TODO gdyby edytować z karty na konto i na odwró
             * Accounts.Remove(oldAccound);
             * oldAccound.MAccount = editedAccound;
             * Accounts.Insert(index, oldAccound);*/
        }
コード例 #10
0
        private async void NewMoneyAccount_Click(object sender, RoutedEventArgs e)
        {
            var contentDialogItem = new NewMoneyAccountContentDialog();
            var result            = await contentDialogItem.ShowAsync();

            if (result != ContentDialogResult.Primary)
            {
                return;
            }

            MAccount newAccount = contentDialogItem.AddedAccount; //TODO Id i GlobalID bo są 0 albo null

            if (newAccount is SubMAccount)
            {
                MAccountWithSubMAccounts mAccountWithSubMAccounts =
                    Accounts.SingleOrDefault(i => i.MAccount.GlobalId == ((SubMAccount)newAccount).BossAccountGlobalId);
                mAccountWithSubMAccounts?.SubMAccounts.Insert(0, (SubMAccount)newAccount); //TODO wali NULLem jeżeli kontoi nie ma podkategorii
            }
            else
            {
                Accounts.Insert(0, new MAccountWithSubMAccounts {
                    MAccount = newAccount
                });
            }
        }
コード例 #11
0
        /// <summary>
        /// Create and convert Fact Line.
        /// Used to create a DR and/or CR entry
        /// </summary>
        /// <param name="docLine">the document line or null</param>
        /// <param name="account">if null, line is not created</param>
        /// <param name="C_Currency_ID">the currency</param>
        /// <param name="debitAmt">debit amount, can be null</param>
        /// <param name="creditAmt">credit amount, can be null</param>
        /// <returns>Fact Line</returns>
        public FactLine CreateLine(DocLine docLine, MAccount account, int C_Currency_ID, Decimal?debitAmt, Decimal?creditAmt)
        {
            //  Data Check
            if (account == null)
            {
                log.Info("No account for " + docLine + ": Amt=" + debitAmt + "/" + creditAmt
                         + " - " + ToString());
                return(null);
            }

            //Added By Bharat to Handle -ve entry

            if (debitAmt < 0)
            {
                creditAmt = Decimal.Negate(debitAmt.Value);
                debitAmt  = 0;
            }
            else if (creditAmt < 0)
            {
                debitAmt  = Decimal.Negate(creditAmt.Value);
                creditAmt = 0;
            }

            //
            FactLine line = new FactLine(_doc.GetCtx(), _doc.Get_Table_ID(),
                                         _doc.Get_ID(),
                                         docLine == null ? 0 : docLine.Get_ID(), _trx);

            // set accounting schema reference
            line.SetC_AcctSchema_ID(_acctSchema.GetC_AcctSchema_ID());
            //  Set Info & Account
            line.SetDocumentInfo(_doc, docLine);
            line.SetPostingType(_postingType);
            line.SetAccount(_acctSchema, account);
            //  Amounts - one needs to not zero
            if (!line.SetAmtSource(C_Currency_ID, debitAmt, creditAmt))
            {
                if (docLine == null || docLine.GetQty() == null || Env.Signum(Utility.Util.GetValueOfDecimal(docLine.GetQty())) == 0)
                {
                    log.Fine("Both amounts & qty = 0/Null - " + docLine
                             + " - " + ToString());
                    return(null);
                }
                log.Fine("Both amounts = 0/Null, Qty=" + docLine.GetQty() + " - " + docLine
                         + " - " + ToString());
            }
            //  Convert
            line.Convert();
            //  Optionally overwrite Acct Amount
            if (docLine != null &&
                (docLine.GetAmtAcctDr() != null || docLine.GetAmtAcctCr() != null))
            {
                line.SetAmtAcct(docLine.GetAmtAcctDr(), docLine.GetAmtAcctCr());
            }
            //
            log.Fine(line.ToString());
            Add(line);
            return(line);
        }
コード例 #12
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (accountIdTextBox.Enabled == true)
            {
                acc = new MAccount();
            }
            else
            {
                acc = (MAccount)DataMaster.GetObjectByProperty(typeof(MAccount), MAccount.ColumnNames.AccountId, accountIdTextBox.Text);
            }

            acc.AccountDesc = accountDescTextBox.Text;
            acc.AccountId   = accountIdTextBox.Text;
            acc.AccountName = accountNameTextBox.Text;
            //acc.AccountSaldo = accountSaldoNumericUpDown.Value;
            acc.AccountPosition = accountPositionComboBox.Text;
            if (accountStatusDebetRadioButton.Checked)
            {
                acc.AccountStatus = ListOfJournalStatus.Debet.ToString();
            }
            if (accountStatusKreditRadioButton.Checked)
            {
                acc.AccountStatus = ListOfJournalStatus.Kredit.ToString();
            }

            acc.ModifiedBy   = lbl_UserName.Text;
            acc.ModifiedDate = DateTime.Now;

            if (accountIdTextBox.Enabled == true)
            {
                try
                {
                    DataMaster.SavePersistence(acc);
                }
                catch (NHibernate.NonUniqueObjectException)
                {
                    RecreateBalloon();
                    balloonHelp.Caption = "Validasi data kurang";
                    balloonHelp.Content = "POS Neraca dengan kode " + accountIdTextBox.Text + " sudah pernah diinput, silahkan input dengan kode yang lain";
                    balloonHelp.ShowBalloon(accountIdTextBox);
                    accountIdTextBox.Focus();
                    return;
                }
                ModuleControlSettings.SaveLog(ListOfAction.Insert, accountIdTextBox.Text, ListOfTable.MAccount, lbl_UserName.Text);
            }
            else
            {
                DataMaster.UpdatePersistence(acc);
                ModuleControlSettings.SaveLog(ListOfAction.Update, accountIdTextBox.Text, ListOfTable.MAccount, lbl_UserName.Text);
            }


            BindData();
        }
コード例 #13
0
 private void TransferFormValuesTo(MAccount mCompanyToUpdate, MAccount mCompanyFromForm)
 {
     mCompanyToUpdate.AccountName     = mCompanyFromForm.AccountName;
     mCompanyToUpdate.AccountDesc     = mCompanyFromForm.AccountDesc;
     mCompanyToUpdate.AccountCatId    = mCompanyFromForm.AccountCatId;
     mCompanyToUpdate.AccountParentId = mCompanyFromForm.AccountParentId;
     mCompanyToUpdate.AccountStatus   = mCompanyFromForm.AccountStatus;
 }
コード例 #14
0
 /// <summary>
 /// Allocation Tax Adjustmentdiscount acct
 /// </summary>
 /// <param name="DiscountAccount">DiscountAccount </param>
 /// <param name="DiscountAmt">discount amt</param>
 /// <param name="WriteOffAccount">write off acct</param>
 /// <param name="WriteOffAmt">write off amt</param>
 public Doc_AllocationTax(MAccount DiscountAccount, Decimal DiscountAmt, MAccount WriteOffAccount, Decimal WriteOffAmt)
 {
     log = VLogger.GetVLogger(this.GetType().FullName);//getClass());
     _DiscountAccount = DiscountAccount;
     _DiscountAmt     = DiscountAmt;
     _WriteOffAccount = WriteOffAccount;
     _WriteOffAmt     = WriteOffAmt;
 }
コード例 #15
0
        private async void NewCategory_AddButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            AddedAccount = MAccountsDal.AddAccount(GetNewAccount());

            if (!string.IsNullOrEmpty(_acceptedCostValue))
            {
                Dal.SaveOperation(await MakeOperation(AddedAccount.GlobalId));
            }
        }
コード例 #16
0
        /// <summary>
        /// Is used to create line against Income Account summary account --
        /// </summary>
        /// <param name="Profit">class object of MProfitLoss </param>
        private void InsertProfitLossLine(MProfitLoss Profit)
        {
            // get consolidated profit amount agsint Organization
            String  Sql      = @"SELECT AD_Org_ID , (SUM(AccountDebit) - SUM(AccountCredit)) AS ProfitAmt
                                    FROM C_ProfitLossLines WHERE C_ProfitAndLoss_ID > 0 AND C_ProfitLoss_ID = " + Profit.GetC_ProfitLoss_ID() + @" GROUP BY AD_Org_ID";
            DataSet dsProfit = DB.ExecuteDataset(Sql, null, Get_Trx());

            if (dsProfit != null && dsProfit.Tables.Count > 0 && dsProfit.Tables[0].Rows.Count > 0)
            {
                // get max line no
                int lineNo = Convert.ToInt32(DB.ExecuteScalar(@"SELECT NVL(MAX(Line),0)+10 AS line FROM C_ProfitLossLines WHERE C_ProfitLoss_ID = " + Profit.GetC_ProfitLoss_ID(), null, Get_Trx()));

                // get Valid Combination against Income Summary Acct  from accounting schema
                int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT IncomeSummary_Acct FROM C_AcctSchema_GL WHERE C_AcctSchema_ID=" + Util.GetValueOfInt(Profit.Get_Value("C_AcctSchema_ID"))));
                // get account id
                MAccount acct = MAccount.Get(GetCtx(), validComID);

                for (int i = 0; i < dsProfit.Tables[0].Rows.Count; i++)
                {
                    Decimal profitAmt = Util.GetValueOfDecimal(dsProfit.Tables[0].Rows[i]["ProfitAmt"]);

                    // when difference of DR - CR is ZERO then not to create line
                    if (profitAmt == 0)
                    {
                        continue;
                    }
                    MProfitLossLines profitLossLines = new MProfitLossLines(GetCtx(), 0, Get_Trx());
                    profitLossLines.SetAD_Client_ID(Profit.GetAD_Client_ID());
                    profitLossLines.SetAD_Org_ID(Util.GetValueOfInt(dsProfit.Tables[0].Rows[i]["AD_Org_ID"]));
                    profitLossLines.SetC_ProfitLoss_ID(Profit.GetC_ProfitLoss_ID());
                    profitLossLines.SetLine(lineNo);
                    profitLossLines.SetC_AcctSchema_ID(Util.GetValueOfInt(Profit.Get_Value("C_AcctSchema_ID")));
                    profitLossLines.SetPostingType(Util.GetValueOfString(Profit.Get_Value("PostingType")));
                    profitLossLines.SetAccount_ID(acct.GetAccount_ID());
                    profitLossLines.Set_Value("LedgerCode", acct.GetAccount().Get_Value("Value"));
                    profitLossLines.Set_Value("LedgerName", acct.GetAccount().Get_Value("Name"));
                    if (profitAmt > 0)
                    {
                        profitLossLines.SetAccountCredit(profitAmt);
                    }
                    else
                    {
                        profitLossLines.SetAccountDebit(profitAmt);
                    }
                    if (!profitLossLines.Save(Get_Trx()))
                    {
                        ValueNamePair pp = VLogger.RetrieveError();
                        log.Fine("Failed - Profit loss line not saved for income acct summary - " + (pp != null && !String.IsNullOrEmpty(pp.GetName()) ? pp.GetName() : ""));
                    }
                    else
                    {
                        lineNo += 10;
                    }
                }
            }
        }
コード例 #17
0
 public async Task<IActionResult> Create([Bind("AccountSeq,AccountType,Id,Pass,DatabaseName,UpdateDt,UpdateId,UpdateTer,CreateDt,CreateId,CreateTer,ConfigurationManagementSeq")] MAccount mAccount)
 {
     if (ModelState.IsValid)
     {
         _context.Add(mAccount);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(mAccount);
 }
コード例 #18
0
ファイル: MAccountDao.cs プロジェクト: uvbs/tumumi
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="obj">对象</param>
        /// <returns>返回:该条数据的主键Id</returns>
        public int Insert(MAccount obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "MAccount.Insert";

            return(SqlMapper.Instance().QueryForObject <int>(stmtId, obj));
        }
コード例 #19
0
 private void bindingSource_Master_PositionChanged(object sender, EventArgs e)
 {
     SetNavigatorDisplay();
     acc = (MAccount)DataMaster.GetObjectByProperty(typeof(MAccount), MAccount.ColumnNames.AccountId, accountIdTextBox.Text);
     if (acc != null)
     {
         accountStatusDebetRadioButton.Checked  = (acc.AccountStatus == ListOfJournalStatus.Debet.ToString());
         accountStatusKreditRadioButton.Checked = (acc.AccountStatus == ListOfJournalStatus.Kredit.ToString());
     }
 }
コード例 #20
0
        private void SubAccountToAccount(SubMAccount oldSubMAccount, MAccount newMAccount)
        {
            var accountWithSubMAccounts = Accounts.FirstOrDefault(i => i.SubMAccounts.Contains(oldSubMAccount));

            accountWithSubMAccounts.SubMAccounts.Remove(oldSubMAccount);

            Accounts.Insert(0, new MAccountWithSubMAccounts {
                MAccount = newMAccount
            });
        }
コード例 #21
0
        /// <summary>
        /// Create Facts (the accounting logic) for
        /// CMC.
        /// <pre>
        /// Expense
        /// CashExpense     DR
        ///        CashAsset               CR
        ///Receipt
        ///        CashAsset       DR
        ///        CashReceipt             CR
        ///  Charge
        ///        Charge          DR
        ///          CashAsset               CR
        ///  Difference
        ///          CashDifference  DR
        ///          CashAsset               CR
        ///  Invoice
        ///          CashAsset       DR
        ///          CashTransfer            CR
        ///  Transfer
        ///          BankInTransit   DR
        ///          CashAsset               CR
        ///  </pre>
        /// </summary>
        /// <param name="?"></param>
        /// <returns>Fact</returns>
        public override List <Fact> CreateFacts(MAcctSchema as1)
        {
            //  create Fact Header
            List <Fact> facts = new List <Fact>();

            if (GetDocumentType().Equals(MDocBaseType.DOCBASETYPE_PROFITLOSS))
            {
                //	Decimal grossAmt = getAmount(Doc.AMTTYPE_Gross);
                SetC_Currency_ID(GetCurrency(as1.GetC_AcctSchema_ID()));
                //  Commitment
                Fact    fact = new Fact(this, as1, Fact.POST_Actual);
                Decimal total = Env.ZERO, totalCredit = Env.ZERO, totalDebit = Env.ZERO;
                Decimal credit = Env.ZERO, debit = Env.ZERO;

                for (int i = 0; i < _lines.Length; i++)
                {
                    DocLine          dline = _lines[i];
                    MProfitLossLines line  = new MProfitLossLines(GetCtx(), dline.Get_ID(), null);
                    credit = Util.GetValueOfDecimal(dline.GetAmtAcctCr());
                    debit  = Util.GetValueOfDecimal(dline.GetAmtAcctDr());
                    if (credit > 0)
                    {
                        totalCredit = Decimal.Add(totalCredit, credit);
                    }
                    if (debit > 0)
                    {
                        totalDebit = Decimal.Add(totalDebit, debit);
                    }

                    //	Account
                    MAccount expense = MAccount.Get(GetCtx(), GetAD_Client_ID(), GetAD_Org_ID(), line.GetC_AcctSchema_ID(), line.GetAccount_ID(), line.GetC_SubAcct_ID(), line.GetM_Product_ID(), line.GetC_BPartner_ID(), line.GetAD_OrgTrx_ID(),
                                                    line.GetC_LocFrom_ID(), line.GetC_LocTo_ID(), line.GetC_SalesRegion_ID(), line.GetC_Project_ID(), line.GetC_Campaign_ID(), line.GetC_Activity_ID(), line.GetUser1_ID(), line.GetUser2_ID(), line.GetUserElement1_ID(), line.GetUserElement2_ID());

                    fact.CreateLine(dline, expense, GetCurrency(line.GetC_AcctSchema_ID()), debit, credit);
                }
                total = totalCredit - totalDebit;
                if (total != Env.ZERO)
                {
                    int      validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT IncomeSummary_Acct FROM C_AcctSchema_GL WHERE C_AcctSchema_ID=" + as1.GetC_AcctSchema_ID() + " AND AD_Client_ID = " + GetAD_Client_ID()));
                    MAccount acct       = MAccount.Get(GetCtx(), validComID);
                    fact.CreateLine(null, acct, GetC_Currency_ID(), total);
                }
                //if (TotalCurrLoss != Env.ZERO)
                //{
                //    int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT C_ValidCombination_ID FROM C_ValidCombination WHERE Account_ID= ( SELECT C_ElementValue_ID FROM C_ElementValue WHERE Value='82540' AND AD_Client_ID = " + GetAD_Client_ID() + " )"));
                //    MAccount acct = MAccount.Get(GetCtx(), validComID);
                //    TotalCurrLoss = MConversionRate.Convert(GetCtx(), TotalCurrLoss, childCashCurrency, headerCashCurrency, GetAD_Client_ID(), GetAD_Org_ID());
                //    fact.CreateLine(null, acct,
                //     GetC_Currency_ID(), (TotalCurrLoss));
                //}

                facts.Add(fact);
            }
            return(facts);
        }
コード例 #22
0
ファイル: MAccountDao.cs プロジェクト: uvbs/tumumi
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>返回:ture 成功,false 失败</returns>
        public bool Update(MAccount obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            String stmtId = "MAccount.Update";
            int    result = SqlMapper.Instance().QueryForObject <int>(stmtId, obj);

            return(result > 0 ? true : false);
        }
コード例 #23
0
 /// <summary>
 /// Create and convert Fact Line.
 /// Used to create either a DR or CR entry
 /// </summary>
 /// <param name="docLine">Document line or null</param>
 /// <param name="account">Account to be used</param>
 /// <param name="C_Currency_ID">Currency</param>
 /// <param name="Amt">if negative Cr else Dr</param>
 /// <param name ="AD_Org_ID">Set Line Org</param>
 /// <returns>FactLine</returns>
 public FactLine CreateLine(DocLine docLine, MAccount account, int C_Currency_ID, Decimal?Amt, int AD_Org_ID)
 {
     if (Env.Signum(Amt.Value) < 0)
     {
         return(CreateLine(docLine, account, C_Currency_ID, null, Math.Abs(Amt.Value), AD_Org_ID));
     }
     else
     {
         return(CreateLine(docLine, account, C_Currency_ID, Amt.Value, null, AD_Org_ID));
     }
 }
コード例 #24
0
ファイル: AccountValidate.cs プロジェクト: ofnhkb1/Notify2017
 /// <summary>
 /// 验证用户信息(登录)
 /// </summary>
 /// <param name="mAccount">用户信息</param>
 public static void ValdateLoginMAccount(MAccount mAccount)
 {
     if (mAccount == null)
     {
         throw new CustomException("帐号不存在");
     }
     if (mAccount.Status == Model.AccountStatus.Disable)
     {
         throw new CustomException("帐号已被禁用");
     }
 }
コード例 #25
0
ファイル: FillHelper.cs プロジェクト: ryuki/YTech.IM.Paramita
        public static SelectList GetAccounts(IMAccountRepository mAccountRepository, string defaultText)
        {
            IList <MAccount> listAcc = mAccountRepository.GetAll();

            if (!string.IsNullOrEmpty(defaultText))
            {
                MAccount account = new MAccount();
                account.AccountName = defaultText;
                listAcc.Insert(0, account);
            }
            return(new SelectList(listAcc, "Id", "AccountName"));
        }
コード例 #26
0
        private void SaveJournal(string subAccountId, ListOfJournalStatus listOfJournalStatus)
        {
            TJournal jur = new TJournal();

            MSubAccount sub = (MSubAccount)DataMaster.GetObjectByProperty(typeof(MSubAccount), MSubAccount.ColumnNames.SubAccountId, subAccountId);
            MAccount    acc = new MAccount();

            if (sub != null)
            {
                acc = (MAccount)DataMaster.GetObjectByProperty(typeof(MAccount), MAccount.ColumnNames.AccountId, sub.AccountId);
                if (acc == null)
                {
                    acc = new MAccount();
                }
            }
            else
            {
                sub = new MSubAccount();
            }

            if (acc.AccountStatus == listOfJournalStatus.ToString())
            {
                jur.AccountSaldo   = acc.AccountSaldo + GrandTotalNumericUpDown.Value;
                jur.SubAccontSaldo = sub.SubAccountSaldo + GrandTotalNumericUpDown.Value;
            }
            else
            {
                jur.AccountSaldo   = acc.AccountSaldo - GrandTotalNumericUpDown.Value;
                jur.SubAccontSaldo = sub.SubAccountSaldo - GrandTotalNumericUpDown.Value;
            }

            jur.JournalDate   = DateTime.Now;
            jur.JournalDesc   = namaTransaksi + transactionFacturTextBox.Text;
            jur.JournalJumlah = GrandTotalNumericUpDown.Value;
            jur.JournalPic    = transactionByTextBox.Text;
            jur.JournalStatus = listOfJournalStatus.ToString();
            jur.SubAccountId  = subAccountId;
            jur.ModifiedBy    = lbl_UserName.Text;
            jur.ModifiedDate  = DateTime.Now;
            DataMaster.SavePersistence(jur);

            //update saldo sub account
            sub.SubAccountSaldo = jur.SubAccontSaldo;
            sub.ModifiedBy      = lbl_UserName.Text;
            sub.ModifiedDate    = DateTime.Now;
            DataMaster.UpdatePersistence(sub);

            //update saldo account
            acc.AccountSaldo = jur.AccountSaldo;
            acc.ModifiedBy   = lbl_UserName.Text;
            acc.ModifiedDate = DateTime.Now;
            DataMaster.UpdatePersistence(acc);
        }
コード例 #27
0
 /*
  * private async void ShowDeleteCardContentDialog(SubMAccount account) {
  *  AcceptContentDialog acceptDeleteOperationContentDialog = new AcceptContentDialog("Czy chcesz usunąć kartę płatniczą? Zostaną usunięte wszystkie operacje skojażone z tą kartą.");
  *  ContentDialogResult result = await acceptDeleteOperationContentDialog.ShowAsync();
  *  if (result == ContentDialogResult.Primary)
  *      DeleteAccountWithOperations(account);
  * }
  */
 private void DeleteAccountWithOperations(MAccount account)
 {
     if (account is SubMAccount)
     {
         DeleteCardWithOperations((SubMAccount)account);
     }
     else
     {
         Accounts.Remove(Accounts.SingleOrDefault(i => i.MAccount.Id == account.Id));// /Remove(account);
     }
     MAccountsDal.RemoveAccountWithSubAccountsAndOperations(account);
 }
コード例 #28
0
        public BalanceAccountContentDialog(MAccount account)
        {
            InitializeComponent();
            _account          = account;
            _actualMoneyValue = _account.ActualMoneyValueDecimal;

            if (account is SubMAccount)
            {
                ParentAccountNameTextBlock.Visibility = Visibility.Visible;
                ParentAccountNameTextBlock.Text       = ((SubMAccount)account).ParentAccount.Name;
            }
        }
コード例 #29
0
        /// <summary>
        /// Save account
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="AD_Client_ID"></param>
        /// <param name="AD_Org_ID"></param>
        /// <param name="C_AcctSchema_ID"></param>
        /// <param name="AD_Account_ID"></param>
        /// <param name="C_SubAcct_ID"></param>
        /// <param name="M_Product_ID"></param>
        /// <param name="C_BPartner_ID"></param>
        /// <param name="AD_OrgTrx_ID"></param>
        /// <param name="C_LocFrom_ID"></param>
        /// <param name="C_LocTo_ID"></param>
        /// <param name="C_SRegion_ID"></param>
        /// <param name="C_Project_ID"></param>
        /// <param name="C_Campaign_ID"></param>
        /// <param name="C_Activity_ID"></param>
        /// <param name="User1_ID"></param>
        /// <param name="User2_ID"></param>
        /// <param name="Alias"></param>
        /// <returns></returns>
        public AccountingObjects SaveAccount(Ctx ctx, int AD_Client_ID, int AD_Org_ID, int C_AcctSchema_ID, int AD_Account_ID, int C_SubAcct_ID, int M_Product_ID,
                                             int C_BPartner_ID, int AD_OrgTrx_ID, int C_LocFrom_ID, int C_LocTo_ID, int C_SRegion_ID, int C_Project_ID, int C_Campaign_ID,
                                             int C_Activity_ID, int User1_ID, int User2_ID, string Alias)
        {
            AccountingObjects obj = new AccountingObjects();

            MAccount acct = MAccount.Get(ctx, AD_Client_ID, AD_Org_ID, C_AcctSchema_ID, AD_Account_ID, C_SubAcct_ID, M_Product_ID, C_BPartner_ID, AD_OrgTrx_ID,
                                         C_LocFrom_ID, C_LocTo_ID, C_SRegion_ID, C_Project_ID, C_Campaign_ID, C_Activity_ID, User1_ID, User2_ID, 0, 0);

            if (acct != null && acct.Get_ID() == 0)
            {
                acct.Save();
            }

            //  Show Info
            if (acct == null || acct.Get_ID() == 0)
            {
                obj = LoadInfo(0, 0);
            }
            else
            {
                //	Update Account with optional Alias
                bool found = false;
                if (Alias.Length > 0)
                {
                    String sql1 = "SELECT COUNT(*) FROM C_ValidCombination WHERE Alias='" + Alias + "'";
                    int    ii   = DB.GetSQLValue(null, sql1);

                    if (ii != 0)
                    {
                        found = true;
                    }
                    else
                    {
                        acct.SetAlias(Alias);
                        acct.Save();
                    }
                }

                if (found)
                {
                    obj.ErrorMsg = "DuplicateAlias";
                }
                else
                {
                    //obj = LoadInfo(acct.Get_ID(), C_AcctSchema_ID);
                    obj.C_ValidCombination_ID = acct.Get_ID();
                    obj.C_AcctSchema_ID       = C_AcctSchema_ID;
                }
            }
            return(obj);
        }
コード例 #30
0
        private void AccountToAccount(MAccountWithSubMAccounts oldAccount, MAccount newAccount)
        {
            // var accountWithSubMAccounts = Accounts.FirstOrDefault(i => Equals(i.MAccount, oldAccount.MAccount));
            // accountWithSubMAccounts.MAccount = newAccount;

            int index = Accounts.IndexOf(oldAccount);
            var accountWithSubMAccounts = Accounts.ElementAt(index);

            accountWithSubMAccounts.MAccount = newAccount;

            Accounts.RemoveAt(index);
            Accounts.Insert(index, accountWithSubMAccounts);
        }