Пример #1
0
    public override string RenderValue()
    {
        var current  = CompanyStatisticsUtils.GetCurrentAnnualReport(Q);
        var previous = CompanyStatisticsUtils.GetPreviousAnnualReport(Q);

        var investorId = MyCompany.shareholder.Id;

        var currentReport  = current.Groups.Find(r => r.ShareholderId == investorId);
        var previousReport = previous.Groups.Find(r => r.ShareholderId == investorId);


        var prevCost = previousReport.Cost + 1;
        var currCost = currentReport.Cost + 1;

        var growthAbsolute = currCost - prevCost;
        var growthRelative = growthAbsolute * 100 / prevCost;

        bool isGrowth = growthAbsolute >= 0;
        var  color    = growthAbsolute >= 0 ? Colors.COLOR_POSITIVE : Colors.COLOR_NEGATIVE;

        //$"+23% growth (+$102.4M)"
        var relativeGrowthText = Format.Sign(growthRelative);                                // Visuals.Colorize(, color);

        var absoluteGrowthText = (isGrowth ? "+" : "") + Format.MinifyMoney(growthAbsolute); // Visuals.Colorize(, color);
        var change             = Visuals.DescribeValueWithText(growthAbsolute, "growth", "loss", "");

        // if company younger than 1 year
        if (growthRelative > 20000)
        {
            return(absoluteGrowthText);
        }

        return($"{absoluteGrowthText} {change} ({relativeGrowthText}%)");
    }
Пример #2
0
    public override void ViewRender()
    {
        base.ViewRender();

        var previousReport = CompanyStatisticsUtils.GetPreviousAnnualReport(Q);
        var currentReport  = CompanyStatisticsUtils.GetCurrentAnnualReport(Q);

        RenderHuman(previousReport, currentReport);
        RenderGroup(previousReport, currentReport);

        int CurrentIntYear = C.START_YEAR + CurrentIntDate / 360;

        CurrentYear.text = $"Results of year {CurrentIntYear - 1}";
    }