public BankStatementDataModel GetAnualizedBankStatementDataModel(BankStatementDataModel model)
        {
            var annualModel = new BankStatementDataModel {
                DateFrom        = model.DateFrom,
                DateTo          = model.DateTo,
                Period          = model.Period,
                PeriodMonthsNum = model.PeriodMonthsNum
            };

            if (annualModel.DateFrom.HasValue && annualModel.DateTo.HasValue)
            {
                var days = (annualModel.DateTo.Value - annualModel.DateFrom.Value).TotalDays;

                if (days > 60 && days < 90)
                {
                    days = 90;                     // we get usually 90 of data
                }

                double annualMult = Math.Abs(days) < 1 ? 1 : 365.0 / days;
                annualModel.Revenues             = model.Revenues * annualMult;
                annualModel.Opex                 = model.Opex * annualMult;
                annualModel.Salaries             = model.Salaries * annualMult;
                annualModel.Tax                  = model.Tax * annualMult;
                annualModel.ActualLoansRepayment = model.ActualLoansRepayment * annualMult;
                annualModel.TotalValueAdded      = annualModel.Revenues - Math.Abs(annualModel.Opex);
                annualModel.Ebida                = annualModel.TotalValueAdded - Math.Abs(annualModel.Salaries) - Math.Abs(annualModel.Tax);
                annualModel.FreeCashFlow         = annualModel.Ebida - Math.Abs(annualModel.ActualLoansRepayment);
            }
            return(annualModel);
        }
Exemplo n.º 2
0
 public LoadVatReturnFullData(int nCustomerID, int nCustomerMarketplaceID)
 {
     m_nCustomerID            = nCustomerID;
     m_nCustomerMarketplaceID = nCustomerMarketplaceID;
     BankStatement            = new BankStatementDataModel();
     BankStatementAnnualized  = new BankStatementDataModel();
 }         // constructor
Exemplo n.º 3
0
        public void CalculateBankStatements(VatReturnRawData lastVatReturn, BankStatementDataModel bankStatement)
        {
            decimal box3 = 0;
            decimal box4 = 0;
            decimal box6 = 0;
            decimal box7 = 0;

            if (lastVatReturn != null)
            {
                foreach (KeyValuePair <string, Coin> vat in lastVatReturn.Data)
                {
                    if (vat.Key.Contains("(Box 3)"))
                    {
                        box3 = vat.Value.Amount;
                    }
                    else if (vat.Key.Contains("(Box 4)"))
                    {
                        box4 = vat.Value.Amount;
                    }
                    else if (vat.Key.Contains("(Box 6)"))
                    {
                        box6 = vat.Value.Amount;
                    }
                    else if (vat.Key.Contains("(Box 7)"))
                    {
                        box7 = vat.Value.Amount;
                    }
                }         // foreach
            }             // if

            var vatRevenues = 1 + (box6 == 0 ? 0 : (box3 / box6));
            var vatOpex     = 1 + (box7 == 0 ? 0 : (box4 / box7));

            BankStatement.Revenues          = vatRevenues == 0 ? bankStatement.Revenues : bankStatement.Revenues / (double)vatRevenues;
            BankStatement.Opex              = Math.Abs(vatOpex == 0 ? bankStatement.Opex : bankStatement.Opex / (double)vatOpex);
            BankStatement.TotalValueAdded   = bankStatement.Revenues - bankStatement.Opex;
            BankStatement.PercentOfRevenues = Math.Abs(bankStatement.Revenues - 0) < 0.01 ? 0 : bankStatement.TotalValueAdded / bankStatement.Revenues;
            BankStatement.Ebida             = bankStatement.TotalValueAdded + (bankStatement.Salaries + bankStatement.Tax);
            BankStatement.FreeCashFlow      = bankStatement.Ebida - bankStatement.ActualLoansRepayment;

            if (BankStatement.PeriodMonthsNum == 0)
            {
                return;
            }

            const int year = 12;

            BankStatementAnnualized.Revenues          = (BankStatement.Revenues / BankStatement.PeriodMonthsNum * year);
            BankStatementAnnualized.Opex              = (BankStatement.Opex / BankStatement.PeriodMonthsNum * year);
            BankStatementAnnualized.TotalValueAdded   = BankStatementAnnualized.Revenues - BankStatementAnnualized.Opex;
            BankStatementAnnualized.PercentOfRevenues = Math.Abs(BankStatementAnnualized.Revenues) < 0.01 ? 0 : BankStatementAnnualized.TotalValueAdded / BankStatementAnnualized.Revenues;
            BankStatementAnnualized.Salaries          = (BankStatement.Salaries / BankStatement.PeriodMonthsNum * year);
            BankStatementAnnualized.Tax   = (BankStatement.Tax / BankStatement.PeriodMonthsNum * year);
            BankStatementAnnualized.Ebida = BankStatementAnnualized.TotalValueAdded + (BankStatementAnnualized.Salaries + BankStatementAnnualized.Tax);
            BankStatementAnnualized.ActualLoansRepayment = (BankStatement.ActualLoansRepayment / BankStatement.PeriodMonthsNum * year);
            BankStatementAnnualized.FreeCashFlow         = BankStatementAnnualized.Ebida - BankStatementAnnualized.ActualLoansRepayment;
        } // CalculateBankStatements
        public BankStatementDataModel GetBankStatementDataModel()
        {
            var bankStatementDataModel = new BankStatementDataModel();

            if (yodlee.MinDateDict.Any() && yodlee.MinDateDict.Any())
            {
                var minDate = int.Parse(yodlee.MinDateDict.First().Key);
                var maxDate = int.Parse(yodlee.MaxDateDict.Last().Key);
                var from    = new DateTime(minDate / 100, minDate % 100, yodlee.MinDateDict.Last().Value);
                var to      = new DateTime(maxDate / 100, maxDate % 100, yodlee.MaxDateDict.Last().Value);
                bankStatementDataModel.PeriodMonthsNum      = ((to.Year - from.Year) * 12) + to.Month - from.Month;
                bankStatementDataModel.Period               = string.Format("{0} - {1}", from.ToString("MMM yy", CultureInfo.InvariantCulture), to.ToString("MMM yy", CultureInfo.InvariantCulture));
                bankStatementDataModel.Revenues             = yodlee.YodleeCashFlowReportModelDict.ContainsKey("1aRevenues") ? yodlee.YodleeCashFlowReportModelDict["1aRevenues"][TotalColumn] : 0;
                bankStatementDataModel.Opex                 = yodlee.YodleeCashFlowReportModelDict.ContainsKey("2aOpex") ? yodlee.YodleeCashFlowReportModelDict["2aOpex"][TotalColumn] : 0;
                bankStatementDataModel.Salaries             = yodlee.YodleeCashFlowReportModelDict.ContainsKey("3aSalaries and Tax") ? yodlee.YodleeCashFlowReportModelDict["3aSalaries and Tax"][TotalColumn] : 0;
                bankStatementDataModel.Tax                  = yodlee.YodleeCashFlowReportModelDict.ContainsKey("4aCorporate tax") ? yodlee.YodleeCashFlowReportModelDict["4aCorporate tax"][TotalColumn] : 0;
                bankStatementDataModel.ActualLoansRepayment = yodlee.YodleeCashFlowReportModelDict.ContainsKey("5aLoan Repayments") ? yodlee.YodleeCashFlowReportModelDict["5aLoan Repayments"][TotalColumn] : 0;
            }

            return(bankStatementDataModel);
        }