internal CallContext OfferSave(Offer entity, CallContext callContext) { CallContext resContext = new OfferBL().EntitySave <Offer>(entity, callContext); if (resContext.ResultCode == ETEMEnums.ResultEnum.Success && entity.InquiryNumber.Trim() == string.Empty) { entity.InquiryNumber = new SequenceBL().GetInquiryNumber(); new OfferBL().EntitySave <Offer>(entity, callContext, new List <string>() { "InquiryNumber" }); } return(resContext); }
internal void CreateExpenseGroupForOffer(int idOffer) { Offer offer = new OfferBL().GetEntityById(idOffer); SAPData sapData = new SAPDataBL().GetSAPDataByDateActiveTo(offer.OfferDate); List <Expense> listExpenseToBeSave = new List <Expense>(); if (sapData != null) { List <Expense> list = new ExpenseCalculationBL().LoadExpenseGroupByIdSAPData(sapData.idSAPData); } else { throw new ETEMModelException("Not found expenses. "); } }
internal Offer Recalculation(Offer offer, CallContext callContext) { Offer offerFromDB = GetEntityById(offer.idOffer); EntityToEntityInputOnly(offer, offerFromDB); callContext = new OfferBL().EntitySave <Offer>(offerFromDB, callContext); #region OfferProducitivity OfferProducitivity offerProducitivity = this.dbContext.OfferProducitivities.FirstOrDefault(o => o.idOffer == offer.idOffer); // TODO: Add code for recalculation of Producitivity offerProducitivity.PressProducitivity_TON_MH = offerProducitivity.PressProducitivity_TON_MH_Computable; offerProducitivity.QCProducitivity_TON_MH = offerProducitivity.QCProducitivity_TON_MH_Computable; offerProducitivity.COMetalProducitivity_TON_MH = offerProducitivity.COMetalProducitivity_TON_MH_Computable; offerProducitivity.PackagingProducitivity_TON_MH = offerProducitivity.PackagingProducitivity_TON_MH_Computable; callContext = new OfferProducitivityBL().EntitySave <OfferProducitivity>(offerProducitivity, callContext); #endregion return(offer); }
internal OfferOverviewResult LoadOfferOverviewByOfferId(int idOffer, CallContext resultContext) { OfferOverviewResult result = new OfferOverviewResult(); listOfferOverview = new List <OfferOverviewDataView>(); Offer offer = new OfferBL().GetEntityById(idOffer); productCost = new ProductCostBL().LoadProductCostsByOfferId(idOffer, resultContext); #region CostTable //Aluminum ProductCostDataView ProductCostLME = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "LME").FirstOrDefault(); ProductCostDataView ProductCostPREMIUM = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "PREMIUM").FirstOrDefault(); listOfferOverview.Add(new OfferOverviewDataView() { Name = "Aluminum", RowKeyIntCode = "Aluminum", OfferOverviewType = "CostTable", Indicator_Value = (ProductCostLME.Value_EUR_ton.HasValue ? ProductCostLME.Value_EUR_ton.Value : Decimal.Zero) + (ProductCostPREMIUM.Value_EUR_ton.HasValue ? ProductCostPREMIUM.Value_EUR_ton.Value : Decimal.Zero), RowType = ETEMEnums.DataRowType.Data }); //Commission ProductCostDataView ProductCostCommission = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "Commission").FirstOrDefault(); listOfferOverview.Add(new OfferOverviewDataView() { Name = "Commission", RowKeyIntCode = "CostTableCommission", OfferOverviewType = "CostTable", Indicator_Value = (ProductCostCommission.Value_EUR_ton.HasValue ? ProductCostCommission.Value_EUR_ton.Value : Decimal.Zero), RowType = ETEMEnums.DataRowType.Data }); //Transportation ProductCostDataView ProductCostTransportation = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "Transportation").FirstOrDefault(); listOfferOverview.Add(new OfferOverviewDataView() { Name = "Transportation", RowKeyIntCode = "Transportation", OfferOverviewType = "CostTable", Indicator_Value = (ProductCostTransportation.Value_EUR_ton.HasValue ? ProductCostTransportation.Value_EUR_ton.Value : Decimal.Zero), RowType = ETEMEnums.DataRowType.Data }); //Extrusion Conversion cost (without Aluminium) per ton ProductCostDataView ProductCostTotalExtrusionConversionCost = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "TotalExtrusionConversionCost").FirstOrDefault(); listOfferOverview.Add(new OfferOverviewDataView() { Name = "Extrusion conversion cost per ton", RowKeyIntCode = "TotalExtrusionConversionCost", OfferOverviewType = "CostTable", Indicator_Value = (ProductCostTotalExtrusionConversionCost.Value_EUR_ton.HasValue ? ProductCostTotalExtrusionConversionCost.Value_EUR_ton.Value : Decimal.Zero), RowType = ETEMEnums.DataRowType.Data }); //Packaging conversion cost per ton ProductCostDataView ProductCostTotalPackagingCost = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "TotalPackagingCost").FirstOrDefault(); listOfferOverview.Add(new OfferOverviewDataView() { Name = "Packaging conversion cost per ton", RowKeyIntCode = "TotalPackagingCost", OfferOverviewType = "CostTable", Indicator_Value = (ProductCostTotalPackagingCost.Value_EUR_ton.HasValue ? ProductCostTotalPackagingCost.Value_EUR_ton.Value : Decimal.Zero), RowType = ETEMEnums.DataRowType.Data }); //TOTAL COST //'=Aluminum+Commision+Transportation+Extrusion conversion cost per ton+Packaging conversion cost per ton listOfferOverview.Add(new OfferOverviewDataView() { Name = "TOTAL COST", RowKeyIntCode = "CostTableTotalCost", OfferOverviewType = "CostTable", Indicator_Value = listOfferOverview.Where(o => o.OfferOverviewType == "CostTable").Sum(s => s.Indicator_Value), RowType = ETEMEnums.DataRowType.Total }); #endregion #region SalesPrice //'=Gross margin (%), tab Inquiry data listOfferOverview.Add(new OfferOverviewDataView() { Name = "Gross margin (%)", RowKeyIntCode = "SalesPriceGrossMargin", OfferOverviewType = "SalesPrice", Indicator_Value = offer.GrossMargin.HasValue ? offer.GrossMargin.Value : Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); //'=TOTAL COST/(1-Gross margin (%)) try { listOfferOverview.Add(new OfferOverviewDataView() { Name = "Total sales price (EUR/ton)", RowKeyIntCode = "TotalSalesPrice_EUR_TON", OfferOverviewType = "SalesPrice", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "CostTableTotalCost").Indicator_Value / (1 - listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "SalesPriceGrossMargin").Indicator_Value / 100), RowType = ETEMEnums.DataRowType.Data }); } catch { listOfferOverview.Add(new OfferOverviewDataView() { Name = "Total sales price (EUR/ton)", RowKeyIntCode = "TotalSalesPrice_EUR_TON", OfferOverviewType = "SalesPrice", Indicator_Value = Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); } //Sales conversion (EUR/ton) //'=Total sales price (EUR/ton)-TOTAL COST listOfferOverview.Add(new OfferOverviewDataView() { Name = "Sales conversion (EUR/ton)", RowKeyIntCode = "SalesConversion_EUR_TON", OfferOverviewType = "SalesPrice", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalSalesPrice_EUR_TON").Indicator_Value - listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "CostTableTotalCost").Indicator_Value, RowType = ETEMEnums.DataRowType.Data }); //CONVERSION TO CUSTOMER (EUR/ton) //'=Total sales price (EUR/ton)-Aluminum listOfferOverview.Add(new OfferOverviewDataView() { Name = "CONVERSION TO CUSTOMER (EUR/ton)", RowKeyIntCode = "CONVERSION_TO_CUSTOMER_EUR_TON", OfferOverviewType = "SalesPrice", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalSalesPrice_EUR_TON").Indicator_Value - listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Aluminum").Indicator_Value, RowType = ETEMEnums.DataRowType.Data }); ////'=Savings rate %, tab Inquiry data //listOfferOverview.Add(new OfferOverviewDataView() //{ // Name = "Savings rate %", // RowKeyIntCode = "SavingsRate", // OfferOverviewType = "SalesPrice", // Indicator_Value = offer.SavingsRate.HasValue ? offer.SavingsRate.Value : Decimal.Zero, // RowType = ETEMEnums.DataRowType.Data //}); ////Total sales price with savings and discounts (EUR/ton) //listOfferOverview.Add(new OfferOverviewDataView() //{ // Name = "Total sales price with savings and discounts (EUR/ton)", // RowKeyIntCode = "TotalSalesPriceWithSavingsAndDiscounts_EUR_TON", // OfferOverviewType = "SalesPrice", // Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalSalesPrice_EUR_TON").Indicator_Value * // (1 + listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "SavingsRate").Indicator_Value / 100), // RowType = ETEMEnums.DataRowType.Data //}); //Target price (EUR/ton) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Target price (EUR/ton)", RowKeyIntCode = "TargetPrice_EUR_TON", OfferOverviewType = "SalesPrice", Indicator_Value = offer.TargetPrice_EUR_TON.HasValue ? offer.TargetPrice_EUR_TON.Value : Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); //Target price (EUR/ton) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Balance (EUR/ton)", RowKeyIntCode = "Balance_EUR_TON", OfferOverviewType = "SalesPrice", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TargetPrice_EUR_TON").Indicator_Value - listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalSalesPrice_EUR_TON").Indicator_Value, RowType = ETEMEnums.DataRowType.Data }); try { //Target price (EUR/ton) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Balance (%)", RowKeyIntCode = "Balance_Persent", OfferOverviewType = "SalesPrice", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Balance_EUR_TON").Indicator_Value / listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalSalesPrice_EUR_TON").Indicator_Value * 100, RowType = ETEMEnums.DataRowType.Data }); } catch { //Target price (EUR/ton) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Balance (%)", RowKeyIntCode = "Balance_Persent", OfferOverviewType = "SalesPrice", Indicator_Value = Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); } #endregion #region Summary Expenses //Commission listOfferOverview.Add(new OfferOverviewDataView() { Name = "Commission", RowKeyIntCode = "SummaryExpensesCommission", OfferOverviewType = "SummaryExpenses", Indicator_Value = offer.Commission_EUR_Computable, RowType = ETEMEnums.DataRowType.Data }); //Other material cost //''=(Cost of Billet Scrap, table Extrusion, tab Product cost+Material cost, table Packaging, tab Product cost+Cost of Consumed material Scrap, table Packaging, tab Product cost)*Tonnage listOfferOverview.Add(new OfferOverviewDataView() { Name = "Other material cost", RowKeyIntCode = "Other_Material_Cost", OfferOverviewType = "SummaryExpenses", Indicator_Value = ( GetPC_EUR_TON("Extrusion", "Cost_Of_Billet_Scrap") + GetPC_EUR_TON("Packaging", "MaterialCost") + GetPC_EUR_TON("Packaging", "CostOfConsumedMaterialScrap") ) * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Variable expenses //'=(Direct Labour, table Extrusion, tab Product cost+Variable Expenses, table Extrusion, tab Product cost+Direct Labour, table Packaging, tab Product cost+Variable Expenses,table listOfferOverview.Add(new OfferOverviewDataView() { Name = "Variable expenses", RowKeyIntCode = "Variable_Expenses", OfferOverviewType = "SummaryExpenses", Indicator_Value = ( GetPC_EUR_TON("Extrusion", "DirectLaborGroup") + GetPC_EUR_TON("Extrusion", "VariableExpenses") + GetPC_EUR_TON("Packaging", "DirectLaborGroup") + GetPC_EUR_TON("Packaging", "PackagingVariableExpenses") ) * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Fixed expenses //'=(Fixed Expenses, table Extrusion, tab Product cost+Fixed Expenses,table Packaging, tab Product cost)*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Fixed expenses", RowKeyIntCode = "Fixed_Expenses", OfferOverviewType = "SummaryExpenses", Indicator_Value = ( GetPC_EUR_TON("Extrusion", "FixedExpenses") + GetPC_EUR_TON("Packaging", "PackagingFixedExpenses") ) * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Depreciation //'=(Depreciation, table Extrusion, tab Product cost+Depreciation,table Packaging, tab Product cost)*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Depreciation", RowKeyIntCode = "Depreciation", OfferOverviewType = "SummaryExpenses", Indicator_Value = ( GetPC_EUR_TON("Extrusion", "Depreciation") + GetPC_EUR_TON("Packaging", "PackagingDepreciation") ) * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //LME //'=LME (EUR/ton), tab Inquiry data*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "LME", RowKeyIntCode = "LME", OfferOverviewType = "SummaryExpenses", Indicator_Value = offer.LME * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //PREMIUM //'=PREMIUM (EUR/ton), tab Inquiry data*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "PREMIUM", RowKeyIntCode = "PREMIUM", OfferOverviewType = "SummaryExpenses", Indicator_Value = offer.PREMIUM * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Production expenses //'=Commission+Other material cost+Variable expenses+Fixed expenses+Depreciation+LME+PREMIUM listOfferOverview.Add(new OfferOverviewDataView() { Name = "Production expenses", RowKeyIntCode = "Production_Expenses", OfferOverviewType = "SummaryExpenses", Indicator_Value = SumIndicatorValue(null, "SummaryExpensesCommission", "Other_Material_Cost", "Variable_Expenses", "Fixed_Expenses", "Depreciation", "LME", "PREMIUM"), RowType = ETEMEnums.DataRowType.Total }); //Administration //'=Commission+Other material cost+Variable expenses+Fixed expenses+Depreciation+LME+PREMIUM listOfferOverview.Add(new OfferOverviewDataView() { Name = "Administration", RowKeyIntCode = "SummaryExpensesAdministration", OfferOverviewType = "SummaryExpenses", Indicator_Value = GetPC_EUR_TON("SGAsAndFinancials", "AdministrationExpenses") * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Selling //'=Sales expenses, table SGA's and Financials, tab Product cost*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Selling", RowKeyIntCode = "SummaryExpensesSelling", OfferOverviewType = "SummaryExpenses", Indicator_Value = GetPC_EUR_TON("SGAsAndFinancials", "SalesExpenses") * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Financial fixed expenses //'=Financial fixed expenses, table SGA's and Financials, tab Product cost*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Financial fixed expenses", RowKeyIntCode = "Financial_Fixed_Expenses", OfferOverviewType = "SummaryExpenses", Indicator_Value = GetPC_EUR_TON("SGAsAndFinancials", "FinancialFixedExpenses") * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Financial variable expenses //'=Financial variable expenses, table SGA's and Financials, tab Product cost*Tonnage (kg)/1000 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Financial variable expenses", RowKeyIntCode = "Financial_Variable_Expenses", OfferOverviewType = "SummaryExpenses", Indicator_Value = GetPC_EUR_TON("SGAsAndFinancials", "FinancialVariableExpenses") * offer.Tonnage, RowType = ETEMEnums.DataRowType.Data }); //Non Production expenses //'=Administration+Selling+Financial fixed expenses+Financial variable expenses listOfferOverview.Add(new OfferOverviewDataView() { Name = "Non Production expenses", RowKeyIntCode = "Non_Production_expenses", OfferOverviewType = "SummaryExpenses", Indicator_Value = SumIndicatorValue("SummaryExpenses", "SummaryExpensesAdministration", "SummaryExpensesSelling", "Financial_Fixed_Expenses", "Financial_Variable_Expenses"), RowType = ETEMEnums.DataRowType.Total }); #endregion #region ETEM CALCULATIONS //Length of final PC (mm) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Length of final PC (mm)", RowKeyIntCode = "LengthOfFinalPC", OfferOverviewType = "EtemCalculations", Indicator_Value = offer.LengthOfFinalPC.HasValue ? offer.LengthOfFinalPC.Value : Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); //Tonnage (kg) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Tonnage (kg)", RowKeyIntCode = "Tonnage_KG", OfferOverviewType = "EtemCalculations", Indicator_Value = offer.Tonnage.HasValue ? offer.Tonnage.Value * 1000: Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); //'=Pcs for the whole project, tab Inquiry data listOfferOverview.Add(new OfferOverviewDataView() { Name = "Pcs for the whole project", RowKeyIntCode = "PcsForTheWholeProject", OfferOverviewType = "EtemCalculations", Indicator_Value = offer.PcsForTheWholeProject.HasValue ? offer.PcsForTheWholeProject.Value : Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); //'Price EUR/PC //'=Total sales price (EUR/ton)/1000*Weight per PC (kg), tab Inquiry data listOfferOverview.Add(new OfferOverviewDataView() { Name = "Price EUR/PC", RowKeyIntCode = "Price_EUR_PC", OfferOverviewType = "EtemCalculations", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalSalesPrice_EUR_TON").Indicator_Value * (offer.WeightPerPC.HasValue ? offer.WeightPerPC.Value : Decimal.Zero) / 1000, RowType = ETEMEnums.DataRowType.Data }); //'Total cost EUR/PC (excl. SGA) //'=Total Cost (incl. Extrusion, Packaging, Transportation and Commission)/1000*Weight per PC (kg), tab Inquiry data ProductCostDataView ProductCostTotalCostExtrusionPackagingTransportationAndCommission = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "TotalCostExtrusionPackagingTransportationAndCommission").FirstOrDefault(); listOfferOverview.Add(new OfferOverviewDataView() { Name = "Total cost EUR/PC (excl. SGA)", RowKeyIntCode = "Total_Cost_EUR_PC_Excl_SGA", OfferOverviewType = "EtemCalculations", Indicator_Value = ProductCostTotalCostExtrusionPackagingTransportationAndCommission.Value_EUR_PC, RowType = ETEMEnums.DataRowType.Data }); //Gross (%) //=(Price EUR/PC-Total cost EUR/PC (excl. SGA))/Price EUR/PC*100 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Gross (%)", RowKeyIntCode = "EtemCalculationsGross", OfferOverviewType = "EtemCalculations", Indicator_Value = CalcPercentByListOfferIndicator(listOfferOverview, "Price_EUR_PC", "Total_Cost_EUR_PC_Excl_SGA"), RowType = ETEMEnums.DataRowType.Data }); ProductCostDataView ProductCostTotalCost = productCost.ListProductCosts.Where(p => p.RowKeyIntCode == "TotalCost").FirstOrDefault(); //Total cost EUR/PC (incl. SGA, Finance, etc.) //'=TOTAL COST (EUR/ton) (incl. Extrusion, Packaging, Transportation and Commission, SGA's and Financials), tab Product cost/1000*Weight per PC (kg), tab Inquiry data listOfferOverview.Add(new OfferOverviewDataView() { Name = "Total cost EUR/PC (incl. SGA, Finance, etc.)", RowKeyIntCode = "TotalCost_EUR_PC_incl_SGA_Finance_etc", OfferOverviewType = "EtemCalculations", Indicator_Value = ProductCostTotalCost.Value_EUR_PC, RowType = ETEMEnums.DataRowType.Data }); //Net Profit (%) //'=(Price EUR/PC-Total cost EUR/PC (+SGA, Finance, etc))/Price EUR/PC*100 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Net Profit (%)", RowKeyIntCode = "Net_Profit_Percent_PC", OfferOverviewType = "EtemCalculations", Indicator_Value = CalcPercentByListOfferIndicator(listOfferOverview, "Price_EUR_PC", "TotalCost_EUR_PC_incl_SGA_Finance_etc"), RowType = ETEMEnums.DataRowType.Data }); Decimal price_EUR_PC = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Price_EUR_PC").Indicator_Value.HasValue?listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Price_EUR_PC").Indicator_Value.Value:Decimal.Zero; //Turnover (EUR) //'=Price EUR/PC*Pcs for the whole project listOfferOverview.Add(new OfferOverviewDataView() { Name = "Turnover (EUR)", RowKeyIntCode = "Turnover_EUR", OfferOverviewType = "EtemCalculations", Indicator_Value = price_EUR_PC * offer.PcsForTheWholeProject, RowType = ETEMEnums.DataRowType.Data }); //Total cost (EUR) (excl. SGA) //Total cost EUR/PC (excl. SGA)*Pcs for the whole project listOfferOverview.Add(new OfferOverviewDataView() { Name = "Total cost (EUR) (excl. SGA)", RowKeyIntCode = "Total_Cost_EUR_excl_SGA", OfferOverviewType = "EtemCalculations", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Total_Cost_EUR_PC_Excl_SGA").Indicator_Value *offer.PcsForTheWholeProject, RowType = ETEMEnums.DataRowType.Data }); //Gross (%) //'=(Turnover (EUR)-Total cost (EUR) (excl. SGA))/Turnover (EUR)*100 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Gross (%)", RowKeyIntCode = "EtemCalculationsGrossTurnover", OfferOverviewType = "EtemCalculations", Indicator_Value = CalcPercentByListOfferIndicator(listOfferOverview, "Turnover_EUR", "Total_Cost_EUR_excl_SGA"), RowType = ETEMEnums.DataRowType.Data }); //Total cost EUR (incl. SGA, Finance, etc.) //Total cost EUR/PC (incl. SGA, Finance, etc.)*Pcs for the whole project listOfferOverview.Add(new OfferOverviewDataView() { Name = "Total cost EUR (incl. SGA, Finance, etc.)", RowKeyIntCode = "TotalCost_EUR_PC_incl_SGA_Finance_etc_PcsForTheWholeProject", OfferOverviewType = "EtemCalculations", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalCost_EUR_PC_incl_SGA_Finance_etc").Indicator_Value *offer.PcsForTheWholeProject, RowType = ETEMEnums.DataRowType.Data }); //Net profit (EUR) //'=Turnover (EUR)-Total cost EUR (incl. SGA, Finance, etc.) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Net profit (EUR)", RowKeyIntCode = "Net_profit_EUR", OfferOverviewType = "EtemCalculations", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Turnover_EUR").Indicator_Value - listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "TotalCost_EUR_PC_incl_SGA_Finance_etc_PcsForTheWholeProject").Indicator_Value, RowType = ETEMEnums.DataRowType.Data }); //Net profit (%) //'=(Turnover (EUR)-Total cost EUR (incl. SGA, Finance, etc.))/Turnover (EUR)*100 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Net profit (%)", RowKeyIntCode = "Net_Profit_Percent_Turnover", OfferOverviewType = "EtemCalculations", Indicator_Value = CalcPercentByListOfferIndicator(listOfferOverview, "Turnover_EUR", "TotalCost_EUR_PC_incl_SGA_Finance_etc_PcsForTheWholeProject"), RowType = ETEMEnums.DataRowType.Data }); //Conversion (EUR) //'=Sales conversion (EUR/ton)/1000*Tonnage (kg) listOfferOverview.Add(new OfferOverviewDataView() { Name = "Conversion (EUR)", RowKeyIntCode = "ConversionTonnage", OfferOverviewType = "EtemCalculations", Indicator_Value = listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "SalesConversion_EUR_TON").Indicator_Value / 1000 * listOfferOverview.FirstOrDefault(p => p.RowKeyIntCode == "Tonnage_KG").Indicator_Value, RowType = ETEMEnums.DataRowType.Data }); //Net Conversion (EUR) //=Conversion (EUR)-Non Production expenses listOfferOverview.Add(new OfferOverviewDataView() { Name = "Net Conversion (EUR)", RowKeyIntCode = "Net_Conversion_EUR", OfferOverviewType = "EtemCalculations", Indicator_Value = SumIndicatorValue("EtemCalculations", "ConversionTonnage") - SumIndicatorValue("SummaryExpenses", "Non_Production_expenses"), RowType = ETEMEnums.DataRowType.Data }); //Contribution margin (EUR) //'=Turnover (EUR)-Production expenses+Fixed expenses listOfferOverview.Add(new OfferOverviewDataView() { Name = "Contribution margin (EUR)", RowKeyIntCode = "Contribution_Margin_EUR", OfferOverviewType = "EtemCalculations", Indicator_Value = SumIndicatorValue("EtemCalculations", "Turnover_EUR") + SumIndicatorValue("SummaryExpenses", "Fixed_Expenses") - SumIndicatorValue("SummaryExpenses", "Production_Expenses"), RowType = ETEMEnums.DataRowType.Data }); try { //Marginal Contribution (%) //'=Contribution margin (EUR)/Turnover (EUR)*100 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Marginal Contribution (%)", RowKeyIntCode = "Marginal_Contribution_Percent", OfferOverviewType = "EtemCalculations", Indicator_Value = SumIndicatorValue("EtemCalculations", "Contribution_Margin_EUR") / SumIndicatorValue("EtemCalculations", "Turnover_EUR") * 100, RowType = ETEMEnums.DataRowType.Data }); } catch { //Marginal Contribution (%) //'=Contribution margin (EUR)/Turnover (EUR)*100 listOfferOverview.Add(new OfferOverviewDataView() { Name = "Marginal Contribution (%)", RowKeyIntCode = "Marginal_Contribution_Percent", OfferOverviewType = "EtemCalculations", Indicator_Value = Decimal.Zero, RowType = ETEMEnums.DataRowType.Data }); } //EBITDA //'=Net profit (EUR)+Financial fixed expenses+Financial variable expenses+Depreciation listOfferOverview.Add(new OfferOverviewDataView() { Name = "EBITDA (EUR)", RowKeyIntCode = "EBITDA", OfferOverviewType = "EtemCalculations", Indicator_Value = SumIndicatorValue("EtemCalculations", "Net_profit_EUR") + SumIndicatorValue("SummaryExpenses", "Financial_Fixed_Expenses", "Financial_Variable_Expenses", "Depreciation"), RowType = ETEMEnums.DataRowType.Data }); #endregion result.ListOfferOverview.AddRange(listOfferOverview); return(result); }
public Dictionary <string, TableRow[]> LoadOfferDataCostCenterAndExpensesType(int idOffer, ETEMEnums.CalculationType calculationType, CallContext resultContext) { Dictionary <string, TableRow[]> result = new Dictionary <string, TableRow[]>(); try { List <string> listKeyTypeIntCodes = new List <string>() { ETEMEnums.KeyTypeEnum.CostCenter.ToString(), ETEMEnums.KeyTypeEnum.ExpensesTypeGroup.ToString(), }; List <KeyValueDataView> listKeyValuesToSAPDataCostCenterAndExpensesTypeGroup = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueCostCenter = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueExpensesTypeGroup = new List <KeyValueDataView>(); listKeyValuesToSAPDataCostCenterAndExpensesTypeGroup = (from kv in this.dbContext.KeyValues join kt in this.dbContext.KeyTypes on kv.idKeyType equals kt.idKeyType where listKeyTypeIntCodes.Contains(kt.KeyTypeIntCode) orderby kv.V_Order ascending select new KeyValueDataView { idKeyValue = kv.idKeyValue, Name = kv.Name, NameEN = kv.NameEN, DefaultValue1 = kv.DefaultValue1, KeyValueIntCode = kv.KeyValueIntCode, KeyTypeIntCode = kt.KeyTypeIntCode } ).ToList <KeyValueDataView>(); List <OfferDataExpenseGroupView> listGroupExpense = GetAllOfferDataExpenseGroupByOffer(idOffer); Offer offer = new OfferBL().GetEntityById(idOffer); OfferProducitivity offerProducitivity = new OfferProducitivityBL().GetOfferProducitivityByOfferID(idOffer); List <int> listIdCostCenter = listGroupExpense.DistinctBy(k => k.idCostCenter).Select(k => k.idCostCenter).ToList(); listKeyValueCostCenter = listKeyValuesToSAPDataCostCenterAndExpensesTypeGroup.Where(w => listIdCostCenter.Contains(w.idKeyValue)).ToList(); listKeyValueExpensesTypeGroup = listKeyValuesToSAPDataCostCenterAndExpensesTypeGroup.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.ExpensesTypeGroup.ToString()).ToList(); int countRows = listKeyValueExpensesTypeGroup.Count + 3; if (calculationType == ETEMEnums.CalculationType.EUR_TON) { countRows = listKeyValueExpensesTypeGroup.Count + 4; } TableRow[] arrExpensesTypeGroup = new TableRow[countRows]; TableRow tableRow = new TableRow(); TableCell tableCell = new TableCell(); TableHeaderRow tableHeaderRow = new TableHeaderRow(); TableHeaderCell tableHeaderCell = new TableHeaderCell(); int rowIndex = 0; #region Expenses by Cost Centers (EUR/MH) string eurTonMHbr = string.Empty; string eurTonMH = string.Empty; int columnSpan = 2; if (calculationType == ETEMEnums.CalculationType.EUR_MH) { eurTonMHbr = "<br/>(EUR/MH)"; eurTonMH = "(EUR/MH)"; columnSpan--; } else { eurTonMHbr = "<br/>(EUR/ton)"; eurTonMH = "(EUR/ton)"; } tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Expenses by Cost Centers " + eurTonMH; tableHeaderCell.ColumnSpan = listIdCostCenter.Count + columnSpan; tableHeaderCell.CssClass = "GridExpenses_tr_th_Main"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpensesTypeGroup[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); if (calculationType == ETEMEnums.CalculationType.EUR_TON) { tableHeaderCell.Text = "Expenses " + eurTonMHbr; } else { tableHeaderCell.Text = "Expenses"; } tableHeaderCell.Width = Unit.Pixel(320); tableHeaderRow.Cells.Add(tableHeaderCell); arrExpensesTypeGroup[rowIndex] = tableHeaderRow; #region Add header and footer columns and rows //Calculate tableHeaderCell width int headerWidth; if (calculationType == ETEMEnums.CalculationType.EUR_MH) { headerWidth = (int)(100 / (listKeyValueCostCenter.Count + 1)); } else { headerWidth = (int)(100 / (listKeyValueCostCenter.Count + 2)); } // Add header columns foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { if (kvCostCenter.DefaultValue1 == "Packaging" && calculationType == ETEMEnums.CalculationType.EUR_TON) { //add total extrusion column if (calculationType == ETEMEnums.CalculationType.EUR_TON) { //TotalColumn tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Total Extrusion " + eurTonMHbr; //В офертата да направим колоните в таблиците с разходите с еднакъв размер tableHeaderCell.Width = new Unit(headerWidth.ToString() + "%"); arrExpensesTypeGroup[rowIndex].Cells.Add(tableHeaderCell); } } tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = kvCostCenter.Name; //В офертата да направим колоните в таблиците с разходите с еднакъв размер tableHeaderCell.Width = new Unit(headerWidth.ToString() + "%"); if (kvCostCenter.DefaultValue1 == "DIES" && calculationType == ETEMEnums.CalculationType.EUR_MH) { tableHeaderCell.Text += "<br/>" + "(EUR/kg)"; } arrExpensesTypeGroup[rowIndex].Cells.Add(tableHeaderCell); } //add total extrusion column //if (calculationType == ETEMEnums.CalculationType.EUR_TON) //{ // //TotalColumn // tableHeaderCell = new TableHeaderCell(); // tableHeaderCell.Text = "Total Extrusion " + eurTonMH; // //В офертата да направим колоните в таблиците с разходите с еднакъв размер // tableHeaderCell.Width = new Unit(headerWidth.ToString() + "%"); // arrExpensesTypeGroup[rowIndex].Cells.Add(tableHeaderCell); //} rowIndex++; // Add header rows foreach (KeyValueDataView kvExpensesTypeGroup in listKeyValueExpensesTypeGroup) { tableRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = kvExpensesTypeGroup.Name.Replace("group", ""); tableRow.Cells.Add(tableCell); arrExpensesTypeGroup[rowIndex++] = tableRow; } int i = 0; if (calculationType == ETEMEnums.CalculationType.EUR_TON) { TableRow tableFooterRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = "Die depreciation"; tableFooterRow.Cells.Add(tableCell); arrExpensesTypeGroup[rowIndex] = tableFooterRow; rowIndex++; i++; } TableRow tableFooterTotalRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = "Total " + eurTonMH; tableCell.Font.Bold = true; tableCell.CssClass = "MainGrid_td_item_right GridExpenses_td_background_yellow"; tableFooterTotalRow.Cells.Add(tableCell); arrExpensesTypeGroup[rowIndex] = tableFooterTotalRow; #endregion Dictionary <string, decimal> dictTotalByColl = new Dictionary <string, decimal>(); decimal totalByRowTon = decimal.Zero; decimal currValue = decimal.Zero; decimal totalByTotalRow = decimal.Zero; rowIndex = rowIndex - (listKeyValueExpensesTypeGroup.Count + i); foreach (KeyValueDataView kvExpensesTypeGroup in listKeyValueExpensesTypeGroup) { totalByRowTon = decimal.Zero; foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "MainGrid_td_item_right"; var currGroupExpense = listGroupExpense.Where(w => w.idExpensesType == kvExpensesTypeGroup.idKeyValue && w.idCostCenter == kvCostCenter.idKeyValue).FirstOrDefault(); if (currGroupExpense != null) { currValue = Convert.ToDecimal(currGroupExpense.ValueData); if (dictTotalByColl.ContainsKey(kvCostCenter.KeyValueIntCode)) { if (calculationType == ETEMEnums.CalculationType.EUR_MH) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; } else if (calculationType == ETEMEnums.CalculationType.EUR_TON) { #region EUR_TON if (kvCostCenter.DefaultValue1 == "Press") { if (offerProducitivity != null && offerProducitivity.PressProducitivity_TON_MH != decimal.Zero) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue / offerProducitivity.PressProducitivity_TON_MH; currValue = currValue / offerProducitivity.PressProducitivity_TON_MH; } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; } totalByRowTon += currValue; } else if (kvCostCenter.DefaultValue1 == "COMETAL") { if (offerProducitivity != null && offerProducitivity.COMetalProducitivity_TON_MH != decimal.Zero) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue / offerProducitivity.COMetalProducitivity_TON_MH; currValue = currValue / offerProducitivity.COMetalProducitivity_TON_MH; } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; } totalByRowTon += currValue; } else if (kvCostCenter.DefaultValue1 == "QualityControl") { if (offerProducitivity != null && offerProducitivity.QCProducitivity_TON_MH != decimal.Zero) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue / offerProducitivity.QCProducitivity_TON_MH; currValue = currValue / offerProducitivity.QCProducitivity_TON_MH; } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; } totalByRowTon += currValue; } else if (kvCostCenter.DefaultValue1 == "Packaging") { /// //fill total in each row TableCell tableCellTotal = new TableCell(); tableCellTotal.Text = totalByRowTon.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); totalByTotalRow += totalByRowTon; tableCellTotal.Font.Bold = true; tableCellTotal.CssClass = "MainGrid_td_item_right GridExpenses_td_background_yellow"; arrExpensesTypeGroup[rowIndex].Cells.Add(tableCellTotal); /// if (offerProducitivity != null && offerProducitivity.PackagingProducitivity_TON_MH != decimal.Zero) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue / offerProducitivity.PackagingProducitivity_TON_MH; currValue = currValue / offerProducitivity.PackagingProducitivity_TON_MH; } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; } } else if (kvCostCenter.DefaultValue1 == "DIES") { //for Direct depreciation Expenses //offer.CostOfDie if (kvExpensesTypeGroup.KeyValueIntCode != "DirectDepreciationGroup") { currValue = currValue * 1000; dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; //For DIES Department formula is different: '=Value (EUR/kg)*1000 } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += decimal.Zero; currValue = decimal.Zero; } totalByRowTon += currValue; } #endregion } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += decimal.Zero; } } else { if (calculationType == ETEMEnums.CalculationType.EUR_MH) { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } else if (calculationType == ETEMEnums.CalculationType.EUR_TON) { #region EUR_TON if (kvCostCenter.DefaultValue1 == "Press") { if (offerProducitivity != null && offerProducitivity.PressProducitivity_TON_MH != decimal.Zero) { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue / offerProducitivity.PressProducitivity_TON_MH); currValue = currValue / offerProducitivity.PressProducitivity_TON_MH; } else { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } totalByRowTon += currValue; } else if (kvCostCenter.DefaultValue1 == "COMETAL") { if (offerProducitivity != null && offerProducitivity.COMetalProducitivity_TON_MH != decimal.Zero) { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue / offerProducitivity.COMetalProducitivity_TON_MH); currValue = currValue / offerProducitivity.COMetalProducitivity_TON_MH; } else { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } totalByRowTon += currValue; } else if (kvCostCenter.DefaultValue1 == "QualityControl") { if (offerProducitivity != null && offerProducitivity.QCProducitivity_TON_MH != decimal.Zero) { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue / offerProducitivity.QCProducitivity_TON_MH); currValue = currValue / offerProducitivity.QCProducitivity_TON_MH; } else { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } totalByRowTon += currValue; } else if (kvCostCenter.DefaultValue1 == "Packaging") { /// //fill total in each row TableCell tableCellTotal = new TableCell(); tableCellTotal.Text = totalByRowTon.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); totalByTotalRow += totalByRowTon; tableCellTotal.Font.Bold = true; tableCellTotal.CssClass = "MainGrid_td_item_right GridExpenses_td_background_yellow"; arrExpensesTypeGroup[rowIndex].Cells.Add(tableCellTotal); /// if (offerProducitivity != null && offerProducitivity.PackagingProducitivity_TON_MH != decimal.Zero) { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue / offerProducitivity.PackagingProducitivity_TON_MH); currValue = currValue / offerProducitivity.PackagingProducitivity_TON_MH; } else { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } } else if (kvCostCenter.DefaultValue1 == "DIES") { //for Direct depreciation Expenses //offer.CostOfDie //dictTotalByColl[kvCostCenter.KeyValueIntCode] = currValue * 1000; //For DIES Department formula is different: '=Value (EUR/kg)*1000 if (kvExpensesTypeGroup.KeyValueIntCode != "DirectDepreciationGroup") { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue * 1000); //For DIES Department formula is different: '=Value (EUR/kg)*1000 currValue = currValue * 1000; } else { currValue = decimal.Zero; dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } totalByRowTon += currValue; } #endregion } else { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, decimal.Zero); } } tableCell.Text = currValue.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); arrExpensesTypeGroup[rowIndex].Cells.Add(tableCell); } } ////fill total in each row //if (calculationType == ETEMEnums.CalculationType.EUR_TON) //{ // tableCell = new TableCell(); // tableCell.Text = totalByRowTon.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); // totalByTotalRow += totalByRowTon; // tableCell.Font.Bold = true; // tableCell.CssClass = "MainGrid_td_item_right"; // arrExpensesTypeGroup[rowIndex].Cells.Add(tableCell); //} rowIndex++; } string dieDepreciation = decimal.Zero.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); //Fill cell in additional row 'Die depreciation' if (calculationType == ETEMEnums.CalculationType.EUR_TON) { foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "MainGrid_td_item_right"; if (kvCostCenter.DefaultValue1 == "DIES") { if (offer.CostOfDieEUR_Per_TON_Computable.HasValue) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += offer.CostOfDieEUR_Per_TON_Computable.Value; tableCell.Text = offer.CostOfDieEUR_Per_TON_Computable.Value.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); //dictTotalByColl[kvCostCenter.KeyValueIntCode].ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); totalByTotalRow += offer.CostOfDieEUR_Per_TON_Computable.Value; } else { dictTotalByColl[kvCostCenter.KeyValueIntCode] += decimal.Zero; tableCell.Text = decimal.Zero.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); } dieDepreciation = tableCell.Text; } else if (kvCostCenter.DefaultValue1 == "Packaging") { //fill total in Die depreciation row TableCell tableCellTotal = new TableCell(); tableCellTotal.Font.Bold = true; tableCellTotal.CssClass = "MainGrid_td_item_right GridExpenses_td_background_yellow"; tableCellTotal.Text = dieDepreciation; arrExpensesTypeGroup[rowIndex].Cells.Add(tableCellTotal); tableCell.Text = decimal.Zero.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); } else { tableCell.Text = decimal.Zero.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); } arrExpensesTypeGroup[rowIndex].Cells.Add(tableCell); } //fill total in Die depreciation row //tableCell = new TableCell(); //tableCell.Font.Bold = true; //tableCell.CssClass = "MainGrid_td_item_right"; //tableCell.Text = dieDepreciation; //arrExpensesTypeGroup[rowIndex].Cells.Add(tableCell); rowIndex++; } foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { if (kvCostCenter.DefaultValue1 == "Packaging" && calculationType == ETEMEnums.CalculationType.EUR_TON) { TableCell tableCellTotal = new TableCell(); tableCellTotal.Font.Bold = true; tableCellTotal.CssClass = "MainGrid_td_item_right GridExpenses_td_background_yellow"; tableCellTotal.Text = totalByTotalRow.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); arrExpensesTypeGroup[rowIndex].Cells.Add(tableCellTotal); } tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "MainGrid_td_item_right GridExpenses_td_background_yellow"; tableCell.Font.Bold = true; tableCell.Text = dictTotalByColl[kvCostCenter.KeyValueIntCode].ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); arrExpensesTypeGroup[rowIndex].Cells.Add(tableCell); } //fill cell total on Total Extrusion //if (calculationType == ETEMEnums.CalculationType.EUR_TON) //{ // tableCell = new TableCell(); // tableCell.Font.Bold = true; // tableCell.CssClass = "MainGrid_td_item_right"; // tableCell.Text = totalByTotalRow.ToString("N", BaseHelper.GetNumberFormatInfo(".", ",", 4)); // arrExpensesTypeGroup[rowIndex].Cells.Add(tableCell); //} #endregion result.Add("Expenses", arrExpensesTypeGroup); } catch (Exception ex) { resultContext.Message = "Error load SAP data expenses and quantities!"; BaseHelper.Log("Error load SAP data expenses and quantities!"); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } return(result); }