function getDividendsForOnePeriod(uint _startTime, uint _endTime, uint _investmentValue, uint _doublePercentsEnd) internal view returns(uint) {
        uint fullDaysForDividents = _endTime.sub(_startTime).div(oneDay);
        uint maxDividends = investors[msg.sender].fullInvestment.mul(130).div(100);
        uint maxDaysWithFullDividends = maxDividends.div(_investmentValue.mul(35).div(1000));
        uint maxDaysWithDoubleDividends = maxDividends.div(_investmentValue.mul(7).div(100));
        uint daysWithDoublePercents;

        if(_doublePercentsEnd != 0){
            daysWithDoublePercents = _doublePercentsEnd.sub(_startTime).div(oneDay);
        } else {
            daysWithDoublePercents = fullDaysForDividents;
        }

        uint dividends;

        if(daysWithDoublePercents > maxDaysWithDoubleDividends && !investors[msg.sender].withdrawn){
            dividends = _investmentValue.mul(7).div(100).mul(maxDaysWithDoubleDividends);
            dividends = dividends.add(_investmentValue.div(100).mul(daysWithDoublePercents.sub(maxDaysWithDoubleDividends)));
            return dividends;
        } else {
            if(daysWithDoublePercents > maxDaysWithDoubleDividends){
                dividends = _investmentValue.mul(7).div(100).mul(maxDaysWithDoubleDividends);
            } else {
                dividends = _investmentValue.mul(7).div(100).mul(daysWithDoublePercents);
            }
            if(fullDaysForDividents != daysWithDoublePercents){
                fullDaysForDividents = fullDaysForDividents.sub(daysWithDoublePercents);
            } else {
                return dividends;
            }

            maxDividends = maxDividends.sub(dividends);
            maxDaysWithFullDividends = maxDividends.div(_investmentValue.mul(35).div(1000));

            if(fullDaysForDividents > maxDaysWithFullDividends && !investors[msg.sender].withdrawn){
                dividends = dividends.add(_investmentValue.mul(35).div(1000).mul(maxDaysWithFullDividends));
                dividends = dividends.add(_investmentValue.mul(5).div(1000).mul(fullDaysForDividents.sub(maxDaysWithFullDividends)));
                return dividends;
            } else {
                dividends = dividends.add(_investmentValue.mul(35).div(1000).mul(fullDaysForDividents));
                return dividends;
            }
        }
    }