/// <summary> /// Inserts the account balance. /// </summary> /// <param name="buPlanReceipt">The bu plan receipt.</param> /// <param name="buPlanReceiptDetail">The bu plan receipt detail.</param> public void InsertAccountBalance(BUPlanReceiptEntity buPlanReceipt, BUPlanReceiptDetailEntity buPlanReceiptDetail) { //insert AccountBalance for debit account var accountBalanceForDebit = AddAccountBalanceForDebit(buPlanReceipt, buPlanReceiptDetail); var accountBalanceForDebitExit = AccountBalanceDao.GetExitsAccountBalance(accountBalanceForDebit); if (accountBalanceForDebitExit != null) { UpdateAccountBalance(accountBalanceForDebitExit, accountBalanceForDebit.MovementDebitAmountOC, accountBalanceForDebit.MovementDebitAmount, true, 1); } else { AccountBalanceDao.InsertAccountBalance(accountBalanceForDebit); } }
public string InsertBUPlanReceiptDetail(BUPlanReceiptDetailEntity buPlanReceiptDetail) { const string procedures = @"uspInsert_BUPlanReceiptDetail"; return(Db.Insert(procedures, true, Take(buPlanReceiptDetail))); }
private static object[] Take(BUPlanReceiptDetailEntity bUPlanReceiptDetailEntity) { return(new object[] { "@RefDetailID", bUPlanReceiptDetailEntity.RefDetailId, "@RefID", bUPlanReceiptDetailEntity.RefId, "@Description", bUPlanReceiptDetailEntity.Description, "@BudgetSourceID", bUPlanReceiptDetailEntity.BudgetSourceId, "@BudgetKindItemCode", bUPlanReceiptDetailEntity.BudgetKindItemCode, "@BudgetSubKindItemCode", bUPlanReceiptDetailEntity.BudgetSubKindItemCode, "@BudgetGroupItemCode", bUPlanReceiptDetailEntity.BudgetGroupItemCode, "@BudgetParentItemCode", bUPlanReceiptDetailEntity.BudgetParentItemCode, "@BudgetItemCode", bUPlanReceiptDetailEntity.BudgetItemCode, "@BudgetSubItemCode", bUPlanReceiptDetailEntity.BudgetSubItemCode, "@DebitAccount", bUPlanReceiptDetailEntity.DebitAccount, "@Amount", bUPlanReceiptDetailEntity.Amount, "@AmountOC", bUPlanReceiptDetailEntity.AmountOC, "@ProjectID", bUPlanReceiptDetailEntity.ProjectId, "@ListItemID", bUPlanReceiptDetailEntity.ListItemId, "@SortOrder", bUPlanReceiptDetailEntity.SortOrder, "@BudgetDetailItemCode", bUPlanReceiptDetailEntity.BudgetDetailItemCode, "@FundStructureID", bUPlanReceiptDetailEntity.FundStructureId, "@BankID", bUPlanReceiptDetailEntity.BankId, "@ProjectActivityEAID", bUPlanReceiptDetailEntity.ProjectActivityEAId, "@AmountQuater1", bUPlanReceiptDetailEntity.AmountQuater1, "@AmountQuater1OC", bUPlanReceiptDetailEntity.AmountQuater1OC, "@AmountQuater2", bUPlanReceiptDetailEntity.AmountQuater2, "@AmountQuater2OC", bUPlanReceiptDetailEntity.AmountQuater2OC, "@AmountQuater3", bUPlanReceiptDetailEntity.AmountQuater3, "@AmountQuater3OC", bUPlanReceiptDetailEntity.AmountQuater3OC, "@AmountQuater4", bUPlanReceiptDetailEntity.AmountQuater4, "@AmountQuater4OC", bUPlanReceiptDetailEntity.AmountQuater4OC, "@AmountMonth1", bUPlanReceiptDetailEntity.AmountMonth1, "@AmountMonth1OC", bUPlanReceiptDetailEntity.AmountMonth1OC, "@AmountMonth2", bUPlanReceiptDetailEntity.AmountMonth2, "@AmountMonth2OC", bUPlanReceiptDetailEntity.AmountMonth2OC, "@AmountMonth3", bUPlanReceiptDetailEntity.AmountMonth3, "@AmountMonth3OC", bUPlanReceiptDetailEntity.AmountMonth3OC, "@AmountMonth4", bUPlanReceiptDetailEntity.AmountMonth4, "@AmountMonth4OC", bUPlanReceiptDetailEntity.AmountMonth4OC, "@AmountMonth5", bUPlanReceiptDetailEntity.AmountMonth5, "@AmountMonth5OC", bUPlanReceiptDetailEntity.AmountMonth5OC, "@AmountMonth6", bUPlanReceiptDetailEntity.AmountMonth6, "@AmountMonth6OC", bUPlanReceiptDetailEntity.AmountMonth6OC, "@AmountMonth7", bUPlanReceiptDetailEntity.AmountMonth7, "@AmountMonth7OC", bUPlanReceiptDetailEntity.AmountMonth7OC, "@AmountMonth8", bUPlanReceiptDetailEntity.AmountMonth8, "@AmountMonth8OC", bUPlanReceiptDetailEntity.AmountMonth8OC, "@AmountMonth9", bUPlanReceiptDetailEntity.AmountMonth9, "@AmountMonth9OC", bUPlanReceiptDetailEntity.AmountMonth9OC, "@AmountMonth10", bUPlanReceiptDetailEntity.AmountMonth10, "@AmountMonth10OC", bUPlanReceiptDetailEntity.AmountMonth10OC, "@AmountMonth11", bUPlanReceiptDetailEntity.AmountMonth11, "@AmountMonth11OC", bUPlanReceiptDetailEntity.AmountMonth11OC, "@AmountMonth12", bUPlanReceiptDetailEntity.AmountMonth12, "@AmountMonth12OC", bUPlanReceiptDetailEntity.AmountMonth12OC, "@BudgetProvideCode", bUPlanReceiptDetailEntity.BudgetProvideCode, "@MethodDistributeID", bUPlanReceiptDetailEntity.MethodDistributeId, "@ContractID", bUPlanReceiptDetailEntity.ContractId, "@CapitalPlanID", bUPlanReceiptDetailEntity.CapitalPlanId, "@BudgetChapterCode", bUPlanReceiptDetailEntity.BudgetChapterCode, "@ActivityID", bUPlanReceiptDetailEntity.ActivityId , }); }
public List <BUPlanReceiptDetailEntity> BuPlanReceiptDetails(List <BUPlanReceiptDetail> buPlanDetail, string refid) { List <BUPlanReceiptDetailEntity> lstBuPlanReceiptDetailEntities = new List <BUPlanReceiptDetailEntity>(); foreach (var buPlan in buPlanDetail) { var objBuPlanReceipt = new BUPlanReceiptDetailEntity(); objBuPlanReceipt.RefDetailId = buPlan.RefDetailID.ToString(); objBuPlanReceipt.RefId = refid; objBuPlanReceipt.Description = buPlan.Description; objBuPlanReceipt.BudgetSourceId = buPlan.BudgetSource == null ? null : buPlan.BudgetSource.BudgetSourceID.ToString(); objBuPlanReceipt.BudgetKindItemCode = buPlan.BudgetKindItemCode; objBuPlanReceipt.BudgetSubKindItemCode = buPlan.BudgetSubKindItemCode; objBuPlanReceipt.BudgetGroupItemCode = buPlan.BudgetGroupItemCode; objBuPlanReceipt.BudgetItemCode = buPlan.BudgetItemCode; objBuPlanReceipt.BudgetSubItemCode = buPlan.BudgetSubItemCode; objBuPlanReceipt.DebitAccount = buPlan.DebitAccount; objBuPlanReceipt.Amount = buPlan.Amount; objBuPlanReceipt.AmountOC = buPlan.AmountOC; objBuPlanReceipt.ProjectId = buPlan.Project == null ? null : buPlan.Project.ProjectID.ToString(); objBuPlanReceipt.ListItemId = buPlan.ListItem == null ? null : buPlan.ListItem.ListItemID.ToString(); objBuPlanReceipt.SortOrder = buPlan.SortOrder ?? 0; objBuPlanReceipt.BudgetDetailItemCode = buPlan.BudgetDetailItemCode; objBuPlanReceipt.FundStructureId = buPlan.FundStructure == null ? null : buPlan.FundStructure.FundStructureID.ToString(); objBuPlanReceipt.BankId = buPlan.BankAccount == null ? null : banks.FirstOrDefault(x => x.BankAccount == buPlan.BankAccount).BankInfoID.ToString(); objBuPlanReceipt.ProjectActivityEAId = buPlan.Project1 == null ? null : buPlan.Project1.ProjectID.ToString(); objBuPlanReceipt.AmountQuater1 = buPlan.AmountQuater1; objBuPlanReceipt.AmountQuater1OC = buPlan.AmountQuater1OC; objBuPlanReceipt.AmountQuater2 = buPlan.AmountQuater2; objBuPlanReceipt.AmountQuater2OC = buPlan.AmountQuater2OC; objBuPlanReceipt.AmountQuater3 = buPlan.AmountQuater3; objBuPlanReceipt.AmountQuater3OC = buPlan.AmountQuater3OC; objBuPlanReceipt.AmountQuater4 = buPlan.AmountQuater4; objBuPlanReceipt.AmountQuater4OC = buPlan.AmountQuater4OC; objBuPlanReceipt.AmountMonth1 = buPlan.AmountMonth1; objBuPlanReceipt.AmountMonth1OC = buPlan.AmountMonth1OC; objBuPlanReceipt.AmountMonth2 = buPlan.AmountMonth2; objBuPlanReceipt.AmountMonth2OC = buPlan.AmountMonth2OC; objBuPlanReceipt.AmountMonth3 = buPlan.AmountMonth3; objBuPlanReceipt.AmountMonth3OC = buPlan.AmountMonth3OC; objBuPlanReceipt.AmountMonth4 = buPlan.AmountMonth4; objBuPlanReceipt.AmountMonth4OC = buPlan.AmountMonth4OC; objBuPlanReceipt.AmountMonth5 = buPlan.AmountMonth5; objBuPlanReceipt.AmountMonth5OC = buPlan.AmountMonth5OC; objBuPlanReceipt.AmountMonth6 = buPlan.AmountMonth6; objBuPlanReceipt.AmountMonth6OC = buPlan.AmountMonth6OC; objBuPlanReceipt.AmountMonth7 = buPlan.AmountMonth7; objBuPlanReceipt.AmountMonth7OC = buPlan.AmountMonth7OC; objBuPlanReceipt.AmountMonth8 = buPlan.AmountMonth8; objBuPlanReceipt.AmountMonth8OC = buPlan.AmountMonth8OC; objBuPlanReceipt.AmountMonth9 = buPlan.AmountMonth9; objBuPlanReceipt.AmountMonth9OC = buPlan.AmountMonth9OC; objBuPlanReceipt.AmountMonth10 = buPlan.AmountMonth10; objBuPlanReceipt.AmountMonth10OC = buPlan.AmountMonth10OC; objBuPlanReceipt.AmountMonth11 = buPlan.AmountMonth11; objBuPlanReceipt.AmountMonth11OC = buPlan.AmountMonth11OC; objBuPlanReceipt.AmountMonth12 = buPlan.AmountMonth12; objBuPlanReceipt.AmountMonth12OC = buPlan.AmountMonth12OC; objBuPlanReceipt.BudgetProvideCode = buPlan.BudgetProvidence == null ? null : buPlan.BudgetProvidence.BudgetProvideCode; //objBuPlanReceipt.MethodDistributeId = buPlan.m; //objBuPlanReceipt.BudgetParentItemCode = buPlan.BudgetDetailItemCode; lstBuPlanReceiptDetailEntities.Add(objBuPlanReceipt); } return(lstBuPlanReceiptDetailEntities); }
/// <summary> /// Adds the account balance for debit. /// </summary> /// <param name="buPlanReceipt">The bu plan receipt.</param> /// <param name="buPlanReceiptDetail">The bu plan receipt detail.</param> /// <returns></returns> public AccountBalanceEntity AddAccountBalanceForDebit(BUPlanReceiptEntity buPlanReceipt, BUPlanReceiptDetailEntity buPlanReceiptDetail) { return(new AccountBalanceEntity { AccountBalanceId = Guid.NewGuid().ToString(), AccountNumber = buPlanReceiptDetail.DebitAccount, CurrencyCode = buPlanReceipt.CurrencyCode, ExchangeRate = buPlanReceipt.ExchangeRate, BalanceDate = buPlanReceipt.PostedDate, MovementDebitAmountOC = buPlanReceiptDetail.AmountOC, MovementDebitAmount = buPlanReceiptDetail.Amount, MovementCreditAmountOC = 0, MovementCreditAmount = 0, BudgetSourceId = buPlanReceiptDetail.BudgetSourceId, BudgetChapterCode = buPlanReceipt.BudgetChapterCode, BudgetKindItemCode = buPlanReceiptDetail.BudgetKindItemCode, BudgetSubKindItemCode = buPlanReceiptDetail.BudgetSubKindItemCode, BudgetItemCode = buPlanReceiptDetail.BudgetItemCode, BudgetSubItemCode = buPlanReceiptDetail.BudgetSubItemCode, ProjectId = buPlanReceiptDetail.ProjectId, BankAccount = buPlanReceiptDetail.BankId, FundStructureId = buPlanReceiptDetail.FundStructureId, BudgetDetailItemCode = buPlanReceiptDetail.BudgetDetailItemCode }); }