Exemplo n.º 1
0
        internal void SaveSplitted(YearMonth startYearMonth, YearMonth endYearMonth)
        {
            int monthsNo = endYearMonth.GetMonthsDiffrence(startYearMonth) + 1;

            decimal[] TEList            = Rounding.Divide(this._NewCosts.TE, monthsNo);
            decimal[] ProtoPartsList    = Rounding.Divide(this._NewCosts.ProtoParts, monthsNo);
            decimal[] ProtoToolingList  = Rounding.Divide(this._NewCosts.ProtoTooling, monthsNo);
            decimal[] TrialsList        = Rounding.Divide(this._NewCosts.Trials, monthsNo);
            decimal[] OtherExpensesList = Rounding.Divide(this._NewCosts.OtherExpenses, monthsNo);

            for (YearMonth currentYearMonth = new YearMonth(startYearMonth.Value); currentYearMonth.Value <= endYearMonth.Value; currentYearMonth.AddMonths(1))
            {
                int iteratorPosition = currentYearMonth.GetMonthsDiffrence(startYearMonth);
                RevisedBudgetOtherCosts currentOtherCost = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.TE;
                currentOtherCost.CostVal    = TEList[iteratorPosition];
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.ProtoParts;
                currentOtherCost.CostVal    = ProtoPartsList[iteratorPosition];
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.ProtoTooling;
                currentOtherCost.CostVal    = ProtoToolingList[iteratorPosition];
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.Trials;
                currentOtherCost.CostVal    = TrialsList[iteratorPosition];
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.OtherExpenses;
                currentOtherCost.CostVal    = OtherExpensesList[iteratorPosition];
                currentOtherCost.Save();
            }
        }
Exemplo n.º 2
0
        internal void SaveSplitted(YearMonth startYearMonth, YearMonth endYearMonth, bool isAssociateCurrency, int idCostCenter, int associateCurrency, CurrencyConverter converter)
        {
            int monthsNo = endYearMonth.GetMonthsDiffrence(startYearMonth) + 1;

            decimal[] TEList            = Rounding.Divide(this._NewCosts.TE, monthsNo);
            decimal[] ProtoPartsList    = Rounding.Divide(this._NewCosts.ProtoParts, monthsNo);
            decimal[] ProtoToolingList  = Rounding.Divide(this._NewCosts.ProtoTooling, monthsNo);
            decimal[] TrialsList        = Rounding.Divide(this._NewCosts.Trials, monthsNo);
            decimal[] OtherExpensesList = Rounding.Divide(this._NewCosts.OtherExpenses, monthsNo);

            for (YearMonth currentYearMonth = new YearMonth(startYearMonth.Value); currentYearMonth.Value <= endYearMonth.Value; currentYearMonth.AddMonths(1))
            {
                int iteratorPosition = currentYearMonth.GetMonthsDiffrence(startYearMonth);
                RevisedBudgetOtherCosts currentOtherCost = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.TE;
                currentOtherCost.CostVal    = TEList[iteratorPosition];

                //Apply the cost center currency if this is the case
                if (isAssociateCurrency)
                {
                    currentOtherCost.ApplyCostCenterCurrency(idCostCenter, associateCurrency, converter);
                }
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.ProtoParts;
                currentOtherCost.CostVal    = ProtoPartsList[iteratorPosition];

                //Apply the cost center currency if this is the case
                if (isAssociateCurrency)
                {
                    currentOtherCost.ApplyCostCenterCurrency(idCostCenter, associateCurrency, converter);
                }
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.ProtoTooling;
                currentOtherCost.CostVal    = ProtoToolingList[iteratorPosition];

                //Apply the cost center currency if this is the case
                if (isAssociateCurrency)
                {
                    currentOtherCost.ApplyCostCenterCurrency(idCostCenter, associateCurrency, converter);
                }
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.Trials;
                currentOtherCost.CostVal    = TrialsList[iteratorPosition];

                //Apply the cost center currency if this is the case
                if (isAssociateCurrency)
                {
                    currentOtherCost.ApplyCostCenterCurrency(idCostCenter, associateCurrency, converter);
                }
                currentOtherCost.Save();

                currentOtherCost            = CreateInstanceWithSameFlag(currentYearMonth);
                currentOtherCost.IdCostType = EOtherCostTypes.OtherExpenses;
                currentOtherCost.CostVal    = OtherExpensesList[iteratorPosition];

                //Apply the cost center currency if this is the case
                if (isAssociateCurrency)
                {
                    currentOtherCost.ApplyCostCenterCurrency(idCostCenter, associateCurrency, converter);
                }
                currentOtherCost.Save();
            }
        }