private FinancialSalesOrManufactureExpenseSummary_Fact CreateFinancialSalesOrManufactureExpenseSummary( Session session, Guid OwnerOrgId, DateTime IssueDate, bool IsBalanceForward ) { FinancialSalesOrManufactureExpenseSummary_Fact result = new FinancialSalesOrManufactureExpenseSummary_Fact(session); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); DimBO dimBO = new DimBO(); result.MonthDimId = dimBO.GetMonthDim(session, (short)IssueDate.Month); result.YearDimId = dimBO.GetYearDim(session, (short)IssueDate.Year); result.OwnerOrgDimId = dimBO.GetOwnerOrgDim(session, OwnerOrgId); result.RowStatus = Constant.ROWSTATUS_ACTIVE; if (result.MonthDimId == null || result.YearDimId == null || result.OwnerOrgDimId == null) { return(null); } result.Save(); return(result); } catch (Exception) { return(null); } }
private GoodsInTransitForSaleSummary_Fact CreateGoodsInTransitForSaleSummary_Fact(Session session, Guid OwnerOrgId, DateTime IssueDate, string FinancialAccountCode, bool IsBalanceForward) { GoodsInTransitForSaleSummary_Fact result = new GoodsInTransitForSaleSummary_Fact(session); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); DimBO dimBO = new DimBO(); result.BeginCreditBalance = 0; result.BeginDebitBalance = 0; result.CreditSum = 0; result.DebitSum = 0; result.EndCreditBalance = 0; result.EndDebitBalance = 0; result.FinancialAccountDimId = accountingBO.GetFinancialAccountDim(session, FinancialAccountCode); result.MonthDimId = dimBO.GetMonthDim(session, (short)IssueDate.Month); result.YearDimId = dimBO.GetYearDim(session, (short)IssueDate.Year); result.OwnerOrgDimId = dimBO.GetOwnerOrgDim(session, OwnerOrgId); result.RowStatus = Constant.ROWSTATUS_ACTIVE; if (result.FinancialAccountDimId == null || result.MonthDimId == null || result.YearDimId == null || result.OwnerOrgDimId == null) { return(null); } var date = new DateTime(IssueDate.Year, IssueDate.Month, 1); GoodsInTransitForSaleSummary_Fact previousSummary = GetGoodsInTransitForSaleSummary_Fact(session, OwnerOrgId, date.AddMonths(-1), FinancialAccountCode); if (previousSummary != null) { result.BeginDebitBalance = previousSummary.EndDebitBalance; result.BeginCreditBalance = previousSummary.EndCreditBalance; } result.Save(); result.Save(); return(result); } catch (Exception) { return(null); } }
public FinancialOnTheWayBuyingGoodSummary CreateFinancialOnTheWayBuyingGoodSummary(Session session, Guid OwnerOrgId, DateTime IssueDate, string FinancialAccountCode) { FinancialOnTheWayBuyingGoodSummary result = new FinancialOnTheWayBuyingGoodSummary(session); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); FinancialAccountDim accountDim = accountingBO.GetFinancialAccountDim(session, FinancialAccountCode); DimBO dimBO = new DimBO(); MonthDim monthDim = dimBO.GetMonthDim(session, (short)IssueDate.Month); YearDim yearDim = dimBO.GetYearDim(session, (short)IssueDate.Year); OwnerOrgDim ownOrgDim = dimBO.GetOwnerOrgDim(session, OwnerOrgId); result.BeginBalance = 0; result.FinancialAccountDimId = accountDim != null ? accountDim : accountingBO.CreateFinancialAccountDim(session, FinancialAccountCode); result.MonthDimId = monthDim != null ? monthDim : dimBO.CreateMonthDim(session, (short)IssueDate.Month); result.YearDimId = yearDim != null ? yearDim : dimBO.CreateYearDim(session, (short)IssueDate.Year); result.OwnerOrgDimId = ownOrgDim != null ? ownOrgDim : dimBO.CreateOwnerOrgDim(session, OwnerOrgId); result.RowStatus = Constant.ROWSTATUS_ACTIVE; if (result.FinancialAccountDimId == null || result.MonthDimId == null || result.YearDimId == null || result.OwnerOrgDimId == null) { return(null); } var date = new DateTime(IssueDate.Year, IssueDate.Month, 1); FinancialOnTheWayBuyingGoodSummary previousSummary = GetFinancialOnTheWayBuyingGoodSummary(session, OwnerOrgId, date.AddMonths(-1), FinancialAccountCode); if (previousSummary != null) { result.BeginBalance = previousSummary.EndBalance; } result.Save(); return(result); } catch (Exception) { return(null); } }
public FinancialSupplierLiabilitySummary_Fact CreateFinnancialSupplierLiabilitySummaryFact(Session session, Guid OwnerOrgId, Guid SupplierOrgId, DateTime IssueDate, string FinancialAccountCode, bool IsBalanceForward) { FinancialSupplierLiabilitySummary_Fact result = new FinancialSupplierLiabilitySummary_Fact(session); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); DimBO dimBO = new DimBO(); result.BeginCreditBalance = 0; result.BeginDebitBalance = 0; result.CreditSum = 0; result.DebitSum = 0; result.EndCreditBalance = 0; result.EndDebitBalance = 0; result.FinancialAccountDimId = accountingBO.GetFinancialAccountDim(session, FinancialAccountCode); result.MonthDimId = dimBO.GetMonthDim(session, (short)IssueDate.Month); result.YearDimId = dimBO.GetYearDim(session, (short)IssueDate.Year); result.OwnerOrgDimId = dimBO.GetOwnerOrgDim(session, OwnerOrgId); result.RowStatus = Constant.ROWSTATUS_ACTIVE; result.SupplierOrgDimId = dimBO.GetSupplierOrgDim(session, SupplierOrgId); if (result.FinancialAccountDimId == null || result.MonthDimId == null || result.YearDimId == null || result.OwnerOrgDimId == null || result.SupplierOrgDimId == null) { return(null); } result.Save(); return(result); } catch (Exception) { return(null); } }
// Create public DiaryJournal_Fact CreateDiaryJournalFact(Session session, Guid OwnerOrgId, DateTime IssueDate, DiaryJournalTemplate diaryJournal, string accountCode) { DiaryJournal_Fact result = new DiaryJournal_Fact(session); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); DimBO dimBO = new DimBO(); result.FinancialAccountDimId = accountingBO.GetFinancialAccountDim(session, accountCode); result.MonthDimId = dimBO.GetMonthDim(session, (short)IssueDate.Month); result.YearDimId = dimBO.GetYearDim(session, (short)IssueDate.Year); result.OwnerOrgDimId = dimBO.GetOwnerOrgDim(session, OwnerOrgId); //result.CreditSum = 0; //result.DebitSum = 0; //result.BeginCreditBalance = 0; //result.BeginDebitBalance = 0; //result.EndCreditBalance = 0; //result.EndDebitBalance = 0; if (result.FinancialAccountDimId == null || result.MonthDimId == null || result.YearDimId == null || result.OwnerOrgDimId == null) { return(null); } result.Save(); } catch (Exception) { return(null); } return(result); }